|
|
@ -1,152 +1,108 @@ |
|
|
<template> |
|
|
<template> |
|
|
<el-dialog |
|
|
<el-dialog v-model="showDialog" :title="formData.id ? t('updateSixSpeed') : t('addSixSpeed')" width="50%" class="diy-dialog-wrap" :destroy-on-close="true"> |
|
|
v-model="showDialog" |
|
|
<el-form :model="formData" label-width="120px" ref="formRef" :rules="formRules" class="page-form" v-loading="loading"> |
|
|
:title="formData.id ? t('updateSixSpeed') : t('addSixSpeed')" |
|
|
<el-form-item :label="t('purchasePower')" prop="purchase_power"> |
|
|
width="50%" |
|
|
<el-select class="input-width" v-model="formData.purchase_power" clearable :placeholder="t('purchasePowerPlaceholder')"> |
|
|
class="diy-dialog-wrap" |
|
|
<el-option label="请选择" value=""></el-option> |
|
|
:destroy-on-close="true" |
|
|
<el-option |
|
|
> |
|
|
v-for="(item, index) in purchase_powerList" |
|
|
<el-form |
|
|
:key="index" |
|
|
:model="formData" |
|
|
:label="item.name" |
|
|
label-width="120px" |
|
|
:value="item.value" |
|
|
ref="formRef" |
|
|
/> |
|
|
:rules="formRules" |
|
|
</el-select> |
|
|
class="page-form" |
|
|
</el-form-item> |
|
|
v-loading="loading" |
|
|
|
|
|
> |
|
|
<el-form-item :label="t('conceptAwareness')" prop="concept_awareness"> |
|
|
<el-form-item :label="t('purchasePower')" prop="purchase_power"> |
|
|
<el-select class="input-width" v-model="formData.concept_awareness" clearable :placeholder="t('conceptAwarenessPlaceholder')"> |
|
|
<el-input |
|
|
<el-option label="请选择" value=""></el-option> |
|
|
v-model="formData.purchase_power" |
|
|
<el-option |
|
|
clearable |
|
|
v-for="(item, index) in concept_awarenessList" |
|
|
:placeholder="t('purchasePowerPlaceholder')" |
|
|
:key="index" |
|
|
class="input-width" |
|
|
:label="item.name" |
|
|
/> |
|
|
:value="item.value" |
|
|
</el-form-item> |
|
|
/> |
|
|
|
|
|
</el-select> |
|
|
<el-form-item :label="t('conceptAwareness')" prop="concept_awareness"> |
|
|
</el-form-item> |
|
|
<el-input |
|
|
|
|
|
v-model="formData.concept_awareness" |
|
|
<el-form-item :label="t('preferredClassTime')" prop="preferred_class_time" class="input-width"> |
|
|
clearable |
|
|
<el-date-picker |
|
|
:placeholder="t('conceptAwarenessPlaceholder')" |
|
|
class="flex-1 !flex" |
|
|
class="input-width" |
|
|
v-model="formData.preferred_class_time" |
|
|
/> |
|
|
clearable |
|
|
</el-form-item> |
|
|
type="datetime" |
|
|
|
|
|
value-format="YYYY-MM-DD HH:mm:ss" |
|
|
<el-form-item |
|
|
:placeholder="t('preferredClassTimePlaceholder')"> |
|
|
:label="t('preferredClassTime')" |
|
|
</el-date-picker> |
|
|
prop="preferred_class_time" |
|
|
</el-form-item> |
|
|
> |
|
|
<el-form-item :label="t('distance')" prop="distance"> |
|
|
<el-input |
|
|
<el-input v-model="formData.distance" clearable :placeholder="t('distancePlaceholder')" class="input-width" /> |
|
|
v-model="formData.preferred_class_time" |
|
|
</el-form-item> |
|
|
clearable |
|
|
|
|
|
:placeholder="t('preferredClassTimePlaceholder')" |
|
|
<el-form-item :label="t('communication')" prop="communication"> |
|
|
class="input-width" |
|
|
<el-input v-model="formData.communication" type="textarea" rows="4" clearable :placeholder="t('communicationPlaceholder')" class="input-width"/> |
|
|
/> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item :label="t('promisedVisitTime')" prop="promised_visit_time" class="input-width"> |
|
|
|
|
|
<el-date-picker |
|
|
<el-form-item :label="t('distance')" prop="distance"> |
|
|
class="flex-1 !flex" |
|
|
<el-input |
|
|
v-model="formData.promised_visit_time" |
|
|
v-model="formData.distance" |
|
|
clearable |
|
|
clearable |
|
|
type="datetime" |
|
|
:placeholder="t('distancePlaceholder')" |
|
|
value-format="YYYY-MM-DD HH:mm:ss" |
|
|
class="input-width" |
|
|
:placeholder="t('promisedVisitTimePlaceholder')"> |
|
|
/> |
|
|
</el-date-picker> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
|
|
|
<el-form-item :label="t('actualVisitTime')" class="input-width"> |
|
|
<el-form-item :label="t('communication')" prop="communication"> |
|
|
<el-date-picker |
|
|
<el-input |
|
|
class="flex-1 !flex" |
|
|
v-model="formData.communication" |
|
|
v-model="formData.actual_visit_time" |
|
|
clearable |
|
|
clearable |
|
|
:placeholder="t('communicationPlaceholder')" |
|
|
type="datetime" |
|
|
class="input-width" |
|
|
value-format="YYYY-MM-DD HH:mm:ss" |
|
|
/> |
|
|
:placeholder="t('actualVisitTimePlaceholder')"> |
|
|
</el-form-item> |
|
|
</el-date-picker> |
|
|
|
|
|
</el-form-item> |
|
|
<el-form-item :label="t('promisedVisitTime')" prop="promised_visit_time"> |
|
|
<el-form-item :label="t('callIntent')" prop="call_intent"> |
|
|
<el-input |
|
|
<el-select class="input-width" v-model="formData.call_intent" clearable :placeholder="t('callIntentPlaceholder')"> |
|
|
v-model="formData.promised_visit_time" |
|
|
<el-option label="请选择" value=""></el-option> |
|
|
clearable |
|
|
<el-option |
|
|
:placeholder="t('promisedVisitTimePlaceholder')" |
|
|
v-for="(item, index) in call_intentList" |
|
|
class="input-width" |
|
|
:key="index" |
|
|
/> |
|
|
:label="item.name" |
|
|
</el-form-item> |
|
|
:value="item.value" |
|
|
|
|
|
/> |
|
|
<el-form-item :label="t('actualVisitTime')"> |
|
|
</el-select> |
|
|
<el-input |
|
|
</el-form-item> |
|
|
v-model="formData.actual_visit_time" |
|
|
|
|
|
clearable |
|
|
<el-form-item :label="t('firstVisitStatus')" > |
|
|
:placeholder="t('actualVisitTimePlaceholder')" |
|
|
<el-input v-model="formData.first_visit_status" type="textarea" rows="4" clearable :placeholder="t('firstVisitStatusPlaceholder')" class="input-width"/> |
|
|
class="input-width" |
|
|
</el-form-item> |
|
|
/> |
|
|
<el-form-item :label="t('secondVisitStatus')" > |
|
|
</el-form-item> |
|
|
<el-input v-model="formData.second_visit_status" type="textarea" rows="4" clearable :placeholder="t('secondVisitStatusPlaceholder')" class="input-width"/> |
|
|
|
|
|
</el-form-item> |
|
|
<el-form-item :label="t('callIntent')" prop="call_intent"> |
|
|
<el-form-item :label="t('isClosed')" prop="is_closed"> |
|
|
<el-input |
|
|
<el-select class="input-width" v-model="formData.is_closed" clearable :placeholder="t('isClosedPlaceholder')"> |
|
|
v-model="formData.call_intent" |
|
|
<el-option label="请选择" value=""></el-option> |
|
|
clearable |
|
|
<el-option |
|
|
:placeholder="t('callIntentPlaceholder')" |
|
|
v-for="(item, index) in is_closedList" |
|
|
class="input-width" |
|
|
:key="index" |
|
|
/> |
|
|
:label="item.name" |
|
|
</el-form-item> |
|
|
:value="item.value" |
|
|
|
|
|
/> |
|
|
<el-form-item :label="t('firstVisitStatus')"> |
|
|
</el-select> |
|
|
<el-input |
|
|
</el-form-item> |
|
|
v-model="formData.first_visit_status" |
|
|
|
|
|
clearable |
|
|
</el-form> |
|
|
:placeholder="t('firstVisitStatusPlaceholder')" |
|
|
|
|
|
class="input-width" |
|
|
<template #footer> |
|
|
/> |
|
|
<span class="dialog-footer"> |
|
|
</el-form-item> |
|
|
<el-button @click="showDialog = false">{{ t('cancel') }}</el-button> |
|
|
|
|
|
<el-button type="primary" :loading="loading" @click="confirm(formRef)">{{ |
|
|
<el-form-item :label="t('secondVisitStatus')"> |
|
|
t('confirm') |
|
|
<el-input |
|
|
}}</el-button> |
|
|
v-model="formData.second_visit_status" |
|
|
</span> |
|
|
clearable |
|
|
</template> |
|
|
:placeholder="t('secondVisitStatusPlaceholder')" |
|
|
</el-dialog> |
|
|
class="input-width" |
|
|
|
|
|
/> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
|
|
<el-form-item :label="t('isClosed')" prop="is_closed"> |
|
|
|
|
|
<el-input |
|
|
|
|
|
v-model="formData.is_closed" |
|
|
|
|
|
clearable |
|
|
|
|
|
:placeholder="t('isClosedPlaceholder')" |
|
|
|
|
|
class="input-width" |
|
|
|
|
|
/> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
|
|
<el-form-item :label="t('staffId')" prop="staff_id"> |
|
|
|
|
|
<el-input |
|
|
|
|
|
v-model="formData.staff_id" |
|
|
|
|
|
clearable |
|
|
|
|
|
:placeholder="t('staffIdPlaceholder')" |
|
|
|
|
|
class="input-width" |
|
|
|
|
|
/> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
|
|
<el-form-item :label="t('resourceId')" prop="resource_id"> |
|
|
|
|
|
<el-input |
|
|
|
|
|
v-model="formData.resource_id" |
|
|
|
|
|
clearable |
|
|
|
|
|
:placeholder="t('resourceIdPlaceholder')" |
|
|
|
|
|
class="input-width" |
|
|
|
|
|
/> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-form> |
|
|
|
|
|
|
|
|
|
|
|
<template #footer> |
|
|
|
|
|
<span class="dialog-footer"> |
|
|
|
|
|
<el-button @click="showDialog = false">{{ t('cancel') }}</el-button> |
|
|
|
|
|
<el-button |
|
|
|
|
|
type="primary" |
|
|
|
|
|
:loading="loading" |
|
|
|
|
|
@click="confirm(formRef)" |
|
|
|
|
|
>{{ t('confirm') }}</el-button |
|
|
|
|
|
> |
|
|
|
|
|
</span> |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-dialog> |
|
|
|
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script lang="ts" setup> |
|
|
<script lang="ts" setup> |
|
|
@ -154,7 +110,7 @@ import { ref, reactive, computed, watch } from 'vue' |
|
|
import { useDictionary } from '@/app/api/dict' |
|
|
import { useDictionary } from '@/app/api/dict' |
|
|
import { t } from '@/lang' |
|
|
import { t } from '@/lang' |
|
|
import type { FormInstance } from 'element-plus' |
|
|
import type { FormInstance } from 'element-plus' |
|
|
import { addSixSpeed, editSixSpeed, getSixSpeedInfo } from '@/app/api/six_speed' |
|
|
import { addSixSpeed, editSixSpeed, getSixSpeedInfo, getWithPersonnelList, getWithCustomerResourcesList } from '@/app/api/six_speed' |
|
|
|
|
|
|
|
|
let showDialog = ref(false) |
|
|
let showDialog = ref(false) |
|
|
const loading = ref(false) |
|
|
const loading = ref(false) |
|
|
@ -163,20 +119,18 @@ const loading = ref(false) |
|
|
* 表单数据 |
|
|
* 表单数据 |
|
|
*/ |
|
|
*/ |
|
|
const initialFormData = { |
|
|
const initialFormData = { |
|
|
id: '', |
|
|
id: '', |
|
|
purchase_power: '', |
|
|
purchase_power: '', |
|
|
concept_awareness: '', |
|
|
concept_awareness: '', |
|
|
preferred_class_time: '', |
|
|
preferred_class_time: '', |
|
|
distance: '', |
|
|
distance: '', |
|
|
communication: '', |
|
|
communication: '', |
|
|
promised_visit_time: '', |
|
|
promised_visit_time: '', |
|
|
actual_visit_time: '', |
|
|
actual_visit_time: '', |
|
|
call_intent: '', |
|
|
call_intent: '', |
|
|
first_visit_status: '', |
|
|
first_visit_status: '', |
|
|
second_visit_status: '', |
|
|
second_visit_status: '', |
|
|
is_closed: '', |
|
|
is_closed: '', |
|
|
staff_id: '', |
|
|
|
|
|
resource_id: '', |
|
|
|
|
|
} |
|
|
} |
|
|
const formData: Record<string, any> = reactive({ ...initialFormData }) |
|
|
const formData: Record<string, any> = reactive({ ...initialFormData }) |
|
|
|
|
|
|
|
|
@ -184,79 +138,63 @@ const formRef = ref<FormInstance>() |
|
|
|
|
|
|
|
|
// 表单验证规则 |
|
|
// 表单验证规则 |
|
|
const formRules = computed(() => { |
|
|
const formRules = computed(() => { |
|
|
return { |
|
|
return { |
|
|
purchase_power: [ |
|
|
purchase_power: [ |
|
|
{ |
|
|
{ required: true, message: t('purchasePowerPlaceholder'), trigger: 'blur' }, |
|
|
required: true, |
|
|
|
|
|
message: t('purchasePowerPlaceholder'), |
|
|
] |
|
|
trigger: 'blur', |
|
|
, |
|
|
}, |
|
|
|
|
|
], |
|
|
|
|
|
concept_awareness: [ |
|
|
concept_awareness: [ |
|
|
{ |
|
|
{ required: true, message: t('conceptAwarenessPlaceholder'), trigger: 'blur' }, |
|
|
required: true, |
|
|
|
|
|
message: t('conceptAwarenessPlaceholder'), |
|
|
] |
|
|
trigger: 'blur', |
|
|
, |
|
|
}, |
|
|
|
|
|
], |
|
|
|
|
|
preferred_class_time: [ |
|
|
preferred_class_time: [ |
|
|
{ |
|
|
{ required: true, message: t('preferredClassTimePlaceholder'), trigger: 'blur' }, |
|
|
required: true, |
|
|
|
|
|
message: t('preferredClassTimePlaceholder'), |
|
|
] |
|
|
trigger: 'blur', |
|
|
, |
|
|
}, |
|
|
|
|
|
], |
|
|
|
|
|
distance: [ |
|
|
distance: [ |
|
|
{ required: true, message: t('distancePlaceholder'), trigger: 'blur' }, |
|
|
{ required: true, message: t('distancePlaceholder'), trigger: 'blur' }, |
|
|
], |
|
|
|
|
|
|
|
|
] |
|
|
|
|
|
, |
|
|
communication: [ |
|
|
communication: [ |
|
|
{ |
|
|
{ required: true, message: t('communicationPlaceholder'), trigger: 'blur' }, |
|
|
required: true, |
|
|
|
|
|
message: t('communicationPlaceholder'), |
|
|
] |
|
|
trigger: 'blur', |
|
|
, |
|
|
}, |
|
|
|
|
|
], |
|
|
|
|
|
promised_visit_time: [ |
|
|
promised_visit_time: [ |
|
|
{ |
|
|
{ required: true, message: t('promisedVisitTimePlaceholder'), trigger: 'blur' }, |
|
|
required: true, |
|
|
|
|
|
message: t('promisedVisitTimePlaceholder'), |
|
|
] |
|
|
trigger: 'blur', |
|
|
, |
|
|
}, |
|
|
|
|
|
], |
|
|
|
|
|
actual_visit_time: [ |
|
|
actual_visit_time: [ |
|
|
{ |
|
|
{ required: true, message: t('actualVisitTimePlaceholder'), trigger: 'blur' }, |
|
|
required: true, |
|
|
|
|
|
message: t('actualVisitTimePlaceholder'), |
|
|
] |
|
|
trigger: 'blur', |
|
|
, |
|
|
}, |
|
|
|
|
|
], |
|
|
|
|
|
call_intent: [ |
|
|
call_intent: [ |
|
|
{ required: true, message: t('callIntentPlaceholder'), trigger: 'blur' }, |
|
|
{ required: true, message: t('callIntentPlaceholder'), trigger: 'blur' }, |
|
|
], |
|
|
|
|
|
|
|
|
] |
|
|
|
|
|
, |
|
|
first_visit_status: [ |
|
|
first_visit_status: [ |
|
|
{ |
|
|
{ required: true, message: t('firstVisitStatusPlaceholder'), trigger: 'blur' }, |
|
|
required: true, |
|
|
|
|
|
message: t('firstVisitStatusPlaceholder'), |
|
|
] |
|
|
trigger: 'blur', |
|
|
, |
|
|
}, |
|
|
|
|
|
], |
|
|
|
|
|
second_visit_status: [ |
|
|
second_visit_status: [ |
|
|
{ |
|
|
{ required: true, message: t('secondVisitStatusPlaceholder'), trigger: 'blur' }, |
|
|
required: true, |
|
|
|
|
|
message: t('secondVisitStatusPlaceholder'), |
|
|
] |
|
|
trigger: 'blur', |
|
|
, |
|
|
}, |
|
|
|
|
|
], |
|
|
|
|
|
is_closed: [ |
|
|
is_closed: [ |
|
|
{ required: true, message: t('isClosedPlaceholder'), trigger: 'blur' }, |
|
|
{ required: true, message: t('isClosedPlaceholder'), trigger: 'blur' }, |
|
|
], |
|
|
|
|
|
staff_id: [ |
|
|
] |
|
|
{ required: true, message: t('staffIdPlaceholder'), trigger: 'blur' }, |
|
|
, |
|
|
], |
|
|
} |
|
|
resource_id: [ |
|
|
|
|
|
{ required: true, message: t('resourceIdPlaceholder'), trigger: 'blur' }, |
|
|
|
|
|
], |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
const emit = defineEmits(['complete']) |
|
|
const emit = defineEmits(['complete']) |
|
|
@ -266,93 +204,120 @@ const emit = defineEmits(['complete']) |
|
|
* @param formEl |
|
|
* @param formEl |
|
|
*/ |
|
|
*/ |
|
|
const confirm = async (formEl: FormInstance | undefined) => { |
|
|
const confirm = async (formEl: FormInstance | undefined) => { |
|
|
if (loading.value || !formEl) return |
|
|
if (loading.value || !formEl) return |
|
|
let save = formData.id ? editSixSpeed : addSixSpeed |
|
|
let save = formData.id ? editSixSpeed : addSixSpeed |
|
|
|
|
|
|
|
|
await formEl.validate(async (valid) => { |
|
|
await formEl.validate(async (valid) => { |
|
|
if (valid) { |
|
|
if (valid) { |
|
|
loading.value = true |
|
|
loading.value = true |
|
|
|
|
|
|
|
|
let data = formData |
|
|
let data = formData |
|
|
|
|
|
|
|
|
save(data) |
|
|
save(data).then(res => { |
|
|
.then((res) => { |
|
|
loading.value = false |
|
|
loading.value = false |
|
|
showDialog.value = false |
|
|
showDialog.value = false |
|
|
emit('complete') |
|
|
emit('complete') |
|
|
}).catch(err => { |
|
|
}) |
|
|
loading.value = false |
|
|
.catch((err) => { |
|
|
}) |
|
|
loading.value = false |
|
|
} |
|
|
}) |
|
|
}) |
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 获取字典数据 |
|
|
// 获取字典数据 |
|
|
|
|
|
let purchase_powerList = ref([]) |
|
|
|
|
|
const purchase_powerDictList = async () => { |
|
|
|
|
|
purchase_powerList.value = await (await useDictionary('customer_purchasing_power')).data.dictionary |
|
|
|
|
|
} |
|
|
|
|
|
purchase_powerDictList(); |
|
|
|
|
|
watch(() => purchase_powerList.value, () => { formData.purchase_power = purchase_powerList.value[0].value }) |
|
|
|
|
|
let concept_awarenessList = ref([]) |
|
|
|
|
|
const concept_awarenessDictList = async () => { |
|
|
|
|
|
concept_awarenessList.value = await (await useDictionary('cognitive_concept')).data.dictionary |
|
|
|
|
|
} |
|
|
|
|
|
concept_awarenessDictList(); |
|
|
|
|
|
watch(() => concept_awarenessList.value, () => { formData.concept_awareness = concept_awarenessList.value[0].value }) |
|
|
|
|
|
let call_intentList = ref([]) |
|
|
|
|
|
const call_intentDictList = async () => { |
|
|
|
|
|
call_intentList.value = await (await useDictionary('preliminarycustomerintention')).data.dictionary |
|
|
|
|
|
} |
|
|
|
|
|
call_intentDictList(); |
|
|
|
|
|
watch(() => call_intentList.value, () => { formData.call_intent = call_intentList.value[0].value }) |
|
|
|
|
|
let is_closedList = ref([]) |
|
|
|
|
|
const is_closedDictList = async () => { |
|
|
|
|
|
is_closedList.value = await (await useDictionary('global_true_or_false')).data.dictionary |
|
|
|
|
|
} |
|
|
|
|
|
is_closedDictList(); |
|
|
|
|
|
watch(() => is_closedList.value, () => { formData.is_closed = is_closedList.value[0].value }) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const staffIdList = ref([] as any[]) |
|
|
|
|
|
const setStaffIdList = async () => { |
|
|
|
|
|
staffIdList.value = await (await getWithPersonnelList({})).data |
|
|
|
|
|
} |
|
|
|
|
|
setStaffIdList() |
|
|
|
|
|
const resourceIdList = ref([] as any[]) |
|
|
|
|
|
const setResourceIdList = async () => { |
|
|
|
|
|
resourceIdList.value = await (await getWithCustomerResourcesList({})).data |
|
|
|
|
|
} |
|
|
|
|
|
setResourceIdList() |
|
|
const setFormData = async (row: any = null) => { |
|
|
const setFormData = async (row: any = null) => { |
|
|
Object.assign(formData, initialFormData) |
|
|
Object.assign(formData, initialFormData) |
|
|
loading.value = true |
|
|
loading.value = true |
|
|
if (row) { |
|
|
if(row){ |
|
|
const data = await (await getSixSpeedInfo(row.id)).data |
|
|
const data = await (await getSixSpeedInfo(row.id)).data |
|
|
if (data) |
|
|
if (data) Object.keys(formData).forEach((key: string) => { |
|
|
Object.keys(formData).forEach((key: string) => { |
|
|
if (data[key] != undefined) formData[key] = data[key] |
|
|
if (data[key] != undefined) formData[key] = data[key] |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
loading.value = false |
|
|
loading.value = false |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 验证手机号格式 |
|
|
// 验证手机号格式 |
|
|
const mobileVerify = (rule: any, value: any, callback: any) => { |
|
|
const mobileVerify = (rule: any, value: any, callback: any) => { |
|
|
if (value && !/^1[3-9]\d{9}$/.test(value)) { |
|
|
if (value && !/^1[3-9]\d{9}$/.test(value)) { |
|
|
callback(new Error(t('generateMobile'))) |
|
|
callback(new Error(t('generateMobile'))) |
|
|
} else { |
|
|
} else { |
|
|
callback() |
|
|
callback() |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 验证身份证号 |
|
|
// 验证身份证号 |
|
|
const idCardVerify = (rule: any, value: any, callback: any) => { |
|
|
const idCardVerify = (rule: any, value: any, callback: any) => { |
|
|
if ( |
|
|
if (value && !/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(value)) { |
|
|
value && |
|
|
callback(new Error(t('generateIdCard'))) |
|
|
!/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test( |
|
|
} else { |
|
|
value |
|
|
callback() |
|
|
) |
|
|
} |
|
|
) { |
|
|
|
|
|
callback(new Error(t('generateIdCard'))) |
|
|
|
|
|
} else { |
|
|
|
|
|
callback() |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 验证邮箱号 |
|
|
// 验证邮箱号 |
|
|
const emailVerify = (rule: any, value: any, callback: any) => { |
|
|
const emailVerify = (rule: any, value: any, callback: any) => { |
|
|
if (value && !/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/.test(value)) { |
|
|
if (value && !/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/.test(value)) { |
|
|
callback(new Error(t('generateEmail'))) |
|
|
callback(new Error(t('generateEmail'))) |
|
|
} else { |
|
|
} else { |
|
|
callback() |
|
|
callback() |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 验证请输入整数 |
|
|
// 验证请输入整数 |
|
|
const numberVerify = (rule: any, value: any, callback: any) => { |
|
|
const numberVerify = (rule: any, value: any, callback: any) => { |
|
|
if (!Number.isInteger(value)) { |
|
|
if (!Number.isInteger(value)) { |
|
|
callback(new Error(t('generateNumber'))) |
|
|
callback(new Error(t('generateNumber'))) |
|
|
} else { |
|
|
} else { |
|
|
callback() |
|
|
callback() |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
defineExpose({ |
|
|
defineExpose({ |
|
|
showDialog, |
|
|
showDialog, |
|
|
setFormData, |
|
|
setFormData |
|
|
}) |
|
|
}) |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<style lang="scss" scoped></style> |
|
|
<style lang="scss" scoped></style> |
|
|
<style lang="scss"> |
|
|
<style lang="scss"> |
|
|
.diy-dialog-wrap .el-form-item__label { |
|
|
.diy-dialog-wrap .el-form-item__label{ |
|
|
height: auto !important; |
|
|
height: auto !important; |
|
|
} |
|
|
} |
|
|
</style> |
|
|
</style> |
|
|
|