From 8c0c2e4213efa9c8eb30e7e3ec7253a62e8ae5db Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Fri, 2 Jul 2021 17:00:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E3=80=81=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E3=80=81=E8=A7=92=E8=89=B2=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/index.js | 52 +-- src/assets/img/arrow.png | Bin 0 -> 612 bytes src/libs/util.js | 6 +- src/pages/data/list/index.vue | 28 +- src/pages/index/list/index.vue | 2 +- src/pages/role/list/index.vue | 6 - src/pages/setting/person/download.vue | 10 +- src/pages/stat/list/index.vue | 141 ++++++-- src/pages/user/list/index.vue | 490 +++++++++++--------------- src/plugins/requests/index.js | 4 +- src/setting.js | 6 +- 11 files changed, 396 insertions(+), 349 deletions(-) create mode 100644 src/assets/img/arrow.png diff --git a/src/api/index.js b/src/api/index.js index 533298f..f44a38b 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -1,7 +1,7 @@ import Setting from '@/setting' let uploadURL = Setting.upload.apiURL let host = 'http://www.liuwanr.cn' -let host1 = 'http://192.168.31.125:8888' +let host1 = 'http://192.168.31.125:9000' export default { // 登录注册 @@ -36,9 +36,9 @@ export default { queryCity: `cjEnterprise/city/queryCity`, queryClient: `cjEnterprise/client/list`, - // 员工管理 - addStaff: `evaluation/tms/system/addStaff`, - daleteBatchStaff: `evaluation/tms/system/daleteBatchStaff`, + // 用户管理 + saveUser: `/data/user/save`, + getUserList: `/data/user/getUserList`, queryStaff: `evaluation/tms/system/queryStaff`, querystaffDetail: `evaluation/tms/system/querystaffDetail`, updateStaff: `evaluation/tms/system/updateStaff`, @@ -49,26 +49,34 @@ export default { resetPwd:`evaluation/tms/system/resetPwd`, // 角色管理 - batchRemove:`/data/data/role/batchRemove`, - getRole:`/data/data/role/get`, - getName:`/data/data/role/getName`, - listRole:`/data/data/role/list`, - removeRole:`/data/data/role/remove`, - saveOrUpdate:`/data/data/role/saveOrUpdate`, + batchRemove:`/data/role/batchRemove`, + getRole:`/data/role/get`, + getName:`/data/role/getName`, + listRole:`/data/role/list`, + removeRole:`/data/role/remove`, + saveOrUpdate:`/data/role/saveOrUpdate`, + getRoles:`/data/role/getRole`, + checkAccount:`/data/user/checkAccount`, // 权限菜单管理 - doAssign:`/data/data/permission/doAssign`, - queryPermissionMenu:`/data/data/permission/queryPermissionMenu`, - savePer:`/data/data/permission/save`, - toAssign:`/data/data/permission/toAssign`, + doAssign:`/data/permission/doAssign`, + queryPermissionMenu:`/data/permission/queryPermissionMenu`, + savePer:`/data/permission/save`, + toAssign:`/data/permission/toAssign`, // 表展示 - getIdQueryTable:`/data/huoran/data/table/getIdQueryTable`, - getTableByClassification:`/data/huoran/data/table/getTableByClassification`, - getTableByCondition:`/data/huoran/data/table/getTableByCondition`, - downloadData:`${host1}/data/data/download`, - previewData:`${host1}/data/data/preview`, - downloadRecord:`${host1}/data/huoran/data/myDownload/downloadRecord`, - getDownloadRecord:`${host1}/data/huoran/data/myDownload/getDownloadRecord`, - downloadAgain:`${host1}/data/data/downloadAgain`, + getIdQueryTable:`/data/table/getIdQueryTable`, + getTableByClassification:`/data/table/getTableByClassification`, + getTableByCondition:`/data/table/getTableByCondition`, + downloadData:`${host1}/data/download`, + previewData:`${host1}/data/preview`, + downloadRecord:`${host1}/data/myDownload/downloadRecord`, + getDownloadRecord:`data/myDownload/getDownloadRecord`, + downloadAgain:`${host1}/data/downloadAgain`, + + // 数据操作记录 + queryAccumulate:`${host1}/data/dataRecord/queryAccumulate`, + queryDatabaseInfo:`${host1}/data/dataRecord/queryDatabaseInfo`, + queryDatabaseInfoByMonth:`${host1}/data/dataRecord/queryDatabaseInfoByMonth`, + saveRecord:`${host1}/data/dataRecord/saveRecord`, } \ No newline at end of file diff --git a/src/assets/img/arrow.png b/src/assets/img/arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..066334d57d3a608546c6b668afeee2bd13a18a6f GIT binary patch literal 612 zcmV-q0-ODbP)ft*<%VV3#EpX7pd zF*EGPg%ae { + this.$post(this.api.saveRecord,{ + platformUserId: 4, + tableId: row.id, + type: 2, + schoolId: this.schoolId, + }).then(res => {}).catch(res => {}) let comment = res.comment let previewHead = [] comment.map(n => { @@ -311,18 +319,19 @@ export default { let newFields = [] let fieldsList = this.fieldsList fields.map(n => { - newFields.push(`fields=${fieldsList.find(e => e.comment == n).field}`) + newFields.push(fieldsList.find(e => e.comment == n).field) }) - util.successMsg('数据正在生成中,请稍等片刻,生成后会自动下载,您可以先访问其他页面。',5000) + let msgObj = util.successMsg('数据正在生成中,请稍等片刻,生成后会自动下载,您可以先访问其他页面。',5000) this.downloadVisible = false let startTime = this.startTime ? this.startTime : '' let endTime = this.endTime ? this.endTime : '' let frequency = this.frequency - axios.get(`${this.api.downloadData}?tableName=${this.curRow.name}&${newFields.join('&')}&startTime=${startTime}&endTime=${endTime}&frequency=${frequency}`,{ + axios.get(`${this.api.downloadData}?tableName=${this.curRow.name}&table_id=${this.curRow.id}&fields=${newFields.join()}&startTime=${startTime}&endTime=${endTime}&frequency=${frequency}`,{ responseType: 'blob' }).then((res) => { - console.log(22,res.data) + msgObj.close() + if(res.data.type != 'multipart/form-data') return util.warningMsg('数据总数为零!') const blob = new Blob([res.data]) const fileName = `${this.curRow.showName}.xls` if ('download' in document.createElement('a')) { // 非IE下载 @@ -338,7 +347,16 @@ export default { navigator.msSaveBlob(blob, fileName) } - this.$get(`${this.api.downloadRecord}?platformUserId=4&tableId=${this.curRow.id}&${newFields.join('&')}&startTime=${startTime}&endTime=${endTime}&frequency=${frequency}`).then(res => {}).catch(res => {}) + this.$get(`${this.api.downloadRecord}?platformUserId=4&tableId=${this.curRow.id}&fields=${newFields.join()}&startTime=${startTime}&endTime=${endTime}&frequency=${frequency}`).then(res => {}).catch(res => {}) + + this.$post(this.api.saveRecord,{ + platformUserId: 4, + tableId: this.curRow.id, + type: 1, + schoolId: this.schoolId, + }).then(res => {}).catch(res => {}) + }).catch(res => { + msgObj.close() }) } } diff --git a/src/pages/index/list/index.vue b/src/pages/index/list/index.vue index 05c8a13..f6f6fea 100644 --- a/src/pages/index/list/index.vue +++ b/src/pages/index/list/index.vue @@ -76,7 +76,7 @@ export default { this.getData() }, download(row){ - this.$router.push(`/data?download=true&name=${row.name}`) + this.$router.push(`/data?download=true&id=${row.id}&name=${row.name}`) } } }; diff --git a/src/pages/role/list/index.vue b/src/pages/role/list/index.vue index 2ccac1e..c744d56 100644 --- a/src/pages/role/list/index.vue +++ b/src/pages/role/list/index.vue @@ -115,12 +115,6 @@ export default { }, methods: { getData() { - let data = { - clientId: this.clientId - } - if(this.keyword.length){ - data.name = this.keyword - } this.$get(`${this.api.listRole}/${this.page}/${this.pageSize}?name=${this.keyword}&clientId=`).then(res => { this.listData = res.items this.total = res.total diff --git a/src/pages/setting/person/download.vue b/src/pages/setting/person/download.vue index 04e47de..27b5446 100644 --- a/src/pages/setting/person/download.vue +++ b/src/pages/setting/person/download.vue @@ -80,9 +80,12 @@ export default { this.getData() }, download(row){ - axios.get(`${this.api.downloadAgain}?table_id=${row.id}&fields=${row.fields}&startTime=${row.startTime ? row.startTime : ''}&endTime=${row.endTime ? row.endTime : ''}&frequency=${row.frequency ? row.frequency : ''}`,{ + let msgObj = util.successMsg('数据正在生成中,请稍等片刻,生成后会自动下载,您可以先访问其他页面。',5000) + axios.get(`${this.api.downloadData}?tableName=${row.tableNme}&table_id=${row.id}&fields=${row.fields}&startTime=${row.startTime ? row.startTime : ''}&endTime=${row.endTime ? row.endTime : ''}&frequency=${row.frequency ? row.frequency : ''}`,{ responseType: 'blob' }).then(res => { + msgObj.close() + if(res.data.type != 'multipart/form-data') return util.warningMsg('数据总数为零!') const blob = new Blob([res.data]) const fileName = `${row.databaseName}.xls` if ('download' in document.createElement('a')) { // 非IE下载 @@ -97,7 +100,10 @@ export default { } else { // IE10+下载 navigator.msSaveBlob(blob, fileName) } - }).catch(res => {}) + this.$post(`${this.api.saveRecord}?platformUserId=4&tableId=${row.id}&type=1&schoolId=1`).then(res => {}).catch(res => {}) + }).catch(res => { + msgObj.close() + }) } } }; diff --git a/src/pages/stat/list/index.vue b/src/pages/stat/list/index.vue index d1fbbbd..f5a3797 100644 --- a/src/pages/stat/list/index.vue +++ b/src/pages/stat/list/index.vue @@ -2,6 +2,7 @@
+
广东工业大学
使用期限:
@@ -9,6 +10,7 @@

剩余期限:300

+

账号数量:10

@@ -23,13 +25,13 @@
  • - 2人 + {{dayCount}}

    平均日访客量

  • - 4 + {{schoolCount}}

    累计下载

  • @@ -49,6 +51,10 @@ +
  • + + +
  • @@ -62,17 +68,19 @@ - - - - + + + + +
    + +
    按月份统计数据库使用概况
    -
    导出数据
    @@ -82,18 +90,18 @@ - - - - - - - - - - - - + + + + + + + + + + + +
    @@ -104,10 +112,17 @@ export default { data() { return { + schoolId: 1001, + dayCount: 0, + schoolCount: 0, + keyword: '', + searchTimer: null, date: [], startTime: '', endTime: '', listData: [], + listDataKeyword: [], + listDataAll: [], multipleSelection: [], monthData: [ { @@ -125,9 +140,16 @@ export default { }, ], multipleSelection1: [], + active: false } }, watch: { + keyword: function(val) { + clearTimeout(this.searchTimer) + this.searchTimer = setTimeout(() => { + this.searchData() + },500) + }, date: function(val){ if(val){ this.startTime = val[0] @@ -136,23 +158,66 @@ export default { this.startTime = '' this.endTime = '' } - this.getData() + this.getDatabase() } }, mounted() { - + this.getData() }, methods: { getData(){ + this.$get(`${this.api.queryAccumulate}?schoolId=${this.schoolId}`).then(res => { + this.dayCount = res.dayCount + this.schoolCount = res.schoolCount + }).catch(res => {}) + this.$get(`${this.api.queryDatabaseInfoByMonth}?schoolId=${this.schoolId}`).then(res => { + let list = res.message + let result = [] + for(let i in list){ + for(let n in list[i]){ + let item = { + year: i, + type: n, + } + list[i][n].map((val,index) => { + item[index + 1] = val + }) + result.push(item) + } + } + this.monthData = result + }).catch(res => {}) + this.getDatabase() + }, + getDatabase(){ + this.$get(`${this.api.queryDatabaseInfo}?schoolId=${this.schoolId}&startTime=${this.startTime}&endTime=${this.endTime}`).then(res => { + let list = JSON.parse(res.databaseInfo) + this.listData = list.slice(0,10) + this.listDataAll = list + }).catch(res => {}) + }, + searchData(){ + let list = this.listDataAll + let result = [] + list.map(n => { + (n.categoryOne.includes(this.keyword) || n.categoryTwo.includes(this.keyword)) && result.push(n) + }) + this.listData = this.active ? result : result.slice(0,10) + this.listDataKeyword = result }, objectSpanMethod({ row, column, rowIndex, columnIndex }) { - if (columnIndex === 0) { - if (rowIndex % 2 === 0) { + if (!columnIndex || columnIndex == 1) { + if (rowIndex % 3 == 0) { return { rowspan: 3, colspan: 1 - }; + } + }else { + return { + rowspan: 0, + colspan: 0 + } } } }, @@ -162,6 +227,22 @@ export default { handleSelectionChange1(val) { this.multipleSelection1 = val }, + toggleList(){ + if(this.keyword){ + if(this.active){ + this.listData = this.listDataKeyword.slice(0,10) + }else{ + this.listData = this.listDataKeyword + } + }else{ + if(this.active){ + this.listData = this.listDataAll.slice(0,10) + }else{ + this.listData = this.listDataAll + } + } + this.active = !this.active + } } }; @@ -176,6 +257,12 @@ export default { padding: 15px; background-color: #fff; border-radius: 8px; + .school{ + margin-bottom: 15px; + font-size: 20px; + color: #568DF2; + text-align: center; + } .date{ display: flex; align-items: center; @@ -213,6 +300,12 @@ export default { line-height: 1.8; border-left: 6px solid; } + .arrow{ + cursor: pointer; + &.active{ + transform: rotate(180deg) + } + } .stat{ display: flex; li{ diff --git a/src/pages/user/list/index.vue b/src/pages/user/list/index.vue index 10b36b1..74cd989 100644 --- a/src/pages/user/list/index.vue +++ b/src/pages/user/list/index.vue @@ -2,11 +2,34 @@
    -
    +
      +
    • + + + + +
    • +
    • + + +
    • +
    • + + + + + +
    • +
    • + + + + +
    • - +
    @@ -23,20 +46,29 @@ - + + + + + + - + @@ -44,35 +76,35 @@
    - - - - + + + + - + - - + + - - + + - + - + - + - 取 消 - 确 定 + 取 消 + 确 定 @@ -102,32 +134,60 @@ import util from '@/libs/util' export default { data() { return { - pages: 10, + schoolId: 1001, + month: '', + monthList: [ + { + id: '', + label: '不限' + },{ + id: 3, + label: '近3个月' + },{ + id: 6, + label: '近6个月' + },{ + id: 12, + label: '近1年' + } + ], + date: [], + startTime: '', + endTime: '', + role: '', + status: '', + statusList: [ + { + id: '', + label: '不限' + },{ + id: 0, + label: '启用' + },{ + id: 1, + label: '禁用' + } + ], isDetail: false, - props: { multiple: true }, - orgList: [], - isAddteacher: false, - teacherVisible: false, - staffShowVisible: false, + userVisible: false, roleList: [], - teacherForm: { - teacherId: '', + form: { + platformId: Setting.platformId, + // type: 1, // 可不传 + account: '', + userId: '', userName: '', - roleValue: '', + roleId: '', phone: '', - uniqueIdentificationAccount: '', + uniqueIdentification: '', workNumber: '', email: '', - major: '', - department: '', - userAccount: '', - major: '', - clientId: this.clientId, - clientName: this.clientName, + schoolId: this.schoolId, + password: '' }, rules: { - userAccount: [ - { required: true, message: '请输入账号', trigger: 'blur' }, + account: [ + { required: true, message: '请输入职工账号', trigger: 'blur' }, { pattern: /^[A-Za-z0-9]+$/, message: '请输入正确的账号', @@ -137,45 +197,31 @@ export default { userName: [ { required: true, message: '请输入用户姓名', trigger: 'blur' } ], - roleValue: [ + roleId: [ { required: true, message: '请选择账号角色', trigger: 'change' } ], - uniqueIdentificationAccount: [ - // { required: true, message: '请输入唯一标识', trigger: 'blur' }, - ], - major: [ - { required: true, message: '请选择一级部门', trigger: 'change' } - ], workNumber: [ - { required: true, message: '请输入职工工号', trigger: 'blur' }, + { required: true, message: '请输入工号/学号', trigger: 'blur' }, { - pattern: /^[A-Za-z0-9]+$/, - message: '请输入正确的职工工号', - trigger: 'blur' + pattern: /^[A-Za-z0-9]+$/, + message: '请输入正确的工号/学号', + trigger: 'blur' } ], - department: [ - { required: true, message: '请选择二级部门', trigger: 'change' } - ], phone: [ - // { required: true, message: '请输入职工手机号', trigger: 'blur' }, { - pattern: /^1[3456789]\d{9}$/, - message: '请输入正确的手机号', - trigger: 'blur' + pattern: /^1[3456789]\d{9}$/, + message: '请输入正确的手机号', + trigger: 'blur' } ], email: [ - // { required: true, message: '请输入邮箱', trigger: 'blur' }, { - pattern: /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/, - message: '请输入正确的邮箱', - trigger: 'blur' + pattern: /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/, + message: '请输入正确的邮箱', + trigger: 'blur' } ], - // schoolId: [ - // { required: true, message: '请选择所在院校', trigger: 'change' } - // ], }, listData: [], importVisible: false, @@ -183,32 +229,12 @@ export default { page: 1, pageSize: 10, total: 0, - departmentList: [], - teacherDepartmentList: [], - staffstateProfessId: '', - staffGradeId: '', multipleSelection: [], uploadList: [], - provinceId: this.$store.state.provinceId, - cityId: this.$store.state.cityId, - userId: this.$store.state.userId, - oneDepartmentIds: '', - twoDepartmentIds: '', - ProfessionalClassList: [], - subjectList: [], - ProfessionalList: [], - NoAdd: '', - AccountNoAdd: '', - NumberNoAdd: '', - platformId: this.$store.state.platformId, - schoolList: [], uploadFaild: false, token: '', accountRepeat: false, workNumberRepeat: false, - originalAccount: '', - originalWorkNumber: '', - password: Setting.initialPassword }; }, computed: { @@ -225,59 +251,45 @@ export default { this.searchTimer = setTimeout(() => { this.initData() },500) + }, + month: function(val){ + if(val){ + let unit = 24 * 60 * 60 * 1000 + this.date = [util.formatDate('yyyy-MM-dd',new Date(new Date().getTime() - unit * 30 * val)),util.formatDate('yyyy-MM-dd',new Date(new Date().getTime() + unit))] + }else{ + this.date = [] + } + }, + date: function(val){ + if(val.length){ + this.startTime = val[0] + this.endTime = val[1] + }else{ + this.startTime = '' + this.endTime = '' + } + this.initData() } }, mounted(){ - this.getOrg() - this.teacherForm.clientId = this.clientId - this.teacherForm.clientName = this.clientName + this.form.schoolId = this.schoolId this.getData() - this.getRoles() + this.getRole() }, methods: { - getOrg(){ - let data = { - schoolId: this.clientId - } - this.$get(this.api.queryStaffPro,data).then(res => { - let firList = res.data.StaffProfessionalArchitectureList - if(firList){ - firList.map(e => { - e.isParent = true - e.value = e.staffProfessionalArchitectureId - e.label = e.staffProfessionalArchitectureName - let data = { - staffProfessionalArchitectureId: e.staffProfessionalArchitectureId - } - this.$get(this.api.queryStaffGrade,data).then(res1 => { - res1.data.staffGradeList.map(e => { - e.value = e.staffGradeId - e.label = e.staffGradeName - }) - e.children = res1.data.staffGradeList - }).catch(res => {}) - }) - setTimeout(() => { - this.orgList = firList - },500) - } - }).catch(res => {}) - }, getData(){ - let totalPage = Math.ceil((this.total - 1) / this.pageSize) - let currentPage = this.page > totalPage ? totalPage : this.page - this.page = currentPage < 1 ? 1 : currentPage - let data = { - staffProfessionalArchitectureIds: this.oneDepartmentIds, - staffGradeIds: this.twoDepartmentIds, - searchContent: this.keyword, - schoolId: this.clientId, + this.$post(this.api.getUserList,{ + createTime: this.startTime, + disableAccount: this.status, + endTime: this.endTime, + keyWord: this.keyword, pageNum: this.page, - pageSize: this.pageSize - } - this.$get(`${this.api.queryStaff}/${this.page}/${this.pageSize}`,data).then(res => { - this.listData = res.data.staffList.list - this.total = res.data.staffList.totalCount + pageSize: this.pageSize, + platformId: Setting.platformId, + roleId: this.role, + }).then(res => { + this.listData = res.pageList.records + this.total = res.pageList.total if(!this.listData.length && this.total){ this.page-- this.getData() @@ -288,16 +300,9 @@ export default { this.page = 1 this.getData() }, - orgChange(node){ - this.twoDepartmentIds = node.map(n => n[1]).toString() - this.initData() - }, - getRoles(){ - let data = { - clientId: this.clientId - } - this.$get(`${this.api.queryRoles}/1/100`,data).then(res => { - this.roleList = res.data.items + getRole(){ + this.$get(this.api.getRoles).then(res => { + this.roleList = res.list }).catch(res => {}) }, resetPassword(row){ @@ -319,173 +324,107 @@ export default { }).catch(() => {}) }, accountChange(){ - if(this.teacherForm.userAccount !== this.originalAccount){ - this.$get(`${this.api.getAccount}?account=${this.teacherForm.userAccount}`).then(res => { - if(res.data.userInfo){ + // if(this.form.account !== this.originalAccount){ + this.$get(`${this.api.checkAccount}?account=${this.form.account}&type=1`).then(res => { + if(res.status == 200){ + this.accountRepeat = false + }else{ this.accountRepeat = true util.warningMsg('该账号已存在') - }else{ - this.accountRepeat = false } }).catch(res => {}) - }else{ - this.accountRepeat = false - } + // }else{ + // this.accountRepeat = false + // } }, workNumberChange(){ - if(this.teacherForm.workNumber !== this.originalWorkNumber){ - this.$get(`${this.api.getWorkNumber}?workNumber=${this.teacherForm.workNumber}`).then(res => { - if(res.data.staff){ + // if(this.form.workNumber !== this.originalWorkNumber){ + this.$get(`${this.api.checkAccount}?workNumber=${this.form.workNumber}&type=2`).then(res => { + if(res.status == 200){ + this.workNumberRepeat = false + }else{ this.workNumberRepeat = true util.warningMsg('该工号已存在') - }else{ - this.workNumberRepeat = false } }).catch(res => {}) - }else{ - this.workNumberRepeat = false - } + // }else{ + // this.workNumberRepeat = false + // } }, - closeTeacher(){ - this.$refs.teacherForm.resetFields() - this.teacherForm.clientId = this.clientId - this.teacherForm.clientName = this.clientName - this.teacherForm.department = '' - this.teacherForm.major = '' - this.teacherForm.workNumber = '' - this.teacherForm.userId = '' - this.teacherForm.staffId = '' + closeUser(){ + this.$refs.form.resetFields() + console.log(11,this.form) }, addTeacher(){ this.isDetail = false - this.teacherVisible = true + this.userVisible = true this.isAddteacher = true - this.teacherForm.teacherId = '' }, getStaffDetail(userId){ this.$get(`${this.api.getStaff}/${userId}`).then(res => { let user = res.data.userInfo; let or = res.data.staff; - this.teacherForm.uniqueIdentificationAccount = user.uniqueIdentificationAccount - this.teacherForm.clientId = user.clientId - this.teacherForm.clientName = user.clientName - this.teacherForm.userName = user.userName - this.teacherForm.phone = user.phone - this.teacherForm.email = user.email - this.teacherForm.userAccount = user.account + this.form.uniqueIdentification = user.uniqueIdentification + this.form.userName = user.userName + this.form.phone = user.phone + this.form.email = user.email + this.form.account = user.account this.originalAccount = user.account - this.teacherForm.userId = user.userId - this.teacherForm.schoolId = user.schoolId - this.teacherForm.roleValue = user.roleId + this.form.userId = user.userId + this.form.schoolId = user.schoolId - this.teacherForm.major = or.staffProfessionalArchitectureId - this.teacherForm.department = or.staffGradeId - this.teacherForm.workNumber = or.workNumber + this.form.workNumber = or.workNumber this.originalWorkNumber = or.workNumber - this.isManager = true - this.teacherForm.staffId = or.staffId - this.getDepartment() - }).catch(res => {}); + }).catch(res => {}) }, editTeacher(row){ this.isDetail = false - this.teacherVisible = true + this.userVisible = true this.isAddteacher = false this.AccountNoAdd = false - this.teacherForm.teacherId = row.staffId - this.getStaffDetail(row.staffId) + this.form.userId = row.userId + this.getStaffDetail(row.userId) }, showTeacher(row){ - this.staffShowVisible = true this.isDetail = true - this.isAddManage = false - this.AccountNoAdd = false - this.teacherForm.manageId = row.staffId - this.getStaffDetail(row.staffId) + this.getStaffDetail(row.userId) }, - getDepartment(){ - let data = { - staffProfessionalArchitectureId: this.teacherForm.major - } - this.$get(this.api.queryStaffGrade,data).then(res => { - this.departmentList = res.data.staffGradeList - }).catch(res => {}); - }, - async saveSure(teacherForm){ - this.$refs[teacherForm].validate((valid) => { + confirm(){ + this.$refs.form.validate((valid) => { if (valid) { if(this.accountRepeat) return util.warningMsg('该账号已存在') if(this.workNumberRepeat) return util.warningMsg('该工号已存在') - let isTeacher = false - let isManager = false - let data = { - userInfo: { - userId: this.teacherForm.userId, - userName: this.teacherForm.userName, - account: this.teacherForm.userAccount, - clientId: this.teacherForm.clientId, - clientName: this.teacherForm.clientName, - roleId: this.teacherForm.roleValue, - phone: this.teacherForm.phone, - email: this.teacherForm.email, - isPort: 2, - uniqueIdentificationAccount: this.teacherForm.uniqueIdentificationAccount ? this.teacherForm.uniqueIdentificationAccount : Date.parse(new Date()), - } - } - let oneDepartmentName = ''; - for(let i in this.orgList){ - if(this.orgList[i].staffProfessionalArchitectureId == this.teacherForm.major) { - oneDepartmentName = this.orgList[i].staffProfessionalArchitectureName - break; - } - } - let twoDepartmentName = this.departmentList.find((n) => { - return n.staffGradeId == this.teacherForm.department - }).staffGradeName; - data.staff = { - roleId: this.teacherForm.roleValue, - isPort: 2, - schoolId: this.teacherForm.clientId, - staffId: this.teacherForm.staffId, - userId: this.teacherForm.userId, - workNumber: this.teacherForm.workNumber, - staffProfessionalArchitectureId: this.teacherForm.major, - staffGradeId: this.teacherForm.department, - staffProfessionalArchitectureName: oneDepartmentName, - staffGradeName: twoDepartmentName, - }; - if(this.teacherForm.teacherId){ + let data = this.form + if(!data.uniqueIdentification) data.uniqueIdentification = new Date().getTime() + console.log(22,data) + if(this.form.userId){ this.$post(this.api.updateStaff,data).then(res => { - this.teacherVisible = false - util.successMsg('编辑成功'); + this.userVisible = false + util.successMsg('编辑成功') this.getData() - }).catch(res => {}); + }).catch(res => {}) }else{ - this.$post(this.api.addStaff,data).then(res => { - this.teacherVisible = false - util.successMsg('添加成功'); + this.$post(this.api.saveUser,data).then(res => { + this.userVisible = false + util.successMsg('添加成功') this.getData() - }).catch(res => {}); + }).catch(res => {}) } - }else{ - return false; } }) }, - delTeacher(row){ + handleDelete(row){ this.$confirm('此删除操作不可逆,是否确认删除选中项?', '提示', { type: 'warning' - }) - .then(() => { + }).then(() => { let data = { staffIds: row.staffId } this.$del(this.api.deleteStaffs,data).then(res => { util.successMsg('删除成功') this.getData() - }).catch(res => {}); - }) - .catch(() => {}); + }).catch(res => {}) + }).catch(() => {}) }, switchOff(val,row,index) { let data = { @@ -493,24 +432,22 @@ export default { isDisable: val } this.$post(this.api.updateClient,data).then((res) => { - val == 1 ? util.warningMsg('该院校系统使用权限已关闭') : util.successMsg('该院校系统使用权限已激活') + val == 1 ? util.warningMsg('该用户权限已关闭') : util.successMsg('该用户权限已激活') }).catch((res) => { }) }, handleSelectionChange(val) { - this.multipleSelection = val; + this.multipleSelection = val }, delAllSelection() { if(this.multipleSelection.length != ''){ let newArr = this.multipleSelection let delList = newArr.map(item => { - return item.staffId + return item.userId }) - // 批量删除 this.$confirm(`此批量删除操作不可逆,是否确认删除${util.ellipsisStr(newArr[0].userName)}等${newArr.length}个选中项?`, '提示', { type: 'warning' - }) - .then(() => { + }).then(() => { let data = { staffIds: delList.join(',') } @@ -518,8 +455,8 @@ export default { this.$refs.table.clearSelection() util.successMsg('删除成功') this.getData() - }).catch(res => {}); - }).catch(() => {}); + }).catch(res => {}) + }).catch(() => {}) }else{ util.errorMsg('请先选择数据 !') } @@ -544,7 +481,6 @@ export default { showFaild(){ location.href = `${this.api.exportFailureStaff}?token=${this.token}` }, - // 上传文件 handleExceed(files, fileList) { util.warningMsg( `当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!` @@ -590,6 +526,13 @@ export default { }; + \ No newline at end of file diff --git a/src/plugins/requests/index.js b/src/plugins/requests/index.js index decdb78..d9d1fb0 100644 --- a/src/plugins/requests/index.js +++ b/src/plugins/requests/index.js @@ -101,10 +101,10 @@ function get(url, params){ if(res){ resolve(res) }else{ - reject() + reject(res) } }).catch(err => { - reject(err.data) + reject(err) }) }) } diff --git a/src/setting.js b/src/setting.js index 1d355b8..899dac3 100644 --- a/src/setting.js +++ b/src/setting.js @@ -16,7 +16,7 @@ const Setting = { showProgressBar: true, // 接口请求地址 // apiBaseURL: env === 'development' ? 'http://192.168.31.125:8888' : 'http://39.108.250.202:8000', - apiBaseURL: env === 'development' ? 'http://192.168.31.151:10001' : 'http://www.liuwanr.cn', + apiBaseURL: env === 'development' ? 'http://192.168.31.151:9000' : 'http://www.liuwanr.cn', // 接口请求返回错误时,弹窗的持续时间,单位:秒 modalDuration: 3, // 接口请求返回错误时,弹窗的类型,可选值为 Message 或 Notice @@ -39,6 +39,10 @@ const Setting = { * 默认密码 */ initialPassword: '111aaa', + /** + * 所属平台:1->职站 2->数据平台 + */ + platformId: 2, /** * 多语言配置 * */