From 5e2aafeede13d337380f736567caf74f49713be7 Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Fri, 09 Aug 2024 14:38:32 +0800
Subject: [PATCH] 代码优化

---
 src/views/system/user.vue |  105 +++++++++++++++++++++++++++-------------------------
 1 files changed, 55 insertions(+), 50 deletions(-)

diff --git a/src/views/system/user.vue b/src/views/system/user.vue
index efe2ad3..898b687 100644
--- a/src/views/system/user.vue
+++ b/src/views/system/user.vue
@@ -27,12 +27,12 @@
               @click="handleReset">密码重置
             </el-button>
             <!-- <el-button type="info"
-                       size="small"
-                       plain
-                       v-if="userInfo.role_name.includes('admin')"
-                       icon="el-icon-setting"
-                       @click="handlePlatform">平台配置
-            </el-button> -->
+                         size="small"
+                         plain
+                         v-if="userInfo.role_name.includes('admin')"
+                         icon="el-icon-setting"
+                         @click="handlePlatform">平台配置
+              </el-button> -->
             <el-button type="info" size="small" plain v-if="userInfo.role_name.includes('admin')"
               icon="el-icon-coordinate" @click="handleLock">账号解封
             </el-button>
@@ -77,34 +77,34 @@
           </avue-form>
         </el-dialog>
         <!-- <el-dialog title="用户平台配置"
-                   append-to-body
-                   :visible.sync="platformBox">
-          <avue-crud :option="platformOption"
-                     :table-loading="platformLoading"
-                     :data="platformData"
-                     ref="platformCrud"
-                     v-model="platformForm"
-                     :before-open="platformBeforeOpen"
-                     :page.sync="platformPage"
-                     :permission="platformPermissionList"
-                     @row-update="platformRowUpdate"
-                     @search-change="platformSearchChange"
-                     @search-reset="platformSearchReset"
-                     @selection-change="platformSelectionChange"
-                     @current-change="platformCurrentChange"
-                     @size-change="platformSizeChange"
-                     @refresh-change="platformRefreshChange"
-                     @on-load="platformOnLoad">
-            <template slot-scope="{row}"
-                      slot="tenantName">
-              <el-tag>{{row.tenantName}}</el-tag>
-            </template>
-            <template slot-scope="{row}"
-                      slot="userTypeName">
-              <el-tag>{{row.userTypeName}}</el-tag>
-            </template>
-          </avue-crud>
-        </el-dialog> -->
+                     append-to-body
+                     :visible.sync="platformBox">
+            <avue-crud :option="platformOption"
+                       :table-loading="platformLoading"
+                       :data="platformData"
+                       ref="platformCrud"
+                       v-model="platformForm"
+                       :before-open="platformBeforeOpen"
+                       :page.sync="platformPage"
+                       :permission="platformPermissionList"
+                       @row-update="platformRowUpdate"
+                       @search-change="platformSearchChange"
+                       @search-reset="platformSearchReset"
+                       @selection-change="platformSelectionChange"
+                       @current-change="platformCurrentChange"
+                       @size-change="platformSizeChange"
+                       @refresh-change="platformRefreshChange"
+                       @on-load="platformOnLoad">
+              <template slot-scope="{row}"
+                        slot="tenantName">
+                <el-tag>{{row.tenantName}}</el-tag>
+              </template>
+              <template slot-scope="{row}"
+                        slot="userTypeName">
+                <el-tag>{{row.userTypeName}}</el-tag>
+              </template>
+            </avue-crud>
+          </el-dialog> -->
       </basic-container>
     </el-col>
   </el-row>
@@ -244,6 +244,7 @@
               label: "登录账号",
               prop: "account",
               search: true,
+              searchLabelWidth: 76,
               display: false
             },
             // {
@@ -458,14 +459,15 @@
                 {
                   label: "所属角色",
                   prop: "roleId",
-                  multiple: true,
                   type: "tree",
+                  multiple: true,
+                  checkStrictly: true,
+                  leafOnly: false,
                   dicData: [],
                   props: {
-                    label: "title"
+                    label: "title",
+                    value: "id"
                   },
-                  checkStrictly: true,
-                  slot: true,
                   rules: [{
                     required: true,
                     message: "请选择所属角色",
@@ -476,13 +478,15 @@
                   label: "所属部门",
                   prop: "deptId",
                   type: "tree",
-                  // multiple: true,
+                  multiple: true,
+                  leafOnly: false,
                   dicData: [],
-                  dataType: "string",
+                  // dataType: "string",
                   props: {
-                    label: "title"
+                    label: "title",
+                    value: "id"
                   },
-                  // checkStrictly: true,
+                  checkStrictly: true,
                   slot: true,
                   span: 12,
                   rules: [{
@@ -716,7 +720,7 @@
         row['userType'] = 1
         row.deptId = func.join(row.deptId)
         row.roleId = func.join(row.roleId)
-        row.postId = func.join(row.postId);
+        // row.postId = func.join(row.postId)
         add(row).then(() => {
           this.initFlag = false
           this.onLoad(this.page)
@@ -735,7 +739,7 @@
         row['userType'] = 1
         row.deptId = func.join(row.deptId)
         row.roleId = func.join(row.roleId)
-        row.postId = func.join(row.postId);
+        // row.postId = func.join(row.postId)
         update(row).then(() => {
           this.initFlag = false
           this.onLoad(this.page)
@@ -876,6 +880,7 @@
       handleExport() {
         const account = func.toStr(this.search.account)
         const realName = func.toStr(this.search.realName)
+        const deptId = this.treeDeptId
         this.$confirm("是否导出用户数据?", "提示", {
           confirmButtonText: "确定",
           cancelButtonText: "取消",
@@ -883,8 +888,8 @@
         }).then(() => {
           NProgress.start()
           exportBlob(
-            `/api/blade-system/user/export-user?${this.website.tokenHeader}=${getToken()}&account=${account}&realName=${realName}`
-            ).then(res => {
+            `/api/blade-system/user/export-user?${this.website.tokenHeader}=${getToken()}&account=${account}&realName=${realName}&deptId=${deptId}`
+          ).then(res => {
             downloadXls(res.data, `用户数据表${dateNow()}.xlsx`)
             NProgress.done()
           })
@@ -905,9 +910,9 @@
             if (this.form.hasOwnProperty("roleId")) {
               this.form.roleId = this.form.roleId.split(",")
             }
-            if (this.form.hasOwnProperty("postId")) {
-              this.form.postId = this.form.postId.split(",")
-            }
+            // if (this.form.hasOwnProperty("postId")) {
+            //     this.form.postId = this.form.postId.split(",")
+            // }
           })
         }
         this.initFlag = true
@@ -1005,4 +1010,4 @@
   .box .el-scrollbar__wrap {
     overflow: scroll;
   }
-</style>
+</style>
\ No newline at end of file

--
Gitblit v1.9.3