From 79fd1696ef2b6d4a3f553053ac1e653e3106752e Mon Sep 17 00:00:00 2001 From: xiongchengqiang Date: Tue, 8 Dec 2020 10:33:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/kpi/assessment/goals/index.vue | 27 ++++++-- .../components/UseButton/index.vue | 66 +++++++++++++++++-- .../kpi/assessment/performance/index.vue | 5 +- 3 files changed, 86 insertions(+), 12 deletions(-) diff --git a/src/views/kpi/assessment/goals/index.vue b/src/views/kpi/assessment/goals/index.vue index 54b7e95..f1ef55e 100644 --- a/src/views/kpi/assessment/goals/index.vue +++ b/src/views/kpi/assessment/goals/index.vue @@ -207,6 +207,9 @@ export default { handleNumber (item) { return item.detailDtos ? item.detailDtos.filter(i => !i.isDelete).length : 0 }, + handleFilter (item) { + return item ? item.filter(i => !i.isDelete) : [] + }, async handleGetNext () { const arr = this.handleFilter(this.obj.recortModelDtos) if (arr.some(i => i.weight === null)) { @@ -235,7 +238,6 @@ export default { const obj = { status: 1, menuName: '制定了' } const params = Object.assign({}, { resultRecordId: this.$route.query.id || '' }, obj) let res = await apiSaveapproval(params) - console.log("🚀 ~ file: index.vue ~ line 238 ~ handleGetNext ~ res", res) if (res.code !== 200) { this.$message.error(res.msg || '出错了 ') return @@ -299,16 +301,30 @@ export default { this.showIndicators = false }, handleSubmitZhibiao () { + console.log(this.formIndicators) + const arr = this.obj.recortModelDtos[this.formIndicators.dazhibiaoIndex].detailDtos this.$refs.formIndicators.validate((v) => { if (v) { if (this.formIndicators.index === -1) { - this.obj.recortModelDtos[this.formIndicators.dazhibiaoIndex].detailDtos.push(Object.assign({}, this.formIndicators, { checkWeight: this.formIndicators.checkWeight / 100 })) + arr.push(Object.assign({}, this.formIndicators, { checkWeight: this.formIndicators.checkWeight / 100 })) } else { - this.obj.recortModelDtos[this.formIndicators.dazhibiaoIndex].detailDtos[this.formIndicators.index] = Object.assign({}, this.formIndicators, { checkWeight: this.formIndicators.checkWeight / 100 }) + let _index = 0 + this.obj.recortModelDtos[this.formIndicators.dazhibiaoIndex].detailDtos = arr.map(i => { + if (i.isDelete !== 1) { + if (_index === this.formIndicators.index) { + i = Object.assign({}, this.formIndicators, { checkWeight: this.formIndicators.checkWeight / 100 }) + } + _index++ + + } + return i + }) } + this.$forceUpdate() this.showIndicators = false } }) + console.log(" this.obj", this.obj) }, // 编辑 hanidleEdit (item, index, type) { @@ -319,6 +335,7 @@ export default { return } } + this.zhibiaoTitle = index === -1 ? "添加指标" : "编辑指标" if (index === -1) { this.formIndicators = { checkWeight: 0 @@ -341,9 +358,7 @@ export default { this.obj.recortModelDtos[type].detailDtos = this.obj.recortModelDtos[type].detailDtos.filter(i => i !== item) this.$forceUpdate() }, - handleFilter (item) { - return item ? item.filter(i => !i.isDelete) : [] - }, + async handleGetTbale (id = this.$route.query.id) { let res = await apiResultGetDetail({ id }) if (res.code !== 200) return diff --git a/src/views/kpi/assessment/performance/components/UseButton/index.vue b/src/views/kpi/assessment/performance/components/UseButton/index.vue index 2b93c77..56c1b9c 100644 --- a/src/views/kpi/assessment/performance/components/UseButton/index.vue +++ b/src/views/kpi/assessment/performance/components/UseButton/index.vue @@ -123,9 +123,9 @@