场地预约整改:分工会/协会审核-校工会审核

This commit is contained in:
2026-09-08 19:55:03 +08:00
parent 3e9fdf0584
commit 8089a1a2d8
32 changed files with 1860 additions and 2751 deletions
@@ -1,551 +1,258 @@
<!--#
layout("/mobile/platform.html"){
#-->
<!--# layout("/mobile/platform.html"){ #-->
<style>
.van-hairline--top-bottom::after, .van-hairline-unset--top-bottom::after {
border: 0;
}
.van-index-bar__sidebar {
display: none;
}
.van-doc-card {
margin: 14px;
padding: 12px 12px 12px 12px;
background-color: #fff;
border-radius: 10px;
box-shadow: 0 8px 12px #ebedf0;
line-height: 20px;
font-size: 12px;
position: relative;
}
.in-sheet-card {
display: flex;
justify-content: space-between;
line-height: 24px;
}
.van-divider {
margin: 6px 0 6px 0px;
border-color: lightgray;
}
.van-button--small {
border-radius: revert;
width: 40%;
height: 30px;
}
.van-col {
line-height: 20px;
}
.title_span {
font-size: 16px;
font-weight: bold;
position: absolute;
left: -1px;
top: 11px;
color: #1867b0;
}
.title {
font-size: 13px;
font-weight: bold;
flex: 1;
overflow: hidden;
white-space: nowrap;
}
.cus_overflow {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.showMore {
color: #1867b0;
}
.cus_popup {
width: 70%;
height: 50%;
/*border-radius: 10px;*/
padding: 10px 14px;
font-size: 15px;
/*background-color: #E5E7E9;
background-image: url("https://www.transparenttextures.com/patterns/green-cup.png");*/
}
.cus_icon {
z-index: 10000;
color: white;
font-size: 35px;
position: fixed;
top: 81%;
left: 44%;
}
.userPopup {
max-height: 96%;
height: 96%;
background-color: #f6f7f9;
font-size: 14px;
position: absolute;
}
.van-row div {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.firstName {
width: 45px;
background-color: lightgrey;
border-radius: 45px;
display: flex;
align-items: center;
justify-content: center;
font-size: 24px;
color: white;
}
.content {
height: 86%;
overflow: auto;
}
.no_content {
height: 100%;
overflow: auto;
}
.van-action-sheet__content {
height: 88%;
}
.van-dialog__header {
padding-top: 8px;
}
.van-dialog__confirm {
color: #1867b0;
}
.van-field__label {
width: 6em;
}
.cus_cell {
padding: 4px 0px;
font-size: 12px;
}
.van-checkbox-group {
max-height: 260px;
overflow-y: auto;
margin-top: 6px;
}
.unit {
display: inline-block;
max-width: 160px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
position: absolute;
}
.cus_button {
border-top-right-radius: 16px;
border-bottom-left-radius: 16px;
height: 26px;
}
.van-dropdown-menu__item {
flex: auto;
}
.audit_icon {
font-size: 24px;
/*position: absolute;*/
font-weight: bolder;
right: 0;
top: 5px;
}
.van-cell__value--alone {
text-align: center;
}
.site-audit .van-doc-card { margin:14px; padding:12px; background:#fff; border-radius:10px; box-shadow:0 8px 12px #ebedf0; line-height:20px; font-size:15px; position:relative; }
.site-audit .card-title { font-size:18px; font-weight:bold; color:#1867b0; padding-left:4px; }
.site-audit .title-mark { position:absolute; left:0; top:12px; color:#1867b0; font-weight:bold; }
.site-audit .card-fields { margin-top:4px; line-height:30px; overflow-wrap:anywhere; }
.site-audit .field-label { color:grey; }
.site-audit .van-divider { margin:6px 0; }
.site-audit .card-footer { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:8px; }
.site-audit .card-footer .van-button { border-radius:8px; height:26px; font-size:16px; margin-left:4px; }
.site-audit .process-title { color:#1867b0; font-size:15px; font-weight:600; margin:10px 7px; padding:10px; }
.site-audit .audit-actions { display:flex; gap:10px; padding:10px; }
.site-audit .site-audit-section { color:#1867b0; font-weight:bold; font-size:16px; }
.site-audit .site-audit-loading { padding:24px; text-align:center; }
.site-audit .site-audit-text .van-cell__label { white-space:pre-wrap; overflow-wrap:anywhere; }
.site-audit .detail-popup { background:#f7f8fa; }
</style>
<div id="app" v-cloak>
<m-page-loading v-if="mLoading"></m-page-loading>
<!--top栏-->
<van-nav-bar
title="场地预约审核"
left-arrow
placeholder
fixed
@click-left="pjaxReplace('/mobile/index')"
safe-area-inset-top
></van-nav-bar>
<!--筛选框-->
<div class="search-fixed">
<van-search
v-model="pageForm.searchKeyword"
shape="round"
maxlength="10"
@search="doSearch"
placeholder="请输入场地名称、场地地点进行查询"
>
</van-search>
<van-dropdown-menu>
<!--<van-dropdown-item v-model="pageForm.meetingTime" :options="meetingTimeList"
@change="doSearch"></van-dropdown-item>-->
<van-dropdown-item v-model="pageForm.typeId" :options="typeList"
@change="doSearch"></van-dropdown-item>
<div id="app" class="site-audit" v-cloak>
<van-sticky>
<van-nav-bar title="${reviewTitle}" left-text="返回" left-arrow @click-left="goBack"></van-nav-bar>
<van-search v-model="keyword" placeholder="请输入场地名称或申请人" @search="search" @clear="search"></van-search>
<van-dropdown-menu :close-on-click-outside="false" :close-on-click-overlay="false">
<van-dropdown-item ref="auditFilter" v-model="isAudit" :options="auditOptions" @change="search"
@open="filterOpened" @close="filterClosed"></van-dropdown-item>
</van-dropdown-menu>
</div>
<!--列表-->
<div style="margin-top: 116px">
<van-list
v-model="loading"
:finished="finished" :immediate-check="false"
:finished-text="tableData.length>0?'没有更多了':''"
@load="onLoad">
<div class="van-doc-card" v-for="o in tableData">
<div @click="openView(o.id, o.modulename)">
<div style="display: flex; justify-content: space-between">
<div style="width: 74%">
<div class="van-ellipsis title">
<span class="title_span">|</span>
<span>{{o.name}}</span>
</div>
<div style="color: grey">{{o.address}}</div>
</div>
<div style="color: #1867b0;">
{{o.meetingtypename}}
</div>
</div>
<van-divider></van-divider>
<div style="margin-top: 10px">
<van-row>
<van-col span="12"><span style="color: grey">&emsp;联系人:</span>{{o.unitname ? (o.unitname +
'') : '' + '' + o.contact_person}}
</van-col>
</van-row>
<van-row>
<van-col span="12"><span style="color: grey">联系方式:</span>{{o.contact_phone}}</van-col>
</van-row>
</div>
<div style="display: flex; justify-content: space-between">
<!--<div class="cus_overflow" style="line-height: 20px; width: 83%">
<span style="color: grey">开放时段:</span>
{{o.meetingdescription}}
</div>-->
<!--<span class="showMore" @click.stop="desc = o.meetingdescription; popupShow = true">查看更多</span>-->
</div>
<div style="display: flex; justify-content: flex-end; margin-top: 4px">
<div>
<van-button @click.stop="getAuditList(o)" class="cus_button"
type="primary" size="small" color="#1867b0"
style="margin-right: 8px; width: auto;">已审{{o.audit}}
</van-button>
<van-button @click.stop="openView(o.id, o.modulename)" class="cus_button"
type="primary" size="small" color="#1867b0"
style="margin-right: 8px; width: auto;">未审{{o.no_audit}}
</van-button>
</div>
</div>
</van-sticky>
<van-list v-model="loading" :finished="finished" :error.sync="listError" error-text="加载失败,点击重试"
:immediate-check="false" :finished-text="rows.length ? '没有更多了' : ''" @load="loadMore">
<div v-for="row in rows" :key="row.id" class="van-doc-card">
<div class="card-title van-ellipsis"><span class="title-mark">|</span>{{row.reserve_person}}{{row.loginname}}</div>
<div class="card-fields">
<div><span class="field-label">场地名称:</span>{{row.site_name}}</div>
<div><span class="field-label">所属单位:</span>{{row.reserve_person_unit || '—'}}</div>
<div><span class="field-label">预约类型:</span>{{typeName(row.reserve_type)}}</div>
<div v-if="row.club_name"><span class="field-label">所属协会:</span>{{row.club_name}}</div>
<div><span class="field-label">预约时段:</span>{{row.concat_day}}</div>
</div>
<van-divider></van-divider>
<div class="card-footer">
<!-- 仅状态内容绑定配置颜色,保留字段标签原有灰色。 -->
<div><span class="field-label">当前状态:</span><span :style="{color: row.state_color || null}">{{row.state_name}}</span></div>
<div>
<van-button size="small" type="info" @click="openDetail(row,false)">查看</van-button>
<van-button v-if="canReview(row)" size="small" type="primary" @click="openDetail(row,true)">审核</van-button>
<van-button v-if="isAudit===true" size="small" type="danger" :disabled="!row.canRevoke || formLoading"
:loading="formLoading && revokeId===row.id" @click="openRevoke(row)">撤回</van-button>
</div>
</div>
</van-list>
<van-empty
v-if="mLoading==false&&tableData.length==0"
class="custom-image"
image="/none.svg"
description="暂无数据"
></van-empty>
</div>
<!--弹出框-->
<van-popup v-model:show="popupShow" class="cus_popup">
<pre style="margin: 0; white-space: break-spaces">{{desc}}</pre>
</div>
</van-list>
<van-empty v-if="!loading && !listError && !rows.length" image="/none.svg" description="暂无数据"></van-empty>
<van-popup v-model="detailShow" position="right" :style="{height:'100%',width:'100%'}" class="detail-popup" safe-area-inset-bottom>
<van-sticky>
<van-nav-bar title="申请详情" left-text="返回" left-arrow @click-left="goBack"></van-nav-bar>
</van-sticky>
<site-audit-info ref="infoRef" :review-api="reviewApi" @loaded="onDetailLoaded"></site-audit-info>
<div v-if="showApprovalForm">
<div class="process-title">${reviewTitle}</div>
<van-form @submit="openConfirm(true)">
<van-field label="审核人员" readonly v-model="formData.username"></van-field>
<van-field label="当前时间" readonly v-model="formData.auditTime"></van-field>
<van-field label="审核意见" type="textarea" maxlength="500" show-word-limit required
v-model="formData.auditOpinion" placeholder="请输入审核意见"></van-field>
</van-form>
<div class="audit-actions">
<van-button block type="default" :disabled="formLoading" @click="goBack">取消</van-button>
<van-button block type="danger" :disabled="!auditReady || formLoading" :loading="formLoading && !pendingPass" @click="openConfirm(false)">拒绝</van-button>
<van-button block type="primary" :disabled="!auditReady || formLoading" :loading="formLoading && pendingPass" @click="openConfirm(true)">通过</van-button>
</div>
</div>
</van-popup>
<van-icon @click="popupShow = false" class="cus_icon" v-if="popupShow" name="close"></van-icon>
<!--审核人员-->
<van-action-sheet v-model:show="userShow" :title="queryType === 'notAudit' ? '预约列表' : '预约列表'"
class="userPopup" @close="popClose">
<div :class="queryType == 'notAudit' ? 'content' : 'no_content'">
<div v-if="queryType === 'notAudit'" style="text-align: right; width: 96%">
<van-tag color="#1867b0" style="margin-right: 10px" @click="cancelAll" size="large" type="primary">
取消选中
</van-tag>
<van-tag color="#1867b0" @click="allIn" size="large" type="primary">全选</van-tag>
</div>
<div class="van-doc-card in-sheet-card" v-for="(item, i) in userList">
<!--<div style="display: flex; justify-content: space-between">
<div style="width: 80%">
<span>{{moment(item.startTime).format('YYYY-MM-DD HH:mm') + ' ~ ' + moment(item.endTime).format('YYYY-MM-DD HH:mm')}}</span>
</div>
<div v-if="queryType === 'notAudit'">
<span @click="checkAll(i)">全选</span>
<span @click="toggleAll(i)" style="margin-left: 4px">反选</span>
</div>
</div>-->
<div style="width: 90%">
<div>
<span style="display: inline-block; min-width: 40px; max-width: 76px">{{item.username}}</span>
<span style="display: inline-block; width: 20px">{{item.sex}}</span>
<span style="display: inline-block; width: 76px">{{item.loginname}}</span>
<span class="unit">{{item.unitname}}</span>
</div>
<div style="width: 94%; display: flex">
<div style="color: grey;">预约时间:</div>
<div>
<div v-for="(d,index) in item.concat_day.split(',')">{{getTime(item, d)}}</div>
</div>
</div>
<div style="width: 94%;">
<span style="color: grey">参加人员:</span><span>{{item.joinUser}}</span>
</div>
<div style="width: 94%;">
<span style="color: grey">预约事由:</span><span>{{item.reserve_cause}}</span>
</div>
<div style="width: 94%;">
<span style="color: grey">审核状态:</span><span>{{item.stateName}}</span>
</div>
<div v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('xghng')||@shiro.hasRole('A06')}"
style="width: 94%;">
<span style="color: grey">反馈意见:</span><span>{{item.back_option}}</span>
</div>
</div>
<van-checkbox-group v-model="result" ref="checkboxGroup">
<van-cell-group>
<van-cell
clickable class="cus_cell"
:key="item.id"
@click="toggle(i)">
<van-icon class="audit_icon" color="green"
v-if="queryType === 'hasAudit' && item.auditState == true"
name="passed"></van-icon>
<van-icon class="audit_icon" color="grey"
v-if="queryType === 'hasAudit' && item.auditState == false"
name="close"></van-icon>
<template #right-icon v-if="queryType === 'notAudit'">
<van-checkbox :name="item.id" ref="checkboxes"></van-checkbox>
</template>
</van-cell>
</van-cell-group>
</van-checkbox-group>
</div>
<!--<div v-if="queryType === 'notAudit'" style="display: flex; justify-content: space-evenly; position: fixed; bottom: 50px; width: 95%">
<van-button @click="audit('all', 'reject')" color="#ff976a" size="small" style="height: 38px">一键全部驳回</van-button>
<van-button @click="audit('all', 'pass')" color="#1867b0" size="small" style="height: 38px">一键全部通过</van-button>
</div>-->
</div>
<div style="position: absolute; bottom: 20px; width: 100%;z-index: 9999">
<div v-if="queryType === 'notAudit'" style="display: flex; justify-content: center">
<van-button @click="audit('many', 'reject')" color="#ff976a" size="small"
style="height: 38px;border-radius: 10px;margin-right: 20px">驳回
</van-button>
<van-button @click="audit('many', 'pass')" color="#1867b0" size="small"
style="height: 38px;border-radius: 10px">通过
</van-button>
</div>
</div>
</van-action-sheet>
<!--审核弹框-->
<van-dialog v-model:show="auditShow" @confirm="auditDo" title="温馨提示" show-cancel-button>
<div style="padding-top: 8px; text-align: center; font-size: 14px; color: #646566">{{str}}</div>
<van-divider style="margin: 12px 0 1px 0px;"></van-divider>
<van-field
v-model="reason"
rows="2"
label="审核意见:"
autosize
type="textarea"
maxlength="50"
placeholder="请输入审核意见"
show-word-limit
></van-field>
<van-dialog v-model="confirmShow" title="提示" show-cancel-button :before-close="beforeConfirmClose"
:message="pendingPass ? '确定通过该申请吗?' : '确定拒绝该申请吗?拒绝后流程结束。'">
</van-dialog>
<van-dialog v-model="revokeShow" title="撤回审核" show-cancel-button :before-close="beforeRevokeClose"
message="确定撤回本次审核吗?撤回后申请恢复到当前节点待审核。"></van-dialog>
</div>
<script>
<!--# include("/platform/activity/includeJs/activityUtil.js"){} #-->
const siteTypeUtil = new typeUtil()
const vue = new Vue({
(() => {
// PJAX 先执行内联脚本;捕获本次页面,依赖加载完成后才允许创建 Vue。
const pageRoot = document.getElementById('app')
const startPage = () => {
if (document.getElementById('app') !== pageRoot || !pageRoot.isConnected) return
<!--# include('./common/info.js'){} #-->
new Vue({
el: '#app',
mixins: [mobileMixins],
mixins: [window.popupHistoryMixin],
components: {'site-audit-info': SITE_AUDIT_INFO},
data() {
return {
desc: '',
list: ['a', 'b'],
result: [],
reason: '',
auditShow: false,
popupShow: false,
userShow: false,
userList: [],
userClickList: [],
str: '',
type: '',
auditType: '',
queryType: '',
typeList: [],
meetingTimeList: [{text: '全部时间', value: null}, {text: '即将开始', value: 0}, {text: '已结束', value: 1}],
historyPopupKeys: ['filterShow','detailShow','confirmShow','revokeShow'],
revokeShow:false, revokeId:'',
reviewApi: '${reviewApi}',
auditOptions: [{text:'已审核',value:true},{text:'未审核',value:false}],
isAudit: false, keyword: '', rows: [], page: 1,
loading: false, finished: false, listError: false, requestVersion: 0, requesting: false,
filterShow: false, detailShow: false, confirmShow: false,
showApprovalForm: false, auditReady: false, pendingPass: false, formLoading: false,
formData: {id:'',username:'',auditTime:'',auditOpinion:''}
}
},
watch: {
// DropdownItem 没有弹层 v-model,通过全局历史状态同步关闭内部下拉层。
filterShow(value) { if (!value && this.$refs.auditFilter) this.$refs.auditFilter.toggle(false) }
},
methods: {
getTime(o, day) {
const week = new Date(day).getDay()
const arr = ['日', '一', '二', '三', '四', '五', '六']
return moment(day).format('MM月DD日') + ' 周' + arr[week] + ' ' + o.start_time + '-' + o.end_time
openRevoke(row) {
if (this.formLoading || !row.canRevoke) return
this.$set(this, 'revokeId', row.id)
this.$set(this, 'revokeShow', true)
},
async getAuditList(o) {
this.queryType = 'hasAudit'
const resp = await $.post('/mobile/activity/site/audit/getLeaveUser', {
siteId: o.id,
auditType: 'hasAudit',
// 确认框也进入历史栈;失败保留弹框,请求结束复位 Vant 内部 loading。
beforeRevokeClose(action, done) {
if (this.formLoading) { done(false); return }
if (action!=='confirm') { done(false); this.goBack(); return }
this.$set(this, 'formLoading', true)
$.post(this.reviewApi + '/doRevoke', {id:this.revokeId}).then((res) => {
if (res && res.code===0) {
this.clearPopupHistory(() => { this.$toast.success('已撤回审核'); this.search() })
} else { this.$toast.fail(res && res.msg || '响应异常,请刷新核对申请状态') }
}, () => { this.$toast.fail('请求失败,请刷新核对申请状态') }).always(() => {
this.$set(this, 'formLoading', false)
done(false)
})
if (resp.code === 0) {
this.userList = resp.data
if (this.userList.length === 0) {
vant.Toast('暂无数据')
},
// 菜单采用 PJAX replace 进入,列表返回应回手机首页,不能依赖上一条浏览器历史。
// 弹框存在时通过统一栈关闭最上层,重复点击也不会连续退过业务页面。
goBack() {
if (this.formLoading) return
const key = this.revokeShow ? 'revokeShow' : this.confirmShow ? 'confirmShow' : this.detailShow ? 'detailShow' : this.filterShow ? 'filterShow' : null
if (key) {
window.popupHistory.close(this._popupOwner, key)
} else {
this.clearPopupHistory(() => pjaxReplace('/mobile/index'))
}
},
typeName(type) { return {1:'个人预约',2:'单位预约',3:'协会预约'}[type] || '—' },
filterOpened() { this.$set(this, 'filterShow', true) },
filterClosed() { this.$set(this, 'filterShow', false) },
canReview(row) {
const stage = this.reviewApi.substring(this.reviewApi.lastIndexOf('/') + 1)
return Number(row.reserve_state) === {union:4000,club:4010,school:4020}[stage]
},
search() {
// 筛选变更使旧响应失效,避免未审核和已审核数据混入同一列表。
this.$set(this, 'requestVersion', this.requestVersion + 1)
this.$set(this, 'requesting', false)
this.$set(this, 'rows', [])
this.$set(this, 'page', 1)
this.$set(this, 'finished', false)
this.$set(this, 'listError', false)
this.loadMore()
},
// isAudit 为审核状态,pageNumber/pageSize 为分页;响应 data 含 list 和 totalCount。
loadMore() {
if (this.requesting || this.finished) return
const version = this.requestVersion
this.$set(this, 'requesting', true)
this.$set(this, 'loading', true)
$.post(this.reviewApi + '/pageData', {
isAudit: this.isAudit, searchKeyword: this.keyword, pageNumber: this.page, pageSize: 10
}).then((res) => {
if (version !== this.requestVersion) return
if (res.code === 0) {
this.$set(this, 'rows', this.rows.concat(res.data.list))
this.$set(this, 'page', this.page + 1)
this.$set(this, 'finished', this.rows.length >= res.data.totalCount)
} else {
this.$set(this, 'listError', true)
this.$toast.fail(res.msg)
}
}).fail(() => {
if (version === this.requestVersion) this.$set(this, 'listError', true)
}).always(() => {
if (version === this.requestVersion) {
this.$set(this, 'loading', false)
this.$set(this, 'requesting', false)
}
})
},
openDetail(row, approval) {
this.$set(this, 'auditReady', false)
this.$set(this, 'showApprovalForm', approval)
this.$set(this, 'formData', {
id: row.id, username: "${@shiro.getPrincipalProperty('username')}",
auditTime: moment().format('YYYY-MM-DD HH:mm:ss'), auditOpinion: ''
})
this.$set(this, 'detailShow', true)
this.$nextTick(() => this.$refs.infoRef.onOpen(row.id))
},
onDetailLoaded(detail) {
this.$set(this, 'auditReady', detail.id === this.formData.id && this.canReview(detail))
},
openConfirm(isPass) {
if (this.formLoading || !this.auditReady) return
if (!this.formData.auditOpinion.trim()) { this.$toast.fail('请填写审核意见'); return }
this.$set(this, 'pendingPass', isPass)
this.$set(this, 'confirmShow', true)
},
// 确认时保留 Dialog,请求收尾通过 done(false) 复位其内部 loading;取消只退一层历史。
beforeConfirmClose(action, done) {
if (this.formLoading) { done(false); return }
if (action === 'confirm') this.review(done)
else { done(false); this.goBack() }
},
// ids 为预约 ID 数组,isPass 为通过/拒绝;响应应为统一 code/msg,空响应不能视为成功。
review(dialogDone = () => {}) {
if (this.formLoading || !this.auditReady) { dialogDone(false); return }
const opinion = (this.formData.auditOpinion || '').trim()
if (!opinion) { dialogDone(false); this.$toast.fail('请填写审核意见'); return }
this.$set(this, 'formLoading', true)
$.post(this.reviewApi + '/doReview', {
ids: JSON.stringify([this.formData.id]), isPass: this.pendingPass,
auditOpinion: opinion
}).then((res) => {
// jQuery 1.x 的 then 回调异常可能中断后续链,先检查空或非标准响应再读取字段。
if (!res || typeof res !== 'object' || typeof res.code !== 'number') {
this.$toast.fail('审核响应异常,请刷新核对申请状态')
return
}
this.userList.sort((a, b) => {
return b.auditState - a.auditState
})
this.userShow = true
}
},
cancelAll() {
this.$refs.checkboxes.forEach(item => item.toggle(false))
},
allIn() {
this.$refs.checkboxes.forEach(item => item.toggle(true))
},
checkAll(i) {
this.$refs.checkboxGroup[i].children.forEach(item => item.toggle(true))
},
toggleAll(i) {
this.$refs.checkboxGroup[i].children.forEach(item => item.toggle())
},
toggle(i) {
this.$refs.checkboxes[i].toggle();
},
async auditDo() {
let idList = this.result
if (this.type === 'all') {
idList = this.userList.map(o => o.id)
}
const resp = await $.post('/mobile/activity/site/audit/audit', {
ids: JSON.stringify(idList),
auditOpinion: this.reason,
isPass: this.auditType === 'pass'
})
if (resp.code === 0) {
vant.Toast(resp.msg)
this.doSearch()
} else {
vant.Toast('操作失败')
}
this.userShow = false
},
audit(type, auditType) {
this.type = type
this.auditType = auditType
if (type === 'many' && this.result.length === 0) {
vant.Toast('请先选择人员')
return
}
this.str = type === 'many' ? '您选择了' + this.result.length + '个人,请确认您的选择' : '您确定要一键全部审核吗?'
this.reason = auditType === 'pass' ? '同意' : '拒绝'
this.auditShow = true
},
async openView(id, modulename) {
this.queryType = 'notAudit'
this.userList = []
const resp = await $.post('/mobile/activity/site/audit/getLeaveUser', {
siteId: id,
moduleName: modulename,
auditType: 'canAudit',
})
if (resp.code === 0) {
this.userList = resp.data
this.userClickList = []
if (this.userList.length === 0) {
vant.Toast('暂无预约数据')
} else {
this.userShow = true
}
return
}
vant.Toast('系统错误,请联系管理员')
},
popClose() {
this.$nextTick(function () {
if (this.$refs.checkboxes !== undefined) {
this.$refs.checkboxes.forEach(item => item.toggle(false));
}
})
},
doSearch() {
this.pageForm.pageNumber = 1
this.tableData = []
this.finished = false
this.onLoad()
},
async onLoad() {
this.loading = true
$.post('/mobile/activity/site/audit/pageData', this.pageForm).then(res => {
if (res.code === 0) {
this.tableData = this.tableData.concat(res.data.list)
if (this.tableData.length === res.data.totalCount) {
this.finished = true
} else {
this.pageForm.pageNumber++
}
}
this.loading = false
this.$set(this, 'auditReady', false)
this.clearPopupHistory(() => { this.$toast.success('审核成功'); this.search() })
} else { this.$toast.fail(res.msg || '审核失败,请刷新核对申请状态') }
}).fail(() => { this.$toast.fail('提交失败,请刷新核对申请状态') }).always(() => {
// 同时复位表单按钮及 Vant Dialog 内部按钮,失败时保留意见供核对。
this.$set(this, 'formLoading', false)
dialogDone(false)
})
},
},
async created() {
this.typeList = await siteTypeUtil.getAllType()
this.typeList.unshift({text: '全部场地类型'})
if (this.typeList && this.typeList.length > 0) {
this.$set(this.pageForm, "typeId", this.typeList[0].value)
}
this.$set(this.pageForm, "meetingTime", this.meetingTimeList[1].value)
this.onLoad()
},
created() { this.search() },
mounted() {
// PJAX 替换 DOM 不会自动销毁 Vue,离开时注销弹框历史同步及本页事件。
this._siteAuditDispose = () => this.$destroy()
$(document).one('pjax:beforeReplace.siteAudit', this._siteAuditDispose)
},
beforeDestroy() {
$(document).off('pjax:beforeReplace.siteAudit', this._siteAuditDispose)
this.$set(this, 'requestVersion', this.requestVersion + 1)
}
})
}
if (window.popupHistoryMixin) {
startPage()
} else {
// 共用一次加载请求;失败后允许重新进入重试,不能在缺少 mixin 时继续挂载。
if (!window.siteAuditHistoryLoading) {
window.siteAuditHistoryLoading = $.getScript('/assets/mobile/js/popupHistory.js')
.fail(() => { window.siteAuditHistoryLoading = null })
}
window.siteAuditHistoryLoading.then(() => startPage()).fail(() => {
if (document.getElementById('app') === pageRoot) vant.Toast.fail('页面组件加载失败,请重新进入')
})
}
})()
</script>
<!--#
}
#-->
<!--# } #-->