【更新】修复授权移动端无按钮错误,优化前端移动端菜单模块等管理界面

This commit is contained in:
小诺 2023-02-05 03:12:07 +08:00 committed by 俞宝山
parent b34c427a5d
commit a901e2a4ff
6 changed files with 34 additions and 33 deletions

View File

@ -48,13 +48,11 @@
formRef.value.resetFields() formRef.value.resetFields()
visible = false visible = false
} }
// //
const formRules = { const formRules = {
title: [required('请输入按钮名称')], title: [required('请输入按钮名称')],
code: [required('请输入按钮编码')] code: [required('请输入按钮编码')]
} }
// //
const onSubmit = () => { const onSubmit = () => {
formRef.value formRef.value
@ -62,7 +60,6 @@
.then(() => { .then(() => {
const defParam = { const defParam = {
category: 'BUTTON', category: 'BUTTON',
// module: recordData.value.module,
parentId: recordData.value.id parentId: recordData.value.id
} }
const param = Object.assign(defParam, formData.value) const param = Object.assign(defParam, formData.value)
@ -72,7 +69,6 @@
}) })
}) })
} }
// //
defineExpose({ defineExpose({
onOpen onOpen

View File

@ -1,7 +1,7 @@
<template> <template>
<a-drawer <a-drawer
:title="formData.id ? '编辑移动端菜单' : '增加移动端菜单'" :title="formData.id ? '编辑移动端菜单' : '增加移动端菜单'"
:width="500" :width="600"
:visible="visible" :visible="visible"
:destroy-on-close="true" :destroy-on-close="true"
:footer-style="{ textAlign: 'right' }" :footer-style="{ textAlign: 'right' }"
@ -73,19 +73,18 @@
<a-button style="margin-right: 8px" @click="onClose">关闭</a-button> <a-button style="margin-right: 8px" @click="onClose">关闭</a-button>
<a-button type="primary" @click="onSubmit" :loading="submitLoading">保存</a-button> <a-button type="primary" @click="onSubmit" :loading="submitLoading">保存</a-button>
</template> </template>
<!-- <Icon-selector ref="iconSelector" @iconCallBack="iconCallBack" />-->
<icon-mobile-selector ref="iconSelector" @iconCallBack="iconCallBack" /> <icon-mobile-selector ref="iconSelector" @iconCallBack="iconCallBack" />
</a-drawer> </a-drawer>
</template> </template>
<script setup name="mobileMenuForm"> <script setup name="mobileMenuForm">
import tool from '@/utils/tool' import tool from '@/utils/tool'
import { message } from 'ant-design-vue'
import SnowflakeId from 'snowflake-id' import SnowflakeId from 'snowflake-id'
import { cloneDeep } from 'lodash-es' import { cloneDeep } from 'lodash-es'
import { required } from '@/utils/formRules' import { required } from '@/utils/formRules'
import mobileMenuApi from '@/api/mobile/resource/menuApi' import mobileMenuApi from '@/api/mobile/resource/menuApi'
import ColorPicker from '@/components/ColorPicker/index.vue' import ColorPicker from '@/components/ColorPicker/index.vue'
// import IconSelector from '@/components/Selector/iconSelector.vue'
import IconMobileSelector from '@/components/Selector/iconMobileSelector.vue' import IconMobileSelector from '@/components/Selector/iconMobileSelector.vue'
// //
const visible = ref(false) const visible = ref(false)
@ -122,6 +121,10 @@
// //
const onOpen = (record, module) => { const onOpen = (record, module) => {
if (!module) {
message.warning('请先添加菜单所属模块')
return
}
moduleId.value = module moduleId.value = module
visible.value = true visible.value = true
// //

View File

@ -1,6 +1,7 @@
<template> <template>
<a-card :bordered="false"> <a-card :bordered="false" :body-style="{ 'padding-bottom': '0px' }" class="mb-2">
<a-space class="mb-3"> <a-form ref="searchFormRef" name="advanced_search" :model="searchFormState" class="ant-advanced-search-form">
<a-space style="align-items: normal">
<a-radio-group v-model:value="module" button-style="solid"> <a-radio-group v-model:value="module" button-style="solid">
<a-radio-button <a-radio-button
v-for="module in moduleList" v-for="module in moduleList"
@ -12,15 +13,17 @@
{{ module.title }}</a-radio-button {{ module.title }}</a-radio-button
> >
</a-radio-group> </a-radio-group>
<a-form-item name="searchKey">
<a-input-search <a-space>
v-model:value="searchFormState.searchKey" <a-input v-model:value="searchFormState.searchKey" placeholder="请输入模块名称关键词"></a-input>
placeholder="请输入菜单名称关键词" <a-button type="primary" @click="table.refresh(true)">查询</a-button>
enter-button <a-button style="margin: 0 8px" @click="() => searchFormRef.resetFields()">重置</a-button>
allowClear
@search="onSearch"
/>
</a-space> </a-space>
</a-form-item>
</a-space>
</a-form>
</a-card>
<a-card :bordered="false">
<s-table <s-table
ref="table" ref="table"
:columns="columns" :columns="columns"
@ -47,8 +50,9 @@
<span v-else>{{record.path}}</span> <span v-else>{{record.path}}</span>
</template> </template>
<template v-if="column.dataIndex === 'icon'"> <template v-if="column.dataIndex === 'icon'">
<!-- <component :is="record.icon" />--> <a-tag :color="record.color">
<span class="snowy xn-icons" :class="record.icon" ></span> <span class="snowy xn-icons" :class="record.icon" ></span>
</a-tag>
</template> </template>
<template v-if="column.dataIndex === 'regType'"> <template v-if="column.dataIndex === 'regType'">
{{ $TOOL.dictTypeData('MOBILE_REG_TYPE', record.regType) }} {{ $TOOL.dictTypeData('MOBILE_REG_TYPE', record.regType) }}
@ -101,9 +105,9 @@
let searchFormState = reactive({}) let searchFormState = reactive({})
let moduleList = ref([]) let moduleList = ref([])
const module = ref() const module = ref()
const searchFormRef = ref()
const table = ref() const table = ref()
const formRef = ref() const formRef = ref()
const searchFormRef = ref()
const changeModuleFormRef = ref() const changeModuleFormRef = ref()
const button = ref() const button = ref()
const toolConfig = { refresh: true, height: true, columnSetting: true, striped: false } const toolConfig = { refresh: true, height: true, columnSetting: true, striped: false }
@ -184,13 +188,6 @@
searchFormState.module = value searchFormState.module = value
table.value.refresh(true) table.value.refresh(true)
} }
//
const onSearch = () => {
if (searchFormState.searchKey) {
table.value.refresh(true)
}
}
// //
const deleteMobileMenu = (record) => { const deleteMobileMenu = (record) => {
let params = [ let params = [

View File

@ -27,7 +27,7 @@
<a-button style="margin-right: 8px" @click="onClose">关闭</a-button> <a-button style="margin-right: 8px" @click="onClose">关闭</a-button>
<a-button type="primary" @click="onSubmit">保存</a-button> <a-button type="primary" @click="onSubmit">保存</a-button>
</template> </template>
<Icon-selector ref="iconSelector" @iconCallBack="iconCallBack" /> <icon-mobile-selector ref="iconSelector" @iconCallBack="iconCallBack" />
</a-drawer> </a-drawer>
</template> </template>
@ -35,7 +35,7 @@
import ColorPicker from '@/components/ColorPicker/index.vue' import ColorPicker from '@/components/ColorPicker/index.vue'
import { required } from '@/utils/formRules' import { required } from '@/utils/formRules'
import moduleApi from '@/api/mobile/resource/moduleApi' import moduleApi from '@/api/mobile/resource/moduleApi'
import IconSelector from '@/components/Selector/iconSelector.vue' import IconMobileSelector from '@/components/Selector/iconMobileSelector.vue'
// //
let visible = $ref(false) let visible = $ref(false)
const emit = defineEmits({ successful: null }) const emit = defineEmits({ successful: null })

View File

@ -110,6 +110,12 @@
return res return res
}) })
} }
//
const onSearch = () => {
if (searchFormState.searchKey) {
table.value.refresh(true)
}
}
// //
const deleteModule = (record) => { const deleteModule = (record) => {
let params = [ let params = [

View File

@ -206,7 +206,6 @@ public class MobileMenuServiceImpl extends ServiceImpl<MobileMenuMapper, MobileM
@Override @Override
public List<JSONObject> mobileMenuTreeSelector() { public List<JSONObject> mobileMenuTreeSelector() {
LambdaQueryWrapper<MobileMenu> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<MobileMenu> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(MobileMenu::getCategory, MobileResourceCategoryEnum.MODULE.getValue(), MobileResourceCategoryEnum.MENU.getValue());
List<MobileMenu> allModuleAndMenuList = this.list(lambdaQueryWrapper); List<MobileMenu> allModuleAndMenuList = this.list(lambdaQueryWrapper);
List<MobileMenu> mobileModuleList = CollectionUtil.newArrayList(); List<MobileMenu> mobileModuleList = CollectionUtil.newArrayList();
List<MobileMenu> mobileMenuList = CollectionUtil.newArrayList(); List<MobileMenu> mobileMenuList = CollectionUtil.newArrayList();
@ -218,7 +217,7 @@ public class MobileMenuServiceImpl extends ServiceImpl<MobileMenuMapper, MobileM
allModuleAndMenuList.forEach(mobileMenu -> { allModuleAndMenuList.forEach(mobileMenu -> {
if (mobileMenu.getCategory().equals(MobileResourceCategoryEnum.MODULE.getValue())) mobileModuleList.add(mobileMenu); if (mobileMenu.getCategory().equals(MobileResourceCategoryEnum.MODULE.getValue())) mobileModuleList.add(mobileMenu);
if (mobileMenu.getCategory().equals(MobileResourceCategoryEnum.MENU.getValue())) mobileMenuList.add(mobileMenu); if (mobileMenu.getCategory().equals(MobileResourceCategoryEnum.MENU.getValue())) mobileMenuList.add(mobileMenu);
if (mobileMenu.getCategory().equals(MobileResourceCategoryEnum.BUTTON.getValue())) mobileMenuList.add(mobileMenu); if (mobileMenu.getCategory().equals(MobileResourceCategoryEnum.BUTTON.getValue())) mobileButtonList.add(mobileMenu);
}); });
List<JSONObject> leafMenuList = CollectionUtil.newArrayList(); List<JSONObject> leafMenuList = CollectionUtil.newArrayList();
List<TreeNode<String>> treeNodeList = mobileMenuList.stream().map(mobileMenu -> List<TreeNode<String>> treeNodeList = mobileMenuList.stream().map(mobileMenu ->