Commit f6b548cb authored by 田翔's avatar 田翔

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

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