index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. <template>
  2. <div class="app-container">
  3. <!-- 搜索区域 -->
  4. <el-card shadow="never" class="search-card">
  5. <el-form :model="queryParams" ref="queryRef" label-width="90px">
  6. <!-- 第一行:客户编号、客户名称、客户等级、行业 -->
  7. <el-row :gutter="20" class="mt-15">
  8. <el-col :span="6">
  9. <el-form-item label="客户编号" prop="customerNo" class="custom-form-item">
  10. <el-input v-model="queryParams.customerNo" placeholder="请输入客户编号" clearable />
  11. </el-form-item>
  12. </el-col>
  13. <el-col :span="6">
  14. <el-form-item label="客户名称" prop="customerName" class="custom-form-item">
  15. <el-input v-model="queryParams.customerName" placeholder="请输入客户名称" clearable />
  16. </el-form-item>
  17. </el-col>
  18. <el-col :span="6">
  19. <el-form-item label="客户等级" prop="customerLevelId" class="custom-form-item">
  20. <el-select v-model="queryParams.customerLevelId" placeholder="请选择" clearable style="width: 100%">
  21. <el-option v-for="item in levelOptions" :key="item.id" :label="item.levelName" :value="item.id" />
  22. </el-select>
  23. </el-form-item>
  24. </el-col>
  25. <el-col :span="6">
  26. <el-form-item label="行业" prop="industryCategoryId" class="custom-form-item">
  27. <el-select v-model="queryParams.industryCategoryId" placeholder="请选择" clearable style="width: 100%">
  28. <el-option v-for="item in industryOptions" :key="item.id" :label="item.industryCategoryName" :value="item.id" />
  29. </el-select>
  30. </el-form-item>
  31. </el-col>
  32. </el-row>
  33. <!-- 第二行:业务负责人、客服支持、部门、合作状态 -->
  34. <el-row :gutter="20" class="mt-15">
  35. <el-col :span="6">
  36. <el-form-item label="业务负责人" prop="salesPersonId" class="custom-form-item">
  37. <el-select v-model="queryParams.salesPersonId" placeholder="请选择" clearable style="width: 100%">
  38. <el-option v-for="item in staffOptions" :key="item.staffId" :label="item.staffName" :value="item.staffId" />
  39. </el-select>
  40. </el-form-item>
  41. </el-col>
  42. <el-col :span="6">
  43. <el-form-item label="客服支持" prop="serviceStaffId" class="custom-form-item">
  44. <el-select v-model="queryParams.serviceStaffId" placeholder="请选择" clearable style="width: 100%">
  45. <el-option v-for="item in staffOptions" :key="item.staffId" :label="item.staffName" :value="item.staffId" />
  46. </el-select>
  47. </el-form-item>
  48. </el-col>
  49. <el-col :span="6">
  50. <el-form-item label="部门" prop="belongingDepartmentId" class="custom-form-item">
  51. <el-tree-select
  52. v-model="queryParams.belongingDepartmentId"
  53. :data="deptOptions"
  54. :props="{ value: 'deptId', label: 'deptName', children: 'children' }"
  55. value-key="deptId"
  56. placeholder="请选择部门"
  57. check-strictly
  58. clearable
  59. style="width: 100%"
  60. />
  61. </el-form-item>
  62. </el-col> <el-col :span="6">
  63. <el-form-item label="合作状态" prop="status" class="custom-form-item">
  64. <el-select v-model="queryParams.status" placeholder="请选择" clearable style="width: 100%">
  65. <el-option v-for="item in cooperationOptions" :key="item.value" :label="item.label" :value="item.value" />
  66. </el-select>
  67. </el-form-item>
  68. </el-col>
  69. </el-row>
  70. <!-- 第三行:企业类型 + 操作按钮 -->
  71. <el-row :gutter="20" class="mt-15">
  72. <el-col :span="6">
  73. <el-form-item label="企业类型" prop="enterpriseTypeId" class="custom-form-item">
  74. <el-select v-model="queryParams.enterpriseTypeId" placeholder="请选择" clearable style="width: 100%">
  75. <el-option v-for="item in corpTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
  76. </el-select>
  77. </el-form-item>
  78. </el-col>
  79. <el-col :span="18">
  80. <div class="search-btns-area">
  81. <el-button type="default" icon="Search" @click="handleQuery">搜索</el-button>
  82. <el-button icon="Refresh" @click="resetQuery">重置</el-button>
  83. </div>
  84. </el-col>
  85. </el-row>
  86. </el-form>
  87. </el-card>
  88. <div class="title-container">
  89. <span class="list-title">客户公海信息列表</span>
  90. </div>
  91. <!-- 列表区域 -->
  92. <el-card shadow="never" class="table-card">
  93. <el-table ref="tableRef" v-loading="loading" :data="dataList" border class="custom-table">
  94. <el-table-column label="客户编号" align="center" prop="customerNo" width="100" />
  95. <el-table-column align="center" min-width="250" show-overflow-tooltip>
  96. <template #header>
  97. <span class="required-star"></span>客户名称
  98. </template>
  99. <template #default="scope">
  100. <span class="customer-name-text" @click="handleDetail(scope.row)">{{ scope.row.customerName }}</span>
  101. </template>
  102. </el-table-column>
  103. <el-table-column label="归属公司" align="center" prop="companyName" min-width="180" show-overflow-tooltip />
  104. <el-table-column label="行业" align="center" prop="industryName" width="120" />
  105. <el-table-column label="企业类型" align="center" prop="enterpriseTypeName" width="120" />
  106. <el-table-column label="合作等级" align="center" prop="customerLevelName" width="100" />
  107. <el-table-column label="业务负责人" align="center" prop="salesPersonName" width="120" />
  108. <el-table-column align="center" prop="serviceStaffName" width="120">
  109. <template #header>
  110. <span class="required-star"></span>客服支持
  111. </template>
  112. </el-table-column>
  113. <el-table-column label="部门" align="center" prop="deptName" width="120" />
  114. <el-table-column label="合作状态" align="center" prop="cooperationName" width="100" />
  115. <el-table-column label="操作" align="center" width="130" fixed="right">
  116. <template #default="scope">
  117. <el-button link type="info" class="op-link detail-link" @click="handleDetail(scope.row)">详情</el-button>
  118. <el-button link type="primary" class="op-link claim-link" @click="handleClaim(scope.row)">认领</el-button>
  119. </template>
  120. </el-table-column>
  121. </el-table>
  122. <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
  123. </el-card>
  124. <!-- 客户详情侧边栏 -->
  125. <customer-detail ref="infoRef" @success="getList" />
  126. <!-- 认领客户对话框 -->
  127. <el-dialog title="您正在认领公海客户,请录入客户认领信息" v-model="claimOpen" width="550px" append-to-body class="claim-dialog">
  128. <el-form ref="claimRef" :model="claimForm" :rules="claimRules" label-width="140px">
  129. <el-form-item label="业务员:" prop="salespersonId">
  130. <el-select v-model="claimForm.salespersonId" placeholder="请选择" style="width: 100%">
  131. <el-option v-for="item in staffOptions" :key="item.staffId" :label="item.staffName" :value="item.staffId" />
  132. </el-select>
  133. </el-form-item>
  134. <el-form-item label="客服:" prop="serviceStaffId">
  135. <el-select v-model="claimForm.serviceStaffId" placeholder="请选择" style="width: 100%">
  136. <el-option v-for="item in staffOptions" :key="item.staffId" :label="item.staffName" :value="item.staffId" />
  137. </el-select>
  138. </el-form-item>
  139. <el-form-item label="保留已有负责人:" prop="keepOwner">
  140. <el-radio-group v-model="claimForm.keepOwner">
  141. <el-radio value="1">是</el-radio>
  142. <el-radio value="0">否</el-radio>
  143. </el-radio-group>
  144. </el-form-item>
  145. </el-form>
  146. <template #footer>
  147. <div class="dialog-footer" style="text-align: right; padding-top: 20px;">
  148. <el-button @click="cancelClaim" style="width: 80px;">取 消</el-button>
  149. <el-button type="primary" @click="submitClaimForm" style="width: 80px; background-color: #3b82f6; border-color: #3b82f6;">确 认</el-button>
  150. </div>
  151. </template>
  152. </el-dialog>
  153. </div>
  154. </template>
  155. <script setup name="CustomerHighSeas">
  156. import { ref, reactive, onMounted, getCurrentInstance, toRefs } from 'vue';
  157. import { useRouter } from 'vue-router';
  158. import { listPool, claimPool } from "@/api/customer/customerPool";
  159. import { listIndustryCategory } from "@/api/customer/industryCategory";
  160. import { listLevel } from "@/api/customer/customerLevel";
  161. import { listComStaff } from "@/api/system/comStaff/index";
  162. import { deptTreeSelect } from "@/api/system/dept";
  163. import { debounce } from 'lodash-es';
  164. import CustomerDetail from "./detail.vue";
  165. const proxy = getCurrentInstance().proxy;
  166. const { Q0001: corpTypeOptions, cooperation_status: cooperationOptions } = toRefs(reactive(proxy.useDict("Q0001", "cooperation_status")));
  167. const router = useRouter();
  168. const loading = ref(false);
  169. const total = ref(0);
  170. const dataList = ref([]);
  171. // 下拉选项数据
  172. const industryOptions = ref([]);
  173. const levelOptions = ref([]);
  174. const staffOptions = ref([]);
  175. const deptOptions = ref([]);
  176. const infoRef = ref(null);
  177. const tableRef = ref(null);
  178. const queryParams = reactive({
  179. pageNum: 1,
  180. pageSize: 10,
  181. customerNo: undefined,
  182. customerName: undefined,
  183. industryCategoryId: undefined,
  184. customerLevelId: undefined,
  185. enterpriseTypeId: undefined,
  186. salesPersonId: undefined,
  187. serviceStaffId: undefined,
  188. belongingDepartmentId: undefined,
  189. status: undefined,
  190. enterpriseSource: undefined,
  191. procurementType: undefined,
  192. isApprove: undefined,
  193. platformCode: undefined
  194. });
  195. // 认领相关数据
  196. const claimOpen = ref(false);
  197. const claimRef = ref(null);
  198. const claimForm = reactive({
  199. customerId: undefined,
  200. salespersonId: undefined,
  201. serviceStaffId: undefined,
  202. keepOwner: '0'
  203. });
  204. const claimRules = {
  205. salespersonId: [{ required: true, message: "请选择业务员", trigger: "change" }],
  206. serviceStaffId: [{ required: true, message: "请选择客服", trigger: "change" }],
  207. keepOwner: [{ required: true, message: "请选择是否保留已有负责人", trigger: "change" }]
  208. };
  209. /** 查询基础下拉选项 */
  210. const getOptions = async () => {
  211. try {
  212. const industryRes = await listIndustryCategory();
  213. industryOptions.value = industryRes.data || [];
  214. const levelRes = await listLevel();
  215. levelOptions.value = levelRes.rows || [];
  216. const staffRes = await listComStaff({ pageSize: 1000 });
  217. staffOptions.value = staffRes.rows || staffRes.data || [];
  218. const deptRes = await deptTreeSelect();
  219. deptOptions.value = proxy.handleTree(deptRes.data, "deptId");
  220. } catch (err) {
  221. console.error('获取选项失败:', err);
  222. }
  223. };
  224. /** 查询公海列表数据 */
  225. const getList = () => {
  226. loading.value = true;
  227. listPool(queryParams).then(response => {
  228. dataList.value = response.rows || [];
  229. total.value = response.total || 0;
  230. loading.value = false;
  231. }).catch(() => {
  232. loading.value = false;
  233. });
  234. };
  235. const handleQuery = () => {
  236. queryParams.pageNum = 1;
  237. getList();
  238. };
  239. const resetQuery = () => {
  240. proxy.resetForm("queryRef");
  241. handleQuery();
  242. };
  243. /** 打开详情侧边栏 */
  244. const handleDetail = (row) => {
  245. infoRef.value.open(row.id);
  246. };
  247. const handleClaim = (row) => {
  248. claimForm.customerId = row.id;
  249. claimForm.salespersonId = undefined;
  250. claimForm.serviceStaffId = undefined;
  251. claimForm.keepOwner = '0';
  252. claimOpen.value = true;
  253. };
  254. const cancelClaim = () => {
  255. claimOpen.value = false;
  256. proxy.resetForm("claimRef");
  257. };
  258. const submitClaimForm = () => {
  259. proxy.$refs["claimRef"].validate(async valid => {
  260. if (valid) {
  261. loading.value = true;
  262. try {
  263. const data = {
  264. id: claimForm.customerId,
  265. salesPersonId: claimForm.salespersonId,
  266. serviceStaffId: claimForm.serviceStaffId,
  267. keepOldManager: claimForm.keepOwner
  268. };
  269. // 自动带出业务员所属部门
  270. const selectedStaff = staffOptions.value.find(s => s.staffId === claimForm.salespersonId);
  271. if (selectedStaff) {
  272. data.deptId = selectedStaff.deptId;
  273. }
  274. await claimPool(data);
  275. proxy.$modal.msgSuccess("认领成功");
  276. claimOpen.value = false;
  277. getList();
  278. } catch (err) {
  279. console.error(err);
  280. } finally {
  281. loading.value = false;
  282. }
  283. }
  284. });
  285. };
  286. onMounted(() => {
  287. getList();
  288. getOptions();
  289. });
  290. </script>
  291. <style scoped lang="scss">
  292. .app-container {
  293. padding: 24px;
  294. background-color: #f8fafc;
  295. min-height: 100vh;
  296. /* 全局强制取消加粗 */
  297. :deep(*) {
  298. font-weight: 400 !important;
  299. }
  300. }
  301. .search-card {
  302. margin-bottom: 20px;
  303. border-radius: 8px;
  304. border: none;
  305. box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  306. }
  307. .custom-form-item {
  308. margin-bottom: 0px;
  309. :deep(.el-form-item__label) {
  310. font-weight: 500;
  311. color: #475569;
  312. padding-right: 12px;
  313. }
  314. :deep(.el-input__wrapper), :deep(.el-select__wrapper) {
  315. box-shadow: 0 0 0 1px #cbd5e1 inset !important;
  316. &:hover, &.is-focus {
  317. box-shadow: 0 0 0 1px #3b82f6 inset !important;
  318. }
  319. }
  320. }
  321. .search-btns-area {
  322. display: flex;
  323. justify-content: flex-start;
  324. align-items: center;
  325. gap: 12px;
  326. padding-left: 20px;
  327. .el-button {
  328. border-radius: 2px;
  329. height: 32px;
  330. padding: 0 15px;
  331. font-size: 14px;
  332. transition: all 0.2s;
  333. }
  334. // 搜索和重置按钮样式
  335. .el-button--default, .el-button:not(.el-button--primary) {
  336. border: 1px solid #d1d5db !important;
  337. color: #374151 !important;
  338. background-color: #fff;
  339. &:hover {
  340. background-color: #f9fafb;
  341. border-color: #9ca3af !important;
  342. }
  343. }
  344. // 新增按钮样式
  345. .el-button--primary {
  346. background-color: #3b82f6 !important;
  347. border-color: #3b82f6 !important;
  348. color: #ffffff !important;
  349. &:hover {
  350. background-color: #2563eb !important;
  351. border-color: #2563eb !important;
  352. }
  353. }
  354. }
  355. .required-star {
  356. color: #ea580c;
  357. margin-right: 4px;
  358. font-weight: bold;
  359. }
  360. .title-container {
  361. margin: 20px 0 15px 0;
  362. display: flex;
  363. justify-content: space-between;
  364. align-items: center;
  365. .list-title {
  366. font-size: 16px;
  367. font-weight: normal;
  368. color: #1e293b;
  369. }
  370. }
  371. .table-card {
  372. border-radius: 4px;
  373. border: 1px solid #e2e8f0;
  374. box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  375. :deep(.el-card__body) {
  376. padding: 0;
  377. }
  378. }
  379. .custom-table {
  380. border-radius: 0;
  381. overflow: hidden;
  382. :deep(th.el-table__cell) {
  383. background-color: #f8fafc !important;
  384. color: #1e293b;
  385. font-size: 13px;
  386. font-weight: normal;
  387. height: 44px;
  388. }
  389. :deep(.el-table__row) {
  390. height: 48px;
  391. td {
  392. font-size: 13px;
  393. color: #334155;
  394. }
  395. }
  396. // 修复固定列左侧边框缺失问题
  397. :deep(.el-table__fixed-right) {
  398. border-left: 1px solid #ebeef5;
  399. height: 100% !important; // 确保边框高度撑满
  400. }
  401. :deep(.el-table__fixed-right-patch) {
  402. border-left: 1px solid #ebeef5;
  403. background-color: #f8fafc !important;
  404. }
  405. }
  406. .customer-name-text {
  407. color: #409eff;
  408. font-weight: normal;
  409. cursor: pointer;
  410. transition: all 0.2s;
  411. &:hover {
  412. color: #66b1ff;
  413. }
  414. }
  415. .op-link {
  416. font-weight: normal;
  417. margin: 0 6px;
  418. font-size: 13px;
  419. }
  420. .detail-link {
  421. color: #909399 !important;
  422. &:hover {
  423. color: #606266 !important;
  424. }
  425. }
  426. .claim-link {
  427. color: #409eff !important;
  428. &:hover {
  429. color: #66b1ff !important;
  430. }
  431. }
  432. .mt-15 {
  433. margin-top: 15px;
  434. }
  435. :deep(.claim-dialog) {
  436. .el-dialog__header {
  437. margin-right: 0;
  438. padding: 20px 24px;
  439. border-bottom: 1px solid #f1f5f9;
  440. .el-dialog__title {
  441. font-size: 16px;
  442. font-weight: 600;
  443. color: #1e293b;
  444. }
  445. }
  446. .el-dialog__body {
  447. padding: 30px 40px;
  448. }
  449. .el-form-item__label {
  450. font-weight: 500;
  451. color: #475569;
  452. white-space: nowrap;
  453. }
  454. .el-radio {
  455. margin-right: 30px;
  456. }
  457. }
  458. </style>