yangfeng
2023-10-10 7d7fbe920279c9d7a42268a284427d2c42d8f0f2
src/views/sales/contractManage/index.vue
@@ -26,6 +26,7 @@
              :table-list="tableList"
              @selCommonClick="selCommonClick"
              @getSelectArray="getSelectArray"
              @selTableCol="selTableCol"
          >
            <template slot="tableButton">
              <el-table-column label="操作" width="100">
@@ -104,7 +105,15 @@
      searchSel: {
        value: "number",
        label: "单据编号"
      }
      },
      tableColumn: [
        { label: "单据编号", prop: "number", min: 120, isCommonClick: true, default: true },
        { label: "负责人", prop: "member_name", min: 90 },
        { label: "客户名称", prop: "client_name" },
        { label: "合同状态", prop: "serviceContractStatus_name", min: 100 },
        { label: "创建时间", prop: "created_at" }
      ],
      showCol:["单据编号", "负责人", "客户名称", "合同状态", "创建时间"]
    }
  },
  created() {
@@ -122,14 +131,11 @@
    setTable() {
      this.tableList = {
        tableInfomation: [],
        tableColumn: [
          { label: "单据编号", prop: "number", min: 120, isCommonClick: true },
          { label: "负责人", prop: "member_name", min: 90 },
          { label: "客户名称", prop: "client_name" },
          { label: "合同状态", prop: "serviceContractStatus_name", min: 100 },
          { label: "创建时间", prop: "created_at" }
        ]
        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
@@ -137,6 +143,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