Merge remote-tracking branch 'origin/master'
# Conflicts: # src/views/supermarketerp/supermarketSpu/components/package-unit.vue
This commit is contained in:
commit
afb18fcd6d
5 files changed
+200
-739
No files matched your search
@@ -1,193 +1,81 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-view">
|
||||
<div
|
||||
ref="containerRef"
|
||||
class="border-flow-container relative flex h-screen w-full flex-col overflow-hidden bg-gradient-to-br from-[#1a2942] to-[#121e2d] p-4"
|
||||
>
|
||||
<!-- 背景装饰 -->
|
||||
<div class="pointer-events-none absolute inset-0 bg-pattern opacity-10"></div>
|
||||
<div ref="containerRef" class="relative h-full w-full overflow-y-auto bg-gradient-to-br from-[#232e55] to-[#040a1b] p-2">
|
||||
<!-- 背景圆点 -->
|
||||
<div class="pointer-events-none absolute inset-0 pattern-dots opacity-[0.08]"></div>
|
||||
|
||||
<!-- 圆形云纹装饰 -->
|
||||
<div class="ink-cloud absolute left-4 top-4 h-64 w-64 opacity-20"></div>
|
||||
<!-- 背景外侧环形 -->
|
||||
<div class="ink-cloud absolute left-4 top-4 h-64 w-64 rotate-0 opacity-20"></div>
|
||||
<div class="ink-cloud absolute right-4 top-4 h-64 w-64 rotate-90 opacity-20"></div>
|
||||
<div class="ink-cloud absolute bottom-4 left-4 h-64 w-64 -rotate-90 opacity-20"></div>
|
||||
<div class="ink-cloud absolute bottom-4 right-4 h-64 w-64 rotate-180 opacity-20"></div>
|
||||
|
||||
<!-- 随机位置云纹装饰 -->
|
||||
<!-- 背景中间环形 -->
|
||||
<div class="ink-cloud absolute left-[30%] top-[20%] h-48 w-48 opacity-15 rotate-45"></div>
|
||||
<div class="ink-cloud absolute right-[25%] top-[40%] h-40 w-40 opacity-15 rotate-[120deg]"></div>
|
||||
<div class="ink-cloud absolute left-[45%] bottom-[30%] h-56 w-56 opacity-15 rotate-[220deg]"></div>
|
||||
<div class="ink-cloud absolute right-[40%] bottom-[15%] h-44 w-44 opacity-15 rotate-[300deg]"></div>
|
||||
|
||||
<!-- 顶部区域 -->
|
||||
<div class="relative mb-2 flex items-center justify-center">
|
||||
<!-- 左侧条纹 -->
|
||||
<div class="continuous-flow-stripe absolute left-0 flex h-2 w-[calc(50%-8rem)] items-center">
|
||||
<div class="h-full w-full rounded-full bg-gradient-to-r from-transparent via-[#F7D6C3]/30 to-transparent"></div>
|
||||
<div class="h-8 relative mx-4 flex items-center justify-between">
|
||||
<div class="flex items-center">
|
||||
<h1 class="text-4xl text-[#b0bfff] font-bold tracking-wider">今日午餐菜品</h1>
|
||||
<div class="text-xl text-blue-400 drop-shadow-lg ml-5">{{ currentDate }} {{ currentTime }}</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col items-center">
|
||||
<h1 class="gradient-text relative text-2xl font-bold tracking-wider">今日午餐菜品</h1>
|
||||
<div class="flow-text mt-2 text-lg font-medium text-[#8ab4ff] drop-shadow-lg">{{ currentDate }} {{ currentTime }}</div>
|
||||
</div>
|
||||
|
||||
<!-- 右侧条纹 -->
|
||||
<div class="continuous-flow-stripe absolute right-0 flex h-2 w-[calc(50%-8rem)] items-center">
|
||||
<div class="h-full w-full rounded-full bg-gradient-to-r from-transparent via-[#F7D6C3]/30 to-transparent"></div>
|
||||
</div>
|
||||
|
||||
<!-- 全屏按钮和滚动控制按钮 -->
|
||||
<div class="absolute right-0 flex items-center gap-2">
|
||||
<el-tooltip v-if="needScroll" :content="isScrolling ? '暂停滚动' : '开始滚动'" placement="bottom" effect="dark">
|
||||
<button
|
||||
@click="toggleScroll"
|
||||
class="flex h-8 w-8 items-center justify-center rounded-xl bg-[#F7D6C3]/20 transition-all hover:scale-110 hover:bg-[#F7D6C3]/40"
|
||||
>
|
||||
<el-icon class="h-10 w-10 font-bold">
|
||||
<component :is="isScrolling ? 'VideoPause' : 'VideoPlay'" />
|
||||
</el-icon>
|
||||
</button>
|
||||
</el-tooltip>
|
||||
|
||||
<el-tooltip :content="isFullscreen ? '退出全屏' : '全屏'" placement="bottom" effect="dark">
|
||||
<button
|
||||
@click="toggleFullScreen"
|
||||
class="flex h-8 w-8 items-center justify-center rounded-xl bg-[#F7D6C3]/20 transition-all hover:scale-110 hover:bg-[#F7D6C3]/40"
|
||||
>
|
||||
<el-icon class="icon h-10 w-10 font-bold bg-contain bg-center bg-no-repeat"><FullScreen /></el-icon>
|
||||
</button>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<!-- 全屏按钮 -->
|
||||
<el-tooltip :content="isFullscreen ? '退出全屏' : '全屏'" placement="left" effect="dark">
|
||||
<button
|
||||
@click="toggleFullScreen"
|
||||
class="flex h-8 w-8 items-center justify-center rounded-xl bg-[#F7D6C3]/20 transition-all hover:scale-110 hover:bg-[#F7D6C3]/40"
|
||||
>
|
||||
<el-icon class="icon h-10 w-10 font-bold bg-contain bg-center bg-no-repeat"><FullScreen /></el-icon>
|
||||
</button>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
|
||||
<!-- 菜品展示区域 -->
|
||||
<div class="flex-1 px-4" :style="containerStyle">
|
||||
<div class="scroll-wrapper" ref="scrollContainerRef">
|
||||
<div class="scroll-content" :style="{ transform: `translateY(${-scrollOffset}px)` }">
|
||||
<div class="grid w-full gap-3" :style="gridStyle">
|
||||
<template v-for="hourType in foodData" :key="hourType">
|
||||
<div
|
||||
v-for="dish in hourType"
|
||||
:key="dish.id"
|
||||
class="group relative flex flex-col overflow-hidden rounded-xl border border-[#F7D6C3]/10 bg-[#1d2b45]/60 transition-all duration-500 hover:scale-[1.02] hover:-translate-y-1 hover:bg-[#1d2b45]/80 hover:shadow-[0_0_20px_rgba(74,136,255,0.1)]"
|
||||
>
|
||||
<div class="relative h-32 overflow-hidden">
|
||||
<div class="absolute inset-0 bg-gradient-to-b from-transparent"></div>
|
||||
<img
|
||||
:src="imageBaseUrl + dish.picUrl"
|
||||
:alt="dish.name"
|
||||
class="h-full w-full object-cover transition-transform duration-500 group-hover:scale-110"
|
||||
/>
|
||||
<div class="absolute left-2 top-2 rounded-lg">
|
||||
<!-- <dict-tag
|
||||
:options="daily_menu"
|
||||
:value="canteenCategoryOption?.find((v: any) => v.id == dish.categoryId)?.categoryType?.split(',')"
|
||||
/> -->
|
||||
<el-tag type="primary">午餐</el-tag>
|
||||
</div>
|
||||
<div class="absolute right-1 top-2 rounded-lg px-2 py-0.5 text-sm">
|
||||
<el-tag type="primary">
|
||||
{{ canteenCategoryOption?.find((v: any) => v.id == dish.categoryId)?.name }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col justify-between gap-1 bg-[#1d2b45]/40 p-3 backdrop-blur-sm">
|
||||
<div class="flex items-center justify-between">
|
||||
<h3 class="text-2xl font-bold text-[#8ab4ff] drop-shadow-lg transition-colors group-hover:text-white line-clamp-1">
|
||||
{{ dish.name }}
|
||||
</h3>
|
||||
<p class="text-3xl font-bold text-[#4a88ff] drop-shadow-lg whitespace-nowrap ml-4">
|
||||
¥{{ displayPrice(dish.price) }}
|
||||
</p>
|
||||
</div>
|
||||
<!-- <span class="text-base text-[#8ab4ff]/80 line-clamp-1">{{ dish.name }}</span> -->
|
||||
</div>
|
||||
<div class="absolute inset-px rounded-xl border border-[#F7D6C3]/10 pointer-events-none"></div>
|
||||
</div>
|
||||
</template>
|
||||
<div class="w-full">
|
||||
<div class="w-full flex flex-wrap items-center justify-center" v-for="(hourType, index) in foodData" :key="index">
|
||||
<div v-for="dish in hourType" :key="dish.id" class="w-60 p-2">
|
||||
<div class="h-32 overflow-hidden">
|
||||
<!-- <div class="absolute inset-0 bg-gradient-to-b from-transparent"></div> -->
|
||||
<img :src="imageBaseUrl + dish.picUrl" :alt="dish.name" class="h-full w-full object-cover" />
|
||||
<!-- <div class="absolute left-2 top-2 rounded-lg">
|
||||
<el-tag type="primary">午餐</el-tag>
|
||||
</div> -->
|
||||
<!-- <div class="absolute right-1 top-2 rounded-lg px-2 py-0.5 text-sm">
|
||||
<el-tag type="primary">
|
||||
{{ canteenCategoryOption?.find((v: any) => v.id == dish.categoryId)?.name }}
|
||||
</el-tag>
|
||||
</div> -->
|
||||
</div>
|
||||
<!-- 只在需要滚动时显示克隆内容 -->
|
||||
<div v-if="needScroll" class="grid w-full gap-3" :style="gridStyle">
|
||||
<template v-for="hourType in foodData" :key="hourType + '_clone'">
|
||||
<div
|
||||
v-for="dish in hourType"
|
||||
:key="dish.id"
|
||||
class="group relative flex flex-col overflow-hidden rounded-xl border border-[#F7D6C3]/10 bg-[#1d2b45]/60 transition-all duration-500 hover:scale-[1.02] hover:-translate-y-1 hover:bg-[#1d2b45]/80 hover:shadow-[0_0_20px_rgba(74,136,255,0.1)]"
|
||||
>
|
||||
<div class="relative h-32 overflow-hidden">
|
||||
<div class="absolute inset-0 bg-gradient-to-b from-transparent"></div>
|
||||
<img
|
||||
:src="imageBaseUrl + dish.picUrl"
|
||||
:alt="dish.name"
|
||||
class="h-full w-full object-cover transition-transform duration-500 group-hover:scale-110"
|
||||
/>
|
||||
<div class="absolute left-2 top-2 rounded-lg">
|
||||
<!-- <dict-tag
|
||||
:options="daily_menu"
|
||||
:value="canteenCategoryOption?.find((v: any) => v.id == dish.categoryId)?.categoryType?.split(',')"
|
||||
/> -->
|
||||
<el-tag type="primary">午餐</el-tag>
|
||||
</div>
|
||||
<div class="absolute right-1 top-2 rounded-lg px-2 py-0.5 text-sm">
|
||||
<el-tag type="primary">
|
||||
{{ canteenCategoryOption?.find((v: any) => v.id == dish.categoryId)?.name }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col justify-between gap-1 bg-[#1d2b45]/40 p-3 backdrop-blur-sm">
|
||||
<div class="flex items-center justify-between">
|
||||
<h3 class="text-2xl font-bold text-[#8ab4ff] drop-shadow-lg transition-colors group-hover:text-white line-clamp-1">
|
||||
{{ dish.name }}
|
||||
</h3>
|
||||
<p class="text-3xl font-bold text-[#4a88ff] drop-shadow-lg whitespace-nowrap ml-4">
|
||||
¥{{ displayPrice(dish.price) }}
|
||||
</p>
|
||||
</div>
|
||||
<!-- <span class="text-base text-[#8ab4ff]/80 line-clamp-1">{{ dish.name }}</span> -->
|
||||
</div>
|
||||
<div class="absolute inset-px rounded-xl border border-[#F7D6C3]/10 pointer-events-none"></div>
|
||||
</div>
|
||||
</template>
|
||||
<div
|
||||
class="w-full flex items-center justify-between bg-[#AEBBF9]/40 px-2 pb-4 backdrop-blur-sm rounded-bl-[50%] rounded-br-[50%]"
|
||||
>
|
||||
<h3 class="text-2xl font-bold text-[#8ab4ff] drop-shadow-lg line-clamp-1 whitespace-nowrap">
|
||||
{{ dish.name }}
|
||||
</h3>
|
||||
<p class="text-3xl font-bold text-[#4a88ff] drop-shadow-lg whitespace-nowrap">¥{{ displayPrice(dish.price) }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 底部区域 -->
|
||||
<div class="mt-4 flex items-center justify-center gap-8 pb-2 text-sm text-[#8ab4ff]/60">
|
||||
<div class="h-[1px] w-32 bg-gradient-to-r from-transparent via-[#F7D6C3]/20 to-transparent"></div>
|
||||
<span>智慧食堂</span>
|
||||
<div class="h-[1px] w-32 bg-gradient-to-r from-transparent via-[#F7D6C3]/20 to-transparent"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, onUnmounted, computed, watch, nextTick } from "vue"
|
||||
import dayjs from "dayjs"
|
||||
import { ElTooltip } from "element-plus"
|
||||
import { selectTimeFoodApi } from "/@/api/canteen/canteenDailyMenu"
|
||||
import { getAllSimple as getCanteenCategory } from "/@/api/canteen/canteenCategory"
|
||||
import { displayPrice } from "/@/utils/formatMoney"
|
||||
import dayjs from "dayjs"
|
||||
|
||||
const containerRef = ref<HTMLElement | null>(null)
|
||||
const currentDate = ref(dayjs().format("YYYY年MM月DD日"))
|
||||
const currentDate = ref(dayjs().format("YYYY/MM/DD"))
|
||||
const currentTime = ref(dayjs().format("HH:mm:ss"))
|
||||
const isFullscreen = ref(false)
|
||||
const imageBaseUrl = import.meta.env.VITE_IMAGE_BASE_PATH
|
||||
const canteenCategoryOption = ref<
|
||||
| {
|
||||
id: string
|
||||
categoryType: string
|
||||
name: string
|
||||
[key: string]: any
|
||||
}[]
|
||||
| null
|
||||
>()
|
||||
|
||||
interface FoodItem {
|
||||
categoryId: string
|
||||
@@ -207,37 +95,110 @@ const foodData = reactive<{
|
||||
lunch: [],
|
||||
dinner: [],
|
||||
})
|
||||
const canteenCategoryOption = ref<any>()
|
||||
let timer: number
|
||||
|
||||
// 根据日期和时段获取菜品
|
||||
const getDishByType = async () => {
|
||||
const result = await selectTimeFoodApi({
|
||||
time: dayjs().format("YYYY-MM-DD"),
|
||||
// time: "2025-03-14",
|
||||
// time: "2025-02-07",
|
||||
merchantId: "1887400193644199937",
|
||||
onMounted(async () => {
|
||||
timer = setInterval(() => (currentTime.value = dayjs().format("HH:mm:ss")), 1000)
|
||||
await getDishByType()
|
||||
await getCanteenDishesCategory()
|
||||
|
||||
// 监听全屏变化事件
|
||||
const handleFullscreenChange = () => {
|
||||
isFullscreen.value = !!(
|
||||
document.fullscreenElement ||
|
||||
(document as any).webkitFullscreenElement ||
|
||||
(document as any).mozFullScreenElement ||
|
||||
(document as any).msFullscreenElement
|
||||
)
|
||||
}
|
||||
|
||||
// 全屏api兼容性
|
||||
document.addEventListener("fullscreenchange", handleFullscreenChange)
|
||||
document.addEventListener("webkitfullscreenchange", handleFullscreenChange)
|
||||
document.addEventListener("mozfullscreenchange", handleFullscreenChange)
|
||||
document.addEventListener("MSFullscreenChange", handleFullscreenChange)
|
||||
|
||||
onUnmounted(() => {
|
||||
document.removeEventListener("fullscreenchange", handleFullscreenChange)
|
||||
document.removeEventListener("webkitfullscreenchange", handleFullscreenChange)
|
||||
document.removeEventListener("mozfullscreenchange", handleFullscreenChange)
|
||||
document.removeEventListener("MSFullscreenChange", handleFullscreenChange)
|
||||
})
|
||||
if (result.code == 0) {
|
||||
result.data.forEach((r: any) => {
|
||||
switch (r.hourType) {
|
||||
case 1:
|
||||
// foodData.breakfast = r.dailyMenuVOS
|
||||
break
|
||||
case 2:
|
||||
foodData.lunch = r.dailyMenuVOS.filter((v: any, index: number) => index < 12)
|
||||
break
|
||||
case 3:
|
||||
// foodData.dinner = r.dailyMenuVOS
|
||||
break
|
||||
})
|
||||
|
||||
// 全屏切换
|
||||
const toggleFullScreen = async () => {
|
||||
const element = containerRef.value
|
||||
if (!element) return
|
||||
|
||||
try {
|
||||
if (!isFullscreen.value) {
|
||||
if (element.requestFullscreen) {
|
||||
await element.requestFullscreen()
|
||||
} else if ((element as any).webkitRequestFullscreen) {
|
||||
await (element as any).webkitRequestFullscreen()
|
||||
} else if ((element as any).msRequestFullscreen) {
|
||||
await (element as any).msRequestFullscreen()
|
||||
} else if ((element as any).mozRequestFullScreen) {
|
||||
await (element as any).mozRequestFullScreen()
|
||||
}
|
||||
})
|
||||
isFullscreen.value = true
|
||||
} else {
|
||||
if (document.exitFullscreen) {
|
||||
await document.exitFullscreen()
|
||||
} else if ((document as any).webkitExitFullscreen) {
|
||||
await (document as any).webkitExitFullscreen()
|
||||
} else if ((document as any).msExitFullscreen) {
|
||||
await (document as any).msExitFullscreen()
|
||||
} else if ((document as any).mozCancelFullScreen) {
|
||||
await (document as any).mozCancelFullScreen()
|
||||
}
|
||||
isFullscreen.value = false
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("全屏切换失败:", err)
|
||||
}
|
||||
}
|
||||
|
||||
// 更新时间
|
||||
let timer: number
|
||||
const updateTime = () => {
|
||||
currentTime.value = dayjs().format("HH:mm:ss")
|
||||
// 根据日期和时段获取菜品
|
||||
const getDishByType = async () => {
|
||||
const { code, data, msg } = await selectTimeFoodApi({
|
||||
time: dayjs().format("YYYY-MM-DD"),
|
||||
merchantId: "1887400193644199937",
|
||||
})
|
||||
if (code != 0) return useMessage().error(msg || "获取菜品列表失败")
|
||||
data.forEach((r: any) => {
|
||||
switch (r.hourType) {
|
||||
case 1:
|
||||
// foodData.breakfast = r.dailyMenuVOS
|
||||
break
|
||||
case 2:
|
||||
foodData.lunch = r.dailyMenuVOS.filter((item: any) => !item.name.includes("元") && !item.name.includes("米饭"))
|
||||
break
|
||||
case 3:
|
||||
// foodData.dinner = r.dailyMenuVOS
|
||||
break
|
||||
}
|
||||
})
|
||||
}
|
||||
// 获取食堂菜品分类
|
||||
const getCanteenDishesCategory = async () => {
|
||||
try {
|
||||
const res = await getCanteenCategory()
|
||||
if (res.code === 0) {
|
||||
canteenCategoryOption.value = res.data
|
||||
}
|
||||
} catch (error) {
|
||||
canteenCategoryOption.value = []
|
||||
}
|
||||
}
|
||||
// =====================================
|
||||
import { ref, onMounted, onUnmounted, computed, watch, nextTick } from "vue"
|
||||
import { selectTimeFoodApi } from "/@/api/canteen/canteenDailyMenu"
|
||||
import { getAllSimple as getCanteenCategory } from "/@/api/canteen/canteenCategory"
|
||||
import { displayPrice } from "/@/utils/formatMoney"
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
|
||||
const scrollContainerRef = ref<HTMLElement | null>(null)
|
||||
let scrollOffset = ref(0)
|
||||
@@ -324,143 +285,6 @@ const checkNeedScroll = () => {
|
||||
return needScroll.value
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
timer = setInterval(updateTime, 1000)
|
||||
await getDishByType()
|
||||
try {
|
||||
// 获取菜品分类
|
||||
const res = await getCanteenCategory()
|
||||
if (res.code === 0) {
|
||||
canteenCategoryOption.value = res.data
|
||||
}
|
||||
} catch (error) {
|
||||
canteenCategoryOption.value = []
|
||||
}
|
||||
|
||||
// 监听全屏变化事件
|
||||
const handleFullscreenChange = () => {
|
||||
isFullscreen.value = !!(
|
||||
document.fullscreenElement ||
|
||||
(document as any).webkitFullscreenElement ||
|
||||
(document as any).mozFullScreenElement ||
|
||||
(document as any).msFullscreenElement
|
||||
)
|
||||
}
|
||||
|
||||
// 全屏api兼容性
|
||||
document.addEventListener("fullscreenchange", handleFullscreenChange)
|
||||
document.addEventListener("webkitfullscreenchange", handleFullscreenChange)
|
||||
document.addEventListener("mozfullscreenchange", handleFullscreenChange)
|
||||
document.addEventListener("MSFullscreenChange", handleFullscreenChange)
|
||||
|
||||
onUnmounted(() => {
|
||||
clearInterval(timer)
|
||||
document.removeEventListener("fullscreenchange", handleFullscreenChange)
|
||||
document.removeEventListener("webkitfullscreenchange", handleFullscreenChange)
|
||||
document.removeEventListener("mozfullscreenchange", handleFullscreenChange)
|
||||
document.removeEventListener("MSFullscreenChange", handleFullscreenChange)
|
||||
stopScroll()
|
||||
})
|
||||
|
||||
// 延迟启动滚动,等待内容加载
|
||||
setTimeout(() => {
|
||||
// 检查是否需要滚动
|
||||
if (checkNeedScroll()) {
|
||||
isScrolling.value = true
|
||||
startScroll()
|
||||
}
|
||||
}, 1000)
|
||||
|
||||
// 在内容变化时重新检查是否需要滚动
|
||||
watch(
|
||||
() => [foodData.breakfast, foodData.lunch, foodData.dinner],
|
||||
() => {
|
||||
nextTick(() => {
|
||||
checkNeedScroll()
|
||||
})
|
||||
},
|
||||
{ deep: true },
|
||||
)
|
||||
|
||||
// 在窗口大小改变时重新检查是否需要滚动
|
||||
const handleResize = debounce(() => {
|
||||
checkNeedScroll()
|
||||
}, 200)
|
||||
|
||||
window.addEventListener("resize", handleResize)
|
||||
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener("resize", handleResize)
|
||||
})
|
||||
})
|
||||
|
||||
// 全屏切换
|
||||
const toggleFullScreen = async () => {
|
||||
const element = containerRef.value
|
||||
if (!element) return
|
||||
|
||||
try {
|
||||
if (!isFullscreen.value) {
|
||||
if (element.requestFullscreen) {
|
||||
await element.requestFullscreen()
|
||||
} else if ((element as any).webkitRequestFullscreen) {
|
||||
await (element as any).webkitRequestFullscreen()
|
||||
} else if ((element as any).msRequestFullscreen) {
|
||||
await (element as any).msRequestFullscreen()
|
||||
} else if ((element as any).mozRequestFullScreen) {
|
||||
await (element as any).mozRequestFullScreen()
|
||||
}
|
||||
isFullscreen.value = true
|
||||
} else {
|
||||
if (document.exitFullscreen) {
|
||||
await document.exitFullscreen()
|
||||
} else if ((document as any).webkitExitFullscreen) {
|
||||
await (document as any).webkitExitFullscreen()
|
||||
} else if ((document as any).msExitFullscreen) {
|
||||
await (document as any).msExitFullscreen()
|
||||
} else if ((document as any).mozCancelFullScreen) {
|
||||
await (document as any).mozCancelFullScreen()
|
||||
}
|
||||
isFullscreen.value = false
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("全屏切换失败:", err)
|
||||
}
|
||||
}
|
||||
|
||||
// 计算容器和网格布局
|
||||
const containerStyle = computed(() => {
|
||||
const headerHeight = 120
|
||||
const footerHeight = 50
|
||||
const padding = 32
|
||||
const extraOffset = isFullscreen.value ? 0 : 60 // 非全屏状态下额外偏移量
|
||||
|
||||
return {
|
||||
height: `calc(100vh - ${headerHeight + footerHeight + padding + extraOffset}px)`,
|
||||
marginBottom: isFullscreen.value ? "0" : "60px", // 非全屏状态添加底部边距
|
||||
}
|
||||
})
|
||||
|
||||
const gridStyle = computed(() => {
|
||||
const totalItems = foodData.breakfast.length + foodData.lunch.length + foodData.dinner.length
|
||||
if (totalItems === 0) return {}
|
||||
|
||||
// 计算行列数
|
||||
const aspectRatio = window.innerWidth / window.innerHeight
|
||||
let columns = Math.ceil(Math.sqrt(totalItems * aspectRatio)) - 1
|
||||
let rows = Math.ceil(totalItems / columns)
|
||||
|
||||
// 占满屏幕
|
||||
while (rows * columns < totalItems) {
|
||||
columns++
|
||||
}
|
||||
|
||||
return {
|
||||
gridTemplateColumns: `repeat(${columns}, 1fr)`,
|
||||
gridTemplateRows: `repeat(${rows}, 1fr)`,
|
||||
}
|
||||
})
|
||||
|
||||
// 防抖函数
|
||||
function debounce(fn: Function, delay: number) {
|
||||
let timer: number | null = null
|
||||
@@ -474,146 +298,14 @@ function debounce(fn: Function, delay: number) {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.bg-pattern {
|
||||
background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M54.627 0l.83.828-1.415 1.415L51.8 0h2.827zM5.373 0l-.83.828L5.96 2.243 8.2 0H5.374zM48.97 0l3.657 3.657-1.414 1.414L46.143 0h2.828zM11.03 0L7.372 3.657 8.787 5.07 13.857 0H11.03zm32.284 0L49.8 6.485 48.384 7.9l-7.9-7.9h2.83zM16.686 0L10.2 6.485 11.616 7.9l7.9-7.9h-2.83zm20.97 0l9.315 9.314-1.414 1.414L34.828 0h2.83zM22.344 0L13.03 9.314l1.414 1.414L25.172 0h-2.83zM32 0l12.142 12.142-1.414 1.414L30 .828 17.272 13.556l-1.414-1.414L28 0h4zM.284 0l28 28-1.414 1.414L0 2.544V0h.284zM0 5.373l25.456 25.455-1.414 1.415L0 8.2V5.374zm0 5.656l22.627 22.627-1.414 1.414L0 13.86v-2.83zm0 5.656l19.8 19.8-1.415 1.413L0 19.514v-2.83zm0 5.657l16.97 16.97-1.414 1.415L0 25.172v-2.83zM0 28l14.142 14.142-1.414 1.414L0 30.828V28zm0 5.657L11.314 44.97 9.9 46.386l-9.9-9.9v-2.828zm0 5.657L8.485 47.8 7.07 49.212 0 42.143v-2.83zm0 5.657l5.657 5.657-1.414 1.415L0 47.8v-2.83zm0 5.657l2.828 2.83-1.414 1.413L0 53.456v-2.83zM54.627 60L30 35.373 5.373 60H8.2L30 38.2 51.8 60h2.827zm-5.656 0L30 41.03 11.03 60h2.828L30 43.858 46.142 60h2.83zm-5.656 0L30 46.686 16.686 60h2.83L30 49.515 40.485 60h2.83zm-5.657 0L30 52.343 22.344 60h2.83L30 55.172 34.828 60h2.83zM32 60l-2-2-2 2h4zM59.716 0l-28 28 1.414 1.414L60 2.544V0h-.284zM60 5.373L34.544 30.828l1.414 1.415L60 8.2V5.374zm0 5.656L37.373 33.656l1.414 1.414L60 13.86v-2.83zm0 5.656l-19.8 19.8 1.415 1.413L60 19.514v-2.83zm0 5.657l-16.97 16.97 1.414 1.415L60 25.172v-2.83zM60 28L45.858 42.142l1.414 1.414L60 30.828V28zm0 5.657L48.686 44.97l1.415 1.415 9.9-9.9v-2.828zm0 5.657L51.515 47.8l1.414 1.413 7.07-7.07v-2.83zm0 5.657l-5.657 5.657 1.414 1.415L60 47.8v-2.83zm0 5.657l-2.828 2.83 1.414 1.413L60 53.456v-2.83zM39.9 16.385l1.414-1.414L30 3.658 18.686 14.97l1.415 1.415 9.9-9.9 9.9 9.9zm-2.83 2.828l1.415-1.414L30 9.313 21.515 17.8l1.414 1.413L30 11.8l7.07 7.414v-.002zm-2.827 2.83l1.414-1.416L30 14.97l-5.657 5.657 1.414 1.415L30 17.8l4.243 4.242zm-2.83 2.827l1.415-1.414L30 20.626l-2.828 2.83 1.414 1.414L30 23.456l1.414 1.414zM56.87 59.414L58.284 58 30 29.716 1.716 58l1.414 1.414L30 32.544l26.87 26.87z' fill='%23F7D6C3' fill-opacity='0.05' fill-rule='evenodd'/%3E%3C/svg%3E");
|
||||
}
|
||||
|
||||
.pattern-dots {
|
||||
background-image: radial-gradient(#f7d6c3 1px, transparent 1px);
|
||||
background-size: calc(10 * 1px) calc(10 * 1px);
|
||||
background-image: radial-gradient(#eff4ee 1px, transparent 10px);
|
||||
background-size: 10px 10px;
|
||||
}
|
||||
|
||||
.gradient-text {
|
||||
background: linear-gradient(-45deg, #f7d6c3, #1d4ed8, #2563eb, #3b82f6);
|
||||
background-size: 200% 200%;
|
||||
-webkit-background-clip: text;
|
||||
background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
animation: gradientBG 6s ease infinite;
|
||||
}
|
||||
|
||||
.flow-text {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
|
||||
&::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: -100%;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.2) 50%, transparent 100%);
|
||||
animation: flowLight 3s infinite linear;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes flowLight {
|
||||
0% {
|
||||
left: -100%;
|
||||
}
|
||||
100% {
|
||||
left: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.continuous-flow-stripe {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
|
||||
&::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: -100%;
|
||||
width: 200%;
|
||||
height: 100%;
|
||||
background: linear-gradient(
|
||||
90deg,
|
||||
transparent 0%,
|
||||
rgba(74, 136, 255, 0.1) 20%,
|
||||
rgba(74, 136, 255, 0.3) 30%,
|
||||
rgba(74, 136, 255, 0.3) 40%,
|
||||
rgba(74, 136, 255, 0.1) 50%,
|
||||
transparent 60%
|
||||
);
|
||||
animation: continuousFlow 3s linear infinite;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes gradientBG {
|
||||
0% {
|
||||
background-position: 0% 50%;
|
||||
}
|
||||
50% {
|
||||
background-position: 100% 50%;
|
||||
}
|
||||
100% {
|
||||
background-position: 0% 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.ink-cloud {
|
||||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath fill='%23F7D6C3' d='M50,0C36.7,0,25,11.7,25,25c0,13.3,11.7,25,25,25s25-11.7,25-25C75,11.7,63.3,0,50,0z M50,40c-8.3,0-15-6.7-15-15s6.7-15,15-15s15,6.7,15,15S58.3,40,50,40z'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 50 50' to='360 50 50' dur='20s' repeatCount='indefinite'/%3E%3C/path%3E%3C/svg%3E");
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
filter: blur(2px);
|
||||
}
|
||||
|
||||
@keyframes continuousFlow {
|
||||
from {
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
to {
|
||||
transform: translateX(50%);
|
||||
}
|
||||
}
|
||||
|
||||
.border-flow-container {
|
||||
position: relative;
|
||||
|
||||
&::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: linear-gradient(90deg, #f7d6c3 50%, transparent 50%);
|
||||
background-size: 200% 100%;
|
||||
animation: borderFlow 4s linear infinite;
|
||||
mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
|
||||
mask-composite: exclude;
|
||||
padding: 1px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes borderFlow {
|
||||
0% {
|
||||
background-position: 0% 0%;
|
||||
}
|
||||
100% {
|
||||
background-position: 200% 0%;
|
||||
}
|
||||
}
|
||||
|
||||
.group {
|
||||
display: grid;
|
||||
grid-template-rows: auto 1fr;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.relative.h-32 {
|
||||
height: auto;
|
||||
aspect-ratio: 16/9;
|
||||
}
|
||||
|
||||
.scroll-wrapper {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.scroll-content {
|
||||
will-change: transform;
|
||||
}
|
||||
</style>
|
||||
@@ -1,111 +0,0 @@
|
||||
<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-row :gutter="24">
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="商品SPU ID" prop="spuId">
|
||||
<el-input v-model="form.spuId" placeholder="请输入商品SPU ID"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="口味名称" prop="taste">
|
||||
<el-input v-model="form.taste" placeholder="请输入口味名称"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="该口味的库存数量" prop="stock">
|
||||
<el-input v-model="form.stock" placeholder="请输入该口味的库存数量"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="SmErpTasteStockDialog">
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { useMessage } from "/@/hooks/message";
|
||||
import { getObj, addObj, putObj } from '/@/api/supermarketerp/smErpTasteStock'
|
||||
import { rule } from '/@/utils/validate';
|
||||
const emit = defineEmits(['refresh']);
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
// 定义字典
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id:'',
|
||||
spuId: '',
|
||||
taste: '',
|
||||
stock: '',
|
||||
});
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
visible.value = true
|
||||
form.id = ''
|
||||
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields();
|
||||
});
|
||||
|
||||
// 获取smErpTasteStock信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
getsmErpTasteStockData(id)
|
||||
}
|
||||
};
|
||||
|
||||
// 提交
|
||||
const onSubmit = async () => {
|
||||
const valid = await dataFormRef.value.validate().catch(() => {});
|
||||
if (!valid) return false;
|
||||
|
||||
try {
|
||||
loading.value = true;
|
||||
form.id ? await putObj(form) : await addObj(form);
|
||||
useMessage().success(form.id ? '修改成功' : '添加成功');
|
||||
visible.value = false;
|
||||
emit('refresh');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 初始化表单数据
|
||||
const getsmErpTasteStockData = (id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
getObj(id).then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
};
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
||||
@@ -1,115 +0,0 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()"
|
||||
v-auth="'supermarket_smErpTasteStock_add'">
|
||||
新 增
|
||||
</el-button>
|
||||
<el-button plain :disabled="multiple" icon="Delete" type="primary"
|
||||
v-auth="'supermarket_smErpTasteStock_del'" @click="handleDelete(selectObjs)">
|
||||
删除
|
||||
</el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" :export="'supermarket_smErpTasteStock_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-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="40" />
|
||||
<el-table-column prop="spuId" label="商品SPU ID" show-overflow-tooltip/>
|
||||
<el-table-column prop="taste" label="口味名称" show-overflow-tooltip/>
|
||||
<el-table-column prop="stock" label="该口味的库存数量" show-overflow-tooltip/>
|
||||
<el-table-column label="操作" width="150">
|
||||
<template #default="scope">
|
||||
<el-button icon="edit-pen" text type="primary" v-auth="'supermarket_smErpTasteStock_edit'"
|
||||
@click="formDialogRef.openDialog(scope.row.id)">编辑</el-button>
|
||||
<el-button icon="delete" text type="primary" v-auth="'supermarket_smErpTasteStock_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" />
|
||||
</div>
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="systemSmErpTasteStock">
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { fetchList, delObjs } from "/@/api/supermarketerp/smErpTasteStock";
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
// 定义查询字典
|
||||
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
// 搜索变量
|
||||
const queryRef = ref()
|
||||
const showSearch = 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 resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/supermarket/smErpTasteStock/export', Object.assign(state.queryForm, { ids: selectObjs }), 'smErpTasteStock.xlsx')
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||
selectObjs.value = objs.map(({ id }) => id);
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
await useMessageBox().confirm('此操作将永久删除');
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await delObjs(ids);
|
||||
getDataList();
|
||||
useMessage().success('删除成功');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -150,7 +150,6 @@ export interface rowVU {
|
||||
promotionPrice: number
|
||||
costPrice: number
|
||||
isBase?: boolean | null
|
||||
flag?: string
|
||||
tasteName?: string
|
||||
tasteId: string
|
||||
}
|
||||
@@ -208,7 +207,9 @@ const slotInputChange = (slotParams: any) => {
|
||||
$table.updateStatus(slotParams)
|
||||
}
|
||||
}
|
||||
const pushEvent = (flag?: "flag" | undefined) => {
|
||||
|
||||
// 底部新增行
|
||||
const pushEvent = () => {
|
||||
const newRow: rowVU = {
|
||||
id: "tmp_" + nanoid(5),
|
||||
barCode: "",
|
||||
@@ -224,69 +225,67 @@ const pushEvent = (flag?: "flag" | undefined) => {
|
||||
tasteId: "",
|
||||
}
|
||||
|
||||
if (flag) newRow.flag = "defaultPackageUnitRow"
|
||||
|
||||
packageUnitList.value.push(newRow)
|
||||
nextTick(() => {
|
||||
const $table = tableRef.value
|
||||
if ($table) {
|
||||
$table.setEditRow(newRow)
|
||||
}
|
||||
})
|
||||
}
|
||||
packageUnitList.value.push(newRow)
|
||||
nextTick(() => {
|
||||
const $table = tableRef.value
|
||||
if ($table) {
|
||||
$table.setEditRow(newRow)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 删除行
|
||||
const removeRow = (rowIndex: number) => {
|
||||
packageUnitList.value.splice(rowIndex, 1)
|
||||
}
|
||||
const removeRow = (rowIndex: number) => {
|
||||
packageUnitList.value.splice(rowIndex, 1)
|
||||
}
|
||||
|
||||
// 设置单选的行
|
||||
const setRadioRow = (index: number) => {
|
||||
const $table = tableRef.value
|
||||
if ($table) {
|
||||
$table.setRadioRow(packageUnitList.value[index])
|
||||
}
|
||||
}
|
||||
const setRadioRow = (index: number) => {
|
||||
const $table = tableRef.value
|
||||
if ($table) {
|
||||
$table.setRadioRow(packageUnitList.value[index])
|
||||
}
|
||||
}
|
||||
|
||||
// 获取单选的行
|
||||
const getRadioRow = () => {
|
||||
const $table = tableRef.value
|
||||
if ($table) {
|
||||
const currRadioRow = $table.getRadioRecord()
|
||||
return currRadioRow
|
||||
}
|
||||
}
|
||||
const getRadioRow = () => {
|
||||
const $table = tableRef.value
|
||||
if ($table) {
|
||||
const currRadioRow = $table.getRadioRecord()
|
||||
return currRadioRow
|
||||
}
|
||||
}
|
||||
|
||||
// 校验表格 成功返回 true 失败返回 false
|
||||
const tableValidate = async (filed?: string) => {
|
||||
const $table = tableRef.value
|
||||
if ($table) {
|
||||
if (filed) {
|
||||
const errMap = await $table.validateField(packageUnitList.value, filed)
|
||||
if (errMap) {
|
||||
console.log("字段校验失败!", errMap)
|
||||
return false
|
||||
} else {
|
||||
console.log("字段校验成功!")
|
||||
return true
|
||||
}
|
||||
} else {
|
||||
const errMap = await $table.validate(true)
|
||||
if (errMap) {
|
||||
console.log("全量校验失败!", errMap)
|
||||
return false
|
||||
} else {
|
||||
console.log("全量校验成功!")
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const tableValidate = async (filed?: string) => {
|
||||
const $table = tableRef.value
|
||||
if ($table) {
|
||||
if (filed) {
|
||||
const errMap = await $table.validateField(packageUnitList.value, filed)
|
||||
if (errMap) {
|
||||
console.log("字段校验失败!", errMap)
|
||||
return false
|
||||
} else {
|
||||
console.log("字段校验成功!")
|
||||
return true
|
||||
}
|
||||
} else {
|
||||
const errMap = await $table.validate(true)
|
||||
if (errMap) {
|
||||
console.log("全量校验失败!", errMap)
|
||||
return false
|
||||
} else {
|
||||
console.log("全量校验成功!")
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
tableValidate,
|
||||
setRadioRow,
|
||||
getRadioRow,
|
||||
pushEvent,
|
||||
})
|
||||
defineExpose({
|
||||
tableValidate,
|
||||
setRadioRow,
|
||||
getRadioRow,
|
||||
pushEvent,
|
||||
})
|
||||
</script>
|
||||
@@ -40,7 +40,6 @@ import { fetchList } from "/@/api/supermarketerp/smErpTasteStock"
|
||||
import { TabPaneName } from "element-plus"
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import { displayPrice, storePrice } from "/@/utils/formatMoney"
|
||||
import { nanoid } from "nanoid"
|
||||
|
||||
const emit = defineEmits(["refresh"])
|
||||
|
||||
@@ -144,11 +143,8 @@ const nextStep = () => {
|
||||
|
||||
// 默认设置一行基础包装单位
|
||||
const setDefaultPackageUnit = () => {
|
||||
if (!form.id && tabPaneActiveIndex.value == 1) {
|
||||
const isFlagRowExist = form.smErpUnitEntityList.some((item: rowVU) => item.flag === "defaultPackageUnitRow")
|
||||
if (isFlagRowExist) return
|
||||
|
||||
packageUnitRef.value.pushEvent("flag")
|
||||
if (!form.id && tabPaneActiveIndex.value == 1 && form.smErpUnitEntityList.length === 0) {
|
||||
packageUnitRef.value.pushEvent()
|
||||
packageUnitRef.value.setRadioRow(0) // 自动设置基础包装单位的radio单选行
|
||||
}
|
||||
}
|
||||
@@ -237,7 +233,7 @@ const settlePackageUnitList = () => {
|
||||
}
|
||||
if (item.id.startsWith("tmp_")) item.id = ""
|
||||
if (item.tasteId?.startsWith("tmp_")) {
|
||||
item.tasteName = form.smErpTasteStockEntityList.find((tasteItem: any) => tasteItem.id === item.tasteId).tasteName
|
||||
item.tasteName = form.smErpTasteStockEntityList.find((tasteItem: any) => tasteItem.id === item.tasteId)?.tasteName || ""
|
||||
item.tasteId = ""
|
||||
}
|
||||
// 转换金额单位
|
||||
|
||||
Reference in new issue
Block a user