diff --git a/src/views/user/AddUser.vue b/src/views/user/AddUser.vue index 2a9454d..db27fb4 100644 --- a/src/views/user/AddUser.vue +++ b/src/views/user/AddUser.vue @@ -203,7 +203,7 @@ export default { }) }, show(row) { - this.$router.push(`/info?userId=${row.userId}&workNumber=${row.workNumber}&roleName=${row.roleName}&platformName=${row.platformName}`) + this.$router.push(`/info?userId=${row.userId}&platformName=${row.platformName}`) } } }; diff --git a/src/views/user/Info.vue b/src/views/user/Info.vue index 0d576cb..a475ddd 100644 --- a/src/views/user/Info.vue +++ b/src/views/user/Info.vue @@ -36,18 +36,18 @@
- - + +
- - + +
- - + +
@@ -92,30 +92,30 @@
  • - - + +
  • - - + +
  • - - + +
  • - - + +
  • @@ -166,11 +166,6 @@ export default { value: 2 } ], - countryList: [ - { - label: '中国' - } - ], occupationList: [{ value: 1, label: '学生' @@ -178,8 +173,6 @@ export default { value: 2, label: '老师' }], - provinceList:[], - cityList: [], educationDegreeList: [ { name: '专科', @@ -202,12 +195,6 @@ export default { value: 5 } ], - subjectList: [], //专业学科 - ProfessionalClassList: [], //专业类 - ProfessionalList: [], //专业 - schoolList: [], - curPassword: '', - accountRepeat: false, archivesList: [], showArch: false, @@ -237,10 +224,6 @@ export default { }, mounted() { this.getdata() - this.getProvince() - this.getSchoolData() - this.getSubject() - if (!this.archivesList.length) this.archivesList = [JSON.parse(JSON.stringify(this.archivesForm))] }, methods: { ...mapActions('user', [ @@ -248,456 +231,22 @@ export default { ]), getdata() { this.loading = true - this.$get(this.api.queryUserInfoDetails, { userId: this.userId }).then(({ result }) => { - let userInfo = result.hrUserInfo - this.form = Object.assign(userInfo, result.userAccountList[0]) + this.$get(this.api.personalFile, { userId: this.userId }).then(({ result }) => { + this.form = result const form = this.form - const { workNumber, roleName } = this.$route.query - form.workNumber = workNumber - form.roleName = roleName - this.archivesList = result.personalFileList - this.$nextTick(() => { - if(this.form.provinceId){ - this.getCityData(1) - } - if(this.archivesList.length != 0){ - this.archivesList.forEach((e,k) =>{ - this.$set(e, 'subjectList', this.subjectList) - this.$set(e, 'disciplineId', e.disciplineId ? e.disciplineId : '') - this.$set(e, 'disciplineName', e.disciplineName ? e.disciplineName : '') - this.$set(e, 'professionalClassId', e.professionalClassId ? e.professionalClassId : '') - this.$set(e, 'professionalClassName', e.professionalClassName ? e.professionalClassName : '') - this.$set(e, 'professionalId', e.professionalId ? e.professionalId : '') - this.$set(e, 'professionalName', e.professionalName ? e.professionalName : '') - this.$set(e, 'schoolId', e.schoolId ? e.schoolId : '') - this.$set(e, 'schoolName', e.schoolName ? e.schoolName : '') - - if(e.disciplineId){ - this.$get(this.api.queryCourseProfessionalClass, {disciplineId: e.disciplineId }).then(res => { - this.$set(e, 'ProfessionalClassList', res.list) - }).catch(res => {}) - }else{ - this.$set(e, 'ProfessionalClassList', []) - } - if(e.professionalClassId){ - this.$get(this.api.queryCourseProfessional,{ professionalClassId: e.professionalClassId }).then(res => { - this.$set(e, 'ProfessionalList', res.list) - }).catch(res => {}) - }else{ - this.$set(e, 'ProfessionalList', []) - } - }) - }else{ - this.concatArch() - } - this.loading = false - }) + const list = result.nakadaiPersonalFileList + this.archivesList = list.length ? list : [this.archivesForm] + this.loading = false }).catch(err => { this.loading = false }) }, - getProvince(){ - this.$get(this.api.queryProvince).then(res => { - this.provinceList = res.list - }).catch(res => {}) - }, - getCity(id,type){ - this.form.cityId = 1 - this.getCityData() - }, - getCityData(index){ - let provinceId = this.form.provinceId - this.$get(this.api.queryCity,{provinceId}).then(res => { - this.cityList = res.list - }).catch(res => {}) - }, - getCityName(id,index){ - this.archivesList[index].cityName = this.archivesList[index].cityList[id-1].cityName - }, - getSchoolName(id,index){ - const school = this.schoolList.find(e => e.schoolId == id) - if (school) this.archivesList[index].schoolName = school.schoolName - }, - getSchoolData(){ - this.$get(this.api.querySchoolData,{schoolName: '',provinceId: this.provinceId,cityId: this.cityId}).then(res => { - this.schoolList = res.list - }).catch(res => {}) - }, - accountChange(){ - this.$get(`${this.api.getAccount}?account=${this.form.account}`).then(res => { - if(res.data.userInfo){ - this.accountRepeat = true - util.warningMsg('该账号已存在') - }else{ - this.accountRepeat = false - } - }).catch(res => {}) - }, - save() { - if (this.form.idNumber && !/(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)/.test(this.form.idNumber)) return util.warningMsg("请输入正确的身份证号码"); - let form = this.form; - let personalFileList = [] - this.archivesList.forEach((n,k) => { - n.personalCareerId && personalFileList.push({ - disciplineId: n.disciplineId, - disciplineName: n.disciplineName, - personalCareerId: n.personalCareerId, - personalFileId: n.personalFileId, - professionalClassId: n.professionalClassId, - professionalClassName: n.professionalClassName, - professionalId: n.professionalId, - professionalName: n.professionalName, - provinceId: n.provinceId, - provinceName: n.provinceName, - schoolId: n.schoolId, - schoolName: n.schoolName, - userId: form.userId - }) - }) - let data = { - userId: form.userId, - userAccountList: [{ - id: form.accountId, - account: form.account, - userId: form.userId, - }], - hrUserInfo: { - provinceId: form.provinceId, - cityId: form.cityId, - countries: form.countries, - dateBirth: form.dateBirth, - educationDegree: form.educationDegree, - idNumber: form.idNumber, - schoolId: form.schoolId, - sex: form.sex, - userId: form.userId, - userName: form.userName, - wechatId: form.wechatId - }, - personalFileList, - } - this.$post(this.api.updatePersonCenter,data).then(res => { - this.setUserName(form.userName); - this.$emit('updateStatus',false) - this.$message.success('提交成功!') - }).catch(res => {}) - }, - - concatArch() { - this.archivesList = this.archivesList.concat({ - countries: '中国', - personalCareerId: '', - schoolId: '', - schoolName: '', - subjectList: this.subjectList, - disciplineId: '', - disciplineName: '', - ProfessionalClassList: [], - professionalClassId: '', - professionalClassName: '', - ProfessionalList: [], - professionalId: '', - professionalName: '', - personalFileId: '' - }) - }, - addArch() { - let isEmpty = false - this.archivesList.forEach((n,k) => { - if(!n.personalCareerId) isEmpty = true - }) - if(isEmpty) return util.warningMsg('请选择职业') - this.showArch = true - this.concatArch() - }, - delArchive(i) { - this.$confirm(`此操作不可逆,是否确认删除?`, '提示', { - type: 'warning' - }).then(() => { - const id = this.archivesList[i].personalFileId - this.archivesList.splice(i, 1) - id && this.$post(`${this.api.deleteProfile}?personalFileIds=${id}`).then(res => {}).catch(err => {}) - }).catch(() => {}) - }, - bindEmail() { - this.email = this.form.email - this.emailVisible = true - }, - bindPhone() { - this.phoneVisible = true - }, - bindPassword() { - this.passwordVisible = true - }, - editPassword() { - if(!this.passwordForm.password) return util.warningMsg('请输入原密码') - if(!this.passwordForm.newPassword) return util.warningMsg('请输入新密码') - if(!this.passwordForm.reNewPassword) return util.warningMsg('请确认新密码') - if(this.passwordForm.newPassword.length < 6 || this.passwordForm.reNewPassword.length < 6) return util.warningMsg('请输入6位数以上的密码') - if(this.passwordForm.newPassword !== this.passwordForm.reNewPassword) return util.warningMsg('输入的新密码不一致,请重新确认') - if(this.passwordForm.password === this.passwordForm.newPassword) return util.warningMsg('原密码跟新密码不能一致') - - let data = this.passwordForm - data.accountId = this.form.id - this.$post(this.api.examinePassword,data).then(res => { - util.successMsg('更换成功') - this.passwordVisible = false - }).catch(err => {}) - }, - closePassword() { - this.passwordForm = { - password: '', - newPassword: '', - reNewPassword: '' - } - }, foldArch() { this.showArch = !this.showArch this.$nextTick(() => { document.body.scrollTop = document.querySelector('.content-box').scrollHeight document.documentElement.scrollTop = document.querySelector('.content-box').scrollHeight }) - }, - // 获取学科类别 - getSubject(){ - this.$get(this.api.queryCourseDiscipline).then(res => { - this.subjectList = res.list - }).catch(res => {}) - }, - // 清除学科类别 - clearClass(){ - this.archivesForm.professionalClassId = '', - this.archivesForm.professionalId = '' - }, - // 获取专业类 - getProfessionalClass(val){ - this.clearClass() - if(val){ - let obj = {} - obj = this.subjectList.find((item)=>{ - return item.disciplineId === val - }); - this.archivesForm.disciplineName = obj.disciplineName - this.getProfessionalClassData(val) - } - }, - clearItemClass(index){ - this.archivesList[index].professionalClassId = '' - this.archivesList[index].professionalClassName = '' - this.archivesList[index].professionalId = '' - this.archivesList[index].professionalName = '' - }, - getItemProfessionalClass(item,index){ - this.clearItemClass(index) - if(item){ - let obj = {} - obj = this.subjectList.find(r =>{ - return r.disciplineId === item - }); - this.$get(this.api.queryCourseProfessionalClass, { disciplineId: item }).then(res => { - this.archivesList.map(e =>{ - if(e.disciplineId == item){ - e.ProfessionalClassList = res.list - e.disciplineName = obj.disciplineName - } - }) - }).catch(res => {}) - } - }, - getProfessionalClassData(value){ - this.$get(this.api.queryCourseProfessionalClass, { - disciplineId: value - }).then(res => { - this.ProfessionalClassList = res.list - }).catch(res => {}) - }, - // 清除专业类 - clearProfess(){ - this.archivesForm.professionalId = '' - }, - // 获取专业 - getProfessional(val){ - this.clearProfess() - if(val){ - let obj = {} - obj = this.ProfessionalClassList.find((item)=>{ - return item.professionalClassId === val - }) - this.archivesForm.professionalClassName = obj.professionalClassName - this.getProfessionalData(val) - } - }, - clearItemProfess(index){ - this.archivesList[index].professionalId = '' - this.archivesList[index].professionalName = '' - }, - getItemProfessional(item,index){ - this.clearItemProfess(index) - if(item){ - this.$get(this.api.queryCourseProfessional,{ professionalClassId: item }).then(res => { - this.archivesList.map(e =>{ - if(e.professionalClassId == item){ - let obj = {} - obj = e.ProfessionalClassList.find(r =>{ - return r.professionalClassId === item - }) - e.ProfessionalList = res.list - e.professionalClassName = obj.professionalClassName - } - }) - }).catch(res => {}) - } - }, - getProfessionalData(value){ - this.$get(this.api.queryCourseProfessional,{professionalClassId: value}).then(res => { - this.ProfessionalList = res.list - }).catch(res => {}) - }, - // 获取专业名称 - getStuGrade(val){ - if(val){ - let obj = {} - obj = this.ProfessionalList.find(r =>{ - return r.professionalId === val; - }) - this.archivesForm.professionalName = obj.professionalName - } - }, - getItemStuGrade(item){ - if(item){ - this.archivesList.map(e =>{ - if(e.professionalId == item){ - let obj = {} - obj = e.ProfessionalList.find(r =>{ - return r.professionalId === item; - }) - e.professionalName = obj.professionalName - } - }) - } - }, - emailCountdown(){ - let count = 60 - if(!this.emailTimer){ - this.emailDisabled = true - this.emailTimer = setInterval(() => { - console.log('倒计时中') - if(count > 0){ - count-- - this.emailBtnText = `${count}秒后重试` - }else{ - this.emailDisabled = false - clearInterval(this.emailTimer) - this.emailTimer = null - this.emailBtnText = `发送验证码` - } - },1000) - } - }, - phoneCountdown(){ - let count = 60 - if(!this.phoneTimer){ - this.phoneDisabled = true - this.phoneTimer = setInterval(() => { - console.log('倒计时中') - if(count > 0){ - count-- - this.phoneBtnText = `${count}秒后重试` - }else{ - this.phoneDisabled = false - clearInterval(this.phoneTimer) - this.phoneTimer = null - this.phoneBtnText = `发送验证码` - } - },1000) - } - }, - closeEmail(){ - this.emailCode = '' - }, - sendEmailCode(){ - if(!this.email) return util.warningMsg('请输入邮箱') - if(!/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(this.email)) return util.warningMsg('请输入正确的邮箱') - let data = { - userId: this.form.userId, - email: this.email, - types: 1 - } - this.$post(this.api.sendPhoneOrEmailCode,data).then(res => { - if(res.message.opener){ - this.emailCountdown() - this.emailOpener = res.message.opener - }else{ - util.errorMsg(res.message) - } - }).catch(res => {}) - }, - emailSubmit(){ - if(!this.email) return util.warningMsg('请输入邮箱') - if(!/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(this.email)) return util.warningMsg('请输入正确的邮箱') - if(!this.emailCode) return util.warningMsg('请输入验证码') - let data = { - userId: this.form.userId, - email: this.email, - types: 1, - code: this.emailCode, - opener: this.emailOpener - } - this.$post(this.api.bindPhoneOrEmail,data).then(res => { - util.successMsg('绑定成功') - this.form.email = this.email - this.emailVisible = false - }).catch(res => {}) - }, - closePhone(){ - this.phoneCode = '' - }, - sendPhoneCode(){ - if(!this.phone) return util.warningMsg('请输入手机号') - if(!/^1[3456789]\d{9}$/.test(this.phone)) return util.warningMsg('请输入正确的手机号') - let data = { - userId: this.form.userId, - phone: this.phone, - types: 2 - } - this.$post(this.api.sendPhoneOrEmailCode,data).then(res => { - if(res.message.opener){ - this.phoneCountdown() - this.phoneOpener = res.message.opener - }else{ - util.errorMsg(res.message) - } - - }).catch(res => {}) - }, - phoneSubmit(){ - if(!this.phone) return util.warningMsg('请输入手机号') - if(!/^1[3456789]\d{9}$/.test(this.phone)) return util.warningMsg('请输入正确的手机号') - if(!this.phoneCode) return util.warningMsg('请输入验证码') - let data = { - userId: this.form.userId, - phone: this.phone, - types: 2, - code: this.phoneCode, - opener: this.phoneOpener - } - this.$post(this.api.bindPhoneOrEmail,data).then(res => { - util.successMsg('绑定成功') - this.form.phone = this.phone - this.phoneVisible = false - }).catch(res => {}) - }, - openAccount() { - this.account = this.form.account - this.accountVisible = true - }, - confirmAccount() { - if (this.account) { - this.form.account = this.account - this.accountVisible = false - } else { - util.errorMsg('请输入账号') - } } } }; diff --git a/src/views/user/User.vue b/src/views/user/User.vue index 940f3c6..10595fa 100644 --- a/src/views/user/User.vue +++ b/src/views/user/User.vue @@ -211,7 +211,7 @@ export default { ], page: 1, pageSize: 10, - totals: 1, + totals: 0, multipleSelection: [], loading: false };