From 1c4b5c617f5a27f7ce23c7852a838242c37d3590 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Tue, 26 Mar 2024 16:42:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=88=A0=E9=99=A4=E7=AD=89?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Transaction.vue | 45 +++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/src/views/Transaction.vue b/src/views/Transaction.vue index 87b149a..f2b59b0 100644 --- a/src/views/Transaction.vue +++ b/src/views/Transaction.vue @@ -17,7 +17,7 @@ 保存 + @click="submit">保存 @@ -106,6 +106,10 @@ type="primary" size="mini" @click="batchDel">批量删除 + 一键保存 {{ scope.row.resultOperation === 0 ? "且" : "或" }} @@ -480,6 +484,7 @@ + @@ -769,11 +774,11 @@ export default { const temp = item.emptyTwo.split('~') if (temp.length) { const symbol = temp[0].match(/[<>=]+/g) - const num = temp[0].match(/\d+/g) - const unit = temp[0].match(/[^<>=\d]+/g) + const num = temp[0].match(/[\d\.]+/g) + const unit = temp[0].match(/[^<>=\d\.]+/g) const symbol1 = temp.length > 1 ? temp[1].match(/[<>=]+/g) : '' - const num1 = temp.length > 1 ? temp[1].match(/\d+/g) : '' - const unit1 = temp.length > 1 ? temp[1].match(/[^<>=\d]+/g) : '' + const num1 = temp.length > 1 ? temp[1].match(/[\d\.]+/g) : '' + const unit1 = temp.length > 1 ? temp[1].match(/[^<>=\d\.]+/g) : '' obj.value2 = symbol ? symbol[0] : '' obj.value3 = num ? num[0] : '' obj.value4 = unit ? unit[0] : '' @@ -837,11 +842,11 @@ export default { const temp = item.emptyTwo.split('~') if (temp.length) { const symbol = temp[0].match(/[<>=]+/g) - const num = temp[0].match(/\d+/g) - const unit = temp[0].match(/[^<>=\d]+/g) + const num = temp[0].match(/[\d\.]+/g) + const unit = temp[0].match(/[^<>=\d\.]+/g) const symbol1 = temp.length > 1 ? temp[1].match(/[<>=]+/g) : '' - const num1 = temp.length > 1 ? temp[1].match(/\d+/g) : '' - const unit1 = temp.length > 1 ? temp[1].match(/[^<>=\d]+/g) : '' + const num1 = temp.length > 1 ? temp[1].match(/[\d\.]+/g) : '' + const unit1 = temp.length > 1 ? temp[1].match(/[^<>=\d\.]+/g) : '' obj.value2 = symbol ? symbol[0] : '' obj.value3 = num ? num[0] : '' obj.value4 = unit ? unit[0] : '' @@ -980,7 +985,7 @@ export default { }).catch(err => { }); } }, - saveAll () { // 保存判分点 + submit () { // 保存判分点 const point = this.formData.lcJudgmentPoint if (!point.name) { this.$message.warning(`判分点名称不能为空`); @@ -1045,7 +1050,7 @@ export default { } else if (i.type == 5) { // obj.emptyOne = i.value1; // 选择指标不传 obj.emptyOne = i.subjectId ? i.subjectId.toString() : ""; - obj.emptyTwo = `${i.value2 || ''}${i.value3}${i.value4}${i.value5 ? '~' + i.value5 : ''}${i.value6}${i.value7 || ''}`; + obj.emptyTwo = `${i.value2 || ''}${i.value3 || ''}${i.value4 || ''}${i.value5 ? '~' + i.value5 : ''}${i.value6 || ''}${i.value7 || ''}`; } else if (i.type == 6) { const money = [] const { moneys } = this @@ -1172,10 +1177,6 @@ export default { row.isSave = false; }, handleSave (row, index) { // 处理保存规则 - // let keys = this.$refs[`tree-${index}`].getCheckedKeys(); - // if(!row.operationIds){ - // row.operationIds = keys[0] - // } if (!row.operationIds) { this.$message.warning(`请选择操作点`); return; @@ -1288,10 +1289,11 @@ export default { type: "warning", center: true }).then(() => { - const ids = this.multipleSelection.map(e => e.id) + const prop = this.isAdd ? 'index' : 'id' + const ids = this.multipleSelection.map(e => e[prop]) const list = this.tableData ids.map((e, i) => { - const index = list.findIndex(j => j.id === e) + const index = list.findIndex(j => j[prop] === e) if (index !== -1) { this.tableData.splice(index === this.tableData.length - 1 ? index - 1 : index, 2) } @@ -1310,6 +1312,13 @@ export default { this.$message.error('请先选择数据 !') } }, + // 一键保存 + saveAll () { + this.tableData.forEach(e => { + e.isDisabled = true + e.isSave = true + }) + }, // 表头样式设置 headClass () { return "text-align: center;";