|
|
@ -103,15 +103,13 @@ |
|
|
|
<el-table-column type="index" width="60" label="序号" align="center"></el-table-column> |
|
|
|
<el-table-column type="index" width="60" label="序号" align="center"></el-table-column> |
|
|
|
<el-table-column prop="userName" label="员工姓名" align="center" min-width="100"></el-table-column> |
|
|
|
<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="account" label="账号" align="center" min-width="100"></el-table-column> |
|
|
|
<el-table-column prop="className" label="手机号" align="center" width="120"></el-table-column> |
|
|
|
<el-table-column prop="phone" label="手机号" align="center" width="120"></el-table-column> |
|
|
|
<el-table-column prop="loginNumber" label="所在部门" align="center" min-width="100"></el-table-column> |
|
|
|
<el-table-column prop="staffArchitectureName" label="所在部门" align="center" min-width="100"></el-table-column> |
|
|
|
<el-table-column prop="countries" label="授权角色" align="center" width="100"> |
|
|
|
<el-table-column prop="roleName" label="授权角色" align="center" width="100"></el-table-column> |
|
|
|
<template slot-scope="scope">员工</template> |
|
|
|
|
|
|
|
</el-table-column> |
|
|
|
|
|
|
|
<el-table-column label="操作" align="center" width="300"> |
|
|
|
<el-table-column label="操作" align="center" width="300"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-button type="text" @click="editStaff(scope.row,true)">查看</el-button> |
|
|
|
<el-button type="text" @click="queryStaff(scope.row,true)">查看</el-button> |
|
|
|
<el-button type="text" @click="editStaff(scope.row,false)">编辑</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="resetPassword(scope.row)">重置密码</el-button> |
|
|
|
<el-button type="text" @click="delStaff(scope.row)">删除</el-button> |
|
|
|
<el-button type="text" @click="delStaff(scope.row)">删除</el-button> |
|
|
|
</template> |
|
|
|
</template> |
|
|
@ -121,7 +119,7 @@ |
|
|
|
<el-pagination background @current-change="currentChange" :current-page="page" layout="total, prev, pager, next" :total="total"></el-pagination> |
|
|
|
<el-pagination background @current-change="currentChange" :current-page="page" layout="total, prev, pager, next" :total="total"></el-pagination> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<el-dialog :title="isDetail ? '查看' : (form.accountId ? '编辑' : '新增') + '员工'" :visible.sync="staffVisible" width="580px" class="dialog" :close-on-click-modal="false"> |
|
|
|
<el-dialog :title="isDetail ? '查看' : (form.accountId ? '编辑' : '新增') + '员工'" :visible.sync="staffVisible" width="580px" class="dialog" :close-on-click-modal="false" @close="closeStaff"> |
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="150px" :disabled="isDetail" style='margin-right: 80px;'> |
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="150px" :disabled="isDetail" style='margin-right: 80px;'> |
|
|
|
<el-form-item prop="workNumber" label="工号"> |
|
|
|
<el-form-item prop="workNumber" label="工号"> |
|
|
|
<el-input v-model.trim="form.workNumber" placeholder="请输入工号"></el-input> |
|
|
|
<el-input v-model.trim="form.workNumber" placeholder="请输入工号"></el-input> |
|
|
@ -133,13 +131,13 @@ |
|
|
|
<el-input v-model.trim="form.account" placeholder="请输入账号"></el-input> |
|
|
|
<el-input v-model.trim="form.account" placeholder="请输入账号"></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item prop="phone" label="手机号"> |
|
|
|
<el-form-item prop="phone" label="手机号"> |
|
|
|
<el-input v-model.trim="form.phone" placeholder="请输入手机号" maxlength="11" @blur="phoneChange"></el-input> |
|
|
|
<el-input v-model.trim="form.phone" placeholder="请输入手机号" maxlength="11"></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item prop="email" label="邮箱"> |
|
|
|
<el-form-item prop="email" label="邮箱"> |
|
|
|
<el-input v-model.trim="form.email" placeholder="请输入邮箱" @blur="emailChange"></el-input> |
|
|
|
<el-input v-model.trim="form.email" placeholder="请输入邮箱"></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item prop="roleValue" label="授权角色"> |
|
|
|
<el-form-item prop="roleList" label="授权角色"> |
|
|
|
<el-select v-model="form.roleValue" @change="roleChange" @remove-tag="roleRemove" multiple style="width: 100%;"> |
|
|
|
<el-select class="w-100" v-model="form.roleList" multiple> |
|
|
|
<template v-for="item in roleList"> |
|
|
|
<template v-for="item in roleList"> |
|
|
|
<!-- 不显示超管 --> |
|
|
|
<!-- 不显示超管 --> |
|
|
|
<el-option |
|
|
|
<el-option |
|
|
@ -151,17 +149,17 @@ |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</el-select> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item v-for="(item, i) in form.roleAndDeptList" :key="i" :label="`${item.roleName}所在部门`"> |
|
|
|
<el-form-item label="所在部门"> |
|
|
|
<el-cascader |
|
|
|
<el-cascader |
|
|
|
v-model="item.cascaderValue" |
|
|
|
class="w-100" |
|
|
|
|
|
|
|
v-model="form.staffArchitectureId" |
|
|
|
:options="orgList" |
|
|
|
:options="orgList" |
|
|
|
:props="casProps" |
|
|
|
:props="casProps" |
|
|
|
style="width: 100%" |
|
|
|
|
|
|
|
></el-cascader> |
|
|
|
></el-cascader> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
</el-form> |
|
|
|
<span slot="footer" class="dialog-footer" v-if="!isDetail"> |
|
|
|
<span slot="footer" class="dialog-footer" v-if="!isDetail"> |
|
|
|
<el-button @click="closeStudent">取消</el-button> |
|
|
|
<el-button @click="staffVisible = false">取消</el-button> |
|
|
|
<el-button type="primary" @click="submitStaff">确定</el-button> |
|
|
|
<el-button type="primary" @click="submitStaff">确定</el-button> |
|
|
|
</span> |
|
|
|
</span> |
|
|
|
</el-dialog> |
|
|
|
</el-dialog> |
|
|
@ -206,33 +204,58 @@ import OrgTree from "@/components/org-tree/src/tree"; |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
components: { OrgTree }, |
|
|
|
components: { OrgTree }, |
|
|
|
data() { |
|
|
|
data() { |
|
|
|
var accountPass = (rule, value, callback) => { |
|
|
|
const accountPass = (rule, value, callback) => { |
|
|
|
if (value === '') { |
|
|
|
if (value === '') { |
|
|
|
callback(new Error('请输入账号')); |
|
|
|
callback(new Error('请输入账号')) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
var pattern = /^[A-Za-z0-9]*$/; |
|
|
|
const pattern = /^[A-Za-z0-9]*$/ |
|
|
|
if(pattern.test(value)){ |
|
|
|
if(pattern.test(value)){ |
|
|
|
this.accountChange(); |
|
|
|
this.accountChange() |
|
|
|
callback(); |
|
|
|
callback() |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
callback(new Error('请输入正确账号格式')); |
|
|
|
callback(new Error('请输入正确账号格式')) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
var workNumberPass = (rule, value, callback) => { |
|
|
|
} |
|
|
|
if (value === '') { |
|
|
|
const workNumberPass = (rule, value, callback) => { |
|
|
|
callback(new Error('请输入员工学号')); |
|
|
|
if (value === '') { |
|
|
|
} else { |
|
|
|
callback(new Error('请输入工号')) |
|
|
|
var pattern = /^[A-Za-z0-9]*$/; |
|
|
|
} else { |
|
|
|
if(pattern.test(value)){ |
|
|
|
const pattern = /^[A-Za-z0-9]*$/ |
|
|
|
this.worknumberChange(); |
|
|
|
if(pattern.test(value)){ |
|
|
|
callback(); |
|
|
|
this.worknumberChange() |
|
|
|
}else{ |
|
|
|
callback() |
|
|
|
callback(new Error('请输入正确员工学号格式')); |
|
|
|
}else{ |
|
|
|
} |
|
|
|
callback(new Error('请输入正确工号格式')) |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
let that = this; |
|
|
|
} |
|
|
|
|
|
|
|
const phonePass = (rule, value, callback) => { |
|
|
|
|
|
|
|
if (value) { |
|
|
|
|
|
|
|
const pattern = /^1[3456789]\d{9}$/ |
|
|
|
|
|
|
|
if(pattern.test(value)){ |
|
|
|
|
|
|
|
this.phoneChange() |
|
|
|
|
|
|
|
callback() |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
callback(new Error('请输入正确手机号格式')) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
callback() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
const emailPass = (rule, value, callback) => { |
|
|
|
|
|
|
|
if (value) { |
|
|
|
|
|
|
|
const pattern = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/ |
|
|
|
|
|
|
|
if(pattern.test(value)){ |
|
|
|
|
|
|
|
this.emailChange() |
|
|
|
|
|
|
|
callback() |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
callback(new Error('请输入正确邮箱格式')) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
callback() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
return { |
|
|
|
return { |
|
|
|
orgList: [], |
|
|
|
orgList: [], |
|
|
|
orgListDia: [], |
|
|
|
orgListDia: [], |
|
|
@ -262,34 +285,27 @@ export default { |
|
|
|
uniqueIdentification: '', |
|
|
|
uniqueIdentification: '', |
|
|
|
workNumber: '', |
|
|
|
workNumber: '', |
|
|
|
email: '', |
|
|
|
email: '', |
|
|
|
account: '' |
|
|
|
account: '', |
|
|
|
|
|
|
|
staffArchitectureId: [] |
|
|
|
}, |
|
|
|
}, |
|
|
|
rules: { |
|
|
|
rules: { |
|
|
|
organizationName: [ |
|
|
|
|
|
|
|
{ required: true, message: "请输入名称", trigger: "blur" } |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
account: [ |
|
|
|
account: [ |
|
|
|
{ required: true,validator: accountPass, trigger: 'blur' } |
|
|
|
{ required: true,validator: accountPass, trigger: 'blur' } |
|
|
|
], |
|
|
|
], |
|
|
|
userName: [ |
|
|
|
userName: [ |
|
|
|
{ required: true, message: "请输入姓名", trigger: "blur" } |
|
|
|
{ required: true, message: "请输入姓名", trigger: "blur" } |
|
|
|
], |
|
|
|
], |
|
|
|
workNumber: [ |
|
|
|
workNumber: [ |
|
|
|
{ required: true,validator: workNumberPass, trigger: 'blur' } |
|
|
|
{ required: true,validator: workNumberPass, trigger: 'blur' } |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
roleList: [ |
|
|
|
|
|
|
|
{ required: true, message: "请选择授权角色", trigger: "change" } |
|
|
|
], |
|
|
|
], |
|
|
|
phone: [ |
|
|
|
phone: [ |
|
|
|
{ |
|
|
|
{ validator: phonePass, trigger: 'blur' } |
|
|
|
pattern: /^1[3456789]\d{9}$/, |
|
|
|
|
|
|
|
message: "请输入正确的手机号", |
|
|
|
|
|
|
|
trigger: "blur" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
], |
|
|
|
], |
|
|
|
email: [ |
|
|
|
email: [ |
|
|
|
{ |
|
|
|
{ validator: emailPass, trigger: 'blur' } |
|
|
|
pattern: /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/, |
|
|
|
|
|
|
|
message: "请输入正确的邮箱", |
|
|
|
|
|
|
|
trigger: "blur" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
] |
|
|
|
] |
|
|
|
}, |
|
|
|
}, |
|
|
|
listData: [], |
|
|
|
listData: [], |
|
|
@ -305,7 +321,6 @@ export default { |
|
|
|
originWorkNumber: '', |
|
|
|
originWorkNumber: '', |
|
|
|
phoneRepeat: false, |
|
|
|
phoneRepeat: false, |
|
|
|
emailRepeat: false, |
|
|
|
emailRepeat: false, |
|
|
|
defaultCheckedKeys: [], |
|
|
|
|
|
|
|
casProps: { |
|
|
|
casProps: { |
|
|
|
multiple: true, |
|
|
|
multiple: true, |
|
|
|
checkStrictly: true, |
|
|
|
checkStrictly: true, |
|
|
@ -325,10 +340,10 @@ export default { |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
watch: { |
|
|
|
keyWord: function(val) { |
|
|
|
keyWord: function(val) { |
|
|
|
clearTimeout(this.searchTimer); |
|
|
|
clearTimeout(this.searchTimer); |
|
|
|
this.searchTimer = setTimeout(this.getStaff, 500); |
|
|
|
this.searchTimer = setTimeout(this.getStaff, 500); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
mounted() { |
|
|
|
this.getOrg() |
|
|
|
this.getOrg() |
|
|
@ -445,17 +460,16 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 员工列表 |
|
|
|
// 员工列表 |
|
|
|
getStaff() { |
|
|
|
getStaff() { |
|
|
|
let data = { |
|
|
|
this.$post(this.api.staffList, { |
|
|
|
type: this.studentType || '', |
|
|
|
type: this.studentType || 1, |
|
|
|
staffArchitectureId: this.$refs.orgTree.getCurrentKey() || '', |
|
|
|
staffArchitectureId: this.$refs.orgTree.getCurrentKey() || '', |
|
|
|
keyWord: this.keyWord, |
|
|
|
keyWord: this.keyWord, |
|
|
|
pageNum: this.page, |
|
|
|
pageNum: this.page, |
|
|
|
pageSize: this.pageSize |
|
|
|
pageSize: this.pageSize |
|
|
|
}; |
|
|
|
}).then(res => { |
|
|
|
this.$post(this.api.staffList, data).then(res => { |
|
|
|
this.listData = res.page.records |
|
|
|
this.listData = res.records |
|
|
|
this.total = res.page.total |
|
|
|
this.total = res.total |
|
|
|
}).catch(err => {}) |
|
|
|
}).catch(err => {}) |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
// 切换页码 |
|
|
|
// 切换页码 |
|
|
|
currentChange(val) { |
|
|
|
currentChange(val) { |
|
|
@ -466,41 +480,40 @@ export default { |
|
|
|
this.multipleSelection = val |
|
|
|
this.multipleSelection = val |
|
|
|
}, |
|
|
|
}, |
|
|
|
initData() { |
|
|
|
initData() { |
|
|
|
this.$refs.table.clearSelection() |
|
|
|
this.$refs.table.clearSelection() |
|
|
|
this.page = 1 |
|
|
|
this.page = 1 |
|
|
|
this.getStaff() |
|
|
|
this.getStaff() |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 删除 |
|
|
|
// 删除 |
|
|
|
delStaff(row) { |
|
|
|
delStaff(row) { |
|
|
|
this.$confirm("确定要删除吗?", "提示", { |
|
|
|
this.$confirm("确定要删除吗?", "提示", { |
|
|
|
type: "warning" |
|
|
|
type: "warning" |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
|
this.$post(`${this.api.delStaff}?accountIds=${row.accountId}`).then(res => { |
|
|
|
this.$post(`${this.api.delStaff}?accountIds=${row.accountId}`).then(res => { |
|
|
|
util.successMsg("删除成功") |
|
|
|
util.successMsg("删除成功") |
|
|
|
this.getStaff() |
|
|
|
this.getStaff() |
|
|
|
}).catch(res => { |
|
|
|
}).catch(res => {}) |
|
|
|
}); |
|
|
|
}).catch(() => {}) |
|
|
|
}).catch(() => {}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 重置密码 |
|
|
|
resetPassword(row) { // 重置密码 |
|
|
|
resetPassword(row) { |
|
|
|
this.$confirm(`重置后的密码为:${Setting.initialPassword},确定重置?`, "提示", { type: "warning" }).then(() => { |
|
|
|
this.$confirm(`重置后的密码为:${Setting.initialPassword},确定重置?`, "提示", { type: "warning" }).then(() => { |
|
|
|
this.$get(`${this.api.resetPassword}?userId=${row.userId}&newPwd=111aaa`).then(res => { |
|
|
|
this.$get(`${this.api.resetPassword}?userId=${row.userId}&newPwd=111aaa`).then(res => { |
|
|
|
util.successMsg("重置成功"); |
|
|
|
util.successMsg("重置成功") |
|
|
|
}).catch(res => { |
|
|
|
}).catch(res => {}) |
|
|
|
}); |
|
|
|
}).catch(() => {}) |
|
|
|
}).catch(() => { |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
// 添加员工 |
|
|
|
// 添加员工 |
|
|
|
addStaff() { |
|
|
|
addStaff() { |
|
|
|
this.staffVisible = true |
|
|
|
this.staffVisible = true |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 编辑/查看 |
|
|
|
// 编辑/查看 |
|
|
|
editStaff(row, isDetail) { |
|
|
|
queryStaff(row, isDetail) { |
|
|
|
this.isDetail = isDetail |
|
|
|
this.isDetail = isDetail |
|
|
|
this.staffVisible = true |
|
|
|
this.staffVisible = true |
|
|
|
this.$post(`${this.api.staffDetail}?accountId=${row.accountId}`).then(res => { |
|
|
|
this.$get(`${this.api.staffDetail}?accountId=${row.accountId}`).then(res => { |
|
|
|
const { data } = res |
|
|
|
const { data } = res |
|
|
|
|
|
|
|
data.staffArchitectureId = data.staffArchitectureId.split(',') |
|
|
|
this.form = data |
|
|
|
this.form = data |
|
|
|
this.originAccount = data.account |
|
|
|
this.originAccount = data.account |
|
|
|
this.originWorkNumber = data.workNumber |
|
|
|
this.originWorkNumber = data.workNumber |
|
|
@ -513,189 +526,107 @@ export default { |
|
|
|
this.roleList = res.rolePage.records |
|
|
|
this.roleList = res.rolePage.records |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => {}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 处理切换角色 |
|
|
|
// 账号判重 |
|
|
|
roleChange(value) { |
|
|
|
accountChange() { |
|
|
|
if (value.length) { |
|
|
|
const form = this.form |
|
|
|
let ids = this.form.roleAndDeptList.map(e => e.roleId); |
|
|
|
const { account } = form |
|
|
|
this.roleList.forEach(i => { |
|
|
|
if (account === this.originAccount) { |
|
|
|
let obj = { |
|
|
|
this.accountReapeat = false |
|
|
|
roleId: "", |
|
|
|
} else { |
|
|
|
roleName: "", |
|
|
|
const { accountId } = form |
|
|
|
cascaderValue: [] |
|
|
|
this.$post(`${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=2&account=${account}${accountId ? `&accountId=${accountId}` : ''}`).then(res => { |
|
|
|
}; |
|
|
|
this.accountReapeat = false |
|
|
|
if (value.includes(i.id) && !ids.includes(i.id)) { |
|
|
|
}).catch(err => { |
|
|
|
console.log(i) |
|
|
|
this.accountReapeat = true |
|
|
|
obj.roleId = i.id; |
|
|
|
}) |
|
|
|
obj.roleName = i.roleName; |
|
|
|
} |
|
|
|
this.form.roleAndDeptList.push(obj); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.form.roleAndDeptList.splice(0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
roleRemove(value) { // 处理移除角色 |
|
|
|
|
|
|
|
let list = []; |
|
|
|
|
|
|
|
for(var i=0;i<this.form.roleAndDeptList.length;i++){ |
|
|
|
|
|
|
|
if (this.form.roleAndDeptList[i].roleId == value){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
list.push(this.form.roleAndDeptList[i]) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.form.roleAndDeptList = list |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
accountChange() { // 切换账号 |
|
|
|
|
|
|
|
if (this.form.account) { |
|
|
|
|
|
|
|
let url = ""; |
|
|
|
|
|
|
|
if (this.form.accountId) { |
|
|
|
|
|
|
|
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=1&account=${this.form.account}&workNumber=`; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=1&accountId=${this.form.accountId}&account=${this.form.account}&workNumber=`; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.$post(url).then(res => { |
|
|
|
|
|
|
|
this.disableds = false |
|
|
|
|
|
|
|
if (this.form.accountId) { |
|
|
|
|
|
|
|
this.$refs.form.clearValidate(); |
|
|
|
|
|
|
|
this.form = { |
|
|
|
|
|
|
|
account: this.form.account, |
|
|
|
|
|
|
|
userName: '', |
|
|
|
|
|
|
|
phone: '', |
|
|
|
|
|
|
|
uniqueIdentification: '', |
|
|
|
|
|
|
|
workNumber: '', |
|
|
|
|
|
|
|
email: '', |
|
|
|
|
|
|
|
classId: "" |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
this.$refs.classTree.setCheckedKeys([]); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.$refs.form.clearValidate(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.accountReapeat = false; |
|
|
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.form.accountId) { |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.accountReapeat = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
// 工号判重 |
|
|
|
worknumberChange() { |
|
|
|
worknumberChange() { |
|
|
|
if (this.form.workNumber) { |
|
|
|
const form = this.form |
|
|
|
let url = ""; |
|
|
|
const { workNumber } = form |
|
|
|
if (!this.form.accountId) { |
|
|
|
if (workNumber === this.originWorkNumber) { |
|
|
|
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=1&workNumber=${this.form.workNumber}&account=`; |
|
|
|
this.workNumberReapeat = false |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=1&accountId=${this.form.accountId}&workNumber=${this.form.workNumber}&account=`; |
|
|
|
const { accountId } = form |
|
|
|
} |
|
|
|
this.$post(`${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=2&workNumber=${workNumber}${accountId ? `&accountId=${accountId}` : ''}`).then(res => { |
|
|
|
this.$post(url).then(res => { |
|
|
|
this.workNumberReapeat = false |
|
|
|
if (res.status === 200) { |
|
|
|
}).catch(err => { |
|
|
|
this.workNumberReapeat = false; |
|
|
|
this.workNumberReapeat = true |
|
|
|
} |
|
|
|
}) |
|
|
|
}).catch(err => { |
|
|
|
} |
|
|
|
this.$post(`${this.api.getDetailByAccount}?workNumber=${this.form.workNumber}&platformId=${Setting.platformId}&type=1`).then(res => { |
|
|
|
|
|
|
|
let classId = res.data.classList.map(e => e.id); |
|
|
|
|
|
|
|
this.form.classId = classId.toString(); |
|
|
|
|
|
|
|
delete this.form.classList; |
|
|
|
|
|
|
|
this.accountReapeat = false; |
|
|
|
|
|
|
|
this.$refs.form.clearValidate(); |
|
|
|
|
|
|
|
}).catch(res => {}); |
|
|
|
|
|
|
|
this.workNumberReapeat = true; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
// 手机号判重 |
|
|
|
phoneChange() { |
|
|
|
phoneChange() { |
|
|
|
let regex = /^1[3456789]\d{9}$/; |
|
|
|
const form = this.form |
|
|
|
if (regex.test(this.form.phone)) { |
|
|
|
const { phone } = form |
|
|
|
let url = ""; |
|
|
|
if (phone) { |
|
|
|
if (!this.form.accountId) { |
|
|
|
const { accountId } = form |
|
|
|
url = `${this.api.checkEmailOrPhone}?phone=${this.form.phone}&email=`; |
|
|
|
this.$post(`${this.api.checkEmailOrPhone}?phone=${phone}${accountId ? `&accountId=${accountId}` : ''}`).then(res => { |
|
|
|
} else { |
|
|
|
this.phoneRepeat = false |
|
|
|
url = `${this.api.checkEmailOrPhone}?accountId=${this.form.accountId}&phone=${this.form.phone}&email=`; |
|
|
|
}).catch(err => { |
|
|
|
} |
|
|
|
this.phoneRepeat = true |
|
|
|
this.$post(url).then(res => { |
|
|
|
}) |
|
|
|
if (res.status === 200) { |
|
|
|
} |
|
|
|
this.phoneRepeat = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
|
|
this.phoneRepeat = true; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
// 邮箱判重 |
|
|
|
emailChange() { |
|
|
|
emailChange() { |
|
|
|
let regex = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/; |
|
|
|
const form = this.form |
|
|
|
if (regex.test(this.form.email)) { |
|
|
|
const { email } = form |
|
|
|
let url = ""; |
|
|
|
if (email) { |
|
|
|
if (!this.form.accountId) { |
|
|
|
const { accountId } = form |
|
|
|
url = `${this.api.checkEmailOrPhone}?email=${this.form.email}&phone=`; |
|
|
|
this.$post(`${this.api.checkEmailOrPhone}?email=${email}${accountId ? `&accountId=${accountId}` : ''}`).then(res => { |
|
|
|
} else { |
|
|
|
this.emailRepeat = false |
|
|
|
url = `${this.api.checkEmailOrPhone}?accountId=${this.form.accountId}&email=${this.form.email}&phone=`; |
|
|
|
}).catch(err => { |
|
|
|
} |
|
|
|
this.emailRepeat = true |
|
|
|
this.$post(url).then(res => { |
|
|
|
}) |
|
|
|
if (res.status === 200) { |
|
|
|
} |
|
|
|
this.emailRepeat = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
|
|
this.emailRepeat = true; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
// 提交新增/编辑员工 |
|
|
|
// 提交新增/编辑员工 |
|
|
|
submitStaff() { |
|
|
|
submitStaff() { |
|
|
|
this.$refs.form.validate((valid) => { |
|
|
|
this.$refs.form.validate((valid) => { |
|
|
|
if (valid) { |
|
|
|
if (valid) { |
|
|
|
if (this.submiting) return false |
|
|
|
if (this.submiting) return false |
|
|
|
if (this.accountReapeat) return util.warningMsg("该账号已存在") |
|
|
|
if (this.accountReapeat) return util.warningMsg("该账号已存在") |
|
|
|
if (this.workNumberReapeat) return util.warningMsg("该员工学号已存在") |
|
|
|
if (this.workNumberReapeat) return util.warningMsg("该工号已存在") |
|
|
|
if (this.phoneRepeat) return util.warningMsg("该手机号已存在") |
|
|
|
if (this.phoneRepeat) return util.warningMsg("该手机号已存在") |
|
|
|
if (this.emailRepeat) return util.warningMsg("该邮箱已存在") |
|
|
|
if (this.emailRepeat) return util.warningMsg("该邮箱已存在") |
|
|
|
const form = this.form |
|
|
|
this.submiting = true |
|
|
|
if (this.teacherForm.roleAndDeptList.length){ |
|
|
|
const form = this.form |
|
|
|
for (let i = 0; i < this.teacherForm.roleAndDeptList.length; i++) { |
|
|
|
const ids = form.staffArchitectureId |
|
|
|
if (this.teacherForm.roleAndDeptList[i].cascaderValue.length < 2) { |
|
|
|
form.staffArchitectureId = ids.map(e => e[e.length - 1]) |
|
|
|
util.warningMsg(`请选择${this.teacherForm.roleAndDeptList[i].roleName}所属部门`) |
|
|
|
console.log("🚀 ~ file: staff.vue ~ line 622 ~ this.$refs.form.validate ~ form", form) |
|
|
|
return; |
|
|
|
if (form.accountId) { |
|
|
|
} else { |
|
|
|
this.$post(this.api.modifyStaff, form).then(res => { |
|
|
|
data.roleAndDeptList.push({ |
|
|
|
util.successMsg("编辑成功!") |
|
|
|
roleId: this.teacherForm.roleAndDeptList[i].roleId, |
|
|
|
this.staffVisible = false |
|
|
|
staffArchitectureId: this.teacherForm.roleAndDeptList[i].cascaderValue[0], |
|
|
|
setTimeout(() => { |
|
|
|
gradeId: this.teacherForm.roleAndDeptList[i].cascaderValue[1] |
|
|
|
this.submiting = false |
|
|
|
}) |
|
|
|
}, 2000) |
|
|
|
} |
|
|
|
}).catch(res => { |
|
|
|
} |
|
|
|
setTimeout(() => { |
|
|
|
} |
|
|
|
this.submiting = false |
|
|
|
this.submiting = true |
|
|
|
}, 2000) |
|
|
|
if (form.accountId) { |
|
|
|
}) |
|
|
|
this.$post(this.api.modifyStaff, form).then(res => { |
|
|
|
} else { |
|
|
|
util.successMsg("编辑成功!") |
|
|
|
form.uniqueIdentification = new Date().getTime() |
|
|
|
this.closeStudent() |
|
|
|
this.$post(this.api.saveStaff, form).then(res => { |
|
|
|
setTimeout(() => { |
|
|
|
util.successMsg("新增成功!") |
|
|
|
this.submiting = false |
|
|
|
this.staffVisible = false |
|
|
|
}, 2000) |
|
|
|
setTimeout(() => { |
|
|
|
}).catch(res => { |
|
|
|
this.submiting = false |
|
|
|
setTimeout(() => { |
|
|
|
}, 2000) |
|
|
|
this.submiting = false |
|
|
|
}).catch(res => { |
|
|
|
}, 2000) |
|
|
|
setTimeout(() => { |
|
|
|
}) |
|
|
|
this.submiting = false |
|
|
|
} else { |
|
|
|
}, 2000) |
|
|
|
form.uniqueIdentification = new Date().getTime() |
|
|
|
}) |
|
|
|
this.$post(this.api.saveStaff, form).then(res => { |
|
|
|
} |
|
|
|
util.successMsg("新增成功!") |
|
|
|
} |
|
|
|
this.closeStudent() |
|
|
|
}) |
|
|
|
setTimeout(() => { |
|
|
|
|
|
|
|
this.submiting = false |
|
|
|
|
|
|
|
}, 2000) |
|
|
|
|
|
|
|
}).catch(res => { |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
|
|
this.submiting = false |
|
|
|
|
|
|
|
}, 2000) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
// 关闭新增员工对话框 |
|
|
|
// 关闭新增员工对话框 |
|
|
|
closeStudent() { |
|
|
|
closeStaff() { |
|
|
|
this.$refs.form.clearValidate() |
|
|
|
this.$refs.form.clearValidate() |
|
|
|
this.form = { |
|
|
|
this.form = { |
|
|
|
accountId: '', |
|
|
|
accountId: '', |
|
|
@ -705,65 +636,65 @@ export default { |
|
|
|
uniqueIdentification: '', |
|
|
|
uniqueIdentification: '', |
|
|
|
workNumber: '', |
|
|
|
workNumber: '', |
|
|
|
email: '', |
|
|
|
email: '', |
|
|
|
classId: '' |
|
|
|
staffArchitectureId: [], |
|
|
|
|
|
|
|
roleList: [] |
|
|
|
}; |
|
|
|
}; |
|
|
|
this.defaultCheckedKeys = [] |
|
|
|
|
|
|
|
this.isDetail = false |
|
|
|
this.isDetail = false |
|
|
|
this.staffVisible = false |
|
|
|
this.staffVisible = false |
|
|
|
this.getStaff() |
|
|
|
this.getStaff() |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 批量导入 |
|
|
|
// 批量导入 |
|
|
|
batchImport() { |
|
|
|
batchImport() { |
|
|
|
this.importVisible = true; |
|
|
|
this.importVisible = true |
|
|
|
this.uploadList = []; |
|
|
|
this.uploadList = [] |
|
|
|
this.uploadFaild = false; |
|
|
|
this.uploadFaild = false |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 模板下载 |
|
|
|
// 模板下载 |
|
|
|
downLoad() { |
|
|
|
downLoad() { |
|
|
|
location.href = this.api.studentTemplate; |
|
|
|
location.href = this.api.studentTemplate |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 上传文件 |
|
|
|
// 上传文件 |
|
|
|
handleExceed(files, fileList) { |
|
|
|
handleExceed(files, fileList) { |
|
|
|
util.warningMsg( |
|
|
|
util.warningMsg( |
|
|
|
`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!` |
|
|
|
`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!` |
|
|
|
); |
|
|
|
) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 下载失败文件 |
|
|
|
// 下载失败文件 |
|
|
|
showFaild() { |
|
|
|
showFaild() { |
|
|
|
location.href = `${this.api.exportFailure}?exportCode=${this.exportCode}`; |
|
|
|
location.href = `${this.api.exportFailure}?exportCode=${this.exportCode}` |
|
|
|
}, |
|
|
|
}, |
|
|
|
uploadSuccess(res, file, fileList) { |
|
|
|
uploadSuccess(res, file, fileList) { |
|
|
|
this.uploadFaild = false; |
|
|
|
this.uploadFaild = false |
|
|
|
if (res.status === 200) { |
|
|
|
if (res.status === 200) { |
|
|
|
if (res.data.exportCode) { |
|
|
|
if (res.data.exportCode) { |
|
|
|
this.exportCode = res.data.exportCode; |
|
|
|
this.exportCode = res.data.exportCode |
|
|
|
this.uploadFaild = true; |
|
|
|
this.uploadFaild = true |
|
|
|
} |
|
|
|
|
|
|
|
util.successMsg(`上传成功${res.data.successNum},上传失败${res.data.failureNum}`); |
|
|
|
|
|
|
|
util.successMsg(`本次上传有${res.data.failureNum}个错误信息录入`); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
res.message ? util.errorMsg(res.message) : util.errorMsg("上传失败,请检查数据"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
util.successMsg(`上传成功${res.data.successNum},上传失败${res.data.failureNum}`) |
|
|
|
|
|
|
|
util.successMsg(`本次上传有${res.data.failureNum}个错误信息录入`) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
res.message ? util.errorMsg(res.message) : util.errorMsg("上传失败,请检查数据") |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
uploadError(err, file, fileList) { |
|
|
|
uploadError(err, file, fileList) { |
|
|
|
this.$message({ |
|
|
|
this.$message({ |
|
|
|
message: "上传出错,请重试!", |
|
|
|
message: "上传出错,请重试!", |
|
|
|
type: "error", |
|
|
|
type: "error", |
|
|
|
center: true |
|
|
|
center: true |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
beforeRemove(file, fileList) { |
|
|
|
beforeRemove(file, fileList) { |
|
|
|
return this.$confirm(`确定移除 ${file.name}?`); |
|
|
|
return this.$confirm(`确定移除 ${file.name}?`) |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleRemove(file, fileList) { |
|
|
|
handleRemove(file, fileList) { |
|
|
|
this.uploadList = fileList; |
|
|
|
this.uploadList = fileList |
|
|
|
this.uploadFaild = false; |
|
|
|
this.uploadFaild = false |
|
|
|
}, |
|
|
|
}, |
|
|
|
uploadSure() { |
|
|
|
uploadSure() { |
|
|
|
this.importVisible = false; |
|
|
|
this.importVisible = false |
|
|
|
this.studentType = 1; |
|
|
|
this.studentType = 1 |
|
|
|
this.keyWord = ""; |
|
|
|
this.keyWord = '' |
|
|
|
this.initData(); |
|
|
|
this.initData() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
@ -776,4 +707,7 @@ export default { |
|
|
|
.org-name { |
|
|
|
.org-name { |
|
|
|
margin-right: 20px; |
|
|
|
margin-right: 20px; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.w-100 { |
|
|
|
|
|
|
|
width: 100%; |
|
|
|
|
|
|
|
} |
|
|
|
</style> |
|
|
|
</style> |