yys 5 godzin temu
rodzic
commit
3cdf644bc3

+ 28 - 0
.env.prod-tyt

@@ -0,0 +1,28 @@
+# 页面标题
+VUE_APP_TITLE =互联网医院管理系统
+# 公司名称
+VUE_APP_COMPANY_NAME =重庆太乙堂云联互联网医院有限公司
+# ICP备案号
+VUE_APP_ICP_RECORD = 渝ICP备2023010906号-8
+# ICP网站访问地址
+VUE_APP_ICP_URL =https://beian.miit.gov.cn
+# 网站LOG
+VUE_APP_LOG_URL =@/assets/logo/tyt.png
+
+# 生产环境配置
+ENV = 'production'
+
+# FS管理系统/开发环境
+VUE_APP_BASE_API = '/prod-api'
+
+#默认 1、会员 2、企微
+VUE_APP_COURSE_DEFAULT = 1
+
+#项目所属
+VUE_APP_PROJECT_FROM=tyt
+
+# 路由懒加载
+VUE_CLI_BABEL_TRANSPILE_MODULES = true
+
+# 直播webSocket地址
+VUE_APP_LIVE_WS_URL = wss://liveapp.cqtyt.com/ws

+ 0 - 35
build/index.js

@@ -1,35 +0,0 @@
-const { run } = require('runjs')
-const chalk = require('chalk')
-const config = require('../vue.config.js')
-const rawArgv = process.argv.slice(2)
-const args = rawArgv.join(' ')
-
-if (process.env.npm_config_preview || rawArgv.includes('--preview')) {
-  const report = rawArgv.includes('--report')
-
-  run(`vue-cli-service build ${args}`)
-
-  const port = 9526
-  const publicPath = config.publicPath
-
-  var connect = require('connect')
-  var serveStatic = require('serve-static')
-  const app = connect()
-
-  app.use(
-    publicPath,
-    serveStatic('./dist', {
-      index: ['index.html', '/']
-    })
-  )
-
-  app.listen(port, function () {
-    console.log(chalk.green(`> Preview at  http://localhost:${port}${publicPath}`))
-    if (report) {
-      console.log(chalk.green(`> Report at  http://localhost:${port}${publicPath}report.html`))
-    }
-
-  })
-} else {
-  run(`vue-cli-service build ${args}`)
-}

+ 1 - 0
package.json

@@ -26,6 +26,7 @@
     "build:prod-myhk": "vue-cli-service build --mode prod-myhk",
     "build:prod-fzbt": "vue-cli-service build --mode prod-fzbt",
     "build:prod-sft": "vue-cli-service build --mode prod-sft",
+    "build:prod-tyt": "vue-cli-service build --mode prod-tyt",
     "build:prod-zsjk": "vue-cli-service build --mode prod-zsjk",
     "build:prod-lmjy": "vue-cli-service build --mode prod-lmjy",
     "build:prod-bnkc": "vue-cli-service build --mode prod-bnkc",

+ 8 - 0
src/api/company/companyUser.js

@@ -395,3 +395,11 @@ export function unbindSaleAndFsUser(data) {
     data
   });
 }
+// 更新用户ai角色
+export function updateUserRole(data) {
+  return request({
+    url: '/company/user/updateUserRole',
+    method: 'post',
+    data: data
+  })
+}

+ 7 - 0
src/api/fastGpt/fastGptRole.js

@@ -79,3 +79,10 @@ export function exportFastGptRole(query) {
     params: query
   })
 }
+// 查询角色名和id
+export function listFastGptRoleNameAndId() {
+  return request({
+    url: '/fastGpt/fastGptRole/listNameAndId',
+    method: 'get'
+  })
+}

+ 53 - 0
src/api/fastGpt/imChatMsg.js

@@ -0,0 +1,53 @@
+import request from '@/utils/request'
+
+// 查询聊天消息列表
+export function listMsg(query) {
+  return request({
+    url: '/im/msg/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询聊天消息详细
+export function getMsg(msgId) {
+  return request({
+    url: '/im/msg/' + msgId,
+    method: 'get'
+  })
+}
+
+// 新增聊天消息
+export function addMsg(data) {
+  return request({
+    url: '/im/msg',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改聊天消息
+export function updateMsg(data) {
+  return request({
+    url: '/im/msg',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除聊天消息
+export function delMsg(msgId) {
+  return request({
+    url: '/im/msg/' + msgId,
+    method: 'delete'
+  })
+}
+
+// 导出聊天消息
+export function exportMsg(query) {
+  return request({
+    url: '/im/msg/export',
+    method: 'get',
+    params: query
+  })
+}

+ 60 - 0
src/api/fastGpt/imChatSession.js

@@ -0,0 +1,60 @@
+import request from '@/utils/request'
+
+// 查询聊天会话列表
+export function listSession(query) {
+  return request({
+    url: '/im/session/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询聊天会话详细
+export function getSession(sessionId) {
+  return request({
+    url: '/im/session/' + sessionId,
+    method: 'get'
+  })
+}
+
+// 新增聊天会话
+export function addSession(data) {
+  return request({
+    url: '/im/session',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改聊天会话
+export function updateSession(data) {
+  return request({
+    url: '/im/session',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除聊天会话
+export function delSession(sessionId) {
+  return request({
+    url: '/im/session/' + sessionId,
+    method: 'delete'
+  })
+}
+
+// 导出聊天会话
+export function exportSession(query) {
+  return request({
+    url: '/im/session/export',
+    method: 'get',
+    params: query
+  })
+}
+// 取消ai自动回复
+export function updateImSessionToPerson(chatId) {
+  return request({
+    url: '/im/session/updateImSessionToPerson?chatId=' + chatId,
+    method: 'get',
+  })
+}

+ 46 - 0
src/views/company/companyUser/index.vue

@@ -262,6 +262,7 @@
                 @click="qwBind(scope.row)"
                 v-hasPermi="['qw:user:bind']"
               >查或换绑企微</el-button>
+              <el-button size="mini" type="text" icon="el-icon-edit" @click="saleAiBind(scope.row)" v-hasPermi="['company:user:bindAI']">绑定客服ai</el-button>
               <el-button
                 size="mini"
                 type="text"
@@ -796,6 +797,22 @@
         <el-button type="primary" @click="confirmBindMember" size="small">确 定</el-button>
       </div>
     </el-dialog>
+    <!--   绑定ai客服 -->
+    <el-dialog :title="fastgptRoleDialog.title" :visible.sync="fastgptRoleDialog.open" width="300px" append-to-body>
+      <el-select v-model="userFastGptRole"  filterable placeholder="请选择绑定的ai客服" style="width: 200px;">
+        <el-option
+          v-for="item in fastGptRoleList"
+          :key="item.roleId"
+          :label="item.roleName"
+          :value="item.roleId"
+        ></el-option>
+      </el-select>
+      <div slot="footer" style="text-align: center;">
+        <el-button type="primary" @click="submitFormRole(userFastGptRole)">确 定</el-button>
+        <el-button @click="fastgptRoleDialog.open = false">取 消</el-button>
+      </div>
+    </el-dialog>
+
   </div>
 </template>
 
@@ -811,6 +828,7 @@ import {
   importTemplate,
   getCitysAreaList,
   changeUserStatus,
+  updateUserRole,
   generateSubDomain,
   setIsRegisterMember,
   updateCompanyUserAreaList,
@@ -832,11 +850,19 @@ import { getConfigByKey } from "@/api/company/companyConfig";
 import axios from "axios";
 import {addCodeUrl} from "../../../api/company/companyUser";
 import selectDoctor from "@/views/qw/user/selectDoctor.vue";
+import { listFastGptRole,listFastGptRoleNameAndId } from "@/api/fastGpt/fastGptRole";
 export default {
   name: "User",
   components: {selectDoctor, Treeselect ,selectUser},
   data() {
     return {
+      userFastGptRole:null,
+      fastgptRoleDialog:{
+        open:false,
+        title:"绑定Ai客服角色",
+      },
+      userFastGptForm:{},
+      fastGptRoleList: [],
       doctor: {
         open: false,
         title: '绑定医生'
@@ -1086,8 +1112,28 @@ export default {
     getMyQwCompanyList().then(response => {
       this.myQwCompanyList = response.data;
     });
+    this.getFastGptList();
   },
   methods: {
+    submitFormRole(roleId){
+      this.userFastGptForm.fastgptRoleId = roleId;
+      updateUserRole(this.userFastGptForm).then(res=>{
+        if (res.code == 200) {
+          this.getList();
+          this.fastgptRoleDialog.open = false
+        }
+      })
+    },
+    getFastGptList() {
+      listFastGptRoleNameAndId().then(response => {
+        this.fastGptRoleList = [...this.fastGptRoleList, ...response.data]
+      });
+    },
+    saleAiBind(row){
+      this.userFastGptRole = null
+      this.fastgptRoleDialog.open = true
+      this.userFastGptForm.userId = row.userId
+    },
     handlePagination(data) {
       // 添加防抖或判断,避免初始化时自动触发
       if (this.member.open) {

+ 294 - 0
src/views/fastGpt/imChatMsg/index.vue

@@ -0,0 +1,294 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="用户昵称" prop="nickName">
+        <el-input
+          v-model="queryParams.nickName"
+          placeholder="请输入用户昵称"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="客服角色" prop="roleId">
+        <el-select v-model="queryParams.roleId" placeholder="请选择客服角色" clearable size="small">
+          <el-option
+                v-for="item in roles"
+                :key="item.roleId"
+                :label="item.roleName"
+                :value="item.roleId"
+              />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="消息类型" prop="msgType">
+          <el-select v-model="queryParams.msgType" placeholder="请选择类型" clearable size="small">
+           <el-option
+             v-for="item in typeOptions"
+               :key="item.dictValue"
+               :label="item.dictLabel"
+               :value="item.dictValue"
+             />
+          </el-select>
+      </el-form-item>
+
+      <el-form-item label="发送时间" prop="createTime">
+        <el-date-picker
+           style="width:220px"
+           clearable size="small"
+           v-model="dateRange"
+           type="daterange"
+           value-format="yyyy-MM-dd"
+           start-placeholder="开始日期"
+           end-placeholder="结束日期">
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+          v-hasPermi="['chat:chatMsg:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table border v-loading="loading" :data="chatMsgList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="ID" align="center" prop="msgId" />
+      <el-table-column label="用户" align="center" prop="nickName" />
+      <el-table-column label="头像" width="150" align="center">
+        <template slot-scope="scope">
+          <img :src="scope.row.avatar" style="height: 80px">
+        </template>
+      </el-table-column>
+      <el-table-column label="AI客服" align="center" prop="roleName" />
+      <el-table-column show-overflow-tooltip label="消息内容" align="center" prop="content" />
+      <el-table-column  label="消息类型"  align="center" prop="msgType">
+            <template slot-scope="scope">
+                <el-tag prop="type" v-for="(item, index) in typeOptions"    v-if="scope.row.msgType==item.dictValue">{{item.dictLabel}}</el-tag>
+              </template>
+      </el-table-column>
+      <el-table-column  label="发送方式"  align="center" prop="sendType">
+            <template slot-scope="scope">
+                <el-tag prop="type" v-for="(item, index) in sendTypeOptions"    v-if="scope.row.sendType==item.dictValue">{{item.dictLabel}}</el-tag>
+            </template>
+      </el-table-column>
+
+      <el-table-column label="发送时间" align="center" prop="createTime" />
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+  </div>
+</template>
+
+<script>
+import { listFastGptChatMsg, getFastGptChatMsg, delFastGptChatMsg, addFastGptChatMsg, updateFastGptChatMsg, exportFastGptChatMsg } from "@/api/fastGpt/fastGptChatMsg";
+import { getAllRoleList } from "@/api/fastGpt/fastGptRole";
+
+export default {
+  name: "imChatMsg",
+  data() {
+    return {
+      show:{
+              title:"聊天详情",
+              open:false,
+            },
+      roles:[],
+      dateRange:[],
+      typeOptions:[],
+      sendTypeOptions:[],
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 聊天消息记录表格数据
+      chatMsgList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        chatId: null,
+        content: null,
+        msgType: null,
+        sendType: null,
+        companyId: null,
+        roleId: null,
+        companyUserId: null,
+        msgJson: null
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+      }
+    };
+  },
+  created() {
+    this.getDicts("chat_msg_type").then((response) => {
+      this.typeOptions = response.data;
+    });
+    this.getDicts("chat_msg_send_type").then((response) => {
+      this.sendTypeOptions = response.data;
+    });
+    getAllRoleList().then(response => {
+        this.roles = response.data;
+    });
+    this.getList();
+  },
+  methods: {
+    handleShow(){
+
+    },
+    /** 查询聊天消息记录列表 */
+    getList() {
+      this.loading = true;
+      listFastGptChatMsg(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
+        this.chatMsgList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        msgId: null,
+        chatId: null,
+        content: null,
+        msgType: null,
+        sendType: null,
+        companyId: null,
+        roleId: null,
+        companyUserId: null,
+        createTime: null,
+        msgJson: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.dateRange=null
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.msgId)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加聊天消息记录";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const msgId = row.msgId || this.ids
+      getFastGptChatMsg(msgId).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改聊天消息记录";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.msgId != null) {
+            updateFastGptChatMsg(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addFastGptChatMsg(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const msgIds = row.msgId || this.ids;
+      this.$confirm('是否确认删除聊天消息记录编号为"' + msgIds + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delFastGptChatMsg(msgIds);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有聊天消息记录数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.exportLoading = true;
+          return exportFastGptChatMsg(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+          this.exportLoading = false;
+        }).catch(() => {});
+    }
+  }
+};
+</script>
+
+<style lang="css">
+  .el-tooltip__popper{
+    max-width:40%
+  }
+</style>

+ 107 - 0
src/views/fastGpt/imChatSession/imChatMsgDetails.vue

@@ -0,0 +1,107 @@
+<template>
+    <div style="background-color: #f0f2f5; padding-bottom: 20px; min-height: 100%; " >
+      <div style="padding: 20px; background-color: #fff;">
+         查看聊天记录
+      </div>
+      <div class="contentx" v-if="item!=null">
+          <div class="desct"> 会话详情</div>
+          <el-descriptions title="" :column="3" border>
+            <el-descriptions-item label="会话标识"><span v-if="item!=null">{{item.chatId}}</span></el-descriptions-item>
+            <el-descriptions-item label="咨询客户"><span v-if="item!=null">{{item.nickName}}</span></el-descriptions-item>
+            <el-descriptions-item label="客服账号" span="3"><span v-if="item!=null">{{item.roleName}}</span></el-descriptions-item>
+            <el-descriptions-item label="接待时间"><span v-if="item!=null">{{item.createTime}}</span></el-descriptions-item>
+            <el-descriptions-item label="结束时间"><span v-if="item!=null">{{item.updateTime}}</span></el-descriptions-item>
+          </el-descriptions>
+      </div>
+      <div class="contentx" v-if="item!=null">
+          <div class="desct"> 查看聊天记录</div>
+          <div class="block">
+            <el-timeline>
+              <el-timeline-item v-for="(i, index) in msgList" :key="index" :timestamp="i.createTime" placement="top">
+                <el-card>
+                  <h4 v-if="i.sendType==1">{{ item.nickName }}</h4>
+                  <h4 v-else>{{item.roleName}}</h4>
+                  <p>{{i.content}}</p>
+                 <!-- <p v-if="i.sendType==2" style="color: #c8cacb;">{{i.status==1?'正确':'未标记'}}</p>
+                  <el-link type="primary" :underline="false" v-if="i.sendType==2" class="ivu-pl-8" @click="updateLogs(i.msgId)" style="float: right; margin-right: 20px; margin-bottom: 20px;">修改记录</el-link>
+                  <el-link type="primary" :underline="false" v-if="i.sendType==2" class="ivu-pl-8" @click="updateMsgStatus(i.msgId)" style="float: right; margin-right: 20px; ">√</el-link>
+                  <el-link type="primary" :underline="false" v-if="i.sendType==2" class="ivu-pl-8" @click="updateMsg(i.msgId)" style="float: right; margin-right: 20px; ">X</el-link> -->
+                </el-card>
+              </el-timeline-item>
+            </el-timeline>
+          </div>
+      </div>
+
+
+    </div>
+</template>
+
+<script>
+
+import { getSession } from "@/api/fastGpt/imChatSession";
+  export default {
+    name: "imChatMsgDetails",
+    data() {
+      return {
+        sessionStatusOptions:[],
+        open:false,
+        logsOpen:false,
+        // 方剂类型字典
+        typeOptions:[],
+        sendTypeOptions:[],
+        msgList:[],
+        // 状态字典
+        statusOptions: [],
+        item:null,
+        form: {},
+      }
+    },
+    created() {
+      this.getDicts("sys_chat_session_status").then(response => {
+        this.sessionStatusOptions = response.data;
+      });
+      this.getDicts("chat_msg_type").then((response) => {
+        this.typeOptions = response.data;
+      });
+      this.getDicts("chat_msg_send_type").then((response) => {
+        this.sendTypeOptions = response.data;
+      });
+    },
+    methods: {
+      getDetails(id) {
+        this.item=null;
+        getSession(id).then(response => {
+            this.item = response.data;
+            this.msgList = response.list;
+        });
+      },
+    }
+  }
+</script>
+<style>
+  .contentx{
+      height: 100%;
+      background-color: #fff;
+      padding: 0px 20px 20px;
+
+
+      margin: 20px;
+  }
+  .el-descriptions-item__label.is-bordered-label{
+    font-weight: normal;
+  }
+  .el-descriptions-item__content {
+    max-width: 150px;
+    min-width: 100px;
+  }
+  .desct{
+      padding-top: 20px;
+      padding-bottom: 20px;
+      color: #524b4a;
+      font-weight: bold;
+    }
+  .padding-a{
+    padding-right: 10px;
+
+  }
+</style>

+ 423 - 0
src/views/fastGpt/imChatSession/index.vue

@@ -0,0 +1,423 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="会话标识" prop="chatId">
+        <el-input
+          v-model="queryParams.chatId"
+          placeholder="请输入会话标识"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="客服名称" prop="nickName">
+        <el-input
+          v-model="queryParams.nickName"
+          placeholder="请输入客服名称"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+
+      <el-form-item label="用户名称" prop="userName">
+        <el-input
+          v-model="queryParams.userName"
+          placeholder="请输入用户名称"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="查看状态" prop="isLook">
+        <el-select v-model="queryParams.isLook" placeholder="请选择" clearable size="small">
+          <el-option
+            v-for="item in sessionLookOptions"
+            :key="item.dictValue"
+            :label="item.dictLabel"
+            :value="item.dictValue"
+          />
+        </el-select>
+      </el-form-item>
+
+      <el-form-item label="接待时间" prop="createTime">
+        <el-date-picker
+          style="width:220px"
+          clearable size="small"
+          v-model="dateRange"
+          type="daterange"
+          value-format="yyyy-MM-dd"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期">
+          @change="changeTime"
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+<!--      <el-col :span="1.5">-->
+<!--        <el-button-->
+<!--          type="primary"-->
+<!--          plain-->
+<!--          icon="el-icon-plus"-->
+<!--          size="mini"-->
+<!--          @click="handleAdd"-->
+<!--          v-hasPermi="['fastGpt:fastGptChatSession:add']"-->
+<!--        >新增</el-button>-->
+<!--      </el-col>-->
+<!--      <el-col :span="1.5">-->
+<!--        <el-button-->
+<!--          type="success"-->
+<!--          plain-->
+<!--          icon="el-icon-edit"-->
+<!--          size="mini"-->
+<!--          :disabled="single"-->
+<!--          @click="handleUpdate"-->
+<!--          v-hasPermi="['fastGpt:fastGptChatSession:edit']"-->
+<!--        >修改</el-button>-->
+<!--      </el-col>-->
+    <el-col :span="1.5">
+       <el-button
+         type="danger"
+         plain
+         icon="el-icon-delete"
+         size="mini"
+         :disabled="multiple"
+         @click="handleDelete"
+         v-hasPermi="['fastGpt:fastGptChatSession:remove']"
+       >删除</el-button>
+      </el-col>
+<!--      <el-col :span="1.5">-->
+<!--        <el-button-->
+<!--          type="warning"-->
+<!--          plain-->
+<!--          icon="el-icon-download"-->
+<!--          size="mini"-->
+<!--          :loading="exportLoading"-->
+<!--          @click="handleExport"-->
+<!--          v-hasPermi="['fastGpt:fastGptChatSession:export']"-->
+<!--        >导出</el-button>-->
+<!--      </el-col>-->
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" border :data="imChatSessionList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="会话标识" align="center" prop="chatId" />
+      <el-table-column label="客服名称" align="center" prop="nickName" />
+      <el-table-column label="用户名称" align="center" prop="userName" />
+      <el-table-column label="当前回复状态" align="center">
+        <template slot-scope="scope">
+          <el-tag
+            :type="isPersonReply(scope.row) ? 'success' : 'warning'"
+            size="mini"
+          >
+            {{ isPersonReply(scope.row) ? '人工' : 'AI' }}
+          </el-tag>
+        </template>
+      </el-table-column>
+
+      <el-table-column label="头像" align="center" prop="avatar" >
+        <template slot-scope="scope">
+          <el-image
+            v-if="scope.row.avatar != null"
+            :src="scope.row.avatar"
+            :preview-src-list="[scope.row.avatar]"
+            :style="{ width: '100px', height: '100px' }"
+          ></el-image>
+        </template>
+      </el-table-column>
+      <el-table-column label="接待时间" align="center" prop="createTime" >
+        <template slot-scope="scope">
+          <span v-if="!scope.row.updateTime && scope.row.status === 1">
+            {{ scope.row.createTime }} - 未结束
+          </span>
+          <span v-else>
+            {{ scope.row.createTime }} - {{ scope.row.updateTime }}
+          </span>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            @click="handleToggleReply(scope.row)"
+          >
+            {{ isAiReply(scope.row) ? '取消AI回复' : '切换AI回复' }}
+          </el-button>
+
+          <el-button
+            size="mini"
+            type="text"
+            @click="handleDetails(scope.row)"
+          >
+            查看
+          </el-button>
+        </template>
+      </el-table-column>
+
+    </el-table>
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+    <el-drawer
+      :with-header="false"
+      size="75%"  @close="handleDrawerClose"
+      :title="show.title" :visible.sync="show.open">
+      <imChatMsgDetails  ref="Details" />
+    </el-drawer>
+  </div>
+</template>
+
+<script>
+import { listSession, updateImSessionToPerson } from "@/api/fastGpt/imChatSession";
+import imChatMsgDetails from "@/views/fastGpt/imChatSession/imChatMsgDetails.vue";
+
+export default {
+  name: "imChatSession",
+  components: {imChatMsgDetails},
+  data() {
+    return {
+      show:{
+        title:"聊天详情",
+        open:false,
+      },
+      //接待时间
+      dateRange:[],
+      //会话状态
+      sessionStatusOptions:[],
+      //查看状态
+      sessionLookOptions:[],
+	  orOptions:[],
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 对话关系表格数据
+      imChatSessionList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        chatId: null,
+        userId: null,
+        kfId: null,
+        status: null,
+        companyId: null,
+        isLook: null,
+        userType: null,
+        nickName: null,
+        avatar: null,
+        qwUserName: null,
+        roleName: null,
+        question:null,
+        answer:null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+      }
+    };
+  },
+  created() {
+    this.getDicts("sys_chat_session_status").then(response => {
+      this.sessionStatusOptions = response.data;
+    });
+    this.getDicts("sys_chat_session_look").then(response => {
+      this.sessionLookOptions = response.data;
+    });
+	this.getDicts("sys_company_or").then(response => {
+	  this.orOptions = response.data;
+	});
+    this.getList();
+  },
+  methods: {
+    isPersonReply(row) {
+      return Number(row.personOrAi) === 1;
+    },
+    isAiReply(row) {
+      return Number(row.personOrAi) === 2;
+    },
+    /** 查询对话关系列表 */
+    getList() {
+      this.loading = true;
+      listSession(this.queryParams).then(response => {
+        this.imChatSessionList = (response.rows || []).map(row => ({
+          ...row,
+          personOrAi: row.personOrAi == null ? row.personOrAi : Number(row.personOrAi)
+        }));
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    //查看按钮
+    handleDetails(row){
+      this.show.open=true;
+      setTimeout(() => {
+        this.$refs.Details.getDetails(row.sessionId);
+      }, 500);
+    },
+    handleToggleReply(row) {
+      const isPerson = this.isPersonReply(row);
+      const message = isPerson
+        ? '是否确认切换编号为:"' + row.chatId + '"为AI回复?'
+        : '是否确认取消编号为:"' + row.chatId + '"的AI回复?';
+      const successMsg = isPerson ? "已切换为AI回复" : "已切换为人工回复";
+      this.$confirm(message, "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        return updateImSessionToPerson(row.chatId);
+      }).then(() => {
+        this.getList();
+        this.msgSuccess(successMsg);
+      }).catch(() => {});
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        sessionId: null,
+        chatId: null,
+        userId: null,
+        kfId: null,
+        createTime: null,
+        updateTime: null,
+        status: 0,
+        companyId: null,
+        isLook: null,
+        userType: null,
+        nickName: null,
+        avatar: null
+      };
+      this.resetForm("form");
+    },
+    //关闭
+    handleDrawerClose(){
+      this.getList();
+    },
+    /**
+    * 会话时间
+    */
+    changeTime(){
+      if(this.dateRange!=null){
+        this.queryParams.beginTime=this.dateRange[0];
+        this.queryParams.endTime=this.dateRange[1];
+      }else{
+        this.queryParams.beginTime=null;
+        this.queryParams.endTime=null;
+      }
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.sessionId)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加对话关系";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const sessionId = row.sessionId || this.ids
+      getFastGptChatSession(sessionId).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改对话关系";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.sessionId != null) {
+            updateFastGptChatSession(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addFastGptChatSession(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const sessionIds = row.sessionId || this.ids;
+      this.$confirm('是否确认删除对话关系编号为"' + sessionIds + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delFastGptChatSession(sessionIds);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有对话关系数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.exportLoading = true;
+          return exportFastGptChatSession(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+          this.exportLoading = false;
+        }).catch(() => {});
+    }
+  }
+};
+</script>