一键保存

master
yujialong 8 months ago
parent 1c4b5c617f
commit b95a3c87c1
  1. 25
      src/views/Program.vue
  2. 45
      src/views/Transaction.vue

@ -14,7 +14,7 @@
<el-button v-if="!isView"
type="primary"
size="mini"
@click="saveAll">保存</el-button>
@click="submit">保存</el-button>
</div>
</div>
@ -76,6 +76,10 @@
type="primary"
size="mini"
@click="batchDel">批量删除</el-button>
<el-button v-if="!isView"
type="primary"
size="mini"
@click="saveAll">一键保存</el-button>
<el-button v-if="!isView"
type="primary"
size="mini"
@ -320,7 +324,7 @@ export default {
});
}
},
saveAll () { //
submit () { //
if (this.isNameRepeat) {
this.$message.warning(`当前判分点名称已存在`);
return;
@ -446,14 +450,16 @@ export default {
this.tableDataCopy = deepCopy(this.tableData); //
row.isDisabled = false;
},
handleSave (row) { //
handleSave (row, i) { //
const pre = typeof i === 'number' ? `${i + 1}项,` : ''
if (!row.required && !row.result) {
this.$message.warning(`规则与结果至少填写一个`);
this.$message.warning(pre + `规则与结果至少填写一个`);
return;
}
row.isSave = true;
row.isDisabled = true;
this.isAddRule = false;
return true
},
handleCancel (row, index) { //
if (row.isSave) {
@ -507,6 +513,17 @@ export default {
this.$message.error('请先选择数据 !')
}
},
//
saveAll () {
for (const e of this.tableData) {
if (e.isSubject) {
const result = this.handleSave(e, e.index)
if (!result) break
e.isDisabled = true
e.isSave = true
}
}
},
//
headClass () {
return "text-align: center;";

@ -466,7 +466,7 @@
<el-button v-show="!scope.row.isDisabled"
size="mini"
type="text"
@click="handleSave(scope.row, scope.$index)">保存
@click="handleSave(scope.row)">保存
</el-button>
<!-- <el-button v-show="!scope.row.isDisabled"
size="mini"
@ -1176,53 +1176,51 @@ export default {
row.isDisabled = false;
row.isSave = false;
},
handleSave (row, index) { //
handleSave (row, i) { //
const pre = typeof i === 'number' ? `${i + 1}项,` : ''
if (!row.operationIds) {
this.$message.warning(`请选择操作点`);
this.$message.warning(pre + `请选择操作点`);
return;
} else {
//(1 2 3 4 5)
if (row.type == 1 || row.type == 2) {
if (row.type == 1 && this.isSt) {
if (!row.value1.length) {
this.$message.warning(`请选择正确答案`);
this.$message.warning(pre + `请选择正确答案`);
return;
}
} else if (!row.value1) {
this.$message.warning(`请选择正确答案`);
this.$message.warning(pre + `请选择正确答案`);
return;
}
} else if (row.type == 3) {
if (!row.value1) {
this.$message.warning(`请输入字段要求`);
return;
this.$message.warning(pre + `请输入字段要求`);
return
}
} else if (row.type == 4) {
if (!row.value1) {
this.$message.warning(`请选择字数要求`);
this.$message.warning(pre + `请选择字数要求`);
return;
} else if (row.value1 !== "无限制" && !row.value2) {
this.$message.warning(`请输入字数要求`);
this.$message.warning(pre + `请输入字数要求`);
return;
} else if (!row.value3) {
this.$message.warning(`请输入字段要求`);
this.$message.warning(pre + `请输入字段要求`);
return;
}
} else if (row.type == 5) {
if ((!row.value2 || !row.value5) && !this.isSt) {
this.$message.warning(`请选择交易指标区间`);
return;
} else if ((!row.value3 || !row.value5) && !this.isSt) {
this.$message.warning(`请输入交易指标区间`);
if (!row.value2 && !row.value3 && !row.value4 && !row.value5 && !row.value6 && !row.value7) {
this.$message.warning(pre + `请输入交易指标区间`);
return;
} else if (row.value3 && row.value5 && !isNaN(row.value3) && !isNaN(row.value5) && +row.value3 > +row.value5) {
this.$message.warning(`第一个指标必须小于第二个指标`);
this.$message.warning(pre + `第一个指标必须小于第二个指标`);
return;
}
} else if (row.type == 6) {
for (let i = 1; i < 9; i++) {
if (row['check' + i] && row['val' + i] === '') {
this.$message.warning(`请输入数量`)
this.$message.warning(pre + `请输入数量`)
return
}
}
@ -1231,6 +1229,7 @@ export default {
row.isSave = true;
row.isDisabled = true;
this.isAddRule = false;
return true
},
handleCancel (row, index) { //
if (this.judgePoints == true) {
@ -1314,10 +1313,14 @@ export default {
},
//
saveAll () {
this.tableData.forEach(e => {
e.isDisabled = true
e.isSave = true
})
for (const e of this.tableData) {
if (e.isSubject) {
const result = this.handleSave(e, e.index)
if (!result) break
e.isDisabled = true
e.isSave = true
}
}
},
//
headClass () {

Loading…
Cancel
Save