|
@@ -34,7 +34,7 @@
|
|
placeholder="请输入用户名称"
|
|
placeholder="请输入用户名称"
|
|
clearable
|
|
clearable
|
|
size="small"
|
|
size="small"
|
|
- style="width: 240px"
|
|
|
|
|
|
+ style="width: 140px"
|
|
@keyup.enter.native="handleQuery"
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
/>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -44,7 +44,7 @@
|
|
placeholder="请输入手机号码"
|
|
placeholder="请输入手机号码"
|
|
clearable
|
|
clearable
|
|
size="small"
|
|
size="small"
|
|
- style="width: 240px"
|
|
|
|
|
|
+ style="width: 140px"
|
|
@keyup.enter.native="handleQuery"
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
/>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -54,7 +54,7 @@
|
|
placeholder="用户状态"
|
|
placeholder="用户状态"
|
|
clearable
|
|
clearable
|
|
size="small"
|
|
size="small"
|
|
- style="width: 240px"
|
|
|
|
|
|
+ style="width: 120px"
|
|
>
|
|
>
|
|
<el-option
|
|
<el-option
|
|
v-for="dict in statusOptions"
|
|
v-for="dict in statusOptions"
|
|
@@ -78,12 +78,7 @@
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-form-item>
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
|
- </el-form-item>
|
|
|
|
- </el-form>
|
|
|
|
-
|
|
|
|
- <el-row :gutter="10" class="mb8">
|
|
|
|
- <el-col :span="1.5">
|
|
|
|
|
|
+ <el-button type="primary" icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
<el-button
|
|
<el-button
|
|
type="primary"
|
|
type="primary"
|
|
plain
|
|
plain
|
|
@@ -92,19 +87,6 @@
|
|
@click="handleAdd"
|
|
@click="handleAdd"
|
|
v-hasPermi="['system:user:add']"
|
|
v-hasPermi="['system:user:add']"
|
|
>新增</el-button>
|
|
>新增</el-button>
|
|
- </el-col>
|
|
|
|
- <el-col :span="1.5">
|
|
|
|
- <el-button
|
|
|
|
- type="success"
|
|
|
|
- plain
|
|
|
|
- icon="el-icon-edit"
|
|
|
|
- size="mini"
|
|
|
|
- :disabled="single"
|
|
|
|
- @click="handleUpdate"
|
|
|
|
- v-hasPermi="['system:user:edit']"
|
|
|
|
- >修改</el-button>
|
|
|
|
- </el-col>
|
|
|
|
- <el-col :span="1.5">
|
|
|
|
<el-button
|
|
<el-button
|
|
type="danger"
|
|
type="danger"
|
|
plain
|
|
plain
|
|
@@ -114,38 +96,16 @@
|
|
@click="handleDelete"
|
|
@click="handleDelete"
|
|
v-hasPermi="['system:user:remove']"
|
|
v-hasPermi="['system:user:remove']"
|
|
>删除</el-button>
|
|
>删除</el-button>
|
|
- </el-col>
|
|
|
|
- <!-- <el-col :span="1.5">
|
|
|
|
- <el-button
|
|
|
|
- type="info"
|
|
|
|
- plain
|
|
|
|
- icon="el-icon-upload2"
|
|
|
|
- size="mini"
|
|
|
|
- @click="handleImport"
|
|
|
|
- v-hasPermi="['system:user:import']"
|
|
|
|
- >导入</el-button>
|
|
|
|
- </el-col>
|
|
|
|
- <el-col :span="1.5">
|
|
|
|
- <el-button
|
|
|
|
- type="warning"
|
|
|
|
- plain
|
|
|
|
- icon="el-icon-download"
|
|
|
|
- size="mini"
|
|
|
|
- :loading="exportLoading"
|
|
|
|
- @click="handleExport"
|
|
|
|
- v-hasPermi="['system:user:export']"
|
|
|
|
- >导出</el-button>
|
|
|
|
- </el-col> -->
|
|
|
|
- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
|
|
|
- </el-row>
|
|
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
|
|
|
|
- <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
|
|
|
|
|
|
+ <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange" height="calc(100vh - 12vh - 120px)">
|
|
<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 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="userId" prop="userId" v-if="columns[0].visible" show-overflow-tooltip />
|
|
|
|
+ <el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns[1].visible" show-overflow-tooltip />
|
|
|
|
+ <el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" show-overflow-tooltip />
|
|
|
|
+ <el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" show-overflow-tooltip />
|
|
|
|
+ <el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[4].visible" show-overflow-tooltip />
|
|
<el-table-column label="状态" align="center" key="status" v-if="columns[5].visible">
|
|
<el-table-column label="状态" align="center" key="status" v-if="columns[5].visible">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
<el-switch
|
|
<el-switch
|
|
@@ -156,7 +116,7 @@
|
|
></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" show-overflow-tooltip >
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
|
</template>
|
|
</template>
|
|
@@ -220,7 +180,7 @@
|
|
<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.trim="form.nickName" placeholder="请输入用户昵称" maxlength="15" show-word-limit />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
@@ -232,24 +192,24 @@
|
|
<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.trim="form.phonenumber" placeholder="请输入手机号码" maxlength="11" show-word-limit/>
|
|
</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.trim="form.email" placeholder="请输入邮箱" maxlength="20" show-word-limit />
|
|
</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 v-if="form.userId == undefined" label="用户名称" prop="userName">
|
|
- <el-input v-model="form.userName" placeholder="请输入用户名称" maxlength="30" />
|
|
|
|
|
|
+ <el-input v-model.trim="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 v-if="form.userId == undefined" label="用户密码" prop="password">
|
|
- <el-input v-model="form.password" placeholder="请输入用户密码" type="password" maxlength="20" show-password/>
|
|
|
|
|
|
+ <el-input v-model.trim="form.password" placeholder="请输入用户密码" type="password" maxlength="20" show-password @input="onInput()" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
@@ -280,8 +240,8 @@
|
|
</el-row>
|
|
</el-row>
|
|
<el-row>
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
- <el-form-item label="岗位">
|
|
|
|
- <el-select v-model="form.postIds" placeholder="请选择" multiple>
|
|
|
|
|
|
+ <el-form-item label="岗位" prop="postId">
|
|
|
|
+ <el-select v-model.trim="form.postId" placeholder="请选择" @change='changeUnit'>
|
|
<el-option
|
|
<el-option
|
|
v-for="item in postOptions"
|
|
v-for="item in postOptions"
|
|
:key="item.postId"
|
|
:key="item.postId"
|
|
@@ -293,8 +253,9 @@
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
- <el-form-item label="角色" prop="roleIds">
|
|
|
|
- <el-select v-model="form.roleIds" placeholder="请选择" multiple>
|
|
|
|
|
|
+ <el-form-item label="角色" prop="roleId">
|
|
|
|
+ <!-- multiple -->
|
|
|
|
+ <el-select v-model="form.roleId" placeholder="请选择" >
|
|
<el-option
|
|
<el-option
|
|
v-for="item in roleOptions"
|
|
v-for="item in roleOptions"
|
|
:key="item.roleId"
|
|
:key="item.roleId"
|
|
@@ -309,7 +270,7 @@
|
|
<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.trim="form.remark" type="textarea" placeholder="请输入内容" maxlength="30" show-word-limit></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
@@ -453,7 +414,7 @@ export default {
|
|
],
|
|
],
|
|
password: [
|
|
password: [
|
|
{ required: true, message: "用户密码不能为空", trigger: "blur" },
|
|
{ required: true, message: "用户密码不能为空", trigger: "blur" },
|
|
- { min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' }
|
|
|
|
|
|
+ { min: 1, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' }
|
|
],
|
|
],
|
|
email: [
|
|
email: [
|
|
{ required: true, message: "邮箱地址不能为空", trigger: "blur" },
|
|
{ required: true, message: "邮箱地址不能为空", trigger: "blur" },
|
|
@@ -471,7 +432,7 @@ export default {
|
|
trigger: "blur"
|
|
trigger: "blur"
|
|
}
|
|
}
|
|
],
|
|
],
|
|
- roleIds:[
|
|
|
|
|
|
+ roleId:[
|
|
{ required: true, message: "用户角色不能为空", trigger: "change"},
|
|
{ required: true, message: "用户角色不能为空", trigger: "change"},
|
|
],
|
|
],
|
|
|
|
|
|
@@ -487,9 +448,15 @@ export default {
|
|
created() {
|
|
created() {
|
|
this.getList();
|
|
this.getList();
|
|
this.getTreeselect();
|
|
this.getTreeselect();
|
|
|
|
+ //显示状态
|
|
|
|
+ this.getDicts("sys_show_hide").then(response => {
|
|
|
|
+ this.visibleOptions = response.data;
|
|
|
|
+ });
|
|
|
|
+ //菜单状态
|
|
this.getDicts("sys_normal_disable").then(response => {
|
|
this.getDicts("sys_normal_disable").then(response => {
|
|
this.statusOptions = response.data;
|
|
this.statusOptions = response.data;
|
|
});
|
|
});
|
|
|
|
+ //性别状态
|
|
this.getDicts("sys_user_sex").then(response => {
|
|
this.getDicts("sys_user_sex").then(response => {
|
|
this.sexOptions = response.data;
|
|
this.sexOptions = response.data;
|
|
});
|
|
});
|
|
@@ -498,6 +465,13 @@ export default {
|
|
});
|
|
});
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ //强制el-input刷新
|
|
|
|
+ onInput(){
|
|
|
|
+ this.$forceUpdate();
|
|
|
|
+ },
|
|
|
|
+ changeUnit() {
|
|
|
|
+ this.$forceUpdate();
|
|
|
|
+ },
|
|
/** 查询用户列表 */
|
|
/** 查询用户列表 */
|
|
getList() {
|
|
getList() {
|
|
this.loading = true;
|
|
this.loading = true;
|
|
@@ -558,7 +532,9 @@ export default {
|
|
status: "0",
|
|
status: "0",
|
|
remark: undefined,
|
|
remark: undefined,
|
|
postIds: [],
|
|
postIds: [],
|
|
- roleIds: []
|
|
|
|
|
|
+ roleIds: [],
|
|
|
|
+ postId: undefined,
|
|
|
|
+ roleId: undefined
|
|
};
|
|
};
|
|
this.resetForm("form");
|
|
this.resetForm("form");
|
|
},
|
|
},
|
|
@@ -596,27 +572,30 @@ export default {
|
|
handleAdd() {
|
|
handleAdd() {
|
|
this.getTreeselect();
|
|
this.getTreeselect();
|
|
getUser().then(response => {
|
|
getUser().then(response => {
|
|
- this.postOptions = response.data.posts;
|
|
|
|
|
|
+ this.postOptions = response.data.posts
|
|
this.roleOptions = response.data.roles;
|
|
this.roleOptions = response.data.roles;
|
|
this.open = true;
|
|
this.open = true;
|
|
this.title = "添加用户";
|
|
this.title = "添加用户";
|
|
this.form.password = this.initPassword;
|
|
this.form.password = this.initPassword;
|
|
|
|
+
|
|
});
|
|
});
|
|
},
|
|
},
|
|
/** 修改按钮操作 */
|
|
/** 修改按钮操作 */
|
|
handleUpdate(row) {
|
|
handleUpdate(row) {
|
|
- this.reset();
|
|
|
|
this.getTreeselect();
|
|
this.getTreeselect();
|
|
const userId = row.userId || this.ids;
|
|
const userId = row.userId || this.ids;
|
|
getUser(userId).then(response => {
|
|
getUser(userId).then(response => {
|
|
this.form = response.data.data;
|
|
this.form = response.data.data;
|
|
- this.postOptions = response.data.posts;
|
|
|
|
|
|
+ this.postOptions = response.data.posts
|
|
this.roleOptions = response.data.roles;
|
|
this.roleOptions = response.data.roles;
|
|
- this.form.postIds = response.data.postIds;
|
|
|
|
- this.form.roleIds = response.data.roleIds;
|
|
|
|
- this.open = true;
|
|
|
|
- this.title = "修改用户";
|
|
|
|
- this.form.password = "";
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ this.form.postId = response.data.postIds[0]
|
|
|
|
+ this.form.roleId = response.data.roleIds[0]
|
|
|
|
+ this.open = true;
|
|
|
|
+ this.title = "修改用户";
|
|
|
|
+ this.form.password = "";
|
|
|
|
+
|
|
});
|
|
});
|
|
},
|
|
},
|
|
/** 重置密码按钮操作 */
|
|
/** 重置密码按钮操作 */
|
|
@@ -643,6 +622,14 @@ export default {
|
|
this.$refs["form"].validate(valid => {
|
|
this.$refs["form"].validate(valid => {
|
|
if (valid) {
|
|
if (valid) {
|
|
this.loading = true
|
|
this.loading = true
|
|
|
|
+ let postIds = []
|
|
|
|
+ let roleIds = []
|
|
|
|
+ if(this.form.postId){
|
|
|
|
+ postIds.push(this.form.postId)
|
|
|
|
+ }
|
|
|
|
+ roleIds.push(this.form.roleId)
|
|
|
|
+ this.form.postIds = postIds
|
|
|
|
+ this.form.roleIds = roleIds
|
|
if (this.form.userId != undefined) {
|
|
if (this.form.userId != undefined) {
|
|
updateUser(this.form).then(response => {
|
|
updateUser(this.form).then(response => {
|
|
this.loading = false
|
|
this.loading = false
|
|
@@ -651,7 +638,6 @@ export default {
|
|
this.getList();
|
|
this.getList();
|
|
}).catch(err=>{
|
|
}).catch(err=>{
|
|
this.loading = false
|
|
this.loading = false
|
|
- this.open = false;
|
|
|
|
});
|
|
});
|
|
} else {
|
|
} else {
|
|
addUser(this.form).then(response => {
|
|
addUser(this.form).then(response => {
|
|
@@ -661,7 +647,6 @@ export default {
|
|
this.getList();
|
|
this.getList();
|
|
}).catch(err=>{
|
|
}).catch(err=>{
|
|
this.loading = false
|
|
this.loading = false
|
|
- this.open = false;
|
|
|
|
});
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|