<template>
|
<ProDialog
|
title="修改信息"
|
v-model="innerVisible"
|
destroy-on-close
|
draggable
|
bodyNoPaddingBottom
|
@close="onDialogClose"
|
width="800px"
|
>
|
<el-text type="danger"
|
>*身份证号与保险人姓名不能同时变更,只能修改其中一项,且仅能修改一次</el-text
|
>
|
<ProForm :model="innerForm" ref="dialogForm" label-width="100px" style="margin-top: 20px">
|
<ProFormCol>
|
<ProFormColItem :span="16">
|
<ProFormItemV2 label="姓名:" prop="name" :check-rules="[{ message: '请输入姓名' }]">
|
<ProFormText
|
placeholder="请输入姓名"
|
v-model.trim="innerForm.name"
|
:maxlength="30"
|
></ProFormText>
|
</ProFormItemV2>
|
</ProFormColItem>
|
</ProFormCol>
|
<ProFormCol>
|
<ProFormColItem :span="16">
|
<ProFormItemV2
|
label="身份证号:"
|
prop="idNumber"
|
:check-rules="[{ message: '请输入身份证号', type: 'idCard' }]"
|
>
|
<ProFormText
|
placeholder="请输入身份证号"
|
v-model.trim="innerForm.idNumber"
|
:maxlength="30"
|
></ProFormText>
|
</ProFormItemV2>
|
</ProFormColItem>
|
</ProFormCol>
|
<ProFormCol>
|
<ProFormColItem :span="16">
|
<ProFormItemV2 label="手机号:" prop="phone">
|
<ProFormText
|
placeholder=""
|
v-model.trim="innerForm.phone"
|
:maxlength="30"
|
disabled
|
></ProFormText>
|
</ProFormItemV2>
|
</ProFormColItem>
|
</ProFormCol>
|
</ProForm>
|
<template #footer>
|
<span class="dialog-footer">
|
<el-button @click="emit('onCancel')">取 消</el-button>
|
<el-button type="primary" @click="handleConfirm">确 定</el-button>
|
</span>
|
</template>
|
</ProDialog>
|
</template>
|
|
<script setup lang="ts">
|
import {
|
ProDialog,
|
ProForm,
|
ProFormCol,
|
ProFormColItem,
|
ProFormItemV2,
|
ProFormText,
|
} from '@bole-core/components';
|
import { FormInstance } from 'element-plus';
|
|
defineOptions({
|
name: 'ChangePersonInfoDialog',
|
});
|
|
type Props = {
|
modelValue: boolean;
|
form?: {
|
id: string;
|
name: string;
|
idNumber: string;
|
phone: 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) {
|
emit('onConfirm');
|
} else {
|
return;
|
}
|
});
|
}
|
</script>
|