songshankun
2023-09-28 85a5f98e4dd42ca13e3a9543432c8c4f8f64811e
feat: 销售子单页列表配置列显隐控制
1个文件已修改
38 ■■■■ 已修改文件
src/views/sales/subOrder/index.vue 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sales/subOrder/index.vue
@@ -34,6 +34,7 @@
              @selMasterClick="selMasterClick"
              @selCommonClick="selCommonClick"
              @getSelectArray="getSelectArray"
              @selTableCol="selTableCol"
          >
            <template slot="tableButton">
              <el-table-column label="操作" width="90">
@@ -142,7 +143,17 @@
      searchSel: {
        value: "number",
        label: "单据编号"
      }
      },
      tableColumn: [
        { label: "单据编号", prop: "number", min: 120, isCommonClick: true,default: true }, // 单据编号
        { label: "客户名称", prop: "client_name", min: 120, isClientClick: true }, // 客户名称
        { label: "销售总单", prop: "master_order_number", min: 90, isMasterClick: true }, // 销售总单
        { label: "负责人", prop: "member_name" }, // 负责人
        // { label: "审批状态", prop: "approvalStatus" }, // 审批状态
        { label: "产品名称", prop: "productName", isProductName: true }, // 产品名称
        { label: "数量", prop: "productAmount", isProductAmount: true } // 数量
      ],
      showCol:["单据编号", "客户名称", "销售总单", "负责人", "产品名称", "数量"]
    }
  },
  created() {
@@ -160,16 +171,11 @@
    setTable() {
      this.tableList = {
        tableInfomation: [],
        tableColumn: [
          { label: "单据编号", prop: "number", min: 120, isCommonClick: true }, // 单据编号
          { label: "客户名称", prop: "client_name", min: 120, isClientClick: true }, // 客户名称
          { label: "销售总单", prop: "master_order_number", min: 90, isMasterClick: true }, // 销售总单
          { label: "负责人", prop: "member_name" }, // 负责人
          // { label: "审批状态", prop: "approvalStatus" }, // 审批状态
          { label: "产品名称", prop: "productName", isProductName: true }, // 产品名称
          { label: "数量", prop: "productAmount", isProductAmount: true } // 数量
        ]
        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
@@ -177,6 +183,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