index.vue 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690
  1. <template>
  2. <div class="tenant">
  3. <div style="padding: 20px; background: #fff; margin-bottom: 20px">
  4. <el-button type="primary" style="margin-left: 10px" @click="openModal()"
  5. >添加客户</el-button
  6. >
  7. </div>
  8. <div
  9. style="padding: 20px 20px 0 20px; background: #fff; margin-bottom: 20px"
  10. >
  11. <div style="display: flex">
  12. <div style="font-size: 14px; cursor: pointer" class="by-dropdown">
  13. <div class="by-dropdown-title">
  14. <span>{{
  15. dictValueLabel(
  16. sourceList.paginationTwo.statisticsType,
  17. statisticsType
  18. )
  19. }}</span>
  20. <el-icon style="margin-left: 5px; font-size: 16px"
  21. ><CaretBottom
  22. /></el-icon>
  23. </div>
  24. <ul class="by-dropdown-lists">
  25. <li
  26. v-for="item in statisticsType"
  27. :key="item.value"
  28. @click="searchItemSelect(item.value)"
  29. style="
  30. display: flex;
  31. align-items: center;
  32. justify-content: center;
  33. "
  34. >
  35. {{ item.label }}
  36. </li>
  37. </ul>
  38. </div>
  39. </div>
  40. <div
  41. style="
  42. display: flex;
  43. width: 100%;
  44. margin: 10px 0 0 10px;
  45. flex-wrap: wrap;
  46. "
  47. >
  48. <div
  49. style="
  50. padding: 20px;
  51. border-radius: 10px;
  52. width: 200px;
  53. background-color: #d1caff59;
  54. margin: 0 20px 20px 0;
  55. "
  56. >
  57. <div style="margin-bottom: 10px; display: flex">
  58. <div
  59. style="
  60. width: 8px;
  61. height: 8px;
  62. background-color: #5bacff;
  63. border-radius: 50px;
  64. margin-top: 6px;
  65. "
  66. ></div>
  67. <span style="padding-left: 8px">合计</span>
  68. </div>
  69. <div style="color: black; font-size: 20px; font-weight: 700">
  70. {{ statisticalData.countAmount }}
  71. </div>
  72. </div>
  73. <template v-if="sourceList.paginationTwo.statisticsType === 1">
  74. <div
  75. style="
  76. padding: 20px;
  77. border-radius: 10px;
  78. width: 200px;
  79. background-color: #a2d8ff70;
  80. margin: 0 20px 20px 0;
  81. "
  82. v-for="(item, index) in customerSource"
  83. :key="index"
  84. >
  85. <div style="margin-bottom: 10px; display: flex">
  86. <div
  87. style="
  88. width: 8px;
  89. height: 8px;
  90. background-color: #5bacff;
  91. border-radius: 50px;
  92. margin-top: 6px;
  93. "
  94. ></div>
  95. <div class="statistics-text">
  96. <el-tooltip class="box-item" effect="light" placement="bottom">
  97. <template #content>
  98. <div
  99. style="
  100. max-width: 400px;
  101. max-height: 50vh;
  102. word-break: break-all;
  103. "
  104. >
  105. {{ item.label }}
  106. </div>
  107. </template>
  108. <span style="cursor: pointer">{{ item.label }}</span>
  109. </el-tooltip>
  110. </div>
  111. </div>
  112. <div style="color: black; font-size: 20px; font-weight: 700">
  113. {{ getNum(item.value) }}
  114. </div>
  115. </div>
  116. </template>
  117. <template v-else-if="sourceList.paginationTwo.statisticsType === 2">
  118. <div
  119. style="
  120. padding: 20px;
  121. border-radius: 10px;
  122. width: 200px;
  123. background-color: #a2d8ff70;
  124. margin: 0 20px 20px 0;
  125. "
  126. v-for="(item, index) in customerStatus"
  127. :key="index"
  128. >
  129. <div style="margin-bottom: 10px; display: flex">
  130. <div
  131. style="
  132. width: 8px;
  133. height: 8px;
  134. background-color: #5bacff;
  135. border-radius: 50px;
  136. margin-top: 6px;
  137. "
  138. ></div>
  139. <div class="statistics-text">
  140. <el-tooltip class="box-item" effect="light" placement="bottom">
  141. <template #content>
  142. <div
  143. style="
  144. max-width: 400px;
  145. max-height: 50vh;
  146. word-break: break-all;
  147. "
  148. >
  149. {{ item.label }}
  150. </div>
  151. </template>
  152. <span style="cursor: pointer">{{ item.label }}</span>
  153. </el-tooltip>
  154. </div>
  155. </div>
  156. <div style="color: black; font-size: 20px; font-weight: 700">
  157. {{ getNum(item.value) }}
  158. </div>
  159. </div>
  160. </template>
  161. <template v-else-if="sourceList.paginationTwo.statisticsType === 3">
  162. <div
  163. style="
  164. padding: 20px;
  165. border-radius: 10px;
  166. width: 200px;
  167. background-color: #a2d8ff70;
  168. margin: 0 20px 20px 0;
  169. "
  170. v-for="(item, index) in userList"
  171. :key="index"
  172. >
  173. <div style="margin-bottom: 10px; display: flex">
  174. <div
  175. style="
  176. width: 8px;
  177. height: 8px;
  178. background-color: #5bacff;
  179. border-radius: 50px;
  180. margin-top: 6px;
  181. "
  182. ></div>
  183. <div class="statistics-text">
  184. <el-tooltip class="box-item" effect="light" placement="bottom">
  185. <template #content>
  186. <div
  187. style="
  188. max-width: 400px;
  189. max-height: 50vh;
  190. word-break: break-all;
  191. "
  192. >
  193. {{ item.label }}
  194. </div>
  195. </template>
  196. <span style="cursor: pointer">{{ item.label }}</span>
  197. </el-tooltip>
  198. </div>
  199. </div>
  200. <div style="color: black; font-size: 20px; font-weight: 700">
  201. {{ getNum(item.value) }}
  202. </div>
  203. </div>
  204. </template>
  205. </div>
  206. </div>
  207. <byTable
  208. :source="sourceList.data"
  209. :pagination="sourceList.pagination"
  210. :config="config"
  211. :loading="loading"
  212. :selectConfig="selectConfig"
  213. highlight-current-row
  214. @get-list="getList"
  215. >
  216. <template #isTop="{ item }">
  217. <div>
  218. <img
  219. style="cursor: pointer; width: 20px; transform: translateY(5px)"
  220. :src="'/img/isTop.png'"
  221. @click="deleteTop(item)"
  222. v-if="item.isTop === 1"
  223. />
  224. <img
  225. style="cursor: pointer; width: 20px; transform: translateY(5px)"
  226. :src="'/img/noTop.png'"
  227. @click="addTop(item)"
  228. v-else
  229. />
  230. </div>
  231. </template>
  232. <template #address="{ item }">
  233. <span>{{ item.countryName }}</span>
  234. <span v-if="item.provinceName"> ,{{ item.provinceName }}</span>
  235. <span v-if="item.cityName"> ,{{ item.cityName }}</span>
  236. </template>
  237. <template #name="{ item }">
  238. <!-- style="cursor: pointer; color: #409eff" @click="handleClickName(item)" -->
  239. <div>
  240. {{ item.name }}
  241. </div>
  242. </template>
  243. <template #tags="{ item }">
  244. <div style="width: 100%">
  245. <el-tag
  246. style="margin-right: 8px"
  247. type="success"
  248. v-for="(tag, index) in item.tag"
  249. closable
  250. :key="index"
  251. @close="tagClose(tag, item)"
  252. >
  253. {{ dictValueLabel(tag, customerTag) }}
  254. </el-tag>
  255. <template v-if="item.tag.length !== customerTag.length">
  256. <el-select
  257. v-if="item.addTagShow"
  258. v-model="addTag"
  259. style="width: 100%"
  260. @change="
  261. (val) => {
  262. return changeTag(val, item);
  263. }
  264. "
  265. >
  266. <el-option
  267. v-for="tag in customerTag"
  268. :key="tag.value"
  269. :label="tag.label"
  270. :value="tag.value"
  271. :disabled="judgeTagSelect(item.tag, tag.value)"
  272. />
  273. </el-select>
  274. <el-tag
  275. style="cursor: pointer"
  276. type="success"
  277. @click="showSelect(item)"
  278. v-else
  279. >
  280. +
  281. </el-tag>
  282. </template>
  283. </div>
  284. </template>
  285. <template #follow="{ item }">
  286. <div :class="'getWidth' + item.id" style="width: 100%">
  287. <div style="width: 100%; display: flex">
  288. <template
  289. v-if="
  290. item.customerFollowRecordsList &&
  291. item.customerFollowRecordsList.length > 0
  292. "
  293. >
  294. <div
  295. :style="
  296. index > 2
  297. ? 'line-height: 32px; margin-right: 8px; padding: 0 8px; background-color: #eeeeee; border-radius: 4px; cursor: pointer; display: none'
  298. : 'line-height: 32px; margin-right: 8px; padding: 0 8px; background-color: #eeeeee; border-radius: 4px; cursor: pointer'
  299. "
  300. v-for="(record, index) in item.customerFollowRecordsList"
  301. :key="record.id"
  302. >
  303. <el-popover
  304. placement="bottom"
  305. :width="300"
  306. trigger="hover"
  307. @show="recordShow(record)"
  308. >
  309. <template #reference>
  310. <div>
  311. <span v-if="record.date">{{
  312. record.date.substr(0, 10)
  313. }}</span>
  314. <el-icon
  315. style="margin-left: 8px; transform: translateY(2px)"
  316. @click="deleteFollow(record)"
  317. ><DeleteFilled
  318. /></el-icon>
  319. </div>
  320. </template>
  321. <template #default>
  322. <div style="width: 100%">
  323. <div style="color: #909399; margin: 8px 0">
  324. 跟进时间: {{ record.date }}
  325. </div>
  326. <div
  327. style="word-wrap: break-word; margin: 8px 0"
  328. v-html="getStyle(record.content)"
  329. v-if="record.content"
  330. ></div>
  331. <div v-else>跟进记录:</div>
  332. <div
  333. style="margin: 8px 0; display: flex"
  334. v-if="record.fileList && record.fileList.length > 0"
  335. >
  336. <div style="width: 36px">附件:</div>
  337. <div style="width: calc(100% - 36px)">
  338. <div
  339. v-for="(file, index) in record.fileList"
  340. :key="index"
  341. >
  342. <a
  343. style="color: #409eff; cursor: pointer"
  344. @click="openFile(file.fileUrl)"
  345. >{{ file.fileName }}</a
  346. >
  347. </div>
  348. </div>
  349. </div>
  350. </div>
  351. </template>
  352. </el-popover>
  353. </div>
  354. <div
  355. style="
  356. line-height: 32px;
  357. margin-right: 8px;
  358. padding: 0 8px;
  359. background-color: #eeeeee;
  360. border-radius: 4px;
  361. cursor: pointer;
  362. "
  363. @click="clickMore(item)"
  364. v-if="item.customerFollowRecordsList.length >= 3"
  365. >
  366. 更多
  367. </div>
  368. </template>
  369. </div>
  370. </div>
  371. </template>
  372. </byTable>
  373. <el-dialog
  374. :title="modalType == 'add' ? '新增' : '编辑'"
  375. v-if="dialogVisible"
  376. v-model="dialogVisible"
  377. width="800"
  378. v-loading="loadingOperation"
  379. >
  380. <byForm
  381. :formConfig="formConfig"
  382. :formOption="formOption"
  383. v-model="formData.data"
  384. :rules="rules"
  385. ref="submit"
  386. >
  387. <template #allAddress>
  388. <el-row style="width: 100%">
  389. <el-col :span="8">
  390. <el-form-item prop="countryId">
  391. <el-select
  392. v-model="formData.data.countryId"
  393. placeholder="国家"
  394. filterable
  395. allow-create
  396. @change="(val) => getCityData(val, '20', true)"
  397. >
  398. <el-option
  399. v-for="item in countryData"
  400. :label="item.chineseName"
  401. :value="item.id"
  402. >
  403. </el-option>
  404. </el-select>
  405. </el-form-item>
  406. </el-col>
  407. <el-col :span="8">
  408. <el-form-item prop="provinceName">
  409. <selectCity
  410. placeholder="省/洲"
  411. @change="(val) => getCityData(val, '30', true)"
  412. addressId="provinceId"
  413. addressName="provinceName"
  414. v-model="formData.data"
  415. :data="provinceData"
  416. >
  417. </selectCity>
  418. </el-form-item>
  419. </el-col>
  420. <el-col :span="8">
  421. <el-form-item prop="cityName">
  422. <selectCity
  423. placeholder="城市"
  424. addressId="cityId"
  425. addressName="cityName"
  426. v-model="formData.data"
  427. :data="cityData"
  428. ></selectCity>
  429. </el-form-item>
  430. </el-col>
  431. </el-row>
  432. <el-row style="margin-top: 20px; width: 100%">
  433. <el-col :span="24">
  434. <el-form-item prop="address">
  435. <el-input v-model="formData.data.address" type="textarea">
  436. </el-input>
  437. </el-form-item>
  438. </el-col>
  439. </el-row>
  440. </template>
  441. <template #person>
  442. <div style="width: 100%">
  443. <el-button type="primary" @click="clickAddPerson">添 加</el-button>
  444. <el-table
  445. :data="formData.data.customerUserList"
  446. style="width: 100%; margin-top: 16px"
  447. >
  448. <el-table-column label="联系人" width="160">
  449. <template #default="{ row, $index }">
  450. <div style="width: 100%">
  451. <el-form-item
  452. :prop="'customerUserList.' + $index + '.name'"
  453. :rules="rules.name2"
  454. :inline-message="true"
  455. >
  456. <el-input v-model="row.name" placeholder="请输入联系人" />
  457. </el-form-item>
  458. </div>
  459. </template>
  460. </el-table-column>
  461. <el-table-column label="电子邮箱">
  462. <template #default="{ row, $index }">
  463. <div style="width: 100%">
  464. <el-form-item
  465. :prop="'customerUserList.' + $index + '.email'"
  466. :rules="rules.email"
  467. :inline-message="true"
  468. >
  469. <el-input
  470. v-model="row.email"
  471. placeholder="请输入电子邮箱"
  472. />
  473. </el-form-item>
  474. </div>
  475. </template>
  476. </el-table-column>
  477. <el-table-column
  478. align="center"
  479. label="操作"
  480. width="120"
  481. fixed="right"
  482. >
  483. <template #default="{ row, $index }">
  484. <el-button
  485. type="primary"
  486. link
  487. @click="clickInformationMore(row, $index)"
  488. >更多</el-button
  489. >
  490. <el-button type="primary" link @click="clickDelete($index)"
  491. >删除</el-button
  492. >
  493. </template>
  494. </el-table-column>
  495. </el-table>
  496. </div>
  497. </template>
  498. </byForm>
  499. <template #footer>
  500. <el-button @click="dialogVisible = false" size="large">取 消</el-button>
  501. <el-button
  502. type="primary"
  503. @click="submitForm()"
  504. size="large"
  505. :loading="submitLoading"
  506. >确 定</el-button
  507. >
  508. </template>
  509. </el-dialog>
  510. <el-dialog
  511. title="更多联系方式"
  512. v-if="openPerson"
  513. v-model="openPerson"
  514. width="700"
  515. >
  516. <el-form
  517. :label-position="'top'"
  518. :model="formPerson.data"
  519. :rules="rulesPerson"
  520. ref="person"
  521. >
  522. <el-form-item label="联系人" prop="name">
  523. <el-input v-model="formPerson.data.name" />
  524. </el-form-item>
  525. <el-form-item label="电子邮箱" prop="email">
  526. <el-input v-model="formPerson.data.email" />
  527. </el-form-item>
  528. <el-form-item label="更多联系方式">
  529. <div style="width: 100%">
  530. <el-button type="primary" @click="clickAddMoreInformation"
  531. >添 加</el-button
  532. >
  533. <el-table
  534. :data="formPerson.data.contact"
  535. style="width: 100%; margin-top: 16px"
  536. >
  537. <el-table-column label="类型" width="180">
  538. <template #default="{ row, $index }">
  539. <div style="width: 100%">
  540. <el-form-item
  541. :prop="'contact.' + $index + '.type'"
  542. :rules="rulesPerson.type"
  543. :inline-message="true"
  544. >
  545. <el-select
  546. v-model="row.type"
  547. placeholder="请选择类型"
  548. style="width: 100%"
  549. >
  550. <el-option
  551. v-for="item in contactType"
  552. :key="item.value"
  553. :label="item.label"
  554. :value="item.value"
  555. />
  556. </el-select>
  557. </el-form-item>
  558. </div>
  559. </template>
  560. </el-table-column>
  561. <el-table-column label="联系号码">
  562. <template #default="{ row, $index }">
  563. <div style="width: 100%">
  564. <el-form-item
  565. :prop="'contact.' + $index + '.contactNo'"
  566. :rules="rulesPerson.contactNo"
  567. :inline-message="true"
  568. >
  569. <el-input
  570. v-model="row.contactNo"
  571. placeholder="请输入联系号码"
  572. />
  573. </el-form-item>
  574. </div>
  575. </template>
  576. </el-table-column>
  577. <el-table-column
  578. align="center"
  579. label="操作"
  580. width="120"
  581. fixed="right"
  582. >
  583. <template #default="{ $index }">
  584. <el-button
  585. type="primary"
  586. link
  587. @click="clickInformationDelete($index)"
  588. >删除</el-button
  589. >
  590. </template>
  591. </el-table-column>
  592. </el-table>
  593. </div>
  594. </el-form-item>
  595. </el-form>
  596. <template #footer>
  597. <el-button @click="openPerson = false" size="large">取 消</el-button>
  598. <el-button type="primary" @click="submitPerson()" size="large"
  599. >确 定</el-button
  600. >
  601. </template>
  602. </el-dialog>
  603. <el-dialog
  604. title="分配"
  605. v-if="openAllocation"
  606. v-model="openAllocation"
  607. width="300"
  608. >
  609. <byForm
  610. :formConfig="formConfigAllocation"
  611. :formOption="formOption"
  612. v-model="formAllocation.data"
  613. :rules="rulesAllocation"
  614. ref="allocation"
  615. >
  616. </byForm>
  617. <template #footer>
  618. <el-button @click="openAllocation = false" size="large"
  619. >取 消</el-button
  620. >
  621. <el-button type="primary" @click="submitAllocation()" size="large"
  622. >确 定</el-button
  623. >
  624. </template>
  625. </el-dialog>
  626. <el-dialog
  627. title="添加跟进记录"
  628. v-if="openFollow"
  629. v-model="openFollow"
  630. width="500"
  631. destroy-on-close
  632. >
  633. <byForm
  634. :formConfig="formConfigAFollow"
  635. :formOption="formOption"
  636. v-model="formFollow.data"
  637. :rules="rulesFollow"
  638. ref="follow"
  639. >
  640. <template #fileSlot>
  641. <div style="width: 100%">
  642. <el-upload
  643. v-model:fileList="fileList"
  644. action="https://winfaster.oss-cn-fuzhou.aliyuncs.com"
  645. :data="uploadData"
  646. multiple
  647. :before-upload="uploadFile"
  648. :on-preview="onPreviewFile"
  649. >
  650. <el-button type="primary">文件上传</el-button>
  651. </el-upload>
  652. </div>
  653. </template>
  654. </byForm>
  655. <template #footer>
  656. <el-button @click="openFollow = false" size="large">取 消</el-button>
  657. <el-button type="primary" @click="submitFollow()" size="large"
  658. >确 定</el-button
  659. >
  660. </template>
  661. </el-dialog>
  662. <el-dialog
  663. title="跟进记录"
  664. v-if="openRecordMore"
  665. v-model="openRecordMore"
  666. width="800"
  667. destroy-on-close
  668. >
  669. <div>
  670. <div style="padding: 8px 0">
  671. <el-button type="primary" @click="clickFollowUp(rowData)" plain
  672. >添加跟进记录</el-button
  673. >
  674. </div>
  675. <div style="padding-top: 16px">
  676. <div
  677. v-infinite-scroll="infiniteScroll"
  678. class="infinite-scroll"
  679. :infinite-scroll-disabled="judgeTotal()"
  680. >
  681. <el-timeline>
  682. <el-timeline-item
  683. v-for="(record, index) in recordList"
  684. :key="index"
  685. :timestamp="record.date"
  686. hide-timestamp
  687. >
  688. <div>
  689. <div
  690. style="
  691. padding: 0 0 8px 0;
  692. display: flex;
  693. justify-content: space-between;
  694. "
  695. >
  696. <span>{{
  697. dictValueLabel(record.createUser, userList)
  698. }}</span>
  699. <span>{{ record.date }}</span>
  700. </div>
  701. <div
  702. style="word-wrap: break-word; margin: 8px 0"
  703. v-html="getStyle(record.content)"
  704. v-if="record.content"
  705. ></div>
  706. <div style="margin: 8px 0" v-else>跟进记录:</div>
  707. <div
  708. style="margin: 8px 0; display: flex"
  709. v-if="record.fileList && record.fileList.length > 0"
  710. >
  711. <div style="width: 36px">附件:</div>
  712. <div style="width: calc(100% - 36px)">
  713. <div
  714. v-for="(file, index) in record.fileList"
  715. :key="index"
  716. >
  717. <a
  718. style="color: #409eff; cursor: pointer"
  719. @click="openFile(file.fileUrl)"
  720. >{{ file.fileName }}</a
  721. >
  722. </div>
  723. </div>
  724. </div>
  725. </div>
  726. </el-timeline-item>
  727. </el-timeline>
  728. </div>
  729. </div>
  730. </div>
  731. <template #footer>
  732. <el-button @click="openRecordMore = false" size="large"
  733. >关 闭</el-button
  734. >
  735. </template>
  736. </el-dialog>
  737. </div>
  738. </template>
  739. <script setup>
  740. import { ElMessage, ElMessageBox } from "element-plus";
  741. import byTable from "@/components/byTable/index";
  742. import byForm from "@/components/byForm/index";
  743. import { computed, ref } from "vue";
  744. import useUserStore from "@/store/modules/user";
  745. import selectCity from "@/components/selectCity/index.vue";
  746. const { proxy } = getCurrentInstance();
  747. const loading = ref(false);
  748. const loadingOperation = ref(false);
  749. const submitLoading = ref(false);
  750. const openPerson = ref(false);
  751. const openAllocation = ref(false);
  752. const customerTag = ref([]);
  753. const customerSource = ref([]);
  754. const customerStatus = ref([]);
  755. const contactType = ref([]);
  756. const userList = ref([]);
  757. const fileList = ref([]);
  758. const uploadData = ref({});
  759. const statisticsType = ref([
  760. {
  761. label: "客户来源统计",
  762. value: 1,
  763. },
  764. {
  765. label: "客户类型统计",
  766. value: 2,
  767. },
  768. {
  769. label: "业务员统计",
  770. value: 3,
  771. },
  772. ]);
  773. const sourceList = ref({
  774. data: [],
  775. pagination: {
  776. total: 0,
  777. pageNum: 1,
  778. pageSize: 10,
  779. keyword: "",
  780. status: "",
  781. source: "",
  782. type: "",
  783. },
  784. paginationTwo: {
  785. statisticsType: 1,
  786. type: null,
  787. },
  788. });
  789. const selectConfig = computed(() => {
  790. return [
  791. {
  792. label: "客户状态",
  793. prop: "type",
  794. data: [
  795. {
  796. label: "公海",
  797. value: "0",
  798. },
  799. {
  800. label: "私海",
  801. value: "1",
  802. },
  803. ],
  804. },
  805. {
  806. label: "客户来源",
  807. prop: "source",
  808. data: customerSource.value,
  809. },
  810. {
  811. label: "客户类型",
  812. prop: "status",
  813. data: customerStatus.value,
  814. },
  815. ];
  816. });
  817. const config = computed(() => {
  818. return [
  819. {
  820. attrs: {
  821. label: "",
  822. slot: "isTop",
  823. fixed: "left",
  824. width: 60,
  825. align: "center",
  826. },
  827. },
  828. {
  829. attrs: {
  830. label: "客户名称",
  831. prop: "name",
  832. slot: "name",
  833. fixed: "left",
  834. width: 180,
  835. },
  836. },
  837. {
  838. attrs: {
  839. label: "所在城市",
  840. slot: "address",
  841. width: 160,
  842. },
  843. },
  844. {
  845. attrs: {
  846. label: "客户代码",
  847. prop: "customerCode",
  848. width: 120,
  849. },
  850. },
  851. {
  852. attrs: {
  853. label: "客户来源",
  854. prop: "source",
  855. width: 120,
  856. },
  857. render(type) {
  858. return proxy.dictValueLabel(type, customerSource.value);
  859. },
  860. },
  861. {
  862. attrs: {
  863. label: "客户类型",
  864. prop: "status",
  865. width: 120,
  866. },
  867. render(type) {
  868. return proxy.dictValueLabel(type, customerStatus.value);
  869. },
  870. },
  871. {
  872. attrs: {
  873. label: "客户标签",
  874. slot: "tags",
  875. },
  876. },
  877. // {
  878. // attrs: {
  879. // label: "业务员",
  880. // prop: "userId",
  881. // width: 140,
  882. // },
  883. // render(type) {
  884. // let data = userList.value.filter((item) => item.value == type);
  885. // if (data && data.length > 0) {
  886. // return data[0].label;
  887. // } else {
  888. // return "";
  889. // }
  890. // },
  891. // },
  892. // {
  893. // attrs: {
  894. // label: "跟进",
  895. // slot: "follow",
  896. // "min-width": 440,
  897. // },
  898. // },
  899. {
  900. attrs: {
  901. label: "操作",
  902. width: 120,
  903. align: "center",
  904. fixed: "right",
  905. },
  906. renderHTML(row) {
  907. return [
  908. // {
  909. // attrs: {
  910. // label: "分配",
  911. // type: "primary",
  912. // text: true,
  913. // },
  914. // el: "button",
  915. // click() {
  916. // formAllocation.data = {
  917. // id: row.id,
  918. // userId: row.userId,
  919. // };
  920. // openAllocation.value = true;
  921. // },
  922. // },
  923. // {
  924. // attrs: {
  925. // label: "跟进",
  926. // type: "primary",
  927. // text: true,
  928. // },
  929. // el: "button",
  930. // click() {
  931. // clickFollowUp(row);
  932. // },
  933. // },
  934. {
  935. attrs: {
  936. label: "修改",
  937. type: "primary",
  938. text: true,
  939. },
  940. el: "button",
  941. click() {
  942. update(row);
  943. },
  944. },
  945. {
  946. attrs: {
  947. label: "删除",
  948. type: "primary",
  949. text: true,
  950. },
  951. el: "button",
  952. click() {
  953. ElMessageBox.confirm(
  954. "此操作将永久删除该数据, 是否继续?",
  955. "提示",
  956. {
  957. confirmButtonText: "确定",
  958. cancelButtonText: "取消",
  959. type: "warning",
  960. }
  961. ).then(() => {
  962. proxy
  963. .post("/customer/delete", {
  964. id: row.id,
  965. })
  966. .then(() => {
  967. ElMessage({
  968. message: "删除成功",
  969. type: "success",
  970. });
  971. getList();
  972. obtainStatisticalData();
  973. });
  974. });
  975. },
  976. },
  977. ];
  978. },
  979. },
  980. ];
  981. });
  982. const modalType = ref("add");
  983. const dialogVisible = ref(false);
  984. const formData = reactive({
  985. data: {
  986. countryId: "44",
  987. },
  988. });
  989. const openFollow = ref(false);
  990. const formPerson = reactive({
  991. data: {},
  992. });
  993. const formAllocation = reactive({
  994. data: {},
  995. });
  996. const formFollow = reactive({
  997. data: {},
  998. });
  999. const formOption = reactive({
  1000. inline: true,
  1001. labelWidth: 100,
  1002. itemWidth: 100,
  1003. rules: [],
  1004. });
  1005. const formConfig = computed(() => {
  1006. return [
  1007. {
  1008. type: "input",
  1009. prop: "name",
  1010. label: "客户名称",
  1011. required: true,
  1012. itemWidth: 100,
  1013. itemType: "text",
  1014. },
  1015. {
  1016. type: "slot",
  1017. slotName: "allAddress",
  1018. label: "详细地址",
  1019. },
  1020. {
  1021. type: "input",
  1022. prop: "customerCode",
  1023. label: "客户代码",
  1024. required: true,
  1025. itemWidth: 100,
  1026. itemType: "text",
  1027. },
  1028. {
  1029. type: "select",
  1030. label: "客户来源",
  1031. prop: "source",
  1032. itemWidth: 50,
  1033. data: customerSource.value,
  1034. },
  1035. {
  1036. type: "select",
  1037. label: "客户类型",
  1038. prop: "status",
  1039. itemWidth: 50,
  1040. data: customerStatus.value,
  1041. },
  1042. {
  1043. type: "select",
  1044. label: "业务员",
  1045. prop: "userId",
  1046. itemWidth: 100,
  1047. data: userList.value,
  1048. clearable: true,
  1049. },
  1050. {
  1051. type: "select",
  1052. label: "客户标签",
  1053. prop: "tags",
  1054. itemWidth: 100,
  1055. multiple: true,
  1056. data: customerTag.value,
  1057. style: {
  1058. width: "100%",
  1059. },
  1060. },
  1061. {
  1062. type: "slot",
  1063. slotName: "person",
  1064. label: "客户联系人",
  1065. },
  1066. ];
  1067. });
  1068. const rules = ref({
  1069. name: [{ required: true, message: "请输入客户名称", trigger: "blur" }],
  1070. name2: [{ required: true, message: "请输入联系人", trigger: "blur" }],
  1071. email: [{ required: true, message: "请输入电子邮箱", trigger: "blur" }],
  1072. countryId: [{ required: true, message: "请选择国家", trigger: "change" }],
  1073. source: [{ required: true, message: "请选择客户来源", trigger: "change" }],
  1074. status: [{ required: true, message: "请选择类型", trigger: "change" }],
  1075. });
  1076. const formConfigAllocation = computed(() => {
  1077. return [
  1078. {
  1079. type: "select",
  1080. label: "业务员",
  1081. prop: "userId",
  1082. itemWidth: 100,
  1083. data: userList.value,
  1084. clearable: true,
  1085. },
  1086. ];
  1087. });
  1088. const rulesAllocation = ref({
  1089. userId: [{ required: true, message: "请选择业务员", trigger: "change" }],
  1090. });
  1091. const formConfigAFollow = computed(() => {
  1092. return [
  1093. {
  1094. type: "date",
  1095. itemType: "datetime",
  1096. label: "跟进时间",
  1097. prop: "date",
  1098. itemWidth: 100,
  1099. },
  1100. {
  1101. type: "input",
  1102. itemType: "textarea",
  1103. label: "跟进内容",
  1104. prop: "content",
  1105. itemWidth: 100,
  1106. },
  1107. {
  1108. type: "slot",
  1109. label: "上传附件",
  1110. prop: "fileList",
  1111. slotName: "fileSlot",
  1112. },
  1113. ];
  1114. });
  1115. const rulesPerson = ref({
  1116. name: [{ required: true, message: "请输入联系人", trigger: "blur" }],
  1117. email: [{ required: true, message: "请输入电子邮箱", trigger: "blur" }],
  1118. type: [{ required: true, message: "请选择类型", trigger: "change" }],
  1119. contactNo: [{ required: true, message: "请输入联系号码", trigger: "blur" }],
  1120. });
  1121. const rulesFollow = ref({
  1122. date: [{ required: true, message: "请选择跟进时间", trigger: "change" }],
  1123. content: [{ required: true, message: "请输入跟进内容", trigger: "blur" }],
  1124. });
  1125. const submit = ref(null);
  1126. const person = ref(null);
  1127. const allocation = ref(null);
  1128. const follow = ref(null);
  1129. const getList = async (req) => {
  1130. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  1131. loading.value = true;
  1132. proxy.post("/customer/page", sourceList.value.pagination).then((res) => {
  1133. res.rows.forEach((x) => {
  1134. x.addTagShow = false;
  1135. if (x.tag) {
  1136. x.tag = x.tag.split(",");
  1137. } else {
  1138. x.tag = [];
  1139. }
  1140. });
  1141. sourceList.value.data = res.rows;
  1142. sourceList.value.pagination.total = res.total;
  1143. setTimeout(() => {
  1144. loading.value = false;
  1145. }, 200);
  1146. });
  1147. };
  1148. const countryData = ref([]);
  1149. const provinceData = ref([]);
  1150. const cityData = ref([]);
  1151. const getCityData = (id, type, isChange) => {
  1152. proxy.post("/customizeArea/list", { parentId: id }).then((res) => {
  1153. if (type === "20") {
  1154. provinceData.value = res;
  1155. if (isChange) {
  1156. formData.data.provinceId = "";
  1157. formData.data.provinceName = "";
  1158. formData.data.cityId = "";
  1159. formData.data.cityName = "";
  1160. }
  1161. } else if (type === "30") {
  1162. cityData.value = res;
  1163. if (isChange) {
  1164. formData.data.cityId = "";
  1165. formData.data.cityName = "";
  1166. }
  1167. } else {
  1168. countryData.value = res;
  1169. }
  1170. });
  1171. };
  1172. getCityData("0");
  1173. const openModal = () => {
  1174. modalType.value = "add";
  1175. formData.data = {
  1176. countryId: "44",
  1177. tags: [],
  1178. };
  1179. getCityData(formData.data.countryId, "20");
  1180. loadingOperation.value = false;
  1181. dialogVisible.value = true;
  1182. };
  1183. const clickAddPerson = () => {
  1184. if (
  1185. formData.data.customerUserList &&
  1186. formData.data.customerUserList.length > 0
  1187. ) {
  1188. formData.data.customerUserList.push({
  1189. name: "",
  1190. email: "",
  1191. });
  1192. } else {
  1193. formData.data.customerUserList = [
  1194. {
  1195. name: "",
  1196. email: "",
  1197. },
  1198. ];
  1199. }
  1200. };
  1201. const submitAllocation = () => {
  1202. allocation.value.handleSubmit(() => {
  1203. proxy.post("/customer/CustomerAllocation", formAllocation.data).then(() => {
  1204. ElMessage({
  1205. message: "分配成功",
  1206. type: "success",
  1207. });
  1208. openAllocation.value = false;
  1209. getList();
  1210. obtainStatisticalData();
  1211. });
  1212. });
  1213. };
  1214. const submitFollow = () => {
  1215. follow.value.handleSubmit(() => {
  1216. if (fileList.value && fileList.value.length > 0) {
  1217. formFollow.data.fileList = fileList.value.map((item) => {
  1218. return {
  1219. id: item.raw.id,
  1220. fileName: item.raw.fileName,
  1221. fileUrl: item.raw.fileUrl,
  1222. };
  1223. });
  1224. } else {
  1225. formFollow.data.fileList = [];
  1226. }
  1227. proxy
  1228. .post("/customerFollowRecords/" + modalType.value, formFollow.data)
  1229. .then(
  1230. () => {
  1231. ElMessage({
  1232. message: modalType.value == "add" ? "添加成功" : "编辑成功",
  1233. type: "success",
  1234. });
  1235. openFollow.value = false;
  1236. getList();
  1237. },
  1238. (err) => {
  1239. console.log(err);
  1240. }
  1241. );
  1242. });
  1243. };
  1244. const submitForm = () => {
  1245. submit.value.handleSubmit(() => {
  1246. if (
  1247. formData.data.customerUserList &&
  1248. formData.data.customerUserList.length > 0
  1249. ) {
  1250. formData.data.tag = formData.data.tags.join(",");
  1251. submitLoading.value = true;
  1252. proxy.post("/customer/" + modalType.value, formData.data).then(
  1253. () => {
  1254. ElMessage({
  1255. message: modalType.value == "add" ? "添加成功" : "编辑成功",
  1256. type: "success",
  1257. });
  1258. dialogVisible.value = false;
  1259. submitLoading.value = false;
  1260. getList();
  1261. obtainStatisticalData();
  1262. },
  1263. (err) => {
  1264. console.log(err);
  1265. submitLoading.value = false;
  1266. }
  1267. );
  1268. } else {
  1269. ElMessage("请添加客户联系人");
  1270. }
  1271. });
  1272. };
  1273. const getDict = () => {
  1274. proxy
  1275. .getDictOne([
  1276. "customer_tag",
  1277. "customer_source",
  1278. "customer_status",
  1279. "contact_type",
  1280. ])
  1281. .then((res) => {
  1282. customerTag.value = res["customer_tag"].map((x) => ({
  1283. label: x.dictValue,
  1284. value: x.dictKey,
  1285. }));
  1286. customerSource.value = res["customer_source"].map((x) => ({
  1287. label: x.dictValue,
  1288. value: x.dictKey,
  1289. }));
  1290. customerStatus.value = res["customer_status"].map((x) => ({
  1291. label: x.dictValue,
  1292. value: x.dictKey,
  1293. }));
  1294. contactType.value = res["contact_type"].map((x) => ({
  1295. label: x.dictValue,
  1296. value: x.dictKey,
  1297. }));
  1298. });
  1299. proxy
  1300. .get("/tenantUser/list", {
  1301. pageNum: 1,
  1302. pageSize: 10000,
  1303. tenantId: useUserStore().user.tenantId,
  1304. })
  1305. .then((res) => {
  1306. userList.value = res.rows.map((item) => {
  1307. return {
  1308. label: item.nickName,
  1309. value: item.userId,
  1310. };
  1311. });
  1312. });
  1313. };
  1314. getDict();
  1315. getList();
  1316. const handleClickName = (row) => {
  1317. proxy.$router.push({
  1318. path: "/ERP/customer/portrait",
  1319. query: {
  1320. id: row.id,
  1321. },
  1322. });
  1323. };
  1324. const deleteFollow = (data) => {
  1325. ElMessageBox.confirm("是否确认删除该跟进?", "提示", {
  1326. confirmButtonText: "确定",
  1327. cancelButtonText: "取消",
  1328. type: "warning",
  1329. }).then(() => {
  1330. proxy
  1331. .post("/customerFollowRecords/delete", {
  1332. id: data.id,
  1333. })
  1334. .then(() => {
  1335. ElMessage({
  1336. message: "删除成功",
  1337. type: "success",
  1338. });
  1339. getList();
  1340. });
  1341. });
  1342. };
  1343. const addTag = ref("");
  1344. const judgeTagSelect = (data, val) => {
  1345. if (data && data.length > 0) {
  1346. if (data.includes(val)) {
  1347. return true;
  1348. }
  1349. }
  1350. return false;
  1351. };
  1352. const changeTag = (val, item) => {
  1353. let data = {
  1354. id: item.id,
  1355. tag: JSON.parse(JSON.stringify(item.tag)),
  1356. };
  1357. data.tag.push(val);
  1358. data.tag = data.tag.join(",");
  1359. proxy.post("/customer/editTag", data).then(() => {
  1360. ElMessage({
  1361. message: "添加成功",
  1362. type: "success",
  1363. });
  1364. item.addTagShow = false;
  1365. addTag.value = "";
  1366. getList();
  1367. });
  1368. };
  1369. const tagClose = (val, item) => {
  1370. let data = {
  1371. id: item.id,
  1372. tag: JSON.parse(JSON.stringify(item.tag)),
  1373. };
  1374. data.tag = data.tag.filter((row) => row !== val);
  1375. if (data.tag && data.tag.length > 0) {
  1376. data.tag = data.tag.join(",");
  1377. } else {
  1378. data.tag = "";
  1379. }
  1380. proxy.post("/customer/editTag", data).then(() => {
  1381. ElMessage({
  1382. message: "添加成功",
  1383. type: "success",
  1384. });
  1385. item.addTagShow = false;
  1386. addTag.value = "";
  1387. getList();
  1388. });
  1389. };
  1390. const showSelect = (item) => {
  1391. item.addTagShow = true;
  1392. };
  1393. const clickFollowUp = (item) => {
  1394. formFollow.data = {
  1395. customerId: item.id,
  1396. fileList: [],
  1397. };
  1398. fileList.value = [];
  1399. modalType.value = "add";
  1400. openFollow.value = true;
  1401. openRecordMore.value = false;
  1402. };
  1403. const uploadFile = async (file) => {
  1404. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  1405. uploadData.value = res.uploadBody;
  1406. file.id = res.id;
  1407. file.fileName = res.fileName;
  1408. file.fileUrl = res.fileUrl;
  1409. return true;
  1410. };
  1411. const onPreviewFile = (file) => {
  1412. window.open(file.raw.fileUrl, "_blank");
  1413. };
  1414. const getStyle = (val) => {
  1415. if (val) {
  1416. return "跟进记录: " + val.replace(/\n|\r\n/g, "<br>");
  1417. } else {
  1418. return "";
  1419. }
  1420. };
  1421. const recordShow = (item) => {
  1422. if (!(item.fileList && item.fileList.length > 0)) {
  1423. proxy
  1424. .post("/fileInfo/getList", { businessIdList: [item.id] })
  1425. .then((fileObj) => {
  1426. item.fileList = fileObj[item.id] || [];
  1427. });
  1428. }
  1429. };
  1430. const openFile = (path) => {
  1431. window.open(path, "_blank");
  1432. };
  1433. const recordList = ref([]);
  1434. const rowData = ref({});
  1435. const openRecordMore = ref(false);
  1436. const queryParams = ref({
  1437. total: 0,
  1438. pageNum: 1,
  1439. pageSize: 10,
  1440. customerId: "",
  1441. });
  1442. const clickMore = (item) => {
  1443. if (openRecordMore.value === false) {
  1444. queryParams.value.pageNum = 1;
  1445. recordList.value = [];
  1446. rowData.value = item;
  1447. queryParams.value.customerId = item.id;
  1448. }
  1449. proxy.post("/customerFollowRecords/page", queryParams.value).then((res) => {
  1450. recordList.value = recordList.value.concat(res.rows);
  1451. queryParams.value.total = res.total;
  1452. proxy
  1453. .post("/fileInfo/getList", {
  1454. businessIdList: res.rows.map((rows) => rows.id),
  1455. })
  1456. .then((fileObj) => {
  1457. for (let i = 0; i < res.rows.length; i++) {
  1458. recordList.value[
  1459. parseInt(
  1460. i + (queryParams.value.pageNum - 1) * queryParams.value.pageSize
  1461. )
  1462. ].fileList =
  1463. fileObj[
  1464. recordList.value[
  1465. parseInt(
  1466. i +
  1467. (queryParams.value.pageNum - 1) * queryParams.value.pageSize
  1468. )
  1469. ].id
  1470. ] || [];
  1471. }
  1472. });
  1473. });
  1474. openRecordMore.value = true;
  1475. };
  1476. const infiniteScroll = () => {
  1477. queryParams.value.pageNum++;
  1478. clickMore();
  1479. };
  1480. const judgeTotal = () => {
  1481. if (
  1482. queryParams.value.pageNum * queryParams.value.pageSize >=
  1483. queryParams.value.total
  1484. ) {
  1485. return true;
  1486. }
  1487. return false;
  1488. };
  1489. const moreIndex = ref(0);
  1490. const clickInformationMore = (item, index) => {
  1491. moreIndex.value = index;
  1492. if (item.contactJson) {
  1493. item.contact = JSON.parse(item.contactJson);
  1494. } else {
  1495. item.contact = [];
  1496. }
  1497. formPerson.data = proxy.deepClone(item);
  1498. openPerson.value = true;
  1499. };
  1500. const clickDelete = (index) => {
  1501. formData.data.customerUserList.splice(index, 1);
  1502. };
  1503. const clickAddMoreInformation = () => {
  1504. if (formPerson.data.contact && formPerson.data.contact.length > 0) {
  1505. formPerson.data.contact.push({
  1506. type: "",
  1507. contactNo: "",
  1508. });
  1509. } else {
  1510. formPerson.data.contact = [
  1511. {
  1512. type: "",
  1513. contactNo: "",
  1514. },
  1515. ];
  1516. }
  1517. };
  1518. const clickInformationDelete = (index) => {
  1519. formPerson.data.contact.splice(index, 1);
  1520. };
  1521. const submitPerson = () => {
  1522. person.value.validate((valid) => {
  1523. if (valid) {
  1524. formPerson.data.contactJson = JSON.stringify(formPerson.data.contact);
  1525. formData.data.customerUserList[moreIndex.value] = formPerson.data;
  1526. openPerson.value = false;
  1527. }
  1528. });
  1529. };
  1530. const deleteTop = (item) => {
  1531. proxy.post("/customerTop/delete", { customerId: item.id }).then(() => {
  1532. item.isTop = 0;
  1533. });
  1534. };
  1535. const addTop = (item) => {
  1536. proxy.post("/customerTop/add", { customerId: item.id }).then(() => {
  1537. item.isTop = 1;
  1538. });
  1539. };
  1540. const searchItemSelect = (val) => {
  1541. sourceList.value.paginationTwo.statisticsType = val;
  1542. obtainStatisticalData();
  1543. };
  1544. const statisticalData = ref({
  1545. countAmount: 0,
  1546. customerList: [],
  1547. });
  1548. const obtainStatisticalData = () => {
  1549. proxy
  1550. .post("/customer/sourceStatistics", sourceList.value.paginationTwo)
  1551. .then((res) => {
  1552. statisticalData.value = res;
  1553. });
  1554. };
  1555. obtainStatisticalData();
  1556. const getNum = (val) => {
  1557. let num = 0;
  1558. if (
  1559. statisticalData.value.customerList &&
  1560. statisticalData.value.customerList.length > 0
  1561. ) {
  1562. statisticalData.value.customerList.map((item) => {
  1563. if (sourceList.value.paginationTwo.statisticsType === 1) {
  1564. if (item.source === val) {
  1565. num = item.count;
  1566. }
  1567. } else if (sourceList.value.paginationTwo.statisticsType === 2) {
  1568. if (item.status === val) {
  1569. num = item.count;
  1570. }
  1571. } else if (sourceList.value.paginationTwo.statisticsType === 3) {
  1572. if (item.userId === val) {
  1573. num = item.count;
  1574. }
  1575. }
  1576. });
  1577. }
  1578. return num;
  1579. };
  1580. const update = (row) => {
  1581. modalType.value = "edit";
  1582. loadingOperation.value = true;
  1583. proxy.post("/customer/detail", { id: row.id }).then((res) => {
  1584. if (res.tag) {
  1585. res.tags = res.tag.split(",");
  1586. } else {
  1587. res.tags = [];
  1588. }
  1589. formData.data = res;
  1590. getCityData(formData.data.countryId, "20");
  1591. if (formData.data.provinceId) {
  1592. getCityData(formData.data.provinceId, "30");
  1593. }
  1594. loadingOperation.value = false;
  1595. dialogVisible.value = true;
  1596. });
  1597. };
  1598. </script>
  1599. <style lang="scss" scoped>
  1600. .tenant {
  1601. padding: 20px;
  1602. }
  1603. .infinite-scroll {
  1604. max-height: calc(89vh - 94px - 70px - 58px - 16px);
  1605. overflow-y: auto;
  1606. &::-webkit-scrollbar {
  1607. width: 0px;
  1608. }
  1609. }
  1610. .by-dropdown {
  1611. position: relative;
  1612. text-align: left;
  1613. height: 32px;
  1614. z-index: 1010;
  1615. padding: 0 10px;
  1616. transition: all 0.5s ease;
  1617. cursor: pointer;
  1618. line-height: 32px;
  1619. .by-dropdown-title {
  1620. font-size: 14px;
  1621. background-color: #fff;
  1622. }
  1623. ul {
  1624. position: absolute;
  1625. left: 0;
  1626. top: 32px;
  1627. padding: 0;
  1628. margin: 0;
  1629. z-index: 1200;
  1630. display: none;
  1631. white-space: nowrap;
  1632. background-color: #fff;
  1633. li {
  1634. list-style: none;
  1635. z-index: 1200;
  1636. font-size: 12px;
  1637. height: 30px;
  1638. padding: 0 10px;
  1639. }
  1640. li:hover {
  1641. background-color: #eff6ff;
  1642. color: #0084ff;
  1643. }
  1644. }
  1645. }
  1646. .by-dropdown::before {
  1647. display: block;
  1648. width: 1px;
  1649. content: " ";
  1650. position: absolute;
  1651. height: 14px;
  1652. top: 8px;
  1653. background-color: #ddd;
  1654. right: 0;
  1655. z-index: 1011;
  1656. }
  1657. .by-dropdown:hover {
  1658. background: #ffffff;
  1659. border-radius: 2px 2px 2px 2px;
  1660. opacity: 1;
  1661. ul {
  1662. background: #ffffff;
  1663. box-shadow: 0px 2px 16px 1px rgba(0, 0, 0, 0.06);
  1664. border-radius: 2px 2px 2px 2px;
  1665. opacity: 1;
  1666. display: block;
  1667. text-align: left;
  1668. }
  1669. }
  1670. .by-dropdown-lists {
  1671. max-height: 50vh;
  1672. overflow-y: auto;
  1673. line-height: 1;
  1674. }
  1675. .statistics-text {
  1676. padding-left: 8px;
  1677. width: 152px;
  1678. overflow: hidden;
  1679. text-overflow: ellipsis;
  1680. white-space: nowrap;
  1681. }
  1682. </style>