Commit 15af1b0f by zhaochengxiang

word导入字段重复问题

parent 187d7169
...@@ -45,6 +45,8 @@ const EditModel = (props) => { ...@@ -45,6 +45,8 @@ const EditModel = (props) => {
let _roughModelerData = null; let _roughModelerData = null;
if ((_modelerDataStr||'') !== '') { if ((_modelerDataStr||'') !== '') {
_roughModelerData = JSON.parse(_modelerDataStr); _roughModelerData = JSON.parse(_modelerDataStr);
judgeAttributeRepeat(_roughModelerData.easyDataModelerDataModelAttributes);
} }
setActionData({ action: _action, catalogId: _catalogId, modelerId: _modelerId, hints: _hints, roughModelerData: _roughModelerData, permitCheckOut: (_permitCheckOut==='true'), editable: (_editable==='true'), stateId: _stateId, versionId: _versionId }); setActionData({ action: _action, catalogId: _catalogId, modelerId: _modelerId, hints: _hints, roughModelerData: _roughModelerData, permitCheckOut: (_permitCheckOut==='true'), editable: (_editable==='true'), stateId: _stateId, versionId: _versionId });
...@@ -66,6 +68,33 @@ const EditModel = (props) => { ...@@ -66,6 +68,33 @@ const EditModel = (props) => {
}); });
} }
const judgeAttributeRepeat = (attrs) => {
const names = [], nameCountMap = {}, terms = [];
var repeat = false;
(attrs||[]).forEach(item => {
names.push(item.name||'');
if (nameCountMap.name) {
nameCountMap.name++;
} else {
nameCountMap.name = 1;
}
})
Object.keys(nameCountMap).forEach(key => {
if (nameCountMap[key] > 1) {
repeat = true;
terms.push(key);
}
})
if (repeat) {
setAutoTabKey('2');
setTerms(terms);
}
}
const save = async (e, cid = '') => { const save = async (e, cid = '') => {
setAutoTabKey(null); setAutoTabKey(null);
......
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