菜单关联专题分类,引导页接口对接,右侧菜单增加专题参数。

dianlixunjian
刘妍 2024-06-29 16:49:46 +08:00
parent 63862f13f5
commit e24e0436ff
5 changed files with 76 additions and 65 deletions

View File

@ -68,12 +68,13 @@ enum Api {
DeleteNotice = '/api/DroneCaseinfo/UpdateDelMessage', DeleteNotice = '/api/DroneCaseinfo/UpdateDelMessage',
UserList = '/api/users/load', UserList = '/api/users/load',
// StatisticalList='/api/DroneCaseinfo/CaseSynthesisCensus', // StatisticalList='/api/DroneCaseinfo/CaseSynthesisCensus',
StatisticalList = "/api/DroneCaseinfo/CaseSynthesisCensusSingle", StatisticalList = '/api/DroneCaseinfo/CaseSynthesisCensusSingle',
StatisticalListExport = "/api/DroneCaseinfo/ExportCaseSynthesisCensusStreet", StatisticalListExport = '/api/DroneCaseinfo/ExportCaseSynthesisCensusStreet',
LoadNoticeDetail="/api/DroneCaseinfo/LoadMessage", LoadNoticeDetail = '/api/DroneCaseinfo/LoadMessage',
getChildrenTree = '/api/Orgs/LoadChildren', getChildrenTree = '/api/Orgs/LoadChildren',
GetUserRoles = '/api/Roles/UserRoles', GetUserRoles = '/api/Roles/UserRoles',
GetUserOrgs = '/api/Orgs/UserOrgs', GetUserOrgs = '/api/Orgs/UserOrgs',
GetSpecialData = '/api/Specialcolumn/GetDataColName',
} }
export const getPositionsTree = (params?: AccountParams) => export const getPositionsTree = (params?: AccountParams) =>
@ -103,7 +104,7 @@ export const loadForRole = (params?: DeptListItem) =>
export const loadByRole = (params?: DeptListItem) => export const loadByRole = (params?: DeptListItem) =>
defHttp.get<DeptListGetResultModel>({ url: Api.LoadByRole, params }); defHttp.get<DeptListGetResultModel>({ url: Api.LoadByRole, params });
export const getChildrenTree = (params:{parentId:number}) => export const getChildrenTree = (params: { parentId: number }) =>
defHttp.get({ url: Api.getChildrenTree, params }); defHttp.get({ url: Api.getChildrenTree, params });
export function addAccount(params) { export function addAccount(params) {
@ -266,81 +267,62 @@ export const getLoadDataBaseLinkTree = () => defHttp.get({ url: Api.LoadDataBase
export const getPosInfo = (params) => defHttp.get({ url: Api.GetPosInfo, params }); export const getPosInfo = (params) => defHttp.get({ url: Api.GetPosInfo, params });
export const getUserRoles = (params) => defHttp.get({ url: Api.GetUserRoles, params }); export const getUserRoles = (params) => defHttp.get({ url: Api.GetUserRoles, params });
export const getUserOrgs = (params) => defHttp.get({ url: Api.GetUserOrgs, params }); export const getUserOrgs = (params) => defHttp.get({ url: Api.GetUserOrgs, params });
export const getReportList = (params: ReportParams)=> export const getReportList = (params: ReportParams) =>
defHttp.get<ReportListGetResultModel>({ url: Api.ReportList, params }); defHttp.get<ReportListGetResultModel>({ url: Api.ReportList, params });
export const getStatisticalList = (params: ReportParams) =>
export const getStatisticalList = (params: ReportParams)=>
defHttp.get<StatisticalListGetResultModel>({ url: Api.StatisticalList, params }); defHttp.get<StatisticalListGetResultModel>({ url: Api.StatisticalList, params });
export const exportStatisticalList = (params:ReportParams)=>{ export const exportStatisticalList = (params: ReportParams) => {
return defHttp.post( return defHttp.post({
{ url: Api.StatisticalListExport,
url: Api.StatisticalListExport, params,
params, });
}, };
);
}
export const getNoticeList = (params?:Object) => export const getNoticeList = (params?: Object) =>
defHttp.get<NoticeListGetResultModel>({url:Api.NoticeList,params}) defHttp.get<NoticeListGetResultModel>({ url: Api.NoticeList, params });
export function addNotice(params) { export function addNotice(params) {
return defHttp.post( return defHttp.post({
{ url: Api.AddNotice,
url: Api.AddNotice, params,
params, });
},
);
} }
export function updateNotice(params) { export function updateNotice(params) {
return defHttp.post( return defHttp.post({
{ url: Api.UpdateNotice,
url: Api.UpdateNotice, params,
params, });
},
);
} }
export function deleteNotice(params) { export function deleteNotice(params) {
return defHttp.post( return defHttp.post({
{ url: Api.DeleteNotice,
url: Api.DeleteNotice, params,
params, });
},
);
} }
export function getNoticeDetail(params) { export function getNoticeDetail(params) {
return defHttp.get( return defHttp.get({
{ url: Api.LoadNoticeDetail,
url: Api.LoadNoticeDetail, params,
params, });
},
);
} }
export function getCaseInfoList(params) {
export function getCaseInfoList(params){ return defHttp.get({
return defHttp.get( url: Api.ReportList,
{ params,
url: Api.ReportList, });
params,
},
);
} }
export const getUserList = (params: UserListParams) =>
export const getUserList = (params: UserListParams)=>
defHttp.get<UserListGetResultModel>({ url: Api.UserList, params }); defHttp.get<UserListGetResultModel>({ url: Api.UserList, params });
export const getSpecialData = () => defHttp.get({ url: Api.GetSpecialData });

View File

@ -314,8 +314,7 @@ export const usePermissionStore = defineStore({
//通过后端获取菜单 //通过后端获取菜单
const _this = this; const _this = this;
async function buildMenusByServer(list) { async function buildMenusByServer(list) {
console.log(userStore.getSubject); const data = await getMenuList({ typeId: userStore.getSubject });
const data = await getMenuList({ subject: userStore.getSubject });
const moduleRoutes = list; const moduleRoutes = list;
await data.forEach((value) => { await data.forEach((value) => {
moduleRoutes.push(normalizeMenu(value)); moduleRoutes.push(normalizeMenu(value));

View File

@ -66,7 +66,7 @@ export const useUserStore = defineStore({
async setSubject(subject: string | undefined) { async setSubject(subject: string | undefined) {
this.subject = subject; this.subject = subject;
setAuthCache(SUBJECT_KEY, subject); setAuthCache(SUBJECT_KEY, subject);
if (subject) { if (subject != undefined) {
const permissionStore = usePermissionStore(); const permissionStore = usePermissionStore();
await permissionStore.buildRoutesAction(); await permissionStore.buildRoutesAction();
await router.replace(PageEnum.BASE_HOME); await router.replace(PageEnum.BASE_HOME);

View File

@ -2,6 +2,7 @@ import { BasicColumn, FormSchema } from '@/components/Table';
import { h } from 'vue'; import { h } from 'vue';
import { Tag } from 'ant-design-vue'; import { Tag } from 'ant-design-vue';
import Icon from '@/components/Icon/Icon.vue'; import Icon from '@/components/Icon/Icon.vue';
import { getSpecialData } from '@/api/demo/system';
export const columns: BasicColumn[] = [ export const columns: BasicColumn[] = [
{ {
@ -109,6 +110,26 @@ export const formSchema: FormSchema[] = [
required: true, required: true,
ifShow: ({ values }) => isButton(values.type), ifShow: ({ values }) => isButton(values.type),
}, },
{
field: 'moduleTypeId',
label: '专题',
component: 'ApiSelect',
colProps: {
span: 24,
},
componentProps: () => {
return {
api: getSpecialData,
params: {
code: 'FormSort',
},
resultField: '',
labelField: 'title',
valueField: 'id',
};
},
ifShow: ({ values }) => !isButton(values.type),
},
{ {
field: 'sortNo', field: 'sortNo',
label: '排序', label: '排序',
@ -139,7 +160,6 @@ export const formSchema: FormSchema[] = [
field: 'url', field: 'url',
label: '路由地址', label: '路由地址',
component: 'Input', component: 'Input',
required: true,
ifShow: ({ values }) => !isButton(values.type), ifShow: ({ values }) => !isButton(values.type),
}, },
// { // {

View File

@ -1,16 +1,26 @@
<template> <template>
<div> <div>
<a-button @click="goHome('林业专题')"> </a-button> <a-button v-for="item in list" :key="item.id" @click="goHome(item.id)">
<a-button @click="goHome('矿产专题')"> </a-button> {{ item.title }}
</a-button>
<a-button @click="goHome('')"> </a-button>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { PageEnum } from '@/enums/pageEnum';
import { router } from '@/router';
import { useUserStore } from '@/store/modules/user'; import { useUserStore } from '@/store/modules/user';
import { getSpecialData } from '@/api/demo/system';
import { onMounted, ref } from 'vue';
const list: any = ref([]);
const userStore = useUserStore(); const userStore = useUserStore();
async function getData() {
const res = await getSpecialData();
console.log(res);
list.value = res;
}
onMounted(() => {
getData();
});
async function goHome(name) { async function goHome(name) {
console.log(name); console.log(name);
userStore.setSubject(name); userStore.setSubject(name);