Merge branch 'master' of ssh://git.czcyedu.com:222/huoran/FE_judgmentPoint into master

master
luoJunYong.123 3 years ago
commit 5445df6e0c
  1. 245
      src/views/Program.vue
  2. 107
      src/views/Transaction.vue

@ -71,7 +71,7 @@
>
<el-table-column prop="id" type="index" label="序号" width="80"></el-table-column>
<el-table-column label="编译器中正确答案" align="center">
<template slot-scope="scope">
<template slot-scope="scope" v-if="scope.row.isSubject">
<p class="p">字段一致性规则用户编辑器中至少出现如下语句</p>
<el-input
type="textarea"
@ -84,17 +84,22 @@
<el-table-column label=" " width="150">
<template slot-scope="scope">
<el-button
circle
type="primary"
v-if="scope.row.isSubject"
:disabled="isView || scope.row.isDisabled"
type="primary" circle
@click="changeResult(scope.row)"
style="position: absolute; right: 55px"
>
{{ scope.row.withOr === 0 ? '且' : '或' }}
{{ scope.row.resultOperation === 0 ? '且' : '或' }}
</el-button>
<el-button v-else type="primary" circle @click="changeRule(scope.row, scope.$index)">
{{ scope.row.ruleOperation === 0 ? "且" : "或" }}
</el-button>
</template>
</el-table-column>
<el-table-column label="终端中正确答案" align="center">
<template slot-scope="scope">
<template slot-scope="scope" v-if="scope.row.isSubject">
<p class="p">运行结果一致性规则用户运行结果需要与下方代码运行结果一致</p>
<el-input
type="textarea"
@ -105,7 +110,7 @@
</template>
</el-table-column>
<el-table-column label="操作" width="300" v-if="!isView">
<template slot-scope="scope">
<template slot-scope="scope" v-if="scope.row.isSubject">
<el-button v-show="scope.row.isDisabled" size="mini" type="text" @click="handleEdit(scope.row)">编辑</el-button>
<el-button v-show="!scope.row.isDisabled" size="mini" type="text" @click="handleSave(scope.row)">保存</el-button>
<el-button v-show="!scope.row.isDisabled" size="mini" type="text" @click="handleCancel(scope.row, scope.$index)">取消</el-button>
@ -178,14 +183,15 @@ export default {
bcJudgmentRuleList: judgmentRule
}
//
judgmentRule.forEach((item, index) => {
this.tableData.push({
...item,
isSubject: true,
isDisabled: true,
isSave: true
});
})
this.anewPosttingData(judgmentRule)
// judgmentRule.forEach((item, index) => {
// this.tableData.push({
// ...item,
// isSubject: true,
// isDisabled: true,
// isSave: true
// });
// })
} else {
this.$message.warning(res.message);
}
@ -193,6 +199,49 @@ export default {
console.log(err)
});
},
//
anewPosttingData(judgmentRule){
let length = judgmentRule.length;
let tempArr = [];
judgmentRule.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;
console.log(this.tableData)
});
},
handleBlur() { // /
if (this.formData.points.name) {
let params = {
@ -211,10 +260,6 @@ export default {
}
},
saveAll() { //
if (!this.formData.points.name) {
this.$message.warning(`判分点名称不能为空`);
return;
}
if (this.isNameRepeat) {
this.$message.warning(`当前判分点名称已存在`);
return;
@ -223,88 +268,126 @@ 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].required) {
this.$message.warning(`${i + 1}项,规则要求不能为空`);
return;
} else if (!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].isSave) {
} else if (this.tableData[i].isSubject && !this.tableData[i].isSave) {
this.$message.warning(`${i + 1}项,未保存`);
return;
}
}
}
let tempArr = [];
this.tableData.forEach(i => {
let obj = {
id: i.id ? i.id : "",
bcId: i.bcId,
required: i.required,
result: i.result,
withOr: i.withOr
};
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);
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,
required: i.required,
result: i.result,
resultOperation: i.resultOperation,
ruleOperation: i.ruleOperation
};
tempArr.push(obj)
}
}).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() { //
this.isAddRule = true;
this.tableData.push({
isDisabled: false, //
isSave: false, //
bcId: this.bcId,
required: "",
result: "",
withOr: 0
});
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
}, {
indexNo: this.tableData.length + 1,
isSubject: true,
isDisabled: false, //
isSave: false, //
lcId: this.lcId,
resultOperation: 0,
ruleOperation: 0,
operationIds: "",
value1: "",
value2: "",
value3: "",
value4: "",
value5: ""
});
} else {
this.tableData.push({
indexNo: this.tableData.length + 1,
isSubject: true,
isDisabled: false, //
isSave: false, //
lcId: this.lcId,
resultOperation: 0,
ruleOperation: 0,
operationIds: "",
value1: "",
value2: "",
value3: "",
value4: "",
value5: ""
});
}
}
},
changeResult(row) { // (0 1 0)
row.withOr = row.withOr === 0 ? 1 : 0;
row.resultOperation = row.resultOperation === 0 ? 1 : 0;
},
changeRule(row, index) { // (0 1 0)
row.ruleOperation = row.ruleOperation === 0 ? 1 : 0;
this.tableData[index - 1].ruleOperation = row.ruleOperation;
},
handleEdit(row) { //
this.tableDataCopy = deepCopy(this.tableData); //
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;
@ -315,7 +398,8 @@ export default {
if (row.isSave) {
this.$set(this.tableData, index, this.tableDataCopy[index]);
} else {
this.tableData.splice(index, 1);
this.tableData.splice(index-1, 2);
// this.tableData.splice(index, 1);
this.isAddRule = false;
}
},
@ -326,7 +410,12 @@ export default {
type: "warning",
center: true,
}).then(() => {
this.tableData.splice(index, 1);
if (index+1 == this.tableData.length){
this.tableData.splice(index - 1, 2)
}else{
this.tableData.splice(index,2);
}
this.itemkey = Math.random()
this.isAddRule = false;
}).catch(() => {})
},

@ -50,8 +50,8 @@
<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="addRules">新增</el-button>
<!-- <el-button v-if="!isView" type="primary" size="mini" @click="addRule">新增</el-button>-->
</div>
</div>
<el-dialog :visible.sync="configVisible" width="30%" title="批量新增判分点" center :append-to-body='true'>
@ -62,7 +62,9 @@
:data="treeData"
@check="currentChecked"
header-align="center"
show-checkbox node-key="id"
show-checkbox
ref="tree"
node-key="id"
:props="defaultProps">
</el-tree>
</div>
@ -78,9 +80,7 @@
:data="tableData"
:stripe="true"
:key="itemkey"
:cell-style="rowClass"
header-align="center"
:header-cell-style="headClass"
>
<el-table-column prop="indexNo" type="index" label="序号" width="80">
</el-table-column>
@ -129,7 +129,7 @@
<p class="p" style="margin-top: 1px">交易结果一致性规则用户交易结果需要与下面设置的交易结果指标要求一致</p>
<div class="block">
<!-- type: 题目类型(1选择 2判断 3填空 4问答 5指标结果) -->
<div v-if="scope.row.operationIds && scope.row.type == null" style="line-height: 65px">需点击</div>
<div v-if="scope.row.operationIds && scope.row.type == null" style="line-height: 65px;text-align: center">需点击</div>
<template v-if="scope.row.type == 1">
<div class="box">
<div class="line">
@ -396,9 +396,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;
}
@ -418,16 +416,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,
@ -448,18 +436,17 @@ export default {
},
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.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){
@ -476,7 +463,7 @@ export default {
this.anewPosttingDatas(list)
this.tableData.forEach(async (item, index) => {
//
// console.log(item)
item.operationIds = item.id
if (item.id) {
this.$nextTick(() => {
this.$refs[`tree-${index}`].setCheckedKeys([item.id]);
@ -492,9 +479,13 @@ export default {
let obj = {
...item,
isSubject: true,
isDisabled: true, //
isSave: true //
isDisabled: false, //
isSave: false //
};
if(item.type == undefined || item.type == ''){
item.operationIds = item.id
item.type = null
}
//(1 2 3 4 5)
if (item.type == 1 || item.type == 2) {
obj.subjectId = Number(item.emptyOne);
@ -587,18 +578,6 @@ export default {
});
},
handleCheckChange(data, checked, indeterminate, row, index) { //
// this.changeArr.push(checked)
// if(this.changeArr.length === 4) {
// this.checkChange.splice(index, 1, this.changeArr[2])
// this.changeArr.splice(0, this.changeArr.length)
// }else if(this.changeArr.length === 2) {
// this.checkChange.splice(index, 1, true)
// }
if (checked){
}else{
row.operationIds = null
row.type = null
}
if (checked && data.isNode === 1) {
this.tableData[index].operationIds = data.id; // id
row.value1 = "";
@ -606,14 +585,12 @@ export default {
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 +626,6 @@ export default {
let result = [];
data.forEach(item => {
if (item.isNode === 0) {
// item.disabled = true;
item.showCheckbox = false;
} else {
item.showCheckbox = true;
@ -774,14 +750,25 @@ export default {
}
},
addRules(){
this.configVisible = true
this.configVisible = true;
console.log(this.formData.lcJudgmentRuleList)
let operationIds = []
this.tableData.forEach(async (item, index) => {
//
if (item.operationIds) {
operationIds.push(item.operationIds)
}
});
this.$nextTick(() => {
this.$refs.tree.setCheckedKeys(operationIds);
})
},
addRule() { //
this.changeArr.splice(0, this.changeArr.length)
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 +807,6 @@ export default {
}else {
this.$message('请保存当前判分规则再新增!');
}
// anewPosttingData(judgmentRuleList)
},
changeResult(row) { // (0 1 0)
row.resultOperation = row.resultOperation === 0 ? 1 : 0;
@ -837,6 +823,9 @@ export default {
},
handleSave(row, index) { //
let keys = this.$refs[`tree-${index}`].getCheckedKeys();
if(!row.operationIds){
row.operationIds = keys[0]
}
if (!keys.length || !row.operationIds) {
this.$message.warning(`请选择操作点`);
return;
@ -889,8 +878,11 @@ export default {
this.$refs[`tree-${index}`].setCheckedKeys([this.tableData[index].operationIds]);
}
} else {
this.tableData.splice(index-1, 2);
// index ? this.tableData.splice(index - 1, 1) : this.tableData.splice(0, 1);
if (index+1 == this.tableData.length){
this.tableData.splice(index - 1, 2)
}else{
this.tableData.splice(index,2);
}
this.isAddRule = false;
}
},
@ -901,11 +893,11 @@ export default {
type: "warning",
center: true
}).then(() => {
// if(index+1 == this.tableData.length){
// index = index-1
// }
this.tableData.splice(index,2);
index ? this.tableData.splice(index - 1, 1) : this.tableData.splice(0, 1);
if (index+1 == this.tableData.length){
this.tableData.splice(index - 1, 2)
}else{
this.tableData.splice(index,2);
}
this.itemkey = Math.random()
this.tableData.forEach(async (item, index) => {
//
@ -972,7 +964,10 @@ export default {
margin-left: 20px;
}
}
.cell div{
margin: auto;
text-align: center;
}
//
.form-con {
padding-bottom: 24px;

Loading…
Cancel
Save