From 884fad3b0e30e8ced194e29177b6f840c9d295bd Mon Sep 17 00:00:00 2001 From: juzi <819872918@qq.com> Date: Mon, 12 Aug 2024 16:59:52 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=AE=A1=E7=90=86&=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/TopNav/index.vue | 2 +- src/styles/index.scss | 4 + src/views/system/components/statusBtn.vue | 38 + src/views/system/components/statusBtn2.vue | 38 + src/views/system/components/statusBtn3.vue | 41 + src/views/system/components/statusBtn4.vue | 38 + src/views/system/components/statusBtn5.vue | 39 + src/views/system/role/components/dataAuth.vue | 162 +++ src/views/system/role/components/menuAuth.vue | 146 +++ src/views/system/role/components/roleAdd.vue | 129 +++ src/views/system/role/index.vue | 769 ++++++-------- src/views/system/user/index.vue | 940 +++++++++--------- src/views/system/user/profile/index.vue | 8 +- yarn.lock | 183 ++-- 14 files changed, 1470 insertions(+), 1067 deletions(-) create mode 100644 src/views/system/components/statusBtn.vue create mode 100644 src/views/system/components/statusBtn2.vue create mode 100644 src/views/system/components/statusBtn3.vue create mode 100644 src/views/system/components/statusBtn4.vue create mode 100644 src/views/system/components/statusBtn5.vue create mode 100644 src/views/system/role/components/dataAuth.vue create mode 100644 src/views/system/role/components/menuAuth.vue create mode 100644 src/views/system/role/components/roleAdd.vue diff --git a/src/components/TopNav/index.vue b/src/components/TopNav/index.vue index 9f9bae0a..b5f44046 100644 --- a/src/components/TopNav/index.vue +++ b/src/components/TopNav/index.vue @@ -218,7 +218,7 @@ export default { float: left; height: 84px !important; line-height: 84px !important; - color: #999093 !important; + color: transparent !important; padding: 0 5px !important; font-size: 18px; } diff --git a/src/styles/index.scss b/src/styles/index.scss index f1393e30..32d0a6e9 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -224,6 +224,10 @@ input, textarea{ left:20px; font-size:21px !important } + .el-message-box__input { + padding-left: 57px; + padding-right: 15px; + } } .el-message-box__btns { padding-right: 32px; diff --git a/src/views/system/components/statusBtn.vue b/src/views/system/components/statusBtn.vue new file mode 100644 index 00000000..14dda42d --- /dev/null +++ b/src/views/system/components/statusBtn.vue @@ -0,0 +1,38 @@ + + + diff --git a/src/views/system/components/statusBtn2.vue b/src/views/system/components/statusBtn2.vue new file mode 100644 index 00000000..3a4ab297 --- /dev/null +++ b/src/views/system/components/statusBtn2.vue @@ -0,0 +1,38 @@ + + + diff --git a/src/views/system/components/statusBtn3.vue b/src/views/system/components/statusBtn3.vue new file mode 100644 index 00000000..7b70fe18 --- /dev/null +++ b/src/views/system/components/statusBtn3.vue @@ -0,0 +1,41 @@ + + + diff --git a/src/views/system/components/statusBtn4.vue b/src/views/system/components/statusBtn4.vue new file mode 100644 index 00000000..2f335b92 --- /dev/null +++ b/src/views/system/components/statusBtn4.vue @@ -0,0 +1,38 @@ + + + diff --git a/src/views/system/components/statusBtn5.vue b/src/views/system/components/statusBtn5.vue new file mode 100644 index 00000000..6986341d --- /dev/null +++ b/src/views/system/components/statusBtn5.vue @@ -0,0 +1,39 @@ + + + diff --git a/src/views/system/role/components/dataAuth.vue b/src/views/system/role/components/dataAuth.vue new file mode 100644 index 00000000..abb4fc23 --- /dev/null +++ b/src/views/system/role/components/dataAuth.vue @@ -0,0 +1,162 @@ + + diff --git a/src/views/system/role/components/menuAuth.vue b/src/views/system/role/components/menuAuth.vue new file mode 100644 index 00000000..33117086 --- /dev/null +++ b/src/views/system/role/components/menuAuth.vue @@ -0,0 +1,146 @@ + + diff --git a/src/views/system/role/components/roleAdd.vue b/src/views/system/role/components/roleAdd.vue new file mode 100644 index 00000000..26de73be --- /dev/null +++ b/src/views/system/role/components/roleAdd.vue @@ -0,0 +1,129 @@ + + diff --git a/src/views/system/role/index.vue b/src/views/system/role/index.vue index ed6cb080..30b611c8 100644 --- a/src/views/system/role/index.vue +++ b/src/views/system/role/index.vue @@ -1,495 +1,292 @@ + diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index d18f3da6..cbffe0a3 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -1,432 +1,251 @@ @@ -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 @@ 个人信息
- +