yangfeng
2023-08-09 acdff03246ce648082192dfb069c3a006a7fbee6
src/views/client/client/index.vue
@@ -2,14 +2,14 @@
  <div class="custom-manage">
    <div class="tab-view">
      <el-tabs v-model="activeName" @tab-click="tabsClick">
        <el-tab-pane label="全部(含所有公海)" name="first"></el-tab-pane>
        <el-tab-pane label="全部(含公海)" name="second"></el-tab-pane>
        <el-tab-pane label="全部(不含公海)" name="third"></el-tab-pane>
        <el-tab-pane label="公海已分配" name="fourth"></el-tab-pane>
        <el-tab-pane label="公未分配" name="aaa"></el-tab-pane>
        <el-tab-pane label="全部(含所有公海)" name="first" disabled></el-tab-pane>
        <el-tab-pane label="全部(含公海)" name="second" disabled></el-tab-pane>
        <el-tab-pane label="全部(不含公海)" name="third" disabled></el-tab-pane>
        <el-tab-pane label="公海已分配" name="fourth" disabled></el-tab-pane>
        <el-tab-pane label="公未分配" name="aaa" disabled></el-tab-pane>
      </el-tabs>
      <div class="sel-gonghai">
        <el-select v-model="gonghaiValue" placeholder="请选择" class="query-class-sel" size="mini">
        <el-select v-model="gonghaiValue" placeholder="请选择" class="query-class-sel" size="mini" disabled>
          <el-option v-for="item in gonghaiOptions" :key="item.value" :label="item.label" :value="item.value">
          </el-option>
        </el-select>
@@ -23,6 +23,8 @@
        ref="searchCommonView"
        :query-class-options="queryClassOptions"
        :search-options="searchOptions"
        @searchClick="searchClick"
        @resetClick="resetClick"
      />
      <div class="btn-pager">
        <PublicFunctionBtnView
@@ -31,6 +33,7 @@
          :map-button="true"
          :statistics="true"
          :operates-list="operatesList"
          @batchDelete="delClick"
        />
        <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
      </div>
@@ -41,14 +44,15 @@
      :table-list="tableList"
      @selClientClick="selClientClick"
      @selContactsClick="selContactsClick"
      @getSelectArray="getSelectArray"
    >
      <template slot="tableButton">
        <el-table-column label="操作" width="180">
        <el-table-column label="操作" width="150">
          <template slot-scope="scope">
            <el-button type="text" size="small">变更公海</el-button>
            <el-button type="text" size="small" disabled>变更公海</el-button>
            <el-button @click="handleClick(scope.row)" type="text" size="small">编辑</el-button>
            <el-button 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>
@@ -59,6 +63,8 @@
    <DetailClientManage v-if="clientDeail.visible" :client-manage-detail="clientDeail" />
    <!-- 联系人详情 -->
    <DetailContacts v-if="contactsDeail.visible" :contacts-detail="contactsDeail" />
    <!-- 新建/编辑跟进记录 -->
    <AddFollowupRecordsDialog v-if="editFollowupConfig.visible" :edit-contacts-config="editFollowupConfig" />
  </div>
</template>
@@ -66,6 +72,7 @@
import AddClientManageDialog from "@/views/client/client/AddClientManageDialog"
import { getClientList, getDeleteClient } from "@/api/client/client"
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
import AddFollowupRecordsDialog from "@/views/client/followupRecords/AddFollowupRecordsDialog"
export default {
  name: "CustomManage",
@@ -74,13 +81,10 @@
  components: {
    AddClientManageDialog,
    DetailContacts: () => import("@/views/client/contacts/DetailContacts"),
    DetailClientManage: () => import("@/views/client/client/DetailClientManage")
    DetailClientManage: () => import("@/views/client/client/DetailClientManage"),
    AddFollowupRecordsDialog
  },
  computed: {
    searchCommonHeight() {
      return this.$refs.searchCommonView.offsetHeight
    }
  },
  computed: {},
  data() {
    return {
      tableList: {},
@@ -119,6 +123,13 @@
      clientDeail: {
        visible: false,
        infomation: {}
      },
      search_map: {},
      selValueList: [],
      editFollowupConfig: {
        visible: false,
        title: "新建",
        infomation: {}
      }
    }
  },
@@ -132,11 +143,11 @@
        tableInfomation: [],
        tableColumn: [
          { label: "客户名称", prop: "name", min: 100, isClientClick: true }, // 客户名称
          { label: "销售负责人", prop: "member_id" }, // 销售负责人
          { label: "重要级别", prop: "client_level_id" }, // 重要级别
          { label: "销售负责人", prop: "member_name" }, // 销售负责人
          { label: "重要级别", prop: "client_level" }, // 重要级别
          { label: "下次回访日期", prop: "next_visit_time", isTime: true, min: 90 }, // 下次回访日期
          { label: "详细地址", prop: "detail_address", min: 200 }, // 详细地址
          { label: "客户状态", prop: "client_status_id" }, // 客户状态
          { label: "客户状态", prop: "client_status" }, // 客户状态
          { label: "联系人姓名", prop: "contact_name", isContactClick: true }, // 联系人姓名
          { label: "手机号码", prop: "contact_phone" } // 手机号码
        ]
@@ -144,14 +155,15 @@
      this.searchOptions = []
      for (let i = 0; i < this.tableList.tableColumn.length; i++) {
        const label = this.tableList.tableColumn[i].label
        this.searchOptions.push({ value: (i + 1).toString(), label: label })
        const value = this.tableList.tableColumn[i].prop
        this.searchOptions.push({ value: value, label: label })
      }
    },
    // 请求数据
    async getData() {
      this.loading = true
      await getClientList({
        keyword: "",
        search_map: this.search_map,
        page: this.pagerOptions.currPage,
        pageSize: this.pagerOptions.pageSize
      })
@@ -173,7 +185,9 @@
                return {
                  ...item,
                  contact_name: contact_name,
                  contact_phone: contact_phone
                  contact_phone: contact_phone,
                  client_level: item.client_level.name,
                  client_status: item.client_status.name
                }
              })
              this.tableList.tableInfomation = list || []
@@ -195,6 +209,18 @@
    tabsClick(tab, event) {
      console.log(tab, event)
    },
    // 搜索
    searchClick(val, content) {
      console.log(val, content)
      this.search_map = {
        [val]: content
      }
      this.getData()
    },
    resetClick() {
      this.search_map = {}
      this.getData()
    },
    // 新建
    addBtnClick() {
      this.editConfig.visible = true
@@ -214,7 +240,6 @@
          }
        })
      }
      console.log(contactObj)
      this.editConfig.infomation = {
        ...row,
        contact_wechat: contactObj.length > 0 ? contactObj.wechat : "",
@@ -222,16 +247,15 @@
      }
    },
    // 删除
    delClick(id) {
    delClick() {
      if (this.selValueList && this.selValueList.length > 0) {
      this.$confirm("是否确认删除?", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(function () {
          return getDeleteClient({ id: id })
        })
        .then((response) => {
          .then(() => {
            getDeleteClient({ ids: this.selValueList }).then((response) => {
          if (response.code === 200) {
            this.$message.success("删除成功")
            this.getData()
@@ -239,10 +263,19 @@
            this.$message.warning("删除失败")
          }
        })
        .catch(function () {})
          })
          .catch(() => {})
      } else {
        this.$message.warning("请至少选择一条记录")
      }
    },
    getSelectArray(val) {
      console.log(val)
      this.selValueList = []
      const list = val.map((item) => {
        return item.id
      })
      this.selValueList = list
    },
    // 客户名称详情
    selClientClick(row) {
@@ -254,7 +287,27 @@
    selContactsClick(row) {
      console.log(row)
      this.contactsDeail.visible = true
      this.contactsDeail.infomation = { ...row }
      let contact = {}
      if (row.contacts.length !== 0) {
        for (let i = 0; i < row.contacts.length; i++) {
          if (row.contacts[i].is_first) {
            contact = row.contacts[i]
          }
        }
      }
      this.contactsDeail.infomation = { ...contact, Client: { name: row.name } }
    },
    // 跟进
    followupClick(row) {
      console.log(row)
      this.editFollowupConfig.visible = true
      this.editFollowupConfig.title = "新建"
      this.editFollowupConfig.infomation = {
        ...row,
        client_name: row.name,
        number: "",
        next_follow_time: row.next_visit_time
      }
    }
  }
}