Commit 80e9b264 authored by 皮倩雯's avatar 皮倩雯

增加数据字典表单前端验证

parent c216bc99
Pipeline #32428 skipped with stages
......@@ -45,7 +45,8 @@ const WebDic = () => {
const [searchWord, setSearchWord] = useState(''); // 关键字
const { Search } = Input;
const [files, setFiles] = useState('');
const [flag, setFlag] = useState(0)
const [flag, setFlag] = useState(0);
const [flag1, setFlag1] = useState(0);//搜索框数据是否刷新
const [isloading, setIsloading] = useState(false)
const [InPutVisible, setInPutVisible] = useState(false);
......@@ -234,9 +235,9 @@ const WebDic = () => {
if (record.parentID === '-1') {
setSelectColor(record);
}
if(record.parentID === '-1'||record.parentID === null){
if (record.parentID === '-1' || record.parentID === null) {
setEditVisible1(true);
}else{
} else {
setEditVisible(true);
}
editForm.setFieldsValue({
......@@ -261,6 +262,7 @@ const WebDic = () => {
if (record.parentID === '-1') {
setSelectColor(record);
}
}
}
style={{
......@@ -348,6 +350,7 @@ const WebDic = () => {
}
const onSearch = () => {
setSearchVisible(true)
setFlag1(1)
}
//搜索
const sumbitSearch = () => {
......@@ -362,14 +365,8 @@ const WebDic = () => {
}
})
}
const sumbitSearch1 = () => {
SearchDataDictionaryList({ key: searchWord }).then(res => {
if (res.code === 0) {
setSearchData(res.data);
}
})
}
const resetSearch = () => {
setFlag1(0)
setSearchVisible(false);
setSearchWord(''); // 搜索框置空
setSearchData([]);
......@@ -426,13 +423,15 @@ const WebDic = () => {
const nodeName1 = addForm.getFieldsValue()
const nodeName = addForm.getFieldsValue().nodeName1;
const nodeValue = addForm.getFieldsValue().nodeValue1;
console.log(nodeName1);
console.log(nodeName);
let arr = []
let result = nodeName1.users
if (result) {
result.map((item, index) => {
if(item===undefined){
if (item === undefined) {
}else{
} else {
arr.push({ nodeName: item.nodeName, nodeValue: item.nodeValue, parentID: Number(value) })
}
......@@ -502,9 +501,12 @@ const WebDic = () => {
notification.success({
message: '提交成功',
});
sumbitSearch1()
if (flag1 === 1) {
sumbitSearch()
}
} else {
console.log(1)
notification.error({
message: '提交失败',
description: res.msg,
......@@ -532,9 +534,10 @@ const WebDic = () => {
notification.success({
message: '提交成功',
});
sumbitSearch1()
if (flag1 === 1) {
sumbitSearch()
}
} else {
console.log(2)
notification.error({
message: '提交失败',
description: res.msg,
......@@ -554,7 +557,9 @@ const WebDic = () => {
nodeID: select.nodeID,
}).then(res => {
if (res.code === 0) {
sumbitSearch1()
if (flag1 === 1) {
sumbitSearch()
}
getData(select.parentID === '-1' ? null : select.parentID);
if (select.parentID === '-1') {
setSubData([]);
......@@ -752,7 +757,11 @@ const WebDic = () => {
<Form.Item
name='nodeName1'
label="名称"
rules={[{ required: true, message: '不能为空' }]}
rules={
[
{ required: true, message: '不能为空' },
]
}
>
<Input placeholder="请输入名称" />
</Form.Item>
......@@ -775,7 +784,19 @@ const WebDic = () => {
name={[name, 'nodeName']}
label="名称"
fieldKey={[fieldKey, 'frist']}
rules={[{ required: true, message: '不能为空' }]}
rules={
[
{ required: true, message: '不能为空' },
{
validator: (rule, value, callback) => {
const getNodeName = addForm.getFieldsValue().nodeName1;
if (value === getNodeName) {
callback('用户名重复');
}
}
}
]
}
>
<Input placeholder="请输入名称" />
</Form.Item>
......@@ -830,6 +851,7 @@ const WebDic = () => {
</Form>
</Modal>
{/*修改二级条目 */}
<Modal
title={'修改二级条目'}
visible={editVisible}
......@@ -853,6 +875,7 @@ const WebDic = () => {
</Form.Item>
</Form>
</Modal>
<Modal
title={'查找条目'}
visible={searchVisible}
......
......@@ -3,10 +3,15 @@
margin-bottom: 20px;
}
.ant-table-content{
max-height: calc(100vh - 268px);
max-height: calc(100vh - 260px);
border-right: white;
overflow: auto !important;
}
.divv{
.ant-modal-wrap {
z-index: 1001 !important;
}
}
.ant-table-tbody{
.clickRowStyle{
background: #cfe7fd;
......@@ -22,8 +27,8 @@
}
}
.ant-table-body{
max-height: calc(100vh - 338px) !important;
min-height:calc(100vh - 338px);
max-height: calc(100vh - 328px) !important;
min-height:calc(100vh - 328px);
margin-right: -6px;
}
.ant-table-pagination.ant-pagination {
......
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