From f86f41ccbec7527c24d4b22800841ed0df4bc09c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=AE=B8=E5=85=81=E6=9E=9E?= <3422692813@qq.com>
Date: Thu, 6 Feb 2025 09:13:03 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=A3=80=E6=B5=8B=E5=91=98?=
=?UTF-8?q?=E5=B7=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/inspection/staff/api/staff.js | 18 ++++
src/views/inspection/staff/index.vue | 136 +++++++++++++-----------
2 files changed, 91 insertions(+), 63 deletions(-)
diff --git a/src/views/inspection/staff/api/staff.js b/src/views/inspection/staff/api/staff.js
index bb22652..8ac482f 100644
--- a/src/views/inspection/staff/api/staff.js
+++ b/src/views/inspection/staff/api/staff.js
@@ -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) {
diff --git a/src/views/inspection/staff/index.vue b/src/views/inspection/staff/index.vue
index 9d66722..a68a15f 100644
--- a/src/views/inspection/staff/index.vue
+++ b/src/views/inspection/staff/index.vue
@@ -74,11 +74,11 @@
@change="handleStatusChange(scope.row)"/>
-
-
- {{ parseTime(scope.row.createTime) }}
-
-
+
+
+
+
+
-
+
@@ -105,10 +105,11 @@
-
-
-
+
+
+
+
+
@@ -124,18 +125,18 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -151,13 +152,13 @@
-
+
@@ -212,22 +213,24 @@
v-model="form.driverLicenseTypeArr" placeholder="请选择">
+ :value="dict.id"/>
-
-
-
+
+
+
+
-
-
-
-
-
+
+
+
+
@@ -238,8 +241,8 @@
-
-
+
+
{
// 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) {