From 7faf1532a00bb886860ea5150cf80939b0b69f81 Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期一, 20 十月 2025 16:32:22 +0800
Subject: [PATCH] fix: bug

---
 src/views/FlexJobManage/FlexJobManage.vue |  167 ++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 140 insertions(+), 27 deletions(-)

diff --git a/src/views/FlexJobManage/FlexJobManage.vue b/src/views/FlexJobManage/FlexJobManage.vue
index 13aff9e..907e336 100644
--- a/src/views/FlexJobManage/FlexJobManage.vue
+++ b/src/views/FlexJobManage/FlexJobManage.vue
@@ -84,6 +84,7 @@
           <el-button @click="handleBatchUnSign()" type="primary">鎵归噺瑙g害</el-button>
           <el-button @click="handleSendShotMessage()" type="primary">鐭俊鍙戦��</el-button>
           <el-button @click="handleBatchSign()" type="primary">鎵归噺绛剧害</el-button>
+          <el-button @click="handleEnterpriseBatchSign()" type="primary">鎵归噺浼佷笟绛剧害</el-button>
         </template>
       </ProTableQueryFilterBar>
       <ProTableV2
@@ -99,6 +100,7 @@
       </ProTableV2>
     </AppContainer>
     <StaffInfoDialog v-bind="dialogStaffInfoProps" />
+    <StaffDetailInfoDialog v-bind="dialogStaffDetailProps" />
     <BatchImportDialog
       v-bind="dialogBatchImportProps"
       @onDownloadTemplate="handleDownloadTemplate"
@@ -133,12 +135,13 @@
 import StaffInfoDialog from './components/StaffInfoDialog.vue';
 import BatchImportDialog from './components/BatchImportDialog.vue';
 import SendShotMessageDialog from './components/SendShotMessageDialog.vue';
+import StaffDetailInfoDialog from './components/StaffDetailInfoDialog.vue';
 import SignDialog from './components/SignDialog.vue';
 import * as enterpriseEmployeeServices from '@/services/api/enterpriseEmployee';
 import { ModelValueType } from 'element-plus';
 
 defineOptions({
-  name: 'EnterpriseManageList',
+  name: 'FlexJobManageList',
 });
 
 const operationBtns = defineOperationBtns([
@@ -157,16 +160,17 @@
       name: '璇︽儏',
     },
     emits: {
-      onClick: (role) => openDialog(role, true),
+      onClick: (role: API.GetEnterpriseEmployeesQueryResultItem) =>
+        handleStaffDetailEdit({ id: role.id, tabType: 'info' }),
     },
   },
   {
     data: {
-      enCode: 'signBtn',
+      enCode: 'enterpriseSignBtn',
       name: '浼佷笟绛剧害',
     },
     emits: {
-      onClick: (role) => handleSign(role),
+      onClick: (role) => handleEnterpriseSign(role),
     },
     extraProps: {
       hide: (row: API.GetEnterpriseEmployeesQueryResultItem) =>
@@ -178,17 +182,17 @@
   },
   {
     data: {
-      enCode: 'signBtn',
+      enCode: 'inviteSignBtn',
       name: '閭�璇风绾�',
     },
     emits: {
-      onClick: (role) => handleSign(role),
+      onClick: (role) => handleInviteSign(role),
     },
     extraProps: {
       hide: (row: API.GetEnterpriseEmployeesQueryResultItem) =>
         !(
-          row.userSignContractStatus === EnumTaskUserSignContractStatus.Wait ||
-          row.userSignContractStatus === EnumTaskUserSignContractStatus.Refuse
+          row.userSignContractStatus !== EnumTaskUserSignContractStatus.Pass &&
+          row.hireStatus === EnumTaskUserHireStatus.Pass
         ),
     },
   },
@@ -208,16 +212,16 @@
         ),
     },
   },
-  {
-    data: {
-      enCode: 'delBtn',
-      name: '鍒犻櫎',
-    },
-    props: { type: 'danger' },
-    emits: {
-      onClick: (role) => handleDelete(role),
-    },
-  },
+  // {
+  //   data: {
+  //     enCode: 'delBtn',
+  //     name: '鍒犻櫎',
+  //   },
+  //   props: { type: 'danger' },
+  //   emits: {
+  //     onClick: (role) => handleDelete(role),
+  //   },
+  // },
 ]);
 
 const router = useRouter();
@@ -276,7 +280,7 @@
   {
     defaultExtraParams: {
       searchWord: '',
-      orderInput: [{ property: 'id', order: EnumPagedListOrder.Desc }],
+      orderInput: [{ property: 'createdTime', order: EnumPagedListOrder.Desc }],
       createdTime: [] as unknown as ModelValueType,
       signContractTime: [] as unknown as ModelValueType,
       hireStatus: '' as any as EnumTaskUserHireStatus,
@@ -430,6 +434,7 @@
     ids: [] as string[],
     customerId: '',
     name: '',
+    contractTemplateId: '',
   },
 });
 
@@ -452,6 +457,14 @@
 
 async function sendMessageForSign() {
   try {
+    let params: API.SendInviteElectronSignSmsCommand = {
+      ids: editShotMessageForm.ids,
+      contractTemplateId: editShotMessageForm.contractTemplateId,
+    };
+    let res = await enterpriseEmployeeServices.sendInviteElectronSignSms(params);
+    if (res) {
+      Message.successMessage('鐭俊宸插彂閫�');
+    }
   } catch (error) {}
 }
 
@@ -462,18 +475,45 @@
 const {
   dialogProps: dialogSignProps,
   handleAdd: handleSignAdd,
+  handleEdit: handleSignEdit,
   editForm: signEditForm,
 } = useFormDialog({
   onConfirm: signContract,
   defaultFormParams: {
-    url: [] as UploadUserFile[],
+    ids: [] as string[],
+    contractTemplateId: '',
   },
 });
 
-function handleSign(row: API.GetEnterpriseEmployeesQueryResultItem) {
-  handleSignAdd();
+function handleInviteSign(row: API.GetEnterpriseEmployeesQueryResultItem) {
+  if (row) {
+    handleSignEdit({
+      ids: [row.id],
+      contractTemplateId: '',
+    });
+  }
 }
 function handleBatchSign() {
+  const selectionRows = getSelectionRows();
+  if (selectionRows) {
+    const hasSigned = selectionRows?.some(
+      (x) =>
+        x.userSignContractStatus === EnumTaskUserSignContractStatus.Pass ||
+        x.enterpriseSignContractStatus === EnumTaskUserSignContractStatus.Pass ||
+        x.hireStatus === EnumTaskUserHireStatus.Wait
+    );
+    if (hasSigned) {
+      Message.warnMessage('鍕鹃�変汉鍛樹腑鍖呭惈宸茬绾﹀畬鎴愭垨鏈綍鐢ㄤ汉鍛�');
+      return;
+    }
+    handleSignAdd({
+      ids: selectionRows.map((x) => x.id),
+      contractTemplateId: '',
+    });
+  }
+}
+
+function handleEnterpriseBatchSign() {
   const selectionRows = getSelectionRows();
   if (selectionRows) {
     const hasSigned = selectionRows?.some(
@@ -484,30 +524,103 @@
         )
     );
     if (hasSigned) {
-      Message.warnMessage('鍕鹃�変汉鍛樹腑鍖呭惈宸茬绾﹀畬鎴愭垨鏈綍鐢ㄤ汉鍛�');
+      Message.warnMessage('鍕鹃�変汉鍛樹腑鍖呭惈宸蹭紒涓氱绾︺�佹湭褰曠敤浜哄憳鎴栨湭绛剧害瀹屾垚浜哄憳');
       return;
     }
-    handleSignAdd();
+    const ids = selectionRows.map((x) => x.id);
+    handleBatchEnterpriseSign(ids);
   }
+}
+
+async function handleBatchEnterpriseSign(ids: string[]) {
+  try {
+    let res = await enterpriseEmployeeServices.batchEnterpriseSignContract({ ids: ids });
+    if (res) {
+      Message.successMessage('鎿嶄綔鎴愬姛');
+      getList(paginationState.pageIndex);
+      if (res?.errors?.length > 0) {
+        Message.tipMessage('瀛樺湪绛剧害澶辫触鐨勭伒宸ヤ俊鎭暟鎹紝鏄惁瀵煎嚭锛�').then(() => {
+          XLSXUtils.exportToXLSX({
+            workbookDataList: res.errors,
+            fileName: '绛剧害澶辫触鐏靛伐淇℃伅',
+            workbookHeaderMap: {
+              name: '濮撳悕',
+              contactPhoneNumber: '鎵嬫満鍙�',
+              identity: '韬唤璇佸彿',
+              errorMessage: '閿欒淇℃伅',
+            },
+          });
+        });
+      }
+    }
+  } catch (error) {}
 }
 
 async function signContract() {
   try {
+    let params: API.InviteElectronSignCommand = {
+      ids: signEditForm.ids,
+      contractTemplateId: signEditForm.contractTemplateId,
+    };
+    let res = await enterpriseEmployeeServices.inviteElectronSign(params);
+    if (res) {
+      Message.successMessage('鎿嶄綔鎴愬姛');
+      getList(paginationState.pageIndex);
+    }
   } catch (error) {}
 }
 
-async function handleUnSign(row: API.GetEnterpriseEmployeesQueryResultItem) {
+async function handleEnterpriseSign(row: API.GetEnterpriseEmployeesQueryResultItem) {
   try {
-    await Message.tipMessage('纭畾瑙g害鐢ㄦ埛锛�');
+    let res = await enterpriseEmployeeServices.enterpriseUserElectronSign({ id: row.id });
+    if (res) {
+      window.open(res?.signContractLongUrl, '_blank');
+    }
   } catch (error) {}
+}
+
+function handleUnSign(row: API.GetEnterpriseEmployeesQueryResultItem) {
+  stopElectronSign([row.id]);
 }
 
 function handleBatchUnSign() {
   try {
-    Message.warnMessage('鍔熻兘寮�鍙戜腑');
+    const selectionRows = getSelectionRows();
+    if (selectionRows) {
+      const hasUnSigned = selectionRows?.some(
+        (x) => x.enterpriseSignContractStatus !== EnumTaskUserSignContractStatus.Pass
+      );
+      if (hasUnSigned) {
+        Message.warnMessage('鍕鹃�夋暟鎹腑鍖呭惈浼佷笟鏈绾︽垨宸茶В绾︽暟鎹�');
+        return;
+      }
+      stopElectronSign(selectionRows.map((x) => x.id));
+    }
   } catch (error) {}
 }
 
+async function stopElectronSign(ids: string[]) {
+  try {
+    await Message.tipMessage('纭畾瑙g害鐢ㄦ埛锛�');
+    let res = await enterpriseEmployeeServices.stopElectronSign({ ids: ids });
+    if (res) {
+      Message.successMessage('鎿嶄綔鎴愬姛');
+      getList(paginationState.pageIndex);
+    }
+  } catch (error) {}
+}
+
+const {
+  dialogProps: dialogStaffDetailProps,
+  handleEdit: handleStaffDetailEdit,
+  editForm: staffDetailEditForm,
+} = useFormDialog({
+  defaultFormParams: {
+    id: '',
+    tabType: 'info',
+  },
+});
+
 async function handleDelete(row: API.GetEnterpriseEmployeesQueryResultItem) {
   try {
     await Message.deleteMessage();

--
Gitblit v1.9.1