|
|
|
@ -385,54 +385,14 @@ export default { |
|
|
|
|
lcJudgmentPoint: judgmentPoint, |
|
|
|
|
lcJudgmentRuleList: judgmentRuleList |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// 重新封装数据 |
|
|
|
|
let length = judgmentRuleList.length; |
|
|
|
|
let tempArr = []; |
|
|
|
|
console.log(judgmentRuleList) |
|
|
|
|
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)) { |
|
|
|
|
tempArr.push({ruleOperation: item.ruleOperation}); |
|
|
|
|
} |
|
|
|
|
this.tableData = tempArr; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.anewPosttingData(judgmentRuleList) |
|
|
|
|
this.tableData.forEach(async (item, index) => { |
|
|
|
|
// 勾选树节点 |
|
|
|
|
if (item.operationIds) { |
|
|
|
|
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
this.$refs[`tree-${index}`].setCheckedKeys([item.operationIds]); |
|
|
|
|
// this.scrollToDepTree(item.operationIds) |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
// 根据题目id,获取题目信息 |
|
|
|
@ -448,6 +408,48 @@ export default { |
|
|
|
|
console.log(err); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
// 重新封装数据 |
|
|
|
|
anewPosttingData(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)) { |
|
|
|
|
tempArr.push({ruleOperation: item.ruleOperation}); |
|
|
|
|
} |
|
|
|
|
this.tableData = tempArr; |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
getSubjectData(subjectId, index) { // 获取题目信息 |
|
|
|
|
this.$get(`${this.api.getSubjectInfo}?subject_id=${subjectId}`).then(res => { |
|
|
|
|
if (res.status === 200) { |
|
|
|
@ -488,7 +490,7 @@ export default { |
|
|
|
|
if (res.status === 200 && res.list) { |
|
|
|
|
if (res.list.length) { |
|
|
|
|
this.treeData = this.toTreeId(res.list, res.list[0].parentId); |
|
|
|
|
console.log(this.treeData) |
|
|
|
|
// console.log(this.treeData) |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
this.$message.warning(res.message); |
|
|
|
@ -630,6 +632,8 @@ export default { |
|
|
|
|
this.isAddRule = true; |
|
|
|
|
// this.tableData.length && this.tableData.push({ruleOperation: 0, indexNo: ""}); |
|
|
|
|
this.tableData.push({ |
|
|
|
|
ruleOperation: 0 |
|
|
|
|
},{ |
|
|
|
|
indexNo: this.tableData.length +1, |
|
|
|
|
isSubject: true, |
|
|
|
|
isDisabled: false, // 不禁用 |
|
|
|
@ -645,6 +649,7 @@ export default { |
|
|
|
|
value5: "" |
|
|
|
|
}); |
|
|
|
|
console.log(this.tableData) |
|
|
|
|
// anewPosttingData(judgmentRuleList) |
|
|
|
|
}, |
|
|
|
|
changeResult(row) { // (左右)结果运算符(0:且 1:或 默认0) |
|
|
|
|
row.resultOperation = row.resultOperation === 0 ? 1 : 0; |
|
|
|
@ -713,7 +718,7 @@ export default { |
|
|
|
|
this.$refs[`tree-${index}`].setCheckedKeys([this.tableData[index].operationIds]); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
this.tableData.splice(index, 1); |
|
|
|
|
this.tableData.splice(index-1, 2); |
|
|
|
|
// index ? this.tableData.splice(index - 1, 1) : this.tableData.splice(0, 1); |
|
|
|
|
this.isAddRule = false; |
|
|
|
|
} |
|
|
|
@ -728,7 +733,7 @@ export default { |
|
|
|
|
// if(index+1 == this.tableData.length){ |
|
|
|
|
// index = index-1 |
|
|
|
|
// } |
|
|
|
|
this.tableData.splice(index,1); |
|
|
|
|
this.tableData.splice(index,2); |
|
|
|
|
index ? this.tableData.splice(index - 1, 1) : this.tableData.splice(0, 1); |
|
|
|
|
this.itemkey = Math.random() |
|
|
|
|
this.tableData.forEach(async (item, index) => { |
|
|
|
|