Commit 36f0dbbd authored by 皮倩雯's avatar 皮倩雯

fix: '取消数据字典二级限制'

parent ac5339b0
Pipeline #51021 passed with stages
in 7 minutes 34 seconds
/* eslint-disable operator-assignment */
/* eslint-disable no-else-return */
/* eslint-disable no-undef */
/* eslint-disable no-shadow */
......@@ -189,7 +190,7 @@ const WebDic = () => {
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
cursor: ' auto',
cursor: 'auto',
},
}),
render: record => (
......@@ -210,7 +211,7 @@ const WebDic = () => {
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
cursor: ' auto',
cursor: 'auto',
},
}),
render: record => {
......@@ -232,7 +233,7 @@ const WebDic = () => {
align: 'center',
onCell: () => ({
style: {
cursor: ' auto',
cursor: 'auto',
},
}),
render: record => (
......@@ -502,6 +503,7 @@ const WebDic = () => {
const nodeName = addForm.getFieldsValue().nodeName1;
const nodeValue = addForm.getFieldsValue().nodeValue1;
let arr = [];
console.log(nodeName1);
let result = nodeName1.users;
if (result) {
// eslint-disable-next-line array-callback-return
......@@ -1068,38 +1070,78 @@ const WebDic = () => {
label="名称"
rules={[
{ required: true, message: '不能为空' },
{
validator: (rule, value) => {
const nodeName = addForm.getFieldsValue().nodeName1; // 第一项的nodeName
const nodeName1 = addForm.getFieldsValue();
let result = nodeName1.users;
let arr = [];
if (result) {
// eslint-disable-next-line array-callback-return
result.map(item => {
if (item) {
let a = item.nodeName;
if (a !== '') {
arr.push(a);
}
}
});
}
arr.unshift(nodeName);
if (new Set(arr).size !== arr.length) {
// eslint-disable-next-line prefer-promise-reject-errors
return Promise.reject('用户名重复');
}
return Promise.resolve();
},
},
// {
// validator: (rule, value) => {
// const nodeName = addForm.getFieldsValue().nodeName1; // 第一项的nodeName
// const nodeValue = addForm.getFieldsValue().nodeValue1;
// let aa = 0;
// subData.map(i => {
// if (i.nodeName == nodeName && i.nodeValue == nodeValue) {
// aa = aa + 1;
// }
// });
// if (aa != 0) {
// // eslint-disable-next-line prefer-promise-reject-errors
// return Promise.reject('已存在相同名称与值的数据');
// }
// return Promise.resolve();
// },
// },
// {
// validator: (rule, value) => {
// const nodeName = addForm.getFieldsValue().nodeName1; // 第一项的nodeName
// const nodeName1 = addForm.getFieldsValue();
// let result = nodeName1.users;
// let arr = [];
// if (result) {
// // eslint-disable-next-line array-callback-return
// result.map(item => {
// if (item) {
// let a = item.nodeName;
// if (a !== '') {
// arr.push(a);
// }
// }
// });
// }
// arr.unshift(nodeName);
// if (new Set(arr).size !== arr.length) {
// // eslint-disable-next-line prefer-promise-reject-errors
// return Promise.reject('用户名重复');
// }
// return Promise.resolve();
// },
// },
]}
>
<Input placeholder="请输入名称" />
</Form.Item>
</Col>
<Col span={11}>
<Form.Item name="nodeValue1" label="值">
<Form.Item
name="nodeValue1"
label="值"
rules={[
{ required: true, message: '不能为空' },
// {
// validator: (rule, value) => {
// const nodeName = addForm.getFieldsValue().nodeName1; // 第一项的nodeName
// const nodeValue = addForm.getFieldsValue().nodeValue1;
// let aa = 0;
// subData.map(i => {
// if (i.nodeName == nodeName && i.nodeValue == nodeValue) {
// aa = aa + 1;
// }
// });
// if (aa != 0) {
// // eslint-disable-next-line prefer-promise-reject-errors
// return Promise.reject('已存在相同名称与值的数据');
// }
// return Promise.resolve();
// },
// },
]}
>
<Input placeholder="请输入值" />
</Form.Item>
</Col>
......@@ -1118,30 +1160,51 @@ const WebDic = () => {
fieldKey={[fieldKey, 'frist']}
rules={[
{ required: true, message: '不能为空' },
{
validator: (rule, value, callback) => {
const nodeName = addForm.getFieldsValue().nodeName1; // 第一项的nodeName
const nodeName1 = addForm.getFieldsValue();
let result = nodeName1.users;
let arr = [];
// eslint-disable-next-line array-callback-return
result.map(item => {
if (item) {
let a = item.nodeName;
if (a !== '') {
arr.push(a);
}
}
});
if (nodeName !== undefined) {
arr.unshift(nodeName);
}
if (new Set(arr).size !== arr.length) {
arr = [...new Set(arr)];
callback('用户名重复');
}
},
},
// {
// validator: (rule, value, callback) => {
// const nodeName = addForm.getFieldsValue().nodeName1; // 第一项的nodeName
// const nodeName1 = addForm.getFieldsValue();
// let result = nodeName1.users;
// let arr = [];
// // eslint-disable-next-line array-callback-return
// result.map(item => {
// if (item) {
// let a = item.nodeName;
// if (a !== '') {
// arr.push(a);
// }
// }
// });
// if (nodeName !== undefined) {
// arr.unshift(nodeName);
// }
// if (new Set(arr).size !== arr.length) {
// arr = [...new Set(arr)];
// callback('用户名重复');
// }
// },
// },
// {
// validator: (rule, value) => {
// const nodeName1 = addForm.getFieldsValue().nodeName; // 第一项的nodeName
// const nodeValue1 = addForm.getFieldsValue().nodeValue;
// const nodeNameAll = addForm.getFieldsValue();
// console.log(nodeName1);
// console.log(nodeValue1);
// console.log(nodeNameAll);
// let aa = 0;
// subData.map(i => {
// if (i.nodeName == nodeName1 && i.nodeValue == nodeValue1) {
// aa = aa + 1;
// }
// });
// if (aa != 0) {
// // eslint-disable-next-line prefer-promise-reject-errors
// return Promise.reject('已存在相同名称与值的数据');
// }
// return Promise.resolve();
// },
// },
]}
>
<Input placeholder="请输入名称" />
......@@ -1153,6 +1216,28 @@ const WebDic = () => {
name={[name, 'nodeValue']}
label="值"
fieldKey={[fieldKey, 'last']}
rules={[
{ required: true, message: '不能为空' },
// {
// validator: (rule, value) => {
// const nodeName1 = addForm.getFieldsValue().nodeName; // 第一项的nodeName
// const nodeValue1 = addForm.getFieldsValue().nodeValue;
// console.log(nodeName1);
// console.log(nodeValue1);
// let aa = 0;
// subData.map(i => {
// if (i.nodeName == nodeName1 && i.nodeValue == nodeValue1) {
// aa = aa + 1;
// }
// });
// if (aa != 0) {
// // eslint-disable-next-line prefer-promise-reject-errors
// return Promise.reject('已存在相同名称与值的数据');
// }
// return Promise.resolve();
// },
// },
]}
>
<Input placeholder="请输入值" />
</Form.Item>
......
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