Browse Source

菜单管理模块弹窗组件加v-if控制

develop
余菲 2 years ago
parent
commit
59912db464
6 changed files with 35 additions and 14 deletions
  1. +1
    -0
      src/layout/components/Menu/index.vue
  2. +1
    -0
      src/views/system/dept/components/DeptModal.vue
  3. +13
    -2
      src/views/system/dept/index.vue
  4. +2
    -1
      src/views/system/menu/components/MenuModal.vue
  5. +1
    -0
      src/views/system/menu/index.vue
  6. +17
    -11
      src/views/system/role/index.vue

+ 1
- 0
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"

+ 1
- 0
src/views/system/dept/components/DeptModal.vue View File

if (props.row.pid === 0) { if (props.row.pid === 0) {
row.pid = null row.pid = null
} }
console.log('====部门计算属性触发了====', row)
return { return {
title: props.row.name ? '修改部门' : '添加部门', title: props.row.name ? '修改部门' : '添加部门',
show: props.visible, show: props.visible,

+ 13
- 2
src/views/system/dept/index.vue View File

import headSearch from '@/components/Search/index.vue' import headSearch from '@/components/Search/index.vue'
import dataTable from '@/components/DataTable/index.vue' import dataTable from '@/components/DataTable/index.vue'
import TableAction from '@/components/DataTable/tools/Action.vue' import TableAction from '@/components/DataTable/tools/Action.vue'
import { getDeptList, getDeptAll, deleteDept } from '@/api/system/dept/index.js'
import {
getDeptList,
getDeptAll,
deleteDept
} from '@/api/system/dept/index.js'
import { h, unref, toRefs, ref, reactive, onMounted } from 'vue' import { h, unref, toRefs, ref, reactive, onMounted } from 'vue'
import DeptModal from './components/DeptModal.vue' import DeptModal from './components/DeptModal.vue'
import info from './info.js' import info from './info.js'
}) })
} }


return { ...toRefs(data), tableRef, loadDataTable, handleSearch, handleModal, deleteSingle }
return {
...toRefs(data),
tableRef,
loadDataTable,
handleSearch,
handleModal,
deleteSingle
}
} }
} }
</script> </script>

+ 2
- 1
src/views/system/menu/components/MenuModal.vue View File

if (props.data.pid === 0) { if (props.data.pid === 0) {
row.pid = null row.pid = null
} }
console.log('菜单页面计算属性触发:', row)
return { return {
show: props.visible,
title: props.data.title ? '修改菜单' : '添加菜单', title: props.data.title ? '修改菜单' : '添加菜单',
show: props.visible,
form: Object.assign(data.form, row), form: Object.assign(data.form, row),
negativeText: '取消', negativeText: '取消',
positiveText: '确认' positiveText: '确认'

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

</div> </div>


<MenuModal <MenuModal
v-if="modalShow"
v-model:visible="modalShow" v-model:visible="modalShow"
:data="rowData" :data="rowData"
:menu-list="menuList" :menu-list="menuList"

+ 17
- 11
src/views/system/role/index.vue View File

import dataTable from '@/components/DataTable/index.vue' import dataTable from '@/components/DataTable/index.vue'
import TableAction from '@/components/DataTable/tools/Action.vue' import TableAction from '@/components/DataTable/tools/Action.vue'
import TableSwitch from '@/components/DataTable/tools/Switch.vue' import TableSwitch from '@/components/DataTable/tools/Switch.vue'
import { getRoleList, deleteRole, setRoleStatus } from '@/api/system/role/index'
import {
getRoleList,
deleteRole,
setRoleStatus
} from '@/api/system/role/index'
import { h, ref, unref, toRefs, reactive } from 'vue' import { h, ref, unref, toRefs, reactive } from 'vue'
import table from './table.js' import table from './table.js'
import info from './info.js' import info from './info.js'
// 设置状态 // 设置状态
function setStatus(row) { function setStatus(row) {
console.log(row) console.log(row)
setRoleStatus({ id: row.data.id, status: row.value }).then(res => {
if (res.code === 0) {
handleSearch()
$message.success(res.msg)
} else {
$message.error(res.msg)
}
}).catch(e => {
console.log(e)
})
setRoleStatus({ id: row.data.id, status: row.value })
.then((res) => {
if (res.code === 0) {
handleSearch()
$message.success(res.msg)
} else {
$message.error(res.msg)
}
})
.catch((e) => {
console.log(e)
})
} }


return { return {

Loading…
Cancel
Save