yangfeng
2023-08-26 8380b537474be9b9aa24efcd65c730e2907b9b8b
src/views/other/commonDialog/EditDropdownDialog.vue
@@ -55,7 +55,7 @@
</template>
<script>
import { getSupplierTypeList, updateSupplierType } from "@/api/supplierManage/supplier"
import { getSupplierTypeList, updateSupplierType, updateIndustry, getIndustryList } from "@/api/supplierManage/supplier"
export default {
  name: "EditDropdownDialog",
  props: {
@@ -90,6 +90,8 @@
    setList() {
      if (this.editConfig.title === "供应商类型") {
        this.getSupplierTypeList()
      } else if (this.editConfig.title === "所属行业") {
        this.getIndustryList()
      }
    },
    // 供应商类型
@@ -98,13 +100,20 @@
        page: 1,
        pageSize: 100
      }).then((res) => {
        console.log("dsss")
        console.log(res.data)
        this.tableData = res.data.data.list
      })
    },
    // 所属行业
    async getIndustryList() {},
    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
    },
@@ -151,12 +160,16 @@
    // 新增下拉框
    addDropdown() {
      this.tableData.push({
        name: "",
        id: 0
        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
@@ -164,7 +177,19 @@
          console.log(res)
          if (res.code === 200) {
            this.$message.success("编辑成功")
            this.$parent.getData()
            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()
          }
        })
      }