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

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

Loading…
Cancel
Save