py项目增加上下且或判断

master
e 3 years ago
parent 4719526a71
commit cb81102b53
  1. 136
      src/views/Program.vue
  2. 47
      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,6 +84,7 @@
<el-table-column label=" " width="150">
<template slot-scope="scope">
<el-button
v-if="scope.row.isSubject"
:disabled="isView || scope.row.isDisabled"
type="primary" circle
@click="changeResult(scope.row)"
@ -91,10 +92,13 @@
>
{{ scope.row.withOr === 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 +109,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 +182,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 +198,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 = {
@ -281,19 +329,53 @@ export default {
}
},
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;
},
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;
@ -315,7 +397,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 +409,16 @@ export default {
type: "warning",
center: true,
}).then(() => {
this.tableData.splice(index, 1);
// this.tableData.splice(index, 1);
console.log(index)
console.log(this.tableData.length)
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>
@ -77,9 +77,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>
@ -128,7 +126,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">
@ -475,6 +473,7 @@ export default {
this.anewPosttingDatas(list)
this.tableData.forEach(async (item, index) => {
//
item.operationIds = item.id
// console.log(item)
if (item.id) {
this.$nextTick(() => {
@ -491,9 +490,15 @@ export default {
let obj = {
...item,
isSubject: true,
isDisabled: true, //
isSave: true //
isDisabled: false, //
isSave: false //
};
console.log(item)
if(item.type == undefined){
item.operationIds = item.id
item.type = null
}
//(1 2 3 4 5)
if (item.type == 1 || item.type == 2) {
obj.subjectId = Number(item.emptyOne);
@ -586,19 +591,15 @@ 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)
// console.log(checked)
// if (checked){
// }else{
// this.tableData[index].operationIds= null
// this.tableData[index].operationIds= null
// }
if (checked){
}else{
row.operationIds = null
row.type = 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 = "";
@ -836,6 +837,11 @@ 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]
}
if (!keys.length || !row.operationIds) {
this.$message.warning(`请选择操作点`);
return;
@ -971,7 +977,10 @@ export default {
margin-left: 20px;
}
}
.cell div{
margin: auto;
text-align: center;
}
//
.form-con {
padding-bottom: 24px;

Loading…
Cancel
Save