index.vue 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265
  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>
  325. <pagination
  326. v-show="total>0"
  327. :total="total"
  328. :page.sync="queryParams.pageNum"
  329. :limit.sync="queryParams.pageSize"
  330. @pagination="getList"
  331. />
  332. <!-- 绑定AI客服-->
  333. <el-dialog :title="bindAiTitle" :visible.sync="bindAiOpen" width="1200px" append-to-body>
  334. <fast-gpt-role ref="fastGptRole" @refreshFastGptList="refreshFastGptList" ></fast-gpt-role>
  335. </el-dialog>
  336. <!-- <el-dialog :visible.sync="updateIp.open" width="600px" append-to-body>-->
  337. <!-- <el-form ref="updateIpForm" :model="updateIpForm" :rules="updateIpRule" label-width="100px">-->
  338. <!-- <el-form-item label="新云主机IP" prop="Ip">-->
  339. <!-- <el-input v-model="updateIpForm.newIp" placeholder="请输入新IP" />-->
  340. <!-- </el-form-item>-->
  341. <!-- </el-form>-->
  342. <!-- <div slot="footer" class="dialog-footer" >-->
  343. <!-- <el-button type="primary" @click="submitUpdateIpForm">确 定</el-button>-->
  344. <!-- </div>-->
  345. <!-- </el-dialog>-->
  346. <el-dialog title="云主机信息" :visible.sync="cloudAPOpen.open" append-to-body>
  347. <el-card class="box-card">
  348. <div slot="header" class="clearfix">
  349. <span>账号:{{cloudAPOpen.admin}}</span>
  350. </div>
  351. <div slot="header" class="clearfix">
  352. <span>密码:{{cloudAPOpen.passWord}}</span>
  353. </div>
  354. </el-card>
  355. </el-dialog>
  356. <el-dialog :title="callOpen.title" :visible.sync="callOpen.open" width="500px" append-to-body>
  357. <el-form ref="callOpenFrom" :model="callOpenFrom" :rules="callOpenRule" label-width="110px">
  358. <el-form-item label="员工称呼" prop="welcomeText">
  359. <el-input v-model="callOpenFrom.welcomeText" placeholder="请输入员工称呼" />
  360. </el-form-item>
  361. </el-form>
  362. <div slot="footer" class="dialog-footer" >
  363. <el-button type="primary" @click="submitCallOpenFrom">确 定</el-button>
  364. </div>
  365. </el-dialog>
  366. <el-dialog :title="editRemarkOpen.title" :visible.sync="editRemarkOpen.open" width="500px" append-to-body>
  367. <el-form ref="callOpenFrom" :model="editRemarkOpen" label-width="110px">
  368. <el-radio-group v-model="editRemarkOpen.isSendMsg">
  369. <el-card>
  370. <el-row :gutter="20">
  371. <el-col>
  372. <el-radio
  373. :label="1"
  374. style="font-size: 16px; margin: 10px 0;"
  375. >添加【完课备注】在最【旧备注-(前面)】</el-radio>
  376. </el-col>
  377. <el-col>
  378. <el-radio
  379. :label="2"
  380. style="font-size: 16px; margin: 10px 0;"
  381. >添加【完课备注】在最【旧备注-(后面)】</el-radio>
  382. </el-col>
  383. <el-col>
  384. <el-radio
  385. :label="3"
  386. style="font-size: 16px; margin: 10px 0;"
  387. >使用简洁版备注【*日期完】,在【旧备注-前面】</el-radio>
  388. </el-col>
  389. <el-col>
  390. <el-radio
  391. :label="4"
  392. style="font-size: 16px; margin: 10px 0;"
  393. >使用简洁版备注【*日期完】,在【旧备注-后面】</el-radio>
  394. </el-col>
  395. <el-col>
  396. <el-radio
  397. :label="5"
  398. style="font-size: 16px; margin: 10px 0;"
  399. >不用完课备注</el-radio>
  400. </el-col>
  401. </el-row>
  402. </el-card>
  403. </el-radio-group>
  404. </el-form>
  405. <div slot="footer" class="dialog-footer">
  406. <el-button type="primary" @click="submitEditRemarkOpenFrom">确 定</el-button>
  407. </div>
  408. </el-dialog>
  409. <el-dialog title="授权key" :visible.sync="authorizeKeyOpen" width="500px" append-to-body>
  410. <el-form ref="authorizeKeyFrom" :model="authorizeKeyFrom" :rules="authorizeKeyRule" label-width="110px">
  411. <el-form-item label="授权的key值" prop="appKey">
  412. <el-input v-model="authorizeKeyFrom.appKey" placeholder="请输入授权key" type="Number"/>
  413. </el-form-item>
  414. </el-form>
  415. <div slot="footer" class="dialog-footer" >
  416. <el-button type="primary" @click="submitAuthorizeKeyForm">确 定</el-button>
  417. </div>
  418. </el-dialog>
  419. <!--二维码 -->
  420. <el-dialog
  421. title="企微二次认证"
  422. :visible.sync="qwLoginTwo.open"
  423. width="600px"
  424. append-to-body
  425. custom-class="qr-login-dialog"
  426. >
  427. <div class="qr-login-container">
  428. <div class="image-wrapper" v-loading="imageLoading" >
  429. <el-image
  430. :src="'data:image/png;base64,' +qwLoginTwo.codeUrl"
  431. style="display: block; margin: 0 auto; width: 300px; height: 300px;"
  432. />
  433. </div>
  434. <p class="qr-login-instructions">二次验证二维码</p>
  435. </div>
  436. <div slot="footer" class="dialog-footer" >
  437. <el-button type="primary" @click="qwLoginTwo.open=false">确 定</el-button>
  438. </div>
  439. </el-dialog>
  440. <el-dialog
  441. :title="qwLogin.title"
  442. :visible.sync="qwLogin.open"
  443. width="600px"
  444. append-to-body
  445. custom-class="qr-login-dialog"
  446. >
  447. <div class="qr-login-container">
  448. <div class="image-wrapper" v-loading="imageLoading" >
  449. <el-image
  450. :src="'data:image/png;base64,' +qwLogin.codeUrl"
  451. style="display: block; margin: 0 auto; width: 300px; height: 300px;"
  452. />
  453. </div>
  454. <p class="qr-login-instructions">使用企业微信扫码授权登录</p>
  455. </div>
  456. </el-dialog>
  457. <el-dialog
  458. title="输入企微验证码"
  459. :visible.sync="qwCode.open"
  460. width="600px"
  461. append-to-body>
  462. <el-form :model="qwCode" label-width="80px" @submit.native.prevent="handleSubmit">
  463. <el-form-item label="验证码" prop="companyName">
  464. <el-input v-model="qwCode.code" placeholder="输入企微6位验证码" />
  465. </el-form-item>
  466. </el-form>
  467. <div slot="footer" class="dialog-footer">
  468. <el-button type="primary" @click="submitCodeForm">确 定</el-button>
  469. </div>
  470. </el-dialog>
  471. <!-- 大图预览对话框 -->
  472. <el-dialog
  473. :visible.sync="dialogVisible"
  474. :modal="false"
  475. width="1200"
  476. append-to-body>
  477. <img
  478. :src="this.dialogImageUrl"
  479. style="display: block; max-width: 100%; margin: 0 auto"
  480. />
  481. </el-dialog>
  482. <el-dialog
  483. :visible.sync="updateSendOpen"
  484. width="1000px"
  485. append-to-body>
  486. <el-form label-width="80px">
  487. <p>是否修改企微账号发送方式:
  488. <el-tag style="margin-left: 10px" v-for="name in names">{{ name }}</el-tag>
  489. </p>
  490. <el-form-item label="发送方式" prop="type">
  491. <el-radio-group v-model="type">
  492. <el-radio
  493. :label="0"
  494. >方式一
  495. </el-radio>
  496. <el-radio
  497. :label="1"
  498. >方式二
  499. </el-radio>
  500. <el-radio
  501. :label="2"
  502. >掉线通知
  503. </el-radio>
  504. </el-radio-group>
  505. </el-form-item>
  506. </el-form>
  507. <div slot="footer" class="dialog-footer">
  508. <el-button type="primary" @click="submitUpdateSendTypeForm">确 定</el-button>
  509. </div>
  510. </el-dialog>
  511. </div>
  512. </template>
  513. <script>
  514. import {
  515. updateIsAuto,
  516. updateUser,
  517. getMyQwCompanyList,
  518. relieveFastGptRoleById,
  519. loginQwIpad,
  520. loginQwCodeMsg,
  521. twoCode,
  522. twoCodeStatus,
  523. qrCodeStatus,
  524. updateSendType,
  525. getQwIpad,
  526. delQwIpad,
  527. qrCodeVerify,
  528. outLoginQwIpad,
  529. changeVideoStatus,
  530. handleAllocateRemoteHost,
  531. qwBindCloudHost, qwUnbindCloudHost, handleAuthAppKey, handleInputAuthAppKey, selectCloudAP, staffListUser, exportStaff
  532. } from '../../../api/qw/user'
  533. import fastGptRole from "@/views/fastGpt/fastGptRole/fastGptRole";
  534. export default {
  535. name: "cuDeptIdIndex",
  536. components: { fastGptRole},
  537. data() {
  538. return {
  539. isAutoOptions:[],
  540. updateIp:{
  541. open:false,
  542. title: "修改云主机IP"
  543. },
  544. updateIpForm:{
  545. id:null,
  546. newIp:null,
  547. },
  548. authorizeKeyOpen:false,
  549. authorizeKeyFrom:{
  550. id:null,
  551. appKey:null,
  552. qwUserId:null,
  553. qwUserName:null
  554. },
  555. updateIpRule:{},
  556. newIp:null,
  557. //放大图片
  558. dialogImageUrl:null,
  559. dialogVisible:false,
  560. optionsStatus: [{
  561. value: 0,
  562. label: '正常'
  563. }, {
  564. value: 2,
  565. label: '离职'
  566. }],
  567. // 遮罩层
  568. loading: true,
  569. names: [],
  570. // 导出遮罩层
  571. exportLoading: false,
  572. // 选中数组
  573. ids: [],
  574. // 非单个禁用
  575. single: true,
  576. // 非多个禁用
  577. multiple: true,
  578. // 显示搜索条件
  579. showSearch: true,
  580. updateSendOpen: false,
  581. // 总条数
  582. total: 0,
  583. //公司列表
  584. myQwCompanyList:[],
  585. // 企微用户表格数据
  586. userList: [],
  587. allowSelectOptions:[],
  588. // 弹出层标题
  589. bindAiTitle: "",
  590. bindAiOpen: false,
  591. qwLogin:{
  592. title:"",
  593. open:false,
  594. codeUrl:null,
  595. code:null,
  596. appKey:null,
  597. },
  598. qwLoginTwo:{
  599. title:"",
  600. open:false,
  601. codeUrl:null,
  602. code:null,
  603. appKey:null,
  604. },
  605. qwCode:{
  606. title:"",
  607. open:false,
  608. code:null,
  609. },
  610. cloudAPOpen:{
  611. open:false,
  612. admin:null,
  613. passWord:null,
  614. },
  615. callOpen:{
  616. open:false,
  617. title: '修改员工称呼',
  618. },
  619. callOpenFrom:{
  620. id:null,
  621. welcomeText:null,
  622. },
  623. isAutoForm:{
  624. id:null,
  625. isAuto:null,
  626. },
  627. editRemarkOpen: {
  628. open: false,
  629. title: '修改员工自动给完课客户打备注的规则',
  630. id:null,
  631. isSendMsg:null,
  632. },
  633. twoCodeInterval:null,
  634. type: 0,
  635. loginQwInterval:null,
  636. imageLoading: true, // 控制加载状态
  637. // 查询参数
  638. queryParams: {
  639. pageNum: 1,
  640. pageSize: 10,
  641. qwUserId: null,
  642. corpId: null,
  643. qwUserName: null,
  644. },
  645. qwUserId:null,
  646. companyUserList:[],
  647. // 表单参数
  648. form: {
  649. isSendMsg: '2',
  650. },
  651. authorizeKeyRule:{
  652. appKey:[{required:true,message:"授权码不能为空",trigger:"blur"}]
  653. },
  654. callOpenRule:{
  655. welcomeText:[{required:true,message:"员工称呼不能为空",trigger:"blur"}]
  656. },
  657. // 表单校验
  658. rules: {
  659. },
  660. //欢迎语表单校验
  661. weclomeRules:{
  662. welcomeText:[{required:true,message:"消息文本不能为空",trigger:"blur"}]
  663. },
  664. };
  665. },
  666. created() {
  667. this.getDicts("qw_user_is_auto").then(response => {
  668. this.isAutoOptions = response.data;
  669. });
  670. getMyQwCompanyList().then(response => {
  671. this.myQwCompanyList = response.data;
  672. if(this.myQwCompanyList!=null){
  673. this.queryParams.corpId=this.myQwCompanyList[0].dictValue;
  674. this.getList();
  675. }
  676. });
  677. },
  678. watch: {
  679. // 监听弹窗的可见性变化
  680. 'qwLogin.open'(newVal) {
  681. if (!newVal) {
  682. // 如果弹窗关闭,清除定时器
  683. clearInterval(this.loginQwInterval);
  684. }
  685. },
  686. },
  687. methods: {
  688. getList() {
  689. this.loading = true;
  690. staffListUser(this.queryParams).then(response => {
  691. this.userList = response.rows;
  692. this.total = response.total;
  693. this.loading = false;
  694. });
  695. },
  696. updateCorpId() {
  697. this.reset();
  698. this.getList();
  699. },
  700. changeVideoStatus(val){
  701. changeVideoStatus(val.id).then(res => {
  702. this.$message.success("修改状态成功");
  703. this.getList()
  704. })
  705. },
  706. //绑定AI客服
  707. bindFastGptRole(row) {
  708. this.bindAiTitle = "绑定AI客服";
  709. this.bindAiOpen = true;
  710. setTimeout(() => {
  711. this.$refs.fastGptRole.handleBindAiData(row)
  712. }, 200);
  713. },
  714. handleAppellation(val) {
  715. this.callOpen.open = true;
  716. this.callOpenFrom.welcomeText = val.welcomeText;
  717. this.callOpenFrom.id = val.id;
  718. },
  719. handleAutoRemark(val) {
  720. this.editRemarkOpen.open = true;
  721. this.editRemarkOpen.id = val.id;
  722. this.editRemarkOpen.isSendMsg = val.isSendMsg;
  723. },
  724. //登录
  725. handleLoginQwCode(val) {
  726. if (val.appKey == null || val.appKey === '') {
  727. return this.$message.warning("没有授权码,无法登录企业微信,请授权");
  728. }
  729. loginQwIpad({qwUserId: val.id}).then(res => {
  730. this.qwUserId = val.id;
  731. this.qwLogin.code = null;
  732. this.imageLoading = false;
  733. console.log(res)
  734. if (res.msg == "success") {
  735. this.qwLogin.codeUrl = res.qrCode64
  736. this.qwLogin.open = true;
  737. this.loginQwPolling();
  738. } else {
  739. this.$message.success(res.msg);
  740. this.getList()
  741. }
  742. })
  743. },
  744. handleTwoCode(val) {
  745. twoCode({qwUserId: val.id}).then(res => {
  746. console.log(res)
  747. this.qwLoginTwo.open = true;
  748. this.qwLoginTwo.codeUrl = res.qrCode
  749. });
  750. },
  751. twoCodePolling() {
  752. this.twoCodeInterval = setInterval(() => {
  753. twoCodeStatus({qwUserId: this.qwUserId}).then(res => {
  754. console.log(res)
  755. if (res.msg == 104001) {
  756. this.$message.success('登录成功');
  757. this.clearDl()
  758. clearInterval(this.loginQwInterval);
  759. } else if (res.msg == 100004) {
  760. this.clearDl()
  761. }
  762. });
  763. }, 3000);
  764. },
  765. loginQwPolling() {
  766. this.loginQwInterval = setInterval(() => {
  767. qrCodeStatus({qwUserId: this.qwUserId}).then(res => {
  768. console.log(res)
  769. if (res.msg == 22) {
  770. this.$message.success('账号企业不一致请重新扫码登录');
  771. this.clearDl();
  772. }
  773. if (res.msg == 104001) {
  774. this.$message.success('登录成功');
  775. this.clearDl()
  776. } else if (res.msg == 100004) {
  777. this.qwCode.open = true;
  778. clearInterval(this.loginQwInterval);
  779. }
  780. });
  781. }, 3000);
  782. },
  783. submitCodeForm() {
  784. qrCodeVerify({code: this.qwCode.code, qwUserId: this.qwUserId}).then(res => {
  785. console.log(res)
  786. this.$message.success('验证成功账号信息确认中。。。。');
  787. this.qwCode.open = false;
  788. this.loginQwInterval = setTimeout(() => {
  789. qrCodeStatus({qwUserId: this.qwUserId}).then(res => {
  790. console.log(res);
  791. if (res.msg == 23) {
  792. this.$message.error('账号不一致请重新扫码登录');
  793. this.clearDl();
  794. }
  795. if (res.msg == 22) {
  796. this.$message.error('账号企业不一致请重新扫码登录');
  797. this.clearDl();
  798. }
  799. if (res.msg == 104001) {
  800. this.$message.success('登录成功');
  801. this.clearDl();
  802. }
  803. });
  804. }, 4000);
  805. });
  806. },
  807. clearDl() {
  808. this.qwCode.open = false;
  809. this.qwLogin.open = false;
  810. clearInterval(this.loginQwInterval);
  811. this.getList()
  812. },
  813. //退出
  814. handleLoginOutQwStatus(val) {
  815. outLoginQwIpad({qwUserId: val.id}).then(res => {
  816. this.$message.success("退出登录成功");
  817. this.getList()
  818. })
  819. },
  820. handleGetQwIpad(val) {
  821. getQwIpad({qwUserId: val.id}).then(res => {
  822. this.$message.success("获取主机成功");
  823. this.getList();
  824. }).catch(error => {
  825. console.log(error);
  826. if (error.code === 501) {
  827. this.$confirm(
  828. '当前区域没有多余的名额,将为你分配异地名额,会导致企业微信需要扫脸重新登录,并且半个小时后需要进行验证',
  829. '提示',
  830. {
  831. confirmButtonText: '确定',
  832. cancelButtonText: '取消',
  833. type: 'warning',
  834. dangerouslyUseHTMLString: true
  835. }
  836. ).then(() => {
  837. return handleAllocateRemoteHost({qwUserId: val.id});
  838. }).then(res => {
  839. this.$message.success('异地主机分配成功');
  840. this.getList();
  841. }).catch(() => {
  842. this.$message.info('已取消异地主机分配');
  843. });
  844. } else {
  845. this.$message.error('获取主机失败');
  846. }
  847. });
  848. },
  849. handleDelQwIpad(val) {
  850. delQwIpad({qwUserId: val.id}).then(res => {
  851. this.$message.success("解绑主机成功");
  852. this.getList()
  853. })
  854. },
  855. handleUpdateIsAuto(val,code) {
  856. this.isAutoForm={
  857. id:val.id,
  858. isAuto:code
  859. }
  860. updateIsAuto(this.isAutoForm).then(res => {
  861. if (code==='00'){
  862. this.$message.success('禁用成功');
  863. }else {
  864. this.$message.success('启用成功');
  865. }
  866. this.getList();
  867. });
  868. },
  869. //传验证码
  870. handleLoginQwCodeMsg() {
  871. loginQwCodeMsg({appKey: this.qwLogin.appKey, code: this.qwLogin.code}).then(res => {
  872. this.qwLogin.open = false;
  873. this.$message.success("登录成功");
  874. })
  875. },
  876. validateCode() {
  877. // 只允许输入数字并限制长度为6
  878. this.qwLogin.code = this.qwLogin.code.replace(/\D/g, "").slice(0, 6);
  879. },
  880. handleCloudAP(urlAP) {
  881. selectCloudAP({ipAddress: urlAP}).then(res => {
  882. this.cloudAPOpen.open = true
  883. this.cloudAPOpen.admin = res.data.apAdmin;
  884. this.cloudAPOpen.passWord = res.data.apPassword;
  885. })
  886. },
  887. handleUnbindCloudHost(val) {
  888. const appKey = val.appKey;
  889. this.$confirm(
  890. '确定要给企微账号:<span style="color: green;">' + val.qwUserId + '' +
  891. '</span><br>企微昵称:<span style="color: red;">【' + val.qwUserName + '】</span>' +
  892. '</span><br><span style="color: orange;">解绑【Ps:解绑后此云主机可能会分配给他人】</span></span>',
  893. "警告",
  894. {
  895. confirmButtonText: "确定",
  896. cancelButtonText: "取消",
  897. type: "warning",
  898. dangerouslyUseHTMLString: true // 允许使用 HTML 字符串
  899. }
  900. ).then(() => {
  901. return qwUnbindCloudHost(appKey);
  902. }).then(response => {
  903. this.$message.success('解绑成功');
  904. }).finally(res => {
  905. this.getList();
  906. })
  907. },
  908. handleAuthorizeKey(val) {
  909. this.authorizeKeyFrom.id = val.id;
  910. this.authorizeKeyFrom.qwUserId = val.qwUserId;
  911. this.authorizeKeyFrom.qwUserName = val.qwUserName;
  912. this.authorizeKeyOpen = true;
  913. },
  914. submitAuthorizeKeyForm() {
  915. this.$refs["authorizeKeyFrom"].validate(valid => {
  916. if (valid) {
  917. if (this.authorizeKeyFrom.id != null && this.authorizeKeyFrom.appKey != null) {
  918. this.uploadAuthorizeKey();
  919. }
  920. }
  921. });
  922. },
  923. submitCallOpenFrom() {
  924. this.$refs["callOpenFrom"].validate(valid => {
  925. if (valid) {
  926. if (this.callOpenFrom.id != null && this.callOpenFrom.welcomeText != null) {
  927. updateUser(this.callOpenFrom).then(res => {
  928. this.$message.success('修改成功');
  929. this.callOpen.open = false;
  930. this.getList();
  931. });
  932. }
  933. }
  934. });
  935. },
  936. submitEditRemarkOpenFrom() {
  937. if (this.editRemarkOpen.id != null && this.editRemarkOpen.isSendMsg != null) {
  938. updateUser(this.editRemarkOpen).then(res => {
  939. this.$message.success('修改成功');
  940. this.editRemarkOpen.open = false;
  941. this.getList();
  942. });
  943. } else {
  944. this.$message.error("请选择条件")
  945. }
  946. },
  947. uploadAuthorizeKey() {
  948. this.$confirm(
  949. '确定要给企微账号:<span style="color: green;">' + this.authorizeKeyFrom.qwUserId + '' +
  950. '</span><br>企微昵称:<span style="color: red;">【' + this.authorizeKeyFrom.qwUserName + '】</span>' +
  951. '</span><br>授权key:<span style="color: #04adf6;">【' + this.authorizeKeyFrom.appKey + '】</span>?',
  952. "警告",
  953. {
  954. confirmButtonText: "确定",
  955. cancelButtonText: "取消",
  956. type: "warning",
  957. dangerouslyUseHTMLString: true // 允许使用 HTML 字符串
  958. }
  959. ).then(() => {
  960. this.authorizeKeyOpen = false;
  961. return handleInputAuthAppKey(this.authorizeKeyFrom);
  962. }).then(response => {
  963. this.msgSuccess("授权key完成");
  964. }).finally(res => {
  965. this.resetAuthorizeKeyFrom();
  966. this.getList();
  967. })
  968. },
  969. uploadAuthorizeKey2(val) {
  970. const id = val.id;
  971. this.$confirm(
  972. '确定要给企微账号:<span style="color: green;">' + val.qwUserId + '' +
  973. '</span><br>企微昵称:<span style="color: red;">【' + val.qwUserName + '】</span>' +
  974. '</span><br>授权key</span>?',
  975. "警告",
  976. {
  977. confirmButtonText: "确定",
  978. cancelButtonText: "取消",
  979. type: "warning",
  980. dangerouslyUseHTMLString: true // 允许使用 HTML 字符串
  981. }
  982. ).then(() => {
  983. return handleAuthAppKey({id: id});
  984. }).then(response => {
  985. this.msgSuccess("授权key完成");
  986. }).finally(res => {
  987. this.resetAuthorizeKeyFrom();
  988. this.getList();
  989. })
  990. },
  991. handleBindCloudHost(val) {
  992. if (val.appKey == null || val.appKey == '') {
  993. return this.$message.warning('没有授权码,无法绑定主机,请联系管理员');
  994. }
  995. const appKey = val.appKey;
  996. this.$confirm(
  997. '确定要给企微账号:<span style="color: green;">' + val.qwUserId + '' +
  998. '</span><br>企微昵称:<span style="color: red;">【' + val.qwUserName + '】</span>' +
  999. '</span><br><span style="color: dodgerblue;">绑定云主机?</span></span>',
  1000. "警告",
  1001. {
  1002. confirmButtonText: "确定",
  1003. cancelButtonText: "取消",
  1004. type: "warning",
  1005. dangerouslyUseHTMLString: true // 允许使用 HTML 字符串
  1006. }
  1007. ).then(() => {
  1008. return qwBindCloudHost(appKey);
  1009. }).then(response => {
  1010. this.$message.success('绑定成功,请登录云主机进行配置~~');
  1011. }).finally(res => {
  1012. this.getList();
  1013. })
  1014. },
  1015. openImageViewer(url) {
  1016. // 打开大图预览对话框
  1017. this.dialogImageUrl = url
  1018. this.dialogVisible = true;
  1019. },
  1020. //刷新页面
  1021. refreshFastGptList() {
  1022. this.bindAiOpen = false;
  1023. this.getList();
  1024. },
  1025. // 取消按钮
  1026. cancel() {
  1027. this.open = false;
  1028. this.reset();
  1029. },
  1030. // 表单重置
  1031. reset() {
  1032. this.form = {
  1033. id: null,
  1034. qwUserId: null,
  1035. corpId: null,
  1036. qwUserName: null,
  1037. };
  1038. this.resetForm("form");
  1039. },
  1040. //重置授权
  1041. resetAuthorizeKeyFrom() {
  1042. this.authorizeKeyFrom = {
  1043. id: null,
  1044. appKey: null,
  1045. qwUserId: null,
  1046. qwUserName: null
  1047. };
  1048. },
  1049. //重置登录
  1050. resetQwLogin() {
  1051. this.qwLogin = {
  1052. title: "",
  1053. open: false,
  1054. codeUrl: null,
  1055. code: null,
  1056. corpId: null,
  1057. qwUserId: null,
  1058. }
  1059. this.qwLogin.open = false;
  1060. this.loading = false;
  1061. this.getList();
  1062. },
  1063. //解绑AI客服
  1064. relieveFastGptRole(row) {
  1065. this.$confirm('是否确认解绑AI客服?', "警告", {
  1066. confirmButtonText: "确定",
  1067. cancelButtonText: "取消",
  1068. type: "warning"
  1069. }).then(function () {
  1070. return relieveFastGptRoleById(row.id);
  1071. }).then(() => {
  1072. this.getList();
  1073. this.msgSuccess("解绑成功");
  1074. })
  1075. },
  1076. /** 搜索按钮操作 */
  1077. handleQuery() {
  1078. this.queryParams.pageNum = 1;
  1079. this.getList();
  1080. },
  1081. /** 重置按钮操作 */
  1082. resetQuery() {
  1083. this.resetForm("queryForm");
  1084. this.queryParams.corpId = this.myQwCompanyList[0].dictValue;
  1085. this.handleQuery();
  1086. },
  1087. // 多选框选中数据
  1088. handleSelectionChange(selection) {
  1089. this.ids = selection.map(item => item.id)
  1090. this.names = selection.map(item => item.qwUserName)
  1091. this.single = selection.length !== 1
  1092. this.multiple = !selection.length
  1093. },
  1094. /** 提交按钮 */
  1095. submitForm() {
  1096. this.$refs["form"].validate(valid => {
  1097. if (valid) {
  1098. if (this.form.id != null) {
  1099. // updateUser(this.form).then(response => {
  1100. // this.msgSuccess("绑定成功");
  1101. // this.open = false;
  1102. // this.getList();
  1103. //
  1104. // });
  1105. } else {
  1106. // addUser(this.form).then(response => {
  1107. // this.msgSuccess("新增成功");
  1108. // this.open = false;
  1109. // this.getList();
  1110. // });
  1111. }
  1112. }
  1113. });
  1114. },
  1115. /** 导出按钮操作 */
  1116. handleExport() {
  1117. const queryParams = this.queryParams;
  1118. this.$confirm('是否确认导出所有企微员工数据项?', "警告", {
  1119. confirmButtonText: "确定",
  1120. cancelButtonText: "取消",
  1121. type: "warning"
  1122. }).then(() => {
  1123. this.exportLoading = true;
  1124. return exportStaff(queryParams);
  1125. }).then(response => {
  1126. this.download(response.msg);
  1127. this.exportLoading = false;
  1128. }).catch(() => {
  1129. });
  1130. },
  1131. updateSendType() {
  1132. this.updateSendOpen = true;
  1133. },
  1134. cleanUpdateSendType() {
  1135. this.updateSendOpen = false;
  1136. },
  1137. submitUpdateSendTypeForm(){
  1138. updateSendType({ids: this.ids, type: this.type}).then(e => {
  1139. this.updateSendOpen = false;
  1140. this.$message.success("修改成功");
  1141. this.getList();
  1142. });
  1143. },
  1144. }
  1145. };
  1146. </script>
  1147. <style>
  1148. .text-container {
  1149. max-height: 7.5em; /* 设置最大高度为6行,根据字体大小调整 */
  1150. overflow-y: auto; /* 内容超出时显示滚动条 */
  1151. line-height: 1.5em; /* 行高设置,确保每行高度一致 */
  1152. }
  1153. .qr-login-dialog .el-dialog__body {
  1154. display: flex;
  1155. flex-direction: column;
  1156. align-items: center;
  1157. text-align: center;
  1158. padding: 20px;
  1159. }
  1160. .qr-login-container {
  1161. width: 100%;
  1162. }
  1163. .qr-login-instructions {
  1164. font-size: 14px;
  1165. color: #666;
  1166. margin: 10px 0;
  1167. }
  1168. .verification-code-input {
  1169. margin-top: 15px;
  1170. width: 80%;
  1171. }
  1172. </style>