ソースを参照

feat: 同步修改

zhangjie 6 ヶ月 前
コミット
e79b865787

+ 32 - 1
src/modules/target/components/target-score/SyncPaperDialog.vue

@@ -32,6 +32,11 @@
         :index="indexMethod"
       ></el-table-column>
       <el-table-column prop="paperNumber" label="试卷编号"> </el-table-column>
+      <el-table-column prop="sync" label="状态">
+        <span slot-scope="scope" :class="{ 'color-success': scope.row.sync }">
+          {{ scope.row.sync ? "已同步" : "未同步" }}
+        </span>
+      </el-table-column>
       <el-table-column class-name="action-column" label="操作" width="80">
         <template slot-scope="scope">
           <el-button class="btn-primary" type="text" @click="toSync(scope.row)"
@@ -72,6 +77,16 @@ export default {
     async getList() {
       const res = await endScoreSyncPaperList(this.filter);
       this.dataList = res || [];
+      this.updateSyncStatus();
+    },
+    updateSyncStatus() {
+      this.dataList = this.dataList.map((item) => {
+        return {
+          ...item,
+          sync:
+            this.course.sync && this.course.paperNumber === item.paperNumber,
+        };
+      });
     },
     visibleChange() {},
     cancel() {
@@ -81,6 +96,17 @@ export default {
       this.modalIsShow = true;
     },
     async toSync(row) {
+      if (this.course.sync) {
+        const confirm = await this.$confirm(
+          `已同步期末成绩,重新同步或切换试卷编号会清空原同步成绩及学生对应平时成绩,请仔细核对是否需要重新同步!`,
+          "提示",
+          {
+            type: "warning",
+          }
+        ).catch(() => {});
+        if (confirm !== "confirm") return;
+      }
+
       if (this.loading) return;
       this.loading = true;
 
@@ -95,7 +121,12 @@ export default {
 
       if (!res) return;
 
-      this.setCourse({ examId: row.examId, paperNumber: row.paperNumber });
+      this.setCourse({
+        examId: row.examId,
+        paperNumber: row.paperNumber,
+        sync: true,
+      });
+      this.updateSyncStatus();
       this.$message.success(`${res.success},错误:${res.error}`);
       this.$emit("modified");
       this.cancel();

+ 2 - 0
src/modules/target/views/TargetScoreManage.vue

@@ -53,6 +53,8 @@
         </el-table-column>
         <el-table-column prop="semesterName" label="学期" min-width="160">
         </el-table-column>
+        <el-table-column prop="examName" label="考试" min-width="160">
+        </el-table-column>
         <el-table-column label="课程(代码)" min-width="300">
           <template slot-scope="scope">
             {{ scope.row.courseName | defaultFieldFilter }}({{