wupengfei
3 天以前 87acc2d3c66a56bc0e01f44c054bdb0aa3546aa2
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,6 +133,7 @@
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';
@@ -312,8 +315,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: '',
@@ -322,27 +325,48 @@
  },
});
function openDialog(row: API.GetEnterpriseEmployeesQueryResultItem, isDetail = false) {
  handleStaffInfoEdit({
    id: row.id,
    name: row.name,
    identity: row.identity,
    contactPhoneNumber: row.contactPhoneNumber,
    gender: row.gender,
    age: row.age ?? null,
    idFrontUrl: convertApi2FormUrlOnlyOne(row.idFrontUrl),
    idBackUrl: convertApi2FormUrlOnlyOne(row.idBackUrl),
    contractUrl: convertApi2FormUrlOnlyOne(row.contractUrl, {
      fileName: row.contractUrl ? row.contractUrl.split('/').pop() : '合同',
    }),
    regiterTime: row.regiterTime ?? '',
    userRealTime: row.userRealTime,
    userSignContractTime: row.userSignContractTime,
    isDetail: isDetail,
  });
async function openDialog(row: API.GetEnterpriseEmployeesQueryResultItem, isDetail = false) {
  try {
    let detail = await enterpriseEmployeeServices.getEnterpriseEmployee({ id: row.id });
    handleStaffInfoEdit({
      id: row.id,
      name: row.name,
      identity: row.identity,
      contactPhoneNumber: row.contactPhoneNumber,
      gender: detail.gender,
      age: detail.age ?? null,
      identityImg: convertApi2FormUrlOnlyOne(detail.identityImg),
      identityBackImg: convertApi2FormUrlOnlyOne(detail.identityBackImg),
      contractUrl: convertApi2FormUrlOnlyOne(detail.contractUrl, {
        fileName: detail.contractUrl ? detail.contractUrl.split('/').pop() : '合同',
      }),
      regiterTime: detail.applyTime ?? '',
      userRealTime: row.userRealTime ?? '',
      userSignContractTime: row.userSignContractTime ?? '',
      isDetail: isDetail,
    });
  } 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,
@@ -351,15 +375,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,
@@ -376,16 +419,17 @@
async function handleSendShotMessage() {
  try {
    const selectionRows = getSelectionRows();
    if (selectionRows) {
      if (selectionRows.some((x) => x.status === 10)) {
        await Message.tipMessage('勾选人员中包含已签约完成人员,确认要继续发送短信通知吗?');
      }
      handleShotMessageAdd({
        ids: selectionRows.map((x) => x.id),
        name: '人员签约通道短信',
      });
    }
    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: '人员签约通道短信',
    //   });
    // }
  } catch (error) {}
}
@@ -395,16 +439,56 @@
}
function handleDownloadTemplate() {
  downloadFileByUrl('', '批量导入模板');
  downloadFileByUrl(ImportEnterpriseEmployeesTempPath, '批量导入模板');
}
function handleBatchUnSign() {}
const {
  dialogProps: dialogSignProps,
  handleAdd: handleSignAdd,
  editForm: signEditForm,
} = useFormDialog({
  onConfirm: signContract,
  defaultFormParams: {
    url: [] as UploadUserFile[],
  },
});
function handleSign(row: API.GetEnterpriseEmployeesQueryResultItem) {}
function handleBatchSign() {}
function handleSign(row: API.GetEnterpriseEmployeesQueryResultItem) {
  handleSignAdd();
}
function handleBatchSign() {
  const selectionRows = getSelectionRows();
  if (selectionRows) {
    const hasSigned = selectionRows?.some(
      (x) =>
        !(
          x.userSignContractStatus === EnumTaskUserSignContractStatus.Pass &&
          x.enterpriseSignContractStatus === EnumTaskUserSignContractStatus.Wait
        )
    );
    if (hasSigned) {
      Message.warnMessage('勾选人员中包含已签约完成或未录用人员');
      return;
    }
    handleSignAdd();
  }
}
async function signContract() {
  try {
  } catch (error) {}
}
async function handleUnSign(row: API.GetEnterpriseEmployeesQueryResultItem) {
  try {
    await Message.tipMessage('确定解约用户?');
    Message.warnMessage('功能开发中');
    // await Message.tipMessage('确定解约用户?');
  } catch (error) {}
}
function handleBatchUnSign() {
  try {
    Message.warnMessage('功能开发中');
  } catch (error) {}
}