index.vue 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352
  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="qwUserId">
  15. <el-input
  16. v-model="queryParams.qwUserId"
  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. />
  31. </el-form-item>
  32. <el-form-item label="授权码" prop="appKey">
  33. <el-input
  34. v-model="queryParams.appKey"
  35. placeholder="请输入授权码"
  36. clearable
  37. size="small"
  38. @keyup.enter.native="handleQuery"
  39. />
  40. </el-form-item>
  41. <el-form-item label="员工状态" prop="isDel">
  42. <el-select v-model="queryParams.isDel" placeholder="请选择员工状态" clearable>
  43. <el-option
  44. v-for="item in optionsStatus"
  45. :key="item.value"
  46. :label="item.label"
  47. :value="item.value">
  48. </el-option>
  49. </el-select>
  50. </el-form-item>
  51. <el-form-item>
  52. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  53. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  54. </el-form-item>
  55. </el-form>
  56. <el-row :gutter="10" class="mb8">
  57. <el-col :span="1.5">
  58. <el-button
  59. type="primary"
  60. :disabled="multiple"
  61. plain
  62. icon="el-icon-edit"
  63. size="mini"
  64. @click="updateSendType"
  65. >修改发送方式
  66. </el-button>
  67. </el-col>
  68. <el-col :span="1.5">
  69. <el-button
  70. type="warning"
  71. plain
  72. icon="el-icon-download"
  73. size="mini"
  74. :loading="exportLoading"
  75. @click="handleExport"
  76. v-hasPermi="['qw:user:export']"
  77. >导出</el-button>
  78. </el-col>
  79. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  80. </el-row>
  81. <el-table border v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
  82. <el-table-column type="selection" width="55" align="center" />
  83. <el-table-column label="企微成员ID" align="center" prop="id" />
  84. <el-table-column label="企微账号" align="center" prop="qwUserId" />
  85. <el-table-column label="企微昵称" align="center" prop="qwUserName" />
  86. <el-table-column label="员工称呼" align="center" prop="welcomeText" />
  87. <el-table-column label="所属部门" align="center" prop="isDel">
  88. <template slot-scope="scope">
  89. <el-tag v-if="scope.row.isDel == 0" type="success">正常</el-tag>
  90. <el-tag v-else type="error">离职</el-tag>
  91. </template>
  92. </el-table-column>
  93. <el-table-column label="联系我二维码" align="center" prop="contactWay" >
  94. <template slot-scope="scope">
  95. <el-image
  96. v-if="scope.row.contactWay!=null"
  97. style="width: 100px; height: 100px"
  98. :src="scope.row.contactWay"
  99. fit="contain"
  100. @click="openImageViewer(scope.row.contactWay)"/>
  101. </template>
  102. </el-table-column>
  103. <el-table-column label="绑定的AI客服" align="center" prop="fastGptRoleName" />
  104. <el-table-column label="授权码" align="center" prop="appKey" />
  105. <el-table-column label="发送方式" align="center" prop="sendMsgType">
  106. <template slot-scope="scope">
  107. <el-tag v-if="scope.row.sendMsgType == 0">方式一</el-tag>
  108. <el-tag v-if="scope.row.sendMsgType == 1" type="success">方式二</el-tag>
  109. <el-tag v-if="scope.row.sendMsgType == 2" type="warning">掉线通知</el-tag>
  110. </template>
  111. </el-table-column>
  112. <el-table-column label="vid" align="center" prop="vid" />
  113. <el-table-column label="uid" align="center" prop="uid" />
  114. <el-table-column label="serverId" align="center" prop="serverId" />
  115. <el-table-column label="ai状态" align="center" prop="loginStatus">
  116. <template slot-scope="scope">
  117. <el-tag v-if="scope.row.ipadStatus == 1" type="success">在线</el-tag>
  118. <el-tag v-else type="danger">离线</el-tag>
  119. </template>
  120. </el-table-column>
  121. <!-- <el-table-column label="插件状态" align="center" prop="toolStatus">-->
  122. <!-- <template slot-scope="scope">-->
  123. <!-- <el-tag v-if="scope.row.toolStatus == 1" type="success">在线</el-tag>-->
  124. <!-- <el-tag v-else type="danger">离线</el-tag>-->
  125. <!-- </template>-->
  126. <!-- </el-table-column>-->
  127. <!-- <el-table-column label="插件版本" align="center" prop="version"/>-->
  128. <el-table-column label="服务器地址" align="center" prop="loginCodeUrl">
  129. <template slot-scope="scope">
  130. <el-tooltip class="item" effect="dark" :content="scope.row.loginCodeUrl" placement="top">
  131. <div style="display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; text-overflow: ellipsis;">
  132. <span>{{ scope.row.loginCodeUrl }}</span>
  133. </div>
  134. </el-tooltip>
  135. </template>
  136. </el-table-column>
  137. <el-table-column label="自动发课" align="center" prop="isAuto">
  138. <template slot-scope="scope">
  139. <dict-tag :options="isAutoOptions" :value="scope.row.isAuto"/>
  140. </template>
  141. </el-table-column>
  142. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120px" fixed="right">
  143. <template slot-scope="scope">
  144. <el-button
  145. size="mini"
  146. type="text"
  147. icon="el-icon-user-solid"
  148. plain
  149. @click="handleAppellation(scope.row)"
  150. >
  151. 修改员工称呼
  152. </el-button>
  153. <el-button
  154. size="mini"
  155. type="text"
  156. icon="el-icon-user-solid"
  157. plain
  158. @click="handleAutoRemark(scope.row)"
  159. >
  160. 完课备注修改
  161. </el-button>
  162. <el-button
  163. v-if="scope.row.serverStatus==1&&scope.row.ipadStatus!=1"
  164. size="mini"
  165. type="text"
  166. icon="el-icon-sunny"
  167. plain
  168. @click="handleLoginQwCode(scope.row)"
  169. v-hasPermi="['qw:user:login']"
  170. >
  171. 登录企微
  172. </el-button>
  173. <el-button
  174. v-if="scope.row.serverStatus==1&&scope.row.ipadStatus==1"
  175. size="mini"
  176. type="text"
  177. icon="el-icon-moon"
  178. plain
  179. @click="handleLoginOutQwStatus(scope.row)"
  180. v-hasPermi="['qw:user:login']"
  181. >
  182. 退出企微
  183. </el-button>
  184. <el-button
  185. v-if="scope.row.ipadStatus==1"
  186. size="mini"
  187. type="text"
  188. icon="el-icon-moon"
  189. plain
  190. @click="handleTwoCode(scope.row)"
  191. v-hasPermi="['qw:user:login']">
  192. 二次验证
  193. </el-button>
  194. <el-button
  195. v-if="scope.row.serverStatus!=1"
  196. size="mini"
  197. type="text"
  198. icon="el-icon-moon"
  199. plain
  200. @click="handleGetQwIpad(scope.row)"
  201. v-hasPermi="['qw:user:login']"
  202. >
  203. 获取Ai主机
  204. </el-button>
  205. <el-button
  206. v-if="scope.row.serverStatus==1 && scope.row.ipadStatus!=1"
  207. size="mini"
  208. type="text"
  209. icon="el-icon-moon"
  210. plain
  211. @click="handleDelQwIpad(scope.row)"
  212. v-hasPermi="['qw:user:login']"
  213. >
  214. 解绑Ai主机
  215. </el-button>
  216. <el-button
  217. v-if="scope.row.isAuto=='00'"
  218. size="mini"
  219. type="text"
  220. icon="el-icon-moon"
  221. plain
  222. @click="handleUpdateIsAuto(scope.row,'01')"
  223. v-hasPermi="['qw:user:isauto']"
  224. >
  225. 启用插件
  226. </el-button>
  227. <el-button
  228. v-if="scope.row.isAuto=='01'"
  229. size="mini"
  230. type="text"
  231. icon="el-icon-moon"
  232. plain
  233. @click="handleUpdateIsAuto(scope.row,'00')"
  234. v-hasPermi="['qw:user:isauto']"
  235. >
  236. 禁用插件
  237. </el-button>
  238. </template>
  239. </el-table-column>
  240. <el-table-column label="主机" align="center" class-name="small-padding fixed-width" width="110px" fixed="right">
  241. <template slot-scope="scope">
  242. <el-button
  243. v-if="scope.row.appKey==null"
  244. size="mini"
  245. type="text"
  246. icon="el-icon-s-check"
  247. plain
  248. v-hasPermi="['qw:user:authAppKey']"
  249. @click="uploadAuthorizeKey2(scope.row)"
  250. >授权key
  251. </el-button>
  252. <el-button
  253. v-if="scope.row.loginCodeUrl==null && scope.row.appKey !=null"
  254. size="mini"
  255. type="text"
  256. icon="el-icon-sunny"
  257. plain
  258. @click="handleBindCloudHost(scope.row)"
  259. v-hasPermi="['qw:user:loginIp']"
  260. >
  261. 绑定主机
  262. </el-button>
  263. <!-- <el-button-->
  264. <!-- v-if="scope.row.loginCodeUrl!=null"-->
  265. <!-- size="mini"-->
  266. <!-- type="text"-->
  267. <!-- icon="el-icon-video-camera-solid"-->
  268. <!-- plain-->
  269. <!-- @click="handleCloudAP(scope.row.loginCodeUrl)"-->
  270. <!-- v-hasPermi="['qw:user:cloudAP']"-->
  271. <!-- >-->
  272. <!-- 获取主机帐密-->
  273. <!-- </el-button>-->
  274. <el-button
  275. v-if="scope.row.loginCodeUrl!=null"
  276. size="mini"
  277. type="text"
  278. icon="el-icon-moon"
  279. plain
  280. @click="handleUnbindCloudHost(scope.row)"
  281. v-hasPermi="['qw:user:loginIpOut']"
  282. >
  283. 解除主机
  284. </el-button>
  285. <el-button
  286. size="mini"
  287. type="text"
  288. :icon="scope.row.videoGetStatus == 0 ? 'el-icon-circle-check' : 'el-icon-remove-outline'"
  289. plain
  290. @click="changeVideoStatus(scope.row)"
  291. >
  292. {{ scope.row.videoGetStatus == 0 ? "开启" : "禁用" }}视频号接收
  293. </el-button>
  294. </template>
  295. </el-table-column>
  296. <el-table-column label="AI客服" align="center" class-name="small-padding fixed-width" width="100px" fixed="right">
  297. <template slot-scope="scope">
  298. <el-button
  299. size="mini"
  300. type="text"
  301. icon="el-icon-connection"
  302. plain
  303. v-if="scope.row.fastGptRoleName!=null"
  304. @click="bindFastGptRole(scope.row)"
  305. >换绑AI客服</el-button>
  306. <el-button
  307. size="mini"
  308. type="text"
  309. plain
  310. icon="el-icon-link"
  311. v-else
  312. @click="bindFastGptRole(scope.row)"
  313. >绑定AI客服</el-button>
  314. <el-button
  315. size="mini"
  316. type="text"
  317. icon="el-icon-unlock"
  318. plain
  319. v-if="scope.row.fastGptRoleName!=null"
  320. @click="relieveFastGptRole(scope.row)"
  321. >解绑AI客服</el-button>
  322. </template>
  323. </el-table-column>
  324. <el-table-column label="医生" align="center" class-name="small-padding fixed-width" width="100px" fixed="right">
  325. <template slot-scope="scope">
  326. <el-button
  327. size="mini"
  328. type="text"
  329. icon="el-icon-connection"
  330. plain
  331. v-if="scope.row.doctorId!=null"
  332. @click="handleUpdateDoctor(scope.row)"
  333. >换绑医生</el-button>
  334. <el-button
  335. size="mini"
  336. type="text"
  337. plain
  338. icon="el-icon-link"
  339. v-else
  340. @click="handleUpdateDoctor(scope.row)"
  341. >绑定医生</el-button>
  342. <el-button
  343. size="mini"
  344. type="text"
  345. icon="el-icon-unlock"
  346. plain
  347. v-if="scope.row.doctorId!=null"
  348. @click="handleUnBindUserId(scope.row)"
  349. >解绑医生</el-button>
  350. </template>
  351. </el-table-column>
  352. </el-table>
  353. <pagination
  354. v-show="total>0"
  355. :total="total"
  356. :page.sync="queryParams.pageNum"
  357. :limit.sync="queryParams.pageSize"
  358. @pagination="getList"
  359. />
  360. <!-- 绑定AI客服-->
  361. <el-dialog :title="bindAiTitle" :visible.sync="bindAiOpen" width="1200px" append-to-body>
  362. <fast-gpt-role ref="fastGptRole" @refreshFastGptList="refreshFastGptList" ></fast-gpt-role>
  363. </el-dialog>
  364. <!-- <el-dialog :visible.sync="updateIp.open" width="600px" append-to-body>-->
  365. <!-- <el-form ref="updateIpForm" :model="updateIpForm" :rules="updateIpRule" label-width="100px">-->
  366. <!-- <el-form-item label="新云主机IP" prop="Ip">-->
  367. <!-- <el-input v-model="updateIpForm.newIp" placeholder="请输入新IP" />-->
  368. <!-- </el-form-item>-->
  369. <!-- </el-form>-->
  370. <!-- <div slot="footer" class="dialog-footer" >-->
  371. <!-- <el-button type="primary" @click="submitUpdateIpForm">确 定</el-button>-->
  372. <!-- </div>-->
  373. <!-- </el-dialog>-->
  374. <el-dialog title="云主机信息" :visible.sync="cloudAPOpen.open" append-to-body>
  375. <el-card class="box-card">
  376. <div slot="header" class="clearfix">
  377. <span>账号:{{cloudAPOpen.admin}}</span>
  378. </div>
  379. <div slot="header" class="clearfix">
  380. <span>密码:{{cloudAPOpen.passWord}}</span>
  381. </div>
  382. </el-card>
  383. </el-dialog>
  384. <el-dialog :title="callOpen.title" :visible.sync="callOpen.open" width="500px" append-to-body>
  385. <el-form ref="callOpenFrom" :model="callOpenFrom" :rules="callOpenRule" label-width="110px">
  386. <el-form-item label="员工称呼" prop="welcomeText">
  387. <el-input v-model="callOpenFrom.welcomeText" placeholder="请输入员工称呼" />
  388. </el-form-item>
  389. </el-form>
  390. <div slot="footer" class="dialog-footer" >
  391. <el-button type="primary" @click="submitCallOpenFrom">确 定</el-button>
  392. </div>
  393. </el-dialog>
  394. <el-dialog :title="editRemarkOpen.title" :visible.sync="editRemarkOpen.open" width="500px" append-to-body>
  395. <el-form ref="callOpenFrom" :model="editRemarkOpen" label-width="110px">
  396. <el-radio-group v-model="editRemarkOpen.isSendMsg">
  397. <el-card>
  398. <el-row :gutter="20">
  399. <el-col>
  400. <el-radio
  401. :label="1"
  402. style="font-size: 16px; margin: 10px 0;"
  403. >添加【完课备注】在最【旧备注-(前面)】</el-radio>
  404. </el-col>
  405. <el-col>
  406. <el-radio
  407. :label="2"
  408. style="font-size: 16px; margin: 10px 0;"
  409. >添加【完课备注】在最【旧备注-(后面)】</el-radio>
  410. </el-col>
  411. <el-col>
  412. <el-radio
  413. :label="3"
  414. style="font-size: 16px; margin: 10px 0;"
  415. >使用简洁版备注【*日期完】,在【旧备注-前面】</el-radio>
  416. </el-col>
  417. <el-col>
  418. <el-radio
  419. :label="4"
  420. style="font-size: 16px; margin: 10px 0;"
  421. >使用简洁版备注【*日期完】,在【旧备注-后面】</el-radio>
  422. </el-col>
  423. <el-col>
  424. <el-radio
  425. :label="5"
  426. style="font-size: 16px; margin: 10px 0;"
  427. >不用完课备注</el-radio>
  428. </el-col>
  429. </el-row>
  430. </el-card>
  431. </el-radio-group>
  432. </el-form>
  433. <div slot="footer" class="dialog-footer">
  434. <el-button type="primary" @click="submitEditRemarkOpenFrom">确 定</el-button>
  435. </div>
  436. </el-dialog>
  437. <el-dialog title="授权key" :visible.sync="authorizeKeyOpen" width="500px" append-to-body>
  438. <el-form ref="authorizeKeyFrom" :model="authorizeKeyFrom" :rules="authorizeKeyRule" label-width="110px">
  439. <el-form-item label="授权的key值" prop="appKey">
  440. <el-input v-model="authorizeKeyFrom.appKey" placeholder="请输入授权key" type="Number"/>
  441. </el-form-item>
  442. </el-form>
  443. <div slot="footer" class="dialog-footer" >
  444. <el-button type="primary" @click="submitAuthorizeKeyForm">确 定</el-button>
  445. </div>
  446. </el-dialog>
  447. <!--二维码 -->
  448. <el-dialog
  449. title="企微二次认证"
  450. :visible.sync="qwLoginTwo.open"
  451. width="600px"
  452. append-to-body
  453. custom-class="qr-login-dialog"
  454. >
  455. <div class="qr-login-container">
  456. <div class="image-wrapper" v-loading="imageLoading" >
  457. <el-image
  458. :src="'data:image/png;base64,' +qwLoginTwo.codeUrl"
  459. style="display: block; margin: 0 auto; width: 300px; height: 300px;"
  460. />
  461. </div>
  462. <p class="qr-login-instructions">二次验证二维码</p>
  463. </div>
  464. <div slot="footer" class="dialog-footer" >
  465. <el-button type="primary" @click="qwLoginTwo.open=false">确 定</el-button>
  466. </div>
  467. </el-dialog>
  468. <el-dialog
  469. :title="qwLogin.title"
  470. :visible.sync="qwLogin.open"
  471. width="600px"
  472. append-to-body
  473. custom-class="qr-login-dialog"
  474. >
  475. <div class="qr-login-container">
  476. <div class="image-wrapper" v-loading="imageLoading" >
  477. <el-image
  478. :src="'data:image/png;base64,' +qwLogin.codeUrl"
  479. style="display: block; margin: 0 auto; width: 300px; height: 300px;"
  480. />
  481. </div>
  482. <p class="qr-login-instructions">使用企业微信扫码授权登录</p>
  483. </div>
  484. </el-dialog>
  485. <el-dialog
  486. title="输入企微验证码"
  487. :visible.sync="qwCode.open"
  488. width="600px"
  489. append-to-body>
  490. <el-form :model="qwCode" label-width="80px" @submit.native.prevent="handleSubmit">
  491. <el-form-item label="验证码" prop="companyName">
  492. <el-input v-model="qwCode.code" placeholder="输入企微6位验证码" />
  493. </el-form-item>
  494. </el-form>
  495. <div slot="footer" class="dialog-footer">
  496. <el-button type="primary" @click="submitCodeForm">确 定</el-button>
  497. </div>
  498. </el-dialog>
  499. <!-- 大图预览对话框 -->
  500. <el-dialog
  501. :visible.sync="dialogVisible"
  502. :modal="false"
  503. width="1200"
  504. append-to-body>
  505. <img
  506. :src="this.dialogImageUrl"
  507. style="display: block; max-width: 100%; margin: 0 auto"
  508. />
  509. </el-dialog>
  510. <el-dialog
  511. :visible.sync="updateSendOpen"
  512. width="1000px"
  513. append-to-body>
  514. <el-form label-width="80px">
  515. <p>是否修改企微账号发送方式:
  516. <el-tag style="margin-left: 10px" v-for="name in names">{{ name }}</el-tag>
  517. </p>
  518. <el-form-item label="发送方式" prop="type">
  519. <el-radio-group v-model="type">
  520. <el-radio
  521. :label="0"
  522. >方式一
  523. </el-radio>
  524. <el-radio
  525. :label="1"
  526. >方式二
  527. </el-radio>
  528. <el-radio
  529. :label="2"
  530. >掉线通知
  531. </el-radio>
  532. </el-radio-group>
  533. </el-form-item>
  534. </el-form>
  535. <div slot="footer" class="dialog-footer">
  536. <el-button type="primary" @click="submitUpdateSendTypeForm">确 定</el-button>
  537. </div>
  538. </el-dialog>
  539. <el-dialog :title="doctor.title" :visible.sync="doctor.open" width="800px" append-to-body>
  540. <selectDoctor ref="selectDoctor" @bindCompanyUserDoctorId="bindCompanyUserDoctorId"></selectDoctor>
  541. </el-dialog>
  542. </div>
  543. </template>
  544. <script>
  545. import {
  546. updateIsAuto,
  547. updateUser,
  548. exportUser,
  549. getMyQwCompanyList,
  550. relieveFastGptRoleById,
  551. loginQwIpad,
  552. loginQwCodeMsg,
  553. twoCode,
  554. twoCodeStatus,
  555. qrCodeStatus,
  556. updateSendType,
  557. getQwIpad,
  558. delQwIpad,
  559. qrCodeVerify,
  560. outLoginQwIpad,
  561. changeVideoStatus,
  562. handleAllocateRemoteHost,
  563. qwBindCloudHost, qwUnbindCloudHost, handleAuthAppKey, handleInputAuthAppKey, selectCloudAP, staffListUser
  564. } from '../../../api/qw/user'
  565. import fastGptRole from "@/views/fastGpt/fastGptRole/fastGptRole";
  566. import selectDoctor from "@/views/qw/user/selectDoctor.vue";
  567. import {
  568. bindDoctorId,
  569. unBindDoctorId
  570. } from '@/api/company/companyUser'
  571. export default {
  572. name: "cuDeptIdIndex",
  573. components: { fastGptRole, selectDoctor},
  574. data() {
  575. return {
  576. isAutoOptions:[],
  577. doctor: {
  578. open: false,
  579. title: '绑定医生'
  580. },
  581. doctorForm: {
  582. userId: null,
  583. doctorId: null
  584. },
  585. updateIp:{
  586. open:false,
  587. title: "修改云主机IP"
  588. },
  589. updateIpForm:{
  590. id:null,
  591. newIp:null,
  592. },
  593. authorizeKeyOpen:false,
  594. authorizeKeyFrom:{
  595. id:null,
  596. appKey:null,
  597. qwUserId:null,
  598. qwUserName:null
  599. },
  600. updateIpRule:{},
  601. newIp:null,
  602. //放大图片
  603. dialogImageUrl:null,
  604. dialogVisible:false,
  605. optionsStatus: [{
  606. value: 0,
  607. label: '正常'
  608. }, {
  609. value: 2,
  610. label: '离职'
  611. }],
  612. // 遮罩层
  613. loading: true,
  614. names: [],
  615. // 导出遮罩层
  616. exportLoading: false,
  617. // 选中数组
  618. ids: [],
  619. // 非单个禁用
  620. single: true,
  621. // 非多个禁用
  622. multiple: true,
  623. // 显示搜索条件
  624. showSearch: true,
  625. updateSendOpen: false,
  626. // 总条数
  627. total: 0,
  628. //公司列表
  629. myQwCompanyList:[],
  630. // 企微用户表格数据
  631. userList: [],
  632. allowSelectOptions:[],
  633. // 弹出层标题
  634. bindAiTitle: "",
  635. bindAiOpen: false,
  636. qwLogin:{
  637. title:"",
  638. open:false,
  639. codeUrl:null,
  640. code:null,
  641. appKey:null,
  642. },
  643. qwLoginTwo:{
  644. title:"",
  645. open:false,
  646. codeUrl:null,
  647. code:null,
  648. appKey:null,
  649. },
  650. qwCode:{
  651. title:"",
  652. open:false,
  653. code:null,
  654. },
  655. cloudAPOpen:{
  656. open:false,
  657. admin:null,
  658. passWord:null,
  659. },
  660. callOpen:{
  661. open:false,
  662. title: '修改员工称呼',
  663. },
  664. callOpenFrom:{
  665. id:null,
  666. welcomeText:null,
  667. },
  668. isAutoForm:{
  669. id:null,
  670. isAuto:null,
  671. },
  672. editRemarkOpen: {
  673. open: false,
  674. title: '修改员工自动给完课客户打备注的规则',
  675. id:null,
  676. isSendMsg:null,
  677. },
  678. twoCodeInterval:null,
  679. type: 0,
  680. loginQwInterval:null,
  681. imageLoading: true, // 控制加载状态
  682. // 查询参数
  683. queryParams: {
  684. pageNum: 1,
  685. pageSize: 10,
  686. qwUserId: null,
  687. corpId: null,
  688. qwUserName: null,
  689. },
  690. qwUserId:null,
  691. companyUserList:[],
  692. // 表单参数
  693. form: {
  694. isSendMsg: '2',
  695. },
  696. authorizeKeyRule:{
  697. appKey:[{required:true,message:"授权码不能为空",trigger:"blur"}]
  698. },
  699. callOpenRule:{
  700. welcomeText:[{required:true,message:"员工称呼不能为空",trigger:"blur"}]
  701. },
  702. // 表单校验
  703. rules: {
  704. },
  705. //欢迎语表单校验
  706. weclomeRules:{
  707. welcomeText:[{required:true,message:"消息文本不能为空",trigger:"blur"}]
  708. },
  709. };
  710. },
  711. created() {
  712. this.getDicts("qw_user_is_auto").then(response => {
  713. this.isAutoOptions = response.data;
  714. });
  715. getMyQwCompanyList().then(response => {
  716. this.myQwCompanyList = response.data;
  717. if(this.myQwCompanyList!=null){
  718. this.queryParams.corpId=this.myQwCompanyList[0].dictValue;
  719. this.getList();
  720. }
  721. });
  722. },
  723. watch: {
  724. // 监听弹窗的可见性变化
  725. 'qwLogin.open'(newVal) {
  726. if (!newVal) {
  727. // 如果弹窗关闭,清除定时器
  728. clearInterval(this.loginQwInterval);
  729. }
  730. },
  731. },
  732. methods: {
  733. getList() {
  734. this.loading = true;
  735. staffListUser(this.queryParams).then(response => {
  736. this.userList = response.rows;
  737. this.total = response.total;
  738. this.loading = false;
  739. });
  740. },
  741. updateCorpId() {
  742. this.reset();
  743. this.getList();
  744. },
  745. changeVideoStatus(val){
  746. changeVideoStatus(val.id).then(res => {
  747. this.$message.success("修改状态成功");
  748. this.getList()
  749. })
  750. },
  751. //绑定AI客服
  752. bindFastGptRole(row) {
  753. this.bindAiTitle = "绑定AI客服";
  754. this.bindAiOpen = true;
  755. setTimeout(() => {
  756. this.$refs.fastGptRole.handleBindAiData(row)
  757. }, 200);
  758. },
  759. handleUpdateDoctor(row){
  760. this.doctor.title="绑定医生"
  761. this.doctor.open=true;
  762. this.doctorForm.userId=row.companyUserId;
  763. },
  764. bindCompanyUserDoctorId(row){
  765. console.log(row)
  766. this.doctorForm.doctorId=row;
  767. bindDoctorId(this.doctorForm).then(res=>{
  768. if (res.code==200){
  769. this.$message.success('绑定成功')
  770. }else {
  771. this.$message.error('绑定失败:',res.msg)
  772. }
  773. this.getList()
  774. this.doctor.open=false;
  775. })
  776. },
  777. handleUnBindUserId(val){
  778. this.$confirm(
  779. '确认解绑医生:<span style="color: green;">' + val.qwUserName + '' +
  780. '</span> 的医生?',
  781. {
  782. confirmButtonText: "确定",
  783. cancelButtonText: "取消",
  784. type: "warning",
  785. dangerouslyUseHTMLString: true // 允许使用 HTML 字符串
  786. }
  787. ).then(() => {
  788. return unBindDoctorId(val.companyUserId);
  789. }).then(response => {
  790. this.getList();
  791. this.msgSuccess("解绑成功");
  792. }).finally(res=>{
  793. this.getList();
  794. })
  795. },
  796. handleAppellation(val) {
  797. this.callOpen.open = true;
  798. this.callOpenFrom.welcomeText = val.welcomeText;
  799. this.callOpenFrom.id = val.id;
  800. },
  801. handleAutoRemark(val) {
  802. this.editRemarkOpen.open = true;
  803. this.editRemarkOpen.id = val.id;
  804. this.editRemarkOpen.isSendMsg = val.isSendMsg;
  805. },
  806. //登录
  807. handleLoginQwCode(val) {
  808. if (val.appKey == null || val.appKey === '') {
  809. return this.$message.warning("没有授权码,无法登录企业微信,请授权");
  810. }
  811. loginQwIpad({qwUserId: val.id}).then(res => {
  812. this.qwUserId = val.id;
  813. this.qwLogin.code = null;
  814. this.imageLoading = false;
  815. console.log(res)
  816. if (res.msg == "success") {
  817. this.qwLogin.codeUrl = res.qrCode64
  818. this.qwLogin.open = true;
  819. this.loginQwPolling();
  820. } else {
  821. this.$message.success(res.msg);
  822. this.getList()
  823. }
  824. })
  825. },
  826. handleTwoCode(val) {
  827. twoCode({qwUserId: val.id}).then(res => {
  828. console.log(res)
  829. this.qwLoginTwo.open = true;
  830. this.qwLoginTwo.codeUrl = res.qrCode
  831. });
  832. },
  833. twoCodePolling() {
  834. this.twoCodeInterval = setInterval(() => {
  835. twoCodeStatus({qwUserId: this.qwUserId}).then(res => {
  836. console.log(res)
  837. if (res.msg == 104001) {
  838. this.$message.success('登录成功');
  839. this.clearDl()
  840. clearInterval(this.loginQwInterval);
  841. } else if (res.msg == 100004) {
  842. this.clearDl()
  843. }
  844. });
  845. }, 3000);
  846. },
  847. loginQwPolling() {
  848. this.loginQwInterval = setInterval(() => {
  849. qrCodeStatus({qwUserId: this.qwUserId}).then(res => {
  850. console.log(res)
  851. if (res.msg == 22) {
  852. this.$message.success('账号企业不一致请重新扫码登录');
  853. this.clearDl();
  854. }
  855. if (res.msg == 104001) {
  856. this.$message.success('登录成功');
  857. this.clearDl()
  858. } else if (res.msg == 100004) {
  859. this.qwCode.open = true;
  860. clearInterval(this.loginQwInterval);
  861. }
  862. });
  863. }, 3000);
  864. },
  865. submitCodeForm() {
  866. qrCodeVerify({code: this.qwCode.code, qwUserId: this.qwUserId}).then(res => {
  867. console.log(res)
  868. this.$message.success('验证成功账号信息确认中。。。。');
  869. this.qwCode.open = false;
  870. this.loginQwInterval = setTimeout(() => {
  871. qrCodeStatus({qwUserId: this.qwUserId}).then(res => {
  872. console.log(res);
  873. if (res.msg == 23) {
  874. this.$message.error('账号不一致请重新扫码登录');
  875. this.clearDl();
  876. }
  877. if (res.msg == 22) {
  878. this.$message.error('账号企业不一致请重新扫码登录');
  879. this.clearDl();
  880. }
  881. if (res.msg == 104001) {
  882. this.$message.success('登录成功');
  883. this.clearDl();
  884. }
  885. });
  886. }, 4000);
  887. });
  888. },
  889. clearDl() {
  890. this.qwCode.open = false;
  891. this.qwLogin.open = false;
  892. clearInterval(this.loginQwInterval);
  893. this.getList()
  894. },
  895. //退出
  896. handleLoginOutQwStatus(val) {
  897. outLoginQwIpad({qwUserId: val.id}).then(res => {
  898. this.$message.success("退出登录成功");
  899. this.getList()
  900. })
  901. },
  902. handleGetQwIpad(val) {
  903. getQwIpad({qwUserId: val.id}).then(res => {
  904. this.$message.success("获取主机成功");
  905. this.getList();
  906. }).catch(error => {
  907. console.log(error);
  908. if (error.code === 501) {
  909. this.$confirm(
  910. '当前区域没有多余的名额,将为你分配异地名额,会导致企业微信需要扫脸重新登录,并且半个小时后需要进行验证',
  911. '提示',
  912. {
  913. confirmButtonText: '确定',
  914. cancelButtonText: '取消',
  915. type: 'warning',
  916. dangerouslyUseHTMLString: true
  917. }
  918. ).then(() => {
  919. return handleAllocateRemoteHost({qwUserId: val.id});
  920. }).then(res => {
  921. this.$message.success('异地主机分配成功');
  922. this.getList();
  923. }).catch(() => {
  924. this.$message.info('已取消异地主机分配');
  925. });
  926. } else {
  927. this.$message.error('获取主机失败');
  928. }
  929. });
  930. },
  931. handleDelQwIpad(val) {
  932. delQwIpad({qwUserId: val.id}).then(res => {
  933. this.$message.success("解绑主机成功");
  934. this.getList()
  935. })
  936. },
  937. handleUpdateIsAuto(val,code) {
  938. this.isAutoForm={
  939. id:val.id,
  940. isAuto:code
  941. }
  942. updateIsAuto(this.isAutoForm).then(res => {
  943. if (code==='00'){
  944. this.$message.success('禁用成功');
  945. }else {
  946. this.$message.success('启用成功');
  947. }
  948. this.getList();
  949. });
  950. },
  951. //传验证码
  952. handleLoginQwCodeMsg() {
  953. loginQwCodeMsg({appKey: this.qwLogin.appKey, code: this.qwLogin.code}).then(res => {
  954. this.qwLogin.open = false;
  955. this.$message.success("登录成功");
  956. })
  957. },
  958. validateCode() {
  959. // 只允许输入数字并限制长度为6
  960. this.qwLogin.code = this.qwLogin.code.replace(/\D/g, "").slice(0, 6);
  961. },
  962. handleCloudAP(urlAP) {
  963. selectCloudAP({ipAddress: urlAP}).then(res => {
  964. this.cloudAPOpen.open = true
  965. this.cloudAPOpen.admin = res.data.apAdmin;
  966. this.cloudAPOpen.passWord = res.data.apPassword;
  967. })
  968. },
  969. handleUnbindCloudHost(val) {
  970. const appKey = val.appKey;
  971. this.$confirm(
  972. '确定要给企微账号:<span style="color: green;">' + val.qwUserId + '' +
  973. '</span><br>企微昵称:<span style="color: red;">【' + val.qwUserName + '】</span>' +
  974. '</span><br><span style="color: orange;">解绑【Ps:解绑后此云主机可能会分配给他人】</span></span>',
  975. "警告",
  976. {
  977. confirmButtonText: "确定",
  978. cancelButtonText: "取消",
  979. type: "warning",
  980. dangerouslyUseHTMLString: true // 允许使用 HTML 字符串
  981. }
  982. ).then(() => {
  983. return qwUnbindCloudHost(appKey);
  984. }).then(response => {
  985. this.$message.success('解绑成功');
  986. }).finally(res => {
  987. this.getList();
  988. })
  989. },
  990. handleAuthorizeKey(val) {
  991. this.authorizeKeyFrom.id = val.id;
  992. this.authorizeKeyFrom.qwUserId = val.qwUserId;
  993. this.authorizeKeyFrom.qwUserName = val.qwUserName;
  994. this.authorizeKeyOpen = true;
  995. },
  996. submitAuthorizeKeyForm() {
  997. this.$refs["authorizeKeyFrom"].validate(valid => {
  998. if (valid) {
  999. if (this.authorizeKeyFrom.id != null && this.authorizeKeyFrom.appKey != null) {
  1000. this.uploadAuthorizeKey();
  1001. }
  1002. }
  1003. });
  1004. },
  1005. submitCallOpenFrom() {
  1006. this.$refs["callOpenFrom"].validate(valid => {
  1007. if (valid) {
  1008. if (this.callOpenFrom.id != null && this.callOpenFrom.welcomeText != null) {
  1009. updateUser(this.callOpenFrom).then(res => {
  1010. this.$message.success('修改成功');
  1011. this.callOpen.open = false;
  1012. this.getList();
  1013. });
  1014. }
  1015. }
  1016. });
  1017. },
  1018. submitEditRemarkOpenFrom() {
  1019. if (this.editRemarkOpen.id != null && this.editRemarkOpen.isSendMsg != null) {
  1020. updateUser(this.editRemarkOpen).then(res => {
  1021. this.$message.success('修改成功');
  1022. this.editRemarkOpen.open = false;
  1023. this.getList();
  1024. });
  1025. } else {
  1026. this.$message.error("请选择条件")
  1027. }
  1028. },
  1029. uploadAuthorizeKey() {
  1030. this.$confirm(
  1031. '确定要给企微账号:<span style="color: green;">' + this.authorizeKeyFrom.qwUserId + '' +
  1032. '</span><br>企微昵称:<span style="color: red;">【' + this.authorizeKeyFrom.qwUserName + '】</span>' +
  1033. '</span><br>授权key:<span style="color: #04adf6;">【' + this.authorizeKeyFrom.appKey + '】</span>?',
  1034. "警告",
  1035. {
  1036. confirmButtonText: "确定",
  1037. cancelButtonText: "取消",
  1038. type: "warning",
  1039. dangerouslyUseHTMLString: true // 允许使用 HTML 字符串
  1040. }
  1041. ).then(() => {
  1042. this.authorizeKeyOpen = false;
  1043. return handleInputAuthAppKey(this.authorizeKeyFrom);
  1044. }).then(response => {
  1045. this.msgSuccess("授权key完成");
  1046. }).finally(res => {
  1047. this.resetAuthorizeKeyFrom();
  1048. this.getList();
  1049. })
  1050. },
  1051. uploadAuthorizeKey2(val) {
  1052. const id = val.id;
  1053. this.$confirm(
  1054. '确定要给企微账号:<span style="color: green;">' + val.qwUserId + '' +
  1055. '</span><br>企微昵称:<span style="color: red;">【' + val.qwUserName + '】</span>' +
  1056. '</span><br>授权key</span>?',
  1057. "警告",
  1058. {
  1059. confirmButtonText: "确定",
  1060. cancelButtonText: "取消",
  1061. type: "warning",
  1062. dangerouslyUseHTMLString: true // 允许使用 HTML 字符串
  1063. }
  1064. ).then(() => {
  1065. return handleAuthAppKey({id: id});
  1066. }).then(response => {
  1067. this.msgSuccess("授权key完成");
  1068. }).finally(res => {
  1069. this.resetAuthorizeKeyFrom();
  1070. this.getList();
  1071. })
  1072. },
  1073. handleBindCloudHost(val) {
  1074. if (val.appKey == null || val.appKey == '') {
  1075. return this.$message.warning('没有授权码,无法绑定主机,请联系管理员');
  1076. }
  1077. const appKey = val.appKey;
  1078. this.$confirm(
  1079. '确定要给企微账号:<span style="color: green;">' + val.qwUserId + '' +
  1080. '</span><br>企微昵称:<span style="color: red;">【' + val.qwUserName + '】</span>' +
  1081. '</span><br><span style="color: dodgerblue;">绑定云主机?</span></span>',
  1082. "警告",
  1083. {
  1084. confirmButtonText: "确定",
  1085. cancelButtonText: "取消",
  1086. type: "warning",
  1087. dangerouslyUseHTMLString: true // 允许使用 HTML 字符串
  1088. }
  1089. ).then(() => {
  1090. return qwBindCloudHost(appKey);
  1091. }).then(response => {
  1092. this.$message.success('绑定成功,请登录云主机进行配置~~');
  1093. }).finally(res => {
  1094. this.getList();
  1095. })
  1096. },
  1097. openImageViewer(url) {
  1098. // 打开大图预览对话框
  1099. this.dialogImageUrl = url
  1100. this.dialogVisible = true;
  1101. },
  1102. //刷新页面
  1103. refreshFastGptList() {
  1104. this.bindAiOpen = false;
  1105. this.getList();
  1106. },
  1107. // 取消按钮
  1108. cancel() {
  1109. this.open = false;
  1110. this.reset();
  1111. },
  1112. // 表单重置
  1113. reset() {
  1114. this.form = {
  1115. id: null,
  1116. qwUserId: null,
  1117. corpId: null,
  1118. qwUserName: null,
  1119. };
  1120. this.resetForm("form");
  1121. },
  1122. //重置授权
  1123. resetAuthorizeKeyFrom() {
  1124. this.authorizeKeyFrom = {
  1125. id: null,
  1126. appKey: null,
  1127. qwUserId: null,
  1128. qwUserName: null
  1129. };
  1130. },
  1131. //重置登录
  1132. resetQwLogin() {
  1133. this.qwLogin = {
  1134. title: "",
  1135. open: false,
  1136. codeUrl: null,
  1137. code: null,
  1138. corpId: null,
  1139. qwUserId: null,
  1140. }
  1141. this.qwLogin.open = false;
  1142. this.loading = false;
  1143. this.getList();
  1144. },
  1145. //解绑AI客服
  1146. relieveFastGptRole(row) {
  1147. this.$confirm('是否确认解绑AI客服?', "警告", {
  1148. confirmButtonText: "确定",
  1149. cancelButtonText: "取消",
  1150. type: "warning"
  1151. }).then(function () {
  1152. return relieveFastGptRoleById(row.id);
  1153. }).then(() => {
  1154. this.getList();
  1155. this.msgSuccess("解绑成功");
  1156. })
  1157. },
  1158. /** 搜索按钮操作 */
  1159. handleQuery() {
  1160. this.queryParams.pageNum = 1;
  1161. this.getList();
  1162. },
  1163. /** 重置按钮操作 */
  1164. resetQuery() {
  1165. this.resetForm("queryForm");
  1166. this.queryParams.corpId = this.myQwCompanyList[0].dictValue;
  1167. this.handleQuery();
  1168. },
  1169. // 多选框选中数据
  1170. handleSelectionChange(selection) {
  1171. this.ids = selection.map(item => item.id)
  1172. this.names = selection.map(item => item.qwUserName)
  1173. this.single = selection.length !== 1
  1174. this.multiple = !selection.length
  1175. },
  1176. /** 提交按钮 */
  1177. submitForm() {
  1178. this.$refs["form"].validate(valid => {
  1179. if (valid) {
  1180. if (this.form.id != null) {
  1181. // updateUser(this.form).then(response => {
  1182. // this.msgSuccess("绑定成功");
  1183. // this.open = false;
  1184. // this.getList();
  1185. //
  1186. // });
  1187. } else {
  1188. // addUser(this.form).then(response => {
  1189. // this.msgSuccess("新增成功");
  1190. // this.open = false;
  1191. // this.getList();
  1192. // });
  1193. }
  1194. }
  1195. });
  1196. },
  1197. /** 导出按钮操作 */
  1198. handleExport() {
  1199. const queryParams = this.queryParams;
  1200. this.$confirm('是否确认导出所有企微用户数据项?', "警告", {
  1201. confirmButtonText: "确定",
  1202. cancelButtonText: "取消",
  1203. type: "warning"
  1204. }).then(() => {
  1205. this.exportLoading = true;
  1206. return exportUser(queryParams);
  1207. }).then(response => {
  1208. this.download(response.msg);
  1209. this.exportLoading = false;
  1210. }).catch(() => {
  1211. });
  1212. },
  1213. updateSendType() {
  1214. this.updateSendOpen = true;
  1215. },
  1216. cleanUpdateSendType() {
  1217. this.updateSendOpen = false;
  1218. },
  1219. submitUpdateSendTypeForm(){
  1220. updateSendType({ids: this.ids, type: this.type}).then(e => {
  1221. this.updateSendOpen = false;
  1222. this.$message.success("修改成功");
  1223. this.getList();
  1224. });
  1225. },
  1226. }
  1227. };
  1228. </script>
  1229. <style>
  1230. .text-container {
  1231. max-height: 7.5em; /* 设置最大高度为6行,根据字体大小调整 */
  1232. overflow-y: auto; /* 内容超出时显示滚动条 */
  1233. line-height: 1.5em; /* 行高设置,确保每行高度一致 */
  1234. }
  1235. .qr-login-dialog .el-dialog__body {
  1236. display: flex;
  1237. flex-direction: column;
  1238. align-items: center;
  1239. text-align: center;
  1240. padding: 20px;
  1241. }
  1242. .qr-login-container {
  1243. width: 100%;
  1244. }
  1245. .qr-login-instructions {
  1246. font-size: 14px;
  1247. color: #666;
  1248. margin: 10px 0;
  1249. }
  1250. .verification-code-input {
  1251. margin-top: 15px;
  1252. width: 80%;
  1253. }
  1254. </style>