|
@@ -1,7 +1,7 @@
|
|
<template>
|
|
<template>
|
|
<CommonPage back :title="detail.title ">
|
|
<CommonPage back :title="detail.title ">
|
|
<template #action>
|
|
<template #action>
|
|
- <NButton type="primary">
|
|
|
|
|
|
+ <NButton type="primary" @click="handleAdd()">
|
|
<i class="i-material-symbols:add mr-4 text-18" />
|
|
<i class="i-material-symbols:add mr-4 text-18" />
|
|
新增子菜单
|
|
新增子菜单
|
|
</NButton>
|
|
</NButton>
|
|
@@ -22,21 +22,60 @@
|
|
/>
|
|
/>
|
|
</MeQueryItem>
|
|
</MeQueryItem>
|
|
</MeCrud>
|
|
</MeCrud>
|
|
|
|
+
|
|
|
|
+ <MeModal ref="modalRef" width="520px">
|
|
|
|
+ <n-form ref="modalFormRef" label-placement="left" label-align="left" :label-width="80" :model="modalForm">
|
|
|
|
+ <n-form-item
|
|
|
|
+ label="名称" path="title" :rule="{
|
|
|
|
+ required: true,
|
|
|
|
+ message: '请输入名称',
|
|
|
|
+ trigger: ['input', 'blur'],
|
|
|
|
+ }"
|
|
|
|
+ >
|
|
|
|
+ <n-input v-model:value="modalForm.title" />
|
|
|
|
+ </n-form-item>
|
|
|
|
+
|
|
|
|
+ <n-form-item label="备注" path="remark">
|
|
|
|
+ <n-input v-model:value="modalForm.remark" />
|
|
|
|
+ </n-form-item>
|
|
|
|
+ <n-form-item label="是否显示" path="isPublish">
|
|
|
|
+ <NSwitch v-model:value="modalForm.isPublish">
|
|
|
|
+ <template #checked>
|
|
|
|
+ 启用
|
|
|
|
+ </template>
|
|
|
|
+ <template #unchecked>
|
|
|
|
+ 停用
|
|
|
|
+ </template>
|
|
|
|
+ </NSwitch>
|
|
|
|
+ </n-form-item>
|
|
|
|
+ <n-form-item label="状态" path="enable">
|
|
|
|
+ <NSwitch v-model:value="modalForm.enable">
|
|
|
|
+ <template #checked>
|
|
|
|
+ 启用
|
|
|
|
+ </template>
|
|
|
|
+ <template #unchecked>
|
|
|
|
+ 停用
|
|
|
|
+ </template>
|
|
|
|
+ </NSwitch>
|
|
|
|
+ </n-form-item>
|
|
|
|
+ </n-form>
|
|
|
|
+ </MeModal>
|
|
</CommonPage>
|
|
</CommonPage>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
-import { MeCrud, MeQueryItem } from '@/components'
|
|
|
|
|
|
+import { MeCrud, MeModal, MeQueryItem } from '@/components'
|
|
import { useCrud } from '@/composables'
|
|
import { useCrud } from '@/composables'
|
|
|
|
+import { useUserStore } from '@/store/index.js'
|
|
import { formatDateTime } from '@/utils'
|
|
import { formatDateTime } from '@/utils'
|
|
import { NButton, NSwitch } from 'naive-ui'
|
|
import { NButton, NSwitch } from 'naive-ui'
|
|
import { useRoute, useRouter } from 'vue-router'
|
|
import { useRoute, useRouter } from 'vue-router'
|
|
-
|
|
|
|
import api from './api.js'
|
|
import api from './api.js'
|
|
|
|
|
|
const $table = ref(null)
|
|
const $table = ref(null)
|
|
|
|
|
|
const router = useRouter()
|
|
const router = useRouter()
|
|
|
|
+const { userId } = useUserStore()
|
|
const route = useRoute()
|
|
const route = useRoute()
|
|
const detail = ref({
|
|
const detail = ref({
|
|
title: '',
|
|
title: '',
|
|
@@ -46,9 +85,9 @@ const detail = ref({
|
|
const queryItems = ref({
|
|
const queryItems = ref({
|
|
parentId: route.params.id,
|
|
parentId: route.params.id,
|
|
})
|
|
})
|
|
-const { handleDelete, handleEdit }
|
|
|
|
|
|
+const { modalRef, modalFormRef, modalAction, modalForm, handleAdd, handleDelete, handleEdit }
|
|
= useCrud({
|
|
= useCrud({
|
|
- name: '文章',
|
|
|
|
|
|
+ name: '子菜单',
|
|
doCreate: api.create,
|
|
doCreate: api.create,
|
|
doDelete: api.delete,
|
|
doDelete: api.delete,
|
|
doUpdate: api.update,
|
|
doUpdate: api.update,
|
|
@@ -147,7 +186,12 @@ async function handleEnable(row) {
|
|
row.enableLoading = false
|
|
row.enableLoading = false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+watchEffect(() => {
|
|
|
|
+ if (userId) {
|
|
|
|
+ modalForm.value.userId = userId
|
|
|
|
+ modalForm.value.parentId = detail.value.id
|
|
|
|
+ }
|
|
|
|
+})
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
$table.value?.handleSearch()
|
|
$table.value?.handleSearch()
|
|
getMenuDetail()
|
|
getMenuDetail()
|