index.vue 46 KB

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