From 0af507deb2a8b08a606b795d73c660d02ecb7f49 Mon Sep 17 00:00:00 2001 From: fuliqi <fuliqi@qq.com> Date: 星期四, 06 六月 2024 17:11:23 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/views/Manage/TestPaper/QuestionBank.vue | 191 ++++++-- src/api/request.js | 82 +- src/components/PopUp/gap-filling.vue | 27 src/views/Manage/ClassManagement/Class.vue | 117 ++++- src/components/PopUp/single-choice.vue | 22 src/api/classesNotify.js | 61 ++ src/api/user.js | 6 src/components/PopUp/question/Show.vue | 5 src/api/question.js | 1 src/api/subject.js | 6 src/api/classes.js | 22 src/router.js | 7 src/components/PopUp/short-answer.vue | 22 src/components/PopUp/multiple-choice.vue | 23 src/views/Manage/Manage.vue | 40 + src/components/PopUp/true-false.vue | 22 src/api/classesUser.js | 55 ++ src/views/Manage/ClassManagement/ClassStaff.vue | 297 +++++++++---- src/views/Manage/TestPaper/subject.vue | 219 ++++++++++ 19 files changed, 944 insertions(+), 281 deletions(-) diff --git a/src/api/classes.js b/src/api/classes.js index 04cf616..164459d 100644 --- a/src/api/classes.js +++ b/src/api/classes.js @@ -3,7 +3,7 @@ // 鑾峰彇鐝骇鍒嗛〉 export const getClassess = (params) => { return axios({ - url: "/api/classes/page", + url: "/api/admin/classes/page", method: "GET", params: params }) @@ -12,7 +12,7 @@ // 鑾峰彇鐝骇鍒楄〃 export const getClassesList = () => { return axios({ - url: "/api/classes/list", + url: "/api/admin/classes/list", method: "GET" }) } @@ -20,7 +20,7 @@ // 閫氳繃id鑾峰彇鐝骇 export const getClassesById = (params) => { return axios({ - url: "/api/classes/" + params, + url: "/api/admin/classes/" + params, method: "GET" }) } @@ -28,15 +28,23 @@ // 閫氳繃id鍒犻櫎鐝骇 export const deleteClassesById = (params) => { return axios({ - url: "/api/classes/" + params, + url: "/api/admin/classes/" + params, method: "DELETE" }) +} + +// 瑙f暎鐝骇 +export const dissolution = (params) => { + return axios({ + url: "/api/admin/classes/dissolution/" + params, + method: "PUT" + }) } // 鎵归噺鍒犻櫎鐝骇 export const deleteClassesByIds = (params) => { return axios({ - url: "/api/classes/batch", + url: "/api/admin/classes/batch", method: "DELETE", data: params }) @@ -45,7 +53,7 @@ // 淇敼鐝骇 export const editClasses = (params) => { return axios({ - url: "/api/classes/", + url: "/api/admin/classes/", method: "PUT", data: params }) @@ -54,7 +62,7 @@ // 娣诲姞鐝骇 export const addClasses = (params) => { return axios({ - url: "/api/classes/", + url: "/api/admin/classes/", method: "POST", data: params }) diff --git a/src/api/classesNotify.js b/src/api/classesNotify.js new file mode 100644 index 0000000..222fe3a --- /dev/null +++ b/src/api/classesNotify.js @@ -0,0 +1,61 @@ +import axios from "./request"; + +// 鑾峰彇鐝骇閫氱煡鍒嗛〉 +export const getClassesNotifys = (params) => { + return axios({ + url: "/api/admin/classes-notify/page", + method: "GET", + params: params + }) +} + +// 鑾峰彇鐝骇閫氱煡鍒楄〃 +export const getClassesNotifyList = () => { + return axios({ + url: "/api/admin/classes-notify/list", + method: "GET" + }) +} + +// 閫氳繃id鑾峰彇鐝骇閫氱煡 +export const getClassesNotifyById = (params) => { + return axios({ + url: "/api/admin/classes-notify/" + params, + method: "GET" + }) +} + +// 閫氳繃id鍒犻櫎鐝骇閫氱煡 +export const deleteClassesNotifyById = (params) => { + return axios({ + url: "/api/admin/classes-notify/" + params, + method: "DELETE" + }) +} + +// 鎵归噺鍒犻櫎鐝骇閫氱煡 +export const deleteClassesNotifyByIds = (params) => { + return axios({ + url: "/api/admin/classes-notify/batch", + method: "DELETE", + data: params + }) +} + +// 淇敼鐝骇閫氱煡 +export const editClassesNotify = (params) => { + return axios({ + url: "/api/admin/classes-notify/", + method: "PUT", + data: params + }) +} + +// 娣诲姞鐝骇閫氱煡 +export const addClassesNotify = (params) => { + return axios({ + url: "/api/admin/classes-notify/", + method: "POST", + data: params + }) +} diff --git a/src/api/classesUser.js b/src/api/classesUser.js new file mode 100644 index 0000000..338a4e4 --- /dev/null +++ b/src/api/classesUser.js @@ -0,0 +1,55 @@ +import axios from "./request"; + +// 鑾峰彇鐝骇涓庣敤鎴峰叧鑱旇〃鍒嗛〉 +export const getClassesUsers = (params) => { + return axios({ + url: "/api/admin/classesUser/page", + method: "GET", + params: params + }) +} + +// 淇濆瓨鐝骇瀛﹀憳鏁版嵁(鍒犻櫎/鏂板) +export const updateClassesUser = (data) => { + return axios({ + url: "/api/admin/classesUser/edit", + method: "POST", + data: data + }) +} + +// 缂栬緫瀛﹀憳淇℃伅 +export const editClassesUser = (data) => { + return axios({ + url: "/api/admin/classesUser", + method: "PUT", + data: data + }) +} + + +// 閫氳繃id鍒犻櫎 +export const deleteClassesUserById = (params) => { + return axios({ + url: "/api/admin/classesUser/" + params, + method: "DELETE" + }) +} + +// 鎵归噺鍒犻櫎 +export const deleteClassesUserByIds = (params) => { + return axios({ + url: "/api/admin/classesUser/batch", + method: "DELETE", + data: params + }) +} + +// 娣诲姞鐝骇涓庣敤鎴峰叧鑱旇〃 +export const addClassesUser = (params) => { + return axios({ + url: "/api/admin/classesUser/", + method: "POST", + data: params + }) +} diff --git a/src/api/question.js b/src/api/question.js index f28d6ce..780e7a5 100644 --- a/src/api/question.js +++ b/src/api/question.js @@ -3,6 +3,7 @@ export default { pageList: query => post('/api/admin/question/page', query), edit: query => post('/api/admin/question/edit', query), + updateStatus: query => post('/api/admin/question/status', query), select: id => post('/api/admin/question/select/' + id), deleteQuestion: id => post('/api/admin/question/delete/' + id) } diff --git a/src/api/request.js b/src/api/request.js index 449cac1..947c2e5 100644 --- a/src/api/request.js +++ b/src/api/request.js @@ -1,54 +1,54 @@ import axios from "axios"; import router from "../router"; -import { Message } from 'element-ui'; +import {Message} from 'element-ui'; +import vue from "vue"; const instance = axios.create({ - baseURL: process.env.VUE_APP_URL, - timeout: 50000, - // 涓嶆惡甯ookie - withCredentials: true, - headers: { - "Content-Type": "application/json" - } - }); + baseURL: process.env.VUE_APP_URL, + timeout: 50000, + // 涓嶆惡甯ookie + withCredentials: true, + headers: { + "Content-Type": "application/json" + } +}); // 娣诲姞璇锋眰鎷︽埅鍣� instance.interceptors.request.use(function (config) { - return config; - }, function (error) { - Message.error("璇锋眰瀛樺湪闂锛岃妫�鏌�") - return Promise.reject(error); - }); + return config; +}, function (error) { + Message.error("璇锋眰瀛樺湪闂锛岃妫�鏌�") + return Promise.reject(error); +}); // 娣诲姞鍝嶅簲鎷︽埅鍣� instance.interceptors.response.use(function (response) { - // 澶勭悊鑷畾涔夌姸鎬佺爜 - if(response.data.code === 1) { - return response; - // 楠岃瘉鐮侀敊璇斁琛岋紝浠ヤ究鍒锋柊楠岃瘉鐮� - } else if (response.data.code === 1998) { - return response; - } else { - Message.error(response.data.msg); - return Promise.reject(response.data.msg); - } + if (response.data.code === 1) { + return response; + // 楠岃瘉鐮侀敊璇斁琛岋紝浠ヤ究鍒锋柊楠岃瘉鐮� + } + // 澶勭悊鑷畾涔夌姸鎬佺爜 + else if (response.data.code === 1998) { + return response; + } else { + Message.error(response.data.msg); + return Promise.reject(response.data.msg); + } - }, function (error) { - // 澶勭悊http鐘舵�佺爜 - if(error.response.data) { - error.message = error.response.data.msg; - } - if(error.response.status === 401) { - error.message = "鐧诲綍宸茶繃鏈燂紝璇烽噸鏂扮櫥褰�"; - // 鍒犳帀sessionStorage涓繃鏈焧oken - sessionStorage.clear(); - router.push("/login"); - } - if(error.response.status === 403) { - error.message = "鏉冮檺涓嶈冻"; - } - Message.error(error.message); - return Promise.reject(error); - }); +}, function (error) { + // 澶勭悊http鐘舵�佺爜 + if (error.response.data) { + error.message = error.response.data.msg; + } + if (error.response.code === 401) { + error.message = "鐧诲綍宸茶繃鏈燂紝璇烽噸鏂扮櫥褰�"; + vue.prototype.$$router.push({path: '/login'}) + } + if (error.response.code === 403) { + error.message = "鏉冮檺涓嶈冻"; + } + Message.error(error.message); + return Promise.reject(error); +}); export default instance; diff --git a/src/api/subject.js b/src/api/subject.js index 99d3491..e006ae2 100644 --- a/src/api/subject.js +++ b/src/api/subject.js @@ -1,9 +1,11 @@ -import { post } from '@/utils/request' +import { get, post } from '@/utils/request' export default { list: query => post('/api/admin/subject/list'), pageList: query => post('/api/admin/subject/page', query), edit: query => post('/api/admin/subject/edit', query), + updateStatus: query => post('/api/admin/subject/status', query), select: id => post('/api/admin/subject/select/' + id), - deleteSubject: id => post('/api/admin/subject/delete/' + id) + deleteSubject: id => post('/api/admin/subject/delete/' + id), + getItemOrder: id => get('/api/admin/subject/getItemOrder') } diff --git a/src/api/user.js b/src/api/user.js index bd97bde..34afe94 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -1,4 +1,4 @@ -import { post } from '@/utils/request' +import { post,get } from '@/utils/request' export default { getUserPageList: query => post('/api/admin/user/page/list', query), @@ -9,5 +9,7 @@ updateUser: query => post('/api/admin/user/update', query), changeStatus: id => post('/api/admin/user/changeStatus/' + id), deleteUser: id => post('/api/admin/user/delete/' + id), - selectByUserName: query => post('/api/admin/user/selectByUserName', query) + selectByUserName: query => post('/api/admin/user/selectByUserName', query), + studentList: () => get('/api/admin/user/student/list'), + getClassesCurrentUserList: (param) => get('/api/admin/user/classes/students', param), } diff --git a/src/components/PopUp/gap-filling.vue b/src/components/PopUp/gap-filling.vue index 4deb149..24d349d 100644 --- a/src/components/PopUp/gap-filling.vue +++ b/src/components/PopUp/gap-filling.vue @@ -12,18 +12,17 @@ <el-form-item label="濉┖绛旀锛�" required> <el-form-item :label="item.prefix" :key="item.prefix" v-for="item in form.items" label-width="50px" class="question-item-label"> - <el-input v-model="item.content" @focus="inputClick(item, 'content')" class="question-item-content-input" - style="width: 50%" /> - <span class="question-item-span">鍒嗘暟锛�</span><el-input-number v-model="item.score" :precision="1" :step="1" - :max="100"></el-input-number> + <el-input v-model="item.content" @focus="inputClick(item, 'content')" class="question-item-content-input" /> + <!-- <span v-if="false" class="question-item-span">鍒嗘暟锛�</span><el-input-number v-model="item.score" :precision="1" :step="1" + :max="100"></el-input-number> --> </el-form-item> </el-form-item> <el-form-item label="瑙f瀽锛�" prop="analyze" required> <el-input v-model="form.analyze" @focus="inputClick(form, 'analyze')" /> </el-form-item> - <el-form-item label="鍒嗘暟锛�" prop="score" required> + <!-- <el-form-item label="鍒嗘暟锛�" prop="score" required> <el-input-number v-model="form.score" :precision="1" :step="1" :max="100"></el-input-number> - </el-form-item> + </el-form-item> --> <el-form-item label="闅惧害锛�" required> <el-rate v-model="form.difficult" class="question-item-rate"></el-rate> </el-form-item> @@ -105,17 +104,23 @@ }, } }, + props: { + id: { + type: Number, + default: 0 + } + }, created() { - let id = this.$route.query.id + this.getSubjects(); + let id = this.id let _this = this if (id && parseInt(id) !== 0) { _this.formLoading = true questionApi.select(id).then(re => { - _this.form = re.response + _this.form = re.data _this.formLoading = false }) } - this.getSubjects(); }, methods: { // 鑾峰彇绉戠洰 @@ -186,9 +191,7 @@ questionApi.edit(this.form).then(re => { if (re.code === 1) { _this.$message.success(re.message) - _this.delCurrentView(_this).then(() => { - _this.$router.push('/exam/question/list') - }) + this.$emit('callback') } else { _this.$message.error(re.message) this.formLoading = false diff --git a/src/components/PopUp/multiple-choice.vue b/src/components/PopUp/multiple-choice.vue index cd1effc..007389c 100644 --- a/src/components/PopUp/multiple-choice.vue +++ b/src/components/PopUp/multiple-choice.vue @@ -19,9 +19,9 @@ <el-form-item label="瑙f瀽锛�" prop="analyze" required> <el-input v-model="form.analyze" @focus="inputClick(form,'analyze')" /> </el-form-item> - <el-form-item label="鍒嗘暟锛�" prop="score" required> + <!-- <el-form-item label="鍒嗘暟锛�" prop="score" required> <el-input-number v-model="form.score" :precision="1" :step="1" :max="100"></el-input-number> - </el-form-item> + </el-form-item> --> <el-form-item label="闅惧害锛�" required> <el-rate v-model="form.difficult" class="question-item-rate"></el-rate> </el-form-item> @@ -53,7 +53,7 @@ <script> import QuestionShow from '@/components/PopUp/question/Show' import Ueditor from '@/components/Ueditor' -import { mapGetters, mapState, mapActions } from 'vuex' +import { mapActions } from 'vuex' import questionApi from '@/api/question' import subjectApi from '@/api/subject' @@ -117,13 +117,20 @@ } } }, - created () { - let id = this.$route.query.id + props: { + id: { + type: Number, + default: 0 + } + }, + created() { + this.getSubjects(); + let id = this.id let _this = this if (id && parseInt(id) !== 0) { _this.formLoading = true questionApi.select(id).then(re => { - _this.form = re.response + _this.form = re.data _this.formLoading = false }) } @@ -175,9 +182,7 @@ questionApi.edit(this.form).then(re => { if (re.code === 1) { _this.$message.success(re.message) - _this.delCurrentView(_this).then(() => { - _this.$router.push('/exam/question/list') - }) + this.$emit('callback') } else { _this.$message.error(re.message) this.formLoading = false diff --git a/src/components/PopUp/question/Show.vue b/src/components/PopUp/question/Show.vue index 2b7e9c9..b1f3757 100644 --- a/src/components/PopUp/question/Show.vue +++ b/src/components/PopUp/question/Show.vue @@ -60,3 +60,8 @@ methods: {} } </script> +<style scoped> + /deep/ td { + background-color: #f0f0f0; + } +</style> \ No newline at end of file diff --git a/src/components/PopUp/short-answer.vue b/src/components/PopUp/short-answer.vue index 4f2994f..dcf5feb 100644 --- a/src/components/PopUp/short-answer.vue +++ b/src/components/PopUp/short-answer.vue @@ -15,9 +15,9 @@ <el-form-item label="瑙f瀽锛�" prop="analyze" required> <el-input v-model="form.analyze" @focus="inputClick(form,'analyze')" /> </el-form-item> - <el-form-item label="鍒嗘暟锛�" prop="score" required> + <!-- <el-form-item label="鍒嗘暟锛�" prop="score" required> <el-input-number v-model="form.score" :precision="1" :step="1" :max="100"></el-input-number> - </el-form-item> + </el-form-item> --> <el-form-item label="闅惧害锛�" required> <el-rate v-model="form.difficult" class="question-item-rate"></el-rate> </el-form-item> @@ -43,7 +43,6 @@ <script> import QuestionShow from '@/components/PopUp/question/Show' import Ueditor from '@/components/Ueditor' -import { mapGetters, mapState, mapActions } from 'vuex' import questionApi from '@/api/question' import subjectApi from '@/api/subject' @@ -102,13 +101,20 @@ } } }, - created () { - let id = this.$route.query.id + props: { + id: { + type: Number, + default: 0 + } + }, + created() { + this.getSubjects(); + let id = this.id let _this = this if (id && parseInt(id) !== 0) { _this.formLoading = true questionApi.select(id).then(re => { - _this.form = re.response + _this.form = re.data _this.formLoading = false }) } @@ -146,9 +152,7 @@ questionApi.edit(this.form).then(re => { if (re.code === 1) { _this.$message.success(re.message) - _this.delCurrentView(_this).then(() => { - _this.$router.push('/exam/question/list') - }) + this.$emit('callback') } else { _this.$message.error(re.message) this.formLoading = false diff --git a/src/components/PopUp/single-choice.vue b/src/components/PopUp/single-choice.vue index ad7e191..7c35dd5 100644 --- a/src/components/PopUp/single-choice.vue +++ b/src/components/PopUp/single-choice.vue @@ -19,9 +19,9 @@ <el-form-item label="瑙f瀽锛�" prop="analyze" required> <el-input v-model="form.analyze" @focus="inputClick(form,'analyze')" /> </el-form-item> - <el-form-item label="鍒嗘暟锛�" prop="score" required> + <!-- <el-form-item label="鍒嗘暟锛�" prop="score" required> <el-input-number v-model="form.score" :precision="1" :step="1" :max="100"></el-input-number> - </el-form-item> + </el-form-item> --> <el-form-item label="闅惧害锛�" required> <el-rate v-model="form.difficult" class="question-item-rate"></el-rate> </el-form-item> @@ -53,7 +53,6 @@ <script> import QuestionShow from '@/components/PopUp/question/Show' import Ueditor from '@/components/Ueditor' -import { mapGetters, mapState, mapActions } from 'vuex' import questionApi from '@/api/question' import subjectApi from '@/api/subject' @@ -117,13 +116,20 @@ } } }, - created () { - let id = this.$route.query.id + props: { + id: { + type: Number, + default: 0 + } + }, + created() { + this.getSubjects(); + let id = this.id let _this = this if (id && parseInt(id) !== 0) { _this.formLoading = true questionApi.select(id).then(re => { - _this.form = re.response + _this.form = re.data _this.formLoading = false }) } @@ -175,9 +181,7 @@ questionApi.edit(this.form).then(re => { if (re.code === 1) { _this.$message.success(re.message) - _this.delCurrentView(_this).then(() => { - _this.$router.push('/exam/question/list') - }) + this.$emit('callback') } else { _this.$message.error(re.message) this.formLoading = false diff --git a/src/components/PopUp/true-false.vue b/src/components/PopUp/true-false.vue index 1b49929..90f0efa 100644 --- a/src/components/PopUp/true-false.vue +++ b/src/components/PopUp/true-false.vue @@ -18,9 +18,9 @@ <el-form-item label="瑙f瀽锛�" prop="analyze" required> <el-input v-model="form.analyze" @focus="inputClick(form,'analyze')" /> </el-form-item> - <el-form-item label="鍒嗘暟锛�" prop="score" required> + <!-- <el-form-item label="鍒嗘暟锛�" prop="score" required> <el-input-number v-model="form.score" :precision="1" :step="1" :max="100"></el-input-number> - </el-form-item> + </el-form-item> --> <el-form-item label="闅惧害锛�" required> <el-rate v-model="form.difficult" class="question-item-rate"></el-rate> </el-form-item> @@ -51,7 +51,6 @@ <script> import QuestionShow from '@/components/PopUp/question/Show' import Ueditor from '@/components/Ueditor' -import { mapGetters, mapState, mapActions } from 'vuex' import questionApi from '@/api/question' import subjectApi from '@/api/subject' @@ -113,13 +112,20 @@ } } }, - created () { - let id = this.$route.query.id + props: { + id: { + type: Number, + default: 0 + } + }, + created() { + this.getSubjects(); + let id = this.id let _this = this if (id && parseInt(id) !== 0) { _this.formLoading = true questionApi.select(id).then(re => { - _this.form = re.response + _this.form = re.data _this.formLoading = false }) } @@ -157,9 +163,7 @@ questionApi.edit(this.form).then(re => { if (re.code === 1) { _this.$message.success(re.message) - _this.delCurrentView(_this).then(() => { - _this.$router.push('/exam/question/list') - }) + this.$emit('callback') } else { _this.$message.error(re.message) this.formLoading = false diff --git a/src/router.js b/src/router.js index 7b19ea1..e9e8a24 100644 --- a/src/router.js +++ b/src/router.js @@ -129,6 +129,13 @@ component: () => import('@/views/Manage/TestPaper/QuestionBank.vue'), meta: { title: '棰樺簱绠$悊' } }, + // 绉戠洰绠$悊 + { + path: 'subject', + name: 'subject', + component: () => import('@/views/Manage/TestPaper/subject.vue'), + meta: { title: '绉戠洰绠$悊' } + }, // 璇曞嵎鐢熸垚 { path: 'test-paper-generation', diff --git a/src/views/Manage/ClassManagement/Class.vue b/src/views/Manage/ClassManagement/Class.vue index 6bfa2e3..db5b41d 100644 --- a/src/views/Manage/ClassManagement/Class.vue +++ b/src/views/Manage/ClassManagement/Class.vue @@ -15,19 +15,25 @@ @click="handlerAdd" >鏂板鐝骇</el-button> </div> - <div - class="flex" - style="align-items:center" - > - <p style="margin-left:20px;margin-right: 10px;">鎵�鍦ㄥ崟浣�</p> -<!-- <el-select v-model="searchData.deptId">--> -<!-- <el-option></el-option>--> -<!-- </el-select>--> - </div> + <el-form :inline="true" :model="searchForm" class="demo-form-inline"> + <el-form-item label="鐝骇鍚嶇О"> + <el-input v-model="searchForm.className" clearable @clear="page" placeholder="鐝骇鍚嶇О"></el-input> + </el-form-item> + <el-form-item label="鐝骇鐘舵��"> + <el-select v-model="searchForm.status" clearable @change="page" placeholder="鐝骇鐘舵��"> + <el-option label="姝e父" value="normal"></el-option> + <el-option label="瑙f暎" value="dissolution"></el-option> + </el-select> + </el-form-item> + <el-form-item> + <el-button type="primary" @click="page">鏌ヨ</el-button> + </el-form-item> + </el-form> </div> <div> <div> <el-table + v-loading="loading" :data="tableData" border :row-style="{height:'42px'}" @@ -40,11 +46,16 @@ width="180px" ></el-table-column> <el-table-column - label="骞寸骇" + label="鐘舵��" align="center" width="80px" - prop="grade" - ></el-table-column> + prop="status" + > + <template slot-scope="scope"> + <el-tag v-if="scope.row.status === '姝e父'" type="success">{{scope.row.status}}</el-tag> + <el-tag v-if="scope.row.status === '瑙f暎'" type="danger">{{scope.row.status}}</el-tag> + </template> + </el-table-column> <el-table-column width="100px" align="center" @@ -83,9 +94,9 @@ <template slot-scope="scope"> <el-button size="small" @click="handlerEdit(scope.row)" type="primary">淇敼</el-button> <el-button size="small" type="warning">鐝骇楠岃瘉</el-button> - <el-button size="small" type="info">閫氱煡</el-button> - <el-button @click="routersTo()" size="small" type="success">鎴愬憳绠$悊</el-button> - <el-button @click="remove(scope.row.id)" type="danger" size="small">鍒犻櫎</el-button> + <el-button size="small" @click="handlerOpenNotify(scope.row)" type="info">閫氱煡</el-button> + <el-button @click="studentManager(scope.row.id)" size="small" type="success">鎴愬憳绠$悊</el-button> + <el-button v-if="scope.row.status !== '瑙f暎'" @click="dissolution(scope.row.id)" type="danger" size="small">瑙f暎</el-button> </template> </el-table-column> </el-table> @@ -103,6 +114,24 @@ </div> + <el-dialog + title="鐝骇閫氱煡" + :visible.sync="notifyOpen" + width="600px" + :before-close="handleClose"> + <el-form :model="notifyForm" :rules="notifyRules" ref="notifyForm" label-width="100px" class="demo-ruleForm"> + <el-form-item label="閫氱煡鐝骇锛�" prop="className"> + <span>{{notifyForm.className}}</span> + </el-form-item> + <el-form-item label="閫氱煡鍐呭锛�" prop="notifyContent"> + <el-input type="textarea" v-model="notifyForm.notifyContent" size="small"></el-input> + </el-form-item> + </el-form> + <span slot="footer" class="dialog-footer"> + <el-button @click="handleNotifyClose">鍙� 娑�</el-button> + <el-button type="primary" @click="submitNotifyForm">纭� 瀹�</el-button> + </span> + </el-dialog> <el-dialog :title="title" @@ -151,17 +180,27 @@ </template> <script> -import { addClasses, editClasses, getClassess, deleteClassesById } from "@/api/classes"; +import { addClasses, editClasses, getClassess, dissolution } from "@/api/classes"; +import { addClassesNotify } from "@/api/classesNotify"; import Pagination from "@/components/Pagination" export default { components: {Pagination}, data() { return { + notifyOpen: false, + notifyForm: { + className: '', + notifyContent: '', + classesId: null + }, + loading: true, total: 0, open: false, title: "", value: "", searchForm: { + className:'', + status: '', subject: null, pageSize: 10, pageNum: 1 @@ -174,6 +213,12 @@ startTime: null, endTime: null, remark: "" + }, + notifyRules: { + notifyContent: [ + { required: true, message: '璇疯緭鍏ラ�氱煡鍐呭', trigger: 'blur' }, + { min: 1, max: 500, message: '闀垮害鍦� 1 鍒� 500 涓瓧绗�', trigger: 'blur' } + ], }, rules: { className: [ @@ -193,10 +238,38 @@ }; }, methods: { + handlerOpenNotify(row) { + this.notifyOpen = true + this.notifyForm.className = row.className + this.notifyForm.classesId = row.id + }, + submitNotifyForm() { + this.$refs['notifyForm'].validate((valid) => { + if (valid) { + let _this = this + addClassesNotify(_this.notifyForm).then(res => { + this.$message.success(res.data.message) + this.notifyOpen = false + this.clearNotifyForm() + }) + } + }) + }, + clearNotifyForm() { + this.notifyForm = { + className: '', + notifyContent: '' + } + }, + handleNotifyClose() { + this.notifyOpen = false + this.clearNotifyForm() + }, page() { getClassess(this.searchForm).then(res => { this.tableData = res.data.data this.total = res.data.total + this.loading = false }) }, resetForm() { @@ -231,9 +304,9 @@ } }); }, - remove(id) { - deleteClassesById(id).then(res => { - this.$message.success("鍒犻櫎鎴愬姛") + dissolution(id) { + dissolution(id).then(res => { + this.$message.success(res.data.message) this.page() }) }, @@ -250,10 +323,8 @@ this.title = "鏂板鐝骇" }, // 璺宠浆(鏌ョ湅鐝骇浜哄憳鎯呭喌) - routersTo() { - this.$router.push({ - name: "ClassStaff", - }); + studentManager(classesId) { + this.$router.push({ path: "class-management/Class-staff", query: { classesId: classesId } }); }, // 杩斿洖涓婁竴涓〉闈� goBack() { diff --git a/src/views/Manage/ClassManagement/ClassStaff.vue b/src/views/Manage/ClassManagement/ClassStaff.vue index b6849c8..468e550 100644 --- a/src/views/Manage/ClassManagement/ClassStaff.vue +++ b/src/views/Manage/ClassManagement/ClassStaff.vue @@ -3,11 +3,12 @@ <div class="c"> <div class="bg"> <div class="main"> - <TitleIndex title="鐝骇浜哄憳绠$悊" /> <div class="content"> <!-- 鐝骇鍚嶇О --> <div style="padding-bottom:20px; border-bottom: 3px solid #409EFF;margin-bottom: 20px;"> <span>{{title}}</span> + <el-button @click="handlerAddStudent" type="primary" size="small">鏂板瀛﹀憳</el-button> + <el-button @click="open = true" type="primary" size="small">瀛﹀憳璋冩暣</el-button> </div> <!-- 琛ㄦ牸 --> <el-table @@ -26,13 +27,14 @@ </el-table-column> <el-table-column align="center" - prop="name" + prop="realName" label="濮撳悕" > </el-table-column> <el-table-column align="center" prop="sex" + :formatter="sexFormatter" label="鎬у埆" > </el-table-column> @@ -43,33 +45,23 @@ > </el-table-column> <el-table-column - align="center" - prop="condition" - label="涓婄嚎鎯呭喌" - > - </el-table-column> - <el-table-column label="鎿嶄綔" align="center" width="300px" > - <el-button type="warning">缂栬緫</el-button> - <el-button type="danger">鍒犻櫎</el-button> - <el-button type="primary">鍒嗛厤瑙掕壊</el-button> + <template slot-scope="scope"> + <el-button @click="handlerEditStudent(scope.row)" type="warning">缂栬緫</el-button> + <el-button @click="remove(scope.row.id)" type="danger">鍒犻櫎</el-button> + <el-button type="primary">鍒嗛厤瑙掕壊</el-button> + </template> </el-table-column> </el-table> <div class="block" style="display: flex; margin-top: 40px;" > - <el-pagination - style="margin:auto" - background - :page-size="10" - layout="prev, pager, next, jumper" - :total="100" - > - </el-pagination> + <pagination v-show="total>0" :total="total" :page.sync="searchForm.pageNum" :limit.sync="searchForm.pageSize" + @pagination="page"/> </div> </div> </div> @@ -79,11 +71,69 @@ ref="popUp" @children="parentGoods" /> + + <el-dialog + :title="studentTitle" + :visible.sync="addOpen" + width="700px" + :before-close="handleAddClose"> + <el-form :model="studentForm" :rules="studentRules" ref="studentForm" label-width="100px" class="demo-ruleForm"> + <el-form-item label="濮撳悕" prop="realName"> + <el-input v-model="studentForm.realName"></el-input> + </el-form-item> + <el-form-item label="鎬у埆" prop="sex"> + <el-select v-model="studentForm.sex"> + <el-option label="鐢�" value="N"></el-option> + <el-option label="濂�" value="V"></el-option> + </el-select> + </el-form-item> + <el-form-item label="鐢佃瘽" prop="phone"> + <el-input v-model="studentForm.phone"></el-input> + </el-form-item> + <el-form-item label="鐧诲綍璐﹀彿" prop="account"> + <el-input v-model="studentForm.account"></el-input> + </el-form-item> + <el-form-item label="鐧诲綍瀵嗙爜" prop="password"> + <el-input v-model="studentForm.password" show-password placeholder="涓嶅~鍐欎細浣跨敤榛樿202406"></el-input> + </el-form-item> + </el-form> + <span slot="footer" class="dialog-footer"> + <el-button @click="handleAddClose">鍙� 娑�</el-button> + <el-button type="primary" @click="submitStudentForm">娣� 鍔�</el-button> + </span> + </el-dialog> + + <el-dialog + title="瀛﹀憳璋冩暣" + :visible.sync="open" + width="900px" + :before-close="handleClose"> + <el-transfer + filterable + :filter-method="filterMethod" + filter-placeholder="瀛﹀憳濮撳悕" + :titles="['瀛︾敓鍒楄〃', '褰撳墠瀛︾敓']" + :button-texts="['閫�鍑虹彮绾�', '鍔犲叆鐝骇']" + :props="{ + key: 'id', + label: 'realName' + }" + v-model="classes.studentList" + :data="studentList"> + </el-transfer> + <span slot="footer" class="dialog-footer"> + <el-button @click="handleClose">鍙� 娑�</el-button> + <el-button type="primary" @click="submitForm">淇� 瀛�</el-button> + </span> + </el-dialog> + </div> </template> <script> // 寮曞叆褰堝嚭绐楀彛绲勪欢 import PopUp from "../../../components/PopUp/Question.vue"; +import UserApi from "@/api/user"; +import { updateClassesUser, getClassesUsers, deleteClassesUserById, addClassesUser, edit } from "@/api/classesUser"; export default { // 娉ㄥ唽 components: { @@ -91,6 +141,43 @@ }, data() { return { + studentForm: { + realName: "", + sex: "", + phone: "", + age: null, + account: "", + password: "" + }, + studentRules: { + realName: [ + { required: true, message: '璇峰~鍐欏鍛樺鍚�', trigger: 'blur' }, + ], + sex: [ + { required: true, message: '璇烽�夋嫨瀛﹀憳鎬у埆', trigger: 'change' }, + ], + phone: [ + { required: true, message: '璇峰~鍐欏鍛樼數璇�', trigger: 'blur' }, + ], + account: [ + { required: true, message: '璇峰~鍐欏鍛樼櫥褰曡处鍙�', trigger: 'blur' }, + ] + }, + studentTitle: "鏂板瀛﹀憳", + addOpen: false, + total: 0, + studentList: [], + searchForm: { + realName: "", + pageSize: 10, + pageNum: 1, + classesId: null + }, + classes: { + id: null, + studentList: [] + }, + open: false, // 鐝骇鍚嶇О title: "19绾ц蒋浠跺洓鐝�", formLabelAlign: { @@ -99,90 +186,102 @@ region: "", }, tableData: [ - { - id: 1, - name: "寮犱笁", - sex: "鐢�", - phone: "12345678977", - // 鏄惁涓婄嚎 - condition: "宸蹭笂绾�", - }, - { - id: 1, - name: "鏉庡洓", - sex: "濂�", - phone: "12345678977", - // 鏄惁涓婄嚎 - condition: "宸蹭笂绾�", - }, - { - id: 1, - name: "鐜嬩簲", - sex: "鐢�", - phone: "12345678977", - // 鏄惁涓婄嚎 - condition: "鏈笂绾�", - }, - { - id: 1, - name: "寮犱笁", - sex: "鐢�", - phone: "12345678977", - // 鏄惁涓婄嚎 - condition: "宸蹭笂绾�", - }, - { - id: 1, - name: "鏉庡洓", - sex: "濂�", - phone: "12345678977", - // 鏄惁涓婄嚎 - condition: "宸蹭笂绾�", - }, - { - id: 1, - name: "鐜嬩簲", - sex: "鐢�", - phone: "12345678977", - // 鏄惁涓婄嚎 - condition: "鏈笂绾�", - }, - { - id: 1, - name: "寮犱笁", - sex: "鐢�", - phone: "12345678977", - // 鏄惁涓婄嚎 - condition: "宸蹭笂绾�", - }, - { - id: 1, - name: "鏉庡洓", - sex: "濂�", - phone: "12345678977", - // 鏄惁涓婄嚎 - condition: "宸蹭笂绾�", - }, - { - id: 1, - name: "鐜嬩簲", - sex: "鐢�", - phone: "12345678977", - // 鏄惁涓婄嚎 - condition: "鏈笂绾�", - }, - { - id: 1, - name: "鐜嬩簲", - sex: "鐢�", - phone: "12345678977", - // 鏄惁涓婄嚎 - condition: "鏈笂绾�", - }, ], }; }, + mounted() { + this.classes.id = this.$route.query.classesId; + this.page() + this.getClassesCurrentUserList(this.classes.id) + this.getStudentList() + }, methods: { + handlerEditStudent(row) { + this.studentForm = row + this.studentTitle = "缂栬緫瀛﹀憳" + this.addOpen = true + }, + handlerAddStudent() { + this.studentTitle = "娣诲姞瀛﹀憳" + this.addOpen = true + }, + submitStudentForm() { + this.$refs['studentForm'].validate((valid) => { + if (valid) { + this.studentForm.classes = this.classes.id + if (this.studentForm.id) { + edit(this.studentForm).then(res => { + this.addOpen = false + this.$message.success(res.data.message) + this.page() + }) + } + addClassesUser(this.studentForm).then(res => { + this.addOpen = false + this.$message.success(res.data.message) + this.page() + }) + } + }) + }, + resetStudentForm() { + this.studentForm = { + realName: "", + sex: "", + phone: "", + age: null + } + }, + handleAddClose() { + this.addOpen = false + this.resetStudentForm() + }, + remove(id) { + deleteClassesUserById(id).then(res => { + this.$message.success(res.data.message) + this.page() + }) + }, + sexFormatter(row) { + if (row.sex === 1) { + return "鐢�" + } + if (row.sex === 2) { + return "濂�" + } + }, + getClassesCurrentUserList(classesId) { + let param = { + classesId: classesId + } + UserApi.getClassesCurrentUserList(param).then(res => { + this.classes.studentList = res.data + }) + }, + getStudentList() { + UserApi.studentList().then(res => { + this.studentList = res.data; + }) + }, + // 鑾峰彇褰撳墠鐝骇瀛﹀憳鍒嗛〉 + page() { + this.searchForm.classesId = this.classes.id + getClassesUsers(this.searchForm).then(res => { + this.tableData = res.data.data + }) + }, + submitForm() { + updateClassesUser(this.classes).then(res => { + this.$message.success(res.data.message) + this.page(); + }) + }, + handleClose() { + this.open = false + }, + filterMethod(query, item) { + return item.realName.indexOf(query) > -1; + }, // 杩斿洖涓婁竴涓〉闈� goBack() { this.$router.back(); diff --git a/src/views/Manage/Manage.vue b/src/views/Manage/Manage.vue index ba4d18f..eb813a0 100644 --- a/src/views/Manage/Manage.vue +++ b/src/views/Manage/Manage.vue @@ -503,6 +503,46 @@ </div> <p>鏁欏笀绠$悊</p> </div> + <!-- 绉戠洰绠$悊 --> + <div + class="main-1-con" + @click="routersTo('/manage/subject')" + > + <div class="icon-bg1"> + <svg + t="1651737345718" + class="icon" + viewBox="0 0 1024 1024" + version="1.1" + xmlns="http://www.w3.org/2000/svg" + p-id="4056" + width="32" + height="32" + > + <path + d="M897.28 85.333333h-750.933333c-28.16 0-51.2 23.04-51.2 51.2v750.933334c0 28.16 23.04 51.2 51.2 51.2h276.906666c18.773333 0 34.133333-15.36 34.133334-34.133334s-15.36-34.133333-34.133334-34.133333H163.413333V153.6h716.8v275.626667c0 18.773333 15.36 34.133333 34.133334 34.133333s34.133333-15.36 34.133333-34.133333V136.533333c0-28.16-22.613333-51.2-51.2-51.2z" + fill="#515151" + p-id="4057" + ></path> + <path + d="M649.813333 315.733333h-324.266666c-18.773333 0-34.133333-15.36-34.133334-34.133333s15.36-34.133333 34.133334-34.133333h324.266666c18.773333 0 34.133333 15.36 34.133334 34.133333s-14.933333 34.133333-34.133334 34.133333zM564.48 452.266667h-238.933333c-18.773333 0-34.133333-15.36-34.133334-34.133334s15.36-34.133333 34.133334-34.133333h238.933333c18.773333 0 34.133333 15.36 34.133333 34.133333s-14.933333 34.133333-34.133333 34.133334zM479.146667 588.8h-153.6c-18.773333 0-34.133333-15.36-34.133334-34.133333s15.36-34.133333 34.133334-34.133334h153.6c18.773333 0 34.133333 15.36 34.133333 34.133334s-14.933333 34.133333-34.133333 34.133333zM743.68 529.066667c-113.066667 0-204.8 91.733333-204.8 204.8s91.733333 204.8 204.8 204.8 204.8-91.733333 204.8-204.8c0-112.64-91.306667-204.8-204.8-204.8z m0 341.333333c-75.093333 0-136.533333-61.44-136.533333-136.533333s61.013333-136.533333 136.533333-136.533334 136.533333 61.44 136.533333 136.533334c0 75.52-61.013333 136.533333-136.533333 136.533333z" + fill="#515151" + p-id="4058" + ></path> + <path + d="M709.546667 810.666667c-18.773333 0-34.133333-15.36-34.133334-34.133334v-85.333333c0-18.773333 15.36-34.133333 34.133334-34.133333s34.133333 15.36 34.133333 34.133333v85.333333c0 18.773333-14.933333 34.133333-34.133333 34.133334z" + fill="#515151" + p-id="4059" + ></path> + <path + d="M675.413333 776.533333c0-18.773333 15.36-34.133333 34.133334-34.133333h85.333333c18.773333 0 34.133333 15.36 34.133333 34.133333s-15.36 34.133333-34.133333 34.133334h-85.333333c-18.773333 0-34.133333-15.36-34.133334-34.133334z" + fill="#515151" + p-id="4060" + ></path> + </svg> + </div> + <p>绉戠洰绠$悊</p> + </div> <!-- 棰樺簱绠$悊 --> <div class="main-1-con" diff --git a/src/views/Manage/TestPaper/QuestionBank.vue b/src/views/Manage/TestPaper/QuestionBank.vue index e7b4c3e..a8d238d 100644 --- a/src/views/Manage/TestPaper/QuestionBank.vue +++ b/src/views/Manage/TestPaper/QuestionBank.vue @@ -12,78 +12,97 @@ <el-button type="warning" size="mini" v-for="item in editUrlEnum" :key="item.key" @click="getDialogFormVisible(item.name)">{{ item.name }} </el-button> - <el-button slot="reference" type="primary" class="link-left">褰曞叆棰樼洰</el-button> + <el-button slot="reference" type="primary" class="link-left">鏂板</el-button> </el-popover> </div> <!-- 鎼滅储 --> <div> - <el-form :inline="true" :model="formLabelAlign" class="demo-form-inline" label-width="80px"> + <el-form :inline="true" :model="queryParam" class="demo-form-inline" label-width="80px"> <el-form-item> - <el-input v-model="formLabelAlign.type" placeholder="棰樼洰鍚�"></el-input> + <el-input v-model="queryParam.content" placeholder="璇疯緭鍏ラ鐩�" clearable></el-input> </el-form-item> <el-form-item> - <el-select v-model="formLabelAlign.region" placeholder="鍏ㄩ儴绉戠洰"> - <el-option label="鍏ㄩ儴绉戠洰" value="shanghai"></el-option> - <el-option label="璇枃" value="beijing"></el-option> - <el-option label="鏁板" value="beijing"></el-option> - <el-option label="鑻辫" value="beijing"></el-option> + <el-select v-model="queryParam.subjectId" placeholder="璇烽�夋嫨绉戠洰" clearable multiple @change="search"> + <el-option v-for="item in subjects" :key="item.id" :value="item.id" :label="item.name"></el-option> </el-select> </el-form-item> <el-form-item> - <el-select v-model="formLabelAlign.region" placeholder="閫夋嫨棰�"> - <el-option label="閫夋嫨棰�" value="shanghai"></el-option> - <el-option label="闂瓟棰�" value="beijing"></el-option> - <el-option label="鍒ゆ柇棰�" value="beijing"></el-option> + <el-select v-model="queryParam.questionType" placeholder="璇烽�夋嫨棰樺瀷" clearable multiple @change="search"> + <el-option v-for="item in questionTypeEnum" :key="item.key" :value="item.key" + :label="item.value"></el-option> + </el-select> + </el-form-item> + <el-form-item> + <el-select v-model="queryParam.status" placeholder="璇烽�夋嫨鐘舵��" clearable @change="search"> + <el-option value="1" label="鍚敤"></el-option> + <el-option value="2" label="绂佺敤"></el-option> </el-select> </el-form-item> - <el-form-item label=""> + <el-form-item> <el-button style="width:100px;" type="primary" size="small" @click="search()">鏌ヨ</el-button> </el-form-item> </el-form> </div> <!-- 琛ㄦ牸 --> - <el-table v-loading="listLoading" :header-cell-style="getRowClass" :data="tableData" border style="width: 100%;"> - <el-table-column align="center" prop="title" label="棰樼洰鍚�"> + <el-table v-loading="listLoading" :header-cell-style="getRowClass" :data="tableData" border + style="width: 100%;"> + <el-table-column align="center" prop="shortTitle" label="棰樼洰" show-overflow-tooltip> </el-table-column> - <el-table-column align="center" prop="subject" label="绉戠洰"> + <el-table-column align="center" prop="subjectName" label="绉戠洰" width="150px"> </el-table-column> - <el-table-column align="center" prop="type" label="棰樼洰绫诲瀷"> + <el-table-column align="center" prop="questionTypeName" label="棰樺瀷" width="100px"> </el-table-column> - <el-table-column align="center" prop="score" label="鍙傝�冪瓟妗�"> + <el-table-column align="center" prop="difficult" label="闅惧害" width="60px" /> + <el-table-column align="center" prop="createTime" label="鍒涘缓鏃堕棿" width="160px" /> + <el-table-column label="鐘舵��" prop="status" width="70px"> + <template slot-scope="{row}"> + <el-tag :type="row.status === '绂佺敤' ? 'danger' : 'success'"> + {{ row.status ? row.status : '鍚敤' }} + </el-tag> + </template> </el-table-column> - <el-table-column label="鎿嶄綔" align="center"> - <el-button type="text">缂栬緫</el-button> - <el-button type="text">鍒犻櫎</el-button> + <el-table-column label="鎿嶄綔" align="center" width="300px"> + <template slot-scope="{row}"> + <el-button size="mini" @click="showQuestion(row)">棰勮</el-button> + <el-button size="mini" @click="editQuestion(row)">缂栬緫</el-button> + <el-button size="mini" type="primary" @click="statusQuestion(row)">{{ row.status === "绂佺敤" ? "鍚敤" : "绂佺敤" + }}</el-button> + <el-popconfirm title="纭鍒犻櫎鍚�" @confirm="deleteQuestion(row)"> + <el-button slot="reference" size="mini" type="danger" class="link-left">鍒犻櫎</el-button> + </el-popconfirm> + </template> </el-table-column> </el-table> - <div class="block" style="display: flex; margin-top: 40px;"> - <pagination v-show="total > 0" :total="total" :page.sync="queryParam.pageIndex" - :limit.sync="queryParam.pageSize" @pagination="search" /> - </div> + <pagination v-show="total > 0" :total="total" :page.sync="queryParam.pageIndex" + :limit.sync="queryParam.pageSize" @pagination="search" /> </div> </div> - </div> + <!-- 濉┖ --> - <el-dialog :visible.sync="gapVisible" :close-on-click-modal="false"> - <gap ref="gap" @children="parentGoods" /> + <el-dialog :visible.sync="gapVisible" :close-on-click-modal="false" v-if="gapVisible"> + <gap ref="gap" @children="parentGoods" @callback="callback" :id="updateId" /> </el-dialog> <!-- 澶氶�� --> - <el-dialog :visible.sync="multipleVisible" :close-on-click-modal="false"> - <multiple ref="multiple" @children="parentGoods" /> + <el-dialog :visible.sync="multipleVisible" :close-on-click-modal="false" v-if="multipleVisible"> + <multiple ref="multiple" @children="parentGoods" @callback="callback" :id="updateId" /> </el-dialog> <!-- 绠�绛� --> - <el-dialog :visible.sync="shortVisible" :close-on-click-modal="false"> - <short ref="short" @children="parentGoods" /> + <el-dialog :visible.sync="shortVisible" :close-on-click-modal="false" v-if="shortVisible"> + <short ref="short" @children="parentGoods" @callback="callback" :id="updateId" /> </el-dialog> <!-- 鍗曢�� --> - <el-dialog :visible.sync="singleVisible" :close-on-click-modal="false"> - <single ref="single" @children="parentGoods" /> + <el-dialog :visible.sync="singleVisible" :close-on-click-modal="false" v-if="singleVisible"> + <single ref="single" @children="parentGoods" @callback="callback" :id="updateId" /> </el-dialog> <!-- 鍒ゆ柇 --> - <el-dialog :visible.sync="truesVisible" :close-on-click-modal="false"> - <trues ref="trues" @children="parentGoods" /> + <el-dialog :visible.sync="truesVisible" :close-on-click-modal="false" v-if="truesVisible"> + <trues ref="trues" @children="parentGoods" @callback="callback" :id="updateId" /> + </el-dialog> + + <el-dialog :visible.sync="questionShow.dialog" style="width: 100%;height: 100%"> + <QuestionShow :qType="questionShow.qType" :question="questionShow.question" :qLoading="questionShow.loading" /> </el-dialog> </div> </template> @@ -96,6 +115,9 @@ import trues from "@/components/PopUp/true-false.vue"; import { mapGetters, mapState } from 'vuex' import questionApi from '@/api/question' +import QuestionShow from '@/components/PopUp/question/Show' +import subjectApi from '@/api/subject' +import Pagination from '@/components/Pagination' export default { // 娉ㄥ唽 @@ -105,13 +127,24 @@ short, single, trues, + QuestionShow, + Pagination }, data() { return { + updateId: '', + questionShow: { + qType: 0, + dialog: false, + question: null, + loading: false + }, listLoading: true, queryParam: { - questionType: null, - subjectId: null, + questionType: [], + subjectId: [], + content: '', + status: '', pageIndex: 1, pageSize: 10 }, @@ -121,43 +154,43 @@ shortVisible: false, singleVisible: false, truesVisible: false, - formLabelAlign: { - type: "", - user: "", - region: "", - }, tableData: [], + subjects: [] }; }, created() { this.search() + this.getSubjects(); }, methods: { + // 鑾峰彇绉戠洰 + getSubjects() { + subjectApi.list().then(re => { + this.subjects = re.data + }) + }, + callback() { + this.gapVisible = false; + this.multipleVisible = false; + this.shortVisible = false; + this.singleVisible = false; + this.truesVisible = false; + this.search() + }, // 鑾峰彇鍒楄〃 search() { this.listLoading = true questionApi.pageList(this.queryParam).then(re => { - this.tableData = re.data - this.total = re.total - this.queryParam.pageIndex = re.pageNum + this.tableData = re.data.list + this.total = re.data.total + this.queryParam.pageSize = re.data.pageSize + this.queryParam.pageIndex = re.data.pageNum this.listLoading = false }) - }, - // 杩斿洖涓婁竴涓〉闈� - goBack() { - this.$router.back(); }, // 淇敼琛ㄥ崟澶撮儴鐨勯鑹� getRowClass() { return "background:#d2d3d6"; - }, - // 鐢熸垚璇曞嵎 - getCreate() { - // 璺宠浆鍒扮敓鎴愰〉闈� - //璺宠浆鍒板搴旂殑绠$悊椤甸潰 - this.$router.push({ - path: "/manage/test-paper-generation", - }); }, // 鐐瑰嚮鍚庤皟鐢ㄥ脊绐楃粍浠剁殑鏂规硶,寮�鍚脊绐� getDialogFormVisible(value) { @@ -178,11 +211,51 @@ this.truesVisible = true; break; } + this.updateId = ''; }, // 寮圭獥 // 鎺ユ敹寮圭獥缁勪欢杩斿洖鐨勮〃鍗曞�� parentGoods(obj) { console.log(obj, "寮圭獥缁勪欢鐨勮〃鍗曞��"); + }, + showQuestion(row) { + let _this = this + this.questionShow.dialog = true + this.questionShow.loading = true + questionApi.select(row.id).then(re => { + _this.questionShow.qType = re.data.questionType + _this.questionShow.question = re.data + _this.questionShow.loading = false + }) + }, + editQuestion(row) { + this.getDialogFormVisible(row.questionTypeName); + this.updateId = row.id; + }, + statusQuestion(row) { + let question = { + id: row.id, + status: row.status === '绂佺敤' ? '鍚敤' : '绂佺敤' + } + questionApi.updateStatus(question).then(re => { + if (re.code === 1) { + this.$message.success(re.message) + this.search() + } else { + this.$message.error(re.message) + } + }) + }, + deleteQuestion(row) { + let _this = this + questionApi.deleteQuestion(row.id).then(re => { + if (re.code === 1) { + _this.search() + _this.$message.success(re.message) + } else { + _this.$message.error(re.message) + } + }) }, }, computed: { @@ -191,7 +264,7 @@ questionTypeEnum: state => state.exam.question.typeEnum, editUrlEnum: state => state.exam.question.editUrlEnum }), - ...mapState('exam', { subjects: state => state.subjects }) + ...mapGetters('exam', ['subjectEnumFormat']), } }; </script> diff --git a/src/views/Manage/TestPaper/subject.vue b/src/views/Manage/TestPaper/subject.vue new file mode 100644 index 0000000..a1091f0 --- /dev/null +++ b/src/views/Manage/TestPaper/subject.vue @@ -0,0 +1,219 @@ +<!-- 绉戠洰绠$悊 --> +<template> + <div class="c"> + <div class="bg"> + <div class="main"> + <!-- 寰呰繑鍥炵殑鏍囬 --> + <TitleIndex title="绉戠洰绠$悊" /> + <div class="content"> + <!-- 鏂板鎸夐挳 --> + <div style="padding-bottom:20px; border-bottom: 3px solid #409EFF;margin-bottom: 20px;"> + <el-button type="primary" class="link-left" @click="edit()">鏂板</el-button> + </div> + <!-- 鎼滅储 --> + <div> + <el-form :inline="true" :model="queryParam" class="demo-form-inline" label-width="80px"> + <el-form-item> + <el-input v-model="queryParam.name" placeholder="璇疯緭鍏ュ悕绉�" clearable></el-input> + </el-form-item> + <el-form-item> + <el-select v-model="queryParam.status" placeholder="璇烽�夋嫨鐘舵��" clearable @change="search"> + <el-option value="1" label="鍚敤"></el-option> + <el-option value="2" label="绂佺敤"></el-option> + </el-select> + </el-form-item> + <el-form-item> + <el-button style="width:100px;" type="primary" size="small" @click="search()">鏌ヨ</el-button> + </el-form-item> + </el-form> + </div> + <!-- 琛ㄦ牸 --> + <el-table v-loading="listLoading" :header-cell-style="getRowClass" :data="tableData" border + style="width: 100%;"> + <el-table-column align="center" prop="name" label="鍚嶇О" show-overflow-tooltip /> + <el-table-column align="center" prop="itemOrder" label="鎺掑簭" width="150px" /> + <el-table-column align="center" prop="createTime" label="鍒涘缓鏃堕棿" width="160px" /> + <el-table-column label="鐘舵��" prop="status" width="70px"> + <template slot-scope="{row}"> + <el-tag :type="row.status === '绂佺敤' ? 'danger' : 'success'"> + {{ row.status ? row.status : '鍚敤' }} + </el-tag> + </template> + </el-table-column> + <el-table-column label="鎿嶄綔" align="center" width="300px"> + <template slot-scope="{row}"> + <el-button size="mini" @click="edit(row)">缂栬緫</el-button> + <el-button size="mini" type="primary" @click="status(row)">{{ row.status === "绂佺敤" ? "鍚敤" : "绂佺敤" + }}</el-button> + <el-popconfirm title="纭鍒犻櫎鍚�" @confirm="deleteSubject(row)"> + <el-button slot="reference" size="mini" type="danger" class="link-left">鍒犻櫎</el-button> + </el-popconfirm> + </template> + </el-table-column> + </el-table> + <pagination v-show="total > 0" :total="total" :page.sync="queryParam.pageIndex" + :limit.sync="queryParam.pageSize" @pagination="search" /> + </div> + </div> + </div> + + <el-dialog :visible.sync="visible" width="400px"> + <el-form :model="form" ref="form" label-width="100px" v-loading="formLoading" :rules="rules"> + <el-form-item label="鍚嶇О锛�" prop="name" required> + <el-input v-model="form.name" maxlength="10" show-word-limit /> + </el-form-item> + <el-form-item label="鎺掑簭锛�" prop="itemOrder" required> + <el-input-number v-model="form.itemOrder" type="number" :min="1" :max="100" /> + </el-form-item> + <el-form-item> + <el-button type="primary" @click="submitForm">鎻愪氦</el-button> + <el-button @click="resetForm">閲嶇疆</el-button> + </el-form-item> + </el-form> + </el-dialog> + </div> +</template> +<script> +// 寮曞叆褰堝嚭绐楀彛绲勪欢 +import subjectApi from '@/api/subject' +import Pagination from '@/components/Pagination' + +export default { + // 娉ㄥ唽 + components: { + Pagination + }, + data() { + return { + listLoading: true, + queryParam: { + name: '', + pageIndex: 1, + pageSize: 10 + }, + formLoading: false, + total: 0, + tableData: [], + form: { + id: '', + name: '', + itemOrder: '' + }, + visible: false, + rules: { + name: [ + { required: true, message: '璇疯緭鍏ュ悕绉�', trigger: 'blur' } + ], + itemOrder: [ + { required: true, message: '璇疯緭鍏ユ帓搴�', trigger: 'blur', type: 'number' } + ] + }, + }; + }, + created() { + this.search() + }, + methods: { + // 鑾峰彇鎺掑簭 + getItemOrder() { + subjectApi.getItemOrder().then(re => { + this.form.itemOrder = re.data + }) + }, + // 鑾峰彇鍒楄〃 + search() { + this.listLoading = true + subjectApi.pageList(this.queryParam).then(re => { + this.tableData = re.data.list + this.total = re.data.total + this.queryParam.pageSize = re.data.pageSize + this.queryParam.pageIndex = re.data.pageNum + this.listLoading = false + }) + }, + // 淇敼琛ㄥ崟澶撮儴鐨勯鑹� + getRowClass() { + return "background:#d2d3d6"; + }, + edit(row) { + if (row) { + subjectApi.select(row.id).then(re => { + if (re.code === 1) { + this.form = re.data; + this.visible = true; + } else { + this.$message.error(re.message) + } + }) + } else { + this.getItemOrder(); + this.visible = true; + } + }, + status(row) { + let question = { + id: row.id, + status: row.status === '绂佺敤' ? '鍚敤' : '绂佺敤' + } + subjectApi.updateStatus(question).then(re => { + if (re.code === 1) { + this.$message.success(re.message) + this.search() + } else { + this.$message.error(re.message) + } + }) + }, + deleteSubject(row) { + let _this = this + subjectApi.deleteSubject(row.id).then(re => { + if (re.code === 1) { + _this.search() + _this.$message.success(re.message) + } else { + _this.$message.error(re.message) + } + }) + }, + submitForm() { + let _this = this + this.$refs.form.validate((valid) => { + if (valid) { + this.formLoading = true + subjectApi.edit(this.form).then(re => { + if (re.code === 1) { + _this.$message.success(re.message) + _this.search() + _this.formLoading = false + _this.visible = false + } else { + _this.$message.error(re.message) + _this.formLoading = false + _this.visible = false + } + }) + } + }) + }, + resetForm() { + let lastId = this.form.id + this.$refs['form'].resetFields() + this.form.id = lastId + }, + } +}; +</script> +<style scoped lang="scss"> +.flex { + display: flex; +} + +// 鍐呭 +.content { + width: 1262px; + margin-bottom: 80px; + background-color: #fff; + padding: 20px 40px; + border-radius: 10px; +} +</style> -- Gitblit v1.8.0