From d3d8fde64c4df263fd696f1599cb79fe9efb7623 Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期五, 29 八月 2025 15:22:20 +0800
Subject: [PATCH] feat: 签约

---
 src/views/FlexJobManage/FlexJobManage.vue |   60 +++++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 45 insertions(+), 15 deletions(-)

diff --git a/src/views/FlexJobManage/FlexJobManage.vue b/src/views/FlexJobManage/FlexJobManage.vue
index 13aff9e..e2d1b49 100644
--- a/src/views/FlexJobManage/FlexJobManage.vue
+++ b/src/views/FlexJobManage/FlexJobManage.vue
@@ -129,7 +129,7 @@
 import { FlexJobManageColumns } from './constants';
 import { EnumTaskUserHireStatusText, EnumTaskUserSignContractStatusText } from '@/constants';
 import { Message } from '@bole-core/core';
-import { convertApi2FormUrlOnlyOne, downloadFileByUrl, format } from '@/utils';
+import { convertApi2FormUrlOnlyOne, downloadFileByUrl, format, omitByFalse } from '@/utils';
 import StaffInfoDialog from './components/StaffInfoDialog.vue';
 import BatchImportDialog from './components/BatchImportDialog.vue';
 import SendShotMessageDialog from './components/SendShotMessageDialog.vue';
@@ -138,7 +138,7 @@
 import { ModelValueType } from 'element-plus';
 
 defineOptions({
-  name: 'EnterpriseManageList',
+  name: 'FlexJobManageList',
 });
 
 const operationBtns = defineOperationBtns([
@@ -162,11 +162,11 @@
   },
   {
     data: {
-      enCode: 'signBtn',
+      enCode: 'enterpriseSignBtn',
       name: '浼佷笟绛剧害',
     },
     emits: {
-      onClick: (role) => handleSign(role),
+      onClick: (role) => handleEnterpriseSign(role),
     },
     extraProps: {
       hide: (row: API.GetEnterpriseEmployeesQueryResultItem) =>
@@ -178,17 +178,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.Stop
         ),
     },
   },
@@ -265,7 +265,7 @@
         enterpriseSignContractStatus: extraParamState.enterpriseSignContractStatus,
       };
 
-      let res = await enterpriseEmployeeServices.getEnterpriseEmployees(params, {
+      let res = await enterpriseEmployeeServices.getEnterpriseEmployees(omitByFalse(params), {
         showLoading: !state.loading,
       });
       return res;
@@ -462,26 +462,33 @@
 const {
   dialogProps: dialogSignProps,
   handleAdd: handleSignAdd,
+  handleEdit: handleSignEdit,
   editForm: signEditForm,
 } = useFormDialog({
   onConfirm: signContract,
   defaultFormParams: {
-    url: [] as UploadUserFile[],
+    id: '',
+    contractTemplateId: '',
   },
 });
 
-function handleSign(row: API.GetEnterpriseEmployeesQueryResultItem) {
-  handleSignAdd();
+function handleInviteSign(row: API.GetEnterpriseEmployeesQueryResultItem) {
+  if (row) {
+    handleSignEdit({
+      id: row.id,
+      contractTemplateId: '',
+    });
+  }
 }
 function handleBatchSign() {
   const selectionRows = getSelectionRows();
+  console.log('selectionRows: ', selectionRows);
   if (selectionRows) {
     const hasSigned = selectionRows?.some(
       (x) =>
-        !(
-          x.userSignContractStatus === EnumTaskUserSignContractStatus.Pass &&
-          x.enterpriseSignContractStatus === EnumTaskUserSignContractStatus.Wait
-        )
+        x.userSignContractStatus === EnumTaskUserSignContractStatus.Pass ||
+        x.enterpriseSignContractStatus === EnumTaskUserSignContractStatus.Pass ||
+        x.hireStatus === EnumTaskUserHireStatus.Wait
     );
     if (hasSigned) {
       Message.warnMessage('鍕鹃�変汉鍛樹腑鍖呭惈宸茬绾﹀畬鎴愭垨鏈綍鐢ㄤ汉鍛�');
@@ -493,12 +500,35 @@
 
 async function signContract() {
   try {
+    let params: API.InviteElectronSignCommand = {
+      id: signEditForm.id,
+      contractTemplateId: signEditForm.contractTemplateId,
+    };
+    let res = await enterpriseEmployeeServices.inviteElectronSign(params);
+    if (res) {
+      Message.successMessage('鎿嶄綔鎴愬姛');
+      getList(paginationState.pageIndex);
+    }
+  } catch (error) {}
+}
+
+async function handleEnterpriseSign(row: API.GetEnterpriseEmployeesQueryResultItem) {
+  try {
+    let res = await enterpriseEmployeeServices.enterpriseUserElectronSign({ id: row.id });
+    if (res) {
+      window.open(res?.signContractLongUrl, '_blank');
+    }
   } catch (error) {}
 }
 
 async function handleUnSign(row: API.GetEnterpriseEmployeesQueryResultItem) {
   try {
     await Message.tipMessage('纭畾瑙g害鐢ㄦ埛锛�');
+    let res = await enterpriseEmployeeServices.stopElectronSign({ id: row.id });
+    if (res) {
+      Message.successMessage('鎿嶄綔鎴愬姛');
+      getList(paginationState.pageIndex);
+    }
   } catch (error) {}
 }
 

--
Gitblit v1.9.1