From 4d8ba785800a8c478f55d93ae274fcf7ac76a3aa Mon Sep 17 00:00:00 2001 From: songshankun <songshankun@foxmail.com> Date: 星期六, 23 九月 2023 14:24:23 +0800 Subject: [PATCH] feat: 调整各个表格列默认显隐/可配置情况 --- src/views/other/commonDialog/EditDropdownDialog.vue | 102 +++++++++++++++++++++++++++++++++----------------- 1 files changed, 67 insertions(+), 35 deletions(-) diff --git a/src/views/other/commonDialog/EditDropdownDialog.vue b/src/views/other/commonDialog/EditDropdownDialog.vue index 2562bd7..61713a6 100644 --- a/src/views/other/commonDialog/EditDropdownDialog.vue +++ b/src/views/other/commonDialog/EditDropdownDialog.vue @@ -13,12 +13,7 @@ <el-input v-model="scope.row.name" size="mini"></el-input> </template> </el-table-column> - <el-table-column label="鏄剧ず棰滆壊" prop="color"> - <template slot-scope="scope"> - <el-color-picker v-model="scope.row.color" size="small" @change="colorClick(scope.row)"></el-color-picker> - </template> - </el-table-column> - <el-table-column label="璁句负榛樿" prop="setDefault"> + <!-- <el-table-column label="璁句负榛樿" prop="setDefault"> <template slot-scope="scope"> <el-switch v-model="scope.row.setDefault" @@ -29,7 +24,7 @@ > </el-switch> </template> - </el-table-column> + </el-table-column> --> <el-table-column label="鎿嶄綔" width="110px"> <template slot-scope="scope"> <i @@ -50,10 +45,9 @@ </el-table> <div style="padding: 10px"> <el-button type="text" size="mini" @click="addDropdown">鏂板涓嬫媺妗�</el-button> - <el-button type="text" size="mini">鎭㈠榛樿棰滆壊</el-button> </div> <div slot="footer"> - <el-button type="primary" size="small" @click="editConfig.editVisible = false">淇濆瓨</el-button> + <el-button type="primary" size="small" @click="saveClick">淇濆瓨</el-button> <el-button size="small" @click="editConfig.editVisible = false">鍙栨秷</el-button> </div> </el-dialog> @@ -61,6 +55,7 @@ </template> <script> +import { getSupplierTypeList, updateSupplierType, updateIndustry, getIndustryList } from "@/api/supplierManage/supplier" export default { name: "EditDropdownDialog", props: { @@ -85,32 +80,40 @@ return { dialogWidth: "20%", editConfig: this.editDropdownConfig, - tableData: [ - { - name: "1", - color: "red", - setDefault: true - }, - { - name: "2", - color: "blue", - setDefault: false - }, - { - name: "3", - color: null, - setDefault: false - }, - { - name: "4", - color: null, - setDefault: false - } - ] + tableData: [] } }, - created() {}, + created() { + this.setList() + }, methods: { + setList() { + if (this.editConfig.title === "渚涘簲鍟嗙被鍨�") { + this.getSupplierTypeList() + } else if (this.editConfig.title === "鎵�灞炶涓�") { + this.getIndustryList() + } + }, + // 渚涘簲鍟嗙被鍨� + async getSupplierTypeList() { + await getSupplierTypeList({ + page: 1, + pageSize: 100 + }).then((res) => { + console.log(res.data) + this.tableData = res.data.data.list + }) + }, + // 鎵�灞炶涓� + async getIndustryList() { + await getIndustryList({ + page: 1, + pageSize: 100 + }).then((res) => { + console.log(res.data) + this.tableData = res.data.data.list + }) + }, handleClose() { this.editConfig.editVisible = false }, @@ -157,10 +160,39 @@ // 鏂板涓嬫媺妗� addDropdown() { this.tableData.push({ - name: "5", - color: null, - setDefault: false + ID: 0, + name: "" }) + }, + async saveClick() { + console.log(this.tableData) + this.tableData.map((ite) => { + ite.ID = 0 + return { ...ite } + }) + if (this.editConfig.title === "渚涘簲鍟嗙被鍨�") { + updateSupplierType({ + supplierTypes: this.tableData + }).then((res) => { + console.log(res) + if (res.code === 200) { + this.$message.success("缂栬緫鎴愬姛") + this.$parent.getSupplierTypeList() + this.handleClose() + } + }) + } else if (this.editConfig.title === "鎵�灞炶涓�") { + updateIndustry({ + industries: this.tableData + }).then((res) => { + console.log(res) + if (res.code === 200) { + this.$message.success("缂栬緫鎴愬姛") + this.$parent.getIndustryList() + this.handleClose() + } + }) + } } } } -- Gitblit v1.8.0