From 63247f9a30dab37cb21099e9bc020136c2578249 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=86=8A=E6=88=90=E5=BC=BA?= Date: Wed, 28 Oct 2020 20:18:18 +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 | 76 +++++++++++++++++------- 1 file changed, 54 insertions(+), 22 deletions(-) diff --git a/src/views/kpi/assessment/goals/index.vue b/src/views/kpi/assessment/goals/index.vue index 55f0f29..a023e5b 100644 --- a/src/views/kpi/assessment/goals/index.vue +++ b/src/views/kpi/assessment/goals/index.vue @@ -3,14 +3,20 @@
- +
+ +
+ 暂存 + 提交 +
+
+ > -
{{j.target}}
+
{{j.target}}
{{j.keyResult}}
-
{{j.checkWeight * 100}}%
+
{{ Math.round((j.checkWeight * 100)*1000)/1000}}%
- 增加指标项 + 增加指标项
@@ -85,7 +91,7 @@ - + @@ -118,7 +124,7 @@ export default { message: '请输入考核标准', trigger: 'blur' } ], - weight: [{ required: true, + checkWeight: [{ required: true, message: '请输入权重大小', trigger: 'blur' } ] @@ -130,6 +136,7 @@ export default { options1: { group: 'names', draggable: '.items', + handle: '.my-handle', scroll: true, sort: true, // 内部排序列表 delay: 0, // 以毫秒为单位定义排序何时开始。 @@ -163,16 +170,25 @@ export default { } res = res.data this.dimensionsList = res - console.log('res: ', res) } catch (error) { this.$message.error(error.msg) } }, handleCancelZhibiao () { - + this.showIndicators = false }, handleSubmitZhibiao () { - + 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})) + console.log('this.obj.recortModelDtos[this.formIndicators.dazhibiaoIndex].: ', this.obj.recortModelDtos[this.formIndicators.dazhibiaoIndex]) + } else { + this.obj.recortModelDtos[this.formIndicators.dazhibiaoIndex].detailDtos[this.formIndicators.index] = Object.assign({}, this.formIndicators, {checkWeight: this.formIndicators.checkWeight / 100}) + } + this.showIndicators = false + } + }) }, handleAddIndicators (item) { console.log(item) @@ -181,14 +197,25 @@ export default { }, // 编辑 hanidleEdit (item, index, type) { - console.log('type: ', type) - console.log('index: ', index) - console.log('item: ', item) + if (index === -1) { + this.formIndicators = {} + } else { + this.formIndicators = Object.assign({}, item) + this.formIndicators.checkWeight = this.formIndicators.checkWeight * 100 + } + this.formIndicators.dazhibiaoIndex = type + this.formIndicators.index = index + this.formIndicators.type = item.type + this.showIndicators = true }, handleDelateWeidu (item, index, type) { - console.log('type: ', type) - console.log('index: ', index) - console.log('item: ', item) + if (item.id) { + item.isDelete = 1 + this.$forceUpdate() + return + } + 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) : [] @@ -199,9 +226,6 @@ export default { this.obj = res.data this.activeId = String(res.data.recortModelDtos[0].id) console.log('res: ', res) - }, - handleClick (tab, event) { - console.log(tab, event) } }, watch: {} @@ -212,8 +236,16 @@ export default {