yangfeng
2023-10-13 2e9bfefd8d092112b5f964de6f816e171ab3f1db
src/views/sales/quotation/index.vue
@@ -6,15 +6,10 @@
    <div class="filter" v-else>
      <div class="filter-card">
        <CommonSearch
            :show-add="false"
            :amount-view="false"
            placeholder="请输入报价单号"
            @searchClick="onFilterSearch"
        >
        <CommonSearch :show-add="false" :amount-view="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>
@@ -24,19 +19,19 @@
      <div class="body-card">
        <div class="list-view">
          <TableCommonView
              ref="tableListRef"
              :table-list="tableList"
              @selClientClick="selClientClick"
              @selContactsClick="selContactsClick"
              @selCommonClick="selCommonClick"
              @getSelectArray="getSelectArray"
              @selTableCol="selTableCol"
            ref="tableListRef"
            :table-list="tableList"
            @selClientClick="selClientClick"
            @selContactsClick="selContactsClick"
            @selCommonClick="selCommonClick"
            @getSelectArray="getSelectArray"
            @selTableCol="selTableCol"
          >
            <template slot="tableButton">
              <el-table-column label="操作" width="90">
                <template slot-scope="scope">
                  <el-button @click="handleClick(scope.row)" type="text" size="small">编辑</el-button>
                   <el-button @click="deleteItem(scope.row.id)" type="text" size="small">删除</el-button>
                  <el-button @click="deleteItem(scope.row.id)" type="text" size="small">删除</el-button>
                </template>
              </el-table-column>
            </template>
@@ -131,7 +126,7 @@
        label: "报价单号"
      },
      tableColumn: [
        { label: "报价单号", prop: "number", min: 90, isCommonClick: true ,default:true}, // 报价单号
        { label: "报价单号", prop: "number", min: 90, isCommonClick: true, default: true }, // 报价单号
        { label: "客户名称", prop: "client_name", min: 120, isClientClick: true }, // 客户名称
        { label: "联系人姓名", prop: "contact_name", min: 90, isContactClick: true }, // 联系人姓名
        { label: "销售负责人", prop: "member_name" }, // 销售负责人
@@ -142,7 +137,7 @@
        { label: "数量", prop: "productNumber", isProductAmount: true },
        { label: "价税合计", prop: "priceTax", isProductTotal: true }
      ],
      showCol:["报价单号", "客户名称", "联系人姓名", "销售负责人", "有效期", "产品名称", "数量", "价税合计"]
      showCol: ["报价单号", "客户名称", "联系人姓名", "销售负责人", "有效期", "产品名称", "数量", "价税合计"]
    }
  },
  created() {
@@ -151,7 +146,7 @@
      this.search_map = {}
    } else {
      this.search_map = {
        [this.addConfig.id_name]: this.addConfig.client_name
        [this.addConfig.id_name]: this.addConfig.id
      }
    }
    this.getData(this.search_map)
@@ -159,13 +154,13 @@
  methods: {
    setTable() {
      this.tableList = {
        selectIndex:true,
        selectIndex: true,
        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
@@ -173,17 +168,17 @@
        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() {
@@ -222,8 +217,8 @@
        })
    },
    // 搜索
    onFilterSearch(searchText){
      this.search_map.number = searchText ?? ''
    onFilterSearch(searchText) {
      this.search_map.number = searchText ?? ""
      this.pagerOptions.currPage = 1
      this.getData()
    },
@@ -273,22 +268,22 @@
        cancelButtonText: "取消",
        type: "warning"
      })
          .then(() => {
            getDelQuotation({ids: [id]}).then((response) => {
              if (response.code === 200) {
                this.$message.success("删除成功")
                this.getData()
              } else {
                this.$message.warning("删除失败")
              }
            })
          })
          .catch((err) => {
            if (err !== 'cancel') {
              console.error(err)
        .then(() => {
          getDelQuotation({ ids: [id] }).then((response) => {
            if (response.code === 200) {
              this.$message.success("删除成功")
              this.getData()
            } else {
              this.$message.warning("删除失败")
            }
          })
        })
        .catch((err) => {
          if (err !== "cancel") {
            console.error(err)
            this.$message.warning("删除失败")
          }
        })
    },
    getSelectArray(val) {
      console.log(val)
@@ -327,15 +322,15 @@
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
.quotation{
.quotation {
  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;
@@ -346,7 +341,7 @@
      background-color: #fff;
    }
  }
  .body{
  .body {
    box-sizing: border-box;
    padding: 10px 20px;
    border-radius: 12px;