yangfeng
2023-08-07 a2586ce70485035d77746ff9c18364f408f4c6aa
src/views/client/client/index.vue
@@ -18,42 +18,63 @@
        </div>
      </div>
    </div>
    <SearchCommonView ref="searchCommonView" :query-class-options="queryClassOptions" :search-options="searchOptions" />
    <div class="btn-pager">
      <PublicFunctionBtnView
        :duplicate-check="true"
        :list-button="true"
        :map-button="true"
        :statistics="true"
        :operates-list="operatesList"
    <div class="top">
      <SearchCommonView
        ref="searchCommonView"
        :query-class-options="queryClassOptions"
        :search-options="searchOptions"
      />
      <PagerView class="page" />
      <div class="btn-pager">
        <PublicFunctionBtnView
          :duplicate-check="true"
          :list-button="true"
          :map-button="true"
          :statistics="true"
          :operates-list="operatesList"
        />
        <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
      </div>
    </div>
    <TableCommonView ref="tableListRef" v-loading="loading" :table-list="tableList">
    <TableCommonView
      ref="tableListRef"
      v-loading="loading"
      :table-list="tableList"
      @selClientClick="selClientClick"
      @selContactsClick="selContactsClick"
    >
      <template slot="tableButton">
        <el-table-column label="操作" width="150" fixed="right">
        <el-table-column label="操作" width="180">
          <template slot-scope="scope">
            <el-button type="text" size="small">变更公海</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>
          </template>
        </el-table-column>
      </template>
    </TableCommonView>
    <!-- 新建/编辑客户管理 -->
    <AddClientManageDialog v-if="editConfig.visible" :edit-client-manage-config="editConfig" />
    <!-- 客户详情 -->
    <DetailClientManage v-if="clientDeail.visible" :client-manage-detail="clientDeail" />
    <!-- 联系人详情 -->
    <DetailContacts v-if="contactsDeail.visible" :contacts-detail="contactsDeail" />
  </div>
</template>
<script>
import AddClientManageDialog from "@/views/client/client/AddClientManageDialog.vue"
import { getClientList } from "@/api/client/client"
import AddClientManageDialog from "@/views/client/client/AddClientManageDialog"
import { getClientList, getDeleteClient } from "@/api/client/client"
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
export default {
  name: "CustomManage",
  props: {},
  mixins: [pageMixin],
  components: {
    AddClientManageDialog
    AddClientManageDialog,
    DetailContacts: () => import("@/views/client/contacts/DetailContacts"),
    DetailClientManage: () => import("@/views/client/client/DetailClientManage")
  },
  computed: {
    searchCommonHeight() {
@@ -90,6 +111,14 @@
        visible: false,
        title: "新建",
        infomation: {}
      },
      contactsDeail: {
        visible: false,
        infomation: {}
      },
      clientDeail: {
        visible: false,
        infomation: {}
      }
    }
  },
@@ -102,13 +131,13 @@
      this.tableList = {
        tableInfomation: [],
        tableColumn: [
          { label: "客户名称", prop: "name", min: 100 }, // 客户名称
          { label: "客户名称", prop: "name", min: 100, isClientClick: true }, // 客户名称
          { label: "销售负责人", prop: "member_id" }, // 销售负责人
          { label: "重要级别", prop: "client_level_id" }, // 重要级别
          { label: "下次回访日期", prop: "next_visit_time", isTime: true, min: 90 }, // 下次回访日期
          { label: "详细地址", prop: "detail_address", min: 200 }, // 详细地址
          { label: "客户状态", prop: "client_status_id" }, // 客户状态
          { label: "联系人姓名", prop: "contact_name" }, // 联系人姓名
          { label: "联系人姓名", prop: "contact_name", isContactClick: true }, // 联系人姓名
          { label: "手机号码", prop: "contact_phone" } // 手机号码
        ]
      }
@@ -121,7 +150,11 @@
    // 请求数据
    async getData() {
      this.loading = true
      await getClientList()
      await getClientList({
        keyword: "",
        page: this.pagerOptions.currPage,
        pageSize: this.pagerOptions.pageSize
      })
        .then((res) => {
          console.log(res)
          if (res.code === 200) {
@@ -137,7 +170,6 @@
                    }
                  }
                }
                return {
                  ...item,
                  contact_name: contact_name,
@@ -145,6 +177,7 @@
                }
              })
              this.tableList.tableInfomation = list || []
              this.pagerOptions.totalCount = res.data.count
            } else {
              this.tableList.tableInfomation = []
            }
@@ -166,36 +199,7 @@
    addBtnClick() {
      this.editConfig.visible = true
      this.editConfig.title = "新建"
      this.editConfig.infomation = {
        name: "",
        number: "",
        client_status_id: "",
        member_id: "",
        client_type_id: "",
        clientSource: "",
        client_level_id: "",
        service_member_id: "",
        next_visit_time: "",
        latest_service_time: "",
        contact_name: "",
        contact_phone: "",
        contact_duties: "",
        contact_wechat: "",
        contact_email: "",
        industry_id: "",
        representative: "",
        registration_time: "",
        registered_capital_id: "",
        enterprise_nature_id: "",
        enterprise_scale_id: "",
        business_scope: "",
        country: "",
        province: "",
        city: "",
        region: "",
        detail_address: "",
        remark: ""
      }
      this.editConfig.infomation = {}
    },
    // 编辑
    handleClick(row) {
@@ -212,36 +216,45 @@
      }
      console.log(contactObj)
      this.editConfig.infomation = {
        id: row.id,
        name: row.name,
        number: row.number,
        client_status_id: row.client_status_id,
        member_id: row.member_id,
        client_type_id: row.client_type_id,
        clientSource: row.clientSource,
        client_level_id: row.client_level_id,
        service_member_id: row.service_member_id,
        next_visit_time: row.next_visit_time,
        latest_service_time: row.latest_service_time,
        contact_name: row.contact_name,
        contact_phone: row.contact_phone,
        contact_duties: "",
        ...row,
        contact_wechat: contactObj.length > 0 ? contactObj.wechat : "",
        contact_email: contactObj.length > 0 ? contactObj.email : "",
        industry_id: row.industry_id,
        representative: row.representative,
        registration_time: row.registration_time,
        registered_capital_id: row.registered_capital_id,
        enterprise_nature_id: row.enterprise_nature_id,
        enterprise_scale_id: row.enterprise_scale_id,
        business_scope: row.business_scope,
        country: row.country,
        province: row.province,
        city: row.city,
        region: row.region,
        detail_address: row.detail_address,
        remark: row.remark
        contact_email: contactObj.length > 0 ? contactObj.email : ""
      }
    },
    // 删除
    delClick(id) {
      this.$confirm("是否确认删除?", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(function () {
          return getDeleteClient({ id: id })
        })
        .then((response) => {
          if (response.code === 200) {
            this.$message.success("删除成功")
            this.getData()
          } else {
            this.$message.warning("删除失败")
          }
        })
        .catch(function () {})
    },
    getSelectArray(val) {
      console.log(val)
    },
    // 客户名称详情
    selClientClick(row) {
      console.log(row)
      this.clientDeail.visible = true
      this.clientDeail.infomation = { ...row, client_name: row.name }
    },
    // 联系人详情
    selContactsClick(row) {
      console.log(row)
      this.contactsDeail.visible = true
      this.contactsDeail.infomation = { ...row }
    }
  }
}
@@ -270,10 +283,13 @@
      }
    }
  }
  .btn-pager {
    display: flex;
    .page {
      margin-left: auto;
  .top {
    margin-bottom: 20px;
    .btn-pager {
      display: flex;
      .page {
        margin-left: auto;
      }
    }
  }
}