cuDeptIdIndex.vue 34 KB

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