Commit f6b548cb authored by 田翔's avatar 田翔

fix: 人员选择器,部门选择器支持ID存储

parent bd8fd13d
{
"name": "panda-xform",
"version": "1.5.7",
"description": "1.5.7: 关联表单完善",
"version": "1.5.8",
"description": "1.5.8: 人员选择器,部门选择器支持ID存储",
"keywords": [
"panda-xform"
],
......
......@@ -120,14 +120,14 @@ const globalSettings = {
displayType: 'row',
labelWidth: 70,
},
interfaceName: {
title: '接口',
type: 'string',
widget: 'htmlInput',
displayType: 'row',
labelWidth: 70,
default: '我是接口'
},
// interfaceName: {
// title: '接口',
// type: 'string',
// widget: 'htmlInput',
// displayType: 'row',
// labelWidth: 70,
// default: '我是接口'
// },
groupStyle: {
title: '表单样式',
type: 'object',
......@@ -136,12 +136,14 @@ const globalSettings = {
column: {
title: '整体布局',
type: 'number',
enum: [1, 2, 3, 4, 5],
// enum: [1, 2, 3, 4, 5],
enum: [3, 4, 5],
default: 3,
enumNames: ['一行一列', '一行两列', '一行三列', '一行四列', '一行五列'],
// enumNames: ['一行一列', '一行两列', '一行三列', '一行四列', '一行五列'],
enumNames: ['一行三列', '一行四列', '一行五列'],
widget: 'select',
props: {
placeholder: '默认一行列',
placeholder: '默认一行列',
},
displayType: 'row',
labelWidth: 100,
......
......@@ -35,10 +35,8 @@ const base = {
placeholder: {
title: '提示语',
type: 'string',
// widget: 'Placeholder',
displayType: 'row',
labelWidth: 80,
// dependencies: ['title']
},
presetValue: {
title: '默认值',
......@@ -130,7 +128,6 @@ const textWidgets = [
title: '字段名称',
type: 'string',
widget: 'FieldNames',
// tableName: "{{console.log('1',rootValue)}}",
required: true,
displayType: 'row',
labelWidth: 80,
......@@ -153,6 +150,7 @@ const textWidgets = [
presetValue: {
title: '默认值',
type: 'string',
widget: 'InputDefault',
displayType: 'row',
labelWidth: 80,
},
......@@ -202,7 +200,6 @@ const textWidgets = [
title: '字段名',
type: 'string',
hidden: "{{formData.uniqueVerify !== '表名/字段名'}}",
// required: "{{formData.uniqueVerify === '表名/字段名'}}",
displayType: 'row',
labelWidth: 100,
dependencies: ['uniqueVerify'],
......@@ -282,17 +279,6 @@ const textWidgets = [
title: '元素宽度',
type: 'string',
widget: 'percentSlider',
// default: '100%',
},
displayType: {
title: '标签展示模式',
type: 'string',
default: 'row',
enum: ['row', 'column'],
enumNames: ['同行', '单独一行'],
widget: 'select',
displayType: 'row',
labelWidth: 100,
},
labelWidth: {
title: '标签宽度',
......@@ -341,10 +327,9 @@ const textWidgets = [
placeholder: {
title: '提示语',
type: 'string',
// widget: 'Placeholder',
displayType: 'row',
labelWidth: 80,
// dependencies: ['title']
default: '请输入内容'
},
presetValue: {
title: '默认值',
......@@ -1289,6 +1274,9 @@ const selectWidgets = [
...groupStyle,
}
},
]
const businessWidgets = [
{
text: '级联选择',
name: '级联选择',
......@@ -1501,6 +1489,11 @@ const selectWidgets = [
default: false,
width: '25%',
},
isStoreID: {
title: '是否存储ID',
type: 'boolean',
default: false,
},
description: {
title: '说明',
type: 'string',
......@@ -1615,6 +1608,11 @@ const selectWidgets = [
default: false,
width: '25%',
},
isStoreID: {
title: '是否存储ID',
type: 'boolean',
default: false,
},
description: {
title: '说明',
type: 'string',
......@@ -1727,6 +1725,16 @@ const selectWidgets = [
widget: 'BooleanSwitch',
description: '开启后只显示自己所属站点数据',
},
isMultiple: {
title: '多选',
type: 'boolean',
widget: 'checkbox',
default: false,
displayType: 'row',
labelWidth: 100,
widget: 'BooleanSwitch',
hidden: '{{formData.fieldshine.length !== 1}}',
},
sql: {
title: 'SQL过滤',
name: 'SQL过滤',
......@@ -1759,13 +1767,6 @@ const selectWidgets = [
default: false,
width: '23%',
},
isMultiple: {
title: '多选',
type: 'boolean',
widget: 'checkbox',
default: false,
width: '23%',
},
hidden: {
title: '隐藏',
type: 'boolean',
......@@ -2447,6 +2448,29 @@ const mapWidgets = [
},
},
},
// {
// "text": "复杂结构样例",
// "name": "something",
// "schema": {
// "title": "对象",
// "description": "这是一个对象类型",
// // "type": "object",
// type: 'array',
// items: {
// "properties": {
// "GIS编码": {
// "title": "GIS编码",
// "type": "string"
// },
// "GIS图层": {
// "title": "GIS图层",
// "type": "string",
// },
// }
// },
// }
// }
]
const advancedWidgets = [
......@@ -2574,25 +2598,31 @@ const advancedWidgets = [
},
},
},
{
text: '手写签名',
name: '手写签名',
schema: {
title: '手写签名',
name: '手写签名',
type: 'string',
widget: 'Signature',
width: '100%',
},
setting: {
// {
// text: '手写签名',
// name: '手写签名',
// schema: {
// title: '手写签名',
// name: '手写签名',
// type: 'string',
// widget: 'Signature',
// width: '100%',
// },
// setting: {
},
}
// },
// }
]
const settings = [
{
title: '布局控件',
color: 'pink',
props: {
style: {
color: 'red'
}
},
widgets: layoutWidgets
},
{
......@@ -2603,6 +2633,10 @@ const settings = [
title: '选择器控件',
widgets: selectWidgets,
},
{
title: '业务控件',
widgets: businessWidgets,
},
{
title: '时间控件',
show: true,
......
import React, { useRef, useEffect, useState, useContext, forwardRef, createContext, useMemo, useLayoutEffect } from 'react'
import { ConfigProvider, message, Modal, Button } from 'antd'
import Generator from 'fr-generator'
import Generator, { defaultSettings } from 'fr-generator'
import { settings, baseSettings, globalSettings } from './config'
import widgets from '../widgets'
import { saveTableConfig, GetTableConfigJson } from '../../apis/process'
......@@ -8,6 +8,8 @@ import FormRender from '../FormRender'
export const GlobalStore = createContext(null)
console.log('defaultSettings', defaultSettings)
const FormDesigner = (props, ref) => {
const { tableName } = props
......@@ -34,7 +36,9 @@ const FormDesigner = (props, ref) => {
const { code, data, msg } = await GetTableConfigJson({ tableName })
if (code === 0) {
if (data && typeof data === 'string') {
designerRef?.current?.setValue(JSON.parse(data))
let json = JSON.parse(data)
designerRef?.current?.setValue(json)
setSchema(json)
}
} else {
message.error(msg)
......@@ -81,6 +85,11 @@ const FormDesigner = (props, ref) => {
}
]
const fieldRender = (schema, widgetProps, children, originNode) => {
console.log(schema, widgetProps, children, originNode)
return originNode
}
const testSubmit = async () => {
const { formValue, relationForm, errors } = await formRenderRef?.current?.getValues()
if (errors.length) {
......@@ -104,6 +113,7 @@ const FormDesigner = (props, ref) => {
settings={settingsParent}
commonSettings={baseSettings}
globalSettings={globalSettings}
// fieldRender={fieldRender}
/>
<Modal
title={tableName}
......
......@@ -2,6 +2,7 @@ import React, { useState, useContext, forwardRef, useImperativeHandle, createCon
import FormRender, { useForm } from 'form-render'
import { ConfigProvider } from 'antd'
import widgets from '../widgets'
import { isObject } from '../../utils'
export const GlobalStore = createContext(null)
......@@ -23,7 +24,7 @@ const XRender = (props, ref) => {
let { data, errors } = await form.submit()
let formValue = []
Object.keys(data).map((k) => {
if (k !== 'relationForm') {
if (isObject(data[k])) {
Object.keys(data[k]).map((key) => {
formValue.push({ fieldName: key, fieldValue: data[k][key] })
})
......
......@@ -13,6 +13,7 @@ import { Table, Button, Modal, message, Popconfirm, ConfigProvider } from 'antd'
import { SnippetsOutlined, PlusOutlined, FormOutlined, DeleteOutlined } from '@ant-design/icons'
import { GetTableJson } from '../../../../apis/process'
import BaseForm from './BaseForm'
import { isObject } from '../../../../utils'
const icons = {
'详情': <SnippetsOutlined />,
......@@ -24,7 +25,7 @@ let formStateStr = '添加'
const getFormDataObj = (formData) => {
let formDataObj = {}
Object.keys(formData).map((k) => {
if (k !== 'relationForm') {
if (isObject(formData[k])) {
Object.keys(formData[k]).map((key) => {
formDataObj[key] = formData[k][key] || ''
})
......
......@@ -133,6 +133,7 @@ const Coordinate = ({ value, onChange, name, schema }) => {
value={value}
addonAfter={disabled ? null : <CompassOutlined style={{ color: 'rgba(0, 0, 0, 0.25)' }} onClick={showMap} />}
style={{ width: '100%' }}
onClick={showMap}
/>
<Modal
width={'80%'}
......
......@@ -8,7 +8,7 @@ const PersonSelector = (props) => {
const userID = window?.globalConfig?.userInfo?.OID || 1
const { value, onChange, schema, addons } = props
const { disabled, interactiveType, isMultiple, placeholder, presetValue, role } = schema
const { disabled, interactiveType, isMultiple, placeholder, presetValue, role, isStoreID } = schema
const [pullDown, setPullDown] = useState([])
const [groupPerson, setGroupPerson] = useState([])
const [visible, setVisible] = useState(false)
......
......@@ -20,8 +20,10 @@ const Fieldshine = (props) => {
form
.validateFields()
.then((values) => {
// form.resetFields();
const { field } = form.getFieldsValue()
if (field.length !== 1) {
addons.setValue('isMultiple', false)
}
onChange(field)
setVisible(false)
})
......@@ -56,7 +58,6 @@ const Fieldshine = (props) => {
}
let field = value.length ? value : [{ fromField: '', toField: $id }]
console.log('field', field)
form.setFieldsValue({ field })
setVisible(true)
}
......
......@@ -95,3 +95,5 @@ export const isJson = (json) => {
}
return false
}
export const isObject = (obj) => typeof obj === 'object'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment