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

---
 src/views/FlexJobManage/FlexJobManage.vue |   94 +++++++++++++++++++++++++++++++++++------------
 1 files changed, 70 insertions(+), 24 deletions(-)

diff --git a/src/views/FlexJobManage/FlexJobManage.vue b/src/views/FlexJobManage/FlexJobManage.vue
index aeb4fc9..dca1aa8 100644
--- a/src/views/FlexJobManage/FlexJobManage.vue
+++ b/src/views/FlexJobManage/FlexJobManage.vue
@@ -138,7 +138,7 @@
 import { ModelValueType } from 'element-plus';
 
 defineOptions({
-  name: 'EnterpriseManageList',
+  name: 'FlexJobManageList',
 });
 
 const operationBtns = defineOperationBtns([
@@ -162,17 +162,33 @@
   },
   {
     data: {
-      enCode: 'signBtn',
-      name: '绛剧害',
+      enCode: 'enterpriseSignBtn',
+      name: '浼佷笟绛剧害',
     },
     emits: {
-      onClick: (role) => handleSign(role),
+      onClick: (role) => handleEnterpriseSign(role),
     },
     extraProps: {
       hide: (row: API.GetEnterpriseEmployeesQueryResultItem) =>
         !(
           row.userSignContractStatus === EnumTaskUserSignContractStatus.Pass &&
           row.enterpriseSignContractStatus === EnumTaskUserSignContractStatus.Wait
+        ),
+    },
+  },
+  {
+    data: {
+      enCode: 'inviteSignBtn',
+      name: '閭�璇风绾�',
+    },
+    emits: {
+      onClick: (role) => handleInviteSign(role),
+    },
+    extraProps: {
+      hide: (row: API.GetEnterpriseEmployeesQueryResultItem) =>
+        !(
+          row.userSignContractStatus === EnumTaskUserSignContractStatus.Wait ||
+          row.userSignContractStatus === EnumTaskUserSignContractStatus.Stop
         ),
     },
   },
@@ -419,17 +435,18 @@
 
 async function handleSendShotMessage() {
   try {
-    Message.warnMessage('鍔熻兘寮�鍙戜腑');
-    // const selectionRows = getSelectionRows();
-    // if (selectionRows) {
-    //   if (selectionRows.some((x) => x.status === 10)) {
-    //     await Message.tipMessage('鍕鹃�変汉鍛樹腑鍖呭惈宸茬绾﹀畬鎴愪汉鍛橈紝纭瑕佺户缁彂閫佺煭淇¢�氱煡鍚楋紵');
-    //   }
-    //   handleShotMessageAdd({
-    //     ids: selectionRows.map((x) => x.id),
-    //     name: '浜哄憳绛剧害閫氶亾鐭俊',
-    //   });
-    // }
+    const selectionRows = getSelectionRows();
+    if (selectionRows) {
+      if (
+        selectionRows.some((x) => x.userSignContractStatus === EnumTaskUserSignContractStatus.Pass)
+      ) {
+        await Message.tipMessage('鍕鹃�変汉鍛樹腑鍖呭惈宸茬绾﹀畬鎴愪汉鍛橈紝纭瑕佺户缁彂閫佺煭淇¢�氱煡鍚楋紵');
+      }
+      handleShotMessageAdd({
+        ids: selectionRows.map((x) => x.id),
+        name: '浜哄憳绛剧害閫氶亾鐭俊',
+      });
+    }
   } catch (error) {}
 }
 
@@ -445,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('鍕鹃�変汉鍛樹腑鍖呭惈宸茬绾﹀畬鎴愭垨鏈綍鐢ㄤ汉鍛�');
@@ -476,13 +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 {
-    Message.warnMessage('鍔熻兘寮�鍙戜腑');
-    // await Message.tipMessage('纭畾瑙g害鐢ㄦ埛锛�');
+    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