Переглянути джерело

导出token,完播统计,课程修复,为0

xw 2 тижнів тому
батько
коміт
dbdc7b1624

+ 9 - 0
src/api/course/qw/courseWatchLog.js

@@ -158,3 +158,12 @@ export function getUserIdList(query) {
     params: query
   })
 }
+
+// 导出用户ID列表
+export function exportUserIdList(query) {
+  return request({
+    url: '/course/courseWatchLog/exportUserIdList',
+    method: 'get',
+    params: query
+  })
+}

+ 9 - 0
src/api/fastGpt/fastgptPushTokenTotal.js

@@ -7,3 +7,12 @@ export function getFastGptPushTokenTotal(query) {
     params: query
   })
 }
+
+// 导出token统计数据
+export function exportTokenTotal(data) {
+  return request({
+    url: '/qw/qwPushCount/tokenExport',
+    method: 'post',
+    data: data
+  })
+}

+ 26 - 8
src/views/components/course/userCourseCatalogDetails.vue

@@ -186,7 +186,8 @@
           </el-table>
         </el-form-item>
         <el-form-item label="红包金额" prop="redPacketMoney">
-          <el-input-number v-model="form.redPacketMoney" :min="0.1" :max="200" :step="0.1"></el-input-number>
+          <el-input-number v-model="form.redPacketMoney" :min="0" :max="200" :step="0.1"></el-input-number>
+          <span style="color: #909399; font-size: 12px; margin-left: 10px;">设置为0表示不发红包</span>
         </el-form-item>
          <!-- v-if="!!form.randomRedPacketRulesArr" -->
         <el-form-item v-if="!!enableRandomRedPacket" label="随机红包金额"  >
@@ -410,7 +411,7 @@
                   @pagination="resourceList"/>
 
       <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="batchVideoSave">确 定</el-button>
+        <el-button type="primary" @click="batchVideoSave" :loading="addBatchData.saving" :disabled="addBatchData.saving">确 定</el-button>
       </div>
     </el-dialog>
     <el-dialog title="章节红包" :visible.sync="redData.open" width="900px" append-to-body>
@@ -610,6 +611,7 @@ export default {
       addBatchData: {
         open: false,
         loading: true,
+        saving: false, // 防止重复保存
         form: {},
         select: [], // 按用户选择顺序存储视频ID
         total: 0,
@@ -1355,18 +1357,34 @@ export default {
       });
     },
     batchVideoSave() {
+      // 第一时间检查并设置loading状态,防止快速连续点击
+      if (this.addBatchData.saving) {
+        console.log('正在保存,忽略重复点击');
+        return;
+      }
+
       if (this.addBatchData.select.length === 0) {
-        this.$message({
-          message: '请选择视频!!',
-          type: 'warning'
-        });
-        return
+        this.$message.warning('请选择视频');
+        return;
       }
+
+      // 立即设置loading为true,阻止后续点击
+      this.addBatchData.saving = true;
+
       this.addBatchData.form.ids = this.addBatchData.select; // 按用户选择顺序提交
       batchSaveVideo(this.addBatchData.form).then(response => {
+        this.$message.success('批量添加成功');
         this.addBatchData.open = false;
         this.getList();
-      })
+      }).catch(error => {
+        console.error('批量添加失败:', error);
+        this.$message.error('批量添加失败');
+      }).finally(() => {
+        // 延迟重置,防止连续点击
+        setTimeout(() => {
+          this.addBatchData.saving = false;
+        }, 500);
+      });
     },
     updateRedPageckeOpen() {
       this.redData.open = true;

+ 15 - 1
src/views/course/courseRedPacketLog/index.vue

@@ -113,6 +113,12 @@
              :value="parseInt(dict.dictValue)"
            />
      </el-select>
+	</el-form-item>
+	<el-form-item label="发送类型" prop="sendType">
+	  <el-select v-model="queryParams.sendType" placeholder="请选择发送类型" clearable size="small">
+	    <el-option label="手动" :value="1" />
+	    <el-option label="自动" :value="2" />
+	  </el-select>
 	</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 HH:mm:ss" type="daterange"
@@ -162,6 +168,13 @@
       <el-table-column label="所属公司" align="center" prop="companyName" />
       <el-table-column label="员工部门" align="center" prop="deptName" />
       <el-table-column label="转帐金额" align="center" prop="amount" />
+      <el-table-column label="发送类型" align="center" prop="sendType" width="100">
+        <template slot-scope="scope">
+          <el-tag :type="scope.row.sendType === 1 ? 'warning' : 'success'">
+            {{ scope.row.sendType === 1 ? "手动" : "自动" }}
+          </el-tag>
+        </template>
+      </el-table-column>
       <el-table-column label="状态" align="center" prop="status" >
         <template slot-scope="scope">
           <el-tag>{{ scope.row.status === 0 ? "发送中" : "已完成" }}</el-tag>
@@ -274,7 +287,8 @@ export default {
         phoneMk: null,
         sTime:null,
         eTime:null,
-        userIds: null
+        userIds: null,
+        sendType: null
       },
 	   createTime:null,
       // 表单参数

+ 48 - 1
src/views/course/sop/userIdList.vue

@@ -40,6 +40,14 @@
       <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-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+        >导出</el-button>
       </el-form-item>
     </el-form>
 
@@ -71,7 +79,7 @@
 </template>
 
 <script>
-import {getUserIdList } from "@/api/course/qw/courseWatchLog";
+import {getUserIdList, exportUserIdList } from "@/api/course/qw/courseWatchLog";
 import {getMiniProgramList } from "@/api/hisStore/storePayment";
 
 export default {
@@ -79,6 +87,7 @@ export default {
   data() {
     return {
       loading: true,
+      exportLoading: false,
       total: 0,
       appRegisterList: [],
       appMallOptions:[],
@@ -161,6 +170,44 @@ export default {
       // 重置后立即查询
       this.queryParams.pageNum = 1;
       this.getList();
+    },
+
+    /** 导出按钮操作 */
+    handleExport() {
+      // 验证创建时间是否为空
+      if (!this.queryParams.createTime) {
+        this.$message.warning('请选择创建时间');
+        return;
+      }
+
+      this.$confirm('是否确认导出数据?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        // 显示全屏加载提示
+        const loadingInstance = this.$loading({
+          lock: true,
+          text: '正在导出数据,请稍候...',
+          background: 'rgba(0, 0, 0, 0.7)'
+        });
+
+        this.exportLoading = true;
+
+        exportUserIdList(this.queryParams)
+          .then(response => {
+            this.download(response.msg);
+          })
+          .catch(() => {
+            this.$message.error('导出失败');
+          })
+          .finally(() => {
+            loadingInstance.close();
+            this.exportLoading = false;
+          });
+      }).catch(() => {
+        this.$message.info('已取消导出');
+      });
     }
   }
 };

+ 6 - 5
src/views/course/userCoursePeriod/batchRedPacket.vue

@@ -31,12 +31,13 @@
         <template slot-scope="scope">
           <el-input-number
             v-model="scope.row.amount"
-            :min="0.1"
+            :min="0"
             :precision="2"
             :step="0.01"
             size="small"
             style="width: 150px"
           />
+          <span style="color: #909399; font-size: 12px; margin-left: 5px;">0表示不发红包</span>
         </template>
       </el-table-column>
     </el-table>
@@ -89,15 +90,15 @@ export default {
     initTableData() {
       this.tableData = this.selectedData.map(item => ({
         ...item,
-        amount: 0.1
+        amount: 0
       }))
     },
     // 保存
     handleSave() {
-      // 验证金额范围
-      const invalidItems = this.tableData.filter(item => item.amount < 0.1);
+      // 验证金额范围(允许设置为0)
+      const invalidItems = this.tableData.filter(item => item.amount < 0);
       if (invalidItems.length > 0) {
-        this.$message.error('红包金额需要大于等于0.1元');
+        this.$message.error('红包金额不能小于0元');
         return;
       }
 

+ 45 - 18
src/views/fastGpt/fastGptPushTokenTotal/index.vue

@@ -17,6 +17,16 @@
     </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"
+        >导出</el-button>
+      </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
@@ -41,7 +51,7 @@
 
 <script>
 import { listFastgptEventLogTotal, exportFastgptEventLogTotal, getFastGptRoleAppKeyList} from "@/api/fastGpt/fastgptEventLogTotal";
-import { getFastGptPushTokenTotal} from "@/api/fastGpt/fastgptPushTokenTotal";
+import { getFastGptPushTokenTotal, exportTokenTotal} from "@/api/fastGpt/fastgptPushTokenTotal";
 import SelectTree from "@/components/TreeSelect/index.vue";
 import {getDeptData} from "@/api/system/employeeStats";
 import TreeSelect from '@riophae/vue-treeselect'
@@ -236,24 +246,41 @@ export default {
     },
     /** 导出按钮操作 */
     handleExport() {
-      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出token统计数据?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        // 显示全屏加载提示
+        const loadingInstance = this.$loading({
+          lock: true,
+          text: '正在导出数据,请稍候...',
+          background: 'rgba(0, 0, 0, 0.7)'
+        });
 
-      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(() => {});
+        this.exportLoading = true;
+
+        // 准备导出数据,使用POST方式传递数据
+        const exportData = {
+          companyId: this.queryParams.companyId,
+          beginTime: this.queryParams.beginTime,
+          endTime: this.queryParams.endTime
+        };
+
+        exportTokenTotal(exportData)
+          .then(response => {
+            this.download(response.msg);
+          })
+          .catch(() => {
+            this.$message.error('导出失败');
+          })
+          .finally(() => {
+            loadingInstance.close();
+            this.exportLoading = false;
+          });
+      }).catch(() => {
+        this.$message.info('已取消导出');
+      });
     }
   }
 };