zhangjie 2 lat temu
rodzic
commit
f31c9edf6c

+ 3 - 0
src/assets/styles/base.scss

@@ -445,6 +445,9 @@ body {
 .ml-2 {
   margin-left: 10px;
 }
+.ml-4 {
+  margin-left: 20px;
+}
 .mr-1 {
   margin-right: 5px;
 }

+ 7 - 0
src/constants/enumerate.js

@@ -46,3 +46,10 @@ export const DATA_TASK_RESULT = {
   SUCCESS: "成功",
   ERROR: "失败",
 };
+
+// assign
+export const ASSIGN_CALC_STATUS = {
+  INIT: "未开始",
+  RUNNING: "进行中",
+  FINISH: "已完成",
+};

+ 11 - 2
src/modules/base/api.js

@@ -58,6 +58,9 @@ export const deleteSemester = (id) => {
 export const updateSemester = (datas) => {
   return $post("/api/exam_semester/save", datas);
 };
+export const ableSemester = ({ id, enable }) => {
+  return $postParam("/api/exam_semester/enable", { id, enable });
+};
 // no user
 export const semesterSetInUsed = (id) => {
   return $postParam("/api/exam_semester/set_in_used", { id });
@@ -75,6 +78,9 @@ export const deleteExamType = (id) => {
 export const updateExamType = (datas) => {
   return $post("/api/exam_type/save", datas);
 };
+export const ableExamType = ({ id, enable }) => {
+  return $postParam("/api/exam_type/enable", { id, enable });
+};
 // setting --------------------------------->
 // time-task
 export const timeTaskList = (datas) => {
@@ -154,8 +160,8 @@ export const systemSettingQuery = () => {
 export const updateSystemSetting = (datas) => {
   return $post("/api/sys_setting/save", datas);
 };
-export const flushCache = (type) => {
-  return $postParam("/api/admin/common/flush_cache", { type });
+export const flushCache = () => {
+  return $postParam("/api/sys_setting/flush_cache", {});
 };
 // assignment-calculate
 export const assignmentDataList = (datas) => {
@@ -169,6 +175,9 @@ export const assignmentDetailInfo = (datas, silence = false) => {
 export const assignmentCalculate = (datas) => {
   return $post("/api/assign/calc", datas);
 };
+export const assignmentPublish = (id) => {
+  return $postParam("/api/assign/publish", { id });
+};
 export const assignmentCalcResult = (datas) => {
   // required: semesterId,examTypeId,courseCode,openCollege,
   // kcCollege,clazzId,teacherCode

+ 48 - 7
src/modules/base/components/assignment/AssignConfig.vue

@@ -91,9 +91,26 @@
           <el-button type="primary" :loading="loading" @click="toCalc">{{
             loading ? "正在计算中" : "开始试算"
           }}</el-button>
+          <el-button
+            type="primary"
+            :loading="publishing"
+            :disabled="!modalForm.id"
+            @click="toPublish"
+            >发布</el-button
+          >
         </div>
-        <p v-if="calcErrorMsg" class="tips-info tips-error">
-          错误信息:{{ calcErrorMsg }}
+        <div>
+          <span
+            >计算状态:<i>{{ ASSIGN_CALC_STATUS[detailData.status] }}</i></span
+          >
+          <span class="ml-4"
+            >发布状态:<i :class="{ 'color-success': detailData.publish }">{{
+              detailData.publish ? "已发布" : "未发布"
+            }}</i></span
+          >
+        </div>
+        <p v-if="detailData.errorMsg" class="tips-info tips-error">
+          计算结果:失败,错误信息:{{ detailData.errorMsg }}
         </p>
       </el-form-item>
     </el-form>
@@ -102,7 +119,12 @@
 
 <script>
 import timeMixin from "@/mixins/timeMixin";
-import { assignmentDetailInfo, assignmentCalculate } from "../../api";
+import {
+  assignmentDetailInfo,
+  assignmentCalculate,
+  assignmentPublish,
+} from "../../api";
+import { ASSIGN_CALC_STATUS } from "@/constants/enumerate";
 
 export default {
   name: "assign-config",
@@ -134,6 +156,7 @@ export default {
         FORMULA1: "公式1",
         FORMULA2: "公式2",
       },
+      ASSIGN_CALC_STATUS,
       rules: {
         formula: [
           {
@@ -155,9 +178,10 @@ export default {
           },
         ],
       },
-      calcErrorMsg: "",
       loading: false,
+      publishing: false,
       statusPeriod: 5000,
+      detailData: {},
     };
   },
   mounted() {
@@ -169,7 +193,7 @@ export default {
       this.modalForm.value = coefficient.value;
       this.modalForm.detail = coefficient.detail || [];
     }
-    this.calcErrorMsg = this.detailInfo.errorMsg;
+    this.detailData = { ...this.detailInfo };
     if (!this.modalForm.detail.length) {
       this.modalForm.detail = this.detailInfo.inspectCollege.map((item) => {
         return {
@@ -193,9 +217,9 @@ export default {
       const res = await assignmentDetailInfo(this.assignInfo, true);
       this.loading = res.status === "RUNNING";
       this.modalForm.id = res.id;
+      this.detailData = res;
 
       if (!this.loading) {
-        this.calcErrorMsg = res.errorMsg;
         this.$message.success("计算完成!");
         return;
       }
@@ -216,6 +240,23 @@ export default {
         item.value = val;
       });
     },
+    async toPublish() {
+      if (!this.modalForm.id || this.detailData.status !== "FINISH") {
+        return;
+      }
+      const result = await this.$confirm(`确定要发布赋分成绩吗?`, "提示", {
+        type: "warning",
+      });
+      if (result !== "confirm") return;
+
+      if (this.publishing) return;
+      this.publishing = true;
+
+      const res = await assignmentPublish(this.modalForm.id).catch(() => {});
+      this.publishing = false;
+      if (!res) return;
+      this.$message.success("发布成功!");
+    },
     async toCalc() {
       const valid = await this.$refs.modalFormComp.validate().catch(() => {});
       if (!valid) return;
@@ -229,7 +270,7 @@ export default {
         formula: this.modalForm.formula,
         coefficient: this.modalForm,
       };
-      this.calcErrorMsg = "";
+      this.detailData.errorMsg = "";
       const data = await assignmentCalculate(datas).catch(() => {});
       if (!data) {
         this.loading = false;

+ 17 - 1
src/modules/base/views/BusinessDataManage.vue

@@ -2,6 +2,15 @@
   <div class="print-plan-push-manage">
     <div class="part-box part-box-filter part-box-flex">
       <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
+        <el-form-item prop="semesterId" label="学期:">
+          <semester-select v-model="filter.semesterId"></semester-select>
+        </el-form-item>
+        <el-form-item prop="examTypeId" label="考试:">
+          <exam-type-select
+            v-model="filter.examTypeId"
+            :semester-id="filter.semesterId"
+          ></exam-type-select>
+        </el-form-item>
         <el-form-item label="同步日期:">
           <el-date-picker
             v-model="filter.syncDate"
@@ -12,7 +21,12 @@
           </el-date-picker>
         </el-form-item>
         <el-form-item label-width="0px">
-          <el-button type="primary" @click="search">查询</el-button>
+          <el-button
+            type="primary"
+            :disabled="!filter.semesterId || !filter.examTypeId"
+            @click="search"
+            >查询</el-button
+          >
         </el-form-item>
       </el-form>
       <div class="part-box-action">
@@ -107,6 +121,8 @@ export default {
   data() {
     return {
       filter: {
+        semesterId: "",
+        examTypeId: "",
         syncDate: "",
       },
       current: 1,

+ 17 - 1
src/modules/base/views/DownloadManage.vue

@@ -2,6 +2,15 @@
   <div class="student-manage">
     <div class="part-box part-box-filter part-box-flex">
       <el-form ref="FilterForm" label-position="left" label-width="90px" inline>
+        <el-form-item prop="semesterId" label="学期:">
+          <semester-select v-model="filter.semesterId"></semester-select>
+        </el-form-item>
+        <el-form-item prop="examTypeId" label="考试:">
+          <exam-type-select
+            v-model="filter.examTypeId"
+            :semester-id="filter.semesterId"
+          ></exam-type-select>
+        </el-form-item>
         <el-form-item label="下载时间:">
           <el-date-picker
             v-model="filter.operateTime"
@@ -32,7 +41,12 @@
           </el-select>
         </el-form-item>
         <el-form-item>
-          <el-button type="primary" @click="toPage(1)">查询</el-button>
+          <el-button
+            type="primary"
+            :disabled="!filter.semesterId || !filter.examTypeId"
+            @click="toPage(1)"
+            >查询</el-button
+          >
         </el-form-item>
       </el-form>
       <div class="part-box-action">
@@ -135,6 +149,8 @@ export default {
   data() {
     return {
       filter: {
+        semesterId: "",
+        examTypeId: "",
         operateTime: "",
         used: null,
         useScene: "",

+ 29 - 2
src/modules/base/views/ExamTypeManage.vue

@@ -22,8 +22,19 @@
           :index="indexMethod"
         ></el-table-column>
         <el-table-column prop="name" label="类型名称"></el-table-column>
-        <el-table-column class-name="action-column" label="操作" width="160px">
+        <el-table-column prop="enable" label="状态" width="100">
+          <template slot-scope="scope">
+            {{ scope.row.enable | enableFilter }}
+          </template>
+        </el-table-column>
+        <el-table-column class-name="action-column" label="操作" width="140">
           <template slot-scope="scope">
+            <el-button
+              :class="scope.row.enable ? 'btn-danger' : 'btn-primary'"
+              type="text"
+              @click="toEnable(scope.row)"
+              >{{ scope.row.enable ? "禁用" : "启用" }}</el-button
+            >
             <el-button
               class="btn-primary"
               type="text"
@@ -61,7 +72,7 @@
 </template>
 
 <script>
-import { examTypeListQuery, deleteExamType } from "../api";
+import { examTypeListQuery, deleteExamType, ableExamType } from "../api";
 import ModifyExamType from "../components/ModifyExamType.vue";
 
 export default {
@@ -103,6 +114,22 @@ export default {
       this.curRow = row;
       this.$refs.ModifyExamType.open();
     },
+    toEnable(row) {
+      const action = row.enable ? "禁用" : "启用";
+      this.$confirm(`确定要${action}考试类型【${row.name}】吗?`, "提示", {
+        type: "warning",
+      })
+        .then(async () => {
+          const enable = !row.enable;
+          await ableExamType({
+            id: row.id,
+            enable,
+          });
+          row.enable = enable;
+          this.$message.success("操作成功!");
+        })
+        .catch(() => {});
+    },
     async toDelete(row) {
       const result = await this.$confirm(
         `确定要删除类型【${row.name}】吗?`,

+ 29 - 2
src/modules/base/views/SemesterManage.vue

@@ -22,8 +22,19 @@
           :index="indexMethod"
         ></el-table-column>
         <el-table-column prop="name" label="学期"></el-table-column>
-        <el-table-column class-name="action-column" label="操作" width="120">
+        <el-table-column prop="enable" label="状态" width="100">
+          <template slot-scope="scope">
+            {{ scope.row.enable | enableFilter }}
+          </template>
+        </el-table-column>
+        <el-table-column class-name="action-column" label="操作" width="140">
           <template slot-scope="scope">
+            <el-button
+              :class="scope.row.enable ? 'btn-danger' : 'btn-primary'"
+              type="text"
+              @click="toEnable(scope.row)"
+              >{{ scope.row.enable ? "禁用" : "启用" }}</el-button
+            >
             <el-button
               class="btn-primary"
               type="text"
@@ -61,7 +72,7 @@
 </template>
 
 <script>
-import { semesterListQuery, deleteSemester } from "../api";
+import { semesterListQuery, deleteSemester, ableSemester } from "../api";
 import ModifySemester from "../components/ModifySemester";
 
 export default {
@@ -103,6 +114,22 @@ export default {
       this.curRow = row;
       this.$refs.ModifySemester.open();
     },
+    toEnable(row) {
+      const action = row.enable ? "禁用" : "启用";
+      this.$confirm(`确定要${action}学期【${row.name}】吗?`, "提示", {
+        type: "warning",
+      })
+        .then(async () => {
+          const enable = !row.enable;
+          await ableSemester({
+            id: row.id,
+            enable,
+          });
+          row.enable = enable;
+          this.$message.success("操作成功!");
+        })
+        .catch(() => {});
+    },
     async toDelete(row) {
       const result = await this.$confirm(
         `确定要删除学期【${row.name}】吗?`,

+ 10 - 7
src/modules/base/views/SystemSetting.vue

@@ -42,7 +42,9 @@
           <el-button type="primary" :disabled="isSubmit" @click="submit"
             >确认</el-button
           >
-          <el-button type="primary" @click="freshCache">刷新缓存</el-button>
+          <el-button type="primary" :loading="loading" @click="freshCache"
+            >刷新缓存</el-button
+          >
         </el-form-item>
       </el-form>
     </div>
@@ -70,6 +72,7 @@ export default {
       ],
       rules: {},
       setList: [],
+      loading: false,
     };
   },
   mounted() {
@@ -119,12 +122,12 @@ export default {
       this.$message.success("设置成功!");
     },
     async freshCache() {
-      const schoolId = this.$ls.get("schoolId");
-      if (!schoolId) {
-        await flushCache("SYS_SETTING_GLOBAL");
-      } else {
-        await flushCache("SYS_SETTING");
-      }
+      if (this.loading) return;
+      this.loading = true;
+      const res = await flushCache().catch(() => {});
+      this.loading = false;
+      if (!res) return;
+      this.$message.success("操作成功!");
     },
   },
 };

+ 6 - 1
src/modules/base/views/TimeTaskManage.vue

@@ -26,7 +26,12 @@
           </el-date-picker>
         </el-form-item>
         <el-form-item>
-          <el-button type="primary" @click="toPage(1)">查询</el-button>
+          <el-button
+            type="primary"
+            :disabled="!filter.semesterId || !filter.examTypeId"
+            @click="toPage(1)"
+            >查询</el-button
+          >
         </el-form-item>
       </el-form>
       <div class="part-box-action">