zuozhengqing
2023-12-14 9e007f676d0e55c4bf0cc2a78bc7dc96be188d50
src/views/client/contacts/index.vue
@@ -15,7 +15,7 @@
        >
          <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"  @click="delClick">删除</el-button> -->
          </template>
        </CommonSearch>
      </div>
@@ -31,13 +31,14 @@
              @selContactsClick="selContactsClick"
              @selClientClick="selClientClick"
              @getSelectArray="getSelectArray"
              @selTableCol="selTableCol"
          >
            <template slot="tableButton">
              <el-table-column label="操作" width="90" fixed="right">
              <el-table-column label="操作" width="120" fixed="right">
                <template slot-scope="scope">
                  <el-button @click="handleClick(scope.row)" type="text" size="small">编辑</el-button>
                  <el-button @click="followupClick(scope.row)" type="text" size="small">跟进</el-button>
                  <!-- <el-button @click="delClick(scope.row.id)" type="text" size="small">删除</el-button> -->
                  <!-- <el-button @click="followupClick(scope.row)" type="text" size="small">跟进</el-button> -->
                  <el-button @click="delClick(scope.row.id)" type="text" size="small">删除</el-button>
                </template>
              </el-table-column>
            </template>
@@ -128,7 +129,17 @@
        title: "新建",
        infomation: {}
      },
      search_map: {}
      search_map: {},
      tableColumn: [
        { label: "联系人姓名", prop: "name", min: 100, isContactClick: true, default: true }, // 联系人姓名
        { label: "客户名称", prop: "client_name", min: 190, isClientClick: true }, // 客户名称
        // { label: "联系人编号", prop: "number", min: 100 }, // 联系人编号
        { label: "职务", prop: "position", min: 120 }, // 职务
        { label: "手机", prop: "phone", min: 100 }, // 手机号码
        { label: "销售负责人", prop: "member_name", min: 120 }, // 销售负责人
        { label: "首要联系人", prop: "is_first", isFirst: true, min: 90 } // 首要联系人
      ],
      showCol: ['联系人姓名','客户名称','联系人编号','职务','手机','销售负责人','首要联系人']
    }
  },
  created() {
@@ -137,7 +148,7 @@
      this.search_map = {}
    } else {
      this.search_map = {
        [this.addConfig.id_name]: this.addConfig.client_name
        [this.addConfig.id_name]: this.addConfig.client_id
      }
    }
    this.getData(this.search_map)
@@ -145,23 +156,31 @@
  methods: {
    setTable() {
      this.tableList = {
        selectIndex: true,
        tableInfomation: [],
        tableColumn: [
          { label: "联系人姓名", prop: "name", min: 100, isContactClick: true }, // 联系人姓名
          { label: "客户名称", prop: "client_name", min: 190, isClientClick: true }, // 客户名称
          { label: "联系人编号", prop: "number", min: 100 }, // 联系人编号
          { label: "职务", prop: "position", min: 120 }, // 职务
          { label: "手机", prop: "phone", min: 100 }, // 手机号码
          { label: "销售负责人", prop: "member_name", min: 120 }, // 销售负责人
          { label: "首要联系人", prop: "is_first", isFirst: true, min: 90 } // 首要联系人
        ]
        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() {
@@ -220,15 +239,24 @@
      this.editConfig.infomation = { ...row }
    },
    // 删除
    delClick() {
      if (this.selValueList && this.selValueList.length > 0) {
    delClick(id) {
      if(!id){
        if (this.selValueList && this.selValueList.length == 0) {
          this.$message.warning("请至少选择一条记录")
          return true;
        }
      }
        this.$confirm("是否确认删除?", "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            getDeleteContact({ ids: this.selValueList }).then((response) => {
            let params={ids: this.selValueList }
            if(id){
              params={ids: [id]}
            }
            getDeleteContact(params).then((response) => {
              if (response.code === 200) {
                this.$message.success("删除成功")
                this.getData()
@@ -238,9 +266,6 @@
            })
          })
          .catch(() => {})
      } else {
        this.$message.warning("请至少选择一条记录")
      }
    },
    getSelectArray(val) {
      console.log(val)
@@ -271,13 +296,14 @@
    // 跟进
    followupClick(row) {
      console.log(row)
      this.editFollowupConfig.visible = true
      this.editFollowupConfig.title = "新建"
      this.editFollowupConfig.infomation = {
        ...row,
        client_name: row.Client.name,
        number: ""
        number: "",
        codeStandID:''
      }
      this.editFollowupConfig.visible = true
    }
  }
}
@@ -314,15 +340,6 @@
      border-radius: 12px;
      height: 100%;
      overflow: hidden;
    }
    .supplier-search {
      display: flex;
      align-items: center;
      .add-view {
        margin-left: auto;
        margin-right: 20px;
      }
    }
    .list-view {
      height: calc(100% - 60px);