index.vue 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px" style="border: 1px solid transparent">
  4. <el-form-item label="销售公司" prop="companyId">
  5. <el-select v-model="queryParams.companyId" placeholder="销售公司" size="small" @change="getAllUserlist(queryParams.companyId)">
  6. <el-option
  7. v-for="dict in qwCompanyList"
  8. :key="dict.companyId"
  9. :label="dict.companyName"
  10. :value="dict.companyId"
  11. />
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="销售账号" prop="companyUserName">
  15. <el-select v-model="queryParams.companyUserName" placeholder="销售账号" size="small" clearable>
  16. <el-option
  17. v-for="dict in companyUserNameList"
  18. :key="dict.userId"
  19. :label="dict.userName"
  20. :value="dict.userName"
  21. />
  22. </el-select>
  23. </el-form-item>
  24. <el-form-item label="企微微信" prop="companyUserName">
  25. <el-select v-model="queryParams.qwUserId" placeholder="企微微信" size="small" clearable>
  26. <el-option
  27. v-for="dict in qwUserList"
  28. :key="dict.id"
  29. :label="dict.qwUserName"
  30. :value="dict.id"
  31. />
  32. </el-select>
  33. </el-form-item>
  34. <el-form-item label="客户会员id" prop="fsUserId">
  35. <el-input
  36. v-model="queryParams.fsUserId"
  37. placeholder="请输入客户会员id"
  38. clearable
  39. size="small"
  40. @keyup.enter.native="handleQuery"
  41. />
  42. </el-form-item>
  43. <el-form-item label="企微客户id" prop="extId">
  44. <el-input
  45. v-model="queryParams.extId"
  46. placeholder="请输入客户id"
  47. clearable
  48. size="small"
  49. @keyup.enter.native="handleQuery"
  50. />
  51. </el-form-item>
  52. <el-form-item label="客户名称" prop="name">
  53. <el-input
  54. v-model="queryParams.name"
  55. placeholder="请输入客户名称"
  56. clearable
  57. size="small"
  58. @keyup.enter.native="handleQuery"
  59. />
  60. </el-form-item>
  61. <el-form-item label="销售企微昵称" prop="qwUserName">
  62. <el-input
  63. v-model="queryParams.qwUserName"
  64. placeholder="请输入销售企微昵称"
  65. clearable
  66. size="small"
  67. @keyup.enter.native="handleQuery"
  68. />
  69. </el-form-item>
  70. <el-form-item label="用户类别" prop="type">
  71. <el-select v-model="queryParams.type" placeholder="请选择用户类别" clearable size="small">
  72. <el-option
  73. v-for="dict in typeOptions"
  74. :key="dict.dictValue"
  75. :label="dict.dictLabel"
  76. :value="dict.dictValue"
  77. />
  78. </el-select>
  79. </el-form-item>
  80. <el-form-item label="性别" prop="gender">
  81. <el-select v-model="queryParams.gender" placeholder="状态" clearable size="small">
  82. <el-option
  83. v-for="dict in genderOptions"
  84. :key="dict.dictValue"
  85. :label="dict.dictLabel"
  86. :value="dict.dictValue"
  87. />
  88. </el-select>
  89. </el-form-item>
  90. <el-form-item label="客户等级" prop="level">
  91. <el-select v-model="queryParams.level" placeholder="客户等级" clearable size="small">
  92. <el-option
  93. v-for="dict in ratingType"
  94. :key="dict.dictValue"
  95. :label="dict.dictLabel"
  96. :value="dict.dictValue"
  97. />
  98. </el-select>
  99. </el-form-item>
  100. <el-form-item label="等级升降" prop="levelType">
  101. <el-select v-model="queryParams.levelType" placeholder="等级升降" clearable size="small">
  102. <el-option
  103. v-for="dict in ratingUpFall"
  104. :key="dict.dictValue"
  105. :label="dict.dictLabel"
  106. :value="dict.dictValue"
  107. />
  108. </el-select>
  109. </el-form-item>
  110. <el-form-item label="电话号码" prop="remarkMobiles">
  111. <el-input
  112. v-model="queryParams.remarkMobiles"
  113. placeholder="请输入备注电话号码"
  114. clearable
  115. size="small"
  116. @keyup.enter.native="handleQuery"
  117. />
  118. </el-form-item>
  119. <el-form-item label="来源" prop="addWay">
  120. <el-select v-model="queryParams.addWay" placeholder="来源" clearable size="small">
  121. <el-option
  122. v-for="dict in addWayOptions"
  123. :key="dict.dictValue"
  124. :label="dict.dictLabel"
  125. :value="dict.dictValue"
  126. />
  127. </el-select>
  128. </el-form-item>
  129. <el-form-item label="状态" prop="status">
  130. <el-select v-model="queryParams.status" placeholder="状态" clearable size="small">
  131. <el-option
  132. v-for="dict in statusOptions"
  133. :key="dict.dictValue"
  134. :label="dict.dictLabel"
  135. :value="dict.dictValue"
  136. />
  137. </el-select>
  138. </el-form-item>
  139. <el-form-item label="转接状态" prop="addWay">
  140. <el-select v-model="queryParams.transferStatus" placeholder="转接状态" clearable size="small">
  141. <el-option
  142. v-for="dict in transferStatusOptions"
  143. :key="dict.dictValue"
  144. :label="dict.dictLabel"
  145. :value="dict.dictValue"
  146. />
  147. </el-select>
  148. </el-form-item>
  149. <el-form-item label="是否绑定会员" prop="isBindMini">
  150. <el-select v-model="queryParams.isBindMini" placeholder="是否绑定会员" clearable size="small" @change="handleQuery" >
  151. <el-option
  152. v-for="dict in isBindMiniOptions"
  153. :key="dict.dictValue"
  154. :label="dict.dictLabel"
  155. :value="dict.dictValue"
  156. />
  157. </el-select>
  158. </el-form-item>
  159. <el-form-item label="标签" prop="tagIds">
  160. <div @click="hangleChangeTags()" style="cursor: pointer; border: 1px solid #e6e6e6; background-color: white; overflow: hidden; flex-grow: 1;width: 250px">
  161. <div style="min-height: 35px; max-height: 200px; overflow-y: auto;">
  162. <el-tag type="success"
  163. closable
  164. :disable-transitions="false"
  165. v-for="list in this.selectTags"
  166. :key="list.tagId"
  167. @close="handleCloseTags(list)"
  168. style="margin: 3px;"
  169. >{{list.name}}
  170. </el-tag>
  171. </div>
  172. </div>
  173. </el-form-item>
  174. <el-form-item label="备注" prop="remark">
  175. <el-input
  176. v-model="queryParams.remark"
  177. placeholder="请输入备注"
  178. clearable
  179. size="small"
  180. @keyup.enter.native="handleQuery"
  181. />
  182. </el-form-item>
  183. <el-form-item label="所属销售" prop="companyUser">
  184. <el-input
  185. v-model="queryParams.companyUser"
  186. placeholder="请输入昵称或者手机号"
  187. clearable
  188. size="small"
  189. @keyup.enter.native="handleQuery"
  190. />
  191. </el-form-item>
  192. <el-form-item label="添加时间">
  193. <el-date-picker v-model="daterange" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
  194. </el-form-item>
  195. <el-form-item label="流失时间" prop="lossTime">
  196. <el-date-picker clearable size="small"
  197. v-model="queryParams.lossTime"
  198. type="date"
  199. value-format="yyyy-MM-dd"
  200. placeholder="选择流失时间">
  201. </el-date-picker>
  202. </el-form-item>
  203. <el-form-item label="删除时间" prop="delTime">
  204. <el-date-picker clearable size="small"
  205. v-model="queryParams.delTime"
  206. type="date"
  207. value-format="yyyy-MM-dd"
  208. placeholder="选择删除时间">
  209. </el-date-picker>
  210. </el-form-item>
  211. <el-form-item>
  212. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  213. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  214. </el-form-item>
  215. </el-form>
  216. <el-row :gutter="10" class="mb8">
  217. <!-- <el-col :span="1.5">-->
  218. <!-- <el-button-->
  219. <!-- type="warning"-->
  220. <!-- plain-->
  221. <!-- icon="el-icon-download"-->
  222. <!-- size="mini"-->
  223. <!-- :loading="exportLoading"-->
  224. <!-- @click="handleExport"-->
  225. <!-- v-hasPermi="['qw:externalContact:export']"-->
  226. <!-- >导出</el-button>-->
  227. <!-- </el-col>-->
  228. <!-- <el-col :span="1.5">-->
  229. <!-- <el-button-->
  230. <!-- type="warning"-->
  231. <!-- plain-->
  232. <!-- icon="el-icon-download"-->
  233. <!-- size="mini"-->
  234. <!-- :loading="exportUnionidLoading"-->
  235. <!-- @click="handleExportUnionId"-->
  236. <!-- v-hasPermi="['qw:externalContact:export']"-->
  237. <!-- >导出unionid</el-button>-->
  238. <!-- </el-col>-->
  239. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  240. </el-row>
  241. <el-table v-loading="loading" :data="externalContactList" @selection-change="handleSelectionChange" border>
  242. <el-table-column type="selection" width="55" align="center" />
  243. <el-table-column label="企微客户ID" align="center" prop="id" />
  244. <el-table-column label="客户会员ID" align="center" prop="fsUserId" />
  245. <el-table-column label="企微客户头像" align="center" prop="avatar" width="100px">
  246. <template slot-scope="scope">
  247. <el-popover
  248. placement="right"
  249. title=""
  250. trigger="hover">
  251. <img slot="reference" :src="scope.row.avatar" width="60px">
  252. <img :src="scope.row.avatar" style="max-width: 200px;">
  253. </el-popover>
  254. </template>
  255. </el-table-column>
  256. <el-table-column label="企微客户名称" prop="name" width="110px"/>
  257. <el-table-column label="销售企微昵称" align="center" prop="qwUserName" width="120px"/>
  258. <el-table-column label="企微部门" align="center" prop="departmentName" width="120px"/>
  259. <el-table-column label="用户类别" align="center" prop="type">
  260. <template slot-scope="scope">
  261. <dict-tag :options="typeOptions" :value="scope.row.type"/>
  262. </template>
  263. </el-table-column>
  264. <el-table-column label="性别" align="center" prop="gender">
  265. <template slot-scope="scope">
  266. <dict-tag :options="genderOptions" :value="scope.row.gender"/>
  267. </template>
  268. </el-table-column>
  269. <el-table-column label="备注" align="center" prop="remark" />
  270. <el-table-column label="描述信息" align="center" prop="description" />
  271. <el-table-column label="标签" align="center" prop="tagIdsName" width="250px">
  272. <template slot-scope="scope">
  273. <div v-for="name in scope.row.tagIdsName" style="display: inline;">
  274. <el-tag type="success">{{ name }}</el-tag>
  275. </div>
  276. </template>
  277. </el-table-column>
  278. <el-table-column label="状态" align="center" prop="status" width="120px" >
  279. <template slot-scope="scope">
  280. <dict-tag :options="statusOptions" :value="scope.row.status"/>
  281. </template>
  282. </el-table-column>
  283. <el-table-column label="客户等级" align="center" prop="level" width="120px" >
  284. <template slot-scope="scope">
  285. <dict-tag :options="ratingType" :value="scope.row.level"/>
  286. </template>
  287. </el-table-column>
  288. <el-table-column label="等级状态" align="center" prop="levelType" width="120px" >
  289. <template slot-scope="scope">
  290. <dict-tag :options="ratingUpFall" :value="scope.row.levelType"/>
  291. </template>
  292. </el-table-column>
  293. <el-table-column label="添加时间" align="center" prop="createTime" width="100px" />
  294. <el-table-column label="流失时间" align="center" prop="lossTime" width="100px" />
  295. <el-table-column label="删除时间" align="center" prop="delTime" width="100px" />
  296. <el-table-column label="备注电话号码" align="center" prop="remarkMobiles" width="150px">
  297. <template slot-scope="scope">
  298. <div v-for="i in JSON.parse(scope.row.remarkMobiles)" :key="i">{{i}}</div>
  299. </template>
  300. </el-table-column>
  301. <el-table-column label="备注企业名称" align="center" prop="remarkCorpName" />
  302. <el-table-column label="来源" align="center" prop="addWay" width="100px">
  303. <template slot-scope="scope">
  304. <dict-tag :options="addWayOptions" :value="scope.row.addWay"/>
  305. </template>
  306. </el-table-column>
  307. <el-table-column label="转接状态" align="center" prop="transferStatus" width="100px" >
  308. <template slot-scope="scope">
  309. <dict-tag :options="transferStatusOptions" :value="scope.row.transferStatus"/>
  310. </template>
  311. </el-table-column>
  312. <el-table-column label="企业id" align="center" prop="corpId" />
  313. <el-table-column label="是否绑定会员" width="100px" align="center" fixed="right">
  314. <template slot-scope="scope">
  315. <el-tag v-if="scope.row.fsUserId" >已绑定</el-tag>
  316. <el-tag v-else type="info"> 未绑定</el-tag>
  317. </template>
  318. </el-table-column>
  319. <el-table-column label="修改" align="center" class-name="small-padding fixed-width" width="120px" fixed="right">
  320. <template slot-scope="scope">
  321. <!-- <el-button-->
  322. <!-- v-if="scope.row.status==0||scope.row.status==2"-->
  323. <!-- size="mini"-->
  324. <!-- type="text"-->
  325. <!-- icon="el-icon-edit"-->
  326. <!-- @click="handleUpdate(scope.row)"-->
  327. <!-- v-hasPermi="['qw:externalContact:edit']"-->
  328. <!-- >修改备注</el-button>-->
  329. <!-- <el-button-->
  330. <!-- size="mini"-->
  331. <!-- type="text"-->
  332. <!-- icon="el-icon-user-solid"-->
  333. <!-- @click="handleAppellation(scope.row)"-->
  334. <!-- >修改客户称呼</el-button>-->
  335. <!-- </template>-->
  336. <!-- </el-table-column>-->
  337. <!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120px" fixed="right">-->
  338. <!-- <template slot-scope="scope">-->
  339. <!-- <el-button-->
  340. <!-- size="mini"-->
  341. <!-- type="text"-->
  342. <!-- icon="el-icon-edit-outline"-->
  343. <!-- @click="handleUpdateUser(scope.row)"-->
  344. <!-- >-->
  345. <!-- <span v-if="scope.row.fsUserId">换绑会员</span>-->
  346. <!-- <span v-else>绑定会员</span>-->
  347. <!-- </el-button>-->
  348. <!-- <el-button-->
  349. <!-- v-if="scope.row.fsUserId"-->
  350. <!-- size="mini"-->
  351. <!-- type="text"-->
  352. <!-- icon="el-icon-thumb"-->
  353. <!-- @click="handleUnBindUserId(scope.row)"-->
  354. <!-- v-hasPermi="['qw:externalContact:unBindUserId']"-->
  355. <!-- >-->
  356. <!-- <span>解除会员绑定</span>-->
  357. <!-- </el-button>-->
  358. <el-button
  359. size="mini"
  360. type="text"
  361. @click="handledetails(scope.row)"
  362. >AI获取用户信息
  363. </el-button>
  364. </template>
  365. </el-table-column>
  366. </el-table>
  367. <pagination-more
  368. :total="total"
  369. :page.sync="queryParams.pageNum"
  370. :limit.sync="queryParams.pageSize"
  371. @pagination="getList"
  372. />
  373. <!-- 搜索标签 -->
  374. <el-dialog :title="changeTagDialog.title" :visible.sync="changeTagDialog.open" style="width:100%;height: 100%" append-to-body>
  375. <div>搜索标签:
  376. <el-input v-model="queryTagParams.name" placeholder="请输入标签名称" clearable size="small" style="width: 200px;margin-right: 10px" />
  377. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleSearchTags(queryTagParams.name)">搜索</el-button>
  378. <el-button type="primary" icon="el-icon-plus" size="mini" @click="cancelSearchTags">重置</el-button>
  379. </div>
  380. <div v-for="item in tagGroupList" :key="item.id" >
  381. <div style="font-size: 20px;margin-top: 20px;margin-bottom: 20px;">
  382. <span class="name-background">{{ item.name }}</span>
  383. </div>
  384. <div class="tag-container">
  385. <a
  386. v-for="tagItem in item.tag"
  387. class="tag-box"
  388. @click="tagSelection(tagItem)"
  389. :class="{ 'tag-selected': tagItem.isSelected }"
  390. >
  391. {{ tagItem.name }}
  392. </a>
  393. </div>
  394. </div>
  395. <pagination
  396. v-show="tagTotal>0"
  397. :total="tagTotal"
  398. :page.sync="queryTagParams.pageNum"
  399. :limit.sync="queryTagParams.pageSize"
  400. @pagination="getPageListTagGroup"
  401. />
  402. <div slot="footer" class="dialog-footer">
  403. <el-button type="primary" @click="tagSubmitForm()">确 定</el-button>
  404. <el-button @click="tagCancel()">取消</el-button>
  405. </div>
  406. </el-dialog>
  407. <el-dialog :title="info.title" :visible.sync="info.open" width="1100px" append-to-body>
  408. <externalContactInfo ref="Details" />
  409. </el-dialog>
  410. </div>
  411. </template>
  412. <script>
  413. import { listExternalContact, getExternalContact, delExternalContact, addExternalContact, updateExternalContact, exportExternalContact, exportUnionId } from "@/api/qw/externalContact";
  414. import {getCompanyList} from "@/api/company/company";
  415. import {getAllUserlist} from "@/api/company/companyUser";
  416. import {getQwUserInfo} from "@/api/qw/qwUser";
  417. import { allListTagGroup} from "@/api/qw/tagGroup";
  418. import {searchTags,} from "@/api/qw/tag";
  419. import PaginationMore from '@/components/PaginationMore/index.vue'
  420. import externalContactInfo from "../externalContact/info";
  421. export default {
  422. name: "ExternalContact",
  423. components: { PaginationMore,externalContactInfo },
  424. data() {
  425. return {
  426. daterange: [],
  427. // 遮罩层
  428. loading: false,
  429. // 导出遮罩层
  430. exportLoading: false,
  431. exportUnionidLoading: false,
  432. //等级状态
  433. ratingUpFall: [],
  434. // 性别字典
  435. genderOptions: [],
  436. // 用户类别字典
  437. typeOptions: [],
  438. //状态
  439. statusOptions:[],
  440. //客户等级
  441. ratingType: [],
  442. // 来源字典
  443. addWayOptions: [],
  444. //转接状态
  445. transferStatusOptions:[],
  446. // 选中数组
  447. ids: [],
  448. // 非单个禁用
  449. single: true,
  450. // 非多个禁用
  451. multiple: true,
  452. // 显示搜索条件
  453. showSearch: true,
  454. // 总条数
  455. total: 0,
  456. // 企业微信客户表格数据
  457. externalContactList: [],
  458. //销售员工数据
  459. companyUserNameList:[],
  460. //企微用户信息数据
  461. qwUserList:[],
  462. // 弹出层标题
  463. title: "",
  464. // 是否显示弹出层
  465. open: false,
  466. info:{
  467. title:"用户信息",
  468. open:false,
  469. },
  470. //标签
  471. tagGroupList: [],
  472. // 查询参数
  473. queryParams: {
  474. extId:null,
  475. companyUser:null,
  476. pageNum: 1,
  477. pageSize: 10,
  478. qwUserName:null,
  479. userId: null,
  480. externalUserId: null,
  481. name: null,
  482. avatar: null,
  483. type: null,
  484. gender: null,
  485. description: null,
  486. tagIds: null,
  487. remarkMobiles: null,
  488. remarkCorpName: null,
  489. addWay: null,
  490. operUserid: null,
  491. corpId: null,
  492. companyId: null,
  493. companyUserId: null,
  494. qwUserId: null,
  495. customerId: null,
  496. transferStatus: null,
  497. status: null,
  498. stageStatus: null,
  499. transferTime: null,
  500. transferNum: null,
  501. lossTime: null,
  502. delTime: null,
  503. state: null,
  504. wayId: null,
  505. fsUserId: null,
  506. openId: null,
  507. unionid: null,
  508. uploadAddWxStatus: null,
  509. uploadRegisterStatus: null,
  510. uploadFinishedStatus: null,
  511. welcomeStatus: null,
  512. isInteract: null,
  513. level: null,
  514. companyUserName:null,
  515. levelType: null,
  516. firstTime: null,
  517. lastWatchTime: null,
  518. isRepeat: null,
  519. commentStatus: null,
  520. isBindMini:null,
  521. sTime:null,
  522. eTime:null,
  523. },
  524. //标签
  525. changeTagDialog:{
  526. title:"",
  527. open:false,
  528. },
  529. selectTags:[],
  530. tagTotal:0,
  531. queryTagParams:{
  532. pageNum: 1,
  533. pageSize: 10,
  534. total:0,
  535. name:null,
  536. corpId:null,
  537. },
  538. isBindMiniOptions:[
  539. {dictLabel:"已绑定",dictValue:'isBindMini'},
  540. {dictLabel:"未绑定",dictValue:'noBindMini'},
  541. ],
  542. qwCompanyList:[],
  543. // 表单参数
  544. form: {},
  545. // 表单校验
  546. rules: {
  547. }
  548. };
  549. },
  550. created() {
  551. //用户类别
  552. this.getDicts("sys_qw_externalContact_type").then(response => {
  553. this.typeOptions = response.data;
  554. });
  555. //客户等级
  556. this.getDicts("sys_qw_sop_rating_type").then(response => {
  557. this.ratingType = response.data;
  558. });
  559. //等级状态
  560. this.getDicts("sys_qw_sop_rating_upFall").then(response => {
  561. this.ratingUpFall = response.data;
  562. });
  563. //性别
  564. this.getDicts("sys_sex").then(response => {
  565. this.genderOptions = response.data;
  566. });
  567. //状态
  568. this.getDicts("sys_qw_external_contact_status").then(response => {
  569. this.statusOptions = response.data;
  570. });
  571. //来源
  572. this.getDicts("sys_qw_externalContact_addWay").then(response => {
  573. this.addWayOptions = response.data;
  574. });
  575. //转接状态
  576. this.getDicts("sys_qw_transfer_status").then(response => {
  577. this.transferStatusOptions = response.data;
  578. });
  579. //获取企业
  580. getCompanyList().then(response => {
  581. this.qwCompanyList = response.data;
  582. if(this.qwCompanyList!=null){
  583. this.queryParams.companyId=this.qwCompanyList[0].companyId;
  584. this.getAllUserlist(this.queryParams.companyId);
  585. }
  586. });
  587. },
  588. methods: {
  589. handledetails(row){
  590. this.info.open=true;
  591. setTimeout(() => {
  592. this.$refs.Details.getDetails(row.id);
  593. }, 1);
  594. },
  595. /** 获取销售账号列表 **/
  596. getAllUserlist(companyId){
  597. if(companyId){
  598. this.getList();
  599. getAllUserlist({companyId}).then(response => {
  600. this.companyUserNameList=response.data;
  601. });
  602. //企业微信
  603. getQwUserInfo({companyId}).then(response => {
  604. this.qwUserList=response.data;
  605. })
  606. }
  607. },
  608. tagSelection(row){
  609. row.isSelected= !row.isSelected;
  610. this.$forceUpdate();
  611. },
  612. /** 查询企业微信客户列表 */
  613. getList() {
  614. this.loading = true;
  615. if(this.daterange!=null){
  616. this.queryParams.sTime=this.daterange[0];
  617. this.queryParams.eTime=this.daterange[1];
  618. }else{
  619. this.queryParams.sTime=null;
  620. this.queryParams.eTime=null;
  621. }
  622. listExternalContact(this.queryParams).then(response => {
  623. this.externalContactList = response.rows;
  624. this.total = response.total;
  625. this.loading = false;
  626. });
  627. },
  628. // 取消按钮
  629. cancel() {
  630. this.open = false;
  631. this.reset();
  632. },
  633. // 表单重置
  634. reset() {
  635. this.form = {
  636. id: null,
  637. extId:null,
  638. userId: null,
  639. externalUserId: null,
  640. name: null,
  641. avatar: null,
  642. type: null,
  643. gender: null,
  644. remark: null,
  645. description: null,
  646. tagIds: null,
  647. remarkMobiles: null,
  648. remarkCorpName: null,
  649. addWay: null,
  650. operUserid: null,
  651. corpId: null,
  652. companyId: null,
  653. companyUserId: null,
  654. qwUserId: null,
  655. customerId: null,
  656. transferStatus: 0,
  657. status: 0,
  658. stageStatus: "0",
  659. createBy: null,
  660. updateBy: null,
  661. updateTime: null,
  662. transferTime: null,
  663. transferNum: null,
  664. lossTime: null,
  665. delTime: null,
  666. state: null,
  667. wayId: null,
  668. fsUserId: null,
  669. openId: null,
  670. unionid: null,
  671. uploadAddWxStatus: 0,
  672. uploadRegisterStatus: 0,
  673. uploadFinishedStatus: 0,
  674. welcomeStatus: 0,
  675. isInteract: null,
  676. level: null,
  677. levelType: null,
  678. firstTime: null,
  679. lastWatchTime: null,
  680. isRepeat: null,
  681. commentStatus: 0
  682. };
  683. this.resetForm("form");
  684. },
  685. /** 搜索按钮操作 */
  686. handleQuery() {
  687. //验证是否选择企业
  688. if(!this.queryParams.companyId){
  689. return this.$message.warning({
  690. message: "请先选择企业!",
  691. duration: 3000
  692. })
  693. }
  694. if (this.selectTags!=null && this.selectTags.length>0){
  695. // 确保 this.form.tags 是数组
  696. if (!this.queryParams.tagIds) {
  697. this.queryParams.tagIds = []; // 如果未定义,初始化
  698. } else {
  699. this.queryParams.tagIds = []; // 清空已有数据
  700. }
  701. // 遍历并添加 tagId
  702. this.selectTags.forEach(tag => {
  703. if (tag.tagId) { // 确保 tagId 存在
  704. this.queryParams.tagIds.push(tag.tagId);
  705. }
  706. });
  707. this.queryParams.tagIds=this.queryParams.tagIds.join(",");
  708. }else {
  709. this.queryParams.tagIds=null;
  710. }
  711. this.queryParams.pageNum = 1;
  712. this.getList();
  713. },
  714. /** 重置按钮操作 */
  715. resetQuery() {
  716. this.resetForm("queryForm");
  717. this.queryParams.corpId= this.qwCompanyList[0].dictValue;
  718. this.selectTags=[];
  719. this.queryParams.qwUserId = null;
  720. this.queryParams.sTime=null;
  721. this.queryParams.eTime=null;
  722. this.externalContactList=[];
  723. this.daterange=[];
  724. if(this.qwCompanyList!=null){
  725. this.queryParams.companyId=this.qwCompanyList[0].companyId;
  726. this.getAllUserlist(this.queryParams.companyId);
  727. }
  728. },
  729. handleSearchTags(name){
  730. searchTags({name:name,corpId:this.queryParams.corpId}).then(response => {
  731. this.tagGroupList = response.rows;
  732. });
  733. },
  734. cancelSearchTags(){
  735. this.resetSearchQueryTag()
  736. this.getPageListTagGroup();
  737. },
  738. resetSearchQueryTag(){
  739. this.queryTagParams= {
  740. pageNum: 1,
  741. pageSize: 10,
  742. total:0,
  743. name:null,
  744. };
  745. },
  746. //确定选择标签
  747. tagSubmitForm(){
  748. for (let i = 0; i < this.tagGroupList.length; i++) {
  749. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  750. if (this.tagGroupList[i].tag[x].isSelected === true) {
  751. if (!this.selectTags) {
  752. this.selectTags = [];
  753. }
  754. // 检查当前 tag 是否已经存在于 tagListFormIndex[index] 中
  755. let tagExists = this.selectTags.some(
  756. tag => tag.id === this.tagGroupList[i].tag[x].id
  757. );
  758. // 如果 tag 不存在于 tagListFormIndex[index] 中,则新增
  759. if (!tagExists) {
  760. this.selectTags.push(this.tagGroupList[i].tag[x]);
  761. }
  762. }
  763. }
  764. }
  765. if (!this.selectTags || this.selectTags.length === 0) {
  766. return this.$message('请选择标签');
  767. }
  768. this.changeTagDialog.open = false;
  769. },
  770. getPageListTagGroup(){
  771. this.queryTagParams.corpId=this.queryParams.corpId
  772. allListTagGroup(this.queryTagParams).then(response => {
  773. this.tagGroupList = response.rows;
  774. this.tagTotal = response.total;
  775. });
  776. },
  777. //取消选择标签
  778. tagCancel(){
  779. this.changeTagDialog.open = false;
  780. },
  781. //删除一些选择的标签
  782. handleCloseTags(list){
  783. const ls = this.selectTags.findIndex(t => t.tagId === list.tagId);
  784. if (ls !== -1) {
  785. this.selectTags.splice(ls, 1);
  786. this.selectTags = [...this.selectTags];
  787. }
  788. if (this.selectTags!=null && this.selectTags.length>0){
  789. // 确保 this.form.tags 是数组
  790. if (!this.queryParams.tagIds) {
  791. this.queryParams.tagIds = []; // 如果未定义,初始化
  792. } else {
  793. this.queryParams.tagIds = []; // 清空已有数据
  794. }
  795. // 遍历并添加 tagId
  796. this.selectTags.forEach(tag => {
  797. if (tag.tagId) { // 确保 tagId 存在
  798. this.queryParams.tagIds.push(tag.tagId);
  799. }
  800. });
  801. this.queryParams.tagIds=this.queryParams.tagIds.join(",");
  802. }else {
  803. this.queryParams.tagIds=null;
  804. }
  805. },
  806. //搜索的标签
  807. hangleChangeTags(){
  808. this.changeTagDialog.title="搜索的标签"
  809. this.changeTagDialog.open=true;
  810. // 获取 tagListFormIndex 中的所有 tagId,用于快速查找
  811. const selectedTagIds = new Set(
  812. (this.selectTags || []).map(tagItem => tagItem?.tagId)
  813. );
  814. this.queryTagParams.name=null;
  815. this.getPageListTagGroup();
  816. setTimeout(() => {
  817. for (let i = 0; i < this.tagGroupList.length; i++) {
  818. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  819. this.tagGroupList[i].tag[x].isSelected = selectedTagIds.has(this.tagGroupList[i].tag[x].tagId);
  820. }
  821. }
  822. }, 200);
  823. },
  824. // 多选框选中数据
  825. handleSelectionChange(selection) {
  826. this.ids = selection.map(item => item.id)
  827. this.single = selection.length!==1
  828. this.multiple = !selection.length
  829. },
  830. /** 新增按钮操作 */
  831. handleAdd() {
  832. this.reset();
  833. this.open = true;
  834. this.title = "添加企业微信客户";
  835. },
  836. /** 修改按钮操作 */
  837. handleUpdate(row) {
  838. this.reset();
  839. const id = row.id || this.ids
  840. getExternalContact(id).then(response => {
  841. this.form = response.data;
  842. this.open = true;
  843. this.title = "修改企业微信客户";
  844. });
  845. },
  846. /** 提交按钮 */
  847. submitForm() {
  848. this.$refs["form"].validate(valid => {
  849. if (valid) {
  850. if (this.form.id != null) {
  851. updateExternalContact(this.form).then(response => {
  852. this.msgSuccess("修改成功");
  853. this.open = false;
  854. this.getList();
  855. });
  856. } else {
  857. addExternalContact(this.form).then(response => {
  858. this.msgSuccess("新增成功");
  859. this.open = false;
  860. this.getList();
  861. });
  862. }
  863. }
  864. });
  865. },
  866. /** 删除按钮操作 */
  867. handleDelete(row) {
  868. const ids = row.id || this.ids;
  869. this.$confirm('是否确认删除企业微信客户编号为"' + ids + '"的数据项?', "警告", {
  870. confirmButtonText: "确定",
  871. cancelButtonText: "取消",
  872. type: "warning"
  873. }).then(function() {
  874. return delExternalContact(ids);
  875. }).then(() => {
  876. this.getList();
  877. this.msgSuccess("删除成功");
  878. }).catch(() => {});
  879. },
  880. /** 导出按钮操作 */
  881. handleExport() {
  882. //验证是否选择企业
  883. if(!this.queryParams.companyId){
  884. return this.$message.warning({
  885. message: "请先选择企业!",
  886. duration: 3000
  887. })
  888. }
  889. const queryParams = this.queryParams;
  890. this.$confirm('是否确认导出所有企业微信客户数据项?', "警告", {
  891. confirmButtonText: "确定",
  892. cancelButtonText: "取消",
  893. type: "warning"
  894. }).then(() => {
  895. this.exportLoading = true;
  896. return exportExternalContact(queryParams);
  897. }).then(response => {
  898. this.download(response.msg);
  899. this.exportLoading = false;
  900. }).catch(() => {});
  901. },
  902. /** 导出Unionid按钮操作 */
  903. handleExportUnionId() {
  904. //验证是否选择企业
  905. if(!this.queryParams.companyId){
  906. return this.$message.warning({
  907. message: "请先选择企业!",
  908. duration: 3000
  909. })
  910. }
  911. const queryParams = this.queryParams;
  912. this.$confirm('是否确认导出所有企业微信客户unionid数据项?', "警告", {
  913. confirmButtonText: "确定",
  914. cancelButtonText: "取消",
  915. type: "warning"
  916. }).then(() => {
  917. this.exportUnionidLoading = true;
  918. return exportUnionId(queryParams);
  919. }).then(response => {
  920. this.download(response.msg);
  921. this.exportUnionidLoading = false;
  922. }).catch(() => {});
  923. },
  924. }
  925. };
  926. </script>
  927. <style scoped>
  928. /* CSS 样式 */
  929. .tag-container {
  930. display: flex;
  931. flex-wrap: wrap; /* 超出宽度时自动换行 */
  932. gap: 8px; /* 设置标签之间的间距 */
  933. }
  934. .name-background {
  935. display: inline-block;
  936. background-color: #abece6; /* 背景颜色 */
  937. padding: 4px 8px; /* 调整内边距,让背景包裹文字 */
  938. border-radius: 4px; /* 可选:设置圆角 */
  939. }
  940. /* CSS 样式 */
  941. .tag-container {
  942. display: flex;
  943. flex-wrap: wrap; /* 超出宽度时自动换行 */
  944. gap: 8px; /* 设置标签之间的间距 */
  945. }
  946. .name-background {
  947. display: inline-block;
  948. background-color: #abece6; /* 背景颜色 */
  949. padding: 4px 8px; /* 调整内边距,让背景包裹文字 */
  950. border-radius: 4px; /* 可选:设置圆角 */
  951. }
  952. .tag-box {
  953. padding: 8px 12px;
  954. border: 1px solid #989797;
  955. border-radius: 4px;
  956. cursor: pointer;
  957. display: inline-block;
  958. }
  959. .tag-selected {
  960. background-color: #00bc98;
  961. color: #fff;
  962. border-color: #00bc98;
  963. }
  964. .el-tag + .el-tag {
  965. margin-left: 10px;
  966. }
  967. .button-new-tag {
  968. margin-left: 10px;
  969. height: 32px;
  970. line-height: 30px;
  971. padding-top: 0;
  972. padding-bottom: 0;
  973. }
  974. .input-new-tag {
  975. width: 90px;
  976. margin-left: 10px;
  977. vertical-align: bottom;
  978. }
  979. </style>