diff --git a/data/magic-api/api/后台/用户管理/删除.ms b/data/magic-api/api/后台/用户管理/删除.ms index 70316f1..5244577 100644 --- a/data/magic-api/api/后台/用户管理/删除.ms +++ b/data/magic-api/api/后台/用户管理/删除.ms @@ -5,7 +5,7 @@ "groupId" : "4f0230049d7e4f39b1e0897cc0f46f9a", "name" : "删除", "createTime" : null, - "updateTime" : 1646553121622, + "updateTime" : 1647618260057, "lock" : "0", "createBy" : null, "updateBy" : null, @@ -48,6 +48,10 @@ ================================ import org.ssssssss.magicapi.modules.db.cache.SqlCache +if(Arrays.asList(id.split(',')).contains('1')){ + exit 500, '不允许删除超级管理员' +} + for(userId in id.split(',')){ SqlCache.delete(`permissions:${userId}`) db.table("sys_user").logic().where().eq("id",userId).delete(); diff --git a/data/magic-api/api/后台/组织机构/保存.ms b/data/magic-api/api/后台/组织机构/保存.ms index 12f01ae..88d38e2 100644 --- a/data/magic-api/api/后台/组织机构/保存.ms +++ b/data/magic-api/api/后台/组织机构/保存.ms @@ -4,8 +4,8 @@ "script" : null, "groupId" : "8295fc13678d4144bf7363c465247a50", "name" : "保存", - "createTime" : 1646490239492, - "updateTime" : 1644121675551, + "createTime" : null, + "updateTime" : 1647615397163, "lock" : "0", "createBy" : null, "updateBy" : null, @@ -42,7 +42,19 @@ "paths" : [ ], "responseBody" : null, "description" : null, - "requestBodyDefinition" : null, + "requestBodyDefinition" : { + "name" : "", + "value" : "", + "description" : "", + "required" : false, + "dataType" : "Object", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ ] + }, "responseBodyDefinition" : null } ================================ diff --git a/data/magic-api/api/后台/组织机构/删除.ms b/data/magic-api/api/后台/组织机构/删除.ms index 74b6c93..a99459d 100644 --- a/data/magic-api/api/后台/组织机构/删除.ms +++ b/data/magic-api/api/后台/组织机构/删除.ms @@ -5,7 +5,7 @@ "groupId" : "8295fc13678d4144bf7363c465247a50", "name" : "删除", "createTime" : null, - "updateTime" : 1646553126039, + "updateTime" : 1647615807925, "lock" : "0", "createBy" : null, "updateBy" : null, @@ -118,5 +118,17 @@ } } ================================ +var pCount = db.selectInt("select count(1) from sys_office where is_del = 0 and pid = #{id}") +if(pCount > 0){ + exit 500,'存在下级机构,不允许删除' +} +var userCount = db.selectInt("select count(1) from sys_user where is_del = 0 and office_id = #{id}") +if(userCount > 0){ + exit 500, '机构存在用户,不允许删除' +} +var root = db.selectValue("select pid from sys_office where is_del = 0 and id = #{id}") +if(root == '0'){ + exit 500, '不能删除根节点' +} // db.table('sys_user_office').where().eq("office_id",id).delete(); return db.table("sys_office").logic().where().eq("id",id).delete(); \ No newline at end of file diff --git a/data/magic-api/api/后台/角色管理/删除.ms b/data/magic-api/api/后台/角色管理/删除.ms index 471e1ec..118df28 100644 --- a/data/magic-api/api/后台/角色管理/删除.ms +++ b/data/magic-api/api/后台/角色管理/删除.ms @@ -5,7 +5,7 @@ "groupId" : "89130d496f6f467c88b22ae4a7f688eb", "name" : "删除", "createTime" : null, - "updateTime" : 1646553106085, + "updateTime" : 1647615829916, "lock" : "0", "createBy" : null, "updateBy" : null, @@ -47,6 +47,12 @@ } ================================ import '@get:/role/cache/delete' as cacheDelete + +var userCount = db.selectInt("select count(1) from sys_user_role where role_id = #{id}") +if(userCount > 0){ + exit 500, '角色已分配,不允许删除' +} + var roleId = id cacheDelete() diff --git a/magic-boot-ui/src/assets/css/common.css b/magic-boot-ui/src/assets/css/common.css index 4c17e37..2d7579c 100644 --- a/magic-boot-ui/src/assets/css/common.css +++ b/magic-boot-ui/src/assets/css/common.css @@ -28,6 +28,7 @@ body{ --mb-main-icon-color: #909399; --mb-header-height: 60px; --mb-avatar-text-size: 18px; + /*--mb-menu-item-height: 50px;*/ } .el-header{ --el-header-height: var(--mb-header-height); @@ -40,6 +41,9 @@ body{ .el-dialog__body{ padding: 5px 20px; } +/*.el-sub-menu__title, .el-menu-item{*/ +/* height: var(--mb-menu-item-height) !important;*/ +/*}*/ .app-container hr { border: none; height: 1px; diff --git a/magic-boot-ui/src/components/magic/advanced/mb-form.vue b/magic-boot-ui/src/components/magic/advanced/mb-form.vue index 5b98297..a67c403 100644 --- a/magic-boot-ui/src/components/magic/advanced/mb-form.vue +++ b/magic-boot-ui/src/components/magic/advanced/mb-form.vue @@ -69,8 +69,7 @@ var data = {} props.form.rows.forEach(row => { row.cols.forEach(col => { - // data[col.name] = col.defaultValue === null ? col.defaultValue : col.defaultValue || '' - data[col.name] = undefined + data[col.name] = col.defaultValue || undefined }) }) return data diff --git a/magic-boot-ui/src/components/magic/basic/mb-search.vue b/magic-boot-ui/src/components/magic/basic/mb-search.vue index 238d696..7a084d3 100644 --- a/magic-boot-ui/src/components/magic/basic/mb-search.vue +++ b/magic-boot-ui/src/components/magic/basic/mb-search.vue @@ -92,9 +92,17 @@ function reset() { for(var key in props.where){ if(props.notReset.indexOf(key) == -1){ if(props.where[key] instanceof Object){ - props.where[key].value = null + if(props.where[key].value instanceof Array){ + props.where[key].value = [] + }else{ + props.where[key].value = null + } }else{ - props.where[key] = null + if(props.where[key] instanceof Array){ + props.where[key] = [] + }else{ + props.where[key] = null + } } } } diff --git a/magic-boot-ui/src/components/magic/basic/mb-table-column.vue b/magic-boot-ui/src/components/magic/basic/mb-table-column.vue index a9ea826..e8ed8f3 100644 --- a/magic-boot-ui/src/components/magic/basic/mb-table-column.vue +++ b/magic-boot-ui/src/components/magic/basic/mb-table-column.vue @@ -15,13 +15,15 @@ {{ $common.getDictLabel(col.dictType, scope.row[col.field] + '') }} - +
+ +
diff --git a/magic-boot-ui/src/views/examples/test-mb-form.vue b/magic-boot-ui/src/views/examples/test-mb-form.vue index a0df779..86e2c3b 100644 --- a/magic-boot-ui/src/views/examples/test-mb-form.vue +++ b/magic-boot-ui/src/views/examples/test-mb-form.vue @@ -18,7 +18,8 @@ const formOptions = reactive({ cols: [{ span: 12, name: 'input', - label: 'input' + label: 'input', + rules: [{ required: true, message: '请输入input', trigger: 'change' }] },{ span: 12, name: 'switch', @@ -114,7 +115,7 @@ const formOptions = reactive({ props: { url: 'role/all', placeholder: '请选择角色', - el: { multiple: true } + multiple: true } },{ span: 12, @@ -127,6 +128,6 @@ const formOptions = reactive({ } }) function getFormData(){ - console.log(magicForm.value.getFormData()) + console.log(magicForm.value.getFormData().select) } diff --git a/magic-boot-ui/src/views/system/menu/menu-list.vue b/magic-boot-ui/src/views/system/menu/menu-list.vue index 6738246..6b0a698 100644 --- a/magic-boot-ui/src/views/system/menu/menu-list.vue +++ b/magic-boot-ui/src/views/system/menu/menu-list.vue @@ -47,148 +47,147 @@ let menuTree = ref([]) const menuData = ref([]) let searchValue = ref('') const tableOptions = reactive({ - el: { - 'default-expand-all': true, - 'tree-props': { children: 'children', hasChildren: 'hasChildren' }, - 'row-key': 'id' - }, - showNo: false, - page: false, - cols: [ - { - field: 'name', - label: '菜单名称', - align: 'left', - type: 'html' - }, - { - field: 'url', - label: '路径', - align: 'left', - type: 'html' - }, - { - field: 'permission', - label: '权限标识', - width: 150, - align: 'left', - type: 'html' - }, - { - field: 'icon', - label: '图标', - width: 55, - align: 'center', - templet: (row) => { - return generateIconCode(row.icon) - } - }, - { - field: 'sort', - label: '序号', - width: 60 - }, - { - label: '排序', - type: 'btns', - width: 150, - btns: [ - { - label: '上移', - type: 'text', - icon: 'ElSortUp', - click: (row) => { - proxy.$get('menu/sort/up',{ - id: row.id, - pid: row.pid, - sort: row.sort - }).then(() => { - reloadTable() - }) - } - }, - { - label: '下移', - type: 'text', - icon: 'ElSortDown', - click: (row) => { - proxy.$get('menu/sort/down',{ - id: row.id, - pid: row.pid, - sort: row.sort - }).then(() => { - reloadTable() - }) - } - } - ] - }, - { - field: 'isShow', - label: '是否显示', - type: 'switch', - width: 100, - change: (row) => { - proxy.$get('menu/change', { - id: row.id, - isShow: row.isShow - }) - } - }, - { - field: 'keepAlive', - label: '是否缓存', - type: 'switch', - width: 100, - change: (row) => { - proxy.$get('menu/change', { - id: row.id, - keepAlive: row.keepAlive - }) - } - }, - { - label: '操作', - type: 'btns', - width: 260, - fixed: 'right', - align: 'left', - btns: [ - { - label: '添加下级菜单', - type: 'text', - permission: 'menu:save', - icon: 'ElPlus', - click: (row) => { - addSubMenu(row.id) - } - }, - { - label: '修改', - type: 'text', - permission: 'menu:save', - icon: 'ElEdit', - click: (row) => { - handleUpdate(row) - } - }, - { - label: '删除', - type: 'text', - permission: 'menu:delete', - icon: 'ElDelete', - click: (row) => { - proxy.$common.handleDelete({ - url: 'menu/delete', - id: row.id, - done: () => reloadTable() - }) - } - } - ] + el: { + 'tree-props': { children: 'children', hasChildren: 'hasChildren' }, + 'row-key': 'id' + }, + showNo: false, + page: false, + cols: [ + { + field: 'name', + label: '菜单名称', + align: 'left', + type: 'html' + }, + { + field: 'url', + label: '路径', + align: 'left', + type: 'html' + }, + { + field: 'permission', + label: '权限标识', + width: 150, + align: 'left', + type: 'html' + }, + { + field: 'icon', + label: '图标', + width: 55, + align: 'center', + templet: (row) => { + return generateIconCode(row.icon) + } + }, + { + field: 'sort', + label: '序号', + width: 60 + }, + { + label: '排序', + type: 'btns', + width: 150, + btns: [ + { + label: '上移', + type: 'text', + icon: 'ElSortUp', + click: (row) => { + proxy.$get('menu/sort/up',{ + id: row.id, + pid: row.pid, + sort: row.sort + }).then(() => { + reloadTable() + }) } - ] - }) + }, + { + label: '下移', + type: 'text', + icon: 'ElSortDown', + click: (row) => { + proxy.$get('menu/sort/down',{ + id: row.id, + pid: row.pid, + sort: row.sort + }).then(() => { + reloadTable() + }) + } + } + ] + }, + { + field: 'isShow', + label: '是否显示', + type: 'switch', + width: 100, + change: (row) => { + proxy.$get('menu/change', { + id: row.id, + isShow: row.isShow + }) + } + }, + { + field: 'keepAlive', + label: '是否缓存', + type: 'switch', + width: 100, + change: (row) => { + proxy.$get('menu/change', { + id: row.id, + keepAlive: row.keepAlive + }) + } + }, + { + label: '操作', + type: 'btns', + width: 260, + fixed: 'right', + align: 'left', + btns: [ + { + label: '添加下级菜单', + type: 'text', + permission: 'menu:save', + icon: 'ElPlus', + click: (row) => { + addSubMenu(row.id) + } + }, + { + label: '修改', + type: 'text', + permission: 'menu:save', + icon: 'ElEdit', + click: (row) => { + handleUpdate(row) + } + }, + { + label: '删除', + type: 'text', + permission: 'menu:delete', + icon: 'ElDelete', + click: (row) => { + proxy.$common.handleDelete({ + url: 'menu/delete', + id: row.id, + done: () => reloadTable() + }) + } + } + ] + } + ] +}) let dialogTitle = ref('') let searchTimeout = reactive() const menuFormDialog = ref() diff --git a/magic-boot-ui/src/views/system/monitor/login-log.vue b/magic-boot-ui/src/views/system/monitor/login-log.vue index 62bd119..0de37f8 100644 --- a/magic-boot-ui/src/views/system/monitor/login-log.vue +++ b/magic-boot-ui/src/views/system/monitor/login-log.vue @@ -29,13 +29,19 @@ { field: 'type', label: '登录状态', + width: '100px', templet: (row) => { return row.type == '成功' ? '成功' : '失败' } }, + { + field: 'address', + label: '登录地址' + }, { field: 'ip', - label: 'ip' + label: 'ip', + width: '150px' }, { field: 'browser', @@ -50,7 +56,8 @@ }, { field: 'createDate', - label: '操作时间' + label: '操作时间', + width: '180px' } ] }) diff --git a/magic-boot-ui/src/views/system/monitor/oper-log.vue b/magic-boot-ui/src/views/system/monitor/oper-log.vue index c256c04..c6d050f 100644 --- a/magic-boot-ui/src/views/system/monitor/oper-log.vue +++ b/magic-boot-ui/src/views/system/monitor/oper-log.vue @@ -28,15 +28,18 @@ }, { field: 'apiMethod', - label: '方法' + label: '方法', + width: '100px' }, { field: 'userIp', - label: 'ip' + label: 'ip', + width: '150px' }, { field: 'costTime', - label: '耗时' + label: '耗时', + width: '100px' }, { field: 'userAgent', @@ -47,11 +50,13 @@ }, { field: 'username', - label: '操作人' + label: '操作人', + width: '150px' }, { field: 'createDate', - label: '操作时间' + label: '操作时间', + width: '180px' } ] }) diff --git a/magic-boot-ui/src/views/system/office/office-list.vue b/magic-boot-ui/src/views/system/office/office-list.vue index 84fcb7e..9fc1461 100644 --- a/magic-boot-ui/src/views/system/office/office-list.vue +++ b/magic-boot-ui/src/views/system/office/office-list.vue @@ -182,6 +182,9 @@ const tableOptions = reactive({ type: 'text', permission: 'office:delete', icon: 'ElDelete', + if: (row) => { + return row.pid != '0'; + }, click: (row) => { proxy.$common.handleDelete({ url: 'office/delete', diff --git a/magic-boot-ui/src/views/system/role/role-list.vue b/magic-boot-ui/src/views/system/role/role-list.vue index 5fb7c04..c8a7180 100644 --- a/magic-boot-ui/src/views/system/role/role-list.vue +++ b/magic-boot-ui/src/views/system/role/role-list.vue @@ -46,7 +46,7 @@ - + @@ -55,7 +55,7 @@ - + diff --git a/magic-boot-ui/src/views/system/user/user-form.vue b/magic-boot-ui/src/views/system/user/user-form.vue index 5f83b95..fdf0dc7 100644 --- a/magic-boot-ui/src/views/system/user/user-form.vue +++ b/magic-boot-ui/src/views/system/user/user-form.vue @@ -32,11 +32,11 @@ - + - + 有效 锁定 diff --git a/magic-boot-ui/src/views/system/user/user-list.vue b/magic-boot-ui/src/views/system/user/user-list.vue index 7b1db93..6f02162 100644 --- a/magic-boot-ui/src/views/system/user/user-list.vue +++ b/magic-boot-ui/src/views/system/user/user-list.vue @@ -84,7 +84,7 @@ const tableOptions = reactive({ value: '', properties: { url: 'role/all', - el: { multiple: true } + multiple: true } }, officeId: '' @@ -118,6 +118,9 @@ const tableOptions = reactive({ label: '禁止登录', type: 'switch', width: 100, + if: (row) => { + return row.id != '1' + }, change: (row) => { proxy.$get('/user/change/login/status', { id: row.id, @@ -150,6 +153,9 @@ const tableOptions = reactive({ label: '删除', type: 'text', icon: 'ElDelete', + if: (row) => { + return row.id != '1' + }, click: (row) => { proxy.$common.handleDelete({ url: 'user/delete',