zuozhengqing
2023-11-02 a7f37d5a76f80df4bad37a58ad95ab41ba0be22e
src/views/purchaseManage/purchase/components/SelectSupplierDialog.vue
@@ -27,6 +27,7 @@
          :table-list="tableList"
          :select-box="false"
          @selCommonClick="selNameClick"
          @selTableCol="selTableCol"
        >
        </TableCommonView>
        <div slot="footer" class="dialog-footer">
@@ -66,34 +67,54 @@
      loading: false,
      searchOptions: [],
      tableList: {},
      search_map: {}
      search_map: {},
      tableColumn: [
        { label: "供应商编号", prop: "number", min: 190, isCommonClick: true },
        { label: "供应商名称", prop: "name", min: 130 },
        { label: "供应商类型", prop: "supplierType", min: 130 },
        { label: "所属行业", prop: "industry", min: 130 },
        { label: "联系人", prop: "contact", min: 130 },
        { label: "联系电话", prop: "phone", min: 130 },
        { label: "状态", prop: "status_name", min: 130 },
        { label: "创建时间", prop: "member_name", min: 130 }
      ],
      showCol: ['供应商编号', '供应商名称', '供应商类型', '所属行业', '联系人', '联系电话','状态','创建时间']
    }
  },
  created() {
    this.setTable()
    this.getData()
  },
  mounted(){
  },
  methods: {
    setTable() {
      this.tableList = {
        tableInfomation: [],
        tableColumn: [
         { label: "供应商编号", prop: "number", min: 190, isCommonClick: true },
          { label: "供应商名称", prop: "name", min: 130 },
          { label: "供应商类型", prop: "supplierType", min: 130 },
          { label: "所属行业", prop: "industry", min: 130 },
          { label: "联系人", prop: "contact", min: 130 },
          { label: "联系电话", prop: "phone", min: 130 },
          { label: "状态", prop: "status_name", min: 130 },
          { label: "创建时间", prop: "member_name", min: 130 }
        ]
        tableColumn:this.setColumnVisible(this.showCol),
        showcol: this.showCol,
        allcol:[]
      }
      this.tableList.allcol = this.tableList.tableColumn.filter(ele=>!ele.default).map(ele=>ele.label);
      this.searchOptions = []
      for (let i = 0; i < this.tableList.tableColumn.length; i++) {
        const label = this.tableList.tableColumn[i].label
        const value = this.tableList.tableColumn[i].prop
        this.searchOptions.push({ value: value, label: label })
      }
    },
    selTableCol(val) {
      this.showcol = val;
      this.tableList.tableColumn = this.setColumnVisible(val);
    },
    setColumnVisible(showCol){
      return  this.tableColumn.map(ele=>{
        return {
          ...ele,
          isShowColumn:showCol.includes(ele.label)
        }
      })
    },
    handleClose() {
      this.editConfig.editVisible = false
@@ -115,7 +136,8 @@
                  status_name: item.status === 0 ? "未启用" : "启用"
                }
              })
              this.tableList.tableInfomation = list.slice(0, 5) || []
              // this.tableList.tableInfomation = list.slice(0, 5) || []
              this.tableList.tableInfomation = list
            } else {
              this.tableList.tableInfomation = []
            }