fastGptChatMsgDetails.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <div style="background-color: #f0f2f5; padding-bottom: 20px; min-height: 100%; " >
  3. <div style="padding: 20px; background-color: #fff;">
  4. 查看聊天记录
  5. </div>
  6. <div class="contentx" v-if="item!=null">
  7. <div class="desct"> 会话详情</div>
  8. <el-descriptions title="" :column="3" border>
  9. <el-descriptions-item label="会话标识"><span v-if="item!=null">{{item.chatId}}</span></el-descriptions-item>
  10. <el-descriptions-item label="咨询客户"><span v-if="item!=null">{{item.nickName}}</span></el-descriptions-item>
  11. <el-descriptions-item label="客服账号" span="3"><span v-if="item!=null">{{item.roleName}}</span></el-descriptions-item>
  12. <el-descriptions-item label="接待时间"><span v-if="item!=null">{{item.createTime}}</span></el-descriptions-item>
  13. <el-descriptions-item label="结束时间"><span v-if="item!=null">{{item.updateTime}}</span></el-descriptions-item>
  14. <el-descriptions-item label="服务状态">
  15. <span v-if="item!=null"><dict-tag :options="sessionStatusOptions" :value="item.status"/> </span>
  16. </el-descriptions-item>
  17. </el-descriptions>
  18. </div>
  19. <div class="contentx" v-if="item!=null">
  20. <div class="desct"> 查看聊天记录</div>
  21. <div class="block">
  22. <el-timeline>
  23. <el-timeline-item v-for="(i, index) in msgList" :key="index" :timestamp="i.createTime" placement="top">
  24. <el-card>
  25. <h4 v-if="i.sendType==1">{{ item.nickName }}</h4>
  26. <h4 v-else>{{item.roleName}}</h4>
  27. <p>{{i.content}}</p>
  28. <!-- <p v-if="i.sendType==2" style="color: #c8cacb;">{{i.status==1?'正确':'未标记'}}</p>
  29. <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>
  30. <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>
  31. <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> -->
  32. </el-card>
  33. </el-timeline-item>
  34. </el-timeline>
  35. </div>
  36. </div>
  37. <!-- 添加或修改聊天消息记录对话框 -->
  38. <el-dialog title="修改聊天消息" :visible.sync="open" width="700px" append-to-body>
  39. <el-form ref="form" :model="form" label-width="80px">
  40. <el-form-item label="消息内容">
  41. <el-input type="textarea" v-model="form.content" :rows="12"/>
  42. </el-form-item>
  43. </el-form>
  44. <div slot="footer" class="dialog-footer">
  45. <el-button type="primary" @click="submitForm">确 定</el-button>
  46. <el-button @click="cancel">取 消</el-button>
  47. </div>
  48. </el-dialog>
  49. <el-dialog title="修改记录" :visible.sync="logsOpen" width="800px" append-to-body>
  50. <el-timeline>
  51. <el-timeline-item v-for="(i, index) in chatMsgLogsList" :key="index" :timestamp="i.createTime" placement="top">
  52. <el-card>
  53. <h4 v-if="i.logsType==1">标记正确</h4>
  54. <h4 v-else>修改回复</h4>
  55. <p style="float: right;">{{i.nickName}}</p>
  56. <p>{{i.content}}</p>
  57. </el-card>
  58. </el-timeline-item>
  59. </el-timeline>
  60. <div slot="footer" class="dialog-footer">
  61. <el-button type="primary" @click="logsCancel">确 定</el-button>
  62. </div>
  63. </el-dialog>
  64. </div>
  65. </template>
  66. <script>
  67. import { getFastGptChatMsg, updateFastGptChatMsg } from "@/api/fastGpt/fastGptChatMsg";
  68. import { getFastGptChatSession } from "@/api/fastGpt/fastGptChatSession";
  69. import { getAllRoleList } from "@/api/fastGpt/fastGptRole";
  70. import { listFastGptChatMsgLogs} from "@/api/fastGpt/fastGptChatMsgLogs";
  71. export default {
  72. name: "fastGptChatMsgDetails",
  73. data() {
  74. return {
  75. sessionStatusOptions:[],
  76. open:false,
  77. logsOpen:false,
  78. // 方剂类型字典
  79. typeOptions:[],
  80. sendTypeOptions:[],
  81. roles:[],
  82. msgList:[],
  83. chatMsgLogsList:[],
  84. // 状态字典
  85. statusOptions: [],
  86. item:null,
  87. form: {},
  88. }
  89. },
  90. created() {
  91. this.getDicts("sys_chat_session_status").then(response => {
  92. this.sessionStatusOptions = response.data;
  93. });
  94. this.getDicts("chat_msg_type").then((response) => {
  95. this.typeOptions = response.data;
  96. });
  97. this.getDicts("chat_msg_send_type").then((response) => {
  98. this.sendTypeOptions = response.data;
  99. });
  100. getAllRoleList().then(response => {
  101. this.roles = response.data;
  102. });
  103. },
  104. methods: {
  105. getDetails(id) {
  106. this.item=null;
  107. getFastGptChatSession(id).then(response => {
  108. this.item = response.data;
  109. this.msgList = response.list;
  110. });
  111. },
  112. updateMsg(row){
  113. this.form = null;
  114. getFastGptChatMsg(row).then(response => {
  115. this.open = true;
  116. this.form = response.data;
  117. });
  118. },
  119. updateMsgStatus(row){
  120. var statusForm={
  121. msgId:row,
  122. status:1
  123. }
  124. this.$confirm('是否确认标记?', "警告", {
  125. confirmButtonText: "确定",
  126. cancelButtonText: "取消",
  127. type: "warning"
  128. }).then(() => {
  129. this.exportLoading = true;
  130. return updateFastGptChatMsg(statusForm);
  131. }).then(response => {
  132. this.msgSuccess("修改成功");
  133. this.open = false;
  134. var status= this.msgList.find(item => item.msgId ==row);
  135. status.status=1;
  136. }).catch(() => {});
  137. },
  138. updateLogs(row){
  139. this.logsOpen=true;
  140. var queryParams= {
  141. msgId: row
  142. }
  143. listFastGptChatMsgLogs(queryParams).then(response => {
  144. this.chatMsgLogsList = response.rows;
  145. });
  146. },
  147. logsCancel(){
  148. this.logsOpen=false;
  149. },
  150. submitForm(){
  151. var submitForm={
  152. msgId:this.form.msgId,
  153. content:this.form.content
  154. }
  155. updateFastGptChatMsg(submitForm).then(response => {
  156. this.msgSuccess("修改成功");
  157. this.open = false;
  158. var status= this.msgList.find(item => item.msgId ==this.form.msgId);
  159. status.content=this.form.content;
  160. });
  161. },
  162. cancel(){
  163. this.open = false;
  164. }
  165. }
  166. }
  167. </script>
  168. <style>
  169. .contentx{
  170. height: 100%;
  171. background-color: #fff;
  172. padding: 0px 20px 20px;
  173. margin: 20px;
  174. }
  175. .el-descriptions-item__label.is-bordered-label{
  176. font-weight: normal;
  177. }
  178. .el-descriptions-item__content {
  179. max-width: 150px;
  180. min-width: 100px;
  181. }
  182. .desct{
  183. padding-top: 20px;
  184. padding-bottom: 20px;
  185. color: #524b4a;
  186. font-weight: bold;
  187. }
  188. .padding-a{
  189. padding-right: 10px;
  190. }
  191. </style>