Browse Source

Merge branch 'zhangtao' of zhangtao/restructure into develop

develop
zhangtao 2 years ago
parent
commit
ed8078f54d
7 changed files with 15 additions and 15 deletions
  1. +1
    -1
      .env.localhost
  2. +1
    -0
      mock/system/router.js
  3. +3
    -7
      src/components/Search/index.vue
  4. +1
    -1
      src/layout/components/Menu/index.vue
  5. +1
    -1
      src/store/modules/permission.js
  6. +3
    -3
      src/views/system/menu/index.vue
  7. +5
    -2
      src/views/system/menu/info.js

+ 1
- 1
.env.localhost View File

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"]]

+ 1
- 0
mock/system/router.js View File

path: '/system', path: '/system',
component: 'Layout', component: 'Layout',
redirect: '/system/menu', redirect: '/system/menu',
pid: 0,
title: 'System', title: 'System',
meta: { meta: {
title: '系统管理' title: '系统管理'

+ 3
- 7
src/components/Search/index.vue View File

<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()

+ 1
- 1
src/layout/components/Menu/index.vue View File

<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) {

+ 1
- 1
src/store/modules/permission.js View File

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)
}) })

+ 3
- 3
src/views/system/menu/index.vue View File

<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>



+ 5
- 2
src/views/system/menu/info.js View File

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' }] }]
} }
} }
] ]

Loading…
Cancel
Save