zhengyiming
3 天以前 c848d51eb43c87463fc8ce0b8e4996bb3f80894c
src/views/FlexJobManage/FlexJobManage.vue
@@ -84,6 +84,7 @@
          <el-button @click="handleBatchUnSign()" type="primary">批量解约</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,14 @@
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';
import _ from 'lodash';
defineOptions({
  name: 'EnterpriseManageList',
  name: 'FlexJobManageList',
});
const operationBtns = defineOperationBtns([
@@ -157,22 +161,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
        ),
    },
  },
@@ -192,16 +213,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();
@@ -260,7 +281,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,
@@ -414,27 +435,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) {}
}
@@ -445,53 +476,160 @@
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.Wait
        )
        x.userSignContractStatus === EnumTaskUserSignContractStatus.Pass ||
        x.enterpriseSignContractStatus === EnumTaskUserSignContractStatus.Pass ||
        x.hireStatus === EnumTaskUserHireStatus.Wait
    );
    if (hasSigned) {
      Message.warnMessage('勾选人员中包含已签约完成或未录用人员');
      return;
    }
    handleSignAdd();
    handleSignAdd({
      ids: selectionRows.map((x) => x.id),
      contractTemplateId: '',
    });
  }
}
const handleEnterpriseBatchSign = _.debounce(
  () => {
    const selectionRows = getSelectionRows();
    if (selectionRows) {
      const hasSigned = selectionRows?.some(
        (x) =>
          !(
            x.userSignContractStatus === EnumTaskUserSignContractStatus.Pass &&
            x.enterpriseSignContractStatus === EnumTaskUserSignContractStatus.Wait
          )
      );
      if (hasSigned) {
        Message.warnMessage('勾选人员中包含已企业签约、未录用人员或未签约完成人员');
        return;
      }
      const ids = selectionRows.map((x) => x.id);
      handleBatchEnterpriseSign(ids);
    }
  },
  1000,
  { leading: true, trailing: false }
);
async function handleBatchEnterpriseSign(ids: string[]) {
  try {
    state.loading = true;
    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: '身份证号',
              errorMessages: '错误信息',
            },
          });
        });
      }
    }
  } catch (error) {
  } finally {
    state.loading = false;
  }
}
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 {
    Message.warnMessage('功能开发中');
    // await Message.tipMessage('确定解约用户?');
    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('确定解约用户?');
    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();