Forráskód Böngészése

导出导入功能

zhangjie 1 éve
szülő
commit
b10e0edff6

+ 39 - 0
src/modules/paper/views/EditPaper.vue

@@ -72,6 +72,13 @@
             @click="toImportPaperAnswer"
             >导入答案</el-button
           >
+          <el-button
+            size="small"
+            type="primary"
+            plain
+            @click="toImportPaperProperty"
+            >导入属性</el-button
+          >
           <!-- <el-button
             size="small"
             type="primary"
@@ -133,6 +140,13 @@
           >
             {{ quesTagShow ? "隐藏" : "显示" }}属性
           </el-button>
+          <el-button
+            size="small"
+            type="primary"
+            plain
+            @click="toExportPaperBlue"
+            >导出试卷蓝图</el-button
+          >
           <el-button
             type="primary"
             size="small"
@@ -564,6 +578,15 @@
       add-file-param="dataFile"
       @uploaded="initPaper"
     ></import-file-dialog>
+    <!-- 上传属性文件 -->
+    <import-file-dialog
+      ref="ImportPorpertyDialog"
+      dialog-title="上传属性文件"
+      :template-url="propertyTemplateUrl"
+      :upload-url="uploadPropertyUrl"
+      add-file-param="dataFile"
+      @uploaded="initPaper"
+    ></import-file-dialog>
     <!-- 题型分布 -->
     <paper-questype-info
       ref="PaperQuestypeInfo"
@@ -667,6 +690,9 @@ export default {
       // upload answer
       uploadAnswerUrl: "",
       answerTemplateUrl: "",
+      // upload property
+      propertyTemplateUrl: "",
+      uploadPropertyUrl: "",
     };
   },
   computed: {
@@ -778,6 +804,19 @@ export default {
       const url = `${QUESTION_API}/paper/answer/export/${this.paperId}?$key=${key}&$token=${token}`;
       window.open(url);
     },
+    // 导出试卷蓝图
+    toExportPaperBlue() {
+      const { key, token } = this.user;
+      const url = `${QUESTION_API}/paper/blue/export/${this.paperId}?$key=${key}&$token=${token}`;
+      window.open(url);
+    },
+    // 导入属性
+    toImportPaperProperty() {
+      const { key, token } = this.user;
+      this.propertyTemplateUrl = `${QUESTION_API}/paper/property/export/${this.paperId}?$key=${key}&$token=${token}`;
+      this.uploadPropertyUrl = `${QUESTION_API}/paper/property/import/${this.paperId}`;
+      this.$refs.ImportPorpertyDialog.open();
+    },
     toBack() {
       window.history.go(-1);
     },

+ 29 - 1
src/modules/questions/views/CourseProperty.vue

@@ -34,6 +34,14 @@
             @click="impCourseProperty"
             >导入
           </el-button>
+          <el-button
+            type="primary"
+            plain
+            icon="icon icon-export"
+            :disabled="noBatchSelected"
+            @click="exportCourseProperty(selectedList)"
+            >导出
+          </el-button>
         </div>
         <el-button
           type="primary"
@@ -91,9 +99,16 @@
             </span>
           </template>
         </el-table-column>
-        <el-table-column label="操作" width="160">
+        <el-table-column label="操作" width="220">
           <template slot-scope="scope">
             <div class="operate_left">
+              <el-button
+                size="mini"
+                type="primary"
+                plain
+                @click="exportCourseProperty([scope.row.id])"
+                >导出
+              </el-button>
               <el-button
                 size="mini"
                 type="primary"
@@ -354,6 +369,19 @@ export default {
   },
 
   methods: {
+    // 导出
+    exportCourseProperty(coursePropertyIds) {
+      if (!coursePropertyIds.length) {
+        this.$message.error("请选择要导出的属性");
+        return;
+      }
+      var param = new URLSearchParams({
+        $key: this.user.key,
+        $token: this.user.token,
+        coursePropertyIds: coursePropertyIds.join(),
+      });
+      window.open(QUESTION_API + "/courseProperty/detail/export?" + param);
+    },
     //导入
     impCourseProperty() {
       this.impDialog = true;