判分点原有数据保留不动,批量新增往上追加,可重复选择

master
e 3 years ago
parent d0955f6e59
commit 72f45e61e4
  1. 74
      src/views/Transaction.vue

@ -451,53 +451,13 @@ export default {
} }
} }
} }
let tableData = this.tableData
this.tableData = []
this.anewPosttingDatas(list) this.anewPosttingDatas(list)
for (var j=0;j<tableData.length;j++){
for(var i=0;i<this.tableData.length;i++){
if (tableData[j].name == this.tableData[i].name){
this.tableData[i].type = tableData[j].type
if (tableData[j].type == 1 || tableData[j].type == 2) {
this.tableData[i].subjectId = Number(tableData[j].emptyOne);
this.tableData[i].value1 = tableData[j].emptyTwo;
} else if (tableData[j].type == 3) {
this.tableData[i].subjectId = Number(tableData[j].emptyOne);
this.tableData[i].value1 = tableData[j].emptyTwo;
} else if (tableData[j].type == 4) {
// id
if (tableData[j].emptyOne === "无限制") {
this.tableData[i].value1 = tableData[j].emptyOne;
this.tableData[i].value2 = "";
} else {
this.tableData[i].value1 = tableData[j].emptyOne.substring(0, tableData[j].emptyOne.indexOf(","));
this.tableData[i].value2 = tableData[j].emptyOne.substring(tableData[j].emptyOne.indexOf(",") + 1, tableData[j].emptyOne.length);
}
this.tableData[i].value3 = tableData[j].emptyTwo;
} else if (tableData[j].type == 5) {
this.tableData[i].subjectId = Number(tableData[j].emptyOne);
this.tableData[i].value2 = tableData[j].emptyTwo[0];
this.tableData[i].value3 = tableData[j].emptyTwo.substring(1, tableData[j].emptyTwo.indexOf("~"));
this.tableData[i].value4 = tableData[j].emptyTwo.substring(tableData[j].emptyTwo.indexOf("~") + 1, tableData[j].emptyTwo.length - 1);
this.tableData[i].value5 = tableData[j].emptyTwo[tableData[j].emptyTwo.length - 1];
}
this.tableData[i].isDisabled=true//
this.tableData[i].isSave=true //
break
}
if(tableData[j].operationIds == this.tableData[i].operationIds){
this.tableData[i].isDisabled=true//
this.tableData[i].isSave=true //
break
}
}
}
this.tableData.forEach(async (item, index) => { this.tableData.forEach(async (item, index) => {
// //
item.operationIds = item.id // item.operationIds = item.id
if (item.id) { if (item.operationIds) {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs[`tree-${index}`].setCheckedKeys([item.id]); this.$refs[`tree-${index}`].setCheckedKeys([item.operationIds]);
}) })
} }
}) })
@ -506,6 +466,11 @@ export default {
anewPosttingDatas(judgmentRuleList){ anewPosttingDatas(judgmentRuleList){
let length = judgmentRuleList.length; let length = judgmentRuleList.length;
let tempArr = []; let tempArr = [];
if(this.tableData.length > 0){
tempArr.push({ruleOperation: 0});
}else{
tempArr = []
}
judgmentRuleList.forEach((item, index) => { judgmentRuleList.forEach((item, index) => {
let obj = { let obj = {
...item, ...item,
@ -513,9 +478,11 @@ export default {
isDisabled: false, // isDisabled: false, //
isSave: false // isSave: false //
}; };
obj.operationIds = item.id
if(item.type == undefined || item.type == ''){ if(item.type == undefined || item.type == ''){
item.operationIds = item.id obj.type = null
item.type = null }else{
obj.type = item.type
} }
//(1 2 3 4 5) //(1 2 3 4 5)
if (item.type == 1 || item.type == 2) { if (item.type == 1 || item.type == 2) {
@ -549,8 +516,10 @@ export default {
tempArr.push({ruleOperation: 0}); tempArr.push({ruleOperation: 0});
} }
} }
this.tableData = tempArr;
}); });
for(var i=0;i<tempArr.length;i++){
this.tableData.push(tempArr[i]);
}
}, },
// //
anewPosttingData(judgmentRuleList){ anewPosttingData(judgmentRuleList){
@ -612,7 +581,7 @@ export default {
}, },
handleCheckChange(data, checked, indeterminate, row, index) { // handleCheckChange(data, checked, indeterminate, row, index) { //
if (checked && data.isNode === 1) { if (checked && data.isNode === 1) {
this.tableData[index].operationIds = data.id; // id // this.tableData[index].operationIds = data.id; // id
// row.value1 = ""; // row.value1 = "";
// row.value2 = ""; // row.value2 = "";
// row.value3 = ""; // row.value3 = "";
@ -784,16 +753,7 @@ export default {
}, },
addRules(){ addRules(){
this.configVisible = true; this.configVisible = true;
let operationIds = [] this.$refs.tree.setCheckedKeys([]);
this.tableData.forEach(async (item, index) => {
//
if (item.operationIds) {
operationIds.push(item.operationIds)
}
});
this.$nextTick(() => {
this.$refs.tree.setCheckedKeys(operationIds);
})
}, },
addRule() { // addRule() { //
this.changeArr.splice(0, this.changeArr.length) this.changeArr.splice(0, this.changeArr.length)

Loading…
Cancel
Save