feat: 用户管理支持分栏拖动
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
"jsencrypt": "3.3.2",
|
"jsencrypt": "3.3.2",
|
||||||
"nprogress": "0.2.0",
|
"nprogress": "0.2.0",
|
||||||
"pinia": "2.1.7",
|
"pinia": "2.1.7",
|
||||||
|
"splitpanes": "3.1.5",
|
||||||
"vue": "3.4.15",
|
"vue": "3.4.15",
|
||||||
"vue-cropper": "1.1.1",
|
"vue-cropper": "1.1.1",
|
||||||
"vue-router": "4.4.0"
|
"vue-router": "4.4.0"
|
||||||
|
@@ -103,7 +103,7 @@
|
|||||||
/** 表格布局 **/
|
/** 表格布局 **/
|
||||||
.pagination-container {
|
.pagination-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 25px;
|
height: 32px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
padding: 10px 20px !important;
|
padding: 10px 20px !important;
|
||||||
@@ -279,3 +279,8 @@
|
|||||||
.top-right-btn {
|
.top-right-btn {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 分割面板样式 */
|
||||||
|
.splitpanes.default-theme .splitpanes__pane {
|
||||||
|
background-color: #fff!important;
|
||||||
|
}
|
||||||
|
@@ -1,8 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
|
<splitpanes
|
||||||
|
:horizontal="appStore.device === 'mobile'"
|
||||||
|
class="default-theme"
|
||||||
|
>
|
||||||
<!--部门数据-->
|
<!--部门数据-->
|
||||||
<el-col :span="4" :xs="24">
|
<pane size="16">
|
||||||
|
<el-col>
|
||||||
<div class="head-container">
|
<div class="head-container">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="deptName"
|
v-model="deptName"
|
||||||
@@ -26,9 +31,17 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
</pane>
|
||||||
<!--用户数据-->
|
<!--用户数据-->
|
||||||
<el-col :span="20" :xs="24">
|
<pane size="84">
|
||||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
<el-col>
|
||||||
|
<el-form
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryRef"
|
||||||
|
:inline="true"
|
||||||
|
v-show="showSearch"
|
||||||
|
label-width="68px"
|
||||||
|
>
|
||||||
<el-form-item label="用户名称" prop="userName">
|
<el-form-item label="用户名称" prop="userName">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.userName"
|
v-model="queryParams.userName"
|
||||||
@@ -62,7 +75,7 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="创建时间" style="width: 308px;">
|
<el-form-item label="创建时间" style="width: 308px">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="dateRange"
|
v-model="dateRange"
|
||||||
value-format="YYYY-MM-DD"
|
value-format="YYYY-MM-DD"
|
||||||
@@ -73,7 +86,9 @@
|
|||||||
></el-date-picker>
|
></el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="Search" @click="handleQuery"
|
||||||
|
>搜索</el-button
|
||||||
|
>
|
||||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@@ -86,7 +101,8 @@
|
|||||||
icon="Plus"
|
icon="Plus"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
v-hasPermi="['system:user:add']"
|
v-hasPermi="['system:user:add']"
|
||||||
>新增</el-button>
|
>新增</el-button
|
||||||
|
>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
@@ -96,7 +112,8 @@
|
|||||||
:disabled="single"
|
:disabled="single"
|
||||||
@click="handleUpdate"
|
@click="handleUpdate"
|
||||||
v-hasPermi="['system:user:edit']"
|
v-hasPermi="['system:user:edit']"
|
||||||
>修改</el-button>
|
>修改</el-button
|
||||||
|
>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
@@ -106,7 +123,8 @@
|
|||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@click="handleDelete"
|
@click="handleDelete"
|
||||||
v-hasPermi="['system:user:remove']"
|
v-hasPermi="['system:user:remove']"
|
||||||
>删除</el-button>
|
>删除</el-button
|
||||||
|
>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
@@ -115,7 +133,8 @@
|
|||||||
icon="Upload"
|
icon="Upload"
|
||||||
@click="handleImport"
|
@click="handleImport"
|
||||||
v-hasPermi="['system:user:import']"
|
v-hasPermi="['system:user:import']"
|
||||||
>导入</el-button>
|
>导入</el-button
|
||||||
|
>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
@@ -124,19 +143,67 @@
|
|||||||
icon="Download"
|
icon="Download"
|
||||||
@click="handleExport"
|
@click="handleExport"
|
||||||
v-hasPermi="['system:user:export']"
|
v-hasPermi="['system:user:export']"
|
||||||
>导出</el-button>
|
>导出</el-button
|
||||||
|
>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
<right-toolbar
|
||||||
|
v-model:showSearch="showSearch"
|
||||||
|
@queryTable="getList"
|
||||||
|
:columns="columns"
|
||||||
|
></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
|
<el-table
|
||||||
|
v-loading="loading"
|
||||||
|
:data="userList"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
>
|
||||||
<el-table-column type="selection" width="50" align="center" />
|
<el-table-column type="selection" width="50" align="center" />
|
||||||
<el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns[0].visible" />
|
<el-table-column
|
||||||
<el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
|
label="用户编号"
|
||||||
<el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" />
|
align="center"
|
||||||
<el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" />
|
key="userId"
|
||||||
<el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[4].visible" width="120" />
|
prop="userId"
|
||||||
<el-table-column label="状态" align="center" key="status" v-if="columns[5].visible">
|
v-if="columns[0].visible"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="用户名称"
|
||||||
|
align="center"
|
||||||
|
key="userName"
|
||||||
|
prop="userName"
|
||||||
|
v-if="columns[1].visible"
|
||||||
|
:show-overflow-tooltip="true"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="用户昵称"
|
||||||
|
align="center"
|
||||||
|
key="nickName"
|
||||||
|
prop="nickName"
|
||||||
|
v-if="columns[2].visible"
|
||||||
|
:show-overflow-tooltip="true"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="部门"
|
||||||
|
align="center"
|
||||||
|
key="deptName"
|
||||||
|
prop="dept.deptName"
|
||||||
|
v-if="columns[3].visible"
|
||||||
|
:show-overflow-tooltip="true"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="手机号码"
|
||||||
|
align="center"
|
||||||
|
key="phonenumber"
|
||||||
|
prop="phonenumber"
|
||||||
|
v-if="columns[4].visible"
|
||||||
|
width="120"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="状态"
|
||||||
|
align="center"
|
||||||
|
key="status"
|
||||||
|
v-if="columns[5].visible"
|
||||||
|
>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-switch
|
<el-switch
|
||||||
v-model="scope.row.status"
|
v-model="scope.row.status"
|
||||||
@@ -146,24 +213,75 @@
|
|||||||
></el-switch>
|
></el-switch>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[6].visible" width="160">
|
<el-table-column
|
||||||
|
label="创建时间"
|
||||||
|
align="center"
|
||||||
|
prop="createTime"
|
||||||
|
v-if="columns[6].visible"
|
||||||
|
width="160"
|
||||||
|
>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" width="150" class-name="small-padding fixed-width">
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
align="center"
|
||||||
|
width="150"
|
||||||
|
class-name="small-padding fixed-width"
|
||||||
|
>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tooltip content="修改" placement="top" v-if="scope.row.userId !== 1">
|
<el-tooltip
|
||||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:user:edit']"></el-button>
|
content="修改"
|
||||||
|
placement="top"
|
||||||
|
v-if="scope.row.userId !== 1"
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
icon="Edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['system:user:edit']"
|
||||||
|
></el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tooltip content="删除" placement="top" v-if="scope.row.userId !== 1">
|
<el-tooltip
|
||||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:user:remove']"></el-button>
|
content="删除"
|
||||||
|
placement="top"
|
||||||
|
v-if="scope.row.userId !== 1"
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
icon="Delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:user:remove']"
|
||||||
|
></el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tooltip content="重置密码" placement="top" v-if="scope.row.userId !== 1">
|
<el-tooltip
|
||||||
<el-button link type="primary" icon="Key" @click="handleResetPwd(scope.row)" v-hasPermi="['system:user:resetPwd']"></el-button>
|
content="重置密码"
|
||||||
|
placement="top"
|
||||||
|
v-if="scope.row.userId !== 1"
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
icon="Key"
|
||||||
|
@click="handleResetPwd(scope.row)"
|
||||||
|
v-hasPermi="['system:user:resetPwd']"
|
||||||
|
></el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tooltip content="分配角色" placement="top" v-if="scope.row.userId !== 1">
|
<el-tooltip
|
||||||
<el-button link type="primary" icon="CircleCheck" @click="handleAuthRole(scope.row)" v-hasPermi="['system:user:edit']"></el-button>
|
content="分配角色"
|
||||||
|
placement="top"
|
||||||
|
v-if="scope.row.userId !== 1"
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
icon="CircleCheck"
|
||||||
|
@click="handleAuthRole(scope.row)"
|
||||||
|
v-hasPermi="['system:user:edit']"
|
||||||
|
></el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -176,6 +294,8 @@
|
|||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
</pane>
|
||||||
|
</splitpanes>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<!-- 添加或修改用户配置对话框 -->
|
<!-- 添加或修改用户配置对话框 -->
|
||||||
@@ -184,7 +304,11 @@
|
|||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="用户昵称" prop="nickName">
|
<el-form-item label="用户昵称" prop="nickName">
|
||||||
<el-input v-model="form.nickName" placeholder="请输入用户昵称" maxlength="30" />
|
<el-input
|
||||||
|
v-model="form.nickName"
|
||||||
|
placeholder="请输入用户昵称"
|
||||||
|
maxlength="30"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
@@ -203,24 +327,50 @@
|
|||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="手机号码" prop="phonenumber">
|
<el-form-item label="手机号码" prop="phonenumber">
|
||||||
<el-input v-model="form.phonenumber" placeholder="请输入手机号码" maxlength="11" />
|
<el-input
|
||||||
|
v-model="form.phonenumber"
|
||||||
|
placeholder="请输入手机号码"
|
||||||
|
maxlength="11"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="邮箱" prop="email">
|
<el-form-item label="邮箱" prop="email">
|
||||||
<el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" />
|
<el-input
|
||||||
|
v-model="form.email"
|
||||||
|
placeholder="请输入邮箱"
|
||||||
|
maxlength="50"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item v-if="form.userId == undefined" label="用户名称" prop="userName">
|
<el-form-item
|
||||||
<el-input v-model="form.userName" placeholder="请输入用户名称" maxlength="30" />
|
v-if="form.userId == undefined"
|
||||||
|
label="用户名称"
|
||||||
|
prop="userName"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
v-model="form.userName"
|
||||||
|
placeholder="请输入用户名称"
|
||||||
|
maxlength="30"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item v-if="form.userId == undefined" label="用户密码" prop="password">
|
<el-form-item
|
||||||
<el-input v-model="form.password" placeholder="请输入用户密码" type="password" maxlength="20" show-password />
|
v-if="form.userId == undefined"
|
||||||
|
label="用户密码"
|
||||||
|
prop="password"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
v-model="form.password"
|
||||||
|
placeholder="请输入用户密码"
|
||||||
|
type="password"
|
||||||
|
maxlength="20"
|
||||||
|
show-password
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@@ -244,7 +394,8 @@
|
|||||||
v-for="dict in sys_normal_disable"
|
v-for="dict in sys_normal_disable"
|
||||||
:key="dict.value"
|
:key="dict.value"
|
||||||
:value="dict.value"
|
:value="dict.value"
|
||||||
>{{ dict.label }}</el-radio>
|
>{{ dict.label }}</el-radio
|
||||||
|
>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@@ -280,7 +431,11 @@
|
|||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="备注">
|
<el-form-item label="备注">
|
||||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
|
<el-input
|
||||||
|
v-model="form.remark"
|
||||||
|
type="textarea"
|
||||||
|
placeholder="请输入内容"
|
||||||
|
></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@@ -294,7 +449,12 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<!-- 用户导入对话框 -->
|
<!-- 用户导入对话框 -->
|
||||||
<el-dialog :title="upload.title" v-model="upload.open" width="400px" append-to-body>
|
<el-dialog
|
||||||
|
:title="upload.title"
|
||||||
|
v-model="upload.open"
|
||||||
|
width="400px"
|
||||||
|
append-to-body
|
||||||
|
>
|
||||||
<el-upload
|
<el-upload
|
||||||
ref="uploadRef"
|
ref="uploadRef"
|
||||||
:limit="1"
|
:limit="1"
|
||||||
@@ -312,10 +472,18 @@
|
|||||||
<template #tip>
|
<template #tip>
|
||||||
<div class="el-upload__tip text-center">
|
<div class="el-upload__tip text-center">
|
||||||
<div class="el-upload__tip">
|
<div class="el-upload__tip">
|
||||||
<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
|
<el-checkbox
|
||||||
|
v-model="upload.updateSupport"
|
||||||
|
/>是否更新已经存在的用户数据
|
||||||
</div>
|
</div>
|
||||||
<span>仅允许导入xls、xlsx格式文件。</span>
|
<span>仅允许导入xls、xlsx格式文件。</span>
|
||||||
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>
|
<el-link
|
||||||
|
type="primary"
|
||||||
|
:underline="false"
|
||||||
|
style="font-size: 12px; vertical-align: baseline"
|
||||||
|
@click="importTemplate"
|
||||||
|
>下载模板</el-link
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
@@ -331,11 +499,27 @@
|
|||||||
|
|
||||||
<script setup name="User">
|
<script setup name="User">
|
||||||
import { getToken } from "@/utils/auth";
|
import { getToken } from "@/utils/auth";
|
||||||
import { changeUserStatus, listUser, resetUserPwd, delUser, getUser, updateUser, addUser, deptTreeSelect } from "@/api/system/user";
|
import useAppStore from "@/store/modules/app";
|
||||||
|
import {
|
||||||
|
changeUserStatus,
|
||||||
|
listUser,
|
||||||
|
resetUserPwd,
|
||||||
|
delUser,
|
||||||
|
getUser,
|
||||||
|
updateUser,
|
||||||
|
addUser,
|
||||||
|
deptTreeSelect,
|
||||||
|
} from "@/api/system/user";
|
||||||
|
import { Splitpanes, Pane } from "splitpanes";
|
||||||
|
import "splitpanes/dist/splitpanes.css";
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const appStore = useAppStore();
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
const { sys_normal_disable, sys_user_sex } = proxy.useDict("sys_normal_disable", "sys_user_sex");
|
const { sys_normal_disable, sys_user_sex } = proxy.useDict(
|
||||||
|
"sys_normal_disable",
|
||||||
|
"sys_user_sex"
|
||||||
|
);
|
||||||
|
|
||||||
const userList = ref([]);
|
const userList = ref([]);
|
||||||
const open = ref(false);
|
const open = ref(false);
|
||||||
@@ -365,7 +549,7 @@ const upload = reactive({
|
|||||||
// 设置上传的请求头部
|
// 设置上传的请求头部
|
||||||
headers: { Authorization: "Bearer " + getToken() },
|
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([
|
const columns = ref([
|
||||||
@@ -375,7 +559,7 @@ const columns = ref([
|
|||||||
{ key: 3, label: `部门`, visible: true },
|
{ key: 3, label: `部门`, visible: true },
|
||||||
{ key: 4, label: `手机号码`, visible: true },
|
{ key: 4, label: `手机号码`, visible: true },
|
||||||
{ key: 5, label: `状态`, visible: true },
|
{ key: 5, label: `状态`, visible: true },
|
||||||
{ key: 6, label: `创建时间`, visible: true }
|
{ key: 6, label: `创建时间`, visible: true },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
@@ -386,15 +570,50 @@ const data = reactive({
|
|||||||
userName: undefined,
|
userName: undefined,
|
||||||
phonenumber: undefined,
|
phonenumber: undefined,
|
||||||
status: undefined,
|
status: undefined,
|
||||||
deptId: undefined
|
deptId: undefined,
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
userName: [{ required: true, message: "用户名称不能为空", trigger: "blur" }, { min: 2, max: 20, message: "用户名称长度必须介于 2 和 20 之间", trigger: "blur" }],
|
userName: [
|
||||||
nickName: [{ required: true, message: "用户昵称不能为空", trigger: "blur" }],
|
{ required: true, message: "用户名称不能为空", trigger: "blur" },
|
||||||
password: [{ required: true, message: "用户密码不能为空", trigger: "blur" }, { min: 5, max: 20, message: "用户密码长度必须介于 5 和 20 之间", trigger: "blur" }, { pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" }],
|
{
|
||||||
email: [{ type: "email", message: "请输入正确的邮箱地址", trigger: ["blur", "change"] }],
|
min: 2,
|
||||||
phonenumber: [{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur" }]
|
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",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pattern: /^[^<>"'|\\]+$/,
|
||||||
|
message: "不能包含非法字符:< > \" ' \\\ |",
|
||||||
|
trigger: "blur",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
email: [
|
||||||
|
{
|
||||||
|
type: "email",
|
||||||
|
message: "请输入正确的邮箱地址",
|
||||||
|
trigger: ["blur", "change"],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
phonenumber: [
|
||||||
|
{
|
||||||
|
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
|
||||||
|
message: "请输入正确的手机号码",
|
||||||
|
trigger: "blur",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const { queryParams, form, rules } = toRefs(data);
|
const { queryParams, form, rules } = toRefs(data);
|
||||||
@@ -405,34 +624,36 @@ const filterNode = (value, data) => {
|
|||||||
return data.label.indexOf(value) !== -1;
|
return data.label.indexOf(value) !== -1;
|
||||||
};
|
};
|
||||||
/** 根据名称筛选部门树 */
|
/** 根据名称筛选部门树 */
|
||||||
watch(deptName, val => {
|
watch(deptName, (val) => {
|
||||||
proxy.$refs["deptTreeRef"].filter(val);
|
proxy.$refs["deptTreeRef"].filter(val);
|
||||||
});
|
});
|
||||||
/** 查询部门下拉树结构 */
|
/** 查询部门下拉树结构 */
|
||||||
function getDeptTree() {
|
function getDeptTree() {
|
||||||
deptTreeSelect().then(response => {
|
deptTreeSelect().then((response) => {
|
||||||
deptOptions.value = response.data;
|
deptOptions.value = response.data;
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
/** 查询用户列表 */
|
/** 查询用户列表 */
|
||||||
function getList() {
|
function getList() {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
listUser(proxy.addDateRange(queryParams.value, dateRange.value)).then(res => {
|
listUser(proxy.addDateRange(queryParams.value, dateRange.value)).then(
|
||||||
|
(res) => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
userList.value = res.rows;
|
userList.value = res.rows;
|
||||||
total.value = res.total;
|
total.value = res.total;
|
||||||
});
|
}
|
||||||
};
|
);
|
||||||
|
}
|
||||||
/** 节点单击事件 */
|
/** 节点单击事件 */
|
||||||
function handleNodeClick(data) {
|
function handleNodeClick(data) {
|
||||||
queryParams.value.deptId = data.id;
|
queryParams.value.deptId = data.id;
|
||||||
handleQuery();
|
handleQuery();
|
||||||
};
|
}
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
function handleQuery() {
|
function handleQuery() {
|
||||||
queryParams.value.pageNum = 1;
|
queryParams.value.pageNum = 1;
|
||||||
getList();
|
getList();
|
||||||
};
|
}
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
function resetQuery() {
|
function resetQuery() {
|
||||||
dateRange.value = [];
|
dateRange.value = [];
|
||||||
@@ -440,34 +661,46 @@ function resetQuery() {
|
|||||||
queryParams.value.deptId = undefined;
|
queryParams.value.deptId = undefined;
|
||||||
proxy.$refs.deptTreeRef.setCurrentKey(null);
|
proxy.$refs.deptTreeRef.setCurrentKey(null);
|
||||||
handleQuery();
|
handleQuery();
|
||||||
};
|
}
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
function handleDelete(row) {
|
function handleDelete(row) {
|
||||||
const userIds = row.userId || ids.value;
|
const userIds = row.userId || ids.value;
|
||||||
proxy.$modal.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?').then(function () {
|
proxy.$modal
|
||||||
|
.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?')
|
||||||
|
.then(function () {
|
||||||
return delUser(userIds);
|
return delUser(userIds);
|
||||||
}).then(() => {
|
})
|
||||||
|
.then(() => {
|
||||||
getList();
|
getList();
|
||||||
proxy.$modal.msgSuccess("删除成功");
|
proxy.$modal.msgSuccess("删除成功");
|
||||||
}).catch(() => {});
|
})
|
||||||
};
|
.catch(() => {});
|
||||||
|
}
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
function handleExport() {
|
function handleExport() {
|
||||||
proxy.download("system/user/export", {
|
proxy.download(
|
||||||
|
"system/user/export",
|
||||||
|
{
|
||||||
...queryParams.value,
|
...queryParams.value,
|
||||||
},`user_${new Date().getTime()}.xlsx`);
|
},
|
||||||
};
|
`user_${new Date().getTime()}.xlsx`
|
||||||
|
);
|
||||||
|
}
|
||||||
/** 用户状态修改 */
|
/** 用户状态修改 */
|
||||||
function handleStatusChange(row) {
|
function handleStatusChange(row) {
|
||||||
let text = row.status === "0" ? "启用" : "停用";
|
let text = row.status === "0" ? "启用" : "停用";
|
||||||
proxy.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?').then(function () {
|
proxy.$modal
|
||||||
|
.confirm('确认要"' + text + '""' + row.userName + '"用户吗?')
|
||||||
|
.then(function () {
|
||||||
return changeUserStatus(row.userId, row.status);
|
return changeUserStatus(row.userId, row.status);
|
||||||
}).then(() => {
|
})
|
||||||
|
.then(() => {
|
||||||
proxy.$modal.msgSuccess(text + "成功");
|
proxy.$modal.msgSuccess(text + "成功");
|
||||||
}).catch(function () {
|
})
|
||||||
|
.catch(function () {
|
||||||
row.status = row.status === "0" ? "1" : "0";
|
row.status = row.status === "0" ? "1" : "0";
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
/** 更多操作 */
|
/** 更多操作 */
|
||||||
function handleCommand(command, row) {
|
function handleCommand(command, row) {
|
||||||
switch (command) {
|
switch (command) {
|
||||||
@@ -480,15 +713,16 @@ function handleCommand(command, row) {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
/** 跳转角色分配 */
|
/** 跳转角色分配 */
|
||||||
function handleAuthRole(row) {
|
function handleAuthRole(row) {
|
||||||
const userId = row.userId;
|
const userId = row.userId;
|
||||||
router.push("/system/user-auth/role/" + userId);
|
router.push("/system/user-auth/role/" + userId);
|
||||||
};
|
}
|
||||||
/** 重置密码按钮操作 */
|
/** 重置密码按钮操作 */
|
||||||
function handleResetPwd(row) {
|
function handleResetPwd(row) {
|
||||||
proxy.$prompt('请输入"' + row.userName + '"的新密码', "提示", {
|
proxy
|
||||||
|
.$prompt('请输入"' + row.userName + '"的新密码', "提示", {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
closeOnClickModal: false,
|
closeOnClickModal: false,
|
||||||
@@ -496,31 +730,36 @@ function handleResetPwd(row) {
|
|||||||
inputErrorMessage: "用户密码长度必须介于 5 和 20 之间",
|
inputErrorMessage: "用户密码长度必须介于 5 和 20 之间",
|
||||||
inputValidator: (value) => {
|
inputValidator: (value) => {
|
||||||
if (/<|>|"|'|\||\\/.test(value)) {
|
if (/<|>|"|'|\||\\/.test(value)) {
|
||||||
return "不能包含非法字符:< > \" ' \\\ |"
|
return "不能包含非法字符:< > \" ' \\\ |";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}).then(({ value }) => {
|
})
|
||||||
resetUserPwd(row.userId, value).then(response => {
|
.then(({ value }) => {
|
||||||
|
resetUserPwd(row.userId, value).then((response) => {
|
||||||
proxy.$modal.msgSuccess("修改成功,新密码是:" + value);
|
proxy.$modal.msgSuccess("修改成功,新密码是:" + value);
|
||||||
});
|
});
|
||||||
}).catch(() => {});
|
})
|
||||||
};
|
.catch(() => {});
|
||||||
|
}
|
||||||
/** 选择条数 */
|
/** 选择条数 */
|
||||||
function handleSelectionChange(selection) {
|
function handleSelectionChange(selection) {
|
||||||
ids.value = selection.map(item => item.userId);
|
ids.value = selection.map((item) => item.userId);
|
||||||
single.value = selection.length != 1;
|
single.value = selection.length != 1;
|
||||||
multiple.value = !selection.length;
|
multiple.value = !selection.length;
|
||||||
};
|
}
|
||||||
/** 导入按钮操作 */
|
/** 导入按钮操作 */
|
||||||
function handleImport() {
|
function handleImport() {
|
||||||
upload.title = "用户导入";
|
upload.title = "用户导入";
|
||||||
upload.open = true;
|
upload.open = true;
|
||||||
};
|
}
|
||||||
/** 下载模板操作 */
|
/** 下载模板操作 */
|
||||||
function importTemplate() {
|
function importTemplate() {
|
||||||
proxy.download("system/user/importTemplate", {
|
proxy.download(
|
||||||
}, `user_template_${new Date().getTime()}.xlsx`);
|
"system/user/importTemplate",
|
||||||
};
|
{},
|
||||||
|
`user_template_${new Date().getTime()}.xlsx`
|
||||||
|
);
|
||||||
|
}
|
||||||
/**文件上传中处理 */
|
/**文件上传中处理 */
|
||||||
const handleFileUploadProgress = (event, file, fileList) => {
|
const handleFileUploadProgress = (event, file, fileList) => {
|
||||||
upload.isUploading = true;
|
upload.isUploading = true;
|
||||||
@@ -530,13 +769,19 @@ const handleFileSuccess = (response, file, fileList) => {
|
|||||||
upload.open = false;
|
upload.open = false;
|
||||||
upload.isUploading = false;
|
upload.isUploading = false;
|
||||||
proxy.$refs["uploadRef"].handleRemove(file);
|
proxy.$refs["uploadRef"].handleRemove(file);
|
||||||
proxy.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
|
proxy.$alert(
|
||||||
|
"<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
|
||||||
|
response.msg +
|
||||||
|
"</div>",
|
||||||
|
"导入结果",
|
||||||
|
{ dangerouslyUseHTMLString: true }
|
||||||
|
);
|
||||||
getList();
|
getList();
|
||||||
};
|
};
|
||||||
/** 提交上传文件 */
|
/** 提交上传文件 */
|
||||||
function submitFileForm() {
|
function submitFileForm() {
|
||||||
proxy.$refs["uploadRef"].submit();
|
proxy.$refs["uploadRef"].submit();
|
||||||
};
|
}
|
||||||
/** 重置操作表单 */
|
/** 重置操作表单 */
|
||||||
function reset() {
|
function reset() {
|
||||||
form.value = {
|
form.value = {
|
||||||
@@ -551,31 +796,31 @@ function reset() {
|
|||||||
status: "0",
|
status: "0",
|
||||||
remark: undefined,
|
remark: undefined,
|
||||||
postIds: [],
|
postIds: [],
|
||||||
roleIds: []
|
roleIds: [],
|
||||||
};
|
};
|
||||||
proxy.resetForm("userRef");
|
proxy.resetForm("userRef");
|
||||||
};
|
}
|
||||||
/** 取消按钮 */
|
/** 取消按钮 */
|
||||||
function cancel() {
|
function cancel() {
|
||||||
open.value = false;
|
open.value = false;
|
||||||
reset();
|
reset();
|
||||||
};
|
}
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
function handleAdd() {
|
function handleAdd() {
|
||||||
reset();
|
reset();
|
||||||
getUser().then(response => {
|
getUser().then((response) => {
|
||||||
postOptions.value = response.posts;
|
postOptions.value = response.posts;
|
||||||
roleOptions.value = response.roles;
|
roleOptions.value = response.roles;
|
||||||
open.value = true;
|
open.value = true;
|
||||||
title.value = "添加用户";
|
title.value = "添加用户";
|
||||||
form.value.password = initPassword.value;
|
form.value.password = initPassword.value;
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
function handleUpdate(row) {
|
function handleUpdate(row) {
|
||||||
reset();
|
reset();
|
||||||
const userId = row.userId || ids.value;
|
const userId = row.userId || ids.value;
|
||||||
getUser(userId).then(response => {
|
getUser(userId).then((response) => {
|
||||||
form.value = response.data;
|
form.value = response.data;
|
||||||
postOptions.value = response.posts;
|
postOptions.value = response.posts;
|
||||||
roleOptions.value = response.roles;
|
roleOptions.value = response.roles;
|
||||||
@@ -585,19 +830,19 @@ function handleUpdate(row) {
|
|||||||
title.value = "修改用户";
|
title.value = "修改用户";
|
||||||
form.value.password = undefined;
|
form.value.password = undefined;
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
function submitForm() {
|
function submitForm() {
|
||||||
proxy.$refs["userRef"].validate(valid => {
|
proxy.$refs["userRef"].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (form.value.userId != undefined) {
|
if (form.value.userId != undefined) {
|
||||||
updateUser(form.value).then(response => {
|
updateUser(form.value).then((response) => {
|
||||||
proxy.$modal.msgSuccess("修改成功");
|
proxy.$modal.msgSuccess("修改成功");
|
||||||
open.value = false;
|
open.value = false;
|
||||||
getList();
|
getList();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
addUser(form.value).then(response => {
|
addUser(form.value).then((response) => {
|
||||||
proxy.$modal.msgSuccess("新增成功");
|
proxy.$modal.msgSuccess("新增成功");
|
||||||
open.value = false;
|
open.value = false;
|
||||||
getList();
|
getList();
|
||||||
@@ -605,7 +850,7 @@ function submitForm() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
getDeptTree();
|
getDeptTree();
|
||||||
getList();
|
getList();
|
||||||
|
Reference in New Issue
Block a user