From 0c877ddfeb2674bf58af108168ee18fcf5bf704b Mon Sep 17 00:00:00 2001 From: haha Date: Sun, 1 Sep 2024 19:08:45 +0800 Subject: [PATCH] update code --- bin/run-auth.bat | 6 +- bin/run-gateway.bat | 6 +- bin/run-modules-file.bat | 6 +- bin/run-modules-gen.bat | 4 +- bin/run-modules-job.bat | 4 +- bin/run-modules-system.bat | 6 +- bin/run-monitor.bat | 4 +- bin/run.bat | 3 + .../com/yanzhu/system/api/domain/SysUser.java | 22 +- .../system/controller/SysRoleController.java | 2 +- .../yanzhu/system/domain/vo/TreeSelect.java | 13 + .../resources/mapper/system/SysUserMapper.xml | 9 +- yanzhu-ui-vue3/src/api/system/user.js | 11 +- .../src/views/system/user/index.vue | 610 ++++++++---------- 14 files changed, 341 insertions(+), 365 deletions(-) create mode 100644 bin/run.bat diff --git a/bin/run-auth.bat b/bin/run-auth.bat index 0d0952af..050c48c3 100644 --- a/bin/run-auth.bat +++ b/bin/run-auth.bat @@ -1,14 +1,14 @@ @echo off echo. -echo [信息] 使用Jar命令运行Auth工程。 +echo [锟斤拷息] 使锟斤拷Jar锟斤拷锟斤拷锟斤拷锟斤拷Auth锟斤拷锟教★拷 echo. cd %~dp0 -cd ../ruoyi-auth/target +cd ../yanzhu-auth/target set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m -java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-auth.jar +java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar yanzhu-auth.jar cd bin pause \ No newline at end of file diff --git a/bin/run-gateway.bat b/bin/run-gateway.bat index e43d60bc..bb58985f 100644 --- a/bin/run-gateway.bat +++ b/bin/run-gateway.bat @@ -1,14 +1,14 @@ @echo off echo. -echo [信息] 使用Jar命令运行Gateway工程。 +echo [锟斤拷息] 使锟斤拷Jar锟斤拷锟斤拷锟斤拷锟斤拷Gateway锟斤拷锟教★拷 echo. cd %~dp0 -cd ../ruoyi-gateway/target +cd ../yanzhu-gateway/target set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m -java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-gateway.jar +java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar yanzhu-gateway.jar cd bin pause \ No newline at end of file diff --git a/bin/run-modules-file.bat b/bin/run-modules-file.bat index 6d89c905..4db62b7a 100644 --- a/bin/run-modules-file.bat +++ b/bin/run-modules-file.bat @@ -1,14 +1,14 @@ @echo off echo. -echo [信息] 使用Jar命令运行Modules-File工程。 +echo [锟斤拷息] 使锟斤拷Jar锟斤拷锟斤拷锟斤拷锟斤拷Modules-File锟斤拷锟教★拷 echo. cd %~dp0 -cd ../ruoyi-modules/ruoyi-file/target +cd ../yanzhu-modules/yanzhu-file/target set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m -java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-modules-file.jar +java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar yanzhu-modules-file.jar cd bin pause \ No newline at end of file diff --git a/bin/run-modules-gen.bat b/bin/run-modules-gen.bat index 0a4c3905..7b9cea1b 100644 --- a/bin/run-modules-gen.bat +++ b/bin/run-modules-gen.bat @@ -1,6 +1,6 @@ @echo off echo. -echo [信息] 使用Jar命令运行Modules-Gen工程。 +echo [锟斤拷息] 使锟斤拷Jar锟斤拷锟斤拷锟斤拷锟斤拷Modules-Gen锟斤拷锟教★拷 echo. cd %~dp0 @@ -8,7 +8,7 @@ cd ../ruoyi-modules/ruoyi-gen/target set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m -java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-modules-gen.jar +java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar yanzhu-modules-gen.jar cd bin pause \ No newline at end of file diff --git a/bin/run-modules-job.bat b/bin/run-modules-job.bat index 443e59d0..fa88e955 100644 --- a/bin/run-modules-job.bat +++ b/bin/run-modules-job.bat @@ -1,6 +1,6 @@ @echo off echo. -echo [信息] 使用Jar命令运行Modules-Job工程。 +echo [锟斤拷息] 使锟斤拷Jar锟斤拷锟斤拷锟斤拷锟斤拷Modules-Job锟斤拷锟教★拷 echo. cd %~dp0 @@ -8,7 +8,7 @@ cd ../ruoyi-modules/ruoyi-job/target set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m -java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-modules-job.jar +java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar yanzhu-modules-job.jar cd bin pause \ No newline at end of file diff --git a/bin/run-modules-system.bat b/bin/run-modules-system.bat index 26db55e4..652a3aa2 100644 --- a/bin/run-modules-system.bat +++ b/bin/run-modules-system.bat @@ -1,14 +1,14 @@ @echo off echo. -echo [信息] 使用Jar命令运行Modules-System工程。 +echo [锟斤拷息] 使锟斤拷Jar锟斤拷锟斤拷锟斤拷锟斤拷Modules-System锟斤拷锟教★拷 echo. cd %~dp0 -cd ../ruoyi-modules/ruoyi-system/target +cd ../yanzhu-modules/yanzhu-system/target set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m -java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-modules-system.jar +java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar yanzhu-modules-system.jar cd bin pause \ No newline at end of file diff --git a/bin/run-monitor.bat b/bin/run-monitor.bat index 3e8e322b..17c42ffc 100644 --- a/bin/run-monitor.bat +++ b/bin/run-monitor.bat @@ -1,6 +1,6 @@ @echo off echo. -echo [信息] 使用Jar命令运行Monitor工程。 +echo [锟斤拷息] 使锟斤拷Jar锟斤拷锟斤拷锟斤拷锟斤拷Monitor锟斤拷锟教★拷 echo. cd %~dp0 @@ -8,7 +8,7 @@ cd ../ruoyi-visual/ruoyi-monitor/target set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m -java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-visual-monitor.jar +java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar yanzhu-visual-monitor.jar cd bin pause \ No newline at end of file diff --git a/bin/run.bat b/bin/run.bat new file mode 100644 index 00000000..dd01cd34 --- /dev/null +++ b/bin/run.bat @@ -0,0 +1,3 @@ +start bin\run-auth.bat +start bin\run-gateway.bat +start bin\run-modules-system.bat \ No newline at end of file diff --git a/yanzhu-api/yanzhu-api-system/src/main/java/com/yanzhu/system/api/domain/SysUser.java b/yanzhu-api/yanzhu-api-system/src/main/java/com/yanzhu/system/api/domain/SysUser.java index 5720be67..363869ff 100644 --- a/yanzhu-api/yanzhu-api-system/src/main/java/com/yanzhu/system/api/domain/SysUser.java +++ b/yanzhu-api/yanzhu-api-system/src/main/java/com/yanzhu/system/api/domain/SysUser.java @@ -25,17 +25,16 @@ public class SysUser extends BaseEntity @Excel(name = "鐢ㄦ埛搴忓彿", cellType = ColumnType.NUMERIC, prompt = "鐢ㄦ埛缂栧彿") private Long userId; - - private Long compId; - - public Long getCompId() { - return compId; + public Long getComId() { + return comId; } - public void setCompId(Long compId) { - this.compId = compId; + public void setComId(Long comId) { + this.comId = comId; } + private Long comId; + /** 閮ㄩ棬ID */ @Excel(name = "閮ㄩ棬缂栧彿", type = Type.IMPORT) private Long deptId; @@ -104,6 +103,15 @@ public class SysUser extends BaseEntity }) private SysDept dept; + public SysDept getComp() { + return comp; + } + + public void setComp(SysDept comp) { + this.comp = comp; + } + + private SysDept comp; /** 瑙掕壊瀵硅薄 */ private List roles; diff --git a/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/controller/SysRoleController.java b/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/controller/SysRoleController.java index 8ae6ee78..5e6d664d 100644 --- a/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/controller/SysRoleController.java +++ b/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/controller/SysRoleController.java @@ -275,7 +275,7 @@ public class SysRoleController extends BaseController * @param deptId * @return */ - @GetMapping("/deptRole/{deptId}") + @GetMapping("/deptRole/{roleId}") public AjaxResult list(@PathVariable("roleId") Long deptId) { List list = roleService.findDeptRoleList(deptId); diff --git a/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/domain/vo/TreeSelect.java b/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/domain/vo/TreeSelect.java index ca1059b3..1e48bdf4 100644 --- a/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/domain/vo/TreeSelect.java +++ b/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/domain/vo/TreeSelect.java @@ -23,6 +23,16 @@ public class TreeSelect implements Serializable /** 鑺傜偣鍚嶇О */ private String label; + public Object getData() { + return data; + } + + public void setData(Object data) { + this.data = data; + } + + private Object data; + /** 瀛愯妭鐐 */ @JsonInclude(JsonInclude.Include.NON_EMPTY) private List children; @@ -37,6 +47,7 @@ public class TreeSelect implements Serializable this.id = dept.getDeptId(); this.label = dept.getDeptName(); this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); + this.data=dept; } public TreeSelect(SysMenu menu) @@ -44,6 +55,7 @@ public class TreeSelect implements Serializable this.id = menu.getMenuId(); this.label = menu.getMenuName(); this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); + this.data=menu; } public TreeSelect(SysArea area) @@ -51,6 +63,7 @@ public class TreeSelect implements Serializable this.id = area.getId(); this.label = area.getCname(); this.children = area.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); + this.data=area; } public Long getId() diff --git a/yanzhu-modules/yanzhu-system/src/main/resources/mapper/system/SysUserMapper.xml b/yanzhu-modules/yanzhu-system/src/main/resources/mapper/system/SysUserMapper.xml index a2f4bddb..ef4b86de 100644 --- a/yanzhu-modules/yanzhu-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/yanzhu-modules/yanzhu-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -30,6 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -45,6 +46,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + @@ -58,9 +64,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select u.user_id,u.com_id, u.dept_id, u.user_name, u.nick_name, u.user_type, u.card_type, u.card_code, u.user_infos, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.dept_short_name, d.dept_code, d.dept_type, d.order_num, d.leader, d.status as dept_status, - r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status + r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status,com.dept_name com_dept_name from sys_user u left join sys_dept d on u.dept_id = d.dept_id + left join sys_dept com on u.com_id = com.dept_id left join sys_user_role ur on u.user_id = ur.user_id left join sys_role r on r.role_id = ur.role_id diff --git a/yanzhu-ui-vue3/src/api/system/user.js b/yanzhu-ui-vue3/src/api/system/user.js index 09edfe1c..dc75a6d2 100644 --- a/yanzhu-ui-vue3/src/api/system/user.js +++ b/yanzhu-ui-vue3/src/api/system/user.js @@ -32,7 +32,16 @@ export function updateUser(data) { return request({ url: '/system/user', method: 'put', - data: data + data: { + userId:data.userId, + userName:data.userName, + userType:data.userType, + sex:data.sex, + status:data.status, + postIds:data.postIds, + roles:data.roles, + roleIds:data.roleIds + } }) } diff --git a/yanzhu-ui-vue3/src/views/system/user/index.vue b/yanzhu-ui-vue3/src/views/system/user/index.vue index 6c3a175a..02af5472 100644 --- a/yanzhu-ui-vue3/src/views/system/user/index.vue +++ b/yanzhu-ui-vue3/src/views/system/user/index.vue @@ -4,74 +4,35 @@
- +
- +
- + - + - - + + - + 鎼滅储 @@ -81,51 +42,24 @@ - 鏂板 + 鏂板 - 淇敼 + 淇敼 - 鍒犻櫎 + 鍒犻櫎 - 瀵煎叆 + 瀵煎叆 - 瀵煎嚭 + 瀵煎嚭 @@ -133,23 +67,23 @@ - - - - + + + + - + @@ -160,27 +94,26 @@ - + @@ -190,16 +123,9 @@ - + @@ -210,71 +136,52 @@ - + - + - + - + - {{ dict.label }} + {{ dict.label + }} - + - + @@ -290,18 +197,9 @@ - +
灏嗘枃浠舵嫋鍒版澶勶紝鎴鐐瑰嚮涓婁紶
@@ -348,268 +247,305 @@ const deptOptions = ref(undefined); const initPassword = ref(undefined); const postOptions = ref([]); const roleOptions = ref([]); - +const selTreeDept = ref(); const defaultEK = ref([100]); /*** 鐢ㄦ埛瀵煎叆鍙傛暟 */ const upload = reactive({ - // 鏄惁鏄剧ず寮瑰嚭灞傦紙鐢ㄦ埛瀵煎叆锛 - open: false, - // 寮瑰嚭灞傛爣棰橈紙鐢ㄦ埛瀵煎叆锛 - title: "", - // 鏄惁绂佺敤涓婁紶 - isUploading: false, - // 鏄惁鏇存柊宸茬粡瀛樺湪鐨勭敤鎴锋暟鎹 - updateSupport: 0, - // 璁剧疆涓婁紶鐨勮姹傚ご閮 - headers: { Authorization: "Bearer " + getToken() }, - // 涓婁紶鐨勫湴鍧 - url: import.meta.env.VITE_APP_BASE_API + "/system/user/importData" + // 鏄惁鏄剧ず寮瑰嚭灞傦紙鐢ㄦ埛瀵煎叆锛 + open: false, + // 寮瑰嚭灞傛爣棰橈紙鐢ㄦ埛瀵煎叆锛 + title: "", + // 鏄惁绂佺敤涓婁紶 + isUploading: false, + // 鏄惁鏇存柊宸茬粡瀛樺湪鐨勭敤鎴锋暟鎹 + updateSupport: 0, + // 璁剧疆涓婁紶鐨勮姹傚ご閮 + headers: { Authorization: "Bearer " + getToken() }, + // 涓婁紶鐨勫湴鍧 + url: import.meta.env.VITE_APP_BASE_API + "/system/user/importData" }); // 鍒楁樉闅愪俊鎭 const columns = ref([ - { key: 0, label: `鐢ㄦ埛缂栧彿`, visible: false }, - { key: 1, label: `鐧诲綍璐﹀彿`, visible: true }, - { key: 2, label: `鐢ㄦ埛鍚嶇О`, visible: true }, - { key: 3, label: `鎵灞為儴闂╜, visible: true }, - { key: 4, label: `鐢ㄦ埛绫诲瀷`, visible: true }, - { key: 5, label: `鎵嬫満鍙风爜`, visible: true }, - { key: 6, label: `鐢ㄦ埛鐘舵乣, visible: true }, - { key: 7, label: `鍒涘缓鏃堕棿`, visible: true } + { key: 0, label: `鐢ㄦ埛缂栧彿`, visible: false }, + { key: 1, label: `鐧诲綍璐﹀彿`, visible: true }, + { key: 2, label: `鐢ㄦ埛鍚嶇О`, visible: true }, + { key: 3, label: `鎵灞為儴闂╜, visible: true }, + { key: 4, label: `鐢ㄦ埛绫诲瀷`, visible: true }, + { key: 5, label: `鎵嬫満鍙风爜`, visible: true }, + { key: 6, label: `鐢ㄦ埛鐘舵乣, visible: true }, + { key: 7, label: `鍒涘缓鏃堕棿`, visible: true } ]); const data = reactive({ - form: {}, - queryParams: { - pageNum: 1, - pageSize: 10, - userName: undefined, - nickName: undefined, - phonenumber: undefined, - status: undefined, - deptId: undefined - }, - rules: { - deptId: [{ required: true, message: "鎵灞炲崟浣嶄笉鑳戒负绌", trigger: "change" }], - userName: [{ required: true, message: "鐢ㄦ埛鍚嶇О涓嶈兘涓虹┖", trigger: "blur" }, { min: 2, max: 20, message: "鐢ㄦ埛鍚嶇О闀垮害蹇呴』浠嬩簬 2 鍜 20 涔嬮棿", trigger: "blur" }], - nickName: [{ required: true, message: "鐢ㄦ埛鍚嶇О涓嶈兘涓虹┖", trigger: "blur" }], - userType: [{ required: true, message: "鐢ㄦ埛绫诲瀷涓嶈兘涓虹┖", trigger: "change" }], - password: [{ required: true, message: "鐢ㄦ埛瀵嗙爜涓嶈兘涓虹┖", trigger: "blur" }, { min: 5, max: 20, message: "鐢ㄦ埛瀵嗙爜闀垮害蹇呴』浠嬩簬 5 鍜 20 涔嬮棿", trigger: "blur" }], - phonenumber: [{ required: true, message: "鎵嬫満鍙风爜涓嶈兘涓虹┖", trigger: "blur" }, { pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "璇疯緭鍏ユ纭殑鎵嬫満鍙风爜", trigger: "blur" }] - } + form: {}, + queryParams: { + pageNum: 1, + pageSize: 10, + userName: undefined, + nickName: undefined, + phonenumber: undefined, + status: undefined, + deptId: undefined + }, + rules: { + deptId: [{ required: true, message: "鎵灞炲崟浣嶄笉鑳戒负绌", trigger: "change" }], + userName: [{ required: true, message: "鐢ㄦ埛鍚嶇О涓嶈兘涓虹┖", trigger: "blur" }, { min: 2, max: 20, message: "鐢ㄦ埛鍚嶇О闀垮害蹇呴』浠嬩簬 2 鍜 20 涔嬮棿", trigger: "blur" }], + nickName: [{ required: true, message: "鐢ㄦ埛鍚嶇О涓嶈兘涓虹┖", trigger: "blur" }], + userType: [{ required: true, message: "鐢ㄦ埛绫诲瀷涓嶈兘涓虹┖", trigger: "change" }], + password: [{ required: true, message: "鐢ㄦ埛瀵嗙爜涓嶈兘涓虹┖", trigger: "blur" }, { min: 5, max: 20, message: "鐢ㄦ埛瀵嗙爜闀垮害蹇呴』浠嬩簬 5 鍜 20 涔嬮棿", trigger: "blur" }], + phonenumber: [{ required: true, message: "鎵嬫満鍙风爜涓嶈兘涓虹┖", trigger: "blur" }, { pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "璇疯緭鍏ユ纭殑鎵嬫満鍙风爜", trigger: "blur" }] + } }); const { queryParams, form, rules } = toRefs(data); /** 閫氳繃鏉′欢杩囨护鑺傜偣 */ const filterNode = (value, data) => { - if (!value) return true; - return data.label.indexOf(value) !== -1; + if (!value) return true; + return data.label.indexOf(value) !== -1; }; /** 鏍规嵁鍚嶇О绛涢夐儴闂ㄦ爲 */ watch(deptName, val => { - proxy.$refs["deptTreeRef"].filter(val); + proxy.$refs["deptTreeRef"].filter(val); }); /** 鏌ヨ閮ㄩ棬涓嬫媺鏍戠粨鏋 */ function getDeptTree() { - deptTreeSelect().then(response => { - deptOptions.value = response.data; - }); + deptTreeSelect().then(response => { + deptOptions.value = response.data; + }); }; /** 鏌ヨ鐢ㄦ埛鍒楄〃 */ function getList() { - loading.value = true; - listUser(proxy.addDateRange(queryParams.value, dateRange.value)).then(res => { - loading.value = false; - userList.value = res.rows; - total.value = res.total; - }); + loading.value = true; + listUser(proxy.addDateRange(queryParams.value, dateRange.value)).then(res => { + loading.value = false; + userList.value = res.rows; + total.value = res.total; + }); }; /** 鑺傜偣鍗曞嚮浜嬩欢 */ function handleNodeClick(data) { - queryParams.value.deptId = data.id; - handleQuery(); + queryParams.value.deptId = data.id; + handleQuery(); }; /** 鎼滅储鎸夐挳鎿嶄綔 */ function handleQuery() { - queryParams.value.pageNum = 1; - getList(); + queryParams.value.pageNum = 1; + getList(); }; /** 閲嶇疆鎸夐挳鎿嶄綔 */ function resetQuery() { - dateRange.value = []; - proxy.resetForm("queryRef"); - queryParams.value.deptId = undefined; - proxy.$refs.deptTreeRef.setCurrentKey(null); - handleQuery(); + dateRange.value = []; + proxy.resetForm("queryRef"); + queryParams.value.deptId = undefined; + proxy.$refs.deptTreeRef.setCurrentKey(null); + handleQuery(); }; /** 鍒犻櫎鎸夐挳鎿嶄綔 */ function handleDelete(row) { - const userIds = row.userId || ids.value; - proxy.$modal.confirm('鏄惁纭鍒犻櫎鐢ㄦ埛缂栧彿涓"' + userIds + '"鐨勬暟鎹」锛').then(function () { - return delUser(userIds); - }).then(() => { - getList(); - proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); + const userIds = row.userId || ids.value; + proxy.$modal.confirm('鏄惁纭鍒犻櫎鐢ㄦ埛缂栧彿涓"' + userIds + '"鐨勬暟鎹」锛').then(function () { + return delUser(userIds); + }).then(() => { + getList(); + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + }).catch(() => { }); }; /** 瀵煎嚭鎸夐挳鎿嶄綔 */ function handleExport() { - proxy.download("system/user/export", { - ...queryParams.value, - },`user_${new Date().getTime()}.xlsx`); + proxy.download("system/user/export", { + ...queryParams.value, + }, `user_${new Date().getTime()}.xlsx`); }; /** 鐢ㄦ埛鐘舵佷慨鏀 */ function handleStatusChange(row) { - let text = row.status === "0" ? "鍚敤" : "鍋滅敤"; - proxy.$modal.confirm('纭瑕"' + text + '""' + row.userName + '"鐢ㄦ埛鍚?').then(function () { - return changeUserStatus(row.userId, row.status); - }).then(() => { - proxy.$modal.msgSuccess(text + "鎴愬姛"); - }).catch(function () { - row.status = row.status === "0" ? "1" : "0"; - }); + let text = row.status === "0" ? "鍚敤" : "鍋滅敤"; + proxy.$modal.confirm('纭瑕"' + text + '""' + row.userName + '"鐢ㄦ埛鍚?').then(function () { + return changeUserStatus(row.userId, row.status); + }).then(() => { + proxy.$modal.msgSuccess(text + "鎴愬姛"); + }).catch(function () { + row.status = row.status === "0" ? "1" : "0"; + }); }; /** 鏇村鎿嶄綔 */ function handleCommand(command, row) { - switch (command) { - case "handleResetPwd": - handleResetPwd(row); - break; - case "handleAuthRole": - handleAuthRole(row); - break; - default: - break; - } + switch (command) { + case "handleResetPwd": + handleResetPwd(row); + break; + case "handleAuthRole": + handleAuthRole(row); + break; + default: + break; + } }; /** 璺宠浆瑙掕壊鍒嗛厤 */ function handleAuthRole(row) { - const userId = row.userId; - router.push("/system/user-auth/role/" + userId); + const userId = row.userId; + router.push("/system/user-auth/role/" + userId); }; /** 閲嶇疆瀵嗙爜鎸夐挳鎿嶄綔 */ function handleResetPwd(row) { - proxy.$prompt('璇疯緭鍏"' + row.userName + '"鐨勬柊瀵嗙爜', "鎻愮ず", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - closeOnClickModal: false, - inputPattern: /^.{5,20}$/, - inputErrorMessage: "鐢ㄦ埛瀵嗙爜闀垮害蹇呴』浠嬩簬 5 鍜 20 涔嬮棿", - }).then(({ value }) => { - resetUserPwd(row.userId, value).then(response => { - proxy.$modal.msgSuccess("淇敼鎴愬姛锛屾柊瀵嗙爜鏄細" + value); - }); - }).catch(() => {}); + proxy.$prompt('璇疯緭鍏"' + row.userName + '"鐨勬柊瀵嗙爜', "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + closeOnClickModal: false, + inputPattern: /^.{5,20}$/, + inputErrorMessage: "鐢ㄦ埛瀵嗙爜闀垮害蹇呴』浠嬩簬 5 鍜 20 涔嬮棿", + }).then(({ value }) => { + resetUserPwd(row.userId, value).then(response => { + proxy.$modal.msgSuccess("淇敼鎴愬姛锛屾柊瀵嗙爜鏄細" + value); + }); + }).catch(() => { }); }; /** 閫夋嫨鏉℃暟 */ function handleSelectionChange(selection) { - ids.value = selection.map(item => item.userId); - single.value = selection.length != 1; - multiple.value = !selection.length; + ids.value = selection.map(item => item.userId); + single.value = selection.length != 1; + multiple.value = !selection.length; }; /** 瀵煎叆鎸夐挳鎿嶄綔 */ function handleImport() { - upload.title = "鐢ㄦ埛瀵煎叆"; - upload.open = true; + upload.title = "鐢ㄦ埛瀵煎叆"; + upload.open = true; }; /** 涓嬭浇妯℃澘鎿嶄綔 */ function importTemplate() { - proxy.download("system/user/importTemplate", { - }, `user_template_${new Date().getTime()}.xlsx`); + proxy.download("system/user/importTemplate", { + }, `user_template_${new Date().getTime()}.xlsx`); }; /**鏂囦欢涓婁紶涓鐞 */ const handleFileUploadProgress = (event, file, fileList) => { - upload.isUploading = true; + upload.isUploading = true; }; /** 鏂囦欢涓婁紶鎴愬姛澶勭悊 */ const handleFileSuccess = (response, file, fileList) => { - upload.open = false; - upload.isUploading = false; - proxy.$refs["uploadRef"].handleRemove(file); - proxy.$alert("
" + response.msg + "
", "瀵煎叆缁撴灉", { dangerouslyUseHTMLString: true }); - getList(); + upload.open = false; + upload.isUploading = false; + proxy.$refs["uploadRef"].handleRemove(file); + proxy.$alert("
" + response.msg + "
", "瀵煎叆缁撴灉", { dangerouslyUseHTMLString: true }); + getList(); }; /** 鎻愪氦涓婁紶鏂囦欢 */ function submitFileForm() { - proxy.$refs["uploadRef"].submit(); + proxy.$refs["uploadRef"].submit(); }; /** 閲嶇疆鎿嶄綔琛ㄥ崟 */ function reset() { - form.value = { - userId: undefined, - deptId: undefined, - userName: undefined, - nickName: undefined, - password: undefined, - phonenumber: undefined, - email: undefined, - sex: undefined, - status: "0", - remark: undefined, - postIds: [], - roleIds: [] - }; - proxy.resetForm("userRef"); + form.value = { + userId: undefined, + deptId: undefined, + userName: undefined, + nickName: undefined, + password: undefined, + phonenumber: undefined, + email: undefined, + sex: undefined, + status: "0", + remark: undefined, + postIds: [], + roleIds: [] + }; + proxy.resetForm("userRef"); }; /** 鍙栨秷鎸夐挳 */ function cancel() { - open.value = false; - reset(); + open.value = false; + reset(); }; /** 鏂板鎸夐挳鎿嶄綔 */ function handleAdd() { - reset(); - getUser().then(response => { - postOptions.value = response.posts; - open.value = true; - title.value = "娣诲姞鐢ㄦ埛"; - form.value.password = initPassword.value; - }); + reset(); + getUser().then(response => { + data.rules={ + deptId: [{ required: true, message: "鎵灞炲崟浣嶄笉鑳戒负绌", trigger: "change" }], + userName: [{ required: true, message: "鐢ㄦ埛鍚嶇О涓嶈兘涓虹┖", trigger: "blur" }, { min: 2, max: 20, message: "鐢ㄦ埛鍚嶇О闀垮害蹇呴』浠嬩簬 2 鍜 20 涔嬮棿", trigger: "blur" }], + nickName: [{ required: true, message: "鐢ㄦ埛鍚嶇О涓嶈兘涓虹┖", trigger: "blur" }], + userType: [{ required: true, message: "鐢ㄦ埛绫诲瀷涓嶈兘涓虹┖", trigger: "change" }], + password: [{ required: true, message: "鐢ㄦ埛瀵嗙爜涓嶈兘涓虹┖", trigger: "blur" }, { min: 5, max: 20, message: "鐢ㄦ埛瀵嗙爜闀垮害蹇呴』浠嬩簬 5 鍜 20 涔嬮棿", trigger: "blur" }], + phonenumber: [{ required: true, message: "鎵嬫満鍙风爜涓嶈兘涓虹┖", trigger: "blur" }, { pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "璇疯緭鍏ユ纭殑鎵嬫満鍙风爜", trigger: "blur" }] + } + postOptions.value = response.posts; + open.value = true; + title.value = "娣诲姞鐢ㄦ埛"; + form.value.password = initPassword.value; + }); }; /** 淇敼鎸夐挳鎿嶄綔 */ function handleUpdate(row) { - reset(); - const userId = row.userId || ids.value; - getUser(userId).then(response => { - form.value = response.data; - postOptions.value = response.posts; - form.value.postIds = response.postIds; - form.value.roleIds = response.roleIds; - open.value = true; - title.value = "淇敼鐢ㄦ埛"; - form.password = ""; - }); - handleChangeDept(row.deptId); + reset(); + const userId = row.userId || ids.value; + getUser(userId).then(response => { + + data.rules={ + deptId: [{ required: true, message: "鎵灞炲崟浣嶄笉鑳戒负绌", trigger: "change" }], + userType: [{ required: true, message: "鐢ㄦ埛绫诲瀷涓嶈兘涓虹┖", trigger: "change" }], + phonenumber: [{ required: true, message: "鎵嬫満鍙风爜涓嶈兘涓虹┖", trigger: "blur" }, { pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "璇疯緭鍏ユ纭殑鎵嬫満鍙风爜", trigger: "blur" }] + } + form.value = response.data; + postOptions.value = response.posts; + form.value.postIds = response.postIds; + form.value.roleIds = response.roleIds; + open.value = true; + title.value = "淇敼鐢ㄦ埛"; + form.password = ""; + }); + handleChangeDept(row.deptId); }; /** 鏍规嵁鍗曚綅閫夋嫨瑙掕壊 */ -function handleChangeDept(value){ +function handleChangeDept(value) { form.roleIds = null; getDeptRole(value).then(response => { - roleOptions.value = response.data; + roleOptions.value = response.data; }); } +const getCompId=()=>{ + const getCompId=n=>{ + if(n.data.data.deptType==2){ + return n.data.id + }else{ + let pnode=node.parent; + if(!pnode){ + return "" + }else{ + return getCompId(pnode); + } + } + } + let ndData=selTreeDept.value.getCurrentNode(); + let node=selTreeDept.value.getNode(ndData.id); + let compId=getCompId(node); + debugger + return compId; +} + /** 鎻愪氦鎸夐挳 */ function submitForm() { - proxy.$refs["userRef"].validate(valid => { - if (valid) { - if (form.value.userId != undefined) { - updateUser(form.value).then(response => { - proxy.$modal.msgSuccess("淇敼鎴愬姛"); - open.value = false; - getList(); - }); - } else { - addUser(form.value).then(response => { - proxy.$modal.msgSuccess("鏂板鎴愬姛"); - open.value = false; - getList(); - }); + proxy.$refs["userRef"].validate(valid => { + + form.comId=getCompId(); + if (valid) { + form.value.userName = form.value.nickName; + if (form.value.userId != undefined) { + updateUser(form.value).then(response => { + proxy.$modal.msgSuccess("淇敼鎴愬姛"); + open.value = false; + getList(); + }); + } else { + addUser(form.value).then(response => { + proxy.$modal.msgSuccess("鏂板鎴愬姛"); + open.value = false; + getList(); + }); + } } - } - }); + }); }; getDeptTree();