myIndex.vue 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293
  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. this.getList()
  878. })
  879. },
  880. handleUpdateIsAuto(val,code) {
  881. this.isAutoForm={
  882. id:val.id,
  883. isAuto:code
  884. }
  885. updateIsAuto(this.isAutoForm).then(res => {
  886. if (code==='00'){
  887. this.$message.success('禁用成功');
  888. }else {
  889. this.$message.success('启用成功');
  890. }
  891. this.getList();
  892. });
  893. },
  894. //传验证码
  895. handleLoginQwCodeMsg() {
  896. loginQwCodeMsg({appKey: this.qwLogin.appKey, code: this.qwLogin.code}).then(res => {
  897. this.qwLogin.open = false;
  898. this.$message.success("登录成功");
  899. })
  900. },
  901. validateCode() {
  902. // 只允许输入数字并限制长度为6
  903. this.qwLogin.code = this.qwLogin.code.replace(/\D/g, "").slice(0, 6);
  904. },
  905. handleCloudAP(urlAP) {
  906. selectCloudAP({ipAddress: urlAP}).then(res => {
  907. this.cloudAPOpen.open = true
  908. this.cloudAPOpen.admin = res.data.apAdmin;
  909. this.cloudAPOpen.passWord = res.data.apPassword;
  910. })
  911. },
  912. handleUnbindCloudHost(val) {
  913. const appKey = val.appKey;
  914. this.$confirm(
  915. '确定要给企微账号:<span style="color: green;">' + val.qwUserId + '' +
  916. '</span><br>企微昵称:<span style="color: red;">【' + val.qwUserName + '】</span>' +
  917. '</span><br><span style="color: orange;">解绑【Ps:解绑后此云主机可能会分配给他人】</span></span>',
  918. "警告",
  919. {
  920. confirmButtonText: "确定",
  921. cancelButtonText: "取消",
  922. type: "warning",
  923. dangerouslyUseHTMLString: true // 允许使用 HTML 字符串
  924. }
  925. ).then(() => {
  926. return qwUnbindCloudHost(appKey);
  927. }).then(response => {
  928. this.$message.success('解绑成功');
  929. }).finally(res => {
  930. this.getList();
  931. })
  932. },
  933. handleAuthorizeKey(val) {
  934. this.authorizeKeyFrom.id = val.id;
  935. this.authorizeKeyFrom.qwUserId = val.qwUserId;
  936. this.authorizeKeyFrom.qwUserName = val.qwUserName;
  937. this.authorizeKeyOpen = true;
  938. },
  939. submitAuthorizeKeyForm() {
  940. this.$refs["authorizeKeyFrom"].validate(valid => {
  941. if (valid) {
  942. if (this.authorizeKeyFrom.id != null && this.authorizeKeyFrom.appKey != null) {
  943. this.uploadAuthorizeKey();
  944. }
  945. }
  946. });
  947. },
  948. submitCallOpenFrom() {
  949. this.$refs["callOpenFrom"].validate(valid => {
  950. if (valid) {
  951. if (this.callOpenFrom.id != null && this.callOpenFrom.welcomeText != null) {
  952. updateUser(this.callOpenFrom).then(res => {
  953. this.$message.success('修改成功');
  954. this.callOpen.open = false;
  955. this.getList();
  956. });
  957. }
  958. }
  959. });
  960. },
  961. submitEditRemarkOpenFrom() {
  962. if (this.editRemarkOpen.id != null && this.editRemarkOpen.isSendMsg != null) {
  963. updateUser(this.editRemarkOpen).then(res => {
  964. this.$message.success('修改成功');
  965. this.editRemarkOpen.open = false;
  966. this.getList();
  967. });
  968. } else {
  969. this.$message.error("请选择条件")
  970. }
  971. },
  972. uploadAuthorizeKey() {
  973. this.$confirm(
  974. '确定要给企微账号:<span style="color: green;">' + this.authorizeKeyFrom.qwUserId + '' +
  975. '</span><br>企微昵称:<span style="color: red;">【' + this.authorizeKeyFrom.qwUserName + '】</span>' +
  976. '</span><br>授权key:<span style="color: #04adf6;">【' + this.authorizeKeyFrom.appKey + '】</span>?',
  977. "警告",
  978. {
  979. confirmButtonText: "确定",
  980. cancelButtonText: "取消",
  981. type: "warning",
  982. dangerouslyUseHTMLString: true // 允许使用 HTML 字符串
  983. }
  984. ).then(() => {
  985. this.authorizeKeyOpen = false;
  986. return handleInputAuthAppKey(this.authorizeKeyFrom);
  987. }).then(response => {
  988. this.msgSuccess("授权key完成");
  989. }).finally(res => {
  990. this.resetAuthorizeKeyFrom();
  991. this.getList();
  992. })
  993. },
  994. uploadAuthorizeKey2(val) {
  995. const id = val.id;
  996. this.$confirm(
  997. '确定要给企微账号:<span style="color: green;">' + val.qwUserId + '' +
  998. '</span><br>企微昵称:<span style="color: red;">【' + val.qwUserName + '】</span>' +
  999. '</span><br>授权key</span>?',
  1000. "警告",
  1001. {
  1002. confirmButtonText: "确定",
  1003. cancelButtonText: "取消",
  1004. type: "warning",
  1005. dangerouslyUseHTMLString: true // 允许使用 HTML 字符串
  1006. }
  1007. ).then(() => {
  1008. return handleAuthAppKey({id: id});
  1009. }).then(response => {
  1010. this.msgSuccess("授权key完成");
  1011. }).finally(res => {
  1012. this.resetAuthorizeKeyFrom();
  1013. this.getList();
  1014. })
  1015. },
  1016. handleBindCloudHost(val) {
  1017. if (val.appKey == null || val.appKey == '') {
  1018. return this.$message.warning('没有授权码,无法绑定主机,请联系管理员');
  1019. }
  1020. const appKey = val.appKey;
  1021. this.$confirm(
  1022. '确定要给企微账号:<span style="color: green;">' + val.qwUserId + '' +
  1023. '</span><br>企微昵称:<span style="color: red;">【' + val.qwUserName + '】</span>' +
  1024. '</span><br><span style="color: dodgerblue;">绑定云主机?</span></span>',
  1025. "警告",
  1026. {
  1027. confirmButtonText: "确定",
  1028. cancelButtonText: "取消",
  1029. type: "warning",
  1030. dangerouslyUseHTMLString: true // 允许使用 HTML 字符串
  1031. }
  1032. ).then(() => {
  1033. return qwBindCloudHost(appKey);
  1034. }).then(response => {
  1035. this.$message.success('绑定成功,请登录云主机进行配置~~');
  1036. }).finally(res => {
  1037. this.getList();
  1038. })
  1039. },
  1040. openImageViewer(url) {
  1041. // 打开大图预览对话框
  1042. this.dialogImageUrl = url
  1043. this.dialogVisible = true;
  1044. },
  1045. //刷新页面
  1046. refreshFastGptList() {
  1047. this.bindAiOpen = false;
  1048. this.getList();
  1049. },
  1050. // 取消按钮
  1051. cancel() {
  1052. this.open = false;
  1053. this.reset();
  1054. },
  1055. // 表单重置
  1056. reset() {
  1057. this.form = {
  1058. id: null,
  1059. qwUserId: null,
  1060. corpId: null,
  1061. qwUserName: null,
  1062. };
  1063. this.resetForm("form");
  1064. },
  1065. //重置授权
  1066. resetAuthorizeKeyFrom() {
  1067. this.authorizeKeyFrom = {
  1068. id: null,
  1069. appKey: null,
  1070. qwUserId: null,
  1071. qwUserName: null
  1072. };
  1073. },
  1074. //重置登录
  1075. resetQwLogin() {
  1076. this.qwLogin = {
  1077. title: "",
  1078. open: false,
  1079. codeUrl: null,
  1080. code: null,
  1081. corpId: null,
  1082. qwUserId: null,
  1083. }
  1084. this.qwLogin.open = false;
  1085. this.loading = false;
  1086. this.getList();
  1087. },
  1088. //解绑AI客服
  1089. relieveFastGptRole(row) {
  1090. this.$confirm('是否确认解绑AI客服?', "警告", {
  1091. confirmButtonText: "确定",
  1092. cancelButtonText: "取消",
  1093. type: "warning"
  1094. }).then(function () {
  1095. return relieveFastGptRoleById(row.id);
  1096. }).then(() => {
  1097. this.getList();
  1098. this.msgSuccess("解绑成功");
  1099. })
  1100. },
  1101. /** 搜索按钮操作 */
  1102. handleQuery() {
  1103. this.queryParams.pageNum = 1;
  1104. this.getList();
  1105. },
  1106. /** 重置按钮操作 */
  1107. resetQuery() {
  1108. this.resetForm("queryForm");
  1109. this.queryParams.loginStatus = null;
  1110. this.queryParams.corpId = this.myQwCompanyList[0].dictValue;
  1111. this.handleQuery();
  1112. },
  1113. // 多选框选中数据
  1114. handleSelectionChange(selection) {
  1115. this.ids = selection.map(item => item.id)
  1116. this.names = selection.map(item => item.qwUserName)
  1117. this.single = selection.length !== 1
  1118. this.multiple = !selection.length
  1119. },
  1120. /** 提交按钮 */
  1121. submitForm() {
  1122. this.$refs["form"].validate(valid => {
  1123. if (valid) {
  1124. if (this.form.id != null) {
  1125. // updateUser(this.form).then(response => {
  1126. // this.msgSuccess("绑定成功");
  1127. // this.open = false;
  1128. // this.getList();
  1129. //
  1130. // });
  1131. } else {
  1132. // addUser(this.form).then(response => {
  1133. // this.msgSuccess("新增成功");
  1134. // this.open = false;
  1135. // this.getList();
  1136. // });
  1137. }
  1138. }
  1139. });
  1140. },
  1141. /** 导出按钮操作 */
  1142. handleExport() {
  1143. const queryParams = this.queryParams;
  1144. this.$confirm('是否确认导出所有企微员工数据项?', "警告", {
  1145. confirmButtonText: "确定",
  1146. cancelButtonText: "取消",
  1147. type: "warning"
  1148. }).then(() => {
  1149. this.exportLoading = true;
  1150. return exportStaff(queryParams);
  1151. }).then(response => {
  1152. this.download(response.msg);
  1153. this.exportLoading = false;
  1154. }).catch(() => {
  1155. });
  1156. },
  1157. updateSendType() {
  1158. this.updateSendOpen = true;
  1159. },
  1160. cleanUpdateSendType() {
  1161. this.updateSendOpen = false;
  1162. },
  1163. submitUpdateSendTypeForm(){
  1164. updateSendType({ids: this.ids, type: this.type}).then(e => {
  1165. this.updateSendOpen = false;
  1166. this.$message.success("修改成功");
  1167. this.getList();
  1168. });
  1169. },
  1170. }
  1171. };
  1172. </script>
  1173. <style>
  1174. .text-container {
  1175. max-height: 7.5em; /* 设置最大高度为6行,根据字体大小调整 */
  1176. overflow-y: auto; /* 内容超出时显示滚动条 */
  1177. line-height: 1.5em; /* 行高设置,确保每行高度一致 */
  1178. }
  1179. .qr-login-dialog .el-dialog__body {
  1180. display: flex;
  1181. flex-direction: column;
  1182. align-items: center;
  1183. text-align: center;
  1184. padding: 20px;
  1185. }
  1186. .qr-login-container {
  1187. width: 100%;
  1188. }
  1189. .qr-login-instructions {
  1190. font-size: 14px;
  1191. color: #666;
  1192. margin: 10px 0;
  1193. }
  1194. .verification-code-input {
  1195. margin-top: 15px;
  1196. width: 80%;
  1197. }
  1198. </style>