songshankun
2023-10-10 74fae92c3fd076359385d27c5ac4e769a38522ab
src/views/service/serviceContract/index.vue
@@ -31,6 +31,7 @@
              @selClientClick="selClientClick"
              @selCommonClick="selCommonClick"
              @getSelectArray="getSelectArray"
              @selTableCol="selTableCol"
          >
            <template slot="tableButton">
              <el-table-column label="操作" width="60">
@@ -128,7 +129,20 @@
      },
      selValueList: [],
      keyword: "",
      keywordType: ""
      keywordType: "",
      tableColumn: [
        { label: "服务合同编号", prop: "number", isCommonClick: true, default: true }, // 服务合同编号
        { label: "客户名称", prop: "client_name", isClientClick: true }, // 客户名称
        { label: "签约日期", prop: "signTime" }, // 签约日期
        { label: "合同类型", prop: "serviceContractType" }, // 合同类型
        { label: "合同状态", prop: "serviceContractStatus" }, // 合同状态
        { label: "负责人", prop: "member_name" }, // 负责人
        { label: "产品名称", prop: "productName", isProductName: true }, // 产品名称
        { label: "服务开始日", prop: "startTime" }, // 服务开始日
        { label: "服务到期日", prop: "endTime" }, // 服务到期日
        { label: "价税合计", prop: "amountTotal" } // 价税合计
      ],
      showCol:["服务合同编号", "客户名称", "签约日期", "合同类型", "合同状态", "负责人", "产品名称", "服务开始日", "服务到期日", "价税合计"]
    }
  },
  created() {
@@ -146,25 +160,29 @@
    setTable() {
      this.tableList = {
        tableInfomation: [],
        tableColumn: [
          { label: "服务合同编号", prop: "number", isCommonClick: true }, // 服务合同编号
          { label: "客户名称", prop: "client_name", isClientClick: true }, // 客户名称
          { label: "签约日期", prop: "signTime" }, // 签约日期
          { label: "合同类型", prop: "serviceContractType" }, // 合同类型
          { label: "合同状态", prop: "serviceContractStatus" }, // 合同状态
          { label: "负责人", prop: "member_name" }, // 负责人
          { label: "产品名称", prop: "productName", isProductName: true }, // 产品名称
          { label: "服务开始日", prop: "startTime" }, // 服务开始日
          { label: "服务到期日", prop: "endTime" }, // 服务到期日
          { label: "价税合计", prop: "amountTotal" } // 价税合计
        ]
        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
        const value = this.tableList.tableColumn[i].prop
        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() {
@@ -205,16 +223,6 @@
        })
    },
    // 搜索
    searchClick(val, content) {
      this.keyword = content
      this.keywordType = val.label
      this.getData()
    },
    resetClick() {
      this.keyword = ""
      this.keywordType = ""
      this.getData()
    },
    onFilterSearch(searchText){
      this.keyword = searchText ?? ""
      this.keywordType = "服务合同编号"