Bladeren bron

学期管理班级管理

李志伟 3 jaren geleden
bovenliggende
commit
a283385b60

+ 46
- 0
src/api/schoolClass.js Bestand weergeven

@@ -0,0 +1,46 @@
1
+import request from '@/utils/request'
2
+
3
+/**
4
+* 保存班级
5
+* @param {*} data
6
+* @returns
7
+*/
8
+export const saveSchoolClass = (data) => request({
9
+  url: '/admin/school-class',
10
+  method: 'post',
11
+  data
12
+})
13
+
14
+/**
15
+ * 班级列表
16
+ * @param {*} params
17
+ * @returns
18
+ */
19
+export const getSchoolClassList = (params) => request({
20
+  url: '/admin/school-class', params
21
+})
22
+
23
+/**
24
+ * 删除班级
25
+ * @param {*} data
26
+ * @returns
27
+ */
28
+export const deleteSchoolClass = (id) => request({
29
+  url: `/admin/school-class/${id}`, method: 'delete'
30
+})
31
+/**
32
+ * 更新班级
33
+ * @param {*} data
34
+ * @returns
35
+ */
36
+export const UpdateSchoolClass = (data, id) => request({
37
+  url: `/admin/school-class/${id}`, method: 'put', data
38
+})
39
+/**
40
+ * 查询班级详情
41
+ * @param {*} params
42
+ * @returns
43
+ */
44
+export const getSchoolClassDetail = (id) => request({
45
+  url: `/admin/school-class/${id}`
46
+})

+ 46
- 0
src/api/schoolTerm.js Bestand weergeven

@@ -0,0 +1,46 @@
1
+import request from '@/utils/request'
2
+
3
+/**
4
+* 保存学期
5
+* @param {*} data
6
+* @returns
7
+*/
8
+export const saveSchoolTerm = (data) => request({
9
+  url: '/admin/school-term',
10
+  method: 'post',
11
+  data
12
+})
13
+
14
+/**
15
+ * 学期列表
16
+ * @param {*} params
17
+ * @returns
18
+ */
19
+export const getSchoolTermList = (params) => request({
20
+  url: '/admin/school-term', params
21
+})
22
+
23
+/**
24
+ * 删除学期
25
+ * @param {*} data
26
+ * @returns
27
+ */
28
+export const deleteSchoolTerm = (id) => request({
29
+  url: `/admin/school-term/${id}`, method: 'delete'
30
+})
31
+/**
32
+ * 更新学期
33
+ * @param {*} data
34
+ * @returns
35
+ */
36
+export const UpdateSchoolTerm = (data, id) => request({
37
+  url: `/admin/school-term/${id}`, method: 'put', data
38
+})
39
+/**
40
+ * 查询学期详情
41
+ * @param {*} params
42
+ * @returns
43
+ */
44
+export const getSchoolTermDetail = (id) => request({
45
+  url: `/admin/school-term/${id}`
46
+})

+ 1
- 0
src/icons/svg/course.svg Bestand weergeven

@@ -0,0 +1 @@
1
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1645409502613" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3940" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M899.456 321.152v526.72c-0.576 31.488-11.52 57.856-32.832 79.168s-47.68 32.256-79.168 32.832h-560c-31.488-0.576-57.92-11.52-79.168-32.832-21.312-21.312-32.256-47.68-32.832-79.168v-672c0.576-31.488 11.52-57.856 32.832-79.168s47.68-32.256 79.168-32.832h672v140.032H316.736c-16.896 0.576-31.232 6.72-42.88 18.368-11.648 11.648-17.472 26.112-17.472 43.328 0 17.216 5.824 31.68 17.472 43.328 11.648 11.648 25.92 17.792 42.88 18.368h314.112v229.248c2.944 0.576 5.696 1.344 8.32 2.176s5.376 0.128 8.32-2.176l67.392-49.856c5.824-2.944 11.2-4.352 16.192-4.352 4.928 0 8.896 1.472 11.84 4.352l67.392 49.856h5.248c2.944 0 5.568-1.152 7.872-3.52 2.304-2.304 3.52-4.928 3.52-7.872v-224h72.512z" p-id="3941"></path></svg>

+ 1
- 0
src/icons/svg/photoWall.svg Bestand weergeven

@@ -0,0 +1 @@
1
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1645409582214" class="icon" viewBox="0 0 1228 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4150" xmlns:xlink="http://www.w3.org/1999/xlink" width="239.84375" height="200"><defs><style type="text/css"></style></defs><path d="M1160.533333 955.733333a68.266667 68.266667 0 0 1-136.533333 0V204.8a68.266667 68.266667 0 0 0-68.266667-68.266667H273.066667a68.266667 68.266667 0 0 0-68.266667 68.266667v750.933333a68.266667 68.266667 0 0 1-136.533333 0V136.533333a136.533333 136.533333 0 0 1 136.533333-136.533333h819.2a136.533333 136.533333 0 0 1 136.533333 136.533333v819.2zM614.4 624.2304a181.725867 181.725867 0 0 1-179.268267-161.041067l-5.597866-46.011733a191.146667 191.146667 0 0 1 50.9952-154.692267 184.32 184.32 0 0 1 267.605333 0 190.327467 190.327467 0 0 1 50.926933 154.624l-5.597866 46.08A181.6576 181.6576 0 0 1 614.4 624.2304z m-318.737067 117.691733a841.591467 841.591467 0 0 1 637.405867 0A38.570667 38.570667 0 0 1 955.733333 778.24V1024H273.066667v-245.76a38.570667 38.570667 0 0 1 22.664533-36.317867z" p-id="4151"></path></svg>

+ 1
- 0
src/icons/svg/questionnaire.svg Bestand weergeven

@@ -0,0 +1 @@
1
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1645409696539" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4616" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M774.008 7.664H249.992c-73.6 0-133.472 59.88-133.472 133.472v741.728c0 73.592 59.872 133.472 133.472 133.472H774c73.592 0 133.472-59.88 133.472-133.472V141.136c0.008-73.6-59.872-133.472-133.464-133.472z m0 918.856H249.992a43.704 43.704 0 0 1-43.656-43.656V270.288h611.32v612.576a43.696 43.696 0 0 1-43.648 43.656z" p-id="4617"></path><path d="M722.344 387.752H301.656a44.912 44.912 0 0 0 0 89.824h420.68a44.92 44.92 0 0 0 0.008-89.824zM722.344 557.504H301.656a44.912 44.912 0 0 0 0 89.824h420.68a44.92 44.92 0 0 0 0.008-89.824zM722.344 727.248H301.656a44.912 44.912 0 0 0 0 89.824h420.68a44.92 44.92 0 0 0 0.008-89.824z" p-id="4618"></path></svg>

+ 1
- 0
src/icons/svg/schoolClass.svg Bestand weergeven

@@ -0,0 +1 @@
1
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1645430895027" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2309" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M882.145 156.068h-463.93c-34.161 0-61.855 27.698-61.855 61.856v92.786h-30.931c-34.161 0-61.856 27.698-61.856 61.856V496.28c0 34.161 27.695 61.858 61.856 61.858h123.718c34.155 0 61.855-27.697 61.855-61.858V372.567c0-34.159-27.7-61.856-61.855-61.856h-30.932v-92.786h463.93v494.857H696.57v-30.928c0-9.998-2.356-19.451-6.582-27.819l75.628-130.962c8.521-14.799 3.444-33.707-11.324-42.254-14.802-8.547-33.708-3.474-42.255 11.326l-73.878 127.942a67.121 67.121 0 0 0-3.444-0.09H139.856C105.7 619.997 78 647.693 78 681.854v185.571h618.57V774.64h185.574c34.159 0 61.855-27.697 61.855-61.857V217.925c0.001-34.159-27.695-61.857-61.854-61.857z" p-id="2310"></path></svg>

+ 1
- 0
src/icons/svg/schoolTerm.svg Bestand weergeven

@@ -0,0 +1 @@
1
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1645409895718" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8224" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M870.4 153.6h-84.48v95.6416c0 45.8496-37.5296 84.48-83.3792 83.5584A81.92 81.92 0 0 1 622.08 250.88V153.6h-220.16v95.6416c0 45.8496-37.5296 84.48-83.3792 83.5584A81.92 81.92 0 0 1 238.08 250.88V153.6H153.6a77.0304 77.0304 0 0 0-76.8 76.8v640a77.0304 77.0304 0 0 0 76.8 76.8h716.8a77.0304 77.0304 0 0 0 76.8-76.8V230.4a77.0304 77.0304 0 0 0-76.8-76.8z m0 640a77.0304 77.0304 0 0 1-76.8 76.8H230.4a77.0304 77.0304 0 0 1-76.8-76.8V460.8a77.0304 77.0304 0 0 1 76.8-76.8h563.2a77.0304 77.0304 0 0 1 76.8 76.8z" p-id="8225"></path><path d="M324.9152 301.8496c26.496-2.56 46.2848-25.6 46.2848-52.2752V89.6a51.3536 51.3536 0 0 0-56.1152-50.9696c-26.496 2.56-46.2848 25.6-46.2848 52.2752V250.88a51.3536 51.3536 0 0 0 56.1152 50.9696zM708.9152 301.8496c26.496-2.56 46.2848-25.6 46.2848-52.2752V89.6a51.3536 51.3536 0 0 0-56.1152-50.9696c-26.496 2.56-46.2848 25.6-46.2848 52.2752V250.88a51.3536 51.3536 0 0 0 56.1152 50.9696zM284.16 584.5248h167.6544v32.2304h35.456v-63.4112h-36.5568q3.2256-4.2752 10.752-12.8 6.4512-7.5264 9.6768-11.8272l-34.4064-19.3536a42.5472 42.5472 0 0 0-5.376 7.5264q-15.0528 23.6544-24.704 36.5312h-31.1808l18.2784-8.6016q-5.376-8.5504-15.0528-23.6288a152.576 152.576 0 0 0-9.6768-16.128L337.92 518.9632c1.4336 2.8672 3.9168 7.168 7.5264 12.8 5.7344 9.3184 10.0096 16.4864 12.8 21.4784h-43.008l11.8272-7.5264a464.4096 464.4096 0 0 0-32.2304-38.6816l-26.88 18.2784a298.2656 298.2656 0 0 1 22.5792 27.9296H248.6784v63.4112H284.16z" p-id="8226"></path><path d="M441.0368 633.9584v-31.1808H296.96v31.1808h93.4912l-34.3808 22.5536V663.04H244.3776v31.1808h111.7696v16.1024c0 10.0608-6.0928 15.0528-18.2784 15.0528q-16.128 0-35.456-1.0752a175.9744 175.9744 0 0 1 8.6016 32.2304q21.4784 0 46.08-1.0496 35.456-1.1008 35.456-34.4064v-26.9312H491.52V663.04h-94.5408zM661.3504 636.1088q0 68.7616-19.3536 93.4912a256.896 256.896 0 0 0-27.9296-27.9296H652.8v-31.1808h-13.9776v-108.544H652.8v-30.08h-13.9776v-21.504h-32.2816v21.504h-38.6816v-21.504h-31.1808v21.504h-17.1776v30.08h17.1776v108.544h-20.48v31.1808h35.456a231.68 231.68 0 0 1-34.3808 35.456c1.408 1.4336 4.3008 3.9168 8.6016 7.5264q9.6512 8.576 16.1024 13.952l37.6064-39.7568-22.5536-17.1776h55.8848l-22.5792 17.1776a317.44 317.44 0 0 1 33.28 37.6064l18.2528-13.952a234.5984 234.5984 0 0 1 19.3536 13.952 49.9712 49.9712 0 0 0 5.376 3.2256q21.4528-32.2048 24.704-79.5136h34.4064v32.2304c0 7.9104-3.9424 11.8272-11.8272 11.8272q-8.6016 0-21.504-1.0752a137.0624 137.0624 0 0 1 4.3008 19.3536q2.1504 8.5504 3.2256 12.8c13.6192 0 24.7296-0.384 33.28-1.0752q23.6032-2.2016 23.6288-25.8048v-209.4592h-95.4624z m-54.8096 34.3808h-38.6816v-18.2784h38.6816z m0-46.208h-38.6816v-17.2032h38.6816z m0-45.1328h-38.6816v-17.2032h38.6816z m85.9648-27.9552h33.28v35.4816h-33.28z m0 65.5616h33.28v33.28h-33.28z" p-id="8227"></path></svg>

+ 1
- 0
src/icons/svg/student.svg Bestand weergeven

@@ -0,0 +1 @@
1
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1645409347230" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1992" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M204.096 118.592c10.496 10.24 14.848 23.744 13.12 40.704v700.032c-0.576 16.896-5.824 30.336-15.744 40.256-9.92 9.92-23.36 15.168-40.256 15.744-14.592-0.576-27.456-5.824-38.528-15.744-11.072-9.92-16.896-23.36-17.472-40.256V159.296c0.576-14.592 6.72-27.392 18.368-38.528 11.648-11.072 25.92-16.896 42.88-17.472 14.592 0 27.136 5.056 37.632 15.296z m685.568 17.472c21.312 21.312 32.256 47.68 32.832 79.168v593.28c-0.576 31.488-11.52 57.856-32.832 79.168s-47.68 32.256-79.168 32.832H351.104c-16.896 0-30.336-5.12-40.256-15.296-9.92-10.24-15.168-23.744-15.744-40.704V159.296c0.576-16.896 5.824-30.464 15.744-40.704 9.92-10.176 23.296-15.296 40.256-15.296h459.392c31.488 0.576 57.92 11.52 79.168 32.768z m-119.872 567.04c4.928-6.72 3.648-14.464-3.968-23.168-5.824-22.72-17.472-41.408-35.008-56-17.472-14.592-37.632-22.144-60.352-22.72h-11.392c-8.192 5.824-17.664 10.24-28.416 13.12-10.816 2.944-21.76 4.352-32.832 4.352s-21.44-1.472-31.04-4.352c-9.6-2.944-19.712-7.296-30.208-13.12h-11.392c-22.72 0.576-42.88 8.192-60.352 22.72-17.472 14.592-29.184 33.28-35.008 56-2.368 8.768-1.344 16.512 3.072 23.168 4.352 6.72 10.944 10.048 19.712 10.048h296.64c8.768 0 15.616-3.328 20.544-10.048z m-250.24-332.096c-21.888 20.992-33.088 47.552-33.664 79.616 0.576 34.432 11.84 63.296 33.664 86.656 21.888 23.36 49.728 35.328 83.584 35.904 34.432-0.576 62.592-11.648 84.416-33.28 21.888-21.568 33.088-49.6 33.664-83.968-0.576-34.432-11.84-62.4-33.664-83.968-21.888-21.568-50.048-32.64-84.416-33.28-33.856 0.512-61.696 11.328-83.584 32.32z" p-id="1993"></path></svg>

+ 24
- 11
src/router/index.js Bestand weergeven

@@ -49,23 +49,36 @@ export const constantRoutes = [
49 49
     meta: { title: '学员管理', icon: 'form' },
50 50
     children: [
51 51
       {
52
-        path: 'semester',
52
+        path: 'schoolTerm',
53 53
         name: '学期列表',
54
-        component: () => import('@/views/students/semester/list'),
55
-        meta: { title: '学期列表', icon: 'question' }
54
+        component: () => import('@/views/students/schoolTerm/list'),
55
+        meta: { title: '学期列表', icon: 'schoolTerm' }
56 56
       },
57 57
       {
58 58
         hidden: true,
59
-        path: 'semester/edit',
60
-        name: 'semesterEdit',
61
-        component: () => import('@/views/students/semester/edit'),
59
+        path: 'schoolTerm/edit',
60
+        name: 'schoolTermEdit',
61
+        component: () => import('@/views/students/schoolTerm/edit'),
62 62
         meta: { title: '学期编辑', icon: 'question' }
63 63
       },
64
+      {
65
+        path: 'schoolClass',
66
+        name: '班级列表',
67
+        component: () => import('@/views/students/schoolClass/list'),
68
+        meta: { title: '班级列表', icon: 'schoolClass' }
69
+      },
70
+      {
71
+        hidden: true,
72
+        path: 'schoolClass/edit',
73
+        name: 'schoolClassEdit',
74
+        component: () => import('@/views/students/schoolClass/edit'),
75
+        meta: { title: '班级编辑', icon: 'question' }
76
+      },
64 77
       {
65 78
         path: 'sutdentsList',
66 79
         name: '学员列表',
67 80
         component: () => import('@/views/students/studentsList'),
68
-        meta: { title: '课程列表', icon: 'question' }
81
+        meta: { title: '学员列表', icon: 'student' }
69 82
       }
70 83
     ]
71 84
   },
@@ -74,13 +87,13 @@ export const constantRoutes = [
74 87
   {
75 88
     path: '/course',
76 89
     component: Layout,
77
-    meta: { title: '课程管理', icon: 'form' },
90
+    meta: { title: '课程管理', icon: 'course' },
78 91
     children: [
79 92
       {
80 93
         path: 'course',
81 94
         name: '课程列表',
82 95
         component: () => import('@/views/course/index'),
83
-        meta: { title: '课程列表', icon: 'question' }
96
+        meta: { title: '课程列表', icon: 'course' }
84 97
       },
85 98
       {
86 99
         hidden: true,
@@ -102,7 +115,7 @@ export const constantRoutes = [
102 115
         path: 'photoWall',
103 116
         name: '照片列表',
104 117
         component: () => import('@/views/photoWall/index'),
105
-        meta: { title: '照片墙', icon: 'question' }
118
+        meta: { title: '照片墙', icon: 'photoWall' }
106 119
       },
107 120
       {
108 121
         hidden: true,
@@ -124,7 +137,7 @@ export const constantRoutes = [
124 137
         path: 'questionnaire',
125 138
         name: '问卷列表',
126 139
         component: () => import('@/views/questionnaire/index'),
127
-        meta: { title: '问卷列表', icon: 'question' }
140
+        meta: { title: '问卷列表', icon: 'questionnaire' }
128 141
       },
129 142
       {
130 143
         hidden: true,

+ 1
- 1
src/views/questionnaire/index.vue Bestand weergeven

@@ -21,7 +21,7 @@
21 21
     </el-card>
22 22
     <el-table stripe :data="tableData" border style="width: 100%">
23 23
       <el-table-column prop="title" label="问卷名" />
24
-      <el-table-column prop="semester" label="学期" />
24
+      <el-table-column prop="schoolTerm" label="学期" />
25 25
       <!-- <el-table-column prop="gameImage" label="游戏图标">
26 26
         <template slot-scope="scope">
27 27
           <el-image :src="scope.row.gameImage" style="width: 100px; height: 100px" />

+ 106
- 0
src/views/students/schoolClass/edit.vue Bestand weergeven

@@ -0,0 +1,106 @@
1
+<template>
2
+  <div>
3
+    <el-card class="box-card" style="text-align:center" shadow="never">
4
+      <h2>{{ termId ? '修改' : '新建' }}班级</h2>
5
+      <el-form
6
+        ref="ruleForm"
7
+        :model="ruleForm"
8
+        :rules="rules"
9
+        label-width="10vw"
10
+        class="demo-ruleForm"
11
+      >
12
+        <el-form-item label="学期" prop="termId">
13
+          <el-select v-model="ruleForm.termId" style="width:100%" filterable placeholder="请选择">
14
+            <el-option
15
+              v-for="item in options"
16
+              :key="item.termId"
17
+              :label="item.name"
18
+              :value="item.termId"
19
+            />
20
+          </el-select>
21
+        </el-form-item>
22
+        <el-form-item label="班级名称" prop="name">
23
+          <el-input v-model="ruleForm.name" />
24
+        </el-form-item>
25
+        <el-form-item label-width="0">
26
+          <el-button type="primary" @click="submitForm('ruleForm')">{{
27
+            !termId ? "新建班级" : "修改班级"
28
+          }}</el-button>
29
+          <el-button @click="$router.go(-1)">返回</el-button>
30
+        </el-form-item>
31
+      </el-form>
32
+    </el-card>
33
+  </div>
34
+</template>
35
+
36
+<script>
37
+import { saveSchoolClass, getSchoolClassDetail, UpdateSchoolClass } from '@/api/schoolClass'
38
+import { getSchoolTermList } from '@/api/schoolTerm'
39
+export default {
40
+  data() {
41
+    return {
42
+      classId: undefined,
43
+      options: [],
44
+      ruleForm: {
45
+        termId: undefined,
46
+        name: undefined
47
+      },
48
+      rules: {
49
+        termId: [
50
+          { required: true, message: '请选择学期', trigger: 'blur' }
51
+        ],
52
+        name: [
53
+          { required: true, message: '请输入班级名称', trigger: 'blur' }
54
+        ]
55
+      }
56
+    }
57
+  },
58
+  mounted() {
59
+    if (this.$route?.query.classId) {
60
+      this.classId = this.$route.query.classId
61
+      getSchoolClassDetail(this.classId)
62
+        .then((res) => {
63
+          this.ruleForm = res.data
64
+        })
65
+    }
66
+    getSchoolTermList().then((res) => {
67
+      this.options = res.data.records
68
+    })
69
+  },
70
+  methods: {
71
+    submitForm(formName) {
72
+      this.$refs[formName].validate((valid) => {
73
+        if (valid) {
74
+          if (this.classId) {
75
+            UpdateSchoolClass(this.ruleForm, this.classId)
76
+              .then((res) => {
77
+                this.$message.success('修改成功')
78
+                this.$router.go(-1)
79
+              })
80
+              .catch((e) => {
81
+                console.log(e)
82
+              })
83
+          } else {
84
+            saveSchoolClass(this.ruleForm)
85
+              .then((e) => {
86
+                this.$message.success('保存成功')
87
+                this.$router.go(-1)
88
+              })
89
+          }
90
+        } else {
91
+          return false
92
+        }
93
+      })
94
+    }
95
+  }
96
+}
97
+</script>
98
+
99
+<style scoped >
100
+.demo-ruleForm {
101
+  margin-top: 1em;
102
+}
103
+</style>
104
+
105
+<style lang="scss" scoped>
106
+</style>

+ 126
- 0
src/views/students/schoolClass/list.vue Bestand weergeven

@@ -0,0 +1,126 @@
1
+<template>
2
+  <div class="body">
3
+    <el-card class="box-card" shadow="never">
4
+      学期名称:
5
+      <el-select v-model="termId" filterable placeholder="请选择">
6
+        <el-option
7
+          v-for="item in options"
8
+          :key="item.termId"
9
+          :label="item.name"
10
+          :value="item.termId"
11
+        />
12
+      </el-select>
13
+      班级名称:
14
+      <el-input v-model="name" style="width: 200px; margin-right: 20px" />
15
+      <div style="float:right">
16
+        <el-button type="primary" @click="onSearch">查询</el-button>
17
+        <el-button @click="onReset">重置</el-button>
18
+        <el-button type="primary" icon="el-icon-plus" @click="handleAdd">新建班级</el-button>
19
+      </div>
20
+    </el-card>
21
+    <el-table stripe :data="tableData" border style="width: 100%">
22
+      <el-table-column prop="term" label="学期" />
23
+      <el-table-column prop="name" label="班级" />
24
+      <el-table-column align="center" label="操作" min-width="100" width="280">
25
+        <template slot-scope="scope">
26
+          <el-link :underline="false" style="margin-right:1em" type="primary">
27
+            <router-link
28
+              :to="{path:'schoolClass/Edit',query: { classId: scope.row.classId }}"
29
+            >编辑</router-link>
30
+          </el-link>
31
+          <el-popconfirm
32
+            icon="el-icon-info"
33
+            icon-color="red"
34
+            title="确定要删除该班级吗?"
35
+            @onConfirm="handleDelete(scope.row)"
36
+          >
37
+            <el-link slot="reference" :underline="false" type="danger">删除</el-link>
38
+          </el-popconfirm>
39
+        </template>
40
+      </el-table-column>
41
+    </el-table>
42
+    <el-pagination
43
+      v-show="Total!==0"
44
+      style="float:right; margin:20px 0"
45
+      :total="Total"
46
+      :current-page="currentPage"
47
+      :page-size="pageSize"
48
+      :page-sizes="[pageSize, 20, 35,40,50,80,100]"
49
+      layout="total, prev, pager, next, sizes"
50
+      @size-change="handleSizeChange"
51
+      @current-change="handleCurrentChange"
52
+    />
53
+  </div>
54
+</template>
55
+<script>
56
+import { getSchoolClassList, deleteSchoolClass } from '@/api/schoolClass'
57
+import { getSchoolTermList } from '@/api/schoolTerm'
58
+export default {
59
+  data() {
60
+    return {
61
+      termId: undefined,
62
+      name: undefined,
63
+      options: [],
64
+      tableData: [],
65
+      pageSize: 10,
66
+      currentPage: 1,
67
+      Total: 0 // 条目总数
68
+    }
69
+  },
70
+  mounted() {
71
+    getSchoolTermList().then((res) => {
72
+      this.options = res.data.records
73
+    })
74
+    this.onSearch()
75
+  },
76
+  methods: {
77
+    // 改变每页显示条数
78
+    handleSizeChange(val) {
79
+      this.pageSize = val
80
+      this.changePagination()
81
+    },
82
+    // 改变页码
83
+    handleCurrentChange(val) {
84
+      this.currentPage = val
85
+      this.changePagination()
86
+    },
87
+    // 改变分页组件重新查询数据
88
+    changePagination() {
89
+      getSchoolClassList({
90
+        termId: this.termId,
91
+        name: this.name,
92
+        pageNum: this.currentPage,
93
+        pageSize: this.pageSize
94
+      }).then((res) => {
95
+        this.tableData = res.data.records
96
+      })
97
+    },
98
+    onSearch() {
99
+      getSchoolClassList({
100
+        termId: this.termId,
101
+        name: this.name,
102
+        pageNum: this.currentPage,
103
+        pageSize: this.pageSize
104
+      }).then((res) => {
105
+        this.tableData = res.data.records
106
+        this.Total = res.data.total
107
+      })
108
+    },
109
+    onReset() {
110
+      this.name = undefined
111
+      this.termId = undefined
112
+      this.onSearch()
113
+    },
114
+    handleAdd() {
115
+      this.$router.push({ path: 'schoolClass/edit' })
116
+    },
117
+    handleDelete(row) {
118
+      deleteSchoolClass(row.classId).then(() => {
119
+        this.onSearch()
120
+      })
121
+    }
122
+  }
123
+}
124
+</script>
125
+<style lang="scss" scoped>
126
+</style>

+ 88
- 0
src/views/students/schoolTerm/edit.vue Bestand weergeven

@@ -0,0 +1,88 @@
1
+<template>
2
+  <div>
3
+    <el-card class="box-card" style="text-align:center" shadow="never">
4
+      <h2>{{ termId ? '修改' : '新建' }}学期</h2>
5
+      <el-form
6
+        ref="ruleForm"
7
+        :model="ruleForm"
8
+        :rules="rules"
9
+        label-width="10vw"
10
+        class="demo-ruleForm"
11
+      >
12
+        <el-form-item label="学期名称" prop="name">
13
+          <el-input v-model="ruleForm.name" />
14
+        </el-form-item>
15
+        <el-form-item label-width="0">
16
+          <el-button type="primary" @click="submitForm('ruleForm')">{{
17
+            !termId ? "新建学期" : "修改学期"
18
+          }}</el-button>
19
+          <el-button @click="$router.go(-1)">返回</el-button>
20
+        </el-form-item>
21
+      </el-form>
22
+    </el-card>
23
+  </div>
24
+</template>
25
+
26
+<script>
27
+import { saveSchoolTerm, getSchoolTermDetail, UpdateSchoolTerm } from '@/api/schoolTerm'
28
+
29
+export default {
30
+  data() {
31
+    return {
32
+      termId: undefined,
33
+      ruleForm: {
34
+        name: undefined
35
+      },
36
+      rules: {
37
+        name: [
38
+          { required: true, message: '请输入学期名称', trigger: 'blur' }
39
+        ]
40
+      }
41
+    }
42
+  },
43
+  mounted() {
44
+    if (this.$route?.query.termId) {
45
+      this.termId = this.$route.query.termId
46
+      getSchoolTermDetail(this.termId)
47
+        .then((res) => {
48
+          this.ruleForm = res.data
49
+        })
50
+    }
51
+  },
52
+  methods: {
53
+    submitForm(formName) {
54
+      this.$refs[formName].validate((valid) => {
55
+        if (valid) {
56
+          if (this.termId) {
57
+            UpdateSchoolTerm(this.ruleForm, this.termId)
58
+              .then((res) => {
59
+                this.$message.success('修改成功')
60
+                this.$router.go(-1)
61
+              })
62
+              .catch((e) => {
63
+                console.log(e)
64
+              })
65
+          } else {
66
+            saveSchoolTerm(this.ruleForm)
67
+              .then((e) => {
68
+                this.$message.success('保存成功')
69
+                this.$router.go(-1)
70
+              })
71
+          }
72
+        } else {
73
+          return false
74
+        }
75
+      })
76
+    }
77
+  }
78
+}
79
+</script>
80
+
81
+<style scoped >
82
+.demo-ruleForm {
83
+  margin-top: 1em;
84
+}
85
+</style>
86
+
87
+<style lang="scss" scoped>
88
+</style>

+ 144
- 0
src/views/students/schoolTerm/list.vue Bestand weergeven

@@ -0,0 +1,144 @@
1
+<template>
2
+  <div class="body">
3
+    <el-card class="box-card" shadow="never">
4
+      学期名称:
5
+      <el-input v-model="name" style="width: 200px; margin-right: 20px" />
6
+      <div style="float:right">
7
+        <el-button type="primary" @click="onSearch">查询</el-button>
8
+        <el-button @click="onReset">重置</el-button>
9
+        <el-button type="primary" icon="el-icon-plus" @click="handleAdd">新建学期</el-button>
10
+      </div>
11
+    </el-card>
12
+    <el-table stripe :data="tableData" border style="width: 100%">
13
+      <el-table-column prop="name" label="学期" />
14
+      <el-table-column prop="state" label="状态" width="200">
15
+        <template slot-scope="scope">
16
+          {{ scope.row.state === 1 ? '发布' : '未发布' }}
17
+        </template>
18
+      </el-table-column>
19
+      <el-table-column align="center" label="操作" min-width="100" width="280">
20
+        <template slot-scope="scope">
21
+          <el-button style="margin-right:1em" type="text" @click="toggleState(scope.row)">{{ scope.row.state === 1 ? '取消发布' : '发布' }}</el-button>
22
+          <el-link :underline="false" style="margin-right:1em" type="primary">
23
+            <router-link
24
+              :to="{path:'schoolTerm/Edit',query: { termId: scope.row.termId }}"
25
+            >编辑</router-link>
26
+          </el-link>
27
+          <el-popconfirm
28
+            icon="el-icon-info"
29
+            icon-color="red"
30
+            title="确定要删除该学期吗?"
31
+            @onConfirm="handleDelete(scope.row)"
32
+          >
33
+            <el-link slot="reference" :underline="false" type="danger">删除</el-link>
34
+          </el-popconfirm>
35
+        </template>
36
+      </el-table-column>
37
+    </el-table>
38
+    <el-pagination
39
+      v-show="Total!==0"
40
+      style="float:right; margin:20px 0"
41
+      :total="Total"
42
+      :current-page="currentPage"
43
+      :page-size="pageSize"
44
+      :page-sizes="[pageSize, 20, 35,40,50,80,100]"
45
+      layout="total, prev, pager, next, sizes"
46
+      @size-change="handleSizeChange"
47
+      @current-change="handleCurrentChange"
48
+    />
49
+  </div>
50
+</template>
51
+<script>
52
+import { getSchoolTermList, deleteSchoolTerm, UpdateSchoolTerm } from '@/api/schoolTerm'
53
+export default {
54
+  data() {
55
+    return {
56
+      name: undefined,
57
+      tableData: [],
58
+      pageSize: 10,
59
+      currentPage: 1,
60
+      Total: 0 // 条目总数
61
+    }
62
+  },
63
+  mounted() {
64
+    this.onSearch()
65
+  },
66
+  methods: {
67
+    // 改变每页显示条数
68
+    handleSizeChange(val) {
69
+      this.pageSize = val
70
+      this.changePagination()
71
+    },
72
+    // 改变页码
73
+    handleCurrentChange(val) {
74
+      this.currentPage = val
75
+      this.changePagination()
76
+    },
77
+    // 改变分页组件重新查询数据
78
+    changePagination() {
79
+      getSchoolTermList({
80
+        name: this.name,
81
+        pageNum: this.currentPage,
82
+        pageSize: this.pageSize
83
+      }).then((res) => {
84
+        this.tableData = res.data.records
85
+      })
86
+    },
87
+    onSearch() {
88
+      getSchoolTermList({
89
+        name: this.name,
90
+        pageNum: this.currentPage,
91
+        pageSize: this.pageSize
92
+      }).then((res) => {
93
+        this.tableData = res.data.records
94
+        this.Total = res.data.total
95
+      })
96
+    },
97
+    onReset() {
98
+      this.name = undefined
99
+      this.onSearch()
100
+    },
101
+    handleAdd() {
102
+      this.$router.push({ path: 'schoolTerm/edit' })
103
+    },
104
+    toggleState(val) {
105
+      if (val.state === 1) {
106
+        this.$confirm('是否将本学期取消发布,取消后移动端将不再显示相关信息?', '提示', {
107
+          confirmButtonText: '确定',
108
+          cancelButtonText: '取消',
109
+          type: 'warning'
110
+        }).then(() => {
111
+          UpdateSchoolTerm({ ...val, state: 0 }, val.termId).then(() => {
112
+            this.$message({
113
+              type: 'success',
114
+              message: '已取消发布!'
115
+            })
116
+            this.onSearch()
117
+          })
118
+        }).catch(() => {})
119
+      } else {
120
+        this.$confirm('是否将本学期发布,发布后移动端将显示相关信息?', '提示', {
121
+          confirmButtonText: '确定',
122
+          cancelButtonText: '取消',
123
+          type: 'warning'
124
+        }).then(() => {
125
+          UpdateSchoolTerm({ ...val, state: 1 }, val.termId).then(() => {
126
+            this.$message({
127
+              type: 'success',
128
+              message: '发布成功!'
129
+            })
130
+            this.onSearch()
131
+          })
132
+        }).catch(() => {})
133
+      }
134
+    },
135
+    handleDelete(row) {
136
+      deleteSchoolTerm(row.termId).then(() => {
137
+        this.onSearch()
138
+      })
139
+    }
140
+  }
141
+}
142
+</script>
143
+<style lang="scss" scoped>
144
+</style>

+ 0
- 183
src/views/students/semester/edit.vue Bestand weergeven

@@ -1,183 +0,0 @@
1
-<template>
2
-  <div>
3
-    <el-card class="box-card" shadow="never">
4
-      <el-row :gutter="24">
5
-        <el-col :span="18">
6
-          <el-form
7
-            ref="ruleForm"
8
-            :model="ruleForm"
9
-            :rules="rules"
10
-            label-width="10vw"
11
-            class="demo-ruleForm"
12
-          >
13
-            <el-form-item label="学期" prop="semester">
14
-              <el-input v-model="ruleForm.semester" />
15
-            </el-form-item>
16
-            <!-- <el-form-item label="发布状态" prop="status">
17
-              <el-select v-model="ruleForm.status" placeholder="请选择状态">
18
-                <el-option label="发布" :value="1" />
19
-                <el-option label="未发布" :value="0" />
20
-              </el-select>
21
-            </el-form-item> -->
22
-
23
-            <el-form-item>
24
-              <el-button
25
-                type="primary"
26
-                @click="submitForm('ruleForm')"
27
-              >{{ !configId?'新建学期':'修改学期' }}</el-button>
28
-              <el-button @click="resetForm('ruleForm')">重置</el-button>
29
-            </el-form-item>
30
-          </el-form>
31
-        </el-col>
32
-      </el-row>
33
-    </el-card>
34
-  </div>
35
-</template>
36
-
37
-<script>
38
-// import { saveConfig, detailsConfig, ChangeConfig } from '@/api/WeChatApi'
39
-
40
-export default {
41
-  data() {
42
-    return {
43
-      configId: '',
44
-      gameForm: {
45
-        gameForm: undefined
46
-      },
47
-      ruleForm: {
48
-        semester: undefined,
49
-        appName: '',
50
-        appid: '',
51
-        appType: '',
52
-        aesKey: '',
53
-        apiUrl: '',
54
-        resource: '',
55
-        httpPoxyHost: '',
56
-        msgDataFormat: 'Json',
57
-        secret: '',
58
-        token: '',
59
-        httpProxyPort: null,
60
-        status: null
61
-      },
62
-      rules: {
63
-        appName: [
64
-          { required: true, message: '请输入配置名称', trigger: 'blur' }
65
-        ],
66
-        appid: [{ required: true, message: '请输入AppID', trigger: 'blur' }],
67
-        appType: [{ required: true, message: '请选择类型', trigger: 'blur' }],
68
-        aesKey: [{ required: true, message: '请选择AesKey', trigger: 'blur' }],
69
-        apiUrl: [
70
-          { required: true, message: '请选择第三方接口地址', trigger: 'blur' }
71
-        ],
72
-        httpPoxyHost: [
73
-          { required: true, message: '请输入接口代理地址', trigger: 'blur' }
74
-        ],
75
-        httpProxyPort: [
76
-          { required: true, message: '请输入接口代理端口', trigger: 'blur' }
77
-        ],
78
-        msgDataFormat: [
79
-          { required: true, message: '请输入消息格式类型', trigger: 'blur' }
80
-        ],
81
-        secret: [{ required: true, message: '请输入Secret', trigger: 'blur' }],
82
-        token: [{ required: true, message: '请输入Token', trigger: 'blur' }],
83
-
84
-        status: [{ required: true, message: '请选择状态', trigger: 'blur' }]
85
-      },
86
-      options: [{
87
-        value: '选项1',
88
-        label: '2022年第一学期'
89
-      }, {
90
-        value: '选项2',
91
-        label: '2022年第二学期'
92
-      }, {
93
-        value: '选项3',
94
-        label: '2023年第一学期'
95
-      }, {
96
-        value: '选项4',
97
-        label: '2023年第二学期'
98
-      }, {
99
-        value: '选项5',
100
-        label: '2024年第一学期'
101
-      }]
102
-    }
103
-  },
104
-
105
-  watch: {
106
-    configId: function(val, oldVal) {
107
-      if (val) {
108
-        this.configId = val
109
-      //   detailsConfig(val)
110
-      //     .then((res) => {
111
-      //       this.ruleForm = res.data
112
-      //     })
113
-      //     .catch((e) => {
114
-      //       this.$message.error('ID有误。')
115
-      //       this.$router.go(-1)
116
-      //     })
117
-      }
118
-    }
119
-  },
120
-  mounted() {
121
-    if (this.$route?.query.configId) {
122
-      this.configId = this.$route.query.configId
123
-      // detailsConfig(this.configId)
124
-      //   .then((res) => {
125
-      //     this.ruleForm = res.data
126
-      //   })
127
-      //   .catch((e) => {
128
-      //     this.$message.error('ID有误。')
129
-      //     this.$router.go(-1)
130
-      //   })
131
-    }
132
-  },
133
-  methods: {
134
-    submitForm(formName) {
135
-      this.$refs[formName].validate((valid) => {
136
-        console.log(this.ruleForm)
137
-        // if (valid) {
138
-        //   if (this.configId === '') {
139
-        //     saveConfig(this.ruleForm)
140
-        //       .then((e) => {
141
-        //         this.$message.success('配置保存成功')
142
-        //         this.$router.go(-1)
143
-        //         console.log('保存字段', e)
144
-        //       })
145
-        //       .catch((e) => {
146
-        //         this.$message.error('保存失败', e)
147
-        //       })
148
-        //   } else {
149
-        //     ChangeConfig(this.ruleForm, this.configId)
150
-        //       .then((res) => {
151
-        //         this.$message.success('配置修改成功')
152
-        //         this.$router.go(-1)
153
-        //       })
154
-        //       .catch((e) => {
155
-        //         console.log(e)
156
-        //       })
157
-        //   }
158
-        // } else {
159
-        //   return false
160
-        // }
161
-      })
162
-    },
163
-    resetForm(formName) {
164
-      this.$refs[formName].resetFields()
165
-    },
166
-    handleChange(val) {
167
-      this.gameForm.gameImage = val
168
-    },
169
-    handleDeleteIcon() {
170
-      this.gameForm.gameImage = ''
171
-    }
172
-  }
173
-}
174
-</script>
175
-
176
-<style scoped >
177
-.demo-ruleForm {
178
-  margin-top: 1em;
179
-}
180
-</style>
181
-
182
-<style lang="scss" scoped>
183
-</style>

+ 0
- 114
src/views/students/semester/list.vue Bestand weergeven

@@ -1,114 +0,0 @@
1
-<template>
2
-  <div class="body">
3
-    <el-card class="box-card" shadow="never">
4
-      <div slot="header" class="clearfix">
5
-        <el-button type="primary" style="float: right" icon="el-icon-plus" @click="handleAdd">新建学期</el-button>
6
-      </div>
7
-      <div class="text item">
8
-        <el-table stripe :data="tableData" border style="width: 100%">
9
-          <el-table-column prop="semester" label="学期" />
10
-          <el-table-column align="center" label="操作" min-width="100" width="280">
11
-            <template slot-scope="scope">
12
-              <el-link :underline="false" style="margin-right:1em" type="primary">
13
-                <router-link
14
-                  :to="{path:'semester/Edit',query: { configId: scope.row.configId }}"
15
-                >编辑</router-link>
16
-              </el-link>
17
-              <el-popconfirm
18
-                icon="el-icon-info"
19
-                icon-color="red"
20
-                title="确定要删除该学期吗?"
21
-                @onConfirm="handleDelete(scope.row)"
22
-              >
23
-                <el-link slot="reference" :underline="false" type="danger">删除</el-link>
24
-              </el-popconfirm>
25
-            </template>
26
-          </el-table-column>
27
-        </el-table>
28
-        <el-pagination
29
-          v-show="WxTotal!==0"
30
-          style="float:right; margin:20px 0"
31
-          :total="WxTotal"
32
-          :current-page="currentPage"
33
-          :page-size="pageSize"
34
-          :page-sizes="[pageSize, 20, 35,40,50,80,100]"
35
-          layout="total, prev, pager, next, sizes"
36
-          @size-change="handleSizeChange"
37
-          @current-change="handleCurrentChange"
38
-        />
39
-      </div>
40
-    </el-card>
41
-  </div>
42
-</template>
43
-<script>
44
-// import { getConfigList, DeleteConfig } from '@/api/WeChatApi'
45
-
46
-export default {
47
-  data() {
48
-    return {
49
-      appName: undefined,
50
-      daterange: '',
51
-      tableData: [],
52
-      endDate: undefined,
53
-      startDate: undefined,
54
-      //
55
-      pageSize: 10,
56
-      currentPage: 1,
57
-      WxTotal: 0 // 条目总数
58
-    }
59
-  },
60
-  mounted() {
61
-    this.onSearch()
62
-  },
63
-  methods: {
64
-    // 改变每页显示条数
65
-    handleSizeChange(val) {
66
-      this.pageSize = val
67
-      this.changePagination()
68
-    },
69
-    // 改变页码
70
-    handleCurrentChange(val) {
71
-      this.currentPage = val
72
-      this.changePagination()
73
-    },
74
-    // 改变分页组件重新查询数据
75
-    changePagination() {
76
-      // getConfigList({
77
-      //   // title: this.title,
78
-      //   // startDate: this.startDate,
79
-      //   // endDate: this.endDate,
80
-      //   pageNum: this.currentPage,
81
-      //   pageSize: this.pageSize
82
-      // }).then((res) => {
83
-      //   this.tableData = res.data.records
84
-      // })
85
-    },
86
-
87
-    handleAdd() {
88
-      this.$router.push({ path: 'semester/edit' })
89
-    },
90
-
91
-    handleDelete(row) {
92
-      // DeleteConfig(row.configId).then(() => {
93
-      //   this.onSearch()
94
-      // })
95
-    },
96
-    onSearch() {
97
-      // getConfigList({
98
-      //   pageNum: this.currentPage,
99
-      //   pageSize: this.pageSize
100
-      // }).then((res) => {
101
-      //   this.tableData = res.data.records
102
-      //   this.WxTotal = res.data.total
103
-      // })
104
-    },
105
-    onReset() {
106
-      this.appName = ''
107
-
108
-      this.onSearch()
109
-    }
110
-  }
111
-}
112
-</script>
113
-<style lang="scss" scoped>
114
-</style>