From 41edd210f4f52ec3328da024f446216e01d8b23b Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期一, 03 三月 2025 15:29:42 +0800
Subject: [PATCH] 修改系统管理bug
---
src/components/Table/lims-table.vue | 3
src/views/system/role/index.vue | 2
src/views/system/user/index.vue | 7
src/api/system/user.js | 168 ++++++++++++++++----------------
src/views/system/dept/index.vue | 106 +++++++-------------
5 files changed, 131 insertions(+), 155 deletions(-)
diff --git a/src/api/system/user.js b/src/api/system/user.js
index 8ecfc5a..752aa45 100644
--- a/src/api/system/user.js
+++ b/src/api/system/user.js
@@ -1,191 +1,191 @@
-import request from '@/utils/request'
+import request from "@/utils/request";
import { parseStrEmpty } from "@/utils/ruoyi";
// 鏌ヨ鐢ㄦ埛鍒楄〃
export function listUser(query) {
return request({
- url: '/system/user/list',
- method: 'get',
- params: query
- })
+ url: "/system/user/list",
+ method: "get",
+ params: query,
+ });
}
// 鏌ヨ鐢ㄦ埛璇︾粏
export function getUser(userId) {
return request({
- url: '/system/user/' + parseStrEmpty(userId),
- method: 'get'
- })
+ url: "/system/user/" + parseStrEmpty(userId),
+ method: "get",
+ });
}
// 鏂板鐢ㄦ埛
export function addUser(data) {
return request({
- url: '/system/user',
- method: 'post',
- data: data
- })
+ url: "/system/user",
+ method: "post",
+ data: data,
+ });
}
// 淇敼鐢ㄦ埛
export function updateUser(data) {
return request({
- url: '/system/user',
- method: 'put',
- data: data
- })
+ url: "/system/user",
+ method: "put",
+ data: data,
+ });
}
// 鍒犻櫎鐢ㄦ埛
export function delUser(userId) {
return request({
- url: '/system/user/' + userId,
- method: 'delete'
- })
+ url: "/system/user/" + userId,
+ method: "delete",
+ });
}
// 鐢ㄦ埛瀵嗙爜閲嶇疆
export function resetUserPwd(userId, password) {
const data = {
userId,
- password
- }
+ password,
+ };
return request({
- url: '/system/user/resetPwd',
- method: 'put',
- data: data
- })
+ url: "/system/user/resetPwd",
+ method: "put",
+ data: data,
+ });
}
// 鐢ㄦ埛鐘舵�佷慨鏀�
export function changeUserStatus(userId, status) {
const data = {
userId,
- status
- }
+ status,
+ };
return request({
- url: '/system/user/changeStatus',
- method: 'put',
- data: data
- })
+ url: "/system/user/changeStatus",
+ method: "put",
+ data: data,
+ });
}
// 鏌ヨ鐢ㄦ埛涓汉淇℃伅
export function getUserProfile() {
return request({
- url: '/system/user/profile',
- method: 'get'
- })
+ url: "/system/user/profile",
+ method: "get",
+ });
}
// 淇敼鐢ㄦ埛涓汉淇℃伅
export function updateUserProfile(data) {
return request({
- url: '/system/user/profile',
- method: 'put',
- data: data
- })
+ url: "/system/user/profile",
+ method: "put",
+ data: data,
+ });
}
// 鐢ㄦ埛瀵嗙爜閲嶇疆
export function updateUserPwd(oldPassword, newPassword) {
const data = {
oldPassword,
- newPassword
- }
+ newPassword,
+ };
return request({
- url: '/system/user/profile/updatePwd',
- method: 'put',
- data: data
- })
+ url: "/system/user/profile/updatePwd",
+ method: "put",
+ data: data,
+ });
}
// 鐢ㄦ埛澶村儚涓婁紶
export function uploadAvatar(data) {
return request({
- url: '/system/user/profile/avatar',
- method: 'post',
- headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
- data: data
- })
+ url: "/system/user/profile/avatar",
+ method: "post",
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
+ data: data,
+ });
}
// 鏌ヨ鎺堟潈瑙掕壊
export function getAuthRole(userId) {
return request({
- url: '/system/user/authRole/' + userId,
- method: 'get'
- })
+ url: "/system/user/authRole/" + userId,
+ method: "get",
+ });
}
// 淇濆瓨鎺堟潈瑙掕壊
export function updateAuthRole(data) {
return request({
- url: '/system/user/authRole',
- method: 'put',
- params: data
- })
+ url: "/system/user/authRole",
+ method: "put",
+ params: data,
+ });
}
// 鏌ヨ閮ㄩ棬涓嬫媺鏍戠粨鏋�
export function deptTreeSelect() {
return request({
- url: '/system/user/deptTree',
- method: 'get'
- })
+ url: "/system/user/deptTree",
+ method: "get",
+ });
}
// 鑾峰彇浜轰簨绯荤粺缁勭粐
export function selectCompaniesList() {
return request({
- url: '/companies/selectCompaniesList',
- method: 'get'
- })
+ url: "/companies/selectCompaniesList",
+ method: "get",
+ });
}
// 鑾峰彇浜轰簨绯荤粺缁勭粐涓嬬殑浜哄憳
export function selectSimpleList(data) {
return request({
- url: '/companies/selectSimpleList',
- method: 'post',
- params: data
- })
+ url: "/companies/selectSimpleList",
+ method: "post",
+ params: data,
+ });
}
// 鑾峰彇浜轰簨绯荤粺缁勭粐涓嬬殑浜哄憳
export function addPersonUser(data) {
return request({
- url: '/companies/addPersonUser',
- method: 'post',
- params: data
- })
+ url: "/companies/addPersonUser",
+ method: "post",
+ params: data,
+ });
}
// 鑾峰彇瑙掕壊
export function selectRoleList() {
return request({
- url: '/role/selectRoleList',
- method: 'get',
- })
+ url: "/role/selectRoleList",
+ method: "get",
+ });
}
// 鑾峰彇鍗曚綅
export function selectCustomEnum() {
return request({
- url: '/system/custom/selectCustomEnum',
- method: 'get',
- })
+ url: "/system/custom/selectCustomEnum",
+ method: "get",
+ });
}
// 鎻愪氦娣诲姞鏋舵瀯淇℃伅
-export function addDepartment(params) {
+export function addDepartment(data) {
return request({
- url: '/department/addDepartment',
- method: 'post',
- params: params
- })
+ url: "/department/addDepartment",
+ method: "post",
+ data: data,
+ });
}
// 鑾峰彇褰撳墠鐧诲綍浜哄憳閮ㄩ棬
export function selectUserDepartmentLimsName(query) {
return request({
- url: '/system/newUser/selectUserDepartmentLimsName',
- method: 'get'
- })
+ url: "/system/newUser/selectUserDepartmentLimsName",
+ method: "get",
+ });
}
// 鑾峰彇鐢ㄦ埛鍒楄〃
export function selectUserCondition(query) {
diff --git a/src/components/Table/lims-table.vue b/src/components/Table/lims-table.vue
index abe65a0..1ca2022 100644
--- a/src/components/Table/lims-table.vue
+++ b/src/components/Table/lims-table.vue
@@ -31,7 +31,8 @@
</div>
<!-- 鍥剧墖 -->
<div v-else-if="item.dataType == 'image'">
- <img :src="javaApi + '/img/' + item.prop" alt="" style="width: 40px; height: 40px; margin-top: 10px" />
+ <img :src="javaApi + '/img/' + scope.row[item.prop]" alt=""
+ style="width: 40px; height: 40px; margin-top: 10px" />
</div>
<!-- tag -->
diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue
index 2483a2b..fa71608 100644
--- a/src/views/system/dept/index.vue
+++ b/src/views/system/dept/index.vue
@@ -2,21 +2,12 @@
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
<el-form-item label="閮ㄩ棬鍚嶇О" prop="deptName">
- <el-input
- v-model="queryParams.deptName"
- placeholder="璇疯緭鍏ラ儴闂ㄥ悕绉�"
- clearable
- @keyup.enter.native="handleQuery"
- />
+ <el-input v-model="queryParams.deptName" placeholder="璇疯緭鍏ラ儴闂ㄥ悕绉�" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="鐘舵��" prop="status">
<el-select v-model="queryParams.status" placeholder="閮ㄩ棬鐘舵��" clearable>
- <el-option
- v-for="dict in dict.type.sys_normal_disable"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- />
+ <el-option v-for="dict in dict.type.sys_normal_disable" :key="dict.value" :label="dict.label"
+ :value="dict.value" />
</el-select>
</el-form-item>
<el-form-item>
@@ -27,40 +18,22 @@
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
- <el-button
- type="primary"
- plain
- icon="el-icon-plus"
- size="mini"
- @click="handleAdd"
- v-hasPermi="['system:dept:add']"
- >鏂板</el-button>
+ <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
+ v-hasPermi="['system:dept:add']">鏂板</el-button>
</el-col>
<el-col :span="1.5">
- <el-button
- type="info"
- plain
- icon="el-icon-sort"
- size="mini"
- @click="toggleExpandAll"
- >灞曞紑/鎶樺彔</el-button>
+ <el-button type="info" plain icon="el-icon-sort" size="mini" @click="toggleExpandAll">灞曞紑/鎶樺彔</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
- <el-table
- v-if="refreshTable"
- v-loading="loading"
- :data="deptList"
- row-key="deptId"
- :default-expand-all="isExpandAll"
- :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
- >
+ <el-table v-if="refreshTable" v-loading="loading" :data="deptList" row-key="deptId"
+ :default-expand-all="isExpandAll" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
<el-table-column prop="deptName" label="閮ㄩ棬鍚嶇О" width="260"></el-table-column>
<el-table-column prop="orderNum" label="鎺掑簭" width="200"></el-table-column>
<el-table-column prop="status" label="鐘舵��" width="100">
<template slot-scope="scope">
- <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
+ <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" width="200">
@@ -70,28 +43,12 @@
</el-table-column>
<el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
- <el-button
- size="mini"
- type="text"
- icon="el-icon-edit"
- @click="handleUpdate(scope.row)"
- v-hasPermi="['system:dept:edit']"
- >淇敼</el-button>
- <el-button
- size="mini"
- type="text"
- icon="el-icon-plus"
- @click="handleAdd(scope.row)"
- v-hasPermi="['system:dept:add']"
- >鏂板</el-button>
- <el-button
- v-if="scope.row.parentId != 0"
- size="mini"
- type="text"
- icon="el-icon-delete"
- @click="handleDelete(scope.row)"
- v-hasPermi="['system:dept:remove']"
- >鍒犻櫎</el-button>
+ <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
+ v-hasPermi="['system:dept:edit']">淇敼</el-button>
+ <el-button size="mini" type="text" icon="el-icon-plus" @click="handleAdd(scope.row)"
+ v-hasPermi="['system:dept:add']">鏂板</el-button>
+ <el-button v-if="scope.row.parentId != 0" size="mini" type="text" icon="el-icon-delete"
+ @click="handleDelete(scope.row)" v-hasPermi="['system:dept:remove']">鍒犻櫎</el-button>
</template>
</el-table-column>
</el-table>
@@ -102,7 +59,8 @@
<el-row>
<el-col :span="24" v-if="form.parentId !== 0">
<el-form-item label="涓婄骇閮ㄩ棬" prop="parentId">
- <treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="閫夋嫨涓婄骇閮ㄩ棬" />
+ <treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer"
+ placeholder="閫夋嫨涓婄骇閮ㄩ棬" />
</el-form-item>
</el-col>
</el-row>
@@ -139,11 +97,9 @@
<el-col :span="12">
<el-form-item label="閮ㄩ棬鐘舵��">
<el-radio-group v-model="form.status">
- <el-radio
- v-for="dict in dict.type.sys_normal_disable"
- :key="dict.value"
- :label="dict.value"
- >{{dict.label}}</el-radio>
+ <el-radio v-for="dict in dict.type.sys_normal_disable" :key="dict.value" :label="dict.value">{{
+ dict.label
+ }}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
@@ -280,6 +236,7 @@
this.title = "娣诲姞閮ㄩ棬";
listDept().then(response => {
this.deptOptions = this.handleTree(response.data, "deptId");
+ this.deptOptions = this.limitTreeDepth(this.deptOptions, 2)
});
},
/** 灞曞紑/鎶樺彔鎿嶄綔 */
@@ -303,11 +260,12 @@
const noResultsOptions = { deptId: this.form.parentId, deptName: this.form.parentName, children: [] };
this.deptOptions.push(noResultsOptions);
}
+ this.deptOptions = this.limitTreeDepth(this.deptOptions, 2)
});
});
},
/** 鎻愪氦鎸夐挳 */
- submitForm: function() {
+ submitForm: function () {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.deptId != undefined) {
@@ -328,12 +286,26 @@
},
/** 鍒犻櫎鎸夐挳鎿嶄綔 */
handleDelete(row) {
- this.$modal.confirm('鏄惁纭鍒犻櫎鍚嶇О涓�"' + row.deptName + '"鐨勬暟鎹」锛�').then(function() {
+ this.$modal.confirm('鏄惁纭鍒犻櫎鍚嶇О涓�"' + row.deptName + '"鐨勬暟鎹」锛�').then(function () {
return delDept(row.deptId);
}).then(() => {
this.getList();
this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
- }).catch(() => {});
+ }).catch(() => { });
+ },
+ // 閫掑綊鍑芥暟锛岀敤浜庨檺鍒舵爲鐨勬繁搴�
+ limitTreeDepth(options, maxDepth, currentDepth = 1) {
+ return options.map(option => {
+ const newOption = { ...option };
+ if (currentDepth < maxDepth && option.children) {
+ // 濡傛灉褰撳墠娣卞害灏忎簬鏈�澶ф繁搴︿笖瀛樺湪瀛愯妭鐐癸紝鍒欓�掑綊澶勭悊瀛愯妭鐐�
+ newOption.children = this.limitTreeDepth(option.children, maxDepth, currentDepth + 1);
+ } else {
+ // 鍚﹀垯绉婚櫎瀛愯妭鐐�
+ delete newOption.children;
+ }
+ return newOption;
+ });
}
}
};
diff --git a/src/views/system/role/index.vue b/src/views/system/role/index.vue
index 93de712..853e45e 100644
--- a/src/views/system/role/index.vue
+++ b/src/views/system/role/index.vue
@@ -403,6 +403,8 @@
handleCheckedTreeConnect(value, type) {
if (type == 'menu') {
this.form.menuCheckStrictly = value ? true : false;
+ this.menuNodeAll = false
+ this.$refs.menu.setCheckedNodes([]);
} else if (type == 'dept') {
this.form.deptCheckStrictly = value ? true : false;
}
diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue
index 95dc281..0d8450a 100644
--- a/src/views/system/user/index.vue
+++ b/src/views/system/user/index.vue
@@ -8,8 +8,8 @@
<div class="head-container addButton">
<el-input v-model="deptName" placeholder="閮ㄩ棬鍚嶇О" clearable size="small" prefix-icon="el-icon-search"
style="margin-bottom: 20px" />
- <el-button style="margin-left: 4px" type="primary" plain icon="el-icon-plus" size="mini" circle
- @click="addSchema"></el-button>
+ <!-- <el-button style="margin-left: 4px" type="primary" plain icon="el-icon-plus" size="mini" circle
+ @click="addSchema"></el-button> -->
</div>
<div class="head-container">
<el-tree :data="deptOptions" :props="defaultProps" :expand-on-click-node="false"
@@ -149,7 +149,8 @@
</el-col>
<el-col :span="12">
<el-form-item label="褰掑睘閮ㄩ棬" prop="deptId">
- <treeselect v-model="form.deptId" :options="enabledDeptOptions" :show-count="true" placeholder="璇烽�夋嫨褰掑睘閮ㄩ棬" />
+ <treeselect v-model="form.deptId" :options="enabledDeptOptions" :show-count="true"
+ placeholder="璇烽�夋嫨褰掑睘閮ㄩ棬" />
</el-form-item>
</el-col>
</el-row>
--
Gitblit v1.9.3