|
@@ -1,5 +1,5 @@
|
|
|
import React, { useState, useEffect, useRef } from 'react';
|
|
|
-import { Form, Input, Button, Table, Pagination, Row, Col, Select, Modal, DatePicker, Space } from 'antd';
|
|
|
+import { Form, Input, Button, Table, Row, Col, Select, Modal, DatePicker, Space } from 'antd';
|
|
|
import { DeleteOutlined, PlusOutlined } from '@ant-design/icons';
|
|
|
import '@common/common.less';
|
|
|
import apiObj from '@api/index';
|
|
@@ -11,6 +11,9 @@ const { RangePicker } = DatePicker;
|
|
|
const { Option } = Select;
|
|
|
function FieldRules() {
|
|
|
useEffect(() => {
|
|
|
+ getRegular()
|
|
|
+ getTableName()
|
|
|
+ getColumnName()
|
|
|
getColumnVerifyPage();
|
|
|
}, []);
|
|
|
const [addVisible, setAddVisible] = useState(false); //新增页面显示
|
|
@@ -20,7 +23,10 @@ function FieldRules() {
|
|
|
const [visible, setVisible] = useState(false);
|
|
|
const [size, setSize] = useState(15);
|
|
|
const [current, setCurrent] = useState(1);
|
|
|
+ const [regularList, setRegularList] = useState([]);//正则式数据
|
|
|
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
|
|
|
+ const [tableList, setTableList] = useState([]);//表名称
|
|
|
+ const [colList, setColList] = useState([]);//字段名称
|
|
|
const [filedDetail, setFiledDetail] = useState(null);//详情数据
|
|
|
const [params, setParams] = useState({
|
|
|
pages: 1,
|
|
@@ -28,10 +34,6 @@ function FieldRules() {
|
|
|
size: 15
|
|
|
});
|
|
|
const [form] = Form.useForm();
|
|
|
- const typeMap = {
|
|
|
- '1': '职务变更',
|
|
|
- '2': '职称变更'
|
|
|
- };
|
|
|
let data = {
|
|
|
pages: 1,
|
|
|
current: 1,
|
|
@@ -47,12 +49,71 @@ function FieldRules() {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+ //获取正则式名称
|
|
|
+ function getRegular(name) {
|
|
|
+ const param = {
|
|
|
+ name: name || ''
|
|
|
+ }
|
|
|
+ post(api.getRegular, param).then((res) => {
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ const data = res.data.data;
|
|
|
+ setRegularList(data);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ //获取字段名
|
|
|
+ function getColumnName(columnCname, columnEname) {
|
|
|
+ const param = {
|
|
|
+ columnCname: columnCname,
|
|
|
+ columnEname: columnEname
|
|
|
+ }
|
|
|
+ post(api.getColumnName, param).then((res) => {
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ const data = res.data.data;
|
|
|
+ setColList([...data]);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ //获取表名称
|
|
|
+ function getTableName(tableCname, tableEname) {
|
|
|
+ const param = {
|
|
|
+ tableCname: tableCname,
|
|
|
+ tableEname: tableEname
|
|
|
+ }
|
|
|
+ post(api.getTableName, param).then((res) => {
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ const data = res.data.data;
|
|
|
+ setTableList([...data]);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ //表名称搜索(中文)
|
|
|
+ function cnameSearch(val) {
|
|
|
+ getTableName(val, '')
|
|
|
+ }
|
|
|
+ //表名称搜索(英文)
|
|
|
+ function enameSearch(val) {
|
|
|
+ getTableName('', val)
|
|
|
+ }
|
|
|
+ //字段名称搜索(中文)
|
|
|
+ function colmeSearch(val) {
|
|
|
+ getColumnName(val, '')
|
|
|
+ }
|
|
|
+ //字段名称搜索(英文)
|
|
|
+ function coleneSearch(val) {
|
|
|
+ getColumnName('', val)
|
|
|
+ }
|
|
|
+ //正则式名称搜索
|
|
|
+ function onSearch(val) {
|
|
|
+ getRegular(val)
|
|
|
+ }
|
|
|
//删除记录
|
|
|
- function delRecord() {
|
|
|
- post(api.delOfficialCapacityPage, { id: selectedRowKeys }).then((res) => {
|
|
|
+ function delColumnVerify() {
|
|
|
+ post(api.delColumnVerify, { ids: selectedRowKeys }).then((res) => {
|
|
|
if (res.data.code === 200) {
|
|
|
//刷新列表
|
|
|
getColumnVerifyPage()
|
|
|
+ message.success(res.data.msg);
|
|
|
} else {
|
|
|
message.warning(res.data.msg || '操作失败,请重试~');
|
|
|
}
|
|
@@ -61,7 +122,6 @@ function FieldRules() {
|
|
|
}
|
|
|
//删除弹窗确认
|
|
|
function showDelModal(flag) {
|
|
|
- console.log(selectedRowKeys)
|
|
|
if (flag && !selectedRowKeys.length) {
|
|
|
message.warning("请先选择要删除的记录~", 1);
|
|
|
return;
|
|
@@ -72,7 +132,17 @@ function FieldRules() {
|
|
|
function showModal(type) {
|
|
|
setAddVisible(true)
|
|
|
setType(type)
|
|
|
- setFiledDetail([])
|
|
|
+ setFiledDetail({
|
|
|
+ columnList: [{
|
|
|
+ columnCname: "",
|
|
|
+ columnEname: "",
|
|
|
+ ableCname: "",
|
|
|
+ tableEname: ""
|
|
|
+ }],
|
|
|
+ standardValueList: [{
|
|
|
+ tit: ''
|
|
|
+ }]
|
|
|
+ })
|
|
|
}
|
|
|
function onSizeChange(current, pageSize) {
|
|
|
params.current = current
|
|
@@ -121,18 +191,18 @@ function FieldRules() {
|
|
|
getColumnVerifyPage(data);
|
|
|
};
|
|
|
const columns = [
|
|
|
- { title: '序号', dataIndex: 'index', render: (text, record, index) => (current - 1) * params.size + index + 1 },
|
|
|
- { title: '表名称(中文)', dataIndex: 'tableCname', key: 'tableCname' },
|
|
|
- { title: '表名称(英文)', dataIndex: 'tableEname', key: 'tableEname' },
|
|
|
- { title: '字段名称(中文)', dataIndex: 'columnCname', key: 'columnCname' },
|
|
|
- { title: '字段名称(英文)', dataIndex: 'columnEname', key: 'columnEname' },
|
|
|
+ { title: '序号', dataIndex: 'index', render: (text, record, index) => (current - 1) * params.size + index + 1,width: 60 },
|
|
|
+ { title: '表名称(中文)', dataIndex: 'tableCname', key: 'tableCname',width: 130, },
|
|
|
+ { title: '表名称(英文)', dataIndex: 'tableEname', key: 'tableEname',width: 130, },
|
|
|
+ { title: '字段名称(中文)', dataIndex: 'columnCname', key: 'columnCname',width: 145, },
|
|
|
+ { title: '字段名称(英文)', dataIndex: 'columnEname', key: 'columnEname',width: 145, },
|
|
|
{
|
|
|
title: '是否必填', dataIndex: 'isRequired', key: 'isRequired', render: (text, record) => {
|
|
|
return record.isRequired == 1 ? "是" : "否";
|
|
|
}
|
|
|
},
|
|
|
- { title: '标准值维护', dataIndex: 'standardValue', key: 'standardValue' },
|
|
|
- { title: '正则式名称', dataIndex: 'regularName', key: 'regularName' },
|
|
|
+ { title: '标准值维护', dataIndex: 'standardValue', key: 'standardValue',width: 110 },
|
|
|
+ { title: '正则式名称', dataIndex: 'regularName', key: 'regularName',width: 110 },
|
|
|
{ title: '说明', dataIndex: 'regularName', key: 'regularName' },
|
|
|
{
|
|
|
title: '操作', dataIndex: 'key', render: (text, record) => (
|
|
@@ -148,7 +218,7 @@ function FieldRules() {
|
|
|
};
|
|
|
if (addVisible && filedDetail) {
|
|
|
return (
|
|
|
- <FiledContext.Provider value={{ type,save: addSubFiled, detail: filedDetail }}>
|
|
|
+ <FiledContext.Provider value={{ type, save: addSubFiled, detail: filedDetail }}>
|
|
|
<AddRules back={goBack} />
|
|
|
</FiledContext.Provider>
|
|
|
)
|
|
@@ -163,51 +233,78 @@ function FieldRules() {
|
|
|
>
|
|
|
<Row gutter={24}>
|
|
|
<Col span={5} key={0}>
|
|
|
- <Form.Item label="表名称(中文)" name="doctorName">
|
|
|
- <Input placeholder="请输入" autoComplete='off' />
|
|
|
+ <Form.Item label="表名称(中文)" name="tableCname">
|
|
|
+ <Select showSearch allowClear onSearch={cnameSearch} placeholder="请选择">
|
|
|
+ {tableList.map((item) => {
|
|
|
+ return (
|
|
|
+ <Option value={item.tableCname} key={item.tableCname}>{item.tableCname}</Option>
|
|
|
+ )
|
|
|
+ })}
|
|
|
+ </Select>
|
|
|
</Form.Item>
|
|
|
</Col>
|
|
|
<Col span={5} key={1}>
|
|
|
- <Form.Item label="表名称(英文)" name="deptName">
|
|
|
- <Input placeholder="请输入" autoComplete='off' />
|
|
|
+ <Form.Item label="表名称(英文)" name="tableEname">
|
|
|
+ <Select showSearch allowClear onSearch={enameSearch} placeholder="请选择">
|
|
|
+ {tableList.map((item) => {
|
|
|
+ return (
|
|
|
+ <Option value={item.tableEname} key={item.tableEname}>{item.tableEname}</Option>
|
|
|
+ )
|
|
|
+ })}
|
|
|
+ </Select>
|
|
|
</Form.Item>
|
|
|
</Col>
|
|
|
<Col span={5} key={2}>
|
|
|
- <Form.Item label="字段名称(中文)" name="doctorCode">
|
|
|
- <Input placeholder="请输入" autoComplete='off' />
|
|
|
+ <Form.Item label="字段名称(中文)" name="columnCname">
|
|
|
+ <Select showSearch allowClear onSearch={colmeSearch} placeholder="请选择">
|
|
|
+ {colList.map((item) => {
|
|
|
+ return (
|
|
|
+ <Option value={item.columnCname} key={item.columnCname}>{item.columnCname}</Option>
|
|
|
+ )
|
|
|
+ })}
|
|
|
+ </Select>
|
|
|
</Form.Item>
|
|
|
</Col>
|
|
|
<Col span={5} key={3}>
|
|
|
- <Form.Item label="字段名称(英文)" name="name">
|
|
|
- <Input placeholder="请输入" autoComplete='off' />
|
|
|
+ <Form.Item label="字段名称(英文)" name="columnEname">
|
|
|
+ <Select showSearch allowClear onSearch={coleneSearch} placeholder="请选择">
|
|
|
+ {colList.map((item) => {
|
|
|
+ return (
|
|
|
+ <Option value={item.columnEname} key={item.columnEname}>{item.columnEname}</Option>
|
|
|
+ )
|
|
|
+ })}
|
|
|
+ </Select>
|
|
|
</Form.Item>
|
|
|
</Col>
|
|
|
<Col span={5} key={4}>
|
|
|
- <Form.Item label="是否必填" name="type">
|
|
|
+ <Form.Item label="是否必填" name="isRequired">
|
|
|
<Select
|
|
|
placeholder="请选择"
|
|
|
onChange={onTypeChange}
|
|
|
allowClear
|
|
|
>
|
|
|
- <Option value="0" key={0}>全部</Option>
|
|
|
- <Option value="1" key={1}>{typeMap['1']}</Option>
|
|
|
- <Option value="2" key={2}>{typeMap['2']}</Option>
|
|
|
+ <Option value="1" key={1}>是</Option>
|
|
|
+ <Option value="0" key={0}>否</Option>
|
|
|
</Select>
|
|
|
</Form.Item>
|
|
|
</Col>
|
|
|
- <Col span={5} key={3}>
|
|
|
- <Form.Item label="标准值" name="name">
|
|
|
+ <Col span={5} key={5}>
|
|
|
+ <Form.Item label="标准值" name="standardValue">
|
|
|
<Input placeholder="请输入" autoComplete='off' />
|
|
|
</Form.Item>
|
|
|
</Col>
|
|
|
- <Col span={7} key={5}>
|
|
|
- <Form.Item label="正则名称" name="changeTime">
|
|
|
- <RangePicker
|
|
|
- placeholder={['开始时间', '结束时间']}
|
|
|
- />
|
|
|
+ <Col span={7} key={6}>
|
|
|
+ <Form.Item label="正则名称" name="regularName">
|
|
|
+ <Select showSearch allowClear onSearch={onSearch} placeholder="请选择">
|
|
|
+ {regularList.map((item) => {
|
|
|
+ return (
|
|
|
+ <Option value={item.name} key={item.id}>{item.name}</Option>
|
|
|
+ )
|
|
|
+ })}
|
|
|
+ </Select>
|
|
|
</Form.Item>
|
|
|
</Col>
|
|
|
- <Col span={6} key={6}>
|
|
|
+ <Col span={6} key={7}>
|
|
|
<Form.Item>
|
|
|
<Button type="primary" htmlType="submit">
|
|
|
查询
|
|
@@ -255,11 +352,11 @@ function FieldRules() {
|
|
|
cancelText='取消'
|
|
|
width={400}
|
|
|
visible={visible}
|
|
|
- onOk={delRecord}
|
|
|
+ onOk={delColumnVerify}
|
|
|
/*confirmLoading={confirmLoading}*/
|
|
|
onCancel={() => showDelModal(false)}
|
|
|
>
|
|
|
- <p>职务职称变更记录删除后将无法恢复,确认删除这{selectedRowKeys.length}条变更记录?</p>
|
|
|
+ <p>字段校验规则删除后将无法恢复,确认删除这{selectedRowKeys.length}条变更记录?</p>
|
|
|
</Modal>
|
|
|
</div >
|
|
|
)
|