diff --git a/package-lock.json b/package-lock.json index 2ffcbc4..aff600d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "vue": "^2.6.12", "vue-clipboard2": "^0.3.1", "vue-cookie": "^1.1.4", + "vue-json-excel": "^0.3.0", "vue-router": "^3.4.9", "vuex": "^3.6.0" }, @@ -4914,6 +4915,11 @@ "integrity": "sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==", "dev": true }, + "node_modules/downloadjs": { + "version": "1.4.7", + "resolved": "https://registry.npmmirror.com/downloadjs/-/downloadjs-1.4.7.tgz", + "integrity": "sha512-LN1gO7+u9xjU5oEScGFKvXhYf7Y/empUIIEAGBs1LzUq/rg5duiDrkuH5A2lQGd5jfMOb9X9usDa2oVXwJ0U/Q==" + }, "node_modules/duplexer": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", @@ -9670,6 +9676,14 @@ "integrity": "sha512-BXq3jwIagosjgNVae6tkHzzIk6a8MHFtzAdwhnV5VlvPTFxDCvIttgSiHWjdGoTJvXtmRu5HacExfdarRcFhog==", "dev": true }, + "node_modules/vue-json-excel": { + "version": "0.3.0", + "resolved": "https://registry.npmmirror.com/vue-json-excel/-/vue-json-excel-0.3.0.tgz", + "integrity": "sha512-FrSh0tVUpw4K+ilLO8g0Qp52eFJw/hkk3rZPTEKo9qVkJgVfQtZwzj3UWc5ACYxA3jLk9HtjK+f9xKHCN4Kgag==", + "dependencies": { + "downloadjs": "^1.4.7" + } + }, "node_modules/vue-loader": { "version": "17.1.0", "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-17.1.0.tgz", @@ -14130,6 +14144,11 @@ "integrity": "sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==", "dev": true }, + "downloadjs": { + "version": "1.4.7", + "resolved": "https://registry.npmmirror.com/downloadjs/-/downloadjs-1.4.7.tgz", + "integrity": "sha512-LN1gO7+u9xjU5oEScGFKvXhYf7Y/empUIIEAGBs1LzUq/rg5duiDrkuH5A2lQGd5jfMOb9X9usDa2oVXwJ0U/Q==" + }, "duplexer": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", @@ -17670,6 +17689,14 @@ "integrity": "sha512-BXq3jwIagosjgNVae6tkHzzIk6a8MHFtzAdwhnV5VlvPTFxDCvIttgSiHWjdGoTJvXtmRu5HacExfdarRcFhog==", "dev": true }, + "vue-json-excel": { + "version": "0.3.0", + "resolved": "https://registry.npmmirror.com/vue-json-excel/-/vue-json-excel-0.3.0.tgz", + "integrity": "sha512-FrSh0tVUpw4K+ilLO8g0Qp52eFJw/hkk3rZPTEKo9qVkJgVfQtZwzj3UWc5ACYxA3jLk9HtjK+f9xKHCN4Kgag==", + "requires": { + "downloadjs": "^1.4.7" + } + }, "vue-loader": { "version": "17.1.0", "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-17.1.0.tgz", diff --git a/package.json b/package.json index b9bb54e..e9bf182 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "vue": "^2.6.12", "vue-clipboard2": "^0.3.1", "vue-cookie": "^1.1.4", + "vue-json-excel": "^0.3.0", "vue-router": "^3.4.9", "vuex": "^3.6.0" }, diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..ca35552 Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/index.html b/public/index.html index b4cb112..8f6f5cf 100644 --- a/public/index.html +++ b/public/index.html @@ -5,7 +5,7 @@ - 微信后台管理系统 + 评阅人员管理系统 diff --git a/src/main.js b/src/main.js index 304e583..089e020 100644 --- a/src/main.js +++ b/src/main.js @@ -17,7 +17,8 @@ Vue.use(ElementUI); Vue.use(VueClipboard) Vue.use(VueCookie) Vue.config.productionTip = false - +import JsonExcel from 'vue-json-excel'; +Vue.component('downloadExcel', JsonExcel) // 挂载全局 Vue.prototype.$http = httpRequest // ajax请求方法 Vue.prototype.isAuth = isAuth // 权限方法 diff --git a/src/views/common/home.vue b/src/views/common/home.vue index 948980d..89eda83 100644 --- a/src/views/common/home.vue +++ b/src/views/common/home.vue @@ -1,6 +1,6 @@ --> \ No newline at end of file diff --git a/src/views/modules/h5/group.vue b/src/views/modules/h5/group.vue new file mode 100644 index 0000000..fb124ee --- /dev/null +++ b/src/views/modules/h5/group.vue @@ -0,0 +1,441 @@ + + + + \ No newline at end of file diff --git a/src/views/modules/h5/hostel.vue b/src/views/modules/h5/hostel.vue index c011b52..24bb4b2 100644 --- a/src/views/modules/h5/hostel.vue +++ b/src/views/modules/h5/hostel.vue @@ -12,7 +12,7 @@ 批量删除 - + 下载Excel模板 @@ -193,7 +193,7 @@ export default { // 删除 deleteHandle(userid) { var userIds = userid ? [userid] : this.dataListSelections.map(item => item.id) - this.$confirm(`确定对[userid=${userIds.join(',')}]进行[${userid ? '删除' : '批量删除'}]操作?`, '提示', { + this.$confirm(`确定操作?`, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' diff --git a/src/views/modules/h5/invitation.vue b/src/views/modules/h5/invitation.vue new file mode 100644 index 0000000..ec7d20f --- /dev/null +++ b/src/views/modules/h5/invitation.vue @@ -0,0 +1,390 @@ + + + + diff --git a/src/views/modules/h5/localTeacher-add-or-update.vue b/src/views/modules/h5/localTeacher-add-or-update.vue index bc75a79..0ec2426 100644 --- a/src/views/modules/h5/localTeacher-add-or-update.vue +++ b/src/views/modules/h5/localTeacher-add-or-update.vue @@ -116,7 +116,7 @@ export default { console.log(data) if (data && data.code === 200) { this.dataForm.userName = data.user.userName - this.dataForm.groupId = data.user.groupId + this.dataForm.groupId = data.user.groupId== 0 ? '' : data.user.groupId this.dataForm.teacherId = data.user.teacherId this.dataForm.userId = data.user.userId this.dataForm.status = data.user.status diff --git a/src/views/modules/h5/localTeacher.vue b/src/views/modules/h5/localTeacher.vue index 41d2628..b5594c0 100644 --- a/src/views/modules/h5/localTeacher.vue +++ b/src/views/modules/h5/localTeacher.vue @@ -2,7 +2,7 @@
- + 查询 @@ -11,8 +11,13 @@ :disabled="dataListSelections.length <= 0">批量删除 + + 导出 + + - @@ -21,13 +26,13 @@ {{ (pageIndex - 1) * pageSize + scope.$index + 1 }} - + + + - + - - - + @@ -38,6 +43,7 @@ - + - + + + - + - - - + @@ -51,7 +54,7 @@ @@ -95,6 +98,48 @@ export default { dataListSelections: [], addOrUpdateVisible: false, groupIdes: [], + json_fields: { + "序号":"index", + "姓名": "userName", + "身份码": "userId", + "用户专业码": "userMajorId", + "学号": "studentId", + "学科": { + field: "majorId", + callback: (value) => { + // 定义major_id到对应文本的映射 + const majorMap = { + 1: "语文", + 4: "地理", + 7: "历史", + 8: "政治", + }; + return majorMap[value] || value; // 返回对应的文本 + } + }, + "手机号": "phone", + "分组": { + field: "groupId", + callback: (value) => { + if (value=='0'){ + return "" + } + return this.groupIdMap[value] || value; // 返回对应的文本 + } + }, + "是否第一次阅卷": { + field: "status", + callback: (value) => { + // 定义major_id到对应文本的映射 + const majorMap = { + 0: "否", + 1: "是", + }; + return majorMap[value] || value; // 返回对应的文本 + } + } + }, + groupIdMap:{}, } }, components: { @@ -104,27 +149,62 @@ export default { this.getDataList() this.groupIdes=[] // 获取分组 - myRequest.getGroupList(this) + let groupList = myRequest.getGroupList(this); + setTimeout(() => { + groupList.forEach(item => { + this.groupIdMap[item.id] = item.text; + }) + },500) }, computed: {}, methods: { + /** + * 自定义排序 + */ + sortChange(colum){ + if (colum.order === 'ascending'){ + this.getDataList(colum.prop,colum.order) + }else { + this.getDataList(colum.prop,colum.order) + } + + }, + // Excel导出 + async getExportExcel(){ + let excelData=[] + await this.$http({ + url: this.$http.adornUrl('/stu/export'), + method: 'get', + }).then(({data}) => { + excelData = data.map((item, index) => { + return { ...item, index: index + 1 }; // 添加序号字段 + }); + }) + return excelData + }, // isAuth, // 分组过滤 filterTag(value, row) { return row.groupId === value; }, getgroups(id) { - try { - let groupIdes = this.groupIdes - return groupIdes[id - 1].text - }catch (e) { - // console.log(e) - return "未分组" - } - + let groupName='' + // console.log(this.groupIdesShow[id]) + this.groupIdesShow.forEach(item => { + if (item.id === id){ + groupName= item.name + } + }) + return groupName + // try { + // + // } catch (e) { + // console.log(e) + // return "未分组" + // } }, // 获取数据列表 - getDataList() { + getDataList(prop='',sort='') { this.dataListLoading = true this.$http({ url: this.$http.adornUrl('/stu/list'), @@ -132,7 +212,9 @@ export default { params: this.$http.adornParams({ 'page': this.pageIndex, 'limit': this.pageSize, - 'userId': this.dataForm.userName + 'userName': this.dataForm.userName, + 'prop': prop, + 'sort': sort }) }).then(({data}) => { if (data && data.code === 200) { @@ -170,7 +252,8 @@ export default { // 删除 deleteHandle(userid) { var userIds = userid ? [userid] : this.dataListSelections.map(item => item.id) - this.$confirm(`确定对[userid=${userIds.join(',')}]进行[${userid ? '删除' : '批量删除'}]操作?`, '提示', { + // this.$confirm(`确定对[userid=${userIds.join(',')}]进行[${userid ? '删除' : '批量删除'}]操作?`, '提示', { + this.$confirm(`确定操作?`, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' diff --git a/src/views/modules/h5/test.vue b/src/views/modules/h5/test.vue new file mode 100644 index 0000000..e69de29 diff --git a/src/views/modules/h5/user-add-or-update.vue b/src/views/modules/h5/user-add-or-update.vue index d179b15..c15fd1b 100644 --- a/src/views/modules/h5/user-add-or-update.vue +++ b/src/views/modules/h5/user-add-or-update.vue @@ -5,17 +5,24 @@ - + - + + + + + + - {{item.name}} + + {{ item.name }} + @@ -60,11 +67,52 @@ export default { id: 0, userName: '', groupId: '', - identity: '', + identity: 3, userId: '', + userMajorId: 1, status: 0 }, - identityes: ['管理员', '研究生', '本校老师', '外校老师'], + majors: [ + { + id: 1, + name: '语文', + value: 1, + }, + { + id: 2, + name: '地理', + value: 4, + }, + { + id: 3, + name: '历史', + value: 7, + }, + { + id: 4, + name: '政治', + value: 8, + }], + identityes: [ + // { + // id: 1, + // name: '管理员', + // value: 2, + // }, + { + id: 2, + name: '研究生', + value: 3, + }, { + id: 3, + name: '本校老师', + value: 6, + }, { + id: 4, + name: '外校老师', + value: 9, + } + ], groupIdes: [], dataRule: { userName: [ @@ -85,7 +133,7 @@ export default { myRequest.getGroupList2(this).then(res => { this.groupIdes = res.data.list }) - if (id==undefined){ + if (id == undefined) { this.dataForm.userId = '' this.dataForm.userName = '' this.dataForm.groupId = '' @@ -115,7 +163,7 @@ export default { console.log(data) if (data && data.code === 200) { this.dataForm.userName = data.user.userName - this.dataForm.groupId = data.user.groupId + this.dataForm.groupId = data.user.groupId == 0 ? '' : data.user.groupId this.dataForm.identity = data.user.identity this.dataForm.userId = data.user.userId this.dataForm.status = data.user.status @@ -132,11 +180,12 @@ export default { url: this.$http.adornUrl(`/h5/user/${!this.dataForm.id ? 'save' : 'update'}`), method: 'post', data: this.$http.adornData({ - 'id':this.dataForm.id, + 'id': this.dataForm.id, 'userName': this.dataForm.userName, 'groupId': this.dataForm.groupId, 'identity': this.dataForm.identity, 'userId': this.dataForm.userId, + 'userMajorId': this.dataForm.userMajorId, 'status': this.dataForm.status, }) }).then(({data}) => { diff --git a/src/views/modules/h5/user.vue b/src/views/modules/h5/user.vue index 5092dfa..d9228c5 100644 --- a/src/views/modules/h5/user.vue +++ b/src/views/modules/h5/user.vue @@ -1,8 +1,16 @@ - + - + + + - + - + + + - + + + + + + + + + +