-
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 将文件拖到此处,或
+ 点击上传
+
+
+
+
+ 是否更新已经存在的用户数据
+
+
仅允许导入xls、xlsx格式文件。
+
+ 导出模板
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
+ v-model="form.roleIds"
+ multiple
+ placeholder="请选择"
+ style="width: 100%">
+ v-for="item in roleOptions"
+ :key="parseInt(item.id)"
+ :label="item.name"
+ :value="parseInt(item.id)">
-
-
-
-
-
- 搜索
-
- 重置
-
-
-
-
-
- 新增
-
-
-
-
- 导入
-
-
-
-
- 导出
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ parseTime(scope.row.createTime) }}
-
-
-
-
-
- 修改
-
- handleCommand(command, scope.$index, scope.row)
- "
- v-hasPermi="[
- 'system:user:delete',
- 'system:user:update-password',
- 'system:permission:assign-user-role',
- ]">
-
- 更多
-
-
-
- 删除
-
-
- 重置密码
-
-
- 分配角色
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 将文件拖到此处,或
- 点击上传
-
-
-
-
- 是否更新已经存在的用户数据
-
-
仅允许导入xls、xlsx格式文件。
-
- 下载模板
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -453,12 +272,168 @@ import { DICT_TYPE, getDictDatas } from '@/utils/dict';
import { assignUserRole, listUserRoles } from '@/api/system/permission';
import { listSimpleRoles } from '@/api/system/role';
import { getBaseHeader } from '@/utils/request';
-
+import tableHeightMixin from '@/mixins/tableHeightMixin';
+import { parseTime } from '@/utils/ruoyi';
+import statusBtn5 from './../components/statusBtn5.vue';
+const tableProps = [
+ {
+ prop: 'id',
+ label: '用户编号',
+ showOverflowtooltip: true,
+ },
+ {
+ prop: 'username',
+ label: '用户名称',
+ minWidth: 120,
+ showOverflowtooltip: true,
+ },
+ {
+ prop: 'nickname',
+ label: '用户昵称',
+ minWidth: 120,
+ showOverflowtooltip: true,
+ },
+ {
+ prop: 'dept',
+ label: '部门',
+ minWidth: 120,
+ filter: (item) => item.name || '',
+ showOverflowtooltip: true,
+ },
+ {
+ prop: 'mobile',
+ label: '手机号码',
+ minWidth: 150,
+ showOverflowtooltip: true,
+ },
+ {
+ prop: 'status',
+ label: '状态',
+ minWidth: 80,
+ // filter: publicFormatter(DICT_TYPE.SYSTEM_OPERATE_TYPE),
+ subcomponent: statusBtn5,
+ },
+ {
+ prop: 'createTime',
+ label: '创建时间',
+ filter: parseTime,
+ minWidth: 150,
+ showOverflowtooltip: true,
+ },
+];
export default {
name: 'SystemUser',
+ mixins: [tableHeightMixin],
components: { Treeselect },
data() {
return {
+ formConfig: [
+ {
+ type: 'input',
+ label: '用户名称',
+ placeholder: '用户名称',
+ param: 'username',
+ width: 150,
+ },
+ {
+ type: 'input',
+ label: '手机号码',
+ placeholder: '手机号码',
+ param: 'mobile',
+ width: 150,
+ },
+ {
+ type: 'select',
+ label: '状态',
+ selectOptions: this.getDictDatas(this.DICT_TYPE.COMMON_STATUS),
+ labelField: 'label',
+ valueField: 'value',
+ param: 'status',
+ width: 100,
+ },
+ {
+ type: 'datePicker',
+ label: '创建时间',
+ dateType: 'daterange',
+ format: 'yyyy-MM-dd',
+ valueFormat: 'yyyy-MM-dd HH:mm:ss',
+ rangeSeparator: '-',
+ startPlaceholder: '开始日期',
+ endPlaceholder: '结束日期',
+ param: 'createTime',
+ defaultSelect: [],
+ defaultTime: ['00:00:00', '23:59:59'],
+ width: 250,
+ },
+ {
+ type: 'button',
+ btnName: '查询',
+ name: 'search',
+ color: 'primary',
+ },
+ {
+ type: 'button',
+ btnName: '重置',
+ name: 'cancel',
+ },
+ {
+ type: this.$auth.hasPermiOr([
+ 'system:user:create',
+ 'system:user:import',
+ 'system:user:export',
+ ])
+ ? 'separate'
+ : '',
+ },
+ {
+ type: this.$auth.hasPermi('system:user:import') ? 'button' : '',
+ btnName: '导入',
+ name: 'import',
+ color: 'primary',
+ plain: true,
+ },
+ {
+ type: this.$auth.hasPermi('system:user:export') ? 'button' : '',
+ btnName: '导出',
+ name: 'export',
+ color: 'primary',
+ plain: true,
+ },
+ {
+ type: this.$auth.hasPermi('system:user:create') ? 'button' : '',
+ btnName: '新增',
+ name: 'addNew',
+ color: 'success',
+ plain: true,
+ },
+ ],
+ tableBtn: [
+ this.$auth.hasPermi('system:user:update-password')
+ ? {
+ type: 'reset',
+ btnName: '重置密码',
+ }
+ : undefined,
+ this.$auth.hasPermi('system:permission:assign-user-role')
+ ? {
+ type: 'role',
+ btnName: '分配角色',
+ }
+ : undefined,
+ this.$auth.hasPermi('system:user:update')
+ ? {
+ type: 'edit',
+ btnName: '修改',
+ }
+ : undefined,
+ this.$auth.hasPermi('system:user:delete')
+ ? {
+ type: 'delete',
+ btnName: '删除',
+ }
+ : undefined,
+ ].filter((v) => v),
+ tableProps,
// 遮罩层
loading: true,
// 导出遮罩层
@@ -468,7 +443,7 @@ export default {
// 总条数
total: 0,
// 用户表格数据
- userList: null,
+ userList: [],
// 弹出层标题
title: '',
// 部门树选项
@@ -509,23 +484,13 @@ export default {
// 查询参数
queryParams: {
pageNo: 1,
- pageSize: 10,
+ pageSize: 20,
username: undefined,
mobile: undefined,
status: undefined,
deptId: undefined,
createTime: [],
},
- // 列信息
- columns: [
- { key: 0, label: `用户编号`, visible: true },
- { key: 1, label: `用户名称`, visible: true },
- { key: 2, label: `用户昵称`, visible: true },
- { key: 3, label: `部门`, visible: true },
- { key: 4, label: `手机号码`, visible: true },
- { key: 5, label: `状态`, visible: true },
- { key: 6, label: `创建时间`, visible: true },
- ],
// 表单校验
rules: {
username: [
@@ -577,23 +542,44 @@ export default {
// });
},
methods: {
- // 更多操作
- handleCommand(command, index, row) {
- switch (command) {
- case 'handleUpdate':
- this.handleUpdate(row); //修改客户信息
+ handleClick(val) {
+ switch (val.type) {
+ case 'edit':
+ this.handleUpdate(val.data);
break;
- case 'handleDelete':
- this.handleDelete(row); //红号变更
+ case 'delete':
+ this.handleDelete(val.data.id, val.data.username);
break;
- case 'handleResetPwd':
- this.handleResetPwd(row);
- break;
- case 'handleRole':
- this.handleRole(row);
+ case 'reset':
+ this.handleResetPwd(val.data);
break;
default:
+ this.handleRole(val.data);
+ }
+ },
+ buttonClick(val) {
+ console.log(val);
+ switch (val.btnName) {
+ case 'search':
+ this.handleQuery(val);
break;
+ case 'cancel':
+ this.$refs['userSearchBarForm'].resetForm();
+ this.queryParams.pageNo = 1;
+ this.queryParams.username = '';
+ this.queryParams.mobile = '';
+ this.queryParams.status = '';
+ this.queryParams.createTime = [];
+ this.getList();
+ break;
+ case 'addNew':
+ this.handleAdd();
+ break;
+ case 'import':
+ this.handleImport();
+ break;
+ default:
+ this.handleExport();
}
},
/** 查询用户列表 */
@@ -630,21 +616,9 @@ export default {
},
// 用户状态修改
handleStatusChange(row) {
- let text = row.status === CommonStatusEnum.ENABLE ? '启用' : '停用';
- this.$modal
- .confirm('确认要"' + text + '""' + row.username + '"用户吗?')
- .then(function () {
- return changeUserStatus(row.id, row.status);
- })
- .then(() => {
- this.$modal.msgSuccess(text + '成功');
- })
- .catch(function () {
- row.status =
- row.status === CommonStatusEnum.ENABLE
- ? CommonStatusEnum.DISABLE
- : CommonStatusEnum.ENABLE;
- });
+ changeUserStatus(row.id, row.status).then((res) => {
+ this.$modal.msgSuccess('操作成功');
+ });
},
// 取消按钮
cancel() {
@@ -675,15 +649,14 @@ export default {
this.resetForm('form');
},
/** 搜索按钮操作 */
- handleQuery() {
+ handleQuery(val) {
this.queryParams.pageNo = 1;
+ this.queryParams.username = val.username;
+ this.queryParams.mobile = val.mobile;
+ this.queryParams.status = val.status;
+ this.queryParams.createTime = val.createTime;
this.getList();
},
- /** 重置按钮操作 */
- resetQuery() {
- this.resetForm('queryForm');
- this.handleQuery();
- },
/** 新增按钮操作 */
handleAdd() {
this.reset();
@@ -703,15 +676,12 @@ export default {
this.form = response.data;
this.open = true;
this.title = '修改用户';
- this.form.password = '';
});
},
/** 重置密码按钮操作 */
handleResetPwd(row) {
- this.$prompt('请输入"' + row.username + '"的新密码', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- })
+ this.$modal
+ .prompt('请输入 【' + row.username + '】 的新密码')
.then(({ value }) => {
resetUserPwd(row.id, value).then((response) => {
this.$modal.msgSuccess('修改成功,新密码是:' + value);
@@ -775,12 +745,11 @@ export default {
}
},
/** 删除按钮操作 */
- handleDelete(row) {
- const ids = row.id || this.ids;
+ handleDelete(id, detContent) {
this.$modal
- .confirm('是否确认删除用户编号为"' + ids + '"的数据项?')
- .then(function () {
- return delUser(ids);
+ .delConfirm(detContent)
+ .then(() => {
+ return delUser(id);
})
.then(() => {
this.getList();
@@ -811,7 +780,7 @@ export default {
this.upload.title = '用户导入';
this.upload.open = true;
},
- /** 下载模板操作 */
+ /** 导出模板操作 */
importTemplate() {
importTemplate().then((response) => {
this.$download.excel(response, '用户导入模板.xls');
@@ -867,3 +836,20 @@ export default {
},
};
+
diff --git a/src/views/system/user/profile/index.vue b/src/views/system/user/profile/index.vue
index f2b0340b..20c37f99 100644
--- a/src/views/system/user/profile/index.vue
+++ b/src/views/system/user/profile/index.vue
@@ -7,9 +7,9 @@
个人信息