From 7b22f927763db946ae4dae732ba665406d278baf Mon Sep 17 00:00:00 2001 From: e <2432808546@qq.com> Date: Thu, 23 Dec 2021 14:37:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A4=E6=96=AD=E5=AD=97=E6=AE=B5=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=E9=97=AE=E9=A2=98=20=E8=A7=84=E5=88=99=E4=B8=8E?= =?UTF-8?q?=E5=8F=82=E8=80=83=E7=AD=94=E6=A1=88=E5=85=B6=E4=B8=AD=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E5=AD=98=E5=9C=A8=E6=95=B0=E6=8D=AE=E5=B0=B1=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Program.vue | 89 +++++++++++++++++++-------------------- src/views/Transaction.vue | 36 ---------------- 2 files changed, 43 insertions(+), 82 deletions(-) diff --git a/src/views/Program.vue b/src/views/Program.vue index 3dcff48..723e01d 100644 --- a/src/views/Program.vue +++ b/src/views/Program.vue @@ -260,10 +260,6 @@ export default { } }, saveAll() { // 保存判分点 - if (!this.formData.points.name) { - this.$message.warning(`判分点名称不能为空`); - return; - } if (this.isNameRepeat) { this.$message.warning(`当前判分点名称已存在`); return; @@ -272,20 +268,13 @@ export default { this.$message.warning(`实验要求不能为空`); return; } - if (!this.formData.points.experimentCode) { - this.$message.warning(`实验代码不能为空`); - return; - } if (!this.tableData.length) { this.$message.warning(`请添加判分规则`); return; } else { for (let i = 0; i < this.tableData.length; i++) { - if (this.tableData[i].isSubject && !this.tableData[i].required) { - this.$message.warning(`第${i + 1}项,规则要求不能为空`); - return; - } else if (this.tableData[i].isSubject && !this.tableData[i].result) { - this.$message.warning(`第${i + 1}项,规则结果不能为空`); + if ((this.tableData[i].isSubject && !this.tableData[i].required) && (this.tableData[i].isSubject && !this.tableData[i].result)) { + this.$message.warning(`第${i + 1}项,规则与结果至少填写一个`); return; } else if (this.tableData[i].isSubject && !this.tableData[i].isSave) { this.$message.warning(`第${i + 1}项,未保存`); @@ -293,9 +282,10 @@ export default { } } } - let tempArr = []; - this.tableData.forEach(i => { - if (i.isSubject) { + if (this.formData.points.name || this.formData.points.experimentCode){ + let tempArr = []; + this.tableData.forEach(i => { + if (i.isSubject) { let obj = { id: i.id ? i.id : "", bcId: i.bcId, @@ -305,31 +295,42 @@ export default { ruleOperation: i.ruleOperation }; tempArr.push(obj) - } - }); - this.formData.bcJudgmentRuleList = tempArr; - if (this.isAdd) { // 新增判分点 - this.$post(this.api.addBcJudgmentPoint, this.formData).then(res => { - if (res.status === 200) { - this.$message.success("新增判分点成功"); - this.Back(); - } else { - this.$message.warning(res.message); } - }).catch(err => { - console.log(err) - }) - } else if (this.isEdit) { // 编辑判分点 - this.$post(this.api.updateBcJudgmentPoint, this.formData).then(res => { - if (res.status === 200) { - this.$message.success("更新判分点成功"); - this.Back(); - } else { - this.$message.warning(res.message); - } - }).catch(err => { - console.log(err) - }) + }); + this.formData.bcJudgmentRuleList = tempArr; + if (this.isAdd) { // 新增判分点 + this.$post(this.api.addBcJudgmentPoint, this.formData).then(res => { + if (res.status === 200) { + this.$message.success("新增判分点成功"); + this.Back(); + } else { + this.$message.warning(res.message); + } + }).catch(err => { + console.log(err) + }) + } else if (this.isEdit) { // 编辑判分点 + this.$post(this.api.updateBcJudgmentPoint, this.formData).then(res => { + if (res.status === 200) { + this.$message.success("更新判分点成功"); + this.Back(); + } else { + this.$message.warning(res.message); + } + }).catch(err => { + console.log(err) + }) + } + }else{ + this.$message.warning(`实验代码与判分点名称至少填写一个`); + // if (!this.formData.points.name) { + // this.$message.warning(`判分点名称不能为空`); + // return; + // } + // if (!this.formData.points.experimentCode) { + // + // return; + // } } }, addRule() { // 新增规则 @@ -385,12 +386,8 @@ export default { row.isDisabled = false; }, handleSave(row) { // 处理保存规则 - if (!row.required) { - this.$message.warning(`规则要求不能为空`); - return; - } - if (!row.result) { - this.$message.warning(`规则结果不能为空`); + if (!row.required && !row.result) { + this.$message.warning(`规则与结果至少填写一个`); return; } row.isSave = true; diff --git a/src/views/Transaction.vue b/src/views/Transaction.vue index 3ab97f6..009c705 100644 --- a/src/views/Transaction.vue +++ b/src/views/Transaction.vue @@ -393,9 +393,7 @@ export default { token: atob(decodeURI(this.$route.query.token)) }); this.checkChange.push(false) - console.log('remounted') this.getTreeData(); - console.log(this.treeData) if (this.$route.query.systemId) { this.formData.lcJudgmentPoint.systemId = this.$route.query.systemId; } @@ -415,16 +413,6 @@ export default { if (item.operationIds) { this.$nextTick(() => { this.$refs[`tree-${index}`].setCheckedKeys([item.operationIds]); - // let currentNode = this.$refs[`tree-${index}`].getNode([item]); - // while ( parentLevel>0)//包含一级节点,因为一级节点有多个,如果是一级节点有一个,那这个判断就是while ( 1!=parentLevel) - // let dom = document.querySelector("#divTree") - // let dom1 = document.querySelector("#depTree") - // //一个节点的高度是26px,这个值能否从对象中获取,等我把这个功能做好再考虑吧 - // let nodeHight =26 - // dom1.style.height = (nodeCount * nodeHight) + "px" - // let contHeight=(nodeIndex * nodeHight)+topHeight-300//总高度,盒子高度的一半 - // dom.scrollTo(0, contHeight) - // this.scrollToDepTree(item.operationIds) }) } // 根据题目id,获取题目信息 @@ -445,7 +433,6 @@ export default { }, currentChecked (nodeObj, SelectedObj) { this.SelectedObj = SelectedObj - }, handleConfirm(){ let list = [] @@ -474,7 +461,6 @@ export default { this.tableData.forEach(async (item, index) => { // 勾选树节点 item.operationIds = item.id - // console.log(item) if (item.id) { this.$nextTick(() => { this.$refs[`tree-${index}`].setCheckedKeys([item.id]); @@ -493,8 +479,6 @@ export default { isDisabled: false, // 已禁用 isSave: false // 已保存 }; - console.log(item) - if(item.type == undefined){ item.operationIds = item.id item.type = null @@ -591,29 +575,19 @@ export default { }); }, handleCheckChange(data, checked, indeterminate, row, index) { // 处理勾选 - // console.log(checked) - // if (checked){ - // }else{ - // this.tableData[index].operationIds= null - // this.tableData[index].operationIds= null - // } - // console.log(this.tableData[index].operationIds) if (checked && data.isNode === 1) { - console.log('123') this.tableData[index].operationIds = data.id; // 操作id串 row.value1 = ""; row.value2 = ""; row.value3 = ""; row.value4 = ""; row.value5 = ""; - // console.log(data) if (data.subjectId) { // 是否有题目id this.currentNodeData = data; this.$refs[`tree-${index}`].setCheckedNodes([data]); this.getSubjectData(data.subjectId, index); } else { row.type = null; - // console.log(row.type) this.currentNodeData = {}; this.$refs[`tree-${index}`].setCheckedNodes([data]); } @@ -649,7 +623,6 @@ export default { let result = []; data.forEach(item => { if (item.isNode === 0) { - // item.disabled = true; item.showCheckbox = false; } else { item.showCheckbox = true; @@ -781,7 +754,6 @@ export default { this.checkChange.push(false) if(!this.isAddRule) { this.isAddRule = true; - // this.tableData.length && this.tableData.push({ruleOperation: 0, indexNo: ""}); if (this.tableData.length > 0){ this.tableData.push({ ruleOperation: 0 @@ -820,7 +792,6 @@ export default { }else { this.$message('请保存当前判分规则再新增!'); } - // anewPosttingData(judgmentRuleList) }, changeResult(row) { // (左右)结果运算符(0:且 1:或 默认0) row.resultOperation = row.resultOperation === 0 ? 1 : 0; @@ -837,8 +808,6 @@ export default { }, handleSave(row, index) { // 处理保存规则 let keys = this.$refs[`tree-${index}`].getCheckedKeys(); - console.log(keys) - console.log(row) if(!row.operationIds){ row.operationIds = keys[0] } @@ -899,8 +868,6 @@ export default { }else{ this.tableData.splice(index,2); } - // this.tableData.splice(index-1, 2); - // index ? this.tableData.splice(index - 1, 1) : this.tableData.splice(0, 1); this.isAddRule = false; } }, @@ -911,9 +878,6 @@ export default { type: "warning", center: true }).then(() => { - // if(index+1 == this.tableData.length){ - // index = index-1 - // } if (index+1 == this.tableData.length){ this.tableData.splice(index - 1, 2) }else{