Commit dbd05bb4 authored by 田翔's avatar 田翔

fix: 增加地址以及设备二维码配置,台账选择器隐射字段默认设置

parent 431ecb15
{ {
"name": "panda-xform", "name": "panda-xform",
"version": "1.5.5", "version": "1.5.6",
"description": "1.5.5: 字段名称处理", "description": "1.5.6: 增加地址以及设备二维码配置,台账选择器隐射字段默认设置",
"keywords": [ "keywords": [
"panda-xform" "panda-xform"
], ],
......
...@@ -214,6 +214,17 @@ const textWidgets = [ ...@@ -214,6 +214,17 @@ const textWidgets = [
type: 'object', type: 'object',
properties: {} properties: {}
}, },
required: {
title: '必填',
type: 'boolean',
default: false,
width: '33%',
props: {
style: {
marginLeft: '10px',
}
}
},
disabled: { disabled: {
title: '只读', title: '只读',
type: 'boolean', type: 'boolean',
...@@ -228,25 +239,22 @@ const textWidgets = [ ...@@ -228,25 +239,22 @@ const textWidgets = [
default: false, default: false,
width: '33%', width: '33%',
}, },
required: {
title: '必填',
type: 'boolean',
default: false,
width: '33%',
props: {
style: {
marginLeft: '10px',
}
}
},
isStoreID: { isStoreID: {
title: '是否存储ID', title: '是否存储ID',
type: 'boolean', type: 'boolean',
default: false, default: false,
// width: '33%',
hidden: "{{!['【本人姓名】','【本人部门】'].includes(rootValue.presetValue) }}", hidden: "{{!['【本人姓名】','【本人部门】'].includes(rootValue.presetValue) }}",
dependencies: ['presetValue'], dependencies: ['presetValue'],
}, },
isQRCode: {
title: '设备二维码',
type: 'boolean',
widget: 'BooleanSwitch',
default: false,
displayType: 'row',
labelWidth: 120,
description: '是否解析为二维码格式(手持端专用)',
},
description: { description: {
title: '说明', title: '说明',
type: 'string', type: 'string',
...@@ -390,6 +398,15 @@ const textWidgets = [ ...@@ -390,6 +398,15 @@ const textWidgets = [
default: false, default: false,
width: '30%', width: '30%',
}, },
currentAddress: {
title: '获取当前地址',
type: 'boolean',
widget: 'BooleanSwitch',
default: false,
displayType: 'row',
labelWidth: 120,
description: '是否自动获取当前地址(手持端专用)',
},
description: { description: {
title: '说明', title: '说明',
type: 'string', type: 'string',
...@@ -1321,10 +1338,10 @@ const selectWidgets = [ ...@@ -1321,10 +1338,10 @@ const selectWidgets = [
presetValue: { presetValue: {
title: '默认值', title: '默认值',
type: 'string', type: 'string',
displayType: 'row',
widget: 'CascadeDefault', widget: 'CascadeDefault',
displayType: 'row',
labelWidth: 80, labelWidth: 80,
dependencies: ['soruceType'] // dependencies: ['soruceType']
}, },
gorupSoruce: { gorupSoruce: {
title: '数据来源', title: '数据来源',
...@@ -1708,7 +1725,7 @@ const selectWidgets = [ ...@@ -1708,7 +1725,7 @@ const selectWidgets = [
displayType: 'row', displayType: 'row',
labelWidth: 100, labelWidth: 100,
required: true, required: true,
dependencies: ['accountName'], dependencies: ['accountName', '$id'],
default: [], default: [],
description: '单字段映射支持多选,多字段映射仅支持单选', description: '单字段映射支持多选,多字段映射仅支持单选',
}, },
...@@ -2498,19 +2515,19 @@ const advancedWidgets = [ ...@@ -2498,19 +2515,19 @@ const advancedWidgets = [
} }
} }
}, },
hidden: { // hidden: {
title: '隐藏', // title: '隐藏',
type: 'boolean', // type: 'boolean',
widget: 'checkbox', // widget: 'checkbox',
default: false, // default: false,
width: '33%', // width: '33%',
}, // },
emphasis: { description: {
title: '强调', title: '说明',
type: 'boolean', type: 'string',
widget: 'checkbox', widget: 'htmlInput',
default: false, displayType: 'row',
width: '33%', labelWidth: 60,
}, },
gorupSoruce: { gorupSoruce: {
title: '数据来源', title: '数据来源',
...@@ -2525,15 +2542,39 @@ const advancedWidgets = [ ...@@ -2525,15 +2542,39 @@ const advancedWidgets = [
labelWidth: 80, labelWidth: 80,
required: true required: true
}, },
mappedField: {
title: '映射字段',
type: 'array',
widget: 'MappedField',
displayType: 'row',
labelWidth: 80,
required: true,
default: [],
},
defaultShow: {
title: '默认显示',
type: 'boolean',
widget: 'BooleanSwitch',
default: false,
displayType: 'row',
labelWidth: 80,
},
controlShow: {
title: '控制规则',
type: 'string',
displayType: 'row',
labelWidth: 80,
widget: 'ControlShow',
},
...groupStyle, ...groupStyle,
}, },
}, },
{ {
text: '个性签名', text: '手写签名',
name: '个性签名', name: '手写签名',
schema: { schema: {
title: '个性签名', title: '手写签名',
name: '个性签名', name: '手写签名',
type: 'string', type: 'string',
widget: 'Signature', widget: 'Signature',
width: '100%', width: '100%',
...@@ -2569,7 +2610,7 @@ const settings = [ ...@@ -2569,7 +2610,7 @@ const settings = [
widgets: fileWidgets, widgets: fileWidgets,
}, },
{ {
title: '地图控件', title: 'GIS控件',
show: true, show: true,
widgets: mapWidgets, widgets: mapWidgets,
}, },
......
...@@ -91,7 +91,6 @@ const FormDesigner = (props, ref) => { ...@@ -91,7 +91,6 @@ const FormDesigner = (props, ref) => {
if (errors.length) { if (errors.length) {
return message.error('表单校验未通过!') return message.error('表单校验未通过!')
} }
console.log('formValue', formValue)
} }
return ( return (
......
...@@ -11,7 +11,7 @@ import { ...@@ -11,7 +11,7 @@ import {
} from '../../../../apis/process' } from '../../../../apis/process'
import { Table, Button, Modal, message, Popconfirm } from 'antd' import { Table, Button, Modal, message, Popconfirm } from 'antd'
import { SnippetsOutlined, PlusOutlined, FormOutlined, DeleteOutlined, } from '@ant-design/icons' import { SnippetsOutlined, PlusOutlined, FormOutlined, DeleteOutlined, } from '@ant-design/icons'
// import FormDesigner from '../../../FormDesigner' import FormRender, { useForm } from 'form-render'
const icons = { const icons = {
'详情': <SnippetsOutlined />, '详情': <SnippetsOutlined />,
...@@ -22,15 +22,12 @@ let formStateStr = '添加' ...@@ -22,15 +22,12 @@ let formStateStr = '添加'
const RelationForm = (props) => { const RelationForm = (props) => {
console.log('props', props)
const fieldNames = ['事件编号', '工单编号'] const fieldNames = ['事件编号', '工单编号']
const { value, onChange, schema, addons } = props const { value, onChange, schema, addons } = props
const { disabled, source, accountName } = schema const { disabled, source, accountName } = schema
// const configInfo = source ? { ...JSON.parse(source) } : {}
const [listData, setListData] = useState([]) const [listData, setListData] = useState([])
const { codes } = parent const { codes } = parent
const form = useForm()
const [config, setConfig] = useState({ webShowFieldGroup: '', fieldGroup: '' }) const [config, setConfig] = useState({ webShowFieldGroup: '', fieldGroup: '' })
const [dataSource, setDataSource] = useState([]) const [dataSource, setDataSource] = useState([])
const [groupMeta, setGroupMeta] = useState([]) const [groupMeta, setGroupMeta] = useState([])
...@@ -370,6 +367,8 @@ const RelationForm = (props) => { ...@@ -370,6 +367,8 @@ const RelationForm = (props) => {
} }
}, [accountName]) }, [accountName])
console.log('tablesSchema', tablesSchema)
return ( return (
<div className={styles.relationForm}> <div className={styles.relationForm}>
<div className={styles.header}> <div className={styles.header}>
...@@ -392,15 +391,10 @@ const RelationForm = (props) => { ...@@ -392,15 +391,10 @@ const RelationForm = (props) => {
bodyStyle={{ height: 700 }} bodyStyle={{ height: 700 }}
destroyOnClose destroyOnClose
> >
{/* <FormDesigner <FormRender
tablesSchema={tablesSchema} form={form}
/> */} schema={tablesSchema}
{/* <JsonToHtml />
isReadOnly={isReadOnly}
tablesSchema={tablesSchema}
ref={parseFormRef}
noButtons
/> */}
</Modal> </Modal>
</div> </div>
) )
......
...@@ -48,7 +48,11 @@ const CascadeSelector = (props) => { ...@@ -48,7 +48,11 @@ const CascadeSelector = (props) => {
return result; return result;
} }
const cascaderChange = selectedValues => { const cascaderChange = (selectedValues) => {
if (addons) {
if (!selectedValues) {
return onChange('')
}
const result = [] const result = []
// 递归查询城市所有数据 // 递归查询城市所有数据
function findCityData(city) { function findCityData(city) {
...@@ -65,7 +69,6 @@ const CascadeSelector = (props) => { ...@@ -65,7 +69,6 @@ const CascadeSelector = (props) => {
findCityData(city) findCityData(city)
// 分发监听 // 分发监听
const cityValue = result.map(v => v.label) const cityValue = result.map(v => v.label)
if (addons) {
onChange(cityValue.join('/')) onChange(cityValue.join('/'))
} }
} }
......
...@@ -22,6 +22,8 @@ const CheckBox = (props) => { ...@@ -22,6 +22,8 @@ const CheckBox = (props) => {
useEffect(() => { useEffect(() => {
if (addons) { if (addons) {
addons.setValue(addons.dataPath, presetValue) addons.setValue(addons.dataPath, presetValue)
} else {
onChange(presetValue)
} }
}, [presetValue]) }, [presetValue])
......
...@@ -4,9 +4,10 @@ import { GetSelectItemList, GetFieldValueFromTable, getStationListByUserID } fro ...@@ -4,9 +4,10 @@ import { GetSelectItemList, GetFieldValueFromTable, getStationListByUserID } fro
const { Option } = Select const { Option } = Select
const ComboBox = ({ value, onChange, schema }) => { const ComboBox = (props) => {
const userID = window?.globalConfig?.userInfo?.OID || 1 const userID = window?.globalConfig?.userInfo?.OID || 1
const { value, onChange, schema, addons } = props
const { placeholder, disabled, soruceType, options, dictionary, tableName, fieldName, presetValue, isMultiple, isEdit, isMySite } = schema const { placeholder, disabled, soruceType, options, dictionary, tableName, fieldName, presetValue, isMultiple, isEdit, isMySite } = schema
const [dictionaryList, setDictionaryList] = useState([]) const [dictionaryList, setDictionaryList] = useState([])
const [tableData, setTableData] = useState([]) const [tableData, setTableData] = useState([])
...@@ -54,6 +55,7 @@ const ComboBox = ({ value, onChange, schema }) => { ...@@ -54,6 +55,7 @@ const ComboBox = ({ value, onChange, schema }) => {
} }
const onFocus = async () => { const onFocus = async () => {
if (addons) {
if (soruceType === '数据字典') { if (soruceType === '数据字典') {
if (!dictionary) { if (!dictionary) {
return message.error('请选择数据字典!') return message.error('请选择数据字典!')
...@@ -94,6 +96,7 @@ const ComboBox = ({ value, onChange, schema }) => { ...@@ -94,6 +96,7 @@ const ComboBox = ({ value, onChange, schema }) => {
} }
} }
} }
}
return ( return (
<Select <Select
......
...@@ -23,6 +23,7 @@ const DeptSelector = (props) => { ...@@ -23,6 +23,7 @@ const DeptSelector = (props) => {
} }
const iconClick = async () => { const iconClick = async () => {
if (addons) {
const { code, data, msg } = await getDeptList() const { code, data, msg } = await getDeptList()
if (code === 0) { if (code === 0) {
setTreeData(data) setTreeData(data)
...@@ -30,6 +31,7 @@ const DeptSelector = (props) => { ...@@ -30,6 +31,7 @@ const DeptSelector = (props) => {
message.error(msg) message.error(msg)
} }
} }
}
useEffect(() => { useEffect(() => {
if (addons) { if (addons) {
......
...@@ -6,7 +6,6 @@ const CascadeDefault = (props) => { ...@@ -6,7 +6,6 @@ const CascadeDefault = (props) => {
const { value, onChange, schema, addons } = props const { value, onChange, schema, addons } = props
const { soruceType } = addons.formData const { soruceType } = addons.formData
const { disabled } = schema
const enums = useMemo(() => { const enums = useMemo(() => {
if (soruceType === '城市数据') { if (soruceType === '城市数据') {
...@@ -75,10 +74,9 @@ const CascadeDefault = (props) => { ...@@ -75,10 +74,9 @@ const CascadeDefault = (props) => {
return ( return (
<Cascader <Cascader
value={value ? getDefaultValue(value) : []} value={value}
showSearch showSearch
onChange={cascaderChange} onChange={cascaderChange}
disabled={disabled}
style={{ width: '100%' }} style={{ width: '100%' }}
options={enums} options={enums}
/> />
......
...@@ -10,7 +10,6 @@ const FieldNames = (props) => { ...@@ -10,7 +10,6 @@ const FieldNames = (props) => {
const [fieldName, setFieldName] = useState([]) const [fieldName, setFieldName] = useState([])
const selectChange = (value) => { const selectChange = (value) => {
console.log('value', value)
onChange(value) onChange(value)
} }
...@@ -30,6 +29,8 @@ const FieldNames = (props) => { ...@@ -30,6 +29,8 @@ const FieldNames = (props) => {
let array = value.split('/') let array = value.split('/')
if (array.length === 3) { if (array.length === 3) {
onChange(array[2]) onChange(array[2])
} else if (array.length === 2) {
onChange(array[1])
} }
} }
}, [value]) }, [value])
......
import React, { useEffect, useState, useRef } from 'react';
// import { RuleValidation } from '@/services/workflow/workflow';
import { Modal, Input, Form, message, Dropdown, Menu, Tree } from 'antd';
import styles from './index.less';
// import Tree from '@/components/ExpendableTree';
const { TextArea } = Input;
const fnList = [
{ label: '是否为工作日', value: '$fn.isWorkDay()' },
{ label: '是否为工作时间', value: '$fn.isWorkTime()' },
];
const RuleConfig = props => {
const { visible, handleCancel, fieldList, onSubumit, RuleContent, flag } = props;
const [rule, setRule] = useState([]);
const [expandedKey, setExpandedKey] = useState(''); // 默认展开项
const [currentSelectId, setCurrentSelectId] = useState(''); // 选中得节点
const ruleText = useRef();
const chooseIndex = useRef(0);
const [form] = Form.useForm();
useEffect(() => {
if (visible) {
setExpandedKey(fieldList[0].TableName);
setRule(RuleContent);
setTimeout(() => {
console.log(document.getElementById('ruleText'));
console.log(ruleText.current);
document
.getElementById('ruleText')
.setSelectionRange(RuleContent.length, RuleContent.length); // 重新定位光标
}, 0);
} else {
chooseIndex.current = 0;
setExpandedKey('');
setCurrentSelectId('');
setRule('');
}
}, [visible]);
// 保存线配置
const onSave = () => {
console.log('rule', rule)
// RuleValidation({ ruleContent: rule }).then(res => {
// if (res.data) {
// onSubumit(rule);
// } else {
// message.error('请检查规则是否正确');
// }
// });
};
// 处理树数据
const mapTree = (val, index) => ({
title: val.TableName,
key: val.TableName,
children: val.TableFieldNames.map(item => ({
title: item,
key: `${val.TableName}.${item}`,
})),
});
const onSelect = (prop, treeNode) => {
console.log(prop, treeNode);
if (!treeNode.node.children) {
insert(`{${treeNode.node.key}}`);
}
setCurrentSelectId(prop[0]);
};
const insert = text => {
let ednIndex = document.getElementById('ruleText').selectionEnd;
let rangeIndex = document.getElementById('ruleText').selectionStart;
console.log(ednIndex, rangeIndex, 'endene');
setRule(`${rule.slice(0, rangeIndex)}${text}${rule.slice(rangeIndex)}`);
rangeIndex += text.toString().length;
ruleText.current.focus();
};
const insertFn = value => {
insert(value);
};
const fnListRender = (
<Menu>
{fnList.map(item => (
<Menu.Item key={item.value} onClick={() => insertFn(item.value)}>
{item.label}
</Menu.Item>
))}
</Menu>
);
return (
<Modal
title="规则配置"
visible={visible}
onOk={onSave}
width="740px"
onCancel={handleCancel}
maskClosable={false}
destroyOnClose
getContainer={false}
>
<div className={styles.configContent}>
<div className={styles.leftTree}>
<Tree
blockNode
autoExpandParent
onSelect={onSelect}
selectedKeys={[currentSelectId]}
expandedKeys={expandedKey}
treeData={fieldList.map((item, index) => mapTree(item, index))}
/>
</div>
<div className={styles.rightContent}>
{flag == 1 && <div className={styles.title}>符合以下条件时工单扭转到对应的节点</div>}
<div className={styles.textAreaBox}>
<Dropdown overlay={fnListRender} placement="bottom" arrow>
<div className={styles.insertFn}>插入函数</div>
</Dropdown>
<TextArea
id="ruleText"
autoSize={{ minRows: 19, maxRows: 19 }}
value={rule}
rows={4}
ref={ruleText}
onChange={e => setRule(e.target.value)}
/>
</div>
<ul className={styles.tipBox}>
<li>
<p>请从左侧面板选择字段或选项</p>
<p>
{'支持'} <i>英文</i> {'模式下运算符(+、-、*、/><==!=<=>='}
</p>
</li>
{flag === 1 ? (
<>
<li>
<p>参考场景:</p>
<p>当报销金额大于1000时,才能进入所选节点,则可将流转条件设置为:</p>
<p>
<em>{'报销金额 > 1000'}</em>
</p>
</li>
</>
) : (
<li>{`示例:{表名.是否缴费} = ‘是’ and {表名.缴费金额} > 1000`}</li>
)}
</ul>
</div>
</div>
</Modal>
)
}
export default RuleConfig;
import React, { useEffect, useState, useRef } from 'react';
// import { RuleValidation } from '@/services/workflow/workflow';
import { Modal, Input, Form, message, Dropdown, Menu, Tree } from 'antd';
import styles from './index.less';
// import Tree from '@/components/ExpendableTree';
const { TextArea } = Input;
// import RuleConfig from './RuleConfig';
const ControlShow = (props) => {
const { value, onChange } = props
const inputChange = (e) => {
onChange(e.target.value)
}
return (
<div>
<Input
// onClick={inputClick}
onChange={inputChange}
/>
{/* <RuleConfig
fieldList={fieldList}
RuleContent={123}
visible={visible}
handleCancel={() => { }}
onSubumit={() => { }}
flag={2}
/> */}
</div>
)
}
export default ControlShow
...@@ -9,7 +9,7 @@ const { TreeNode } = TreeSelect ...@@ -9,7 +9,7 @@ const { TreeNode } = TreeSelect
const Fieldshine = (props) => { const Fieldshine = (props) => {
const { addons, onChange, value } = props const { addons, onChange, value } = props
const { accountName, tableNameParent } = addons.formData const { $id, accountName, tableNameParent } = addons.formData
const [form] = Form.useForm() const [form] = Form.useForm()
const [visible, setVisible] = useState(false) const [visible, setVisible] = useState(false)
...@@ -31,6 +31,9 @@ const Fieldshine = (props) => { ...@@ -31,6 +31,9 @@ const Fieldshine = (props) => {
} }
const inputClick = async () => { const inputClick = async () => {
if ($id.includes('台账选择器')) {
return message.info('请选择字段名称')
}
if (!accountName) { if (!accountName) {
return message.info('请选择台账名称') return message.info('请选择台账名称')
} }
...@@ -51,7 +54,10 @@ const Fieldshine = (props) => { ...@@ -51,7 +54,10 @@ const Fieldshine = (props) => {
} else { } else {
message.error(res2.msg) message.error(res2.msg)
} }
form.setFieldsValue({ field: value })
let field = value.length ? value : [{ fromField: '', toField: $id }]
console.log('field', field)
form.setFieldsValue({ field })
setVisible(true) setVisible(true)
} }
...@@ -73,13 +79,15 @@ const Fieldshine = (props) => { ...@@ -73,13 +79,15 @@ const Fieldshine = (props) => {
<Form.List name="field"> <Form.List name="field">
{(value, { add, remove }) => ( {(value, { add, remove }) => (
<> <>
{value.map(({ key, name, ...restField }) => ( {value.map(({ key, name, ...restField }, index) => (
<Space <Space
key={key} key={key}
style={{ style={{
display: 'flex', display: 'flex',
marginBottom: '5px ', marginBottom: '5px ',
justifyContent: 'center', justifyContent: 'center',
position: 'relative',
left: index === 0 ? '-11px' : '',
}} }}
align="baseline" align="baseline"
> >
...@@ -138,11 +146,13 @@ const Fieldshine = (props) => { ...@@ -138,11 +146,13 @@ const Fieldshine = (props) => {
showCheckedStrategy showCheckedStrategy
> >
<TreeNode value='事件_测试02' title='事件_测试02' disabled> <TreeNode value='事件_测试02' title='事件_测试02' disabled>
{toField.map(s => <TreeNode value={s.alias} title={s.name} key={s.name} />)} {
index === 0 ? <TreeNode value={$id} title={$id} /> : toField.map(s => <TreeNode value={s.name} title={s.name} key={s.name} />)
}
</TreeNode> </TreeNode>
</TreeSelect> </TreeSelect>
</Form.Item> </Form.Item>
<MinusCircleOutlined onClick={() => remove(name)} /> {index !== 0 ? <MinusCircleOutlined onClick={() => remove(name)} /> : null}
</Space> </Space>
))} ))}
<Form.Item style={{ padding: '0 10px' }}> <Form.Item style={{ padding: '0 10px' }}>
......
import React, { useState } from 'react'
import { Form, Space, TreeSelect, Button, Input, Modal, message } from 'antd'
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons'
import styles from './index.less'
import { ReloadTableFields, QueryFields } from '../../../../../apis/process'
const { TreeNode } = TreeSelect
const MappedField = (props) => {
const { value, onChange, schema, addons } = props
const { accountName, tableNameParent } = addons.formData
const [form] = Form.useForm()
const [visible, setVisible] = useState(false)
const [fromField, setFromField] = useState([])
const [toField, setToField] = useState([])
const inputClick = async () => {
if (!accountName) {
message.info('请选择台账名称')
}
const req1 = QueryFields(accountName)
const req2 = ReloadTableFields({ tableName: tableNameParent })
const [res1, res2] = await Promise.all([req1, req2])
console.log(res1, res2)
if (res1.code === 0) {
setToField(res1.data)
} else {
message.error(res1.msg)
}
if (res2.code === 0) {
setFromField(res2.data.root)
} else {
message.error(res2.msg)
}
setVisible(true)
}
const onOk = () => {
form
.validateFields()
.then((values) => {
const { field } = form.getFieldsValue()
onChange(field)
setVisible(false)
})
.catch((info) => {
console.log('Validate Failed:', info)
})
}
return (
<div className={styles.mappedField}>
<Input
value={value && value.length ? JSON.stringify(value) : null}
onClick={inputClick}
/>
<Modal
title={accountName}
visible={visible}
onCancel={() => setVisible(false)}
onOk={onOk}
>
<Form name="dynamic_form_nest_item" form={form} autoComplete="off">
<Form.List name="field">
{(value, { add, remove }) => (
<>
{value.map(({ key, name, ...restField }, index) => (
<Space
key={key}
style={{
display: 'flex',
marginBottom: '5px ',
justifyContent: 'center'
}}
align="baseline"
>
<Form.Item
{...restField}
name={[name, 'fromField']}
rules={[
{
required: true,
message: '来源字段必填',
}
]}
>
<TreeSelect
showSearch
style={{ width: '180px' }}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
placeholder="请选择字段名 "
allowClear
treeDefaultExpandAll
showCheckedStrategy
>
<TreeNode value='内置字段' title='内置字段' disabled>
{['工单编号', '事件编号'].map(s => <TreeNode value={s} title={s} key={s} />)}
</TreeNode>
<TreeNode value='附加字段' title='附加字段' disabled>
{fromField.map(s => {
if (['工单编号', '事件编号'].includes(s.name)) {
return null
}
return <TreeNode value={s.name} title={s.name} key={s.name} />
})}
</TreeNode>
</TreeSelect>
</Form.Item>
<div className={styles.centerImg}></div>
<Form.Item
{...restField}
name={[name, 'toField']}
rules={[
{
required: true,
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
showSearch
style={{ width: '180px' }}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
placeholder="请选择字段名 "
allowClear
treeDefaultExpandAll
showCheckedStrategy
>
<TreeNode value={accountName} title={accountName} disabled>
{toField.map(s => <TreeNode value={s} title={s} key={s} />)}
</TreeNode>
</TreeSelect>
</Form.Item>
<MinusCircleOutlined onClick={() => remove(name)} />
</Space>
))}
<Form.Item style={{ padding: '0 10px' }}>
<Button type="dashed" onClick={() => add()} block icon={<PlusOutlined />}>
添加映射
</Button>
</Form.Item>
</>
)}
</Form.List>
</Form>
</Modal>
</div>
)
}
export default MappedField
\ No newline at end of file
@imgSrc: '../../../../../assets/images/settting';
.mappedField {
.centerImg {
width: 24px;
height: 24px;
background: url('@{imgSrc}/值映射.png');
background-size: 100% 100%;
position: relative;
top: 7px;
}
}
\ No newline at end of file
...@@ -2,12 +2,16 @@ import Dictionary from './Dictionary' ...@@ -2,12 +2,16 @@ import Dictionary from './Dictionary'
import TableAndField from './TableAndField' import TableAndField from './TableAndField'
import AccountName from './AccountName' import AccountName from './AccountName'
import Fieldshine from './Fieldshine' import Fieldshine from './Fieldshine'
import MappedField from './MappedField'
import ControlShow from './ControlShow'
const groupSource = { const groupSource = {
Dictionary, Dictionary,
TableAndField, TableAndField,
AccountName, AccountName,
Fieldshine, Fieldshine,
MappedField,
ControlShow,
} }
export default groupSource export default groupSource
\ No newline at end of file
...@@ -3,23 +3,27 @@ import { InputNumber } from 'antd' ...@@ -3,23 +3,27 @@ import { InputNumber } from 'antd'
const NumberInput = (props) => { const NumberInput = (props) => {
const { value, onChange, schema } = props const { value, onChange, schema, addons } = props
const { disabled, presetValue, placeholder, prefix, formatter } = schema const { disabled, presetValue, placeholder, prefix, formatter } = schema
useEffect(() => { useEffect(() => {
onChange(presetValue) onChange(presetValue)
}, [presetValue, formatter]) }, [presetValue, formatter])
const inputChange = (value) => {
if (addons) {
onChange(value)
}
}
return ( return (
<InputNumber <InputNumber
defaultValue={null}
prefix={prefix} prefix={prefix}
placeholder={placeholder} placeholder={placeholder}
disabled={disabled} disabled={disabled}
value={value} value={value}
formatter={(value) => value && formatter ? `${value}${formatter}` : value} formatter={(value) => value && formatter ? `${value}${formatter}` : value}
parser={(value) => value && formatter && value.replace(formatter, '')} onChange={inputChange}
onChange={value => onChange(value)}
style={{ width: '100%' }} style={{ width: '100%' }}
/> />
) )
......
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