yangfeng
2023-10-17 a63d71177a2899b01da37e5bfc2d498bec5f80be
src/views/other/payment/receipt/index.vue
@@ -7,16 +7,16 @@
    <div v-else class="filter">
      <div class="filter-card">
        <CommonSearch
            :show-add="false"
            :show-download="false"
            :amount-view="false"
            :show-action-btn="false"
            placeholder="请输入收款单编号"
            @searchClick="onFilterSearch"
          :show-add="false"
          :show-download="false"
          :amount-view="false"
          :show-action-btn="false"
          placeholder="请输入收款单编号"
          @searchClick="onFilterSearch"
        >
          <template slot="leftButton">
            <el-button size="small" type="primary"  @click="addBtnClick">新建</el-button>
<!--            <el-button size="small"  @click="delClick">删除</el-button>-->
            <el-button size="small" type="primary" @click="addBtnClick">新建</el-button>
            <!--            <el-button size="small"  @click="delClick">删除</el-button>-->
          </template>
        </CommonSearch>
      </div>
@@ -26,12 +26,12 @@
      <div class="body-card">
        <div class="list-view">
          <TableCommonView
              ref="tableListRef"
              v-loading="loading"
              :table-list="tableList"
              :select-box="!isDetail"
              @getSelectArray="getSelectArray"
              @selTableCol="selTableCol"
            ref="tableListRef"
            v-loading="loading"
            :table-list="tableList"
            :select-box="!isDetail"
            @getSelectArray="getSelectArray"
            @selTableCol="selTableCol"
          >
            <!-- <template slot="tableButton">
              <el-table-column label="操作" width="60" fixed="right">
@@ -124,7 +124,7 @@
      keyword: "",
      keywordType: "",
      tableColumn: [
        { label: "收款单编号", prop: "number", default: true},
        { label: "收款单编号", prop: "number", default: true },
        { label: "客户名称", prop: "client_name" },
        { label: "选择源单", prop: "sourceId" },
        { label: "实际收款金额", prop: "amount" },
@@ -132,7 +132,7 @@
        { label: "销售负责人", prop: "principal_name" },
        { label: "收款日期", prop: "receiptDate" }
      ],
      showCol:["收款单编号", "客户名称", "选择源单", "实际收款金额", "收款方式", "销售负责人", "收款日期"]
      showCol: ["收款单编号", "客户名称", "选择源单", "实际收款金额", "收款方式", "销售负责人", "收款日期"]
    }
  },
  created() {
@@ -146,15 +146,16 @@
    }
    this.getData()
  },
  mounted() {},
  methods: {
    setTable() {
      this.tableList = {
        tableInfomation: [],
        allcol: [],
        showcol: this.showCol,
        tableColumn:this.setColumnVisible(this.showCol)
        tableColumn: this.setColumnVisible(this.showCol)
      }
      this.tableList.allcol = this.tableList.tableColumn.filter(ele=>!ele.default).map(ele=>ele.label);
      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
@@ -162,30 +163,45 @@
        this.searchOptions.push({ value: value, label: label })
      }
    },
    setColumnVisible(showCol){
      return  this.tableColumn.map(ele=>{
    setColumnVisible(showCol) {
      return this.tableColumn.map((ele) => {
        return {
          ...ele,
          isShowColumn:showCol.includes(ele.label)
          isShowColumn: showCol.includes(ele.label)
        }
      })
    },
    selTableCol(val) {
      this.showcol = val;
      this.tableList.tableColumn = this.setColumnVisible(val);
      this.showcol = val
      this.tableList.tableColumn = this.setColumnVisible(val)
    },
    // 请求数据
    async getData() {
      // console.log()
      this.loading = true
      await getReceiptList({
        keyword: this.keyword,
        keywordType: this.keywordType,
        page: this.pagerOptions.currPage,
        pageSize: this.pagerOptions.pageSize
      })
      let params = {}
      let sourceTyle = this.addConfig.keywordType === "销售明细单" || this.addConfig.keywordType === "客户名称" ? 1 : 2
      if (this.addConfig.id) {
        params = {
          sourceId: this.addConfig.id,
          sourceType: sourceTyle,
          page: this.pagerOptions.currPage,
          pageSize: this.pagerOptions.pageSize,
          client_id: this.addConfig.client_id
        }
      } else {
        params = {
          keyword: this.keyword,
          keywordType: this.keywordType,
          page: this.pagerOptions.currPage,
          pageSize: this.pagerOptions.pageSize,
          client_id: this.addConfig.client_id
        }
      }
      await getReceiptList(params)
        .then((res) => {
          if (res.data.code === 200) {
            const resList = res?.data?.data?.data ?? []
          if (res.code === 200) {
            const resList = res?.data?.data ?? []
            if (resList.length > 0) {
              const list = resList.map((item) => {
                return {
@@ -196,7 +212,7 @@
                }
              })
              this.tableList.tableInfomation = list || []
              this.pagerOptions.totalCount = res.data.data.count
              this.pagerOptions.totalCount = res.data.count
            } else {
              this.tableList.tableInfomation = []
            }
@@ -212,7 +228,7 @@
        })
    },
    // 搜索
    onFilterSearch(searchText){
    onFilterSearch(searchText) {
      this.keyword = searchText ?? ""
      this.keywordType = "收款单编号"
      this.pagerOptions.currPage = 1
@@ -230,8 +246,8 @@
    addBtnClick() {
      this.editConfig.visible = true
      this.editConfig.title = "新建"
      this.editConfig.sourceType = this.sourceType
      this.editConfig.infomation = { ...this.addConfig }
      this.editConfig.sourceType = this.addConfig.keywordType === "客户名称" ? 1 : this.sourceType
      this.editConfig.infomation = { ...this.addConfig, saleDetailNumber: "" }
    }
  }
}
@@ -239,15 +255,15 @@
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
.receipt{
.receipt {
  height: 100%;
  overflow: hidden;
  .filter{
  .filter {
    height: 80px;
    display: flex;
    align-items: center;
    padding: 12px 20px 0 20px;
    &-card{
    &-card {
      height: 80px;
      display: flex;
      align-items: center;
@@ -258,7 +274,7 @@
      background-color: #fff;
    }
  }
  .body{
  .body {
    box-sizing: border-box;
    padding: 10px 20px;
    border-radius: 12px;