myIndex.vue 39 KB

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