zhangjie 1 rok pred
rodič
commit
5e3465cdd1

+ 2 - 0
src/constants/enumerate.js

@@ -241,6 +241,8 @@ export const IMPORT_TEMPLATE_TYPE = {
   examStudent: "TEMPLATE_BASIC_EXAM_STUDENT",
   // 课程知识点
   courseProperty: "TEMPLATE_COURSE_DIMENSION",
+  // 阅卷数据
+  markStudent: "TEMPLATE_MARK_STUDENT",
 };
 // 印刷 -------------->
 // 印刷计划状态

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

@@ -239,8 +239,8 @@ export const courseListPage = (datas) => {
 export const courseQuery = (datas) => {
   return $postParam("/api/admin/basic/course/query", datas);
 };
-export const courseQueryByOrg = (belongOrgId) => {
-  return $postParam("/api/admin/basic/course/list_by_org", { belongOrgId });
+export const courseQueryByOrg = (datas) => {
+  return $postParam("/api/admin/basic/course/list_by_org", datas);
 };
 export const deleteCourse = (idList) => {
   return $postParam("/api/admin/basic/course/delete_batch", { idList });
@@ -516,6 +516,9 @@ export const deleteClazzSimple = (idList) => {
 export const updateClazzSimple = (datas) => {
   return $post("/api/admin/teach/clazz/edit", datas);
 };
+export const basicTeachClazzListPage = (datas) => {
+  return $postParam("/api/admin/basic/condition/list_basic_teach_clazz", datas);
+};
 
 // student-simple-manage
 export const studentSimpleListQuery = (datas) => {

+ 129 - 0
src/modules/base/components/course-simple/AddClazzSimpleDialog.vue

@@ -0,0 +1,129 @@
+<template>
+  <el-dialog
+    class="modify-course-simple"
+    :visible.sync="modalIsShow"
+    title="添加教学班"
+    top="10px"
+    width="800px"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    @open="visibleChange"
+  >
+    <el-form ref="FilterForm" label-position="left" inline label-width="0px">
+      <el-form-item>
+        <el-button type="primary" @click="toPage(1)">查询</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-table
+      ref="TableList"
+      :data="dataList"
+      border
+      max-height="440px"
+      @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="clazzName"
+        label="教学班名称"
+        min-width="120"
+      ></el-table-column>
+      <el-table-column
+        prop="courseCode"
+        label="课程编码"
+        min-width="120"
+      ></el-table-column>
+    </el-table>
+
+    <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 { updateClazzSimple, basicTeachClazzListPage } from "../../api";
+
+export default {
+  name: "add-clazz-simple-dialog",
+  props: {
+    course: {
+      type: Object,
+      default() {
+        return {};
+      },
+    },
+  },
+  data() {
+    return {
+      modalIsShow: false,
+      isSubmit: false,
+      dataList: [],
+      multipleSelection: [],
+    };
+  },
+  methods: {
+    visibleChange() {
+      this.multipleSelection = [];
+      this.toPage(1);
+    },
+    cancel() {
+      this.modalIsShow = false;
+    },
+    open() {
+      this.modalIsShow = true;
+    },
+    async getList() {
+      const datas = {
+        examId: this.course.examId,
+      };
+
+      const data = await basicTeachClazzListPage(datas);
+      this.dataList = data || [];
+    },
+    toPage(page) {
+      this.current = page;
+      this.getList();
+    },
+    handleSelectionChange(val) {
+      this.multipleSelection = val.map((item) => item.id);
+    },
+    async submit() {
+      if (!this.multipleSelection.length) {
+        this.$message.error("请选择班级");
+        return;
+      }
+
+      if (this.isSubmit) return;
+      this.isSubmit = true;
+      const data = await updateClazzSimple({
+        idList: this.multipleSelection,
+        teachCourseId: this.course.id,
+      }).catch(() => {});
+      this.isSubmit = false;
+
+      if (!data) return;
+
+      this.$message.success("添加成功!");
+      this.multipleSelection = [];
+      this.$refs.TableList.clearSelection();
+      this.$emit("modified");
+      this.cancel();
+    },
+  },
+};
+</script>

+ 21 - 31
src/modules/base/components/course-simple/ClazzSimpleManage.vue

@@ -10,16 +10,12 @@
           ></el-input>
         </el-form-item>
         <el-form-item>
-          <el-button
-            type="primary"
-            :disabled="!filter.basicCourseId"
-            @click="toPage(1)"
-            >查询</el-button
-          >
+          <el-button type="primary" @click="toPage(1)">查询</el-button>
         </el-form-item>
       </el-form>
       <div v-if="editable" class="part-box-action">
         <el-button type="danger" @click="toBatchDelete">批量删除</el-button>
+        <el-button type="primary" @click="toAdd">添加班级</el-button>
       </div>
     </div>
     <div class="part-box part-box-pad">
@@ -57,15 +53,9 @@
           v-if="editable"
           class-name="action-column"
           label="操作"
-          width="170px"
+          width="140"
         >
           <template slot-scope="scope">
-            <el-button
-              class="btn-primary"
-              type="text"
-              @click="toEdit(scope.row)"
-              >重命名</el-button
-            >
             <el-button
               class="btn-primary"
               type="text"
@@ -96,13 +86,12 @@
       </div>
     </div>
 
-    <!-- ModifyClazzSimple -->
-    <modify-clazz-simple
-      v-if="editable"
-      :instance="curRow"
+    <!-- AddClazzSimpleDialog -->
+    <add-clazz-simple-dialog
+      ref="AddClazzSimpleDialog"
+      :course="course"
       @modified="getList"
-      ref="ModifyClazzSimple"
-    ></modify-clazz-simple>
+    ></add-clazz-simple-dialog>
     <!-- StudentSimpleManage -->
     <student-simple-manage
       v-if="editable"
@@ -115,12 +104,12 @@
 
 <script>
 import { clazzSimpleListPage, deleteClazzSimple } from "../../api";
-import ModifyClazzSimple from "./ModifyClazzSimple.vue";
+import AddClazzSimpleDialog from "./AddClazzSimpleDialog.vue";
 import StudentSimpleManage from "./StudentSimpleManage.vue";
 
 export default {
   name: "clazz-simple-manage",
-  components: { ModifyClazzSimple, StudentSimpleManage },
+  components: { StudentSimpleManage, AddClazzSimpleDialog },
   props: {
     course: {
       type: Object,
@@ -132,7 +121,8 @@ export default {
   data() {
     return {
       filter: {
-        basicCourseId: "",
+        examId: "",
+        courseCode: "",
         teachClazzName: "",
       },
       current: 1,
@@ -146,7 +136,7 @@ export default {
   },
   computed: {
     editable() {
-      return this.userId === this.course.courseCreateId;
+      return this.userId === this.course.createId;
     },
   },
   mounted() {
@@ -154,7 +144,10 @@ export default {
   },
   methods: {
     async initData() {
-      this.filter.basicCourseId = this.course.basicCourseId;
+      Object.assign(this.filter, {
+        examId: this.course.examId,
+        courseCode: this.course.courseCode,
+      });
       await this.getList();
     },
     async getList() {
@@ -175,15 +168,12 @@ export default {
       this.multipleSelection = val.map((item) => item.id);
     },
     toAdd() {
-      this.curRow = { basicCourseId: this.filter.basicCourseId };
-      this.$refs.ModifyClazzSimple.open();
-    },
-    toEdit(row) {
-      this.curRow = row;
-      this.$refs.ModifyClazzSimple.open();
+      this.$refs.AddClazzSimpleDialog.open();
     },
     toManageStudent(row) {
-      this.curRow = row;
+      const course = { ...this.course };
+      delete course.id;
+      this.curRow = { ...row, ...course };
       this.$refs.StudentSimpleManage.open();
     },
     async toDelete(row) {

+ 15 - 149
src/modules/base/components/course-simple/ModifyCourseSimple.vue

@@ -10,69 +10,15 @@
     append-to-body
     @open="visibleChange"
   >
-    <!-- <div class="mb-4 tab-btns">
-      <el-button
-        v-for="tab in tabs"
-        :key="tab.val"
-        size="medium"
-        :type="curTab == tab.val ? 'primary' : 'default'"
-        @click="selectMenu(tab.val)"
-        >{{ tab.name }}
-      </el-button>
-    </div> -->
-    <!-- input -->
-    <div v-if="curTab === 'input'" class="tab-body">
-      <el-form
-        ref="modalFormComp"
-        :model="modalForm"
-        :rules="rules"
-        :key="modalForm.id"
-        label-width="100px"
-      >
-        <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>
-    </div>
     <!-- select -->
-    <div v-if="curTab === 'select'" class="tab-body">
+    <div class="tab-body">
       <select-simple-course
         ref="SelectSimpleCourse"
         v-model="selectedCourseIds"
+        :exam-id="course.examId"
       ></select-simple-course>
     </div>
-    <!-- import -->
-    <div v-if="curTab === 'import'" class="tab-body">
-      <el-button
-        type="success"
-        icon="el-icon-download"
-        @click="downloadTemplate('teachCourse')"
-        >模板下载</el-button
-      >
-      <upload-button
-        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>
-    </div>
-    <div v-if="!IS_IMPORT" slot="footer">
+    <div slot="footer">
       <el-button type="primary" :disabled="isSubmit" @click="submit"
         >确认</el-button
       >
@@ -82,24 +28,18 @@
 </template>
 
 <script>
-import { updateCourseSimple, batchAddCourseSimple } from "../../api";
-import UploadButton from "@/components/UploadButton";
+import { batchAddCourseSimple } from "../../api";
 import SelectSimpleCourse from "./SelectSimpleCourse.vue";
-import templateDownload from "@/mixins/templateDownload";
-
-const initModalForm = {
-  id: null,
-  courseName: "",
-  courseCode: "",
-};
 
 export default {
   name: "modify-course-simple",
-  components: { UploadButton, SelectSimpleCourse },
-  mixins: [templateDownload],
-  computed: {
-    IS_IMPORT() {
-      return this.curTab === "import";
+  components: { SelectSimpleCourse },
+  props: {
+    course: {
+      type: Object,
+      default() {
+        return {};
+      },
     },
   },
   data() {
@@ -107,51 +47,12 @@ export default {
       modalIsShow: false,
       isSubmit: false,
       curTab: "select",
-      tabs: [
-        {
-          name: "手动添加",
-          val: "input",
-        },
-        {
-          name: "课程表选择",
-          val: "select",
-        },
-        {
-          name: "批量导入",
-          val: "import",
-        },
-      ],
-      modalForm: { ...initModalForm },
-      courses: [],
-      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",
-          },
-        ],
-      },
       selectedCourseIds: [],
-      // import
-      uploadUrl: "/api/admin/teach/course/import",
-      dfilename: "教学课程导入模板.xlsx",
     };
   },
   methods: {
     visibleChange() {
-      this.modalForm = { ...initModalForm };
+      this.selectedCourseIds = [];
     },
     cancel() {
       this.modalIsShow = false;
@@ -159,35 +60,7 @@ export default {
     open() {
       this.modalIsShow = true;
     },
-    selectMenu(tab) {
-      this.curTab = tab;
-    },
-    submit() {
-      const submitFunc = {
-        input: this.submitInput,
-        select: this.submitSelect,
-      };
-      submitFunc[this.curTab]();
-    },
-    async submitInput() {
-      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 updateCourseSimple(datas).catch(() => {
-        this.isSubmit = false;
-      });
-
-      if (!data) return;
-
-      this.isSubmit = false;
-      this.$message.success("添加成功!");
-      this.$emit("modified");
-      this.cancel();
-    },
-    async submitSelect() {
+    async submit() {
       if (!this.selectedCourseIds.length) {
         this.$message.error("请选择科目");
         return;
@@ -196,23 +69,16 @@ export default {
       if (this.isSubmit) return;
       this.isSubmit = true;
       const data = await batchAddCourseSimple({
-        basicCourseIdList: this.selectedCourseIds.join(),
+        courseCodeList: this.selectedCourseIds,
+        examId: this.course.examId,
       }).catch(() => {});
       this.isSubmit = false;
 
       if (!data) return;
 
       this.$message.success("添加成功!");
-      this.$emit("modified");
       this.selectedCourseIds = [];
       this.$refs.SelectSimpleCourse.clearSelection();
-    },
-    // import
-    validError(errorData) {
-      this.$message.error(errorData.message);
-    },
-    uploadSuccess(data) {
-      this.$message.success(data.data || "课程导入成功!");
       this.$emit("modified");
       this.cancel();
     },

+ 12 - 174
src/modules/base/components/course-simple/ModifyStudentSimple.vue

@@ -9,207 +9,53 @@
     :close-on-press-escape="false"
     append-to-body
     destroy-on-close
-    @open="visibleChange"
   >
-    <!-- <div class="mb-4 tab-btns">
-      <el-button
-        v-for="tab in tabs"
-        :key="tab.val"
-        size="medium"
-        :type="curTab == tab.val ? 'primary' : 'default'"
-        @click="selectMenu(tab.val)"
-        >{{ tab.name }}
-      </el-button>
-    </div> -->
-    <!-- input -->
-    <div v-if="curTab === 'input'" class="tab-body">
-      <el-form
-        ref="modalFormComp"
-        :model="modalForm"
-        :rules="rules"
-        :key="modalForm.id"
-        label-width="60px"
-      >
-        <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>
-    </div>
     <!-- select -->
-    <div v-if="curTab === 'select'" class="tab-body">
-      <select-simple-student
-        ref="SelectSimpleStudent"
-        v-model="selectedStudentIds"
-      ></select-simple-student>
-    </div>
-    <!-- import -->
-    <div v-if="curTab === 'import'" class="tab-body">
-      <el-button
-        type="success"
-        icon="el-icon-download"
-        @click="downloadTemplate('teachClassStudent')"
-        >模板下载</el-button
-      >
-      <upload-button
-        btn-icon="el-icon-circle-plus-outline"
-        btn-content="批量导入"
-        btn-type="success"
-        :upload-url="uploadUrl"
-        :upload-data="uploadData"
-        :format="['xls', 'xlsx']"
-        accept=".xls,.xlsx"
-        @valid-error="validError"
-        @upload-success="uploadSuccess"
-      >
-      </upload-button>
-    </div>
+    <select-simple-student
+      ref="SelectSimpleStudent"
+      v-model="selectedStudentIds"
+      :exam-id="clazz.examId"
+    ></select-simple-student>
 
-    <div v-if="!IS_IMPORT" slot="footer">
+    <div slot="footer">
       <el-button type="primary" :disabled="isSubmit" @click="submit"
         >确认</el-button
       >
       <el-button @click="cancel">取消</el-button>
     </div>
-    <div v-else slot="footer"></div>
   </el-dialog>
 </template>
 
 <script>
-import { updateStudentSimple, batchAddStudentSimple } from "../../api";
-import UploadButton from "@/components/UploadButton";
+import { batchAddStudentSimple } from "../../api";
 import SelectSimpleStudent from "./SelectSimpleStudent.vue";
-import templateDownload from "@/mixins/templateDownload";
-
-const initModalForm = {
-  id: null,
-  teachClazzId: null,
-  studentName: "",
-  studentCode: "",
-};
 
 export default {
   name: "modify-student-simple",
-  components: { UploadButton, SelectSimpleStudent },
-  mixins: [templateDownload],
+  components: { SelectSimpleStudent },
   props: {
-    instance: {
+    clazz: {
       type: Object,
       default() {
         return {};
       },
     },
   },
-  computed: {
-    IS_IMPORT() {
-      return this.curTab === "import";
-    },
-  },
   data() {
     return {
       modalIsShow: false,
       isSubmit: false,
-      curTab: "select",
-      tabs: [
-        {
-          name: "手动添加",
-          val: "input",
-        },
-        {
-          name: "从课程班级添加",
-          val: "select",
-        },
-        {
-          name: "批量导入",
-          val: "import",
-        },
-      ],
-      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",
-          },
-        ],
-      },
       selectedStudentIds: [],
-      // import
-      uploadData: {},
-      uploadUrl: "/api/admin/teach/student/import",
-      dfilename: "教学班级学生导入模板.xlsx",
     };
   },
   methods: {
-    initData(val) {
-      this.modalForm = this.$objAssign(initModalForm, val);
-      this.uploadData = {
-        teachClazzId: val.teachClazzId,
-      };
-    },
-    visibleChange() {
-      this.initData(this.instance);
-    },
     cancel() {
       this.modalIsShow = false;
     },
     open() {
       this.modalIsShow = true;
     },
-    selectMenu(tab) {
-      this.curTab = tab;
-    },
-    submit() {
-      const submitFunc = {
-        input: this.submitInput,
-        select: this.submitSelect,
-      };
-      submitFunc[this.curTab]();
-    },
-    async submitInput() {
-      const valid = await this.$refs.modalFormComp.validate().catch(() => {});
-      if (!valid) return;
-
-      if (this.isSubmit) return;
-      this.isSubmit = true;
-      const data = await updateStudentSimple(this.modalForm).catch(() => {});
-      this.isSubmit = false;
-
-      if (!data) return;
-
-      this.$message.success("添加成功!");
-      this.$emit("modified");
-      this.modalForm = this.$objAssign(initModalForm, this.instance);
-    },
-    async submitSelect() {
+    async submit() {
       if (!this.selectedStudentIds.length) {
         this.$message.error("请选择学生");
         return;
@@ -218,24 +64,16 @@ export default {
       if (this.isSubmit) return;
       this.isSubmit = true;
       const data = await batchAddStudentSimple({
-        teachClazzId: this.instance.teachClazzId,
-        basicStudentIdSet: this.selectedStudentIds,
+        teachClazzId: this.clazz.id,
+        basicExamStudentIdList: this.selectedStudentIds,
       }).catch(() => {});
       this.isSubmit = false;
 
       if (!data) return;
 
       this.$message.success("添加成功!");
-      this.$emit("modified");
       this.selectedStudentIds = [];
       this.$refs.SelectSimpleStudent.clearSelection();
-    },
-    // import
-    validError(errorData) {
-      this.$message.error(errorData.message);
-    },
-    uploadSuccess(data) {
-      this.$message.success(data.data || "学生导入成功!");
       this.$emit("modified");
       this.cancel();
     },

+ 10 - 52
src/modules/base/components/course-simple/ModifyTeacherSimple.vue

@@ -52,28 +52,7 @@
         v-model="selectedTeacherIds"
       ></select-simple-teacher>
     </div>
-    <!-- import -->
-    <div v-if="curTab === 'import'" class="tab-body">
-      <el-button
-        type="success"
-        icon="el-icon-download"
-        @click="downloadTemplate('teachTeacher')"
-        >模板下载</el-button
-      >
-      <upload-button
-        btn-icon="el-icon-circle-plus-outline"
-        btn-content="批量导入"
-        btn-type="success"
-        :upload-url="uploadUrl"
-        :upload-data="uploadData"
-        :format="['xls', 'xlsx']"
-        accept=".xls,.xlsx"
-        @valid-error="validError"
-        @upload-success="uploadSuccess"
-      >
-      </upload-button>
-    </div>
-    <div v-if="!IS_IMPORT" slot="footer">
+    <div slot="footer">
       <el-button type="primary" :disabled="isSubmit" @click="submit"
         >确认</el-button
       >
@@ -84,19 +63,19 @@
 
 <script>
 import { updateTeacherSimple, batchAddTeacherSimple } from "../../api";
-import UploadButton from "@/components/UploadButton";
 import SelectSimpleTeacher from "./SelectSimpleTeacher.vue";
 import templateDownload from "@/mixins/templateDownload";
 
 const initModalForm = {
-  basicCourseId: null,
+  examId: null,
+  courseCode: null,
   teacherName: "",
   teacherCode: "",
 };
 
 export default {
   name: "modify-teacher-simple",
-  components: { UploadButton, SelectSimpleTeacher },
+  components: { SelectSimpleTeacher },
   mixins: [templateDownload],
   props: {
     course: {
@@ -106,11 +85,6 @@ export default {
       },
     },
   },
-  computed: {
-    IS_IMPORT() {
-      return this.curTab === "import";
-    },
-  },
   data() {
     return {
       modalIsShow: false,
@@ -125,10 +99,6 @@ export default {
           name: "手动添加",
           val: "input",
         },
-        // {
-        //   name: "批量导入",
-        //   val: "import",
-        // },
       ],
       modalForm: { ...initModalForm },
       courses: [],
@@ -153,19 +123,14 @@ export default {
         ],
       },
       selectedTeacherIds: [],
-      // import
-      uploadData: {},
-      uploadUrl: "/api/admin/teach/course/import_teacher",
-      dfilename: "教师团队导入模板.xlsx",
     };
   },
   methods: {
     visibleChange() {
-      this.modalForm = { ...initModalForm };
-      this.modalForm.basicCourseId = this.course.basicCourseId;
-      this.uploadData = {
-        basicCourseId: this.course.basicCourseId,
-      };
+      this.modalForm = Object.assign({}, initModalForm, {
+        examId: this.course.examId,
+        courseCode: this.course.courseCode,
+      });
     },
     cancel() {
       this.modalIsShow = false;
@@ -210,7 +175,8 @@ export default {
       if (this.isSubmit) return;
       this.isSubmit = true;
       const data = await batchAddTeacherSimple({
-        basicCourseId: this.course.basicCourseId,
+        examId: this.course.examId,
+        courseCode: this.course.courseCode,
         userIdList: this.selectedTeacherIds.join(),
       }).catch(() => {});
       this.isSubmit = false;
@@ -221,14 +187,6 @@ export default {
       this.$emit("modified");
       this.selectedTeacherIds = [];
       this.$refs.SelectSimpleTeacher.clearSelection();
-    },
-    // import
-    validError(errorData) {
-      this.$message.error(errorData.message);
-    },
-    uploadSuccess(data) {
-      this.$message.success("教师导入成功!");
-      this.$emit("modified");
       this.cancel();
     },
   },

+ 10 - 2
src/modules/base/components/course-simple/SelectSimpleCourse.vue

@@ -73,11 +73,16 @@ export default {
         return [];
       },
     },
+    examId: {
+      type: String,
+      default: "",
+    },
   },
   data() {
     return {
       filter: {
         belongOrgId: "",
+        examId: "",
       },
       dataList: [],
       multipleSelection: [],
@@ -88,9 +93,12 @@ export default {
       return this.filter.belongOrgId;
     },
   },
+  mounted() {
+    this.filter.examId = this.examId;
+  },
   methods: {
     async getList() {
-      const data = await courseQueryByOrg(this.filter.belongOrgId);
+      const data = await courseQueryByOrg(this.filter);
       this.dataList = data || [];
     },
     toPage(page) {
@@ -102,7 +110,7 @@ export default {
       this.emitChange();
     },
     handleSelectionChange(val) {
-      this.multipleSelection = val.map((item) => item.basicCourseId);
+      this.multipleSelection = val.map((item) => item.courseCode);
       this.emitChange();
     },
     emitChange() {

+ 38 - 63
src/modules/base/components/course-simple/SelectSimpleStudent.vue

@@ -1,36 +1,19 @@
 <template>
   <div class="select-simple-student">
-    <el-form ref="FilterForm" label-position="left" inline label-width="0px">
+    <el-form ref="FilterForm" label-position="left" inline>
       <el-form-item>
-        <college-select
-          v-model="filter.collegeId"
-          class="width-200"
-          placeholder="学院"
-          @change="collegeChange"
-        ></college-select>
+        <el-select v-model="filter.clazzId" placeholder="教学班级" filterable>
+          <el-option
+            v-for="item in clazzList"
+            :key="item.id"
+            :value="item.id"
+            :label="item.clazzName"
+          >
+          </el-option>
+        </el-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>
-        <major-class-select
-          v-model="filter.clazzId"
-          class="width-200"
-          :major-id="filter.majorId"
-          cascader
-          placeholder="班级"
-          @change="classChange"
-        ></major-class-select>
-      </el-form-item>
-      <el-form-item>
-        <el-button type="primary" :disabled="!canSearch" @click="toPage(1)"
+        <el-button type="primary" :disabled="!canSearch" @click="toPage"
           >查询</el-button
         >
       </el-form-item>
@@ -63,17 +46,14 @@
         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-column prop="name" label="姓名"></el-table-column>
+      <el-table-column prop="code" label="学号"></el-table-column>
     </el-table>
   </div>
 </template>
 
 <script>
-import { unitQueryByType } from "../../api";
+import { unitQueryByType, basicTeachClazzListPage } from "../../api";
 
 export default {
   name: "select-simple-student",
@@ -84,50 +64,54 @@ export default {
         return [];
       },
     },
+    examId: {
+      type: String,
+      default: "",
+    },
   },
   data() {
     return {
       filter: {
-        collegeId: "",
-        majorId: "",
         clazzId: "",
       },
-      filterNames: {
-        collegeName: "",
-        majorName: "",
-        clazzName: "",
-      },
+      clazzList: [],
       dataList: [],
       multipleSelection: [],
     };
   },
   computed: {
     canSearch() {
-      return (
-        this.filter.collegeId && this.filter.majorId && this.filter.clazzId
-      );
+      return this.filter.clazzId;
+    },
+  },
+  watch: {
+    examId: {
+      immediate: true,
+      handler(val, oldval) {
+        if (val !== oldval) this.getClazzList();
+      },
     },
   },
   methods: {
+    async getClazzList() {
+      if (!this.examId) return;
+      const datas = {
+        examId: this.examId,
+      };
+
+      const data = await basicTeachClazzListPage(datas);
+      this.clazzList = data || [];
+    },
     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) {
+    toPage() {
       if (!this.canSearch) return;
 
-      this.current = page;
       this.getList();
       this.multipleSelection = [];
       this.emitChange();
@@ -136,15 +120,6 @@ export default {
       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);

+ 1 - 2
src/modules/base/components/course-simple/StudentSimpleManage.vue

@@ -98,7 +98,7 @@
     <!-- ModifyStudentSimple -->
     <modify-student-simple
       ref="ModifyStudentSimple"
-      :instance="curStudent"
+      :clazz="clazz"
       @modified="getList"
     ></modify-student-simple>
   </div>
@@ -173,7 +173,6 @@ export default {
       this.multipleSelection = val.map((item) => item.id);
     },
     toAdd() {
-      this.curStudent = { teachClazzId: this.clazz.id };
       this.$refs.ModifyStudentSimple.open();
     },
     toDelete(row) {

+ 8 - 11
src/modules/base/components/course-simple/TeacherSimpleAssignCourseDialog.vue

@@ -21,14 +21,10 @@
           ></el-input>
         </el-form-item>
         <!-- <el-form-item>
-          <el-button type="primary" @click="toPage(1)">查询</el-button>
+          <el-button type="primary" @click="getList">查询</el-button>
         </el-form-item> -->
       </el-form>
-      <el-table
-        ref="TableList"
-        :data="dataList"
-        @selection-change="handleSelectionChange"
-      >
+      <el-table ref="TableList" :data="dataList">
         <el-table-column width="55" align="center">
           <template slot="header">
             <el-checkbox
@@ -72,6 +68,7 @@ export default {
       orignDataList: [],
       dataList: [],
       filterLabel: "",
+      checkAll: false,
       loading: false,
     };
   },
@@ -91,9 +88,7 @@ export default {
         }
         return item;
       });
-    },
-    handleSelectionChange(val) {
-      this.multipleSelection = val.map((item) => item.clazzId);
+      this.labelChange();
     },
     checkAllChagne(checked) {
       this.dataList.forEach((item) => {
@@ -110,12 +105,14 @@ export default {
       );
     },
     visibleChange() {
+      this.filterLabel = "";
       this.getList();
     },
     cancel() {
       this.modalIsShow = false;
     },
     open() {
+      ``;
       this.modalIsShow = true;
     },
     async submit() {
@@ -133,9 +130,9 @@ export default {
       const res = await teacherSimpleAssignCourse({
         examId: this.teacher.examId,
         courseCode: this.teacher.courseCode,
-        teacherId: this.teacher.id,
+        teacherId: this.teacher.userId,
         clazzIdList,
-      });
+      }).catch(() => {});
       this.loading = false;
       if (!res) return;
       this.$message.success("保存成功!");

+ 6 - 9
src/modules/base/components/course-simple/TeacherSimpleManage.vue

@@ -10,12 +10,7 @@
           ></el-input>
         </el-form-item>
         <el-form-item>
-          <el-button
-            type="primary"
-            :disabled="!filter.basicCourseId"
-            @click="toPage(1)"
-            >查询</el-button
-          >
+          <el-button type="primary" @click="toPage(1)">查询</el-button>
         </el-form-item>
       </el-form>
       <div v-if="editable" class="part-box-action">
@@ -117,7 +112,8 @@ export default {
   data() {
     return {
       filter: {
-        basicCourseId: "",
+        examId: "",
+        courseCode: "",
         userInfo: "",
       },
       current: 1,
@@ -131,7 +127,7 @@ export default {
   },
   computed: {
     editable() {
-      return this.userId === this.course.courseCreateId;
+      return this.userId === this.course.createId;
     },
   },
   mounted() {
@@ -139,7 +135,8 @@ export default {
   },
   methods: {
     async initData() {
-      this.filter.basicCourseId = this.course.basicCourseId;
+      this.filter.examId = this.course.examId;
+      this.filter.courseCode = this.course.courseCode;
       await this.getList();
     },
     async getList() {

+ 0 - 80
src/modules/base/components/course-simple/targetData.js

@@ -1,80 +0,0 @@
-export const weightList = [
-  {
-    courseTargetId: "101",
-    courseTargetName: "课程目标名称1",
-    degreeRequirement: "支撑毕业要求1",
-    totalWeight: 35,
-    evaluation: [
-      {
-        evaluationName: "评价方式名称1",
-        enable: true,
-        weight: 30,
-        targetScore: 20,
-      },
-      {
-        evaluationName: "评价方式名称2",
-        enable: false,
-        weight: null,
-        targetScore: null,
-      },
-      {
-        evaluationName: "评价方式名称3",
-        enable: false,
-        weight: null,
-        targetScore: null,
-      },
-    ],
-  },
-  {
-    courseTargetId: "102",
-    courseTargetName: "课程目标名称2",
-    degreeRequirement: "支撑毕业要求2",
-    totalWeight: 25,
-    evaluation: [
-      {
-        evaluationName: "评价方式名称1",
-        enable: false,
-        weight: null,
-        targetScore: null,
-      },
-      {
-        evaluationName: "评价方式名称2",
-        enable: true,
-        weight: 40,
-        targetScore: 30,
-      },
-      {
-        evaluationName: "评价方式名称3",
-        enable: true,
-        weight: 20,
-        targetScore: 24,
-      },
-    ],
-  },
-  {
-    courseTargetId: "103",
-    courseTargetName: "课程目标名称3",
-    degreeRequirement: "支撑毕业要求3",
-    totalWeight: 40,
-    evaluation: [
-      {
-        evaluationName: "评价方式名称1",
-        enable: false,
-        weight: null,
-        targetScore: null,
-      },
-      {
-        evaluationName: "评价方式名称2",
-        enable: true,
-        weight: 20,
-        targetScore: 30,
-      },
-      {
-        evaluationName: "评价方式名称3",
-        enable: false,
-        weight: null,
-        targetScore: null,
-      },
-    ],
-  },
-];

+ 8 - 8
src/modules/base/views/CourseSimpleManage.vue

@@ -51,7 +51,7 @@
             scope.row.createTime | timestampFilter
           }}</span>
         </el-table-column>
-        <el-table-column class-name="action-column" label="操作" width="160">
+        <el-table-column class-name="action-column" label="操作" width="120">
           <template slot-scope="scope">
             <el-button
               v-if="checkPrivilege('link', 'Link')"
@@ -61,7 +61,10 @@
               >管理</el-button
             >
             <el-button
-              v-if="checkPrivilege('link', 'Delete')"
+              v-if="
+                checkPrivilege('link', 'Delete') &&
+                userId === scope.row.createId
+              "
               class="btn-danger"
               type="text"
               @click="toDelete(scope.row)"
@@ -89,7 +92,7 @@
     <modify-course-simple
       v-if="checkPrivilege('button', 'AddCourse')"
       ref="ModifyCourseSimple"
-      :instance="curCourse"
+      :course="curCourse"
       @modified="getList"
     ></modify-course-simple>
     <!-- CourseSimpleDetail -->
@@ -117,6 +120,7 @@ export default {
       total: 0,
       courses: [],
       curCourse: {},
+      userId: this.$ls.get("user", { id: "" }).id,
     };
   },
   mounted() {
@@ -144,11 +148,7 @@ export default {
       this.toPage(1);
     },
     toAdd() {
-      this.curCourse = {};
-      this.$refs.ModifyCourseSimple.open();
-    },
-    toEdit(row) {
-      this.curCourse = row;
+      this.curCourse = { ...this.filter };
       this.$refs.ModifyCourseSimple.open();
     },
     toEditClazz(row) {

+ 53 - 18
src/modules/mark/views/MarkManage.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="mark-manage">
-    <div class="part-box part-box-filter part-box-flex">
+    <div class="part-box part-box-filter">
       <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
         <template v-if="checkPrivilege('condition', 'condition')">
           <secp-select
@@ -29,22 +29,32 @@
           >
         </el-form-item>
       </el-form>
-      <div class="part-box-action">
-        <el-button
-          v-if="checkPrivilege('button', 'Export')"
-          type="primary"
-          @click="toExport"
-        >
-          导出评卷员工作量
-        </el-button>
-        <el-button
-          v-if="checkPrivilege('button', 'BatchFinish')"
-          type="primary"
-          :disabled="!multipleSelection.length"
-          @click="toBatchFinish"
-        >
-          结束评卷
-        </el-button>
+      <div class="box-justify">
+        <div></div>
+        <div>
+          <el-button
+            v-if="checkPrivilege('button', 'import')"
+            type="primary"
+            @click="toImportMarkData"
+          >
+            导入阅卷数据
+          </el-button>
+          <el-button
+            v-if="checkPrivilege('button', 'Export')"
+            type="primary"
+            @click="toExport"
+          >
+            导出评卷员工作量
+          </el-button>
+          <el-button
+            v-if="checkPrivilege('button', 'BatchFinish')"
+            type="primary"
+            :disabled="!multipleSelection.length"
+            @click="toBatchFinish"
+          >
+            结束评卷
+          </el-button>
+        </div>
       </div>
     </div>
 
@@ -124,6 +134,18 @@
     </div>
     <!-- MarkDetail -->
     <mark-detail ref="MarkDetail" :instance="curRow"></mark-detail>
+    <!-- ImportFile -->
+    <import-file
+      v-if="checkPrivilege('button', 'import')"
+      ref="ImportFile"
+      title="导入阅卷数据"
+      :upload-url="uploadUrl"
+      :format="['xls', 'xlsx']"
+      :download-handle="() => downloadTemplate('markStudent')"
+      :download-filename="dfilename"
+      :auto-upload="false"
+      @upload-success="uploadSuccess"
+    ></import-file>
   </div>
 </template>
 
@@ -135,10 +157,13 @@ import {
 } from "../api";
 import { downloadByApi } from "@/plugins/download";
 import MarkDetail from "../components/markDetail/MarkDetail.vue";
+import ImportFile from "@/components/ImportFile.vue";
+import templateDownload from "@/mixins/templateDownload";
 
 export default {
   name: "mark-manage",
-  components: { MarkDetail },
+  components: { MarkDetail, ImportFile },
+  mixins: [templateDownload],
   data() {
     return {
       filter: {
@@ -155,6 +180,9 @@ export default {
       curRow: {},
       multipleSelection: [],
       downloading: false,
+      // import
+      uploadUrl: "/api/admin/mark/setting/mark_student_import",
+      dfilename: "阅卷数据导入模板.xlsx",
     };
   },
   methods: {
@@ -250,6 +278,13 @@ export default {
         return;
       }
     },
+    toImportMarkData() {
+      this.$refs.ImportFile.open();
+    },
+    uploadSuccess() {
+      this.$message.success("文件上传成功,后台正在导入!");
+      this.getList();
+    },
   },
 };
 </script>