This commit is contained in:
dzc committed 2026-03-29 21:26:25 +08:00
1 parent c613f3b92b
commit 952a04e48d
5 files changed
+77 -103

No files matched your search

+4 -4
View File
@@ -11,15 +11,15 @@ ENV = 'development'
# VITE_ADMIN_PROXY_PATH = http://123.157.250.162:8089/api/ # 测试线上
# VITE_ADMIN_PROXY_PATH = http://123.156.230.15:8089/api/ # 测试线上-过期
# VITE_ADMIN_PROXY_PATH = http://localhost:9999/
# VITE_ADMIN_PROXY_PATH = http://192.168.101.196:9999 # 邓-本地
VITE_ADMIN_PROXY_PATH = http://59.202.170.152:81/api # 正式环境线上
VITE_ADMIN_PROXY_PATH = https://dzc-test-1.fy.takin.cc # 邓-本地
# VITE_ADMIN_PROXY_PATH = http://59.202.170.152:81/api # 正式环境线上
# 图片访问基础地址
# VITE_IMAGE_BASE_PATH = http://123.157.250.162:8089/api/ # 测试线上
# VITE_IMAGE_BASE_PATH = http://123.156.230.15:8089/api/ # 测试线上-过期
# VITE_IMAGE_BASE_PATH = http://localhost:9999
# VITE_IMAGE_BASE_PATH = http://192.168.101.196:9999 # 邓-本地
VITE_IMAGE_BASE_PATH = http://59.202.170.152:81/api/ # 正式环境线上
VITE_IMAGE_BASE_PATH = https://dzc-test-1.fy.takin.cc # 邓-本地
# VITE_IMAGE_BASE_PATH = http://59.202.170.152:81/api/ # 正式环境线上
# 代码生成服务地址
VITE_GEN_PROXY_PATH = http://192.168.110.156:5003
+7 -10
View File
@@ -1,6 +1,7 @@
<template>
<el-dialog :title="form.id ? '编辑' : '新增'" v-model="visible" :close-on-click-modal="false" draggable>
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px"
v-loading="loading">
<el-row :gutter="24">
<el-col :span="14" class="mb20">
<el-form-item label="分类名称" prop="name">
@@ -10,7 +11,8 @@
<el-col :span="14" class="mb20">
<el-form-item label="餐段类型" prop="categoryType">
<el-select v-model="form.categoryType" placeholder="请选择餐段类型" multiple>
<el-option :value="item.value" :label="item.label" v-for="(item, index) in daily_menu" :key="index"></el-option>
<el-option :value="item.value" :label="item.label" v-for="(item, index) in daily_menu"
:key="index"></el-option>
</el-select>
</el-form-item>
</el-col>
@@ -28,13 +30,8 @@
<el-col :span="14" class="mb20">
<el-form-item label="是否涨价" prop="isPriceIncreased">
<el-switch
v-model="form.isPriceIncreased"
:active-value="true"
:inactive-value="false"
active-text="是"
inactive-text="否"
/>
<el-switch v-model="form.isPriceIncreased" :active-value="true" :inactive-value="false"
active-text="是" inactive-text="否" />
</el-form-item>
</el-col>
@@ -111,7 +108,7 @@ const openDialog = (id: string) => {
// 提交
const onSubmit = async () => {
const valid = await dataFormRef.value.validate().catch(() => {})
const valid = await dataFormRef.value.validate().catch(() => { })
if (!valid) return false
try {
+22 -46
View File
@@ -7,51 +7,30 @@
<el-input placeholder="请输入分类名称" v-model="state.queryForm.name" />
</el-form-item>
<el-form-item>
<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-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
v-model:showSearch="showSearch"
:export="'canteen_canteenCategory_export'"
@exportExcel="exportExcel"
class="ml10 mr20"
style="float: right"
@queryTable="getDataList"
/>
<right-toolbar v-model:showSearch="showSearch" :export="'canteen_canteenCategory_export'"
@exportExcel="exportExcel" class="ml10 mr20" style="float: right" @queryTable="getDataList" />
</div>
</el-row>
<el-table
:data="state.dataList"
v-loading="state.loading"
border
:cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle"
@selection-change="selectionChangHandle"
@sort-change="sortChangeHandle"
>
<el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle" @selection-change="selectionChangHandle"
@sort-change="sortChangeHandle">
<el-table-column type="selection" width="40" align="center" />
<el-table-column type="index" label="#" width="50" />
<el-table-column prop="name" label="分类名称" show-overflow-tooltip min-width="100" />
@@ -78,22 +57,19 @@
<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 icon="delete" text type="primary" v-auth="'canteen_canteenCategory_del'"
@click="handleDelete([scope.row.id])">
删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle"
v-bind="state.pagination" />
</div>
<!-- 编辑、新增 -->
@@ -142,10 +118,10 @@ const exportExcel = () => {
downBlobFile("/canteen/canteenCategory/export", Object.assign(state.queryForm, { ids: selectObjs }), "每日菜品分类.xlsx")
}
// 兼容后端可能返回 true/false 或 1/0
// 兼容后端可能返回 true/false 或 1/0
const formatYesNo = (value: any) => {
return value === true || value === 1 || value === "1" ? "是" : "否"
}
return value === true || value === 1 || value === "1" ? "是" : "否"
}
// 多选事件
const selectionChangHandle = (objs: { id: string }[]) => {
+14 -4
View File
@@ -1,6 +1,7 @@
<template>
<el-dialog :title="form.id ? '编辑' : '新增'" v-model="visible" :close-on-click-modal="false" draggable>
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="140px" v-loading="loading">
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="140px"
v-loading="loading">
<el-row :gutter="24">
<!-- <el-col :span="14" class="mb20">-->
<!-- <el-form-item label="商户" prop="merchantId">-->
@@ -32,7 +33,8 @@
<el-col :span="14" class="mb20">
<el-form-item label="菜品状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio :label="item.value" v-for="(item, index) in spu_status" border :key="index">{{ item.label }}</el-radio>
<el-radio :label="item.value" v-for="(item, index) in spu_status" border :key="index">{{
item.label }}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
@@ -51,10 +53,17 @@
<el-col :span="12" class="mb20">
<el-form-item label="是否在移动端显示" prop="status">
<el-radio-group v-model="form.isShow">
<el-radio :label="item.value" v-for="(item, index) in is_show" border :key="index">{{ item.label }} </el-radio>
<el-radio :label="item.value" v-for="(item, index) in is_show" border :key="index">{{
item.label }} </el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="14" class="mb20">
<el-form-item label="是否涨价" prop="isPriceIncreased">
<el-switch v-model="form.isPriceIncreased" :active-value="'1'" :inactive-value="'0'"
active-text="是" inactive-text="否" />
</el-form-item>
</el-col>
<!-- <el-col :span="14" class="mb20">-->
<!-- <el-form-item label="库存" prop="stock">-->
<!-- <el-input-number v-model="form.stock" :min="0" :precision="0" />-->
@@ -127,6 +136,7 @@ const form = reactive({
browseCount: "",
deptId: "",
isShow: "0",
isPriceIncreased: '0',
})
// 定义校验规则
@@ -172,7 +182,7 @@ const openDialog = async (id: string) => {
// 提交
const onSubmit = async () => {
const valid = await dataFormRef?.value.validate().catch(() => {})
const valid = await dataFormRef?.value.validate().catch(() => { })
if (!valid) return false
try {
+30 -39
View File
@@ -9,52 +9,41 @@
<el-form-item label="菜品分类" prop="categoryId">
<select-ctcg v-model="state.queryForm.categoryId" style="width: 200px" />
</el-form-item>
<el-form-item label="是否涨价" prop="isPriceIncreased">
<dict-select v-model="state.queryForm.isPriceIncreased" dict-code="yes_no_type"
style="width: 200px" />
</el-form-item>
<el-form-item>
<el-button icon="search" type="primary" @click="getDataList" v-auth="'canteen_canteenSpu_view'"> 查询 </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>
<el-row>
<div class="mb8" style="width: 100%">
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()" v-auth="'canteen_canteenSpu_add'">
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()"
v-auth="'canteen_canteenSpu_add'">
新 增
</el-button>
<el-button
plain
:disabled="multiple"
icon="Delete"
type="primary"
v-auth="'canteen_canteenSpu_del'"
@click="handleDelete(selectObjs)"
>
<el-button plain :disabled="multiple" icon="Delete" type="primary" v-auth="'canteen_canteenSpu_del'"
@click="handleDelete(selectObjs)">
删 除
</el-button>
<right-toolbar
v-model:showSearch="showSearch"
:export="'canteen_canteenSpu_export'"
@exportExcel="exportExcel"
class="ml10 mr20"
style="float: right"
@queryTable="getDataList"
></right-toolbar>
<right-toolbar v-model:showSearch="showSearch" :export="'canteen_canteenSpu_export'"
@exportExcel="exportExcel" class="ml10 mr20" style="float: right"
@queryTable="getDataList"></right-toolbar>
</div>
</el-row>
<el-table
:data="state.dataList"
v-loading="state.loading"
border
:cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle"
@selection-change="selectionChangHandle"
@sort-change="sortChangeHandle"
>
<el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle" @selection-change="selectionChangHandle"
@sort-change="sortChangeHandle">
<el-table-column type="selection" width="40" align="center" />
<el-table-column type="index" label="#" width="50" />
<el-table-column prop="name" label="菜品名称" width="120px" show-overflow-tooltip />
<el-table-column prop="categoryId" label="菜品分类" width="100px" show-overflow-tooltip>
<template #default="{ row }">
{{ categoryOptions?.find((item: any) => item?.id === row?.categoryId)?.name }}
{{categoryOptions?.find((item: any) => item?.id === row?.categoryId)?.name}}
</template>
</el-table-column>
<el-table-column prop="picUrl" label="菜品封面图" align="center" width="160px" show-overflow-tooltip>
@@ -69,11 +58,16 @@
<dict-tag :options="spu_status" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column prop="isShow" label="是否在移动端显示" show-overflow-tooltip>
<el-table-column prop="isShow" width="150px" label="是否在移动端显示" show-overflow-tooltip>
<template #default="scope">
<dict-tag :options="is_show" :value="scope.row.isShow"></dict-tag>
</template>
</el-table-column>
<el-table-column prop="isShow" width="100px" label="是否涨价" show-overflow-tooltip>
<template #default="{ row }">
<dict-tag :options="yes_no_type" :value="row.isPriceIncreased"></dict-tag>
</template>
</el-table-column>
<el-table-column prop="price" label="菜品价格" show-overflow-tooltip>
<template #default="scope">
{{ displayPrice(scope.row.price) }}
@@ -92,22 +86,19 @@
<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_canteenSpu_edit'"
@click="formDialogRef?.openDialog(scope.row.id)"
>
<el-button icon="edit-pen" text type="primary" v-auth="'canteen_canteenSpu_edit'"
@click="formDialogRef?.openDialog(scope.row.id)">
编辑
</el-button>
<el-button icon="delete" text type="primary" v-auth="'canteen_canteenSpu_del'" @click="handleDelete([scope.row.id])">
<el-button icon="delete" text type="primary" v-auth="'canteen_canteenSpu_del'"
@click="handleDelete([scope.row.id])">
删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle"
v-bind="state.pagination" />
</div>
<!-- 编辑、新增 -->
@@ -126,7 +117,7 @@ import { getAllSimple as getCanteenCategory } from "/@/api/canteen/canteenCatego
// 引入组件
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
const { spu_status, is_show } = useDict("spu_status", "is_show")
const { spu_status, is_show, yes_no_type } = useDict("spu_status", "is_show", "yes_no_type")
// 定义变量内容
const formDialogRef = ref()
// 搜索变量