zhangjie преди 2 години
родител
ревизия
c8f7043aaa

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

@@ -345,6 +345,9 @@ body {
 .color-gray {
   color: $--color-text-gray;
 }
+.color-gray-1 {
+  color: $--color-text-gray-1;
+}
 .color-gray-2 {
   color: $--color-text-gray-2;
 }

+ 3 - 0
src/modules/base/api.js

@@ -210,6 +210,9 @@ export const deleteCourseSimple = idList => {
 export const updateCourseSimple = datas => {
   return $post("/api/admin/teach/course/create", datas);
 };
+export const batchAddCourseSimple = datas => {
+  return $post("/api/admin/teach/course/create", datas);
+};
 // flow-manage
 export const flowListPage = datas => {
   return $postParam("/api/admin/custom/flow/list", datas);

+ 0 - 155
src/modules/base/components/ModifyCourseSimple.vue

@@ -1,155 +0,0 @@
-<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="basicCourseId" label="课程名称:">
-        <el-select
-          class="width-full"
-          v-model="modalForm.basicCourseId"
-          placeholder="课程"
-          clearable
-          filterable
-          @change="courseChange"
-        >
-          <el-option
-            v-for="item in courses"
-            :key="item.id"
-            :value="item.id"
-            :label="item.name"
-          >
-            <span>{{ `${item.name}(${item.code})` }}</span>
-          </el-option>
-        </el-select>
-      </el-form-item>
-      <el-form-item prop="basicCourseCode" label="课程编码:">
-        <el-input
-          v-model.trim="modalForm.basicCourseCode"
-          placeholder="课程编码"
-          readonly
-        ></el-input>
-      </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 { updateCourseSimple, courseSimpleQuery } from "../api";
-
-const initModalForm = {
-  id: null,
-  basicCourseId: "",
-  basicCourseCode: ""
-};
-
-export default {
-  name: "modify-course-simple",
-  props: {
-    instance: {
-      type: Object,
-      default() {
-        return {};
-      }
-    }
-  },
-  computed: {
-    isEdit() {
-      return !!this.instance.id;
-    },
-    title() {
-      return (this.isEdit ? "编辑" : "新增") + "课程";
-    }
-  },
-  data() {
-    return {
-      modalIsShow: false,
-      isSubmit: false,
-      modalForm: { ...initModalForm },
-      courses: [],
-      rules: {
-        basicCourseId: [
-          {
-            required: true,
-            message: "请选择课程",
-            trigger: "change"
-          }
-        ],
-        basicCourseCode: [
-          {
-            required: true,
-            message: "需要课程编码",
-            trigger: "change"
-          }
-        ]
-      }
-    };
-  },
-  mounted() {
-    this.getCourseSimple();
-  },
-  methods: {
-    async getCourseSimple() {
-      const data = await courseSimpleQuery();
-      this.courses = data || [];
-    },
-    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;
-    },
-    courseChange(val) {
-      const course = this.courses.find(item => item.id === val);
-      this.modalForm.basicCourseCode = course.code;
-    },
-    async submit() {
-      const valid = await this.$refs.modalFormComp.validate().catch(() => {});
-      if (!valid) return;
-
-      if (this.isSubmit) return;
-      this.isSubmit = true;
-      let datas = { basicCourseId: this.modalForm.basicCourseId };
-      const data = await updateCourseSimple(datas).catch(() => {
-        this.isSubmit = false;
-      });
-
-      if (!data) return;
-
-      this.isSubmit = false;
-      this.$message.success(this.title + "成功!");
-      this.$emit("modified");
-      this.cancel();
-    }
-  }
-};
-</script>

+ 212 - 0
src/modules/base/components/course-simple/ClazzSimpleManage.vue

@@ -0,0 +1,212 @@
+<template>
+  <div class="clazz-simple-manage">
+    <div class="part-box part-box-filter part-box-flex">
+      <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
+        <el-form-item label="班级名称:">
+          <el-input
+            v-model.trim="filter.teachClazzName"
+            placeholder="班级名称"
+            clearable
+          ></el-input>
+        </el-form-item>
+        <el-form-item>
+          <el-button
+            type="primary"
+            :disabled="!filter.teachCourseId"
+            @click="toPage(1)"
+            >查询</el-button
+          >
+        </el-form-item>
+      </el-form>
+      <div 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">
+      <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="teachClazzName"
+          label="班级名称"
+        ></el-table-column>
+        <el-table-column
+          prop="teachStudentCount"
+          label="学生人数"
+        ></el-table-column>
+        <el-table-column prop="createTime" label="创建时间" width="170">
+          <span slot-scope="scope">{{
+            scope.row.createTime | timestampFilter
+          }}</span>
+        </el-table-column>
+        <el-table-column class-name="action-column" label="操作" width="170px">
+          <template slot-scope="scope">
+            <el-button
+              class="btn-primary"
+              type="text"
+              @click="toEdit(scope.row)"
+              >重命名</el-button
+            >
+            <el-button
+              class="btn-primary"
+              type="text"
+              @click="toManageStudent(scope.row)"
+              >管理学生</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, sizes, prev, pager, next, jumper"
+          :pager-count="5"
+          :current-page="current"
+          :total="total"
+          :page-size="size"
+          @current-change="toPage"
+          @size-change="pageSizeChange"
+        >
+        </el-pagination>
+      </div>
+    </div>
+
+    <!-- ModifyClazzSimple -->
+    <modify-clazz-simple
+      :instance="curRow"
+      @modified="getList"
+      ref="ModifyClazzSimple"
+    ></modify-clazz-simple>
+    <!-- StudentSimpleManage -->
+    <student-simple-manage
+      ref="StudentSimpleManage"
+      :clazz="curRow"
+      @modified="getList"
+    ></student-simple-manage>
+  </div>
+</template>
+
+<script>
+import { clazzSimpleListPage, deleteClazzSimple } from "../../api";
+import ModifyClazzSimple from "./ModifyClazzSimple.vue";
+import StudentSimpleManage from "./StudentSimpleManage.vue";
+
+export default {
+  name: "clazz-simple-manage",
+  components: { ModifyClazzSimple, StudentSimpleManage },
+  props: {
+    course: {
+      type: Object,
+      default() {
+        return {};
+      }
+    }
+  },
+  data() {
+    return {
+      filter: {
+        teachCourseId: "",
+        teachClazzName: ""
+      },
+      current: 1,
+      size: this.GLOBAL.pageSize,
+      total: 0,
+      multipleSelection: [],
+      dataList: [],
+      curRow: {}
+    };
+  },
+  mounted() {
+    this.initData();
+  },
+  methods: {
+    async initData() {
+      this.filter.teachCourseId = this.course.id;
+      await this.getList();
+    },
+    async getList() {
+      const datas = {
+        ...this.filter,
+        pageNumber: this.current,
+        pageSize: this.size
+      };
+      const data = await clazzSimpleListPage(datas);
+      this.dataList = data.records;
+      this.total = data.total;
+    },
+    toPage(page) {
+      this.current = page;
+      this.getList();
+    },
+    handleSelectionChange(val) {
+      this.multipleSelection = val.map(item => item.id);
+    },
+    toAdd() {
+      this.curRow = { teachCourseId: this.filter.teachCourseId };
+      this.$refs.ModifyClazzSimple.open();
+    },
+    toEdit(row) {
+      this.curRow = row;
+      this.$refs.ModifyClazzSimple.open();
+    },
+    toManageStudent(row) {
+      this.curRow = row;
+      this.$refs.StudentSimpleManage.open();
+    },
+    async toDelete(row) {
+      const confirm = await this.$confirm(
+        `确定要删除班级【${row.teachClazzName}】吗?`,
+        "提示",
+        {
+          type: "warning"
+        }
+      ).catch(() => {});
+      if (confirm !== "confirm") return;
+
+      await deleteClazzSimple([row.id]);
+      this.$message.success("删除成功!");
+      this.deletePageLastItem();
+    },
+    async toBatchDelete() {
+      if (!this.multipleSelection.length) {
+        this.$message.error("请选择要删除的数据");
+        return;
+      }
+
+      const confirm = await this.$confirm(
+        `确定要删除选中的这些数据吗?`,
+        "提示",
+        {
+          type: "warning"
+        }
+      ).catch(() => {});
+      if (confirm !== "confirm") return;
+
+      await deleteClazzSimple(this.multipleSelection);
+      this.$message.success("删除成功!");
+      this.deletePageLastItem(this.multipleSelection.length);
+      this.multipleSelection = [];
+    }
+  }
+};
+</script>

+ 80 - 0
src/modules/base/components/course-simple/CourseSimpleDetail.vue

@@ -0,0 +1,80 @@
+<template>
+  <div class="course-simple-detail">
+    <el-dialog
+      class="page-dialog"
+      :visible.sync="modalIsShow"
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+      append-to-body
+      fullscreen
+    >
+      <div slot="title">
+        课程管理<span class="color-gray ml-2"
+          >{{ course.courseName }}({{ course.courseCode }})</span
+        >
+      </div>
+      <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>
+
+      <div v-if="modalIsShow">
+        <component :is="compName" :course="course"></component>
+      </div>
+
+      <div slot="footer"></div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import ClazzSimpleManage from "./ClazzSimpleManage.vue";
+
+export default {
+  name: "course-simple-detail",
+  components: { ClazzSimpleManage },
+  props: {
+    course: {
+      type: Object,
+      default() {
+        return {};
+      }
+    }
+  },
+  data() {
+    return {
+      modalIsShow: false,
+      curTab: "clazz",
+      tabs: [
+        {
+          name: "班级管理",
+          val: "clazz"
+        },
+        {
+          name: "教师团队管理",
+          val: "teacher"
+        }
+      ]
+    };
+  },
+  computed: {
+    compName() {
+      return `${this.curTab}-simple-manage`;
+    }
+  },
+  methods: {
+    cancel() {
+      this.modalIsShow = false;
+    },
+    open() {
+      this.modalIsShow = true;
+    }
+  }
+};
+</script>

+ 1 - 33
src/modules/base/components/ModifyClazzSimple.vue → src/modules/base/components/course-simple/ModifyClazzSimple.vue

@@ -24,25 +24,6 @@
           clearable
         ></el-input>
       </el-form-item>
-      <el-form-item prop="teachCourseId" label="课程:">
-        <el-select
-          v-model="modalForm.teachCourseId"
-          placeholder="课程"
-          clearable
-          filterable
-          :disabled="isEdit"
-          class="width-full"
-        >
-          <el-option
-            v-for="item in courses"
-            :key="item.id"
-            :value="item.id"
-            :label="item.name"
-          >
-            <span>{{ `${item.name}(${item.code})` }}</span>
-          </el-option>
-        </el-select>
-      </el-form-item>
     </el-form>
     <div slot="footer">
       <el-button type="primary" :disabled="isSubmit" @click="submit"
@@ -54,7 +35,7 @@
 </template>
 
 <script>
-import { updateClazzSimple } from "../api";
+import { updateClazzSimple } from "../../api";
 
 const initModalForm = {
   id: null,
@@ -70,12 +51,6 @@ export default {
       default() {
         return {};
       }
-    },
-    courses: {
-      type: Array,
-      default() {
-        return [];
-      }
     }
   },
   computed: {
@@ -103,13 +78,6 @@ export default {
             message: "班级名称不能超过30个字",
             trigger: "change"
           }
-        ],
-        teachCourseId: [
-          {
-            required: true,
-            message: "请选择课程",
-            trigger: "change"
-          }
         ]
       }
     };

+ 219 - 0
src/modules/base/components/course-simple/ModifyCourseSimple.vue

@@ -0,0 +1,219 @@
+<template>
+  <el-dialog
+    class="modify-course"
+    :visible.sync="modalIsShow"
+    title="添加课程"
+    top="10px"
+    width="800px"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    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-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>
+    </div>
+    <!-- select -->
+    <div v-if="curTab === 'select'" class="tab-body">
+      <select-simple-course
+        ref="SelectSimpleCourse"
+        v-model="selectedCourseIds"
+      ></select-simple-course>
+    </div>
+    <!-- import -->
+    <div v-if="curTab === 'import'" class="tab-body">
+      <el-button type="success" icon="el-icon-download"
+        ><a :href="downloadUrl" :download="dfilename">模板下载</a></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">
+      <el-button type="primary" :disabled="isSubmit" @click="submit"
+        >确认</el-button
+      >
+      <el-button @click="cancel">取消</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+import { updateCourseSimple, batchAddCourseSimple } from "../../api";
+import UploadButton from "@/components/UploadButton";
+import SelectSimpleCourse from "./SelectSimpleCourse.vue";
+
+const initModalForm = {
+  id: null,
+  courseName: "",
+  courseCode: ""
+};
+
+export default {
+  name: "modify-course-simple",
+  components: { UploadButton, SelectSimpleCourse },
+  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 },
+      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
+      uploadData: {},
+      uploadUrl: "/api/admin/teach/course/import",
+      downloadUrl: "/temps/courseSimpleTemplate.xlsx",
+      dfilename: "教学课程导入模板.xlsx"
+    };
+  },
+  methods: {
+    visibleChange() {
+      this.modalForm = { ...initModalForm };
+    },
+    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;
+      let datas = { ...this.modalForm };
+      const data = await updateCourseSimple(datas).catch(() => {
+        this.isSubmit = false;
+      });
+
+      if (!data) return;
+
+      this.isSubmit = false;
+      this.$message.success(this.title + "成功!");
+      this.$emit("modified");
+      this.cancel();
+    },
+    async submitSelect() {
+      if (!this.selectedCourseIds.length) {
+        this.$message.error("请选择科目");
+        return;
+      }
+
+      if (this.isSubmit) return;
+      this.isSubmit = true;
+      const data = await batchAddCourseSimple({
+        basicCourseIdSet: this.selectedCourseIds
+      }).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();
+    }
+  }
+};
+</script>

+ 8 - 8
src/modules/base/components/ModifyStudentSimple.vue → src/modules/base/components/course-simple/ModifyStudentSimple.vue

@@ -48,10 +48,10 @@
     </div>
     <!-- select -->
     <div v-if="curTab === 'select'" class="tab-body">
-      <select-class-student
-        ref="SelectClassStudent"
+      <select-simple-student
+        ref="SelectSimpleStudent"
         v-model="selectedStudentIds"
-      ></select-class-student>
+      ></select-simple-student>
     </div>
     <!-- import -->
     <div v-if="curTab === 'import'" class="tab-body">
@@ -83,9 +83,9 @@
 </template>
 
 <script>
-import { updateStudentSimple, batchAddStudentSimple } from "../api";
-import UploadButton from "../../../components/UploadButton";
-import SelectClassStudent from "./SelectClassStudent";
+import { updateStudentSimple, batchAddStudentSimple } from "../../api";
+import UploadButton from "@/components/UploadButton";
+import SelectSimpleStudent from "./SelectSimpleStudent.vue";
 
 const initModalForm = {
   id: null,
@@ -96,7 +96,7 @@ const initModalForm = {
 
 export default {
   name: "modify-student-simple",
-  components: { UploadButton, SelectClassStudent },
+  components: { UploadButton, SelectSimpleStudent },
   props: {
     instance: {
       type: Object,
@@ -224,7 +224,7 @@ export default {
       this.$message.success("添加成功!");
       this.$emit("modified");
       this.selectedStudentIds = [];
-      this.$refs.SelectClassStudent.clearSelection();
+      this.$refs.SelectSimpleStudent.clearSelection();
     },
     // import
     validError(errorData) {

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


+ 123 - 0
src/modules/base/components/course-simple/SelectSimpleCourse.vue

@@ -0,0 +1,123 @@
+<template>
+  <div class="select-class-student">
+    <el-form ref="FilterForm" label-position="left" inline label-width="0px">
+      <el-form-item>
+        <org-select
+          v-model="filter.belongOrgId"
+          placeholder="开课部门"
+        ></org-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="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="courseName"
+        label="课程名称"
+        min-width="120"
+      ></el-table-column>
+      <el-table-column
+        prop="courseCode"
+        label="课程编码"
+        min-width="120"
+      ></el-table-column>
+      <el-table-column
+        prop="teachingRoomName"
+        label="开课部门"
+        min-width="120"
+      ></el-table-column>
+    </el-table>
+  </div>
+</template>
+
+<script>
+import { courseListPage } from "../../api";
+
+export default {
+  name: "select-simple-course",
+  props: {
+    value: {
+      type: Array,
+      default() {
+        return [];
+      }
+    }
+  },
+  data() {
+    return {
+      filter: {
+        belongOrgId: "",
+        enable: true,
+        pageNumber: 1,
+        pageSize: 1000
+      },
+      dataList: [],
+      multipleSelection: []
+    };
+  },
+  computed: {
+    canSearch() {
+      return this.filter.belongOrgId;
+    }
+  },
+  methods: {
+    async getList() {
+      const datas = {
+        ...this.filter
+      };
+      const data = await courseListPage(datas);
+      this.dataList = data.records || [];
+    },
+    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();
+    },
+    emitChange() {
+      this.$emit("input", this.multipleSelection);
+      this.$emit("change", this.multipleSelection);
+    },
+    clearSelection() {
+      this.$refs.TableList.clearSelection();
+    }
+  }
+};
+</script>

+ 4 - 5
src/modules/base/components/SelectClassStudent.vue → src/modules/base/components/course-simple/SelectSimpleStudent.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="select-class-student">
+  <div class="select-simple-student">
     <el-form ref="FilterForm" label-position="left" inline label-width="0px">
       <el-form-item>
         <college-select
@@ -49,7 +49,7 @@
       ref="TableList"
       :data="dataList"
       border
-      max-height="440"
+      max-height="440px"
       @selection-change="handleSelectionChange"
     >
       <el-table-column
@@ -73,11 +73,10 @@
 </template>
 
 <script>
-// import { studentListQuery } from "../api";
-import { unitQueryByType } from "../../base/api";
+import { unitQueryByType } from "../../api";
 
 export default {
-  name: "select-class-student",
+  name: "select-simple-student",
   props: {
     value: {
       type: Array,

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


+ 3 - 3
src/modules/base/components/ModifyClazzSimpleStudent.vue → src/modules/base/components/course-simple/StudentSimpleManage.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <el-dialog
-      class="modify-clazz-simple-student page-dialog"
+      class="clazz-simple-student-manage page-dialog"
       :visible.sync="modalIsShow"
       :title="title"
       :close-on-click-modal="false"
@@ -105,11 +105,11 @@
 </template>
 
 <script>
-import { studentSimpleListQuery, deleteStudentSimple } from "../api";
+import { studentSimpleListQuery, deleteStudentSimple } from "../../api";
 import ModifyStudentSimple from "./ModifyStudentSimple";
 
 export default {
-  name: "modify-clazz-simple-student",
+  name: "clazz-simple-student-manage",
   components: { ModifyStudentSimple },
   props: {
     clazz: {

+ 193 - 0
src/modules/base/components/course-simple/TeacherSimpleManage.vue

@@ -0,0 +1,193 @@
+<template>
+  <div class="teacher-simple-manage">
+    <div class="part-box part-box-filter part-box-flex">
+      <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
+        <el-form-item>
+          <el-input
+            v-model.trim="filter.teachClazzName"
+            placeholder="请输入姓名或工号"
+            clearable
+          ></el-input>
+        </el-form-item>
+        <el-form-item>
+          <el-button
+            type="primary"
+            :disabled="!filter.teachCourseId"
+            @click="toPage(1)"
+            >查询</el-button
+          >
+        </el-form-item>
+      </el-form>
+      <div 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">
+      <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="teachClazzName" label="姓名"></el-table-column>
+        <el-table-column
+          prop="teachStudentCount"
+          label="工号"
+        ></el-table-column>
+        <el-table-column
+          prop="teachStudentCount"
+          label="角色"
+        ></el-table-column>
+        <el-table-column
+          prop="teachStudentCount"
+          label="所在机构"
+        ></el-table-column>
+        <el-table-column class-name="action-column" label="操作" width="170px">
+          <template slot-scope="scope">
+            <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, sizes, prev, pager, next, jumper"
+          :pager-count="5"
+          :current-page="current"
+          :total="total"
+          :page-size="size"
+          @current-change="toPage"
+          @size-change="pageSizeChange"
+        >
+        </el-pagination>
+      </div>
+    </div>
+
+    <!-- ModifyTeacherSimple -->
+    <modify-teacher-simple
+      :instance="curRow"
+      @modified="getList"
+      ref="ModifyTeacherSimple"
+    ></modify-teacher-simple>
+  </div>
+</template>
+
+<script>
+import { clazzSimpleListPage, deleteClazzSimple } from "../../api";
+import ModifyTeacherSimple from "../components/ModifyTeacherSimple";
+
+export default {
+  name: "teacher-simple-manage",
+  components: { ModifyTeacherSimple },
+  props: {
+    course: {
+      type: Object,
+      default() {
+        return {};
+      }
+    }
+  },
+  data() {
+    return {
+      filter: {
+        teachCourseId: "",
+        teachClazzName: ""
+      },
+      current: 1,
+      size: this.GLOBAL.pageSize,
+      total: 0,
+      multipleSelection: [],
+      dataList: [],
+      curRow: {}
+    };
+  },
+  mounted() {
+    this.initData();
+  },
+  methods: {
+    async initData() {
+      this.filter.teachCourseId = this.course.id;
+      await this.getList();
+    },
+    async getList() {
+      const datas = {
+        ...this.filter,
+        pageNumber: this.current,
+        pageSize: this.size
+      };
+      const data = await clazzSimpleListPage(datas);
+      this.dataList = data.records;
+      this.total = data.total;
+    },
+    toPage(page) {
+      this.current = page;
+      this.getList();
+    },
+    handleSelectionChange(val) {
+      this.multipleSelection = val.map(item => item.id);
+    },
+    toAdd() {
+      this.curRow = { teachCourseId: this.filter.teachCourseId };
+      this.$refs.ModifyTeacherSimple.open();
+    },
+    toEdit(row) {
+      this.curRow = row;
+      this.$refs.ModifyTeacherSimple.open();
+    },
+    toEditStudent(row) {
+      this.curRow = row;
+      this.$refs.ModifyClazzSimpleStudent.open();
+    },
+    async toDelete(row) {
+      const confirm = await this.$confirm(
+        `确定要删除班级【${row.teachClazzName}】吗?`,
+        "提示",
+        {
+          type: "warning"
+        }
+      ).catch(() => {});
+      if (confirm !== "confirm") return;
+
+      await deleteClazzSimple([row.id]);
+      this.$message.success("删除成功!");
+      this.deletePageLastItem();
+    },
+    async toBatchDelete() {
+      if (!this.multipleSelection.length) {
+        this.$message.error("请选择要删除的数据");
+        return;
+      }
+
+      const confirm = await this.$confirm(
+        `确定要删除选中的这些数据吗?`,
+        "提示",
+        {
+          type: "warning"
+        }
+      ).catch(() => {});
+      if (confirm !== "confirm") return;
+
+      await deleteClazzSimple(this.multipleSelection);
+      this.$message.success("删除成功!");
+      this.deletePageLastItem(this.multipleSelection.length);
+      this.multipleSelection = [];
+    }
+  }
+};
+</script>

+ 9 - 9
src/modules/base/views/ClazzSimpleManage.vue

@@ -116,12 +116,12 @@
       @modified="getList"
       ref="ModifyClazzSimple"
     ></modify-clazz-simple>
-    <!-- ModifyClazzSimpleStudent -->
-    <modify-clazz-simple-student
-      ref="ModifyClazzSimpleStudent"
+    <!-- StudentSimpleManage -->
+    <student-simple-manage
+      ref="StudentSimpleManage"
       :clazz="curRow"
       @modified="getList"
-    ></modify-clazz-simple-student>
+    ></student-simple-manage>
   </div>
 </template>
 
@@ -131,15 +131,15 @@ import {
   clazzTeachCourseQuery,
   deleteClazzSimple
 } from "../api";
-import ModifyClazzSimple from "../components/ModifyClazzSimple";
-import ModifyClazzSimpleStudent from "../components/ModifyClazzSimpleStudent";
+import ModifyClazzSimple from "../components/course-simple/ModifyClazzSimple";
+import StudentSimpleManage from "../components/course-simple/StudentSimpleManage.vue";
 
 export default {
   name: "clazz-simple-manage",
-  components: { ModifyClazzSimple, ModifyClazzSimpleStudent },
+  components: { ModifyClazzSimple, StudentSimpleManage },
   data() {
     return {
-      filter: {
+      StudentSimpleManagefilter: {
         teachCourseId: "",
         teachClazzName: ""
       },
@@ -196,7 +196,7 @@ export default {
     },
     toEditStudent(row) {
       this.curRow = row;
-      this.$refs.ModifyClazzSimpleStudent.open();
+      this.$refs.StudentSimpleManage.open();
     },
     toDelete(row) {
       this.$confirm(`确定要删除班级【${row.teachClazzName}】吗?`, "提示", {

+ 13 - 10
src/modules/base/views/CourseSimpleManage.vue

@@ -26,7 +26,7 @@
           type="primary"
           icon="el-icon-circle-plus-outline"
           @click="toAdd"
-          >新增课程</el-button
+          >添加课程</el-button
         >
       </div>
     </div>
@@ -53,7 +53,7 @@
               class="btn-primary"
               type="text"
               @click="toEditClazz(scope.row)"
-              >班级管理</el-button
+              >管理</el-button
             >
             <el-button
               v-if="checkPrivilege('link', 'Delete')"
@@ -87,16 +87,23 @@
       :instance="curCourse"
       @modified="getList"
     ></modify-course-simple>
+    <!-- CourseSimpleDetail -->
+    <course-simple-detail
+      v-if="checkPrivilege('link', 'Link')"
+      ref="CourseSimpleDetail"
+      :course="curCourse"
+    ></course-simple-detail>
   </div>
 </template>
 
 <script>
 import { courseSimpleListPage, deleteCourseSimple } from "../api";
-import ModifyCourseSimple from "../components/ModifyCourseSimple";
+import ModifyCourseSimple from "../components/course-simple/ModifyCourseSimple";
+import CourseSimpleDetail from "../components/course-simple/CourseSimpleDetail.vue";
 
 export default {
   name: "course-simple-manage",
-  components: { ModifyCourseSimple },
+  components: { ModifyCourseSimple, CourseSimpleDetail },
   data() {
     return {
       filter: {
@@ -139,12 +146,8 @@ export default {
       this.$refs.ModifyCourseSimple.open();
     },
     toEditClazz(row) {
-      this.$router.push({
-        name: "ClazzSimpleManage",
-        params: {
-          teachCourseId: row.id
-        }
-      });
+      this.curCourse = row;
+      this.$refs.CourseSimpleDetail.open();
     },
     toDelete(row) {
       this.$confirm(`确定要删除课程【${row.courseName}】吗?`, "提示", {

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

@@ -73,7 +73,7 @@
           :data="examRoomInfoList"
           border
           style="width: 100%"
-          max-height="300"
+          max-height="300px"
         >
           <el-table-column
             v-if="hasClassInfo"