浏览代码

1.提交ai对话配套的代码

jzp 4 天之前
父节点
当前提交
dace0093f7

+ 12 - 1
src/api/company/statistics.js

@@ -128,5 +128,16 @@ export function exportIpadStaticByTime(dateTime) {
     method: 'get'
   })
 }
-
+export function tokenStaticTotal(dateTime) {
+  return request({
+    url: '/company/statistics/tokenStaticTotal/' + dateTime,
+    method: 'get'
+  })
+}
+export function exportTokenStaticByTime(dateTime) {
+  return request({
+    url: '/company/statistics/exportTokenStaticByTime/' + dateTime,
+    method: 'get'
+  })
+}
 

+ 18 - 0
src/api/course/courseWatchComment.js

@@ -35,6 +35,15 @@ export function listCourseWatchComment(query) {
 //   })
 // }
 //
+
+// 修改弹幕状态
+export function updateBarrageStatus(data) {
+  return request({
+    url: '/course/courseWatchComment/updateBarrageStatus',
+    method: 'put',
+    data: data
+  })
+}
 // 删除看课评论
 export function delCourseWatchComment(commentId) {
   return request({
@@ -60,3 +69,12 @@ export function addBlack(query) {
     params: query
   })
 }
+
+// 解除拉黑外部联系人
+export function clearBlack(query) {
+  return request({
+    url: '/course/courseWatchComment/clearBlack',
+    method: 'put',
+    params: query
+  })
+}

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

@@ -0,0 +1,53 @@
+import request from '@/utils/request'
+
+// 查询违规词语列表
+export function listFastGptChatReplaceText(query) {
+  return request({
+    url: '/fastGpt/fastGptChatReplaceText/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询违规词语详细
+export function getFastGptChatReplaceText(id) {
+  return request({
+    url: '/fastGpt/fastGptChatReplaceText/' + id,
+    method: 'get'
+  })
+}
+
+// 新增违规词语
+export function addFastGptChatReplaceText(data) {
+  return request({
+    url: '/fastGpt/fastGptChatReplaceText',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改违规词语
+export function updateFastGptChatReplaceText(data) {
+  return request({
+    url: '/fastGpt/fastGptChatReplaceText',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除违规词语
+export function delFastGptChatReplaceText(id) {
+  return request({
+    url: '/fastGpt/fastGptChatReplaceText/' + id,
+    method: 'delete'
+  })
+}
+
+// 导出违规词语
+export function exportFastGptChatReplaceText(query) {
+  return request({
+    url: '/fastGpt/fastGptChatReplaceText/export',
+    method: 'get',
+    params: query
+  })
+}

+ 62 - 0
src/api/fastGpt/fastGptKeywordSend.js

@@ -0,0 +1,62 @@
+import request from '@/utils/request'
+
+// 查询Ai指令关键字列表
+export function keywordList(query) {
+  return request({
+    url: '/fastGpt/fastGptKeywordSend/keywordList',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询Ai指令列表
+export function listFastGptKeywordSend(query) {
+  return request({
+    url: '/fastGpt/fastGptKeywordSend/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询Ai指令详细
+export function getFastGptKeywordSend(id) {
+  return request({
+    url: '/fastGpt/fastGptKeywordSend/' + id,
+    method: 'get'
+  })
+}
+
+// 新增Ai指令
+export function addFastGptKeywordSend(data) {
+  return request({
+    url: '/fastGpt/fastGptKeywordSend',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改Ai指令
+export function updateFastGptKeywordSend(data) {
+  return request({
+    url: '/fastGpt/fastGptKeywordSend',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除Ai指令
+export function delFastGptKeywordSend(id) {
+  return request({
+    url: '/fastGpt/fastGptKeywordSend/' + id,
+    method: 'delete'
+  })
+}
+
+// 导出Ai指令
+export function exportFastGptKeywordSend(query) {
+  return request({
+    url: '/fastGpt/fastGptKeywordSend/export',
+    method: 'get',
+    params: query
+  })
+}

+ 70 - 0
src/api/fastGpt/fastgptEventLogTotal.js

@@ -0,0 +1,70 @@
+import request from '@/utils/request'
+
+// 查询ai事件埋点统计列表
+/*export function listFastgptEventLogTotal(query) {
+  return request({
+    url: '/fastGpt/fastgptEventLogTotal/list',
+    method: 'get',
+    params: query
+  })
+}*/
+
+export function listFastgptEventLogTotal(data) {
+  return request({
+    url: '/fastGpt/fastgptEventLogTotal/list',
+    method: 'post',
+    data: data
+  })
+}
+
+
+// 查询ai事件埋点统计详细
+export function getFastgptEventLogTotal(id) {
+  return request({
+    url: '/fastGpt/fastgptEventLogTotal/' + id,
+    method: 'get'
+  })
+}
+
+// 新增ai事件埋点统计
+export function addFastgptEventLogTotal(data) {
+  return request({
+    url: '/fastGpt/fastgptEventLogTotal',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改ai事件埋点统计
+export function updateFastgptEventLogTotal(data) {
+  return request({
+    url: '/fastGpt/fastgptEventLogTotal',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除ai事件埋点统计
+export function delFastgptEventLogTotal(id) {
+  return request({
+    url: '/fastGpt/fastgptEventLogTotal/' + id,
+    method: 'delete'
+  })
+}
+
+// 导出ai事件埋点统计
+export function exportFastgptEventLogTotal(query) {
+  return request({
+    url: '/fastGpt/fastgptEventLogTotal/export',
+    method: 'get',
+    params: query
+  })
+}
+
+
+export function getFastGptRoleAppKeyList() {
+  return request({
+    url: '/fastGpt/fastgptEventLogTotal/getFastGptRoleAppKeyList',
+    method: 'get'
+  })
+}

+ 228 - 95
src/views/course/courseWatchComment/index.vue

@@ -11,6 +11,22 @@
           style="width: 280px"
         />
       </el-form-item>
+      <el-form-item label="状态" prop="status">
+        <el-select
+          v-model="queryParams.status"
+          placeholder="操作状态"
+          clearable
+          size="small"
+          style="width: 240px"
+        >
+          <el-option
+            v-for="dict in statusOptions"
+            :key="dict.dictValue"
+            :label="dict.dictLabel"
+            :value="dict.dictValue"
+          />
+        </el-select>
+      </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>
@@ -18,27 +34,27 @@
     </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="['course:courseWatchComment: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="['course:courseWatchComment:edit']"-->
-<!--        >修改</el-button>-->
-<!--      </el-col>-->
+      <!--      <el-col :span="1.5">-->
+      <!--        <el-button-->
+      <!--          type="primary"-->
+      <!--          plain-->
+      <!--          icon="el-icon-plus"-->
+      <!--          size="mini"-->
+      <!--          @click="handleAdd"-->
+      <!--          v-hasPermi="['course:courseWatchComment: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="['course:courseWatchComment:edit']"-->
+      <!--        >修改</el-button>-->
+      <!--      </el-col>-->
       <el-col :span="1.5">
         <el-button
           type="danger"
@@ -66,26 +82,39 @@
 
     <el-table border v-loading="loading" :data="courseWatchCommentList" @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55" align="center" />
-<!--      <el-table-column label="评论id" align="center" prop="commentId" />-->
-<!--      <el-table-column label="用户id" align="center" prop="userId" />-->
+      <!--      <el-table-column label="评论id" align="center" prop="commentId" />-->
+      <!--      <el-table-column label="用户id" align="center" prop="userId" />-->
       <el-table-column label="用户昵称" align="center" prop="nickName" width="130px" />
-<!--      <el-table-column label="用户类型,1-管理员,2-用户" align="center" prop="userType" />-->
-<!--      <el-table-column label="评论类型 1:评论,2:回复" align="center" prop="type" />-->
-<!--      <el-table-column label="父评论id" align="center" prop="parentId" />-->
+      <!--      <el-table-column label="用户类型,1-管理员,2-用户" align="center" prop="userType" />-->
+      <!--      <el-table-column label="评论类型 1:评论,2:回复" align="center" prop="type" />-->
+      <!--      <el-table-column label="父评论id" align="center" prop="parentId" />-->
       <el-table-column label="评论内容" align="center" prop="content" />
       <el-table-column label="所属课程" align="center" prop="courseName" />
       <el-table-column label="所属小节" align="center" prop="title" />
+      <el-table-column label="弹幕状态" align="center" prop="status">
+        <template slot-scope="scope">
+          <el-tag :type="getStatusTagType(scope.row.status)">
+            {{ formatBarrageStatus(scope.row.status) }}
+          </el-tag>
+        </template>
+      </el-table-column>
       <el-table-column label="评论时间" align="center" prop="createTime" width="160px"/>
-<!--      <el-table-column label="是否是撤回的消息,1-是,0-否" align="center" prop="isRevoke" />-->
+      <!--      <el-table-column label="是否是撤回的消息,1-是,0-否" align="center" prop="isRevoke" />-->
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
-<!--          <el-button-->
-<!--            size="mini"-->
-<!--            type="text"-->
-<!--            icon="el-icon-edit"-->
-<!--            @click="handleUpdate(scope.row)"-->
-<!--            v-hasPermi="['course:courseWatchComment:edit']"-->
-<!--          >修改</el-button>-->
+          <!--          <el-button-->
+          <!--            size="mini"-->
+          <!--            type="text"-->
+          <!--            icon="el-icon-edit"-->
+          <!--            @click="handleUpdate(scope.row)"-->
+          <!--            v-hasPermi="['course:courseWatchComment:edit']"-->
+          <!--          >修改</el-button>-->
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdateStatus(scope.row)"
+          >修改弹幕状态</el-button>
           <el-button
             size="mini"
             type="text"
@@ -93,11 +122,19 @@
             @click="handleAddKeyWords(scope.row)"
           >添加关键字</el-button>
           <el-button
+            v-if="scope.row.userStatus === 1 "
             size="mini"
             type="text"
             icon="el-icon-edit"
             @click="handleAddBlack(scope.row)"
           >拉黑</el-button>
+          <el-button
+            v-if="scope.row.userStatus === 0 "
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleClearBlack(scope.row)"
+          >解除拉黑</el-button>
           <el-button
             size="mini"
             type="text"
@@ -126,57 +163,86 @@
         <el-button type="primary" @click="submitForm">确 定</el-button>
         <el-button @click="cancel">取 消</el-button>
       </div>
-  </el-dialog>
-<!--    &lt;!&ndash; 添加或修改看课评论对话框 &ndash;&gt;-->
-<!--    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>-->
-<!--      <el-form ref="form" :model="form" :rules="rules" label-width="80px">-->
-<!--        <el-form-item label="用户id" prop="userId">-->
-<!--          <el-input v-model="form.userId" placeholder="请输入用户id" />-->
-<!--        </el-form-item>-->
-<!--        <el-form-item label="用户类型,1-管理员,2-用户" prop="userType">-->
-<!--          <el-select v-model="form.userType" placeholder="请选择用户类型,1-管理员,2-用户">-->
-<!--            <el-option label="请选择字典生成" value="" />-->
-<!--          </el-select>-->
-<!--        </el-form-item>-->
-<!--        <el-form-item label="课程id" prop="courseId">-->
-<!--          <el-input v-model="form.courseId" placeholder="请输入课程id" />-->
-<!--        </el-form-item>-->
-<!--        <el-form-item label="视频id" prop="videoId">-->
-<!--          <el-input v-model="form.videoId" placeholder="请输入视频id" />-->
-<!--        </el-form-item>-->
-<!--        <el-form-item label="评论类型 1:评论,2:回复" prop="type">-->
-<!--          <el-select v-model="form.type" placeholder="请选择评论类型 1:评论,2:回复">-->
-<!--            <el-option label="请选择字典生成" value="" />-->
-<!--          </el-select>-->
-<!--        </el-form-item>-->
-<!--        <el-form-item label="父评论id" prop="parentId">-->
-<!--          <el-input v-model="form.parentId" placeholder="请输入父评论id" />-->
-<!--        </el-form-item>-->
-<!--        <el-form-item label="评论内容" prop="content">-->
-<!--          <el-input v-model="form.content" type="textarea" placeholder="请输入内容" />-->
-<!--        </el-form-item>-->
-<!--        <el-form-item label="是否是撤回的消息,1-是,0-否" prop="isRevoke">-->
-<!--          <el-select v-model="form.isRevoke" placeholder="请选择是否是撤回的消息,1-是,0-否">-->
-<!--            <el-option label="请选择字典生成" value="" />-->
-<!--          </el-select>-->
-<!--        </el-form-item>-->
-<!--      </el-form>-->
-<!--      <div slot="footer" class="dialog-footer">-->
-<!--        <el-button type="primary" @click="submitForm">确 定</el-button>-->
-<!--        <el-button @click="cancel">取 消</el-button>-->
-<!--      </div>-->
-<!--    </el-dialog>-->
+    </el-dialog>
+
+    <el-dialog :title="title" :visible.sync="updateStatus" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="弹幕状态" prop="barrageStatus">
+          <el-radio-group v-model="form.status">
+            <el-radio
+              v-for="dict in barrageStatusOptions"
+              :key="dict.dictValue"
+              :label="dict.dictValue"
+              v-if="dict.dictValue !== 2"
+            >
+              <el-tag :type="getStatusTagType(dict.dictValue)" size="small">
+                {{dict.dictLabel}}
+              </el-tag>
+            </el-radio>
+          </el-radio-group>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="updateForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+    <!--    &lt;!&ndash; 添加或修改看课评论对话框 &ndash;&gt;-->
+    <!--    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>-->
+    <!--      <el-form ref="form" :model="form" :rules="rules" label-width="80px">-->
+    <!--        <el-form-item label="用户id" prop="userId">-->
+    <!--          <el-input v-model="form.userId" placeholder="请输入用户id" />-->
+    <!--        </el-form-item>-->
+    <!--        <el-form-item label="用户类型,1-管理员,2-用户" prop="userType">-->
+    <!--          <el-select v-model="form.userType" placeholder="请选择用户类型,1-管理员,2-用户">-->
+    <!--            <el-option label="请选择字典生成" value="" />-->
+    <!--          </el-select>-->
+    <!--        </el-form-item>-->
+    <!--        <el-form-item label="课程id" prop="courseId">-->
+    <!--          <el-input v-model="form.courseId" placeholder="请输入课程id" />-->
+    <!--        </el-form-item>-->
+    <!--        <el-form-item label="视频id" prop="videoId">-->
+    <!--          <el-input v-model="form.videoId" placeholder="请输入视频id" />-->
+    <!--        </el-form-item>-->
+    <!--        <el-form-item label="评论类型 1:评论,2:回复" prop="type">-->
+    <!--          <el-select v-model="form.type" placeholder="请选择评论类型 1:评论,2:回复">-->
+    <!--            <el-option label="请选择字典生成" value="" />-->
+    <!--          </el-select>-->
+    <!--        </el-form-item>-->
+    <!--        <el-form-item label="父评论id" prop="parentId">-->
+    <!--          <el-input v-model="form.parentId" placeholder="请输入父评论id" />-->
+    <!--        </el-form-item>-->
+    <!--        <el-form-item label="评论内容" prop="content">-->
+    <!--          <el-input v-model="form.content" type="textarea" placeholder="请输入内容" />-->
+    <!--        </el-form-item>-->
+    <!--        <el-form-item label="是否是撤回的消息,1-是,0-否" prop="isRevoke">-->
+    <!--          <el-select v-model="form.isRevoke" placeholder="请选择是否是撤回的消息,1-是,0-否">-->
+    <!--            <el-option label="请选择字典生成" value="" />-->
+    <!--          </el-select>-->
+    <!--        </el-form-item>-->
+    <!--      </el-form>-->
+    <!--      <div slot="footer" class="dialog-footer">-->
+    <!--        <el-button type="primary" @click="submitForm">确 定</el-button>-->
+    <!--        <el-button @click="cancel">取 消</el-button>-->
+    <!--      </div>-->
+    <!--    </el-dialog>-->
   </div>
 </template>
 
 <script>
-import { listCourseWatchComment, delCourseWatchComment, exportCourseWatchComment, addBlack } from "@/api/course/courseWatchComment";
+import { listCourseWatchComment, delCourseWatchComment, exportCourseWatchComment, addBlack,clearBlack,updateBarrageStatus } from "@/api/course/courseWatchComment";
 import { addKeyword } from "@/api/system/keyword";
 
 export default {
   name: "CourseWatchComment",
   data() {
     return {
+      // 弹幕状态选项
+      barrageStatusOptions: [
+        { dictValue: 0, dictLabel: "正常" },
+        { dictValue: 1, dictLabel: "屏蔽" },
+        { dictValue: 2, dictLabel: "人工" }
+      ],
       // 遮罩层
       loading: true,
       // 导出遮罩层
@@ -193,16 +259,21 @@ export default {
       total: 0,
       // 看课评论表格数据
       courseWatchCommentList: [],
+      //下拉状态
+      statusOptions:[],
       // 弹出层标题
       title: "",
       // 是否显示弹出层
       open: false,
+      updateStatus: false,
       // 查询参数
       queryParams: {
         pageNum: 1,
         pageSize: 10,
         keywords: null,
         isAll: true, //判断是否属于全局查询
+        status: '',
+        userStatus: '',
         // userId: null,
         // userType: null,
         // courseId: null,
@@ -223,6 +294,9 @@ export default {
     };
   },
   created() {
+    this.getDicts("sys_barrage_clean_type").then((response) => {
+      this.statusOptions = response.data;
+    });
     this.getList();
   },
   methods: {
@@ -235,9 +309,24 @@ export default {
         this.loading = false;
       });
     },
+    // 获取状态标签类型
+    getStatusTagType(status) {
+      switch(status) {
+        case 0: return 'success';
+        case 1: return 'danger';
+        case 2: return 'primary';
+        default: return 'info';
+      }
+    },
+    // 格式化状态显示
+    formatBarrageStatus(status) {
+      const dict = this.barrageStatusOptions.find(item => item.dictValue === status);
+      return dict ? dict.dictLabel : status;
+    },
     // 取消按钮
     cancel() {
       this.open = false;
+      this.updateStatus = false;
       this.reset();
     },
     // 表单重置
@@ -254,7 +343,9 @@ export default {
         createTime: null,
         updateTime: null,
         isRevoke: null,
-        keyword: null
+        keyword: null,
+        status: '',
+        userStatus: ''
       };
       this.resetForm("form");
     },
@@ -281,6 +372,34 @@ export default {
       this.open = true;
       this.title = "添加到关键字";
     },
+    handleUpdateStatus(row) {
+      this.reset();
+      this.form.status = row.status;
+      this.form.commentId = row.commentId;
+      this.updateStatus = true;
+      this.title = "修改弹幕状态";
+    },
+    /** 解除拉黑用户按钮操作 */
+    handleClearBlack(row) {
+      this.$confirm(`谨慎操作,确定要解除"${row.nickName}"用户拉黑吗`, "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        const data = {
+          fsUserId: row.userId,
+          commentStatus: 0
+        };
+        clearBlack(data).then(response => {
+          this.msgSuccess("操作成功");
+          this.getList(); // 重新加载列表
+        }).catch(() => {
+          this.msgError("操作失败");
+        });
+      }).catch(() => {
+        // 用户取消操作
+      });
+    },
     /** 拉黑用户按钮操作 */
     handleAddBlack(row) {
       this.$confirm(`谨慎操作,确定要拉黑用户"${row.nickName}"吗`, "警告", {
@@ -302,6 +421,20 @@ export default {
         // 用户取消操作
       });
     },
+    updateForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          console.log(this.form)
+          updateBarrageStatus(this.form).then(response => {
+            this.msgSuccess("修改成功");
+            this.updateStatus = false;
+            this.getList();
+          }).catch(() => {
+            this.msgError("修改失败");
+          });
+        }
+      })
+    },
     /** 提交按钮 */
     submitForm() {
       this.$refs["form"].validate(valid => {
@@ -339,30 +472,30 @@ export default {
     handleDelete(row) {
       const commentIds = row.commentId || this.ids;
       this.$confirm('是否确认删除此看课评论?删除后不可恢复', "警告", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        }).then(function() {
-          return delCourseWatchComment(commentIds);
-        }).then(() => {
-          this.getList();
-          this.msgSuccess("删除成功");
-        }).catch(() => {});
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function() {
+        return delCourseWatchComment(commentIds);
+      }).then(() => {
+        this.getList();
+        this.msgSuccess("删除成功");
+      }).catch(() => {});
     },
     /** 导出按钮操作 */
     handleExport() {
       const queryParams = this.queryParams;
       this.$confirm('是否确认导出当前看课评论数据项?', "警告", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        }).then(() => {
-          this.exportLoading = true;
-          return exportCourseWatchComment(queryParams);
-        }).then(response => {
-          this.download(response.msg);
-          this.exportLoading = false;
-        }).catch(() => {});
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        this.exportLoading = true;
+        return exportCourseWatchComment(queryParams);
+      }).then(response => {
+        this.download(response.msg);
+        this.exportLoading = false;
+      }).catch(() => {});
     }
   }
 };

+ 340 - 0
src/views/fastGpt/fastGptChatReplaceText/index.vue

@@ -0,0 +1,340 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="类型" prop="type">
+        <el-select v-model="queryParams.type" placeholder="请选择类型" clearable size="small">
+          <el-option
+            v-for="dict in typeOptions"
+            :key="dict.dictValue"
+            :label="dict.dictLabel"
+            :value="dict.dictValue"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="易错词" prop="content">
+        <el-input
+          v-model="queryParams.content"
+          placeholder="请输入原来的文本"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+
+      <el-form-item label="状态" prop="status">
+        <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
+          <el-option
+            v-for="dict in statusOptions"
+            :key="dict.dictValue"
+            :label="dict.dictLabel"
+            :value="dict.dictValue"
+          />
+        </el-select>
+      </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:fastGptChatReplaceText: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:fastGptChatReplaceText: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:fastGptChatReplaceText: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:fastGptChatReplaceText:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table border v-loading="loading" :data="fastGptChatReplaceTextList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="id" align="center" prop="id" />
+      <el-table-column label="类型" align="center" prop="type">
+        <template slot-scope="scope">
+          <dict-tag :options="typeOptions" :value="scope.row.type"/>
+        </template>
+      </el-table-column>
+      <el-table-column label="易错词" align="center" prop="content" />
+      <el-table-column label="替换文本" align="center" prop="changeCount" />
+      <el-table-column label="状态" align="center" prop="status">
+        <template slot-scope="scope">
+          <dict-tag :options="statusOptions" :value="scope.row.status"/>
+        </template>
+      </el-table-column>
+      <el-table-column label="排序" align="center" prop="sort" />
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['fastGpt:fastGptChatReplaceText:edit']"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['fastGpt:fastGptChatReplaceText:remove']"
+          >删除</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-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="类型" prop="type">
+          <el-select v-model="form.type" placeholder="请选择类型">
+            <el-option
+              v-for="dict in typeOptions"
+              :key="dict.dictValue"
+              :label="dict.dictLabel"
+              :value="parseInt(dict.dictValue)"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="易错词" prop="content">
+          <el-input v-model="form.content" placeholder="请输入易错词" />
+        </el-form-item>
+        <el-form-item label="替换文本" prop="changeCount">
+          <el-input v-model="form.changeCount" placeholder="替换文本" />
+        </el-form-item>
+        <el-form-item label="状态">
+          <el-radio-group v-model="form.status">
+            <el-radio
+              v-for="dict in statusOptions"
+              :key="dict.dictValue"
+              :label="parseInt(dict.dictValue)"
+            >{{dict.dictLabel}}</el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item label="排序" prop="sort">
+            <el-input-number v-model="form.sort"  :min="0" label="请输入排序"></el-input-number>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listFastGptChatReplaceText, getFastGptChatReplaceText, delFastGptChatReplaceText, addFastGptChatReplaceText, updateFastGptChatReplaceText, exportFastGptChatReplaceText } from "@/api/fastGpt/fastGptChatReplaceText";
+
+export default {
+  name: "FastGptChatReplaceText",
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 易错词语表格数据
+      fastGptChatReplaceTextList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 类型字典
+      typeOptions: [],
+      // 状态字典
+      statusOptions: [],
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        type: null,
+        content: null,
+        changeCount: null,
+        status: null,
+        sort: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+      }
+    };
+  },
+  created() {
+    this.getList();
+    this.getDicts("sys_fastgpt_chat_replace_words_type").then(response => {
+      this.typeOptions = response.data;
+    });
+    this.getDicts("sys_company_status").then(response => {
+      this.statusOptions = response.data;
+    });
+  },
+  methods: {
+    /** 查询易错词语列表 */
+    getList() {
+      this.loading = true;
+      listFastGptChatReplaceText(this.queryParams).then(response => {
+        this.fastGptChatReplaceTextList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        type: null,
+        content: null,
+        changeCount: null,
+        status: 0,
+        sort: null,
+        createTime: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加易错词语";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids
+      getFastGptChatReplaceText(id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改易错词语";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateFastGptChatReplaceText(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addFastGptChatReplaceText(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$confirm('是否确认删除易错词语编号为"' + ids + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delFastGptChatReplaceText(ids);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有易错词语数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.exportLoading = true;
+          return exportFastGptChatReplaceText(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+          this.exportLoading = false;
+        }).catch(() => {});
+    }
+  }
+};
+</script>

+ 113 - 0
src/views/fastGpt/fastGptKeywordSend/fastGptKeyWordDetails.vue

@@ -0,0 +1,113 @@
+<template>
+    <div style="background-color: #f0f2f5; padding-bottom: 20px; min-height: 100%; " >
+      <div style="padding: 20px; background-color: #fff;">
+        营销指令内容
+      </div>
+      <!-- 使用 el-form 包裹表单项 -->
+      <el-form label-width="120px" style="padding: 20px;">
+        <!-- 发送文字内容 -->
+        <el-form-item label="发送文字内容" >
+          <div class="el-form-item__content readonly-field" style="line-height: 28px;">
+            {{ form.content || '-' }}
+          </div>
+        </el-form-item>
+
+        <!-- 图片访问地址 -->
+        <el-form-item label="图片访问地址">
+          <div class="el-form-item__content readonly-field">
+            <div v-if="form.contentType !== 0 && form.imgUrl && form.imgUrl.trim()">
+              <el-image
+                v-for="(url, index) in form.imgUrl.split(',')"
+                :key="index"
+                :src="url"              style="width: 100px; height: 100px; margin-right: 10px;"
+                fit="cover"
+              >
+                <div slot="error" class="image-slot">
+                  <i class="el-icon-picture-outline"></i>
+                </div>
+              </el-image>
+            </div>
+            <div v-else class="el-form-item__content" style="line-height: 28px;">-</div>
+          </div>
+        </el-form-item>
+      </el-form>
+    </div>
+</template>
+
+<script>
+
+import {getFastGptKeywordSend} from "@/api/fastGpt/fastGptKeywordSend";
+
+  export default {
+    name: "fastGptChatMsgDetails",
+    data() {
+      return {
+        open:false,
+        logsOpen:false,
+        roles:[],
+        msgList:[],
+        item:null,
+        form: {
+          content: '',
+          imgUrl: ''
+        },
+        queryParams: {
+          pageNum: 1,
+          pageSize: 10,
+          keyword: null,
+          content: null,
+          contentType: null,
+          imgUrl: null,
+          status: null,
+          roleId: null,
+          createTime: null,
+        }
+      }
+    },
+
+    methods: {
+      getDetails(id) {
+        getFastGptKeywordSend(id).then(response => {
+          console.log(response);
+          this.form = response.data;
+        });
+      },
+
+      cancel(){
+          this.open = false;
+      }
+    }
+  }
+</script>
+<style>
+  .readonly-field {
+    background-color: #fafafa;
+    padding: 10px;
+    border-radius: 4px;
+  }
+  .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>

+ 529 - 0
src/views/fastGpt/fastGptKeywordSend/index.vue

@@ -0,0 +1,529 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="88px">
+<!--      <el-form-item label="营销关键字" prop="keyword" style="white-space: nowrap;">
+        <el-input
+          v-model="queryParams.keyword"
+          placeholder="请输入营销关键字"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>-->
+      <el-form-item label="营销关键字" prop="keyword"  style="white-space: nowrap;">
+        <el-select v-model="queryParams.keyword" clearable placeholder="请选择营销关键字">
+          <el-option
+            v-for="dict in keywordOptions"
+            :key="dict.keyword"
+            :label="dict.keyword"
+            :value="dict.keyword"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+     <el-form-item label="发送文字内容" prop="content" style="white-space: nowrap;">
+        <el-input
+          v-model="queryParams.content"
+          placeholder="请输入发送文字内容"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="内容类型" prop="contentType">
+        <el-select v-model="queryParams.contentType" placeholder="请选择内容类型" clearable size="small">
+          <el-option
+            v-for="dict in contentTypeOptions"
+            :key="dict.dictValue"
+            :label="dict.dictLabel"
+            :value="dict.dictValue"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="状态" prop="status">
+        <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
+          <el-option
+            v-for="dict in statusOptions"
+            :key="dict.dictValue"
+            :label="dict.dictLabel"
+            :value="dict.dictValue"
+          />
+        </el-select>
+      </el-form-item>
+<!--      <el-form-item label="客服角色" prop="roleIds">
+        <el-select v-model="queryParams.roleIds" 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>
+        <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:fastGptKeywordSend: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:fastGptKeywordSend: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:fastGptKeywordSend: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:fastGptKeywordSend:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table border v-loading="loading" :data="fastGptKeywordSendList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="id" align="center" prop="id" />
+      <el-table-column label="营销关键字" align="center" prop="keyword"/>
+      <el-table-column label="内容类型" align="center" prop="contentType">
+        <template slot-scope="scope">
+          <dict-tag :options="contentTypeOptions" :value="scope.row.contentType"/>
+        </template>
+      </el-table-column>
+<!--      <el-table-column label="图片访问地址" align="center" prop="imgUrl" />-->
+      <el-table-column label="状态" align="center" prop="status">
+        <template slot-scope="scope">
+          <dict-tag :options="statusOptions" :value="scope.row.status"/>
+        </template>
+      </el-table-column>
+<!--      <el-table-column label="客服角色" align="center" prop="roleIds">
+        <template slot-scope="scope">
+          {{ getRoleNameById(scope.row.roleIds) }}
+        </template>
+      </el-table-column>-->
+
+      <el-table-column label="创建时间" align="center" prop="createTime" />
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            @click="handleDetails(scope.row)"
+          >查看</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['fastGpt:fastGptKeywordSend:edit']"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['fastGpt:fastGptKeywordSend:remove']"
+          >删除</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"
+    />
+
+    <!-- 添加或修改Ai指令对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
+
+        <el-form-item label="营销关键字" prop="keyword">
+          <el-select v-model="form.keyword" placeholder="请选择营销关键字">
+            <el-option
+              v-for="dict in keywordOptions"
+              :key="dict.keyword"
+              :label="dict.keyword"
+              :value="dict.keyword"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="发送内容" prop="content">
+          <el-input
+            type="textarea"
+            :autosize="{ minRows: 2, maxRows: 4}"
+            placeholder="请输入发送内容"
+            v-model="form.content">
+          </el-input>
+        </el-form-item>
+        <el-form-item label="内容类型" prop="contentType">
+          <el-select v-model="form.contentType" placeholder="请选择内容类型">
+            <el-option
+              v-for="dict in contentTypeOptions"
+              :key="dict.dictValue"
+              :label="dict.dictLabel"
+              :value="parseInt(dict.dictValue)"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="图片" prop="imgUrl" v-if="this.form.contentType !== 0">
+          <ImageUpload v-model="form.imgUrl"  type="image" :limit="1" :width="100" :height="100" />
+        </el-form-item>
+        <el-form-item label="状态">
+          <el-radio-group v-model="form.status">
+            <el-radio
+              v-for="dict in statusOptions"
+              :key="dict.dictValue"
+              :label="parseInt(dict.dictValue)"
+            >{{dict.dictLabel}}</el-radio>
+          </el-radio-group>
+        </el-form-item>
+<!--        <el-form-item label="客服角色" prop="roleIds">
+          <el-select
+            v-model="form.roleIds"
+            placeholder="请选择客服角色"
+            size="small"
+            multiple
+            filterable
+            clearable
+            :filter-method="filterRoles"
+          >
+            <el-option
+              v-for="item in filteredRoles"
+              :key="item.roleId"
+              :label="item.roleName"
+              :value="item.roleId"/>
+          </el-select>
+        </el-form-item>-->
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+
+    <el-drawer
+      :with-header="false"
+      size="75%"  @close="handleDrawerClose"
+      :title="show.title" :visible.sync="show.open">
+      <fastGptKeyWordDetails  ref="Details" />
+    </el-drawer>
+  </div>
+</template>
+
+<script>
+import {
+  listFastGptKeywordSend,
+  getFastGptKeywordSend,
+  delFastGptKeywordSend,
+  addFastGptKeywordSend,
+  updateFastGptKeywordSend,
+  exportFastGptKeywordSend,
+  keywordList
+} from "@/api/fastGpt/fastGptKeywordSend";
+import ImageUpload from "@/components/ImageUpload/index.vue";
+import fastGptKeyWordDetails from "@/views/fastGpt/fastGptKeywordSend/fastGptKeyWordDetails.vue";
+import { getAllRoleList } from "@/api/fastGpt/fastGptRole";
+
+export default {
+  name: "FastGptKeywordSend",
+  components: {fastGptKeyWordDetails, ImageUpload},
+  data() {
+    return {
+      show:{
+        title:"指令内容",
+        open:false,
+      },
+      roleMap:{},
+      roles:[],
+      filteredRoles: [], // 过滤后的角色数据
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // Ai指令表格数据
+      fastGptKeywordSendList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 关键字内容字典
+      keywordOptions: [],
+      // 内容类型字典
+      contentTypeOptions: [],
+      // 状态字典
+      statusOptions: [],
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        keyword: null,
+        content: null,
+        contentType: null,
+        imgUrl: null,
+        status: null,
+        roleIds: [],
+        createTime: null,
+      },
+      // 表单参数
+      form: {roleIds: [],},
+      // 表单校验
+      rules: {
+        keyword: [
+          { required: true, message: "营销关键字不能为空", trigger: "change" }
+        ],
+        content: [
+          // 如果 contentType 不是纯文本类型(比如图文混合),可以动态设置校验规则
+          // 这里假设纯文本内容不需要上传图片
+          { validator: (rule, value, callback) => {
+              const { contentType } = this.form;
+              if (contentType === 0 && !value) {
+                callback(new Error("发送文字内容不能为空"));
+              } else {
+                callback();
+              }
+            },
+            trigger: "blur"
+          }
+        ],
+        imgUrl: [
+          { validator: (rule, value, callback) => {
+              const { contentType } = this.form;
+              if (contentType !== 0 && !value) {
+                callback(new Error("图片不能为空"));
+              } else {
+                callback();
+              }
+            },
+            trigger: "change"
+          }
+        ]
+      }
+    };
+  },
+  created() {
+    this.getList();
+    Promise.all([
+      keywordList().then(response => {
+        this.keywordOptions = response.data;
+      }),
+    this.getDicts("sys_fastgpt_keyword_file_type").then(response => {
+      this.contentTypeOptions = response.data;
+    }),
+    this.getDicts("sys_fastgpt_keyword_send_status").then(response => {
+      this.statusOptions = response.data;
+    }),
+      getAllRoleList().then(response => {
+        this.roles = response.data;
+        this.filteredRoles = response.data;
+        // 生成角色映射表
+        this.roleMap = response.data.reduce((map, role) => {
+          map[role.roleId] = role.roleName;
+          return map;
+        }, {});
+      })
+    ])
+  },
+  methods: {
+    /** 查询Ai指令列表 */
+    getList() {
+      this.loading = true;
+      listFastGptKeywordSend(this.queryParams).then(response => {
+        this.fastGptKeywordSendList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 添加过滤方法
+    filterRoles(query) {
+      this.filteredRoles = this.roles.filter(item =>
+        item.roleName.toLowerCase().includes(query.toLowerCase())
+      );
+    },
+    // 获取角色名
+    getRoleNameById(roleIds) {
+      if (!roleIds) return '-';
+
+      // 确保 roleIds 是数组
+      const idArray = Array.isArray(roleIds) ? roleIds : roleIds.split(',').map(id => id.trim());
+      return idArray
+        .map(id => this.roleMap[id])
+        .filter(name => name)
+        .join('、');
+    },
+    //查看按钮
+    handleDetails(row){
+      this.show.open=true;
+      setTimeout(() => {
+        this.$refs.Details.getDetails(row.id);
+      }, 500);
+    },
+
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      getAllRoleList().then(response => {
+        this.roles = response.data;
+        this.filteredRoles = response.data;
+      });
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        keyword: null,
+        content: null,
+        contentType: null,
+        imgUrl: null,
+        status: 0,
+        roleIds: [],
+        createTime: null
+      };
+      this.resetForm("form");
+
+    },
+    //关闭
+    handleDrawerClose(){
+      this.getList();
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加Ai指令";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids;
+      getFastGptKeywordSend(id).then(response => {
+        const data = response.data;
+        this.form = {
+          ...data,
+          roleIds: data.roleIds ? data.roleIds.split(',').map(Number) : [] // 确保转为 number[]
+        };
+        this.open = true;
+        this.title = "修改Ai指令";
+        this.$nextTick(() => {
+          this.$forceUpdate(); // 强制更新 el-select 的绑定
+        });
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          // 提取 roleIds 数组中的 roleId 字段组成字符串
+          this.form.roleIds = this.form.roleIds.join(',');
+          if (this.form.id != null) {
+            updateFastGptKeywordSend(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addFastGptKeywordSend(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$confirm('是否确认删除Ai指令编号为"' + ids + '"的数据项?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function() {
+        return delFastGptKeywordSend(ids);
+      }).then(() => {
+        this.getList();
+        this.msgSuccess("删除成功");
+      }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有Ai指令数据项?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        this.exportLoading = true;
+        return exportFastGptKeywordSend(queryParams);
+      }).then(response => {
+        this.download(response.msg);
+        this.exportLoading = false;
+      }).catch(() => {});
+    }
+  }
+};
+</script>
+<style scoped>.el-form-item__content {
+  white-space: nowrap;
+}
+</style>

+ 333 - 0
src/views/fastGpt/fastgptEventLogTotal/index.vue

@@ -0,0 +1,333 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="公司名" prop="companyId">
+        <select-tree
+          v-model="selectedCompanyList"
+          :raw-data="deptList"
+          placeholder="请选择销售"
+          :parentSelectable="true"
+          :multiple="true"
+          component-width="300px"
+          :max-display-tags="3"
+          :check-strictly="false"
+          :return-leaf-only="false"
+          @change="handleMultiChange"
+        ></select-tree>
+      </el-form-item>
+      <el-form-item label="销售" prop="nickName" v-if="queryParams.companyId">
+        <el-select v-model="queryParams.companyUserId" remote
+                   placeholder="请选择"
+                   filterable clearable
+                   style="width: 100%;"
+                   @keyup.enter.native="handleQuery"
+                   @change="handleCompanyUserId"
+        >
+          <el-option
+            v-for="dict in companyUserList"
+            :key="`${dict.nickName} - ${dict.userName}`"
+            :label="`${dict.nickName} - ${dict.userName}`"
+            :value="dict.userId">
+          </el-option>
+        </el-select>
+      </el-form-item>
+
+      <el-form-item label="AppKey" prop="appKey">
+        <div style="display: flex; align-items: center;">
+          <tree-select
+            v-model="selectedAppKey"
+            :options="appKeyOptions"
+            :normalizer="normalizer"
+            :disable-branch-nodes="false"
+            placeholder="请选择 AppKey"      style="width: 300px;"
+            @input="handleAppKeyChange"
+          />
+        </div>
+      </el-form-item>
+
+      <el-form-item label="创建时间" prop="createTime">
+        <el-date-picker v-model="createTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" 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">
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table border v-loading="loading" :data="fastgptEventLogTotalList" :row-class-name="() => 'fixed-bottom-row'"
+              @selection-change="handleSelectionChange" :max-height="600">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="角色名称" align="center" prop="roleName" />
+      <el-table-column label="时间" align="center" prop="statTime" />
+      <el-table-column
+        v-for="dict in typeOptions"
+        :key="dict.dictValue"
+        :label="dict.dictLabel"
+        align="center">
+        <template slot-scope="scope">
+          <span>{{ scope.row.typeCountMap ? scope.row.typeCountMap[dict.dictValue] : '' }}</span>
+          <span v-if="dict.dictValue !== '11'"
+                :style="{ fontSize: '12px', marginLeft: '5px',
+                color: getPercentageColor((scope.row.typeCountMap[dict.dictValue] / scope.row.typeCountMap[2]) * 100) }">
+            ({{ ((scope.row.typeCountMap[dict.dictValue] / scope.row.typeCountMap[2]) * 100).toFixed(2) }}%)
+          </span>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+  </div>
+</template>
+
+<script>
+import { listFastgptEventLogTotal, getFastgptEventLogTotal, delFastgptEventLogTotal, addFastgptEventLogTotal, updateFastgptEventLogTotal, exportFastgptEventLogTotal, getFastGptRoleAppKeyList} from "@/api/fastGpt/fastgptEventLogTotal";
+import SelectTree from "@/components/TreeSelect/index.vue";
+import {getDeptData} from "@/api/system/employeeStats";
+import TreeSelect from '@riophae/vue-treeselect'
+import '@riophae/vue-treeselect/dist/vue-treeselect.css'
+
+
+
+export default {
+  name: "FastgptEventLogTotal",
+  components: {SelectTree,TreeSelect},
+  data() {
+    return {
+      createTime:null,
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      selectedCompanyList: [],
+      deptList: [],
+      companyUserList: [],
+      selectedAppKey: null,
+      selectedAppKeyLabel: '',
+      appKeyOptions: [],
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // ai事件埋点统计表格数据
+      fastgptEventLogTotalList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      typeCountMap: null,
+      // 日志类型字典
+      typeOptions: [],
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        roleId: null,
+        count: null,
+        type: null,
+        companyId: null,
+        companyUserId: null,
+        qwUserId: null,
+        typeCountMap: null,
+        beginTime:null,
+        endTime:null,
+        appKey:null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+      }
+    };
+  },
+  created() {
+    this.getList();
+    this.getDicts("sys_fastgpt_event_log_type").then(response => {
+      this.typeOptions = response.data;
+    });
+
+    getDeptData().then(response => {
+      this.deptList = response.data;
+    });
+    getFastGptRoleAppKeyList().then(res => {
+      this.appKeyOptions = res.data.map(item => ({
+        id: `p_${item.roleId}`,
+        label: item.roleName,
+        children: (item.roleList || []).map(child => ({
+          id: `c_${child.roleId}`,
+          label: child.roleName,
+          parentId: `p_${item.roleId}`, // 记录父节点 ID
+          parentLabel: item.roleName,   // 记录父节点 label
+          disabled: true
+        }))
+      }));
+    });
+
+  },
+  methods: {
+    /** 查询ai事件埋点统计列表 */
+    getList() {
+      this.loading = true;
+      if(this.selectedCompanyList != null && this.selectedCompanyList.length > 0) {
+        this.queryParams.userIds = this.selectedCompanyList;
+      }else {
+        this.queryParams.userIds = [];
+      }
+
+      listFastgptEventLogTotal(this.queryParams).then(response => {
+        console.log(response)
+        this.fastgptEventLogTotalList = response.data.list;
+        this.total = response.data.total;
+        this.loading = false;
+      });
+    },
+    normalizer(node) {
+      return {
+        id: node.id,
+        label: node.label,
+        children: node.children,
+        disabled: node.disabled
+      }
+    },
+    handleAppKeyChange(value) {
+      const node = this.findNodeById(this.appKeyOptions, value);
+      if (!node) {
+        this.selectedAppKeyLabel = '';
+        return;
+      }
+
+      // 如果是子节点,则找父节点 label
+      if (node.parentLabel) {
+        this.queryParams.appKey = node.parentLabel;
+        this.selectedAppKeyLabel = node.parentLabel;
+        this.selectedAppKey = this.selectedAppKeyLabel;
+      } else {
+        this.queryParams.appKey = node.label;
+        this.selectedAppKeyLabel = node.label;
+        this.selectedAppKey = this.selectedAppKeyLabel;
+      }
+    },
+    findNodeById(nodes, id) {
+      for (const node of nodes) {
+        if (node.id === id) return node;
+        if (node.children) {
+          const found = this.findNodeById(node.children, id);
+          if (found) return found;
+        }
+      }
+      return null;
+    },
+    changeTime(){
+      console.log(this.createTime);
+      if(this.createTime!=null){
+        this.queryParams.beginTime=this.createTime[0];
+        this.queryParams.endTime=this.createTime[1];
+      }else{
+        this.queryParams.beginTime=null;
+        this.queryParams.endTime=null;
+      }
+      console.log(this.queryParams.beginTime);
+      console.log(this.queryParams.endTime);
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    handleMultiChange(e){
+
+    },
+    handleCompanyUserId(val){
+      if(val == null || val === '') {
+        this.queryParams.companyUserId = null;
+        this.queryParams.userIds = [];
+      }
+      console.log(val);
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        roleId: null,
+        count: null,
+        type: null,
+        companyId: null,
+        companyUserId: null,
+        qwUserId: null,
+        statTime: null
+      };
+      this.resetForm("form");
+    },
+    getPercentageColor(percentage) {
+      // HSL模式从黄色(60度)渐变到红色(0度)
+      const percent = Math.min(100, Math.max(0, parseFloat(percentage)));
+
+      // 调整色相范围:从深黄色(40°)渐变到红色(0°)
+      const hue = 40 - 40 * (percent / 100); // 初始 hue=40(深黄),终点 hue=0(红)
+
+      // 提高饱和度(100%),亮度保持 50%(鲜艳但不刺眼)
+      return `hsl(${hue}, 100%, 50%)`;
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      console.log(this.selectedAppKey)
+      if(this.selectedAppKey === null || typeof this.selectedAppKey === 'undefined'){
+        this.queryParams.appKey = null;
+      }
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.selectedAppKey = null;
+      this.selectedAppKeyLabel = '';
+      this.selectedCompanyList = [];
+      this.queryParams.appKey = null;
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+
+      if(this.selectedCompanyList != null && this.selectedCompanyList.length > 0) {
+        this.queryParams.userIds = this.selectedCompanyList;
+      }else {
+        this.queryParams.userIds = [];
+      }
+      this.$confirm('是否确认导出所有ai事件埋点统计数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.exportLoading = true;
+          return exportFastgptEventLogTotal(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+          this.exportLoading = false;
+        }).catch(() => {});
+    }
+  }
+};
+</script>

+ 252 - 0
src/views/his/statistics/tokenStatic.vue

@@ -0,0 +1,252 @@
+<template>
+    <div class="app-container">
+      <el-card>
+        <div slot="header" class="clearfix">
+          <span>token消耗统计</span>
+        </div>
+
+        <el-tabs v-model="activeTab" @tab-click="handleTabClick">
+          <el-tab-pane label="按天统计" name="daily">
+            <el-form :inline="true" class="demo-form-inline">
+              <el-form-item label="日期">
+                <el-date-picker
+                  v-model="dailyDate"
+                  type="date"
+                  placeholder="选择日期"
+                  value-format="yyyy-MM-dd"
+                  @change="handleDailyDateChange"
+                ></el-date-picker>
+              </el-form-item>
+
+              <el-form-item>
+                <el-button type="primary" @click="searchDaily">查询</el-button>
+                <el-button @click="resetDaily">重置</el-button>
+                <el-button type="success" @click="exportDaily">导出</el-button>
+              </el-form-item>
+            </el-form>
+
+            <el-table
+              v-loading="dailyLoading"
+              border
+              :data="companyList"
+              style="width: 100%"
+            >
+              <el-table-column prop="statTime" label="日期" width="180" />
+              <el-table-column prop="companyName" label="公司名称" />
+              <el-table-column prop="count" label="消耗token数" />
+            </el-table>
+
+            <div class="chart-container" style="margin-top: 20px; height: 400px">
+              <div ref="dailyChart" style="height: 100%; width: 100%"></div>
+            </div>
+          </el-tab-pane>
+
+          <el-tab-pane label="按月统计" name="monthly">
+            <el-form :inline="true" class="demo-form-inline">
+              <el-form-item label="月份">
+                <el-date-picker
+                  v-model="monthlyDate"
+                  type="month"
+                  placeholder="选择月份"
+                  value-format="yyyy-MM"
+                  @change="handleMonthlyDateChange"
+                ></el-date-picker>
+              </el-form-item>
+
+              <el-form-item>
+                <el-button type="primary" @click="searchMonthly">查询</el-button>
+                <el-button @click="resetMonthly">重置</el-button>
+                <el-button type="success" @click="exportMonthly">导出</el-button>
+              </el-form-item>
+            </el-form>
+
+            <el-table
+              v-loading="monthlyLoading"
+              border
+              :data="companyList"
+              style="width: 100%"
+            >
+              <el-table-column prop="date" label="月份" width="180" />
+              <el-table-column prop="companyName" label="公司名称" />
+              <el-table-column prop="count" label="消耗token数" />
+            </el-table>
+
+            <div class="chart-container" style="margin-top: 20px; height: 400px">
+              <div ref="monthlyChart" style="height: 100%; width: 100%"></div>
+            </div>
+          </el-tab-pane>
+        </el-tabs>
+      </el-card>
+    </div>
+  </template>
+
+  <script>
+  import { tokenStaticTotal,exportTokenStaticByTime} from "@/api/company/statistics";
+
+  export default {
+    name: 'tokenStatic',
+    data() {
+      const today = this.parseTime(new Date(), '{y}-{m}-{d}')
+      const yesterday = this.parseTime(new Date(new Date().getTime() - 24 * 60 * 60 * 1000), '{y}-{m}-{d}')
+      return {
+        // 激活的标签页
+        activeTab: 'daily',
+        // 按天统计数据
+        dailyLoading: false,
+        dailyDate: yesterday, // 默认当天
+        // 按月统计数据
+        monthlyLoading: false,
+        monthlyDate: this.parseTime(new Date(), '{y}-{m}'), // 默认当月
+        companyList: [],
+      }
+    },
+    created() {
+      // 获取当天数据
+      this.getList()
+    },
+    methods: {
+      // 标签页切换
+      handleTabClick(tab) {
+        if (tab.name === 'daily') {
+          this.getList()
+        } else if (tab.name === 'monthly') {
+          this.getMonthlyList()
+        }
+      },
+
+      // 按天统计相关方法
+      handleDailyDateChange(val) {
+        if (val) {
+          this.dailyDate = val
+        }
+      },
+      searchDaily() {
+        this.getList()
+      },
+      resetDaily() {
+        const today = this.parseTime(new Date(), '{y}-{m}-{d}')
+        const yesterday = this.parseTime(new Date(new Date().getTime() - 24 * 60 * 60 * 1000), '{y}-{m}-{d}')
+        this.dailyDate = yesterday
+        this.getList()
+      },
+
+      // 导出
+      exportDaily() {
+        this.$confirm("是否确认导出数据项?", "警告", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning",
+        })
+            .then(() => {
+            this.exportLoading = true;
+            return exportTokenStaticByTime(this.dailyDate);
+            })
+            .then((response) => {
+            this.download(response.msg);
+            this.exportLoading = false;
+            })
+            .catch(() => { });
+      },
+      getList() {
+        this.dailyLoading = true
+        tokenStaticTotal(this.dailyDate).then(response => {
+          // 处理返回数据,添加日期字段用于表格和图表显示
+          this.companyList = response.list;
+          this.dailyLoading = false;
+        }).catch(() => {
+          this.dailyLoading = false;
+        });
+      },
+
+      // 按月统计相关方法
+      handleMonthlyDateChange(val) {
+        if (val) {
+          this.monthlyDate = val
+        }
+      },
+      searchMonthly() {
+        this.getMonthlyList()
+      },
+      resetMonthly() {
+        this.monthlyDate = this.parseTime(new Date(), '{y}-{m}')
+        this.getMonthlyList()
+      },
+      exportMonthly() {
+        this.$confirm("是否确认导出数据项?", "警告", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning",
+        })
+            .then(() => {
+            this.exportLoading = true;
+            return exportTokenStaticByTime(this.monthlyDate);
+            })
+            .then((response) => {
+            this.download(response.msg);
+            this.exportLoading = false;
+            })
+            .catch(() => { });
+      },
+      getMonthlyList() {
+        this.monthlyLoading = true
+        tokenStaticTotal(this.monthlyDate).then(response => {
+          // 处理返回数据,添加月份字段用于表格和图表显示
+          this.companyList = response.list;
+          this.monthlyLoading = false;
+        }).catch(() => {
+          this.monthlyLoading = false;
+          this.monthlyTotal = 0;
+        });
+      },
+
+      // 日期格式化
+      parseTime(time, pattern) {
+        let date;
+        if (arguments.length === 0 || !time) {
+          return null
+        }
+        const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}'
+
+        if (typeof time === 'object') {
+          date = time
+        } else {
+          if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
+            time = parseInt(time)
+          } else if (typeof time === 'string') {
+            time = time.replace(new RegExp(/-/gm), '/')
+          }
+          if ((typeof time === 'number') && (time.toString().length === 10)) {
+            time = time * 1000
+          }
+          date = new Date(time)
+        }
+        const formatObj = {
+          y: date.getFullYear(),
+          m: date.getMonth() + 1,
+          d: date.getDate(),
+          h: date.getHours(),
+          i: date.getMinutes(),
+          s: date.getSeconds(),
+          a: date.getDay()
+        }
+        const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
+          let value = formatObj[key]
+          // Note: getDay() returns 0 on Sunday
+          if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] }
+          if (result.length > 0 && value < 10) {
+            value = '0' + value
+          }
+          return value || 0
+        })
+        return time_str
+      }
+    }
+  }
+  </script>
+
+  <style scoped>
+  .chart-container {
+    position: relative;
+    padding: 20px 0;
+  }
+  </style>