|
@@ -183,8 +183,6 @@ const selectAllBusinessHours = computed({
|
|
|
return days.every(day => model.value.businessHours[day]?.enabled);
|
|
return days.every(day => model.value.businessHours[day]?.enabled);
|
|
|
},
|
|
},
|
|
|
set: (value: boolean) => {
|
|
set: (value: boolean) => {
|
|
|
- // 编辑模式下不允许修改
|
|
|
|
|
- if (isEditMode.value) return;
|
|
|
|
|
if (!model.value.businessHours) return;
|
|
if (!model.value.businessHours) return;
|
|
|
days.forEach(day => {
|
|
days.forEach(day => {
|
|
|
if (model.value.businessHours[day]) {
|
|
if (model.value.businessHours[day]) {
|
|
@@ -213,8 +211,6 @@ const selectAllBusinessHours = computed({
|
|
|
|
|
|
|
|
// 处理单个日期选择
|
|
// 处理单个日期选择
|
|
|
const handleDayToggle = (day: string) => {
|
|
const handleDayToggle = (day: string) => {
|
|
|
- // 编辑模式下不允许修改
|
|
|
|
|
- if (isEditMode.value) return;
|
|
|
|
|
if (!model.value.businessHours || !model.value.businessHours[day]) return;
|
|
if (!model.value.businessHours || !model.value.businessHours[day]) return;
|
|
|
const wasEnabled = model.value.businessHours[day].enabled;
|
|
const wasEnabled = model.value.businessHours[day].enabled;
|
|
|
model.value.businessHours[day].enabled = !wasEnabled;
|
|
model.value.businessHours[day].enabled = !wasEnabled;
|
|
@@ -241,8 +237,6 @@ const handleDayToggle = (day: string) => {
|
|
|
|
|
|
|
|
// 处理时间范围变化
|
|
// 处理时间范围变化
|
|
|
const handleTimeRangeChange = (day: string, timeRange: [Dayjs, Dayjs] | null) => {
|
|
const handleTimeRangeChange = (day: string, timeRange: [Dayjs, Dayjs] | null) => {
|
|
|
- // 编辑模式下不允许修改
|
|
|
|
|
- if (isEditMode.value) return;
|
|
|
|
|
if (!model.value.businessHours || !model.value.businessHours[day]) return;
|
|
if (!model.value.businessHours || !model.value.businessHours[day]) return;
|
|
|
if (timeRange && timeRange.length === 2) {
|
|
if (timeRange && timeRange.length === 2) {
|
|
|
model.value.businessHours[day].start = timeRange[0].format('HH:mm');
|
|
model.value.businessHours[day].start = timeRange[0].format('HH:mm');
|
|
@@ -530,11 +524,6 @@ const showBusinessHours = computed<boolean>(() => {
|
|
|
return !!(offlineCPTypes && Array.isArray(offlineCPTypes) && offlineCPTypes.length > 0);
|
|
return !!(offlineCPTypes && Array.isArray(offlineCPTypes) && offlineCPTypes.length > 0);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
-// 判断是否是编辑模式
|
|
|
|
|
-const isEditMode = computed<boolean>(() => {
|
|
|
|
|
- return !!(props.data?.id);
|
|
|
|
|
-});
|
|
|
|
|
-
|
|
|
|
|
const prevOfflineCPTypes = ref<string[] | undefined>(undefined);
|
|
const prevOfflineCPTypes = ref<string[] | undefined>(undefined);
|
|
|
let wasCleared = false;
|
|
let wasCleared = false;
|
|
|
|
|
|
|
@@ -709,16 +698,16 @@ onBeforeMount(async () => {
|
|
|
<template #businessHours>
|
|
<template #businessHours>
|
|
|
<div class="business-hours-container">
|
|
<div class="business-hours-container">
|
|
|
<div class="business-hours-header">
|
|
<div class="business-hours-header">
|
|
|
- <Checkbox v-model:checked="selectAllBusinessHours" :disabled="isEditMode">全选</Checkbox>
|
|
|
|
|
|
|
+ <Checkbox v-model:checked="selectAllBusinessHours">全选</Checkbox>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="business-hours-list">
|
|
<div class="business-hours-list">
|
|
|
<div v-for="(day, index) in days" :key="day" class="business-hours-item">
|
|
<div v-for="(day, index) in days" :key="day" class="business-hours-item">
|
|
|
- <Checkbox :checked="model.businessHours?.[day]?.enabled || false" :disabled="isEditMode" @change="() => handleDayToggle(day)">
|
|
|
|
|
|
|
+ <Checkbox :checked="model.businessHours?.[day]?.enabled || false" @change="() => handleDayToggle(day)">
|
|
|
{{ model.dayLabels?.[index] || dayLabels[index] }}
|
|
{{ model.dayLabels?.[index] || dayLabels[index] }}
|
|
|
</Checkbox>
|
|
</Checkbox>
|
|
|
<div class="time-range-wrapper">
|
|
<div class="time-range-wrapper">
|
|
|
<a-time-range-picker :value="timeRangeValues[day]" format="HH:mm"
|
|
<a-time-range-picker :value="timeRangeValues[day]" format="HH:mm"
|
|
|
- :disabled="isEditMode || !model.businessHours?.[day]?.enabled"
|
|
|
|
|
|
|
+ :disabled="!model.businessHours?.[day]?.enabled"
|
|
|
@change="(timeRange: any) => handleTimeRangeChange(day, timeRange)" style="width: 200px" />
|
|
@change="(timeRange: any) => handleTimeRangeChange(day, timeRange)" style="width: 200px" />
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|