From 0cb324779727155effffcbca13c5b11409c8211c Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期五, 07 十一月 2025 11:06:40 +0800
Subject: [PATCH] feat: 1.3.0.1

---
 src/views/EmploymentManage/components/AddOrEditEmploymentView.vue |  147 ++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 127 insertions(+), 20 deletions(-)

diff --git a/src/views/EmploymentManage/components/AddOrEditEmploymentView.vue b/src/views/EmploymentManage/components/AddOrEditEmploymentView.vue
index 8c2f0c5..86883c6 100644
--- a/src/views/EmploymentManage/components/AddOrEditEmploymentView.vue
+++ b/src/views/EmploymentManage/components/AddOrEditEmploymentView.vue
@@ -5,12 +5,12 @@
         <ProForm :model="form" ref="productFormRef" label-width="110px" :is-read="isDetail">
           <ProFormItemV2
             label="渚涘簲鍟�:"
-            prop="settlementAccess"
+            prop="supplierEnterpriseId"
             :check-rules="[{ message: '璇烽�夋嫨渚涘簲鍟�' }]"
           >
             <ProFormSelect
-              v-model="form.settlementAccess"
-              :value-enum="[]"
+              v-model="form.supplierEnterpriseId"
+              :value-enum="supplierEnterpriseSelect"
               placeholder="璇烽�夋嫨渚涘簲鍟�"
             ></ProFormSelect>
           </ProFormItemV2>
@@ -22,6 +22,25 @@
                 :check-rules="[{ message: '璇疯緭鍏ヤ换鍔″悕绉�' }]"
               >
                 <ProFormText v-model.trim="form.name" placeholder="璇疯緭鍏ヤ换鍔″悕绉�" />
+              </ProFormItemV2>
+            </ProFormColItem>
+          </ProFormCol>
+          <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>
@@ -67,12 +86,7 @@
               </ProFormItemV2>
             </ProFormColItem>
           </ProFormCol>
-          <template
-            v-if="
-              form.billingMethod === EnumBillingMethod.Hour ||
-              form.billingMethod === EnumBillingMethod.Day
-            "
-          >
+          <template v-if="form.billingMethod === EnumBillingMethod.Hour">
             <ProFormCol>
               <ProFormColItem :span="12">
                 <ProFormItemV2
@@ -116,7 +130,25 @@
               </ProFormColItem>
             </ProFormCol>
           </template>
-
+          <ProFormCol v-if="form.billingMethod === EnumBillingMethod.Piece">
+            <ProFormColItem :span="12">
+              <ProFormItemV2
+                label="鎬讳欢鏁�:"
+                prop="totalPieceQuantity"
+                :check-rules="[{ message: '璇疯緭鍏ヤ换鍔℃�讳欢鏁�' }]"
+              >
+                <ProFormInputNumber
+                  :controls="false"
+                  v-model="form.totalPieceQuantity"
+                  placeholder="璇疯緭鍏ヤ换鍔℃�讳欢鏁�"
+                  :min="0"
+                  :max="999999999999"
+                  unit="浠�"
+                  :disabled="feeCannotEdit"
+                ></ProFormInputNumber>
+              </ProFormItemV2>
+            </ProFormColItem>
+          </ProFormCol>
           <ProFormCol>
             <ProFormColItem :span="12">
               <ProFormItemV2
@@ -285,7 +317,20 @@
               <ProFormItemV2
                 label="浠诲姟鏃堕棿:"
                 prop="time"
-                :check-rules="[{ message: '璇烽�夋嫨浠诲姟鏃堕棿', type: 'array' }]"
+                :check-rules="[
+                  { message: '璇烽�夋嫨浠诲姟鏃堕棿', type: 'array' },
+                  {
+                    validator: (rule, value, callback) => {
+                      if (form.billingMethod === EnumBillingMethod.Month) {
+                        if (dayjs(form.time[1]).diff(dayjs(form.time[0]), 'month') < 1) {
+                          callback(new Error('鏈堢粨浠诲姟鏃朵换鍔℃椂闂撮渶澶т簬涓�涓湀'));
+                        }
+                        callback();
+                      }
+                      callback();
+                    },
+                  },
+                ]"
               >
                 <ProFormDatePicker
                   v-model="form.time"
@@ -321,14 +366,13 @@
             <ProFormColItem :span="12">
               <ProFormItemV2
                 label="楠屾敹鏂瑰紡:"
-                prop="checkReceiveMethod"
+                prop="checkReceiveMethods"
                 :check-rules="[{ message: '璇烽�夋嫨楠屾敹鏂瑰紡' }]"
               >
-                <ProFormRadio
-                  v-model="form.checkReceiveMethod"
+                <ProFormCheckbox
+                  v-model="form.checkReceiveMethods"
                   :value-enum="EnumTaskCheckReceiveMethodText"
-                  :button-style="false"
-                ></ProFormRadio>
+                ></ProFormCheckbox>
               </ProFormItemV2>
             </ProFormColItem>
           </ProFormCol>
@@ -399,10 +443,11 @@
 };
 defineProps<Props>();
 const route = useRoute();
+const router = useRouter();
 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');
@@ -445,9 +490,12 @@
 });
 
 const form = reactive({
+  supplierEnterpriseId: '',
   name: '',
+  needPeopleNumber: null as number,
   billingMethod: EnumBillingMethod.Day,
   serviceFee: null,
+  totalPieceQuantity: null as number,
   settlementCycle: EnumSettlementCycle.Day,
   settlementDate: null as number,
   benefits: [] as string[],
@@ -461,9 +509,13 @@
   verifyWorkHours: null as number,
   timeoutServiceFee: null as number,
   description: '',
-  checkReceiveMethod: '' as any as EnumTaskCheckReceiveMethod,
+  checkReceiveMethods: [] as any as EnumTaskCheckReceiveMethod[],
   applyTime: [] as unknown as ModelValueType,
   settlementAccess: '' as any as EnumEnterpriseWalletAccess,
+});
+
+const { settlementAccessList } = useEnterpriseWalletAccessSelect({
+  supplierEnterpriseId: computed(() => form.supplierEnterpriseId),
 });
 
 const { isLoading } = useQuery({
@@ -478,8 +530,11 @@
   },
   placeholderData: () => ({} as API.GetTaskInfoQueryResult),
   onSuccess(data) {
+    form.supplierEnterpriseId = data.supplierEnterpriseId;
     form.name = data.name;
+    form.needPeopleNumber = data.needPeopleNumber;
     form.billingMethod = data.billingMethod;
+    form.totalPieceQuantity = data.totalPieceQuantity;
     form.serviceFee = data.serviceFee;
     form.settlementCycle = data.settlementCycle;
     form.settlementDate = data.settlementDate;
@@ -509,7 +564,7 @@
     form.verifyWorkHours = data.verifyWorkHours;
     form.timeoutServiceFee = data.timeoutServiceFee;
     form.description = data.description;
-    form.checkReceiveMethod = data.checkReceiveMethod;
+    form.checkReceiveMethods = data.checkReceiveMethods;
     form.applyTime = [
       format(data.applyBeginTime, 'YYYY-MM-DD 00:00:00'),
       format(data.applyEndTime, 'YYYY-MM-DD 23:59:59'),
@@ -532,6 +587,34 @@
     name: 'TaskManageList',
   });
 }
+
+function calculateMonthInterval(startDate, endDate) {
+  const diffInDays = dayjs(endDate).diff(startDate, 'day');
+  const monthInterval = Math.ceil(diffInDays / 30);
+  return monthInterval > 15 ? Math.ceil(monthInterval / 30) : monthInterval;
+}
+
+function calculateServicesFee(
+  billingMethod: EnumBillingMethod,
+  serviceFee: number,
+  time: ModelValueType,
+  needPeopleNumber: number,
+  verifyWorkHours: number
+) {
+  const monthInterval = calculateMonthInterval(time[0], time[1]);
+  const dayInterval = dayjs(time[1]).diff(time[0], 'day');
+  switch (billingMethod) {
+    case EnumBillingMethod.Month:
+      return monthInterval * serviceFee * needPeopleNumber;
+    case EnumBillingMethod.Day:
+      return serviceFee * dayInterval * needPeopleNumber;
+    case EnumBillingMethod.Hour:
+      return serviceFee * dayInterval * needPeopleNumber * verifyWorkHours;
+    case EnumBillingMethod.Piece:
+      return serviceFee * needPeopleNumber;
+  }
+}
+
 const productFormRef = ref<FormInstance>();
 function handleConfirm() {
   if (!productFormRef.value) return;
@@ -545,9 +628,33 @@
 }
 async function submit() {
   try {
+    // const estimateServicesFee = calculateServicesFee(
+    //   form.billingMethod,
+    //   form.serviceFee,
+    //   form.time,
+    //   form.needPeopleNumber,
+    //   form.verifyWorkHours
+    // );
+    // if (estimateServicesFee > 10000) {
+    //   Message.tipMessage('鎮ㄥ綋鍓嶈处鎴蜂綑棰濅笉瓒筹紝鏆傛椂鏃犳硶鍙戝竷浠诲姟锛岃鍏呭�煎悗鎿嶄綔', {
+    //     confirmButtonText: '绔嬪嵆鍏呭��',
+    //     cancelButtonText: '鍙栨秷',
+    //     type: 'warning',
+    //     callback: (action) => {
+    //       if (action === 'confirm') {
+    //         router.push({
+    //           name: 'BalanceManageV2',
+    //         });
+    //       }
+    //     },
+    //   });
+    // }
     let params: API.SaveTaskInfoCommand = {
+      supplierEnterpriseId: form.supplierEnterpriseId,
       name: form.name,
+      needPeopleNumber: form.needPeopleNumber,
       billingMethod: form.billingMethod,
+      totalPieceQuantity: form.totalPieceQuantity,
       serviceFee: form.serviceFee,
       settlementCycle: form.settlementCycle,
       settlementDate: form.settlementDate ? form.settlementDate : 0,
@@ -569,7 +676,7 @@
       verifyWorkHours: form.verifyWorkHours,
       timeoutServiceFee: form.timeoutServiceFee,
       description: form.description,
-      checkReceiveMethod: form.checkReceiveMethod,
+      checkReceiveMethods: form.checkReceiveMethods,
       settlementAccess: form.settlementAccess,
     };
     if (isEdit) {

--
Gitblit v1.9.1