wupengfei
3 天以前 fcb87424f8f9fc58163227684ecee36a99ba0c3d
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"
@@ -129,13 +131,15 @@
import { FlexJobManageColumns } from './constants';
import { EnumTaskUserHireStatusText, EnumTaskUserSignContractStatusText } from '@/constants';
import { Message } from '@bole-core/core';
import { convertApi2FormUrlOnlyOne, downloadFileByUrl, format, omitByFalse } from '@/utils';
import { convertApi2FormUrlOnlyOne, downloadFileByUrl, format } from '@/utils';
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: 'FlexJobManageList',
@@ -157,7 +161,8 @@
      name: '详情',
    },
    emits: {
      onClick: (role) => openDialog(role, true),
      onClick: (role: API.GetEnterpriseEmployeesQueryResultItem) =>
        handleStaffDetailEdit({ id: role.id, tabType: 'info' }),
    },
  },
  {
@@ -187,8 +192,8 @@
    extraProps: {
      hide: (row: API.GetEnterpriseEmployeesQueryResultItem) =>
        !(
          row.userSignContractStatus === EnumTaskUserSignContractStatus.Wait ||
          row.userSignContractStatus === EnumTaskUserSignContractStatus.Stop
          row.userSignContractStatus !== EnumTaskUserSignContractStatus.Pass &&
          row.hireStatus === EnumTaskUserHireStatus.Pass
        ),
    },
  },
@@ -208,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();
@@ -265,7 +270,7 @@
        enterpriseSignContractStatus: extraParamState.enterpriseSignContractStatus,
      };
      let res = await enterpriseEmployeeServices.getEnterpriseEmployees(omitByFalse(params), {
      let res = await enterpriseEmployeeServices.getEnterpriseEmployees(params, {
        showLoading: !state.loading,
      });
      return res;
@@ -276,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,
@@ -430,6 +435,7 @@
    ids: [] as string[],
    customerId: '',
    name: '',
    contractTemplateId: '',
  },
});
@@ -452,6 +458,14 @@
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) {}
}
@@ -467,7 +481,7 @@
} = useFormDialog({
  onConfirm: signContract,
  defaultFormParams: {
    id: '',
    ids: [] as string[],
    contractTemplateId: '',
  },
});
@@ -475,14 +489,13 @@
function handleInviteSign(row: API.GetEnterpriseEmployeesQueryResultItem) {
  if (row) {
    handleSignEdit({
      id: row.id,
      ids: [row.id],
      contractTemplateId: '',
    });
  }
}
function handleBatchSign() {
  const selectionRows = getSelectionRows();
  console.log('selectionRows: ', selectionRows);
  if (selectionRows) {
    const hasSigned = selectionRows?.some(
      (x) =>
@@ -494,14 +507,69 @@
      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 {
    let res = await enterpriseEmployeeServices.batchEnterpriseSignContract(
      { ids: ids },
      {
        showLoading: !state.loading,
      }
    );
    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) {}
}
async function signContract() {
  try {
    let params: API.InviteElectronSignCommand = {
      id: signEditForm.id,
      ids: signEditForm.ids,
      contractTemplateId: signEditForm.contractTemplateId,
    };
    let res = await enterpriseEmployeeServices.inviteElectronSign(params);
@@ -521,10 +589,30 @@
  } catch (error) {}
}
async function handleUnSign(row: API.GetEnterpriseEmployeesQueryResultItem) {
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('确定解约用户?');
    let res = await enterpriseEmployeeServices.stopElectronSign({ id: row.id });
    let res = await enterpriseEmployeeServices.stopElectronSign({ ids: ids });
    if (res) {
      Message.successMessage('操作成功');
      getList(paginationState.pageIndex);
@@ -532,11 +620,16 @@
  } catch (error) {}
}
function handleBatchUnSign() {
  try {
    Message.warnMessage('功能开发中');
  } catch (error) {}
}
const {
  dialogProps: dialogStaffDetailProps,
  handleEdit: handleStaffDetailEdit,
  editForm: staffDetailEditForm,
} = useFormDialog({
  defaultFormParams: {
    id: '',
    tabType: 'info',
  },
});
async function handleDelete(row: API.GetEnterpriseEmployeesQueryResultItem) {
  try {