批量新增判分规则

master
e 3 years ago
parent eb26e5293c
commit 4719526a71
  1. 111
      src/views/Transaction.vue

@ -50,10 +50,28 @@
<div>判分规则</div> <div>判分规则</div>
</div> </div>
<div> <div>
<el-button v-if="!isView" type="primary" size="mini" @click="addRules">批量新增</el-button>
<el-button v-if="!isView" type="primary" size="mini" @click="addRule">新增</el-button> <el-button v-if="!isView" type="primary" size="mini" @click="addRule">新增</el-button>
</div> </div>
</div> </div>
<el-dialog :visible.sync="configVisible" width="30%" title="批量新增判分点" center>
<div class="flex-between mgb20">
<div style="width: 100%;height: 400px;overflow: auto;margin: auto;background: #F5F5F5">
<el-tree
style="background: #F5F5F5"
:data="treeData"
@check="currentChecked"
header-align="center"
show-checkbox node-key="id"
:props="defaultProps">
</el-tree>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="configVisible = false"> </el-button>
<el-button type="primary" @click="handleConfirm"> </el-button>
</span>
</el-dialog>
<el-card shadow="hover"> <el-card shadow="hover">
<el-table <el-table
:data="tableData" :data="tableData"
@ -368,6 +386,8 @@ export default {
isAddRule: false, // isAddRule: false, //
itemkey:'', itemkey:'',
judgePoints:false,// judgePoints:false,//
configVisible:false,
SelectedObj:[]
}; };
}, },
mounted() { mounted() {
@ -424,6 +444,90 @@ export default {
//1.+- //1.+-
scrollToDepTree(deptCode){ scrollToDepTree(deptCode){
},
currentChecked (nodeObj, SelectedObj) {
this.SelectedObj = SelectedObj
},
handleConfirm(){
let list = []
if (this.formData.lcJudgmentRuleList.length){
for (var j = 0;j<this.formData.lcJudgmentRuleList.length;j++){
list.push(this.formData.lcJudgmentRuleList[j]);
}
for (var i=0;i<list.length;i++){
list[i].id = list[i].operationIds
}
}
if (this.SelectedObj.checkedNodes.length > 0){
for (var i=0;i<this.SelectedObj.checkedNodes.length;i++){
if(this.SelectedObj.checkedNodes[i].children.length > 0){
}else{
this.SelectedObj.checkedNodes[i].resultOperation = 0
if (this.SelectedObj.checkedNodes[i].id) {
list.push(this.SelectedObj.checkedNodes[i])
}
}
}
}
this.tableData = []
this.anewPosttingDatas(list)
this.tableData.forEach(async (item, index) => {
//
// console.log(item)
if (item.id) {
this.$nextTick(() => {
this.$refs[`tree-${index}`].setCheckedKeys([item.id]);
})
}
})
this.configVisible = false
},
anewPosttingDatas(judgmentRuleList){
let length = judgmentRuleList.length;
let tempArr = [];
judgmentRuleList.forEach((item, index) => {
let obj = {
...item,
isSubject: true,
isDisabled: true, //
isSave: true //
};
//(1 2 3 4 5)
if (item.type == 1 || item.type == 2) {
obj.subjectId = Number(item.emptyOne);
obj.value1 = item.itemId;
} else if (item.type == 3) {
obj.subjectId = Number(item.emptyOne);
obj.value1 = item.emptyTwo;
} else if (item.type == 4) {
// id
if (item.emptyOne === "无限制") {
obj.value1 = item.emptyOne;
obj.value2 = "";
} else {
obj.value1 = item.emptyOne.substring(0, item.emptyOne.indexOf(","));
obj.value2 = item.emptyOne.substring(item.emptyOne.indexOf(",") + 1, item.emptyOne.length);
}
obj.value3 = item.emptyTwo;
} else if (item.type == 5) {
obj.subjectId = Number(item.emptyOne);
obj.value2 = item.emptyTwo[0];
obj.value3 = item.emptyTwo.substring(1, item.emptyTwo.indexOf("~"));
obj.value4 = item.emptyTwo.substring(item.emptyTwo.indexOf("~") + 1, item.emptyTwo.length - 1);
obj.value5 = item.emptyTwo[item.emptyTwo.length - 1];
}
tempArr.push(obj);
if (length > 1 && index !== (length - 1)) {
if(item.ruleOperation){
tempArr.push({ruleOperation: item.ruleOperation});
}else{
tempArr.push({ruleOperation: 0});
}
}
this.tableData = tempArr;
});
}, },
// //
anewPosttingData(judgmentRuleList){ anewPosttingData(judgmentRuleList){
@ -544,7 +648,7 @@ export default {
let result = []; let result = [];
data.forEach(item => { data.forEach(item => {
if (item.isNode === 0) { if (item.isNode === 0) {
item.disabled = true; // item.disabled = true;
item.showCheckbox = false; item.showCheckbox = false;
} else { } else {
item.showCheckbox = true; item.showCheckbox = true;
@ -668,6 +772,9 @@ export default {
}); });
} }
}, },
addRules(){
this.configVisible = true
},
addRule() { // addRule() { //
this.changeArr.splice(0, this.changeArr.length) this.changeArr.splice(0, this.changeArr.length)
this.checkChange.push(false) this.checkChange.push(false)

Loading…
Cancel
Save