Files
zhgh_zjitc/src/main/resources/views/mobile/therapyRecuperation/baseManagement.html
T
2025-05-30 16:13:21 +08:00

977 lines
39 KiB
HTML

<!--#
layout("/mobile/platform.html"){
#-->
<style>
.container img {
background-size: contain;
width: 100%;
height: auto;
margin: 5px auto;
display: block;
}
.header {
padding: 20px;
}
.content {
line-height: 26px;
padding: 0px 10px 56px 10px;
}
.title {
font-weight: bold;
font-size: 19px;
color: #505050;
margin-bottom: 10px;
}
.van-divider {
border-color: grey;
margin: 0;
}
.van-skeleton {
padding: 20px;
}
.van-skeleton__content {
height: 600px;
padding-top: 60px;
}
.van-skeleton__row, .van-skeleton__title {
height: 30px;
}
.footer {
background-color: white;
position: fixed;
bottom: 0;
width: 100%;
height: 60px;
display: flex;
justify-content: space-evenly;
align-items: center;
left: 0;
}
.footer .van-button {
height: 34px;
border-radius: 6px;
width: 90% !important;
}
.submitButton .van-button {
height: 34px;
border-radius: 6px;
width: 90% !important;
margin: 0 10px;
}
.family_join {
background-color: #ff976a;
color: white;
}
.join {
background-color: #0e78c5;
color: white;
}
.joinPopup {
width: 100%;
height: 100%;
background-color: #f6f7f9;
}
.join_content {
padding: 20px;
height: calc(100% - 40px - 46px);
overflow-y: auto;
}
.join_submit {
width: 90% !important;
}
.van-doc-card {
background-color: #fff;
border-radius: 6px;
box-shadow: 0 8px 12px #ebedf0;
line-height: 20px;
position: relative;
}
.van-card-header {
padding: 14px 20px;
border-bottom: 1px solid #ebeef5;
box-sizing: border-box;
color: #0e78c5;
font-weight: bold;
}
.van-card-body {
padding: 0px 10px 0px 10px
}
.van-doc-card > div:first-child {
border: 2px #0e78c5 solid;
width: 26px;
border-radius: 6px;
position: absolute;
top: 0;
left: 20px;
}
.van-cell {
padding: 8px 16px;
}
.van-tabs__wrap {
margin: 6px;
}
.van-tabs__nav--card {
border: none;
}
.van-tabs__nav--card .van-tab.van-tab--active {
border-radius: 6px;
}
.van-tabs__nav--card .van-tab {
border-right: 0 !important;
}
.top_icon {
position: fixed;
bottom: 80px;
right: 20px;
}
.van-field__control {
text-overflow: ellipsis;
}
.list-card {
width: auto;
}
.companionList_empty_text {
text-align: center;
padding: 10px 0px;
font-size: 16px;
color: grey;
}
.header div span {
color: grey;
}
.header :last-child {
font-size: 14px;
}
.van-empty {
position: relative;
transform: none;
top: 0;
left: 0;
background-color: transparent;
height: calc(100vh - 46px - 153px - 60px);
}
.submitButton {
background-color: white !important;
width: 100%;
height: 60px;
display: flex;
justify-content: space-evenly;
align-items: center;
}
.van-image-preview img {
background-color: white;
}
select-checkbox {
position: absolute;
right: 0;
}
.select-popup-footer {
margin-top: 10px;
padding: 10px;
display: flex;
justify-content: space-between;
}
.btn {
display: flex;
justify-content: space-between;
background-color: #fff;
}
.cancle {
font-size: 18px;
}
.confirm {
font-size: 18px;
}
.van-tag {
color: white !important;
}
.cal_middle {
color: #ee0a24;
background-color: #FDE6E9;
}
.cal_end {
color: #fff;
background-color: #ee0a24;
border-radius: 0 4px 4px 0;
}
.van-calendar__day--middle::after {
background-color: transparent;
}
.pdf_div {
padding-bottom: 12px;
height: calc(100vh - 46px - 60px - 151px - 50px);
overflow-y: auto;
}
.backTop {
display: none !important;
}
</style>
<div id="app" v-cloak>
<van-sticky>
<van-nav-bar @click-left="pageBack" fixed left-arrow placeholder title="职工疗休养-酒店介绍"></van-nav-bar>
</van-sticky>
<!--线路详情-->
<van-skeleton title :loading="skeLoading" :row="12">
<div class="container">
<div class="header">
<div class="title">
<!--<van-tag size="large" color="#1867b0" style="color: white;position: relative; top: -2px">
{{baseData.regionalNature}}
</van-tag>-->
{{baseData.baseName}}
</div>
<div style="margin-top: 10px">
<div>
<span class="line_label">&emsp;&emsp;域:</span>
{{baseData.regionalNature}}
</div>
<div>
<span>创建模式:</span>
{{baseData.createMode === 1 ? '校工会' : '分工会'}}
</div>
<div>
<span>报名时间:</span>
{{moment(configData.fragmentStartTime).format('YYYY-MM-DD HH:mm') + ' ~ ' +
moment(configData.fragmentEndTime).format('YYYY-MM-DD HH:mm')}}
</div>
<div>
<span>活动时间:</span>
{{moment(configData.fragmentPlayStartTime).format('YYYY-MM-DD HH:mm') + ' ~ ' +
moment(configData.fragmentPlayEndTime).format('YYYY-MM-DD HH:mm')}}
</div>
</div>
</div>
<van-divider :style="{ color: 'orange', fontSize: '12px' }">上下滑动翻页,单击查看,再单击返回</van-divider>
<div v-if="isPdf" v-html="baseData.content" class="content"></div>
<div v-else id="demo" class="pdf_div"></div>
</div>
</van-skeleton>
<!--置顶图标-->
<image v-if="btnFlag" @click="backTop" src="/assets/mobile/svg/therapyRecuperation/top.svg"
class="top_icon"></image>
<!--底部报名按钮-->
<div class="footer" v-if="fromUrlByMy == 'find'">
<van-button @click="join"
class="join">我的填报信息
</van-button>
</div>
<div class="footer" v-else>
<template v-if="baseData.isNormal == 0 && baseData.isNormalFalse > 0">
<van-button @click="join" class="join">我要报名</van-button>
</template>
<template v-else>
<van-button v-if="moment().unix() >= moment(configData.fragmentStartTime).unix() && moment().unix() <= moment(configData.fragmentEndTime).unix()"
@click="join" class="join">我要报名</van-button>
<van-button v-if="moment().unix() > moment(configData.fragmentEndTime).unix()" class="join">报名结束</van-button>
</template>
</div>
<!--报名弹出框-->
<van-popup v-model:show="joinPopup" position="right" class="joinPopup">
<van-nav-bar @click-left="joinPopup = false" fixed left-arrow placeholder title="疗休养报名"></van-nav-bar>
<div class="join_content">
<van-form :disabled="fromUrlByMy == 'find'" @submit="joinSubmit">
<!--基础信息-->
<div class="van-doc-card" style="margin-bottom: 16px">
<div></div>
<div class="van-card-header">
基础信息
</div>
<div class="van-card-body">
<van-field label="姓名" readonly v-model="formData.userName"></van-field>
<van-field label="工号" readonly v-model="formData.loginName"></van-field>
<van-field label="身份证号" name="idCard" :rules="[{ required: true }]"
placeholder="请填写身份证号" v-model="formData.idCard"></van-field>
<van-field label="手机号" name="mobile" :rules="[{ required: true }]"
placeholder="请填写手机号" v-model="formData.mobile"></van-field>
<van-field label="所属工会" readonly v-model="formData.unionName"></van-field>
<van-field label="报名酒店" readonly v-model="formData.baseName"></van-field>
<van-field label="出行天数" readonly @click="if(fromUrlByMy != 'find')playDayVisible = true"
:rules="[{ required: true }]" placeholder="请选择出行天数" required
is-link v-model="formData.playDay" name="playDay"></van-field>
<van-field label="活动时间" readonly @click="specificTimeClick"
:rules="[{ required: true }]" placeholder="请选择活动时间" required
is-link v-model="formData.specificTime" name="specificTime"></van-field>
</div>
</div>
<!--床位信息-->
<!--<div class="van-doc-card" style="margin-bottom: 16px">
<div></div>
<div class="van-card-header">
床位信息(一位教职工一间)
</div>
<div class="van-card-body">
<van-field @click="if(fromUrlByMy != 'find'){self = true; roomVisible = true}" readonly is-link
label="房间" name="bedType"
placeholder="请选择房间" v-model="formData.bedInfo.bedType"
:rules="[{ required: true }]"></van-field>
&lt;!&ndash;<van-field v-if="formData.bedInfo.bedType == '标准间'" @click="self = true; bedVisible = true"
readonly is-link label="床位"
name="bedNum" placeholder="请选择床位" v-model="formData.bedInfo.bedNum"
:rules="[{ required: true }]"></van-field>
<van-field v-if="formData.bedInfo.bedType == '标准间'" :rules="[{ validator, message: '请选择是否拼房' }]"
label="是否拼房" name="validator">
<template #input>
<van-radio-group direction="horizontal" v-model="formData.bedInfo.isSleepTogether">
<van-radio :name="true" shape="square">是</van-radio>
<van-radio :name="false" shape="square">否</van-radio>
</van-radio-group>
</template>
</van-field>&ndash;&gt;
&lt;!&ndash;<van-field v-if="formData.bedInfo.bedType == '标准间' && formData.bedInfo.isSleepTogether == true"
label="意向拼房人" name="otherSleepUser" placeholder="若无拼房人,填写“无”即可"
v-model="formData.bedInfo.otherSleepUser"
:rules="[{ required: true }]"></van-field>&ndash;&gt;
</div>
</div>-->
<!--随行人信息-->
<!--<div class="van-doc-card" style="margin-bottom: 16px">
<div></div>
<div class="van-card-header"
style="display: flex; justify-content: space-between; align-items: center">
<span style="float:left;">随行人信息</span>
<div v-if="fromUrlByMy != 'find'">
<van-tag @click="delCompanion" size="large" type="primary" color="lightgrey">删除随行人</van-tag>
<van-tag @click="addCompanion" size="large" type="primary" color="#1867b0">添加随行人</van-tag>
</div>
</div>
<div v-if="formData.companionList.length > 0" class="van-card-body">
<van-tabs v-model="active" type="card" color="#0e78c5" animated>
<van-tab v-for="item, index in formData.companionList" :title="'随行人' + (index + 1)">
<van-field label="姓名" name="userName" placeholder="请填写姓名" v-model="item.userName"
:rules="[{ required: true }]"></van-field>
&lt;!&ndash;<van-field label="工号" name="loginName" placeholder="若没有工号,请忽略此项" v-model="item.loginName"></van-field>&ndash;&gt;
<van-field label="年龄" name="age" placeholder="请填写年龄" v-model="item.age" type="digit"
:rules="[{ required: true }]"></van-field>
<van-field :rules="[{ required: true, message: '请选择性别' }]" label="性别" name="validator">
<template #input>
<van-radio-group direction="horizontal" v-model="item.sex">
<van-radio name="男" shape="square">男</van-radio>
<van-radio name="女" shape="square">女</van-radio>
</van-radio-group>
</template>
</van-field>
<van-field label="身份证号" name="idCard" placeholder="请填写身份证号"
:rules="[{ required: true }]"
v-model="item.idCard"></van-field>
<van-field label="手机号" name="mobile" placeholder="请填写手机号"
:rules="[{ required: true }]" type="digit"
v-model="item.mobile"></van-field>
<van-field @click="if(fromUrlByMy != 'find')companionVisible = true" readonly is-link
label="与本人关系"
name="relation"
placeholder="随行人与本人关系" v-model="item.relation"
:rules="[{ required: true }]"></van-field>
<van-field @click="if(fromUrlByMy != 'find'){self = false; roomVisible = true}" readonly
is-link label="房间"
name="bedType" placeholder="请选择房间"
v-model="item.bedInfo.bedType"></van-field>
<div style="font-size: 8px; color:orangered; padding-left: 16px; padding-bottom: 4px">
提醒:如果跟报名人员同一房间,无须选择!
</div>
<van-field v-if="item.bedInfo.bedType == '标准间'"
@click="if(fromUrlByMy != 'find'){self = false; bedVisible = true}"
readonly is-link label="床位"
name="bedNum" placeholder="请选择床位" v-model="item.bedInfo.bedNum"></van-field>
<van-field v-if="item.bedInfo.bedType == '标准间'"
:rules="[{ validator, message: '请选择是否拼房' }]" label="是否拼房">
<template #input>
<van-radio-group direction="horizontal" v-model="item.bedInfo.isSleepTogether">
<van-radio :name="true" shape="square">是</van-radio>
<van-radio :name="false" shape="square">否</van-radio>
</van-radio-group>
</template>
</van-field>
<van-field v-if="item.bedInfo.bedType == '标准间' && item.bedInfo.isSleepTogether == true"
label="意向拼房人" name="otherSleepUser" placeholder="若无拼房人,填写“无”即可"
v-model="item.bedInfo.otherSleepUser"></van-field>
</van-tab>
</van-tabs>
</div>
<div v-if="formData.companionList.length == 0" class="companionList_empty_text">
<span>
如有随行人出行,请添加随行人
</span>
</div>
</div>-->
<div v-if="fromUrlByMy != 'find'" class="submitButton">
<van-button class="join join_submit">提交报名</van-button>
</div>
</van-form>
</div>
</van-popup>
<van-popup position="bottom" round v-model="playDayVisible">
<van-picker
title="出行天数" show-toolbar
:columns="playDayColumns"
@confirm="playDayConfirm"
@cancel="playDayVisible = false">
</van-picker>
</van-popup>
<!--房间类型弹出框-->
<van-popup position="bottom" round v-model="roomVisible">
<van-picker
title="入住房间" show-toolbar
:columns="roomColumns"
:default-index="defaultIndex"
@confirm="roomConfirm"
@cancel="roomCancel">
</van-picker>
</van-popup>
<!--床位弹出框-->
<van-popup position="bottom" round v-model="bedVisible">
<van-picker
title="床位" show-toolbar
:columns="bedColumns"
@confirm="bedConfirm"
@cancel="bedVisible = false">
</van-picker>
</van-popup>
<!--随行人关系弹出框-->
<van-popup position="bottom" round v-model="companionVisible" popup-style="bottom: 60px;">
<van-picker
title="与本人关系" show-toolbar
:columns="companionColumns"
@confirm="(value, index) => {formData.companionList[active].relation = value; companionVisible = false}"
@cancel="companionVisible = false">
</van-picker>
</van-popup>
<van-calendar type="range" v-model="timeVisible"
ref="cal" @confirm="calConfirm"
:min-date="minDate" :max-date="maxDate"
:first-day-of-week="1" :formatter="formatter"
@select="daySelect"
:max-range="lotValue" :style="{ height: '660px' }"></van-calendar>
</div>
<script>
function getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return decodeURI(r[2]);
return null;
}
let pdfh5 = null
const vue = new Vue({
el: '#app',
mixins: [mobileMixins],
data() {
return {
isPdf: false,
lotValue: 0,
minDate: new Date(2010, 0, 1),
maxDate: new Date(2010, 0, 31),
holidays: [],
timeVisible: false,
active: 0,
tarBarActive: 0,
roomColumns: ['大床房', '标准间'],
bedColumns: ['1', '2'],
companionColumns: ['配偶', '子女'],
bedVisible: false,
roomVisible: false,
companionVisible: false,
joinPopup: false,
skeLoading: true,
id: '',
baseData: {},
formData: {
userName: "${@shiro.getPrincipalProperty('username')}",
loginName: "${@shiro.getPrincipalProperty('loginname')}",
unionName: "${@shiro.getPrincipalProperty('union').getUnionname()}",
idCard: "",
mobile: "${@shiro.getPrincipalProperty('mobile')}",
lineName: '',
takePartInLineId: '',
takePartInUnionId: '',
companionList: [],
bedInfo: {},
},
self: true,
btnFlag: false,
index: 0,
scrollTop: 0,
fromUrlByMy: '',
enrollId: '',
timeArray: [],
defaultIndex: 0,
userList: [],
show: false,
result: '',
weekList: {
0: '周日',
1: '周一',
2: '周二',
3: '周三',
4: '周四',
5: '周五',
6: '周六',
},
chooseDate: [],
configData: {},
playDayVisible: false,
playDayColumns: [],
}
},
methods: {
playDayConfirm(val) {
this.formData.playDay = val.value
this.lotValue = val.value == 2.5 ? 3 : val.value
this.formData.specificTime = ''
this.playDayVisible = false
},
specificTimeClick() {
if(!this.formData.playDay) {
this.$toast('请先选择出行天数')
return
}
if(this.fromUrlByMy !== 'find') this.timeVisible = true
},
pageBack() {
window.removeEventListener('scroll', this.scrollToTop)
document.removeEventListener('click', this.handleClick)
if(['find', 'edit'].includes(this.fromUrlByMy)) {
pjaxReplace('/platform/mobile/theRapyRecuperation/myRecuperation')
} else {
pjaxReplace('/platform/mobile/theRapyRecuperation/mobileLineListPage')
}
},
calConfirm(date) {
const start = moment(date[0]).format('MM月DD日')
const end = moment(date[1]).format('MM月DD日')
this.formData.specificTime = start + '-' + end
this.timeVisible = false
},
daySelect(day) {
this.chooseDate = []
const date = moment(day[0])
for (let i = 1; i <= this.lotValue - 1; i++) {
const afterDate = date.clone().add(i, 'days')
const afterDateStr = moment(afterDate).format('YYYY-MM-DD')
if(this.holidays.includes(afterDateStr)) {
this.$toast(afterDateStr + '是节假日或前一天,不能选择')
this.$refs.cal.reset(null)
break
}
this.chooseDate.push(afterDateStr)
if(i === (this.lotValue - 1)) {
const afterDate = date.clone().add(this.lotValue - 1, 'days')
const afterDateStr = moment(afterDate).format('YYYY-MM-DD')
day[1] = new Date(afterDateStr)
this.$refs.cal.reset(day)
}
}
this.$forceUpdate()
},
formatter(day) {
const date = moment(day.date).format('YYYY-MM-DD')
if(this.timeArray.indexOf(date) === -1) {
day.type = 'disabled'
}
if(this.chooseDate.length > 0 && this.chooseDate.includes(date)) {
day.className = 'cal_middle'
if(date === this.chooseDate[this.chooseDate.length - 1]) {
day.className = 'cal_end'
day.bottomInfo = '离店';
}
}
if (day.type === 'start') {
day.bottomInfo = '入住';
} else if (day.type === 'end') {
day.bottomInfo = '离店';
}
return day
},
roomCancel() {
if (!this.self) {
this.formData.companionList[this.active].bedInfo.bedType = ''
}
this.roomVisible = false
},
roomConfirm(value, index) {
if (this.self) {
this.formData.bedInfo.bedType = value
if (value === '大床房') {
this.formData.bedInfo.bedNum = 1
this.formData.bedInfo.isSleepTogether = false
this.formData.bedInfo.otherSleepUser = ''
} else {
this.formData.bedInfo.bedNum = 2
this.formData.bedInfo.isSleepTogether = true
}
} else {
this.formData.companionList[this.active].bedInfo.bedType = value
}
this.roomVisible = false
},
bedConfirm(value, index) {
if (this.self) {
this.formData.bedInfo.bedNum = value
} else {
this.formData.companionList[this.active].bedInfo.bedNum = value
}
this.bedVisible = false
},
validator(value) {
return value != null
},
async joinSubmit() {
let toast = vant.Toast.loading({
duration: 0,
forbidClick: true,
overlay: true,
message: '努力提交中',
})
const cloneData = clone(this.formData)
cloneData.companionList.forEach((item, index) => {
if (item.userName === '') {
cloneData.companionList.splice(index, 1)
}
})
const resp = await $.post('/platform/theRapyRecuperation/line/enroll/doSignUpForBaseManagement', {
enroll: JSON.stringify(cloneData),
})
setTimeout(() => {
toast.clear()
vant.Dialog.alert({
title: '温馨提示',
message: resp.msg,
})
if (resp.code === 0) {
pjaxReplace('/platform/mobile/theRapyRecuperation/myRecuperation?index=' + this.index)
}
}, 1000)
},
addCompanion() {
this.formData.companionList.push({userName: '', loginName: '', sex: '', relation: '', bedInfo: {}})
},
delCompanion() {
this.formData.companionList.splice(this.active, 1)
},
async join() {
if (this.fromUrlByMy !== 'find') {
const re = await $.post('/platform/theRapyRecuperation/line/enroll/validSignUpInfo', {
enroll: JSON.stringify({
takePartInBaseManagementId: this.baseData.id,
isNormal: this.baseData.isNormal,
id: this.enrollId
}),
})
if (re.code !== 0) {
vant.Toast(re.msg)
return
}
if (this.fromUrlByMy !== 'editDo') {
this.formData = {
userName: "${@shiro.getPrincipalProperty('username')}",
loginName: "${@shiro.getPrincipalProperty('loginname')}",
unionName: "${@shiro.getPrincipalProperty('union').getUnionname()}",
idCard: "${@shiro.getPrincipalProperty('idcard')}",
mobile: "${@shiro.getPrincipalProperty('mobile')}",
baseName: this.baseData.baseName,
takePartInBaseManagementId: this.baseData.id,
companionList: [],
bedInfo: {},
}
this.formData.bedInfo.bedType = '大床房'
this.defaultIndex = this.formData.bedInfo.bedType === '标准间' ? "1" : "0"
this.formData.bedInfo.bedNum = 2
this.formData.bedInfo.isSleepTogether = true
}
//不是查看,是修改
const now_date = moment()//当前时间
let start = this.formData.specificTime ? this.formData.specificTime.split('-')[0] : '01月01日'
start = new Date().getFullYear() + '-' + start.replaceAll('月', '-').replaceAll('日', '')
const targetDate = new Date(start);
const previousThursdayDate = this.getPreviousThursday(targetDate);
const previousStr = previousThursdayDate.toISOString().split('T')[0]
let start_date = moment(previousStr) // 时间区间开始日期
//1.已经报名,2.当前时间大于活动开始时间(只要大于活动开始时间就表示错过了某个时间段)
if (this.enrollId && now_date >= start_date && this.formData.isTakePartIn === false) {
vant.Dialog.alert({
title: '温馨提示',
message: '您报的时间段已过,请联系管理员修改后方可修改',
})
return
}
if(this.index == 3) {
await this.getTimeArray()
}
}
this.joinPopup = true
},
async getData() {
const res = await $.get('/platform/theRapyRecuperation/baseManagement/selectBaseAllInfo', {
id: this.id
})
if (res.code === 0) {
this.baseData = res.data
this.formData.baseName = this.baseData.baseName
this.skeLoading = false
if(this.baseData.allowDay) {
this.playDayColumns = []
const list = JSON.parse(this.baseData.allowDay)
list.forEach(item => {
this.playDayColumns.push({
text: item + '天', value: item
})
})
}
}
},
async getTimeArray() {
const res = await $.post('/platform/theRapyRecuperation/baseManagement/getTimeArray', {
id: this.id
})
this.timeArray = res.data.days
this.holidays = res.data.holidays
//this.lotValue = Number(res.data.lotValue)
this.minDate = new Date(res.data.minDate)
this.maxDate = new Date(res.data.maxDate)
},
// 点击图片回到顶部方法,加计时器是为了过渡顺滑
backTop() {
const that = this
let timer = setInterval(() => {
let speed = Math.floor(-that.scrollTop / 5)
document.documentElement.scrollTop = document.body.scrollTop = that.scrollTop + speed
if (that.scrollTop === 0) {
clearInterval(timer)
}
}, 16)
},
// 为了计算距离顶部的高度,当高度大于100显示回顶部图标,小于100则隐藏
scrollToTop() {
const that = this
that.scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
that.btnFlag = that.scrollTop > 100;
},
//修改时查询报名信息,进行回显
async findSignUpInfoById() {
const res = await $.post('/platform/theRapyRecuperation/line/enroll/findSignUpInfoById/' + this.enrollId)
if (res.code === 0) {
this.formData = res.data
if (this.formData.bedInfo === null) {
this.formData.bedInfo = {}
}
if (this.formData.companionList) {
this.formData.companionList.forEach(item => {
if (item.bedInfo === null) {
item.bedInfo = {}
}
})
}
this.$forceUpdate()
}
},
getPreviousThursday(date) {
// 将输入日期转换为Date对象
const inputDate = new Date(date);
// 获取输入日期的星期几(0表示星期日,1表示星期一,以此类推)
const dayOfWeek = inputDate.getDay();
// 计算距离上一个周四还有多少天(0表示当前为周四)
const daysUntilPreviousThursday = (dayOfWeek + 7 - 4) % 7;
// 计算上一个周四的日期
const previousThursday = new Date(inputDate);
previousThursday.setDate(inputDate.getDate() - daysUntilPreviousThursday);
return previousThursday;
},
fn() {
this.show = true;
},
async delaySearch(query) {
if (query) {
const {data} = await $.get("/platform/fw/condolence/apply/queryUser", {query})
data.forEach(v => {
v.name = v.username + '(' + v.loginname + ')'
return v
})
this.userList = data
}
},
async getConfigData() {
const resp = await $.get('/platform/theRapyRecuperation/TheRapyConfig/findOne')
this.configData = resp.data
},
async toResult(loginname) {
const res = await $.post('/platform/theRapyRecuperation/line/enroll/validSignUpInfo', {
enroll: JSON.stringify({
takePartInBaseManagementId: this.baseData.id,
isNormal: true,
id: this.enrollId
}),
loginName: loginname
})
if (res.code !== 0) {
vant.Toast(res.msg)
return
}
const resp = await $.post('/platform/theRapyRecuperation/baseManagement/getUserByLoginName', {loginName: loginname})
if (resp.code === 0) {
const o = resp.data
this.formData = {
userName: o.username,
loginName: o.loginname,
unionName: o.unionname,
idCard: o.idcard,
mobile: o.mobile,
baseName: this.baseData.baseName,
takePartInBaseManagementId: this.baseData.id,
companionList: [],
bedInfo: {},
}
}
this.show = false
},
handleClick(event, classArray = [], imagesArray = []) {
if (event.target.tagName === 'IMG' && event.target.className !== 'top_icon') {
if(imagesArray.length > 0) {
const index = classArray.indexOf(event.target.className)
if(index !== -1) {
vant.ImagePreview({
images: imagesArray,
startPosition: index,
closeable: true,
})
}
} else {
vant.ImagePreview({
images: [event.target.src],
closeable: true,
})
}
}
},
readPDFPicture(pdf) {
const that = this
if(pdf != null) {
pdf.on("complete", function () {
const imgDoc = document.querySelectorAll('img')
let array = []
let classArray = []
imgDoc.forEach(o => {
if(o.getAttribute('class') !== 'top_icon') {
classArray.push(o.getAttribute('class'))
array.push(o.getAttribute('src'))
}
})
document.addEventListener('click', (event) => that.handleClick(event, classArray, array))
})
}
},
},
async created() {
await this.getConfigData()
this.id = getQueryString('id') ? getQueryString('id') : ''
this.enrollId = getQueryString('enrollId') ? getQueryString('enrollId') : ''
this.index = getQueryString('index') ? getQueryString('index') : ''
//编辑传出来的参数
this.fromUrlByMy = getQueryString('fromUrlByMy') ? getQueryString('fromUrlByMy') : ''
if (this.enrollId) {
await this.findSignUpInfoById()
}
await this.getData()
try {
const parser = new DOMParser();
const doc = parser.parseFromString(this.baseData.content, 'text/html');
const link = doc.querySelector('a');
const href = link.getAttribute('href');
this.$nextTick(() => {
pdfh5 = new Pdfh5('#demo', {
pdfurl: href,
});
})
}catch (e) {
this.isPdf = true
//document.addEventListener('click', (event) => this.handleClick(event))
}
this.$nextTick(() => {
this.readPDFPicture(pdfh5)
})
},
mounted() {
//window.addEventListener('scroll', this.scrollToTop)
},
destroyed() {
},
})
</script>
<!--#
}
#-->