Commit cbedc92e authored by 田翔's avatar 田翔

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

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