zhangjie 2 tygodni temu
rodzic
commit
d790e09453

+ 1 - 0
src/modules/admin/components/school/SchoolSetBase.vue

@@ -106,6 +106,7 @@ export default {
         recognition: "SchoolSetRecognition",
         robot: "SchoolSetRobot",
         ai: "SchoolSetAi",
+        mark: "SchoolSetMark",
       };
       return map[val];
     },

+ 59 - 67
src/modules/admin/components/school/SchoolSetMark.vue

@@ -1,51 +1,21 @@
 <template>
   <div class="school-set-mark part-box part-box-pad">
     <el-form
-      v-if="fields.length"
       ref="modalFormComp"
       :model="modalForm"
       :rules="rules"
-      label-width="140px"
+      label-width="180px"
     >
-      <el-form-item
-        v-for="field in fields"
-        :key="field.code"
-        :prop="field.prop"
-        :label="field.name + ':'"
-      >
-        <template v-if="field.options">
-          <el-radio-group v-model="field.value">
-            <el-radio
-              v-for="item in field.options"
-              :key="item.value"
-              :label="item.value"
-              >{{ item.label }}</el-radio
-            >
-          </el-radio-group>
-        </template>
-        <template v-else>
-          <el-radio-group v-model="field.enable" @change="resetVal(field)">
-            <el-radio
-              v-for="item in OPEN_STATUS"
-              :key="item.value"
-              :label="item.value"
-              >{{ item.label }}</el-radio
-            >
-          </el-radio-group>
-          <br />
-          <el-input
-            v-if="field.enable"
-            v-model.trim="field.value"
-            placeholder="请输入内容"
-            clearable
+      <el-form-item prop="bindSet" label="评卷员自动绑定设置:">
+        <el-radio-group v-model="modalForm.bindSet">
+          <el-radio
+            v-for="item in bindList"
+            :key="item.value"
+            :label="item.value"
           >
-          </el-input>
-        </template>
-      </el-form-item>
-      <el-form-item>
-        <el-button type="primary" :loading="loading" @click="confirm"
-          >保存</el-button
-        >
+            {{ item.name }}
+          </el-radio>
+        </el-radio-group>
       </el-form-item>
     </el-form>
   </div>
@@ -53,7 +23,6 @@
 
 <script>
 import { schoolSetMarkeInfo, schoolSetMarkerUpdate } from "../../api";
-import { OPEN_STATUS } from "../../../../constants/enumerate";
 
 export default {
   name: "school-set-mark",
@@ -68,40 +37,61 @@ export default {
   data() {
     return {
       loading: false,
-      OPEN_STATUS,
-      modalForm: {},
+      bindInfo: [],
+      cachedModalForm: null,
+      modalForm: {
+        bindSet: "",
+      },
+      bindList: [
+        {
+          name: "不绑定",
+          value: "NONE",
+        },
+        {
+          name: "交卷老师及任课老师",
+          value: "SUBJECT_AND_ASSIGN_TEACHER",
+        },
+        {
+          name: "交卷老师",
+          value: "ASSIGN_TEACHER",
+        },
+      ],
       fields: [],
-      rules: {},
+      rules: {
+        bindSet: [
+          {
+            required: true,
+            message: "请选择评卷员自动绑定设置",
+            trigger: "change",
+          },
+        ],
+      },
     };
   },
+  watch: {
+    modalForm: {
+      deep: true,
+      handler() {
+        const isChanged = this.checkConfigChanged();
+        this.$emit("config-changed", isChanged);
+      },
+    },
+  },
   mounted() {
     this.initData();
   },
   methods: {
     async initData() {
       const data = await schoolSetMarkeInfo(this.school.id);
-      this.fields = data.result || [];
-      this.fields.forEach((field) => {
-        field.prop = field.code.split(".").join("_");
-        this.$set(this.modalForm, field.prop, field.value);
-        if (field.options) return;
-
-        this.rules[field.prop] = [
-          {
-            validator: (rule, value, callback) => {
-              if (!field.value && field.enable) {
-                return callback(new Error(`请输入${field.name}`));
-              }
-
-              callback();
-            },
-            trigger: "change",
-          },
-        ];
-      });
+      this.bindInfo = data.result;
+      this.modalForm.bindSet = data.result[0]?.value || "";
+      this.cachedModalForm = JSON.parse(JSON.stringify(this.modalForm));
     },
-    resetVal(field) {
-      if (!field.enable) field.value = "";
+    checkConfigChanged() {
+      if (!this.cachedModalForm) return false;
+      return (
+        JSON.stringify(this.modalForm) !== JSON.stringify(this.cachedModalForm)
+      );
     },
     async confirm() {
       const valid = await this.$refs.modalFormComp.validate().catch(() => {});
@@ -109,12 +99,14 @@ export default {
 
       if (this.loading) return;
       this.loading = true;
-      const datas = { param: this.fields, schoolId: this.school.id };
+      this.bindInfo[0].value = this.modalForm.bindSet;
+      const datas = { param: this.bindInfo, schoolId: this.school.id };
       const res = await schoolSetMarkerUpdate(datas).catch(() => {});
       this.loading = false;
       if (!res) return;
 
-      this.$message.success("修改成功!");
+      this.cachedModalForm = JSON.parse(JSON.stringify(this.modalForm));
+      this.$emit("config-changed", false);
       this.initData();
     },
   },

+ 6 - 1
src/modules/admin/components/school/SchoolSetTarget.vue

@@ -25,6 +25,11 @@
           <i class="el-icon-document mr-1"></i>课程目标达成度模板.doc
         </span>
       </el-form-item>
+      <el-form-item label="综合成绩:">
+        <el-checkbox v-model="modalForm.showTotalScore"
+          >报告不显示综合成绩</el-checkbox
+        >
+      </el-form-item>
     </el-form>
   </div>
 </template>
@@ -51,7 +56,7 @@ export default {
     return {
       loading: false,
       info: {},
-      modalForm: { schoolId: "", attachmentId: "" },
+      modalForm: { schoolId: "", attachmentId: "", showTotalScore: true },
       cachedModalForm: null,
       rules: {
         attachmentId: [