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