张田田 3 ماه پیش
والد
کامیت
91521daf58
2فایلهای تغییر یافته به همراه9 افزوده شده و 51 حذف شده
  1. 8 50
      src/components/EditSupplier.vue
  2. 1 1
      src/order/DispatchOrderPanel.vue

+ 8 - 50
src/components/EditSupplier.vue

@@ -147,7 +147,6 @@ function findLabel(nodes: any[], id: string | number): string {
   return '';
 }
 
-// 收集整棵树的所有节点 key,用于一次性展开整个下拉树
 function collectAllKeys(nodes: any[]): string[] {
   const keys: string[] = [];
   const stack = [...nodes];
@@ -249,10 +248,8 @@ const handleTimeRangeChange = (day: string, timeRange: [Dayjs, Dayjs] | null) =>
   });
 };
 
-// 为每个日期创建响应式的时间范围值
 const timeRangeValues = ref<Record<string, [Dayjs, Dayjs] | null>>({});
 
-// 初始化所有日期的时间范围值
 function initTimeRangeValues() {
   days.forEach(day => {
     if (!(day in timeRangeValues.value)) {
@@ -261,13 +258,11 @@ function initTimeRangeValues() {
   });
 }
 
-// 初始化时间范围值
 watch(() => model.value.businessHours, (newVal) => {
   if (newVal) {
     days.forEach(day => {
       const dayData = newVal[day];
       if (dayData?.enabled) {
-        // 如果日期已启用,设置时间范围值
         if (dayData?.start && dayData?.end) {
           try {
             timeRangeValues.value[day] = [dayjs(dayData.start, 'HH:mm'), dayjs(dayData.end, 'HH:mm')];
@@ -275,11 +270,9 @@ watch(() => model.value.businessHours, (newVal) => {
             timeRangeValues.value[day] = [dayjs('08:00', 'HH:mm'), dayjs('20:00', 'HH:mm')];
           }
         } else {
-          // 如果已启用但没有时间,使用默认值
           timeRangeValues.value[day] = [dayjs('08:00', 'HH:mm'), dayjs('20:00', 'HH:mm')];
         }
       } else {
-        // 如果未启用,也初始化默认值,以便组件能正常显示
         if (!timeRangeValues.value[day]) {
           timeRangeValues.value[day] = [dayjs('08:00', 'HH:mm'), dayjs('20:00', 'HH:mm')];
         }
@@ -296,23 +289,6 @@ initTimeRangeValues();
 
 const formRef = ref<any>(null);
 
-// 验证至少选择一个项目类型(实体商品、线下服务、线上权益)
-// function validateAtLeastOneProjectType() {
-//   const onlineCPTypes = formProps.data?.onlineCPTypes;
-//   const offlineCPTypes = formProps.data?.offlineCPTypes;
-//   const outlineCPTypes = formProps.data?.outlineCPTypes;
-//   const hasOnline = onlineCPTypes && Array.isArray(onlineCPTypes) && onlineCPTypes.length > 0;
-//   const hasOffline = offlineCPTypes && Array.isArray(offlineCPTypes) && offlineCPTypes.length > 0;
-//   const hasOutline = outlineCPTypes && Array.isArray(outlineCPTypes) && outlineCPTypes.length > 0;
-
-//   if (!hasOnline && !hasOffline && !hasOutline) {
-//     // throw new Error('实体商品、线下服务、线上权益至少选择一项');
-//     notification.warning({
-//       message: '实体商品、线下服务、线上权益至少选择一项',
-//     });
-//   }
-// }
-
 // 基础表单项(不包含营业时间)
 const baseFormItems = [
   {
@@ -436,15 +412,6 @@ const baseFormItems = [
     span: 24,
     itemRender: { name: 'VxeInput', props: { placeholder: '请输入', type: 'number', min: 0, max: 100 } },
   },
-  // 营业时间
-  // {
-  //   field: 'businessTime',
-  //   title: '营业时间',
-  //   span: 24,
-  //   slots: {
-  //     default: 'businessHours',
-  //   },
-  // },
   // 营业状态 单选,营业、休息、停业
   {
     field: 'businessStatus',
@@ -459,9 +426,10 @@ const baseFormItems = [
 // 营业时间字段
 const businessHoursField = {
   field: 'businessTime',
-  title: '*营业时间',
+  title: '营业时间',
   span: 24,
   slots: {
+    title: 'businessTimeTitle',
     default: 'businessHours',
   },
 } as const;
@@ -585,12 +553,12 @@ watch(() => formProps.data?.offlineCPTypes, (newVal) => {
   const newHasValue = !!(newVal && Array.isArray(newVal) && newVal.length > 0);
   const oldHasValue = !!(prevOfflineCPTypes.value && Array.isArray(prevOfflineCPTypes.value) && prevOfflineCPTypes.value.length > 0);
 
-  // 检测从有值变为空
+
   if (oldHasValue && !newHasValue) {
     wasCleared = true;
   }
 
-  // 检测从空变为有值(清除后再次选择)
+
   if (wasCleared && !oldHasValue && newHasValue) {
     resetBusinessHours();
     wasCleared = false;
@@ -600,19 +568,6 @@ watch(() => formProps.data?.offlineCPTypes, (newVal) => {
   updateFormItems();
 }, { deep: true });
 
-function handleSelect(value: string, node: any, extra: any) {
-  const get = (children?: any[]) => {
-    if (!Array.isArray(children)) return;
-    children.forEach(child => {
-      if (!model.value.collaborateDepts.find((item: any) => item.value === child.value)) {
-        model.value.collaborateDepts.push(child)
-      }
-      get(child.children)
-    })
-  }
-  get(node.children)
-}
-
 const formEmits: VxeFormListeners<FormModel> = {
   submit({ data }) {
     // 验证至少选择一个项目类型
@@ -725,7 +680,7 @@ onBeforeMount(async () => {
   await getOfflineCPList();
   // 初始化线下服务的前一个值
   prevOfflineCPTypes.value = formProps.data?.offlineCPTypes ? [...formProps.data.offlineCPTypes] : undefined;
-  // 初始化表单
+  // 初始化表单
   updateFormItems();
 });
 </script>
@@ -740,6 +695,9 @@ onBeforeMount(async () => {
           :dropdownMatchSelectWidth="false" :dropdownStyle="{ zIndex: 4000 }" placeholder="请选择" @change="onDeptChange"
           @dropdownVisibleChange="onVisibleChange" />
       </template>
+      <template #businessTimeTitle>
+        <span style="color: #ff4d4f">*</span>营业时间
+      </template>
       <template #businessHours>
         <div class="business-hours-container">
           <div class="business-hours-header">

+ 1 - 1
src/order/DispatchOrderPanel.vue

@@ -437,7 +437,7 @@ async function loadInstitutionList() {
         } else if (!selectedOrder.arrangeDate) {
           message.error('请先选择日期');
         } else if (!selectedOrder.arrangeTime) {
-          message.error('请先选择时间111');
+          message.error('请先选择时间');
         }
         return;
       }