index.vue 40 KB

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