From 5c4c90a27c352dfc0da414e32c25324caf06f686 Mon Sep 17 00:00:00 2001 From: RuoYi <yzz_ivy@163.com> Date: 星期五, 13 五月 2022 15:00:24 +0800 Subject: [PATCH] 用户管理左侧树型组件增加选中高亮保持 --- src/views/system/user/index.vue | 103 ++++++++++++++++++++++++--------------------------- 1 files changed, 49 insertions(+), 54 deletions(-) diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index 4edd8c0..a9e5bf4 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -8,8 +8,7 @@ v-model="deptName" placeholder="璇疯緭鍏ラ儴闂ㄥ悕绉�" clearable - size="small" - prefix-icon="el-icon-search" + prefix-icon="Search" style="margin-bottom: 20px" /> </div> @@ -20,6 +19,7 @@ :expand-on-click-node="false" :filter-node-method="filterNode" ref="deptTreeRef" + highlight-current default-expand-all @node-click="handleNodeClick" /> @@ -33,7 +33,6 @@ v-model="queryParams.userName" placeholder="璇疯緭鍏ョ敤鎴峰悕绉�" clearable - size="small" style="width: 240px" @keyup.enter="handleQuery" /> @@ -43,7 +42,6 @@ v-model="queryParams.phonenumber" placeholder="璇疯緭鍏ユ墜鏈哄彿鐮�" clearable - size="small" style="width: 240px" @keyup.enter="handleQuery" /> @@ -53,7 +51,6 @@ v-model="queryParams.status" placeholder="鐢ㄦ埛鐘舵��" clearable - size="small" style="width: 240px" > <el-option @@ -64,11 +61,9 @@ /> </el-select> </el-form-item> - <el-form-item label="鍒涘缓鏃堕棿"> + <el-form-item label="鍒涘缓鏃堕棿" style="width: 308px;"> <el-date-picker v-model="dateRange" - size="small" - style="width: 240px" value-format="YYYY-MM-DD" type="daterange" range-separator="-" @@ -77,8 +72,8 @@ ></el-date-picker> </el-form-item> <el-form-item> - <el-button type="primary" icon="Search" size="mini" @click="handleQuery">鎼滅储</el-button> - <el-button icon="Refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> + <el-button type="primary" icon="Search" @click="handleQuery">鎼滅储</el-button> + <el-button icon="Refresh" @click="resetQuery">閲嶇疆</el-button> </el-form-item> </el-form> @@ -88,7 +83,6 @@ type="primary" plain icon="Plus" - size="mini" @click="handleAdd" v-hasPermi="['system:user:add']" >鏂板</el-button> @@ -98,7 +92,6 @@ type="success" plain icon="Edit" - size="mini" :disabled="single" @click="handleUpdate" v-hasPermi="['system:user:edit']" @@ -109,7 +102,6 @@ type="danger" plain icon="Delete" - size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['system:user:remove']" @@ -120,7 +112,6 @@ type="info" plain icon="Upload" - size="mini" @click="handleImport" v-hasPermi="['system:user:import']" >瀵煎叆</el-button> @@ -130,7 +121,6 @@ type="warning" plain icon="Download" - size="mini" @click="handleExport" v-hasPermi="['system:user:export']" >瀵煎嚭</el-button> @@ -155,42 +145,45 @@ ></el-switch> </template> </el-table-column> - <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" v-if="columns[6].visible" width="150"> + <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" v-if="columns[6].visible" width="160"> <template #default="scope"> <span>{{ parseTime(scope.row.createTime) }}</span> </template> </el-table-column> - <el-table-column label="鎿嶄綔" align="center" width="180" class-name="small-padding fixed-width"> + <el-table-column label="鎿嶄綔" align="center" width="150" class-name="small-padding fixed-width"> <template #default="scope"> - <el-button - size="mini" - v-if="scope.row.userId !== 1" - type="text" - icon="Edit" - @click="handleUpdate(scope.row)" - v-hasPermi="['system:user:edit']" - >淇敼</el-button> - <el-button - size="mini" - v-if="scope.row.userId !== 1" - type="text" - icon="Delete" - @click="handleDelete(scope.row)" - v-hasPermi="['system:user:remove']" - >鍒犻櫎</el-button> - <el-dropdown v-if="scope.row.userId !== 1" @command="(command) => handleCommand(command, scope.row)"> - <span class="el-dropdown-link" v-hasPermi="['system:user:resetPwd', 'system:user:edit']"> - <el-icon><d-arrow-right /></el-icon>鏇村 - </span> - <template #dropdown> - <el-dropdown-menu> - <el-dropdown-item command="handleResetPwd" icon="Key" - v-hasPermi="['system:user:resetPwd']">閲嶇疆瀵嗙爜</el-dropdown-item> - <el-dropdown-item command="handleAuthRole" icon="CircleCheck" - v-hasPermi="['system:user:edit']">鍒嗛厤瑙掕壊</el-dropdown-item> - </el-dropdown-menu> - </template> - </el-dropdown> + <el-tooltip content="淇敼" placement="top" v-if="scope.row.userId !== 1"> + <el-button + type="text" + icon="Edit" + @click="handleUpdate(scope.row)" + v-hasPermi="['system:user:edit']" + ></el-button> + </el-tooltip> + <el-tooltip content="鍒犻櫎" placement="top" v-if="scope.row.userId !== 1"> + <el-button + type="text" + icon="Delete" + @click="handleDelete(scope.row)" + v-hasPermi="['system:user:remove']" + ></el-button> + </el-tooltip> + <el-tooltip content="閲嶇疆瀵嗙爜" placement="top" v-if="scope.row.userId !== 1"> + <el-button + type="text" + icon="Key" + @click="handleResetPwd(scope.row)" + v-hasPermi="['system:user:resetPwd']" + ></el-button> + </el-tooltip> + <el-tooltip content="鍒嗛厤瑙掕壊" placement="top" v-if="scope.row.userId !== 1"> + <el-button + type="text" + icon="CircleCheck" + @click="handleAuthRole(scope.row)" + v-hasPermi="['system:user:edit']" + ></el-button> + </el-tooltip> </template> </el-table-column> </el-table> @@ -215,11 +208,13 @@ </el-col> <el-col :span="12"> <el-form-item label="褰掑睘閮ㄩ棬" prop="deptId"> - <tree-select - v-model:value="form.deptId" - :options="deptOptions" + <el-tree-select + v-model="form.deptId" + :data="deptOptions" + :props="{ value: 'id', label: 'label', children: 'children' }" + value-key="id" placeholder="璇烽�夋嫨褰掑睘閮ㄩ棬" - :objMap="{ value: 'id', label: 'label', children: 'children' }" + check-strictly /> </el-form-item> </el-col> @@ -390,7 +385,7 @@ // 璁剧疆涓婁紶鐨勮姹傚ご閮� headers: { Authorization: "Bearer " + getToken() }, // 涓婁紶鐨勫湴鍧� - url: import.meta.env.VITE_APP_BASE_API + "system/user/importData" + url: import.meta.env.VITE_APP_BASE_API + "/system/user/importData" }); // 鍒楁樉闅愪俊鎭� const columns = ref([ @@ -417,7 +412,7 @@ userName: [{ required: true, message: "鐢ㄦ埛鍚嶇О涓嶈兘涓虹┖", trigger: "blur" }, { min: 2, max: 20, message: "鐢ㄦ埛鍚嶇О闀垮害蹇呴』浠嬩簬 2 鍜� 20 涔嬮棿", trigger: "blur" }], nickName: [{ required: true, message: "鐢ㄦ埛鏄电О涓嶈兘涓虹┖", trigger: "blur" }], password: [{ required: true, message: "鐢ㄦ埛瀵嗙爜涓嶈兘涓虹┖", trigger: "blur" }, { min: 5, max: 20, message: "鐢ㄦ埛瀵嗙爜闀垮害蹇呴』浠嬩簬 5 鍜� 20 涔嬮棿", trigger: "blur" }], - email: [{ type: "email", message: "'璇疯緭鍏ユ纭殑閭鍦板潃", trigger: ["blur", "change"] }], + email: [{ type: "email", message: "璇疯緭鍏ユ纭殑閭鍦板潃", trigger: ["blur", "change"] }], phonenumber: [{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "璇疯緭鍏ユ纭殑鎵嬫満鍙风爜", trigger: "blur" }] } }); @@ -451,7 +446,7 @@ /** 鑺傜偣鍗曞嚮浜嬩欢 */ function handleNodeClick(data) { queryParams.value.deptId = data.id; - getList(); + handleQuery(); }; /** 鎼滅储鎸夐挳鎿嶄綔 */ function handleQuery() { @@ -596,7 +591,7 @@ roleOptions.value = response.roles; open.value = true; title.value = "娣诲姞鐢ㄦ埛"; - form.password.value = initPassword.value; + form.value.password = initPassword.value; }); }; /** 淇敼鎸夐挳鎿嶄綔 */ -- Gitblit v1.9.3