bug修改

This commit is contained in:
=
2025-10-10 08:59:32 +08:00
parent 761ade5916
commit dc55b0701d
25 changed files with 323 additions and 128 deletions
@@ -589,6 +589,15 @@ layout("/layouts/platform_h5.html"){
return false;
}
// 银行卡号格式验证
if (this.formData.bankCardNumber) {
const bankCardRegex = /^([1-9]{1})(\d{15}|\d{18})$/;
if (!bankCardRegex.test(this.formData.bankCardNumber)) {
this.$toast.fail("请输入正确的银行卡号");
return false;
}
}
if (!this.formData.bankOfDeposit) {
this.$toast.fail("请填写开户行");
return false;
@@ -604,6 +613,14 @@ layout("/layouts/platform_h5.html"){
this.$toast.fail("请填写慰问对象联系方式");
return false;
}
// 慰问对象手机号验证
if (this.formData.condolenceMobile) {
const mobileRegex = /^1[3-9]\d{9}$/;
if (!mobileRegex.test(this.formData.condolenceMobile)) {
this.$toast.fail("请输入正确的慰问对象手机号码");
return false;
}
}
if (!this.formData.condolenceType) {
this.$toast.fail("请选择慰问类型");
return false;
@@ -34,13 +34,13 @@ const UNION_REIMBURSE_INFO = {
<van-cell title="联系方式" v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1'">{{ viewData.condolenceMobile }}</van-cell>
<van-cell title="慰问类型" v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1'">{{ viewData.typeName }}</van-cell>
<van-cell title="慰问金额" v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1'">{{ viewData.money }}</van-cell>
<van-cell title="慰问时间" v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1'">{{ viewData.condolenceTime }}</van-cell>
<van-cell title="慰问时间" v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1'">{{ formatDate(viewData.condolenceTime) }}</van-cell>
<van-cell title="活动名称" v-if="viewData.reimburseProject !== 'UNION_REIMBURSE_PROJECT_1'">{{ viewData.activityName }}</van-cell>
<van-cell title="活动类型" v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_2'">{{ viewData.activityType }}</van-cell>
<van-cell title="活动人数" v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_2'">{{ viewData.activityNumber }}</van-cell>
<van-cell title="活动地点" v-if="viewData.reimburseProject !== 'UNION_REIMBURSE_PROJECT_1'">{{ viewData.activityPlace }}</van-cell>
<van-cell title="报销金额" v-if="viewData.reimburseProject !== 'UNION_REIMBURSE_PROJECT_1'">{{ viewData.money }}</van-cell>
<van-cell title="活动时间" v-if="viewData.reimburseProject !== 'UNION_REIMBURSE_PROJECT_1'">{{ viewData.activityTime }}</van-cell>
<van-cell title="活动时间" v-if="viewData.reimburseProject !== 'UNION_REIMBURSE_PROJECT_1'">{{ formatDate(viewData.activityTime) }}</van-cell>
<van-cell title="发票张数" v-if="viewData.reimburseType === 'UNION_REIMBURSE_TYPE_1'">{{ viewData.invoiceNumber }}</van-cell>
<van-cell title="发票号码" v-if="viewData.reimburseType === 'UNION_REIMBURSE_TYPE_1'">{{ viewData.invoice }}</van-cell>
<van-cell title="支付内容">{{ viewData.paymentNotes }}</van-cell>
@@ -111,6 +111,31 @@ const UNION_REIMBURSE_INFO = {
this.getInfo()
this.getDoneTasks()
},
// 添加日期格式化方法
formatDate(date) {
if (!date) return '';
// 如果已经是 yyyy-MM-dd 格式,直接返回
if (typeof date === 'string' && /^\d{4}-\d{2}-\d{2}/.test(date)) {
// 如果包含时间,只取日期部分
if (date.length > 10) {
return date.substring(0, 10);
}
return date;
}
// 否则转换为 yyyy-MM-dd 格式
try {
const d = new Date(date);
if (isNaN(d.getTime())) {
return date;
}
const year = d.getFullYear();
const month = String(d.getMonth() + 1).padStart(2, '0');
const day = String(d.getDate()).padStart(2, '0');
return year + '-' + month + '-' + day;
} catch (e) {
return date;
}
},
// 关闭
onClose(){
this.visible = false
@@ -267,9 +267,9 @@ layout("/layouts/platform_h5.html"){
if (!this.formData.retireFiles || this.formData.retireFiles.length === 0) {
errors.push('请上传退休证');
}
if (!this.formData.sign) {
errors.push('请签字');
}
// if (!this.formData.sign) {
// errors.push('请签字');
// }
if (!this.formData.declarationAgreed) {
errors.push('请阅读并同意声明');
}
@@ -407,7 +407,22 @@ layout("/layouts/platform_h5.html"){
},
async created() {
await this.init();
// 页面初始化完成后立即检查退休状态和申请状态
const isRetired = await this.checkRetirementStatus();
if (!isRetired) {
this.$toast.fail('您不是退休人员,无法申请此项福利');
return false;
}
if (!this.bizId) { // 如果不是编辑已有记录,则检查是否已申请
const isApplied = await this.checkUserApplication();
if (isApplied) {
this.$toast.fail('您已经提交过申请,不能重复申请');
}
}
}
})
</script>
@@ -416,6 +416,14 @@ layout("/layouts/platform_h5.html"){
if (!this.formData.childrenBirthday) {
errors.push('请选择子女出生日期');
}
// 添加时间顺序验证
if (this.formData.startTime && this.formData.endTime) {
const startDate = new Date(this.formData.startTime);
const endDate = new Date(this.formData.endTime);
if (endDate < startDate) {
errors.push('休假结束时间不能早于开始时间');
}
}
return errors;
},
@@ -11,7 +11,7 @@
</dict-tag></van-cell>
<van-cell title="入学年份">{{ viewData.childrenYear }}</van-cell>
<van-cell title="身份证号">{{ viewData.childrenIdCard }}</van-cell>
<van-cell title="出生日期">{{ viewData.childrenBirthday }}</van-cell>
<van-cell title="出生日期">{{ formatDate(viewData.childrenBirthday) }}</van-cell>
<van-cell title="性别">{{ viewData.childrenSex }}</van-cell>
<van-cell title="国籍">{{ viewData.childrenCountry }}</van-cell>
<van-cell title="就读学校">{{ viewData.childrenCurrentSchool }}</van-cell>
@@ -50,6 +50,31 @@
this.visible = true
this.getInfo()
},
// 添加日期格式化方法
formatDate(date) {
if (!date) return '';
// 如果已经是 yyyy-MM-dd 格式,直接返回
if (typeof date === 'string' && /^\d{4}-\d{2}-\d{2}/.test(date)) {
// 如果包含时间,只取日期部分
if (date.length > 10) {
return date.substring(0, 10);
}
return date;
}
// 否则转换为 yyyy-MM-dd 格式
try {
const d = new Date(date);
if (isNaN(d.getTime())) {
return date;
}
const year = d.getFullYear();
const month = String(d.getMonth() + 1).padStart(2, '0');
const day = String(d.getDate()).padStart(2, '0');
return year + '-' + month + '-' + day;
} catch (e) {
return date;
}
},
// 关闭
onClose(){
this.visible = false
@@ -46,8 +46,13 @@ layout("/layouts/platform_h5.html"){
show-toolbar
></van-picker>
</van-popup>
<van-field label="身份证号" v-model="formData.childrenIdCard" placeholder="请输入身份证号"></van-field>
<van-field
label="身份证号"
v-model="formData.childrenIdCard"
placeholder="请输入身份证号"
:rules="formRules.childrenIdCard"
required
></van-field> <van-field
label="出生年月"
v-model="formData.childrenBirthday"
placeholder="请选择出生年月"
@@ -96,16 +101,25 @@ layout("/layouts/platform_h5.html"){
<van-field label="监护人1" v-model="formData.guardianUserName1" readonly placeholder="读取信息中心数据"></van-field>
<van-field label="工号" v-model="formData.guardianLoginName1" readonly placeholder="读取信息中心数据"></van-field>
<van-field label="手机号码" v-model="formData.guardianMobile1" readonly placeholder="读取信息中心数据"></van-field>
<van-field
label="手机号码"
v-model="formData.guardianMobile1"
readonly
placeholder="读取信息中心数据"
:rules="formRules.guardianMobile1"
></van-field>
<van-field label="所在单位" v-model="formData.guardianUnitName1" readonly placeholder="读取信息中心数据"></van-field>
<van-field
label="监护人2"
v-model="formData.guardianUserName2"
placeholder="请输入监护人姓名"
></van-field>
<van-field label="工号" v-model="formData.guardianLoginName2" placeholder="没有则不填" ></van-field>
<van-field label="手机号码" v-model="formData.guardianMobile2" placeholder="请输入手机号码"></van-field>
<van-field
label="手机号码"
v-model="formData.guardianMobile2"
placeholder="请输入手机号码"
></van-field>
<van-field label="所在单位" v-model="formData.guardianUnitName2" placeholder="请输入所在单位"></van-field>
<van-field
label="备注"
@@ -190,28 +204,41 @@ layout("/layouts/platform_h5.html"){
currentDate: new Date(), // 添加这一行
minDate: new Date(1900, 0, 1),
maxDate: new Date(),
formRules: {
childrenIdCard: [
{ pattern: /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/, message: '请输入正确的身份证号码' }
],
guardianMobile1: [
{ pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号码' }
],
}
}
},
methods: {
onSave() {
this.$dialog.confirm({
title: "提示",
message: "您确定保存吗?"
}).then(() => {
// 创建提交数据的副本
const submitData = {...this.formData};
// 如果有年级代码值,则使用代码值提交
if (this.formData.childrenGradeCode) {
submitData.childrenGrade = this.formData.childrenGradeCode;
}
this.$axios.post("/platform/childManage/write/save", { data: JSON.stringify(submitData) }).then(res => {
if (res.code === 0) {
this.$toast(res.msg)
this.$pjaxReplace('/platform/childManage/mine/h5')
// 先进行表单验证
this.$refs.formRef.validate().then(() => {
this.$dialog.confirm({
title: "提示",
message: "您确定保存吗?"
}).then(() => {
// 创建提交数据的副本
const submitData = {...this.formData};
// 如果有年级代码值,则使用代码值提交
if (this.formData.childrenGradeCode) {
submitData.childrenGrade = this.formData.childrenGradeCode;
}
this.$axios.post("/platform/childManage/write/save", { data: JSON.stringify(submitData) }).then(res => {
if (res.code === 0) {
this.$toast(res.msg)
this.$pjaxReplace('/platform/childManage/mine/h5')
}
})
})
})
}).catch(() => {
// 验证失败,Vant 会自动显示错误信息
});
},
onChildrenGradeConfirm(o) {
// 显示名称给用户看