省级互助保障
This commit is contained in:
@@ -18,7 +18,7 @@ layout("/layouts/platform_h5.html"){
|
||||
<van-field label="职工姓名" v-model="formData.userName" placeholder="从信息中心获取"
|
||||
readonly></van-field>
|
||||
<van-field label="性别" v-model="formData.sex" placeholder="从信息中心获取" readonly></van-field>
|
||||
<van-field label="出生年月" v-model="formData.birthday" placeholder="从信息中心获取"
|
||||
<van-field label="出生年月" v-model="formattedBirthday" placeholder="从信息中心获取"
|
||||
readonly></van-field>
|
||||
<van-field label="原工作单位" v-model="formData.unitName" placeholder="从信息中心获取"
|
||||
readonly></van-field>
|
||||
@@ -155,8 +155,8 @@ layout("/layouts/platform_h5.html"){
|
||||
// 性别选择器
|
||||
showLoverSexPicker: false,
|
||||
loverSexColumns: [
|
||||
{ value: '男性', text: '男性' },
|
||||
{ value: '女性', text: '女性' }
|
||||
{ value: '男', text: '男' },
|
||||
{ value: '女', text: '女' }
|
||||
],
|
||||
// 日期选择器
|
||||
showDatePopup: false,
|
||||
@@ -165,8 +165,39 @@ layout("/layouts/platform_h5.html"){
|
||||
maxDate: new Date(2040, 11, 31)
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
// 格式化出生年月显示
|
||||
formattedBirthday() {
|
||||
return this.formatDate(this.formData.birthday);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 添加日期格式化方法
|
||||
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;
|
||||
}
|
||||
},
|
||||
|
||||
// 显示日期选择器
|
||||
showDatePicker(fieldName) {
|
||||
this.currentDatePickerField = fieldName;
|
||||
@@ -175,7 +206,7 @@ layout("/layouts/platform_h5.html"){
|
||||
|
||||
// 日期确认事件
|
||||
onDateConfirm(value) {
|
||||
const formattedDate = this.$moment(value).format("YYYY-MM-DD");
|
||||
const formattedDate = this.formatDate(value);
|
||||
this.$set(this.formData, this.currentDatePickerField, formattedDate);
|
||||
this.showDatePopup = false;
|
||||
},
|
||||
@@ -351,6 +382,13 @@ layout("/layouts/platform_h5.html"){
|
||||
this.$axios.post("/platform/dsznfmtx/apply/findOne", {id: this.bizId}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.formData = res.data;
|
||||
// 格式化所有日期字段
|
||||
const dateFields = ['birthday', 'retireTime', 'marryTime', 'childrenBirthday', 'getCertificateTime'];
|
||||
dateFields.forEach(field => {
|
||||
if (this.formData[field]) {
|
||||
this.$set(this.formData, field, this.formatDate(this.formData[field]));
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
} else {
|
||||
@@ -363,7 +401,7 @@ layout("/layouts/platform_h5.html"){
|
||||
this.$set(this.formData, "unionId", user.union.id)
|
||||
this.$set(this.formData, "unionName", user.union.name)
|
||||
this.$set(this.formData, "sex", user.sex)
|
||||
this.$set(this.formData, "birthday", user.birthday)
|
||||
this.$set(this.formData, "birthday", this.formatDate(user.birthday))
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -6,15 +6,15 @@ const DSZNFMTX_INFO = {
|
||||
<van-cell-group title="基本信息">
|
||||
<van-cell title="职工姓名">{{ viewData.userName }}</van-cell>
|
||||
<van-cell title="性别">{{ viewData.sex }}</van-cell>
|
||||
<van-cell title="出生年月">{{ viewData.birthday }}</van-cell>
|
||||
<van-cell title="出生年月">{{ formatDate(viewData.birthday) }}</van-cell>
|
||||
<van-cell title="原工作单位">{{ viewData.unitName }}</van-cell>
|
||||
<van-cell title="退休时间">{{ viewData.retireTime }}</van-cell>
|
||||
<van-cell title="退休时间">{{ formatDate(viewData.retireTime) }}</van-cell>
|
||||
<van-cell title="爱人姓名">{{ viewData.loverName }}</van-cell>
|
||||
<van-cell title="性别">{{ viewData.loverSex }}</van-cell>
|
||||
<van-cell title="工作单位">{{ viewData.loverUnitName }}</van-cell>
|
||||
<van-cell title="结婚日期">{{ viewData.loverBirthday }}</van-cell>
|
||||
<van-cell title="子女出生日">{{ viewData.loverBirthday }}</van-cell>
|
||||
<van-cell title="领独生子女光时间">{{ viewData.getCertificateTime }}</van-cell>
|
||||
<van-cell title="结婚日期">{{ formatDate(viewData.marryTime) }}</van-cell>
|
||||
<van-cell title="子女出生日">{{ formatDate(viewData.childrenBirthday) }}</van-cell>
|
||||
<van-cell title="领独生子女光时间">{{ formatDate(viewData.getCertificateTime) }}</van-cell>
|
||||
<van-cell title="独生子女光荣证号">{{ viewData.childrenGraceNumber }}</van-cell>
|
||||
<van-cell title="办证机关">{{ viewData.office }}</van-cell>
|
||||
<van-cell title="奖励金额">{{ viewData.bonus }}</van-cell>
|
||||
@@ -39,7 +39,7 @@ const DSZNFMTX_INFO = {
|
||||
{{ task.ext.initiatorName}}({{task.ext.initiatorAccount}})
|
||||
</van-cell>
|
||||
<van-cell title="申请时间">
|
||||
{{ task.finishTime}}
|
||||
{{ formatDate(task.finishTime) }}
|
||||
</van-cell>
|
||||
<van-cell title="办理结果">
|
||||
<dict-tag :options="dict.type.PROCESS_TASK_SUBMIT_TYPE"
|
||||
@@ -51,7 +51,7 @@ const DSZNFMTX_INFO = {
|
||||
{{ task.taskFormData.userName}}({{task.taskFormData.loginName}})
|
||||
</van-cell>
|
||||
<van-cell title="办理时间">
|
||||
{{ task.finishTime}}
|
||||
{{ formatDate(task.finishTime) }}
|
||||
</van-cell>
|
||||
<van-cell title="办理结果">
|
||||
<dict-tag :options="dict.type.PROCESS_TASK_SUBMIT_TYPE"
|
||||
@@ -86,6 +86,32 @@ const DSZNFMTX_INFO = {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 添加日期格式化方法
|
||||
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;
|
||||
}
|
||||
},
|
||||
|
||||
onOpen(row) {
|
||||
this.row = row
|
||||
this.visible = true
|
||||
|
||||
+6
-6
@@ -173,8 +173,8 @@ layout("/layouts/platform_h5.html"){
|
||||
// 性别
|
||||
showLoverSexPicker: false,
|
||||
loverSexColumns: [
|
||||
{ value: '男性', text: '男性' },
|
||||
{ value: '女性', text: '女性' }
|
||||
{ value: '男', text: '男' },
|
||||
{ value: '女', text: '女' }
|
||||
],
|
||||
showLoverBirthdayPicker: false,
|
||||
showStartTimePicker: false,
|
||||
@@ -249,7 +249,7 @@ layout("/layouts/platform_h5.html"){
|
||||
isMale(newVal) {
|
||||
if (newVal) {
|
||||
// 男性默认设置
|
||||
this.$set(this.formData, 'loverSex', '女性');
|
||||
this.$set(this.formData, 'loverSex', '女');
|
||||
this.$set(this.formData, 'withLeave', 15);
|
||||
this.$set(this.formData, 'parentalLeave', 10);
|
||||
}
|
||||
@@ -257,7 +257,7 @@ layout("/layouts/platform_h5.html"){
|
||||
isFemale(newVal) {
|
||||
if (newVal) {
|
||||
// 女性默认设置
|
||||
this.$set(this.formData, 'loverSex', '男性');
|
||||
this.$set(this.formData, 'loverSex', '男');
|
||||
this.$set(this.formData, 'maternityLeave', 98);
|
||||
this.$set(this.formData, 'extendLeave', 60);
|
||||
}
|
||||
@@ -561,7 +561,7 @@ layout("/layouts/platform_h5.html"){
|
||||
// 根据性别设置默认值
|
||||
if (this.isMale) {
|
||||
// 男性默认设置
|
||||
this.$set(this.formData, 'loverSex', '女性');
|
||||
this.$set(this.formData, 'loverSex', '女');
|
||||
this.$set(this.formData, 'withLeave', 15);
|
||||
this.$set(this.formData, 'parentalLeave', 10);
|
||||
// 男性默认产假和延长假为0
|
||||
@@ -569,7 +569,7 @@ layout("/layouts/platform_h5.html"){
|
||||
this.$set(this.formData, 'extendLeave', 0);
|
||||
} else if (this.isFemale) {
|
||||
// 女性默认设置
|
||||
this.$set(this.formData, 'loverSex', '男性');
|
||||
this.$set(this.formData, 'loverSex', '男');
|
||||
this.$set(this.formData, 'maternityLeave', 98);
|
||||
this.$set(this.formData, 'extendLeave', 60);
|
||||
// 女性默认陪产假和育儿假为0
|
||||
|
||||
Reference in New Issue
Block a user