|
|
@ -1,7 +1,7 @@ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<div class="wrap"> |
|
|
|
<div class="wrap"> |
|
|
|
<div class="side"> |
|
|
|
<div class="side"> |
|
|
|
<org ref="org" @getSingle="getSingle" @getCheck="getCheck"></org> |
|
|
|
<org ref="org"></org> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="right"> |
|
|
|
<div class="right"> |
|
|
@ -13,8 +13,8 @@ |
|
|
|
</li> |
|
|
|
</li> |
|
|
|
</ul> |
|
|
|
</ul> |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
<el-button type="primary" round @click="addTeacher">导入模型</el-button> |
|
|
|
<el-button type="primary" round @click="add">导入模型</el-button> |
|
|
|
<el-button type="primary" round @click="delAllSelection">批量移除</el-button> |
|
|
|
<el-button type="primary" round @click="batchDel">批量移除</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
@ -27,7 +27,7 @@ |
|
|
|
<el-table-column label="操作" width="200" align="center"> |
|
|
|
<el-table-column label="操作" width="200" align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-button type="text" @click="showTeacher(scope.row)">查看</el-button> |
|
|
|
<el-button type="text" @click="showTeacher(scope.row)">查看</el-button> |
|
|
|
<el-button type="text" @click="delTeacher(scope.row)">移除</el-button> |
|
|
|
<el-button type="text" @click="del(scope.row)">移除</el-button> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
</el-table> |
|
|
@ -36,186 +36,84 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<el-dialog :title="isDetail ? '查看员工' : (isAdd ? '新增员工' : '编辑员工')" :visible.sync="teacherVisible" |
|
|
|
<el-dialog title="请选择需要导入的模型" :visible.sync="modelVisible" width="500px" class="dialog" :close-on-click-modal="false"> |
|
|
|
width="30%" @close="closeTeacher" class="dialog" :close-on-click-modal="false"> |
|
|
|
<el-tree |
|
|
|
<el-form ref="teacherForm" :model="teacherForm" :rules="rules" label-width="150px" :disabled="isDetail" style='margin-right: 80px;'> |
|
|
|
:data="modelData" |
|
|
|
<el-form-item prop="account" label="账号"> |
|
|
|
ref="tree" |
|
|
|
<el-input v-model.trim="teacherForm.account" placeholder="请输入职工账号"></el-input> |
|
|
|
default-expand-all |
|
|
|
</el-form-item> |
|
|
|
show-checkbox |
|
|
|
<el-form-item prop="userName" label="用户姓名"> |
|
|
|
:check-strictly="true" |
|
|
|
<el-input v-model.trim="teacherForm.userName" placeholder="请输入员工姓名"></el-input> |
|
|
|
node-key="id"> |
|
|
|
</el-form-item> |
|
|
|
</el-tree> |
|
|
|
<el-form-item prop="roleValue" label="账号角色"> |
|
|
|
|
|
|
|
<el-select v-model="teacherForm.roleValue" @change="roleChange" @remove-tag="roleRemove" multiple style="width: 100%;height: 32px"> |
|
|
|
|
|
|
|
<el-option |
|
|
|
|
|
|
|
v-for="item in roleList" |
|
|
|
|
|
|
|
:key="item.id" |
|
|
|
|
|
|
|
:label="item.roleName" |
|
|
|
|
|
|
|
:value="item.id"> |
|
|
|
|
|
|
|
</el-option> |
|
|
|
|
|
|
|
</el-select> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item prop="uniqueIdentification" label="唯一标识"> |
|
|
|
|
|
|
|
<el-input disabled v-model.trim="teacherForm.uniqueIdentification" placeholder="请输入职工工号获取唯一标识"></el-input> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item prop="workNumber" label="工号"> |
|
|
|
|
|
|
|
<el-input v-model.trim="teacherForm.workNumber" placeholder="请输入职工工号"></el-input> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item v-for="item in teacherForm.roleAndDeptList" :label="`${item.roleName}所属部门`" :rules="{ |
|
|
|
|
|
|
|
required: true, message: '请选择', trigger: 'change' |
|
|
|
|
|
|
|
}"> |
|
|
|
|
|
|
|
<el-cascader |
|
|
|
|
|
|
|
v-model="item.cascaderValue" |
|
|
|
|
|
|
|
:options="orgList" |
|
|
|
|
|
|
|
:props="casProps" |
|
|
|
|
|
|
|
style="width: 100%" |
|
|
|
|
|
|
|
></el-cascader> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item prop="phone" label="手机号"> |
|
|
|
|
|
|
|
<el-input v-model.trim="teacherForm.phone" placeholder="请输入手机号" maxlength="11" @blur="phoneChange"></el-input> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item prop="email" label="邮箱"> |
|
|
|
|
|
|
|
<el-input v-model.trim="teacherForm.email" placeholder="请输入邮箱" @blur="emailChange"></el-input> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
</el-form> |
|
|
|
|
|
|
|
<span slot="footer" class="dialog-footer" v-if="!isDetail"> |
|
|
|
<span slot="footer" class="dialog-footer" v-if="!isDetail"> |
|
|
|
<el-button @click="closeTeacher">取 消</el-button> |
|
|
|
<el-button @click="modelVisible = false">取 消</el-button> |
|
|
|
<el-button type="primary" @click="saveSure('teacherForm')">确 定</el-button> |
|
|
|
<el-button type="primary" @click="submit">确 定</el-button> |
|
|
|
</span> |
|
|
|
|
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<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> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<el-upload |
|
|
|
|
|
|
|
name="file" |
|
|
|
|
|
|
|
accept=".xls,.xlsx" |
|
|
|
|
|
|
|
:on-remove="handleRemove" |
|
|
|
|
|
|
|
:on-error="uploadError" |
|
|
|
|
|
|
|
:on-success="uploadSuccess" |
|
|
|
|
|
|
|
:before-remove="beforeRemove" |
|
|
|
|
|
|
|
:limit="1" |
|
|
|
|
|
|
|
:on-exceed="handleExceed" |
|
|
|
|
|
|
|
:action="this.api.importStaff" |
|
|
|
|
|
|
|
:file-list="uploadList" |
|
|
|
|
|
|
|
:headers="headers" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<el-button type="primary" class="ml20">上传文件<i class="el-icon-upload2 el-icon--right"></i></el-button> |
|
|
|
|
|
|
|
</el-upload> |
|
|
|
|
|
|
|
<el-link v-if="uploadFaild" type="primary" @click="showFaild">部分数据导入失败,查看失败原因</el-link> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
|
|
|
|
<el-button @click="importVisible = false">取 消</el-button> |
|
|
|
|
|
|
|
<el-button type="primary" @click="uploadSure">确 定</el-button> |
|
|
|
|
|
|
|
</span> |
|
|
|
</span> |
|
|
|
</el-dialog> |
|
|
|
</el-dialog> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<script> |
|
|
|
<script> |
|
|
|
import Setting from "@/setting"; |
|
|
|
|
|
|
|
import org from "./modelType" |
|
|
|
import org from "./modelType" |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
data() { |
|
|
|
var accountPass = (rule, value, callback) => { |
|
|
|
|
|
|
|
if (value === '') { |
|
|
|
|
|
|
|
callback(new Error('请输入账号')); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
var pattern = /^[A-Za-z0-9]*$/; |
|
|
|
|
|
|
|
if(pattern.test(value)){ |
|
|
|
|
|
|
|
this.accountChange(); |
|
|
|
|
|
|
|
callback(); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
callback(new Error('请输入正确账号格式')); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
var workNumberPass = (rule, value, callback) => { |
|
|
|
|
|
|
|
if (value === '') { |
|
|
|
|
|
|
|
callback(new Error('请输入职工工号')); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
var pattern = /^[a-zA-Z0-9]*$/; |
|
|
|
|
|
|
|
if(pattern.test(value)){ |
|
|
|
|
|
|
|
this.workNumberChange(); |
|
|
|
|
|
|
|
callback(); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
callback(new Error('职工工号必须为数字或英文')); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
exportCode: "", |
|
|
|
listData: [], |
|
|
|
headers: { |
|
|
|
keyword: '', |
|
|
|
// token: util.local.get(Setting.tokenKey) |
|
|
|
page: 1, |
|
|
|
|
|
|
|
pageSize: 10, |
|
|
|
|
|
|
|
total: 0, |
|
|
|
|
|
|
|
multipleSelection: [], |
|
|
|
|
|
|
|
modelVisible: false, |
|
|
|
|
|
|
|
modelData: [ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
id: 1, |
|
|
|
|
|
|
|
label: '品牌一', |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
id: 4, |
|
|
|
|
|
|
|
label: '华东区域', |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
id: 9, |
|
|
|
|
|
|
|
label: '上海' |
|
|
|
}, |
|
|
|
}, |
|
|
|
isDetail: false, |
|
|
|
{ |
|
|
|
isAdd: false, |
|
|
|
id: 10, |
|
|
|
teacherVisible: false, |
|
|
|
label: '昆山' |
|
|
|
roleList: [], // 角色列表 |
|
|
|
} |
|
|
|
orgList: [], // 员工组织架构列表 |
|
|
|
] |
|
|
|
casProps: { |
|
|
|
} |
|
|
|
value: 'id' |
|
|
|
] |
|
|
|
}, |
|
|
|
}, |
|
|
|
teacherForm: { |
|
|
|
{ |
|
|
|
accountId: "", |
|
|
|
id: 2, |
|
|
|
account: "", |
|
|
|
label: '品牌二', |
|
|
|
userName: "", |
|
|
|
children: [ |
|
|
|
roleValue: [], |
|
|
|
{ |
|
|
|
roleAndDeptList: [], |
|
|
|
id: 5, |
|
|
|
uniqueIdentification: "", |
|
|
|
label: '华东区域' |
|
|
|
workNumber: "", |
|
|
|
|
|
|
|
phone: "", |
|
|
|
|
|
|
|
email: "" |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
rules: { |
|
|
|
|
|
|
|
account: [ |
|
|
|
|
|
|
|
{ required: true, validator: accountPass, trigger: 'blur' } |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
userName: [ |
|
|
|
|
|
|
|
{ required: true, message: "请输入用户姓名", trigger: "blur" } |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
roleValue: [ |
|
|
|
|
|
|
|
{ required: true, message: "请选择账号角色", trigger: "change" } |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
workNumber: [ |
|
|
|
|
|
|
|
{ required: true, validator: workNumberPass , trigger: 'blur' } |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
uniqueIdentification: [ |
|
|
|
|
|
|
|
// { required: true, message: '请输入唯一标识', trigger: 'blur' }, |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
phone: [ |
|
|
|
|
|
|
|
// { required: true, 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})$/, |
|
|
|
id: 6, |
|
|
|
message: "请输入正确的邮箱", |
|
|
|
label: '华南区域' |
|
|
|
trigger: "blur" |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
], |
|
|
|
] |
|
|
|
}, |
|
|
|
}, |
|
|
|
accountReapeat: false, |
|
|
|
{ |
|
|
|
workNumberReapeat: false, |
|
|
|
id: 3, |
|
|
|
phoneRepeat: false, |
|
|
|
label: '品牌三', |
|
|
|
emailRepeat: false, |
|
|
|
children: [ |
|
|
|
|
|
|
|
{ |
|
|
|
listData: [], // 员工列表数据 |
|
|
|
id: 7, |
|
|
|
keyword: "", |
|
|
|
label: '华北区域' |
|
|
|
page: 1, |
|
|
|
}, |
|
|
|
pageSize: 10, |
|
|
|
{ |
|
|
|
total: 0, |
|
|
|
id: 8, |
|
|
|
multipleSelection: [], // 多选 |
|
|
|
label: '华南区域' |
|
|
|
|
|
|
|
} |
|
|
|
importVisible: false, // 批量导入对话框 |
|
|
|
] |
|
|
|
uploadList: [], // 上传文件列表 |
|
|
|
} |
|
|
|
uploadFaild: false, // 上传失败 |
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
gradeId: "", // 员工年级ID |
|
|
|
|
|
|
|
staffArchitectureId: "", // 员工部门ID |
|
|
|
|
|
|
|
submiting: false // 新增编辑员工防抖标识 |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
components: { |
|
|
|
components: { |
|
|
@ -225,36 +123,13 @@ export default { |
|
|
|
keyword: function(val) { |
|
|
|
keyword: function(val) { |
|
|
|
clearTimeout(this.searchTimer); |
|
|
|
clearTimeout(this.searchTimer); |
|
|
|
this.searchTimer = setTimeout(() => { |
|
|
|
this.searchTimer = setTimeout(() => { |
|
|
|
this.initData(); |
|
|
|
this.initData() |
|
|
|
}, 500); |
|
|
|
}, 500) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
mounted() {}, |
|
|
|
// this.getRoleData() |
|
|
|
|
|
|
|
// this.getData() |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
getSingle(data) { |
|
|
|
getData() { |
|
|
|
this.staffArchitectureId = data.gradeId ? '' : data.staffArchitectureId |
|
|
|
|
|
|
|
this.gradeId = data.gradeId || '' |
|
|
|
|
|
|
|
this.initData() |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
getCheck(data) { |
|
|
|
|
|
|
|
const marjorIds = [] |
|
|
|
|
|
|
|
const depIds = [] |
|
|
|
|
|
|
|
data.forEach(e => { |
|
|
|
|
|
|
|
e.gradeId ? depIds.push(e.gradeId) : marjorIds.push(e.staffArchitectureId) |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.staffArchitectureId = marjorIds.toString() |
|
|
|
|
|
|
|
this.gradeId = depIds.toString() |
|
|
|
|
|
|
|
this.initData() |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
initData() { |
|
|
|
|
|
|
|
this.$refs.table.clearSelection() |
|
|
|
|
|
|
|
this.page = 1 |
|
|
|
|
|
|
|
this.getData() |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
getData() { // 获取员工列表数据 |
|
|
|
|
|
|
|
let data = { |
|
|
|
let data = { |
|
|
|
keyWord: this.keyword, |
|
|
|
keyWord: this.keyword, |
|
|
|
pageNum: this.page, |
|
|
|
pageNum: this.page, |
|
|
@ -267,236 +142,21 @@ export default { |
|
|
|
this.total = res.page.total; |
|
|
|
this.total = res.page.total; |
|
|
|
}).catch(res => {}); |
|
|
|
}).catch(res => {}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
getRoleData() { // 获取角色数据 |
|
|
|
initData() { |
|
|
|
this.roleList =[]; |
|
|
|
this.$refs.table.clearSelection() |
|
|
|
this.$get(`${this.api.roleList}?page=1&size=100&name=&platformId=1`).then(res => { |
|
|
|
this.page = 1 |
|
|
|
for(var i=0;i<res.rolePage.records.length;i++){ |
|
|
|
this.getData() |
|
|
|
if (res.rolePage.records[i].roleName == '超级管理员'){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
this.roleList.push(res.rolePage.records[i]) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// this.roleList = res.rolePage.records; |
|
|
|
|
|
|
|
}).catch(res => {}); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
closeTeacher() { // 关闭新增/编辑员工对话框 |
|
|
|
|
|
|
|
this.teacherForm = { |
|
|
|
|
|
|
|
accountId: "", |
|
|
|
|
|
|
|
account: "", |
|
|
|
|
|
|
|
userName: "", |
|
|
|
|
|
|
|
roleValue: [], |
|
|
|
|
|
|
|
roleAndDeptList: [], |
|
|
|
|
|
|
|
uniqueIdentification: "", |
|
|
|
|
|
|
|
workNumber: "", |
|
|
|
|
|
|
|
phone: "", |
|
|
|
|
|
|
|
email: "" |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
this.$refs.teacherForm.clearValidate(); |
|
|
|
|
|
|
|
this.teacherVisible = false; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
addTeacher() { // 新增员工 |
|
|
|
|
|
|
|
this.isDetail = false; |
|
|
|
|
|
|
|
this.isAdd = true; |
|
|
|
|
|
|
|
this.teacherVisible = true; |
|
|
|
|
|
|
|
this.orgList = this.$refs.org.orgList; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
getStaffDetail(accountId) { // 获取员工详情 |
|
|
|
|
|
|
|
this.$get(`${this.api.staffDetail}?accountId=${accountId}`).then(res => { |
|
|
|
|
|
|
|
let { data } = res; |
|
|
|
|
|
|
|
this.teacherForm = data; |
|
|
|
|
|
|
|
this.teacherForm.roleValue = data.roleAndDeptList.map(i => i.roleId); |
|
|
|
|
|
|
|
this.teacherForm.roleAndDeptList = data.roleAndDeptList.map(i => { |
|
|
|
|
|
|
|
i.cascaderValue = [i.staffArchitectureId, i.gradeId] |
|
|
|
|
|
|
|
return i; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
console.log(22, this.teacherForm) |
|
|
|
|
|
|
|
}).catch(res => {}); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
resetPassword(row) { // 重置密码 |
|
|
|
|
|
|
|
this.$confirm(`重置后的密码为:${Setting.initialPassword},确定重置?`, "提示", { type: "warning" }).then(() => { |
|
|
|
|
|
|
|
this.$get(`${this.api.resetPassword}?userId=${row.userId}&newPwd=111aaa`).then(res => { |
|
|
|
|
|
|
|
this.$message.success("重置成功"); |
|
|
|
|
|
|
|
}).catch(res => { |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}).catch(() => { |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
editTeacher(row) { // 处理编辑 |
|
|
|
|
|
|
|
this.isDetail = false; |
|
|
|
|
|
|
|
this.isAdd = false; |
|
|
|
|
|
|
|
this.teacherVisible = true; |
|
|
|
|
|
|
|
this.orgList = this.$refs.org.orgList; |
|
|
|
|
|
|
|
this.getStaffDetail(row.accountId); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
showTeacher(row) { // 处理查看 |
|
|
|
|
|
|
|
this.isDetail = true; |
|
|
|
|
|
|
|
this.isAdd = false; |
|
|
|
|
|
|
|
this.teacherVisible = true; |
|
|
|
|
|
|
|
this.orgList = this.$refs.org.orgList; |
|
|
|
|
|
|
|
this.getStaffDetail(row.accountId); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
accountChange() { // 切换账号 |
|
|
|
|
|
|
|
if (this.teacherForm.account) { |
|
|
|
|
|
|
|
let url = ""; |
|
|
|
|
|
|
|
if (this.isAdd) { |
|
|
|
|
|
|
|
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=${Setting.platformType}&account=${this.teacherForm.account}&workNumber=`; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=${Setting.platformType}&accountId=${this.teacherForm.accountId}&account=${this.teacherForm.account}&workNumber=`; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.$post(url).then(res => { |
|
|
|
|
|
|
|
if (res.status === 200) { |
|
|
|
|
|
|
|
this.accountReapeat = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}).catch( err => { |
|
|
|
|
|
|
|
this.accountReapeat = true; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
workNumberChange() { // 切换工号 |
|
|
|
|
|
|
|
if (this.teacherForm.workNumber) { |
|
|
|
|
|
|
|
let url = ""; |
|
|
|
|
|
|
|
if (this.isAdd) { |
|
|
|
|
|
|
|
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=${Setting.platformType}&workNumber=${this.teacherForm.workNumber}&account=`; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=${Setting.platformType}&accountId=${this.teacherForm.accountId}&workNumber=${this.teacherForm.workNumber}&account=`; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.$post(url).then(res => { |
|
|
|
|
|
|
|
if (res.status === 200) { |
|
|
|
|
|
|
|
this.workNumberReapeat = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}).catch( err => { |
|
|
|
|
|
|
|
this.workNumberReapeat = true; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
phoneChange() { // 切换手机号 |
|
|
|
|
|
|
|
let regex = /^1[3456789]\d{9}$/; |
|
|
|
|
|
|
|
if (regex.test(this.teacherForm.phone)) { |
|
|
|
|
|
|
|
let url = ""; |
|
|
|
|
|
|
|
if (this.isAdd) { |
|
|
|
|
|
|
|
url = `${this.api.checkEmailOrPhone}?phone=${this.teacherForm.phone}&email=`; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
url = `${this.api.checkEmailOrPhone}?accountId=${this.teacherForm.accountId}&phone=${this.teacherForm.phone}&email=`; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.$post(url).then(res => { |
|
|
|
|
|
|
|
if (res.status === 200) { |
|
|
|
|
|
|
|
this.phoneRepeat = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}).catch( err => { |
|
|
|
|
|
|
|
this.phoneRepeat = true; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
emailChange() { // 切换邮箱 |
|
|
|
|
|
|
|
let regex = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/; |
|
|
|
|
|
|
|
if (regex.test(this.teacherForm.email)) { |
|
|
|
|
|
|
|
let url = ""; |
|
|
|
|
|
|
|
if (this.isAdd) { |
|
|
|
|
|
|
|
url = `${this.api.checkEmailOrPhone}?email=${this.teacherForm.email}&phone=`; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
url = `${this.api.checkEmailOrPhone}?accountId=${this.teacherForm.accountId}&email=${this.teacherForm.email}&phone=`; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.$post(url).then(res => { |
|
|
|
|
|
|
|
if (res.status === 200) { |
|
|
|
|
|
|
|
this.emailRepeat = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}).catch( err => { |
|
|
|
|
|
|
|
this.emailRepeat = true; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
roleChange(value) { // 处理切换角色 |
|
|
|
|
|
|
|
console.log(this.teacherForm.roleValue) |
|
|
|
|
|
|
|
if (value.length) { |
|
|
|
|
|
|
|
let ids = this.teacherForm.roleAndDeptList.map(e => e.roleId); |
|
|
|
|
|
|
|
this.roleList.forEach(i => { |
|
|
|
|
|
|
|
let obj = { |
|
|
|
|
|
|
|
roleId: "", |
|
|
|
|
|
|
|
roleName: "", |
|
|
|
|
|
|
|
cascaderValue: [] |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
if (value.includes(i.id) && !ids.includes(i.id)) { |
|
|
|
|
|
|
|
console.log(i) |
|
|
|
|
|
|
|
obj.roleId = i.id; |
|
|
|
|
|
|
|
obj.roleName = i.roleName; |
|
|
|
|
|
|
|
this.teacherForm.roleAndDeptList.push(obj); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.teacherForm.roleAndDeptList.splice(0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
roleRemove(value) { // 处理移除角色 |
|
|
|
// 导入模型 |
|
|
|
let list = []; |
|
|
|
add() { |
|
|
|
for(var i=0;i<this.teacherForm.roleAndDeptList.length;i++){ |
|
|
|
this.modelVisible = true |
|
|
|
if (this.teacherForm.roleAndDeptList[i].roleId == value){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
list.push(this.teacherForm.roleAndDeptList[i]) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.teacherForm.roleAndDeptList = list |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
async saveSure(teacherForm) { |
|
|
|
// 查看模型 |
|
|
|
this.$refs[teacherForm].validate((valid) => { |
|
|
|
show(row) { |
|
|
|
if (valid) { |
|
|
|
this.modelVisible = true |
|
|
|
if (this.submiting) return false |
|
|
|
|
|
|
|
if (this.accountReapeat) return this.$message.warning("该账号已存在"); |
|
|
|
|
|
|
|
if (this.workNumberReapeat) return this.$message.warning("该员工工号已存在"); |
|
|
|
|
|
|
|
if (this.phoneRepeat) return this.$message.warning("该手机号已存在"); |
|
|
|
|
|
|
|
if (this.emailRepeat) return this.$message.warning("该邮箱已存在"); |
|
|
|
|
|
|
|
let data = { |
|
|
|
|
|
|
|
accountId: this.teacherForm.accountId, |
|
|
|
|
|
|
|
account: this.teacherForm.account, |
|
|
|
|
|
|
|
userName: this.teacherForm.userName, |
|
|
|
|
|
|
|
roleAndDeptList: [], |
|
|
|
|
|
|
|
uniqueIdentification: this.teacherForm.uniqueIdentification ? this.teacherForm.uniqueIdentification : new Date().getTime(), |
|
|
|
|
|
|
|
workNumber: this.teacherForm.workNumber, |
|
|
|
|
|
|
|
phone: this.teacherForm.phone, |
|
|
|
|
|
|
|
email: this.teacherForm.email |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
if (this.teacherForm.roleAndDeptList.length){ |
|
|
|
|
|
|
|
for (let i = 0; i < this.teacherForm.roleAndDeptList.length; i++) { |
|
|
|
|
|
|
|
if (this.teacherForm.roleAndDeptList[i].cascaderValue.length < 2) { |
|
|
|
|
|
|
|
this.$message.warning(`请选择${this.teacherForm.roleAndDeptList[i].roleName}所属部门`) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
let obj = { |
|
|
|
|
|
|
|
roleId: this.teacherForm.roleAndDeptList[i].roleId, |
|
|
|
|
|
|
|
staffArchitectureId: this.teacherForm.roleAndDeptList[i].cascaderValue[0], |
|
|
|
|
|
|
|
gradeId: this.teacherForm.roleAndDeptList[i].cascaderValue[1] |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
data.roleAndDeptList.push(obj); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.submiting = true |
|
|
|
|
|
|
|
if (this.teacherForm.accountId) { |
|
|
|
|
|
|
|
this.$post(this.api.modifyStaff, data).then(res => { |
|
|
|
|
|
|
|
this.$message.success("编辑成功"); |
|
|
|
|
|
|
|
this.closeTeacher(); |
|
|
|
|
|
|
|
this.getData(); |
|
|
|
|
|
|
|
this.submiting = false |
|
|
|
|
|
|
|
}).catch(res => { |
|
|
|
|
|
|
|
this.submiting = false |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.$post(this.api.saveStaff, data).then(res => { |
|
|
|
|
|
|
|
this.$message.success("添加成功"); |
|
|
|
|
|
|
|
this.closeTeacher(); |
|
|
|
|
|
|
|
this.getData(); |
|
|
|
|
|
|
|
this.submiting = false |
|
|
|
|
|
|
|
}).catch(res => { |
|
|
|
|
|
|
|
this.submiting = false |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
delTeacher(row) { |
|
|
|
// 删除模型 |
|
|
|
|
|
|
|
del(row) { |
|
|
|
this.$confirm("确定要删除吗?", "提示", { |
|
|
|
this.$confirm("确定要删除吗?", "提示", { |
|
|
|
type: "warning" |
|
|
|
type: "warning" |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
@ -507,11 +167,11 @@ export default { |
|
|
|
}).catch(() => {}); |
|
|
|
}).catch(() => {}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleSelectionChange(val) { |
|
|
|
handleSelectionChange(val) { |
|
|
|
this.multipleSelection = val; |
|
|
|
this.multipleSelection = val |
|
|
|
}, |
|
|
|
}, |
|
|
|
delAllSelection() { |
|
|
|
|
|
|
|
if (this.multipleSelection.length) { |
|
|
|
|
|
|
|
// 批量删除 |
|
|
|
// 批量删除 |
|
|
|
|
|
|
|
batchDel() { |
|
|
|
|
|
|
|
if (this.multipleSelection.length) { |
|
|
|
this.$confirm("确定要删除吗?", "提示", { |
|
|
|
this.$confirm("确定要删除吗?", "提示", { |
|
|
|
type: "warning" |
|
|
|
type: "warning" |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
@ -528,66 +188,16 @@ export default { |
|
|
|
}).catch(() => { |
|
|
|
}).catch(() => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.$message.error("请先选择员工 !"); |
|
|
|
this.$message.error("请先选择模型 !"); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
batchImport() { |
|
|
|
|
|
|
|
this.importVisible = true; |
|
|
|
|
|
|
|
this.uploadList = []; |
|
|
|
|
|
|
|
this.uploadFaild = false; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
searchTeacher() { |
|
|
|
|
|
|
|
this.page = 1; |
|
|
|
|
|
|
|
this.getData(); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
handleCurrentChange(val) { |
|
|
|
handleCurrentChange(val) { |
|
|
|
this.page = val; |
|
|
|
this.page = val |
|
|
|
this.getData(); |
|
|
|
this.getData() |
|
|
|
}, |
|
|
|
|
|
|
|
downLoad() { |
|
|
|
|
|
|
|
location.href = this.api.staffTemplate; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
showFaild() { |
|
|
|
|
|
|
|
location.href = `${this.api.exportFailureStaff}?exportCode=${this.exportCode}`; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 上传文件 |
|
|
|
|
|
|
|
handleExceed(files, fileList) { |
|
|
|
|
|
|
|
this.$message.warning( |
|
|
|
|
|
|
|
`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!` |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
uploadSuccess(res, file, fileList) { |
|
|
|
|
|
|
|
console.log(res); |
|
|
|
|
|
|
|
this.uploadFaild = false; |
|
|
|
|
|
|
|
if (res.status === 200) { |
|
|
|
|
|
|
|
if (res.data.exportCode) { |
|
|
|
|
|
|
|
this.exportCode = res.data.exportCode; |
|
|
|
|
|
|
|
this.uploadFaild = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.$message.success(`上传成功${res.data.successNum},上传失败${res.data.failureNum}`); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
res.message ? this.$message.error(res.message) : this.$message.error("上传失败,请检查数据"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
uploadError(err, file, fileList) { |
|
|
|
|
|
|
|
this.$message({ |
|
|
|
|
|
|
|
message: "上传出错,请重试!", |
|
|
|
|
|
|
|
type: "error", |
|
|
|
|
|
|
|
center: true |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
beforeRemove(file, fileList) { |
|
|
|
|
|
|
|
return this.$confirm(`确定移除 ${file.name}?`); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
handleRemove(file, fileList) { |
|
|
|
|
|
|
|
this.uploadList = fileList; |
|
|
|
|
|
|
|
this.uploadFaild = false; |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
uploadSure() { |
|
|
|
// 导入模型提交 |
|
|
|
this.importVisible = false; |
|
|
|
submit() { |
|
|
|
this.page = 1; |
|
|
|
|
|
|
|
this.keyword = ""; |
|
|
|
|
|
|
|
this.getData(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|