VITE_PUBLIC_PATH = '/' | VITE_PUBLIC_PATH = '/' | ||||
# 是否启用MOCK | # 是否启用MOCK | ||||
VITE_APP_USE_MOCK = false | |||||
VITE_APP_USE_MOCK = true | |||||
# proxy | # proxy | ||||
VITE_PROXY = [["/api-local","http://127.0.0.1:8002/api"],["/api-mock","http://127.0.0.1:8003"]] | VITE_PROXY = [["/api-local","http://127.0.0.1:8002/api"],["/api-mock","http://127.0.0.1:8003"]] |
path: '/system', | path: '/system', | ||||
component: 'Layout', | component: 'Layout', | ||||
redirect: '/system/menu', | redirect: '/system/menu', | ||||
pid: 0, | |||||
title: 'System', | title: 'System', | ||||
meta: { | meta: { | ||||
title: '系统管理' | title: '系统管理' |
<n-form-item v-if="['select'].includes(item.type) " :label="item.label"> | <n-form-item v-if="['select'].includes(item.type) " :label="item.label"> | ||||
<n-select v-model:value="getFormOptions.form[item.key]" v-bind="item.props" /> | <n-select v-model:value="getFormOptions.form[item.key]" v-bind="item.props" /> | ||||
</n-form-item> | </n-form-item> | ||||
<n-form-item v-if="['cascader'].includes(item.type) " :label="item.label"> | |||||
<n-form-item v-if="['area'].includes(item.type) " :label="item.label"> | |||||
<AreaCascader :ref="el=>{itemRefs[item.refIndex] = el}" v-model:value="getFormOptions.form[item.key]" v-bind="item.props" @selectd="handleSelect" /> | <AreaCascader :ref="el=>{itemRefs[item.refIndex] = el}" v-model:value="getFormOptions.form[item.key]" v-bind="item.props" @selectd="handleSelect" /> | ||||
</n-form-item> | </n-form-item> | ||||
<n-form-item v-if="['date'].includes(item.type) " :label="item.label"> | <n-form-item v-if="['date'].includes(item.type) " :label="item.label"> | ||||
const len = ref(props.info.length - 1) | const len = ref(props.info.length - 1) | ||||
const itemRefs = ref([]) | const itemRefs = ref([]) | ||||
const showButton = ref(!!(showItemNum.value < len.value)) | const showButton = ref(!!(showItemNum.value < len.value)) | ||||
/* 获取传递的props */ | |||||
const data = reactive({ | |||||
info: toRaw(props.info) | |||||
}) | |||||
const form = ref({}) | const form = ref({}) | ||||
/* 初始化搜索表单信息 */ | /* 初始化搜索表单信息 */ | ||||
function initForm() { | function initForm() { | ||||
data.info.forEach((item) => { | |||||
if (item.key) form.value[item.key] = '' | |||||
Object.keys(form.value).forEach((key) => { | |||||
form.value[key] = null | |||||
}) | }) | ||||
itemRefs.value.forEach((item) => { | itemRefs.value.forEach((item) => { | ||||
item.clearValue() | item.clearValue() |
<template> | <template> | ||||
<n-menu | <n-menu | ||||
:mode="menuMode" | :mode="menuMode" | ||||
:accordion="true" | |||||
:value="(currentRoute.title && currentRoute.meta.activeMenu) || currentRoute.title" | :value="(currentRoute.title && currentRoute.meta.activeMenu) || currentRoute.title" | ||||
:options="getMenuOptions" | :options="getMenuOptions" | ||||
@update:value="handleMenuSelect" | @update:value="handleMenuSelect" | ||||
} | } | ||||
function generateOptions(routes, basePath) { | function generateOptions(routes, basePath) { | ||||
// console.log('routes', routes) | |||||
const options = [] | const options = [] | ||||
routes.forEach((route) => { | routes.forEach((route) => { | ||||
if (route.title && !route.isHidden) { | if (route.title && !route.isHidden) { |
tmp.name = tmp.title | tmp.name = tmp.title | ||||
tmp.meta = { | tmp.meta = { | ||||
...tmp.meta, | ...tmp.meta, | ||||
title: tmp.title | |||||
title: tmp.meta.title || tmp.title | |||||
} | } | ||||
res.push(tmp) | res.push(tmp) | ||||
}) | }) |
<template> | <template> | ||||
<div> | <div> | ||||
<n-card> | <n-card> | ||||
<headSearch :info="info" @search="handleSearch" /> | |||||
<data-table | |||||
<headSearch :info="info" /> | |||||
<!-- <data-table | |||||
ref="tableRef" | ref="tableRef" | ||||
:columns="columns" | :columns="columns" | ||||
:pagination="false" | :pagination="false" | ||||
<template #tableTitle> | <template #tableTitle> | ||||
<n-button type="primary" @click="handleModal"> 添加菜单 </n-button> | <n-button type="primary" @click="handleModal"> 添加菜单 </n-button> | ||||
</template> | </template> | ||||
</data-table> | |||||
</data-table> --> | |||||
</n-card> | </n-card> | ||||
</div> | </div> | ||||
const data = [ | const data = [ | ||||
{ | { | ||||
label: '菜单名称', | label: '菜单名称', | ||||
key: 'title', | |||||
type: 'area', | |||||
key: 'name', | |||||
refIndex: 0, | |||||
props: { | props: { | ||||
placeholder: '请输入菜单名称' | |||||
placeholder: '请输入菜单名称', | |||||
options: [{ label: 1, value: 1, children: [{ label: '1-1', value: '1-1' }] }] | |||||
} | } | ||||
} | } | ||||
] | ] |