zhengyiming
6 天以前 9373e192d80ba82036929de1904f7fadb515bfd5
src/views/FlexJobManage/FlexJobManage.vue
@@ -104,6 +104,7 @@
      @onDownloadTemplate="handleDownloadTemplate"
    />
    <SendShotMessageDialog v-bind="dialogShotMessageProps" />
    <SignDialog v-bind="dialogSignProps" />
  </LoadingLayout>
</template>
@@ -123,6 +124,7 @@
  defineOperationBtns,
  useFormDialog,
  UploadUserFile,
  XLSXUtils,
} from '@bole-core/components';
import { FlexJobManageColumns } from './constants';
import { EnumTaskUserHireStatusText, EnumTaskUserSignContractStatusText } from '@/constants';
@@ -131,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([
@@ -159,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
        ),
    },
  },
@@ -189,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();
@@ -312,8 +331,8 @@
    contactPhoneNumber: '',
    gender: EnumUserGender.Male,
    age: null as any as number,
    idFrontUrl: [] as UploadUserFile[],
    idBackUrl: [] as UploadUserFile[],
    identityImg: [] as UploadUserFile[],
    identityBackImg: [] as UploadUserFile[],
    contractUrl: [] as UploadUserFile[],
    regiterTime: '',
    userRealTime: '',
@@ -332,8 +351,8 @@
      contactPhoneNumber: row.contactPhoneNumber,
      gender: detail.gender,
      age: detail.age ?? null,
      idFrontUrl: convertApi2FormUrlOnlyOne(detail.identityImg),
      idBackUrl: convertApi2FormUrlOnlyOne(detail.identityBackImg),
      identityImg: convertApi2FormUrlOnlyOne(detail.identityImg),
      identityBackImg: convertApi2FormUrlOnlyOne(detail.identityBackImg),
      contractUrl: convertApi2FormUrlOnlyOne(detail.contractUrl, {
        fileName: detail.contractUrl ? detail.contractUrl.split('/').pop() : '合同',
      }),
@@ -345,7 +364,25 @@
  } catch (error) {}
}
async function handleAddOrEdit() {}
async function handleAddOrEdit() {
  try {
    let params: API.EditEnterpriseEmployeeCommand = {
      name: staffInfoEditForm.name,
      identity: staffInfoEditForm.identity,
      contactPhoneNumber: staffInfoEditForm.contactPhoneNumber,
      gender: staffInfoEditForm.gender,
      age: staffInfoEditForm.age,
      identityImg: staffInfoEditForm.identityImg[0]?.path ?? '',
      identityBackImg: staffInfoEditForm.identityBackImg[0]?.path ?? '',
      id: staffInfoEditForm.id,
    };
    let res = await enterpriseEmployeeServices.editEnterpriseEmployee(params);
    if (res) {
      Message.successMessage('操作成功');
      getList(paginationState.pageIndex);
    }
  } catch (error) {}
}
const {
  dialogProps: dialogBatchImportProps,
@@ -354,15 +391,34 @@
} = useFormDialog({
  onConfirm: handleBatchImport,
  defaultFormParams: {
    customerId: '',
    contractTemplateId: '',
    templateDataId: '',
    url: [] as UploadUserFile[],
    userList: [],
  },
});
async function handleBatchImport() {}
async function handleBatchImport() {
  try {
    let params: API.ImportEnterpriseEmployeesCommand = {
      excelUrl: batchImportForm.url[0]?.path ?? '',
    };
    let res = await enterpriseEmployeeServices.importEnterpriseEmployees(params);
    if (res.failCount > 0) {
      await Message.tipMessage('存在错误数据,是否导出?');
      XLSXUtils.exportToXLSX({
        workbookDataList: res.errors,
        fileName: '灵工批量导入-错误数据',
        workbookHeaderMap: {
          name: '姓名',
          identity: '身份证号',
          contactPhoneNumber: '手机号',
          errorMessage: '备注',
        },
      });
    } else {
      Message.successMessage('导入成功');
      getList();
    }
  } catch (error) {}
}
const {
  dialogProps: dialogShotMessageProps,
@@ -381,7 +437,9 @@
  try {
    const selectionRows = getSelectionRows();
    if (selectionRows) {
      if (selectionRows.some((x) => x.status === 10)) {
      if (
        selectionRows.some((x) => x.userSignContractStatus === EnumTaskUserSignContractStatus.Pass)
      ) {
        await Message.tipMessage('勾选人员中包含已签约完成人员,确认要继续发送短信通知吗?');
      }
      handleShotMessageAdd({
@@ -398,16 +456,94 @@
}
function handleDownloadTemplate() {
  downloadFileByUrl('', '批量导入模板');
  downloadFileByUrl(ImportEnterpriseEmployeesTempPath, '批量导入模板');
}
function handleBatchUnSign() {}
const {
  dialogProps: dialogSignProps,
  handleAdd: handleSignAdd,
  handleEdit: handleSignEdit,
  editForm: signEditForm,
} = useFormDialog({
  onConfirm: signContract,
  defaultFormParams: {
    ids: [] as string[],
    contractTemplateId: '',
  },
});
function handleSign(row: API.GetEnterpriseEmployeesQueryResultItem) {}
function handleBatchSign() {}
async function handleUnSign(row: API.GetEnterpriseEmployeesQueryResultItem) {
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 {
    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 handleEnterpriseSign(row: API.GetEnterpriseEmployeesQueryResultItem) {
  try {
    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('确定解约用户?');
    let res = await enterpriseEmployeeServices.stopElectronSign({ ids: ids });
    if (res) {
      Message.successMessage('操作成功');
      getList(paginationState.pageIndex);
    }
  } catch (error) {}
}