index.vue 38 KB

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