| <template> | 
|   <ProDialog | 
|     title="选择保单" | 
|     v-model="visible" | 
|     @close="onDialogClose" | 
|     draggable | 
|     destroy-on-close | 
|     :close-on-click-modal="false" | 
|     :close-on-press-escape="false" | 
|     :show-close="false" | 
|   > | 
|     <ProForm :model="form" ref="dialogForm" label-width="90px"> | 
|       <ProFormItemV2 | 
|         label="保单:" | 
|         prop="insuranceOrderId" | 
|         :check-rules="[{ message: '请选择保单' }]" | 
|       > | 
|         <ProFormSelect v-model="form.insuranceOrderId" :value-enum="insuranceOrderList" /> | 
|       </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 { FormInstance } from 'element-plus'; | 
| import { | 
|   ProDialog, | 
|   ProForm, | 
|   ProFormItemV2, | 
|   ProFormText, | 
|   ProFormRadio, | 
|   ProFormSelect, | 
| } from '@bole-core/components'; | 
| import { format } from '@/utils'; | 
|   | 
| defineOptions({ | 
|   name: 'SelectOrderDialog', | 
| }); | 
|   | 
| // type Props = {}; | 
|   | 
| // const props = withDefaults(defineProps<Props>(), {}); | 
|   | 
| const visible = defineModel({ type: Boolean }); | 
|   | 
| type Form = { | 
|   title?: string; | 
|   insuranceOrderId: string; | 
|   insuranceOrderList: API.InsuranceOrderListOutput[]; | 
| }; | 
|   | 
| const form = defineModel<Form>('form'); | 
|   | 
| const insuranceOrderList = computed(() => | 
|   form.value.insuranceOrderList.map((x) => ({ | 
|     label: `${x.channel}-${x.name}-${x.idNumber}-${format(x.insuranceBeginTime)}-${format( | 
|       x.insuranceEndTime | 
|     )}-${x.insuredInstitution}-${x.insuranceScheme}-${x.onJobFlag}`, | 
|     value: x.id, | 
|   })) | 
| ); | 
|   | 
| const emit = defineEmits<{ | 
|   (e: 'onConfirm'): void; | 
|   (e: 'onCancel'): void; | 
| }>(); | 
|   | 
| 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) { | 
|       emit('onConfirm'); | 
|     } else { | 
|       return; | 
|     } | 
|   }); | 
| } | 
| </script> |