fastGptRole.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="客服名称" prop="roleName">
  5. <el-input
  6. v-model="queryParams.roleName"
  7. placeholder="请输入客服名称"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item>
  14. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  15. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  16. </el-form-item>
  17. </el-form>
  18. <el-table v-loading="loading" :data="fastGptRoleList">
  19. <el-table-column label="ID" align="center" prop="roleId" />
  20. <el-table-column label="客服名称" align="center" prop="roleName" />
  21. <el-table-column label="客服类型" align="center" prop="roleType" >
  22. <template slot-scope="scope">
  23. <el-tag prop="type" v-for="(item, index) in typeOptions" v-if="scope.row.roleType==item.dictValue">{{item.dictLabel}}</el-tag>
  24. </template>
  25. </el-table-column>
  26. <el-table-column label="客服应用头像" align="center" prop="avatar" >
  27. <template slot-scope="scope">
  28. <img :src="scope.row.avatar" style="height: 80px">
  29. </template>
  30. </el-table-column>
  31. <el-table-column label="提示词" align="center" prop="reminderWords" >
  32. <template slot-scope="scope">
  33. <el-tooltip class="item" effect="dark" :content="scope.row.reminderWords" placement="top">
  34. <div style="display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; text-overflow: ellipsis;">
  35. <span>{{ scope.row.reminderWords }}</span>
  36. </div>
  37. </el-tooltip>
  38. </template>
  39. </el-table-column>
  40. <el-table-column label="绑定的公司" align="center" prop="corpName" />
  41. <el-table-column label="操作" align="center">
  42. <template slot-scope="scope">
  43. <el-button
  44. size="mini"
  45. type="primary"
  46. plain
  47. icon="el-icon-edit"
  48. @click="handleBindAi(scope.row)"
  49. >绑定AI客服</el-button>
  50. <!-- <el-button
  51. style="margin-top: 2%"
  52. v-if="scope.row.corpName!=null"
  53. size="mini"
  54. type="primary"
  55. plain
  56. icon="el-icon-edit"
  57. @click="handleRelieveAi(scope.row)"
  58. >解绑</el-button>-->
  59. </template>
  60. </el-table-column>
  61. </el-table>
  62. <pagination
  63. v-show="total>0"
  64. :total="total"
  65. :page.sync="queryParams.pageNum"
  66. :limit.sync="queryParams.pageSize"
  67. @pagination="getList"
  68. />
  69. </div>
  70. </template>
  71. <script>
  72. import { newListFastGptRole, getFastGptRole, delFastGptRole, addFastGptRole, updateFastGptRole, exportFastGptRole,relieveFastGptRole } from "@/api/fastGpt/fastGptRole";
  73. import {BindAi, qwUserBindAi} from "../../../api/qw/user";
  74. export default {
  75. name: "FastGptRole",
  76. data() {
  77. return {
  78. // 遮罩层
  79. loading: true,
  80. // 导出遮罩层
  81. exportLoading: false,
  82. //AI客服类型
  83. typeOptions:[],
  84. qwUserId:null,
  85. corpId:null,
  86. companyId:null,
  87. //AI模型
  88. modeOptions:[],
  89. // 选中数组
  90. ids: [],
  91. // 非单个禁用
  92. single: true,
  93. // 非多个禁用
  94. multiple: true,
  95. // 显示搜索条件
  96. showSearch: true,
  97. // 总条数
  98. total: 0,
  99. // 应用表格数据
  100. fastGptRoleList: [],
  101. // 弹出层标题
  102. title: "",
  103. // 是否显示弹出层
  104. open: false,
  105. // 查询参数
  106. queryParams: {
  107. pageNum: 1,
  108. pageSize: 10,
  109. roleName: null,
  110. companyId: null,
  111. roleType: null,
  112. mode: null,
  113. kfId: null,
  114. kfUrl: null,
  115. avatar: null,
  116. kfMediaId: null,
  117. bindCorpId: null,
  118. },
  119. // 表单参数
  120. form: {},
  121. // 表单校验
  122. rules: {
  123. roleName: [
  124. { required: true, message: "角色名称不能为空", trigger: "blur" }
  125. ],
  126. roleType: [
  127. { required: true, message: "角色类型不能为空", trigger: "change" }
  128. ],
  129. }
  130. };
  131. },
  132. created() {
  133. //客服类型
  134. this.getDicts("chat_role_type").then((response) => {
  135. this.typeOptions = response.data;
  136. });
  137. this.getList();
  138. },
  139. methods: {
  140. /** 查询应用列表 */
  141. getList() {
  142. this.loading = true;
  143. this.queryParams.bindCorpId = this.corpId;
  144. newListFastGptRole(this.queryParams).then(response => {
  145. this.fastGptRoleList = response.rows;
  146. this.total = response.total;
  147. this.loading = false;
  148. });
  149. },
  150. // 取消按钮
  151. cancel() {
  152. this.open = false;
  153. this.reset();
  154. },
  155. handleRelieveAi(row){
  156. if (row.corpId!==this.corpId){
  157. return this.$message.error("当前企业无法解绑 其他企业 ");
  158. }
  159. this.$confirm('此处解绑-会将【所有】已绑定此应用的员工 的状态清除!确定要解除 应用:"' + row.roleId +"("+ row.roleName +')"的绑定?', "警告", {
  160. confirmButtonText: "确定",
  161. cancelButtonText: "取消",
  162. type: "warning"
  163. }).then(function() {
  164. return relieveFastGptRole(row.roleId);
  165. }).then(() => {
  166. this.getList();
  167. this.msgSuccess("解绑成功");
  168. }).catch(() => {});
  169. },
  170. // 表单重置
  171. reset() {
  172. this.form = {
  173. roleId: null,
  174. roleName: null,
  175. companyId: null,
  176. createTime: null,
  177. updateTime: null,
  178. roleType: null,
  179. modeConfigJson:{APPKey:null,Key:null},
  180. mode: null,
  181. kfId: null,
  182. kfUrl: null,
  183. avatar: null,
  184. kfMediaId: null,
  185. reminderWords: null
  186. };
  187. this.resetForm("form");
  188. },
  189. /** 搜索按钮操作 */
  190. handleQuery() {
  191. this.queryParams.pageNum = 1;
  192. this.getList();
  193. },
  194. /** 重置按钮操作 */
  195. resetQuery() {
  196. this.resetForm("queryForm");
  197. this.handleQuery();
  198. },
  199. //重置参数
  200. resetParam(){
  201. this.qwUserId = null;
  202. this.corpId = null;
  203. this.getList();
  204. },
  205. handleBindAi(row){
  206. qwUserBindAi({id:this.qwUserId,fastGptRoleId:row.roleId,corpId:this.corpId}).then(res => {
  207. this.$message.success(res.msg);
  208. this.resetParam();
  209. this.$emit("refreshFastGptList");
  210. });
  211. },
  212. handleBindAiData(val){
  213. this.qwUserId=val.id;
  214. this.corpId=val.corpId;
  215. this.queryParams.bindCorpId = val.corpId;
  216. this.queryParams.companyId = val.companyId;
  217. // 设置完数据后主动查询
  218. this.getList();
  219. }
  220. }
  221. };
  222. </script>