Jelajahi Sumber

feat: 课程目标达成度统计新增重新计算

zhangjie 11 bulan lalu
induk
melakukan
f198886878
2 mengubah file dengan 25 tambahan dan 2 penghapusan
  1. 3 0
      src/modules/target/api.js
  2. 22 2
      src/modules/target/views/TargetStatistics.vue

+ 3 - 0
src/modules/target/api.js

@@ -201,6 +201,9 @@ export const requirementStatisticsCalculate = (datas) => {
 export const targetStatisticsListPage = (datas) => {
   return $postParam("/api/admin/course/degree/report/list", datas);
 };
+export const targetStatisticsCalculate = (datas) => {
+  return $postParam("/api/admin/course/degree/report/again/calculate", datas);
+};
 export const targetStatisticsDetail = (datas) => {
   return $postParam("/api/admin/course/degree/report/view", datas);
 };

+ 22 - 2
src/modules/target/views/TargetStatistics.vue

@@ -61,10 +61,17 @@
         <el-table-column
           class-name="action-column"
           label="操作"
-          width="90"
+          width="160"
           fixed="right"
         >
           <template slot-scope="scope">
+            <el-button
+              v-if="checkPrivilege('link', 'view')"
+              class="btn-primary"
+              type="text"
+              @click="toCalculate(scope.row)"
+              >重新计算</el-button
+            >
             <el-button
               v-if="checkPrivilege('link', 'view')"
               class="btn-primary"
@@ -99,7 +106,7 @@
 </template>
 
 <script>
-import { targetStatisticsListPage } from "../api";
+import { targetStatisticsListPage, targetStatisticsCalculate } from "../api";
 import DetailTargetStatistics from "../components/target-statistics/DetailTargetStatistics.vue";
 
 export default {
@@ -117,6 +124,7 @@ export default {
       total: 0,
       dataList: [],
       curRow: {},
+      loading: false,
     };
   },
   mounted() {
@@ -149,6 +157,18 @@ export default {
       this.curRow = row;
       this.$refs.DetailTargetStatistics.open();
     },
+    async toCalculate(row) {
+      if (this.loading) return;
+      this.loading = true;
+      const res = await targetStatisticsCalculate({
+        cultureProgramId: row.cultureProgramId,
+        courseId: row.courseId,
+      }).catch(() => {});
+      this.loading = false;
+      if (!res) return;
+
+      this.$message.success("操作成功!");
+    },
   },
 };
 </script>