| | |
| | | return { |
| | | dialogWidth: "20%", |
| | | editConfig: this.editDropdownConfig, |
| | | tableData: [] |
| | | tableData: [], |
| | | isName: false |
| | | } |
| | | }, |
| | | created() { |
| | |
| | | pageSize: 100 |
| | | }).then((res) => { |
| | | console.log(res.data) |
| | | this.tableData = res.data.data.list |
| | | this.tableData = res.data.list |
| | | }) |
| | | }, |
| | | // 所属行业 |
| | |
| | | name: "" |
| | | }) |
| | | }, |
| | | // 判断添加name是否为空 |
| | | determineNameEmpty(data) { |
| | | for (let i = 0; i < data.length; i++) { |
| | | if (data[i].name.length === 0) { |
| | | this.isName = true |
| | | break |
| | | } else { |
| | | this.isName = false |
| | | } |
| | | } |
| | | }, |
| | | 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() |
| | | } |
| | | this.determineNameEmpty(this.tableData) |
| | | if (this.isName) { |
| | | this.$message.error("名称不能为空") |
| | | } else { |
| | | this.tableData.map((ite) => { |
| | | ite.ID = 0 |
| | | return { ...ite } |
| | | }) |
| | | } 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() |
| | | } |
| | | }) |
| | | 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() |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | } |