<template>
|
<ProDialog
|
title="批量减员"
|
v-model="innerVisible"
|
destroy-on-close
|
draggable
|
bodyNoPaddingBottom
|
@close="onDialogClose"
|
>
|
<ProForm :model="form" ref="dialogForm" label-width="120px">
|
<ProFormItemV2 label="保单号:" prop="orderNo" :check-rules="[{ message: '请输入保单号' }]">
|
<ProFormText
|
placeholder="请输入保单号"
|
v-model.trim="form.orderNo"
|
:maxlength="30"
|
></ProFormText>
|
</ProFormItemV2>
|
<ProFormItemV2
|
label="上传增员名单:"
|
prop="url"
|
:check-rules="[{ message: '请上传增员名单', type: 'upload' }]"
|
>
|
<ProFormUpload v-model:file-url="form.url" :limit="1" :limitFileSize="10" accept="xlsx,xls">
|
<el-button style="margin-right: 10px" type="primary" size="small" icon="Upload"
|
>文件上传</el-button
|
>
|
<el-button
|
style="margin-left: 10px"
|
type="primary"
|
link
|
@click.stop="downloadImportEntryStaff"
|
>模板下载</el-button
|
>
|
</ProFormUpload>
|
</ProFormItemV2>
|
</ProForm>
|
<template #footer>
|
<span class="dialog-footer">
|
<el-button type="primary" @click="handleConfirm">确 定</el-button>
|
</span>
|
</template>
|
</ProDialog>
|
</template>
|
|
<script setup lang="ts">
|
import { JYBInsuranceOrderTempPath } from '@/constants';
|
import {
|
ProDialog,
|
UploadUserFile,
|
ProForm,
|
ProFormItemV2,
|
ProFormText,
|
ProFormUpload,
|
} from '@bole-core/components';
|
import { downloadFileByUrl, Message } from '@bole-core/core';
|
import { FormInstance } from 'element-plus';
|
|
defineOptions({
|
name: 'BatchDownsizingDialog',
|
});
|
|
type Props = {
|
modelValue: boolean;
|
form?: {
|
checkOrderNo: string;
|
orderNo: string;
|
url: UploadUserFile[];
|
downsizingInsuranceList: string[];
|
};
|
};
|
|
const props = withDefaults(defineProps<Props>(), {
|
modelValue: false,
|
});
|
|
const emit = defineEmits<{
|
(e: 'update:modelValue', value: boolean): void;
|
(e: 'update:form', value: Props['form']): void;
|
(e: 'onConfirm'): void;
|
(e: 'onCancel'): void;
|
}>();
|
|
const innerVisible = computed({
|
get() {
|
return props.modelValue;
|
},
|
set(val) {
|
emit('update:modelValue', val);
|
},
|
});
|
|
const innerForm = computed({
|
get() {
|
return props.form;
|
},
|
set(val) {
|
emit('update:form', val);
|
},
|
});
|
|
const dialogForm = ref<FormInstance>();
|
|
function onDialogClose() {
|
if (!dialogForm.value) return;
|
dialogForm.value.resetFields();
|
}
|
|
function handleConfirm() {
|
if (!dialogForm.value) return;
|
dialogForm.value.validate((valid) => {
|
if (valid) {
|
if (innerForm.value.orderNo !== innerForm.value.checkOrderNo) {
|
Message.errorMessage('保单号不一致,减员失败');
|
return;
|
}
|
emit('onConfirm');
|
} else {
|
return;
|
}
|
});
|
}
|
|
function downloadImportEntryStaff() {
|
downloadFileByUrl(JYBInsuranceOrderTempPath, '保单导入模板');
|
}
|
</script>
|