个人中心等修复

dev_2022-03-03
yujialong 3 years ago
parent b0d076fadc
commit afd772052d
  1. BIN
      src/assets/img/info1.png
  2. BIN
      src/assets/img/info2.png
  3. BIN
      src/assets/img/info3.png
  4. BIN
      src/assets/img/trash.png
  5. 2
      src/router/index.js
  6. 3
      src/utils/api.js
  7. 38
      src/views/serve/projectAdd.vue
  8. 1
      src/views/serve/projectList.vue
  9. 123
      src/views/setting/index.vue
  10. 943
      src/views/setting/info.vue
  11. 67
      src/views/system/staff.vue

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

@ -129,7 +129,7 @@ let router = new Router({
},
{
path: '/person',
component: () => import('../views/setting/Person.vue'),
component: () => import('../views/setting'),
// meta: { title: '个人中心' }
},
{

@ -1,7 +1,7 @@
import Setting from "@/setting";
const uploadURL = Setting.uploadURL
const host1 = 'http://192.168.31.137:9000/'
const host1 = 'http://39.108.250.202:9000/'
export default {
@ -92,6 +92,7 @@ export default {
queryProjectManage: `occupationlab/projectManage/queryProjectManage`, // 项目管理列表(分页、筛选)
updateIsOpen: `occupationlab/projectManage/updateIsOpen`, // 更新开启状态
getProjectDetail: `occupationlab/projectManage/getProjectDetail`, // 根据项目id查询详情
saveProjectDraft: `occupationlab/projectManage/saveProjectDraft`, // 新增项目管理
addProjectManage: `occupationlab/projectManage/addProjectManage`, // 新增项目管理
updateProjectManage: `occupationlab/projectManage/updateProjectManage`, // 修改项目管理
copyProjectManage: `occupationlab/projectManage/copyProjectManage`, // 复制项目管理

@ -257,6 +257,7 @@ export default {
selectedJudgment: [], //
rowKey: "", // Key
projectNameRepeat: false, //
originName: '',
flag: false, //
avgValuelist: [], //
@ -365,18 +366,17 @@ export default {
}
},
projectNameExistis() { //
if (this.projectManage.projectName) {
this.$post(this.api.queryNameIsExist, { projectName: this.projectManage.projectName }).then(res => {
if (res.status === 200) {
this.projectNameRepeat = false;
const { projectName } = this.projectManage
if (this.originName === projectName) {
this.projectNameRepeat = false
} else {
this.projectNameRepeat = true;
this.$post(this.api.queryNameIsExist, { projectName }).then(res => {
if (res.status === 200) {
this.projectNameRepeat = false
}
}).catch(err => {
this.projectNameRepeat = true;
});
} else {
this.projectNameRepeat = false;
this.projectNameRepeat = true
})
}
},
systemChange() { //
@ -392,6 +392,10 @@ export default {
});
}
},
//
removeTag(val) {
return val.replace('<p><br></p>', '')
},
judgmentRelease(state) { //
let {
projectName,
@ -409,14 +413,11 @@ export default {
return false;
}
if (state) {
let reg = /<\/?.+?\/?>/g
let experimentTargets = experimentTarget.replace(reg, '')
if (!experimentTargets) {
if (!experimentTarget || !this.removeTag(experimentTarget)) {
this.$message.warning("请输入实验目标");
return false;
}
let experimentDescriptions = experimentDescription.replace(reg, '')
if (!experimentDescriptions) {
if (!experimentDescription || !this.removeTag(experimentDescription)) {
this.$message.warning("请输入案例描述");
return false;
}
@ -432,8 +433,7 @@ export default {
this.$message.warning("判分点分数已超过100");
return false;
}
let experimentHints = experimentHint.replace(reg, '')
if (!experimentHints && hintOpen == 0) {
if ((!experimentHint || !this.removeTag(experimentHint)) && hintOpen == 0) {
this.$message.warning("请输入实验提示");
return false;
}
@ -497,7 +497,7 @@ export default {
});
},
addProject(params) { //
this.$post(`${this.api.addProjectManage}`, params).then(res => {
this.$post(this.api[params.projectManage.state ? 'addProjectManage' : 'saveProjectDraft'], params).then(res => {
if (res.status === 200) {
this.$message.success("添加实验项目成功");
this.$router.back();
@ -609,7 +609,7 @@ export default {
this.judgementData = result;
}
}).catch(err => {
console.log(err);
this.visibleLoading = false
});
},
getProgrammingClassData(params) { //
@ -626,7 +626,7 @@ export default {
this.judgementData = result;
}
}).catch(err => {
console.log(err);
this.visibleLoading = false
});
},
handleSelectionJudgment(val) { //

@ -97,6 +97,7 @@
</el-button>
<el-button type="text" @click="copyData(scope.row.projectId)">复制</el-button>
<el-switch
v-if="scope.row.state"
v-model="scope.row.ztOpen"
:active-text="scope.row.ztOpen ? '关闭' : '启用'"
:active-value="0"

@ -0,0 +1,123 @@
<template>
<div class="wrap">
<div class="left">
<div class="inner">
<div class="text-center">
<img :src="$store.state.avatar" class="avatar" />
<el-upload :headers="{token}" :action="this.api.updateUserAvatars" name="file" :limit="10" :show-file-list="false" :on-success="changeAvatar">
<el-button type="text" size="small">点击更换头像</el-button>
</el-upload>
</div>
<ul class="menu">
<li v-for="item in typeList" :key="item.index" :class="{active: item.index == active}">
{{ item.title }}
</li>
</ul>
</div>
</div>
<div class="right">
<info ref="info" @updateStatus="updateStatus"></info>
</div>
</div>
</template>
<script>
import Setting from '@/setting'
import { mapState,mapActions } from 'vuex'
import info from './info'
import util from '@/libs/util'
export default {
data() {
return {
token: util.local.get(Setting.tokenKey),
typeList: [
{
index: '1',
title: '用户信息'
}
],
active: '1',
edited: false
};
},
components: { info },
computed: {
...mapState('user', [
'avatar'
]),
},
// ,
beforeRouteLeave(to, from, next) {
if(this.edited){
this.$confirm(`您所更改的内容未更新,是否更新?`, '提示', {
type: 'warning'
}).then(() => {
this.$refs.info.save()
next(false)
}).catch(() => {
next(false)
})
}else{
next()
}
},
mounted() {
},
methods: {
...mapActions('user', [
'setAvatar'
]),
changeAvatar(res) {
this.setAvatar(res.message)
},
updateStatus(status){
this.edited = status
}
}
};
</script>
<style lang="scss" scoped>
.wrap{
display: flex;
width: 1280px;
margin: 0 auto;
background-color: #f3f6fa;
.text-center {
text-align: center;
}
.left{
margin-right: 12px;
background-color: #fff;
box-shadow: 2px 0px 6px 0px #EEEEEE;
.inner{
width: 170px;
padding: 20px 0;
}
.avatar{
width: 80px;
height: 80px;
border-radius: 50%;
}
.menu{
margin-top: 32px;
li{
padding: 0 20px;
color: #303133;
font-size: 14px;
line-height: 38px;
cursor: pointer;
&.active{
color: #fff;
background-color: #9278ff;
}
}
}
}
.right{
flex: 1;
}
}
</style>

@ -0,0 +1,943 @@
<template>
<div>
<div class="scroll">
<div class="page">
<h6 class="l-title"><img src="@/assets/img/info1.png" alt=""> 基本信息</h6>
<div class="page-content">
<ul class="list">
<div class="line info">
<li>
<label>姓名</label>
<el-input size="small" v-model="form.userName" clearable></el-input>
</li>
<li>
<label>所在国家</label>
<el-select size="small" v-model="form.countries">
<el-option v-for="item in countryList" :key="item.value" :label="item.label" :value="item.label"></el-option>
</el-select>
</li>
</div>
<div class="line info">
<li>
<label>性别</label>
<el-select size="small" v-model="form.sex">
<el-option v-for="item in sexList" :key="item.value" :label="item.name" :value="item.value"></el-option>
</el-select>
</li>
<li class="selects">
<label>所在地</label>
<div class="mul">
<div class="child">
<el-select size="small" v-model="form.countries" placeholder>
<el-option v-for="item in countryList" :key="item.value" :label="item.label" :value="item.label"></el-option>
</el-select>
</div>
<div class="child">
<el-select size="small" v-model="form.provinceId" placeholder @change="id => getCity(id,1)">
<el-option v-for="item in provinceList" :key="item.provinceId" :label="item.provinceName" :value="item.provinceId"></el-option>
</el-select>
</div>
<div class="child">
<el-select size="small" v-model="form.cityId" placeholder :disabled="form.provinceId ? false : true">
<el-option v-for="item in cityList" :key="item.cityId" :label="item.cityName" :value="item.cityId"></el-option>
</el-select>
</div>
</div>
</li>
</div>
<div class="line info">
<li>
<label>出生年月</label>
<el-date-picker size="small" placeholder="请选择时间" v-model="form.dateBirth" :clearable="false" type="date" format="yyyy-MM-dd" value-format="yyyy-MM-dd"></el-date-picker>
</li>
<li>
<label>身份证</label>
<el-input size="small" placeholder="请输入身份证" v-model="form.idNumber" clearable></el-input>
</li>
</div>
<div class="line info">
<li>
<label>教育程度</label>
<el-select size="small" v-model="form.educationDegree" placeholder="请选择教育程度">
<el-option v-for="(item,index) in educationDegreeList" :key="index" :label="item.name" :value="item.value"></el-option>
</el-select>
</li>
</div>
</ul>
</div>
<div class="flex j-between a-center" style="width: 862px">
<h6 class="l-title"><img src="@/assets/img/info2.png" alt=""> 个人档案</h6>
<el-button type="text" icon="el-icon-plus" style="margin-left: 16px" @click="addArch">新增</el-button>
</div>
<div class="page-content">
<div class="archives" v-for="(archive,index) in archivesList" :key="index" v-show="index == 0 || showArch">
<ul class="list">
<div class="line">
<li>
<label>职业</label>
<el-select size="small" v-model="archive.personalCareerId" placeholder="选择职业">
<el-option v-for="item in occupationList" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</li>
<li>
<label>所在国家</label>
<el-select size="small" v-model="form.countries" placeholder>
<el-option v-for="item in countryList" :key="item.value" :label="item.label" :value="item.label" ></el-option>
</el-select>
</li>
</div>
<div class="line">
<li>
<label>学校名称</label>
<el-select size="small" v-model="archive.schoolId" filterable placeholder="选择学校" @change="id => getSchoolName(id,index)">
<el-option v-for="item in schoolList" :key="item.value" :label="item.schoolName" :value="item.schoolId"></el-option>
</el-select>
</li>
<li>
<label>专业学科</label>
<el-select size="small" v-model="archive.disciplineId" placeholder="选择专业学科" @change="id => getItemProfessionalClass(id,index)" @clear="() => clearItemClass(index)">
<el-option v-for="item in subjectList" :key="item.value" :label="item.disciplineName" :value="item.disciplineId"></el-option>
</el-select>
</li>
</div>
<div class="line" style="margin-bottom: 0">
<li>
<label>专业类</label>
<el-select size="small" v-model="archive.professionalClassId" placeholder="选择专业类" :disabled="archive.disciplineId ? false : true" @change="id => getItemProfessional(id,index)" @clear="() => clearItemProfess(index)">
<el-option v-for="item in archive.ProfessionalClassList" :key="item.professionalClassId" :label="item.professionalClassName" :value="item.professionalClassId"></el-option>
</el-select>
</li>
<li>
<label>专业</label>
<el-select size="small" v-model="archive.professionalId" placeholder="选择专业" :disabled="archive.professionalClassId ? false : true" @change="getItemStuGrade">
<el-option v-for="item in archive.ProfessionalList" :key="item.professionalId" :label="item.professionalName" :value="item.professionalId"></el-option>
</el-select>
</li>
</div>
</ul>
<img class="del" src="@/assets/img/trash.png" alt="" v-if="index" @click="delArchive(index)">
</div>
<div class="fold" v-if="archivesList.length > 1">
<span :class="{active: showArch}" @click="showArch = !showArch">
展开更多
<i class="el-icon-arrow-down"></i>
</span>
</div>
</div>
</div>
<div class="page">
<h6 class="l-title"><img src="@/assets/img/info3.png" alt=""> 账号信息</h6>
<div class="page-content">
<ul class="list">
<div class="line info imp">
<li>
<label>用户账号</label>
<el-input class="m-r-10" size="small" v-model="form.account" clearable disabled></el-input>
<el-button type="text" size="small" @click="openAccount">编辑</el-button>
</li>
<li>
<label>手机号</label>
<el-input class="m-r-10" type="text" size="small" v-model="form.phone" disabled></el-input>
<el-button type="text" size="small" @click="bindPhone">更换</el-button>
</li>
</div>
<div class="line info imp">
<li>
<label>邮箱</label>
<el-input class="m-r-10" size="small" v-model="form.email" disabled></el-input>
<el-button v-if="form.email" type="text" size="small" @click="bindEmail">更换</el-button>
<el-button v-else type="text" size="small" @click="bindEmail">添加</el-button>
</li>
<li>
<label>密码</label>
<el-input class="m-r-10" size="small" value="xxxxxxxx" disabled></el-input>
<el-button type="text" size="small" @click="bindPassword">更换</el-button>
</li>
</div>
</ul>
</div>
</div>
</div>
<div class="btns">
<el-button size="small" v-throttle @click="$router.back()">取消</el-button>
<el-button type="primary" size="small" v-throttle @click="save">更新</el-button>
</div>
<el-dialog :title="form.email ? '更换邮箱' : '绑定邮箱'" :visible.sync="emailVisible" :close-on-click-modal="false" @close="closeEmail" width="30%">
<el-form ref="form" :model="form" label-width="60px">
<el-form-item label="邮箱">
<el-input style="width: 394px;" placeholder="请输入邮箱" v-model="email"></el-input>
</el-form-item>
<el-form-item label="验证码">
<div class="flex">
<el-input v-model="emailCode" placeholder="请输入验证码" maxlength="6"></el-input>
<el-button style="margin-left: 10px" type="text" @click="sendEmailCode" :disabled="emailDisabled">{{emailBtnText}}</el-button>
</div>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="emailVisible = false"> </el-button>
<el-button size="small" type="primary" @click="emailSubmit"> </el-button>
</span>
</el-dialog>
<el-dialog :title="form.phone ? '更换手机号' : '绑定手机号'" :visible.sync="phoneVisible" :close-on-click-modal="false" @close="closePhone" width="30%">
<el-form ref="form" :model="form" label-width="60px">
<el-form-item label="手机号">
<el-input style="width: 394px;" placeholder="请输入手机号" v-model="phone" maxlength="11"></el-input>
</el-form-item>
<el-form-item label="验证码">
<div class="flex">
<el-input v-model="phoneCode" placeholder="请输入验证码" maxlength="6"></el-input>
<el-button style="margin-left: 10px" type="text" @click="sendPhoneCode" :disabled="phoneDisabled">{{phoneBtnText}}</el-button>
</div>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="phoneVisible = false"> </el-button>
<el-button size="small" type="primary" @click="phoneSubmit"> </el-button>
</span>
</el-dialog>
<el-dialog title="更换密码" :visible.sync="passwordVisible" :close-on-click-modal="false" @close="closePassword" width="30%">
<el-form ref="passwordForm" :model="form" label-width="82px">
<el-form-item label="原密码">
<el-input type="password" v-model="passwordForm.password" placeholder="请输入原密码"></el-input>
</el-form-item>
<el-form-item label="新密码">
<el-input type="password" v-model="passwordForm.newPassword" placeholder="请输入新密码" @keyup.enter.native="editPassword"></el-input>
</el-form-item>
<el-form-item label="确认新密码">
<el-input type="password" v-model="passwordForm.reNewPassword" placeholder="请确认新密码" @keyup.enter.native="editPassword"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="passwordVisible = false"> </el-button>
<el-button size="small" type="primary" @click="editPassword"> </el-button>
</span>
</el-dialog>
<el-dialog title="修改用户账号" :visible.sync="accountVisible" :close-on-click-modal="false" width="30%">
<el-form label-width="82px">
<el-form-item label="用户账号">
<el-input v-model="account" placeholder="请输入用户账号"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="accountVisible = false"> </el-button>
<el-button size="small" type="primary" @click="confirmAccount"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { mapState,mapActions } from 'vuex'
import util from '@/libs/util'
export default {
data() {
return {
form: {
name:'',
workNumber:'',
password:"",
phone:'',
email:'',
provinceName:'',
cityName:'',
schoolName:'',
professionalName:'',
experimentName:'',
sex: 1,
dateBirth: '',
educationDegree: ''
},
emailVisible: false,
passwordVisible: false,
phoneVisible: false,
showArch: false,
passwordForm: {
password: '',
newPassword: '',
reNewPassword: ''
},
sexList: [
{
name: '男',
value: 1
},
{
name: '女',
value: 2
}
],
countryList: [
{
label: '中国'
}
],
occupationList: [{
value: 1,
label: '学生'
},{
value: 2,
label: '老师'
}],
provinceList:[],
cityList: [],
educationDegreeList: [
{
name: '专科',
value: 1
},
{
name: '本科',
value: 2
},
{
name: '硕士',
value: 3
},
{
name: '博士',
value: 4
},
{
name: '其他',
value: 5
}
],
subjectList: [], //
ProfessionalClassList: [], //
ProfessionalList: [], //
schoolList: [],
curPassword: '',
accountRepeat: false,
archivesList: [],
archivesForm: {
personalCareerId: '',
schoolId: '',
schoolName: '',
professionalClassId: '',
professionalClassName: '',
disciplineId: '',
disciplineName: '',
professionalId: '',
professionalName: '',
},
email: '',
emailBtnText: '发送验证码',
emailCode: '',
emailDisabled: false,
emailTimer: null,
phone: '',
phoneBtnText: '发送验证码',
phoneCode: '',
phoneDisabled: false,
phoneTimer: null,
updateTime: 0,
account: '',
accountVisible: false
};
},
watch: {
// ,
form: {
handler(){
this.updateTime++
if(this.updateTime > 1) this.$emit('updateStatus',this.updateTime > 1)
},
deep:true
}
},
mounted() {
this.getdata()
this.getProvince()
this.getSchoolData()
this.getSubject()
if (!this.archivesList.length) this.archivesList = [JSON.parse(JSON.stringify(this.archivesForm))]
},
methods: {
...mapActions('user', [
'setAvatar','setUserName'
]),
getdata() {
this.$get(this.api.queryUserInfoDetails).then(res => {
let userInfo = res.result.hrUserInfo
let schoolId = userInfo.schoolId
this.form = Object.assign(userInfo, res.result.userAccountList[0])
this.form.schoolId = schoolId
this.form.accountId = userInfo.id
this.originAccount = this.form.account
this.archivesList = res.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()
}
})
}).catch(err => {})
},
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('请输入账号')
}
}
}
};
</script>
<style lang="scss" scoped>
.m-r-10 {
margin-right: 10px;
}
.l-title{
display: flex;
align-items: center;
margin-bottom: 12px;
font-size: 14px;
color: #333;
img{
margin-right: 5px;
}
}
.scroll{
max-height: calc(100vh - 218px);
overflow: auto;
}
.page{
margin-bottom: 12px;
/deep/.el-input__inner{
border-color: #CACFDB;
}
.list{
.line{
display: flex;
margin-bottom: 24px;
&.info li:not(.selects){
.el-input{
flex: 1;
}
}
&.imp li{
&:nth-child(odd) {
width: 360px;
margin-right: 64px;
}
}
}
.el-input, .el-select{
width: 220px;
.el-input__inner{
border-color: #CACFDB;
}
}
li{
display: inline-flex;
align-items: center;
&>label{
width: 100px;
margin-right: 5px;
text-align: right;
font-size: 14px;
color: #4c4c4c;
}
.el-select {
flex: 1;
}
.el-select .el-input.is-disabled .el-input__inner{
border-color: #ddd;
}
.val{
margin-right: 15px;
color: #606266;
font-size: 14px;
}
.mul{
display: inline-flex;
.child{
display: inline-flex;
width: 132px;
margin-right: 10px;
&>span{
margin-bottom: 5px;
font-size: 14px;
color: #575757;
}
}
}
&:nth-child(odd) {
width: 325px;
margin-right: 100px;
}
}
}
.archives{
position: relative;
width: 862px;
padding: 16px 0;
margin-bottom: 6px;
border-radius: 4px;
background-color: #FAFAFA;
.del{
position: absolute;
top: 80px;
right: 19px;
cursor: pointer;
}
}
.fold{
margin-top: 20px;
text-align: center;
font-size: 12px;
color: #006EFF;
span{
cursor: pointer;
i{
transition: .5s;
}
&.active i{
transform: rotate(180deg);
}
}
}
}
.btns{
width: 100%;
padding: 12px 0;
text-align: center;
background-color: #fff;
box-shadow: 0px 0px 10px 0px rgba(188, 201, 218, 0.4);
.el-button{
width: 80px;
}
}
</style>

@ -35,16 +35,19 @@
<span class="org-name">{{ node.label }}</span>
<span>
<el-button
v-auth="'/system:后台账号:新增部门'"
type="text"
icon="el-icon-circle-plus-outline"
@click="() => addOrg(node, data)">
</el-button>
<el-button
v-auth="'/system:后台账号:编辑部门'"
type="text"
icon="el-icon-edit-outline"
@click="() => editOrg(node, data)">
</el-button>
<el-button
v-auth="'/system:后台账号:删除部门'"
type="text"
icon="el-icon-delete"
@click="() => delOrg(node, data)">
@ -94,8 +97,8 @@
</li>
</ul>
<div>
<el-button type="primary" @click="addStaff">新增员工</el-button>
<el-button type="primary" @click="batchImport">批量导入</el-button>
<el-button type="primary" @click="addStaff" v-auth="'/system:后台账号:新增员工'">新增员工</el-button>
<el-button type="primary" @click="batchImport" v-auth="'/system:后台账号:批量导入'">批量导入</el-button>
</div>
</div>
@ -105,14 +108,14 @@
<el-table-column prop="userName" label="员工姓名" align="center" min-width="100"></el-table-column>
<el-table-column prop="account" label="账号" align="center" min-width="100"></el-table-column>
<el-table-column prop="phone" label="手机号" align="center" width="120"></el-table-column>
<el-table-column prop="staffArchitectureName" label="所在部门" align="center" min-width="100"></el-table-column>
<el-table-column prop="roleName" label="授权角色" align="center" width="100"></el-table-column>
<el-table-column prop="staffArchitectureName" label="所在部门" align="center" min-width="200" show-overflow-tooltip></el-table-column>
<el-table-column prop="roleName" label="授权角色" align="center" min-width="200" show-overflow-tooltip></el-table-column>
<el-table-column label="操作" align="center" width="300">
<template slot-scope="scope">
<el-button type="text" @click="queryStaff(scope.row,true)">查看</el-button>
<el-button type="text" @click="queryStaff(scope.row,false)">编辑</el-button>
<el-button type="text" @click="resetPassword(scope.row)">重置密码</el-button>
<el-button type="text" @click="delStaff(scope.row)">删除</el-button>
<el-button type="text" v-auth="'/system:后台账号:查看'" @click="queryStaff(scope.row,true)">查看</el-button>
<el-button type="text" v-auth="'/system:后台账号:编辑'" @click="queryStaff(scope.row,false)">编辑</el-button>
<el-button type="text" v-auth="'/system:后台账号:重置密码'" @click="resetPassword(scope.row)">重置密码</el-button>
<el-button type="text" v-auth="'/system:后台账号:删除'" @click="delStaff(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
@ -168,9 +171,10 @@
<el-dialog title="批量导入" :visible.sync="importVisible" width="24%" :close-on-click-modal="false">
<div style="text-align: center">
<div style="margin-bottom: 10px;">
<el-button type="primary" @click="downLoad">模板下载<i class="el-icon-download el-icon--right"></i></el-button>
<el-button type="primary" @click="download">模板下载<i class="el-icon-download el-icon--right"></i></el-button>
</div>
<el-upload
ref="importStaff"
name="file"
accept=".xls,.xlsx"
:on-remove="handleRemove"
@ -182,6 +186,7 @@
:action="this.api.importStaff"
:file-list="uploadList"
:headers="headers"
:auto-upload="false"
>
<el-button type="primary" class="ml20">上传文件<i class="el-icon-upload2 el-icon--right"></i></el-button>
</el-upload>
@ -383,7 +388,8 @@ export default {
},
//
changeType() {
this.initData(true)
this.$refs.orgTree.setCurrentKey(null)
this.initData()
},
//
addOrg(node, data) {
@ -479,11 +485,10 @@ export default {
this.getOrg()
},
//
getStaff(fromType) {
const orgId = this.$refs.orgTree.getCurrentKey() || ''
getStaff() {
this.$post(this.api.staffList, {
type: this.studentType || 1,
staffArchitectureId: fromType ? '' : orgId,
staffArchitectureId: this.$refs.orgTree.getCurrentKey() || '',
keyWord: this.keyWord,
pageNum: this.page,
pageSize: this.pageSize
@ -500,10 +505,10 @@ export default {
handleSelectionChange(val) { //
this.multipleSelection = val
},
initData(fromType) {
initData() {
this.$refs.table.clearSelection()
this.page = 1
this.getStaff(fromType)
this.getStaff()
},
//
delStaff(row) {
@ -518,8 +523,9 @@ export default {
},
//
resetPassword(row) {
this.$confirm(`重置后的密码为:${Setting.initialPassword},确定重置?`, "提示", { type: "warning" }).then(() => {
this.$get(`${this.api.resetPassword}?userId=${row.userId}&newPwd=111aaa`).then(res => {
const newPwd = Setting.initialPassword
this.$confirm(`重置后的密码为:${newPwd},确定重置?`, "提示", { type: "warning" }).then(() => {
this.$get(`${this.api.resetPwd}?userId=${row.userId}&newPwd=${newPwd}`).then(res => {
util.successMsg("重置成功")
}).catch(res => {})
}).catch(() => {})
@ -626,7 +632,6 @@ export default {
submitStaff() {
this.$refs.form.validate((valid) => {
if (valid) {
debugger
if (this.submiting) return false
if (this.accountReapeat) return util.warningMsg("该账号已存在")
if (this.workNumberReapeat) return util.warningMsg("该工号已存在")
@ -635,7 +640,7 @@ export default {
this.submiting = true
const form = JSON.parse(JSON.stringify(this.form))
const ids = form.staffArchitectureId
form.staffArchitectureId = ids.map(e => e[e.length - 1])
if (ids) form.staffArchitectureId = ids.map(e => e[e.length - 1])
if (form.accountId) {
this.$post(this.api.modifyStaff, form).then(res => {
util.successMsg("编辑成功!")
@ -667,7 +672,6 @@ export default {
},
//
closeStaff() {
this.$refs.form.clearValidate()
this.form = {
accountId: '',
userName: '',
@ -678,9 +682,8 @@ export default {
email: '',
staffArchitectureId: [],
roleList: []
};
}
this.isDetail = false
this.staffVisible = false
this.getStaff()
},
//
@ -690,7 +693,7 @@ export default {
this.uploadFaild = false
},
//
downLoad() {
download() {
location.href = this.api.staffTemplate
},
//
@ -703,15 +706,24 @@ export default {
showFaild() {
location.href = `${this.api.exportFailure}?exportCode=${this.exportCode}`
},
//
importSuccess() {
this.importVisible = false
this.studentType = 1
this.keyWord = ''
this.$refs.orgTree.setCurrentKey(null)
this.getOrg()
},
uploadSuccess(res, file, fileList) {
this.uploadFaild = false
if (res.status === 200) {
if (res.data.exportCode) {
this.exportCode = res.data.exportCode
this.uploadFaild = true
util.errorMsg(`本次上传有${res.data.failureNum}个错误信息录入`)
} else {
this.importSuccess()
}
util.successMsg(`上传成功${res.data.successNum},上传失败${res.data.failureNum}`)
util.successMsg(`本次上传有${res.data.failureNum}个错误信息录入`)
} else {
res.message ? util.errorMsg(res.message) : util.errorMsg("上传失败,请检查数据")
}
@ -731,10 +743,7 @@ export default {
this.uploadFaild = false
},
uploadSure() {
this.importVisible = false
this.studentType = 1
this.keyWord = ''
this.initData()
this.uploadFaild ? this.importSuccess() : this.$refs.importStaff.submit()
}
}
};

Loading…
Cancel
Save