cuDeptIdIndex.vue 33 KB

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