From 9373e192d80ba82036929de1904f7fadb515bfd5 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期一, 01 九月 2025 16:27:07 +0800
Subject: [PATCH] Merge branch 'master' of http://120.26.58.240:8888/r/flexJobAdminBClient

---
 src/views/FlexJobManage/FlexJobManage.vue |  160 +++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 124 insertions(+), 36 deletions(-)

diff --git a/src/views/FlexJobManage/FlexJobManage.vue b/src/views/FlexJobManage/FlexJobManage.vue
index 9c08eec..55741d4 100644
--- a/src/views/FlexJobManage/FlexJobManage.vue
+++ b/src/views/FlexJobManage/FlexJobManage.vue
@@ -104,6 +104,7 @@
       @onDownloadTemplate="handleDownloadTemplate"
     />
     <SendShotMessageDialog v-bind="dialogShotMessageProps" />
+    <SignDialog v-bind="dialogSignProps" />
   </LoadingLayout>
 </template>
 
@@ -132,11 +133,12 @@
 import StaffInfoDialog from './components/StaffInfoDialog.vue';
 import BatchImportDialog from './components/BatchImportDialog.vue';
 import SendShotMessageDialog from './components/SendShotMessageDialog.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([
@@ -160,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.Pass &&
+          row.hireStatus === EnumTaskUserHireStatus.Pass
         ),
     },
   },
@@ -190,16 +208,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();
@@ -417,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) {}
 }
 
@@ -440,22 +459,91 @@
   downloadFileByUrl(ImportEnterpriseEmployeesTempPath, '鎵归噺瀵煎叆妯℃澘');
 }
 
-function handleBatchUnSign() {
+const {
+  dialogProps: dialogSignProps,
+  handleAdd: handleSignAdd,
+  handleEdit: handleSignEdit,
+  editForm: signEditForm,
+} = useFormDialog({
+  onConfirm: signContract,
+  defaultFormParams: {
+    ids: [] as string[],
+    contractTemplateId: '',
+  },
+});
+
+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: '',
+    });
+  }
+}
+
+async function signContract() {
   try {
-    Message.warnMessage('鍔熻兘寮�鍙戜腑');
+    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) {}
 }
 
-function handleSign(row: API.GetEnterpriseEmployeesQueryResultItem) {
-  Message.warnMessage('鍔熻兘寮�鍙戜腑');
-}
-function handleBatchSign() {
-  Message.warnMessage('鍔熻兘寮�鍙戜腑');
-}
-async function handleUnSign(row: API.GetEnterpriseEmployeesQueryResultItem) {
+async function handleEnterpriseSign(row: API.GetEnterpriseEmployeesQueryResultItem) {
   try {
-    Message.warnMessage('鍔熻兘寮�鍙戜腑');
-    // 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 {
+    const selectionRows = getSelectionRows();
+    if (selectionRows) {
+      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) {}
 }
 

--
Gitblit v1.9.1