commit
This commit is contained in:
+24
@@ -80,6 +80,10 @@ public class SiteCugApplyServiceImpl extends BaseServiceImpl<SiteCugApply> imple
|
||||
if (!Boolean.TRUE.equals(siteInfo.getState())) {
|
||||
return Map.of(false, "该场地未开启预约");
|
||||
}
|
||||
Map<Boolean, String> termDateRangeValidate = validateTermDateRange(apply, siteInfo);
|
||||
if (termDateRangeValidate.containsKey(false)) {
|
||||
return termDateRangeValidate;
|
||||
}
|
||||
if (apply.getJoinCount() == null || apply.getJoinCount() <= 0) {
|
||||
return Map.of(false, "预约人数必须大于0");
|
||||
}
|
||||
@@ -135,6 +139,26 @@ public class SiteCugApplyServiceImpl extends BaseServiceImpl<SiteCugApply> imple
|
||||
return Map.of(true, "");
|
||||
}
|
||||
|
||||
// 分工会预约必须落在后台配置的本学期时间内,批量预约逐条复用该校验防止接口越权提交学期外日期
|
||||
private Map<Boolean, String> validateTermDateRange(SiteCugApply apply, SiteCugInfo siteInfo) {
|
||||
if (!StrUtil.equals(apply.getReserveType(), "union")
|
||||
|| StrUtil.hasBlank(siteInfo.getTermStartDate(), siteInfo.getTermEndDate())) {
|
||||
return Map.of(true, "");
|
||||
}
|
||||
try {
|
||||
DateTime reserveStart = DateUtil.parseDateTime(apply.getReserveStartTime());
|
||||
DateTime reserveEnd = DateUtil.parseDateTime(apply.getReserveEndTime());
|
||||
Date termStart = DateUtil.beginOfDay(DateUtil.parseDate(siteInfo.getTermStartDate()));
|
||||
Date termEnd = DateUtil.endOfDay(DateUtil.parseDate(siteInfo.getTermEndDate()));
|
||||
if (reserveStart.isBefore(termStart) || reserveEnd.isAfter(termEnd)) {
|
||||
return Map.of(false, "预约时间必须在本学期时间范围内");
|
||||
}
|
||||
return Map.of(true, "");
|
||||
} catch (Exception e) {
|
||||
return Map.of(false, "本学期时间配置有误,请联系管理员处理");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Boolean, String> occupyRecord(String id, String message, boolean sendMsg) {
|
||||
if (StrUtil.isBlank(message)) {
|
||||
|
||||
@@ -175,9 +175,9 @@ const apply = {
|
||||
<el-col :span="24">
|
||||
<el-form-item label="批量预约">
|
||||
<div style="display: flex; align-items: flex-start; column-gap: 12px; flex-wrap: wrap; line-height: 1.7;">
|
||||
<el-checkbox v-model="yearlyReserve">预约本年后续每周同一时段</el-checkbox>
|
||||
<el-checkbox v-model="yearlyReserve">预约本月后续每周同一时段</el-checkbox>
|
||||
<span style="color: #909399;">
|
||||
例如先选某个周一 09:00-11:00,勾选后会自动预约本年剩余所有周一的这个时段。
|
||||
例如先选某个周一 09:00-11:00,勾选后会自动预约本月剩余所有周一的这个时段。
|
||||
</span>
|
||||
</div>
|
||||
<div v-if="yearlyReserve" style="margin-top: 10px; max-width: 320px;">
|
||||
@@ -344,7 +344,10 @@ const apply = {
|
||||
if (!this.formData.reserveStartTime) {
|
||||
return false
|
||||
}
|
||||
return this.$moment(time).format('YYYY-MM-DD') < this.formData.reserveStartTime.slice(0, 10)
|
||||
const targetDay = this.$moment(time).format('YYYY-MM-DD')
|
||||
const startDay = this.formData.reserveStartTime.slice(0, 10)
|
||||
const monthEndDay = this.$moment(this.formData.reserveStartTime).endOf('month').format('YYYY-MM-DD')
|
||||
return targetDay < startDay || targetDay > monthEndDay
|
||||
},
|
||||
}
|
||||
},
|
||||
@@ -397,10 +400,10 @@ const apply = {
|
||||
return ''
|
||||
}
|
||||
if (!this.formData.reserveStartTime || !this.formData.reserveEndTime) {
|
||||
return '请先选择开始和结束时间后,再批量预约本年同星期时段'
|
||||
return '请先选择开始和结束时间后,再批量预约本月同星期时段'
|
||||
}
|
||||
if (!this.yearlyReserveDates.length) {
|
||||
return '当前时间段无法生成本年批量预约日期'
|
||||
return '当前时间段无法生成本月批量预约日期'
|
||||
}
|
||||
return '将从 ' + this.yearlyReserveDates[0] + ' 开始,自动预约到 ' + this.yearlyReserveDates[this.yearlyReserveDates.length - 1] + ',共 ' + this.yearlyReserveDates.length + ' 个时段'
|
||||
},
|
||||
@@ -498,6 +501,10 @@ const apply = {
|
||||
}
|
||||
if (this.formData.reserveStartTime && this.formData.yearlyReserveEndDate < this.formData.reserveStartTime.slice(0, 10)) {
|
||||
this.$set(this.formData, 'yearlyReserveEndDate', defaultDate)
|
||||
return
|
||||
}
|
||||
if (this.formData.reserveStartTime && this.formData.yearlyReserveEndDate > defaultDate) {
|
||||
this.$set(this.formData, 'yearlyReserveEndDate', defaultDate)
|
||||
}
|
||||
},
|
||||
getInitialScheduleDate() {
|
||||
@@ -1020,12 +1027,16 @@ const apply = {
|
||||
this.$message.warning('批量预约截止日期不能早于开始日期')
|
||||
return false
|
||||
}
|
||||
if (this.formData.reserveStartTime && this.formData.yearlyReserveEndDate > this.$moment(this.formData.reserveStartTime).endOf('month').format('YYYY-MM-DD')) {
|
||||
this.$message.warning('批量预约截止日期不能超过预约开始时间所在月份')
|
||||
return false
|
||||
}
|
||||
if (!this.yearlyReserveDates.length) {
|
||||
this.$message.warning('当前选择的时间段在截止日期内无法生成可批量预约的日期')
|
||||
return false
|
||||
}
|
||||
if (!this.yearlyReserveDates.length) {
|
||||
this.$message.warning('当前选择的时间段无法生成本年批量预约日期')
|
||||
this.$message.warning('当前选择的时间段无法生成本月批量预约日期')
|
||||
return false
|
||||
}
|
||||
return true
|
||||
@@ -1038,7 +1049,7 @@ const apply = {
|
||||
if (!this.yearlyReserve) {
|
||||
return baseText + ',是否确定提交预约?'
|
||||
}
|
||||
return baseText + '。系统将继续预约本年后续 ' + this.yearlyReserveDates.length + ' 个同星期时段,是否确定提交?'
|
||||
return baseText + '。系统将继续预约本月后续 ' + this.yearlyReserveDates.length + ' 个同星期时段,是否确定提交?'
|
||||
},
|
||||
validateYearlyReserve() {
|
||||
if (!this.yearlyReserve) {
|
||||
@@ -1052,6 +1063,10 @@ const apply = {
|
||||
this.$message.warning('批量预约截止日期不能早于开始日期')
|
||||
return false
|
||||
}
|
||||
if (this.formData.reserveStartTime && this.formData.yearlyReserveEndDate > this.$moment(this.formData.reserveStartTime).endOf('month').format('YYYY-MM-DD')) {
|
||||
this.$message.warning('批量预约截止日期不能超过预约开始时间所在月份')
|
||||
return false
|
||||
}
|
||||
if (!this.yearlyReserveDates.length) {
|
||||
this.$message.warning('当前选择的时间段在截止日期内无法生成可批量预约的日期')
|
||||
return false
|
||||
|
||||
+2
-2
@@ -288,7 +288,7 @@ layout("/layouts/platform.html"){
|
||||
return
|
||||
}
|
||||
const message = this.formData.yearlyBatch
|
||||
? ('该记录属于“预约本年”批量预约,提交后将一并审核同批次的 ' + (this.formData.batchAuditCount || 0) + ' 条预约记录,是否继续?')
|
||||
? ('该记录属于“预约本月”批量预约,提交后将一并审核同批次的 ' + (this.formData.batchAuditCount || 0) + ' 条预约记录,是否继续?')
|
||||
: '您确定要提交吗?'
|
||||
this.$confirm(message, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
@@ -317,7 +317,7 @@ layout("/layouts/platform.html"){
|
||||
return
|
||||
}
|
||||
const message = this.normalizeBatchFlag(row)
|
||||
? ('该记录属于“预约本年”批量预约,撤回后将一并撤回同批次的 ' + (row.batchAuditCount || row._batchCount || 0) + ' 条审核任务,是否继续?')
|
||||
? ('该记录属于“预约本月”批量预约,撤回后将一并撤回同批次的 ' + (row.batchAuditCount || row._batchCount || 0) + ' 条审核任务,是否继续?')
|
||||
: '您确定要撤回吗?'
|
||||
this.$confirm(message, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
|
||||
@@ -142,7 +142,10 @@ new Vue({
|
||||
return base.startOf('day').toDate()
|
||||
},
|
||||
yearlyReserveMaxDate() {
|
||||
return this.$moment().add(2, 'year').endOf('year').toDate()
|
||||
const base = this.formData.reserveStartTime
|
||||
? this.$moment(this.formData.reserveStartTime)
|
||||
: (this.scheduleDate ? this.$moment(this.scheduleDate, 'YYYY-MM-DD') : this.$moment())
|
||||
return base.endOf('month').toDate()
|
||||
},
|
||||
yearlyReserveDates() {
|
||||
if (!this.yearlyReserve || !this.formData.reserveStartTime || !this.formData.reserveEndTime || !this.formData.yearlyReserveEndDate) {
|
||||
@@ -255,6 +258,10 @@ new Vue({
|
||||
}
|
||||
if (this.formData.reserveStartTime && this.formData.yearlyReserveEndDate < this.formData.reserveStartTime.slice(0, 10)) {
|
||||
this.$set(this.formData, 'yearlyReserveEndDate', defaultDate)
|
||||
return
|
||||
}
|
||||
if (this.formData.reserveStartTime && this.formData.yearlyReserveEndDate > defaultDate) {
|
||||
this.$set(this.formData, 'yearlyReserveEndDate', defaultDate)
|
||||
}
|
||||
},
|
||||
openReserveTypePicker() {
|
||||
@@ -488,6 +495,20 @@ new Vue({
|
||||
result.push('slot-block--closed')
|
||||
return result
|
||||
},
|
||||
formatSlotLabel(block) {
|
||||
const label = block && block.label ? block.label : ''
|
||||
const match = label.match(/^(.+?)\s+(\d{2}:\d{2}(?::\d{2})?\s*-\s*\d{2}:\d{2}(?::\d{2})?)$/)
|
||||
if (match) {
|
||||
return {
|
||||
name: match[1],
|
||||
time: match[2],
|
||||
}
|
||||
}
|
||||
return {
|
||||
name: label,
|
||||
time: '',
|
||||
}
|
||||
},
|
||||
onAvailabilityBlockClick(block) {
|
||||
if (!block || !block.key) {
|
||||
return
|
||||
@@ -847,6 +868,10 @@ new Vue({
|
||||
this.$toast('批量预约截止日期不能早于开始日期')
|
||||
return false
|
||||
}
|
||||
if (this.formData.reserveStartTime && this.formData.yearlyReserveEndDate > this.$moment(this.formData.reserveStartTime).endOf('month').format('YYYY-MM-DD')) {
|
||||
this.$toast('批量预约截止日期不能超过预约开始时间所在月份')
|
||||
return false
|
||||
}
|
||||
if (!this.yearlyReserveDates.length) {
|
||||
this.$toast('当前截止日期内没有可批量预约的同星期时段')
|
||||
return false
|
||||
|
||||
+33
-7
@@ -165,21 +165,30 @@ layout("/layouts/platform_h5.html"){
|
||||
.availability-popup__tabs {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
padding: 12px 16px 0;
|
||||
padding: 12px 16px 8px;
|
||||
overflow-x: auto;
|
||||
background: #f8fafc;
|
||||
scrollbar-width: none;
|
||||
-ms-overflow-style: none;
|
||||
}
|
||||
|
||||
.availability-popup__tabs::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.availability-tab {
|
||||
flex: 0 0 auto;
|
||||
min-width: 72px;
|
||||
height: 34px;
|
||||
padding: 0 14px;
|
||||
min-height: 34px;
|
||||
padding: 6px 14px;
|
||||
border: 1px solid #cbd5e1;
|
||||
border-radius: 999px;
|
||||
background: #ffffff;
|
||||
color: #475569;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
line-height: 1.2;
|
||||
white-space: nowrap;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
@@ -244,12 +253,13 @@ layout("/layouts/platform_h5.html"){
|
||||
|
||||
.slot-block {
|
||||
min-height: 48px;
|
||||
padding: 0 12px;
|
||||
padding: 8px 10px;
|
||||
border: 1px solid #dbe4ee;
|
||||
border-radius: 14px;
|
||||
background: #ffffff;
|
||||
color: #475569;
|
||||
display: inline-flex;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
@@ -259,6 +269,21 @@ layout("/layouts/platform_h5.html"){
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.slot-block__name,
|
||||
.slot-block__time {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.slot-block__time {
|
||||
margin-top: 2px;
|
||||
font-size: 12px;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.slot-block--available {
|
||||
border-color: #86efac;
|
||||
background: rgba(34, 197, 94, 0.1);
|
||||
@@ -464,7 +489,7 @@ layout("/layouts/platform_h5.html"){
|
||||
</template>
|
||||
</van-cell>
|
||||
<div v-if="yearlyReserve" class="batch-panel">
|
||||
<div class="section-tip">将自动预约截止日期内每周同一时段,默认到本月底。</div>
|
||||
<div class="section-tip">预约本月后续每周同一时段,默认到本月底。</div>
|
||||
<van-field
|
||||
:value="formData.yearlyReserveEndDate"
|
||||
label="截至日期"
|
||||
@@ -548,7 +573,8 @@ layout("/layouts/platform_h5.html"){
|
||||
type="button"
|
||||
:class="getBlockClass(block)"
|
||||
@click="onAvailabilityBlockClick(block)">
|
||||
<span>{{ block.label }}</span>
|
||||
<span class="slot-block__name">{{ formatSlotLabel(block).name }}</span>
|
||||
<span class="slot-block__time">{{ formatSlotLabel(block).time }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -3,7 +3,54 @@ layout("/layouts/platform_h5.html"){
|
||||
#-->
|
||||
|
||||
<style scoped>
|
||||
|
||||
.site-cug-card-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.site-cug-tag {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-height: 22px;
|
||||
padding: 0 8px;
|
||||
border-radius: 4px;
|
||||
background: #eef6ff;
|
||||
color: #0b75bd;
|
||||
font-size: 12px;
|
||||
}
|
||||
.site-cug-tag.gray {
|
||||
background: #f1f5f9;
|
||||
color: #64748b;
|
||||
}
|
||||
.site-cug-tag.warn {
|
||||
background: #fff3e5;
|
||||
color: #d97706;
|
||||
}
|
||||
.site-cug-tag.info {
|
||||
background: #eef2ff;
|
||||
color: #2563eb;
|
||||
}
|
||||
.site-cug-tag.muted {
|
||||
background: #f8fafc;
|
||||
color: #94a3b8;
|
||||
}
|
||||
.site-cug-batch-toggle {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
min-height: 22px;
|
||||
padding: 0 8px;
|
||||
border: 0;
|
||||
border-radius: 4px;
|
||||
background: #e0f2fe;
|
||||
color: #0369a1;
|
||||
font-size: 12px;
|
||||
}
|
||||
.site-cug-batch-child {
|
||||
padding-left: 8px;
|
||||
border-left: 3px solid #dbeafe;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="app" v-cloak>
|
||||
@@ -18,18 +65,35 @@ layout("/layouts/platform_h5.html"){
|
||||
|
||||
<table-list api="/platform/siteCug/mine/pageData" :page_form.sync="pageForm" ref="tableListRef" title="siteName" @ready="onReady">
|
||||
<template v-slot="{index,row}">
|
||||
<div :class="row._isBatchChild ? 'site-cug-batch-child' : ''">
|
||||
<div class="site-cug-card-tags">
|
||||
<span v-if="row.applyLoginName" class="site-cug-tag">{{ row.applyLoginName }}</span>
|
||||
<span class="site-cug-tag gray">{{ row.reserveType === 'club' ? '协会预约' : '分工会预约' }}</span>
|
||||
<span v-if="row.yearlyBatch" class="site-cug-tag warn">预约本月</span>
|
||||
<span v-if="row._isBatchChild" class="site-cug-tag muted">明细</span>
|
||||
<span v-if="row._batchCount > 1 && !row._isBatchChild" class="site-cug-tag info">共 {{ row._batchCount }} 条</span>
|
||||
<button
|
||||
v-if="row._hasFoldChildren && !row._isBatchChild"
|
||||
type="button"
|
||||
class="site-cug-batch-toggle"
|
||||
@click.stop="toggleBatchGroup(row)">
|
||||
<i :class="row._expanded ? 'fa fa-angle-up' : 'fa fa-angle-down'"></i>
|
||||
<span>{{ row._expanded ? '收起' : '展开' }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<table-column label="预约人">{{row.applyUserName || '-'}}</table-column>
|
||||
<table-column label="预约类型">{{row.reserveType === 'club' ? '协会预约' : '分工会预约'}}</table-column>
|
||||
<table-column label="开始时间">{{row.reserveStartTime}}</table-column>
|
||||
<table-column label="结束时间">{{row.reserveEndTime}}</table-column>
|
||||
<table-column label="当前节点">{{row.taskName || '-'}}</table-column>
|
||||
</div>
|
||||
</template>
|
||||
<template #actions="{index,row}">
|
||||
<div class="action-btn" @click="onView(row)">
|
||||
<i class="fa fa-eye"></i>
|
||||
<span>查看</span>
|
||||
</div>
|
||||
<div class="action-btn delete" @click="onDelete(row)" v-if="row.canCancel">
|
||||
<div class="action-btn delete" @click="onDelete(row)" v-if="!row._isBatchChild && row.canCancel">
|
||||
<i class="fa fa-trash"></i>
|
||||
<span>取消预约</span>
|
||||
</div>
|
||||
@@ -68,14 +132,113 @@ layout("/layouts/platform_h5.html"){
|
||||
value: null,
|
||||
}
|
||||
],
|
||||
expandedBatchKeys: {},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async onReady() {
|
||||
this.installTableListFoldHook()
|
||||
await this.querySiteType()
|
||||
await this.querySites()
|
||||
this.doSearch()
|
||||
},
|
||||
normalizeBatchFlag(row) {
|
||||
return row && (row.yearlyBatch === 1 || row.yearlyBatch === '1' || row.yearlyBatch === true)
|
||||
},
|
||||
getBatchGroupKey(row) {
|
||||
if (!this.normalizeBatchFlag(row)) {
|
||||
return 'single_' + row.id
|
||||
}
|
||||
return 'batch_' + (row.backOption || row.id) + '_' + (row.createdBy || '')
|
||||
},
|
||||
buildFoldedTableData(rows) {
|
||||
const groups = {}
|
||||
;(rows || []).forEach((row) => {
|
||||
const key = this.getBatchGroupKey(row)
|
||||
if (!groups[key]) {
|
||||
groups[key] = []
|
||||
}
|
||||
groups[key].push(Object.assign({}, row))
|
||||
})
|
||||
const displayRows = []
|
||||
Object.keys(groups).forEach((key) => {
|
||||
const sortedRows = groups[key].slice().sort((a, b) => {
|
||||
return (a.reserveStartTime || '').localeCompare(b.reserveStartTime || '')
|
||||
})
|
||||
const parent = Object.assign({}, sortedRows[0])
|
||||
const children = sortedRows.slice(1).map((item) => {
|
||||
return Object.assign({}, item, {
|
||||
_isBatchChild: true,
|
||||
_groupKey: key,
|
||||
_hasFoldChildren: false,
|
||||
})
|
||||
})
|
||||
parent._groupKey = key
|
||||
parent._isBatchChild = false
|
||||
parent._hasFoldChildren = children.length > 0
|
||||
parent._expanded = !!this.expandedBatchKeys[key]
|
||||
parent._batchCount = parent.batchDeleteCount || sortedRows.length
|
||||
parent._foldedRecords = children
|
||||
displayRows.push(parent)
|
||||
if (parent._expanded) {
|
||||
children.forEach((child) => displayRows.push(child))
|
||||
}
|
||||
})
|
||||
return displayRows
|
||||
},
|
||||
refreshFoldedTableData() {
|
||||
const tableList = this.$refs.tableListRef
|
||||
if (!tableList) {
|
||||
return
|
||||
}
|
||||
tableList.tableData = this.buildFoldedTableData(tableList._rawTableData || [])
|
||||
},
|
||||
toggleBatchGroup(row) {
|
||||
if (!row || !row._groupKey || !row._hasFoldChildren) {
|
||||
return
|
||||
}
|
||||
this.$set(this.expandedBatchKeys, row._groupKey, !this.expandedBatchKeys[row._groupKey])
|
||||
this.refreshFoldedTableData()
|
||||
},
|
||||
installTableListFoldHook() {
|
||||
const tableList = this.$refs.tableListRef
|
||||
if (!tableList || tableList._siteCugBatchFoldHooked) {
|
||||
return
|
||||
}
|
||||
tableList._siteCugBatchFoldHooked = true
|
||||
tableList._rawTableData = []
|
||||
tableList.pageData = () => {
|
||||
return this.loadFoldedMinePageData(tableList)
|
||||
}
|
||||
tableList.doSearch = () => {
|
||||
tableList.tableFinished = false
|
||||
tableList.tableData = []
|
||||
tableList._rawTableData = []
|
||||
tableList.localPageForm.pageNumber = 1
|
||||
tableList.$emit('update:page_form', Object.assign({}, tableList.localPageForm))
|
||||
return this.loadFoldedMinePageData(tableList)
|
||||
}
|
||||
},
|
||||
loadFoldedMinePageData(tableList) {
|
||||
tableList.tableLoading = true
|
||||
const loading = createListLoading()
|
||||
return this.$axios.post(tableList.api, tableList.json ? { pageForm: JSON.stringify(tableList.localPageForm) } : tableList.localPageForm).then((res) => {
|
||||
if (res.code === 0) {
|
||||
const list = res.data && Array.isArray(res.data.list) ? res.data.list : []
|
||||
tableList._rawTableData = (tableList._rawTableData || []).concat(list)
|
||||
tableList.tableData = this.buildFoldedTableData(tableList._rawTableData)
|
||||
tableList.localPageForm.totalCount = res.data ? res.data.totalCount : 0
|
||||
if (tableList._rawTableData.length >= tableList.localPageForm.totalCount) {
|
||||
tableList.tableFinished = true
|
||||
}
|
||||
tableList.$emit('update:page_form', Object.assign({}, tableList.localPageForm))
|
||||
}
|
||||
}).finally(() => {
|
||||
loading.close()
|
||||
tableList.tableLoading = false
|
||||
tableList.tableRefreshing = false
|
||||
})
|
||||
},
|
||||
onView(row) {
|
||||
this.$refs.infoRef.onOpen(row)
|
||||
},
|
||||
@@ -83,7 +246,7 @@ layout("/layouts/platform_h5.html"){
|
||||
this.$dialog.confirm({
|
||||
title: '提示',
|
||||
message: row.yearlyBatch
|
||||
? ('该记录属于“预约本年”批量预约,确认后将一并删除同批次的 ' + (row.batchDeleteCount || 0) + ' 条预约记录,是否继续?')
|
||||
? ('该记录属于“预约本月”批量预约,确认后将一并删除同批次的 ' + (row.batchDeleteCount || row._batchCount || 0) + ' 条预约记录,是否继续?')
|
||||
: '您确定要取消该预约吗?',
|
||||
}).then(() => {
|
||||
this.$axios.post('/platform/siteCug/mine/delete', { id: row.id }).then((res) => {
|
||||
@@ -134,6 +297,7 @@ layout("/layouts/platform_h5.html"){
|
||||
},
|
||||
doSearch() {
|
||||
this.$nextTick(() => {
|
||||
this.expandedBatchKeys = {}
|
||||
this.pageForm.pageNumber = 1
|
||||
this.pageForm.totalCount = 0
|
||||
this.$refs.tableListRef.doSearch()
|
||||
@@ -145,4 +309,4 @@ layout("/layouts/platform_h5.html"){
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
#-->
|
||||
|
||||
+141
-5
@@ -52,6 +52,30 @@ layout("/layouts/platform_h5.html"){
|
||||
background: #fff3e5;
|
||||
color: #d97706;
|
||||
}
|
||||
.site-cug-tag.info {
|
||||
background: #eef2ff;
|
||||
color: #2563eb;
|
||||
}
|
||||
.site-cug-tag.muted {
|
||||
background: #f8fafc;
|
||||
color: #94a3b8;
|
||||
}
|
||||
.site-cug-batch-toggle {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
min-height: 22px;
|
||||
padding: 0 8px;
|
||||
border: 0;
|
||||
border-radius: 4px;
|
||||
background: #e0f2fe;
|
||||
color: #0369a1;
|
||||
font-size: 12px;
|
||||
}
|
||||
.site-cug-batch-child {
|
||||
padding-left: 8px;
|
||||
border-left: 3px solid #dbeafe;
|
||||
}
|
||||
.action-btn.disabled {
|
||||
opacity: 0.45;
|
||||
pointer-events: none;
|
||||
@@ -94,10 +118,21 @@ layout("/layouts/platform_h5.html"){
|
||||
<div class="site-cug-audit-list-scroll">
|
||||
<table-list api="/platform/siteCug/schoolUnionAudit/pageData" :page_form.sync="pageForm" ref="tableListRef" title="applyUserName" @ready="onReady">
|
||||
<template v-slot="{index,row}">
|
||||
<div :class="row._isBatchChild ? 'site-cug-batch-child' : ''">
|
||||
<div class="site-cug-card-tags">
|
||||
<span v-if="row.applyLoginName" class="site-cug-tag">{{ row.applyLoginName }}</span>
|
||||
<span class="site-cug-tag gray">{{ reserveTypeText(row) }}</span>
|
||||
<span v-if="row.yearlyBatch" class="site-cug-tag warn">预约本年</span>
|
||||
<span v-if="row.yearlyBatch" class="site-cug-tag warn">预约本月</span>
|
||||
<span v-if="row._isBatchChild" class="site-cug-tag muted">明细</span>
|
||||
<span v-if="row._batchCount > 1 && !row._isBatchChild" class="site-cug-tag info">共 {{ row._batchCount }} 条</span>
|
||||
<button
|
||||
v-if="row._hasFoldChildren && !row._isBatchChild"
|
||||
type="button"
|
||||
class="site-cug-batch-toggle"
|
||||
@click.stop="toggleBatchGroup(row)">
|
||||
<i :class="row._expanded ? 'fa fa-angle-up' : 'fa fa-angle-down'"></i>
|
||||
<span>{{ row._expanded ? '收起' : '展开' }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<table-column label="场地名称">{{row.siteName}}</table-column>
|
||||
<table-column label="预约主体">{{row.reserveType === 'club' ? (row.clubName || '-') : (row.applyUnionName || '-')}}</table-column>
|
||||
@@ -105,17 +140,18 @@ layout("/layouts/platform_h5.html"){
|
||||
<table-column label="开始时间">{{row.reserveStartTime}}</table-column>
|
||||
<table-column label="结束时间">{{row.reserveEndTime}}</table-column>
|
||||
<table-column label="当前节点">{{row.curTaskName || '-'}}</table-column>
|
||||
</div>
|
||||
</template>
|
||||
<template #actions="{index,row}">
|
||||
<div class="action-btn" @click="onView(row)">
|
||||
<i class="fa fa-eye"></i>
|
||||
<span>查看</span>
|
||||
</div>
|
||||
<div class="action-btn" v-if="row.taskState === 10" @click="onAudit(row)">
|
||||
<div class="action-btn" v-if="!row._isBatchChild && row.taskState === 10" @click="onAudit(row)">
|
||||
<i class="fa fa-edit"></i>
|
||||
<span>审核</span>
|
||||
</div>
|
||||
<div class="action-btn delete" v-if="canRevoke(row)" :class="{ loading: revokeLoading }" @click="onRevoke(row)">
|
||||
<div class="action-btn delete" v-if="!row._isBatchChild && canRevoke(row)" :class="{ loading: revokeLoading }" @click="onRevoke(row)">
|
||||
<van-loading v-if="revokeLoading" size="14px" color="#fff"></van-loading>
|
||||
<i v-else class="fa fa-reply"></i>
|
||||
<span>撤回</span>
|
||||
@@ -184,11 +220,13 @@ layout("/layouts/platform_h5.html"){
|
||||
showApprovalForm: false,
|
||||
auditLoading: false,
|
||||
revokeLoading: false,
|
||||
expandedBatchKeys: {},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
historyBack,
|
||||
async onReady() {
|
||||
this.installTableListFoldHook()
|
||||
await this.querySiteType()
|
||||
await this.querySites()
|
||||
this.doSearch()
|
||||
@@ -203,6 +241,103 @@ layout("/layouts/platform_h5.html"){
|
||||
reserveTypeText(row) {
|
||||
return row && row.reserveType === 'club' ? '协会预约' : '分工会预约'
|
||||
},
|
||||
normalizeBatchFlag(row) {
|
||||
return row && (row.yearlyBatch === 1 || row.yearlyBatch === '1' || row.yearlyBatch === true)
|
||||
},
|
||||
getBatchGroupKey(row) {
|
||||
if (!this.normalizeBatchFlag(row)) {
|
||||
return 'single_' + row.id
|
||||
}
|
||||
return 'batch_' + (row.backOption || row.id) + '_' + (row.createdBy || '')
|
||||
},
|
||||
buildFoldedTableData(rows) {
|
||||
const groups = {}
|
||||
;(rows || []).forEach((row) => {
|
||||
const key = this.getBatchGroupKey(row)
|
||||
if (!groups[key]) {
|
||||
groups[key] = []
|
||||
}
|
||||
groups[key].push(Object.assign({}, row))
|
||||
})
|
||||
const displayRows = []
|
||||
Object.keys(groups).forEach((key) => {
|
||||
const sortedRows = groups[key].slice().sort((a, b) => {
|
||||
return (a.reserveStartTime || '').localeCompare(b.reserveStartTime || '')
|
||||
})
|
||||
const parent = Object.assign({}, sortedRows[0])
|
||||
const children = sortedRows.slice(1).map((item) => {
|
||||
return Object.assign({}, item, {
|
||||
_isBatchChild: true,
|
||||
_groupKey: key,
|
||||
_hasFoldChildren: false,
|
||||
})
|
||||
})
|
||||
parent._groupKey = key
|
||||
parent._isBatchChild = false
|
||||
parent._hasFoldChildren = children.length > 0
|
||||
parent._expanded = !!this.expandedBatchKeys[key]
|
||||
parent._batchCount = parent.batchAuditCount || sortedRows.length
|
||||
parent._foldedRecords = children
|
||||
displayRows.push(parent)
|
||||
if (parent._expanded) {
|
||||
children.forEach((child) => displayRows.push(child))
|
||||
}
|
||||
})
|
||||
return displayRows
|
||||
},
|
||||
refreshFoldedTableData() {
|
||||
const tableList = this.$refs.tableListRef
|
||||
if (!tableList) {
|
||||
return
|
||||
}
|
||||
tableList.tableData = this.buildFoldedTableData(tableList._rawTableData || [])
|
||||
},
|
||||
toggleBatchGroup(row) {
|
||||
if (!row || !row._groupKey || !row._hasFoldChildren) {
|
||||
return
|
||||
}
|
||||
this.$set(this.expandedBatchKeys, row._groupKey, !this.expandedBatchKeys[row._groupKey])
|
||||
this.refreshFoldedTableData()
|
||||
},
|
||||
installTableListFoldHook() {
|
||||
const tableList = this.$refs.tableListRef
|
||||
if (!tableList || tableList._siteCugBatchFoldHooked) {
|
||||
return
|
||||
}
|
||||
tableList._siteCugBatchFoldHooked = true
|
||||
tableList._rawTableData = []
|
||||
tableList.pageData = () => {
|
||||
return this.loadFoldedAuditPageData(tableList)
|
||||
}
|
||||
tableList.doSearch = () => {
|
||||
tableList.tableFinished = false
|
||||
tableList.tableData = []
|
||||
tableList._rawTableData = []
|
||||
tableList.localPageForm.pageNumber = 1
|
||||
tableList.$emit('update:page_form', Object.assign({}, tableList.localPageForm))
|
||||
return this.loadFoldedAuditPageData(tableList)
|
||||
}
|
||||
},
|
||||
loadFoldedAuditPageData(tableList) {
|
||||
tableList.tableLoading = true
|
||||
const loading = createListLoading()
|
||||
return this.$axios.post(tableList.api, tableList.json ? { pageForm: JSON.stringify(tableList.localPageForm) } : tableList.localPageForm).then((res) => {
|
||||
if (res.code === 0) {
|
||||
const list = res.data && Array.isArray(res.data.list) ? res.data.list : []
|
||||
tableList._rawTableData = (tableList._rawTableData || []).concat(list)
|
||||
tableList.tableData = this.buildFoldedTableData(tableList._rawTableData)
|
||||
tableList.localPageForm.totalCount = res.data ? res.data.totalCount : 0
|
||||
if (tableList._rawTableData.length >= tableList.localPageForm.totalCount) {
|
||||
tableList.tableFinished = true
|
||||
}
|
||||
tableList.$emit('update:page_form', Object.assign({}, tableList.localPageForm))
|
||||
}
|
||||
}).finally(() => {
|
||||
loading.close()
|
||||
tableList.tableLoading = false
|
||||
tableList.tableRefreshing = false
|
||||
})
|
||||
},
|
||||
onView(row) {
|
||||
this.showApprovalForm = false
|
||||
this.$refs.infoRef.onOpen(row)
|
||||
@@ -228,7 +363,7 @@ layout("/layouts/platform_h5.html"){
|
||||
this.$dialog.confirm({
|
||||
title: '提示',
|
||||
message: this.formData.yearlyBatch
|
||||
? ('该记录属于“预约本年”批量预约,提交后将一并审核同批次的 ' + (this.formData.batchAuditCount || 0) + ' 条预约记录,是否继续?')
|
||||
? ('该记录属于“预约本月”批量预约,提交后将一并审核同批次的 ' + (this.formData.batchAuditCount || 0) + ' 条预约记录,是否继续?')
|
||||
: '您确定要提交吗?',
|
||||
}).then(() => {
|
||||
this.auditLoading = true
|
||||
@@ -267,7 +402,7 @@ layout("/layouts/platform_h5.html"){
|
||||
this.$dialog.confirm({
|
||||
title: '提示',
|
||||
message: row.yearlyBatch
|
||||
? ('该记录属于“预约本年”批量预约,撤回后将一并撤回同批次的 ' + (row.batchAuditCount || 0) + ' 条审核任务,是否继续?')
|
||||
? ('该记录属于“预约本月”批量预约,撤回后将一并撤回同批次的 ' + (row.batchAuditCount || 0) + ' 条审核任务,是否继续?')
|
||||
: '您确定要撤回吗?',
|
||||
}).then(() => {
|
||||
this.revokeLoading = true
|
||||
@@ -321,6 +456,7 @@ layout("/layouts/platform_h5.html"){
|
||||
},
|
||||
doSearch() {
|
||||
this.$nextTick(() => {
|
||||
this.expandedBatchKeys = {}
|
||||
this.pageForm.pageNumber = 1
|
||||
this.pageForm.totalCount = 0
|
||||
this.$refs.tableListRef.doSearch()
|
||||
|
||||
Reference in New Issue
Block a user