From 9dc92ef9d1b7ccbaf68e2511222b2db628c68161 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E6=96=8C=E6=9D=B0?= <> Date: Thu, 16 May 2024 23:09:17 +0800 Subject: [PATCH] ui --- src/views/user-list/UserList.vue | 385 ++++++++++++++++++++++++++++--- 1 file changed, 356 insertions(+), 29 deletions(-) diff --git a/src/views/user-list/UserList.vue b/src/views/user-list/UserList.vue index 197dec0..b9c25ba 100644 --- a/src/views/user-list/UserList.vue +++ b/src/views/user-list/UserList.vue @@ -6,10 +6,10 @@ 权限管理 / 用户管理 - +
@@ -42,6 +42,8 @@ :props="defaultProps" @node-click="handleNodeClick" highlight-current + node-key="id" + ref="itemType" >
@@ -213,6 +215,13 @@ size="small" /> + + + - + + + + + + + + + + + + + +
+ + + + +
+
+
+ + + + + +
+ + + + +
+
+
- + + + + + + + + + + + + + + + + +
+ + + + +
+
+
+
+ + + + + + +
+ + + + +
+
+
+
@@ -708,6 +832,9 @@ export default { roleNames: [ { required: true, message: "请选择所属用户", trigger: "change" }, ], + operatorType: [ + { required: true, message: "请选择操作类别", trigger: "change" }, + ], nam: [{ required: true, message: "请输入名", trigger: "change" }], }, ruless: { @@ -749,6 +876,9 @@ export default { roleNames: [ { required: true, message: "请选择所属用户", trigger: "change" }, ], + operatorType: [ + { required: true, message: "请选择操作类别", trigger: "change" }, + ], nam: [{ required: true, message: "请输入名", trigger: "change" }], }, tableData: [], @@ -767,6 +897,9 @@ export default { userName: "", password: "", isActive: true, + userSign: "", + userPhoto: "", + operatorType: "", }, roleNames: [], are: [], @@ -790,6 +923,28 @@ export default { itemtype: [], haveitemtype: [], newitemtype: [], + departments: "", + quckDepartment: [], + initTableData: [], + actionUrl: "", + operatorType: [ + { + id: "0", + displayName: "操作员", + }, + { + id: "1", + displayName: "医生", + }, + { + id: "2", + displayName: "总检医生", + }, + { + id: "3", + displayName: "医生和总检医生", + }, + ], }; }, computed: { @@ -803,6 +958,117 @@ export default { }, methods: { + handleRemove(){ + this.form.userSign=this.$options.data().form.userSign + }, + handleRemoves(){ + this.form.userPhoto=this.$options.data().form.userPhoto + }, + quckDepartments(e) { + if (e) { + let currentKey = ""; + this.quckDepartment.forEach((item) => { + if (e == item.id) { + currentKey = item.organizationUnitId; + } + }); + this.$refs["itemType"].setCurrentKey(currentKey); + let selected = this.$refs["itemType"].getCurrentNode(); + if ( + this.$refs["itemType"].getNode(selected) && + this.$refs["itemType"].getNode(selected).parent + ) { + this.expandParents(this.$refs["itemType"].getNode(selected).parent); + } + postapi( + "/api/identity/users/getlistinorganizationunit",{ + organizationUnitId:currentKey + } + ).then((res) => { + if (res.code != -1) { + this.tableData = res.data; + this.tableData.forEach((item, index) => { + if (e == item.id) { + this.$refs["tableData"].setCurrentRow(item); + this.rowick(item); + this.searchup(item, index); + } + }); + } + }); + } else { + this.remoteMethodes(); + } + }, + remoteMethodes(keyWords) { + if (keyWords) { + this.quckDepartment = []; + this.initTableData.forEach((item) => { + if ( + item.userName.toLowerCase().indexOf(keyWords.toLowerCase()) > -1 || + item.simpleCode.toLowerCase().indexOf(keyWords.toLowerCase()) > -1 + || item.surname.toLowerCase().indexOf(keyWords.toLowerCase()) > -1 + ) { + this.quckDepartment.push(item); + } + }); + } else { + this.quckDepartment = deepCopy(this.initTableData); + } + }, + expandParents(node) { + node.expanded = true; + if (node.parent) { + this.expandParents(node.parent); + } + }, + searchup(data, index) { + this.$nextTick(() => { + if (index == 0) { + index = 1; + } + const targetTop = this.$refs["tableData"].$el + .querySelectorAll(".el-table__body tr") + [index - 1].getBoundingClientRect().top; + const containerTop = this.$refs["tableData"].$el + .querySelector(".el-table__body") + .getBoundingClientRect().top; + const scrollParent = this.$refs["tableData"].$el.querySelector( + ".el-table__body-wrapper" + ); + scrollParent.scrollTop = targetTop - containerTop; + }); + }, + getFile(file, fileList) { + //上传头像 + this.getBase64(file.raw).then((res) => { + this.form.userSign = res; + console.log(res); + }); + }, + getFiles(file, fileList) { + //上传头像 + this.getBase64(file.raw).then((res) => { + this.form.userPhoto = res; + }); + }, + getBase64(file) { + //把图片转成base64编码 + return new Promise(function (resolve, reject) { + let reader = new FileReader(); + let imgResult = ""; + reader.readAsDataURL(file); + reader.onload = function () { + imgResult = reader.result; + }; + reader.onerror = function (error) { + reject(error); + }; + reader.onloadend = function () { + resolve(imgResult); + }; + }); + }, cancellation() { this.dialogVisible = false; this.form = this.$options.data().form; @@ -836,8 +1102,10 @@ export default { }, handleNodeClick(data) { this.department = data.displayName; - getapi( - `/api/identity/users/getlistinorganizationunit?OrganizationUnitId=${data.id}` + postapi( + "/api/identity/users/getlistinorganizationunit",{ + organizationUnitId:data.id + } ).then((res) => { if (res.code != -1) { this.tableData = res.data; @@ -945,9 +1213,11 @@ export default { // // usreslist() // }, btnQuery() { - getapi("/api/identity/users/getlist", this.pages).then((res) => { + postapi("/api/identity/users/getlistinorganizationunit").then((res) => { if (res.code != -1) { - this.tableData = res.data.items; + this.tableData = res.data; + this.quckDepartment = [...res.data]; + this.initTableData = [...res.data]; } }); }, @@ -1102,6 +1372,10 @@ export default { password: this.form.password, roleNames: this.form.roleNames, isActive: this.form.isActive, + email: this.form.email, + operatorType: this.form.operatorType, + userSign: this.form.userSign, + userPhoto: this.form.userPhoto, }; if (this.form.roleNames.length == 0) { this.$message.warning("请选择角色"); @@ -1133,7 +1407,8 @@ export default { this.department = this.$options.data().department; this.curRow = this.$options.data().curRow; this.orgId = this.$options.data().orgId; - this.haveitemtype =this.$options.data().haveitemtype; + this.haveitemtype = + this.$options.data().haveitemtype; this.$refs["tableData"].setCurrentRow(""); this.btnQuery(); } @@ -1157,18 +1432,22 @@ export default { password: this.form.password, roleNames: this.form.roleNames, isActive: this.form.isActive, + email: this.form.email, + operatorType: this.form.operatorType, + userSign: this.form.userSign, + userPhoto: this.form.userPhoto, // roleNames: this.form.roleNames, }; if (this.orgId == "" || this.orgId == null) { return this.$message.warning("请选择科室"); } + console.log(this.form.roleNames); if (this.form.roleNames.length == 0) { this.$message.warning("请选则用户角色"); return; } let msg = ""; - //更新用户与所属角色 postapi(`/api/identity/users/update?id=${this.form.id}`, obj).then( (res) => { @@ -1195,7 +1474,8 @@ export default { this.department = this.$options.data().department; this.curRow = this.$options.data().curRow; this.orgId = this.$options.data().orgId; - this.haveitemtype =this.$options.data().haveitemtype; + this.haveitemtype = + this.$options.data().haveitemtype; this.$refs["tableData"].setCurrentRow(""); //this.$message.success("操作成功!"); this.btnQuery(); @@ -1256,12 +1536,18 @@ export default { if (this.title == 2) { // row里面没有roleNames字段 //const form = JSON.parse(JSON.stringify(row)); - const form = deepCopy(this.curRow); - this.form = { - ...form, - roleNames: [], - }; - this.form.roleNames = []; + getapi("/api/identity/users/getinfo", { + id: this.curRow.id, + }).then((res) => { + if (res.code != -1) { + const form = deepCopy(res.data); + this.form = { + ...form, + roleNames: [], + }; + this.form.roleNames = []; + } + }); //获取组织架构 organizationtree().then((res) => { if (res.code != -1) { @@ -1273,7 +1559,7 @@ export default { // postapi(`/api/app/abpuserdepartment/createmany?UserId=${this.form.id}`,{orgId:this.orgId[0]}).then(res=>{ // console.log(res,'wwwwwwwwwwwww'); // }) - useraffiliation(this.form.id).then((res) => { + useraffiliation(this.curRow.id).then((res) => { if (res.code != -1) { if (res.data.items && res.data.items.length > 0) { let val = res.data.items.map((item) => { @@ -1396,7 +1682,48 @@ export default { :deep .el-table tr { height: 33px; } -:deep .el-tree-node>.el-tree-node__children{ +:deep .el-tree-node > .el-tree-node__children { overflow: visible; } +.seachinput { + width: 250px; + margin-right: 110px; +} +:deep .seachinput .el-select { + width: 100%; +} +:deep.avatar-uploader{ + display: inline-block; +} +:deep.avatar-uploader .el-upload { + border: 1px dashed #d9d9d9; + border-radius: 6px; + cursor: pointer; + position: relative; + overflow: hidden; +} +:deep.avatar-uploader .el-upload:hover { + border-color: #409eff; +} +:deep.avatar-uploader-icon { + font-size: 28px; + color: #8c939d; + width: 80px; + height: 80px; + line-height: 80px; + text-align: center; +} +.avatar { + width: 80px; + height: 80px; + display: block; +} +.el-upload-delete{ + position: absolute; + top: 0; + right: 0; + line-height: 0; + font-size: 18px; + +} \ No newline at end of file