zhangjie 2 жил өмнө
parent
commit
bf701af843
26 өөрчлөгдсөн 6056 нэмэгдсэн , 6108 устгасан
  1. 0 3
      src/constants/enumerate.js
  2. 262 262
      src/modules/base/components/ModifyCardInfo.vue
  3. 384 384
      src/modules/base/components/ModifyCardRule.vue
  4. 178 178
      src/modules/base/components/ModifyCourse.vue
  5. 253 253
      src/modules/base/components/ModifyExamConfig.vue
  6. 137 137
      src/modules/base/components/ModifyMajor.vue
  7. 148 154
      src/modules/base/components/ModifyOrganization.vue
  8. 247 247
      src/modules/base/components/ModifyStudent.vue
  9. 268 268
      src/modules/base/components/ModifyTemplate.vue
  10. 293 293
      src/modules/base/components/ModifyUser.vue
  11. 158 158
      src/modules/base/components/SelectClassStudent.vue
  12. 219 219
      src/modules/base/views/ApproveRecordManage.vue
  13. 268 268
      src/modules/base/views/CardManage.vue
  14. 292 292
      src/modules/base/views/CardRuleManage.vue
  15. 303 303
      src/modules/base/views/CourseManage.vue
  16. 186 186
      src/modules/base/views/MajorManage.vue
  17. 146 189
      src/modules/base/views/OrganizationManage.vue
  18. 252 252
      src/modules/base/views/StudentManage.vue
  19. 302 302
      src/modules/base/views/TemplateManage.vue
  20. 1 1
      src/modules/exam/api.js
  21. 743 743
      src/modules/exam/components/CreateTaskApply.vue
  22. 286 286
      src/modules/exam/components/ModifyTaskApply.vue
  23. 346 346
      src/modules/exam/components/PaperApproveTable.vue
  24. 2 2
      src/modules/exam/components/createExamAndPrintTask/InfoExamTask.vue
  25. 209 209
      src/modules/exam/views/DownloadManage.vue
  26. 173 173
      src/modules/stmms/components/markParam/paramData.js

+ 0 - 3
src/constants/enumerate.js

@@ -42,9 +42,6 @@ export const PRIVILEGE_TYPE = {
 // 基础 -------------->
 // 机构
 export const ORG_TYPE = {
-  COLLEGE: "学院",
-  FACULTY: "院系",
-  TEACHING_ROOM: "教研室",
   PRINTING_HOUSE: "印刷室"
 };
 // 角色

+ 262 - 262
src/modules/base/components/ModifyCardInfo.vue

@@ -1,262 +1,262 @@
-<template>
-  <el-dialog
-    class="modify-card-info"
-    :visible.sync="modalIsShow"
-    :title="title"
-    top="10px"
-    width="600px"
-    :close-on-click-modal="false"
-    :close-on-press-escape="false"
-    append-to-body
-    @open="visibleChange"
-  >
-    <el-form
-      ref="modalFormComp"
-      label-position="top"
-      :rules="rules"
-      :model="modalForm"
-    >
-      <el-form-item prop="title" label="题卡名称:">
-        <el-input
-          v-model.trim="modalForm.title"
-          placeholder="建议不超过30个字,题卡名称不允许重复"
-          clearable
-        ></el-input>
-      </el-form-item>
-      <el-form-item prop="remark" label="备注:">
-        <el-input
-          v-model="modalForm.remark"
-          type="textarea"
-          resize="none"
-          :rows="2"
-          :maxlength="50"
-          clearable
-          show-word-limit
-          placeholder="建议不超过50个字"
-        ></el-input>
-      </el-form-item>
-      <el-form-item prop="createMethod" label="题卡创建方式:">
-        <el-radio-group v-model="modalForm.createMethod" :disabled="isEdit">
-          <el-radio-button
-            v-for="(val, key) in CARD_CREATE_METHOD_TYPE"
-            :key="key"
-            :label="key"
-            >{{ val }}</el-radio-button
-          >
-        </el-radio-group>
-      </el-form-item>
-      <el-form-item v-if="IS_UPLOAD" prop="attachmentId" label="上传模板文件:">
-        <upload-file-view
-          :upload-data="uploadData"
-          :upload-url="uploadUrl"
-          :format="format"
-          @valid-error="validError"
-          @upload-success="uploadSuccess"
-          ref="UploadFileView"
-        ></upload-file-view>
-      </el-form-item>
-      <el-form-item v-if="IS_STANDARD" prop="cardRuleId" label="题卡规则:">
-        <card-rule-select
-          ref="CardRuleSelect"
-          v-model.trim="modalForm.cardRuleId"
-          placeholder="请选择题卡规则"
-          clearable
-          class="width-full"
-          :disabled="isEdit"
-          :show-common-card="false"
-        ></card-rule-select>
-      </el-form-item>
-      <el-form-item prop="orgIds" label="适用学院范围:">
-        <select-orgs v-model="modalForm.orgIds" ref="SelectOrgs"></select-orgs>
-      </el-form-item>
-    </el-form>
-
-    <div slot="footer">
-      <el-button type="primary" :disabled="isSubmit" @click="submit"
-        >确认</el-button
-      >
-      <el-button @click="cancel">取消</el-button>
-    </div>
-  </el-dialog>
-</template>
-
-<script>
-import { updateCard } from "../api";
-import { attachmentDetail } from "../../login/api";
-import { CARD_CREATE_METHOD_TYPE } from "../../../constants/enumerate";
-import UploadFileView from "@/components/UploadFileView";
-import SelectOrgs from "./SelectOrgs";
-
-const initModalForm = {
-  id: null,
-  title: "",
-  type: "GENERIC",
-  createMethod: "UPLOAD",
-  remark: "",
-  cardRuleId: "",
-  attachmentId: "",
-  status: "STAGE",
-  orgIds: []
-};
-
-export default {
-  name: "modify-card-info",
-  components: { UploadFileView, SelectOrgs },
-  props: {
-    instance: {
-      type: Object,
-      default() {
-        return {};
-      }
-    }
-  },
-  computed: {
-    isEdit() {
-      return !!this.modalForm.id;
-    },
-    title() {
-      return (this.isEdit ? "编辑" : "新增") + "题卡";
-    },
-    IS_GENGRIC() {
-      return this.modalForm.type === "GENERIC";
-    },
-    IS_UPLOAD() {
-      return this.modalForm.createMethod === "UPLOAD";
-    },
-    IS_STANDARD() {
-      return this.modalForm.createMethod === "STANDARD";
-    },
-    IS_FREE() {
-      return this.modalForm.createMethod === "FREE";
-    }
-  },
-  data() {
-    return {
-      modalIsShow: false,
-      isSubmit: false,
-      modalForm: {},
-      attachment: {},
-      format: ["html"],
-      CARD_CREATE_METHOD_TYPE,
-      rules: {
-        title: [
-          {
-            required: true,
-            message: "题卡名称不能超过30个字",
-            max: 30,
-            trigger: "change"
-          }
-        ],
-        createMethod: [
-          {
-            required: true,
-            message: "请选择题卡创建方式",
-            trigger: "change"
-          }
-        ],
-        attachmentId: [
-          {
-            required: true,
-            message: "请上传模板文件",
-            trigger: "change"
-          }
-        ],
-        cardRuleId: [
-          {
-            required: true,
-            message: "请选择题卡规则",
-            trigger: "change"
-          }
-        ],
-        orgIds: [
-          {
-            required: true,
-            validator: (rule, value, callback) => {
-              if (value.length) {
-                callback();
-              } else {
-                callback(new Error("请选择适用学院"));
-              }
-            },
-            trigger: "change"
-          }
-        ]
-      },
-      // upload
-      uploadUrl: "/api/admin/common/file/upload",
-      uploadData: {
-        type: "UPLOAD"
-      }
-    };
-  },
-  methods: {
-    initData(val) {
-      this.modalForm = this.$objAssign(initModalForm, val);
-      if (val.id) {
-        this.modalForm.orgIds = val.orgs.map(item => item.id);
-        if (this.modalForm.createMethod !== "UPLOAD") return;
-        this.getAttachment();
-      } else {
-        this.modalForm.orgIds = [];
-        if (this.modalForm.createMethod !== "UPLOAD") return;
-        this.$nextTick(() => {
-          this.$refs.UploadFileView.setAttachmentName("");
-        });
-      }
-    },
-    async getAttachment() {
-      const data = await attachmentDetail(this.instance.attachmentId);
-      this.attachment = data;
-
-      this.$nextTick(() => {
-        this.$refs.UploadFileView.setAttachmentName(`${data.name}${data.type}`);
-      });
-    },
-    visibleChange() {
-      this.initData(this.instance);
-
-      this.$nextTick(() => {
-        this.$refs.modalFormComp.clearValidate();
-      });
-    },
-    cancel() {
-      this.modalIsShow = false;
-    },
-    open() {
-      this.modalIsShow = true;
-    },
-    async submit() {
-      const valid = await this.$refs.modalFormComp.validate().catch(() => {});
-      if (!valid) return;
-
-      if (!this.IS_UPLOAD && !this.isEdit) {
-        this.$emit("new-card", this.modalForm);
-        this.cancel();
-        return;
-      }
-
-      if (this.isSubmit) return;
-      this.isSubmit = true;
-      let datas = {
-        ...this.modalForm
-      };
-      const data = await updateCard(datas).catch(() => {});
-      this.isSubmit = false;
-      if (!data) return;
-
-      this.$message.success("保存成功!");
-      this.$emit("modified");
-      this.cancel();
-    },
-    validError(errorData) {
-      this.$message.error(errorData.message);
-    },
-    uploadSuccess(data) {
-      this.$message.success("上传成功!");
-
-      this.modalForm.attachmentId = data.id;
-      this.$refs.modalFormComp.validateField("attachmentId");
-    }
-  }
-};
-</script>
+<template>
+  <el-dialog
+    class="modify-card-info"
+    :visible.sync="modalIsShow"
+    :title="title"
+    top="10px"
+    width="600px"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    @open="visibleChange"
+  >
+    <el-form
+      ref="modalFormComp"
+      label-position="top"
+      :rules="rules"
+      :model="modalForm"
+    >
+      <el-form-item prop="title" label="题卡名称:">
+        <el-input
+          v-model.trim="modalForm.title"
+          placeholder="建议不超过30个字,题卡名称不允许重复"
+          clearable
+        ></el-input>
+      </el-form-item>
+      <el-form-item prop="remark" label="备注:">
+        <el-input
+          v-model="modalForm.remark"
+          type="textarea"
+          resize="none"
+          :rows="2"
+          :maxlength="50"
+          clearable
+          show-word-limit
+          placeholder="建议不超过50个字"
+        ></el-input>
+      </el-form-item>
+      <el-form-item prop="createMethod" label="题卡创建方式:">
+        <el-radio-group v-model="modalForm.createMethod" :disabled="isEdit">
+          <el-radio-button
+            v-for="(val, key) in CARD_CREATE_METHOD_TYPE"
+            :key="key"
+            :label="key"
+            >{{ val }}</el-radio-button
+          >
+        </el-radio-group>
+      </el-form-item>
+      <el-form-item v-if="IS_UPLOAD" prop="attachmentId" label="上传模板文件:">
+        <upload-file-view
+          :upload-data="uploadData"
+          :upload-url="uploadUrl"
+          :format="format"
+          @valid-error="validError"
+          @upload-success="uploadSuccess"
+          ref="UploadFileView"
+        ></upload-file-view>
+      </el-form-item>
+      <el-form-item v-if="IS_STANDARD" prop="cardRuleId" label="题卡规则:">
+        <card-rule-select
+          ref="CardRuleSelect"
+          v-model.trim="modalForm.cardRuleId"
+          placeholder="请选择题卡规则"
+          clearable
+          class="width-full"
+          :disabled="isEdit"
+          :show-common-card="false"
+        ></card-rule-select>
+      </el-form-item>
+      <el-form-item prop="orgIds" label="适用机构范围:">
+        <select-orgs v-model="modalForm.orgIds" ref="SelectOrgs"></select-orgs>
+      </el-form-item>
+    </el-form>
+
+    <div slot="footer">
+      <el-button type="primary" :disabled="isSubmit" @click="submit"
+        >确认</el-button
+      >
+      <el-button @click="cancel">取消</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+import { updateCard } from "../api";
+import { attachmentDetail } from "../../login/api";
+import { CARD_CREATE_METHOD_TYPE } from "../../../constants/enumerate";
+import UploadFileView from "@/components/UploadFileView";
+import SelectOrgs from "./SelectOrgs";
+
+const initModalForm = {
+  id: null,
+  title: "",
+  type: "GENERIC",
+  createMethod: "UPLOAD",
+  remark: "",
+  cardRuleId: "",
+  attachmentId: "",
+  status: "STAGE",
+  orgIds: []
+};
+
+export default {
+  name: "modify-card-info",
+  components: { UploadFileView, SelectOrgs },
+  props: {
+    instance: {
+      type: Object,
+      default() {
+        return {};
+      }
+    }
+  },
+  computed: {
+    isEdit() {
+      return !!this.modalForm.id;
+    },
+    title() {
+      return (this.isEdit ? "编辑" : "新增") + "题卡";
+    },
+    IS_GENGRIC() {
+      return this.modalForm.type === "GENERIC";
+    },
+    IS_UPLOAD() {
+      return this.modalForm.createMethod === "UPLOAD";
+    },
+    IS_STANDARD() {
+      return this.modalForm.createMethod === "STANDARD";
+    },
+    IS_FREE() {
+      return this.modalForm.createMethod === "FREE";
+    }
+  },
+  data() {
+    return {
+      modalIsShow: false,
+      isSubmit: false,
+      modalForm: {},
+      attachment: {},
+      format: ["html"],
+      CARD_CREATE_METHOD_TYPE,
+      rules: {
+        title: [
+          {
+            required: true,
+            message: "题卡名称不能超过30个字",
+            max: 30,
+            trigger: "change"
+          }
+        ],
+        createMethod: [
+          {
+            required: true,
+            message: "请选择题卡创建方式",
+            trigger: "change"
+          }
+        ],
+        attachmentId: [
+          {
+            required: true,
+            message: "请上传模板文件",
+            trigger: "change"
+          }
+        ],
+        cardRuleId: [
+          {
+            required: true,
+            message: "请选择题卡规则",
+            trigger: "change"
+          }
+        ],
+        orgIds: [
+          {
+            required: true,
+            validator: (rule, value, callback) => {
+              if (value.length) {
+                callback();
+              } else {
+                callback(new Error("请选择适用机构"));
+              }
+            },
+            trigger: "change"
+          }
+        ]
+      },
+      // upload
+      uploadUrl: "/api/admin/common/file/upload",
+      uploadData: {
+        type: "UPLOAD"
+      }
+    };
+  },
+  methods: {
+    initData(val) {
+      this.modalForm = this.$objAssign(initModalForm, val);
+      if (val.id) {
+        this.modalForm.orgIds = val.orgs.map(item => item.id);
+        if (this.modalForm.createMethod !== "UPLOAD") return;
+        this.getAttachment();
+      } else {
+        this.modalForm.orgIds = [];
+        if (this.modalForm.createMethod !== "UPLOAD") return;
+        this.$nextTick(() => {
+          this.$refs.UploadFileView.setAttachmentName("");
+        });
+      }
+    },
+    async getAttachment() {
+      const data = await attachmentDetail(this.instance.attachmentId);
+      this.attachment = data;
+
+      this.$nextTick(() => {
+        this.$refs.UploadFileView.setAttachmentName(`${data.name}${data.type}`);
+      });
+    },
+    visibleChange() {
+      this.initData(this.instance);
+
+      this.$nextTick(() => {
+        this.$refs.modalFormComp.clearValidate();
+      });
+    },
+    cancel() {
+      this.modalIsShow = false;
+    },
+    open() {
+      this.modalIsShow = true;
+    },
+    async submit() {
+      const valid = await this.$refs.modalFormComp.validate().catch(() => {});
+      if (!valid) return;
+
+      if (!this.IS_UPLOAD && !this.isEdit) {
+        this.$emit("new-card", this.modalForm);
+        this.cancel();
+        return;
+      }
+
+      if (this.isSubmit) return;
+      this.isSubmit = true;
+      let datas = {
+        ...this.modalForm
+      };
+      const data = await updateCard(datas).catch(() => {});
+      this.isSubmit = false;
+      if (!data) return;
+
+      this.$message.success("保存成功!");
+      this.$emit("modified");
+      this.cancel();
+    },
+    validError(errorData) {
+      this.$message.error(errorData.message);
+    },
+    uploadSuccess(data) {
+      this.$message.success("上传成功!");
+
+      this.modalForm.attachmentId = data.id;
+      this.$refs.modalFormComp.validateField("attachmentId");
+    }
+  }
+};
+</script>

+ 384 - 384
src/modules/base/components/ModifyCardRule.vue

@@ -1,384 +1,384 @@
-<template>
-  <el-dialog
-    class="modify-card-rule"
-    :visible.sync="modalIsShow"
-    :title="title"
-    top="10px"
-    width="950px"
-    :close-on-click-modal="false"
-    :close-on-press-escape="false"
-    append-to-body
-    @open="visibleChange"
-  >
-    <el-form
-      ref="modalFormComp"
-      label-width="130px"
-      :rules="rules"
-      :model="modalForm"
-    >
-      <el-form-item prop="name" label="题卡规则名称:">
-        <el-input
-          v-model.trim="modalForm.name"
-          placeholder="建议不超过30个字,规则名称不允许重复"
-          style="width: 100%"
-          clearable
-          :disabled="!editable"
-        ></el-input>
-      </el-form-item>
-      <el-form-item prop="remark" label="备注:">
-        <el-input
-          v-model="modalForm.remark"
-          type="textarea"
-          resize="none"
-          :rows="2"
-          :maxlength="50"
-          :disabled="!editable"
-          clearable
-          show-word-limit
-          placeholder="建议不超过50个字"
-        ></el-input>
-      </el-form-item>
-      <el-form-item
-        prop="examNumberStyle"
-        label="考号版式:"
-        class="inline-block"
-      >
-        <el-select
-          v-model="modalForm.examNumberStyle"
-          style="width: 142px;"
-          @change="numStyleChange"
-          placeholder="请选择"
-          :disabled="!editable"
-        >
-          <el-option
-            v-for="(val, key) in EXAM_NUMBER_STYLE"
-            :key="key"
-            :value="key"
-            :label="val"
-          ></el-option>
-        </el-select>
-      </el-form-item>
-      <el-form-item prop="paperType" label="AB卷版式:" class="inline-block">
-        <el-select
-          v-model="modalForm.paperType"
-          style="width: 142px;"
-          placeholder="请选择"
-          :disabled="!editable"
-        >
-          <el-option
-            v-for="(val, key) in PAPER_TYPE"
-            :key="key"
-            :value="key"
-            :label="val"
-          ></el-option>
-        </el-select>
-      </el-form-item>
-      <el-form-item>
-        <el-checkbox v-model="modalForm.examAbsent" :disabled="!editable"
-          >启用“缺考填涂”</el-checkbox
-        >
-        <el-checkbox v-model="modalForm.discipline" :disabled="!editable"
-          >启用“违纪填涂”</el-checkbox
-        >
-        <el-checkbox
-          v-model="modalForm.writeSign"
-          :disabled="modalForm.examNumberStyle === 'FILL' || !editable"
-          >启用“手写签名”</el-checkbox
-        >
-      </el-form-item>
-      <div class="part-box part-box-pad part-box-border">
-        <h4 class="part-box-tips">题卡版头变量印刷字段配置:</h4>
-        <el-form-item label="必选字段:" label-width="115px" required>
-          <el-checkbox
-            v-for="column in modalForm.requiredFields"
-            :key="column.code"
-            v-model="column.enable"
-            disabled
-            >{{ column.name }}</el-checkbox
-          >
-        </el-form-item>
-        <el-form-item label="扩展字段:" label-width="115px">
-          <el-checkbox
-            v-for="column in modalForm.extendFields"
-            :key="column.code"
-            v-model="column.enable"
-            :disabled="!editable"
-            >{{ column.name }}</el-checkbox
-          >
-        </el-form-item>
-      </div>
-      <el-form-item prop="titleRule" label="题卡标题规则:">
-        <!-- <el-input
-            v-model="modalForm.titleRule"
-            :disabled="!editable"
-          ></el-input> -->
-        <card-title-rule-edit
-          v-model="modalForm.titleRule"
-          :disabled="!editable"
-          :field-sourses="fieldSourses"
-          v-if="fieldSourses.length"
-          ref="CardTitleRuleEdit"
-        ></card-title-rule-edit>
-      </el-form-item>
-      <el-form-item prop="attention" label="注意事项:">
-        <el-input
-          type="textarea"
-          :rows="4"
-          v-model="modalForm.attention"
-          :disabled="!editable"
-        ></el-input>
-        <p class="tips-info">
-          提示:换行之后,题卡注意事项会展示为多条内容,内容序号会被自动添加。
-        </p>
-      </el-form-item>
-      <el-form-item prop="objectiveAttention" label="客观题注意事项:">
-        <el-input
-          v-model="modalForm.objectiveAttention"
-          :disabled="!editable"
-        ></el-input>
-      </el-form-item>
-      <el-form-item prop="subjectiveAttention" label="主观题注意事项:">
-        <el-input
-          v-model="modalForm.subjectiveAttention"
-          :disabled="!editable"
-        ></el-input>
-      </el-form-item>
-      <el-form-item prop="orgIds" label="适用学院范围:">
-        <select-orgs
-          v-model="modalForm.orgIds"
-          ref="SelectOrgs"
-          :disabled="!editable"
-        ></select-orgs>
-      </el-form-item>
-    </el-form>
-
-    <div slot="footer">
-      <el-button
-        v-if="editable"
-        type="primary"
-        :disabled="isSubmit"
-        @click="submit"
-        >确认</el-button
-      >
-      <el-button @click="cancel">取消</el-button>
-    </div>
-  </el-dialog>
-</template>
-
-<script>
-import { EXAM_NUMBER_STYLE, PAPER_TYPE } from "@/constants/enumerate";
-import { saveCardRule } from "../api";
-import SelectOrgs from "./SelectOrgs";
-import CardTitleRuleEdit from "./CardTitleRuleEdit";
-
-const initModalForm = {
-  id: null,
-  name: "",
-  remark: "",
-  examNumberStyle: "",
-  paperType: "PRINT",
-  examAbsent: true,
-  discipline: true,
-  writeSign: true,
-  requiredFields: [],
-  extendFields: [],
-  titleRule: "",
-  attention: "",
-  objectiveAttention: "",
-  subjectiveAttention: "",
-  orgIds: []
-};
-
-export default {
-  name: "modify-card-rule",
-  components: { SelectOrgs, CardTitleRuleEdit },
-  props: {
-    instance: {
-      type: Object,
-      default() {
-        return {};
-      }
-    },
-    editType: {
-      type: String,
-      default: "ADD",
-      validator: val => ["ADD", "PREVIEW", "EDIT"].includes(val)
-    }
-  },
-  computed: {
-    title() {
-      const names = {
-        ADD: "新增题卡规则",
-        PREVIEW: "题卡规则详情",
-        EDIT: "编辑题卡规则"
-      };
-      return names[this.editType];
-    },
-    editable() {
-      return this.editType !== "PREVIEW";
-    }
-    // fieldSourses() {
-    //   return [
-    //     ...this.modalForm.requiredFields,
-    //     ...this.modalForm.extendFields
-    //   ].filter(item => item.enable);
-    // }
-  },
-  data() {
-    return {
-      modalIsShow: false,
-      isSubmit: false,
-      modalForm: { ...initModalForm },
-      EXAM_NUMBER_STYLE,
-      PAPER_TYPE,
-      dataReady: false,
-      rules: {
-        name: [
-          {
-            required: true,
-            message: "题卡规则名称不能超过30个字",
-            max: 30,
-            trigger: "change"
-          }
-        ],
-        examNumberStyle: [
-          {
-            required: true,
-            message: "请选择考号版式",
-            trigger: "change"
-          }
-        ],
-        paperType: [
-          {
-            required: true,
-            message: "请选择AB卷版式",
-            trigger: "change"
-          }
-        ],
-        titleRule: [
-          {
-            required: true,
-            message: "请输入题卡标题规则",
-            trigger: "change"
-          }
-        ],
-        attention: [
-          {
-            required: true,
-            message: "请输入注意事项",
-            trigger: "change"
-          },
-          {
-            validator: (rule, value, callback) => {
-              const val = value.replace(/\n/g, "");
-              if (val.length > 200) {
-                callback(new Error("注意事项最多只能输入200个字符"));
-              } else {
-                callback();
-              }
-            },
-            trigger: "change"
-          }
-        ],
-        objectiveAttention: [
-          {
-            required: true,
-            message: "请输入客观题注意事项",
-            trigger: "change"
-          },
-          {
-            max: 26,
-            message: "客观题注意事项最多只能输入26个汉字",
-            trigger: "change"
-          }
-        ],
-        subjectiveAttention: [
-          {
-            required: true,
-            message: "请输入主观题注意事项",
-            trigger: "change"
-          },
-          {
-            max: 26,
-            message: "主观题注意事项最多只能输入26个汉字",
-            trigger: "change"
-          }
-        ],
-        orgIds: [
-          {
-            required: true,
-            validator: (rule, value, callback) => {
-              if (value.length) {
-                callback();
-              } else {
-                callback(new Error("请选择适用学院"));
-              }
-            },
-            trigger: "change"
-          }
-        ]
-      },
-      fieldSourses: [
-        {
-          code: "courseName",
-          enable: true,
-          name: "课程名称"
-        },
-        {
-          code: "schoolName",
-          enable: true,
-          name: "学校名称"
-        }
-      ]
-    };
-  },
-  methods: {
-    initData(val) {
-      this.modalForm = this.$objAssign(initModalForm, val);
-
-      if (val.id) {
-        this.modalForm.requiredFields = JSON.parse(val.requiredFields);
-        this.modalForm.extendFields = JSON.parse(val.extendFields);
-        this.modalForm.orgIds = val.orgs.map(item => item.id);
-      } else {
-        this.modalForm.orgIds = [];
-      }
-    },
-    visibleChange() {
-      this.initData(this.instance);
-
-      this.$nextTick(() => {
-        this.$refs.modalFormComp.clearValidate();
-      });
-    },
-    cancel() {
-      this.modalIsShow = false;
-    },
-    open() {
-      this.modalIsShow = true;
-    },
-    numStyleChange() {
-      this.modalForm.writeSign = this.modalForm.examNumberStyle !== "FILL";
-    },
-    async submit() {
-      const valid = await this.$refs.modalFormComp.validate().catch(() => {});
-      if (!valid) return;
-
-      if (this.isSubmit) return;
-      this.isSubmit = true;
-      let modals = {
-        ...this.modalForm
-      };
-      modals.requiredFields = JSON.stringify(modals.requiredFields);
-      modals.extendFields = JSON.stringify(modals.extendFields);
-      const data = await saveCardRule(modals).catch(() => {});
-      this.isSubmit = false;
-      if (!data) return;
-
-      this.$message.success("保存成功!");
-      this.$emit("modified");
-      this.cancel();
-    }
-  }
-};
-</script>
+<template>
+  <el-dialog
+    class="modify-card-rule"
+    :visible.sync="modalIsShow"
+    :title="title"
+    top="10px"
+    width="950px"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    @open="visibleChange"
+  >
+    <el-form
+      ref="modalFormComp"
+      label-width="130px"
+      :rules="rules"
+      :model="modalForm"
+    >
+      <el-form-item prop="name" label="题卡规则名称:">
+        <el-input
+          v-model.trim="modalForm.name"
+          placeholder="建议不超过30个字,规则名称不允许重复"
+          style="width: 100%"
+          clearable
+          :disabled="!editable"
+        ></el-input>
+      </el-form-item>
+      <el-form-item prop="remark" label="备注:">
+        <el-input
+          v-model="modalForm.remark"
+          type="textarea"
+          resize="none"
+          :rows="2"
+          :maxlength="50"
+          :disabled="!editable"
+          clearable
+          show-word-limit
+          placeholder="建议不超过50个字"
+        ></el-input>
+      </el-form-item>
+      <el-form-item
+        prop="examNumberStyle"
+        label="考号版式:"
+        class="inline-block"
+      >
+        <el-select
+          v-model="modalForm.examNumberStyle"
+          style="width: 142px;"
+          @change="numStyleChange"
+          placeholder="请选择"
+          :disabled="!editable"
+        >
+          <el-option
+            v-for="(val, key) in EXAM_NUMBER_STYLE"
+            :key="key"
+            :value="key"
+            :label="val"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item prop="paperType" label="AB卷版式:" class="inline-block">
+        <el-select
+          v-model="modalForm.paperType"
+          style="width: 142px;"
+          placeholder="请选择"
+          :disabled="!editable"
+        >
+          <el-option
+            v-for="(val, key) in PAPER_TYPE"
+            :key="key"
+            :value="key"
+            :label="val"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-checkbox v-model="modalForm.examAbsent" :disabled="!editable"
+          >启用“缺考填涂”</el-checkbox
+        >
+        <el-checkbox v-model="modalForm.discipline" :disabled="!editable"
+          >启用“违纪填涂”</el-checkbox
+        >
+        <el-checkbox
+          v-model="modalForm.writeSign"
+          :disabled="modalForm.examNumberStyle === 'FILL' || !editable"
+          >启用“手写签名”</el-checkbox
+        >
+      </el-form-item>
+      <div class="part-box part-box-pad part-box-border">
+        <h4 class="part-box-tips">题卡版头变量印刷字段配置:</h4>
+        <el-form-item label="必选字段:" label-width="115px" required>
+          <el-checkbox
+            v-for="column in modalForm.requiredFields"
+            :key="column.code"
+            v-model="column.enable"
+            disabled
+            >{{ column.name }}</el-checkbox
+          >
+        </el-form-item>
+        <el-form-item label="扩展字段:" label-width="115px">
+          <el-checkbox
+            v-for="column in modalForm.extendFields"
+            :key="column.code"
+            v-model="column.enable"
+            :disabled="!editable"
+            >{{ column.name }}</el-checkbox
+          >
+        </el-form-item>
+      </div>
+      <el-form-item prop="titleRule" label="题卡标题规则:">
+        <!-- <el-input
+            v-model="modalForm.titleRule"
+            :disabled="!editable"
+          ></el-input> -->
+        <card-title-rule-edit
+          v-model="modalForm.titleRule"
+          :disabled="!editable"
+          :field-sourses="fieldSourses"
+          v-if="fieldSourses.length"
+          ref="CardTitleRuleEdit"
+        ></card-title-rule-edit>
+      </el-form-item>
+      <el-form-item prop="attention" label="注意事项:">
+        <el-input
+          type="textarea"
+          :rows="4"
+          v-model="modalForm.attention"
+          :disabled="!editable"
+        ></el-input>
+        <p class="tips-info">
+          提示:换行之后,题卡注意事项会展示为多条内容,内容序号会被自动添加。
+        </p>
+      </el-form-item>
+      <el-form-item prop="objectiveAttention" label="客观题注意事项:">
+        <el-input
+          v-model="modalForm.objectiveAttention"
+          :disabled="!editable"
+        ></el-input>
+      </el-form-item>
+      <el-form-item prop="subjectiveAttention" label="主观题注意事项:">
+        <el-input
+          v-model="modalForm.subjectiveAttention"
+          :disabled="!editable"
+        ></el-input>
+      </el-form-item>
+      <el-form-item prop="orgIds" label="适用机构范围:">
+        <select-orgs
+          v-model="modalForm.orgIds"
+          ref="SelectOrgs"
+          :disabled="!editable"
+        ></select-orgs>
+      </el-form-item>
+    </el-form>
+
+    <div slot="footer">
+      <el-button
+        v-if="editable"
+        type="primary"
+        :disabled="isSubmit"
+        @click="submit"
+        >确认</el-button
+      >
+      <el-button @click="cancel">取消</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+import { EXAM_NUMBER_STYLE, PAPER_TYPE } from "@/constants/enumerate";
+import { saveCardRule } from "../api";
+import SelectOrgs from "./SelectOrgs";
+import CardTitleRuleEdit from "./CardTitleRuleEdit";
+
+const initModalForm = {
+  id: null,
+  name: "",
+  remark: "",
+  examNumberStyle: "",
+  paperType: "PRINT",
+  examAbsent: true,
+  discipline: true,
+  writeSign: true,
+  requiredFields: [],
+  extendFields: [],
+  titleRule: "",
+  attention: "",
+  objectiveAttention: "",
+  subjectiveAttention: "",
+  orgIds: []
+};
+
+export default {
+  name: "modify-card-rule",
+  components: { SelectOrgs, CardTitleRuleEdit },
+  props: {
+    instance: {
+      type: Object,
+      default() {
+        return {};
+      }
+    },
+    editType: {
+      type: String,
+      default: "ADD",
+      validator: val => ["ADD", "PREVIEW", "EDIT"].includes(val)
+    }
+  },
+  computed: {
+    title() {
+      const names = {
+        ADD: "新增题卡规则",
+        PREVIEW: "题卡规则详情",
+        EDIT: "编辑题卡规则"
+      };
+      return names[this.editType];
+    },
+    editable() {
+      return this.editType !== "PREVIEW";
+    }
+    // fieldSourses() {
+    //   return [
+    //     ...this.modalForm.requiredFields,
+    //     ...this.modalForm.extendFields
+    //   ].filter(item => item.enable);
+    // }
+  },
+  data() {
+    return {
+      modalIsShow: false,
+      isSubmit: false,
+      modalForm: { ...initModalForm },
+      EXAM_NUMBER_STYLE,
+      PAPER_TYPE,
+      dataReady: false,
+      rules: {
+        name: [
+          {
+            required: true,
+            message: "题卡规则名称不能超过30个字",
+            max: 30,
+            trigger: "change"
+          }
+        ],
+        examNumberStyle: [
+          {
+            required: true,
+            message: "请选择考号版式",
+            trigger: "change"
+          }
+        ],
+        paperType: [
+          {
+            required: true,
+            message: "请选择AB卷版式",
+            trigger: "change"
+          }
+        ],
+        titleRule: [
+          {
+            required: true,
+            message: "请输入题卡标题规则",
+            trigger: "change"
+          }
+        ],
+        attention: [
+          {
+            required: true,
+            message: "请输入注意事项",
+            trigger: "change"
+          },
+          {
+            validator: (rule, value, callback) => {
+              const val = value.replace(/\n/g, "");
+              if (val.length > 200) {
+                callback(new Error("注意事项最多只能输入200个字符"));
+              } else {
+                callback();
+              }
+            },
+            trigger: "change"
+          }
+        ],
+        objectiveAttention: [
+          {
+            required: true,
+            message: "请输入客观题注意事项",
+            trigger: "change"
+          },
+          {
+            max: 26,
+            message: "客观题注意事项最多只能输入26个汉字",
+            trigger: "change"
+          }
+        ],
+        subjectiveAttention: [
+          {
+            required: true,
+            message: "请输入主观题注意事项",
+            trigger: "change"
+          },
+          {
+            max: 26,
+            message: "主观题注意事项最多只能输入26个汉字",
+            trigger: "change"
+          }
+        ],
+        orgIds: [
+          {
+            required: true,
+            validator: (rule, value, callback) => {
+              if (value.length) {
+                callback();
+              } else {
+                callback(new Error("请选择适用机构"));
+              }
+            },
+            trigger: "change"
+          }
+        ]
+      },
+      fieldSourses: [
+        {
+          code: "courseName",
+          enable: true,
+          name: "课程名称"
+        },
+        {
+          code: "schoolName",
+          enable: true,
+          name: "学校名称"
+        }
+      ]
+    };
+  },
+  methods: {
+    initData(val) {
+      this.modalForm = this.$objAssign(initModalForm, val);
+
+      if (val.id) {
+        this.modalForm.requiredFields = JSON.parse(val.requiredFields);
+        this.modalForm.extendFields = JSON.parse(val.extendFields);
+        this.modalForm.orgIds = val.orgs.map(item => item.id);
+      } else {
+        this.modalForm.orgIds = [];
+      }
+    },
+    visibleChange() {
+      this.initData(this.instance);
+
+      this.$nextTick(() => {
+        this.$refs.modalFormComp.clearValidate();
+      });
+    },
+    cancel() {
+      this.modalIsShow = false;
+    },
+    open() {
+      this.modalIsShow = true;
+    },
+    numStyleChange() {
+      this.modalForm.writeSign = this.modalForm.examNumberStyle !== "FILL";
+    },
+    async submit() {
+      const valid = await this.$refs.modalFormComp.validate().catch(() => {});
+      if (!valid) return;
+
+      if (this.isSubmit) return;
+      this.isSubmit = true;
+      let modals = {
+        ...this.modalForm
+      };
+      modals.requiredFields = JSON.stringify(modals.requiredFields);
+      modals.extendFields = JSON.stringify(modals.extendFields);
+      const data = await saveCardRule(modals).catch(() => {});
+      this.isSubmit = false;
+      if (!data) return;
+
+      this.$message.success("保存成功!");
+      this.$emit("modified");
+      this.cancel();
+    }
+  }
+};
+</script>

+ 178 - 178
src/modules/base/components/ModifyCourse.vue

@@ -1,178 +1,178 @@
-<template>
-  <el-dialog
-    class="modify-course"
-    :visible.sync="modalIsShow"
-    :title="title"
-    top="10vh"
-    width="550px"
-    :close-on-click-modal="false"
-    :close-on-press-escape="false"
-    append-to-body
-    @open="visibleChange"
-  >
-    <el-form
-      ref="modalFormComp"
-      :model="modalForm"
-      :rules="rules"
-      :key="modalForm.id"
-      label-position="top"
-    >
-      <el-form-item prop="courseName" label="课程名称:">
-        <el-input
-          v-model.trim="modalForm.courseName"
-          placeholder="请输入课程名称"
-          clearable
-        ></el-input>
-      </el-form-item>
-      <el-form-item prop="courseCode" label="课程编码:">
-        <el-input
-          v-model.trim="modalForm.courseCode"
-          placeholder="请输入课程编码"
-          clearable
-        ></el-input>
-      </el-form-item>
-      <el-form-item prop="teachingRoomId" label="所属教研室:">
-        <teaching-room-select
-          v-model.trim="modalForm.teachingRoomId"
-          style="width:100%;"
-          clearable
-        ></teaching-room-select>
-      </el-form-item>
-      <el-form-item label="授课班级:">
-        <clazz-select
-          v-model="modalForm.clazzIdSet"
-          placeholder="请选择授课班级"
-          multiple
-          clearable
-          style="width:100%;"
-        ></clazz-select>
-      </el-form-item>
-    </el-form>
-    <div slot="footer">
-      <el-button type="primary" :disabled="isSubmit" @click="submit"
-        >确认</el-button
-      >
-      <el-button @click="cancel">取消</el-button>
-    </div>
-  </el-dialog>
-</template>
-
-<script>
-import { updateCourse, getCode } from "../api";
-
-const initModalForm = {
-  id: null,
-  courseName: "",
-  courseCode: "",
-  teachingRoomId: "",
-  clazzIdSet: ""
-};
-
-export default {
-  name: "modify-course",
-  props: {
-    instance: {
-      type: Object,
-      default() {
-        return {};
-      }
-    }
-  },
-  computed: {
-    isEdit() {
-      return !!this.instance.id;
-    },
-    title() {
-      return (this.isEdit ? "编辑" : "新增") + "课程";
-    }
-  },
-  data() {
-    return {
-      modalIsShow: false,
-      isSubmit: false,
-      modalForm: { ...initModalForm },
-      rules: {
-        courseName: [
-          {
-            required: true,
-            // pattern: /^[0-9a-zA-Z\u4E00-\u9FA5]{1,20}$/,
-            // message: "课程名称只能输入汉字、数字和字母,长度不能超过20",
-            message: "课程名称不能超过30个字",
-            max: 30,
-            trigger: "change"
-          }
-        ],
-        courseCode: [
-          {
-            required: true,
-            pattern: /^[0-9a-zA-Z_-]{3,30}$/,
-            message: "课程编码只能由数字字母短横线组成,长度在3-30之间",
-            trigger: "change"
-          }
-        ],
-        teachingRoomId: [
-          {
-            required: true,
-            message: "请选择所属教研室",
-            trigger: "change"
-          }
-        ],
-        clazzIdSet: [
-          {
-            required: true,
-            validator: (rule, value, callback) => {
-              if (!value || !value.length) {
-                return callback(new Error("请选择授课班级"));
-              }
-
-              callback();
-            },
-            trigger: "change"
-          }
-        ]
-      }
-    };
-  },
-  methods: {
-    initData(val) {
-      if (val.id) {
-        this.modalForm = this.$objAssign(initModalForm, val);
-        this.modalForm.clazzIdSet = val.clazzList.map(item => item.id);
-      } else {
-        this.modalForm = { ...initModalForm };
-        this.createCode();
-      }
-    },
-    async createCode() {
-      this.modalForm.courseCode = await getCode("COURSE_CODE");
-    },
-    visibleChange() {
-      this.initData(this.instance);
-    },
-    cancel() {
-      this.modalIsShow = false;
-    },
-    open() {
-      this.modalIsShow = true;
-    },
-    async submit() {
-      const valid = await this.$refs.modalFormComp.validate().catch(() => {});
-      if (!valid) return;
-
-      if (this.isSubmit) return;
-      this.isSubmit = true;
-      let datas = { ...this.modalForm };
-      const data = await updateCourse(datas).catch(() => {
-        this.isSubmit = false;
-      });
-
-      if (!data) return;
-
-      this.isSubmit = false;
-      this.$message.success(this.title + "成功!");
-      this.$emit("modified");
-      this.cancel();
-    }
-  }
-};
-</script>
+<template>
+  <el-dialog
+    class="modify-course"
+    :visible.sync="modalIsShow"
+    :title="title"
+    top="10vh"
+    width="550px"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    @open="visibleChange"
+  >
+    <el-form
+      ref="modalFormComp"
+      :model="modalForm"
+      :rules="rules"
+      :key="modalForm.id"
+      label-position="top"
+    >
+      <el-form-item prop="courseName" label="课程名称:">
+        <el-input
+          v-model.trim="modalForm.courseName"
+          placeholder="请输入课程名称"
+          clearable
+        ></el-input>
+      </el-form-item>
+      <el-form-item prop="courseCode" label="课程编码:">
+        <el-input
+          v-model.trim="modalForm.courseCode"
+          placeholder="请输入课程编码"
+          clearable
+        ></el-input>
+      </el-form-item>
+      <el-form-item prop="teachingRoomId" label="所属机构:">
+        <teaching-room-select
+          v-model.trim="modalForm.teachingRoomId"
+          style="width:100%;"
+          clearable
+        ></teaching-room-select>
+      </el-form-item>
+      <el-form-item label="授课班级:">
+        <clazz-select
+          v-model="modalForm.clazzIdSet"
+          placeholder="请选择授课班级"
+          multiple
+          clearable
+          style="width:100%;"
+        ></clazz-select>
+      </el-form-item>
+    </el-form>
+    <div slot="footer">
+      <el-button type="primary" :disabled="isSubmit" @click="submit"
+        >确认</el-button
+      >
+      <el-button @click="cancel">取消</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+import { updateCourse, getCode } from "../api";
+
+const initModalForm = {
+  id: null,
+  courseName: "",
+  courseCode: "",
+  teachingRoomId: "",
+  clazzIdSet: ""
+};
+
+export default {
+  name: "modify-course",
+  props: {
+    instance: {
+      type: Object,
+      default() {
+        return {};
+      }
+    }
+  },
+  computed: {
+    isEdit() {
+      return !!this.instance.id;
+    },
+    title() {
+      return (this.isEdit ? "编辑" : "新增") + "课程";
+    }
+  },
+  data() {
+    return {
+      modalIsShow: false,
+      isSubmit: false,
+      modalForm: { ...initModalForm },
+      rules: {
+        courseName: [
+          {
+            required: true,
+            // pattern: /^[0-9a-zA-Z\u4E00-\u9FA5]{1,20}$/,
+            // message: "课程名称只能输入汉字、数字和字母,长度不能超过20",
+            message: "课程名称不能超过30个字",
+            max: 30,
+            trigger: "change"
+          }
+        ],
+        courseCode: [
+          {
+            required: true,
+            pattern: /^[0-9a-zA-Z_-]{3,30}$/,
+            message: "课程编码只能由数字字母短横线组成,长度在3-30之间",
+            trigger: "change"
+          }
+        ],
+        teachingRoomId: [
+          {
+            required: true,
+            message: "请选择所属机构",
+            trigger: "change"
+          }
+        ],
+        clazzIdSet: [
+          {
+            required: true,
+            validator: (rule, value, callback) => {
+              if (!value || !value.length) {
+                return callback(new Error("请选择授课班级"));
+              }
+
+              callback();
+            },
+            trigger: "change"
+          }
+        ]
+      }
+    };
+  },
+  methods: {
+    initData(val) {
+      if (val.id) {
+        this.modalForm = this.$objAssign(initModalForm, val);
+        this.modalForm.clazzIdSet = val.clazzList.map(item => item.id);
+      } else {
+        this.modalForm = { ...initModalForm };
+        this.createCode();
+      }
+    },
+    async createCode() {
+      this.modalForm.courseCode = await getCode("COURSE_CODE");
+    },
+    visibleChange() {
+      this.initData(this.instance);
+    },
+    cancel() {
+      this.modalIsShow = false;
+    },
+    open() {
+      this.modalIsShow = true;
+    },
+    async submit() {
+      const valid = await this.$refs.modalFormComp.validate().catch(() => {});
+      if (!valid) return;
+
+      if (this.isSubmit) return;
+      this.isSubmit = true;
+      let datas = { ...this.modalForm };
+      const data = await updateCourse(datas).catch(() => {
+        this.isSubmit = false;
+      });
+
+      if (!data) return;
+
+      this.isSubmit = false;
+      this.$message.success(this.title + "成功!");
+      this.$emit("modified");
+      this.cancel();
+    }
+  }
+};
+</script>

+ 253 - 253
src/modules/base/components/ModifyExamConfig.vue

@@ -1,253 +1,253 @@
-<template>
-  <div>
-    <el-dialog
-      class="modify-exam-config page-dialog"
-      :visible.sync="modalIsShow"
-      :title="title"
-      :close-on-click-modal="false"
-      :close-on-press-escape="false"
-      append-to-body
-      fullscreen
-      destroy-on-close
-      @open="visibleChange"
-    >
-      <div class="part-box part-box-filter part-box-flex">
-        <el-form
-          ref="FilterForm"
-          label-position="left"
-          label-width="85px"
-          inline
-        >
-          <el-form-item label="创建时间:">
-            <el-date-picker
-              v-model="createTime"
-              type="datetimerange"
-              :picker-options="pickerOptions"
-              range-separator="至"
-              start-placeholder="创建开始时间"
-              end-placeholder="创建结束时间"
-              value-format="timestamp"
-              align="right"
-              unlink-panels
-            >
-            </el-date-picker>
-          </el-form-item>
-          <el-form-item label="启用/禁用:" label-width="90px">
-            <el-select
-              v-model="filter.enable"
-              style="width: 120px;"
-              placeholder="启用/禁用"
-              clearable
-            >
-              <el-option
-                v-for="(val, key) in ABLE_TYPE"
-                :key="key"
-                :value="key * 1"
-                :label="val"
-              ></el-option>
-            </el-select>
-          </el-form-item>
-          <el-form-item>
-            <el-button type="primary" @click="toPage(1)">查询</el-button>
-          </el-form-item>
-        </el-form>
-        <div class="part-box-action">
-          <el-button
-            type="primary"
-            icon="el-icon-circle-plus-outline"
-            @click="toAdd"
-            >新增</el-button
-          >
-        </div>
-      </div>
-
-      <div class="part-box part-box-pad">
-        <el-table ref="TableList" :data="examConfigList">
-          <el-table-column
-            type="index"
-            label="序号"
-            width="70"
-            :index="indexMethod"
-          ></el-table-column>
-          <el-table-column prop="orgs" label="适用学院">
-            <template slot-scope="scope">
-              <more-text :data="scope.row.orgNames" :show-count="3"></more-text>
-            </template>
-          </el-table-column>
-          <el-table-column prop="createTime" label="创建时间">
-            <span slot-scope="scope">{{
-              scope.row.createTime | timestampFilter
-            }}</span>
-          </el-table-column>
-          <el-table-column prop="enable" label="启用/禁用">
-            <template slot-scope="scope">
-              {{ scope.row.enable | enableFilter }}
-            </template>
-          </el-table-column>
-          <el-table-column class-name="action-column" label="操作" width="160">
-            <template slot-scope="scope">
-              <el-button
-                class="btn-primary"
-                type="text"
-                @click="toEdit(scope.row)"
-                >编辑</el-button
-              >
-              <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-danger"
-                type="text"
-                @click="toDelete(scope.row)"
-                >删除</el-button
-              >
-            </template>
-          </el-table-column>
-        </el-table>
-        <div class="part-page">
-          <el-pagination
-            background
-            layout="total,prev, pager, next"
-            :current-page="current"
-            :total="total"
-            :page-size="size"
-            @current-change="toPage"
-          >
-          </el-pagination>
-        </div>
-      </div>
-    </el-dialog>
-
-    <!-- ModifyExamConfigDetail -->
-    <modify-exam-config-detail
-      ref="ModifyExamConfigDetail"
-      :instance="curExamConfig"
-      @modified="examConfigDetailModified"
-    ></modify-exam-config-detail>
-  </div>
-</template>
-
-<script>
-import { ABLE_TYPE } from "@/constants/enumerate";
-import pickerOptions from "@/constants/datePickerOptions";
-import { examConfigQuery, deleteExamConfig, ableExamConfig } from "../api";
-import ModifyExamConfigDetail from "./ModifyExamConfigDetail";
-
-export default {
-  name: "modify-exam-config",
-  components: { ModifyExamConfigDetail },
-  props: {
-    exam: {
-      type: Object,
-      default() {
-        return {};
-      }
-    }
-  },
-  data() {
-    return {
-      modalIsShow: false,
-      filter: {
-        examId: "",
-        createStartTime: "",
-        createEndTime: "",
-        enable: ""
-      },
-      ABLE_TYPE,
-      current: 1,
-      size: this.GLOBAL.pageSize,
-      total: 0,
-      examConfigList: [],
-      curExamConfig: {},
-      usedOrgIds: [],
-      // date-picker
-      createTime: [],
-      pickerOptions
-    };
-  },
-  computed: {
-    title() {
-      return "配置管理-" + this.exam.name;
-    }
-  },
-  methods: {
-    visibleChange() {
-      this.filter.examId = this.exam.id;
-      this.toPage(1);
-    },
-    cancel() {
-      this.modalIsShow = false;
-    },
-    open() {
-      this.modalIsShow = true;
-    },
-    examConfigDetailModified() {
-      this.getList();
-    },
-    async getList() {
-      const datas = {
-        ...this.filter,
-        pageNumber: this.current,
-        pageSize: this.size
-      };
-      if (this.createTime) {
-        datas.createStartTime = this.createTime[0];
-        datas.createEndTime = this.createTime[1];
-      }
-      if (datas.enable !== null && datas.enable !== "")
-        datas.enable = !!datas.enable;
-
-      const data = await examConfigQuery(datas);
-      this.examConfigList = data.records.map(item => {
-        item.orgNames = item.orgs.map(org => org.name);
-        return item;
-      });
-      this.total = data.total;
-    },
-    toPage(page) {
-      this.current = page;
-      this.getList();
-    },
-    toAdd() {
-      this.curExamConfig = {
-        examId: this.filter.examId
-      };
-      this.$refs.ModifyExamConfigDetail.open();
-    },
-    toEdit(row) {
-      this.curExamConfig = { ...row, examId: this.filter.examId };
-      this.$refs.ModifyExamConfigDetail.open();
-    },
-    toDelete(row) {
-      this.$confirm(`确定要删除该配置吗?`, "提示", {
-        type: "warning"
-      })
-        .then(async () => {
-          await deleteExamConfig(row.id);
-          this.$message.success("删除成功!");
-          this.deletePageLastItem();
-        })
-        .catch(() => {});
-    },
-    toEnable(row) {
-      const action = row.enable ? "禁用" : "启用";
-      this.$confirm(`确定要${action}该配置吗?`, "提示", {
-        type: "warning"
-      })
-        .then(async () => {
-          const enable = !row.enable;
-          await ableExamConfig({
-            id: row.id,
-            enable
-          });
-          row.enable = enable;
-          this.$message.success("操作成功!");
-        })
-        .catch(() => {});
-    }
-  }
-};
-</script>
+<template>
+  <div>
+    <el-dialog
+      class="modify-exam-config page-dialog"
+      :visible.sync="modalIsShow"
+      :title="title"
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+      append-to-body
+      fullscreen
+      destroy-on-close
+      @open="visibleChange"
+    >
+      <div class="part-box part-box-filter part-box-flex">
+        <el-form
+          ref="FilterForm"
+          label-position="left"
+          label-width="85px"
+          inline
+        >
+          <el-form-item label="创建时间:">
+            <el-date-picker
+              v-model="createTime"
+              type="datetimerange"
+              :picker-options="pickerOptions"
+              range-separator="至"
+              start-placeholder="创建开始时间"
+              end-placeholder="创建结束时间"
+              value-format="timestamp"
+              align="right"
+              unlink-panels
+            >
+            </el-date-picker>
+          </el-form-item>
+          <el-form-item label="启用/禁用:" label-width="90px">
+            <el-select
+              v-model="filter.enable"
+              style="width: 120px;"
+              placeholder="启用/禁用"
+              clearable
+            >
+              <el-option
+                v-for="(val, key) in ABLE_TYPE"
+                :key="key"
+                :value="key * 1"
+                :label="val"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+          <el-form-item>
+            <el-button type="primary" @click="toPage(1)">查询</el-button>
+          </el-form-item>
+        </el-form>
+        <div class="part-box-action">
+          <el-button
+            type="primary"
+            icon="el-icon-circle-plus-outline"
+            @click="toAdd"
+            >新增</el-button
+          >
+        </div>
+      </div>
+
+      <div class="part-box part-box-pad">
+        <el-table ref="TableList" :data="examConfigList">
+          <el-table-column
+            type="index"
+            label="序号"
+            width="70"
+            :index="indexMethod"
+          ></el-table-column>
+          <el-table-column prop="orgs" label="适用机构">
+            <template slot-scope="scope">
+              <more-text :data="scope.row.orgNames" :show-count="3"></more-text>
+            </template>
+          </el-table-column>
+          <el-table-column prop="createTime" label="创建时间">
+            <span slot-scope="scope">{{
+              scope.row.createTime | timestampFilter
+            }}</span>
+          </el-table-column>
+          <el-table-column prop="enable" label="启用/禁用">
+            <template slot-scope="scope">
+              {{ scope.row.enable | enableFilter }}
+            </template>
+          </el-table-column>
+          <el-table-column class-name="action-column" label="操作" width="160">
+            <template slot-scope="scope">
+              <el-button
+                class="btn-primary"
+                type="text"
+                @click="toEdit(scope.row)"
+                >编辑</el-button
+              >
+              <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-danger"
+                type="text"
+                @click="toDelete(scope.row)"
+                >删除</el-button
+              >
+            </template>
+          </el-table-column>
+        </el-table>
+        <div class="part-page">
+          <el-pagination
+            background
+            layout="total,prev, pager, next"
+            :current-page="current"
+            :total="total"
+            :page-size="size"
+            @current-change="toPage"
+          >
+          </el-pagination>
+        </div>
+      </div>
+    </el-dialog>
+
+    <!-- ModifyExamConfigDetail -->
+    <modify-exam-config-detail
+      ref="ModifyExamConfigDetail"
+      :instance="curExamConfig"
+      @modified="examConfigDetailModified"
+    ></modify-exam-config-detail>
+  </div>
+</template>
+
+<script>
+import { ABLE_TYPE } from "@/constants/enumerate";
+import pickerOptions from "@/constants/datePickerOptions";
+import { examConfigQuery, deleteExamConfig, ableExamConfig } from "../api";
+import ModifyExamConfigDetail from "./ModifyExamConfigDetail";
+
+export default {
+  name: "modify-exam-config",
+  components: { ModifyExamConfigDetail },
+  props: {
+    exam: {
+      type: Object,
+      default() {
+        return {};
+      }
+    }
+  },
+  data() {
+    return {
+      modalIsShow: false,
+      filter: {
+        examId: "",
+        createStartTime: "",
+        createEndTime: "",
+        enable: ""
+      },
+      ABLE_TYPE,
+      current: 1,
+      size: this.GLOBAL.pageSize,
+      total: 0,
+      examConfigList: [],
+      curExamConfig: {},
+      usedOrgIds: [],
+      // date-picker
+      createTime: [],
+      pickerOptions
+    };
+  },
+  computed: {
+    title() {
+      return "配置管理-" + this.exam.name;
+    }
+  },
+  methods: {
+    visibleChange() {
+      this.filter.examId = this.exam.id;
+      this.toPage(1);
+    },
+    cancel() {
+      this.modalIsShow = false;
+    },
+    open() {
+      this.modalIsShow = true;
+    },
+    examConfigDetailModified() {
+      this.getList();
+    },
+    async getList() {
+      const datas = {
+        ...this.filter,
+        pageNumber: this.current,
+        pageSize: this.size
+      };
+      if (this.createTime) {
+        datas.createStartTime = this.createTime[0];
+        datas.createEndTime = this.createTime[1];
+      }
+      if (datas.enable !== null && datas.enable !== "")
+        datas.enable = !!datas.enable;
+
+      const data = await examConfigQuery(datas);
+      this.examConfigList = data.records.map(item => {
+        item.orgNames = item.orgs.map(org => org.name);
+        return item;
+      });
+      this.total = data.total;
+    },
+    toPage(page) {
+      this.current = page;
+      this.getList();
+    },
+    toAdd() {
+      this.curExamConfig = {
+        examId: this.filter.examId
+      };
+      this.$refs.ModifyExamConfigDetail.open();
+    },
+    toEdit(row) {
+      this.curExamConfig = { ...row, examId: this.filter.examId };
+      this.$refs.ModifyExamConfigDetail.open();
+    },
+    toDelete(row) {
+      this.$confirm(`确定要删除该配置吗?`, "提示", {
+        type: "warning"
+      })
+        .then(async () => {
+          await deleteExamConfig(row.id);
+          this.$message.success("删除成功!");
+          this.deletePageLastItem();
+        })
+        .catch(() => {});
+    },
+    toEnable(row) {
+      const action = row.enable ? "禁用" : "启用";
+      this.$confirm(`确定要${action}该配置吗?`, "提示", {
+        type: "warning"
+      })
+        .then(async () => {
+          const enable = !row.enable;
+          await ableExamConfig({
+            id: row.id,
+            enable
+          });
+          row.enable = enable;
+          this.$message.success("操作成功!");
+        })
+        .catch(() => {});
+    }
+  }
+};
+</script>

+ 137 - 137
src/modules/base/components/ModifyMajor.vue

@@ -1,137 +1,137 @@
-<template>
-  <el-dialog
-    class="modify-major"
-    :visible.sync="modalIsShow"
-    :title="title"
-    top="10vh"
-    width="448px"
-    :close-on-click-modal="false"
-    :close-on-press-escape="false"
-    append-to-body
-    @open="visibleChange"
-  >
-    <el-form
-      ref="modalFormComp"
-      :model="modalForm"
-      :rules="rules"
-      :key="modalForm.id"
-      label-position="top"
-    >
-      <el-form-item prop="majorName" label="专业名称:">
-        <el-input
-          v-model.trim="modalForm.majorName"
-          placeholder="请输入专业名称"
-          clearable
-        ></el-input>
-      </el-form-item>
-      <el-form-item prop="collegeId" label="所属学院:">
-        <college-select
-          v-model="modalForm.collegeId"
-          placeholder="请选择所属学院"
-          clearable
-          style="width: 100%"
-        ></college-select>
-      </el-form-item>
-    </el-form>
-    <div slot="footer">
-      <el-button type="primary" :disabled="isSubmit" @click="submit"
-        >确认</el-button
-      >
-      <el-button @click="cancel">取消</el-button>
-    </div>
-  </el-dialog>
-</template>
-
-<script>
-import { updateMajor } from "../api";
-
-const initModalForm = {
-  id: null,
-  majorName: "",
-  collegeId: ""
-};
-
-export default {
-  name: "modify-major",
-  props: {
-    instance: {
-      type: Object,
-      default() {
-        return {};
-      }
-    }
-  },
-  computed: {
-    isEdit() {
-      return !!this.instance.id;
-    },
-    title() {
-      return (this.isEdit ? "编辑" : "新增") + "专业";
-    }
-  },
-  data() {
-    return {
-      modalIsShow: false,
-      isSubmit: false,
-      classList: [],
-      modalForm: { ...initModalForm },
-      rules: {
-        majorName: [
-          {
-            required: true,
-            message: "请输入专业名称",
-            trigger: "change"
-          },
-          {
-            message: "专业名称不能超过50个字",
-            max: 50,
-            trigger: "change"
-          }
-        ],
-        collegeId: [
-          {
-            required: true,
-            message: "请选择所属学院",
-            trigger: "change"
-          }
-        ]
-      }
-    };
-  },
-  methods: {
-    initData(val) {
-      if (val.id) {
-        this.modalForm = this.$objAssign(initModalForm, val);
-      } else {
-        this.modalForm = { ...initModalForm };
-      }
-    },
-    visibleChange() {
-      this.initData(this.instance);
-    },
-    cancel() {
-      this.modalIsShow = false;
-    },
-    open() {
-      this.modalIsShow = true;
-    },
-    async submit() {
-      const valid = await this.$refs.modalFormComp.validate().catch(() => {});
-      if (!valid) return;
-
-      if (this.isSubmit) return;
-      this.isSubmit = true;
-      const data = await updateMajor(this.modalForm).catch(() => {
-        this.isSubmit = false;
-      });
-
-      if (!data) return;
-
-      this.isSubmit = false;
-      this.$message.success(this.title + "成功!");
-      this.$emit("modified");
-      this.cancel();
-    }
-  }
-};
-</script>
+<template>
+  <el-dialog
+    class="modify-major"
+    :visible.sync="modalIsShow"
+    :title="title"
+    top="10vh"
+    width="448px"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    @open="visibleChange"
+  >
+    <el-form
+      ref="modalFormComp"
+      :model="modalForm"
+      :rules="rules"
+      :key="modalForm.id"
+      label-position="top"
+    >
+      <el-form-item prop="majorName" label="专业名称:">
+        <el-input
+          v-model.trim="modalForm.majorName"
+          placeholder="请输入专业名称"
+          clearable
+        ></el-input>
+      </el-form-item>
+      <el-form-item prop="collegeId" label="所属机构:">
+        <college-select
+          v-model="modalForm.collegeId"
+          placeholder="请选择所属机构"
+          clearable
+          style="width: 100%"
+        ></college-select>
+      </el-form-item>
+    </el-form>
+    <div slot="footer">
+      <el-button type="primary" :disabled="isSubmit" @click="submit"
+        >确认</el-button
+      >
+      <el-button @click="cancel">取消</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+import { updateMajor } from "../api";
+
+const initModalForm = {
+  id: null,
+  majorName: "",
+  collegeId: ""
+};
+
+export default {
+  name: "modify-major",
+  props: {
+    instance: {
+      type: Object,
+      default() {
+        return {};
+      }
+    }
+  },
+  computed: {
+    isEdit() {
+      return !!this.instance.id;
+    },
+    title() {
+      return (this.isEdit ? "编辑" : "新增") + "专业";
+    }
+  },
+  data() {
+    return {
+      modalIsShow: false,
+      isSubmit: false,
+      classList: [],
+      modalForm: { ...initModalForm },
+      rules: {
+        majorName: [
+          {
+            required: true,
+            message: "请输入专业名称",
+            trigger: "change"
+          },
+          {
+            message: "专业名称不能超过50个字",
+            max: 50,
+            trigger: "change"
+          }
+        ],
+        collegeId: [
+          {
+            required: true,
+            message: "请选择所属机构",
+            trigger: "change"
+          }
+        ]
+      }
+    };
+  },
+  methods: {
+    initData(val) {
+      if (val.id) {
+        this.modalForm = this.$objAssign(initModalForm, val);
+      } else {
+        this.modalForm = { ...initModalForm };
+      }
+    },
+    visibleChange() {
+      this.initData(this.instance);
+    },
+    cancel() {
+      this.modalIsShow = false;
+    },
+    open() {
+      this.modalIsShow = true;
+    },
+    async submit() {
+      const valid = await this.$refs.modalFormComp.validate().catch(() => {});
+      if (!valid) return;
+
+      if (this.isSubmit) return;
+      this.isSubmit = true;
+      const data = await updateMajor(this.modalForm).catch(() => {
+        this.isSubmit = false;
+      });
+
+      if (!data) return;
+
+      this.isSubmit = false;
+      this.$message.success(this.title + "成功!");
+      this.$emit("modified");
+      this.cancel();
+    }
+  }
+};
+</script>

+ 148 - 154
src/modules/base/components/ModifyOrganization.vue

@@ -1,154 +1,148 @@
-<template>
-  <el-dialog
-    class="modify-organization"
-    :visible.sync="modalIsShow"
-    :title="title"
-    top="10vh"
-    width="448px"
-    :close-on-click-modal="false"
-    :close-on-press-escape="false"
-    append-to-body
-    @opened="visibleChange"
-  >
-    <el-form
-      ref="modalFormComp"
-      :model="modalForm"
-      :rules="rules"
-      label-position="top"
-    >
-      <el-form-item label="上级机构:">
-        <el-input v-model.trim="modalForm.parentName" disabled></el-input>
-      </el-form-item>
-      <el-form-item prop="name" label="机构名称:">
-        <el-input
-          v-model.trim="modalForm.name"
-          placeholder="请输入机构名称"
-          clearable
-        ></el-input>
-      </el-form-item>
-      <el-form-item prop="type" label="机构类型:">
-        <el-select
-          v-model="modalForm.type"
-          style="width: 100%;"
-          placeholder="请选择"
-          clearable
-        >
-          <el-option
-            v-for="item in orgTypes"
-            :key="item.type"
-            :value="item.type"
-            :label="item.name"
-          ></el-option>
-        </el-select>
-      </el-form-item>
-      <!-- <el-form-item label="启用/禁用:">
-          <el-switch
-            v-model="modalForm.enable"
-            
-            inactive-color="#dcdfe6"
-          >
-          </el-switch>
-        </el-form-item> -->
-    </el-form>
-    <div slot="footer">
-      <el-button type="primary" :disabled="isSubmit" @click="submit"
-        >确认</el-button
-      >
-      <el-button @click="cancel">取消</el-button>
-    </div>
-  </el-dialog>
-</template>
-
-<script>
-import { updateOrganization } from "../api";
-
-const initModalForm = {
-  id: null,
-  name: "",
-  type: "",
-  parentId: null,
-  parentName: "",
-  enable: true
-};
-
-export default {
-  name: "modify-organization",
-  props: {
-    instance: {
-      type: Object,
-      default() {
-        return {};
-      }
-    },
-    orgTypes: {
-      type: Array,
-      default() {
-        return [];
-      }
-    }
-  },
-  computed: {
-    isEdit() {
-      return !!this.instance.id;
-    },
-    title() {
-      return (this.isEdit ? "编辑" : "新增") + "机构";
-    }
-  },
-  data() {
-    return {
-      modalIsShow: false,
-      isSubmit: false,
-      modalForm: {},
-      rules: {
-        name: [
-          {
-            required: true,
-            pattern: /^[0-9a-zA-Z\u4E00-\u9FA5]{1,30}$/,
-            message: "机构名称只能输入汉字、数字和字母,长度不能超过30",
-            trigger: "change"
-          }
-        ],
-        type: [
-          {
-            required: true,
-            message: "请选择机构类型",
-            trigger: "change"
-          }
-        ]
-      }
-    };
-  },
-  methods: {
-    initData(val) {
-      this.modalForm = this.$objAssign(initModalForm, val);
-    },
-    visibleChange() {
-      this.initData(this.instance);
-      this.$nextTick(() => {
-        this.$refs.modalFormComp.clearValidate();
-      });
-    },
-    cancel() {
-      this.modalIsShow = false;
-    },
-    open() {
-      this.modalIsShow = true;
-    },
-    async submit() {
-      const valid = await this.$refs.modalFormComp.validate().catch(() => {});
-      if (!valid) return;
-
-      if (this.isSubmit) return;
-      this.isSubmit = true;
-      const datas = { ...this.modalForm };
-      const data = await updateOrganization(datas).catch(() => {});
-      this.isSubmit = false;
-      if (!data) return;
-
-      this.$emit("confirm", this.modalForm);
-      this.cancel();
-    }
-  }
-};
-</script>
+<template>
+  <el-dialog
+    class="modify-organization"
+    :visible.sync="modalIsShow"
+    :title="title"
+    top="10vh"
+    width="448px"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    @opened="visibleChange"
+  >
+    <el-form
+      ref="modalFormComp"
+      :model="modalForm"
+      :rules="rules"
+      label-position="top"
+    >
+      <el-form-item label="上级机构:">
+        <el-input v-model.trim="modalForm.parentName" disabled></el-input>
+      </el-form-item>
+      <el-form-item prop="name" label="机构名称:">
+        <el-input
+          v-model.trim="modalForm.name"
+          placeholder="请输入机构名称"
+          clearable
+        ></el-input>
+      </el-form-item>
+      <el-form-item v-if="orgTypes.length" prop="type" label="机构类型:">
+        <el-select
+          v-model="modalForm.type"
+          style="width: 100%;"
+          placeholder="请选择"
+          clearable
+        >
+          <el-option
+            v-for="item in orgTypes"
+            :key="item.type"
+            :value="item.type"
+            :label="item.name"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+      <!-- <el-form-item label="启用/禁用:">
+          <el-switch
+            v-model="modalForm.enable"
+            
+            inactive-color="#dcdfe6"
+          >
+          </el-switch>
+        </el-form-item> -->
+    </el-form>
+    <div slot="footer">
+      <el-button type="primary" :disabled="isSubmit" @click="submit"
+        >确认</el-button
+      >
+      <el-button @click="cancel">取消</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+import { updateOrganization } from "../api";
+
+const initModalForm = {
+  id: null,
+  name: "",
+  type: "",
+  parentId: null,
+  parentName: "",
+  enable: true
+};
+
+export default {
+  name: "modify-organization",
+  props: {
+    instance: {
+      type: Object,
+      default() {
+        return {};
+      }
+    },
+    orgTypes: {
+      type: Array,
+      default() {
+        return [];
+      }
+    }
+  },
+  computed: {
+    isEdit() {
+      return !!this.instance.id;
+    },
+    title() {
+      return (this.isEdit ? "编辑" : "新增") + "机构";
+    }
+  },
+  data() {
+    return {
+      modalIsShow: false,
+      isSubmit: false,
+      modalForm: {},
+      rules: {
+        name: [
+          {
+            required: true,
+            pattern: /^[0-9a-zA-Z\u4E00-\u9FA5]{1,30}$/,
+            message: "机构名称只能输入汉字、数字和字母,长度不能超过30",
+            trigger: "change"
+          }
+        ]
+      }
+    };
+  },
+  methods: {
+    initData(val) {
+      this.modalForm = this.$objAssign(initModalForm, val);
+    },
+    visibleChange() {
+      this.initData(this.instance);
+      this.$nextTick(() => {
+        this.$refs.modalFormComp.clearValidate();
+      });
+    },
+    cancel() {
+      this.modalIsShow = false;
+    },
+    open() {
+      this.modalIsShow = true;
+    },
+    async submit() {
+      const valid = await this.$refs.modalFormComp.validate().catch(() => {});
+      if (!valid) return;
+
+      if (this.isSubmit) return;
+      this.isSubmit = true;
+      const datas = { ...this.modalForm };
+      if (!datas.type) datas.type = "";
+      const data = await updateOrganization(datas).catch(() => {});
+      this.isSubmit = false;
+      if (!data) return;
+
+      this.$emit("confirm", this.modalForm);
+      this.cancel();
+    }
+  }
+};
+</script>

+ 247 - 247
src/modules/base/components/ModifyStudent.vue

@@ -1,247 +1,247 @@
-<template>
-  <el-dialog
-    class="modify-student"
-    :visible.sync="modalIsShow"
-    :title="title"
-    top="10px"
-    width="448px"
-    :close-on-click-modal="false"
-    :close-on-press-escape="false"
-    append-to-body
-    destroy-on-close
-    @open="visibleChange"
-  >
-    <el-form
-      ref="modalFormComp"
-      :model="modalForm"
-      :rules="rules"
-      :key="modalForm.id"
-      label-position="top"
-    >
-      <el-form-item prop="studentName" label="姓名:">
-        <el-input
-          v-model.trim="modalForm.studentName"
-          placeholder="请输入姓名"
-          clearable
-        ></el-input>
-      </el-form-item>
-      <el-form-item prop="studentCode" label="学号:">
-        <el-input
-          v-model.trim="modalForm.studentCode"
-          placeholder="请输入学号"
-          clearable
-        ></el-input>
-      </el-form-item>
-      <el-form-item prop="phoneNumber" label="手机号:">
-        <el-input
-          v-model.trim="modalForm.phoneNumber"
-          placeholder="请输入手机号"
-          clearable
-        ></el-input>
-      </el-form-item>
-      <el-form-item prop="campusId" label="所属校区:">
-        <campus-select
-          v-model="modalForm.campusId"
-          placeholder="请选择所属校区"
-          style="width: 100%;"
-          @change="updateClazz"
-        ></campus-select>
-      </el-form-item>
-      <el-form-item prop="collegeId" label="学院:">
-        <college-select
-          v-model="modalForm.collegeId"
-          placeholder="请选择学院"
-          style="width: 100%;"
-        ></college-select>
-      </el-form-item>
-      <el-form-item prop="majorId" label="专业:">
-        <major-select
-          v-model="modalForm.majorId"
-          :college-id="modalForm.collegeId"
-          cascader
-          placeholder="请选择专业"
-          style="width: 100%;"
-          @change="updateClazz"
-        ></major-select>
-      </el-form-item>
-      <el-form-item prop="clazzId" label="班级:">
-        <el-select
-          v-model="modalForm.clazzId"
-          placeholder="请选择班级"
-          style="width: 100%;"
-        >
-          <el-option
-            v-for="item in clazzList"
-            :key="item.id"
-            :value="item.id"
-            :label="item.name"
-          >
-          </el-option>
-        </el-select>
-      </el-form-item>
-    </el-form>
-    <div slot="footer">
-      <el-button type="primary" :disabled="isSubmit" @click="submit"
-        >确认</el-button
-      >
-      <el-button @click="cancel">取消</el-button>
-    </div>
-  </el-dialog>
-</template>
-
-<script>
-import { updateStudent, unitQueryByType } from "../api";
-
-const initModalForm = {
-  id: null,
-  studentName: "",
-  studentCode: "",
-  phoneNumber: "",
-  campusId: "",
-  collegeId: "",
-  majorId: "",
-  clazzId: ""
-};
-
-export default {
-  name: "modify-student",
-  props: {
-    instance: {
-      type: Object,
-      default() {
-        return {};
-      }
-    }
-  },
-  computed: {
-    isEdit() {
-      return !!this.instance.id;
-    },
-    title() {
-      return (this.isEdit ? "编辑" : "新增") + "学生";
-    }
-  },
-  data() {
-    return {
-      modalIsShow: false,
-      isSubmit: false,
-      modalForm: { ...initModalForm },
-      rules: {
-        studentName: [
-          {
-            required: true,
-            message: "请输入姓名",
-            trigger: "change"
-          },
-          {
-            message: "姓名不能超过50个字",
-            max: 50,
-            trigger: "change"
-          }
-        ],
-        studentCode: [
-          {
-            required: true,
-            message: "请输入学号",
-            trigger: "change"
-          },
-          {
-            message: "学号不能超过50个字",
-            max: 50,
-            trigger: "change"
-          }
-        ],
-        phoneNumber: [
-          {
-            required: false,
-            pattern: /^1\d{10}$/,
-            message: "请输入合适的手机号码",
-            trigger: "change"
-          }
-        ],
-        campusId: [
-          {
-            required: false,
-            message: "请选择校区",
-            trigger: "change"
-          }
-        ],
-        collegeId: [
-          {
-            required: false,
-            message: "请选择学院",
-            trigger: "change"
-          }
-        ],
-        majorId: [
-          {
-            required: false,
-            message: "请选择专业",
-            trigger: "change"
-          }
-        ],
-        clazzId: [
-          {
-            required: false,
-            message: "请选择班级",
-            trigger: "change"
-          }
-        ]
-      },
-      clazzList: []
-    };
-  },
-  methods: {
-    initData(val) {
-      if (val.id) {
-        this.modalForm = this.$objAssign(initModalForm, val);
-        this.getClazz();
-      } else {
-        this.modalForm = { ...initModalForm };
-      }
-    },
-    visibleChange() {
-      this.initData(this.instance);
-    },
-    cancel() {
-      this.modalIsShow = false;
-    },
-    open() {
-      this.modalIsShow = true;
-    },
-    updateClazz() {
-      this.modalForm.clazzId = "";
-      this.getClazz();
-    },
-    async getClazz() {
-      this.clazzList = [];
-      if (!this.modalForm.campusId || !this.modalForm.majorId) return;
-      const res = await unitQueryByType(
-        {
-          campusId: this.modalForm.campusId,
-          majorId: this.modalForm.majorId
-        },
-        "CLAZZ"
-      );
-      this.clazzList = res;
-    },
-    async submit() {
-      const valid = await this.$refs.modalFormComp.validate().catch(() => {});
-      if (!valid) return;
-
-      if (this.isSubmit) return;
-      this.isSubmit = true;
-      const data = await updateStudent(this.modalForm).catch(() => {
-        this.isSubmit = false;
-      });
-
-      if (!data) return;
-
-      this.isSubmit = false;
-      this.$message.success(this.title + "成功!");
-      this.$emit("modified");
-      this.cancel();
-    }
-  }
-};
-</script>
+<template>
+  <el-dialog
+    class="modify-student"
+    :visible.sync="modalIsShow"
+    :title="title"
+    top="10px"
+    width="448px"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    destroy-on-close
+    @open="visibleChange"
+  >
+    <el-form
+      ref="modalFormComp"
+      :model="modalForm"
+      :rules="rules"
+      :key="modalForm.id"
+      label-position="top"
+    >
+      <el-form-item prop="studentName" label="姓名:">
+        <el-input
+          v-model.trim="modalForm.studentName"
+          placeholder="请输入姓名"
+          clearable
+        ></el-input>
+      </el-form-item>
+      <el-form-item prop="studentCode" label="学号:">
+        <el-input
+          v-model.trim="modalForm.studentCode"
+          placeholder="请输入学号"
+          clearable
+        ></el-input>
+      </el-form-item>
+      <el-form-item prop="phoneNumber" label="手机号:">
+        <el-input
+          v-model.trim="modalForm.phoneNumber"
+          placeholder="请输入手机号"
+          clearable
+        ></el-input>
+      </el-form-item>
+      <el-form-item prop="campusId" label="所属校区:">
+        <campus-select
+          v-model="modalForm.campusId"
+          placeholder="请选择所属校区"
+          style="width: 100%;"
+          @change="updateClazz"
+        ></campus-select>
+      </el-form-item>
+      <el-form-item prop="collegeId" label="机构:">
+        <college-select
+          v-model="modalForm.collegeId"
+          placeholder="请选择机构"
+          style="width: 100%;"
+        ></college-select>
+      </el-form-item>
+      <el-form-item prop="majorId" label="专业:">
+        <major-select
+          v-model="modalForm.majorId"
+          :college-id="modalForm.collegeId"
+          cascader
+          placeholder="请选择专业"
+          style="width: 100%;"
+          @change="updateClazz"
+        ></major-select>
+      </el-form-item>
+      <el-form-item prop="clazzId" label="班级:">
+        <el-select
+          v-model="modalForm.clazzId"
+          placeholder="请选择班级"
+          style="width: 100%;"
+        >
+          <el-option
+            v-for="item in clazzList"
+            :key="item.id"
+            :value="item.id"
+            :label="item.name"
+          >
+          </el-option>
+        </el-select>
+      </el-form-item>
+    </el-form>
+    <div slot="footer">
+      <el-button type="primary" :disabled="isSubmit" @click="submit"
+        >确认</el-button
+      >
+      <el-button @click="cancel">取消</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+import { updateStudent, unitQueryByType } from "../api";
+
+const initModalForm = {
+  id: null,
+  studentName: "",
+  studentCode: "",
+  phoneNumber: "",
+  campusId: "",
+  collegeId: "",
+  majorId: "",
+  clazzId: ""
+};
+
+export default {
+  name: "modify-student",
+  props: {
+    instance: {
+      type: Object,
+      default() {
+        return {};
+      }
+    }
+  },
+  computed: {
+    isEdit() {
+      return !!this.instance.id;
+    },
+    title() {
+      return (this.isEdit ? "编辑" : "新增") + "学生";
+    }
+  },
+  data() {
+    return {
+      modalIsShow: false,
+      isSubmit: false,
+      modalForm: { ...initModalForm },
+      rules: {
+        studentName: [
+          {
+            required: true,
+            message: "请输入姓名",
+            trigger: "change"
+          },
+          {
+            message: "姓名不能超过50个字",
+            max: 50,
+            trigger: "change"
+          }
+        ],
+        studentCode: [
+          {
+            required: true,
+            message: "请输入学号",
+            trigger: "change"
+          },
+          {
+            message: "学号不能超过50个字",
+            max: 50,
+            trigger: "change"
+          }
+        ],
+        phoneNumber: [
+          {
+            required: false,
+            pattern: /^1\d{10}$/,
+            message: "请输入合适的手机号码",
+            trigger: "change"
+          }
+        ],
+        campusId: [
+          {
+            required: false,
+            message: "请选择校区",
+            trigger: "change"
+          }
+        ],
+        collegeId: [
+          {
+            required: false,
+            message: "请选择机构",
+            trigger: "change"
+          }
+        ],
+        majorId: [
+          {
+            required: false,
+            message: "请选择专业",
+            trigger: "change"
+          }
+        ],
+        clazzId: [
+          {
+            required: false,
+            message: "请选择班级",
+            trigger: "change"
+          }
+        ]
+      },
+      clazzList: []
+    };
+  },
+  methods: {
+    initData(val) {
+      if (val.id) {
+        this.modalForm = this.$objAssign(initModalForm, val);
+        this.getClazz();
+      } else {
+        this.modalForm = { ...initModalForm };
+      }
+    },
+    visibleChange() {
+      this.initData(this.instance);
+    },
+    cancel() {
+      this.modalIsShow = false;
+    },
+    open() {
+      this.modalIsShow = true;
+    },
+    updateClazz() {
+      this.modalForm.clazzId = "";
+      this.getClazz();
+    },
+    async getClazz() {
+      this.clazzList = [];
+      if (!this.modalForm.campusId || !this.modalForm.majorId) return;
+      const res = await unitQueryByType(
+        {
+          campusId: this.modalForm.campusId,
+          majorId: this.modalForm.majorId
+        },
+        "CLAZZ"
+      );
+      this.clazzList = res;
+    },
+    async submit() {
+      const valid = await this.$refs.modalFormComp.validate().catch(() => {});
+      if (!valid) return;
+
+      if (this.isSubmit) return;
+      this.isSubmit = true;
+      const data = await updateStudent(this.modalForm).catch(() => {
+        this.isSubmit = false;
+      });
+
+      if (!data) return;
+
+      this.isSubmit = false;
+      this.$message.success(this.title + "成功!");
+      this.$emit("modified");
+      this.cancel();
+    }
+  }
+};
+</script>

+ 268 - 268
src/modules/base/components/ModifyTemplate.vue

@@ -1,268 +1,268 @@
-<template>
-  <el-dialog
-    class="modify-template"
-    :visible.sync="modalIsShow"
-    :title="title"
-    top="10px"
-    width="600px"
-    :close-on-click-modal="false"
-    :close-on-press-escape="false"
-    append-to-body
-    @open="visibleChange"
-  >
-    <el-form
-      ref="modalFormComp"
-      label-position="top"
-      :rules="rules"
-      :model="modalForm"
-    >
-      <el-form-item prop="name" label="模板名称:">
-        <el-input
-          v-model.trim="modalForm.name"
-          placeholder="建议不超过30个字,规则名称不允许重复"
-          style="width: 100%"
-          clearable
-          :disabled="!editable"
-        ></el-input>
-      </el-form-item>
-      <el-form-item prop="remark" label="备注:">
-        <el-input
-          v-model="modalForm.remark"
-          type="textarea"
-          resize="none"
-          :rows="2"
-          :maxlength="50"
-          :disabled="!editable"
-          clearable
-          show-word-limit
-          placeholder="建议不超过50个字"
-        ></el-input>
-      </el-form-item>
-      <el-form-item
-        v-if="modalForm.type !== 'GENERIC'"
-        prop="classify"
-        label="分类:"
-      >
-        <el-select
-          v-model="modalForm.classify"
-          style="width: 100%;"
-          placeholder="请选择"
-          :disabled="!editable"
-          clearable
-        >
-          <el-option
-            v-for="(val, key) in categories"
-            :key="key"
-            :value="key"
-            :label="val"
-          ></el-option>
-        </el-select>
-      </el-form-item>
-      <el-form-item prop="attachmentId" label="上传模板文件:">
-        <upload-file-view
-          :upload-data="uploadData"
-          :upload-url="uploadUrl"
-          :disabled="!editable"
-          :format="format"
-          @valid-error="validError"
-          @upload-success="uploadSuccess"
-          ref="UploadFileView"
-        ></upload-file-view>
-      </el-form-item>
-      <el-form-item prop="orgIds" label="适用学院范围:">
-        <select-orgs
-          v-model="modalForm.orgIds"
-          ref="SelectOrgs"
-          :disabled="!editable"
-        ></select-orgs>
-      </el-form-item>
-    </el-form>
-
-    <div slot="footer">
-      <el-button
-        v-if="editable"
-        type="primary"
-        :disabled="isSubmit"
-        @click="submit"
-        >确认</el-button
-      >
-      <el-button @click="cancel">取消</el-button>
-    </div>
-  </el-dialog>
-</template>
-
-<script>
-import { updateTemplate } from "../api";
-import { attachmentDetail } from "../../login/api";
-import UploadFileView from "@/components/UploadFileView";
-import SelectOrgs from "./SelectOrgs";
-
-const initModalForm = {
-  id: null,
-  name: "",
-  type: "GENERIC",
-  remark: "",
-  classify: "",
-  attachmentId: "",
-  orgIds: []
-};
-
-const TEMPLATE_CLASSIFY = {
-  VARIABLE: { SIGN: "签到表", PACKAGE: "卷袋贴" },
-  ORDINARY: { CHECK_IN: "考试情况登记表" }
-};
-
-export default {
-  name: "modify-template",
-  components: { UploadFileView, SelectOrgs },
-  props: {
-    instance: {
-      type: Object,
-      default() {
-        return {};
-      }
-    },
-    editType: {
-      type: String,
-      default: "ADD",
-      validator: val => ["ADD", "PREVIEW", "EDIT"].includes(val)
-    }
-  },
-  computed: {
-    title() {
-      const names = {
-        ADD: "新增模板",
-        PREVIEW: "模板详情",
-        EDIT: "编辑模板"
-      };
-      return names[this.editType];
-    },
-    editable() {
-      return this.editType !== "PREVIEW";
-    },
-    categories() {
-      return TEMPLATE_CLASSIFY[this.modalForm.type] || {};
-    },
-    format() {
-      const formats = {
-        GENERIC: ["html"],
-        VARIABLE: ["ftl"],
-        ORDINARY: ["ftl", "html", "pdf"]
-      };
-      return formats[this.modalForm.type];
-    }
-  },
-  data() {
-    return {
-      modalIsShow: false,
-      isSubmit: false,
-      modalForm: {},
-      attachment: {},
-      rules: {
-        name: [
-          {
-            required: true,
-            message: "题卡规则名称不能超过30个字",
-            max: 30,
-            trigger: "change"
-          }
-        ],
-        classify: [
-          {
-            required: true,
-            message: "请选择分类",
-            trigger: "change"
-          }
-        ],
-        attachmentId: [
-          {
-            required: true,
-            message: "请上传模板文件",
-            trigger: "change"
-          }
-        ],
-        orgIds: [
-          {
-            required: true,
-            validator: (rule, value, callback) => {
-              if (value.length) {
-                callback();
-              } else {
-                callback(new Error("请选择适用学院"));
-              }
-            },
-            trigger: "change"
-          }
-        ]
-      },
-      // upload
-      uploadUrl: "/api/admin/common/file/upload",
-      uploadData: {
-        type: "UPLOAD"
-      }
-    };
-  },
-  methods: {
-    initData(val) {
-      this.modalForm = this.$objAssign(initModalForm, val);
-      if (val.id) {
-        this.modalForm.orgIds = val.orgs.map(item => item.id);
-        this.getAttachment();
-      } else {
-        this.modalForm.orgIds = [];
-        this.$nextTick(() => {
-          this.$refs.UploadFileView.setAttachmentName("");
-        });
-      }
-    },
-    async getAttachment() {
-      const data = await attachmentDetail(this.instance.attachmentId);
-      this.attachment = data;
-
-      this.$nextTick(() => {
-        this.$refs.UploadFileView.setAttachmentName(`${data.name}${data.type}`);
-      });
-    },
-    visibleChange() {
-      this.initData(this.instance);
-
-      this.$nextTick(() => {
-        this.$refs.modalFormComp.clearValidate();
-      });
-    },
-    cancel() {
-      this.modalIsShow = false;
-    },
-    open() {
-      this.modalIsShow = true;
-    },
-    async submit() {
-      const valid = await this.$refs.modalFormComp.validate().catch(() => {});
-      if (!valid) return;
-
-      if (this.isSubmit) return;
-      this.isSubmit = true;
-      let datas = {
-        ...this.modalForm
-      };
-      if (datas.type === "GENERIC") datas.classify = "CARD";
-      const data = await updateTemplate(datas).catch(() => {});
-      this.isSubmit = false;
-      if (!data) return;
-
-      this.$message.success("保存成功!");
-      this.$emit("modified");
-      this.cancel();
-    },
-    validError(errorData) {
-      this.$message.error(errorData.message);
-    },
-    uploadSuccess(data) {
-      this.$message.success("上传成功!");
-
-      this.modalForm.attachmentId = data.id;
-      this.$refs.modalFormComp.validateField("attachmentId");
-    }
-  }
-};
-</script>
+<template>
+  <el-dialog
+    class="modify-template"
+    :visible.sync="modalIsShow"
+    :title="title"
+    top="10px"
+    width="600px"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    @open="visibleChange"
+  >
+    <el-form
+      ref="modalFormComp"
+      label-position="top"
+      :rules="rules"
+      :model="modalForm"
+    >
+      <el-form-item prop="name" label="模板名称:">
+        <el-input
+          v-model.trim="modalForm.name"
+          placeholder="建议不超过30个字,规则名称不允许重复"
+          style="width: 100%"
+          clearable
+          :disabled="!editable"
+        ></el-input>
+      </el-form-item>
+      <el-form-item prop="remark" label="备注:">
+        <el-input
+          v-model="modalForm.remark"
+          type="textarea"
+          resize="none"
+          :rows="2"
+          :maxlength="50"
+          :disabled="!editable"
+          clearable
+          show-word-limit
+          placeholder="建议不超过50个字"
+        ></el-input>
+      </el-form-item>
+      <el-form-item
+        v-if="modalForm.type !== 'GENERIC'"
+        prop="classify"
+        label="分类:"
+      >
+        <el-select
+          v-model="modalForm.classify"
+          style="width: 100%;"
+          placeholder="请选择"
+          :disabled="!editable"
+          clearable
+        >
+          <el-option
+            v-for="(val, key) in categories"
+            :key="key"
+            :value="key"
+            :label="val"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item prop="attachmentId" label="上传模板文件:">
+        <upload-file-view
+          :upload-data="uploadData"
+          :upload-url="uploadUrl"
+          :disabled="!editable"
+          :format="format"
+          @valid-error="validError"
+          @upload-success="uploadSuccess"
+          ref="UploadFileView"
+        ></upload-file-view>
+      </el-form-item>
+      <el-form-item prop="orgIds" label="适用机构范围:">
+        <select-orgs
+          v-model="modalForm.orgIds"
+          ref="SelectOrgs"
+          :disabled="!editable"
+        ></select-orgs>
+      </el-form-item>
+    </el-form>
+
+    <div slot="footer">
+      <el-button
+        v-if="editable"
+        type="primary"
+        :disabled="isSubmit"
+        @click="submit"
+        >确认</el-button
+      >
+      <el-button @click="cancel">取消</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+import { updateTemplate } from "../api";
+import { attachmentDetail } from "../../login/api";
+import UploadFileView from "@/components/UploadFileView";
+import SelectOrgs from "./SelectOrgs";
+
+const initModalForm = {
+  id: null,
+  name: "",
+  type: "GENERIC",
+  remark: "",
+  classify: "",
+  attachmentId: "",
+  orgIds: []
+};
+
+const TEMPLATE_CLASSIFY = {
+  VARIABLE: { SIGN: "签到表", PACKAGE: "卷袋贴" },
+  ORDINARY: { CHECK_IN: "考试情况登记表" }
+};
+
+export default {
+  name: "modify-template",
+  components: { UploadFileView, SelectOrgs },
+  props: {
+    instance: {
+      type: Object,
+      default() {
+        return {};
+      }
+    },
+    editType: {
+      type: String,
+      default: "ADD",
+      validator: val => ["ADD", "PREVIEW", "EDIT"].includes(val)
+    }
+  },
+  computed: {
+    title() {
+      const names = {
+        ADD: "新增模板",
+        PREVIEW: "模板详情",
+        EDIT: "编辑模板"
+      };
+      return names[this.editType];
+    },
+    editable() {
+      return this.editType !== "PREVIEW";
+    },
+    categories() {
+      return TEMPLATE_CLASSIFY[this.modalForm.type] || {};
+    },
+    format() {
+      const formats = {
+        GENERIC: ["html"],
+        VARIABLE: ["ftl"],
+        ORDINARY: ["ftl", "html", "pdf"]
+      };
+      return formats[this.modalForm.type];
+    }
+  },
+  data() {
+    return {
+      modalIsShow: false,
+      isSubmit: false,
+      modalForm: {},
+      attachment: {},
+      rules: {
+        name: [
+          {
+            required: true,
+            message: "题卡规则名称不能超过30个字",
+            max: 30,
+            trigger: "change"
+          }
+        ],
+        classify: [
+          {
+            required: true,
+            message: "请选择分类",
+            trigger: "change"
+          }
+        ],
+        attachmentId: [
+          {
+            required: true,
+            message: "请上传模板文件",
+            trigger: "change"
+          }
+        ],
+        orgIds: [
+          {
+            required: true,
+            validator: (rule, value, callback) => {
+              if (value.length) {
+                callback();
+              } else {
+                callback(new Error("请选择适用机构"));
+              }
+            },
+            trigger: "change"
+          }
+        ]
+      },
+      // upload
+      uploadUrl: "/api/admin/common/file/upload",
+      uploadData: {
+        type: "UPLOAD"
+      }
+    };
+  },
+  methods: {
+    initData(val) {
+      this.modalForm = this.$objAssign(initModalForm, val);
+      if (val.id) {
+        this.modalForm.orgIds = val.orgs.map(item => item.id);
+        this.getAttachment();
+      } else {
+        this.modalForm.orgIds = [];
+        this.$nextTick(() => {
+          this.$refs.UploadFileView.setAttachmentName("");
+        });
+      }
+    },
+    async getAttachment() {
+      const data = await attachmentDetail(this.instance.attachmentId);
+      this.attachment = data;
+
+      this.$nextTick(() => {
+        this.$refs.UploadFileView.setAttachmentName(`${data.name}${data.type}`);
+      });
+    },
+    visibleChange() {
+      this.initData(this.instance);
+
+      this.$nextTick(() => {
+        this.$refs.modalFormComp.clearValidate();
+      });
+    },
+    cancel() {
+      this.modalIsShow = false;
+    },
+    open() {
+      this.modalIsShow = true;
+    },
+    async submit() {
+      const valid = await this.$refs.modalFormComp.validate().catch(() => {});
+      if (!valid) return;
+
+      if (this.isSubmit) return;
+      this.isSubmit = true;
+      let datas = {
+        ...this.modalForm
+      };
+      if (datas.type === "GENERIC") datas.classify = "CARD";
+      const data = await updateTemplate(datas).catch(() => {});
+      this.isSubmit = false;
+      if (!data) return;
+
+      this.$message.success("保存成功!");
+      this.$emit("modified");
+      this.cancel();
+    },
+    validError(errorData) {
+      this.$message.error(errorData.message);
+    },
+    uploadSuccess(data) {
+      this.$message.success("上传成功!");
+
+      this.modalForm.attachmentId = data.id;
+      this.$refs.modalFormComp.validateField("attachmentId");
+    }
+  }
+};
+</script>

+ 293 - 293
src/modules/base/components/ModifyUser.vue

@@ -1,293 +1,293 @@
-<template>
-  <el-dialog
-    class="modify-user"
-    :visible.sync="modalIsShow"
-    :title="title"
-    top="10vh"
-    width="500px"
-    :close-on-click-modal="false"
-    :close-on-press-escape="false"
-    append-to-body
-    @open="visibleChange"
-  >
-    <el-form
-      ref="modalFormComp"
-      :model="modalForm"
-      :rules="rules"
-      label-position="top"
-    >
-      <el-form-item prop="loginName" label="用户名:">
-        <el-input
-          v-model.trim="modalForm.loginName"
-          placeholder="请输入用户名"
-          :disabled="isEdit"
-        ></el-input>
-      </el-form-item>
-      <el-form-item prop="realName" label="姓名:">
-        <el-input
-          v-model.trim="modalForm.realName"
-          placeholder="请输入姓名"
-          clearable
-        ></el-input>
-      </el-form-item>
-      <el-form-item prop="code" label="工号:">
-        <el-input
-          v-model.trim="modalForm.code"
-          placeholder="请输入工号"
-          clearable
-        ></el-input>
-      </el-form-item>
-      <el-form-item prop="mobileNumber" label="手机号:">
-        <el-input
-          v-model.trim="modalForm.mobileNumber"
-          placeholder="请输入手机号"
-          clearable
-        ></el-input>
-      </el-form-item>
-      <el-form-item prop="roleIds" label="角色:">
-        <el-select
-          style="width:100%;"
-          v-model="modalForm.roleIds"
-          placeholder="请选择角色"
-          multiple
-        >
-          <el-option
-            v-for="item in roles"
-            :key="item.id"
-            :value="item.id"
-            :label="item.name"
-          >
-          </el-option>
-        </el-select>
-      </el-form-item>
-      <el-form-item prop="orgId" label="所属学院:">
-        <select-orgs
-          ref="SelectOrgs"
-          v-model="modalForm.orgId"
-          :multiple="false"
-          check-strictly
-          @change="orgChange"
-        ></select-orgs>
-      </el-form-item>
-    </el-form>
-    <div slot="footer">
-      <el-button type="primary" :disabled="isSubmit" @click="submit"
-        >确认</el-button
-      >
-      <el-button @click="cancel">取消</el-button>
-    </div>
-  </el-dialog>
-</template>
-
-<script>
-import { updateUser } from "../api";
-// import { logout } from "../../login/api";
-// import { phone } from "@/plugins/formRules";
-import SelectOrgs from "./SelectOrgs";
-import { SYS_ADMIN_NAME } from "@/constants/enumerate";
-
-const initModalForm = {
-  id: "",
-  loginName: "",
-  realName: "",
-  code: "",
-  mobileNumber: "",
-  roleIds: [],
-  courseIds: [],
-  orgId: []
-};
-
-export default {
-  name: "modify-user",
-  components: { SelectOrgs },
-  props: {
-    instance: {
-      type: Object,
-      default() {
-        return {};
-      }
-    },
-    roles: {
-      type: Array,
-      default() {
-        return [];
-      }
-    }
-  },
-  computed: {
-    isEdit() {
-      return !!this.instance.id;
-    },
-    title() {
-      return (this.isEdit ? "编辑" : "新增") + "用户";
-    }
-  },
-  data() {
-    const roleIdsValidator = (rule, value, callback) => {
-      if (!value || !value.length) {
-        callback(new Error("请选择角色"));
-      } else {
-        callback();
-      }
-    };
-    const orgIdValidator = (rule, value, callback) => {
-      if (!value || !value.length) {
-        callback(new Error("请选择所属学院"));
-      } else {
-        callback();
-      }
-    };
-    const mobileNumberValidator = (rule, value, callback) => {
-      if (!value) {
-        return callback();
-      }
-
-      if (/^1\d{10}$/.test(value)) {
-        return callback();
-      } else {
-        return callback(new Error("请输入合适的手机号码"));
-      }
-    };
-
-    const IS_SUPER_ADMIN =
-      this.$ls.get("user", { loginName: "" }).loginName === SYS_ADMIN_NAME;
-
-    return {
-      modalIsShow: false,
-      isSubmit: false,
-      modalForm: {},
-      rules: {
-        mobileNumber: [
-          {
-            required: false,
-            validator: mobileNumberValidator,
-            trigger: "change"
-          }
-        ],
-        loginName: [
-          {
-            required: true,
-            message: "请输入用户名",
-            trigger: "change"
-          },
-          {
-            max: 50,
-            message: "用户名不能超过50",
-            trigger: "change"
-          }
-        ],
-        realName: [
-          {
-            required: true,
-            message: "请输入姓名",
-            trigger: "change"
-          },
-          {
-            max: 50,
-            message: "姓名不能超过50",
-            trigger: "change"
-          }
-        ],
-        code: [
-          {
-            required: true,
-            message: "请输入工号",
-            trigger: "change"
-          },
-          {
-            max: 50,
-            message: "工号不能超过50",
-            trigger: "change"
-          }
-        ],
-        roleIds: [
-          {
-            required: true,
-            validator: roleIdsValidator,
-            trigger: "change"
-          }
-        ],
-        orgId: [
-          {
-            required: true,
-            validator: orgIdValidator,
-            trigger: "change"
-          }
-        ]
-      },
-      user: {},
-      courses: [],
-      roleList: [],
-      IS_SUPER_ADMIN
-    };
-  },
-  methods: {
-    initData(val) {
-      if (val.id) {
-        this.modalForm = this.$objAssign(initModalForm, val);
-        this.modalForm.roleIds = val.roles.map(item => item.id);
-        this.modalForm.orgId = [val.orgId];
-      } else {
-        this.modalForm = { ...initModalForm };
-        this.$nextTick(() => {
-          this.$refs.modalFormComp.clearValidate();
-        });
-      }
-    },
-    visibleChange() {
-      this.initData(this.instance);
-    },
-    cancel() {
-      this.modalIsShow = false;
-    },
-    open() {
-      this.modalIsShow = true;
-    },
-    orgChange() {
-      this.$nextTick(() => {
-        this.$refs.modalFormComp.validateField("orgId");
-      });
-    },
-    async submit() {
-      const valid = await this.$refs.modalFormComp.validate().catch(() => {});
-      if (!valid) return;
-
-      if (this.isSubmit) return;
-      this.isSubmit = true;
-
-      const datas = { ...this.modalForm };
-      datas.orgId = datas.orgId.join();
-      const data = await updateUser(datas).catch(() => {});
-      this.isSubmit = false;
-      if (!data) return;
-
-      this.$message.success("修改成功!");
-      this.cancel();
-      this.$emit("modified");
-
-      // if (!this.isEdit) {
-      //   this.$emit("modified");
-      //   return;
-      // }
-
-      // // 自己把自己的角色改了之后要重新登录,重新获取权限
-      // const oldRoleIds = this.instance.roles
-      //   .map(item => item.id)
-      //   .sort((a, b) => a - b)
-      //   .join();
-      // const newRoleIds = datas.roleIds.sort((a, b) => a - b).join();
-      // if (
-      //   oldRoleIds !== newRoleIds &&
-      //   this.$ls.get("user").id === this.instance.id
-      // ) {
-      //   await logout();
-      //   this.$ls.clear();
-      //   this.$router.push({ name: "Login" });
-      //   this.$message.info("您的权限已经变更,请重新登录系统!");
-      // } else {
-      //   this.$emit("modified");
-      // }
-    }
-  }
-};
-</script>
+<template>
+  <el-dialog
+    class="modify-user"
+    :visible.sync="modalIsShow"
+    :title="title"
+    top="10vh"
+    width="500px"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    @open="visibleChange"
+  >
+    <el-form
+      ref="modalFormComp"
+      :model="modalForm"
+      :rules="rules"
+      label-position="top"
+    >
+      <el-form-item prop="loginName" label="用户名:">
+        <el-input
+          v-model.trim="modalForm.loginName"
+          placeholder="请输入用户名"
+          :disabled="isEdit"
+        ></el-input>
+      </el-form-item>
+      <el-form-item prop="realName" label="姓名:">
+        <el-input
+          v-model.trim="modalForm.realName"
+          placeholder="请输入姓名"
+          clearable
+        ></el-input>
+      </el-form-item>
+      <el-form-item prop="code" label="工号:">
+        <el-input
+          v-model.trim="modalForm.code"
+          placeholder="请输入工号"
+          clearable
+        ></el-input>
+      </el-form-item>
+      <el-form-item prop="mobileNumber" label="手机号:">
+        <el-input
+          v-model.trim="modalForm.mobileNumber"
+          placeholder="请输入手机号"
+          clearable
+        ></el-input>
+      </el-form-item>
+      <el-form-item prop="roleIds" label="角色:">
+        <el-select
+          style="width:100%;"
+          v-model="modalForm.roleIds"
+          placeholder="请选择角色"
+          multiple
+        >
+          <el-option
+            v-for="item in roles"
+            :key="item.id"
+            :value="item.id"
+            :label="item.name"
+          >
+          </el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item prop="orgId" label="所属机构:">
+        <select-orgs
+          ref="SelectOrgs"
+          v-model="modalForm.orgId"
+          :multiple="false"
+          check-strictly
+          @change="orgChange"
+        ></select-orgs>
+      </el-form-item>
+    </el-form>
+    <div slot="footer">
+      <el-button type="primary" :disabled="isSubmit" @click="submit"
+        >确认</el-button
+      >
+      <el-button @click="cancel">取消</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+import { updateUser } from "../api";
+// import { logout } from "../../login/api";
+// import { phone } from "@/plugins/formRules";
+import SelectOrgs from "./SelectOrgs";
+import { SYS_ADMIN_NAME } from "@/constants/enumerate";
+
+const initModalForm = {
+  id: "",
+  loginName: "",
+  realName: "",
+  code: "",
+  mobileNumber: "",
+  roleIds: [],
+  courseIds: [],
+  orgId: []
+};
+
+export default {
+  name: "modify-user",
+  components: { SelectOrgs },
+  props: {
+    instance: {
+      type: Object,
+      default() {
+        return {};
+      }
+    },
+    roles: {
+      type: Array,
+      default() {
+        return [];
+      }
+    }
+  },
+  computed: {
+    isEdit() {
+      return !!this.instance.id;
+    },
+    title() {
+      return (this.isEdit ? "编辑" : "新增") + "用户";
+    }
+  },
+  data() {
+    const roleIdsValidator = (rule, value, callback) => {
+      if (!value || !value.length) {
+        callback(new Error("请选择角色"));
+      } else {
+        callback();
+      }
+    };
+    const orgIdValidator = (rule, value, callback) => {
+      if (!value || !value.length) {
+        callback(new Error("请选择所属机构"));
+      } else {
+        callback();
+      }
+    };
+    const mobileNumberValidator = (rule, value, callback) => {
+      if (!value) {
+        return callback();
+      }
+
+      if (/^1\d{10}$/.test(value)) {
+        return callback();
+      } else {
+        return callback(new Error("请输入合适的手机号码"));
+      }
+    };
+
+    const IS_SUPER_ADMIN =
+      this.$ls.get("user", { loginName: "" }).loginName === SYS_ADMIN_NAME;
+
+    return {
+      modalIsShow: false,
+      isSubmit: false,
+      modalForm: {},
+      rules: {
+        mobileNumber: [
+          {
+            required: false,
+            validator: mobileNumberValidator,
+            trigger: "change"
+          }
+        ],
+        loginName: [
+          {
+            required: true,
+            message: "请输入用户名",
+            trigger: "change"
+          },
+          {
+            max: 50,
+            message: "用户名不能超过50",
+            trigger: "change"
+          }
+        ],
+        realName: [
+          {
+            required: true,
+            message: "请输入姓名",
+            trigger: "change"
+          },
+          {
+            max: 50,
+            message: "姓名不能超过50",
+            trigger: "change"
+          }
+        ],
+        code: [
+          {
+            required: true,
+            message: "请输入工号",
+            trigger: "change"
+          },
+          {
+            max: 50,
+            message: "工号不能超过50",
+            trigger: "change"
+          }
+        ],
+        roleIds: [
+          {
+            required: true,
+            validator: roleIdsValidator,
+            trigger: "change"
+          }
+        ],
+        orgId: [
+          {
+            required: true,
+            validator: orgIdValidator,
+            trigger: "change"
+          }
+        ]
+      },
+      user: {},
+      courses: [],
+      roleList: [],
+      IS_SUPER_ADMIN
+    };
+  },
+  methods: {
+    initData(val) {
+      if (val.id) {
+        this.modalForm = this.$objAssign(initModalForm, val);
+        this.modalForm.roleIds = val.roles.map(item => item.id);
+        this.modalForm.orgId = [val.orgId];
+      } else {
+        this.modalForm = { ...initModalForm };
+        this.$nextTick(() => {
+          this.$refs.modalFormComp.clearValidate();
+        });
+      }
+    },
+    visibleChange() {
+      this.initData(this.instance);
+    },
+    cancel() {
+      this.modalIsShow = false;
+    },
+    open() {
+      this.modalIsShow = true;
+    },
+    orgChange() {
+      this.$nextTick(() => {
+        this.$refs.modalFormComp.validateField("orgId");
+      });
+    },
+    async submit() {
+      const valid = await this.$refs.modalFormComp.validate().catch(() => {});
+      if (!valid) return;
+
+      if (this.isSubmit) return;
+      this.isSubmit = true;
+
+      const datas = { ...this.modalForm };
+      datas.orgId = datas.orgId.join();
+      const data = await updateUser(datas).catch(() => {});
+      this.isSubmit = false;
+      if (!data) return;
+
+      this.$message.success("修改成功!");
+      this.cancel();
+      this.$emit("modified");
+
+      // if (!this.isEdit) {
+      //   this.$emit("modified");
+      //   return;
+      // }
+
+      // // 自己把自己的角色改了之后要重新登录,重新获取权限
+      // const oldRoleIds = this.instance.roles
+      //   .map(item => item.id)
+      //   .sort((a, b) => a - b)
+      //   .join();
+      // const newRoleIds = datas.roleIds.sort((a, b) => a - b).join();
+      // if (
+      //   oldRoleIds !== newRoleIds &&
+      //   this.$ls.get("user").id === this.instance.id
+      // ) {
+      //   await logout();
+      //   this.$ls.clear();
+      //   this.$router.push({ name: "Login" });
+      //   this.$message.info("您的权限已经变更,请重新登录系统!");
+      // } else {
+      //   this.$emit("modified");
+      // }
+    }
+  }
+};
+</script>

+ 158 - 158
src/modules/base/components/SelectClassStudent.vue

@@ -1,158 +1,158 @@
-<template>
-  <div class="select-class-student">
-    <el-form ref="FilterForm" label-position="left" inline label-width="0px">
-      <el-form-item>
-        <college-select
-          v-model="filter.collegeId"
-          class="width-200"
-          placeholder="学院"
-          @change="collegeChange"
-        ></college-select>
-      </el-form-item>
-      <el-form-item>
-        <major-select
-          v-model="filter.majorId"
-          class="width-200"
-          :college-id="filter.collegeId"
-          cascader
-          placeholder="专业"
-          @change="majorChange"
-        ></major-select>
-      </el-form-item>
-      <el-form-item>
-        <class-select
-          v-model="filter.clazzId"
-          class="width-200"
-          :major-id="filter.majorId"
-          cascader
-          placeholder="班级"
-          @change="classChange"
-        ></class-select>
-      </el-form-item>
-      <el-form-item>
-        <el-button type="primary" :disabled="!canSearch" @click="toPage(1)"
-          >查询</el-button
-        >
-      </el-form-item>
-    </el-form>
-    <div class="box-justify mb-2">
-      <p>
-        全部共<span class="mlr-1">{{ dataList.length }}</span
-        >人
-      </p>
-      <p>
-        已选<span class="mlr-1">{{ multipleSelection.length }}</span
-        >人
-      </p>
-    </div>
-    <el-table
-      ref="TableList"
-      :data="dataList"
-      border
-      max-height="440"
-      @selection-change="handleSelectionChange"
-    >
-      <el-table-column
-        type="selection"
-        width="55"
-        align="center"
-      ></el-table-column>
-      <el-table-column
-        type="index"
-        label="序号"
-        width="70"
-        :index="indexMethod"
-      ></el-table-column>
-      <el-table-column prop="studentName" label="姓名"></el-table-column>
-      <el-table-column prop="studentCode" label="学号"></el-table-column>
-      <el-table-column prop="collegeName" label="学院"></el-table-column>
-      <el-table-column prop="majorName" label="专业"></el-table-column>
-      <el-table-column prop="clazzName" label="班级"></el-table-column>
-    </el-table>
-  </div>
-</template>
-
-<script>
-// import { studentListQuery } from "../api";
-import { unitQueryByType } from "../../base/api";
-
-export default {
-  name: "select-class-student",
-  props: {
-    value: {
-      type: Array,
-      default() {
-        return [];
-      }
-    }
-  },
-  data() {
-    return {
-      filter: {
-        collegeId: "",
-        majorId: "",
-        clazzId: ""
-      },
-      filterNames: {
-        collegeName: "",
-        majorName: "",
-        clazzName: ""
-      },
-      dataList: [],
-      multipleSelection: []
-    };
-  },
-  computed: {
-    canSearch() {
-      return (
-        this.filter.collegeId && this.filter.majorId && this.filter.clazzId
-      );
-    }
-  },
-  methods: {
-    async getList() {
-      const datas = {
-        ...this.filter
-      };
-      const data = await unitQueryByType(datas, "STUDENT");
-      this.dataList = data || [];
-      this.dataList = this.dataList.map(item => {
-        return {
-          id: item.id,
-          studentName: item.name,
-          studentCode: item.code,
-          ...this.filterNames
-        };
-      });
-    },
-    toPage(page) {
-      if (!this.canSearch) return;
-
-      this.current = page;
-      this.getList();
-      this.multipleSelection = [];
-      this.emitChange();
-    },
-    handleSelectionChange(val) {
-      this.multipleSelection = val.map(item => item.id);
-      this.emitChange();
-    },
-    collegeChange(val) {
-      this.filterNames.collegeName = val.name;
-    },
-    majorChange(val) {
-      this.filterNames.majorName = val.name;
-    },
-    classChange(val) {
-      this.filterNames.clazzName = val.name;
-    },
-    emitChange() {
-      this.$emit("input", this.multipleSelection);
-      this.$emit("change", this.multipleSelection);
-    },
-    clearSelection() {
-      this.$refs.TableList.clearSelection();
-    }
-  }
-};
-</script>
+<template>
+  <div class="select-class-student">
+    <el-form ref="FilterForm" label-position="left" inline label-width="0px">
+      <el-form-item>
+        <college-select
+          v-model="filter.collegeId"
+          class="width-200"
+          placeholder="机构"
+          @change="collegeChange"
+        ></college-select>
+      </el-form-item>
+      <el-form-item>
+        <major-select
+          v-model="filter.majorId"
+          class="width-200"
+          :college-id="filter.collegeId"
+          cascader
+          placeholder="专业"
+          @change="majorChange"
+        ></major-select>
+      </el-form-item>
+      <el-form-item>
+        <class-select
+          v-model="filter.clazzId"
+          class="width-200"
+          :major-id="filter.majorId"
+          cascader
+          placeholder="班级"
+          @change="classChange"
+        ></class-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" :disabled="!canSearch" @click="toPage(1)"
+          >查询</el-button
+        >
+      </el-form-item>
+    </el-form>
+    <div class="box-justify mb-2">
+      <p>
+        全部共<span class="mlr-1">{{ dataList.length }}</span
+        >人
+      </p>
+      <p>
+        已选<span class="mlr-1">{{ multipleSelection.length }}</span
+        >人
+      </p>
+    </div>
+    <el-table
+      ref="TableList"
+      :data="dataList"
+      border
+      max-height="440"
+      @selection-change="handleSelectionChange"
+    >
+      <el-table-column
+        type="selection"
+        width="55"
+        align="center"
+      ></el-table-column>
+      <el-table-column
+        type="index"
+        label="序号"
+        width="70"
+        :index="indexMethod"
+      ></el-table-column>
+      <el-table-column prop="studentName" label="姓名"></el-table-column>
+      <el-table-column prop="studentCode" label="学号"></el-table-column>
+      <el-table-column prop="collegeName" label="机构"></el-table-column>
+      <el-table-column prop="majorName" label="专业"></el-table-column>
+      <el-table-column prop="clazzName" label="班级"></el-table-column>
+    </el-table>
+  </div>
+</template>
+
+<script>
+// import { studentListQuery } from "../api";
+import { unitQueryByType } from "../../base/api";
+
+export default {
+  name: "select-class-student",
+  props: {
+    value: {
+      type: Array,
+      default() {
+        return [];
+      }
+    }
+  },
+  data() {
+    return {
+      filter: {
+        collegeId: "",
+        majorId: "",
+        clazzId: ""
+      },
+      filterNames: {
+        collegeName: "",
+        majorName: "",
+        clazzName: ""
+      },
+      dataList: [],
+      multipleSelection: []
+    };
+  },
+  computed: {
+    canSearch() {
+      return (
+        this.filter.collegeId && this.filter.majorId && this.filter.clazzId
+      );
+    }
+  },
+  methods: {
+    async getList() {
+      const datas = {
+        ...this.filter
+      };
+      const data = await unitQueryByType(datas, "STUDENT");
+      this.dataList = data || [];
+      this.dataList = this.dataList.map(item => {
+        return {
+          id: item.id,
+          studentName: item.name,
+          studentCode: item.code,
+          ...this.filterNames
+        };
+      });
+    },
+    toPage(page) {
+      if (!this.canSearch) return;
+
+      this.current = page;
+      this.getList();
+      this.multipleSelection = [];
+      this.emitChange();
+    },
+    handleSelectionChange(val) {
+      this.multipleSelection = val.map(item => item.id);
+      this.emitChange();
+    },
+    collegeChange(val) {
+      this.filterNames.collegeName = val.name;
+    },
+    majorChange(val) {
+      this.filterNames.majorName = val.name;
+    },
+    classChange(val) {
+      this.filterNames.clazzName = val.name;
+    },
+    emitChange() {
+      this.$emit("input", this.multipleSelection);
+      this.$emit("change", this.multipleSelection);
+    },
+    clearSelection() {
+      this.$refs.TableList.clearSelection();
+    }
+  }
+};
+</script>

+ 219 - 219
src/modules/base/views/ApproveRecordManage.vue

@@ -1,219 +1,219 @@
-<template>
-  <div class="approve-record-manage">
-    <div class="part-box part-box-filter part-box-border">
-      <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
-        <template v-if="checkPrivilege('condition', 'condition')">
-          <el-form-item label="状态:">
-            <el-select
-              v-model="filter.status"
-              style="width: 120px;"
-              placeholder="请选择状态"
-              clearable
-            >
-              <el-option
-                v-for="(val, key) in AUDITING_STATUS"
-                :key="key"
-                :value="key"
-                :label="val"
-              ></el-option>
-            </el-select>
-          </el-form-item>
-          <el-form-item label="教研室:">
-            <teaching-room-select
-              v-model="filter.teachingRoomId"
-              placeholder="所属教研室"
-              clearable
-            ></teaching-room-select>
-          </el-form-item>
-          <el-form-item label="提交人:">
-            <el-input
-              style="width: 142px;"
-              v-model.trim="filter.teacherUserName"
-              placeholder="请输入提交人"
-              clearable
-            ></el-input>
-          </el-form-item>
-          <el-form-item label="提交时间:">
-            <el-date-picker
-              v-model="createTime"
-              type="datetimerange"
-              :picker-options="pickerOptions"
-              range-separator="至"
-              start-placeholder="提交开始时间"
-              end-placeholder="提交结束时间"
-              value-format="timestamp"
-              align="right"
-              unlink-panels
-            >
-            </el-date-picker>
-          </el-form-item>
-          <el-form-item label="当前处理人:">
-            <el-input
-              style="width: 142px;"
-              v-model.trim="filter.pendApproveUserName"
-              placeholder="请输入当前处理人"
-              clearable
-            ></el-input>
-          </el-form-item>
-        </template>
-        <el-form-item label-width="0px">
-          <el-button
-            v-if="checkPrivilege('button', 'select')"
-            type="primary"
-            @click="toPage(1)"
-            >查询</el-button
-          >
-        </el-form-item>
-      </el-form>
-    </div>
-
-    <div class="part-box part-box-pad">
-      <el-table ref="TableList" :data="dataList">
-        <el-table-column
-          type="index"
-          label="序号"
-          width="70"
-          :index="indexMethod"
-        ></el-table-column>
-        <el-table-column
-          prop="teacherUserName"
-          label="提交人"
-        ></el-table-column>
-        <el-table-column prop="createTime" label="提交时间">
-          <span slot-scope="scope">{{
-            scope.row.createTime | timestampFilter
-          }}</span>
-        </el-table-column>
-        <el-table-column prop="statusStr" label="流程状态"></el-table-column>
-        <el-table-column prop="setupStr" label="当前节点"></el-table-column>
-        <el-table-column prop="pendApproveUserName" label="当前处理人">
-        </el-table-column>
-        <el-table-column class-name="action-column" label="操作" width="120px">
-          <template slot-scope="scope">
-            <el-button
-              v-if="checkPrivilege('link', 'preview')"
-              class="btn-primary"
-              type="text"
-              @click="toPreview(scope.row)"
-              >查看</el-button
-            >
-            <el-button
-              v-if="checkPrivilege('link', 'delete')"
-              class="btn-danger"
-              type="text"
-              @click="toDelete(scope.row)"
-              >删除</el-button
-            >
-          </template>
-        </el-table-column>
-      </el-table>
-      <div class="part-page">
-        <el-pagination
-          background
-          layout="total,prev, pager, next"
-          :current-page="current"
-          :total="total"
-          :page-size="size"
-          @current-change="toPage"
-        >
-        </el-pagination>
-      </div>
-    </div>
-
-    <!-- ModifyTaskApply -->
-    <modify-task-apply
-      ref="ModifyTaskApply"
-      edit-type="PREVIEW"
-      :instance="curExamTask"
-    ></modify-task-apply>
-  </div>
-</template>
-
-<script>
-import { approveRecordListPage, deleteApproveRecord } from "../api";
-import { examTaskGetOne } from "../../exam/api";
-import { AUDITING_STATUS } from "@/constants/enumerate";
-import pickerOptions from "@/constants/datePickerOptions";
-import ModifyTaskApply from "../../exam/components/ModifyTaskApply";
-
-export default {
-  name: "approve-record-manage",
-  components: { ModifyTaskApply },
-  data() {
-    return {
-      filter: {
-        status: "",
-        teachingRoomId: "",
-        teacherUserName: "",
-        pendApproveUserName: "",
-        startTime: null,
-        endTime: null
-      },
-      current: 1,
-      size: this.GLOBAL.pageSize,
-      total: 0,
-      dataList: [],
-      AUDITING_STATUS,
-      curExamTask: {},
-      // date-picker
-      createTime: [],
-      pickerOptions
-    };
-  },
-  mounted() {
-    this.toPage(1);
-  },
-  methods: {
-    async getList() {
-      if (!this.checkPrivilege("list", "list")) return;
-
-      const datas = {
-        ...this.filter,
-        pageNumber: this.current,
-        pageSize: this.size
-      };
-      if (this.createTime) {
-        datas.startTime = this.createTime[0];
-        datas.endTime = this.createTime[1];
-      }
-      const data = await approveRecordListPage(datas);
-      this.dataList = data.records;
-      this.total = data.total;
-    },
-    toPage(page) {
-      this.current = page;
-      this.getList();
-    },
-    async toPreview(row) {
-      const types = {
-        exam_task: this.previewExmaTask
-      };
-
-      const func = types[row.objectTable];
-      if (!func) {
-        this.$message.error("操作错误!");
-        return;
-      }
-      func(row);
-    },
-    async previewExmaTask(data) {
-      this.curExamTask = await examTaskGetOne(data.objectId);
-      this.$refs.ModifyTaskApply.open();
-    },
-    toDelete(row) {
-      this.$confirm(`确定要删除当前记录吗?`, "提示", {
-        type: "warning"
-      })
-        .then(async () => {
-          await deleteApproveRecord({
-            id: row.id,
-            enable: 0
-          });
-          this.$message.success("操作成功!");
-          this.getList();
-        })
-        .catch(() => {});
-    }
-  }
-};
-</script>
+<template>
+  <div class="approve-record-manage">
+    <div class="part-box part-box-filter part-box-border">
+      <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
+        <template v-if="checkPrivilege('condition', 'condition')">
+          <el-form-item label="状态:">
+            <el-select
+              v-model="filter.status"
+              style="width: 120px;"
+              placeholder="请选择状态"
+              clearable
+            >
+              <el-option
+                v-for="(val, key) in AUDITING_STATUS"
+                :key="key"
+                :value="key"
+                :label="val"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+          <el-form-item label="机构:">
+            <teaching-room-select
+              v-model="filter.teachingRoomId"
+              placeholder="所属机构"
+              clearable
+            ></teaching-room-select>
+          </el-form-item>
+          <el-form-item label="提交人:">
+            <el-input
+              style="width: 142px;"
+              v-model.trim="filter.teacherUserName"
+              placeholder="请输入提交人"
+              clearable
+            ></el-input>
+          </el-form-item>
+          <el-form-item label="提交时间:">
+            <el-date-picker
+              v-model="createTime"
+              type="datetimerange"
+              :picker-options="pickerOptions"
+              range-separator="至"
+              start-placeholder="提交开始时间"
+              end-placeholder="提交结束时间"
+              value-format="timestamp"
+              align="right"
+              unlink-panels
+            >
+            </el-date-picker>
+          </el-form-item>
+          <el-form-item label="当前处理人:">
+            <el-input
+              style="width: 142px;"
+              v-model.trim="filter.pendApproveUserName"
+              placeholder="请输入当前处理人"
+              clearable
+            ></el-input>
+          </el-form-item>
+        </template>
+        <el-form-item label-width="0px">
+          <el-button
+            v-if="checkPrivilege('button', 'select')"
+            type="primary"
+            @click="toPage(1)"
+            >查询</el-button
+          >
+        </el-form-item>
+      </el-form>
+    </div>
+
+    <div class="part-box part-box-pad">
+      <el-table ref="TableList" :data="dataList">
+        <el-table-column
+          type="index"
+          label="序号"
+          width="70"
+          :index="indexMethod"
+        ></el-table-column>
+        <el-table-column
+          prop="teacherUserName"
+          label="提交人"
+        ></el-table-column>
+        <el-table-column prop="createTime" label="提交时间">
+          <span slot-scope="scope">{{
+            scope.row.createTime | timestampFilter
+          }}</span>
+        </el-table-column>
+        <el-table-column prop="statusStr" label="流程状态"></el-table-column>
+        <el-table-column prop="setupStr" label="当前节点"></el-table-column>
+        <el-table-column prop="pendApproveUserName" label="当前处理人">
+        </el-table-column>
+        <el-table-column class-name="action-column" label="操作" width="120px">
+          <template slot-scope="scope">
+            <el-button
+              v-if="checkPrivilege('link', 'preview')"
+              class="btn-primary"
+              type="text"
+              @click="toPreview(scope.row)"
+              >查看</el-button
+            >
+            <el-button
+              v-if="checkPrivilege('link', 'delete')"
+              class="btn-danger"
+              type="text"
+              @click="toDelete(scope.row)"
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="part-page">
+        <el-pagination
+          background
+          layout="total,prev, pager, next"
+          :current-page="current"
+          :total="total"
+          :page-size="size"
+          @current-change="toPage"
+        >
+        </el-pagination>
+      </div>
+    </div>
+
+    <!-- ModifyTaskApply -->
+    <modify-task-apply
+      ref="ModifyTaskApply"
+      edit-type="PREVIEW"
+      :instance="curExamTask"
+    ></modify-task-apply>
+  </div>
+</template>
+
+<script>
+import { approveRecordListPage, deleteApproveRecord } from "../api";
+import { examTaskGetOne } from "../../exam/api";
+import { AUDITING_STATUS } from "@/constants/enumerate";
+import pickerOptions from "@/constants/datePickerOptions";
+import ModifyTaskApply from "../../exam/components/ModifyTaskApply";
+
+export default {
+  name: "approve-record-manage",
+  components: { ModifyTaskApply },
+  data() {
+    return {
+      filter: {
+        status: "",
+        teachingRoomId: "",
+        teacherUserName: "",
+        pendApproveUserName: "",
+        startTime: null,
+        endTime: null
+      },
+      current: 1,
+      size: this.GLOBAL.pageSize,
+      total: 0,
+      dataList: [],
+      AUDITING_STATUS,
+      curExamTask: {},
+      // date-picker
+      createTime: [],
+      pickerOptions
+    };
+  },
+  mounted() {
+    this.toPage(1);
+  },
+  methods: {
+    async getList() {
+      if (!this.checkPrivilege("list", "list")) return;
+
+      const datas = {
+        ...this.filter,
+        pageNumber: this.current,
+        pageSize: this.size
+      };
+      if (this.createTime) {
+        datas.startTime = this.createTime[0];
+        datas.endTime = this.createTime[1];
+      }
+      const data = await approveRecordListPage(datas);
+      this.dataList = data.records;
+      this.total = data.total;
+    },
+    toPage(page) {
+      this.current = page;
+      this.getList();
+    },
+    async toPreview(row) {
+      const types = {
+        exam_task: this.previewExmaTask
+      };
+
+      const func = types[row.objectTable];
+      if (!func) {
+        this.$message.error("操作错误!");
+        return;
+      }
+      func(row);
+    },
+    async previewExmaTask(data) {
+      this.curExamTask = await examTaskGetOne(data.objectId);
+      this.$refs.ModifyTaskApply.open();
+    },
+    toDelete(row) {
+      this.$confirm(`确定要删除当前记录吗?`, "提示", {
+        type: "warning"
+      })
+        .then(async () => {
+          await deleteApproveRecord({
+            id: row.id,
+            enable: 0
+          });
+          this.$message.success("操作成功!");
+          this.getList();
+        })
+        .catch(() => {});
+    }
+  }
+};
+</script>

+ 268 - 268
src/modules/base/views/CardManage.vue

@@ -1,268 +1,268 @@
-<template>
-  <div class="card-manage">
-    <div class="part-box part-box-filter part-box-flex">
-      <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
-        <template v-if="checkPrivilege('condition', 'condition')">
-          <el-form-item label="题卡名称:">
-            <el-input
-              v-model.trim="filter.title"
-              placeholder="名称"
-              clearable
-            ></el-input>
-          </el-form-item>
-          <el-form-item label="创建方式:" label-width="90px">
-            <el-select
-              v-model="filter.createMethod"
-              style="width: 120px;"
-              placeholder="创建方式"
-              clearable
-            >
-              <el-option
-                v-for="(val, key) in CARD_CREATE_METHOD_TYPE"
-                :key="key"
-                :value="key"
-                :label="val"
-              ></el-option>
-            </el-select>
-          </el-form-item>
-          <el-form-item label="创建时间:">
-            <el-date-picker
-              v-model="createTime"
-              type="datetimerange"
-              :picker-options="pickerOptions"
-              range-separator="至"
-              start-placeholder="创建开始时间"
-              end-placeholder="创建结束时间"
-              value-format="timestamp"
-              align="right"
-              unlink-panels
-            >
-            </el-date-picker>
-          </el-form-item>
-        </template>
-        <el-form-item>
-          <el-button
-            v-if="checkPrivilege('button', 'select')"
-            type="primary"
-            @click="toPage(1)"
-            >查询</el-button
-          >
-        </el-form-item>
-      </el-form>
-      <div class="part-box-action">
-        <el-button
-          v-if="checkPrivilege('button', 'add')"
-          type="primary"
-          icon="el-icon-circle-plus-outline"
-          @click="toAdd"
-          >添加题卡</el-button
-        >
-      </div>
-    </div>
-    <div class="part-box part-box-pad">
-      <el-table ref="TableList" :data="cardList">
-        <el-table-column
-          type="index"
-          label="序号"
-          width="70"
-          :index="indexMethod"
-        ></el-table-column>
-        <el-table-column prop="title" label="题卡名称"></el-table-column>
-        <el-table-column prop="type" label="类型">
-          <span slot-scope="scope">{{ scope.row.type | cardTypeFilter }}</span>
-        </el-table-column>
-        <el-table-column prop="orgNames" label="适用学院">
-          <template slot-scope="scope">
-            <more-text :data="scope.row.orgNames"></more-text>
-          </template>
-        </el-table-column>
-        <el-table-column prop="createMethod" label="创建方式">
-          <span slot-scope="scope">{{
-            scope.row.createMethod | cardCreateMethodTypeFilter
-          }}</span>
-        </el-table-column>
-        <el-table-column prop="status" label="状态">
-          <span
-            :class="{ 'color-danger': scope.row.status !== 'SUBMIT' }"
-            slot-scope="scope"
-            >{{ scope.row.status === "SUBMIT" ? "提交" : "暂存" }}</span
-          >
-        </el-table-column>
-        <el-table-column prop="remark" label="备注">
-          <span slot-scope="scope">{{
-            scope.row.remark | defaultFieldFilter
-          }}</span>
-        </el-table-column>
-        <el-table-column prop="createTime" label="创建时间" width="180">
-          <span slot-scope="scope">{{
-            scope.row.createTime | timestampFilter
-          }}</span>
-        </el-table-column>
-        <el-table-column class-name="action-column" label="操作" width="140">
-          <template slot-scope="scope">
-            <el-button
-              v-if="!checkPrivilege('link', 'preview')"
-              class="btn-primary"
-              type="text"
-              @click="toPreview(scope.row)"
-              >查看</el-button
-            >
-            <el-button
-              v-if="
-                checkPrivilege('link', 'edit') &&
-                  scope.row.createMethod !== 'UPLOAD'
-              "
-              class="btn-primary"
-              type="text"
-              @click="toEditCard(scope.row)"
-              >编辑题卡</el-button
-            >
-            <el-button
-              v-if="checkPrivilege('link', 'edit')"
-              class="btn-primary"
-              type="text"
-              @click="toEditInfo(scope.row)"
-              >编辑信息</el-button
-            >
-            <el-button
-              v-if="checkPrivilege('link', 'delete')"
-              class="btn-danger"
-              type="text"
-              @click="toDelete(scope.row)"
-              >删除</el-button
-            >
-          </template>
-        </el-table-column>
-      </el-table>
-      <div class="part-page">
-        <el-pagination
-          background
-          layout="total,prev, pager, next"
-          :current-page="current"
-          :total="total"
-          :page-size="size"
-          @current-change="toPage"
-        >
-        </el-pagination>
-      </div>
-    </div>
-
-    <!-- ModifyCardInfo -->
-    <modify-card-info
-      ref="ModifyCardInfo"
-      :instance="curCard"
-      @new-card="toNewCard"
-      @modified="getList"
-    ></modify-card-info>
-    <!-- ModifyCard -->
-    <modify-card ref="ModifyCard" @modified="getList"></modify-card>
-  </div>
-</template>
-
-<script>
-import { CARD_CREATE_METHOD_TYPE } from "../../../constants/enumerate";
-import { cardListPage, deleteCard } from "../api";
-import ModifyCardInfo from "../components/ModifyCardInfo";
-import pickerOptions from "@/constants/datePickerOptions";
-import ModifyCard from "../../card/components/ModifyCard";
-
-export default {
-  name: "card-manage",
-  components: { ModifyCardInfo, ModifyCard },
-  data() {
-    return {
-      filter: {
-        title: "",
-        createMethod: "",
-        createStartTime: "",
-        createEndTime: ""
-      },
-      current: 1,
-      size: this.GLOBAL.pageSize,
-      total: 0,
-      CARD_CREATE_METHOD_TYPE,
-      cardList: [],
-      curCard: {},
-      // date-picker
-      createTime: [],
-      pickerOptions
-    };
-  },
-  mounted() {
-    this.getList();
-  },
-  methods: {
-    async getList() {
-      if (!this.checkPrivilege("list", "list")) return;
-
-      const datas = {
-        ...this.filter,
-        pageNumber: this.current,
-        pageSize: this.size
-      };
-      if (this.createTime) {
-        datas.createStartTime = this.createTime[0];
-        datas.createEndTime = this.createTime[1];
-      }
-      const data = await cardListPage(datas);
-      this.cardList = data.records.map(item => {
-        item.orgNames = item.orgs.map(org => org.name);
-        return item;
-      });
-      this.total = data.total;
-    },
-    toPage(page) {
-      this.current = page;
-      this.getList();
-    },
-    toAdd() {
-      this.curCard = {};
-      this.$refs.ModifyCardInfo.open();
-    },
-    toPreview(row) {
-      window.open(
-        this.getRouterPath({
-          name: "CardPreview",
-          params: {
-            cardId: row.id,
-            viewType: "view"
-          }
-        })
-      );
-    },
-    toNewCard(data) {
-      this.$ls.set("prepareTcPCard", data);
-      this.$refs.ModifyCard.open();
-    },
-    toEditCard(row) {
-      this.curCard = row;
-      this.$ls.set("prepareTcPCard", {
-        id: row.id,
-        title: row.title,
-        type: row.type,
-        createMethod: row.createMethod,
-        remark: row.remark,
-        cardRuleId: row.cardRuleId,
-        attachmentId: row.attachmentId,
-        orgIds: row.orgs.map(item => item.id)
-      });
-      this.$refs.ModifyCard.open();
-    },
-    toEditInfo(row) {
-      this.curCard = row;
-      this.$refs.ModifyCardInfo.open();
-    },
-    toDelete(row) {
-      this.$confirm(`确定要删除题卡【${row.title}】吗?`, "提示", {
-        type: "warning"
-      })
-        .then(async () => {
-          await deleteCard(row.id);
-          this.$message.success("删除成功!");
-          this.deletePageLastItem();
-        })
-        .catch(() => {});
-    }
-  }
-};
-</script>
+<template>
+  <div class="card-manage">
+    <div class="part-box part-box-filter part-box-flex">
+      <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
+        <template v-if="checkPrivilege('condition', 'condition')">
+          <el-form-item label="题卡名称:">
+            <el-input
+              v-model.trim="filter.title"
+              placeholder="名称"
+              clearable
+            ></el-input>
+          </el-form-item>
+          <el-form-item label="创建方式:" label-width="90px">
+            <el-select
+              v-model="filter.createMethod"
+              style="width: 120px;"
+              placeholder="创建方式"
+              clearable
+            >
+              <el-option
+                v-for="(val, key) in CARD_CREATE_METHOD_TYPE"
+                :key="key"
+                :value="key"
+                :label="val"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+          <el-form-item label="创建时间:">
+            <el-date-picker
+              v-model="createTime"
+              type="datetimerange"
+              :picker-options="pickerOptions"
+              range-separator="至"
+              start-placeholder="创建开始时间"
+              end-placeholder="创建结束时间"
+              value-format="timestamp"
+              align="right"
+              unlink-panels
+            >
+            </el-date-picker>
+          </el-form-item>
+        </template>
+        <el-form-item>
+          <el-button
+            v-if="checkPrivilege('button', 'select')"
+            type="primary"
+            @click="toPage(1)"
+            >查询</el-button
+          >
+        </el-form-item>
+      </el-form>
+      <div class="part-box-action">
+        <el-button
+          v-if="checkPrivilege('button', 'add')"
+          type="primary"
+          icon="el-icon-circle-plus-outline"
+          @click="toAdd"
+          >添加题卡</el-button
+        >
+      </div>
+    </div>
+    <div class="part-box part-box-pad">
+      <el-table ref="TableList" :data="cardList">
+        <el-table-column
+          type="index"
+          label="序号"
+          width="70"
+          :index="indexMethod"
+        ></el-table-column>
+        <el-table-column prop="title" label="题卡名称"></el-table-column>
+        <el-table-column prop="type" label="类型">
+          <span slot-scope="scope">{{ scope.row.type | cardTypeFilter }}</span>
+        </el-table-column>
+        <el-table-column prop="orgNames" label="适用机构">
+          <template slot-scope="scope">
+            <more-text :data="scope.row.orgNames"></more-text>
+          </template>
+        </el-table-column>
+        <el-table-column prop="createMethod" label="创建方式">
+          <span slot-scope="scope">{{
+            scope.row.createMethod | cardCreateMethodTypeFilter
+          }}</span>
+        </el-table-column>
+        <el-table-column prop="status" label="状态">
+          <span
+            :class="{ 'color-danger': scope.row.status !== 'SUBMIT' }"
+            slot-scope="scope"
+            >{{ scope.row.status === "SUBMIT" ? "提交" : "暂存" }}</span
+          >
+        </el-table-column>
+        <el-table-column prop="remark" label="备注">
+          <span slot-scope="scope">{{
+            scope.row.remark | defaultFieldFilter
+          }}</span>
+        </el-table-column>
+        <el-table-column prop="createTime" label="创建时间" width="180">
+          <span slot-scope="scope">{{
+            scope.row.createTime | timestampFilter
+          }}</span>
+        </el-table-column>
+        <el-table-column class-name="action-column" label="操作" width="140">
+          <template slot-scope="scope">
+            <el-button
+              v-if="!checkPrivilege('link', 'preview')"
+              class="btn-primary"
+              type="text"
+              @click="toPreview(scope.row)"
+              >查看</el-button
+            >
+            <el-button
+              v-if="
+                checkPrivilege('link', 'edit') &&
+                  scope.row.createMethod !== 'UPLOAD'
+              "
+              class="btn-primary"
+              type="text"
+              @click="toEditCard(scope.row)"
+              >编辑题卡</el-button
+            >
+            <el-button
+              v-if="checkPrivilege('link', 'edit')"
+              class="btn-primary"
+              type="text"
+              @click="toEditInfo(scope.row)"
+              >编辑信息</el-button
+            >
+            <el-button
+              v-if="checkPrivilege('link', 'delete')"
+              class="btn-danger"
+              type="text"
+              @click="toDelete(scope.row)"
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="part-page">
+        <el-pagination
+          background
+          layout="total,prev, pager, next"
+          :current-page="current"
+          :total="total"
+          :page-size="size"
+          @current-change="toPage"
+        >
+        </el-pagination>
+      </div>
+    </div>
+
+    <!-- ModifyCardInfo -->
+    <modify-card-info
+      ref="ModifyCardInfo"
+      :instance="curCard"
+      @new-card="toNewCard"
+      @modified="getList"
+    ></modify-card-info>
+    <!-- ModifyCard -->
+    <modify-card ref="ModifyCard" @modified="getList"></modify-card>
+  </div>
+</template>
+
+<script>
+import { CARD_CREATE_METHOD_TYPE } from "../../../constants/enumerate";
+import { cardListPage, deleteCard } from "../api";
+import ModifyCardInfo from "../components/ModifyCardInfo";
+import pickerOptions from "@/constants/datePickerOptions";
+import ModifyCard from "../../card/components/ModifyCard";
+
+export default {
+  name: "card-manage",
+  components: { ModifyCardInfo, ModifyCard },
+  data() {
+    return {
+      filter: {
+        title: "",
+        createMethod: "",
+        createStartTime: "",
+        createEndTime: ""
+      },
+      current: 1,
+      size: this.GLOBAL.pageSize,
+      total: 0,
+      CARD_CREATE_METHOD_TYPE,
+      cardList: [],
+      curCard: {},
+      // date-picker
+      createTime: [],
+      pickerOptions
+    };
+  },
+  mounted() {
+    this.getList();
+  },
+  methods: {
+    async getList() {
+      if (!this.checkPrivilege("list", "list")) return;
+
+      const datas = {
+        ...this.filter,
+        pageNumber: this.current,
+        pageSize: this.size
+      };
+      if (this.createTime) {
+        datas.createStartTime = this.createTime[0];
+        datas.createEndTime = this.createTime[1];
+      }
+      const data = await cardListPage(datas);
+      this.cardList = data.records.map(item => {
+        item.orgNames = item.orgs.map(org => org.name);
+        return item;
+      });
+      this.total = data.total;
+    },
+    toPage(page) {
+      this.current = page;
+      this.getList();
+    },
+    toAdd() {
+      this.curCard = {};
+      this.$refs.ModifyCardInfo.open();
+    },
+    toPreview(row) {
+      window.open(
+        this.getRouterPath({
+          name: "CardPreview",
+          params: {
+            cardId: row.id,
+            viewType: "view"
+          }
+        })
+      );
+    },
+    toNewCard(data) {
+      this.$ls.set("prepareTcPCard", data);
+      this.$refs.ModifyCard.open();
+    },
+    toEditCard(row) {
+      this.curCard = row;
+      this.$ls.set("prepareTcPCard", {
+        id: row.id,
+        title: row.title,
+        type: row.type,
+        createMethod: row.createMethod,
+        remark: row.remark,
+        cardRuleId: row.cardRuleId,
+        attachmentId: row.attachmentId,
+        orgIds: row.orgs.map(item => item.id)
+      });
+      this.$refs.ModifyCard.open();
+    },
+    toEditInfo(row) {
+      this.curCard = row;
+      this.$refs.ModifyCardInfo.open();
+    },
+    toDelete(row) {
+      this.$confirm(`确定要删除题卡【${row.title}】吗?`, "提示", {
+        type: "warning"
+      })
+        .then(async () => {
+          await deleteCard(row.id);
+          this.$message.success("删除成功!");
+          this.deletePageLastItem();
+        })
+        .catch(() => {});
+    }
+  }
+};
+</script>

+ 292 - 292
src/modules/base/views/CardRuleManage.vue

@@ -1,292 +1,292 @@
-<template>
-  <div class="card-rule-manage">
-    <div class="part-box part-box-filter part-box-flex">
-      <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
-        <template v-if="checkPrivilege('condition', 'condition')">
-          <el-form-item label="规则名称:">
-            <el-input
-              style="width: 142px;"
-              v-model.trim="filter.name"
-              placeholder="规则名称"
-              clearable
-            ></el-input>
-          </el-form-item>
-          <el-form-item label="创建时间:">
-            <el-date-picker
-              v-model="createTime"
-              type="datetimerange"
-              :picker-options="pickerOptions"
-              range-separator="至"
-              start-placeholder="创建开始时间"
-              end-placeholder="创建结束时间"
-              value-format="timestamp"
-              align="right"
-              unlink-panels
-            >
-            </el-date-picker>
-          </el-form-item>
-          <el-form-item label="启用/禁用:" label-width="90px">
-            <el-select
-              v-model="filter.enable"
-              style="width: 120px;"
-              placeholder="启用/禁用"
-              clearable
-            >
-              <el-option
-                v-for="(val, key) in ABLE_TYPE"
-                :key="key"
-                :value="key * 1"
-                :label="val"
-              ></el-option>
-            </el-select>
-          </el-form-item>
-        </template>
-        <el-form-item>
-          <el-button
-            v-if="checkPrivilege('button', 'select')"
-            type="primary"
-            @click="toPage(1)"
-            >查询</el-button
-          >
-        </el-form-item>
-      </el-form>
-      <div class="part-box-action">
-        <el-button
-          v-if="checkPrivilege('button', 'add')"
-          type="primary"
-          icon="el-icon-circle-plus-outline"
-          @click="toAdd"
-          >添加</el-button
-        >
-      </div>
-    </div>
-    <div class="part-box part-box-pad">
-      <el-table ref="TableList" :data="rules">
-        <el-table-column
-          type="index"
-          label="序号"
-          width="70"
-          :index="indexMethod"
-        ></el-table-column>
-        <el-table-column prop="name" label="题卡规则名称"></el-table-column>
-        <el-table-column prop="orgs" label="适用学院">
-          <template slot-scope="scope">
-            <more-text :data="scope.row.orgNames"></more-text>
-          </template>
-        </el-table-column>
-        <el-table-column prop="remark" label="备注">
-          <span slot-scope="scope">{{
-            scope.row.remark | defaultFieldFilter
-          }}</span>
-        </el-table-column>
-        <el-table-column prop="enable" label="启用/禁用" width="100">
-          <template slot-scope="scope">
-            {{ scope.row.enable | enableFilter }}
-          </template>
-        </el-table-column>
-        <el-table-column prop="createTime" label="创建时间" width="180">
-          <span slot-scope="scope">{{
-            scope.row.createTime | timestampFilter
-          }}</span>
-        </el-table-column>
-        <el-table-column class-name="action-column" label="操作" width="140">
-          <template slot-scope="scope">
-            <el-button
-              v-if="checkPrivilege('link', 'preview')"
-              class="btn-primary"
-              type="text"
-              @click="toDetail(scope.row)"
-              >查看</el-button
-            >
-            <el-button
-              v-if="checkPrivilege('link', 'edit')"
-              class="btn-primary"
-              type="text"
-              @click="toEdit(scope.row)"
-              >编辑</el-button
-            >
-            <el-button
-              v-if="checkPrivilege('link', 'enable')"
-              :class="scope.row.enable ? 'btn-danger' : 'btn-primary'"
-              type="text"
-              @click="toEnable(scope.row)"
-              >{{ scope.row.enable ? "禁用" : "启用" }}</el-button
-            >
-          </template>
-        </el-table-column>
-      </el-table>
-      <div class="part-page">
-        <el-pagination
-          background
-          layout="total,prev, pager, next"
-          :current-page="current"
-          :total="total"
-          :page-size="size"
-          @current-change="toPage"
-        >
-        </el-pagination>
-      </div>
-    </div>
-    <!-- ModifyCardRule -->
-    <modify-card-rule
-      ref="ModifyCardRule"
-      :instance="curRule"
-      :edit-type="editType"
-      @modified="getList"
-    ></modify-card-rule>
-  </div>
-</template>
-
-<script>
-import { ABLE_TYPE } from "@/constants/enumerate";
-import { examRuleDetail, cardRuleListPage, ableCardRule } from "../api";
-import { getEnums } from "../../login/api";
-import pickerOptions from "@/constants/datePickerOptions";
-
-import ModifyCardRule from "../components/ModifyCardRule";
-
-export default {
-  name: "card-rule-manage",
-  components: {
-    ModifyCardRule
-  },
-  data() {
-    return {
-      filter: {
-        enable: null,
-        name: "",
-        createStartTime: null,
-        createEndTime: null
-      },
-      current: 1,
-      size: this.GLOBAL.pageSize,
-      total: 0,
-      rules: [],
-      curRule: {},
-      editType: "ADD",
-      cardRequiredFields: [],
-      cardExtendFields: [],
-      ABLE_TYPE,
-      // date-picker
-      createTime: [],
-      pickerOptions
-    };
-  },
-  mounted() {
-    this.getList();
-    this.getExamRule();
-  },
-  methods: {
-    async getExamRule() {
-      if (!this.checkPrivilege("button", "add")) return;
-
-      const examRequiredFields = await getEnums("REQUIRED_FIELDS");
-      this.cardRequiredFields = await getEnums("CARD_REQUIRED_FIELDS");
-      const cardRequiredFieldCodes = this.cardRequiredFields.map(
-        item => item.code
-      );
-      const extendFields = examRequiredFields
-        .filter(field => !cardRequiredFieldCodes.includes(field.code))
-        .map(item => {
-          return {
-            code: item.code,
-            name: item.desc
-          };
-        });
-      let examRule = await examRuleDetail();
-      if (!examRule) {
-        this.$notify.error({
-          title: "错误",
-          message: "请先设置通用考务规则配置"
-        });
-        return;
-      }
-
-      this.cardExtendFields = [
-        ...extendFields,
-        ...JSON.parse(examRule.extendFields).filter(item => item.enable)
-      ];
-    },
-    async getList() {
-      if (!this.checkPrivilege("list", "list")) return;
-
-      const datas = {
-        ...this.filter,
-        pageNumber: this.current,
-        pageSize: this.size
-      };
-      if (this.createTime) {
-        datas.createStartTime = this.createTime[0];
-        datas.createEndTime = this.createTime[1];
-      }
-      if (datas.enable !== null && datas.enable !== "")
-        datas.enable = !!datas.enable;
-      const data = await cardRuleListPage(datas);
-      this.rules = data.records.map(item => {
-        item.orgNames = item.orgs.map(org => org.name);
-        return item;
-      });
-      this.total = data.total;
-    },
-    toPage(page) {
-      this.current = page;
-      this.getList();
-    },
-    toAdd() {
-      this.curRule = {
-        requiredFields: this.cardRequiredFields.map(item => {
-          return {
-            code: item.code,
-            name: item.desc,
-            enable: true
-          };
-        }),
-        extendFields: this.cardExtendFields.map(item => {
-          return {
-            code: item.code,
-            name: item.name,
-            enable: false
-          };
-        })
-      };
-      this.editType = "ADD";
-      this.$refs.ModifyCardRule.open();
-    },
-    toEdit(row) {
-      this.curRule = row;
-      this.editType = "EDIT";
-      this.$refs.ModifyCardRule.open();
-    },
-    toDetail(row) {
-      // this.curRule = row;
-      // this.editType = "PREVIEW";
-      // this.$refs.ModifyCardRule.open();
-      window.open(
-        this.getRouterPath({
-          name: "CardRulePreview",
-          params: {
-            cardRuleId: row.id
-          }
-        })
-      );
-    },
-    toEnable(row) {
-      const action = row.enable ? "禁用" : "启用";
-
-      this.$confirm(`确定要${action}题卡规则【${row.name}】吗?`, "提示", {
-        type: "warning"
-      })
-        .then(async () => {
-          const enable = !row.enable;
-          await ableCardRule({
-            id: row.id,
-            enable
-          });
-          row.enable = enable;
-          this.$message.success("操作成功!");
-        })
-        .catch(() => {});
-    }
-  }
-};
-</script>
+<template>
+  <div class="card-rule-manage">
+    <div class="part-box part-box-filter part-box-flex">
+      <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
+        <template v-if="checkPrivilege('condition', 'condition')">
+          <el-form-item label="规则名称:">
+            <el-input
+              style="width: 142px;"
+              v-model.trim="filter.name"
+              placeholder="规则名称"
+              clearable
+            ></el-input>
+          </el-form-item>
+          <el-form-item label="创建时间:">
+            <el-date-picker
+              v-model="createTime"
+              type="datetimerange"
+              :picker-options="pickerOptions"
+              range-separator="至"
+              start-placeholder="创建开始时间"
+              end-placeholder="创建结束时间"
+              value-format="timestamp"
+              align="right"
+              unlink-panels
+            >
+            </el-date-picker>
+          </el-form-item>
+          <el-form-item label="启用/禁用:" label-width="90px">
+            <el-select
+              v-model="filter.enable"
+              style="width: 120px;"
+              placeholder="启用/禁用"
+              clearable
+            >
+              <el-option
+                v-for="(val, key) in ABLE_TYPE"
+                :key="key"
+                :value="key * 1"
+                :label="val"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </template>
+        <el-form-item>
+          <el-button
+            v-if="checkPrivilege('button', 'select')"
+            type="primary"
+            @click="toPage(1)"
+            >查询</el-button
+          >
+        </el-form-item>
+      </el-form>
+      <div class="part-box-action">
+        <el-button
+          v-if="checkPrivilege('button', 'add')"
+          type="primary"
+          icon="el-icon-circle-plus-outline"
+          @click="toAdd"
+          >添加</el-button
+        >
+      </div>
+    </div>
+    <div class="part-box part-box-pad">
+      <el-table ref="TableList" :data="rules">
+        <el-table-column
+          type="index"
+          label="序号"
+          width="70"
+          :index="indexMethod"
+        ></el-table-column>
+        <el-table-column prop="name" label="题卡规则名称"></el-table-column>
+        <el-table-column prop="orgs" label="适用机构">
+          <template slot-scope="scope">
+            <more-text :data="scope.row.orgNames"></more-text>
+          </template>
+        </el-table-column>
+        <el-table-column prop="remark" label="备注">
+          <span slot-scope="scope">{{
+            scope.row.remark | defaultFieldFilter
+          }}</span>
+        </el-table-column>
+        <el-table-column prop="enable" label="启用/禁用" width="100">
+          <template slot-scope="scope">
+            {{ scope.row.enable | enableFilter }}
+          </template>
+        </el-table-column>
+        <el-table-column prop="createTime" label="创建时间" width="180">
+          <span slot-scope="scope">{{
+            scope.row.createTime | timestampFilter
+          }}</span>
+        </el-table-column>
+        <el-table-column class-name="action-column" label="操作" width="140">
+          <template slot-scope="scope">
+            <el-button
+              v-if="checkPrivilege('link', 'preview')"
+              class="btn-primary"
+              type="text"
+              @click="toDetail(scope.row)"
+              >查看</el-button
+            >
+            <el-button
+              v-if="checkPrivilege('link', 'edit')"
+              class="btn-primary"
+              type="text"
+              @click="toEdit(scope.row)"
+              >编辑</el-button
+            >
+            <el-button
+              v-if="checkPrivilege('link', 'enable')"
+              :class="scope.row.enable ? 'btn-danger' : 'btn-primary'"
+              type="text"
+              @click="toEnable(scope.row)"
+              >{{ scope.row.enable ? "禁用" : "启用" }}</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="part-page">
+        <el-pagination
+          background
+          layout="total,prev, pager, next"
+          :current-page="current"
+          :total="total"
+          :page-size="size"
+          @current-change="toPage"
+        >
+        </el-pagination>
+      </div>
+    </div>
+    <!-- ModifyCardRule -->
+    <modify-card-rule
+      ref="ModifyCardRule"
+      :instance="curRule"
+      :edit-type="editType"
+      @modified="getList"
+    ></modify-card-rule>
+  </div>
+</template>
+
+<script>
+import { ABLE_TYPE } from "@/constants/enumerate";
+import { examRuleDetail, cardRuleListPage, ableCardRule } from "../api";
+import { getEnums } from "../../login/api";
+import pickerOptions from "@/constants/datePickerOptions";
+
+import ModifyCardRule from "../components/ModifyCardRule";
+
+export default {
+  name: "card-rule-manage",
+  components: {
+    ModifyCardRule
+  },
+  data() {
+    return {
+      filter: {
+        enable: null,
+        name: "",
+        createStartTime: null,
+        createEndTime: null
+      },
+      current: 1,
+      size: this.GLOBAL.pageSize,
+      total: 0,
+      rules: [],
+      curRule: {},
+      editType: "ADD",
+      cardRequiredFields: [],
+      cardExtendFields: [],
+      ABLE_TYPE,
+      // date-picker
+      createTime: [],
+      pickerOptions
+    };
+  },
+  mounted() {
+    this.getList();
+    this.getExamRule();
+  },
+  methods: {
+    async getExamRule() {
+      if (!this.checkPrivilege("button", "add")) return;
+
+      const examRequiredFields = await getEnums("REQUIRED_FIELDS");
+      this.cardRequiredFields = await getEnums("CARD_REQUIRED_FIELDS");
+      const cardRequiredFieldCodes = this.cardRequiredFields.map(
+        item => item.code
+      );
+      const extendFields = examRequiredFields
+        .filter(field => !cardRequiredFieldCodes.includes(field.code))
+        .map(item => {
+          return {
+            code: item.code,
+            name: item.desc
+          };
+        });
+      let examRule = await examRuleDetail();
+      if (!examRule) {
+        this.$notify.error({
+          title: "错误",
+          message: "请先设置通用考务规则配置"
+        });
+        return;
+      }
+
+      this.cardExtendFields = [
+        ...extendFields,
+        ...JSON.parse(examRule.extendFields).filter(item => item.enable)
+      ];
+    },
+    async getList() {
+      if (!this.checkPrivilege("list", "list")) return;
+
+      const datas = {
+        ...this.filter,
+        pageNumber: this.current,
+        pageSize: this.size
+      };
+      if (this.createTime) {
+        datas.createStartTime = this.createTime[0];
+        datas.createEndTime = this.createTime[1];
+      }
+      if (datas.enable !== null && datas.enable !== "")
+        datas.enable = !!datas.enable;
+      const data = await cardRuleListPage(datas);
+      this.rules = data.records.map(item => {
+        item.orgNames = item.orgs.map(org => org.name);
+        return item;
+      });
+      this.total = data.total;
+    },
+    toPage(page) {
+      this.current = page;
+      this.getList();
+    },
+    toAdd() {
+      this.curRule = {
+        requiredFields: this.cardRequiredFields.map(item => {
+          return {
+            code: item.code,
+            name: item.desc,
+            enable: true
+          };
+        }),
+        extendFields: this.cardExtendFields.map(item => {
+          return {
+            code: item.code,
+            name: item.name,
+            enable: false
+          };
+        })
+      };
+      this.editType = "ADD";
+      this.$refs.ModifyCardRule.open();
+    },
+    toEdit(row) {
+      this.curRule = row;
+      this.editType = "EDIT";
+      this.$refs.ModifyCardRule.open();
+    },
+    toDetail(row) {
+      // this.curRule = row;
+      // this.editType = "PREVIEW";
+      // this.$refs.ModifyCardRule.open();
+      window.open(
+        this.getRouterPath({
+          name: "CardRulePreview",
+          params: {
+            cardRuleId: row.id
+          }
+        })
+      );
+    },
+    toEnable(row) {
+      const action = row.enable ? "禁用" : "启用";
+
+      this.$confirm(`确定要${action}题卡规则【${row.name}】吗?`, "提示", {
+        type: "warning"
+      })
+        .then(async () => {
+          const enable = !row.enable;
+          await ableCardRule({
+            id: row.id,
+            enable
+          });
+          row.enable = enable;
+          this.$message.success("操作成功!");
+        })
+        .catch(() => {});
+    }
+  }
+};
+</script>

+ 303 - 303
src/modules/base/views/CourseManage.vue

@@ -1,303 +1,303 @@
-<template>
-  <div class="course-manage">
-    <div class="part-box part-box-filter part-box-flex">
-      <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
-        <template v-if="checkPrivilege('condition', 'condition')">
-          <el-form-item label="教研室:">
-            <teaching-room-select
-              v-model="filter.belongOrgId"
-              placeholder="教研室"
-              clearable
-            ></teaching-room-select>
-          </el-form-item>
-          <el-form-item label="课程名称:">
-            <el-input
-              style="width: 142px;"
-              v-model.trim="filter.courseName"
-              placeholder="课程名称"
-              clearable
-            ></el-input>
-          </el-form-item>
-          <el-form-item label="启用/禁用:" label-width="90px">
-            <el-select
-              v-model="filter.enable"
-              style="width: 120px;"
-              placeholder="启用/禁用"
-              clearable
-            >
-              <el-option
-                v-for="(val, key) in ABLE_TYPE"
-                :key="key"
-                :value="key * 1"
-                :label="val"
-              ></el-option>
-            </el-select>
-          </el-form-item>
-          <el-form-item label="创建时间:">
-            <el-date-picker
-              v-model="createTime"
-              type="datetimerange"
-              :picker-options="pickerOptions"
-              range-separator="至"
-              start-placeholder="创建开始时间"
-              end-placeholder="创建结束时间"
-              value-format="timestamp"
-              align="right"
-              unlink-panels
-            >
-            </el-date-picker>
-          </el-form-item>
-        </template>
-        <el-form-item>
-          <el-button
-            v-if="checkPrivilege('button', 'select')"
-            type="primary"
-            @click="toPage(1)"
-            >查询</el-button
-          >
-        </el-form-item>
-      </el-form>
-      <div class="part-box-action">
-        <el-button
-          type="danger"
-          :disabled="!filterHasQuery"
-          @click="toBatchDeable"
-          >批量禁用</el-button
-        >
-        <el-button
-          type="success"
-          icon="el-icon-download"
-          v-if="checkPrivilege('button', 'TempleteDownload')"
-          ><a :href="downloadUrl" :download="dfilename">模板下载</a></el-button
-        >
-        <upload-button
-          v-if="checkPrivilege('button', 'Import')"
-          btn-icon="el-icon-circle-plus-outline"
-          btn-content="批量导入"
-          btn-type="success"
-          :upload-url="uploadUrl"
-          :format="['xls', 'xlsx']"
-          accept=".xls,.xlsx"
-          @valid-error="validError"
-          @upload-success="uploadSuccess"
-        >
-        </upload-button>
-        <el-button
-          v-if="checkPrivilege('button', 'add')"
-          type="primary"
-          icon="el-icon-circle-plus-outline"
-          @click="toAdd"
-          >新增课程</el-button
-        >
-      </div>
-    </div>
-    <div class="part-box part-box-pad">
-      <el-table ref="TableList" :data="courses">
-        <el-table-column
-          type="index"
-          label="序号"
-          width="70"
-          :index="indexMethod"
-        ></el-table-column>
-        <el-table-column prop="courseName" label="课程名称"></el-table-column>
-        <el-table-column prop="courseCode" label="课程编码"></el-table-column>
-        <el-table-column
-          prop="teachingRoomName"
-          label="所属教研室"
-        ></el-table-column>
-        <el-table-column prop="clazzList" label="授课班级">
-          <span slot-scope="scope">
-            <more-text :data="scope.row.clazzNames" :show-count="3"></more-text>
-          </span>
-        </el-table-column>
-        <el-table-column prop="createTime" label="创建时间">
-          <span slot-scope="scope">{{
-            scope.row.createTime | timestampFilter
-          }}</span>
-        </el-table-column>
-        <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="120px">
-          <template slot-scope="scope">
-            <el-button
-              v-if="checkPrivilege('link', 'edit')"
-              class="btn-primary"
-              type="text"
-              @click="toEdit(scope.row)"
-              >编辑</el-button
-            >
-            <el-button
-              v-if="checkPrivilege('link', 'Enable')"
-              :class="scope.row.enable ? 'btn-danger' : 'btn-primary'"
-              type="text"
-              @click="toEnable(scope.row)"
-              >{{ scope.row.enable ? "禁用" : "启用" }}</el-button
-            >
-            <!-- <el-button
-              class="btn-danger"
-              type="text"
-              @click="toDelete(scope.row)"
-              >删除</el-button
-            > -->
-          </template>
-        </el-table-column>
-      </el-table>
-      <div class="part-page">
-        <el-pagination
-          background
-          layout="total,prev, pager, next"
-          :current-page="current"
-          :total="total"
-          :page-size="size"
-          @current-change="toPage"
-        >
-        </el-pagination>
-      </div>
-    </div>
-
-    <modify-course
-      :instance="curCourse"
-      @modified="getList"
-      ref="ModifyCourse"
-    ></modify-course>
-  </div>
-</template>
-
-<script>
-import {
-  courseListPage,
-  deleteCourse,
-  ableCourse,
-  batchEnableCourse
-} from "../api";
-import pickerOptions from "@/constants/datePickerOptions";
-import ModifyCourse from "../components/ModifyCourse";
-import UploadButton from "../../../components/UploadButton";
-import { ABLE_TYPE } from "@/constants/enumerate";
-
-export default {
-  name: "course-manage",
-  components: { ModifyCourse, UploadButton },
-  data() {
-    return {
-      filter: {
-        belongOrgId: "",
-        courseName: "",
-        startCreateTime: "",
-        endCreateTime: "",
-        enable: ""
-      },
-      queriedFilter: {},
-      ABLE_TYPE,
-      current: 1,
-      size: this.GLOBAL.pageSize,
-      total: 0,
-      courses: [],
-      curCourse: {},
-      // import
-      uploadUrl: "/api/admin/basic/course/data_import",
-      downloadUrl: "/temps/courseTemplate.xlsx",
-      dfilename: "课程导入模板.xlsx",
-      // date-picker
-      createTime: [],
-      pickerOptions
-    };
-  },
-  computed: {
-    filterHasQuery() {
-      return !Object.keys(this.filter).some(
-        k => this.filter[k] !== this.queriedFilter[k]
-      );
-    }
-  },
-  mounted() {
-    this.getList();
-  },
-  methods: {
-    async getList() {
-      if (!this.checkPrivilege("list", "list")) return;
-
-      const datas = {
-        ...this.filter,
-        pageNumber: this.current,
-        pageSize: this.size
-      };
-      if (this.createTime) {
-        datas.startCreateTime = this.createTime[0];
-        datas.endCreateTime = this.createTime[1];
-      }
-      if (datas.enable !== null && datas.enable !== "")
-        datas.enable = !!datas.enable;
-
-      const data = await courseListPage(datas);
-      this.courses = data.records.map(item => {
-        item.clazzNames = item.clazzList.map(org => org.name);
-        return item;
-      });
-      this.total = data.total;
-      this.queriedFilter = { ...this.filter };
-    },
-    toPage(page) {
-      this.current = page;
-      this.getList();
-    },
-    toAdd() {
-      this.curCourse = {};
-      this.$refs.ModifyCourse.open();
-    },
-    toEdit(row) {
-      this.curCourse = row;
-      this.$refs.ModifyCourse.open();
-    },
-    toDelete(row) {
-      this.$confirm(`确定要删除课程【${row.courseName}】吗?`, "提示", {
-        type: "warning"
-      })
-        .then(async () => {
-          await deleteCourse([row.id]);
-          this.$message.success("删除成功!");
-          this.deletePageLastItem();
-        })
-        .catch(() => {});
-    },
-    toEnable(row) {
-      const action = row.enable ? "禁用" : "启用";
-      this.$confirm(`确定要${action}课程【${row.courseName}】吗?`, "提示", {
-        type: "warning"
-      })
-        .then(async () => {
-          const enable = !row.enable;
-          await ableCourse({
-            idList: [row.id],
-            enable
-          });
-          row.enable = enable;
-          this.$message.success("操作成功!");
-        })
-        .catch(() => {});
-    },
-    toBatchDeable() {
-      this.$confirm(`确定要禁用当前查询的所有课程吗?`, "提示", {
-        type: "warning"
-      })
-        .then(async () => {
-          await batchEnableCourse({ ...this.filter, enableOperate: false });
-          this.$message.success("操作成功!");
-          this.toPage(1);
-        })
-        .catch(() => {});
-    },
-    // import
-    validError(errorData) {
-      this.$message.error(errorData.message);
-    },
-    uploadSuccess() {
-      this.$message.success("文件上传成功,后台正在导入!");
-      this.getList();
-    }
-  }
-};
-</script>
+<template>
+  <div class="course-manage">
+    <div class="part-box part-box-filter part-box-flex">
+      <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
+        <template v-if="checkPrivilege('condition', 'condition')">
+          <el-form-item label="机构:">
+            <teaching-room-select
+              v-model="filter.belongOrgId"
+              placeholder="机构"
+              clearable
+            ></teaching-room-select>
+          </el-form-item>
+          <el-form-item label="课程名称:">
+            <el-input
+              style="width: 142px;"
+              v-model.trim="filter.courseName"
+              placeholder="课程名称"
+              clearable
+            ></el-input>
+          </el-form-item>
+          <el-form-item label="启用/禁用:" label-width="90px">
+            <el-select
+              v-model="filter.enable"
+              style="width: 120px;"
+              placeholder="启用/禁用"
+              clearable
+            >
+              <el-option
+                v-for="(val, key) in ABLE_TYPE"
+                :key="key"
+                :value="key * 1"
+                :label="val"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+          <el-form-item label="创建时间:">
+            <el-date-picker
+              v-model="createTime"
+              type="datetimerange"
+              :picker-options="pickerOptions"
+              range-separator="至"
+              start-placeholder="创建开始时间"
+              end-placeholder="创建结束时间"
+              value-format="timestamp"
+              align="right"
+              unlink-panels
+            >
+            </el-date-picker>
+          </el-form-item>
+        </template>
+        <el-form-item>
+          <el-button
+            v-if="checkPrivilege('button', 'select')"
+            type="primary"
+            @click="toPage(1)"
+            >查询</el-button
+          >
+        </el-form-item>
+      </el-form>
+      <div class="part-box-action">
+        <el-button
+          type="danger"
+          :disabled="!filterHasQuery"
+          @click="toBatchDeable"
+          >批量禁用</el-button
+        >
+        <el-button
+          type="success"
+          icon="el-icon-download"
+          v-if="checkPrivilege('button', 'TempleteDownload')"
+          ><a :href="downloadUrl" :download="dfilename">模板下载</a></el-button
+        >
+        <upload-button
+          v-if="checkPrivilege('button', 'Import')"
+          btn-icon="el-icon-circle-plus-outline"
+          btn-content="批量导入"
+          btn-type="success"
+          :upload-url="uploadUrl"
+          :format="['xls', 'xlsx']"
+          accept=".xls,.xlsx"
+          @valid-error="validError"
+          @upload-success="uploadSuccess"
+        >
+        </upload-button>
+        <el-button
+          v-if="checkPrivilege('button', 'add')"
+          type="primary"
+          icon="el-icon-circle-plus-outline"
+          @click="toAdd"
+          >新增课程</el-button
+        >
+      </div>
+    </div>
+    <div class="part-box part-box-pad">
+      <el-table ref="TableList" :data="courses">
+        <el-table-column
+          type="index"
+          label="序号"
+          width="70"
+          :index="indexMethod"
+        ></el-table-column>
+        <el-table-column prop="courseName" label="课程名称"></el-table-column>
+        <el-table-column prop="courseCode" label="课程编码"></el-table-column>
+        <el-table-column
+          prop="teachingRoomName"
+          label="所属机构"
+        ></el-table-column>
+        <el-table-column prop="clazzList" label="授课班级">
+          <span slot-scope="scope">
+            <more-text :data="scope.row.clazzNames" :show-count="3"></more-text>
+          </span>
+        </el-table-column>
+        <el-table-column prop="createTime" label="创建时间">
+          <span slot-scope="scope">{{
+            scope.row.createTime | timestampFilter
+          }}</span>
+        </el-table-column>
+        <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="120px">
+          <template slot-scope="scope">
+            <el-button
+              v-if="checkPrivilege('link', 'edit')"
+              class="btn-primary"
+              type="text"
+              @click="toEdit(scope.row)"
+              >编辑</el-button
+            >
+            <el-button
+              v-if="checkPrivilege('link', 'Enable')"
+              :class="scope.row.enable ? 'btn-danger' : 'btn-primary'"
+              type="text"
+              @click="toEnable(scope.row)"
+              >{{ scope.row.enable ? "禁用" : "启用" }}</el-button
+            >
+            <!-- <el-button
+              class="btn-danger"
+              type="text"
+              @click="toDelete(scope.row)"
+              >删除</el-button
+            > -->
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="part-page">
+        <el-pagination
+          background
+          layout="total,prev, pager, next"
+          :current-page="current"
+          :total="total"
+          :page-size="size"
+          @current-change="toPage"
+        >
+        </el-pagination>
+      </div>
+    </div>
+
+    <modify-course
+      :instance="curCourse"
+      @modified="getList"
+      ref="ModifyCourse"
+    ></modify-course>
+  </div>
+</template>
+
+<script>
+import {
+  courseListPage,
+  deleteCourse,
+  ableCourse,
+  batchEnableCourse
+} from "../api";
+import pickerOptions from "@/constants/datePickerOptions";
+import ModifyCourse from "../components/ModifyCourse";
+import UploadButton from "../../../components/UploadButton";
+import { ABLE_TYPE } from "@/constants/enumerate";
+
+export default {
+  name: "course-manage",
+  components: { ModifyCourse, UploadButton },
+  data() {
+    return {
+      filter: {
+        belongOrgId: "",
+        courseName: "",
+        startCreateTime: "",
+        endCreateTime: "",
+        enable: ""
+      },
+      queriedFilter: {},
+      ABLE_TYPE,
+      current: 1,
+      size: this.GLOBAL.pageSize,
+      total: 0,
+      courses: [],
+      curCourse: {},
+      // import
+      uploadUrl: "/api/admin/basic/course/data_import",
+      downloadUrl: "/temps/courseTemplate.xlsx",
+      dfilename: "课程导入模板.xlsx",
+      // date-picker
+      createTime: [],
+      pickerOptions
+    };
+  },
+  computed: {
+    filterHasQuery() {
+      return !Object.keys(this.filter).some(
+        k => this.filter[k] !== this.queriedFilter[k]
+      );
+    }
+  },
+  mounted() {
+    this.getList();
+  },
+  methods: {
+    async getList() {
+      if (!this.checkPrivilege("list", "list")) return;
+
+      const datas = {
+        ...this.filter,
+        pageNumber: this.current,
+        pageSize: this.size
+      };
+      if (this.createTime) {
+        datas.startCreateTime = this.createTime[0];
+        datas.endCreateTime = this.createTime[1];
+      }
+      if (datas.enable !== null && datas.enable !== "")
+        datas.enable = !!datas.enable;
+
+      const data = await courseListPage(datas);
+      this.courses = data.records.map(item => {
+        item.clazzNames = item.clazzList.map(org => org.name);
+        return item;
+      });
+      this.total = data.total;
+      this.queriedFilter = { ...this.filter };
+    },
+    toPage(page) {
+      this.current = page;
+      this.getList();
+    },
+    toAdd() {
+      this.curCourse = {};
+      this.$refs.ModifyCourse.open();
+    },
+    toEdit(row) {
+      this.curCourse = row;
+      this.$refs.ModifyCourse.open();
+    },
+    toDelete(row) {
+      this.$confirm(`确定要删除课程【${row.courseName}】吗?`, "提示", {
+        type: "warning"
+      })
+        .then(async () => {
+          await deleteCourse([row.id]);
+          this.$message.success("删除成功!");
+          this.deletePageLastItem();
+        })
+        .catch(() => {});
+    },
+    toEnable(row) {
+      const action = row.enable ? "禁用" : "启用";
+      this.$confirm(`确定要${action}课程【${row.courseName}】吗?`, "提示", {
+        type: "warning"
+      })
+        .then(async () => {
+          const enable = !row.enable;
+          await ableCourse({
+            idList: [row.id],
+            enable
+          });
+          row.enable = enable;
+          this.$message.success("操作成功!");
+        })
+        .catch(() => {});
+    },
+    toBatchDeable() {
+      this.$confirm(`确定要禁用当前查询的所有课程吗?`, "提示", {
+        type: "warning"
+      })
+        .then(async () => {
+          await batchEnableCourse({ ...this.filter, enableOperate: false });
+          this.$message.success("操作成功!");
+          this.toPage(1);
+        })
+        .catch(() => {});
+    },
+    // import
+    validError(errorData) {
+      this.$message.error(errorData.message);
+    },
+    uploadSuccess() {
+      this.$message.success("文件上传成功,后台正在导入!");
+      this.getList();
+    }
+  }
+};
+</script>

+ 186 - 186
src/modules/base/views/MajorManage.vue

@@ -1,186 +1,186 @@
-<template>
-  <div class="major-manage">
-    <div class="part-box part-box-filter part-box-flex">
-      <el-form ref="FilterForm" label-position="left" label-width="90px" inline>
-        <template v-if="checkPrivilege('condition', 'condition')">
-          <el-form-item label="专业名称:">
-            <el-input
-              v-model.trim="filter.majorName"
-              placeholder="专业名称"
-              clearable
-            ></el-input>
-          </el-form-item>
-        </template>
-        <el-form-item>
-          <el-button
-            v-if="checkPrivilege('button', 'select')"
-            type="primary"
-            @click="toPage(1)"
-            >查询</el-button
-          >
-        </el-form-item>
-      </el-form>
-      <div class="part-box-action">
-        <el-button
-          v-if="checkPrivilege('button', 'delete')"
-          type="danger"
-          icon="el-icon-delete"
-          @click="toBatchDelete"
-          >批量删除</el-button
-        >
-        <el-button
-          v-if="checkPrivilege('button', 'add')"
-          type="primary"
-          icon="el-icon-circle-plus-outline"
-          @click="toAdd"
-          >新增专业</el-button
-        >
-      </div>
-    </div>
-    <div class="part-box part-box-pad">
-      <el-table
-        ref="TableList"
-        :data="dataList"
-        @selection-change="handleSelectionChange"
-      >
-        <el-table-column
-          type="selection"
-          width="55"
-          align="center"
-        ></el-table-column>
-        <el-table-column
-          type="index"
-          label="序号"
-          width="70"
-          :index="indexMethod"
-        ></el-table-column>
-        <el-table-column prop="majorName" label="专业名称"></el-table-column>
-        <el-table-column prop="collegeName" label="所属学院"></el-table-column>
-        <el-table-column prop="createTime" label="创建时间">
-          <span slot-scope="scope">{{
-            scope.row.createTime | timestampFilter
-          }}</span>
-        </el-table-column>
-        <el-table-column class-name="action-column" label="操作" width="120px">
-          <template slot-scope="scope">
-            <el-button
-              v-if="checkPrivilege('link', 'edit')"
-              class="btn-primary"
-              type="text"
-              @click="toEdit(scope.row)"
-              >编辑</el-button
-            >
-            <el-button
-              v-if="checkPrivilege('link', 'delete')"
-              class="btn-danger"
-              type="text"
-              @click="toDelete(scope.row)"
-              >删除</el-button
-            >
-          </template>
-        </el-table-column>
-      </el-table>
-      <div class="part-page">
-        <el-pagination
-          background
-          layout="total,prev, pager, next"
-          :current-page="current"
-          :total="total"
-          :page-size="size"
-          @current-change="toPage"
-        >
-        </el-pagination>
-      </div>
-    </div>
-
-    <modify-major
-      :instance="curRow"
-      @modified="getList"
-      ref="ModifyMajor"
-    ></modify-major>
-  </div>
-</template>
-
-<script>
-import { majorListQuery, deleteMajor } from "../api";
-import ModifyMajor from "../components/ModifyMajor";
-
-export default {
-  name: "major-manage",
-  components: { ModifyMajor },
-  data() {
-    return {
-      filter: {
-        majorName: ""
-      },
-      current: 1,
-      size: this.GLOBAL.pageSize,
-      total: 0,
-      dataList: [],
-      multipleSelection: [],
-      curRow: {}
-    };
-  },
-  mounted() {
-    this.getList();
-  },
-  methods: {
-    async getList() {
-      if (!this.checkPrivilege("list", "list")) return;
-
-      const datas = {
-        ...this.filter,
-        pageNumber: this.current,
-        pageSize: this.size
-      };
-      const data = await majorListQuery(datas);
-      this.dataList = data.records;
-      this.total = data.total;
-    },
-    toPage(page) {
-      this.multipleSelection = [];
-      this.current = page;
-      this.getList();
-    },
-    toAdd() {
-      this.curRow = {};
-      this.$refs.ModifyMajor.open();
-    },
-    toEdit(row) {
-      this.curRow = row;
-      this.$refs.ModifyMajor.open();
-    },
-    handleSelectionChange(val) {
-      this.multipleSelection = val.map(item => item.id);
-    },
-    toBatchDelete() {
-      if (!this.multipleSelection.length) {
-        this.$message.error("请选择要删除的数据");
-        return;
-      }
-
-      this.$confirm(`确定要删除选中的这些数据吗?`, "提示", {
-        type: "warning"
-      })
-        .then(async () => {
-          await deleteMajor(this.multipleSelection);
-          this.$message.success("删除成功!");
-          this.deletePageLastItem(this.multipleSelection.length);
-          this.multipleSelection = [];
-        })
-        .catch(() => {});
-    },
-    toDelete(row) {
-      this.$confirm(`确定要删除专业【${row.majorName}】吗?`, "提示", {
-        type: "warning"
-      })
-        .then(async () => {
-          await deleteMajor([row.id]);
-          this.$message.success("删除成功!");
-          this.deletePageLastItem();
-        })
-        .catch(() => {});
-    }
-  }
-};
-</script>
+<template>
+  <div class="major-manage">
+    <div class="part-box part-box-filter part-box-flex">
+      <el-form ref="FilterForm" label-position="left" label-width="90px" inline>
+        <template v-if="checkPrivilege('condition', 'condition')">
+          <el-form-item label="专业名称:">
+            <el-input
+              v-model.trim="filter.majorName"
+              placeholder="专业名称"
+              clearable
+            ></el-input>
+          </el-form-item>
+        </template>
+        <el-form-item>
+          <el-button
+            v-if="checkPrivilege('button', 'select')"
+            type="primary"
+            @click="toPage(1)"
+            >查询</el-button
+          >
+        </el-form-item>
+      </el-form>
+      <div class="part-box-action">
+        <el-button
+          v-if="checkPrivilege('button', 'delete')"
+          type="danger"
+          icon="el-icon-delete"
+          @click="toBatchDelete"
+          >批量删除</el-button
+        >
+        <el-button
+          v-if="checkPrivilege('button', 'add')"
+          type="primary"
+          icon="el-icon-circle-plus-outline"
+          @click="toAdd"
+          >新增专业</el-button
+        >
+      </div>
+    </div>
+    <div class="part-box part-box-pad">
+      <el-table
+        ref="TableList"
+        :data="dataList"
+        @selection-change="handleSelectionChange"
+      >
+        <el-table-column
+          type="selection"
+          width="55"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          type="index"
+          label="序号"
+          width="70"
+          :index="indexMethod"
+        ></el-table-column>
+        <el-table-column prop="majorName" label="专业名称"></el-table-column>
+        <el-table-column prop="collegeName" label="所属机构"></el-table-column>
+        <el-table-column prop="createTime" label="创建时间">
+          <span slot-scope="scope">{{
+            scope.row.createTime | timestampFilter
+          }}</span>
+        </el-table-column>
+        <el-table-column class-name="action-column" label="操作" width="120px">
+          <template slot-scope="scope">
+            <el-button
+              v-if="checkPrivilege('link', 'edit')"
+              class="btn-primary"
+              type="text"
+              @click="toEdit(scope.row)"
+              >编辑</el-button
+            >
+            <el-button
+              v-if="checkPrivilege('link', 'delete')"
+              class="btn-danger"
+              type="text"
+              @click="toDelete(scope.row)"
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="part-page">
+        <el-pagination
+          background
+          layout="total,prev, pager, next"
+          :current-page="current"
+          :total="total"
+          :page-size="size"
+          @current-change="toPage"
+        >
+        </el-pagination>
+      </div>
+    </div>
+
+    <modify-major
+      :instance="curRow"
+      @modified="getList"
+      ref="ModifyMajor"
+    ></modify-major>
+  </div>
+</template>
+
+<script>
+import { majorListQuery, deleteMajor } from "../api";
+import ModifyMajor from "../components/ModifyMajor";
+
+export default {
+  name: "major-manage",
+  components: { ModifyMajor },
+  data() {
+    return {
+      filter: {
+        majorName: ""
+      },
+      current: 1,
+      size: this.GLOBAL.pageSize,
+      total: 0,
+      dataList: [],
+      multipleSelection: [],
+      curRow: {}
+    };
+  },
+  mounted() {
+    this.getList();
+  },
+  methods: {
+    async getList() {
+      if (!this.checkPrivilege("list", "list")) return;
+
+      const datas = {
+        ...this.filter,
+        pageNumber: this.current,
+        pageSize: this.size
+      };
+      const data = await majorListQuery(datas);
+      this.dataList = data.records;
+      this.total = data.total;
+    },
+    toPage(page) {
+      this.multipleSelection = [];
+      this.current = page;
+      this.getList();
+    },
+    toAdd() {
+      this.curRow = {};
+      this.$refs.ModifyMajor.open();
+    },
+    toEdit(row) {
+      this.curRow = row;
+      this.$refs.ModifyMajor.open();
+    },
+    handleSelectionChange(val) {
+      this.multipleSelection = val.map(item => item.id);
+    },
+    toBatchDelete() {
+      if (!this.multipleSelection.length) {
+        this.$message.error("请选择要删除的数据");
+        return;
+      }
+
+      this.$confirm(`确定要删除选中的这些数据吗?`, "提示", {
+        type: "warning"
+      })
+        .then(async () => {
+          await deleteMajor(this.multipleSelection);
+          this.$message.success("删除成功!");
+          this.deletePageLastItem(this.multipleSelection.length);
+          this.multipleSelection = [];
+        })
+        .catch(() => {});
+    },
+    toDelete(row) {
+      this.$confirm(`确定要删除专业【${row.majorName}】吗?`, "提示", {
+        type: "warning"
+      })
+        .then(async () => {
+          await deleteMajor([row.id]);
+          this.$message.success("删除成功!");
+          this.deletePageLastItem();
+        })
+        .catch(() => {});
+    }
+  }
+};
+</script>

+ 146 - 189
src/modules/base/views/OrganizationManage.vue

@@ -1,189 +1,146 @@
-<template>
-  <div class="organization-manage">
-    <div class="part-box part-box-pad part-box-border">
-      <div class="org-tree-head">
-        <div>机构名称</div>
-        <div>操作</div>
-        <div>机构类型</div>
-      </div>
-      <el-tree
-        :data="orgs"
-        node-key="id"
-        default-expand-all
-        :expand-on-click-node="false"
-        :props="defaultProps"
-      >
-        <span class="custom-tree-node" slot-scope="{ node, data }">
-          <span>{{ node.label }}</span>
-          <div class="org-edit">
-            <div class="org-type">
-              {{ data.type | orgTypeFilter }}
-            </div>
-            <div class="org-actions" v-if="data.type === 'SCHOOL'">
-              <el-button
-                v-if="checkPrivilege('button', 'Add')"
-                class="btn-primary"
-                type="text"
-                @click="() => toAdd(data)"
-                >子部门</el-button
-              >
-            </div>
-            <div class="org-actions" v-else>
-              <el-button
-                v-if="
-                  data.type !== 'PRINTING_HOUSE' &&
-                    data.type !== 'TEACHING_ROOM' &&
-                    checkPrivilege('link', 'Add')
-                "
-                class="btn-primary"
-                type="text"
-                @click="() => append(data)"
-                >子部门</el-button
-              >
-              <el-button
-                v-if="checkPrivilege('link', 'Edit')"
-                class="btn-primary"
-                type="text"
-                @click="() => edit(node, data)"
-                >修改</el-button
-              >
-              <el-button
-                v-if="checkPrivilege('link', 'Delete')"
-                class="btn-danger"
-                type="text"
-                @click="() => remove(node, data)"
-                >删除</el-button
-              >
-            </div>
-          </div>
-        </span>
-      </el-tree>
-    </div>
-
-    <!-- ModifyOrganization -->
-    <modify-organization
-      ref="ModifyOrganization"
-      :instance="curOrg"
-      :org-types="orgTypes"
-      @confirm="getList"
-    ></modify-organization>
-  </div>
-</template>
-
-<script>
-import { organizationList, deleteOrganization } from "../api";
-import ModifyOrganization from "../components/ModifyOrganization";
-import { ORG_TYPE } from "@/constants/enumerate";
-
-export default {
-  name: "organization-manage",
-  components: { ModifyOrganization },
-  data() {
-    return {
-      orgs: [],
-      curOrg: {},
-      orgTypes: [],
-      orgTypeSerial: ["COLLEGE", "FACULTY", "TEACHING_ROOM"],
-      defaultProps: {
-        label: "name"
-      }
-    };
-  },
-  mounted() {
-    this.getList();
-  },
-  methods: {
-    async getList() {
-      if (!this.checkPrivilege("list", "LIST")) return;
-      const orgs = await organizationList();
-      this.orgs = orgs || [];
-      if (this.orgs.length) {
-        this.orgs[0].children.sort((a, b) => {
-          if (a.type === "PRINTING_HOUSE") return 1;
-          if (b.type === "PRINTING_HOUSE") return -1;
-
-          return 0;
-        });
-      }
-    },
-    toAdd(data) {
-      this.orgTypes = [
-        { type: "COLLEGE", name: "学院" },
-        { type: "PRINTING_HOUSE", name: "印刷室" }
-      ];
-      this.curOrg = { parentId: data.id, parentName: data.name };
-      this.$refs.ModifyOrganization.open();
-    },
-    edit(node, data) {
-      if (data.type === "PRINTING_HOUSE" || data.type === "TEACHING_ROOM") {
-        this.orgTypes = [{ type: data.type, name: ORG_TYPE[data.type] }];
-      }
-
-      if (data.type === "COLLEGE") {
-        this.orgTypes = [{ type: "COLLEGE", name: "学院" }];
-        // if (node.childNodes.length) {
-        //   const childNodeTypes = node.childNodes.map(item => item.data.type);
-        //   if (!childNodeTypes.includes("FACULTY")) {
-        //     orgTypes.push({ type: "FACULTY", name: "院系" });
-        //   }
-        // } else {
-        //   this.orgTypes = this.orgTypeSerial.map(type => {
-        //     return {
-        //       type,
-        //       name: ORG_TYPE[type]
-        //     };
-        //   });
-        // }
-      }
-      if (data.type === "FACULTY") {
-        let orgTypes = [{ type: "FACULTY", name: "院系" }];
-        // if (!node.parent.data.type) {
-        //   orgTypes.unshift({ type: "COLLEGE", name: "学院" });
-        // }
-        if (!node.childNodes.length) {
-          orgTypes.push({ type: "TEACHING_ROOM", name: "教研室" });
-        }
-        this.orgTypes = orgTypes;
-      }
-      this.curOrg = {
-        ...data,
-        parentName: data.parentId
-          ? node.parent.data.name
-          : this.$ls.get("schoolName")
-      };
-      this.$refs.ModifyOrganization.open();
-    },
-    remove(node, data) {
-      this.$confirm(`确定要删除【${data.name}】吗?`, "提示", {
-        type: "warning"
-      })
-        .then(async () => {
-          await deleteOrganization(data.id);
-
-          const parent = node.parent;
-          const children = parent.data.children || parent.data;
-          const index = children.findIndex(d => d.id === data.id);
-          children.splice(index, 1);
-
-          this.$message.success("删除成功!");
-        })
-        .catch(() => {});
-    },
-    append(data) {
-      if (data.type === "PRINTING_HOUSE" || data.type === "TEACHING_ROOM")
-        return;
-
-      const pos = this.orgTypeSerial.indexOf(data.type);
-      this.orgTypes = this.orgTypeSerial.slice(pos + 1).map(type => {
-        return {
-          type,
-          name: ORG_TYPE[type]
-        };
-      });
-
-      this.curOrg = { parentId: data.id, parentName: data.name };
-      this.$refs.ModifyOrganization.open();
-    }
-  }
-};
-</script>
+<template>
+  <div class="organization-manage">
+    <div class="part-box part-box-pad part-box-border">
+      <div class="org-tree-head">
+        <div>机构名称</div>
+        <div>操作</div>
+        <div>机构类型</div>
+      </div>
+      <el-tree
+        :data="orgs"
+        node-key="id"
+        default-expand-all
+        :expand-on-click-node="false"
+        :props="defaultProps"
+      >
+        <span class="custom-tree-node" slot-scope="{ node, data }">
+          <span>{{ node.label }}</span>
+          <div class="org-edit">
+            <div class="org-type">
+              {{ data.type | orgTypeFilter }}
+            </div>
+            <div class="org-actions" v-if="data.type === 'SCHOOL'">
+              <el-button
+                v-if="checkPrivilege('button', 'Add')"
+                class="btn-primary"
+                type="text"
+                @click="() => toAdd(data)"
+                >子部门</el-button
+              >
+            </div>
+            <div class="org-actions" v-else>
+              <el-button
+                v-if="
+                  data.type !== 'PRINTING_HOUSE' &&
+                    checkPrivilege('link', 'Add')
+                "
+                class="btn-primary"
+                type="text"
+                @click="() => toAdd(data)"
+                >子部门</el-button
+              >
+              <el-button
+                v-if="checkPrivilege('link', 'Edit')"
+                class="btn-primary"
+                type="text"
+                @click="() => edit(node, data)"
+                >修改</el-button
+              >
+              <el-button
+                v-if="checkPrivilege('link', 'Delete')"
+                class="btn-danger"
+                type="text"
+                @click="() => remove(node, data)"
+                >删除</el-button
+              >
+            </div>
+          </div>
+        </span>
+      </el-tree>
+    </div>
+
+    <!-- ModifyOrganization -->
+    <modify-organization
+      ref="ModifyOrganization"
+      :instance="curOrg"
+      :org-types="orgTypes"
+      @confirm="getList"
+    ></modify-organization>
+  </div>
+</template>
+
+<script>
+import { organizationList, deleteOrganization } from "../api";
+import ModifyOrganization from "../components/ModifyOrganization";
+
+export default {
+  name: "organization-manage",
+  components: { ModifyOrganization },
+  data() {
+    return {
+      orgs: [],
+      curOrg: {},
+      orgTypes: [{ type: "PRINTING_HOUSE", name: "印刷室" }],
+      defaultProps: {
+        label: "name"
+      }
+    };
+  },
+  mounted() {
+    this.getList();
+  },
+  methods: {
+    async getList() {
+      if (!this.checkPrivilege("list", "LIST")) return;
+      const orgs = await organizationList();
+      this.orgs = orgs || [];
+      if (this.orgs.length) {
+        this.orgs[0].children.sort((a, b) => {
+          if (a.type === "PRINTING_HOUSE") return 1;
+          if (b.type === "PRINTING_HOUSE") return -1;
+
+          return 0;
+        });
+      }
+    },
+    toAdd(data) {
+      if (data.type === "PRINTING_HOUSE") return;
+
+      this.orgTypes = [{ type: "PRINTING_HOUSE", name: "印刷室" }];
+      this.curOrg = { parentId: data.id, parentName: data.name };
+      this.$refs.ModifyOrganization.open();
+    },
+    edit(node, data) {
+      if (node.childNodes && node.childNodes.length) {
+        this.orgTypes = [];
+      } else {
+        this.orgTypes = [{ type: "PRINTING_HOUSE", name: "印刷室" }];
+      }
+
+      this.curOrg = {
+        ...data,
+        parentName: data.parentId
+          ? node.parent.data.name
+          : this.$ls.get("schoolName")
+      };
+      this.$refs.ModifyOrganization.open();
+    },
+    remove(node, data) {
+      this.$confirm(`确定要删除【${data.name}】吗?`, "提示", {
+        type: "warning"
+      })
+        .then(async () => {
+          await deleteOrganization(data.id);
+
+          const parent = node.parent;
+          const children = parent.data.children || parent.data;
+          const index = children.findIndex(d => d.id === data.id);
+          children.splice(index, 1);
+
+          this.$message.success("删除成功!");
+        })
+        .catch(() => {});
+    }
+  }
+};
+</script>

+ 252 - 252
src/modules/base/views/StudentManage.vue

@@ -1,252 +1,252 @@
-<template>
-  <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 label="姓名/学号:">
-          <el-input
-            style="width: 142px;"
-            v-model.trim="filter.queryParams"
-            placeholder="姓名/学号"
-            clearable
-          ></el-input>
-        </el-form-item>
-        <el-form-item label="校区:">
-          <campus-select
-            v-model="filter.campusId"
-            placeholder="校区"
-            clearable
-            @change="campusChange"
-          ></campus-select>
-        </el-form-item>
-        <el-form-item label="学院:">
-          <college-select
-            v-model="filter.collegeId"
-            placeholder="学院"
-          ></college-select>
-        </el-form-item>
-        <el-form-item label="专业:">
-          <major-select
-            v-model="filter.majorId"
-            :college-id="filter.collegeId"
-            cascader
-            placeholder="专业"
-          ></major-select>
-        </el-form-item>
-        <el-form-item label="班级:">
-          <class-select
-            v-model="filter.clazzId"
-            :major-id="filter.majorId"
-            cascader
-            placeholder="班级"
-          ></class-select>
-        </el-form-item>
-        <el-form-item>
-          <el-button
-            v-if="checkPrivilege('button', 'select')"
-            type="primary"
-            @click="toPage(1)"
-            >查询</el-button
-          >
-        </el-form-item>
-      </el-form>
-      <div class="part-box-action">
-        <el-button
-          v-if="checkPrivilege('button', 'delete')"
-          type="danger"
-          icon="el-icon-delete"
-          :disabled="!filterHasQuery"
-          @click="toBatchDelete"
-          >批量删除</el-button
-        >
-        <el-button
-          type="success"
-          icon="el-icon-download"
-          v-if="checkPrivilege('button', 'import')"
-          ><a :href="downloadUrl" :download="dfilename">模板下载</a></el-button
-        >
-        <upload-button
-          v-if="checkPrivilege('button', 'import')"
-          btn-icon="el-icon-circle-plus-outline"
-          btn-content="批量导入"
-          btn-type="success"
-          :upload-url="uploadUrl"
-          :format="['xls', 'xlsx']"
-          accept=".xls,.xlsx"
-          @valid-error="validError"
-          @upload-success="uploadSuccess"
-        >
-        </upload-button>
-        <el-button
-          v-if="checkPrivilege('button', 'add')"
-          type="primary"
-          icon="el-icon-circle-plus-outline"
-          @click="toAdd"
-          >新增学生</el-button
-        >
-      </div>
-    </div>
-    <div class="part-box part-box-pad">
-      <el-table ref="TableList" :data="dataList">
-        <el-table-column
-          type="index"
-          label="序号"
-          width="70"
-          :index="indexMethod"
-        ></el-table-column>
-        <el-table-column prop="studentName" label="姓名"></el-table-column>
-        <el-table-column prop="studentCode" label="学号"></el-table-column>
-        <el-table-column prop="phoneNumber" label="手机号">
-          <span slot-scope="scope">{{
-            scope.row.phoneNumber | defaultFieldFilter
-          }}</span>
-        </el-table-column>
-        <el-table-column prop="campusName" label="校区"></el-table-column>
-        <el-table-column prop="collegeName" label="学院"></el-table-column>
-        <el-table-column prop="majorName" label="专业"></el-table-column>
-        <el-table-column prop="clazz" label="班级"></el-table-column>
-        <el-table-column prop="createTime" label="创建时间">
-          <span slot-scope="scope">{{
-            scope.row.createTime | timestampFilter
-          }}</span>
-        </el-table-column>
-        <el-table-column class-name="action-column" label="操作" width="120px">
-          <template slot-scope="scope">
-            <el-button
-              v-if="checkPrivilege('link', 'edit')"
-              class="btn-primary"
-              type="text"
-              @click="toEdit(scope.row)"
-              >编辑</el-button
-            >
-            <el-button
-              v-if="checkPrivilege('link', 'delete')"
-              class="btn-danger"
-              type="text"
-              @click="toDelete(scope.row)"
-              >删除</el-button
-            >
-          </template>
-        </el-table-column>
-      </el-table>
-      <div class="part-page">
-        <el-pagination
-          background
-          layout="total,prev, pager, next"
-          :current-page="current"
-          :total="total"
-          :page-size="size"
-          @current-change="toPage"
-        >
-        </el-pagination>
-      </div>
-    </div>
-
-    <modify-student
-      :instance="curRow"
-      @modified="getList"
-      ref="ModifyStudent"
-    ></modify-student>
-  </div>
-</template>
-
-<script>
-import { studentListQuery, deleteStudent, deleteFilterStudent } from "../api";
-import ModifyStudent from "../components/ModifyStudent";
-import UploadButton from "../../../components/UploadButton";
-
-export default {
-  name: "student-manage",
-  components: { ModifyStudent, UploadButton },
-  data() {
-    return {
-      filter: {
-        queryParams: "",
-        campusId: "",
-        collegeId: "",
-        majorId: "",
-        clazzId: ""
-      },
-      queriedFilter: {},
-      current: 1,
-      size: this.GLOBAL.pageSize,
-      total: 0,
-      dataList: [],
-      curRow: {},
-      // import
-      uploadUrl: "/api/admin/basic/student/data_import",
-      downloadUrl: "/temps/studentTemplate.xlsx",
-      dfilename: "学生导入模板.xlsx"
-    };
-  },
-  computed: {
-    filterHasQuery() {
-      return !Object.keys(this.filter).some(
-        k => this.filter[k] !== this.queriedFilter[k]
-      );
-    }
-  },
-  mounted() {
-    this.getList();
-  },
-  methods: {
-    async getList() {
-      if (!this.checkPrivilege("list", "list")) return;
-
-      const datas = {
-        ...this.filter,
-        pageNumber: this.current,
-        pageSize: this.size
-      };
-      const data = await studentListQuery(datas);
-      this.dataList = data.records;
-      this.total = data.total;
-      this.queriedFilter = { ...this.filter };
-    },
-    toPage(page) {
-      this.current = page;
-      this.getList();
-    },
-    campusChange() {
-      this.filter.clazzId = "";
-    },
-    toAdd() {
-      this.curRow = {};
-      this.$refs.ModifyStudent.open();
-    },
-    toEdit(row) {
-      this.curRow = row;
-      this.$refs.ModifyStudent.open();
-    },
-    toBatchDelete() {
-      this.$confirm(`确定要根据设置的筛选条件删除所有数据吗?`, "提示", {
-        type: "warning"
-      })
-        .then(async () => {
-          await deleteFilterStudent(this.filter);
-          this.$message.success("删除成功!");
-          this.toPage(1);
-        })
-        .catch(() => {});
-    },
-    toDelete(row) {
-      this.$confirm(`确定要删除学生【${row.studentName}】吗?`, "提示", {
-        type: "warning"
-      })
-        .then(async () => {
-          await deleteStudent([row.id]);
-          this.$message.success("删除成功!");
-          this.deletePageLastItem();
-        })
-        .catch(() => {});
-    },
-    // import
-    validError(errorData) {
-      this.$message.error(errorData.message);
-    },
-    uploadSuccess() {
-      this.$message.success("文件上传成功,后台正在导入!");
-      this.getList();
-    }
-  }
-};
-</script>
+<template>
+  <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 label="姓名/学号:">
+          <el-input
+            style="width: 142px;"
+            v-model.trim="filter.queryParams"
+            placeholder="姓名/学号"
+            clearable
+          ></el-input>
+        </el-form-item>
+        <el-form-item label="校区:">
+          <campus-select
+            v-model="filter.campusId"
+            placeholder="校区"
+            clearable
+            @change="campusChange"
+          ></campus-select>
+        </el-form-item>
+        <el-form-item label="机构:">
+          <college-select
+            v-model="filter.collegeId"
+            placeholder="机构"
+          ></college-select>
+        </el-form-item>
+        <el-form-item label="专业:">
+          <major-select
+            v-model="filter.majorId"
+            :college-id="filter.collegeId"
+            cascader
+            placeholder="专业"
+          ></major-select>
+        </el-form-item>
+        <el-form-item label="班级:">
+          <class-select
+            v-model="filter.clazzId"
+            :major-id="filter.majorId"
+            cascader
+            placeholder="班级"
+          ></class-select>
+        </el-form-item>
+        <el-form-item>
+          <el-button
+            v-if="checkPrivilege('button', 'select')"
+            type="primary"
+            @click="toPage(1)"
+            >查询</el-button
+          >
+        </el-form-item>
+      </el-form>
+      <div class="part-box-action">
+        <el-button
+          v-if="checkPrivilege('button', 'delete')"
+          type="danger"
+          icon="el-icon-delete"
+          :disabled="!filterHasQuery"
+          @click="toBatchDelete"
+          >批量删除</el-button
+        >
+        <el-button
+          type="success"
+          icon="el-icon-download"
+          v-if="checkPrivilege('button', 'import')"
+          ><a :href="downloadUrl" :download="dfilename">模板下载</a></el-button
+        >
+        <upload-button
+          v-if="checkPrivilege('button', 'import')"
+          btn-icon="el-icon-circle-plus-outline"
+          btn-content="批量导入"
+          btn-type="success"
+          :upload-url="uploadUrl"
+          :format="['xls', 'xlsx']"
+          accept=".xls,.xlsx"
+          @valid-error="validError"
+          @upload-success="uploadSuccess"
+        >
+        </upload-button>
+        <el-button
+          v-if="checkPrivilege('button', 'add')"
+          type="primary"
+          icon="el-icon-circle-plus-outline"
+          @click="toAdd"
+          >新增学生</el-button
+        >
+      </div>
+    </div>
+    <div class="part-box part-box-pad">
+      <el-table ref="TableList" :data="dataList">
+        <el-table-column
+          type="index"
+          label="序号"
+          width="70"
+          :index="indexMethod"
+        ></el-table-column>
+        <el-table-column prop="studentName" label="姓名"></el-table-column>
+        <el-table-column prop="studentCode" label="学号"></el-table-column>
+        <el-table-column prop="phoneNumber" label="手机号">
+          <span slot-scope="scope">{{
+            scope.row.phoneNumber | defaultFieldFilter
+          }}</span>
+        </el-table-column>
+        <el-table-column prop="campusName" label="校区"></el-table-column>
+        <el-table-column prop="collegeName" label="机构"></el-table-column>
+        <el-table-column prop="majorName" label="专业"></el-table-column>
+        <el-table-column prop="clazz" label="班级"></el-table-column>
+        <el-table-column prop="createTime" label="创建时间">
+          <span slot-scope="scope">{{
+            scope.row.createTime | timestampFilter
+          }}</span>
+        </el-table-column>
+        <el-table-column class-name="action-column" label="操作" width="120px">
+          <template slot-scope="scope">
+            <el-button
+              v-if="checkPrivilege('link', 'edit')"
+              class="btn-primary"
+              type="text"
+              @click="toEdit(scope.row)"
+              >编辑</el-button
+            >
+            <el-button
+              v-if="checkPrivilege('link', 'delete')"
+              class="btn-danger"
+              type="text"
+              @click="toDelete(scope.row)"
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="part-page">
+        <el-pagination
+          background
+          layout="total,prev, pager, next"
+          :current-page="current"
+          :total="total"
+          :page-size="size"
+          @current-change="toPage"
+        >
+        </el-pagination>
+      </div>
+    </div>
+
+    <modify-student
+      :instance="curRow"
+      @modified="getList"
+      ref="ModifyStudent"
+    ></modify-student>
+  </div>
+</template>
+
+<script>
+import { studentListQuery, deleteStudent, deleteFilterStudent } from "../api";
+import ModifyStudent from "../components/ModifyStudent";
+import UploadButton from "../../../components/UploadButton";
+
+export default {
+  name: "student-manage",
+  components: { ModifyStudent, UploadButton },
+  data() {
+    return {
+      filter: {
+        queryParams: "",
+        campusId: "",
+        collegeId: "",
+        majorId: "",
+        clazzId: ""
+      },
+      queriedFilter: {},
+      current: 1,
+      size: this.GLOBAL.pageSize,
+      total: 0,
+      dataList: [],
+      curRow: {},
+      // import
+      uploadUrl: "/api/admin/basic/student/data_import",
+      downloadUrl: "/temps/studentTemplate.xlsx",
+      dfilename: "学生导入模板.xlsx"
+    };
+  },
+  computed: {
+    filterHasQuery() {
+      return !Object.keys(this.filter).some(
+        k => this.filter[k] !== this.queriedFilter[k]
+      );
+    }
+  },
+  mounted() {
+    this.getList();
+  },
+  methods: {
+    async getList() {
+      if (!this.checkPrivilege("list", "list")) return;
+
+      const datas = {
+        ...this.filter,
+        pageNumber: this.current,
+        pageSize: this.size
+      };
+      const data = await studentListQuery(datas);
+      this.dataList = data.records;
+      this.total = data.total;
+      this.queriedFilter = { ...this.filter };
+    },
+    toPage(page) {
+      this.current = page;
+      this.getList();
+    },
+    campusChange() {
+      this.filter.clazzId = "";
+    },
+    toAdd() {
+      this.curRow = {};
+      this.$refs.ModifyStudent.open();
+    },
+    toEdit(row) {
+      this.curRow = row;
+      this.$refs.ModifyStudent.open();
+    },
+    toBatchDelete() {
+      this.$confirm(`确定要根据设置的筛选条件删除所有数据吗?`, "提示", {
+        type: "warning"
+      })
+        .then(async () => {
+          await deleteFilterStudent(this.filter);
+          this.$message.success("删除成功!");
+          this.toPage(1);
+        })
+        .catch(() => {});
+    },
+    toDelete(row) {
+      this.$confirm(`确定要删除学生【${row.studentName}】吗?`, "提示", {
+        type: "warning"
+      })
+        .then(async () => {
+          await deleteStudent([row.id]);
+          this.$message.success("删除成功!");
+          this.deletePageLastItem();
+        })
+        .catch(() => {});
+    },
+    // import
+    validError(errorData) {
+      this.$message.error(errorData.message);
+    },
+    uploadSuccess() {
+      this.$message.success("文件上传成功,后台正在导入!");
+      this.getList();
+    }
+  }
+};
+</script>

+ 302 - 302
src/modules/base/views/TemplateManage.vue

@@ -1,302 +1,302 @@
-<template>
-  <div class="template-manage">
-    <div class="part-box part-box-filter part-box-flex">
-      <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
-        <template v-if="checkPrivilege('condition', 'condition')">
-          <el-form-item label="模板名称:">
-            <el-input
-              v-model.trim="filter.name"
-              placeholder="模板名称"
-              clearable
-            ></el-input>
-          </el-form-item>
-          <el-form-item label="创建时间:">
-            <el-date-picker
-              v-model="createTime"
-              type="datetimerange"
-              :picker-options="pickerOptions"
-              range-separator="至"
-              start-placeholder="创建开始时间"
-              end-placeholder="创建结束时间"
-              value-format="timestamp"
-              align="right"
-              unlink-panels
-            >
-            </el-date-picker>
-          </el-form-item>
-          <el-form-item label="启用/禁用:" label-width="90px">
-            <el-select
-              v-model="filter.enable"
-              style="width: 120px;"
-              placeholder="启用/禁用"
-              clearable
-            >
-              <el-option
-                v-for="(val, key) in ABLE_TYPE"
-                :key="key"
-                :value="key * 1"
-                :label="val"
-              ></el-option>
-            </el-select>
-          </el-form-item>
-        </template>
-        <el-form-item>
-          <el-button
-            v-if="checkPrivilege('button', 'select')"
-            type="primary"
-            @click="toPage(1)"
-            >查询</el-button
-          >
-        </el-form-item>
-      </el-form>
-      <div class="part-box-action">
-        <el-button
-          v-if="checkPrivilege('button', 'add')"
-          type="primary"
-          icon="el-icon-circle-plus-outline"
-          @click="toAdd"
-          >添加模板</el-button
-        >
-      </div>
-    </div>
-    <div class="part-box part-box-pad">
-      <el-table ref="TableList" :data="templates">
-        <el-table-column
-          type="index"
-          label="序号"
-          width="70"
-          :index="indexMethod"
-        ></el-table-column>
-        <el-table-column prop="name" label="模板名称"></el-table-column>
-        <el-table-column
-          prop="classify"
-          label="分类"
-          v-if="templateType !== 'GENERIC'"
-        >
-          <template slot-scope="scope">
-            {{ scope.row.classify | templateClassifyFilter }}
-          </template>
-        </el-table-column>
-        <el-table-column prop="orgs" label="适用学院">
-          <template slot-scope="scope">
-            <more-text :data="scope.row.orgNames"></more-text>
-          </template>
-        </el-table-column>
-        <el-table-column prop="remark" label="备注">
-          <span slot-scope="scope">{{
-            scope.row.remark | defaultFieldFilter
-          }}</span>
-        </el-table-column>
-        <el-table-column prop="enable" label="启用/禁用" width="100">
-          <template slot-scope="scope">
-            {{ scope.row.enable | enableFilter }}
-          </template>
-        </el-table-column>
-        <el-table-column prop="createTime" label="创建时间" width="180">
-          <span slot-scope="scope">{{
-            scope.row.createTime | timestampFilter
-          }}</span>
-        </el-table-column>
-        <el-table-column class-name="action-column" label="操作" width="160">
-          <template slot-scope="scope">
-            <el-button
-              v-if="checkPrivilege('link', 'preview')"
-              class="btn-primary"
-              type="text"
-              @click="toDetail(scope.row)"
-              >查看</el-button
-            >
-            <el-button
-              v-if="checkPrivilege('link', 'edit')"
-              class="btn-primary"
-              type="text"
-              @click="toEdit(scope.row)"
-              >编辑</el-button
-            >
-            <el-button
-              v-if="checkPrivilege('link', 'enable')"
-              :class="scope.row.enable ? 'btn-danger' : 'btn-primary'"
-              type="text"
-              @click="toEnable(scope.row)"
-              >{{ scope.row.enable ? "禁用" : "启用" }}</el-button
-            >
-          </template>
-        </el-table-column>
-      </el-table>
-      <div class="part-page">
-        <el-pagination
-          background
-          layout="total,prev, pager, next"
-          :current-page="current"
-          :total="total"
-          :page-size="size"
-          @current-change="toPage"
-        >
-        </el-pagination>
-      </div>
-    </div>
-    <!-- ModifyTemplate -->
-    <modify-template
-      ref="ModifyTemplate"
-      :instance="curTemplate"
-      :edit-type="editType"
-      :template-type="templateType"
-      @modified="getList"
-    ></modify-template>
-    <!-- template-detail -->
-    <el-dialog
-      :visible.sync="templateDetailDialogIsShow"
-      title="印品模板"
-      width="1200px"
-      top="10px"
-      :close-on-click-modal="false"
-      :close-on-press-escape="false"
-      append-to-body
-    >
-      <div id="template-frame"></div>
-      <div slot="footer"></div>
-    </el-dialog>
-  </div>
-</template>
-
-<script>
-import { ABLE_TYPE, TEMPLATE_TYPE } from "@/constants/enumerate";
-import pickerOptions from "@/constants/datePickerOptions";
-import { templateListPage, ableTemplate, templateContentView } from "../api";
-import ModifyTemplate from "../components/ModifyTemplate";
-
-export default {
-  name: "template-manage",
-  components: {
-    ModifyTemplate
-  },
-  props: {
-    templateType: {
-      type: String,
-      default: "GENERIC",
-      validator(val) {
-        return Object.keys(TEMPLATE_TYPE).indexOf(val) !== -1;
-      }
-    }
-  },
-  data() {
-    return {
-      filter: {
-        enable: null,
-        name: "",
-        startTime: "",
-        endTime: ""
-      },
-      current: 1,
-      size: this.GLOBAL.pageSize,
-      total: 0,
-      templates: [],
-      curTemplate: {},
-      editType: "ADD",
-      ABLE_TYPE,
-      templateDetailDialogIsShow: false,
-      // date-picker
-      createTime: [],
-      pickerOptions
-    };
-  },
-  mounted() {
-    this.getList();
-  },
-  methods: {
-    async getList() {
-      if (!this.checkPrivilege("list", "list")) return;
-
-      const datas = {
-        ...this.filter,
-        type: this.templateType,
-        pageNumber: this.current,
-        pageSize: this.size
-      };
-      if (this.createTime) {
-        datas.startTime = this.createTime[0];
-        datas.endTime = this.createTime[1];
-      }
-      if (datas.enable !== null && datas.enable !== "")
-        datas.enable = !!datas.enable;
-      const data = await templateListPage(datas);
-      this.templates = data.records.map(item => {
-        item.orgNames = item.orgs.map(org => org.name);
-        return item;
-      });
-      this.total = data.total;
-    },
-    toPage(page) {
-      this.current = page;
-      this.getList();
-    },
-    toAdd() {
-      this.curTemplate = { type: this.templateType };
-      this.editType = "ADD";
-      this.$refs.ModifyTemplate.open();
-    },
-    toEdit(row) {
-      this.curTemplate = { ...row, type: this.templateType };
-      this.editType = "EDIT";
-      this.$refs.ModifyTemplate.open();
-    },
-    async toDetail(row) {
-      if (this.templateType === "GENERIC") {
-        window.open(
-          this.getRouterPath({
-            name: "CardPreview",
-            params: {
-              cardId: row.cardId,
-              viewType: "view"
-            }
-          })
-        );
-        return;
-      }
-      const content = await templateContentView(row.attachmentId);
-      if (!content) return;
-
-      this.templateDetailDialogIsShow = true;
-      this.$nextTick(() => {
-        this.initFrame(content);
-      });
-    },
-    initFrame(htmlContent) {
-      // 移除framemark标签
-      // htmlContent = htmlContent
-      //   .replace(/\$\{.+?\}/g, "")
-      //   .replace(/<#.+?>/g, "")
-      //   .replace(/<\/#.+?>/g, "");
-      const frameContainerDom = document.getElementById("template-frame");
-      frameContainerDom.innerHTML = "";
-      const iframeDom = document.createElement("iframe");
-      frameContainerDom.appendChild(iframeDom);
-      console.dir(frameContainerDom);
-      const wwidth = frameContainerDom.parentNode.clientWidth - 50;
-      const wheight = window.innerHeight - 130;
-      iframeDom.style.cssText = `width: ${wwidth}px;height: ${wheight}px;border:none;outline:none;background-color: #fff;`;
-      const iframeDoc = iframeDom.contentDocument;
-      iframeDoc.open();
-      iframeDoc.write(htmlContent);
-      iframeDoc.close();
-    },
-    toEnable(row) {
-      const action = row.enable ? "禁用" : "启用";
-
-      this.$confirm(`确定要${action}模板【${row.name}】吗?`, "提示", {
-        type: "warning"
-      })
-        .then(async () => {
-          const enable = !row.enable;
-          await ableTemplate({
-            id: row.id,
-            enable
-          });
-          row.enable = enable;
-          this.$message.success("操作成功!");
-        })
-        .catch(() => {});
-    }
-  }
-};
-</script>
+<template>
+  <div class="template-manage">
+    <div class="part-box part-box-filter part-box-flex">
+      <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
+        <template v-if="checkPrivilege('condition', 'condition')">
+          <el-form-item label="模板名称:">
+            <el-input
+              v-model.trim="filter.name"
+              placeholder="模板名称"
+              clearable
+            ></el-input>
+          </el-form-item>
+          <el-form-item label="创建时间:">
+            <el-date-picker
+              v-model="createTime"
+              type="datetimerange"
+              :picker-options="pickerOptions"
+              range-separator="至"
+              start-placeholder="创建开始时间"
+              end-placeholder="创建结束时间"
+              value-format="timestamp"
+              align="right"
+              unlink-panels
+            >
+            </el-date-picker>
+          </el-form-item>
+          <el-form-item label="启用/禁用:" label-width="90px">
+            <el-select
+              v-model="filter.enable"
+              style="width: 120px;"
+              placeholder="启用/禁用"
+              clearable
+            >
+              <el-option
+                v-for="(val, key) in ABLE_TYPE"
+                :key="key"
+                :value="key * 1"
+                :label="val"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </template>
+        <el-form-item>
+          <el-button
+            v-if="checkPrivilege('button', 'select')"
+            type="primary"
+            @click="toPage(1)"
+            >查询</el-button
+          >
+        </el-form-item>
+      </el-form>
+      <div class="part-box-action">
+        <el-button
+          v-if="checkPrivilege('button', 'add')"
+          type="primary"
+          icon="el-icon-circle-plus-outline"
+          @click="toAdd"
+          >添加模板</el-button
+        >
+      </div>
+    </div>
+    <div class="part-box part-box-pad">
+      <el-table ref="TableList" :data="templates">
+        <el-table-column
+          type="index"
+          label="序号"
+          width="70"
+          :index="indexMethod"
+        ></el-table-column>
+        <el-table-column prop="name" label="模板名称"></el-table-column>
+        <el-table-column
+          prop="classify"
+          label="分类"
+          v-if="templateType !== 'GENERIC'"
+        >
+          <template slot-scope="scope">
+            {{ scope.row.classify | templateClassifyFilter }}
+          </template>
+        </el-table-column>
+        <el-table-column prop="orgs" label="适用机构">
+          <template slot-scope="scope">
+            <more-text :data="scope.row.orgNames"></more-text>
+          </template>
+        </el-table-column>
+        <el-table-column prop="remark" label="备注">
+          <span slot-scope="scope">{{
+            scope.row.remark | defaultFieldFilter
+          }}</span>
+        </el-table-column>
+        <el-table-column prop="enable" label="启用/禁用" width="100">
+          <template slot-scope="scope">
+            {{ scope.row.enable | enableFilter }}
+          </template>
+        </el-table-column>
+        <el-table-column prop="createTime" label="创建时间" width="180">
+          <span slot-scope="scope">{{
+            scope.row.createTime | timestampFilter
+          }}</span>
+        </el-table-column>
+        <el-table-column class-name="action-column" label="操作" width="160">
+          <template slot-scope="scope">
+            <el-button
+              v-if="checkPrivilege('link', 'preview')"
+              class="btn-primary"
+              type="text"
+              @click="toDetail(scope.row)"
+              >查看</el-button
+            >
+            <el-button
+              v-if="checkPrivilege('link', 'edit')"
+              class="btn-primary"
+              type="text"
+              @click="toEdit(scope.row)"
+              >编辑</el-button
+            >
+            <el-button
+              v-if="checkPrivilege('link', 'enable')"
+              :class="scope.row.enable ? 'btn-danger' : 'btn-primary'"
+              type="text"
+              @click="toEnable(scope.row)"
+              >{{ scope.row.enable ? "禁用" : "启用" }}</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="part-page">
+        <el-pagination
+          background
+          layout="total,prev, pager, next"
+          :current-page="current"
+          :total="total"
+          :page-size="size"
+          @current-change="toPage"
+        >
+        </el-pagination>
+      </div>
+    </div>
+    <!-- ModifyTemplate -->
+    <modify-template
+      ref="ModifyTemplate"
+      :instance="curTemplate"
+      :edit-type="editType"
+      :template-type="templateType"
+      @modified="getList"
+    ></modify-template>
+    <!-- template-detail -->
+    <el-dialog
+      :visible.sync="templateDetailDialogIsShow"
+      title="印品模板"
+      width="1200px"
+      top="10px"
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+      append-to-body
+    >
+      <div id="template-frame"></div>
+      <div slot="footer"></div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { ABLE_TYPE, TEMPLATE_TYPE } from "@/constants/enumerate";
+import pickerOptions from "@/constants/datePickerOptions";
+import { templateListPage, ableTemplate, templateContentView } from "../api";
+import ModifyTemplate from "../components/ModifyTemplate";
+
+export default {
+  name: "template-manage",
+  components: {
+    ModifyTemplate
+  },
+  props: {
+    templateType: {
+      type: String,
+      default: "GENERIC",
+      validator(val) {
+        return Object.keys(TEMPLATE_TYPE).indexOf(val) !== -1;
+      }
+    }
+  },
+  data() {
+    return {
+      filter: {
+        enable: null,
+        name: "",
+        startTime: "",
+        endTime: ""
+      },
+      current: 1,
+      size: this.GLOBAL.pageSize,
+      total: 0,
+      templates: [],
+      curTemplate: {},
+      editType: "ADD",
+      ABLE_TYPE,
+      templateDetailDialogIsShow: false,
+      // date-picker
+      createTime: [],
+      pickerOptions
+    };
+  },
+  mounted() {
+    this.getList();
+  },
+  methods: {
+    async getList() {
+      if (!this.checkPrivilege("list", "list")) return;
+
+      const datas = {
+        ...this.filter,
+        type: this.templateType,
+        pageNumber: this.current,
+        pageSize: this.size
+      };
+      if (this.createTime) {
+        datas.startTime = this.createTime[0];
+        datas.endTime = this.createTime[1];
+      }
+      if (datas.enable !== null && datas.enable !== "")
+        datas.enable = !!datas.enable;
+      const data = await templateListPage(datas);
+      this.templates = data.records.map(item => {
+        item.orgNames = item.orgs.map(org => org.name);
+        return item;
+      });
+      this.total = data.total;
+    },
+    toPage(page) {
+      this.current = page;
+      this.getList();
+    },
+    toAdd() {
+      this.curTemplate = { type: this.templateType };
+      this.editType = "ADD";
+      this.$refs.ModifyTemplate.open();
+    },
+    toEdit(row) {
+      this.curTemplate = { ...row, type: this.templateType };
+      this.editType = "EDIT";
+      this.$refs.ModifyTemplate.open();
+    },
+    async toDetail(row) {
+      if (this.templateType === "GENERIC") {
+        window.open(
+          this.getRouterPath({
+            name: "CardPreview",
+            params: {
+              cardId: row.cardId,
+              viewType: "view"
+            }
+          })
+        );
+        return;
+      }
+      const content = await templateContentView(row.attachmentId);
+      if (!content) return;
+
+      this.templateDetailDialogIsShow = true;
+      this.$nextTick(() => {
+        this.initFrame(content);
+      });
+    },
+    initFrame(htmlContent) {
+      // 移除framemark标签
+      // htmlContent = htmlContent
+      //   .replace(/\$\{.+?\}/g, "")
+      //   .replace(/<#.+?>/g, "")
+      //   .replace(/<\/#.+?>/g, "");
+      const frameContainerDom = document.getElementById("template-frame");
+      frameContainerDom.innerHTML = "";
+      const iframeDom = document.createElement("iframe");
+      frameContainerDom.appendChild(iframeDom);
+      console.dir(frameContainerDom);
+      const wwidth = frameContainerDom.parentNode.clientWidth - 50;
+      const wheight = window.innerHeight - 130;
+      iframeDom.style.cssText = `width: ${wwidth}px;height: ${wheight}px;border:none;outline:none;background-color: #fff;`;
+      const iframeDoc = iframeDom.contentDocument;
+      iframeDoc.open();
+      iframeDoc.write(htmlContent);
+      iframeDoc.close();
+    },
+    toEnable(row) {
+      const action = row.enable ? "禁用" : "启用";
+
+      this.$confirm(`确定要${action}模板【${row.name}】吗?`, "提示", {
+        type: "warning"
+      })
+        .then(async () => {
+          const enable = !row.enable;
+          await ableTemplate({
+            id: row.id,
+            enable
+          });
+          row.enable = enable;
+          this.$message.success("操作成功!");
+        })
+        .catch(() => {});
+    }
+  }
+};
+</script>

+ 1 - 1
src/modules/exam/api.js

@@ -9,7 +9,7 @@ export const pageNumberQuery = datas => {
 export const questionTeatherQuery = datas => {
   return $postParam("/api/admin/exam/task/user_query", datas);
 };
-// 教研室查询
+// 机构查询
 export const teachingRoomList = datas => {
   // TODO:
   return $postParam("/api/admin/exam/task/room_query", datas);

+ 743 - 743
src/modules/exam/components/CreateTaskApply.vue

@@ -1,743 +1,743 @@
-<template>
-  <el-dialog
-    class="create-task-apply"
-    :visible.sync="modalIsShow"
-    title="新增命题申请"
-    top="10px"
-    width="1000px"
-    :close-on-click-modal="false"
-    :close-on-press-escape="false"
-    append-to-body
-    destroy-on-close
-    @open="visibleChange"
-  >
-    <div class="part-box part-box-pad part-box-border">
-      <el-form
-        ref="examTaskComp"
-        :model="examTask"
-        :rules="rules"
-        label-width="120px"
-      >
-        <el-row>
-          <el-col :span="12">
-            <el-form-item prop="semesterId" label="学期:">
-              <semester-select
-                v-model="examTask.semesterId"
-                class="width-full"
-              ></semester-select>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item prop="examId" label="考试:">
-              <exam-select
-                v-model="examTask.examId"
-                :semester-id="examTask.semesterId"
-                class="width-full"
-              ></exam-select>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item prop="teachingRoomId" label="教研室:">
-              <teaching-room-select
-                v-model="examTask.teachingRoomId"
-                class="width-full"
-                @change="teachingRoomChange"
-              ></teaching-room-select>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item prop="courseCode" label="课程(代码):">
-              <course-select
-                v-model="examTask.courseCode"
-                class="width-full"
-                :teaching-room-id="examTask.teachingRoomId"
-                @change="courseChange"
-              ></course-select>
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row>
-          <el-col :span="12">
-            <el-form-item label="试卷编号:">
-              <el-input
-                v-model.trim="examTask.paperNumber"
-                placeholder="请输入试卷编号"
-                :maxlength="50"
-                clearable
-              ></el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="拟卷教师:">
-              <el-input
-                v-model.trim="examTask.teacherName"
-                placeholder="请输入拟卷教师"
-                :maxlength="50"
-                clearable
-              ></el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="主讲教师:">
-              <el-input
-                v-model.trim="examTask.lecturerName"
-                placeholder="请输入主讲教师"
-                :maxlength="50"
-                clearable
-              ></el-input>
-            </el-form-item>
-          </el-col>
-        </el-row>
-      </el-form>
-    </div>
-
-    <div class="apply-content task-detail" v-if="modalIsShow">
-      <div class="task-body">
-        <div class="mb-2 text-right">
-          <el-button
-            type="info"
-            icon="el-icon-circle-plus-outline"
-            @click="addAtachment"
-            >增加卷型</el-button
-          >
-        </div>
-        <table class="table mb-2">
-          <tr>
-            <th>试卷类型</th>
-            <th>试卷文件</th>
-            <th>答题卡创建方式</th>
-            <th>答题卡</th>
-            <th>操作</th>
-          </tr>
-          <tr v-for="(attachment, index) in paperAttachments" :key="index">
-            <td>{{ attachment.name }}卷</td>
-            <td>
-              <el-button
-                type="text"
-                class="btn-primary"
-                @click="toUpload(attachment)"
-              >
-                <i
-                  :class="[
-                    'icon',
-                    attachment.attachmentId ? 'icon-files-act' : 'icon-files'
-                  ]"
-                ></i
-                >{{
-                  attachment.attachmentId
-                    ? attachment.filename
-                    : "点击上传试卷文件"
-                }}
-              </el-button>
-            </td>
-            <td :rowspan="paperAttachments.length" v-if="index === 0">
-              {{ createCardTypeName }}
-            </td>
-            <td :rowspan="paperAttachments.length" v-if="index === 0">
-              <el-button
-                type="text"
-                class="btn-primary"
-                @click="toCreateOrViewCard"
-                >{{ cardTodoName }}</el-button
-              >
-              <el-button
-                v-if="examTaskDetail.makeMethod"
-                size="mini"
-                type="primary"
-                @click="changeCreateCardType"
-                >切换题卡创建方式</el-button
-              >
-            </td>
-            <td>
-              <el-button
-                class="btn-danger"
-                type="text"
-                @click="deleteAttachment(index)"
-                >删除</el-button
-              >
-            </td>
-          </tr>
-          <tr v-if="!paperAttachments.length">
-            <td colspan="5">
-              <p class="tips-info text-center">暂无数据</p>
-            </td>
-          </tr>
-        </table>
-
-        <p class="tips-info tips-dark mb-2">
-          提示:多卷型试卷由于会绑定一个答题卡模板,因此试卷结构必须相同。多卷型试卷之间客观题要求试题内容相同,可允许大题内的小题题序不同。
-        </p>
-
-        <el-form>
-          <el-form-item label="单次抽卷卷型数量:" label-width="150">
-            <el-input-number
-              v-model="examTaskDetail.drawCount"
-              :min="1"
-              :max="maxFetchCount"
-              :step="1"
-              step-strictly
-              :controls="false"
-            ></el-input-number>
-          </el-form-item>
-        </el-form>
-
-        <h4 class="mb-2">附件:<span>(最多4张)</span></h4>
-        <div class="image-list">
-          <div
-            class="image-item"
-            v-for="(img, index) in paperConfirmAttachments"
-            :key="index"
-          >
-            <img
-              :src="img.url"
-              :alt="img.filename"
-              title="点击查看大图"
-              @click="toPreview(index)"
-            />
-            <div class="image-delete">
-              <i
-                class="el-icon-delete-solid"
-                @click="deletePaperConfirmAttachment(index)"
-              ></i>
-            </div>
-          </div>
-          <div
-            v-if="paperConfirmAttachments.length < 4"
-            class="image-item image-add"
-            title="上传附件"
-            @click="toUploadPaperConfirm"
-          >
-            <i class="el-icon-plus"></i>
-          </div>
-        </div>
-
-        <h4 class="mb-2">附件说明:</h4>
-        <el-input
-          class="mb-2"
-          v-model="examTaskDetail.remark"
-          type="textarea"
-          resize="none"
-          :rows="2"
-          :maxlength="100"
-          clearable
-          show-word-limit
-          placeholder="建议不超过100个字"
-        ></el-input>
-
-        <div class="part-box part-box-pad part-box-border">
-          <el-timeline>
-            <el-timeline-item
-              v-for="flow in flowList"
-              :key="flow.taskKey"
-              :type="flow.type"
-            >
-              <div class="flow-item">
-                <div class="flow-item-content">
-                  <h4 class="flow-item-title">{{ flow.taskName }}</h4>
-                  <p class="flow-item-desc">{{ flow.approveUserNames }}</p>
-                </div>
-              </div>
-            </el-timeline-item>
-          </el-timeline>
-        </div>
-      </div>
-
-      <div class="task-action">
-        <el-button type="primary" :disabled="isSubmit" @click="submit"
-          >确认提交</el-button
-        >
-        <el-button type="primary" :disabled="isSubmit" @click="toSave(0)"
-          >暂存</el-button
-        >
-        <el-button @click="cancel">取消</el-button>
-      </div>
-    </div>
-
-    <div slot="footer"></div>
-
-    <!-- upload-paper-dialog -->
-    <upload-paper-dialog
-      :paper-attachment="curAttachment"
-      :upload-type="curUploadType"
-      @confirm="uploadConfirm"
-      ref="UploadPaperDialog"
-    ></upload-paper-dialog>
-    <!-- card-option-dialog -->
-    <card-option-dialog
-      ref="CardOptionDialog"
-      :data="task"
-      @upload-sample-over="initData"
-      @confirm="cardConfirm"
-    ></card-option-dialog>
-    <!-- image-preview -->
-    <simple-image-preview
-      :cur-image="curImage"
-      @on-prev="toPrevImage"
-      @on-next="toNextImage"
-      ref="SimpleImagePreview"
-    ></simple-image-preview>
-  </el-dialog>
-</template>
-
-<script>
-import { examRuleDetail, flowDetailByType } from "../../base/api";
-import {
-  teacherCreateTaskApply,
-  teacherCancelTaskApply,
-  switchCardCreateMethod
-} from "../api";
-import UploadPaperDialog from "./UploadPaperDialog";
-import CardOptionDialog from "./CardOptionDialog";
-import SimpleImagePreview from "@/components/SimpleImagePreview";
-import { CARD_SOURCE_TYPE } from "@/constants/enumerate";
-
-const initExamTask = {
-  id: null,
-  semesterId: "",
-  examId: "",
-  courseCode: "",
-  courseName: "",
-  paperNumber: "",
-  cardRuleId: "", // TODO:
-  teachingRoomId: "",
-  teacherName: "",
-  lecturerName: ""
-};
-
-const initExamTaskDetail = {
-  operateType: "STAGE",
-  paperType: "A",
-  cardId: "",
-  paperAttachmentIds: [],
-  paperConfirmAttachmentIds: [],
-  drawCount: 2,
-  remark: "",
-  makeMethod: "",
-  // 题卡状态
-  status: "",
-  // 考务规则
-  review: false,
-  includePaper: false,
-  customCard: false
-};
-
-export default {
-  name: "create-task-apply",
-  components: { UploadPaperDialog, CardOptionDialog, SimpleImagePreview },
-  data() {
-    return {
-      modalIsShow: false,
-      isSubmit: false,
-      flowList: [],
-      flowInfo: {},
-      examTask: {},
-      needReview: false,
-      task: {},
-      examRule: {},
-      rules: {
-        semesterId: [
-          {
-            required: true,
-            message: "请选择学期",
-            trigger: "change"
-          }
-        ],
-        examId: [
-          {
-            required: true,
-            message: "请选择考试",
-            trigger: "change"
-          }
-        ],
-        teachingRoomId: [
-          {
-            required: true,
-            message: "请选择教研室",
-            trigger: "change"
-          }
-        ],
-        courseCode: [
-          {
-            required: true,
-            message: "请选择课程",
-            trigger: "change"
-          }
-        ],
-        cardRuleId: [
-          {
-            required: true,
-            message: "请选择题卡规则",
-            trigger: "change"
-          }
-        ]
-      },
-      // exam-task-detail
-      examTaskDetail: {},
-      paperConfirmAttachmentId: { attachmentId: "", filename: "", url: "" },
-      paperAttachments: [],
-      paperConfirmAttachments: [],
-      curAttachment: {},
-      curUploadType: "paper",
-      attachmentLimitCount: 26,
-      abc: "abcdefghijklmnopqrstuvwxyz".toUpperCase(),
-      // image-preview
-      curImage: {},
-      curImageIndex: 0
-    };
-  },
-  computed: {
-    cardTodoName() {
-      let name = "创建答题卡";
-      if (this.examTaskDetail.cardId) {
-        if (this.examTaskDetail.makeMethod === "SELECT") {
-          name = "选择题卡";
-        } else if (this.examTaskDetail.makeMethod === "SELF") {
-          name = "编辑题卡";
-        } else {
-          // 已经审核的题卡可以自行编辑,未审核的题卡只能查看
-          name =
-            this.examTaskDetail.status === "SUBMIT" ? "编辑题卡" : "查看题卡";
-        }
-      }
-      return name;
-    },
-    createCardTypeName() {
-      return CARD_SOURCE_TYPE[this.examTaskDetail.makeMethod] || "";
-    },
-    maxFetchCount() {
-      return this.paperAttachments.length < 1
-        ? 1
-        : this.paperAttachments.length;
-    }
-  },
-  created() {
-    this.getExamRule();
-  },
-  methods: {
-    async getExamRule() {
-      const examRule = await examRuleDetail();
-      this.examRule = examRule || {};
-      this.needReview = examRule && examRule.review;
-    },
-    async getFlowList() {
-      const data = await flowDetailByType();
-      if (!data) return;
-      this.flowInfo = {
-        customFlowId: data.id,
-        version: data.version
-      };
-      this.flowList = data.flowTaskResultList || [];
-      if (this.flowList.length) {
-        this.flowList[0].type = "success";
-      }
-    },
-    initData() {
-      this.examTask = { ...initExamTask };
-      this.examTaskDetail = { ...initExamTaskDetail };
-      this.examTaskDetail.includePaper = this.examRule.includePaper;
-      this.examTaskDetail.review = this.examRule.review;
-      this.examTaskDetail.customCard = this.examRule.customCard;
-      this.paperAttachments = [];
-    },
-    visibleChange() {
-      if (!this.flowList.length) this.getFlowList();
-      this.initData();
-    },
-    checkData() {
-      return this.$refs.examTaskComp.validate().catch(() => {});
-    },
-    async cancel() {
-      if (this.examTask.id) {
-        await teacherCancelTaskApply(this.examTask.id);
-        this.$message.success("取消命题申请成功!");
-      }
-      this.close();
-    },
-    close() {
-      this.modalIsShow = false;
-    },
-    open() {
-      this.modalIsShow = true;
-    },
-    // exam-task-detail edit
-    addAtachment() {
-      if (this.paperAttachments.length >= this.attachmentLimitCount) return;
-
-      const newAttachment = {
-        name: this.abc[this.paperAttachments.length],
-        attachmentId: "",
-        filename: "",
-        pages: 0
-      };
-      this.paperAttachments.push(newAttachment);
-    },
-    deleteAttachment(index) {
-      if (this.paperAttachments.length <= 1) {
-        this.$message.error("试卷类型数量不得少于1");
-        return;
-      }
-      this.paperAttachments.splice(index, 1);
-      this.paperAttachments.forEach((item, itemIndex) => {
-        item.name = this.abc[itemIndex];
-      });
-      if (
-        this.examTaskDetail.drawCount &&
-        this.examTaskDetail.drawCount > this.paperAttachments.length
-      ) {
-        this.examTaskDetail.drawCount = this.paperAttachments.length;
-      }
-    },
-    toUpload(attachment) {
-      this.curUploadType = "paper";
-      this.curAttachment = {
-        ...attachment
-      };
-      this.$refs.UploadPaperDialog.open();
-    },
-    toUploadPaperConfirm() {
-      if (this.paperConfirmAttachments.length >= 4) return;
-      this.curUploadType = "paperConfirm";
-      this.curAttachment = {
-        ...this.paperConfirmAttachmentId
-      };
-      this.$refs.UploadPaperDialog.open();
-    },
-    uploadConfirm(attachment, uploadType) {
-      if (uploadType === "paper") {
-        const index = this.paperAttachments.findIndex(
-          item => item.name === attachment.name
-        );
-        this.paperAttachments.splice(index, 1, { ...attachment });
-      } else {
-        this.paperConfirmAttachments.push(attachment);
-      }
-    },
-    deletePaperConfirmAttachment(index) {
-      this.paperConfirmAttachments.splice(index, 1);
-    },
-    toViewCard() {
-      window.open(
-        this.getRouterPath({
-          name: "CardPreview",
-          params: {
-            cardId: this.examTaskDetail.cardId,
-            viewType: "view"
-          }
-        })
-      );
-    },
-    toEditCard() {
-      this.cachePrepareTcpCard();
-      this.$router.push({
-        name: "CardEdit",
-        params: {
-          cardId: this.examTaskDetail.cardId
-        }
-      });
-    },
-    cachePrepareTcpCard() {
-      this.$ls.set("prepareTcPCard", {
-        examTaskId: this.examTask.id,
-        courseCode: this.examTask.courseCode,
-        courseName: this.examTask.courseName,
-        makeMethod: this.examTaskDetail.makeMethod,
-        cardRuleId: this.examTask.cardRuleId,
-        type: "CUSTOM",
-        createMethod: "STANDARD"
-      });
-    },
-    async toCreateOrViewCard() {
-      const result = await this.toSave(1);
-      if (!result) return;
-      this.task = {
-        ...this.examTask,
-        ...this.examTaskDetail,
-        examTaskId: this.examTask.id
-      };
-      if (!this.examTaskDetail.cardId) {
-        this.$refs.CardOptionDialog.open();
-        return;
-      }
-
-      if (this.examTaskDetail.makeMethod === "SELECT") {
-        this.$refs.CardOptionDialog.open();
-      } else if (this.examTaskDetail.makeMethod === "SELF") {
-        this.toEditCard();
-      } else {
-        // 客服制卡:制作完毕则可以编辑,未制作完毕则可以查看
-        if (this.examTaskDetail.status === "SUBMIT") {
-          this.toEditCard();
-        } else {
-          this.toViewCard();
-        }
-      }
-    },
-    cardConfirm(data) {
-      this.examTaskDetail = this.$objAssign(this.examTaskDetail, data);
-    },
-    async changeCreateCardType() {
-      const h = this.$createElement;
-      const result = await this.$msgbox({
-        title: "切换题卡操作说明",
-        message: h("div", null, [
-          h("p", null, "1、切换题卡会将之前选择题卡数据删除。"),
-          h(
-            "p",
-            null,
-            "2、之前选择专卡进行绘制,切换题卡后再次选择专卡,需要重新开始绘制。"
-          )
-        ]),
-        showCancelButton: true,
-
-        type: "warning"
-      }).catch(() => {});
-      if (result !== "confirm") return;
-
-      await this.clearMakeMethod();
-      this.toCreateOrViewCard();
-    },
-    async clearMakeMethod() {
-      // 清除后台记录的题卡
-      if (this.examTask.id && this.examTaskDetail.cardId)
-        await switchCardCreateMethod(this.examTask.id);
-
-      this.examTaskDetail.makeMethod = "";
-      this.examTaskDetail.cardId = "";
-    },
-    teachingRoomChange() {
-      this.examTask.courseCode = "";
-      this.examTask.courseName = "";
-      this.clearCard();
-    },
-    courseChange(val) {
-      if (!val || !val.code) {
-        this.examTask.courseCode = "";
-        this.examTask.courseName = "";
-        return;
-      }
-      this.examTask.courseName = val.name;
-      this.clearCard();
-    },
-    clearCard() {
-      this.clearMakeMethod();
-    },
-    getTaskDetailData() {
-      let data = { ...this.examTaskDetail };
-      data.paperType = this.paperAttachments.map(item => item.name).join(",");
-      data.paperAttachmentIds = JSON.stringify(this.paperAttachments, (k, v) =>
-        k === "url" ? undefined : v
-      );
-      data.paperConfirmAttachmentIds = JSON.stringify(
-        this.paperConfirmAttachments
-      );
-      this.examTaskDetail = data;
-    },
-    checkDataValid() {
-      const attachmentValid = !this.paperAttachments.some(
-        item => !item.attachmentId
-      );
-      // 设置了入库强制包含试卷时,校验试卷是否上传。
-      if (this.examTaskDetail.includePaper && !attachmentValid) {
-        this.$message.error("请完成试卷文件上传!");
-        return;
-      }
-      // if (!this.paperConfirmAttachments.length) {
-      //   this.$message.error("请上传附件!");
-      //   return;
-      // }
-
-      if (!this.examTaskDetail.cardId) {
-        this.$message.error("请选择题卡创建方式!");
-        return;
-      }
-
-      if (
-        this.examTaskDetail.makeMethod !== "SELECT" &&
-        this.examTaskDetail.status !== "SUBMIT"
-      ) {
-        this.$message.error("请先提交题卡!");
-        return;
-      }
-
-      return true;
-    },
-    async toSave(silent) {
-      const valid = await this.$refs.examTaskComp.validate().catch(() => {});
-      if (!valid) return;
-
-      if (this.isSubmit) return;
-      this.isSubmit = true;
-      this.getTaskDetailData();
-      let datas = {
-        examTaskDetail: this.examTaskDetail,
-        examTask: this.examTask,
-        ...this.flowInfo
-      };
-      const data = await teacherCreateTaskApply(datas).catch(() => {});
-      this.isSubmit = false;
-      if (!data) return;
-
-      this.examTask = this.$objAssign(this.examTask, data);
-
-      if (!silent) this.$message.success("保存成功!");
-      return true;
-    },
-    async submit() {
-      const valid = await this.$refs.examTaskComp.validate().catch(() => {});
-      if (!valid) return;
-
-      if (!this.checkDataValid()) return;
-
-      this.$confirm(
-        "任务确定提交后,则不可更改试卷及答题卡内容,确定提交该任务?",
-        "提示",
-        {
-          type: "warning"
-        }
-      )
-        .then(async () => {
-          this.getTaskDetailData();
-          this.examTaskDetail.operateType = "SUBMIT";
-          let datas = {
-            examTaskDetail: this.examTaskDetail,
-            examTask: this.examTask
-          };
-          const data = await teacherCreateTaskApply(datas).catch(() => {});
-
-          if (!data) return;
-          this.$message.success("提交成功!");
-          this.close();
-          this.$emit("modified");
-        })
-        .catch(() => {});
-    },
-    // image-preview
-    toPreview(index) {
-      this.curImageIndex = index;
-      this.selectImage(index);
-      this.$refs.SimpleImagePreview.open();
-    },
-    selectImage(index) {
-      this.curImage = this.paperConfirmAttachments[index];
-    },
-    toPrevImage() {
-      if (this.curImageIndex === 0) {
-        this.curImageIndex = this.paperConfirmAttachments.length - 1;
-      } else {
-        this.curImageIndex--;
-      }
-
-      this.selectImage(this.curImageIndex);
-    },
-    toNextImage() {
-      if (this.curImageIndex === this.paperConfirmAttachments.length - 1) {
-        this.curImageIndex = 0;
-      } else {
-        this.curImageIndex++;
-      }
-
-      this.selectImage(this.curImageIndex);
-    }
-  }
-};
-</script>
+<template>
+  <el-dialog
+    class="create-task-apply"
+    :visible.sync="modalIsShow"
+    title="新增命题申请"
+    top="10px"
+    width="1000px"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    destroy-on-close
+    @open="visibleChange"
+  >
+    <div class="part-box part-box-pad part-box-border">
+      <el-form
+        ref="examTaskComp"
+        :model="examTask"
+        :rules="rules"
+        label-width="120px"
+      >
+        <el-row>
+          <el-col :span="12">
+            <el-form-item prop="semesterId" label="学期:">
+              <semester-select
+                v-model="examTask.semesterId"
+                class="width-full"
+              ></semester-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item prop="examId" label="考试:">
+              <exam-select
+                v-model="examTask.examId"
+                :semester-id="examTask.semesterId"
+                class="width-full"
+              ></exam-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item prop="teachingRoomId" label="机构:">
+              <teaching-room-select
+                v-model="examTask.teachingRoomId"
+                class="width-full"
+                @change="teachingRoomChange"
+              ></teaching-room-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item prop="courseCode" label="课程(代码):">
+              <course-select
+                v-model="examTask.courseCode"
+                class="width-full"
+                :teaching-room-id="examTask.teachingRoomId"
+                @change="courseChange"
+              ></course-select>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="试卷编号:">
+              <el-input
+                v-model.trim="examTask.paperNumber"
+                placeholder="请输入试卷编号"
+                :maxlength="50"
+                clearable
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="拟卷教师:">
+              <el-input
+                v-model.trim="examTask.teacherName"
+                placeholder="请输入拟卷教师"
+                :maxlength="50"
+                clearable
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="主讲教师:">
+              <el-input
+                v-model.trim="examTask.lecturerName"
+                placeholder="请输入主讲教师"
+                :maxlength="50"
+                clearable
+              ></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+    </div>
+
+    <div class="apply-content task-detail" v-if="modalIsShow">
+      <div class="task-body">
+        <div class="mb-2 text-right">
+          <el-button
+            type="info"
+            icon="el-icon-circle-plus-outline"
+            @click="addAtachment"
+            >增加卷型</el-button
+          >
+        </div>
+        <table class="table mb-2">
+          <tr>
+            <th>试卷类型</th>
+            <th>试卷文件</th>
+            <th>答题卡创建方式</th>
+            <th>答题卡</th>
+            <th>操作</th>
+          </tr>
+          <tr v-for="(attachment, index) in paperAttachments" :key="index">
+            <td>{{ attachment.name }}卷</td>
+            <td>
+              <el-button
+                type="text"
+                class="btn-primary"
+                @click="toUpload(attachment)"
+              >
+                <i
+                  :class="[
+                    'icon',
+                    attachment.attachmentId ? 'icon-files-act' : 'icon-files'
+                  ]"
+                ></i
+                >{{
+                  attachment.attachmentId
+                    ? attachment.filename
+                    : "点击上传试卷文件"
+                }}
+              </el-button>
+            </td>
+            <td :rowspan="paperAttachments.length" v-if="index === 0">
+              {{ createCardTypeName }}
+            </td>
+            <td :rowspan="paperAttachments.length" v-if="index === 0">
+              <el-button
+                type="text"
+                class="btn-primary"
+                @click="toCreateOrViewCard"
+                >{{ cardTodoName }}</el-button
+              >
+              <el-button
+                v-if="examTaskDetail.makeMethod"
+                size="mini"
+                type="primary"
+                @click="changeCreateCardType"
+                >切换题卡创建方式</el-button
+              >
+            </td>
+            <td>
+              <el-button
+                class="btn-danger"
+                type="text"
+                @click="deleteAttachment(index)"
+                >删除</el-button
+              >
+            </td>
+          </tr>
+          <tr v-if="!paperAttachments.length">
+            <td colspan="5">
+              <p class="tips-info text-center">暂无数据</p>
+            </td>
+          </tr>
+        </table>
+
+        <p class="tips-info tips-dark mb-2">
+          提示:多卷型试卷由于会绑定一个答题卡模板,因此试卷结构必须相同。多卷型试卷之间客观题要求试题内容相同,可允许大题内的小题题序不同。
+        </p>
+
+        <el-form>
+          <el-form-item label="单次抽卷卷型数量:" label-width="150">
+            <el-input-number
+              v-model="examTaskDetail.drawCount"
+              :min="1"
+              :max="maxFetchCount"
+              :step="1"
+              step-strictly
+              :controls="false"
+            ></el-input-number>
+          </el-form-item>
+        </el-form>
+
+        <h4 class="mb-2">附件:<span>(最多4张)</span></h4>
+        <div class="image-list">
+          <div
+            class="image-item"
+            v-for="(img, index) in paperConfirmAttachments"
+            :key="index"
+          >
+            <img
+              :src="img.url"
+              :alt="img.filename"
+              title="点击查看大图"
+              @click="toPreview(index)"
+            />
+            <div class="image-delete">
+              <i
+                class="el-icon-delete-solid"
+                @click="deletePaperConfirmAttachment(index)"
+              ></i>
+            </div>
+          </div>
+          <div
+            v-if="paperConfirmAttachments.length < 4"
+            class="image-item image-add"
+            title="上传附件"
+            @click="toUploadPaperConfirm"
+          >
+            <i class="el-icon-plus"></i>
+          </div>
+        </div>
+
+        <h4 class="mb-2">附件说明:</h4>
+        <el-input
+          class="mb-2"
+          v-model="examTaskDetail.remark"
+          type="textarea"
+          resize="none"
+          :rows="2"
+          :maxlength="100"
+          clearable
+          show-word-limit
+          placeholder="建议不超过100个字"
+        ></el-input>
+
+        <div class="part-box part-box-pad part-box-border">
+          <el-timeline>
+            <el-timeline-item
+              v-for="flow in flowList"
+              :key="flow.taskKey"
+              :type="flow.type"
+            >
+              <div class="flow-item">
+                <div class="flow-item-content">
+                  <h4 class="flow-item-title">{{ flow.taskName }}</h4>
+                  <p class="flow-item-desc">{{ flow.approveUserNames }}</p>
+                </div>
+              </div>
+            </el-timeline-item>
+          </el-timeline>
+        </div>
+      </div>
+
+      <div class="task-action">
+        <el-button type="primary" :disabled="isSubmit" @click="submit"
+          >确认提交</el-button
+        >
+        <el-button type="primary" :disabled="isSubmit" @click="toSave(0)"
+          >暂存</el-button
+        >
+        <el-button @click="cancel">取消</el-button>
+      </div>
+    </div>
+
+    <div slot="footer"></div>
+
+    <!-- upload-paper-dialog -->
+    <upload-paper-dialog
+      :paper-attachment="curAttachment"
+      :upload-type="curUploadType"
+      @confirm="uploadConfirm"
+      ref="UploadPaperDialog"
+    ></upload-paper-dialog>
+    <!-- card-option-dialog -->
+    <card-option-dialog
+      ref="CardOptionDialog"
+      :data="task"
+      @upload-sample-over="initData"
+      @confirm="cardConfirm"
+    ></card-option-dialog>
+    <!-- image-preview -->
+    <simple-image-preview
+      :cur-image="curImage"
+      @on-prev="toPrevImage"
+      @on-next="toNextImage"
+      ref="SimpleImagePreview"
+    ></simple-image-preview>
+  </el-dialog>
+</template>
+
+<script>
+import { examRuleDetail, flowDetailByType } from "../../base/api";
+import {
+  teacherCreateTaskApply,
+  teacherCancelTaskApply,
+  switchCardCreateMethod
+} from "../api";
+import UploadPaperDialog from "./UploadPaperDialog";
+import CardOptionDialog from "./CardOptionDialog";
+import SimpleImagePreview from "@/components/SimpleImagePreview";
+import { CARD_SOURCE_TYPE } from "@/constants/enumerate";
+
+const initExamTask = {
+  id: null,
+  semesterId: "",
+  examId: "",
+  courseCode: "",
+  courseName: "",
+  paperNumber: "",
+  cardRuleId: "", // TODO:
+  teachingRoomId: "",
+  teacherName: "",
+  lecturerName: ""
+};
+
+const initExamTaskDetail = {
+  operateType: "STAGE",
+  paperType: "A",
+  cardId: "",
+  paperAttachmentIds: [],
+  paperConfirmAttachmentIds: [],
+  drawCount: 2,
+  remark: "",
+  makeMethod: "",
+  // 题卡状态
+  status: "",
+  // 考务规则
+  review: false,
+  includePaper: false,
+  customCard: false
+};
+
+export default {
+  name: "create-task-apply",
+  components: { UploadPaperDialog, CardOptionDialog, SimpleImagePreview },
+  data() {
+    return {
+      modalIsShow: false,
+      isSubmit: false,
+      flowList: [],
+      flowInfo: {},
+      examTask: {},
+      needReview: false,
+      task: {},
+      examRule: {},
+      rules: {
+        semesterId: [
+          {
+            required: true,
+            message: "请选择学期",
+            trigger: "change"
+          }
+        ],
+        examId: [
+          {
+            required: true,
+            message: "请选择考试",
+            trigger: "change"
+          }
+        ],
+        teachingRoomId: [
+          {
+            required: true,
+            message: "请选择机构",
+            trigger: "change"
+          }
+        ],
+        courseCode: [
+          {
+            required: true,
+            message: "请选择课程",
+            trigger: "change"
+          }
+        ],
+        cardRuleId: [
+          {
+            required: true,
+            message: "请选择题卡规则",
+            trigger: "change"
+          }
+        ]
+      },
+      // exam-task-detail
+      examTaskDetail: {},
+      paperConfirmAttachmentId: { attachmentId: "", filename: "", url: "" },
+      paperAttachments: [],
+      paperConfirmAttachments: [],
+      curAttachment: {},
+      curUploadType: "paper",
+      attachmentLimitCount: 26,
+      abc: "abcdefghijklmnopqrstuvwxyz".toUpperCase(),
+      // image-preview
+      curImage: {},
+      curImageIndex: 0
+    };
+  },
+  computed: {
+    cardTodoName() {
+      let name = "创建答题卡";
+      if (this.examTaskDetail.cardId) {
+        if (this.examTaskDetail.makeMethod === "SELECT") {
+          name = "选择题卡";
+        } else if (this.examTaskDetail.makeMethod === "SELF") {
+          name = "编辑题卡";
+        } else {
+          // 已经审核的题卡可以自行编辑,未审核的题卡只能查看
+          name =
+            this.examTaskDetail.status === "SUBMIT" ? "编辑题卡" : "查看题卡";
+        }
+      }
+      return name;
+    },
+    createCardTypeName() {
+      return CARD_SOURCE_TYPE[this.examTaskDetail.makeMethod] || "";
+    },
+    maxFetchCount() {
+      return this.paperAttachments.length < 1
+        ? 1
+        : this.paperAttachments.length;
+    }
+  },
+  created() {
+    this.getExamRule();
+  },
+  methods: {
+    async getExamRule() {
+      const examRule = await examRuleDetail();
+      this.examRule = examRule || {};
+      this.needReview = examRule && examRule.review;
+    },
+    async getFlowList() {
+      const data = await flowDetailByType();
+      if (!data) return;
+      this.flowInfo = {
+        customFlowId: data.id,
+        version: data.version
+      };
+      this.flowList = data.flowTaskResultList || [];
+      if (this.flowList.length) {
+        this.flowList[0].type = "success";
+      }
+    },
+    initData() {
+      this.examTask = { ...initExamTask };
+      this.examTaskDetail = { ...initExamTaskDetail };
+      this.examTaskDetail.includePaper = this.examRule.includePaper;
+      this.examTaskDetail.review = this.examRule.review;
+      this.examTaskDetail.customCard = this.examRule.customCard;
+      this.paperAttachments = [];
+    },
+    visibleChange() {
+      if (!this.flowList.length) this.getFlowList();
+      this.initData();
+    },
+    checkData() {
+      return this.$refs.examTaskComp.validate().catch(() => {});
+    },
+    async cancel() {
+      if (this.examTask.id) {
+        await teacherCancelTaskApply(this.examTask.id);
+        this.$message.success("取消命题申请成功!");
+      }
+      this.close();
+    },
+    close() {
+      this.modalIsShow = false;
+    },
+    open() {
+      this.modalIsShow = true;
+    },
+    // exam-task-detail edit
+    addAtachment() {
+      if (this.paperAttachments.length >= this.attachmentLimitCount) return;
+
+      const newAttachment = {
+        name: this.abc[this.paperAttachments.length],
+        attachmentId: "",
+        filename: "",
+        pages: 0
+      };
+      this.paperAttachments.push(newAttachment);
+    },
+    deleteAttachment(index) {
+      if (this.paperAttachments.length <= 1) {
+        this.$message.error("试卷类型数量不得少于1");
+        return;
+      }
+      this.paperAttachments.splice(index, 1);
+      this.paperAttachments.forEach((item, itemIndex) => {
+        item.name = this.abc[itemIndex];
+      });
+      if (
+        this.examTaskDetail.drawCount &&
+        this.examTaskDetail.drawCount > this.paperAttachments.length
+      ) {
+        this.examTaskDetail.drawCount = this.paperAttachments.length;
+      }
+    },
+    toUpload(attachment) {
+      this.curUploadType = "paper";
+      this.curAttachment = {
+        ...attachment
+      };
+      this.$refs.UploadPaperDialog.open();
+    },
+    toUploadPaperConfirm() {
+      if (this.paperConfirmAttachments.length >= 4) return;
+      this.curUploadType = "paperConfirm";
+      this.curAttachment = {
+        ...this.paperConfirmAttachmentId
+      };
+      this.$refs.UploadPaperDialog.open();
+    },
+    uploadConfirm(attachment, uploadType) {
+      if (uploadType === "paper") {
+        const index = this.paperAttachments.findIndex(
+          item => item.name === attachment.name
+        );
+        this.paperAttachments.splice(index, 1, { ...attachment });
+      } else {
+        this.paperConfirmAttachments.push(attachment);
+      }
+    },
+    deletePaperConfirmAttachment(index) {
+      this.paperConfirmAttachments.splice(index, 1);
+    },
+    toViewCard() {
+      window.open(
+        this.getRouterPath({
+          name: "CardPreview",
+          params: {
+            cardId: this.examTaskDetail.cardId,
+            viewType: "view"
+          }
+        })
+      );
+    },
+    toEditCard() {
+      this.cachePrepareTcpCard();
+      this.$router.push({
+        name: "CardEdit",
+        params: {
+          cardId: this.examTaskDetail.cardId
+        }
+      });
+    },
+    cachePrepareTcpCard() {
+      this.$ls.set("prepareTcPCard", {
+        examTaskId: this.examTask.id,
+        courseCode: this.examTask.courseCode,
+        courseName: this.examTask.courseName,
+        makeMethod: this.examTaskDetail.makeMethod,
+        cardRuleId: this.examTask.cardRuleId,
+        type: "CUSTOM",
+        createMethod: "STANDARD"
+      });
+    },
+    async toCreateOrViewCard() {
+      const result = await this.toSave(1);
+      if (!result) return;
+      this.task = {
+        ...this.examTask,
+        ...this.examTaskDetail,
+        examTaskId: this.examTask.id
+      };
+      if (!this.examTaskDetail.cardId) {
+        this.$refs.CardOptionDialog.open();
+        return;
+      }
+
+      if (this.examTaskDetail.makeMethod === "SELECT") {
+        this.$refs.CardOptionDialog.open();
+      } else if (this.examTaskDetail.makeMethod === "SELF") {
+        this.toEditCard();
+      } else {
+        // 客服制卡:制作完毕则可以编辑,未制作完毕则可以查看
+        if (this.examTaskDetail.status === "SUBMIT") {
+          this.toEditCard();
+        } else {
+          this.toViewCard();
+        }
+      }
+    },
+    cardConfirm(data) {
+      this.examTaskDetail = this.$objAssign(this.examTaskDetail, data);
+    },
+    async changeCreateCardType() {
+      const h = this.$createElement;
+      const result = await this.$msgbox({
+        title: "切换题卡操作说明",
+        message: h("div", null, [
+          h("p", null, "1、切换题卡会将之前选择题卡数据删除。"),
+          h(
+            "p",
+            null,
+            "2、之前选择专卡进行绘制,切换题卡后再次选择专卡,需要重新开始绘制。"
+          )
+        ]),
+        showCancelButton: true,
+
+        type: "warning"
+      }).catch(() => {});
+      if (result !== "confirm") return;
+
+      await this.clearMakeMethod();
+      this.toCreateOrViewCard();
+    },
+    async clearMakeMethod() {
+      // 清除后台记录的题卡
+      if (this.examTask.id && this.examTaskDetail.cardId)
+        await switchCardCreateMethod(this.examTask.id);
+
+      this.examTaskDetail.makeMethod = "";
+      this.examTaskDetail.cardId = "";
+    },
+    teachingRoomChange() {
+      this.examTask.courseCode = "";
+      this.examTask.courseName = "";
+      this.clearCard();
+    },
+    courseChange(val) {
+      if (!val || !val.code) {
+        this.examTask.courseCode = "";
+        this.examTask.courseName = "";
+        return;
+      }
+      this.examTask.courseName = val.name;
+      this.clearCard();
+    },
+    clearCard() {
+      this.clearMakeMethod();
+    },
+    getTaskDetailData() {
+      let data = { ...this.examTaskDetail };
+      data.paperType = this.paperAttachments.map(item => item.name).join(",");
+      data.paperAttachmentIds = JSON.stringify(this.paperAttachments, (k, v) =>
+        k === "url" ? undefined : v
+      );
+      data.paperConfirmAttachmentIds = JSON.stringify(
+        this.paperConfirmAttachments
+      );
+      this.examTaskDetail = data;
+    },
+    checkDataValid() {
+      const attachmentValid = !this.paperAttachments.some(
+        item => !item.attachmentId
+      );
+      // 设置了入库强制包含试卷时,校验试卷是否上传。
+      if (this.examTaskDetail.includePaper && !attachmentValid) {
+        this.$message.error("请完成试卷文件上传!");
+        return;
+      }
+      // if (!this.paperConfirmAttachments.length) {
+      //   this.$message.error("请上传附件!");
+      //   return;
+      // }
+
+      if (!this.examTaskDetail.cardId) {
+        this.$message.error("请选择题卡创建方式!");
+        return;
+      }
+
+      if (
+        this.examTaskDetail.makeMethod !== "SELECT" &&
+        this.examTaskDetail.status !== "SUBMIT"
+      ) {
+        this.$message.error("请先提交题卡!");
+        return;
+      }
+
+      return true;
+    },
+    async toSave(silent) {
+      const valid = await this.$refs.examTaskComp.validate().catch(() => {});
+      if (!valid) return;
+
+      if (this.isSubmit) return;
+      this.isSubmit = true;
+      this.getTaskDetailData();
+      let datas = {
+        examTaskDetail: this.examTaskDetail,
+        examTask: this.examTask,
+        ...this.flowInfo
+      };
+      const data = await teacherCreateTaskApply(datas).catch(() => {});
+      this.isSubmit = false;
+      if (!data) return;
+
+      this.examTask = this.$objAssign(this.examTask, data);
+
+      if (!silent) this.$message.success("保存成功!");
+      return true;
+    },
+    async submit() {
+      const valid = await this.$refs.examTaskComp.validate().catch(() => {});
+      if (!valid) return;
+
+      if (!this.checkDataValid()) return;
+
+      this.$confirm(
+        "任务确定提交后,则不可更改试卷及答题卡内容,确定提交该任务?",
+        "提示",
+        {
+          type: "warning"
+        }
+      )
+        .then(async () => {
+          this.getTaskDetailData();
+          this.examTaskDetail.operateType = "SUBMIT";
+          let datas = {
+            examTaskDetail: this.examTaskDetail,
+            examTask: this.examTask
+          };
+          const data = await teacherCreateTaskApply(datas).catch(() => {});
+
+          if (!data) return;
+          this.$message.success("提交成功!");
+          this.close();
+          this.$emit("modified");
+        })
+        .catch(() => {});
+    },
+    // image-preview
+    toPreview(index) {
+      this.curImageIndex = index;
+      this.selectImage(index);
+      this.$refs.SimpleImagePreview.open();
+    },
+    selectImage(index) {
+      this.curImage = this.paperConfirmAttachments[index];
+    },
+    toPrevImage() {
+      if (this.curImageIndex === 0) {
+        this.curImageIndex = this.paperConfirmAttachments.length - 1;
+      } else {
+        this.curImageIndex--;
+      }
+
+      this.selectImage(this.curImageIndex);
+    },
+    toNextImage() {
+      if (this.curImageIndex === this.paperConfirmAttachments.length - 1) {
+        this.curImageIndex = 0;
+      } else {
+        this.curImageIndex++;
+      }
+
+      this.selectImage(this.curImageIndex);
+    }
+  }
+};
+</script>

+ 286 - 286
src/modules/exam/components/ModifyTaskApply.vue

@@ -1,286 +1,286 @@
-<template>
-  <el-dialog
-    class="modify-task-apply"
-    :visible.sync="modalIsShow"
-    :title="title"
-    top="10px"
-    width="900px"
-    :close-on-click-modal="false"
-    :close-on-press-escape="false"
-    append-to-body
-    @open="visibleChange"
-  >
-    <div class="part-box part-box-pad part-box-border part-box-gray">
-      <el-form class="form-info mb-4" label-width="120px">
-        <el-row>
-          <el-col :span="12">
-            <el-form-item label="课程(代码):">
-              <span
-                >{{ modalForm.courseName }}({{ modalForm.courseCode }})</span
-              >
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="教研室:">
-              <span>{{ modalForm.teachingRoomName | defaultFieldFilter }}</span>
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row>
-          <el-col :span="12">
-            <el-form-item label="使用学期:">
-              <span>{{ modalForm.semesterName || "--" }}</span>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="考试:">
-              <span>{{ modalForm.examName || "--" }}</span>
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row>
-          <el-col :span="12">
-            <el-form-item label="拟卷教师:">
-              <span>{{ modalForm.teacherName | defaultFieldFilter }}</span>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="命题老师:">
-              <span>{{ modalForm.propositionName || modalForm.userName }}</span>
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row>
-          <el-col :span="12">
-            <el-form-item label="考试时间:">
-              <span v-if="modalForm.examDate && modalForm.examTime">
-                {{ modalForm.examDate }} <i class="mr-1"></i>
-                {{ modalForm.examTime }}
-              </span>
-              <span v-else>--</span>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="审核状态:">
-              <span>{{ modalForm.auditStatus | auditStatusFilter }}</span>
-            </el-form-item>
-          </el-col>
-        </el-row>
-      </el-form>
-
-      <div v-if="examRoomInfoList.length && !IS_MODEL2" class="task-exam-room">
-        <el-table
-          :data="examRoomInfoList"
-          border
-          style="width: 100%"
-          max-height="300"
-        >
-          <el-table-column
-            v-if="hasClassInfo"
-            prop="clazzNames"
-            label="使用班级"
-            min-width="400"
-          ></el-table-column>
-          <el-table-column
-            prop="studentCount"
-            label="人数"
-            min-width="100"
-          ></el-table-column>
-          <el-table-column
-            prop="printCount"
-            label="总印份数"
-            min-width="100"
-          ></el-table-column>
-        </el-table>
-      </div>
-
-      <div
-        class="part-box part-box-pad task-exam-room"
-        v-if="examRoomInfoList.length && IS_MODEL2"
-      >
-        <p>
-          正式考生{{ examRoomInfoList[0].studentCount }}个,总印份数{{
-            examRoomInfoList[0].printCount
-          }}份(正式考生{{ examRoomInfoList[0].studentCount }}份,备用卷{{
-            examRoomInfoList[0].backupCount
-          }}份)
-        </p>
-      </div>
-    </div>
-
-    <apply-content
-      v-if="modalIsShow"
-      ref="ApplyContent"
-      :exam-task="modalForm"
-      :edit-type="editType"
-      @info-update="modalInfoUpdate"
-      @cancel="cancel"
-      @modified="modified"
-    ></apply-content>
-
-    <div slot="footer"></div>
-  </el-dialog>
-</template>
-
-<script>
-import ApplyContent from "./ApplyContent";
-import { examRuleDetail } from "../../base/api";
-import { cancelOrRestartTaskApply, taskApplyExamObject } from "../api";
-import { parseTimeRangeDateAndTime } from "@/plugins/utils";
-
-const initModalForm = {
-  id: null,
-  examId: "",
-  examName: "",
-  examModel: "",
-  semesterId: "",
-  semesterName: "",
-  courseCode: "",
-  courseName: "",
-  specialty: "",
-  paperNumber: "",
-  startTime: "",
-  endTime: "",
-  cardRuleId: "",
-  cardRuleName: "",
-  flowId: "",
-  setup: 0,
-  userId: "",
-  userName: "",
-  propositionName: "",
-  auditStatus: "",
-  reviewStatus: "",
-  source: "",
-  teachingRoomName: "",
-  teacherName: "",
-  lecturerName: "",
-  paperName: "",
-  examDate: "",
-  examTime: ""
-};
-
-export default {
-  name: "modify-task-apply",
-  components: { ApplyContent },
-  props: {
-    instance: {
-      type: Object,
-      default() {
-        return {};
-      }
-    },
-    editType: {
-      type: String,
-      default: ""
-    }
-  },
-  computed: {
-    title() {
-      // editType为主
-      if (this.editType) {
-        const names = {
-          APPLY: "提交入库申请",
-          PREVIEW: "入库申请详情",
-          AUDIT: "审核入库申请"
-        };
-        return names[this.editType];
-      }
-
-      if (this.modalForm.setup === 1 || this.modalForm.setup === null) {
-        return "提交入库申请";
-      } else if (this.modalForm.setup <= 0) {
-        return "入库申请详情";
-      } else {
-        return "审核入库申请";
-      }
-    },
-    IS_MODEL2() {
-      return this.modalForm.examModel === "MODEL2";
-    }
-  },
-  data() {
-    return {
-      modalIsShow: false,
-      modalForm: {},
-      examRule: {},
-      hasClassInfo: false,
-      examRoomInfoList: [],
-      printTotalCount: 0
-    };
-  },
-  created() {
-    this.getExamRule();
-  },
-  methods: {
-    async getExamRule() {
-      const examRule = await examRuleDetail();
-      this.examRule = examRule || {};
-    },
-    modalInfoUpdate(data) {
-      this.modalForm = this.$objAssign(this.modalForm, data);
-      this.getExamRoomInfo();
-    },
-    initData(val) {
-      this.modalForm = this.$objAssign(initModalForm, val);
-      this.modalForm.includePaper = this.examRule.includePaper;
-      this.modalForm.review = this.examRule.review;
-      this.modalForm.customCard = this.examRule.customCard;
-    },
-    visibleChange() {
-      this.initData(this.instance);
-    },
-    async getExamRoomInfo() {
-      const data = await taskApplyExamObject(this.instance.paperNumber);
-
-      if (this.IS_MODEL2) {
-        const { printCount } = data.examRoomInfoList[0];
-        const nums = printCount.split("+").map(item => item * 1);
-        console.log(nums);
-        this.examRoomInfoList = [
-          {
-            backupCount: nums[1],
-            studentCount: nums[0],
-            printCount: nums[0] + nums[1]
-          }
-        ];
-      } else {
-        this.examRoomInfoList = data.examRoomInfoList || [];
-        this.hasClassInfo = this.examRoomInfoList.some(item => item.clazzNames);
-      }
-      this.printTotalCount = data.printTotalCount;
-      this.modalForm.paperName = data.paperName || "";
-      const { date, time } = parseTimeRangeDateAndTime(
-        data.examStartTime,
-        data.examEndTime
-      );
-
-      this.modalForm.examDate = date;
-      this.modalForm.examTime = time;
-    },
-    cancel() {
-      this.modalIsShow = false;
-    },
-    open() {
-      this.modalIsShow = true;
-    },
-    toCancel() {
-      this.$confirm("确定要撤销当前申请吗?", "提示", {
-        type: "warning"
-      })
-        .then(async () => {
-          const data = await cancelOrRestartTaskApply({
-            id: this.instance.id
-          }).catch(() => {});
-          if (!data) return;
-          this.$message.success("操作成功!");
-          this.modified();
-        })
-        .catch(() => {});
-    },
-    modified() {
-      this.cancel();
-      this.$emit("modified");
-    }
-  }
-};
-</script>
+<template>
+  <el-dialog
+    class="modify-task-apply"
+    :visible.sync="modalIsShow"
+    :title="title"
+    top="10px"
+    width="900px"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    @open="visibleChange"
+  >
+    <div class="part-box part-box-pad part-box-border part-box-gray">
+      <el-form class="form-info mb-4" label-width="120px">
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="课程(代码):">
+              <span
+                >{{ modalForm.courseName }}({{ modalForm.courseCode }})</span
+              >
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="机构:">
+              <span>{{ modalForm.teachingRoomName | defaultFieldFilter }}</span>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="使用学期:">
+              <span>{{ modalForm.semesterName || "--" }}</span>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="考试:">
+              <span>{{ modalForm.examName || "--" }}</span>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="拟卷教师:">
+              <span>{{ modalForm.teacherName | defaultFieldFilter }}</span>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="命题老师:">
+              <span>{{ modalForm.propositionName || modalForm.userName }}</span>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="考试时间:">
+              <span v-if="modalForm.examDate && modalForm.examTime">
+                {{ modalForm.examDate }} <i class="mr-1"></i>
+                {{ modalForm.examTime }}
+              </span>
+              <span v-else>--</span>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="审核状态:">
+              <span>{{ modalForm.auditStatus | auditStatusFilter }}</span>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+
+      <div v-if="examRoomInfoList.length && !IS_MODEL2" class="task-exam-room">
+        <el-table
+          :data="examRoomInfoList"
+          border
+          style="width: 100%"
+          max-height="300"
+        >
+          <el-table-column
+            v-if="hasClassInfo"
+            prop="clazzNames"
+            label="使用班级"
+            min-width="400"
+          ></el-table-column>
+          <el-table-column
+            prop="studentCount"
+            label="人数"
+            min-width="100"
+          ></el-table-column>
+          <el-table-column
+            prop="printCount"
+            label="总印份数"
+            min-width="100"
+          ></el-table-column>
+        </el-table>
+      </div>
+
+      <div
+        class="part-box part-box-pad task-exam-room"
+        v-if="examRoomInfoList.length && IS_MODEL2"
+      >
+        <p>
+          正式考生{{ examRoomInfoList[0].studentCount }}个,总印份数{{
+            examRoomInfoList[0].printCount
+          }}份(正式考生{{ examRoomInfoList[0].studentCount }}份,备用卷{{
+            examRoomInfoList[0].backupCount
+          }}份)
+        </p>
+      </div>
+    </div>
+
+    <apply-content
+      v-if="modalIsShow"
+      ref="ApplyContent"
+      :exam-task="modalForm"
+      :edit-type="editType"
+      @info-update="modalInfoUpdate"
+      @cancel="cancel"
+      @modified="modified"
+    ></apply-content>
+
+    <div slot="footer"></div>
+  </el-dialog>
+</template>
+
+<script>
+import ApplyContent from "./ApplyContent";
+import { examRuleDetail } from "../../base/api";
+import { cancelOrRestartTaskApply, taskApplyExamObject } from "../api";
+import { parseTimeRangeDateAndTime } from "@/plugins/utils";
+
+const initModalForm = {
+  id: null,
+  examId: "",
+  examName: "",
+  examModel: "",
+  semesterId: "",
+  semesterName: "",
+  courseCode: "",
+  courseName: "",
+  specialty: "",
+  paperNumber: "",
+  startTime: "",
+  endTime: "",
+  cardRuleId: "",
+  cardRuleName: "",
+  flowId: "",
+  setup: 0,
+  userId: "",
+  userName: "",
+  propositionName: "",
+  auditStatus: "",
+  reviewStatus: "",
+  source: "",
+  teachingRoomName: "",
+  teacherName: "",
+  lecturerName: "",
+  paperName: "",
+  examDate: "",
+  examTime: ""
+};
+
+export default {
+  name: "modify-task-apply",
+  components: { ApplyContent },
+  props: {
+    instance: {
+      type: Object,
+      default() {
+        return {};
+      }
+    },
+    editType: {
+      type: String,
+      default: ""
+    }
+  },
+  computed: {
+    title() {
+      // editType为主
+      if (this.editType) {
+        const names = {
+          APPLY: "提交入库申请",
+          PREVIEW: "入库申请详情",
+          AUDIT: "审核入库申请"
+        };
+        return names[this.editType];
+      }
+
+      if (this.modalForm.setup === 1 || this.modalForm.setup === null) {
+        return "提交入库申请";
+      } else if (this.modalForm.setup <= 0) {
+        return "入库申请详情";
+      } else {
+        return "审核入库申请";
+      }
+    },
+    IS_MODEL2() {
+      return this.modalForm.examModel === "MODEL2";
+    }
+  },
+  data() {
+    return {
+      modalIsShow: false,
+      modalForm: {},
+      examRule: {},
+      hasClassInfo: false,
+      examRoomInfoList: [],
+      printTotalCount: 0
+    };
+  },
+  created() {
+    this.getExamRule();
+  },
+  methods: {
+    async getExamRule() {
+      const examRule = await examRuleDetail();
+      this.examRule = examRule || {};
+    },
+    modalInfoUpdate(data) {
+      this.modalForm = this.$objAssign(this.modalForm, data);
+      this.getExamRoomInfo();
+    },
+    initData(val) {
+      this.modalForm = this.$objAssign(initModalForm, val);
+      this.modalForm.includePaper = this.examRule.includePaper;
+      this.modalForm.review = this.examRule.review;
+      this.modalForm.customCard = this.examRule.customCard;
+    },
+    visibleChange() {
+      this.initData(this.instance);
+    },
+    async getExamRoomInfo() {
+      const data = await taskApplyExamObject(this.instance.paperNumber);
+
+      if (this.IS_MODEL2) {
+        const { printCount } = data.examRoomInfoList[0];
+        const nums = printCount.split("+").map(item => item * 1);
+        console.log(nums);
+        this.examRoomInfoList = [
+          {
+            backupCount: nums[1],
+            studentCount: nums[0],
+            printCount: nums[0] + nums[1]
+          }
+        ];
+      } else {
+        this.examRoomInfoList = data.examRoomInfoList || [];
+        this.hasClassInfo = this.examRoomInfoList.some(item => item.clazzNames);
+      }
+      this.printTotalCount = data.printTotalCount;
+      this.modalForm.paperName = data.paperName || "";
+      const { date, time } = parseTimeRangeDateAndTime(
+        data.examStartTime,
+        data.examEndTime
+      );
+
+      this.modalForm.examDate = date;
+      this.modalForm.examTime = time;
+    },
+    cancel() {
+      this.modalIsShow = false;
+    },
+    open() {
+      this.modalIsShow = true;
+    },
+    toCancel() {
+      this.$confirm("确定要撤销当前申请吗?", "提示", {
+        type: "warning"
+      })
+        .then(async () => {
+          const data = await cancelOrRestartTaskApply({
+            id: this.instance.id
+          }).catch(() => {});
+          if (!data) return;
+          this.$message.success("操作成功!");
+          this.modified();
+        })
+        .catch(() => {});
+    },
+    modified() {
+      this.cancel();
+      this.$emit("modified");
+    }
+  }
+};
+</script>

+ 346 - 346
src/modules/exam/components/PaperApproveTable.vue

@@ -1,346 +1,346 @@
-<template>
-  <el-dialog
-    class="paper-approve-table"
-    :visible.sync="modalIsShow"
-    :close-on-click-modal="false"
-    :close-on-press-escape="false"
-    :show-close="false"
-    append-to-body
-    fullscreen
-    @open="initData"
-  >
-    <div class="box-justify" slot="title">
-      <span class="el-dialog__title">试卷审批表</span>
-      <div>
-        <el-button type="success" :disabled="loading" @click="toDownload"
-          >下载</el-button
-        >
-        <el-button @click="cancel">取消</el-button>
-      </div>
-    </div>
-
-    <div class="paper-container" ref="PaperContainer">
-      <div class="paper-main" v-if="!pages.length">
-        <div class="paper-a4">
-          <h1 class="paper-h1" id="paper-head">试卷审批表</h1>
-
-          <div class="paper-base" id="paper-base">
-            <div class="paper-row">
-              <div class="paper-item">
-                <span>学院:</span>
-                <span>{{ basicInfo.collegeName }}</span>
-              </div>
-              <div class="paper-item">
-                <span>教研室(或系):</span>
-                <span>{{ basicInfo.teachingRoomName }}</span>
-              </div>
-            </div>
-            <div class="paper-row">
-              <div class="paper-item">
-                <span>使用学期:</span>
-                <span>{{ basicInfo.paperName || "" }}</span>
-              </div>
-              <div class="paper-item">
-                <span>课程名称:</span>
-                <span>{{ basicInfo.courseName }}</span>
-              </div>
-            </div>
-            <div class="paper-row">
-              <div class="paper-item">
-                <span>考试时间:</span>
-                <span>{{ basicInfo.examTime }}</span>
-              </div>
-              <div class="paper-item">
-                <span>拟卷老师:</span>
-                <span>{{ basicInfo.teacherName }}</span>
-              </div>
-            </div>
-          </div>
-
-          <table class="paper-table">
-            <tr>
-              <th style="width: 100px;">卷袋编号</th>
-              <th v-if="hasClassInfo">使用班级</th>
-              <th style="width: 80px;">人数</th>
-              <th style="width: 100px;">总印份数</th>
-            </tr>
-            <tr v-for="item in examRoomInfoList" :key="item.id" :id="item.id">
-              <td style="width: 100px;">{{ item.packageCode }}</td>
-              <td v-if="hasClassInfo">{{ item.clazzNames }}</td>
-              <td style="width: 80px;">{{ item.studentCount }}</td>
-              <td style="width: 100px;">{{ item.printCount }}</td>
-            </tr>
-          </table>
-
-          <table class="paper-table" id="paper-approve">
-            <tr>
-              <th>审批部门</th>
-              <th>审批人</th>
-              <th>审批时间</th>
-              <th style="width: 260px;">审批意见</th>
-            </tr>
-            <tr v-for="(item, index) in approvalInfoList" :key="index">
-              <td>{{ item.approveOrgName }}</td>
-              <td>{{ item.approveName }}</td>
-              <td>{{ item.time | timestampFilter }}</td>
-              <td style="width: 260px;">{{ item.remark }}</td>
-            </tr>
-          </table>
-        </div>
-      </div>
-      <div class="paper-main" v-else>
-        <div class="paper-a4" v-for="(page, pindex) in pages" :key="pindex">
-          <template v-if="pindex === 0">
-            <h1 class="paper-h1">试卷审批表</h1>
-
-            <div class="paper-base">
-              <div class="paper-row">
-                <div class="paper-item">
-                  <span>学院:</span>
-                  <span>{{ basicInfo.collegeName }}</span>
-                </div>
-                <div class="paper-item">
-                  <span>教研室(或系):</span>
-                  <span>{{ basicInfo.teachingRoomName }}</span>
-                </div>
-              </div>
-              <div class="paper-row">
-                <div class="paper-item">
-                  <span>使用学期:</span>
-                  <span>{{ basicInfo.paperName || "" }}</span>
-                </div>
-                <div class="paper-item">
-                  <span>课程名称:</span>
-                  <span>{{ basicInfo.courseName }}</span>
-                </div>
-              </div>
-              <div class="paper-row">
-                <div class="paper-item">
-                  <span>考试时间:</span>
-                  <span>{{ basicInfo.examTime }}</span>
-                </div>
-                <div class="paper-item">
-                  <span>拟卷老师:</span>
-                  <span>{{ basicInfo.teacherName }}</span>
-                </div>
-              </div>
-            </div>
-          </template>
-
-          <template v-for="(part, tindex) in page">
-            <table
-              v-if="part.type === 'room'"
-              class="paper-table"
-              :key="tindex"
-            >
-              <tr>
-                <th style="width: 100px;">卷袋编号</th>
-                <th v-if="hasClassInfo">使用班级</th>
-                <th style="width: 80px;">人数</th>
-                <th style="width: 100px;">总印份数</th>
-              </tr>
-              <tr v-for="item in examRoomInfoList" :key="item.id" :id="item.id">
-                <td style="width: 100px;">{{ item.packageCode }}</td>
-                <td v-if="hasClassInfo">{{ item.clazzNames }}</td>
-                <td style="width: 80px;">{{ item.studentCount }}</td>
-                <td style="width: 100px;">{{ item.printCount }}</td>
-              </tr>
-            </table>
-
-            <table v-else class="paper-table" :key="tindex">
-              <tr>
-                <th>审批部门</th>
-                <th>审批人</th>
-                <th>审批时间</th>
-                <th style="width: 260px;">审批意见</th>
-              </tr>
-              <tr v-for="(item, index) in approvalInfoList" :key="index">
-                <td>{{ item.approveOrgName }}</td>
-                <td>{{ item.approveName }}</td>
-                <td>{{ item.time | timestampFilter }}</td>
-                <td style="width: 260px;">{{ item.remark }}</td>
-              </tr>
-            </table>
-          </template>
-        </div>
-      </div>
-    </div>
-
-    <div slot="footer"></div>
-  </el-dialog>
-</template>
-
-<script>
-import { parseTimeRangeDateAndTime } from "@/plugins/utils";
-import { downloadByApi } from "@/plugins/download";
-import { examTaskApproveForm, downloadExamTaskApproveForm } from "../api";
-
-export default {
-  name: "paper-approve-table",
-  props: {
-    instance: {
-      type: Object,
-      default() {
-        return {};
-      }
-    }
-  },
-  data() {
-    return {
-      modalIsShow: false,
-      loading: false,
-      basicInfo: {},
-      examRoomInfoList: [],
-      hasClassInfo: false,
-      approvalInfoList: [],
-      pages: []
-    };
-  },
-  methods: {
-    async initData() {
-      this.pages = [];
-      this.basicInfo = {};
-      this.examRoomInfoList = [];
-      this.approvalInfoList = [];
-      const paper = await examTaskApproveForm(this.instance.id);
-
-      this.basicInfo = paper.basicInfo;
-      this.examRoomInfoList = paper.examRoomInfoList.map(item => {
-        item.id = this.$randomCode();
-        item.height = 0;
-        return item;
-      });
-      this.hasClassInfo = this.examRoomInfoList.some(item => item.clazzNames);
-      const levelNames = {
-        2: "教研室审批意见",
-        3: "二级学院(部)审批意见"
-      };
-      this.approvalInfoList = paper.approvalInfoList.map(item => {
-        item.levelName = levelNames[item.level];
-        return item;
-      });
-      this.approvalInfoList.sort((a, b) => a.level - b.level);
-
-      const { date, time } = parseTimeRangeDateAndTime(
-        this.basicInfo.examStartTime,
-        this.basicInfo.examEndTime
-      );
-
-      this.basicInfo.examTime = date && time ? `${date}  ${time}` : "--";
-      this.$nextTick(() => {
-        this.rebuildPaper();
-      });
-    },
-    rebuildPaper() {
-      const pageHeight = 1043;
-
-      const pageLimitHeight = [
-        pageHeight -
-          document.getElementById("paper-head").clientHeight -
-          document.getElementById("paper-base").clientHeight -
-          30 -
-          37
-      ];
-      let pages = [];
-      let curPage = [];
-      let curPageLimitHeight = pageHeight;
-      let curPageHeight = 0;
-
-      let roomData = [];
-      this.examRoomInfoList.forEach(item => {
-        const curPageNo = pages.length;
-        curPageLimitHeight = pageLimitHeight[curPageNo] || pageHeight;
-
-        const rowHeight = document.getElementById(item.id).clientHeight;
-        if (rowHeight + curPageHeight <= curPageLimitHeight) {
-          roomData.push(item);
-          curPageHeight += rowHeight;
-        } else {
-          curPage.push({
-            type: "room",
-            data: roomData
-          });
-          pages.push(curPage);
-          curPage = [];
-          roomData = [];
-          roomData.push(item);
-          curPageHeight = rowHeight + 37;
-        }
-      });
-      curPage.push({
-        type: "room",
-        data: roomData
-      });
-      if (
-        curPageHeight +
-          30 +
-          document.getElementById("paper-approve").clientHeight >
-        curPageLimitHeight
-      ) {
-        pages.push(curPage);
-        curPage = [];
-      }
-      curPage.push({
-        type: "approve",
-        data: this.approvalInfoList
-      });
-      pages.push(curPage);
-
-      this.pages = pages;
-    },
-    cancel() {
-      this.modalIsShow = false;
-    },
-    open() {
-      this.modalIsShow = true;
-    },
-    getHtmlContent() {
-      const htmlContent = this.$refs.PaperContainer.innerHTML;
-      const cssContent = `body,div,h1,p,tr,th,td,span{margin:0;padding:0;box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0)}body{font-family:"Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei",Arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:14px;color:#1f2230}.paper-main{width:210mm;margin:0 auto;color:#1f2230}.paper-a4{width:210mm;height:297mm;padding:40px;overflow:hidden;page-break-after:always}.paper-h1{font-size:24px;text-align:center;line-height:1;padding-top:20px;padding-bottom:30px}.paper-base{margin-bottom:30px}.paper-row{margin:0 -5px 10px}.paper-item{display:inline-block;vertical-align:top;width:50%;padding:0 5px}.paper-item>span:first-child{float:left;width:96px;text-align:right}.paper-item>span:last-child{display:block;margin-left:96px}.paper-table{width:100%;border-spacing:0;border-collapse:collapse;margin-bottom:40px;text-align:center}.paper-table th{padding:8px;line-height:20px;letter-spacing:1px;border:1px solid #1f2230}.paper-table td{padding:8px;line-height:20px;border:1px solid #1f2230}`;
-
-      return `
-        <!DOCTYPE html>
-          <html>
-            <head>
-              <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-              <meta name="viewport" content="width=device-width,initial-scale=1.0,
-              maximum-scale=1.0,minimum-scale=1.0, user-scalable=no" "="">
-              <meta name=" renderer" content="webkit|ie-comp|ie-stand" />
-              <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
-              <title>试卷审批表</title>
-
-            </head>
-            <style>${cssContent}</style>
-            <body>${htmlContent}</body>
-          </html>
-        `;
-    },
-    async toDownload() {
-      if (this.loading) return;
-
-      this.loading = true;
-      const datas = {
-        htmlContent: this.getHtmlContent(),
-        examTaskId: this.instance.id
-      };
-      const res = await downloadByApi(() => {
-        return downloadExamTaskApproveForm(datas);
-      }, `${this.instance.courseName}-试卷审批表.pdf`).catch(e => {
-        this.$message.error(e || "下载失败,请重新尝试!");
-      });
-      this.downloading = false;
-
-      if (!res) return;
-      this.$message.success("下载成功!");
-    }
-  }
-};
-</script>
-
-<style scoped>
-.paper-approve-table .paper-a4 {
-  box-shadow: 0 0 1px #666;
-  margin-bottom: 10px;
-}
-</style>
-<style src="@/assets/styles/paper-approve.css" scoped></style>
+<template>
+  <el-dialog
+    class="paper-approve-table"
+    :visible.sync="modalIsShow"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    :show-close="false"
+    append-to-body
+    fullscreen
+    @open="initData"
+  >
+    <div class="box-justify" slot="title">
+      <span class="el-dialog__title">试卷审批表</span>
+      <div>
+        <el-button type="success" :disabled="loading" @click="toDownload"
+          >下载</el-button
+        >
+        <el-button @click="cancel">取消</el-button>
+      </div>
+    </div>
+
+    <div class="paper-container" ref="PaperContainer">
+      <div class="paper-main" v-if="!pages.length">
+        <div class="paper-a4">
+          <h1 class="paper-h1" id="paper-head">试卷审批表</h1>
+
+          <div class="paper-base" id="paper-base">
+            <div class="paper-row">
+              <div class="paper-item">
+                <span>学院:</span>
+                <span>{{ basicInfo.collegeName }}</span>
+              </div>
+              <div class="paper-item">
+                <span>机构(或系):</span>
+                <span>{{ basicInfo.teachingRoomName }}</span>
+              </div>
+            </div>
+            <div class="paper-row">
+              <div class="paper-item">
+                <span>使用学期:</span>
+                <span>{{ basicInfo.paperName || "" }}</span>
+              </div>
+              <div class="paper-item">
+                <span>课程名称:</span>
+                <span>{{ basicInfo.courseName }}</span>
+              </div>
+            </div>
+            <div class="paper-row">
+              <div class="paper-item">
+                <span>考试时间:</span>
+                <span>{{ basicInfo.examTime }}</span>
+              </div>
+              <div class="paper-item">
+                <span>拟卷老师:</span>
+                <span>{{ basicInfo.teacherName }}</span>
+              </div>
+            </div>
+          </div>
+
+          <table class="paper-table">
+            <tr>
+              <th style="width: 100px;">卷袋编号</th>
+              <th v-if="hasClassInfo">使用班级</th>
+              <th style="width: 80px;">人数</th>
+              <th style="width: 100px;">总印份数</th>
+            </tr>
+            <tr v-for="item in examRoomInfoList" :key="item.id" :id="item.id">
+              <td style="width: 100px;">{{ item.packageCode }}</td>
+              <td v-if="hasClassInfo">{{ item.clazzNames }}</td>
+              <td style="width: 80px;">{{ item.studentCount }}</td>
+              <td style="width: 100px;">{{ item.printCount }}</td>
+            </tr>
+          </table>
+
+          <table class="paper-table" id="paper-approve">
+            <tr>
+              <th>审批部门</th>
+              <th>审批人</th>
+              <th>审批时间</th>
+              <th style="width: 260px;">审批意见</th>
+            </tr>
+            <tr v-for="(item, index) in approvalInfoList" :key="index">
+              <td>{{ item.approveOrgName }}</td>
+              <td>{{ item.approveName }}</td>
+              <td>{{ item.time | timestampFilter }}</td>
+              <td style="width: 260px;">{{ item.remark }}</td>
+            </tr>
+          </table>
+        </div>
+      </div>
+      <div class="paper-main" v-else>
+        <div class="paper-a4" v-for="(page, pindex) in pages" :key="pindex">
+          <template v-if="pindex === 0">
+            <h1 class="paper-h1">试卷审批表</h1>
+
+            <div class="paper-base">
+              <div class="paper-row">
+                <div class="paper-item">
+                  <span>学院:</span>
+                  <span>{{ basicInfo.collegeName }}</span>
+                </div>
+                <div class="paper-item">
+                  <span>机构(或系):</span>
+                  <span>{{ basicInfo.teachingRoomName }}</span>
+                </div>
+              </div>
+              <div class="paper-row">
+                <div class="paper-item">
+                  <span>使用学期:</span>
+                  <span>{{ basicInfo.paperName || "" }}</span>
+                </div>
+                <div class="paper-item">
+                  <span>课程名称:</span>
+                  <span>{{ basicInfo.courseName }}</span>
+                </div>
+              </div>
+              <div class="paper-row">
+                <div class="paper-item">
+                  <span>考试时间:</span>
+                  <span>{{ basicInfo.examTime }}</span>
+                </div>
+                <div class="paper-item">
+                  <span>拟卷老师:</span>
+                  <span>{{ basicInfo.teacherName }}</span>
+                </div>
+              </div>
+            </div>
+          </template>
+
+          <template v-for="(part, tindex) in page">
+            <table
+              v-if="part.type === 'room'"
+              class="paper-table"
+              :key="tindex"
+            >
+              <tr>
+                <th style="width: 100px;">卷袋编号</th>
+                <th v-if="hasClassInfo">使用班级</th>
+                <th style="width: 80px;">人数</th>
+                <th style="width: 100px;">总印份数</th>
+              </tr>
+              <tr v-for="item in examRoomInfoList" :key="item.id" :id="item.id">
+                <td style="width: 100px;">{{ item.packageCode }}</td>
+                <td v-if="hasClassInfo">{{ item.clazzNames }}</td>
+                <td style="width: 80px;">{{ item.studentCount }}</td>
+                <td style="width: 100px;">{{ item.printCount }}</td>
+              </tr>
+            </table>
+
+            <table v-else class="paper-table" :key="tindex">
+              <tr>
+                <th>审批部门</th>
+                <th>审批人</th>
+                <th>审批时间</th>
+                <th style="width: 260px;">审批意见</th>
+              </tr>
+              <tr v-for="(item, index) in approvalInfoList" :key="index">
+                <td>{{ item.approveOrgName }}</td>
+                <td>{{ item.approveName }}</td>
+                <td>{{ item.time | timestampFilter }}</td>
+                <td style="width: 260px;">{{ item.remark }}</td>
+              </tr>
+            </table>
+          </template>
+        </div>
+      </div>
+    </div>
+
+    <div slot="footer"></div>
+  </el-dialog>
+</template>
+
+<script>
+import { parseTimeRangeDateAndTime } from "@/plugins/utils";
+import { downloadByApi } from "@/plugins/download";
+import { examTaskApproveForm, downloadExamTaskApproveForm } from "../api";
+
+export default {
+  name: "paper-approve-table",
+  props: {
+    instance: {
+      type: Object,
+      default() {
+        return {};
+      }
+    }
+  },
+  data() {
+    return {
+      modalIsShow: false,
+      loading: false,
+      basicInfo: {},
+      examRoomInfoList: [],
+      hasClassInfo: false,
+      approvalInfoList: [],
+      pages: []
+    };
+  },
+  methods: {
+    async initData() {
+      this.pages = [];
+      this.basicInfo = {};
+      this.examRoomInfoList = [];
+      this.approvalInfoList = [];
+      const paper = await examTaskApproveForm(this.instance.id);
+
+      this.basicInfo = paper.basicInfo;
+      this.examRoomInfoList = paper.examRoomInfoList.map(item => {
+        item.id = this.$randomCode();
+        item.height = 0;
+        return item;
+      });
+      this.hasClassInfo = this.examRoomInfoList.some(item => item.clazzNames);
+      const levelNames = {
+        2: "机构审批意见",
+        3: "二级学院(部)审批意见"
+      };
+      this.approvalInfoList = paper.approvalInfoList.map(item => {
+        item.levelName = levelNames[item.level];
+        return item;
+      });
+      this.approvalInfoList.sort((a, b) => a.level - b.level);
+
+      const { date, time } = parseTimeRangeDateAndTime(
+        this.basicInfo.examStartTime,
+        this.basicInfo.examEndTime
+      );
+
+      this.basicInfo.examTime = date && time ? `${date}  ${time}` : "--";
+      this.$nextTick(() => {
+        this.rebuildPaper();
+      });
+    },
+    rebuildPaper() {
+      const pageHeight = 1043;
+
+      const pageLimitHeight = [
+        pageHeight -
+          document.getElementById("paper-head").clientHeight -
+          document.getElementById("paper-base").clientHeight -
+          30 -
+          37
+      ];
+      let pages = [];
+      let curPage = [];
+      let curPageLimitHeight = pageHeight;
+      let curPageHeight = 0;
+
+      let roomData = [];
+      this.examRoomInfoList.forEach(item => {
+        const curPageNo = pages.length;
+        curPageLimitHeight = pageLimitHeight[curPageNo] || pageHeight;
+
+        const rowHeight = document.getElementById(item.id).clientHeight;
+        if (rowHeight + curPageHeight <= curPageLimitHeight) {
+          roomData.push(item);
+          curPageHeight += rowHeight;
+        } else {
+          curPage.push({
+            type: "room",
+            data: roomData
+          });
+          pages.push(curPage);
+          curPage = [];
+          roomData = [];
+          roomData.push(item);
+          curPageHeight = rowHeight + 37;
+        }
+      });
+      curPage.push({
+        type: "room",
+        data: roomData
+      });
+      if (
+        curPageHeight +
+          30 +
+          document.getElementById("paper-approve").clientHeight >
+        curPageLimitHeight
+      ) {
+        pages.push(curPage);
+        curPage = [];
+      }
+      curPage.push({
+        type: "approve",
+        data: this.approvalInfoList
+      });
+      pages.push(curPage);
+
+      this.pages = pages;
+    },
+    cancel() {
+      this.modalIsShow = false;
+    },
+    open() {
+      this.modalIsShow = true;
+    },
+    getHtmlContent() {
+      const htmlContent = this.$refs.PaperContainer.innerHTML;
+      const cssContent = `body,div,h1,p,tr,th,td,span{margin:0;padding:0;box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0)}body{font-family:"Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei",Arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:14px;color:#1f2230}.paper-main{width:210mm;margin:0 auto;color:#1f2230}.paper-a4{width:210mm;height:297mm;padding:40px;overflow:hidden;page-break-after:always}.paper-h1{font-size:24px;text-align:center;line-height:1;padding-top:20px;padding-bottom:30px}.paper-base{margin-bottom:30px}.paper-row{margin:0 -5px 10px}.paper-item{display:inline-block;vertical-align:top;width:50%;padding:0 5px}.paper-item>span:first-child{float:left;width:96px;text-align:right}.paper-item>span:last-child{display:block;margin-left:96px}.paper-table{width:100%;border-spacing:0;border-collapse:collapse;margin-bottom:40px;text-align:center}.paper-table th{padding:8px;line-height:20px;letter-spacing:1px;border:1px solid #1f2230}.paper-table td{padding:8px;line-height:20px;border:1px solid #1f2230}`;
+
+      return `
+        <!DOCTYPE html>
+          <html>
+            <head>
+              <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+              <meta name="viewport" content="width=device-width,initial-scale=1.0,
+              maximum-scale=1.0,minimum-scale=1.0, user-scalable=no" "="">
+              <meta name=" renderer" content="webkit|ie-comp|ie-stand" />
+              <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
+              <title>试卷审批表</title>
+
+            </head>
+            <style>${cssContent}</style>
+            <body>${htmlContent}</body>
+          </html>
+        `;
+    },
+    async toDownload() {
+      if (this.loading) return;
+
+      this.loading = true;
+      const datas = {
+        htmlContent: this.getHtmlContent(),
+        examTaskId: this.instance.id
+      };
+      const res = await downloadByApi(() => {
+        return downloadExamTaskApproveForm(datas);
+      }, `${this.instance.courseName}-试卷审批表.pdf`).catch(e => {
+        this.$message.error(e || "下载失败,请重新尝试!");
+      });
+      this.downloading = false;
+
+      if (!res) return;
+      this.$message.success("下载成功!");
+    }
+  }
+};
+</script>
+
+<style scoped>
+.paper-approve-table .paper-a4 {
+  box-shadow: 0 0 1px #666;
+  margin-bottom: 10px;
+}
+</style>
+<style src="@/assets/styles/paper-approve.css" scoped></style>

+ 2 - 2
src/modules/exam/components/createExamAndPrintTask/InfoExamTask.vue

@@ -29,7 +29,7 @@
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item prop="teachingRoomId" label="教研室:">
+            <el-form-item prop="teachingRoomId" label="机构:">
               <teaching-room-select
                 v-model="examTask.teachingRoomId"
                 class="width-full"
@@ -305,7 +305,7 @@ export default {
         teachingRoomId: [
           {
             required: true,
-            message: "请选择教研室",
+            message: "请选择机构",
             trigger: "change"
           }
         ],

+ 209 - 209
src/modules/exam/views/DownloadManage.vue

@@ -1,209 +1,209 @@
-<template>
-  <div class="download-manage">
-    <div class="part-box part-box-filter part-box-flex">
-      <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
-        <template v-if="checkPrivilege('condition', 'condition')">
-          <el-form-item label="学期:">
-            <semester-select v-model="filter.semesterId"></semester-select>
-          </el-form-item>
-          <el-form-item label="考试:">
-            <exam-select
-              v-model="filter.examId"
-              :semester-id="filter.semesterId"
-            ></exam-select>
-          </el-form-item>
-          <el-form-item label="学院:">
-            <college-select
-              v-model="filter.orgId"
-              :semester-id="filter.semesterId"
-              cascader
-              placeholder="学院"
-            ></college-select>
-          </el-form-item>
-          <el-form-item label="课程名称:">
-            <el-input
-              v-model="filter.courseName"
-              placeholder="课程名称"
-              clearable
-            ></el-input>
-          </el-form-item>
-        </template>
-
-        <el-form-item label-width="0px">
-          <el-button
-            v-if="checkPrivilege('button', 'select')"
-            type="primary"
-            @click="toPage(1)"
-            >查询</el-button
-          >
-        </el-form-item>
-      </el-form>
-      <div class="part-box-action">
-        <el-button
-          v-if="checkPrivilege('button', 'download')"
-          icon="el-icon-circle-plus-outline"
-          type="info"
-          :disabled="!filterHasQuery"
-          @click="toBatchDownload"
-        >
-          批量下载
-        </el-button>
-      </div>
-    </div>
-
-    <div class="part-box part-box-pad">
-      <el-table
-        ref="TableList"
-        :data="dataList"
-        @selection-change="handleSelectionChange"
-      >
-        <el-table-column
-          type="selection"
-          width="55"
-          align="center"
-        ></el-table-column>
-        <el-table-column
-          type="index"
-          label="序号"
-          width="70"
-          :index="indexMethod"
-        ></el-table-column>
-        <el-table-column prop="courseName" label="课程(代码)">
-          <template slot-scope="scope">
-            {{ scope.row.courseName }}({{ scope.row.courseCode }})
-          </template>
-        </el-table-column>
-        <el-table-column prop="paperNumber" label="试卷编号"></el-table-column>
-        <el-table-column prop="paperType" label="全部卷型" width="100">
-        </el-table-column>
-        <el-table-column
-          prop="unexposedPaperType"
-          label="未曝光卷型"
-          width="100"
-        ></el-table-column>
-        <el-table-column
-          class-name="action-column"
-          label="操作"
-          width="120px"
-          align="center"
-        >
-          <template slot-scope="scope">
-            <el-button
-              v-if="checkPrivilege('link', 'download')"
-              class="btn-primary"
-              type="text"
-              @click="toDownload(scope.row)"
-              >下载</el-button
-            >
-          </template>
-        </el-table-column>
-      </el-table>
-      <div class="part-page">
-        <el-pagination
-          background
-          layout="total,prev, pager, next"
-          :current-page="current"
-          :total="total"
-          :page-size="size"
-          @current-change="toPage"
-        >
-        </el-pagination>
-      </div>
-    </div>
-
-    <!-- DownloadSetDialog -->
-    <download-set-dialog :download-set="downloadSet" ref="DownloadSetDialog">
-    </download-set-dialog>
-  </div>
-</template>
-
-<script>
-import DownloadSetDialog from "../components/DownloadSetDialog";
-import { downloadByApi } from "@/plugins/download";
-import { dataDownloadList, dataDownloadDetail } from "../api";
-
-export default {
-  name: "download-manage",
-  components: {
-    DownloadSetDialog
-  },
-  data() {
-    return {
-      filter: {
-        semesterId: "",
-        examId: "",
-        orgId: "",
-        courseName: ""
-      },
-      queriedFilter: {},
-      current: 1,
-      size: this.GLOBAL.pageSize,
-      total: 0,
-      downloading: false,
-      multipleSelection: [],
-      dataList: [],
-      curRow: {},
-      downloadSet: {}
-    };
-  },
-  computed: {
-    filterHasQuery() {
-      return !Object.keys(this.filter).some(
-        k => this.filter[k] !== this.queriedFilter[k]
-      );
-    }
-  },
-  mounted() {
-    this.getList();
-  },
-  methods: {
-    async getList() {
-      if (!this.checkPrivilege("list", "list")) return;
-
-      const datas = {
-        ...this.filter,
-        pageNumber: this.current,
-        pageSize: this.size
-      };
-      const data = await dataDownloadList(datas);
-      this.dataList = data.records;
-      this.total = data.total;
-      this.queriedFilter = { ...this.filter };
-    },
-    toPage(page) {
-      this.current = page;
-      this.getList();
-    },
-    handleSelectionChange(val) {
-      this.multipleSelection = val.map(item => item.id);
-    },
-    toBatchDownload() {
-      if (this.multipleSelection.length) {
-        this.downloadSet = {
-          idSet: this.multipleSelection
-        };
-      } else {
-        this.downloadSet = {
-          ...this.filter,
-          idSet: this.multipleSelection
-        };
-      }
-      this.$refs.DownloadSetDialog.open();
-    },
-    async toDownload(row) {
-      if (this.downloading) return;
-      this.downloading = true;
-
-      const res = await downloadByApi(() => {
-        return dataDownloadDetail(row.id);
-      }).catch(e => {
-        this.$message.error(e || "下载失败,请重新尝试!");
-      });
-      this.downloading = false;
-
-      if (!res) return;
-      this.$message.success("下载成功!");
-    }
-  }
-};
-</script>
+<template>
+  <div class="download-manage">
+    <div class="part-box part-box-filter part-box-flex">
+      <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
+        <template v-if="checkPrivilege('condition', 'condition')">
+          <el-form-item label="学期:">
+            <semester-select v-model="filter.semesterId"></semester-select>
+          </el-form-item>
+          <el-form-item label="考试:">
+            <exam-select
+              v-model="filter.examId"
+              :semester-id="filter.semesterId"
+            ></exam-select>
+          </el-form-item>
+          <el-form-item label="学院:">
+            <college-select
+              v-model="filter.orgId"
+              :semester-id="filter.semesterId"
+              cascader
+              placeholder="机构"
+            ></college-select>
+          </el-form-item>
+          <el-form-item label="课程名称:">
+            <el-input
+              v-model="filter.courseName"
+              placeholder="课程名称"
+              clearable
+            ></el-input>
+          </el-form-item>
+        </template>
+
+        <el-form-item label-width="0px">
+          <el-button
+            v-if="checkPrivilege('button', 'select')"
+            type="primary"
+            @click="toPage(1)"
+            >查询</el-button
+          >
+        </el-form-item>
+      </el-form>
+      <div class="part-box-action">
+        <el-button
+          v-if="checkPrivilege('button', 'download')"
+          icon="el-icon-circle-plus-outline"
+          type="info"
+          :disabled="!filterHasQuery"
+          @click="toBatchDownload"
+        >
+          批量下载
+        </el-button>
+      </div>
+    </div>
+
+    <div class="part-box part-box-pad">
+      <el-table
+        ref="TableList"
+        :data="dataList"
+        @selection-change="handleSelectionChange"
+      >
+        <el-table-column
+          type="selection"
+          width="55"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          type="index"
+          label="序号"
+          width="70"
+          :index="indexMethod"
+        ></el-table-column>
+        <el-table-column prop="courseName" label="课程(代码)">
+          <template slot-scope="scope">
+            {{ scope.row.courseName }}({{ scope.row.courseCode }})
+          </template>
+        </el-table-column>
+        <el-table-column prop="paperNumber" label="试卷编号"></el-table-column>
+        <el-table-column prop="paperType" label="全部卷型" width="100">
+        </el-table-column>
+        <el-table-column
+          prop="unexposedPaperType"
+          label="未曝光卷型"
+          width="100"
+        ></el-table-column>
+        <el-table-column
+          class-name="action-column"
+          label="操作"
+          width="120px"
+          align="center"
+        >
+          <template slot-scope="scope">
+            <el-button
+              v-if="checkPrivilege('link', 'download')"
+              class="btn-primary"
+              type="text"
+              @click="toDownload(scope.row)"
+              >下载</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="part-page">
+        <el-pagination
+          background
+          layout="total,prev, pager, next"
+          :current-page="current"
+          :total="total"
+          :page-size="size"
+          @current-change="toPage"
+        >
+        </el-pagination>
+      </div>
+    </div>
+
+    <!-- DownloadSetDialog -->
+    <download-set-dialog :download-set="downloadSet" ref="DownloadSetDialog">
+    </download-set-dialog>
+  </div>
+</template>
+
+<script>
+import DownloadSetDialog from "../components/DownloadSetDialog";
+import { downloadByApi } from "@/plugins/download";
+import { dataDownloadList, dataDownloadDetail } from "../api";
+
+export default {
+  name: "download-manage",
+  components: {
+    DownloadSetDialog
+  },
+  data() {
+    return {
+      filter: {
+        semesterId: "",
+        examId: "",
+        orgId: "",
+        courseName: ""
+      },
+      queriedFilter: {},
+      current: 1,
+      size: this.GLOBAL.pageSize,
+      total: 0,
+      downloading: false,
+      multipleSelection: [],
+      dataList: [],
+      curRow: {},
+      downloadSet: {}
+    };
+  },
+  computed: {
+    filterHasQuery() {
+      return !Object.keys(this.filter).some(
+        k => this.filter[k] !== this.queriedFilter[k]
+      );
+    }
+  },
+  mounted() {
+    this.getList();
+  },
+  methods: {
+    async getList() {
+      if (!this.checkPrivilege("list", "list")) return;
+
+      const datas = {
+        ...this.filter,
+        pageNumber: this.current,
+        pageSize: this.size
+      };
+      const data = await dataDownloadList(datas);
+      this.dataList = data.records;
+      this.total = data.total;
+      this.queriedFilter = { ...this.filter };
+    },
+    toPage(page) {
+      this.current = page;
+      this.getList();
+    },
+    handleSelectionChange(val) {
+      this.multipleSelection = val.map(item => item.id);
+    },
+    toBatchDownload() {
+      if (this.multipleSelection.length) {
+        this.downloadSet = {
+          idSet: this.multipleSelection
+        };
+      } else {
+        this.downloadSet = {
+          ...this.filter,
+          idSet: this.multipleSelection
+        };
+      }
+      this.$refs.DownloadSetDialog.open();
+    },
+    async toDownload(row) {
+      if (this.downloading) return;
+      this.downloading = true;
+
+      const res = await downloadByApi(() => {
+        return dataDownloadDetail(row.id);
+      }).catch(e => {
+        this.$message.error(e || "下载失败,请重新尝试!");
+      });
+      this.downloading = false;
+
+      if (!res) return;
+      this.$message.success("下载成功!");
+    }
+  }
+};
+</script>

+ 173 - 173
src/modules/stmms/components/markParam/paramData.js

@@ -1,173 +1,173 @@
-export default {
-  paperStructureInfo: [
-    {
-      id: "7b66fero9p9labg8",
-      qType: "subjective",
-      mainId: "8j3dsapo3k2gs0ao",
-      mainTitle: "1111",
-      mainNumber: 1,
-      subNumber: 1,
-      totalScore: 1,
-      isMainFirstSub: true,
-      expandSub: true
-    },
-    {
-      id: "1qn4giooe61tp9bg",
-      qType: "subjective",
-      mainId: "8j3dsapo3k2gs0ao",
-      mainTitle: "1111",
-      mainNumber: 1,
-      subNumber: 2,
-      totalScore: 1,
-      isMainFirstSub: false,
-      expandSub: true
-    },
-    {
-      id: "835rbhgosr75hgfq",
-      qType: "subjective",
-      mainId: "8j3dsapo3k2gs0ao",
-      mainTitle: "1111",
-      mainNumber: 1,
-      subNumber: 3,
-      totalScore: 1,
-      isMainFirstSub: false,
-      expandSub: true
-    },
-    {
-      id: "07pnh1iqn85sabdg",
-      qType: "subjective",
-      mainId: "9mpi7el81lefm1kj",
-      mainTitle: "2222",
-      mainNumber: 2,
-      subNumber: 1,
-      totalScore: 1,
-      isMainFirstSub: true,
-      expandSub: true
-    },
-    {
-      id: "laitpjllpmg59hhg",
-      qType: "subjective",
-      mainId: "9mpi7el81lefm1kj",
-      mainTitle: "2222",
-      mainNumber: 2,
-      subNumber: 2,
-      totalScore: 1,
-      isMainFirstSub: false,
-      expandSub: true
-    },
-    {
-      id: "deqv73p8qfh0tm68",
-      qType: "subjective",
-      mainId: "9mpi7el81lefm1kj",
-      mainTitle: "2222",
-      mainNumber: 2,
-      subNumber: 3,
-      totalScore: 1,
-      isMainFirstSub: false,
-      expandSub: true
-    }
-  ],
-  groupInfo: [
-    {
-      id: "aaklqjnok11cf4jo",
-      markerList: [
-        { id: "239689678024867840", name: "kw05", label: "kw05(艺术教研室)" },
-        { id: "239689583325872128", name: "mt05", label: "mt05(艺术教研室)" },
-        { id: "239689762452013056", name: "zr05", label: "zr05(艺术教研室)" }
-      ],
-      doubleRate: 1,
-      arbitrateThreshold: 1,
-      questions: [
-        {
-          id: "7b66fero9p9labg8",
-          qType: "subjective",
-          mainId: "8j3dsapo3k2gs0ao",
-          mainTitle: "1111",
-          mainNumber: 1,
-          subNumber: 1,
-          totalScore: 1,
-          isMainFirstSub: true,
-          expandSub: true
-        },
-        {
-          id: "1qn4giooe61tp9bg",
-          qType: "subjective",
-          mainId: "8j3dsapo3k2gs0ao",
-          mainTitle: "1111",
-          mainNumber: 1,
-          subNumber: 2,
-          totalScore: 1,
-          isMainFirstSub: false,
-          expandSub: true
-        },
-        {
-          id: "835rbhgosr75hgfq",
-          qType: "subjective",
-          mainId: "8j3dsapo3k2gs0ao",
-          mainTitle: "1111",
-          mainNumber: 1,
-          subNumber: 3,
-          totalScore: 1,
-          isMainFirstSub: false,
-          expandSub: true
-        }
-      ],
-      picConfig: []
-    },
-    {
-      id: "ddqkaotgp9gjcg38",
-      markerList: [
-        { id: "236486056571052032", name: "test1", label: "test1(美术印刷室)" },
-        { id: "236519144445444096", name: "ys01", label: "ys01(印刷室2)" }
-      ],
-      doubleRate: 1,
-      arbitrateThreshold: 1,
-      questions: [
-        {
-          id: "07pnh1iqn85sabdg",
-          qType: "subjective",
-          mainId: "9mpi7el81lefm1kj",
-          mainTitle: "2222",
-          mainNumber: 2,
-          subNumber: 1,
-          totalScore: 1,
-          isMainFirstSub: true,
-          expandSub: true
-        },
-        {
-          id: "laitpjllpmg59hhg",
-          qType: "subjective",
-          mainId: "9mpi7el81lefm1kj",
-          mainTitle: "2222",
-          mainNumber: 2,
-          subNumber: 2,
-          totalScore: 1,
-          isMainFirstSub: false,
-          expandSub: true
-        },
-        {
-          id: "deqv73p8qfh0tm68",
-          qType: "subjective",
-          mainId: "9mpi7el81lefm1kj",
-          mainTitle: "2222",
-          mainNumber: 2,
-          subNumber: 3,
-          totalScore: 1,
-          isMainFirstSub: false,
-          expandSub: true
-        }
-      ],
-      picConfig: []
-    }
-  ],
-  basicPaperInfo: {
-    thirdRelateId: 1,
-    thirdRelateName: "考试1",
-    courseName: "语文",
-    courseCode: "yw001",
-    paperNumber: 112345667,
-    paperType: "AB",
-    paperTypes: ["A", "B"],
-    status: "FINISH"
-  }
-};
+export default {
+  paperStructureInfo: [
+    {
+      id: "7b66fero9p9labg8",
+      qType: "subjective",
+      mainId: "8j3dsapo3k2gs0ao",
+      mainTitle: "1111",
+      mainNumber: 1,
+      subNumber: 1,
+      totalScore: 1,
+      isMainFirstSub: true,
+      expandSub: true
+    },
+    {
+      id: "1qn4giooe61tp9bg",
+      qType: "subjective",
+      mainId: "8j3dsapo3k2gs0ao",
+      mainTitle: "1111",
+      mainNumber: 1,
+      subNumber: 2,
+      totalScore: 1,
+      isMainFirstSub: false,
+      expandSub: true
+    },
+    {
+      id: "835rbhgosr75hgfq",
+      qType: "subjective",
+      mainId: "8j3dsapo3k2gs0ao",
+      mainTitle: "1111",
+      mainNumber: 1,
+      subNumber: 3,
+      totalScore: 1,
+      isMainFirstSub: false,
+      expandSub: true
+    },
+    {
+      id: "07pnh1iqn85sabdg",
+      qType: "subjective",
+      mainId: "9mpi7el81lefm1kj",
+      mainTitle: "2222",
+      mainNumber: 2,
+      subNumber: 1,
+      totalScore: 1,
+      isMainFirstSub: true,
+      expandSub: true
+    },
+    {
+      id: "laitpjllpmg59hhg",
+      qType: "subjective",
+      mainId: "9mpi7el81lefm1kj",
+      mainTitle: "2222",
+      mainNumber: 2,
+      subNumber: 2,
+      totalScore: 1,
+      isMainFirstSub: false,
+      expandSub: true
+    },
+    {
+      id: "deqv73p8qfh0tm68",
+      qType: "subjective",
+      mainId: "9mpi7el81lefm1kj",
+      mainTitle: "2222",
+      mainNumber: 2,
+      subNumber: 3,
+      totalScore: 1,
+      isMainFirstSub: false,
+      expandSub: true
+    }
+  ],
+  groupInfo: [
+    {
+      id: "aaklqjnok11cf4jo",
+      markerList: [
+        { id: "239689678024867840", name: "kw05", label: "kw05(艺术机构)" },
+        { id: "239689583325872128", name: "mt05", label: "mt05(艺术机构)" },
+        { id: "239689762452013056", name: "zr05", label: "zr05(艺术机构)" }
+      ],
+      doubleRate: 1,
+      arbitrateThreshold: 1,
+      questions: [
+        {
+          id: "7b66fero9p9labg8",
+          qType: "subjective",
+          mainId: "8j3dsapo3k2gs0ao",
+          mainTitle: "1111",
+          mainNumber: 1,
+          subNumber: 1,
+          totalScore: 1,
+          isMainFirstSub: true,
+          expandSub: true
+        },
+        {
+          id: "1qn4giooe61tp9bg",
+          qType: "subjective",
+          mainId: "8j3dsapo3k2gs0ao",
+          mainTitle: "1111",
+          mainNumber: 1,
+          subNumber: 2,
+          totalScore: 1,
+          isMainFirstSub: false,
+          expandSub: true
+        },
+        {
+          id: "835rbhgosr75hgfq",
+          qType: "subjective",
+          mainId: "8j3dsapo3k2gs0ao",
+          mainTitle: "1111",
+          mainNumber: 1,
+          subNumber: 3,
+          totalScore: 1,
+          isMainFirstSub: false,
+          expandSub: true
+        }
+      ],
+      picConfig: []
+    },
+    {
+      id: "ddqkaotgp9gjcg38",
+      markerList: [
+        { id: "236486056571052032", name: "test1", label: "test1(美术印刷室)" },
+        { id: "236519144445444096", name: "ys01", label: "ys01(印刷室2)" }
+      ],
+      doubleRate: 1,
+      arbitrateThreshold: 1,
+      questions: [
+        {
+          id: "07pnh1iqn85sabdg",
+          qType: "subjective",
+          mainId: "9mpi7el81lefm1kj",
+          mainTitle: "2222",
+          mainNumber: 2,
+          subNumber: 1,
+          totalScore: 1,
+          isMainFirstSub: true,
+          expandSub: true
+        },
+        {
+          id: "laitpjllpmg59hhg",
+          qType: "subjective",
+          mainId: "9mpi7el81lefm1kj",
+          mainTitle: "2222",
+          mainNumber: 2,
+          subNumber: 2,
+          totalScore: 1,
+          isMainFirstSub: false,
+          expandSub: true
+        },
+        {
+          id: "deqv73p8qfh0tm68",
+          qType: "subjective",
+          mainId: "9mpi7el81lefm1kj",
+          mainTitle: "2222",
+          mainNumber: 2,
+          subNumber: 3,
+          totalScore: 1,
+          isMainFirstSub: false,
+          expandSub: true
+        }
+      ],
+      picConfig: []
+    }
+  ],
+  basicPaperInfo: {
+    thirdRelateId: 1,
+    thirdRelateName: "考试1",
+    courseName: "语文",
+    courseCode: "yw001",
+    paperNumber: 112345667,
+    paperType: "AB",
+    paperTypes: ["A", "B"],
+    status: "FINISH"
+  }
+};