Commit 6433e07a authored by 田翔's avatar 田翔

补充提交

parent 651b6107
import React, { useEffect, useState } from 'react'
import { TreeSelect, message } from 'antd'
import { DownOutlined } from '@ant-design/icons'
import { getDeptList } from '../../../../apis/process'
const DeptSelector = (props) => {
const { value, onChange, schema, addons } = props
const { isMultiple, disabled, placeholder, presetValue } = schema
const [treeData, setTreeData] = useState([])
const treeChange = (value) => {
if (addons) {
addons.setValue(addons.dataPath, isMultiple ? value.join(',') : value)
}
}
const filterTreeNode = (inputValue, treeNode) => {
if (treeNode.deptName.includes(inputValue)) {
return true
}
return false
}
const iconClick = async () => {
const { code, data, msg } = await getDeptList()
if (code === 0) {
setTreeData(data)
} else {
message.error(msg)
}
}
useEffect(() => {
if (addons) {
addons.setValue(addons.dataPath, presetValue)
} else {
onChange(presetValue)
}
}, [presetValue])
return (
<TreeSelect
style={{ width: '100%' }}
disabled={disabled}
multiple={isMultiple}
switcherIcon={<DownOutlined />}
fieldNames={{ label: 'deptName', value: 'deptName', children: 'childDepts' }}
treeData={treeData}
onChange={treeChange}
onFocus={iconClick}
value={isMultiple ? (value ? value.split(',') : []) : value}
filterTreeNode={filterTreeNode}
showSearch
showArrow={!disabled}
allowClear
treeDefaultExpandAll={true}
placeholder={disabled ? null : placeholder}
>
</TreeSelect>
)
}
export default DeptSelector
\ No newline at end of file
import React from 'react'
import { Input, Select } from 'antd'
import Form from 'antd/es/form/Form'
const TableAndField = (props) => {
const { value, onChange } = props
const selectChange = (value) => {
onChange(value)
}
const inputChange = (e) => {
onChange(e.target.value)
}
return (
<Form
labelCol={{
span: 8,
}}
wrapperCol={{
span: 16,
}}
>
<Form.Item
label='表名'
name='tableName'
rules={[
{
required: true,
message: '请输入表名',
}
]}
>
<Input style={{ width: '100%' }} />
</Form.Item>
<Form.Item
label='字段名'
name='fieldName'
rules={[
{
required: true,
message: '请输入字段名',
}
]}
>
<Input />
</Form.Item>
</Form>
)
}
export default TableAndField
\ No newline at end of file
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