更新检测员工
This commit is contained in:
parent
02d548f8df
commit
f86f41ccbe
@ -41,6 +41,14 @@ export function addUser(data) {
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 新增用户
|
||||
export function permissionAssign(data) {
|
||||
return request({
|
||||
url: '/system/permission/assign-user-role',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改用户
|
||||
export function updateUser(data) {
|
||||
@ -102,6 +110,16 @@ export function getUserProfile() {
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
// 查询检测岗位
|
||||
export function getPost() {
|
||||
return request({
|
||||
url: '/system/role/pageByQuery',
|
||||
params:{
|
||||
servicePackageId:'jiance'
|
||||
},
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 修改用户个人信息
|
||||
export function updateUserProfile(data) {
|
||||
|
@ -74,11 +74,11 @@
|
||||
@change="handleStatusChange(scope.row)"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[6].visible" width="160">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[6].visible" width="160">-->
|
||||
<!-- <template v-slot="scope">-->
|
||||
<!-- <span>{{ parseTime(scope.row.createTime) }}</span>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width">
|
||||
<template v-slot="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
||||
@ -97,7 +97,7 @@
|
||||
</el-row>
|
||||
|
||||
<!-- 添加或修改参数配置对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
|
||||
<el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
@ -105,10 +105,11 @@
|
||||
<el-input v-model="form.nickname" placeholder="请输入员工名称"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="归属部门" prop="deptId">
|
||||
<treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" :clearable="false"
|
||||
placeholder="请选择归属部门" />
|
||||
<el-col :span="12" v-if="isInsert">
|
||||
<el-form-item label="归属部门" prop="postId">
|
||||
<el-select v-model="form.postId" placeholder="请选择归属部门" filterable >
|
||||
<el-option v-for="item in postOptions" :key="item.id" :label="item.name" :value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -124,18 +125,18 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item v-if="form.id === undefined" label="员工账号" prop="username">
|
||||
<el-input v-model="form.username" placeholder="请输入员工账号"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item v-if="form.id === undefined" label="用户密码" prop="password">
|
||||
<el-input v-model="form.password" placeholder="请输入用户密码" type="password" show-password/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- <el-row>-->
|
||||
<!-- <el-col :span="12">-->
|
||||
<!-- <el-form-item v-if="form.id === undefined" label="员工账号" prop="username">-->
|
||||
<!-- <el-input v-model="form.username" placeholder="请输入员工账号"/>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="12">-->
|
||||
<!-- <el-form-item v-if="form.id === undefined" label="用户密码" prop="password">-->
|
||||
<!-- <el-input v-model="form.password" placeholder="请输入用户密码" type="password" show-password/>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- </el-row>-->
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="身份证号码" prop="idCard">
|
||||
@ -151,13 +152,13 @@
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="学历" prop="educational">
|
||||
<!-- <el-input v-model="form.educational" placeholder="请输入学历"/>-->
|
||||
<!-- <el-input v-model="form.educational" placeholder="请输入学历"/>-->
|
||||
<el-select v-model="form.educational" placeholder="请选择学历">
|
||||
<el-option
|
||||
v-for="dict in educationOptions"
|
||||
:key="dict.value"
|
||||
:key="dict.label"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
:value="dict.label"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@ -212,22 +213,24 @@
|
||||
v-model="form.driverLicenseTypeArr" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="dict in driverLicenseTypeOptions" :key="dict.id" :label="dict.id"
|
||||
:value="dict.id"/>
|
||||
:value="dict.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col>
|
||||
<el-form-item label="试用期" prop="shortNumber">
|
||||
<el-input v-model="form.probationPeriod" placeholder="请输入试用期"/>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="社保购买日期" prop="socialSecurityBuyDate">
|
||||
<el-date-picker v-model="form.socialSecurityBuyDate" type="date" value-format="yyyy-MM-dd"
|
||||
placeholder="请选择社保购买日期"></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col>
|
||||
<el-form-item label="社保购买日期" prop="socialSecurityBuyDate">
|
||||
<el-date-picker v-model="form.socialSecurityBuyDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择社保购买日期"></el-date-picker>
|
||||
<el-col :span="1">
|
||||
<el-form-item label="转正时间" prop="shortNumber">
|
||||
<!-- <el-input v-model="form.probationPeriod" placeholder="请输入试用期"/>-->
|
||||
<el-date-picker v-model="form.probationPeriod" type="date" value-format="yyyy-MM-dd"
|
||||
placeholder="请选择试用期"></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -238,8 +241,8 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- 导入附件-->
|
||||
<el-row>
|
||||
<!-- 导入附件-->
|
||||
<el-row style="display: flex; justify-content: center;">
|
||||
<el-upload
|
||||
class="upload-demo"
|
||||
:action="imageUpload.url"
|
||||
@ -301,7 +304,7 @@ import {
|
||||
listUser,
|
||||
resetUserPwd,
|
||||
getDriverLicenseType,
|
||||
updateUser
|
||||
updateUser, getPost, permissionAssign
|
||||
} from "@/views/inspection/staff/api/staff";
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||
@ -346,11 +349,10 @@ export default {
|
||||
postOptions: [],
|
||||
// 角色选项
|
||||
roleOptions: [],
|
||||
// 学历数组
|
||||
educationOptions: getDictDatas("company_staff_edu"),
|
||||
isInsert: false,
|
||||
// 表单参数
|
||||
form: {
|
||||
driverLicenseTypeArr:[]
|
||||
driverLicenseTypeArr: []
|
||||
},
|
||||
defaultProps: {
|
||||
children: "children",
|
||||
@ -359,7 +361,7 @@ export default {
|
||||
// 文件列表
|
||||
fileList: [],
|
||||
// 驾驶证类型
|
||||
driverLicenseTypeOptions:[],
|
||||
driverLicenseTypeOptions: [],
|
||||
// 用户导入参数
|
||||
upload: {
|
||||
// 是否显示弹出层(用户导入)
|
||||
@ -395,7 +397,7 @@ export default {
|
||||
username: undefined,
|
||||
mobile: undefined,
|
||||
status: undefined,
|
||||
deptId: undefined,
|
||||
postId: undefined,
|
||||
createTime: []
|
||||
},
|
||||
// 列信息
|
||||
@ -428,6 +430,7 @@ export default {
|
||||
],
|
||||
mobile: [
|
||||
{
|
||||
required: true,
|
||||
pattern: /^(?:(?:\+|00)86)?1(?:3[\d]|4[5-79]|5[0-35-9]|6[5-7]|7[0-8]|8[\d]|9[189])\d{8}$/,
|
||||
message: "请输入正确的手机号码",
|
||||
trigger: "blur"
|
||||
@ -442,6 +445,8 @@ export default {
|
||||
// 数据字典
|
||||
statusDictDatas: getDictDatas(DICT_TYPE.COMMON_STATUS),
|
||||
sexDictDatas: getDictDatas(DICT_TYPE.SYSTEM_USER_SEX),
|
||||
// 学历数组
|
||||
educationOptions: getDictDatas(DICT_TYPE.COMPANY_STAFF_EDU),
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
@ -452,7 +457,7 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getTreeselect();
|
||||
// this.getTreeselect();
|
||||
this.getDriverLicenseType();
|
||||
// this.getConfigKey("sys.user.init-password").then(response => {
|
||||
// this.initPassword = response.msg;
|
||||
@ -488,19 +493,6 @@ export default {
|
||||
}
|
||||
);
|
||||
},
|
||||
/** 查询部门下拉树结构 + 岗位下拉 */
|
||||
getTreeselect() {
|
||||
listSimpleDepts().then(response => {
|
||||
// 处理 deptOptions 参数
|
||||
this.deptOptions = [];
|
||||
this.deptOptions.push(...this.handleTree(response.data, "id"));
|
||||
});
|
||||
listSimplePosts().then(response => {
|
||||
// 处理 postOptions 参数
|
||||
this.postOptions = [];
|
||||
this.postOptions.push(...response.data);
|
||||
});
|
||||
},
|
||||
// 查询驾驶证类型
|
||||
getDriverLicenseType() {
|
||||
getDriverLicenseType().then(response => {
|
||||
@ -514,7 +506,7 @@ export default {
|
||||
},
|
||||
// 节点单击事件
|
||||
handleNodeClick(data) {
|
||||
this.queryParams.deptId = data.id;
|
||||
this.queryParams.postId = data.id;
|
||||
this.getList();
|
||||
},
|
||||
// 用户状态修改
|
||||
@ -543,7 +535,7 @@ export default {
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
deptId: undefined,
|
||||
postId: undefined,
|
||||
username: undefined,
|
||||
nickname: undefined,
|
||||
password: undefined,
|
||||
@ -571,8 +563,9 @@ export default {
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.isInsert = true;
|
||||
// 获得下拉数据
|
||||
this.getTreeselect();
|
||||
this.getPostsByDeptId();
|
||||
// 打开表单,并设置初始化
|
||||
this.open = true;
|
||||
this.title = "添加用户";
|
||||
@ -581,8 +574,9 @@ export default {
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
// this.getTreeselect();
|
||||
this.getPostsByDeptId();
|
||||
const id = row.id;
|
||||
this.isInsert = false;
|
||||
getUser(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.fileList = this.form.fileList == null ? [] : this.form.fileList;
|
||||
@ -602,6 +596,13 @@ export default {
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
/** 获取检测岗位集合 */
|
||||
getPostsByDeptId() {
|
||||
getPost().then(response => {
|
||||
this.postOptions = response.data;
|
||||
this.form.postId = this.postOptions[0].id
|
||||
});
|
||||
},
|
||||
/** 分配用户角色操作 */
|
||||
handleRole(row) {
|
||||
this.reset();
|
||||
@ -638,11 +639,20 @@ export default {
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
this.form.username = this.form.mobile
|
||||
this.form.password = '123456'
|
||||
addUser(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
let roleIds = []
|
||||
roleIds.push(this.form.postId)
|
||||
let data = {
|
||||
userId: response.data,
|
||||
roleIds: roleIds
|
||||
}
|
||||
permissionAssign(data)
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -735,7 +745,7 @@ export default {
|
||||
handleRemove(file) {
|
||||
console.log(file);
|
||||
//在fileList中删除附件
|
||||
this.fileList.splice(this.fileList.indexOf(file), 1);
|
||||
this.fileList.splice(this.fileList.indexOf(file), 1);
|
||||
},
|
||||
handlePreview(file) {
|
||||
console.log(file);
|
||||
@ -744,7 +754,7 @@ export default {
|
||||
this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
|
||||
},
|
||||
beforeRemove(file, fileList) {
|
||||
return this.$confirm(`确定移除 ${ file.name }?`);
|
||||
return this.$confirm(`确定移除 ${file.name}?`);
|
||||
},
|
||||
// 文件上传成功处理
|
||||
handleFileSuccessAttachments(response, file, fileList) {
|
||||
|
Loading…
Reference in New Issue
Block a user