zhangjie преди 2 години
родител
ревизия
d6fcae0543

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

@@ -16,6 +16,9 @@ export const paperDimensionExport = datas => {
     responseType: "blob"
   });
 };
+export const syncPaperStruct = datas => {
+  return $postParam("/api/admin/grade/paper/struct/list", datas);
+};
 export const paperStructList = datas => {
   return $postParam("/api/admin/grade/paper/struct/list", datas);
 };

+ 20 - 2
src/modules/analysis/components/baseConfig/BlueprintConfig.vue

@@ -5,6 +5,7 @@
       <el-button
         v-if="baseInfo.useExamCloudStruct"
         type="primary"
+        :loading="updating"
         @click="toUpdateExamCloudStruct"
         >更新试卷结构</el-button
       >
@@ -91,9 +92,13 @@
 </template>
 
 <script>
-import { mapState, mapActions } from "vuex";
+import { mapState, mapMutations, mapActions } from "vuex";
 import ImportFile from "@/components/ImportFile";
-import { updatePaperStruct, paperStructExport } from "../../api";
+import {
+  updatePaperStruct,
+  paperStructExport,
+  syncPaperStruct
+} from "../../api";
 import { downloadByApi } from "@/plugins/download";
 
 export default {
@@ -105,6 +110,7 @@ export default {
       knowledgeList: [],
       abilityList: [],
       loading: false,
+      updating: false,
       // upload
       uploadUrl: "/api/admin/grade/paper/struct/import",
       uploadData: {},
@@ -119,6 +125,7 @@ export default {
     this.initData();
   },
   methods: {
+    ...mapMutations("baseConfigs", ["setBaseInfo"]),
     ...mapActions("baseConfigs", ["fetchStructList"]),
     initDimensions() {
       this.knowledgeList = this.dimensionList
@@ -171,6 +178,17 @@ export default {
       this.$refs.ImportFile.open();
     },
     async toUpdateExamCloudStruct() {
+      if (this.updating) return;
+      this.updating = true;
+
+      const res = await syncPaperStruct({
+        paperNumber: this.baseInfo.paperNumber,
+        paperType: this.baseInfo.paperType
+      }).catch(() => {});
+      this.updating = false;
+      if (!res) return;
+
+      this.setBaseInfo({ ...this.baseInfo, useExamCloudStruct: false });
       await this.fetchStructList();
       this.initData();
     },

+ 0 - 3
src/modules/analysis/components/baseConfig/baseConfigsStore.js

@@ -53,9 +53,6 @@ const actions = {
       paperNumber: state.baseInfo.paperNumber,
       paperType: state.baseInfo.paperType
     };
-    if (state.baseInfo.useExamCloudStruct) {
-      datas.useExamCloudStruct = true;
-    }
     const data = await paperStructList(datas).catch(() => {});
     if (!data) return Promise.reject();
     commit("setStructList", data);

+ 3 - 1
src/modules/analysis/views/DataInitManage.vue

@@ -59,7 +59,9 @@
         >
           <template slot-scope="scope">
             <el-button
-              v-if="checkPrivilege('link', 'window') && scope.row.publishStatus"
+              v-if="
+                checkPrivilege('link', 'window') && !scope.row.publishStatus
+              "
               class="btn-primary"
               type="text"
               @click="toConfig(scope.row)"

+ 13 - 4
src/modules/stmms/views/ScoreArchive.vue

@@ -95,14 +95,14 @@
               v-if="checkPrivilege('link', 'Preview')"
               class="btn-primary"
               type="text"
-              @click="toViewPaper(scope.row, 'sheet')"
+              @click="toViewSheetPaper(scope.row)"
               >原图</el-button
             >
             <el-button
               v-if="checkPrivilege('link', 'Preview')"
               class="btn-primary"
               type="text"
-              @click="toViewPaper(scope.row, 'track')"
+              @click="toViewPaper(scope.row)"
               >轨迹图</el-button
             >
             <el-button
@@ -241,11 +241,20 @@ export default {
       this.$message.success("下载成功!");
     },
     // img view
-    async toViewPaper(row, viewType) {
+    toViewSheetPaper(row) {
+      const dataList = row.sheetUrls ? JSON.parse(row.sheetUrls) : [];
+      this.curImageIndex = 0;
+      this.imageList = dataList.map((item, index) => {
+        return { url: item, name: index + 1 };
+      });
+      this.selectImage(this.curImageIndex);
+      this.$refs.SimpleImagePreview.open();
+    },
+    async toViewPaper(row) {
       const res = await scorePreview(row.id).catch(() => {});
       if (!res) return;
 
-      const dataList = viewType === "sheet" ? res.sheetUrls : res.trailUrls;
+      const dataList = res || [];
 
       if (!dataList || !dataList.length) {
         this.$message.error("数据缺失!");