大屏项目初始化
This commit is contained in:
@@ -10,3 +10,14 @@ export function getHomeModuleList(params) {
|
|||||||
params: params
|
params: params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除信息列表
|
||||||
|
*/
|
||||||
|
export function getHomeModuleDelete(params) {
|
||||||
|
return request({
|
||||||
|
url: '/biz/homeModule/delete',
|
||||||
|
method: 'post',
|
||||||
|
params: params
|
||||||
|
})
|
||||||
|
}
|
||||||
34
screen-vue/src/api/bizModuleUser.js
Normal file
34
screen-vue/src/api/bizModuleUser.js
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取指标信息列表
|
||||||
|
*/
|
||||||
|
export function getHomeModuleUserList(params) {
|
||||||
|
return request({
|
||||||
|
url: '/biz/homeModuleUser/userList',
|
||||||
|
method: 'get',
|
||||||
|
params: params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存信息列表
|
||||||
|
*/
|
||||||
|
export function getHomeModuleUserSave(data) {
|
||||||
|
return request({
|
||||||
|
url: '/biz/homeModuleUser/save',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除信息列表
|
||||||
|
*/
|
||||||
|
export function getHomeModuleUserDelete(params) {
|
||||||
|
return request({
|
||||||
|
url: '/biz/homeModuleUser/delete',
|
||||||
|
method: 'post',
|
||||||
|
params: params
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -11,6 +11,17 @@ export function getHomeUserList(params) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户信息列表
|
||||||
|
*/
|
||||||
|
export function getHomeUserListAll(params) {
|
||||||
|
return request({
|
||||||
|
url: '/biz/homeUser/listAll',
|
||||||
|
method: 'get',
|
||||||
|
params: params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存用户信息列表
|
* 保存用户信息列表
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
<div class="sidebar-content">
|
<div class="sidebar-content">
|
||||||
<FilterSelect
|
<FilterSelect
|
||||||
:list-data="listData"
|
:list-data="listData"
|
||||||
node-key="groupId"
|
node-key="moduleId"
|
||||||
label-key="groupName"
|
label-key="moduleName"
|
||||||
@item-click="handleItemClick"
|
@item-click="handleItemClick"
|
||||||
@edit="handleEdit"
|
@edit="handleEdit"
|
||||||
@delete="handleDelete"
|
@delete="handleDelete"
|
||||||
@@ -43,8 +43,8 @@ import { ElMessage, ElMessageBox, ElNotification } from 'element-plus'
|
|||||||
import ResizablePage from '@/components/Table/proResizable.vue'
|
import ResizablePage from '@/components/Table/proResizable.vue'
|
||||||
import FilterSelect from '@/components/Table/proFilterSelect.vue'
|
import FilterSelect from '@/components/Table/proFilterSelect.vue'
|
||||||
import PDialog from '@/components/Dialog/proDialog.vue'
|
import PDialog from '@/components/Dialog/proDialog.vue'
|
||||||
|
import { getHomeModuleList } from '@/api/bizModule'
|
||||||
import { getHomeModuleGroupList } from '@/api/bizModule'
|
import { getHomeModuleUserSave , getHomeModuleUserDelete } from '@/api/bizModuleUser'
|
||||||
|
|
||||||
import vUser from './list.vue'
|
import vUser from './list.vue'
|
||||||
import vRole from './role.vue'
|
import vRole from './role.vue'
|
||||||
@@ -61,12 +61,8 @@ const formComponentRef = ref(null)
|
|||||||
|
|
||||||
const getListData = async () => {
|
const getListData = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await getHomeModuleGroupList({});
|
const res = await getHomeModuleList();
|
||||||
|
listData.value = res || []
|
||||||
|
|
||||||
console.log(res )
|
|
||||||
|
|
||||||
// listData.value = res || []
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
@@ -82,7 +78,7 @@ const handleEdit = (item) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleDelete = (item) => {
|
const handleDelete = (item) => {
|
||||||
ElMessageBox.confirm('确定要删除当前角色吗?', '删除确认', {
|
ElMessageBox.confirm('确定要删除当前模块吗?', '删除确认', {
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
closeOnClickModal: false,
|
closeOnClickModal: false,
|
||||||
showClose: false
|
showClose: false
|
||||||
@@ -91,12 +87,12 @@ const handleDelete = (item) => {
|
|||||||
const reqParams = {
|
const reqParams = {
|
||||||
roleId: item.roleId
|
roleId: item.roleId
|
||||||
}
|
}
|
||||||
const res = await getHomeRoleDelete(reqParams);
|
const res = await getHomeModuleUserDelete(reqParams);
|
||||||
ElMessage.success(res.msg);
|
ElMessage.success(res.msg);
|
||||||
getListData();
|
getListData();
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
ElMessage.info('已取消删除角色操作');
|
ElMessage.info('已取消删除模块操作');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,16 +116,15 @@ const handleSave = async () => {
|
|||||||
if (formComponentRef.value) {
|
if (formComponentRef.value) {
|
||||||
const isValid = await formComponentRef.value.validate()
|
const isValid = await formComponentRef.value.validate()
|
||||||
if (!isValid) {
|
if (!isValid) {
|
||||||
|
ElMessage.warning('表单验证失败,请检查必填项');
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const selectedMenuIds = formComponentRef.value.getSelectedMenuIds()
|
|
||||||
roleForm.value.menuIds = selectedMenuIds
|
|
||||||
}
|
}
|
||||||
const reqParams = {
|
const reqParams = {
|
||||||
... roleForm.value
|
... roleForm.value
|
||||||
}
|
}
|
||||||
saveLoading.value = true
|
saveLoading.value = true
|
||||||
const res = await getHomeRoleAssign(reqParams);
|
const res = await getHomeModuleUserSave(reqParams);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
ElMessage.success(res.msg)
|
ElMessage.success(res.msg)
|
||||||
saveLoading.value = false
|
saveLoading.value = false
|
||||||
|
|||||||
@@ -1,246 +1,236 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="role-auth-container">
|
<el-form
|
||||||
<el-form
|
:model="formData"
|
||||||
:model="formData"
|
:rules="formRules"
|
||||||
class="role-info-form"
|
ref="formRef"
|
||||||
label-width="80px"
|
label-width="100px"
|
||||||
inline
|
class="dialog-form-container"
|
||||||
>
|
>
|
||||||
<el-form-item label="角色编号:" class="form-col">
|
<div class="form-row">
|
||||||
<el-input
|
<div class="form-col">
|
||||||
v-model="formData.roleId"
|
<el-form-item label="模块编号" prop="moduleId">
|
||||||
disabled
|
<el-input
|
||||||
class="info-input"
|
v-model="formData.moduleId"
|
||||||
/>
|
placeholder="请输入模块编号"
|
||||||
</el-form-item>
|
disabled
|
||||||
<el-form-item label="角色名称:" class="form-col">
|
clearable
|
||||||
<el-input
|
/>
|
||||||
v-model="formData.roleName"
|
</el-form-item>
|
||||||
class="info-input"
|
</div>
|
||||||
/>
|
<div class="form-col">
|
||||||
</el-form-item>
|
<el-form-item label="模块名称" prop="moduleName">
|
||||||
</el-form>
|
<el-input
|
||||||
|
v-model="formData.moduleName"
|
||||||
<div class="menu-tree-wrapper">
|
placeholder="请输入模块名称"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-row transfer-row">
|
||||||
|
<div class="form-col transfer-col">
|
||||||
|
<el-form-item label="权限列表" prop="userIds">
|
||||||
|
<el-transfer
|
||||||
|
filterable
|
||||||
|
v-model="formData.userIds"
|
||||||
|
:data="transferData"
|
||||||
|
:props="{ key: 'userId', label: 'uname' }"
|
||||||
|
:titles="['待选用户', '已选用户']"
|
||||||
|
placeholder="请输入权限名称搜索"
|
||||||
|
class="full-width-transfer"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</el-form>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, onMounted, defineProps, defineExpose, watch } from 'vue'
|
import { ref, onMounted, nextTick, watch } from 'vue'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage, ElMessageBox, ElNotification } from 'element-plus'
|
||||||
import { getTreeMenuList } from '@/api/bizMenu'
|
import { getHomeUserListAll } from '@/api/bizUser'
|
||||||
import { getHomeRoleMenus } from '@/api/bizRole'
|
import { getHomeModuleUserList } from '@/api/bizModuleUser'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
formData: {
|
formData: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true,
|
required: true,
|
||||||
default: () => ({
|
default: () => ({
|
||||||
roleId: '',
|
moduleId: '',
|
||||||
roleName: '',
|
moduleName: '',
|
||||||
menuIds: []
|
userIds: []
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
isEdit: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const menuTreeData = ref([])
|
const formRef = ref(null)
|
||||||
const loading = ref(false)
|
const transferData = ref([])
|
||||||
const menuTreeRef = ref(null)
|
|
||||||
const selectedMenuIds = ref([])
|
|
||||||
|
|
||||||
const getLeafNodeIds = (treeData, leafIds = []) => {
|
const formRules = {
|
||||||
treeData.forEach(node => {
|
moduleName: [ { required: true, message: '请输入模块名称', trigger: 'blur' } ],
|
||||||
if (!node.children || node.children.length === 0) {
|
userIds: [
|
||||||
leafIds.push(String(node.id))
|
{ required: true, message: '请至少选择一个用户', trigger: 'change' }
|
||||||
} else {
|
]
|
||||||
getLeafNodeIds(node.children, leafIds)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return leafIds
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const filterOnlyLeafIds = (allIds, treeData) => {
|
|
||||||
const allLeafIds = getLeafNodeIds(treeData)
|
|
||||||
return allIds.filter(id => allLeafIds.includes(id))
|
|
||||||
}
|
|
||||||
|
|
||||||
const getTreeListData = async () => {
|
|
||||||
try {
|
|
||||||
const res = await getTreeMenuList()
|
|
||||||
menuTreeData.value = res ?? []
|
|
||||||
return menuTreeData.value
|
|
||||||
} catch (error) {
|
|
||||||
console.error('加载菜单树失败:', error)
|
|
||||||
menuTreeData.value = []
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const getRoleMenuIds = async () => {
|
|
||||||
try {
|
|
||||||
const reqParams = { roleId: props.formData.roleId }
|
|
||||||
const res = await getHomeRoleMenus(reqParams)
|
|
||||||
return (res ?? []).map(item => String(item?.menuId)).filter(id => id)
|
|
||||||
} catch (error) {
|
|
||||||
console.error('加载角色菜单权限失败:', error)
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const treeProps = reactive({
|
|
||||||
label: 'label',
|
|
||||||
children: 'children',
|
|
||||||
disabled: 'disabled'
|
|
||||||
})
|
|
||||||
|
|
||||||
function getIndeterminateKeys(node) {
|
|
||||||
let keys = []
|
|
||||||
if (node.indeterminate) {
|
|
||||||
keys.push(node.key)
|
|
||||||
}
|
|
||||||
if (node.childNodes) {
|
|
||||||
node.childNodes.forEach(c => keys.push(...getIndeterminateKeys(c)))
|
|
||||||
}
|
|
||||||
return keys
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCheckedAndIndeterminateKeys() {
|
|
||||||
if (!menuTreeRef.value) return []
|
|
||||||
const checked = menuTreeRef.value.getCheckedKeys(false)
|
|
||||||
const indeterminate = getIndeterminateKeys(menuTreeRef.value.root)
|
|
||||||
return [...new Set([...checked, ...indeterminate])]
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(async () => {
|
|
||||||
loading.value = true
|
|
||||||
try {
|
|
||||||
const treeData = await getTreeListData()
|
|
||||||
const roleMenuIds = await getRoleMenuIds()
|
|
||||||
const propsMenuIds = (props.formData?.menuIds ?? []).map(id => String(id)).filter(id => id)
|
|
||||||
const allMenuIds = roleMenuIds.length > 0 ? roleMenuIds : propsMenuIds
|
|
||||||
const leafMenuIds = filterOnlyLeafIds(allMenuIds, treeData)
|
|
||||||
|
|
||||||
if (leafMenuIds.length > 0) {
|
|
||||||
selectedMenuIds.value = [...leafMenuIds]
|
|
||||||
setTimeout(() => {
|
|
||||||
if (menuTreeRef.value && treeData.length) {
|
|
||||||
menuTreeRef.value.setCheckedKeys(leafMenuIds, false)
|
|
||||||
}
|
|
||||||
}, 300)
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error('初始化权限数据失败:', error)
|
|
||||||
} finally {
|
|
||||||
loading.value = false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
watch(() => props.formData.menuIds, (newVal) => {
|
|
||||||
if (!newVal || !newVal.length || !menuTreeRef.value || !menuTreeData.value.length) return
|
|
||||||
|
|
||||||
const allMenuIds = newVal.map(id => String(id)).filter(id => id)
|
|
||||||
const leafMenuIds = filterOnlyLeafIds(allMenuIds, menuTreeData.value)
|
|
||||||
|
|
||||||
if (leafMenuIds.length) {
|
|
||||||
selectedMenuIds.value = [...leafMenuIds]
|
|
||||||
menuTreeRef.value.setCheckedKeys(leafMenuIds, false)
|
|
||||||
}
|
|
||||||
}, { deep: true })
|
|
||||||
|
|
||||||
const handleCheck = () => {
|
|
||||||
if (!menuTreeRef.value) return
|
|
||||||
selectedMenuIds.value = menuTreeRef.value.getCheckedKeys(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleCheckChange = () => {
|
|
||||||
handleCheck()
|
|
||||||
}
|
|
||||||
|
|
||||||
const validate = async () => {
|
const validate = async () => {
|
||||||
if (selectedMenuIds.value.length === 0) {
|
if (!formRef.value) return false
|
||||||
ElMessage.warning('请至少选择一个菜单权限!')
|
try {
|
||||||
|
const valid = await formRef.value.validate()
|
||||||
|
return valid
|
||||||
|
} catch (error) {
|
||||||
|
console.error('表单验证失败:', error)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const resetForm = () => {
|
const resetForm = () => {
|
||||||
if (menuTreeRef.value) {
|
if (formRef.value) formRef.value.resetFields()
|
||||||
menuTreeRef.value.setCheckedKeys([])
|
}
|
||||||
selectedMenuIds.value = []
|
|
||||||
|
async function getUserData() {
|
||||||
|
try {
|
||||||
|
const res = await getHomeUserListAll()
|
||||||
|
transferData.value = res || []
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取数据失败:', error);
|
||||||
|
transferData.value = []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({
|
async function getUserModuleData() {
|
||||||
validate,
|
try {
|
||||||
resetForm,
|
const reqParams = {
|
||||||
getSelectedMenuIds: () => getCheckedAndIndeterminateKeys(),
|
moduleId: props.formData.moduleId
|
||||||
getLeafMenuIds: () => menuTreeRef.value ? menuTreeRef.value.getCheckedKeys(true) : []
|
}
|
||||||
|
const res = await getHomeModuleUserList(reqParams)
|
||||||
|
if (Array.isArray(res)) {
|
||||||
|
const selectedUserIds = res.map(item => item.userId).filter(Boolean)
|
||||||
|
nextTick(() => {
|
||||||
|
props.formData.userIds = selectedUserIds
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取数据失败:', error);
|
||||||
|
transUserData.value = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(() => props.formData.moduleId, () => {
|
||||||
|
if (props.formData.moduleId) {
|
||||||
|
getUserModuleData()
|
||||||
|
}
|
||||||
|
}, { immediate: true })
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getUserData()
|
||||||
|
getUserModuleData()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
defineExpose({ validate, resetForm })
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.role-auth-container {
|
.dialog-form-container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
|
margin: 0;
|
||||||
border: 1px solid rgba(64, 158, 255, 0.15);
|
border: 1px solid rgba(64, 158, 255, 0.15);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
background: #fff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.role-info-form {
|
.form-row {
|
||||||
margin-bottom: 16px;
|
|
||||||
padding-bottom: 12px;
|
|
||||||
border-bottom: 1px solid #e5e7eb;
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
width: 100%;
|
||||||
|
margin: 0 0 16px 0;
|
||||||
gap: 20px;
|
gap: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.form-row:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.form-col {
|
.form-col {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-width: 200px;
|
min-width: 180px;
|
||||||
}
|
|
||||||
.info-input {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
:deep(.role-info-form .el-form-item) {
|
|
||||||
margin-bottom: 0;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
:deep(.role-info-form .el-input.is-disabled .el-input__inner) {
|
|
||||||
background-color: #f5f7fa;
|
|
||||||
color: #666;
|
|
||||||
}
|
|
||||||
|
|
||||||
.menu-tree-wrapper {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tree-content {
|
|
||||||
width: 100%;
|
|
||||||
height: 400px;
|
|
||||||
overflow-y: auto;
|
|
||||||
border: 1px solid #e5e7eb;
|
|
||||||
border-radius: 4px;
|
|
||||||
padding: 8px;
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.el-tree) {
|
.transfer-col {
|
||||||
--el-tree-node-content-hover-bg-color: #f5f7fa;
|
width: 100% !important;
|
||||||
}
|
min-width: unset !important;
|
||||||
:deep(.el-tree-node__content) {
|
padding: 0 !important;
|
||||||
height: 36px;
|
margin: 0 !important;
|
||||||
line-height: 36px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.tree-content::-webkit-scrollbar {
|
.full-width-transfer {
|
||||||
width: 6px;
|
width: 100% !important;
|
||||||
|
box-sizing: border-box !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
margin: 0 !important;
|
||||||
}
|
}
|
||||||
.tree-content::-webkit-scrollbar-thumb {
|
|
||||||
background-color: #dcdfe6;
|
:deep(.el-transfer) {
|
||||||
border-radius: 3px;
|
width: 100% !important;
|
||||||
|
display: flex !important;
|
||||||
|
flex-direction: row !important;
|
||||||
|
flex-wrap: nowrap !important;
|
||||||
|
align-items: stretch !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
box-sizing: border-box !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-transfer-panel) {
|
||||||
|
flex: 1 1 0 !important;
|
||||||
|
width: calc((100% - 50px) / 2) !important;
|
||||||
|
max-width: calc((100% - 50px) / 2) !important;
|
||||||
|
min-width: 150px !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
box-sizing: border-box !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-transfer__buttons) {
|
||||||
|
flex: 0 0 50px !important;
|
||||||
|
display: flex !important;
|
||||||
|
flex-direction: row !important;
|
||||||
|
justify-content: center !important;
|
||||||
|
align-items: center !important;
|
||||||
|
padding: 0 5px !important;
|
||||||
|
gap: 5px !important;
|
||||||
|
height: 100% !important;
|
||||||
|
margin: auto 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-transfer__button) {
|
||||||
|
width: 45px !important;
|
||||||
|
height: 32px !important;
|
||||||
|
line-height: 32px !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
font-size: 14px !important;
|
||||||
|
border-radius: 4px !important;
|
||||||
|
border: 1px solid #dcdfe6 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-transfer__button .el-icon) {
|
||||||
|
display: block !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
color: #666 !important;
|
||||||
|
font-size: 14px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-form-item) {
|
||||||
|
margin: 0 !important;
|
||||||
|
padding: 0 !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -235,7 +235,7 @@ const handleSave = async () => {
|
|||||||
if (formComponentRef.value) {
|
if (formComponentRef.value) {
|
||||||
const isValid = await formComponentRef.value.validate()
|
const isValid = await formComponentRef.value.validate()
|
||||||
if (!isValid) {
|
if (!isValid) {
|
||||||
ElMessage.warning('表单验证失败,请检查必填项')
|
ElMessage.warning('表单验证失败,请检查必填项');
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ const handleSave = async () => {
|
|||||||
if (formComponentRef.value) {
|
if (formComponentRef.value) {
|
||||||
const isValid = await formComponentRef.value.validate()
|
const isValid = await formComponentRef.value.validate()
|
||||||
if (!isValid) {
|
if (!isValid) {
|
||||||
|
ElMessage.warning('表单验证失败,请检查必填项');
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const selectedMenuIds = formComponentRef.value.getSelectedMenuIds()
|
const selectedMenuIds = formComponentRef.value.getSelectedMenuIds()
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ const handleSave = async () => {
|
|||||||
if (formComponentRef.value) {
|
if (formComponentRef.value) {
|
||||||
const isValid = await formComponentRef.value.validate()
|
const isValid = await formComponentRef.value.validate()
|
||||||
if (!isValid) {
|
if (!isValid) {
|
||||||
ElMessage.warning('表单验证失败,请检查必填项')
|
ElMessage.warning('表单验证失败,请检查必填项')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
14
src/main/java/com/mini/mybigscreen/Model/ModuleUser.java
Normal file
14
src/main/java/com/mini/mybigscreen/Model/ModuleUser.java
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package com.mini.mybigscreen.Model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ModuleUser implements Serializable {
|
||||||
|
|
||||||
|
private String moduleId;
|
||||||
|
private String moduleName;
|
||||||
|
private List<String> userIds;
|
||||||
|
}
|
||||||
@@ -2,10 +2,10 @@ package com.mini.mybigscreen.biz.controller;
|
|||||||
|
|
||||||
import com.mini.mybigscreen.Model.Message;
|
import com.mini.mybigscreen.Model.Message;
|
||||||
import com.mini.mybigscreen.Model.Result;
|
import com.mini.mybigscreen.Model.Result;
|
||||||
import com.mini.mybigscreen.biz.service.HomeModuleGroupService;
|
|
||||||
import com.mini.mybigscreen.biz.service.HomeModuleService;
|
import com.mini.mybigscreen.biz.service.HomeModuleService;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@@ -34,7 +34,9 @@ public class HomeModuleController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Result<Message> delete() {
|
@PostMapping("delete")
|
||||||
|
public Result<Message> delete(String moduleId) {
|
||||||
|
System.out.println(moduleId);
|
||||||
return Result.success(new Message("数据删除成功", 200));
|
return Result.success(new Message("数据删除成功", 200));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
package com.mini.mybigscreen.biz.controller;
|
|
||||||
|
|
||||||
import com.mini.mybigscreen.Model.Result;
|
|
||||||
import com.mini.mybigscreen.biz.service.HomeModuleGroupService;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 前端控制器
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author gaoxq
|
|
||||||
* @since 2026-03-07
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/biz/homeModuleGroup")
|
|
||||||
public class HomeModuleGroupController {
|
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private HomeModuleGroupService moduleGroupService;
|
|
||||||
|
|
||||||
@GetMapping("list")
|
|
||||||
public Result<?> getList(){
|
|
||||||
return Result.success(moduleGroupService.list());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -3,18 +3,18 @@ package com.mini.mybigscreen.biz.controller;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
import com.mini.mybigscreen.Model.Message;
|
import com.mini.mybigscreen.Model.Message;
|
||||||
|
import com.mini.mybigscreen.Model.ModuleUser;
|
||||||
import com.mini.mybigscreen.Model.Result;
|
import com.mini.mybigscreen.Model.Result;
|
||||||
import com.mini.mybigscreen.biz.domain.HomeModule;
|
import com.mini.mybigscreen.biz.domain.HomeModule;
|
||||||
import com.mini.mybigscreen.biz.domain.HomeModuleUser;
|
import com.mini.mybigscreen.biz.domain.HomeModuleUser;
|
||||||
import com.mini.mybigscreen.biz.domain.HomeUser;
|
import com.mini.mybigscreen.biz.domain.HomeUser;
|
||||||
import com.mini.mybigscreen.biz.mapper.HomeModuleMapper;
|
import com.mini.mybigscreen.biz.mapper.HomeModuleMapper;
|
||||||
|
import com.mini.mybigscreen.biz.service.HomeModuleUserService;
|
||||||
import com.mini.mybigscreen.biz.service.HomeUserService;
|
import com.mini.mybigscreen.biz.service.HomeUserService;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpSession;
|
import jakarta.servlet.http.HttpSession;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -37,6 +37,9 @@ public class HomeModuleUserController {
|
|||||||
@Resource
|
@Resource
|
||||||
private HomeModuleMapper homeModuleMapper;
|
private HomeModuleMapper homeModuleMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private HomeModuleUserService moduleUserService;
|
||||||
|
|
||||||
@GetMapping("list")
|
@GetMapping("list")
|
||||||
public Result<List<HomeModule>> getList(HttpServletRequest request) {
|
public Result<List<HomeModule>> getList(HttpServletRequest request) {
|
||||||
HttpSession session = request.getSession(false);
|
HttpSession session = request.getSession(false);
|
||||||
@@ -56,12 +59,24 @@ public class HomeModuleUserController {
|
|||||||
return Result.success(moduleList);
|
return Result.success(moduleList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
public Result<Message> save() {
|
* 获取模块已有的用户
|
||||||
return Result.success(new Message("数据新增成功", 200));
|
*/
|
||||||
|
@GetMapping("userList")
|
||||||
|
public Result<?> getUserModuleList(String moduleId) {
|
||||||
|
LambdaQueryWrapper<HomeModuleUser> ModuleUserQuery = new LambdaQueryWrapper<HomeModuleUser>()
|
||||||
|
.eq(HomeModuleUser::getModuleId, moduleId);
|
||||||
|
List<HomeModuleUser> moduleUserList = moduleUserService.list(ModuleUserQuery);
|
||||||
|
return Result.success(moduleUserList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("save")
|
||||||
|
public Result<Message> save(@RequestBody ModuleUser moduleUser) {
|
||||||
|
return Result.success(new Message("数据新增成功", 200));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("delete")
|
||||||
public Result<Message> delete() {
|
public Result<Message> delete() {
|
||||||
return Result.success(new Message("数据删除成功", 200));
|
return Result.success(new Message("数据删除成功", 200));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,11 @@ public class HomeUserController {
|
|||||||
@Resource
|
@Resource
|
||||||
private HomeUserService userService;
|
private HomeUserService userService;
|
||||||
|
|
||||||
|
@GetMapping("listAll")
|
||||||
|
public Result<?> getListAll() {
|
||||||
|
return Result.success(userService.list());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("list")
|
@GetMapping("list")
|
||||||
public Result<?> getList(Integer pageNum, Integer pageSize,
|
public Result<?> getList(Integer pageNum, Integer pageSize,
|
||||||
|
|||||||
@@ -1,38 +0,0 @@
|
|||||||
package com.mini.mybigscreen.biz.domain;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
*
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author gaoxq
|
|
||||||
* @since 2026-03-07
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@TableName("biz_home_module_group")
|
|
||||||
public class HomeModuleGroup implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@TableField("create_time")
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
|
|
||||||
@TableId(value = "group_id", type = IdType.AUTO)
|
|
||||||
private String groupId;
|
|
||||||
|
|
||||||
@TableField("group_name")
|
|
||||||
private String groupName;
|
|
||||||
|
|
||||||
@TableField("ustatus")
|
|
||||||
private Integer ustatus;
|
|
||||||
}
|
|
||||||
@@ -4,9 +4,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
import com.mini.mybigscreen.Model.BaseEntity;
|
import com.mini.mybigscreen.Model.BaseEntity;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@@ -18,18 +17,20 @@ import lombok.Setter;
|
|||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author gaoxq
|
* @author gaoxq
|
||||||
* @since 2026-02-28
|
* @since 2026-03-07
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@TableName("biz_home_user")
|
@TableName("biz_home_user")
|
||||||
public class HomeUser extends BaseEntity implements Serializable {
|
public class HomeUser extends BaseEntity implements Serializable {
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录日期
|
||||||
|
*/
|
||||||
@TableField("create_time")
|
@TableField("create_time")
|
||||||
private String createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
@TableId(value = "user_id", type = IdType.AUTO)
|
@TableId(value = "user_id", type = IdType.AUTO)
|
||||||
private String userId;
|
private String userId;
|
||||||
@@ -47,7 +48,7 @@ public class HomeUser extends BaseEntity implements Serializable {
|
|||||||
* 性别
|
* 性别
|
||||||
*/
|
*/
|
||||||
@TableField("sex")
|
@TableField("sex")
|
||||||
private String sex;
|
private Integer sex;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 电子邮件
|
* 电子邮件
|
||||||
@@ -67,12 +68,6 @@ public class HomeUser extends BaseEntity implements Serializable {
|
|||||||
@TableField("role_id")
|
@TableField("role_id")
|
||||||
private String roleId;
|
private String roleId;
|
||||||
|
|
||||||
/**
|
|
||||||
* 模块名称
|
|
||||||
*/
|
|
||||||
@TableField("group_module_id")
|
|
||||||
private String groupModuleId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户状态
|
* 用户状态
|
||||||
*/
|
*/
|
||||||
@@ -90,4 +85,25 @@ public class HomeUser extends BaseEntity implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@TableField("last_login_ip")
|
@TableField("last_login_ip")
|
||||||
private String lastLoginIp;
|
private String lastLoginIp;
|
||||||
|
|
||||||
|
@TableField("f_tenant_id")
|
||||||
|
private String fTenantId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流程id
|
||||||
|
*/
|
||||||
|
@TableField("f_flow_id")
|
||||||
|
private String fFlowId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流程任务主键
|
||||||
|
*/
|
||||||
|
@TableField("f_flow_task_id")
|
||||||
|
private String fFlowTaskId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流程任务状态
|
||||||
|
*/
|
||||||
|
@TableField("f_flow_state")
|
||||||
|
private Integer fFlowState;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
package com.mini.mybigscreen.biz.mapper;
|
|
||||||
|
|
||||||
import com.github.yulichang.base.MPJBaseMapper;
|
|
||||||
import com.mini.mybigscreen.biz.domain.HomeModuleGroup;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Mapper 接口
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author gaoxq
|
|
||||||
* @since 2026-03-07
|
|
||||||
*/
|
|
||||||
public interface HomeModuleGroupMapper extends MPJBaseMapper<HomeModuleGroup> {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -2,14 +2,13 @@ package com.mini.mybigscreen.biz.mapper;
|
|||||||
|
|
||||||
import com.github.yulichang.base.MPJBaseMapper;
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
import com.mini.mybigscreen.biz.domain.HomeUser;
|
import com.mini.mybigscreen.biz.domain.HomeUser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* Mapper 接口
|
* Mapper 接口
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author gaoxq
|
* @author gaoxq
|
||||||
* @since 2026-02-28
|
* @since 2026-03-07
|
||||||
*/
|
*/
|
||||||
public interface HomeUserMapper extends MPJBaseMapper<HomeUser> {
|
public interface HomeUserMapper extends MPJBaseMapper<HomeUser> {
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
package com.mini.mybigscreen.biz.service;
|
|
||||||
|
|
||||||
import com.mini.mybigscreen.biz.domain.HomeModuleGroup;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 服务类
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author gaoxq
|
|
||||||
* @since 2026-03-07
|
|
||||||
*/
|
|
||||||
public interface HomeModuleGroupService extends IService<HomeModuleGroup> {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
package com.mini.mybigscreen.biz.service.impl;
|
|
||||||
|
|
||||||
import com.mini.mybigscreen.biz.domain.HomeModuleGroup;
|
|
||||||
import com.mini.mybigscreen.biz.mapper.HomeModuleGroupMapper;
|
|
||||||
import com.mini.mybigscreen.biz.service.HomeModuleGroupService;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 服务实现类
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author gaoxq
|
|
||||||
* @since 2026-03-07
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class HomeModuleGroupServiceImpl extends ServiceImpl<HomeModuleGroupMapper, HomeModuleGroup> implements HomeModuleGroupService {
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user