From b331f884097a2dc5086c8cf043c8c8f52e7640fe Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期五, 12 九月 2025 17:34:39 +0800
Subject: [PATCH] Merge branch 'master' into dev-v1.1

---
 src/views/FlexJobManage/FlexJobManage.vue |  192 ++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 155 insertions(+), 37 deletions(-)

diff --git a/src/views/FlexJobManage/FlexJobManage.vue b/src/views/FlexJobManage/FlexJobManage.vue
index 9c08eec..ca81eac 100644
--- a/src/views/FlexJobManage/FlexJobManage.vue
+++ b/src/views/FlexJobManage/FlexJobManage.vue
@@ -99,11 +99,13 @@
       </ProTableV2>
     </AppContainer>
     <StaffInfoDialog v-bind="dialogStaffInfoProps" />
+    <StaffDetailInfoDialog v-bind="dialogStaffDetailProps" />
     <BatchImportDialog
       v-bind="dialogBatchImportProps"
       @onDownloadTemplate="handleDownloadTemplate"
     />
     <SendShotMessageDialog v-bind="dialogShotMessageProps" />
+    <SignDialog v-bind="dialogSignProps" />
   </LoadingLayout>
 </template>
 
@@ -132,11 +134,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([
@@ -155,22 +159,39 @@
       name: '璇︽儏',
     },
     emits: {
-      onClick: (role) => openDialog(role, true),
+      onClick: (role: API.GetEnterpriseEmployeesQueryResultItem) =>
+        handleStaffDetailEdit({ id: role.id, tabType: 'info' }),
     },
   },
   {
     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 +211,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();
@@ -412,27 +433,37 @@
     ids: [] as string[],
     customerId: '',
     name: '',
+    contractTemplateId: '',
   },
 });
 
 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) {}
 }
 
 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) {}
 }
 
@@ -440,25 +471,112 @@
   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) {
+      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