index.vue 44 KB

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