<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="pdf,doc,docx" 
 | 
        > 
 | 
        </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 { 
 | 
  ProDialog, 
 | 
  UploadUserFile, 
 | 
  ProForm, 
 | 
  ProFormItemV2, 
 | 
  ProFormText, 
 | 
  ProFormUpload, 
 | 
} from '@bole-core/components'; 
 | 
import { FormInstance } from 'element-plus'; 
 | 
  
 | 
defineOptions({ 
 | 
  name: 'BatchUploadOrderDialog', 
 | 
}); 
 | 
  
 | 
type Props = { 
 | 
  modelValue: boolean; 
 | 
  form?: { 
 | 
    orderNo: string; 
 | 
    url: UploadUserFile[]; 
 | 
  }; 
 | 
}; 
 | 
  
 | 
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) { 
 | 
      emit('onConfirm'); 
 | 
    } else { 
 | 
      return; 
 | 
    } 
 | 
  }); 
 | 
} 
 | 
</script> 
 |