Commit cbedc92e authored by 田翔's avatar 田翔

fix: 台账选择器完成,统一增加说明属性替代强调

parent 4489aaf3
{ {
"name": "panda-xform", "name": "panda-xform",
"version": "1.5.1", "version": "1.5.2",
"description": "1.5.1: 增加唯一值校验,增加位置坐标,增加业务选择", "description": "1.5.2: 台账选择器完成,统一增加说明属性替代强调",
"keywords": [ "keywords": [
"panda-xform" "panda-xform"
], ],
......
...@@ -163,25 +163,6 @@ const textWidgets = [ ...@@ -163,25 +163,6 @@ const textWidgets = [
type: 'object', type: 'object',
properties: {} properties: {}
}, },
required: {
title: '必填',
type: 'boolean',
default: false,
width: '33%',
props: {
style: {
marginLeft: '10px',
}
}
},
isStoreID: {
title: '是否存储ID',
type: 'boolean',
default: false,
width: '66%',
hidden: "{{!['【本人姓名】','【本人部门】'].includes(rootValue.presetValue) }}",
dependencies: ['presetValue'],
},
maxLength: { maxLength: {
title: '字节最大长度', title: '字节最大长度',
type: 'number', type: 'number',
...@@ -247,12 +228,30 @@ const textWidgets = [ ...@@ -247,12 +228,30 @@ const textWidgets = [
default: false, default: false,
width: '33%', width: '33%',
}, },
emphasis: { required: {
title: '强调', title: '必填',
type: 'boolean', type: 'boolean',
widget: 'checkbox',
default: false, default: false,
width: '33%', width: '33%',
props: {
style: {
marginLeft: '10px',
}
}
},
isStoreID: {
title: '是否存储ID',
type: 'boolean',
default: false,
// width: '33%',
hidden: "{{!['【本人姓名】','【本人部门】'].includes(rootValue.presetValue) }}",
dependencies: ['presetValue'],
},
description: {
title: '说明',
type: 'string',
displayType: 'row',
labelWidth: 55,
}, },
groupStyle: { groupStyle: {
title: '控件样式', title: '控件样式',
...@@ -352,14 +351,6 @@ const textWidgets = [ ...@@ -352,14 +351,6 @@ const textWidgets = [
type: 'object', type: 'object',
properties: {} properties: {}
}, },
required: {
title: '必填',
type: 'boolean',
widget: 'BooleanSwitch',
default: false,
displayType: 'row',
labelWidth: 100,
},
maxLength: { maxLength: {
title: '最大长度', title: '最大长度',
type: 'number', type: 'number',
...@@ -374,26 +365,36 @@ const textWidgets = [ ...@@ -374,26 +365,36 @@ const textWidgets = [
type: 'object', type: 'object',
properties: {} properties: {}
}, },
required: {
title: '必填',
type: 'boolean',
default: false,
width: '40%',
props: {
style: {
marginLeft: '10px'
}
}
},
disabled: { disabled: {
title: '只读', title: '只读',
type: 'boolean', type: 'boolean',
widget: 'checkbox', widget: 'checkbox',
default: false, default: false,
width: '33%', width: '30%',
}, },
hidden: { hidden: {
title: '隐藏', title: '隐藏',
type: 'boolean', type: 'boolean',
widget: 'checkbox', widget: 'checkbox',
default: false, default: false,
width: '33%', width: '30%',
}, },
emphasis: { description: {
title: '强调', title: '说明',
type: 'boolean', type: 'string',
widget: 'checkbox', displayType: 'row',
default: false, labelWidth: 55,
width: '33%',
}, },
groupStyle: { groupStyle: {
title: '控件样式', title: '控件样式',
...@@ -478,44 +479,41 @@ const textWidgets = [ ...@@ -478,44 +479,41 @@ const textWidgets = [
displayType: 'row', displayType: 'row',
labelWidth: 80, labelWidth: 80,
}, },
groupVerify: { groupSetting: {
title: '数据校验', title: '控件设置',
type: 'object', type: 'object',
properties: {} properties: {}
}, },
required: { required: {
title: '必填', title: '必填',
type: 'boolean', type: 'boolean',
widget: 'BooleanSwitch',
default: false, default: false,
displayType: 'row', width: '40%',
labelWidth: 70, props: {
}, style: {
groupSetting: { marginLeft: '10px'
title: '控件设置', }
type: 'object', }
properties: {}
}, },
disabled: { disabled: {
title: '只读', title: '只读',
type: 'boolean', type: 'boolean',
widget: 'checkbox', widget: 'checkbox',
default: false, default: false,
width: '33%', width: '30%',
}, },
hidden: { hidden: {
title: '隐藏', title: '隐藏',
type: 'boolean', type: 'boolean',
widget: 'checkbox', widget: 'checkbox',
default: false, default: false,
width: '33%', width: '30%',
}, },
emphasis: { description: {
title: '强调', title: '说明',
type: 'boolean', type: 'string',
widget: 'checkbox', displayType: 'row',
default: false, labelWidth: 55,
width: '33%',
}, },
groupStyle: { groupStyle: {
title: '控件样式', title: '控件样式',
...@@ -599,39 +597,41 @@ const textWidgets = [ ...@@ -599,39 +597,41 @@ const textWidgets = [
displayType: 'row', displayType: 'row',
labelWidth: 80, labelWidth: 80,
}, },
// placeholder: {
// title: '提示语',
// type: 'string',
// // widget: 'Placeholder',
// displayType: 'row',
// labelWidth: 80,
// // dependencies: ['title']
// },
groupSetting: { groupSetting: {
title: '控件设置', title: '控件设置',
type: 'object', type: 'object',
properties: {} properties: {}
}, },
required: {
title: '必填',
type: 'boolean',
default: false,
width: '40%',
props: {
style: {
marginLeft: '10px'
}
}
},
disabled: { disabled: {
title: '只读', title: '只读',
type: 'boolean', type: 'boolean',
widget: 'checkbox', widget: 'checkbox',
default: false, default: false,
width: '33%', width: '30%',
}, },
hidden: { hidden: {
title: '隐藏', title: '隐藏',
type: 'boolean', type: 'boolean',
widget: 'checkbox', widget: 'checkbox',
default: false, default: false,
width: '33%', width: '30%',
}, },
emphasis: { description: {
title: '强调', title: '说明',
type: 'boolean', type: 'string',
widget: 'checkbox', displayType: 'row',
default: false, labelWidth: 55,
width: '33%',
}, },
...groupStyle, ...groupStyle,
}, },
...@@ -779,23 +779,16 @@ const selectWidgets = [ ...@@ -779,23 +779,16 @@ const selectWidgets = [
} }
} }
}, },
groupVerify: { groupSetting: {
title: '数据校验', title: '控件设置',
type: 'object', type: 'object',
properties: {} properties: {}
}, },
required: { required: {
title: '必填', title: '必填',
type: 'boolean', type: 'boolean',
widget: 'BooleanSwitch',
default: false, default: false,
displayType: 'row', width: '25%',
labelWidth: 70,
},
groupSetting: {
title: '控件设置',
type: 'object',
properties: {}
}, },
disabled: { disabled: {
title: '只读', title: '只读',
...@@ -811,13 +804,6 @@ const selectWidgets = [ ...@@ -811,13 +804,6 @@ const selectWidgets = [
default: false, default: false,
width: '25%', width: '25%',
}, },
emphasis: {
title: '强调',
type: 'boolean',
widget: 'checkbox',
default: false,
width: '25%',
},
isMultiple: { isMultiple: {
title: '多选', title: '多选',
type: 'boolean', type: 'boolean',
...@@ -833,6 +819,12 @@ const selectWidgets = [ ...@@ -833,6 +819,12 @@ const selectWidgets = [
labelWidth: 120, labelWidth: 120,
description: '勾选后可直接输入选项,可编辑选择仅支持多选' description: '勾选后可直接输入选项,可编辑选择仅支持多选'
}, },
description: {
title: '说明',
type: 'string',
displayType: 'row',
labelWidth: 55,
},
groupStyle: { groupStyle: {
title: '控件样式', title: '控件样式',
type: 'object', type: 'object',
...@@ -962,44 +954,42 @@ const selectWidgets = [ ...@@ -962,44 +954,42 @@ const selectWidgets = [
displayType: 'row', displayType: 'row',
labelWidth: 80, labelWidth: 80,
}, },
groupVerify: { groupSetting: {
title: '数据校验', title: '控件设置',
type: 'object', type: 'object',
properties: {} properties: {}
}, },
required: { required: {
title: '必填', title: '必填',
type: 'boolean', type: 'boolean',
widget: 'BooleanSwitch', widget: 'checkbox',
default: false, default: false,
displayType: 'row', width: '40%',
labelWidth: 70, props: {
}, style: {
groupSetting: { marginLeft: '10px',
title: '控件设置', }
type: 'object', }
properties: {}
}, },
disabled: { disabled: {
title: '只读', title: '只读',
type: 'boolean', type: 'boolean',
widget: 'checkbox', widget: 'checkbox',
default: false, default: false,
width: '33%', width: '30%',
}, },
hidden: { hidden: {
title: '隐藏', title: '隐藏',
type: 'boolean', type: 'boolean',
widget: 'checkbox', widget: 'checkbox',
default: false, default: false,
width: '33%', width: '30%',
}, },
emphasis: { description: {
title: '强调', title: '说明',
type: 'boolean', type: 'string',
widget: 'checkbox', displayType: 'row',
default: false, labelWidth: 55,
width: '33%',
}, },
groupStyle: { groupStyle: {
title: '控件样式', title: '控件样式',
...@@ -1057,13 +1047,6 @@ const selectWidgets = [ ...@@ -1057,13 +1047,6 @@ const selectWidgets = [
displayType: 'row', displayType: 'row',
labelWidth: 80, labelWidth: 80,
}, },
// placeholder: {
// title: '提示语',
// type: 'string',
// // widget: 'Placeholder',
// displayType: 'row',
// labelWidth: 80,
// },
presetValue: { presetValue: {
title: '默认值', title: '默认值',
type: 'string', type: 'string',
...@@ -1130,44 +1113,42 @@ const selectWidgets = [ ...@@ -1130,44 +1113,42 @@ const selectWidgets = [
displayType: 'row', displayType: 'row',
labelWidth: 80, labelWidth: 80,
}, },
groupVerify: { groupSetting: {
title: '数据校验', title: '控件设置',
type: 'object', type: 'object',
properties: {} properties: {}
}, },
required: { required: {
title: '必填', title: '必填',
type: 'boolean', type: 'boolean',
widget: 'BooleanSwitch', widget: 'checkbox',
default: false, default: false,
displayType: 'row', width: '40%',
labelWidth: 70, props: {
}, style: {
groupSetting: { marginLeft: '10px',
title: '控件设置', }
type: 'object', }
properties: {}
}, },
disabled: { disabled: {
title: '只读', title: '只读',
type: 'boolean', type: 'boolean',
widget: 'checkbox', widget: 'checkbox',
default: false, default: false,
width: '33%', width: '30%',
}, },
hidden: { hidden: {
title: '隐藏', title: '隐藏',
type: 'boolean', type: 'boolean',
widget: 'checkbox', widget: 'checkbox',
default: false, default: false,
width: '33%', width: '30%',
}, },
emphasis: { description: {
title: '强调', title: '说明',
type: 'boolean', type: 'string',
widget: 'checkbox', displayType: 'row',
default: false, labelWidth: 55,
width: '33%',
}, },
groupStyle: { groupStyle: {
title: '控件样式', title: '控件样式',
...@@ -1256,51 +1237,42 @@ const selectWidgets = [ ...@@ -1256,51 +1237,42 @@ const selectWidgets = [
displayType: 'row', displayType: 'row',
labelWidth: 80, labelWidth: 80,
}, },
groupVerify: { groupSetting: {
title: '数据校验', title: '控件设置',
type: 'object', type: 'object',
properties: {} properties: {}
}, },
required: { required: {
title: '必填', title: '必填',
type: 'boolean', type: 'boolean',
widget: 'BooleanSwitch', widget: 'checkbox',
default: false, default: false,
displayType: 'row', width: '40%',
labelWidth: 70, props: {
}, style: {
groupSetting: { marginLeft: '10px',
title: '控件设置', }
type: 'object', }
properties: {}
}, },
disabled: { disabled: {
title: '只读', title: '只读',
type: 'boolean', type: 'boolean',
widget: 'checkbox', widget: 'checkbox',
default: false, default: false,
width: '25%', width: '30%',
}, },
hidden: { hidden: {
title: '隐藏', title: '隐藏',
type: 'boolean', type: 'boolean',
widget: 'checkbox', widget: 'checkbox',
default: false, default: false,
width: '25%', width: '30%',
},
emphasis: {
title: '强调',
type: 'boolean',
widget: 'checkbox',
default: false,
width: '25%',
}, },
isMultiple: { description: {
title: '多选', title: '说明',
type: 'boolean', type: 'string',
widget: 'checkbox', displayType: 'row',
default: false, labelWidth: 55,
width: '25%',
}, },
groupStyle: { groupStyle: {
title: '控件样式', title: '控件样式',
...@@ -1402,22 +1374,22 @@ const selectWidgets = [ ...@@ -1402,22 +1374,22 @@ const selectWidgets = [
type: 'object', type: 'object',
properties: {} properties: {}
}, },
disabled: { required: {
title: '只读', title: '必填',
type: 'boolean', type: 'boolean',
widget: 'checkbox', widget: 'checkbox',
default: false, default: false,
width: '25%', width: '25%',
}, },
hidden: { disabled: {
title: '隐藏', title: '只读',
type: 'boolean', type: 'boolean',
widget: 'checkbox', widget: 'checkbox',
default: false, default: false,
width: '25%', width: '25%',
}, },
emphasis: { hidden: {
title: '强调', title: '隐藏',
type: 'boolean', type: 'boolean',
widget: 'checkbox', widget: 'checkbox',
default: false, default: false,
...@@ -1430,6 +1402,12 @@ const selectWidgets = [ ...@@ -1430,6 +1402,12 @@ const selectWidgets = [
default: false, default: false,
width: '25%', width: '25%',
}, },
description: {
title: '说明',
type: 'string',
displayType: 'row',
labelWidth: 55,
},
groupStyle: { groupStyle: {
title: '控件样式', title: '控件样式',
type: 'object', type: 'object',
...@@ -1511,22 +1489,22 @@ const selectWidgets = [ ...@@ -1511,22 +1489,22 @@ const selectWidgets = [
type: 'object', type: 'object',
properties: {} properties: {}
}, },
disabled: { required: {
title: '只读', title: '必填',
type: 'boolean', type: 'boolean',
widget: 'checkbox', widget: 'checkbox',
default: false, default: false,
width: '25%', width: '25%',
}, },
hidden: { disabled: {
title: '隐藏', title: '只读',
type: 'boolean', type: 'boolean',
widget: 'checkbox', widget: 'checkbox',
default: false, default: false,
width: '25%', width: '25%',
}, },
emphasis: { hidden: {
title: '强调', title: '隐藏',
type: 'boolean', type: 'boolean',
widget: 'checkbox', widget: 'checkbox',
default: false, default: false,
...@@ -1539,6 +1517,12 @@ const selectWidgets = [ ...@@ -1539,6 +1517,12 @@ const selectWidgets = [
default: false, default: false,
width: '25%', width: '25%',
}, },
description: {
title: '说明',
type: 'string',
displayType: 'row',
labelWidth: 55,
},
groupStyle: { groupStyle: {
title: '控件样式', title: '控件样式',
type: 'object', type: 'object',
...@@ -1571,6 +1555,8 @@ const selectWidgets = [ ...@@ -1571,6 +1555,8 @@ const selectWidgets = [
type: 'string', type: 'string',
widget: 'AccountSelector', widget: 'AccountSelector',
require: true, require: true,
displayType: 'row',
labelWidth: 120,
}, },
setting: { setting: {
groupBase: { groupBase: {
...@@ -1620,7 +1606,7 @@ const selectWidgets = [ ...@@ -1620,7 +1606,7 @@ const selectWidgets = [
type: 'string', type: 'string',
widget: 'AccountName', widget: 'AccountName',
displayType: 'row', displayType: 'row',
labelWidth: 80, labelWidth: 100,
required: true, required: true,
}, },
fieldshine: { fieldshine: {
...@@ -1629,10 +1615,21 @@ const selectWidgets = [ ...@@ -1629,10 +1615,21 @@ const selectWidgets = [
type: 'array', type: 'array',
widget: 'Fieldshine', widget: 'Fieldshine',
displayType: 'row', displayType: 'row',
labelWidth: 80, labelWidth: 100,
required: true, required: true,
dependencies: ['accountName'], dependencies: ['accountName'],
default: [] default: [],
description: '单字段映射支持多选,多字段映射仅支持单选',
},
siteFilter: {
title: '站点过滤',
name: '站点过滤',
type: 'boolean',
default: false,
displayType: 'row',
labelWidth: 100,
widget: 'BooleanSwitch',
description: '开启后只显示自己所属站点数据',
}, },
sql: { sql: {
title: 'SQL过滤', title: 'SQL过滤',
...@@ -1643,6 +1640,50 @@ const selectWidgets = [ ...@@ -1643,6 +1640,50 @@ const selectWidgets = [
placeholder: '示例:部门="XX部门"' placeholder: '示例:部门="XX部门"'
} }
}, },
groupSetting: {
title: '控件设置',
type: 'object',
properties: {}
},
required: {
title: '必填',
type: 'boolean',
default: false,
width: '31%',
props: {
style: {
marginLeft: '10px',
}
}
},
disabled: {
title: '只读',
type: 'boolean',
widget: 'checkbox',
default: false,
width: '23%',
},
isMultiple: {
title: '多选',
type: 'boolean',
widget: 'checkbox',
default: false,
width: '23%',
},
hidden: {
title: '隐藏',
type: 'boolean',
widget: 'checkbox',
default: false,
width: '23%',
},
description: {
title: '说明',
type: 'string',
displayType: 'row',
labelWidth: 55,
widget: 'input',
},
...groupStyle, ...groupStyle,
} }
} }
...@@ -1696,35 +1737,6 @@ const dateWidgets = [ ...@@ -1696,35 +1737,6 @@ const dateWidgets = [
labelWidth: 80, labelWidth: 80,
description: '勾选默认当前日期此处配置无效' description: '勾选默认当前日期此处配置无效'
}, },
groupVerify: {
title: '数据校验',
type: 'object',
properties: {}
},
required: {
title: '必填',
type: 'boolean',
widget: 'checkbox',
default: false,
width: '33%',
props: {
style: {
marginLeft: '10px',
}
}
},
currentDate: {
title: '不超过当前日期',
type: 'boolean',
widget: 'checkbox',
default: false,
width: '66%',
props: {
style: {
marginLeft: '10px',
}
}
},
groupSetting: { groupSetting: {
title: '控件设置', title: '控件设置',
type: 'object', type: 'object',
...@@ -1739,41 +1751,55 @@ const dateWidgets = [ ...@@ -1739,41 +1751,55 @@ const dateWidgets = [
displayType: 'row', displayType: 'row',
labelWidth: 80, labelWidth: 80,
}, },
disabled: { required: {
title: '只读', title: '必填',
type: 'boolean', type: 'boolean',
widget: 'checkbox', widget: 'checkbox',
default: false, default: false,
width: '30%', width: '40%',
props: { props: {
style: { style: {
marginLeft: '10px', marginLeft: '10px',
} }
} }
}, },
disabled: {
title: '只读',
type: 'boolean',
widget: 'checkbox',
default: false,
width: '30%',
},
hidden: { hidden: {
title: '隐藏', title: '隐藏',
type: 'boolean', type: 'boolean',
widget: 'checkbox', widget: 'checkbox',
default: false, default: false,
width: '25%', width: '30%',
// props: {
// style: {
// marginLeft: '10px',
// }
// }
}, },
defaultCurrent: { defaultCurrent: {
title: '默认当前日期', title: '默认当前日期',
type: 'boolean', type: 'boolean',
widget: 'checkbox', widget: 'checkbox',
default: false, default: false,
width: '45%', width: '50%',
// props: { props: {
// style: { style: {
// marginLeft: '10px', marginLeft: '10px',
// } }
// } }
},
currentDate: {
title: '不超过当前日期',
type: 'boolean',
widget: 'checkbox',
default: false,
width: '50%',
props: {
style: {
marginLeft: '10px',
}
}
}, },
groupStyle: { groupStyle: {
title: '控件样式', title: '控件样式',
...@@ -1846,35 +1872,6 @@ const dateWidgets = [ ...@@ -1846,35 +1872,6 @@ const dateWidgets = [
labelWidth: 80, labelWidth: 80,
description: '勾选默认当前时间此处配置无效' description: '勾选默认当前时间此处配置无效'
}, },
groupVerify: {
title: '数据校验',
type: 'object',
properties: {},
},
required: {
title: '必填',
type: 'boolean',
widget: 'checkbox',
default: false,
width: '33%',
props: {
style: {
marginLeft: '10px',
}
}
},
currentDate: {
title: '不超过当前时间',
type: 'boolean',
widget: 'checkbox',
default: false,
width: '66%',
props: {
style: {
marginLeft: '10px',
}
}
},
groupSetting: { groupSetting: {
title: '控件设置', title: '控件设置',
type: 'object', type: 'object',
...@@ -1889,31 +1886,57 @@ const dateWidgets = [ ...@@ -1889,31 +1886,57 @@ const dateWidgets = [
displayType: 'row', displayType: 'row',
labelWidth: 80, labelWidth: 80,
}, },
disabled: { description: {
title: '只读', title: '说明',
type: 'string',
displayType: 'row',
labelWidth: 80,
widget: 'input',
},
required: {
title: '必填',
type: 'boolean', type: 'boolean',
widget: 'checkbox', widget: 'checkbox',
default: false, default: false,
width: '30%', width: '40%',
props: { props: {
style: { style: {
marginLeft: '10px', marginLeft: '10px',
} }
} }
}, },
disabled: {
title: '只读',
type: 'boolean',
widget: 'checkbox',
default: false,
width: '30%',
},
hidden: { hidden: {
title: '隐藏', title: '隐藏',
type: 'boolean', type: 'boolean',
widget: 'checkbox', widget: 'checkbox',
default: false, default: false,
width: '25%', width: '30%',
}, },
defaultCurrent: { defaultCurrent: {
title: '默认当前时间', title: '默认当前时间',
type: 'boolean', type: 'boolean',
widget: 'checkbox', widget: 'checkbox',
default: false, default: false,
width: '45%', width: '50%',
props: {
style: {
marginLeft: '10px',
}
}
},
currentDate: {
title: '不超过当前时间',
type: 'boolean',
widget: 'checkbox',
default: false,
width: '50%',
}, },
groupStyle: { groupStyle: {
title: '控件样式', title: '控件样式',
......
import React, { useRef, useEffect, useState, useContext } from 'react' import React, { useRef, useEffect, useState, useContext, forwardRef, createContext, useMemo } from 'react'
import { ConfigProvider, message, Modal } from 'antd' import { ConfigProvider, message, Modal } from 'antd'
import Generator, { defaultCommonSettings, defaultGlobalSettings, defaultSettings } from 'fr-generator' import Generator 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'
import FormRender from '../FormRender' import FormRender from '../FormRender'
const FormDesigner = (props) => { export const GlobalStore = createContext(null)
const FormDesigner = (props, ref) => {
const { tableName } = props const { tableName } = props
...@@ -14,7 +16,18 @@ const FormDesigner = (props) => { ...@@ -14,7 +16,18 @@ const FormDesigner = (props) => {
const prefixCls = getPrefixCls('pandaXform') const prefixCls = getPrefixCls('pandaXform')
const [visible, setVisible] = useState(false) const [visible, setVisible] = useState(false)
const [schema, setSchema] = useState({}) const [schema, setSchema] = useState({})
const ref = useRef(null) const designerRef = useRef(null)
const settingsParent = useMemo(() => {
let settingsParent = []
settings.forEach(v => {
v.widgets.forEach(s => {
s.schema = { ...s.schema, tableNameParent: tableName }
})
settingsParent.push(v)
})
return settingsParent
}, [settings, tableName])
const getTableField = () => { const getTableField = () => {
console.log('setSchema', settings) console.log('setSchema', settings)
...@@ -25,7 +38,7 @@ const FormDesigner = (props) => { ...@@ -25,7 +38,7 @@ const FormDesigner = (props) => {
if (code === 0) { if (code === 0) {
if (typeof data === 'string') { if (typeof data === 'string') {
setTimeout(() => { setTimeout(() => {
ref && ref.current && ref.current.setValue && ref.current.setValue(JSON.parse(data)) designerRef && designerRef.current && designerRef.current.setValue && designerRef.current.setValue(JSON.parse(data))
setSchema(JSON.parse(data)) setSchema(JSON.parse(data))
}, 0) }, 0)
} }
...@@ -47,17 +60,17 @@ const FormDesigner = (props) => { ...@@ -47,17 +60,17 @@ const FormDesigner = (props) => {
text: '预览', text: '预览',
onClick: (e) => { onClick: (e) => {
setVisible(true) setVisible(true)
setSchema(ref.current.getValue()) setSchema(designerRef.current.getValue())
} }
}, },
{ {
text: '提交', text: '提交',
onClick: async (value) => { onClick: async (value) => {
const errors = ref.current.getErrorFields() const errors = designerRef.current.getErrorFields()
if (errors.length) { if (errors.length) {
return message.error('请按照提示完善表单内容') return message.error('请按照提示完善表单内容')
} }
const { code, data, msg } = await saveTableConfig(ref.current.getValue()) const { code, data, msg } = await saveTableConfig(designerRef.current.getValue())
if (code === 0) { if (code === 0) {
message.info('保存成功') message.info('保存成功')
} else { } else {
...@@ -84,12 +97,12 @@ const FormDesigner = (props) => { ...@@ -84,12 +97,12 @@ const FormDesigner = (props) => {
object: 'Header', object: 'Header',
}} }}
validation={true} validation={true}
ref={ref} ref={designerRef}
extraButtons={extraButtons} extraButtons={extraButtons}
onChange={onChange} onChange={onChange}
widgets={widgets} widgets={widgets}
onCanvasSelect={onCanvasSelect} onCanvasSelect={onCanvasSelect}
settings={settings} settings={settingsParent}
commonSettings={baseSettings} commonSettings={baseSettings}
globalSettings={globalSettings} globalSettings={globalSettings}
/> />
...@@ -100,7 +113,6 @@ const FormDesigner = (props) => { ...@@ -100,7 +113,6 @@ const FormDesigner = (props) => {
onOk={() => setVisible(false)} onOk={() => setVisible(false)}
onCancel={() => setVisible(false)} onCancel={() => setVisible(false)}
visible={visible} visible={visible}
// getContainer={false}
destroyOnClose destroyOnClose
> >
<FormRender schema={schema} /> <FormRender schema={schema} />
...@@ -111,4 +123,4 @@ const FormDesigner = (props) => { ...@@ -111,4 +123,4 @@ const FormDesigner = (props) => {
} }
export default FormDesigner export default forwardRef(FormDesigner)
\ No newline at end of file \ No newline at end of file
const schema = {
"type": "object",
"properties": {
"formGroup_1": {
"type": "object",
"title": "文本类",
"properties": {
"多行文本": {
"title": "多行文本",
"type": "string",
"format": "textarea",
"default": "",
"min": 0,
"max": 254,
"className": "",
"showDescIcon": true,
"column": 1,
"required": false,
"widget": "textArea",
"rules": [
{
"patterns": false,
"message": ""
}
],
"disabled": false,
"placeholder": "请输入多行文本",
"width": "100%",
"pathKey": "formGroup_1"
},
"富文本": {
"title": "富文本",
"widget": "RichText",
"type": "string",
"config": "",
"format": "text",
"className": "",
"default": "富文本默认值",
"content": "富文本默认值",
"min": 0,
"max": 254,
"disabled": false,
"showDescIcon": true,
"required": false,
"widget": "RichText",
"rules": [
{},
{
"pattern": false,
"message": ""
}
],
"width": "100%",
"pathKey": "formGroup_1"
},
},
"required": [],
"className": "ant-pandaXform-group"
},
},
"required": [],
"column": 4,
"displayType": "row",
"showDescIcon": true,
"labelWidth": 120
}
export default schema
\ No newline at end of file
import React, { useState, useContext, forwardRef } from 'react' import React, { useState, useContext, forwardRef, createContext } from 'react'
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'
......
...@@ -4,8 +4,6 @@ import moment from 'moment' ...@@ -4,8 +4,6 @@ import moment from 'moment'
const Time = (props) => { const Time = (props) => {
console.log('props', props)
const { value, onChange, schema, addons } = props const { value, onChange, schema, addons } = props
const { presetValue, currentDate, defaultCurrent } = schema const { presetValue, currentDate, defaultCurrent } = schema
......
import React, { useEffect, useMemo, useState } from 'react' import React, { useEffect, useState } from 'react'
import styles from './index.less' import styles from './index.less'
import { Upload, Button, message, Modal } from 'antd' import { Upload, Button, message, Modal } from 'antd'
import { UploadOutlined, FileOutlined, ArrowDownOutlined } from '@ant-design/icons' import { UploadOutlined, FileOutlined, ArrowDownOutlined } from '@ant-design/icons'
......
...@@ -9,7 +9,7 @@ const AccountSelector = (props) => { ...@@ -9,7 +9,7 @@ const AccountSelector = (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, accountName, fieldshine, siteJurisdiction, sql, isMultiple, presetValue, placeholder } = schema const { disabled, accountName, fieldshine, siteFilter, sql, isMultiple, presetValue, placeholder } = schema
const [params, setParams] = useState({ info: '', total: 0, pageIndex: 1, pageSize: 20 }) const [params, setParams] = useState({ info: '', total: 0, pageIndex: 1, pageSize: 20 })
const [loading, setLoading] = useState(false) const [loading, setLoading] = useState(false)
...@@ -68,8 +68,8 @@ const AccountSelector = (props) => { ...@@ -68,8 +68,8 @@ const AccountSelector = (props) => {
const getPageList = async (outParams = {}) => { const getPageList = async (outParams = {}) => {
let queryWheres = [] let queryWheres = []
if (siteJurisdiction) { if (siteFilter) {
const { code, data } = await getStationListByUserID(...[userID, window.globalConfig.client, false]) const { code, data } = await getStationListByUserID(...[userID, false])
if (code === 0) { if (code === 0) {
queryWheres = [ queryWheres = [
{ {
...@@ -99,6 +99,8 @@ const AccountSelector = (props) => { ...@@ -99,6 +99,8 @@ const AccountSelector = (props) => {
setKeys(rows.map(v => v.ID)) setKeys(rows.map(v => v.ID))
setParams({ ...params, ...outParams, total: data.totalCount }) setParams({ ...params, ...outParams, total: data.totalCount })
} }
} else {
message.error(msg)
} }
setLoading(false) setLoading(false)
} }
...@@ -118,9 +120,9 @@ const AccountSelector = (props) => { ...@@ -118,9 +120,9 @@ const AccountSelector = (props) => {
Object.keys(addons.formData[child]).forEach(sun => { Object.keys(addons.formData[child]).forEach(sun => {
fieldshine.forEach(v => { fieldshine.forEach(v => {
if (sun === v.toField) { if (sun === v.toField) {
const schema = form.getSchemaByPath(`${child}.${sun}`) const schema = addons.getSchemaByPath(`${child}.${sun}`)
if (schema.widget === 'fileUpload') { if (schema.widget === 'fileUpload') {
form.setSchemaByPath(`${child}.${sun}`, { ...schema, otherFile: row[v.fromField] }) addons.setSchemaByPath(`${child}.${sun}`, { ...schema, otherFile: row[v.fromField] })
} else { } else {
addons.setValue(`${child}.${sun}`, row[v.fromField] || '') addons.setValue(`${child}.${sun}`, row[v.fromField] || '')
} }
...@@ -131,7 +133,7 @@ const AccountSelector = (props) => { ...@@ -131,7 +133,7 @@ const AccountSelector = (props) => {
} else { } else {
let array = dataSource.filter(v => keys.includes(v.ID)) let array = dataSource.filter(v => keys.includes(v.ID))
if (array.length) { if (array.length) {
let rowValues = array.map(v => v[fieldshine[0].fromField]).join(',') let rowValues = array.map(v => v[fieldshine[0].fromField]).filter(v => v).join(',')
onChange(rowValues) onChange(rowValues)
} }
} }
...@@ -151,10 +153,11 @@ const AccountSelector = (props) => { ...@@ -151,10 +153,11 @@ const AccountSelector = (props) => {
return ( return (
<div className={styles.AccountSelector}> <div className={styles.AccountSelector}>
<Input <Input
placeholder={placeholder} placeholder={!disabled ? placeholder : null}
value={value} value={value}
onClick={() => iconClick()} onClick={() => iconClick()}
addonAfter={!disabled ? addonAfter : null} addonAfter={!disabled ? addonAfter : null}
disabled={disabled}
/> />
<Modal <Modal
onCancel={() => setVisible(false)} onCancel={() => setVisible(false)}
...@@ -182,7 +185,7 @@ const AccountSelector = (props) => { ...@@ -182,7 +185,7 @@ const AccountSelector = (props) => {
size="small" size="small"
scroll={{ x: 1500, y: 400 }} scroll={{ x: 1500, y: 400 }}
rowSelection={{ rowSelection={{
type: isMultiple ? 'checkbox' : 'radio', type: isMultiple && fieldshine.length === 1 ? 'checkbox' : 'radio',
selectedRowKeys: keys, selectedRowKeys: keys,
fixed: 'left', fixed: 'left',
onChange: rowChange onChange: rowChange
......
...@@ -4,8 +4,6 @@ import { LoadUnattachedTables } from '../../../../../apis/process' ...@@ -4,8 +4,6 @@ import { LoadUnattachedTables } from '../../../../../apis/process'
const TableNames = (props) => { const TableNames = (props) => {
console.log('props11', props)
const { value, schema, onChange } = props const { value, schema, onChange } = props
const [options, setOptions] = useState([]) const [options, setOptions] = useState([])
......
import React, { useContext, useMemo, useState } from 'react' import React, { useContext, useMemo, useState } from 'react'
import { Input, Select, message } from 'antd' import { Input, Select, message } from 'antd'
import { LoadTableFields, ReloadTableFields } from '../../../../../apis/process' import { LoadTableFields, ReloadTableFields } from '../../../../../apis/process'
// import { GlobalStore } from '../../../../FormDesigner'
const field = [
"处理站点",
"上报人名称",
"上报人部门",
"上报时间",
"现场图片",
"现场录音",
"来源",
"微信探漏是否维修",
"表具服务流水号",
"维修状态",
"维修费用状态",
"用户编号",
"联系人",
"联系电话",
"故障类型",
"是否探到漏点",
"具体位置_门牌号",
"情况描述",
"图片",
"要求处理时间",
"附件_图片",
"探漏人员",
"配合人员",
"创建星期数",
"创建小时数",
"创建分钟数",
"工单编号",
"是否为工作日",
"分支环节1",
"分支环节2",
"服务人员",
"派单提交时间",
"派单状态数字",
"是否接单",
"接单提交时间",
"现场是否需要恢复",
"是否收费",
"管道资产",
"现场情况",
"无需维修原因",
"处理前图片",
"确认当前位置",
"经度",
"纬度",
"是否关阀",
"关闭阀门位置及大小",
"维修管径_DN",
"处理后照片",
"打开阀门位置及大小",
"实收费用",
"维修材料清单",
"缴费照片留存",
"备注",
"维修提交时间",
"维修状态数字",
"恢复前照片",
"恢复提交时间",
"是否已恢复",
"恢复后照片",
"恢复费用要素",
"恢复使用材料拍照",
"恢复费用",
"恢复状态数字",
"维修费用要素",
"计算费用",
"派单耗时",
"接单耗时",
"维修耗时",
"恢复耗时",
"派单耗时_分",
"接单耗时_分",
"维修耗时_分",
"恢复耗时_分"
]
const FieldNames = (props) => { const FieldNames = (props) => {
const { value, onChange, addons } = props const { value, onChange, addons } = props
console.log('props', props)
const [fieldName, setFieldName] = useState([]) const [fieldName, setFieldName] = useState([])
// const { tableName } = useContext(GlobalStore) // const { tableName } = useContext(GlobalStore)
......
...@@ -4,7 +4,8 @@ import { LoadLedgers } from '../../../../../apis/process' ...@@ -4,7 +4,8 @@ import { LoadLedgers } from '../../../../../apis/process'
const AccountName = (props) => { const AccountName = (props) => {
const { value, onChange } = props const { value, onChange, schema, addons } = props
const { name } = addons.formData
const [options, setOptions] = useState([]) const [options, setOptions] = useState([])
const onFocus = async () => { const onFocus = async () => {
...@@ -20,12 +21,19 @@ const AccountName = (props) => { ...@@ -20,12 +21,19 @@ const AccountName = (props) => {
} }
} }
const selectChange = (value) => {
onChange(value)
if (name === '台账选择器') {
addons.setValues({ ...addons.formData, fieldshine: [] })
}
}
return ( return (
<Select <Select
value={value} value={value}
onFocus={onFocus} onFocus={onFocus}
showSearch showSearch
onChange={value => onChange(value)} onChange={selectChange}
> >
{ {
options.map(v => { options.map(v => {
......
...@@ -8,10 +8,8 @@ const { TreeNode } = TreeSelect ...@@ -8,10 +8,8 @@ const { TreeNode } = TreeSelect
const Fieldshine = (props) => { const Fieldshine = (props) => {
console.log('props', props)
const { addons, onChange, value } = props const { addons, onChange, value } = props
const { accountName } = addons.formData const { accountName, tableNameParent } = addons.formData
const [form] = Form.useForm() const [form] = Form.useForm()
const [visible, setVisible] = useState(false) const [visible, setVisible] = useState(false)
...@@ -19,9 +17,17 @@ const Fieldshine = (props) => { ...@@ -19,9 +17,17 @@ const Fieldshine = (props) => {
const [toField, setToField] = useState([]) const [toField, setToField] = useState([])
const onOk = () => { const onOk = () => {
form
.validateFields()
.then((values) => {
// form.resetFields();
const { field } = form.getFieldsValue() const { field } = form.getFieldsValue()
onChange(field) onChange(field)
setVisible(false) setVisible(false)
})
.catch((info) => {
console.log('Validate Failed:', info)
})
} }
const inputClick = async () => { const inputClick = async () => {
...@@ -29,9 +35,7 @@ const Fieldshine = (props) => { ...@@ -29,9 +35,7 @@ const Fieldshine = (props) => {
return message.info('请选择台账名称') return message.info('请选择台账名称')
} }
const req1 = QueryFields(accountName) const req1 = QueryFields(accountName)
console.log(addons, addons.getValue('root')) const req2 = ReloadTableFields({ tableName: tableNameParent })
const req2 = ReloadTableFields({ tableName: '事件_测试02' })
// const req3 = QueryFields(accountName)
const [res1, res2] = await Promise.all([req1, req2]) const [res1, res2] = await Promise.all([req1, req2])
if (res1.code === 0) { if (res1.code === 0) {
if (Array.isArray(res1.data)) { if (Array.isArray(res1.data)) {
...@@ -47,13 +51,10 @@ const Fieldshine = (props) => { ...@@ -47,13 +51,10 @@ const Fieldshine = (props) => {
} else { } else {
message.error(res2.msg) message.error(res2.msg)
} }
form.setFieldsValue({ field: value })
setVisible(true) setVisible(true)
} }
// useEffect(() => {
// addons.setValue(addons.dataPath, [])
// }, [accountName])
return ( return (
<div className={styles.fieldshine}> <div className={styles.fieldshine}>
<Input <Input
...@@ -88,8 +89,8 @@ const Fieldshine = (props) => { ...@@ -88,8 +89,8 @@ const Fieldshine = (props) => {
rules={[ rules={[
{ {
required: true, required: true,
message: 'Missing first name', message: '来源字段必填',
}, }
]} ]}
> >
<TreeSelect <TreeSelect
...@@ -113,8 +114,18 @@ const Fieldshine = (props) => { ...@@ -113,8 +114,18 @@ const Fieldshine = (props) => {
rules={[ rules={[
{ {
required: true, required: true,
message: 'Missing last name', message: '目标字段必填',
}, },
{
validator: (rules, value, callback) => {
const { field } = form.getFieldsValue()
let toFields = Array.from(new Set([...field.map(v => v.toField)]))
if (toFields.length !== field.length) {
return Promise.reject('目标字段不能重复!')
}
return Promise.resolve()
}
}
]} ]}
> >
<TreeSelect <TreeSelect
...@@ -144,7 +155,6 @@ const Fieldshine = (props) => { ...@@ -144,7 +155,6 @@ const Fieldshine = (props) => {
</Form.List> </Form.List>
</Form> </Form>
</Modal> </Modal>
</div> </div>
) )
......
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