|
@@ -8,14 +8,12 @@
|
|
|
<div class="u-demo-block__title" style="margin: 0 0 8px 18px">基本信息</div>
|
|
|
<van-form ref="loginFormRef">
|
|
|
<van-cell-group inset>
|
|
|
- <!-- 通过 pattern 进行正则校验 -->
|
|
|
<van-field
|
|
|
v-model="crmPatientMi.pName"
|
|
|
label="姓名"
|
|
|
- name="emailPattern"
|
|
|
- placeholder="请输入姓名"
|
|
|
+ placeholder="请填写姓名"
|
|
|
required
|
|
|
- :rules="[{ required: true, message: '请输入姓名' }]"
|
|
|
+ :rules="[{ required: true, message: '请填写姓名' }]"
|
|
|
/>
|
|
|
<van-field
|
|
|
v-model="crmPatientMi.sexLabel"
|
|
@@ -29,89 +27,72 @@
|
|
|
<van-field
|
|
|
v-model="crmPatientMi.age"
|
|
|
label="年龄"
|
|
|
- name="emailPattern"
|
|
|
- placeholder="请输入年龄"
|
|
|
+ placeholder="请填写年龄"
|
|
|
required
|
|
|
- :rules="[{ required: true, message: '请输入年龄' }]"
|
|
|
+ :rules="[{ required: true, message: '请填写年龄' }]"
|
|
|
/>
|
|
|
<van-field
|
|
|
v-model="crmPatientMi.socialNo"
|
|
|
label="身份证号"
|
|
|
- name="socialNoPattern"
|
|
|
- placeholder="请输入身份证号"
|
|
|
+ placeholder="请填写身份证号"
|
|
|
required
|
|
|
- :rules="[{ required: true, validator: socialNoPattern, message: '请输入身份证号' }]"
|
|
|
+ :rules="[{ required: true, validator: socialNoPattern, message: '请填写正确的身份证号' }]"
|
|
|
/>
|
|
|
<van-field
|
|
|
v-model="crmPatientMi.relTel"
|
|
|
label="手机号"
|
|
|
- name="emailPattern"
|
|
|
- placeholder="请输入本人手机号"
|
|
|
+ placeholder="请填写本人手机号"
|
|
|
required
|
|
|
- :rules="[{ required: true, message: '请输入本人手机号' }]"
|
|
|
+ :rules="[{ required: true, message: '请填写本人手机号' }]"
|
|
|
/>
|
|
|
<van-field
|
|
|
v-model="crmPatientMi.typeLabel"
|
|
|
label="患者来源"
|
|
|
- name="emailPattern"
|
|
|
placeholder="请选择患者来源"
|
|
|
required
|
|
|
readonly
|
|
|
@click="clickCommonPicker('pType')"
|
|
|
:rules="[{ required: true, message: '请选择患者来源' }]"
|
|
|
/>
|
|
|
+ <van-field
|
|
|
+ v-model="crmPatientMi.chronicDiseaseTypeLabel"
|
|
|
+ label="慢病类型"
|
|
|
+ placeholder="请选择慢病类型"
|
|
|
+ required
|
|
|
+ readonly
|
|
|
+ @click="clickCommonPicker('chronicDiseaseType')"
|
|
|
+ :rules="[{ required: true, message: '请选择慢病类型' }]"
|
|
|
+ />
|
|
|
<van-field
|
|
|
v-model="crmPatientMi.relNameTel"
|
|
|
label="联系人电话"
|
|
|
- name="emailPattern"
|
|
|
- placeholder="请输入家属电话"
|
|
|
- required
|
|
|
- :rules="[{ required: true, message: '请输入家属电话' }]"
|
|
|
+ placeholder="请填写家属电话"
|
|
|
/>
|
|
|
<van-field
|
|
|
v-model="crmPatientMi.relLabel"
|
|
|
label="联系人关系"
|
|
|
- name="emailPattern"
|
|
|
placeholder="请选择联系人关系"
|
|
|
- required
|
|
|
readonly
|
|
|
@click="clickCommonPicker('relCode')"
|
|
|
- :rules="[{ required: true, message: '请选择联系人关系' }]"
|
|
|
- />
|
|
|
- <van-field
|
|
|
- v-model="crmPatientMi.chronicDiseaseTypeLabel"
|
|
|
- label="慢病类型"
|
|
|
- placeholder="请选择慢病类型"
|
|
|
- required
|
|
|
- readonly
|
|
|
- @click="clickCommonPicker('chronicDiseaseType')"
|
|
|
- :rules="[{ required: true, message: '请选择慢病类型' }]"
|
|
|
/>
|
|
|
<van-field
|
|
|
v-model="crmPatientMi.lastDate"
|
|
|
label="确诊时间"
|
|
|
placeholder="请选择确诊时间"
|
|
|
- required
|
|
|
readonly
|
|
|
@click="showTimePicker = true"
|
|
|
- :rules="[{ required: true, message: '确诊时间' }]"
|
|
|
/>
|
|
|
<van-field
|
|
|
v-model="crmPatientMi.districtLabel"
|
|
|
label="省市区选择"
|
|
|
placeholder="请选择省市区"
|
|
|
- required
|
|
|
readonly
|
|
|
@click="showAddressPicker = true"
|
|
|
- :rules="[{ required: true, message: '请选择省市区' }]"
|
|
|
/>
|
|
|
<van-field
|
|
|
v-model="crmPatientMi.detailAdress"
|
|
|
label="详细地址"
|
|
|
- name="emailPattern"
|
|
|
- placeholder="请输入详细地址"
|
|
|
- required
|
|
|
- :rules="[{ required: true, message: '请输入详细地址' }]"
|
|
|
+ placeholder="请填写详细地址"
|
|
|
/>
|
|
|
</van-cell-group>
|
|
|
</van-form>
|
|
@@ -229,28 +210,64 @@ const onConfirmArea = (values) => {
|
|
|
|
|
|
const crmPatientMi = ref({})
|
|
|
|
|
|
-const emailPattern = (val) => /^.+$/.test(val)
|
|
|
const socialNoPattern = (val) => /^[1-9]\d{5}(19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[1-2]\d|3[0-1])\d{3}(\d|X)$/.test(val)
|
|
|
|
|
|
function submitChronicDiseaseInfo() {
|
|
|
- loginFormRef.value?.validate(['emailPattern']).then(() => {
|
|
|
- saveCrmPatientMi(crmPatientMi.value).then(() => {
|
|
|
- showSuccessToast('提交成功')
|
|
|
- })
|
|
|
- }).catch(() => {
|
|
|
- showFailToast('请正确填写信息')
|
|
|
- })
|
|
|
+ if (!validForm()) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!crmPatientMi.value.lastDate) {
|
|
|
+ crmPatientMi.value.lastDate = null;
|
|
|
+ }
|
|
|
+ saveCrmPatientMi(crmPatientMi.value).then(() => {
|
|
|
+ showSuccessToast('提交成功')
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+function validForm() {
|
|
|
+ if (!crmPatientMi.value.pName) {
|
|
|
+ showFailToast('请填写姓名');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (!crmPatientMi.value.sexLabel) {
|
|
|
+ showFailToast('请选择性别');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (!crmPatientMi.value.age) {
|
|
|
+ showFailToast('请填写年龄');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (!crmPatientMi.value.socialNo) {
|
|
|
+ showFailToast('请填写身份证号');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (!crmPatientMi.value.relTel) {
|
|
|
+ showFailToast('请填写本人手机号');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (!crmPatientMi.value.typeLabel) {
|
|
|
+ showFailToast('请选择患者来源');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (!crmPatientMi.value.chronicDiseaseTypeLabel) {
|
|
|
+ showFailToast('请选择慢病类型');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true
|
|
|
}
|
|
|
|
|
|
const showTimePicker = ref(false)
|
|
|
+
|
|
|
function timeConfirm({selectedValues}) {
|
|
|
showTimePicker.value = false
|
|
|
- crmPatientMi.value.lastDate = `${selectedValues[0]}-${selectedValues[1]}-${selectedValues[2]}`
|
|
|
+ crmPatientMi.value.lastDate =
|
|
|
+ `${selectedValues[0]}-${selectedValues[1]}-${selectedValues[2]}`
|
|
|
}
|
|
|
|
|
|
const showCommonPicker = ref(false)
|
|
|
const commonPickerSelections = ref([])
|
|
|
const currentCommonPickerKey = ref(null)
|
|
|
+
|
|
|
function clickCommonPicker(e) {
|
|
|
currentCommonPickerKey.value = e
|
|
|
if (e === 'sex') {
|