songshankun
2023-10-10 74fae92c3fd076359385d27c5ac4e769a38522ab
src/views/client/contacts/index.vue
@@ -31,6 +31,7 @@
              @selContactsClick="selContactsClick"
              @selClientClick="selClientClick"
              @getSelectArray="getSelectArray"
              @selTableCol="selTableCol"
          >
            <template slot="tableButton">
              <el-table-column label="操作" width="90" fixed="right">
@@ -128,7 +129,17 @@
        title: "新建",
        infomation: {}
      },
      search_map: {}
      search_map: {},
      tableColumn: [
        { label: "联系人姓名", prop: "name", min: 100, isContactClick: true, default: true }, // 联系人姓名
        { label: "客户名称", prop: "client_name", min: 190, isClientClick: true }, // 客户名称
        { label: "联系人编号", prop: "number", min: 100 }, // 联系人编号
        { label: "职务", prop: "position", min: 120 }, // 职务
        { label: "手机", prop: "phone", min: 100 }, // 手机号码
        { label: "销售负责人", prop: "member_name", min: 120 }, // 销售负责人
        { label: "首要联系人", prop: "is_first", isFirst: true, min: 90 } // 首要联系人
      ],
      showCol: ['联系人姓名','客户名称','联系人编号','职务','手机','销售负责人','首要联系人']
    }
  },
  created() {
@@ -146,16 +157,11 @@
    setTable() {
      this.tableList = {
        tableInfomation: [],
        tableColumn: [
          { label: "联系人姓名", prop: "name", min: 100, isContactClick: true }, // 联系人姓名
          { label: "客户名称", prop: "client_name", min: 190, isClientClick: true }, // 客户名称
          { label: "联系人编号", prop: "number", min: 100 }, // 联系人编号
          { label: "职务", prop: "position", min: 120 }, // 职务
          { label: "手机", prop: "phone", min: 100 }, // 手机号码
          { label: "销售负责人", prop: "member_name", min: 120 }, // 销售负责人
          { label: "首要联系人", prop: "is_first", isFirst: true, min: 90 } // 首要联系人
        ]
        allcol: [],
        showcol: this.showCol,
        tableColumn:this.setColumnVisible(this.showCol)
      }
      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
@@ -163,6 +169,18 @@
        this.searchOptions.push({ value: value, label: label })
      }
    },
    setColumnVisible(showCol){
      return  this.tableColumn.map(ele=>{
        return {
          ...ele,
          isShowColumn:showCol.includes(ele.label)
        }
      })
    },
    selTableCol(val) {
      this.showcol = val;
      this.tableList.tableColumn = this.setColumnVisible(val);
    },
    // 请求数据
    async getData() {
      this.loading = true