deptIndex.vue 70 KB

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