deptIndex.vue 74 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
  4. <el-form-item label="企微公司" prop="corpId">
  5. <el-select v-model="queryParams.corpId" placeholder="企微公司" size="small" @change="updateCorpId()">
  6. <el-option
  7. v-for="dict in myQwCompanyList"
  8. :key="dict.dictValue"
  9. :label="dict.dictLabel"
  10. :value="dict.dictValue"
  11. />
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="客户名称" prop="name">
  15. <el-input
  16. v-model="queryParams.name"
  17. placeholder="请输入客户名称"
  18. clearable
  19. size="small"
  20. @keyup.enter.native="handleQuery"
  21. />
  22. </el-form-item>
  23. <el-form-item label="销售企微昵称" prop="qwUserName">
  24. <el-input
  25. v-model="queryParams.qwUserName"
  26. placeholder="请输入销售企微昵称"
  27. clearable
  28. size="small"
  29. @keyup.enter.native="handleQuery"
  30. @input="searchQwUser"
  31. @focus="showQwUserDropdown = true"
  32. @blur="hideDropdownWithDelay"
  33. @clear="onQwUserNameClear"
  34. />
  35. <!-- 下拉建议 -->
  36. <div v-if="showQwUserDropdown && qwUserSuggestions.length > 0" class="suggestion-box" @scroll="handleScroll">
  37. <div
  38. v-for="item in qwUserSuggestions"
  39. :key="item.dictValue"
  40. class="suggestion-item"
  41. @click="selectQwUser(item.dictValue,item.dictLabel)"
  42. >
  43. {{ item.dictLabel }}
  44. </div>
  45. </div>
  46. </el-form-item>
  47. <el-form-item label="用户类别" prop="type">
  48. <el-select v-model="queryParams.type" placeholder="请选择用户类别" clearable size="small">
  49. <el-option
  50. v-for="dict in typeOptions"
  51. :key="dict.dictValue"
  52. :label="dict.dictLabel"
  53. :value="dict.dictValue"
  54. />
  55. </el-select>
  56. </el-form-item>
  57. <el-form-item label="性别" prop="gender">
  58. <el-select v-model="queryParams.gender" placeholder="性别" clearable size="small">
  59. <el-option
  60. v-for="dict in genderOptions"
  61. :key="dict.dictValue"
  62. :label="dict.dictLabel"
  63. :value="dict.dictValue"
  64. />
  65. </el-select>
  66. </el-form-item>
  67. <el-form-item label="客户等级" prop="level">
  68. <el-select v-model="queryParams.level" placeholder="客户等级" clearable size="small">
  69. <el-option
  70. v-for="dict in ratingType"
  71. :key="dict.dictValue"
  72. :label="dict.dictLabel"
  73. :value="dict.dictValue"
  74. />
  75. </el-select>
  76. </el-form-item>
  77. <el-form-item label="等级升降" prop="levelType">
  78. <el-select v-model="queryParams.levelType" placeholder="等级升降" clearable size="small">
  79. <el-option
  80. v-for="dict in ratingUpFall"
  81. :key="dict.dictValue"
  82. :label="dict.dictLabel"
  83. :value="dict.dictValue"
  84. />
  85. </el-select>
  86. </el-form-item>
  87. <el-form-item label="电话号码" prop="remarkMobiles">
  88. <el-input
  89. v-model="queryParams.remarkMobiles"
  90. placeholder="请输入备注电话号码"
  91. clearable
  92. size="small"
  93. @keyup.enter.native="handleQuery"
  94. />
  95. </el-form-item>
  96. <el-form-item label="来源" prop="addWay">
  97. <el-select v-model="queryParams.addWay" placeholder="来源" clearable size="small">
  98. <el-option
  99. v-for="dict in addWayOptions"
  100. :key="dict.dictValue"
  101. :label="dict.dictLabel"
  102. :value="dict.dictValue"
  103. />
  104. </el-select>
  105. </el-form-item>
  106. <el-form-item label="状态" prop="status">
  107. <el-select v-model="queryParams.status" placeholder="状态" clearable size="small">
  108. <el-option
  109. v-for="dict in statusOptions"
  110. :key="dict.dictValue"
  111. :label="dict.dictLabel"
  112. :value="dict.dictValue"
  113. />
  114. </el-select>
  115. </el-form-item>
  116. <el-form-item label="转接状态" prop="addWay">
  117. <el-select v-model="queryParams.transferStatus" placeholder="转接状态" clearable size="small">
  118. <el-option
  119. v-for="dict in transferStatusOptions"
  120. :key="dict.dictValue"
  121. :label="dict.dictLabel"
  122. :value="dict.dictValue"
  123. />
  124. </el-select>
  125. </el-form-item>
  126. <el-form-item label="是否绑小程序" prop="isBindMini">
  127. <el-select v-model="queryParams.isBindMini" placeholder="是否绑定小程序" clearable size="small" @change="handleQuery" >
  128. <el-option
  129. v-for="dict in isBindMiniOptions"
  130. :key="dict.dictValue"
  131. :label="dict.dictLabel"
  132. :value="dict.dictValue"
  133. />
  134. </el-select>
  135. </el-form-item>
  136. <el-form-item label="标签" prop="tagIds">
  137. <!-- <el-select v-model="selectTags" remote multiple placeholder="请选择" filterable style="width: 100%;">-->
  138. <!-- <el-option-->
  139. <!-- v-for="dict in tagList"-->
  140. <!-- :label="dict.name"-->
  141. <!-- :value="dict.tagId">-->
  142. <!-- </el-option>-->
  143. <!-- </el-select>-->
  144. <div @click="hangleChangeTags()" style="cursor: pointer; border: 1px solid #e6e6e6; background-color: white; overflow: hidden; flex-grow: 1;width: 250px">
  145. <div style="min-height: 35px; max-height: 200px; overflow-y: auto;">
  146. <el-tag type="success"
  147. closable
  148. :disable-transitions="false"
  149. v-for="list in this.selectTags"
  150. :key="list.tagId"
  151. @close="handleCloseTags(list)"
  152. style="margin: 3px;"
  153. >{{list.name}}
  154. </el-tag>
  155. </div>
  156. </div>
  157. </el-form-item>
  158. <el-form-item label="排除标签" prop="outTagIds">
  159. <div @click="hangleChangeOutTags()"
  160. 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.outSelectTags"
  166. :key="list.tagId"
  167. @close="handleCloseOutTags(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="companyUserName">
  184. <el-input
  185. v-model="queryParams.companyUserName"
  186. placeholder="请输入员工名称"
  187. clearable
  188. size="small"
  189. @keyup.enter.native="handleQuery"
  190. />
  191. </el-form-item>
  192. <el-form-item label="添加时间" prop="createTime">
  193. <el-date-picker v-model="createTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="change"></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="primary"
  220. plain
  221. icon="el-icon-plus"
  222. size="mini"
  223. @click="handleAdd"
  224. v-hasPermi="['qw:externalContact:add']"
  225. >同步</el-button>
  226. </el-col> -->
  227. <el-col :span="1.5">
  228. <el-button
  229. type="success"
  230. plain
  231. icon="el-icon-edit"
  232. size="mini"
  233. @click="handleBatchUpdateNotes"
  234. v-hasPermi="['qw:externalContact:deptEdit']"
  235. >批量修改备注</el-button>
  236. </el-col>
  237. <el-col :span="1.5">
  238. <el-button
  239. type="success"
  240. plain
  241. icon="el-icon-edit"
  242. size="mini"
  243. @click="handleBatchUpdateNotesFilter"
  244. v-hasPermi="['qw:externalContact:edit']"
  245. >批量修改备注(筛选条件)
  246. </el-button>
  247. </el-col>
  248. <!-- <el-col :span="1.5">
  249. <el-button
  250. type="warning"
  251. plain
  252. icon="el-icon-download"
  253. size="mini"
  254. :loading="exportLoading"
  255. @click="handleExport"
  256. v-hasPermi="['qw:externalContact:export']"
  257. >导出</el-button>
  258. </el-col> -->
  259. <el-col :span="1.5">
  260. <el-button
  261. type="primary"
  262. plain
  263. size="mini"
  264. @click="addUserTag"
  265. v-hasPermi="['qw:externalContact:deptAddTag']"
  266. >批量添加标签</el-button>
  267. </el-col>
  268. <el-col :span="1.5">
  269. <el-button
  270. type="primary"
  271. plain
  272. size="mini"
  273. @click="delUserTag"
  274. v-hasPermi="['qw:externalContact:deptDelTag']"
  275. >批量移除标签</el-button>
  276. </el-col>
  277. <el-col :span="1.5">
  278. <el-button
  279. type="primary"
  280. plain
  281. size="mini"
  282. @click="updateTalk"
  283. v-hasPermi="['qw:externalContactInfo:deptUpdateTalk']"
  284. >批量更改交流状态</el-button>
  285. </el-col>
  286. <!-- <el-col :span="1.5">-->
  287. <!-- <el-button-->
  288. <!-- type="primary"-->
  289. <!-- plain-->
  290. <!-- size="mini"-->
  291. <!-- @click="setUserCourseSop"-->
  292. <!-- v-hasPermi="['qw:externalContact:setCourseSop']"-->
  293. <!-- >批量设置课程SOP</el-button>-->
  294. <!-- </el-col>-->
  295. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  296. </el-row>
  297. <!-- <el-tabs type="card" v-model="isBindActiveName" @tab-click="handleClickX">-->
  298. <!-- <el-tab-pane label="全部" name="all"></el-tab-pane>-->
  299. <!-- <el-tab-pane label="已绑定CRM" name="isBind"></el-tab-pane>-->
  300. <!-- <el-tab-pane label="未绑定CRM" name="noBind"></el-tab-pane>-->
  301. <!-- </el-tabs>-->
  302. <el-table v-loading="loading" :data="externalContactList" @selection-change="handleSelectionChange" border>
  303. <el-table-column type="selection" width="55" align="center" />
  304. <el-table-column label="企微客户ID" align="center" prop="id" />
  305. <el-table-column label="企微客户头像" align="center" prop="avatar" width="100px">
  306. <template slot-scope="scope">
  307. <el-popover
  308. placement="right"
  309. title=""
  310. trigger="hover">
  311. <img slot="reference" :src="scope.row.avatar" width="60px">
  312. <img :src="scope.row.avatar" style="max-width: 200px;">
  313. </el-popover>
  314. </template>
  315. </el-table-column>
  316. <el-table-column label="企微客户名称" prop="name" width="110px"/>
  317. <el-table-column label="客户称呼" prop="stageStatus" width="110px"/>
  318. <el-table-column label="销售企微昵称" align="center" prop="qwUserName" width="120px"/>
  319. <el-table-column label="企微部门" align="center" prop="departmentName" width="120px"/>
  320. <el-table-column label="注册时间" align="center" prop="registerTime" width="100px" />
  321. <el-table-column label="用户类别" align="center" prop="type">
  322. <template slot-scope="scope">
  323. <dict-tag :options="typeOptions" :value="scope.row.type"/>
  324. </template>
  325. </el-table-column>
  326. <el-table-column label="性别" align="center" prop="gender">
  327. <template slot-scope="scope">
  328. <dict-tag :options="genderOptions" :value="scope.row.gender"/>
  329. </template>
  330. </el-table-column>
  331. <el-table-column label="备注" align="center" prop="remark" />
  332. <el-table-column label="描述信息" align="center" prop="description" />
  333. <el-table-column label="标签" align="center" prop="tagIdsName" width="300px">
  334. <template slot-scope="scope">
  335. <div class="tag-container">
  336. <div class="tag-list">
  337. <el-tag
  338. v-for="name in scope.row.tagIdsName"
  339. :key="name"
  340. type="success"
  341. size="small"
  342. >
  343. {{ name }}
  344. </el-tag>
  345. </div>
  346. </div>
  347. </template>
  348. </el-table-column>
  349. <el-table-column label="流失风险" align="center" prop="attritionLevel">
  350. <template slot-scope="scope">
  351. <el-tag v-if="scope.row.attritionLevel == null" type="info">未分析</el-tag>
  352. <el-tag v-if="scope.row.attritionLevel === 0" type="info">未知</el-tag>
  353. <el-tag v-else-if="scope.row.attritionLevel === 1" type="success">无风险</el-tag>
  354. <el-tag v-else-if="scope.row.attritionLevel === 2" type="info">低风险</el-tag>
  355. <el-tag v-else-if="scope.row.attritionLevel === 3" type="warning">中风险</el-tag>
  356. <el-tag v-else-if="scope.row.attritionLevel === 4" type="danger">高风险</el-tag>
  357. </template>
  358. </el-table-column>
  359. <el-table-column label="意向度" align="center" prop="intentionDegree">
  360. <template slot-scope="scope">
  361. <el-tag v-if="scope.row.intentionDegree !== null && scope.row.intentionDegree !== undefined && scope.row.intentionDegree !== ''">
  362. {{ scope.row.intentionDegree }}
  363. </el-tag>
  364. <span v-else>-</span>
  365. </template>
  366. </el-table-column>
  367. <el-table-column label="关注点" align="center" prop="customerFocusJson" width="220">
  368. <template slot-scope="scope">
  369. <div v-if="parseFocusPoints(scope.row.customerFocusJson).length" style="text-align: left;">
  370. <el-tooltip
  371. v-for="(item, index) in parseFocusPoints(scope.row.customerFocusJson).slice(0, 2)"
  372. :key="index"
  373. placement="top"
  374. effect="light"
  375. >
  376. <div slot="content" style="max-width: 420px; word-break: break-word;">
  377. {{ item }}
  378. </div>
  379. <el-tag style="margin: 0 6px 6px 0; max-width: 100%; background: #fff; border: 1px solid #dcdfe6; color: #606266;">
  380. {{ shortenText(item, 14) }}
  381. </el-tag>
  382. </el-tooltip>
  383. <el-tooltip
  384. v-if="parseFocusPoints(scope.row.customerFocusJson).length > 2"
  385. placement="top"
  386. effect="light"
  387. >
  388. <div slot="content" style="max-width: 420px;">
  389. <div
  390. v-for="(item, idx) in parseFocusPoints(scope.row.customerFocusJson).slice(2)"
  391. :key="'focus-more-' + idx"
  392. style="margin-bottom: 4px;"
  393. >
  394. {{ item }}
  395. </div>
  396. </div>
  397. <el-tag style="margin: 0 6px 6px 0; background: #fff; border: 1px solid #dcdfe6; color: #606266;">
  398. +{{ parseFocusPoints(scope.row.customerFocusJson).length - 2 }}
  399. </el-tag>
  400. </el-tooltip>
  401. </div>
  402. <span v-else>-</span>
  403. </template>
  404. </el-table-column>
  405. <el-table-column label="状态" align="center" prop="status" width="120px" >
  406. <template slot-scope="scope">
  407. <dict-tag :options="statusOptions" :value="scope.row.status"/>
  408. </template>
  409. </el-table-column>
  410. <el-table-column label="客户等级" align="center" prop="level" width="120px" >
  411. <template slot-scope="scope">
  412. <dict-tag :options="ratingType" :value="scope.row.level"/>
  413. </template>
  414. </el-table-column>
  415. <el-table-column label="state参数" align="center" prop="state" width="100px" />
  416. <el-table-column label="等级状态" align="center" prop="levelType" width="120px" >
  417. <template slot-scope="scope">
  418. <dict-tag :options="ratingUpFall" :value="scope.row.levelType"/>
  419. </template>
  420. </el-table-column>
  421. <el-table-column label="绑定员工" align="center" prop="companyUserName" />
  422. <el-table-column label="添加时间" align="center" prop="createTime" width="100px" />
  423. <el-table-column label="流失时间" align="center" prop="lossTime" width="100px" />
  424. <el-table-column label="删除时间" align="center" prop="delTime" width="100px" />
  425. <el-table-column label="备注电话号码" align="center" prop="remarkMobiles" width="150px">
  426. <template slot-scope="scope">
  427. <div v-for="i in JSON.parse(scope.row.remarkMobiles)" :key="i">{{i}}</div>
  428. </template>
  429. </el-table-column>
  430. <el-table-column label="备注企业名称" align="center" prop="remarkCorpName" />
  431. <el-table-column label="来源" align="center" prop="addWay" width="100px">
  432. <template slot-scope="scope">
  433. <dict-tag :options="addWayOptions" :value="scope.row.addWay"/>
  434. </template>
  435. </el-table-column>
  436. <el-table-column label="转接状态" align="center" prop="transferStatus" width="100px" >
  437. <template slot-scope="scope">
  438. <dict-tag :options="transferStatusOptions" :value="scope.row.transferStatus"/>
  439. </template>
  440. </el-table-column>
  441. <el-table-column label="企业id" align="center" prop="corpId" />
  442. <el-table-column label="是否重粉" align="center" prop="isRepeat" fixed="right">
  443. <template slot-scope="scope">
  444. <el-tag type="success" v-if="scope.row.isRepeat == 0">否</el-tag>
  445. <el-tag type="danger" v-if="scope.row.isRepeat == 1">是</el-tag>
  446. <el-button
  447. v-show="scope.row.isRepeat == 1"
  448. size="mini"
  449. type="text"
  450. @click="openRepeat(scope.row)"
  451. >查看</el-button>
  452. </template>
  453. </el-table-column>
  454. <el-table-column label="是否绑小程序" width="100px" align="center" fixed="right">
  455. <template slot-scope="scope">
  456. <el-tag v-if="scope.row.fsUserId" >已绑定</el-tag>
  457. <el-tag v-else type="info"> 未绑定</el-tag>
  458. </template>
  459. </el-table-column>
  460. <el-table-column label="是否下载APP" width="100px" align="center" fixed="right">
  461. <template slot-scope="scope">
  462. <el-tag :type="scope.row.isDownloadApp === 1 ? 'success' : 'info'">
  463. {{ scope.row.isDownloadApp === 1 ? '已下载' : '未下载' }}
  464. </el-tag>
  465. </template>
  466. </el-table-column>
  467. <el-table-column label="修改" align="center" class-name="small-padding fixed-width" width="120px" fixed="right">
  468. <template slot-scope="scope">
  469. <el-button
  470. v-show="scope.row.status==0||scope.row.status==2"
  471. size="mini"
  472. type="text"
  473. icon="el-icon-edit"
  474. @click="handleUpdate(scope.row)"
  475. v-hasPermi="['qw:externalContact:edit']"
  476. >修改备注</el-button>
  477. <el-button
  478. size="mini"
  479. type="text"
  480. icon="el-icon-user-solid"
  481. @click="handleAppellation(scope.row)"
  482. >修改客户称呼</el-button>
  483. </template>
  484. </el-table-column>
  485. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120px" fixed="right">
  486. <template slot-scope="scope">
  487. <!-- <el-button-->
  488. <!-- size="mini"-->
  489. <!-- type="text"-->
  490. <!-- icon="el-icon-edit-outline"-->
  491. <!-- @click="handleUpdateCustomer(scope.row)"-->
  492. <!-- >-->
  493. <!-- <span v-if="scope.row.customerId">换绑CRM</span>-->
  494. <!-- <span v-else>绑定CRM</span>-->
  495. <!-- </el-button>-->
  496. <el-button
  497. size="mini"
  498. type="text"
  499. icon="el-icon-edit-outline"
  500. @click="handleUpdateUser(scope.row)"
  501. >
  502. <span v-if="scope.row.fsUserId">换绑会员</span>
  503. <span v-else>绑定会员</span>
  504. </el-button>
  505. <el-button
  506. v-show="scope.row.fsUserId"
  507. size="mini"
  508. type="text"
  509. icon="el-icon-thumb"
  510. @click="handleUnBindUserId(scope.row)"
  511. v-hasPermi="['qw:externalContact:unBindUserId']"
  512. >
  513. <span>解除会员绑定</span>
  514. </el-button>
  515. <el-button v-show="scope.row.customerId"
  516. size="mini"
  517. type="text"
  518. icon="el-icon-paperclip"
  519. @click="handleShow(scope.row)"
  520. >CRM客户详情</el-button>
  521. <el-button
  522. size="mini"
  523. type="text"
  524. @click="handledetails(scope.row)"
  525. >AI获取用户信息
  526. </el-button>
  527. <el-button
  528. size="mini"
  529. type="text"
  530. v-show="scope.row.fsUserId"
  531. @click="handleUserdetails(scope.row)"
  532. >会员详情
  533. </el-button>
  534. <el-button
  535. size="mini"
  536. type="text"
  537. v-show="scope.row.fsUserId"
  538. @click="healthHandledetails(scope.row)"
  539. >健康档案
  540. </el-button>
  541. <el-button
  542. v-if="scope.row.attritionLevel !== null && scope.row.attritionLevel !== undefined"
  543. size="mini"
  544. type="text"
  545. @click="openAiDrawer(scope.row)"
  546. v-hasPermi="['qw:externalContact:analyze:list']"
  547. >AI 分析</el-button>
  548. </template>
  549. </el-table-column>
  550. </el-table>
  551. <pagination-more
  552. v-show="total>0"
  553. :total="total"
  554. :page.sync="queryParams.pageNum"
  555. :limit.sync="queryParams.pageSize"
  556. @pagination="getList"
  557. />
  558. <el-drawer size="75%" :title="show.title" :visible.sync="show.open">
  559. <customer-details ref="customerDetails" @refreshList="refreshList"/>
  560. </el-drawer>
  561. <!-- 搜索标签 -->
  562. <el-dialog :title="changeTagDialog.title" :visible.sync="changeTagDialog.open" width="1000px" append-to-body>
  563. <div>搜索标签:
  564. <el-input v-model="queryTagParams.name" placeholder="请输入标签名称" clearable size="small" style="width: 200px;margin-right: 10px" />
  565. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleSearchTags(queryTagParams.name)">搜索</el-button>
  566. <el-button type="primary" icon="el-icon-plus" size="mini" @click="cancelSearchTags">重置</el-button>
  567. </div>
  568. <div v-for="item in tagGroupList" :key="item.id" >
  569. <div style="font-size: 20px;margin-top: 20px;margin-bottom: 20px;">
  570. <span class="name-background">{{ item.name }}</span>
  571. </div>
  572. <!-- 添加外层滚动容器 -->
  573. <div class="scroll-wrapper">
  574. <div class="tag-container">
  575. <a
  576. v-for="tagItem in item.tag"
  577. class="tag-box"
  578. @click="tagSelection(tagItem)"
  579. :class="{ 'tag-selected': tagItem.isSelected }"
  580. >
  581. {{ tagItem.name }}
  582. </a>
  583. </div>
  584. </div>
  585. </div>
  586. <pagination
  587. v-show="tagTotal>0"
  588. :total="tagTotal"
  589. :page.sync="queryTagParams.pageNum"
  590. :limit.sync="queryTagParams.pageSize"
  591. @pagination="getPageListTagGroup"
  592. />
  593. <div slot="footer" class="dialog-footer">
  594. <el-button type="primary" @click="tagSubmitForm(changeTagDialog.type)">确 定</el-button>
  595. <el-button @click="tagCancel(changeTagDialog.type)">取消</el-button>
  596. </div>
  597. </el-dialog>
  598. <el-dialog title="批量添加客户备注" :visible.sync="notesOpen.open" width="800px" append-to-body>
  599. <el-card>
  600. <el-row>
  601. <el-col>
  602. <el-radio-group v-model="notesOpen.nameType" style="margin-bottom: 2%">
  603. <el-radio :label="1">
  604. 客户名称添加在【新备注】【前】
  605. </el-radio>
  606. <el-radio :label="2">
  607. 客户名称添加在【新备注】【后】
  608. </el-radio>
  609. <el-radio :label="3">
  610. 不添加客户名称
  611. </el-radio>
  612. </el-radio-group>
  613. </el-col>
  614. <el-col >
  615. <el-radio-group v-model="notesOpen.type">
  616. <el-radio
  617. :label="1"
  618. >添加【新备注】在最【前】面</el-radio>
  619. <el-radio
  620. :label="2"
  621. >添加【新备注】在最【后】面</el-radio>
  622. <el-radio
  623. :label="3"
  624. >替换所有备注</el-radio>
  625. </el-radio-group>
  626. </el-col>
  627. <el-col>
  628. <el-input v-model="notesOpen.notes" placeholder="请输入客户备注(最多20个字,含已有的)" clearable size="small"
  629. maxlength="20" show-word-limit style="width: 500px;margin-top: 3%" />
  630. <div style="color: #999;font-size: 14px;display: flex;align-items: center;">
  631. <i class="el-icon-info"></i>
  632. 由于企业微信官方限制,备注最多20个字,且自动会去除末尾超出的字
  633. </div>
  634. </el-col>
  635. </el-row>
  636. </el-card>
  637. <div slot="footer" class="dialog-footer">
  638. <el-button type="primary" @click="notesSubmitForm()">确 定</el-button>
  639. <el-button @click="notesCancel()">取消</el-button>
  640. </div>
  641. </el-dialog>
  642. <el-dialog title="批量添加标签" :visible.sync="tagOpen" width="800px" append-to-body>
  643. <div>搜索标签:
  644. <el-input v-model="tagChange.tagName" placeholder="请输入标签名称" clearable size="small" style="width: 200px;margin-right: 10px" />
  645. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleSearchTags(tagChange.tagName)">搜索</el-button>
  646. <el-button type="primary" icon="el-icon-plus" size="mini" @click="cancelSearchTags">重置</el-button>
  647. </div>
  648. <el-form ref="form" :model="addTagForm" label-width="80px">
  649. <div v-for="item in tagGroupList" :key="item.id" >
  650. <div style="font-size: 20px;margin-top: 20px;margin-bottom: 20px;">
  651. <span class="name-background">{{ item.name }}</span>
  652. </div>
  653. <!-- 添加外层滚动容器 -->
  654. <div class="scroll-wrapper">
  655. <div class="tag-container">
  656. <a
  657. v-for="tagItem in item.tag"
  658. class="tag-box"
  659. @click="tagSelection(tagItem)"
  660. :class="{ 'tag-selected': tagItem.isSelected }"
  661. >
  662. {{ tagItem.name }}
  663. </a>
  664. </div>
  665. </div>
  666. </div>
  667. </el-form>
  668. <pagination
  669. v-show="tagTotal>0"
  670. :total="tagTotal"
  671. :page.sync="queryTagParams.pageNum"
  672. :limit.sync="queryTagParams.pageSize"
  673. @pagination="getPageListTagGroup"
  674. />
  675. <div slot="footer" class="dialog-footer">
  676. <el-button type="primary" @click="addTagSubmitForm()">确 定</el-button>
  677. <el-button @click="addTagCancel">取 消</el-button>
  678. </div>
  679. </el-dialog>
  680. <el-dialog title="批量移除标签" :visible.sync="tagDelOpen" width="800px" append-to-body>
  681. <div>搜索标签:
  682. <el-input v-model="tagChange.tagName" placeholder="请输入标签名称" clearable size="small" style="width: 200px;margin-right: 10px" />
  683. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleSearchTags(tagChange.tagName)">搜索</el-button>
  684. <el-button type="primary" icon="el-icon-plus" size="mini" @click="cancelSearchTags">重置</el-button>
  685. </div>
  686. <el-form ref="form" :model="addTagForm" label-width="80px">
  687. <div v-for="item in tagGroupList" :key="item.id" >
  688. <div style="font-size: 20px;margin-top: 20px;margin-bottom: 20px;">
  689. <span class="name-background">{{ item.name }}</span>
  690. </div>
  691. <!-- 添加外层滚动容器 -->
  692. <div class="scroll-wrapper">
  693. <div class="tag-container">
  694. <a
  695. v-for="tagItem in item.tag"
  696. class="tag-box"
  697. @click="tagSelection(tagItem)"
  698. :class="{ 'tag-selected': tagItem.isSelected }"
  699. >
  700. {{ tagItem.name }}
  701. </a>
  702. </div>
  703. </div>
  704. </div>
  705. </el-form>
  706. <pagination
  707. v-show="tagTotal>0"
  708. :total="tagTotal"
  709. :page.sync="queryTagParams.pageNum"
  710. :limit.sync="queryTagParams.pageSize"
  711. @pagination="getPageListTagGroup"
  712. />
  713. <div slot="footer" class="dialog-footer">
  714. <el-button type="primary" @click="tagDelSubmitForm()">确 定</el-button>
  715. <el-button @click="DelTagCancel">取 消</el-button>
  716. </div>
  717. </el-dialog>
  718. <!-- 添加或修改企业微信客户对话框 -->
  719. <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
  720. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  721. <el-form-item label="备注" prop="remark">
  722. <el-input v-model="form.remark" type="textarea" placeholder="请输入备注" />
  723. </el-form-item>
  724. <el-form-item label="描述信息" prop="description">
  725. <el-input v-model="form.description" type="textarea" :rows="3" placeholder="请输入描述信息" />
  726. </el-form-item>
  727. <el-form-item label="备注电话号码" prop="remarkMobiles">
  728. <el-tag
  729. :key="tag"
  730. v-for="tag in remarkMobiles"
  731. closable
  732. :disable-transitions="false"
  733. @close="handleClose(tag)">
  734. {{tag}}
  735. </el-tag>
  736. <el-input
  737. style="width:110px"
  738. class="input-new-tag"
  739. v-if="inputVisible"
  740. v-model="inputValue"
  741. ref="saveTagInput"
  742. size="small"
  743. @keyup.enter.native="handleInputConfirm"
  744. @blur="handleInputConfirm"
  745. >
  746. </el-input>
  747. <el-button v-else class="button-new-tag" size="small" style="width: 110px" @click="showInput">新增电话</el-button>
  748. </el-form-item>
  749. <el-form-item label="备注企业名称" prop="remarkCorpName">
  750. <el-input v-model="form.remarkCorpName" placeholder="请输入备注企业名称" />
  751. </el-form-item>
  752. </el-form>
  753. <div slot="footer" class="dialog-footer">
  754. <el-button type="primary" @click="submitForm">确 定</el-button>
  755. <el-button @click="cancel">取 消</el-button>
  756. </div>
  757. </el-dialog>
  758. <el-dialog :title="callOpen.title" :visible.sync="callOpen.open" width="500px" append-to-body>
  759. <el-form ref="callOpenFrom" :model="callOpenFrom" :rules="callOpenRule" label-width="110px">
  760. <el-form-item label="客户称呼" prop="stageStatus">
  761. <el-input v-model="callOpenFrom.stageStatus" placeholder="请输入客户称呼" />
  762. </el-form-item>
  763. </el-form>
  764. <div slot="footer" class="dialog-footer" >
  765. <el-button type="primary" @click="submitCallOpenFrom">确 定</el-button>
  766. </div>
  767. </el-dialog>
  768. <!-- 绑定客户 -->
  769. <el-dialog :title="bindCustomer.title" :visible.sync="bindCustomer.open" width="1200px" append-to-body>
  770. <mycustomer ref="mycustomer" @bindCustomerId="bindCustomerId"></mycustomer>
  771. </el-dialog>
  772. <!-- 设置一个课程sop-->
  773. <el-dialog :title="setSop.title" :visible.sync="setSop.open" width="1200px" append-to-body>
  774. <SopDialog ref="SopDialog" @bindCourseSop="bindCourseSop"></SopDialog>
  775. </el-dialog>
  776. <el-dialog :title="user.title" :visible.sync="user.open" width="800px" append-to-body>
  777. <selectUser ref="selectUser" @bindMiniCustomerId="bindMiniCustomerId"></selectUser>
  778. </el-dialog>
  779. <el-dialog :title="info.title" :visible.sync="info.open" width="1100px" append-to-body>
  780. <info ref="Details" />
  781. </el-dialog>
  782. <el-dialog
  783. :title="resultTitle"
  784. :visible.sync="resultDialogVisible"
  785. width="50%"
  786. custom-class="feedback-dialog"
  787. >
  788. <pre style="white-space: pre-wrap; font-family: inherit;">{{ resultMessage }}</pre>
  789. <span slot="footer" class="dialog-footer">
  790. <el-button @click="resultDialogVisible = false">关闭</el-button>
  791. </span>
  792. </el-dialog>
  793. <el-dialog
  794. title="企微账号"
  795. :visible.sync="repeat.open"
  796. width="50%"
  797. custom-class="feedback-dialog"
  798. >
  799. <el-row style="padding: 20px 10px">
  800. <el-tag v-for="item in repeat.list">{{item.qwUserName}}</el-tag>
  801. </el-row>
  802. </el-dialog>
  803. <el-drawer
  804. :with-header="false"
  805. size="75%"
  806. :title="showHealth.title" :visible.sync="showHealth.open">
  807. <healthRecordDetails ref="Details" />
  808. </el-drawer>
  809. <el-drawer
  810. :with-header="false"
  811. size="75%"
  812. :title="showUser.title"
  813. :visible.sync="showUser.open">
  814. <userDetails ref="userDetails" />
  815. </el-drawer>
  816. <el-drawer
  817. size="75%"
  818. :title="aiAnalyze.title"
  819. :visible.sync="aiAnalyze.open"
  820. append-to-body
  821. >
  822. <customer-detail
  823. ref="customerAiDetail"
  824. :analyze-user-id="aiAnalyze.userId"
  825. :analyze-external-user-id="aiAnalyze.externalUserId"
  826. :analyze-corp-id="aiAnalyze.corpId"
  827. :customer-row="aiAnalyze.customerRow"
  828. />
  829. </el-drawer>
  830. </div>
  831. </template>
  832. <script>
  833. import {
  834. addExternalContact,
  835. addTag,
  836. batchUpdateExternalContactNotes,
  837. bindUserId,
  838. delExternalContact,
  839. delTag,
  840. editbindCustomer,
  841. exportExternalContact,
  842. getCustomerCourseSop,
  843. getExternalContact,
  844. listExternalContact,
  845. setCustomerCourseSop,
  846. setCustomerCourseSopList,
  847. unBindUserId,
  848. updateExternalContact,
  849. getRepeat,
  850. updateExternalContactCall, myDeptExtList
  851. } from '../../../api/qw/externalContact'
  852. import {getMyQwCompanyList,getQwUserListLikeName} from "@/api/qw/user";
  853. import {getId} from "@/api/store/healthRecord";
  854. import {listTag, searchTags,} from "@/api/qw/tag";
  855. import {allListTagGroup} from "@/api/qw/tagGroup";
  856. import mycustomer from '@/views/qw/externalContact/mycustomer'
  857. import customerDetails from '@/views/qw/externalContact/customerDetails'
  858. import SopDialog from '@/views/course/sop/SopDialog.vue'
  859. import selectUser from "@/views/qw/externalContact/selectUser.vue";
  860. import info from "@/views/qw/externalContact/info.vue";
  861. import {editTalk} from "@/api/qw/externalContactInfo";
  862. import healthRecordDetails from '@/views/store/components/healthRecordDetails.vue'
  863. import userDetails from '@/views/store/components/userDetails.vue';
  864. import PaginationMore from "../../../components/PaginationMore/index.vue";
  865. import customerDetail from './customerDetail.vue';
  866. export default {
  867. name: "deptExternalContact",
  868. components:{PaginationMore, mycustomer,customerDetails,SopDialog,selectUser,info,healthRecordDetails,userDetails,customerDetail},
  869. data() {
  870. return {
  871. resultDialogVisible: false,
  872. resultMessage: '',
  873. resultTitle:'',
  874. repeat: {
  875. open: false,
  876. loading: true,
  877. param:{},
  878. list:[]
  879. },
  880. user:{
  881. open:false,
  882. title:"修改客户"
  883. },
  884. userForm:{
  885. id:null,
  886. fsUserId:null,
  887. },
  888. info:{
  889. title:"用户信息",
  890. open:false,
  891. },
  892. // ...其他已有数据
  893. qwUserSuggestions: [], // 已展示的数据
  894. showQwUserDropdown: false, // 控制下拉框显示
  895. qwUserLoading: false, // 加载状态
  896. qwUserNoMore: false, // 是否还有更多数据
  897. qwUserPageNum: 1, // 当前页码
  898. qwUserPageSize: 10, // 每页数量
  899. qwUserTotal: 0, // 总数
  900. isBindMiniOptions:[
  901. {dictLabel:"已绑定",dictValue:'isBindMini'},
  902. {dictLabel:"未绑定",dictValue:'noBindMini'},
  903. ],
  904. //标签弹窗选择
  905. tagChange:{
  906. open:false,
  907. index:null,
  908. },
  909. sTime:null,
  910. eTime:null,
  911. createTime:null,
  912. // 遮罩层
  913. loading: false,
  914. // 导出遮罩层
  915. exportLoading: false,
  916. tagOpen:false,
  917. notesOpen: {
  918. type: 1,
  919. nameType: 3,
  920. addType: 0,
  921. filter: false,
  922. open: false,
  923. notes: null,
  924. },
  925. tagDelOpen:false,
  926. // 选中数组
  927. ids: [],
  928. isBindActiveName:"all",
  929. remarkMobiles: [],
  930. inputVisible: false,
  931. inputValue: '',
  932. // 非单个禁用
  933. single: true,
  934. tagGroupList: [],
  935. // 非多个禁用
  936. multiple: true,
  937. // 显示搜索条件
  938. showSearch: true,
  939. // 总条数
  940. total: 0,
  941. // 企业微信客户表格数据
  942. externalContactList: [],
  943. // 弹出层标题
  944. title: "",
  945. // 是否显示弹出层
  946. open: false,
  947. // 用户类别字典
  948. typeOptions: [],
  949. ratingType: [],
  950. ratingUpFall: [],
  951. // 性别字典
  952. genderOptions: [],
  953. addTagForm:{
  954. userIds:[],
  955. tagIds:[]
  956. },
  957. myQwCompanyList:[],
  958. show:{
  959. title:"客户详情",
  960. open:false,
  961. },
  962. showHealth:{
  963. title:"健康档案",
  964. open:false,
  965. },
  966. showTongue:{
  967. title:"舌苔报告",
  968. open:false,
  969. },
  970. showUser:{
  971. title:"会员详情",
  972. open:false,
  973. },
  974. //存储选择的客户
  975. chooseCustomerSOP:null,
  976. setSop:{
  977. title:"选择课节SOP",
  978. open:false,
  979. //区分单选1还是多选2
  980. type:null,
  981. },
  982. //合成的客户-课节SOP参数
  983. customerCourseForm:{},
  984. //查询是否已经设置过客户-某个课节的SOP
  985. customerCourseFormLogs:{},
  986. //绑定客户
  987. bindCustomer:{
  988. title:null,
  989. open:false,
  990. },
  991. callOpen:{
  992. open:false,
  993. title: '修改客户称呼',
  994. },
  995. callOpenFrom:{
  996. id:null,
  997. stageStatus:null,
  998. },
  999. callOpenRule:{
  1000. stageStatus:[{required:true,message:"员工称呼不能为空",trigger:"blur"}]
  1001. },
  1002. //绑定的参数表
  1003. qwFormCustomer:{
  1004. externalContactId:null,
  1005. customerId:null,
  1006. },
  1007. // 来源字典
  1008. addWayOptions: [],
  1009. //标签
  1010. changeTagDialog:{
  1011. title:"",
  1012. open:false,
  1013. type: null,
  1014. },
  1015. queryTagParams:{
  1016. pageNum: 1,
  1017. pageSize: 5,
  1018. total:0,
  1019. name:null,
  1020. corpId:null,
  1021. },
  1022. tagTotal:0,
  1023. // 查询参数
  1024. queryParams: {
  1025. pageNum: 1,
  1026. pageSize: 10,
  1027. userId: null,
  1028. qwUserName:null,
  1029. externalUserId: null,
  1030. name: null,
  1031. avatar: null,
  1032. type: null,
  1033. qwUserId:null,
  1034. gender: null,
  1035. description: null,
  1036. tagIds: null,
  1037. outTagIds: null,
  1038. remark:null,
  1039. remarkMobiles: null,
  1040. remarkCorpName: null,
  1041. addWay: null,
  1042. operUserid: null,
  1043. corpId: null,
  1044. companyId: null,
  1045. status:null,
  1046. transferStatus:null,
  1047. isBind:null,
  1048. isBindMini:null,
  1049. lossTime:null,
  1050. sTime:null,
  1051. eTime:null,
  1052. createTime:null,
  1053. level:null,
  1054. levelType:null
  1055. },
  1056. selectTags:[],
  1057. outSelectTags:[],
  1058. // 表单参数
  1059. form: {},
  1060. tagList:[],
  1061. transferStatusOptions:[],
  1062. statusOptions:[],
  1063. // 表单校验
  1064. rules: {
  1065. },
  1066. tongueReportParams: {
  1067. userId: null,
  1068. },
  1069. aiAnalyze: {
  1070. title: "AI 分析",
  1071. open: false,
  1072. userId: null,
  1073. externalUserId: null,
  1074. corpId: null,
  1075. customerRow: null,
  1076. },
  1077. };
  1078. },
  1079. created() {
  1080. this.getDicts("sys_qw_externalContact_type").then(response => {
  1081. this.typeOptions = response.data;
  1082. });
  1083. this.getDicts("sys_qw_sop_rating_type").then(response => {
  1084. this.ratingType = response.data;
  1085. });
  1086. this.getDicts("sys_qw_sop_rating_upFall").then(response => {
  1087. this.ratingUpFall = response.data;
  1088. });
  1089. getMyQwCompanyList().then(response => {
  1090. this.myQwCompanyList = response.data;
  1091. if(this.myQwCompanyList!=null){
  1092. this.queryParams.corpId=this.myQwCompanyList[0].dictValue
  1093. var listTagFrom={corpId:this.queryParams.corpId}
  1094. listTag(listTagFrom).then(response => {
  1095. this.tagList = response.rows;
  1096. });
  1097. this.getList();
  1098. }
  1099. });
  1100. this.getDicts("sys_sex").then(response => {
  1101. this.genderOptions = response.data;
  1102. });
  1103. this.getDicts("sys_qw_externalContact_addWay").then(response => {
  1104. this.addWayOptions = response.data;
  1105. });
  1106. this.getDicts("sys_qw_external_contact_status").then(response => {
  1107. this.statusOptions = response.data;
  1108. });
  1109. this.getDicts("sys_qw_transfer_status").then(response => {
  1110. this.transferStatusOptions = response.data;
  1111. });
  1112. },
  1113. methods: {
  1114. shortenText(text, maxLen = 16) {
  1115. const str = text == null ? '' : String(text);
  1116. if (str.length <= maxLen) return str;
  1117. return str.slice(0, maxLen) + '...';
  1118. },
  1119. parseFocusPoints(value) {
  1120. if (!value) return [];
  1121. if (Array.isArray(value)) {
  1122. return value.map(item => String(item).trim()).filter(Boolean);
  1123. }
  1124. if (typeof value === 'string') {
  1125. const raw = value.trim();
  1126. if (!raw) return [];
  1127. try {
  1128. const parsed = JSON.parse(raw);
  1129. if (Array.isArray(parsed)) {
  1130. return parsed.map(item => String(item).trim()).filter(Boolean);
  1131. }
  1132. if (typeof parsed === 'string') {
  1133. return [parsed.trim()].filter(Boolean);
  1134. }
  1135. } catch (e) {
  1136. // ignore parse error and use raw fallback
  1137. }
  1138. return [raw.replace(/^\[|\]$/g, '').replace(/["']/g, '').trim()].filter(Boolean);
  1139. }
  1140. return [String(value).trim()].filter(Boolean);
  1141. },
  1142. openAiDrawer(row) {
  1143. this.aiAnalyze.userId = row.userId;
  1144. this.aiAnalyze.externalUserId = row.operUserid ;
  1145. this.aiAnalyze.corpId = row.corpId ;
  1146. this.aiAnalyze.customerRow = row;
  1147. this.aiAnalyze.open = true;
  1148. },
  1149. onQwUserNameClear() {
  1150. this.queryParams.qwUserId = null; // 同时清空 qwUserId
  1151. },
  1152. // 搜索企微用户
  1153. searchQwUser(query) {
  1154. if (!query.trim()) {
  1155. this.qwUserSuggestions = [];
  1156. this.showQwUserDropdown = false;
  1157. this.qwUserNoMore = false;
  1158. this.qwUserPageNum = 1;
  1159. return;
  1160. }
  1161. this.queryParams.qwUserName = query;
  1162. this.qwUserPageNum = 1;
  1163. this.qwUserNoMore = false;
  1164. this.qwUserSuggestions = [];
  1165. this.fetchQwUsers(query);
  1166. },
  1167. fetchQwUsers(query) {
  1168. const params = {
  1169. qwUserName: query,
  1170. pageNum: this.qwUserPageNum,
  1171. pageSize: this.qwUserPageSize
  1172. };
  1173. this.qwUserLoading = true;
  1174. getQwUserListLikeName(params).then(res => {
  1175. const list = res.data.list || [];
  1176. const total = res.data.total || 0;
  1177. this.qwUserSuggestions = [...this.qwUserSuggestions, ...list];
  1178. this.qwUserTotal = total;
  1179. // 判断是否还有更多数据
  1180. if (this.qwUserSuggestions.length >= total) {
  1181. this.qwUserNoMore = true;
  1182. }
  1183. this.showQwUserDropdown = true;
  1184. }).finally(() => {
  1185. this.qwUserLoading = false;
  1186. });
  1187. },
  1188. // 选择企微用户
  1189. selectQwUser(key,value) {
  1190. this.queryParams.qwUserName = value;
  1191. this.queryParams.qwUserId = key;
  1192. this.showQwUserDropdown = false;
  1193. this.handleQuery(); // 可选:自动触发查询
  1194. },
  1195. // 延迟隐藏下拉框,防止点击失效
  1196. hideDropdownWithDelay() {
  1197. setTimeout(() => {
  1198. this.showQwUserDropdown = false;
  1199. }, 200);
  1200. },
  1201. handleScroll(e) {
  1202. const container = e.target;
  1203. const scrollTop = container.scrollTop;
  1204. const scrollHeight = container.scrollHeight;
  1205. const clientHeight = container.clientHeight;
  1206. // 距离底部小于 20px 触发加载
  1207. if (scrollHeight - scrollTop - clientHeight < 20 && !this.qwUserLoading && !this.qwUserNoMore) {
  1208. this.qwUserPageNum += 1;
  1209. this.fetchQwUsers(this.queryParams.qwUserName);
  1210. }
  1211. },
  1212. async healthHandledetails(row) {
  1213. try {
  1214. console.log(row.fsUserId);
  1215. console.log(row);
  1216. // 先尝试获取健康记录数据
  1217. const res = await getId(row.fsUserId);
  1218. console.log(res);
  1219. // 只有获取数据成功后才打开对话框
  1220. this.showHealth.open = true;
  1221. // 确保对话框DOM已更新
  1222. await this.$nextTick();
  1223. this.$refs.Details.getDetails(res.data);
  1224. } catch (error) {
  1225. console.error('获取健康档案失败:', error);
  1226. //this.$message.error('获取健康档案失败: ' + (error.message || '该用户还未填写健康档案'));
  1227. }
  1228. },
  1229. async handleUserdetails(row){
  1230. this.showUser.open = true;
  1231. try {
  1232. await this.$nextTick();
  1233. this.$refs.userDetails.getDetails(row.fsUserId);
  1234. } catch (error) {
  1235. console.error('获取会员详情失败:', error);
  1236. }
  1237. },
  1238. change(){
  1239. if(this.createTime!=null){
  1240. this.queryParams.sTime=this.createTime[0];
  1241. this.queryParams.eTime=this.createTime[1];
  1242. }else{
  1243. this.queryParams.sTime=null;
  1244. this.queryParams.eTime=null;
  1245. }
  1246. },
  1247. updateCorpId(){
  1248. var listTagFrom={corpId:this.queryParams.corpId}
  1249. listTag(listTagFrom).then(response => {
  1250. this.tagList = response.rows;
  1251. });
  1252. this.getList();
  1253. },
  1254. /** 查询企业微信客户列表 */
  1255. getList() {
  1256. this.loading = true;
  1257. const { qwUserName, ...queryParams } = this.queryParams;
  1258. myDeptExtList(queryParams).then(response => {
  1259. this.externalContactList = response.rows;
  1260. this.total = response.total;
  1261. this.loading = false;
  1262. });
  1263. },
  1264. bindMiniCustomerId(row){
  1265. console.log(row)
  1266. this.userForm.fsUserId=row;
  1267. bindUserId(this.userForm).then(res=>{
  1268. if (res.code==200){
  1269. this.$message.success('绑定成功')
  1270. }else {
  1271. this.$message.error('绑定失败:',res.msg)
  1272. }
  1273. this.getList()
  1274. this.user.open=false;
  1275. })
  1276. },
  1277. /** 查看客户详情 */
  1278. handleShow(row){
  1279. this.show.open=true;
  1280. var that=this;
  1281. const tab = "visit";
  1282. setTimeout(() => {
  1283. that.$refs.customerDetails.getDetails(row.customerId);
  1284. that.$refs.customerDetails.handleClick(tab);
  1285. }, 200);
  1286. },
  1287. handledetails(row){
  1288. this.info.open=true;
  1289. setTimeout(() => {
  1290. this.$refs.Details.getDetails(row.id);
  1291. }, 1);
  1292. },
  1293. closeInfo(){
  1294. this.info.open=false
  1295. },
  1296. handleClickX(tab, event) {
  1297. this.queryParams.isBind=tab.name;
  1298. this.handleQuery();
  1299. },
  1300. handleClose(tag) {
  1301. this.remarkMobiles.splice(this.remarkMobiles.indexOf(tag), 1);
  1302. },
  1303. showInput() {
  1304. this.inputVisible = true;
  1305. this.$nextTick(_ => {
  1306. this.$refs.saveTagInput.$refs.input.focus();
  1307. });
  1308. },
  1309. handleInputConfirm() {
  1310. let inputValue = this.inputValue;
  1311. if (inputValue) {
  1312. this.remarkMobiles.push(inputValue);
  1313. }
  1314. this.inputVisible = false;
  1315. this.inputValue = '';
  1316. },
  1317. handleBatchUpdateNotes(){
  1318. if(this.ids==null||this.ids==""){
  1319. return this.$message('请选择需要添加备注的客户');
  1320. }
  1321. this.notesOpen.open=true;
  1322. },
  1323. handleBatchUpdateNotesFilter() {
  1324. this.notesOpen.open = true;
  1325. this.notesOpen.filter = true;
  1326. },
  1327. addUserTag(){
  1328. if(this.ids==null||this.ids==""){
  1329. return this.$message('请选择需要添加标签的客户');
  1330. }
  1331. this.getPageListTagGroup();
  1332. setTimeout(() => {
  1333. for (let i = 0; i < this.tagGroupList.length; i++) {
  1334. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1335. this.tagGroupList[i].tag[x].isSelected=false;
  1336. }
  1337. }
  1338. }, 200);
  1339. this.tagOpen = true;
  1340. },
  1341. getPageListTagGroup(){
  1342. this.queryTagParams.corpId=this.queryParams.corpId
  1343. allListTagGroup(this.queryTagParams).then(response => {
  1344. this.tagGroupList = response.rows;
  1345. this.tagTotal = response.total;
  1346. });
  1347. },
  1348. delUserTag(){
  1349. if(this.ids==null||this.ids==""){
  1350. return this.$message('请选择需要移除标签的客户');
  1351. }
  1352. this.getPageListTagGroup();
  1353. setTimeout(() => {
  1354. for (let i = 0; i < this.tagGroupList.length; i++) {
  1355. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1356. this.tagGroupList[i].tag[x].isSelected=false;
  1357. }
  1358. }
  1359. }, 200);
  1360. this.tagDelOpen = true;
  1361. },
  1362. //搜索的标签
  1363. hangleChangeTags(){
  1364. this.changeTagDialog.title="搜索的标签"
  1365. this.changeTagDialog.open=true;
  1366. this.changeTagDialog.type = 1;
  1367. // 获取 tagListFormIndex 中的所有 tagId,用于快速查找
  1368. const selectedTagIds = new Set(
  1369. (this.selectTags || []).map(tagItem => tagItem?.tagId)
  1370. );
  1371. this.queryTagParams.name=null;
  1372. this.getPageListTagGroup();
  1373. setTimeout(() => {
  1374. for (let i = 0; i < this.tagGroupList.length; i++) {
  1375. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1376. this.tagGroupList[i].tag[x].isSelected = selectedTagIds.has(this.tagGroupList[i].tag[x].tagId);
  1377. }
  1378. }
  1379. }, 200);
  1380. },
  1381. //选择排除标签
  1382. hangleChangeOutTags() {
  1383. this.changeTagDialog.title="搜索的标签"
  1384. this.changeTagDialog.open=true;
  1385. this.changeTagDialog.type = 2;
  1386. // 获取 tagListFormIndex 中的所有 tagId,用于快速查找
  1387. const selectedTagIds = new Set(
  1388. (this.outSelectTags || []).map(tagItem => tagItem?.tagId)
  1389. );
  1390. this.queryTagParams.name=null;
  1391. this.getPageListTagGroup();
  1392. setTimeout(() => {
  1393. for (let i = 0; i < this.tagGroupList.length; i++) {
  1394. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1395. this.tagGroupList[i].tag[x].isSelected = selectedTagIds.has(this.tagGroupList[i].tag[x].tagId);
  1396. }
  1397. }
  1398. }, 200);
  1399. },
  1400. //删除一些选择的标签
  1401. handleCloseTags(list){
  1402. const ls = this.selectTags.findIndex(t => t.tagId === list.tagId);
  1403. if (ls !== -1) {
  1404. this.selectTags.splice(ls, 1);
  1405. this.selectTags = [...this.selectTags];
  1406. }
  1407. if (this.selectTags!=null && this.selectTags.length>0){
  1408. // 确保 this.form.tags 是数组
  1409. if (!this.queryParams.tagIds) {
  1410. this.queryParams.tagIds = []; // 如果未定义,初始化
  1411. } else {
  1412. this.queryParams.tagIds = []; // 清空已有数据
  1413. }
  1414. // 遍历并添加 tagId
  1415. this.selectTags.forEach(tag => {
  1416. if (tag.tagId) { // 确保 tagId 存在
  1417. this.queryParams.tagIds.push(tag.tagId);
  1418. }
  1419. });
  1420. this.queryParams.tagIds=this.queryParams.tagIds.join(",");
  1421. }else {
  1422. this.queryParams.tagIds=null;
  1423. }
  1424. },
  1425. //删除一些排除的标签
  1426. handleCloseOutTags(list){
  1427. const ls = this.outSelectTags.findIndex(t => t.tagId === list.tagId);
  1428. if (ls !== -1) {
  1429. this.outSelectTags.splice(ls, 1);
  1430. this.outSelectTags = [...this.selectTags];
  1431. }
  1432. if (this.outSelectTags!=null && this.outSelectTags.length>0){
  1433. // 确保 this.form.tags 是数组
  1434. if (!this.queryParams.outTagIds) {
  1435. this.queryParams.outTagIds = []; // 如果未定义,初始化
  1436. } else {
  1437. this.queryParams.outTagIds = []; // 清空已有数据
  1438. }
  1439. // 遍历并添加 tagId
  1440. this.outSelectTags.forEach(tag => {
  1441. if (tag.tagId) { // 确保 tagId 存在
  1442. this.queryParams.outTagIds.push(tag.tagId);
  1443. }
  1444. });
  1445. this.queryParams.outTagIds=this.queryParams.outTagIds.join(",");
  1446. }else {
  1447. this.queryParams.outTagIds=null;
  1448. }
  1449. },
  1450. //重新获取页面数据
  1451. refreshList(){
  1452. this.getList();
  1453. },
  1454. //批量设置课程sop
  1455. setUserCourseSop(){
  1456. if(this.ids==null||this.ids==""){
  1457. return this.$message('请选择需要设置课程SOP的客户');
  1458. }
  1459. this.$confirm('批量设置客户课节SOP可能会存在重复,确定要批量设置吗?', "警告", {
  1460. confirmButtonText: "确定",
  1461. cancelButtonText: "取消",
  1462. type: "warning"
  1463. }).then(() => {
  1464. this.setSop.open = true;
  1465. this.setSop.type = 2;
  1466. })
  1467. .catch(() => {
  1468. // 可以处理用户点击“取消”的逻辑
  1469. });
  1470. },
  1471. tagSelection(row){
  1472. row.isSelected= !row.isSelected;
  1473. this.$forceUpdate();
  1474. },
  1475. // 取消按钮
  1476. cancel() {
  1477. this.open = false;
  1478. this.reset();
  1479. },
  1480. addTagCancel() {
  1481. this.tagOpen = false;
  1482. this.addTagForm={
  1483. userIds:[],
  1484. tagIds:[]
  1485. };
  1486. },
  1487. DelTagCancel() {
  1488. this.tagDelOpen = false;
  1489. this.addTagForm={
  1490. userIds:[],
  1491. tagIds:[]
  1492. };
  1493. },
  1494. addTagSubmitForm(){
  1495. for (let i = 0; i < this.tagGroupList.length; i++) {
  1496. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1497. if(this.tagGroupList[i].tag[x].isSelected==true){
  1498. this.addTagForm.tagIds.push(this.tagGroupList[i].tag[x].tagId)
  1499. }
  1500. }
  1501. }
  1502. if(this.addTagForm.tagIds==[]||this.addTagForm.tagIds==null||this.addTagForm.tagIds==""){
  1503. return this.$message('请选择标签');
  1504. }
  1505. this.addTagForm.corpId=this.queryParams.corpId
  1506. this.addTagForm.userIds=this.ids;
  1507. let loadingRock = this.$loading({
  1508. lock: true,
  1509. text: '正在执行中请稍后~~请不要刷新页面!!',
  1510. spinner: 'el-icon-loading',
  1511. background: 'rgba(0, 0, 0, 0.7)'
  1512. });
  1513. addTag(this.addTagForm).then(response => {
  1514. this.tagOpen = false;
  1515. loadingRock.close();
  1516. this.addTagForm={
  1517. userIds:[],
  1518. tagIds:[]
  1519. };
  1520. this.resultMessage = response.msg;
  1521. this.resultDialogVisible = true; // 显示弹窗
  1522. this.resultTitle = '批量添加标签结果';
  1523. }).finally(res=>{
  1524. this.getList()
  1525. loadingRock.close();
  1526. });
  1527. },
  1528. tagDelSubmitForm(){
  1529. for (let i = 0; i < this.tagGroupList.length; i++) {
  1530. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1531. if(this.tagGroupList[i].tag[x].isSelected==true){
  1532. this.addTagForm.tagIds.push(this.tagGroupList[i].tag[x].tagId)
  1533. }
  1534. }
  1535. }
  1536. if(this.addTagForm.tagIds==[]||this.addTagForm.tagIds==null||this.addTagForm.tagIds==""){
  1537. return this.$message('请选择标签');
  1538. }
  1539. this.addTagForm.corpId=this.queryParams.corpId
  1540. this.addTagForm.userIds=this.ids;
  1541. let loadingRock = this.$loading({
  1542. lock: true,
  1543. text: '正在执行中请稍后~~请不要刷新页面!!',
  1544. spinner: 'el-icon-loading',
  1545. background: 'rgba(0, 0, 0, 0.7)'
  1546. });
  1547. delTag(this.addTagForm).then(response => {
  1548. this.tagDelOpen = false;
  1549. loadingRock.close();
  1550. this.addTagForm={
  1551. userIds:[],
  1552. tagIds:[]
  1553. };
  1554. this.resultMessage = response.msg;
  1555. this.resultDialogVisible = true; // 显示弹窗
  1556. this.resultTitle = '批量删除标签结果';
  1557. }).finally(res=>{
  1558. this.getList()
  1559. loadingRock.close();
  1560. });
  1561. },
  1562. // 表单重置
  1563. reset() {
  1564. this.form = {
  1565. id: null,
  1566. userId: null,
  1567. externalUserId: null,
  1568. name: null,
  1569. companyUserId:null,
  1570. customerId:null,
  1571. avatar: null,
  1572. type: null,
  1573. gender: null,
  1574. remark: null,
  1575. description: null,
  1576. tagIds: null,
  1577. remarkMobiles: null,
  1578. remarkCorpName: null,
  1579. addWay: null,
  1580. operUserid: null,
  1581. corpId: null,
  1582. companyId: null,
  1583. transferStatus:null,
  1584. status:null,
  1585. sTime:null,
  1586. eTime:null,
  1587. createTime:null,
  1588. transferTime:null,
  1589. transferNum:null,
  1590. lossTime:null,
  1591. delTime:null,
  1592. state:null,
  1593. wayId:null,
  1594. stageStatus:null,
  1595. customerName:null
  1596. };
  1597. this.resetForm("form");
  1598. },
  1599. /** 搜索按钮操作 */
  1600. handleQuery() {
  1601. if (this.selectTags!=null && this.selectTags.length>0){
  1602. // 确保 this.form.tags 是数组
  1603. if (!this.queryParams.tagIds) {
  1604. this.queryParams.tagIds = []; // 如果未定义,初始化
  1605. } else {
  1606. this.queryParams.tagIds = []; // 清空已有数据
  1607. }
  1608. // 遍历并添加 tagId
  1609. this.selectTags.forEach(tag => {
  1610. if (tag.tagId) { // 确保 tagId 存在
  1611. this.queryParams.tagIds.push(tag.tagId);
  1612. }
  1613. });
  1614. this.queryParams.tagIds=this.queryParams.tagIds.join(",");
  1615. }else {
  1616. this.queryParams.tagIds=null;
  1617. }
  1618. if (this.outSelectTags!=null && this.outSelectTags.length>0){
  1619. // 确保 this.form.tags 是数组
  1620. if (!this.queryParams.outTagIds) {
  1621. this.queryParams.outTagIds = []; // 如果未定义,初始化
  1622. } else {
  1623. this.queryParams.outTagIds = []; // 清空已有数据
  1624. }
  1625. // 遍历并添加 tagId
  1626. this.outSelectTags.forEach(tag => {
  1627. if (tag.tagId) { // 确保 tagId 存在
  1628. this.queryParams.outTagIds.push(tag.tagId);
  1629. }
  1630. });
  1631. this.queryParams.outTagIds=this.queryParams.outTagIds.join(",");
  1632. }else {
  1633. this.queryParams.outTagIds=null;
  1634. }
  1635. this.queryParams.pageNum = 1;
  1636. this.getList();
  1637. },
  1638. handleSearchTags(name){
  1639. if (!name){
  1640. return this.$message.error("请输入要搜索的标签")
  1641. }
  1642. this.queryTagParams.name=name;
  1643. this.queryTagParams.corpId=this.queryParams.corpId;
  1644. searchTags(this.queryTagParams).then(response => {
  1645. this.tagGroupList = response.rows;
  1646. this.tagTotal = response.total;
  1647. });
  1648. // searchTags({name:name,corpId:this.queryParams.corpId}).then(response => {
  1649. // this.tagGroupList = response.rows;
  1650. // });
  1651. },
  1652. cancelSearchTags(){
  1653. this.resetSearchQueryTag()
  1654. this.getPageListTagGroup();
  1655. },
  1656. notesSubmitForm(){
  1657. if (this.notesOpen.notes==null || this.notesOpen.notes==""){
  1658. return this.$message.error("请输入备注内容");
  1659. }
  1660. let loadingRock = this.$loading({
  1661. lock: true,
  1662. text: '正在执行中请稍后~~请不要刷新页面!!',
  1663. spinner: 'el-icon-loading',
  1664. background: 'rgba(0, 0, 0, 0.7)'
  1665. });
  1666. batchUpdateExternalContactNotes({userIds:this.ids,notes:this.notesOpen.notes,type:this.notesOpen.type,nameType:this.notesOpen.nameType}).then(res => {
  1667. this.resultMessage = res.msg;
  1668. this.resultDialogVisible = true; // 显示弹窗
  1669. this.resultTitle = '批量修改备注结果';
  1670. }).finally(res=>{
  1671. this.getList();
  1672. loadingRock.close();
  1673. this.notesCancel();
  1674. })
  1675. },
  1676. //确定选择标签
  1677. tagSubmitForm(type){
  1678. if (type==1) {
  1679. for (let i = 0; i < this.tagGroupList.length; i++) {
  1680. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1681. if (this.tagGroupList[i].tag[x].isSelected === true) {
  1682. if (!this.selectTags) {
  1683. this.selectTags = [];
  1684. }
  1685. // 检查当前 tag 是否已经存在于 tagListFormIndex[index] 中
  1686. let tagExists = this.selectTags.some(
  1687. tag => tag.id === this.tagGroupList[i].tag[x].id
  1688. );
  1689. // 如果 tag 不存在于 tagListFormIndex[index] 中,则新增
  1690. if (!tagExists) {
  1691. this.selectTags.push(this.tagGroupList[i].tag[x]);
  1692. }
  1693. }
  1694. }
  1695. }
  1696. if (!this.selectTags || this.selectTags.length === 0) {
  1697. return this.$message('请选择标签');
  1698. }
  1699. }else if (type == 2) {
  1700. for (let i = 0; i < this.tagGroupList.length; i++) {
  1701. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1702. if (this.tagGroupList[i].tag[x].isSelected === true) {
  1703. if (!this.outSelectTags) {
  1704. this.outSelectTags = [];
  1705. }
  1706. // 检查当前 tag 是否已经存在于 tagListFormIndex[index] 中
  1707. let tagExists = this.outSelectTags.some(
  1708. tag => tag.id === this.tagGroupList[i].tag[x].id
  1709. );
  1710. // 如果 tag 不存在于 tagListFormIndex[index] 中,则新增
  1711. if (!tagExists) {
  1712. this.outSelectTags.push(this.tagGroupList[i].tag[x]);
  1713. }
  1714. }
  1715. }
  1716. }
  1717. if (!this.outSelectTags || this.outSelectTags.length === 0) {
  1718. return this.$message('请选择标签');
  1719. }
  1720. }
  1721. this.changeTagDialog.open = false;
  1722. },
  1723. //取消选择标签
  1724. tagCancel(){
  1725. this.changeTagDialog.open = false;
  1726. },
  1727. //取消备注
  1728. notesCancel(){
  1729. this.notesOpen={
  1730. open: false,
  1731. notes: null,
  1732. type: 1,
  1733. nameType:3,
  1734. }
  1735. },
  1736. resetSearchQueryTag(){
  1737. this.queryTagParams= {
  1738. pageNum: 1,
  1739. pageSize: 10,
  1740. total:0,
  1741. name:null,
  1742. };
  1743. },
  1744. /** 重置按钮操作 */
  1745. resetQuery() {
  1746. this.resetForm("queryForm");
  1747. this.queryParams.corpId= this.myQwCompanyList[0].dictValue;
  1748. this.queryParams.transferStatus = null;
  1749. this.selectTags=[];
  1750. this.outSelectTags=[];
  1751. this.createTime=null;
  1752. this.queryParams.sTime=null;
  1753. this.queryParams.eTime=null;
  1754. this.handleQuery();
  1755. },
  1756. // 多选框选中数据
  1757. handleSelectionChange(selection) {
  1758. this.ids = selection.map(item => item.id)
  1759. this.single = selection.length!==1
  1760. this.multiple = !selection.length
  1761. },
  1762. /** 新增按钮操作 */
  1763. handleAdd() {
  1764. this.loading=true;
  1765. this.form.corpId=this.queryParams.corpId
  1766. addExternalContact(this.form).then(response => {
  1767. this.msgSuccess("同步成功");
  1768. this.getList();
  1769. }).finally(()=>{
  1770. this.loading=false;
  1771. });
  1772. },
  1773. /** 修改按钮操作 */
  1774. handleUpdate(row) {
  1775. this.reset();
  1776. const id = row.id || this.ids
  1777. getExternalContact(id).then(response => {
  1778. this.form = response.data;
  1779. if(this.form.remarkMobiles!=null){
  1780. this.remarkMobiles=JSON.parse(this.form.remarkMobiles)
  1781. }else{
  1782. this.remarkMobiles=[]
  1783. }
  1784. this.open = true;
  1785. this.title = "修改企业微信客户";
  1786. });
  1787. },
  1788. handleAppellation(val){
  1789. this.callOpen.open=true;
  1790. this.callOpenFrom.stageStatus=val.stageStatus;
  1791. this.callOpenFrom.id=val.id;
  1792. },
  1793. /** 绑定客户操作 */
  1794. handleUpdateCustomer(row){
  1795. this.bindCustomer.title="绑定客户"
  1796. this.bindCustomer.open=true;
  1797. this.form.id=row.id
  1798. this.form.externalUserId=row.externalUserId
  1799. this.form.name=row.name
  1800. },
  1801. handleUpdateUser(row){
  1802. this.user.title="绑定客户"
  1803. this.user.open=true;
  1804. this.userForm.id=row.id;
  1805. },
  1806. handleUnBindUserId(val){
  1807. this.$confirm(
  1808. '确认解绑客户:<span style="color: green;">' + val.name + '' +
  1809. '</span> 的小程序用户?<br><span style="color: red;">【ps:可能会导致客户无法看课】</span>',
  1810. {
  1811. confirmButtonText: "确定",
  1812. cancelButtonText: "取消",
  1813. type: "warning",
  1814. dangerouslyUseHTMLString: true // 允许使用 HTML 字符串
  1815. }
  1816. ).then(() => {
  1817. return unBindUserId(val.id);
  1818. }).then(response => {
  1819. this.getList();
  1820. this.msgSuccess("解绑成功");
  1821. }).finally(res=>{
  1822. this.getList();
  1823. })
  1824. },
  1825. bindCustomerId(row){
  1826. console.log("row",row)
  1827. // this.qwFormCustomer.customerId=row;
  1828. this.form.customerId=row;
  1829. this.form.corpId=this.queryParams.corpId;
  1830. this.msgWarning("绑定中.....同步信息中.....");
  1831. editbindCustomer(this.form).then(res=>{
  1832. //清空表单
  1833. this.reset();
  1834. this.bindCustomer.open = false;
  1835. this.msgSuccess("绑定成功");
  1836. this.getList();
  1837. })
  1838. },
  1839. //设置一个SOP
  1840. setCourseSOP(row) {
  1841. // 检查 row.miniUserId 是否为 null
  1842. if (row.miniUserId === null || row.miniUserId === undefined) {
  1843. return this.$confirm('当前客户【CRM客户详情】中 未绑定小程序客户,请先绑定', "警告", {
  1844. confirmButtonText: "确定",
  1845. cancelButtonText: "取消",
  1846. type: "warning"
  1847. }).catch(error => {
  1848. this.msgWarning("操作取消:", error);
  1849. });
  1850. } else {
  1851. this.chooseCustomerSOP = row;
  1852. this.setSop.open = true;
  1853. this.setSop.type=1;
  1854. }
  1855. },
  1856. //选择课程SOP
  1857. // 用于设置 customerCourseForm 和 customerCourseFormLogs 的共同属性
  1858. setCommonProperties(form, row) {
  1859. form.qwUserid = this.chooseCustomerSOP.userId;
  1860. form.companyUserId = this.chooseCustomerSOP.companyUserId;
  1861. form.externalUserId = this.chooseCustomerSOP.externalUserId;
  1862. form.customerId = this.chooseCustomerSOP.customerId;
  1863. form.miniUserId = this.chooseCustomerSOP.miniUserId;
  1864. form.businessId = row.businessId;
  1865. },
  1866. bindCourseSop(row,days) {
  1867. if (this.setSop.type==2){
  1868. this.setSop.open = false;
  1869. this.loading=true;
  1870. this.msgWarning("设定中.....同步信息中.....");
  1871. setCustomerCourseSopList({ids:this.ids,fsCourseSopId:row.id,days:days}).then(res=>{
  1872. let msg=" 批量设置成功数【" + res.successNum + "】,<br>"
  1873. if (res.failCRM.length>0){
  1874. msg+="失败的客户【" + res.failCRM + "】,原因是未绑定CRM客户。<br>"
  1875. }
  1876. if (res.failMiNi.length>0){
  1877. msg+="失败的客户【" + res.failMiNi + "】,原因是CRM中未绑定小程序客户。<br>"
  1878. }
  1879. if (res.failCompany.length>0){
  1880. msg+="失败的客户【" + res.failCompany + "】,原因是客户没有所属成员。<br>"
  1881. }
  1882. return this.$confirm(msg, "提示", {
  1883. confirmButtonText: "确定",
  1884. cancelButtonText: "取消",
  1885. type: "warning",
  1886. dangerouslyUseHTMLString: true // 允许使用HTML标签
  1887. }).catch(error => {
  1888. this.msgSuccess("操作完成~");
  1889. });
  1890. }).finally(()=>{
  1891. this.loading = false;
  1892. this.getList();
  1893. })
  1894. }else if (this.setSop.type==1){
  1895. // 设置 customerCourseFormLogs 的属性
  1896. this.setCommonProperties(this.customerCourseFormLogs, row);
  1897. // 设置 customerCourseForm 的属性
  1898. this.setCommonProperties(this.customerCourseForm, row);
  1899. this.customerCourseForm.sopId = row.id;
  1900. this.customerCourseForm.sopType = row.sopType;
  1901. this.customerCourseForm.setting = row.setting;
  1902. this.customerCourseForm.days = days;
  1903. // 执行异步操作
  1904. getCustomerCourseSop(this.customerCourseFormLogs)
  1905. .then(res => {
  1906. if (res) {
  1907. return this.$confirm('当前客户已设置过相同课程课节SOP,确定还要再次设置吗?', "警告", {
  1908. confirmButtonText: "确定",
  1909. cancelButtonText: "取消",
  1910. type: "warning"
  1911. });
  1912. } else {
  1913. return Promise.resolve(); // 如果没有设置过,直接执行后续操作
  1914. }
  1915. })
  1916. .then(() => {
  1917. this.loading = true;
  1918. this.setSop.open = false;
  1919. this.msgSuccess("设定中.....同步信息中.....");
  1920. return setCustomerCourseSop(this.customerCourseForm);
  1921. })
  1922. .then(() => {
  1923. this.msgSuccess("设定成功");
  1924. })
  1925. .catch(error => {
  1926. this.msgWarning("操作取消:", error);
  1927. })
  1928. .finally(() => {
  1929. this.loading = false;
  1930. this.getList();
  1931. });
  1932. }
  1933. },
  1934. submitCallOpenFrom(){
  1935. this.$refs["callOpenFrom"].validate(valid => {
  1936. if (valid) {
  1937. if (this.callOpenFrom.id != null && this.callOpenFrom.stageStatus != null) {
  1938. updateExternalContactCall(this.callOpenFrom).then(res=>{
  1939. this.$message.success('修改成功');
  1940. this.callOpen.open=false;
  1941. this.getList();
  1942. });
  1943. }
  1944. }
  1945. });
  1946. },
  1947. /** 提交按钮 */
  1948. submitForm() {
  1949. this.$refs["form"].validate(valid => {
  1950. if (valid) {
  1951. if (this.form.id != null) {
  1952. this.form.remarkMobiles=JSON.stringify(this.remarkMobiles)
  1953. updateExternalContact(this.form).then(response => {
  1954. this.msgSuccess("修改成功");
  1955. this.open = false;
  1956. this.getList();
  1957. });
  1958. } else {
  1959. addExternalContact(this.form).then(response => {
  1960. this.msgSuccess("新增成功");
  1961. this.open = false;
  1962. this.getList();
  1963. });
  1964. }
  1965. }
  1966. });
  1967. },
  1968. /** 删除按钮操作 */
  1969. handleDelete(row) {
  1970. const ids = row.id || this.ids;
  1971. this.$confirm('是否确认删除企业微信客户编号为"' + ids + '"的数据项?', "警告", {
  1972. confirmButtonText: "确定",
  1973. cancelButtonText: "取消",
  1974. type: "warning"
  1975. }).then(function() {
  1976. return delExternalContact(ids);
  1977. }).then(() => {
  1978. this.getList();
  1979. this.msgSuccess("删除成功");
  1980. }).catch(() => {});
  1981. },
  1982. updateTalk(row){
  1983. const ids = row.id || this.ids;
  1984. this.$confirm('是否确认批量更改用户信息为非首次交流', "警告", {
  1985. confirmButtonText: "确定",
  1986. cancelButtonText: "取消",
  1987. type: "warning"
  1988. }).then(function() {
  1989. return editTalk(ids);
  1990. }).then(() => {
  1991. this.getList();
  1992. this.msgSuccess("成功");
  1993. }).catch(() => {});
  1994. },
  1995. /** 导出按钮操作 */
  1996. handleExport() {
  1997. const queryParams = this.queryParams;
  1998. this.$confirm('是否确认导出所有企业微信客户数据项?', "警告", {
  1999. confirmButtonText: "确定",
  2000. cancelButtonText: "取消",
  2001. type: "warning"
  2002. }).then(() => {
  2003. this.exportLoading = true;
  2004. return exportExternalContact(queryParams);
  2005. }).then(response => {
  2006. this.download(response.msg);
  2007. this.exportLoading = false;
  2008. }).catch(() => {});
  2009. },
  2010. openRepeat(row){
  2011. this.repeat.param = {
  2012. externalUserId: row.externalUserId,
  2013. corpId: row.corpId,
  2014. userId: row.userId,
  2015. };
  2016. getRepeat(this.repeat.param).then(e => {
  2017. this.repeat.open = true;
  2018. this.repeat.loading = false;
  2019. this.repeat.list = e.data;
  2020. })
  2021. },
  2022. }
  2023. };
  2024. </script>
  2025. <style scoped>
  2026. /* CSS 样式 */
  2027. .tag-container {
  2028. display: flex;
  2029. flex-wrap: wrap; /* 超出宽度时自动换行 */
  2030. gap: 8px; /* 设置标签之间的间距 */
  2031. }
  2032. .name-background {
  2033. display: inline-block;
  2034. background-color: #abece6; /* 背景颜色 */
  2035. padding: 4px 8px; /* 调整内边距,让背景包裹文字 */
  2036. border-radius: 4px; /* 可选:设置圆角 */
  2037. }
  2038. /* CSS 样式 */
  2039. .tag-container {
  2040. display: flex;
  2041. flex-wrap: wrap; /* 超出宽度时自动换行 */
  2042. gap: 8px; /* 设置标签之间的间距 */
  2043. }
  2044. .name-background {
  2045. display: inline-block;
  2046. background-color: #abece6; /* 背景颜色 */
  2047. padding: 4px 8px; /* 调整内边距,让背景包裹文字 */
  2048. border-radius: 4px; /* 可选:设置圆角 */
  2049. }
  2050. .tag-box {
  2051. padding: 8px 12px;
  2052. border: 1px solid #989797;
  2053. border-radius: 4px;
  2054. cursor: pointer;
  2055. display: inline-block;
  2056. }
  2057. .tag-selected {
  2058. background-color: #00bc98;
  2059. color: #fff;
  2060. border-color: #00bc98;
  2061. }
  2062. .el-tag + .el-tag {
  2063. margin-left: 10px;
  2064. }
  2065. .suggestion-box {
  2066. position: absolute;
  2067. z-index: 999;
  2068. background: #fff;
  2069. border: 1px solid #ddd;
  2070. max-height: 200px;
  2071. overflow-y: auto;
  2072. width: 100%;
  2073. }
  2074. .suggestion-item {
  2075. padding: 10px;
  2076. cursor: pointer;
  2077. }
  2078. .suggestion-item:hover {
  2079. background-color: #f5f7fa;
  2080. }
  2081. .button-new-tag {
  2082. margin-left: 10px;
  2083. height: 32px;
  2084. line-height: 30px;
  2085. padding-top: 0;
  2086. padding-bottom: 0;
  2087. }
  2088. .input-new-tag {
  2089. width: 90px;
  2090. margin-left: 10px;
  2091. vertical-align: bottom;
  2092. }
  2093. .feedback-dialog {
  2094. width: 100%;
  2095. max-width: 1000px;
  2096. max-height: 80vh; /* 限制最大高度为视窗高度的 80% */
  2097. overflow-y: auto; /* 超出时显示垂直滚动条 */
  2098. padding: 20px;
  2099. box-sizing: border-box; /* 确保 padding 不影响总宽度 */
  2100. }
  2101. /* 新增的滚动容器样式(不影响原有样式) */
  2102. .scroll-wrapper {
  2103. max-height: 130px; /* 大约三行的高度 */
  2104. overflow-y: auto; /* 垂直滚动 */
  2105. padding-right: 5px; /* 为滚动条留出空间 */
  2106. }
  2107. /* 美化滚动条(可选) */
  2108. .scroll-wrapper::-webkit-scrollbar {
  2109. width: 6px;
  2110. }
  2111. .scroll-wrapper::-webkit-scrollbar-thumb {
  2112. background: rgba(0, 0, 0, 0.2);
  2113. border-radius: 3px;
  2114. }
  2115. .tag-container {
  2116. max-height: 200px;
  2117. overflow-y: auto;
  2118. padding: 1px;
  2119. border: 1px solid #ebeef5;
  2120. border-radius: 1px;
  2121. background-color: #fafafa;
  2122. }
  2123. .tag-list {
  2124. display: flex;
  2125. flex-wrap: wrap;
  2126. gap: 8px;
  2127. }
  2128. .scroll-hint {
  2129. text-align: center;
  2130. color: #909399;
  2131. font-size: 12px;
  2132. padding: 1px 0;
  2133. }
  2134. .container {
  2135. max-width: 800px;
  2136. margin: 0 auto;
  2137. padding: 10px;
  2138. }
  2139. .title {
  2140. text-align: center;
  2141. color: #303133;
  2142. margin-bottom: 30px;
  2143. }
  2144. .demo-table {
  2145. width: 100%;
  2146. margin-bottom: 30px;
  2147. }
  2148. .instructions {
  2149. background-color: #f5f7fa;
  2150. padding: 15px;
  2151. border-radius: 1px;
  2152. margin-bottom: 20px;
  2153. }
  2154. </style>