From e314f30de574edeb86f27555c275545b7d12b3a0 Mon Sep 17 00:00:00 2001 From: yangfeng <wanwan926_4@163.com> Date: 星期一, 04 三月 2024 16:50:22 +0800 Subject: [PATCH] 生丝定级标准页面开发、添加列及添加列输入框、删除列功能开发 --- src/views/systemSetting/silkStandardSetting/index.vue | 62 ++++++++++++++++++++++--------- 1 files changed, 44 insertions(+), 18 deletions(-) diff --git a/src/views/systemSetting/silkStandardSetting/index.vue b/src/views/systemSetting/silkStandardSetting/index.vue index 43fb89c..43383a0 100644 --- a/src/views/systemSetting/silkStandardSetting/index.vue +++ b/src/views/systemSetting/silkStandardSetting/index.vue @@ -3,7 +3,7 @@ <div class="filter-card"> <CommonSearch :show-add="false" :amount-view="false" placeholder="璇疯緭鍏ュ叧閿瘝" @searchClick="onFilterSearch"> <template slot="leftButton"> - <el-button size="small" type="primary" @click="addBtnClick">鏂板</el-button> + <el-button size="small" type="primary" @click="addBtnClick" :disabled="!isEdit">鏂板</el-button> <el-button size="small" type="primary" @click="refreshClick">鍒锋柊</el-button> <el-button size="small" type="primary" @click="printClick">鎵撳嵃</el-button> </template> @@ -24,6 +24,8 @@ @addProjectClick="addBtnClick" @clearupProject="clearupProject" @deleteClick="clearupProject" + @addColumnClick="addColumnClick" + @clearupColumn="clearupColumn" > </SilkTableList> </div> @@ -43,7 +45,24 @@ return { isEdit: false, silkTableList: {}, - tableData: [] + tableData: [], + tableColumn: [ + { label: "妫�鏌ラ」鐩悕绉�", prop: "projectName", projectName: true }, + { label: "寮�濮嬬氦搴�", prop: "start", inputFloat: true }, + { label: "缁撴潫绾ゅ害", prop: "end", inputFloat: true }, + { label: "閲庣氦", prop: "price1", inputFloat: true }, + { label: "澶ч噹", prop: "price2", inputFloat: true }, + { label: "鐗归噹", prop: "price3", inputFloat: true } + ], + columnNum: 0, + dataObj: { + projectName: "", + start: 0, + end: 0, + price1: 0, + price2: 0, + price3: 0 + } } }, created() { @@ -54,14 +73,7 @@ this.silkTableList = { tableData: this.tableData, isReturn: false, - tableColumn: [ - { label: "妫�鏌ラ」鐩悕绉�", prop: "projectName", projectName: true }, - { label: "寮�濮嬬氦搴�", prop: "start", inputFloat: true }, - { label: "缁撴潫绾ゅ害", prop: "end", inputFloat: true }, - { label: "閲庣氦", prop: "price1", inputFloat: true }, - { label: "澶ч噹", prop: "price2", inputFloat: true }, - { label: "鐗归噹", prop: "price3", inputFloat: true } - ] + tableColumn: this.tableColumn } }, // 鎼滅储 @@ -70,14 +82,7 @@ }, // 鏂板 addBtnClick() { - this.tableData.push({ - projectName: "", - start: 0, - end: 0, - price1: 0, - price2: 0, - price3: 0 - }) + this.tableData.push(this.dataObj) }, // 鍒锋柊 refreshClick() {}, @@ -95,6 +100,27 @@ // 淇濆瓨缂栬緫鎸夐挳鍒囨崲 editSaveClick() { this.isEdit = !this.isEdit + }, + // 娣诲姞鍒� + addColumnClick() { + let propStr = "trends" + this.columnNum + this.tableColumn.splice(2, 0, { label: "", prop: propStr, inputFloat: true, addColumn: true }) + this.$set(this.dataObj, propStr, 0) + console.log(this.tableColumn) + this.silkTableList.tableColumn = this.tableColumn + this.columnNum += 1 + }, + // 鍒犻櫎鍒� + clearupColumn(prop) { + let currentIndex = 0 + this.tableColumn.map((item, index) => { + if (item.prop == prop) { + currentIndex = index + } + }) + this.tableColumn.splice(currentIndex, 1) + this.silkTableList.tableColumn = this.tableColumn + this.$delete(this.dataObj, prop) } } } -- Gitblit v1.8.0