From ac98d2408e5286ed2ded68516ee495ed8a193a0e Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期五, 31 十月 2025 14:30:47 +0800
Subject: [PATCH] fix: bug

---
 src/views/EmploymentManage/components/AddOrEditEmploymentView.vue |   84 +++++++++++++++++++++++++++++++++++++++---
 1 files changed, 78 insertions(+), 6 deletions(-)

diff --git a/src/views/EmploymentManage/components/AddOrEditEmploymentView.vue b/src/views/EmploymentManage/components/AddOrEditEmploymentView.vue
index 4a8aa94..7f42f3f 100644
--- a/src/views/EmploymentManage/components/AddOrEditEmploymentView.vue
+++ b/src/views/EmploymentManage/components/AddOrEditEmploymentView.vue
@@ -3,6 +3,17 @@
     <AppContainer>
       <PageFormLayout title="鍩烘湰淇℃伅">
         <ProForm :model="form" ref="productFormRef" label-width="110px" :is-read="isDetail">
+          <ProFormItemV2
+            label="渚涘簲鍟�:"
+            prop="supplierEnterpriseId"
+            :check-rules="[{ message: '璇烽�夋嫨渚涘簲鍟�' }]"
+          >
+            <ProFormSelect
+              v-model="form.supplierEnterpriseId"
+              :value-enum="supplierEnterpriseSelect"
+              placeholder="璇烽�夋嫨渚涘簲鍟�"
+            ></ProFormSelect>
+          </ProFormItemV2>
           <ProFormCol>
             <ProFormColItem :span="12">
               <ProFormItemV2
@@ -17,6 +28,25 @@
           <ProFormCol>
             <ProFormColItem :span="12">
               <ProFormItemV2
+                label="闇�姹備汉鏁�:"
+                prop="needPeopleNumber"
+                :check-rules="[{ message: '璇疯緭鍏ラ渶姹備汉鏁�' }]"
+              >
+                <ProFormInputNumber
+                  :controls="false"
+                  v-model="form.needPeopleNumber"
+                  placeholder="璇疯緭鍏ラ渶姹備汉鏁�"
+                  :min="0"
+                  :max="999999999999"
+                  :precision="0"
+                  unit="浜�"
+                ></ProFormInputNumber>
+              </ProFormItemV2>
+            </ProFormColItem>
+          </ProFormCol>
+          <ProFormCol>
+            <ProFormColItem :span="12">
+              <ProFormItemV2
                 label="鏈嶅姟璐�:"
                 prop="billingMethod"
                 :check-rules="[
@@ -25,7 +55,7 @@
                       if (!form.billingMethod) {
                         callback(new Error('璇烽�夋嫨鏈嶅姟璐圭被鍨�'));
                       }
-                      if (!form.serviceFee) {
+                      if (!form.serviceFee && form.billingMethod !== EnumBillingMethod.Face) {
                         callback(new Error('璇疯緭鍏ユ湇鍔¤垂'));
                       }
                       callback();
@@ -38,46 +68,68 @@
                   :value-enum="EnumBillingMethodText"
                   :showExtra="true"
                   :button-style="false"
+                  :disabled="feeCannotEdit"
                 >
                   <template #extra>
                     <ProFormInputNumber
+                      v-if="form.billingMethod !== EnumBillingMethod.Face"
                       :controls="false"
                       v-model="form.serviceFee"
                       placeholder="璇疯緭鍏�"
                       :min="0"
                       :max="999999999999"
                       :unit="EnumBillingMethodUnitText[form.billingMethod]"
+                      :disabled="feeCannotEdit"
                     ></ProFormInputNumber>
                   </template>
                 </RadioWithExtra>
               </ProFormItemV2>
             </ProFormColItem>
           </ProFormCol>
-          <template v-if="form.billingMethod === EnumBillingMethod.Hour || form.billingMethod === EnumBillingMethod.Day">
+          <template
+            v-if="
+              form.billingMethod === EnumBillingMethod.Hour ||
+              form.billingMethod === EnumBillingMethod.Day
+            "
+          >
             <ProFormCol>
               <ProFormColItem :span="12">
-                <ProFormItemV2 label="鏍稿畾宸ユ椂:" prop="verifyWorkHours">
+                <ProFormItemV2
+                  label="鏍稿畾宸ユ椂:"
+                  prop="verifyWorkHours"
+                  :check-rules="[{ message: '璇疯緭鍏ユ牳瀹氬伐鏃�' }]"
+                >
+                  <span v-if="isDetail && !form.verifyWorkHours"></span>
                   <ProFormInputNumber
+                    v-else
                     :controls="false"
                     v-model="form.verifyWorkHours"
                     placeholder="璇疯緭鍏ユ牳瀹氬伐鏃�"
                     :min="0"
                     :max="999999999999"
                     unit="灏忔椂/澶�"
+                    :disabled="feeCannotEdit"
                   ></ProFormInputNumber>
                 </ProFormItemV2>
               </ProFormColItem>
             </ProFormCol>
             <ProFormCol>
               <ProFormColItem :span="12">
-                <ProFormItemV2 label="瓒呮椂鏈嶅姟璐�:" prop="timeoutServiceFee">
+                <ProFormItemV2
+                  label="瓒呮椂鏈嶅姟璐�:"
+                  prop="timeoutServiceFee"
+                  :check-rules="[{ message: '璇疯緭鍏ヨ秴鏃舵湇鍔¤垂' }]"
+                >
+                  <span v-if="isDetail && !form.timeoutServiceFee"></span>
                   <ProFormInputNumber
+                    v-else
                     :controls="false"
                     v-model="form.timeoutServiceFee"
                     placeholder="璇疯緭鍏ヨ秴鏃舵湇鍔¤垂"
                     :min="0"
                     :max="999999999999"
                     unit="鍏�/灏忔椂"
+                    :disabled="feeCannotEdit"
                   ></ProFormInputNumber>
                 </ProFormItemV2>
               </ProFormColItem>
@@ -96,6 +148,7 @@
                   :value-enum="EnumSettlementCycleText"
                   :button-style="false"
                   @change="handleSettlementCycleChange"
+                  :disabled="feeCannotEdit"
                 ></ProFormRadio>
               </ProFormItemV2>
             </ProFormColItem>
@@ -260,6 +313,7 @@
                   start-placeholder="寮�濮嬫棩鏈�"
                   end-placeholder="缁撴潫鏃ユ湡"
                   :disabled-date="disabledDate"
+                  @change="handleTimeChange"
                 ></ProFormDatePicker>
               </ProFormItemV2>
             </ProFormColItem>
@@ -367,15 +421,19 @@
 const id = route.params.id as string;
 const isEdit = !!id;
 
-const { settlementAccessList } = useEnterpriseWalletAccessSelect();
+const { supplierEnterpriseSelect } = useGetSupplierEnterpriseSelect();
 
 function disabledDate(time: Date) {
   return dayjs(time).isBefore(dayjs(), 'day');
 }
 
 function disabledapplyDate(time: Date) {
-  return dayjs(time).isBefore(form.time[0], 'day');
+  return dayjs(time).isAfter(dayjs(form.time[1]), 'day') || dayjs(time).isBefore(dayjs(), 'day');
 }
+
+const feeCannotEdit = computed(() => {
+  return dayjs().isAfter(form.time[0], 'second') && isEdit;
+});
 
 const eventContext = useGlobalEventContext();
 
@@ -406,7 +464,9 @@
 });
 
 const form = reactive({
+  supplierEnterpriseId: '',
   name: '',
+  needPeopleNumber: null as number,
   billingMethod: EnumBillingMethod.Day,
   serviceFee: null,
   settlementCycle: EnumSettlementCycle.Day,
@@ -427,6 +487,10 @@
   settlementAccess: '' as any as EnumEnterpriseWalletAccess,
 });
 
+const { settlementAccessList } = useEnterpriseWalletAccessSelect({
+  supplierEnterpriseId: computed(() => form.supplierEnterpriseId),
+});
+
 const { isLoading } = useQuery({
   queryKey: ['taskServices/getTaskInfo', id],
   queryFn: async () => {
@@ -439,7 +503,9 @@
   },
   placeholderData: () => ({} as API.GetTaskInfoQueryResult),
   onSuccess(data) {
+    form.supplierEnterpriseId = data.supplierEnterpriseId;
     form.name = data.name;
+    form.needPeopleNumber = data.needPeopleNumber;
     form.billingMethod = data.billingMethod;
     form.serviceFee = data.serviceFee;
     form.settlementCycle = data.settlementCycle;
@@ -484,6 +550,10 @@
   form.settlementDate = null as number;
 }
 
+function handleTimeChange() {
+  form.applyTime = [] as unknown as ModelValueType;
+}
+
 function handleBack() {
   closeViewPush(route, {
     name: 'TaskManageList',
@@ -503,7 +573,9 @@
 async function submit() {
   try {
     let params: API.SaveTaskInfoCommand = {
+      supplierEnterpriseId: form.supplierEnterpriseId,
       name: form.name,
+      needPeopleNumber: form.needPeopleNumber,
       billingMethod: form.billingMethod,
       serviceFee: form.serviceFee,
       settlementCycle: form.settlementCycle,

--
Gitblit v1.9.1