From 0336e798e917ef21d44417d5f0eeb4671ce1e470 Mon Sep 17 00:00:00 2001
From: e <2432808546@qq.com>
Date: Mon, 22 Nov 2021 20:15:46 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/myTree/src/tree.vue | 5 ++
src/components/quill/index.vue | 1 -
src/views/Transaction.vue | 97 ++++++++++++++++--------------
3 files changed, 56 insertions(+), 47 deletions(-)
diff --git a/src/components/myTree/src/tree.vue b/src/components/myTree/src/tree.vue
index 5b1c1b4..5b53bbf 100644
--- a/src/components/myTree/src/tree.vue
+++ b/src/components/myTree/src/tree.vue
@@ -13,10 +13,12 @@
v-for="child in root.childNodes"
:node="child"
:props="props"
+ highlight-current
:render-after-expand="renderAfterExpand"
:show-checkbox="showCheckbox"
:key="getNodeKey(child)"
:render-content="renderContent"
+ node-key="orgCode"
@node-expand="handleNodeExpand">
@@ -135,8 +137,10 @@
children: {
set(value) {
this.data = value;
+ console.log(this.data)
},
get() {
+ console.log(this.data)
return this.data;
}
},
@@ -484,6 +488,7 @@
},
mounted() {
+ console.log(this.data)
this.initTabIndex();
this.$el.addEventListener('keydown', this.handleKeydown);
},
diff --git a/src/components/quill/index.vue b/src/components/quill/index.vue
index 2276793..0cb435e 100644
--- a/src/components/quill/index.vue
+++ b/src/components/quill/index.vue
@@ -148,7 +148,6 @@
});
// 将一些 quill 自带的事件传递出去
this.Quill.on('text-change', (delta, oldDelta, source) => {
- console.log(this.Quill)
this.$emit('on-text-change', delta, oldDelta, source);
});
this.Quill.on('selection-change', (range, oldRange, source) => {
diff --git a/src/views/Transaction.vue b/src/views/Transaction.vue
index e07fb7d..8546fb9 100644
--- a/src/views/Transaction.vue
+++ b/src/views/Transaction.vue
@@ -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) => {