deason 3 år sedan
förälder
incheckning
8ff6326d85
1 ändrade filer med 51 tillägg och 7 borttagningar
  1. 51 7
      src/modules/examwork/view/weixinAnswerSetting.vue

+ 51 - 7
src/modules/examwork/view/weixinAnswerSetting.vue

@@ -29,7 +29,11 @@
           </el-form-item>
 
           <el-form-item label="状态">
-            <el-select v-model="searchForm.weixinAnswerEnabled" class="input">
+            <el-select
+              v-model="searchForm.weixinAnswerEnabled"
+              class="input"
+              clearable
+            >
               <el-option label="全部" value=""></el-option>
               <el-option label="启用" value="true"></el-option>
               <el-option label="禁用" value="false"></el-option>
@@ -60,7 +64,7 @@
           type="danger"
           icon="el-icon-edit"
           :disabled="noBatchSelected"
-          @click="xxx"
+          @click="batchEnabled(true)"
           >批量启用</el-button
         >
         <el-button
@@ -68,21 +72,21 @@
           type="danger"
           icon="el-icon-edit"
           :disabled="noBatchSelected"
-          @click="xxx"
+          @click="batchEnabled(false)"
           >批量禁用</el-button
         >
         <el-button
           size="small"
           type="primary"
           icon="el-icon-upload2"
-          @click="xxx"
+          @click="importSetting"
           >导入设置</el-button
         >
         <el-button
           size="small"
           type="primary"
           icon="el-icon-download"
-          @click="xxx"
+          @click="exportSetting"
           >导出设置</el-button
         >
 
@@ -108,7 +112,7 @@
           <el-pagination
             :current-page="searchForm.pageNo"
             :page-size="searchForm.pageSize"
-            :page-sizes="[2, 20, 50, 100, 200, 300]"
+            :page-sizes="[10, 20, 50, 100, 200, 300]"
             :total="totalElements"
             layout="total, sizes, prev, pager, next, jumper"
             @current-change="handlePagerNo"
@@ -164,10 +168,50 @@ export default {
         this.totalElements = response.data.totalElements;
       });
     },
-    xxx() {
+    importSetting() {
       console.log("examId", this.searchForm.examId);
       console.log("courseIds", JSON.stringify(this.selectedCourseIds));
     },
+    exportSetting() {
+      this.$confirm("确认导出设置?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      }).then(() => {
+        let url =
+          EXAM_WORK_API +
+          "/exam/course/export/weixinAnswerEnabledSetting?examId=" +
+          this.searchForm.examId +
+          "&weixinAnswerEnabled=" +
+          this.searchForm.weixinAnswerEnabled;
+        window.open(url);
+      });
+    },
+    batchEnabled(enabled) {
+      this.$confirm(enabled ? "确认启用?" : "确认禁用?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      }).then(() => {
+        let courseIds = this.selectedCourseIds.join(",");
+
+        let url =
+          EXAM_WORK_API +
+          "/exam/course/weixinAnswerEnabled?examId=" +
+          this.searchForm.examId +
+          "&enabled=" +
+          enabled +
+          "&courseIds=" +
+          courseIds;
+        this.$http.post(url).then(() => {
+          this.$notify({
+            type: "success",
+            message: enabled ? "批量启用成功!" : "批量禁用成功!",
+          });
+          this.doSearch(1);
+        });
+      });
+    },
     handlePagerNo(pageNo) {
       this.doSearch(pageNo);
     },