index.vue 47 KB

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