添加按钮权限
This commit is contained in:
1 parent
0fa67d4d02
commit
1beb70d4aa
9 files changed
+239
-143
No files matched your search
+2
-2
@@ -18,8 +18,8 @@ VITE_ADMIN_PROXY_PATH = http://192.168.101.29:9999 # 邓-本地
|
|||||||
# VITE_IMAGE_BASE_PATH = http://123.156.230.15:8089/api # 线上
|
# VITE_IMAGE_BASE_PATH = http://123.156.230.15:8089/api # 线上
|
||||||
# VITE_IMAGE_BASE_PATH = http://pjcloud.center.takin.cc
|
# VITE_IMAGE_BASE_PATH = http://pjcloud.center.takin.cc
|
||||||
# VITE_IMAGE_BASE_PATH = http://localhost:9999
|
# VITE_IMAGE_BASE_PATH = http://localhost:9999
|
||||||
VITE_IMAGE_BASE_PATH = http://192.168.101.29:9999 # 邓-本地
|
# VITE_IMAGE_BASE_PATH = http://192.168.101.29:9999 # 邓-本地
|
||||||
# VITE_IMAGE_BASE_PATH = http://59.202.170.152:81/api/ # 正式环境
|
VITE_IMAGE_BASE_PATH = http://59.202.170.152:81/api/ # 正式环境
|
||||||
|
|
||||||
# 代码生成服务地址
|
# 代码生成服务地址
|
||||||
VITE_GEN_PROXY_PATH = http://192.168.110.156:5003
|
VITE_GEN_PROXY_PATH = http://192.168.110.156:5003
|
||||||
@@ -5,6 +5,9 @@ docker/dist
|
|||||||
|
|
||||||
|
|
||||||
# local env files
|
# local env files
|
||||||
|
.env
|
||||||
|
.env.development
|
||||||
|
.env.prod
|
||||||
.env.local
|
.env.local
|
||||||
.env.*.local
|
.env.*.local
|
||||||
|
|
||||||
|
|||||||
@@ -4,20 +4,25 @@
|
|||||||
<el-row shadow="hover" v-show="showSearch" class="ml10">
|
<el-row shadow="hover" v-show="showSearch" class="ml10">
|
||||||
<el-form :inline="true" :model="state.queryForm" @keyup.enter="getDataList" ref="queryRef">
|
<el-form :inline="true" :model="state.queryForm" @keyup.enter="getDataList" ref="queryRef">
|
||||||
<el-form-item :label="$t('sysmenu.name')" prop="menuName">
|
<el-form-item :label="$t('sysmenu.name')" prop="menuName">
|
||||||
<el-input :placeholder="$t('sysmenu.inputNameTip')" clearable style="max-width: 180px" v-model="state.queryForm.menuName" />
|
<el-input
|
||||||
|
:placeholder="$t('sysmenu.inputNameTip')"
|
||||||
|
clearable
|
||||||
|
style="max-width: 180px"
|
||||||
|
v-model="state.queryForm.menuName"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button @click="query" class="ml10" icon="search" type="primary">
|
<el-button @click="query" class="ml10" icon="search" type="primary">
|
||||||
{{ $t('common.queryBtn') }}
|
{{ $t("common.queryBtn") }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button @click="resetQuery" icon="Refresh">{{ $t('common.resetBtn') }}</el-button>
|
<el-button @click="resetQuery" icon="Refresh">{{ $t("common.resetBtn") }}</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<div class="mb8" style="width: 100%">
|
<div class="mb8" style="width: 100%">
|
||||||
<el-button @click="onOpenAddMenu" class="ml10" icon="folder-add" type="primary" v-auth="'sys_menu_add'">
|
<el-button @click="onOpenAddMenu" class="ml10" icon="folder-add" type="primary" v-auth="'sys_menu_add'">
|
||||||
{{ $t('common.addBtn') }}
|
{{ $t("common.addBtn") }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<right-toolbar
|
<right-toolbar
|
||||||
v-model:showSearch="showSearch"
|
v-model:showSearch="showSearch"
|
||||||
@@ -37,41 +42,68 @@
|
|||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
v-loading="state.loading"
|
v-loading="state.loading"
|
||||||
border
|
border
|
||||||
:cell-style="tableStyle.cellStyle"
|
|
||||||
:header-cell-style="tableStyle?.headerCellStyle"
|
:header-cell-style="tableStyle?.headerCellStyle"
|
||||||
>
|
>
|
||||||
<el-table-column :label="$t('sysmenu.name')" fixed prop="name" show-overflow-tooltip></el-table-column>
|
<el-table-column
|
||||||
<el-table-column :label="$t('sysmenu.sortOrder')" prop="sortOrder" show-overflow-tooltip></el-table-column>
|
:label="$t('sysmenu.name')"
|
||||||
<el-table-column :label="$t('sysmenu.icon')" prop="icon" show-overflow-tooltip>
|
fixed
|
||||||
|
prop="name"
|
||||||
|
align="left"
|
||||||
|
show-overflow-tooltip
|
||||||
|
min-width="200"
|
||||||
|
/>
|
||||||
|
<el-table-column :label="$t('sysmenu.sortOrder')" prop="sortOrder" align="center" show-overflow-tooltip />
|
||||||
|
<el-table-column :label="$t('sysmenu.icon')" prop="icon" show-overflow-tooltip align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<SvgIcon :name="scope.row.meta.icon" />
|
<SvgIcon :name="scope.row.meta.icon" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('sysmenu.path')" prop="path" show-overflow-tooltip></el-table-column>
|
<el-table-column :label="$t('sysmenu.path')" prop="path" show-overflow-tooltip align="center" />
|
||||||
<el-table-column :label="$t('sysmenu.menuType')" show-overflow-tooltip>
|
<el-table-column :label="$t('sysmenu.menuType')" show-overflow-tooltip align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tag v-if="scope.row.menuType === '0'">左菜单</el-tag>
|
<el-tag v-if="scope.row.menuType === '0'">左菜单</el-tag>
|
||||||
<el-tag v-if="scope.row.menuType === '2'">顶菜单</el-tag>
|
<el-tag v-if="scope.row.menuType === '2'">顶菜单</el-tag>
|
||||||
<el-tag type="success" v-if="scope.row.menuType === '1'">按钮</el-tag>
|
<el-tag type="success" v-if="scope.row.menuType === '1'">按钮</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('sysmenu.keepAlive')" show-overflow-tooltip>
|
<el-table-column :label="$t('sysmenu.keepAlive')" show-overflow-tooltip align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tag v-if="scope.row.meta.isKeepAlive">开启</el-tag>
|
<el-tag v-if="scope.row.meta.isKeepAlive">开启</el-tag>
|
||||||
<el-tag type="info" v-else>关闭</el-tag>
|
<el-tag type="info" v-else>关闭</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('sysmenu.permission')" :show-overflow-tooltip="true" prop="permission"></el-table-column>
|
<el-table-column
|
||||||
<el-table-column :label="$t('common.action')" show-overflow-tooltip width="250">
|
:label="$t('sysmenu.permission')"
|
||||||
|
:show-overflow-tooltip="true"
|
||||||
|
prop="permission"
|
||||||
|
align="center"
|
||||||
|
/>
|
||||||
|
<el-table-column :label="$t('common.action')" show-overflow-tooltip width="250" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button icon="folder-add" @click="onOpenAddMenu('add', scope.row)" text type="primary" v-auth="'sys_menu_add'">
|
<el-button
|
||||||
{{ $t('common.addBtn') }}
|
icon="folder-add"
|
||||||
|
@click="onOpenAddMenu('add', scope.row)"
|
||||||
|
text
|
||||||
|
type="primary"
|
||||||
|
v-auth="'sys_menu_add'"
|
||||||
|
>
|
||||||
|
{{ $t("common.addBtn") }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button icon="edit-pen" @click="onOpenEditMenu('edit', scope.row)" text type="primary" v-auth="'sys_menu_edit'"
|
<el-button
|
||||||
>{{ $t('common.editBtn') }}
|
icon="edit-pen"
|
||||||
|
@click="onOpenEditMenu('edit', scope.row)"
|
||||||
|
text
|
||||||
|
type="primary"
|
||||||
|
v-auth="'sys_menu_edit'"
|
||||||
|
>{{ $t("common.editBtn") }}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|
||||||
<el-tooltip icon="delete" :content="$t('sysmenu.deleteDisabledTip')" :disabled="!deleteMenuDisabled(scope.row)" placement="top">
|
<el-tooltip
|
||||||
|
icon="delete"
|
||||||
|
:content="$t('sysmenu.deleteDisabledTip')"
|
||||||
|
:disabled="!deleteMenuDisabled(scope.row)"
|
||||||
|
placement="top"
|
||||||
|
>
|
||||||
<span style="margin-left: 12px">
|
<span style="margin-left: 12px">
|
||||||
<el-button
|
<el-button
|
||||||
icon="delete"
|
icon="delete"
|
||||||
@@ -81,7 +113,7 @@
|
|||||||
type="primary"
|
type="primary"
|
||||||
v-auth="'sys_menu_del'"
|
v-auth="'sys_menu_del'"
|
||||||
>
|
>
|
||||||
{{ $t('common.delBtn') }}
|
{{ $t("common.delBtn") }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</span>
|
</span>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
@@ -94,99 +126,99 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" name="systemMenu" setup>
|
<script lang="ts" name="systemMenu" setup>
|
||||||
import { delObj, pageList } from '/@/api/admin/menu';
|
import { delObj, pageList } from "/@/api/admin/menu"
|
||||||
import { BasicTableProps, useTable } from '/@/hooks/table';
|
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||||
import { useMessage, useMessageBox } from '/@/hooks/message';
|
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from "vue-i18n"
|
||||||
// 引入组件
|
// 引入组件
|
||||||
const MenuDialog = defineAsyncComponent(() => import('./form.vue'));
|
const MenuDialog = defineAsyncComponent(() => import("./form.vue"))
|
||||||
const { t } = useI18n();
|
const { t } = useI18n()
|
||||||
// 定义变量内容
|
// 定义变量内容
|
||||||
const tableRef = ref();
|
const tableRef = ref()
|
||||||
const menuDialogRef = ref();
|
const menuDialogRef = ref()
|
||||||
const showSearch = ref(true);
|
const showSearch = ref(true)
|
||||||
const queryRef = ref();
|
const queryRef = ref()
|
||||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||||
pageList: pageList, // H
|
pageList: pageList, // H
|
||||||
queryForm: {
|
queryForm: {
|
||||||
parentId: -1,
|
parentId: -1,
|
||||||
menuName: '',
|
menuName: "",
|
||||||
},
|
},
|
||||||
isPage: false,
|
isPage: false,
|
||||||
});
|
})
|
||||||
|
|
||||||
const { getDataList, tableStyle } = useTable(state);
|
const { getDataList, tableStyle } = useTable(state)
|
||||||
|
|
||||||
// 根据类型判断是否有子节点
|
// 根据类型判断是否有子节点
|
||||||
const setHasChildren = (arr: any[]) => {
|
const setHasChildren = (arr: any[]) => {
|
||||||
arr.forEach((item) => {
|
arr.forEach((item) => {
|
||||||
// 添加 hasChildren 属性
|
// 添加 hasChildren 属性
|
||||||
item.hasChildren = item.menuType !== '1';
|
item.hasChildren = item.menuType !== "1"
|
||||||
});
|
})
|
||||||
};
|
}
|
||||||
const tableList = computed(() => {
|
const tableList = computed(() => {
|
||||||
const list = state.dataList;
|
const list = state.dataList
|
||||||
if (Array.isArray(list)) {
|
if (Array.isArray(list)) {
|
||||||
setHasChildren(list);
|
setHasChildren(list)
|
||||||
}
|
}
|
||||||
return list;
|
return list
|
||||||
});
|
})
|
||||||
|
|
||||||
// 打开新增菜单弹窗
|
// 打开新增菜单弹窗
|
||||||
const onOpenAddMenu = (type?: string, row?: any) => {
|
const onOpenAddMenu = (type?: string, row?: any) => {
|
||||||
menuDialogRef.value.openDialog(type, row);
|
menuDialogRef.value.openDialog(type, row)
|
||||||
};
|
}
|
||||||
// 打开编辑菜单弹窗
|
// 打开编辑菜单弹窗
|
||||||
const onOpenEditMenu = (type: string, row: any) => {
|
const onOpenEditMenu = (type: string, row: any) => {
|
||||||
menuDialogRef.value.openDialog(type, row);
|
menuDialogRef.value.openDialog(type, row)
|
||||||
};
|
}
|
||||||
|
|
||||||
//是否禁用删除
|
//是否禁用删除
|
||||||
const deleteMenuDisabled = (row: any) => {
|
const deleteMenuDisabled = (row: any) => {
|
||||||
return (row.children || []).length > 0;
|
return (row.children || []).length > 0
|
||||||
};
|
}
|
||||||
|
|
||||||
// 搜索事件
|
// 搜索事件
|
||||||
const query = () => {
|
const query = () => {
|
||||||
state.dataList = [];
|
state.dataList = []
|
||||||
state.queryForm.parentId = undefined;
|
state.queryForm.parentId = undefined
|
||||||
getDataList();
|
getDataList()
|
||||||
};
|
}
|
||||||
|
|
||||||
// 清空搜索条件
|
// 清空搜索条件
|
||||||
const resetQuery = () => {
|
const resetQuery = () => {
|
||||||
queryRef.value.resetFields();
|
queryRef.value.resetFields()
|
||||||
state.dataList = [];
|
state.dataList = []
|
||||||
getDataList();
|
getDataList()
|
||||||
};
|
}
|
||||||
|
|
||||||
const load = (row: any, treeNode: unknown, resolve: (date: any[]) => void) => {
|
const load = (row: any, treeNode: unknown, resolve: (date: any[]) => void) => {
|
||||||
const param = {
|
const param = {
|
||||||
parentId: row.id,
|
parentId: row.id,
|
||||||
};
|
}
|
||||||
pageList(param).then((res) => {
|
pageList(param).then((res) => {
|
||||||
const childrenList = res.data;
|
const childrenList = res.data
|
||||||
if (Array.isArray(childrenList)) {
|
if (Array.isArray(childrenList)) {
|
||||||
setHasChildren(childrenList);
|
setHasChildren(childrenList)
|
||||||
}
|
}
|
||||||
resolve(childrenList);
|
resolve(childrenList)
|
||||||
});
|
})
|
||||||
};
|
}
|
||||||
|
|
||||||
// 删除操作
|
// 删除操作
|
||||||
const handleDelete = async (row: any) => {
|
const handleDelete = async (row: any) => {
|
||||||
try {
|
try {
|
||||||
await useMessageBox().confirm(t('common.delConfirmText'));
|
await useMessageBox().confirm(t("common.delConfirmText"))
|
||||||
} catch {
|
} catch {
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await delObj(row.id);
|
await delObj(row.id)
|
||||||
getDataList();
|
getDataList()
|
||||||
useMessage().success(t('common.delSuccessText'));
|
useMessage().success(t("common.delSuccessText"))
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
useMessage().error(err.msg);
|
useMessage().error(err.msg)
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -187,7 +187,7 @@ const dataRules = ref({
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
email: [
|
email: [
|
||||||
{ type: "email", message: "请输入正确的邮箱地址", trigger: ["blur", "change"] },
|
{ required: true, message: "请输入正确的邮箱地址", trigger: ["blur", "change"] },
|
||||||
{ validator: rule.overLength, trigger: "blur" },
|
{ validator: rule.overLength, trigger: "blur" },
|
||||||
],
|
],
|
||||||
lockFlag: [{ required: true, message: "状态不能为空", trigger: "blur" }],
|
lockFlag: [{ required: true, message: "状态不能为空", trigger: "blur" }],
|
||||||
|
|||||||
@@ -7,17 +7,32 @@
|
|||||||
<el-input placeholder="请输入分类名称" v-model="state.queryForm.name" />
|
<el-input placeholder="请输入分类名称" v-model="state.queryForm.name" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button icon="search" type="primary" @click="getDataList">查询</el-button>
|
<el-button icon="search" type="primary" @click="getDataList" v-auth="'canteen_canteenCategory_view'">
|
||||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
查询
|
||||||
|
</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery" v-auth="'canteen_canteenCategory_view'">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<div class="mb8" style="width: 100%">
|
<div class="mb8" style="width: 100%">
|
||||||
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()" v-auth="'canteen_canteenCategory_add'">
|
<el-button
|
||||||
|
icon="folder-add"
|
||||||
|
type="primary"
|
||||||
|
class="ml10"
|
||||||
|
@click="formDialogRef.openDialog()"
|
||||||
|
v-auth="'canteen_canteenCategory_add'"
|
||||||
|
>
|
||||||
新 增
|
新 增
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button plain :disabled="multiple" icon="Delete" type="primary" v-auth="'canteen_canteenCategory_del'" @click="handleDelete(selectObjs)">
|
<el-button
|
||||||
|
plain
|
||||||
|
:disabled="multiple"
|
||||||
|
icon="Delete"
|
||||||
|
type="primary"
|
||||||
|
v-auth="'canteen_canteenCategory_del'"
|
||||||
|
@click="handleDelete(selectObjs)"
|
||||||
|
>
|
||||||
删 除
|
删 除
|
||||||
</el-button>
|
</el-button>
|
||||||
<right-toolbar
|
<right-toolbar
|
||||||
@@ -27,7 +42,7 @@
|
|||||||
class="ml10 mr20"
|
class="ml10 mr20"
|
||||||
style="float: right"
|
style="float: right"
|
||||||
@queryTable="getDataList"
|
@queryTable="getDataList"
|
||||||
></right-toolbar>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-table
|
<el-table
|
||||||
@@ -57,10 +72,24 @@
|
|||||||
<el-table-column prop="createTime" label="创建时间" show-overflow-tooltip min-width="160" />
|
<el-table-column prop="createTime" label="创建时间" show-overflow-tooltip min-width="160" />
|
||||||
<el-table-column label="操作" width="150" fixed="right">
|
<el-table-column label="操作" width="150" fixed="right">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button icon="edit-pen" text type="primary" v-auth="'canteen_canteenCategory_edit'" @click="formDialogRef.openDialog(scope.row.id)">
|
<el-button
|
||||||
|
icon="edit-pen"
|
||||||
|
text
|
||||||
|
type="primary"
|
||||||
|
v-auth="'canteen_canteenCategory_edit'"
|
||||||
|
@click="formDialogRef.openDialog(scope.row.id)"
|
||||||
|
>
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button icon="delete" text type="primary" v-auth="'canteen_canteenCategory_del'" @click="handleDelete([scope.row.id])">删除</el-button>
|
<el-button
|
||||||
|
icon="delete"
|
||||||
|
text
|
||||||
|
type="primary"
|
||||||
|
v-auth="'canteen_canteenCategory_del'"
|
||||||
|
@click="handleDelete([scope.row.id])"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -73,66 +102,71 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts" name="systemCanteenCategory">
|
<script setup lang="ts" name="systemCanteenCategory">
|
||||||
import { BasicTableProps, useTable } from '/@/hooks/table';
|
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||||
import { fetchList, delObjs } from '/@/api/canteen/canteenCategory';
|
import { fetchList, delObjs } from "/@/api/canteen/canteenCategory"
|
||||||
import { useMessage, useMessageBox } from '/@/hooks/message';
|
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||||
import { useDict } from '/@/hooks/dict';
|
import { useDict } from "/@/hooks/dict"
|
||||||
|
|
||||||
// 引入组件
|
// 引入组件
|
||||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
|
||||||
// 定义查询字典
|
// 定义查询字典
|
||||||
const { daily_menu } = useDict('daily_menu');
|
const { daily_menu } = useDict("daily_menu")
|
||||||
// 定义变量内容
|
// 定义变量内容
|
||||||
const formDialogRef = ref();
|
const formDialogRef = ref()
|
||||||
// 搜索变量
|
// 搜索变量
|
||||||
const queryRef = ref();
|
const queryRef = ref()
|
||||||
const showSearch = ref(true);
|
const showSearch = ref(true)
|
||||||
// 多选变量
|
// 多选变量
|
||||||
const selectObjs = ref([]) as any;
|
const selectObjs = ref([]) as any
|
||||||
const multiple = ref(true);
|
const multiple = ref(true)
|
||||||
|
|
||||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||||
queryForm: {},
|
queryForm: {},
|
||||||
pageList: fetchList,
|
pageList: fetchList,
|
||||||
});
|
})
|
||||||
|
|
||||||
// table hook
|
// table hook
|
||||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state);
|
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } =
|
||||||
|
useTable(state)
|
||||||
|
|
||||||
// 清空搜索条件
|
// 清空搜索条件
|
||||||
const resetQuery = () => {
|
const resetQuery = () => {
|
||||||
// 清空搜索条件
|
// 清空搜索条件
|
||||||
queryRef.value?.resetFields();
|
queryRef.value?.resetFields()
|
||||||
// 清空多选
|
// 清空多选
|
||||||
selectObjs.value = [];
|
selectObjs.value = []
|
||||||
getDataList();
|
getDataList()
|
||||||
};
|
}
|
||||||
|
|
||||||
// 导出excel
|
// 导出excel
|
||||||
const exportExcel = () => {
|
const exportExcel = () => {
|
||||||
downBlobFile('/canteen/canteenCategory/export', Object.assign(state.queryForm, { ids: selectObjs }), 'canteenCategory.xlsx');
|
downBlobFile(
|
||||||
};
|
"/canteen/canteenCategory/export",
|
||||||
|
Object.assign(state.queryForm, { ids: selectObjs }),
|
||||||
|
"canteenCategory.xlsx",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// 多选事件
|
// 多选事件
|
||||||
const selectionChangHandle = (objs: { id: string }[]) => {
|
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||||
selectObjs.value = objs.map(({ id }) => id);
|
selectObjs.value = objs.map(({ id }) => id)
|
||||||
multiple.value = !objs.length;
|
multiple.value = !objs.length
|
||||||
};
|
}
|
||||||
|
|
||||||
// 删除操作
|
// 删除操作
|
||||||
const handleDelete = async (ids: string[]) => {
|
const handleDelete = async (ids: string[]) => {
|
||||||
try {
|
try {
|
||||||
await useMessageBox().confirm('此操作将永久删除');
|
await useMessageBox().confirm("此操作将永久删除")
|
||||||
} catch {
|
} catch {
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await delObjs(ids);
|
await delObjs(ids)
|
||||||
getDataList();
|
getDataList()
|
||||||
useMessage().success('删除成功');
|
useMessage().success("删除成功")
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
useMessage().error(err.msg);
|
useMessage().error(err.msg)
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -85,6 +85,7 @@ import { getAllSimple as getCanteenCategory } from "/@/api/canteen/canteenCatego
|
|||||||
import { useMessage } from "/@/hooks/message"
|
import { useMessage } from "/@/hooks/message"
|
||||||
import { pageJoin } from "/@/api/wallet/mch-manage"
|
import { pageJoin } from "/@/api/wallet/mch-manage"
|
||||||
import { displayPrice } from "/@/utils/formatMoney"
|
import { displayPrice } from "/@/utils/formatMoney"
|
||||||
|
import { auth } from "/@/utils/authFunction"
|
||||||
|
|
||||||
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
|
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
|
||||||
const imageBaseUrl = import.meta.env.VITE_IMAGE_BASE_PATH
|
const imageBaseUrl = import.meta.env.VITE_IMAGE_BASE_PATH
|
||||||
@@ -110,6 +111,7 @@ const merchantId = ref() // 商户Id
|
|||||||
const merchantInfo = ref<any>([])
|
const merchantInfo = ref<any>([])
|
||||||
|
|
||||||
const addFood = async (hourType: number) => {
|
const addFood = async (hourType: number) => {
|
||||||
|
if (!auth("canteen_canteenDailyMenu_add")) return
|
||||||
if (!merchantId.value) {
|
if (!merchantId.value) {
|
||||||
useMessage().error("请选择商户再进行新增")
|
useMessage().error("请选择商户再进行新增")
|
||||||
return
|
return
|
||||||
@@ -182,6 +184,7 @@ const selectTimeFood = async () => {
|
|||||||
|
|
||||||
// 删除菜品
|
// 删除菜品
|
||||||
const delteData = async (tid: number) => {
|
const delteData = async (tid: number) => {
|
||||||
|
if (!auth("canteen_canteenDailyMenu_del")) return
|
||||||
ElMessageBox.confirm("确定删除菜品吗?", "删除菜品", {
|
ElMessageBox.confirm("确定删除菜品吗?", "删除菜品", {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
|
|||||||
@@ -7,14 +7,22 @@
|
|||||||
<el-input placeholder="请输入分类名称" v-model="state.queryForm.name" />
|
<el-input placeholder="请输入分类名称" v-model="state.queryForm.name" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button icon="search" type="primary" @click="getDataList">查询</el-button>
|
<el-button icon="search" type="primary" @click="getDataList" v-auth="'canteen_canteenOnlineCategory_view'">
|
||||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
查询
|
||||||
|
</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery" v-auth="'canteen_canteenOnlineCategory_view'">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<div class="mb8" style="width: 100%">
|
<div class="mb8" style="width: 100%">
|
||||||
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()" v-auth="'canteen_canteenOnlineCategory_add'">
|
<el-button
|
||||||
|
icon="folder-add"
|
||||||
|
type="primary"
|
||||||
|
class="ml10"
|
||||||
|
@click="formDialogRef.openDialog()"
|
||||||
|
v-auth="'canteen_canteenOnlineCategory_add'"
|
||||||
|
>
|
||||||
新 增
|
新 增
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
@@ -34,7 +42,7 @@
|
|||||||
class="ml10 mr20"
|
class="ml10 mr20"
|
||||||
style="float: right"
|
style="float: right"
|
||||||
@queryTable="getDataList"
|
@queryTable="getDataList"
|
||||||
></right-toolbar>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-table
|
<el-table
|
||||||
@@ -67,7 +75,13 @@
|
|||||||
>
|
>
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button icon="delete" text type="primary" v-auth="'canteen_canteenOnlineCategory_del'" @click="handleDelete([scope.row.id])">
|
<el-button
|
||||||
|
icon="delete"
|
||||||
|
text
|
||||||
|
type="primary"
|
||||||
|
v-auth="'canteen_canteenOnlineCategory_del'"
|
||||||
|
@click="handleDelete([scope.row.id])"
|
||||||
|
>
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
@@ -82,64 +96,69 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts" name="systemCanteenOnlineCategory">
|
<script setup lang="ts" name="systemCanteenOnlineCategory">
|
||||||
import { BasicTableProps, useTable } from '/@/hooks/table';
|
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||||
import { fetchList, delObjs } from '/@/api/canteen/canteenOnlineCategory';
|
import { fetchList, delObjs } from "/@/api/canteen/canteenOnlineCategory"
|
||||||
import { useMessage, useMessageBox } from '/@/hooks/message';
|
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||||
|
|
||||||
// 引入组件
|
// 引入组件
|
||||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
|
||||||
|
|
||||||
// 定义变量内容
|
// 定义变量内容
|
||||||
const formDialogRef = ref();
|
const formDialogRef = ref()
|
||||||
// 搜索变量
|
// 搜索变量
|
||||||
const queryRef = ref();
|
const queryRef = ref()
|
||||||
const showSearch = ref(true);
|
const showSearch = ref(true)
|
||||||
// 多选变量
|
// 多选变量
|
||||||
const selectObjs = ref([]) as any;
|
const selectObjs = ref([]) as any
|
||||||
const multiple = ref(true);
|
const multiple = ref(true)
|
||||||
|
|
||||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||||
queryForm: {},
|
queryForm: {},
|
||||||
pageList: fetchList,
|
pageList: fetchList,
|
||||||
});
|
})
|
||||||
|
|
||||||
// table hook
|
// table hook
|
||||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state);
|
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } =
|
||||||
|
useTable(state)
|
||||||
|
|
||||||
// 清空搜索条件
|
// 清空搜索条件
|
||||||
const resetQuery = () => {
|
const resetQuery = () => {
|
||||||
// 清空搜索条件
|
// 清空搜索条件
|
||||||
queryRef.value?.resetFields();
|
queryRef.value?.resetFields()
|
||||||
// 清空多选
|
// 清空多选
|
||||||
selectObjs.value = [];
|
selectObjs.value = []
|
||||||
getDataList();
|
getDataList()
|
||||||
};
|
}
|
||||||
|
|
||||||
// 导出excel
|
// 导出excel
|
||||||
const exportExcel = () => {
|
const exportExcel = () => {
|
||||||
downBlobFile('/canteen/canteenOnlineCategory/export', Object.assign(state.queryForm, { ids: selectObjs }), 'canteenOnlineCategory.xlsx');
|
downBlobFile(
|
||||||
};
|
"/canteen/canteenOnlineCategory/export",
|
||||||
|
Object.assign(state.queryForm, { ids: selectObjs }),
|
||||||
|
"canteenOnlineCategory.xlsx",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// 多选事件
|
// 多选事件
|
||||||
const selectionChangHandle = (objs: { id: string }[]) => {
|
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||||
selectObjs.value = objs.map(({ id }) => id);
|
selectObjs.value = objs.map(({ id }) => id)
|
||||||
multiple.value = !objs.length;
|
multiple.value = !objs.length
|
||||||
};
|
}
|
||||||
|
|
||||||
// 删除操作
|
// 删除操作
|
||||||
const handleDelete = async (ids: string[]) => {
|
const handleDelete = async (ids: string[]) => {
|
||||||
try {
|
try {
|
||||||
await useMessageBox().confirm('此操作将永久删除');
|
await useMessageBox().confirm("此操作将永久删除")
|
||||||
} catch {
|
} catch {
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await delObjs(ids);
|
await delObjs(ids)
|
||||||
getDataList();
|
getDataList()
|
||||||
useMessage().success('删除成功');
|
useMessage().success("删除成功")
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
useMessage().error(err.msg);
|
useMessage().error(err.msg)
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -10,8 +10,10 @@
|
|||||||
<select-ctcgol v-model="state.queryForm.categoryId" style="width: 200px" />
|
<select-ctcgol v-model="state.queryForm.categoryId" style="width: 200px" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button icon="search" type="primary" @click="getDataList">查询</el-button>
|
<el-button icon="search" type="primary" @click="getDataList" v-auth="'canteen_canteenOnlineSpu_view'">
|
||||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
查询
|
||||||
|
</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery" v-auth="'canteen_canteenOnlineSpu_view'">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-row>
|
</el-row>
|
||||||
@@ -43,7 +45,7 @@
|
|||||||
class="ml10 mr20"
|
class="ml10 mr20"
|
||||||
style="float: right"
|
style="float: right"
|
||||||
@queryTable="getDataList"
|
@queryTable="getDataList"
|
||||||
></right-toolbar>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-table
|
<el-table
|
||||||
|
|||||||
@@ -10,8 +10,10 @@
|
|||||||
<select-ctcg v-model="state.queryForm.categoryId" style="width: 200px" />
|
<select-ctcg v-model="state.queryForm.categoryId" style="width: 200px" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button icon="search" type="primary" @click="getDataList">查询</el-button>
|
<el-button icon="search" type="primary" @click="getDataList" v-auth="'canteen_canteenSpu_view'">
|
||||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
查询
|
||||||
|
</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery" v-auth="'canteen_canteenSpu_view'">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-row>
|
</el-row>
|
||||||
@@ -108,8 +110,9 @@
|
|||||||
type="primary"
|
type="primary"
|
||||||
v-auth="'canteen_canteenSpu_del'"
|
v-auth="'canteen_canteenSpu_del'"
|
||||||
@click="handleDelete([scope.row.id])"
|
@click="handleDelete([scope.row.id])"
|
||||||
>删除</el-button
|
|
||||||
>
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|||||||
Reference in new issue
Block a user