This commit is contained in:
@jyuhsin
2025-09-10 17:51:48 +08:00
parent f2c5ccf515
commit c913ee1a12
13 changed files with 896 additions and 30 deletions
@@ -170,7 +170,7 @@ public class SiteApplyController {
@At
@ApiOperation("查询可以预约的日期")
@SaCheckPermission(value = {"site.apply", "h5.site.apply"}, mode = SaMode.OR)
public Result queryAllowTime(String siteId, String startTime, String endTime) {
public Result queryAllowDay(String siteId, String startTime, String endTime) {
if(StrUtil.isBlank(siteId)) {
return Result.success(new ArrayList<>());
}
@@ -58,7 +58,7 @@ public class SiteMineController {
public void index() {}
@At("/h5")
@Ok("beetl:/platform/zhgh/dayofficework/site/mine/index.html")
@Ok("beetl:/platform/zhghh5/dayofficework/site/mine/index.html")
@SaCheckPermission("h5.site.mine")
public void h5Index() {}
@@ -105,7 +105,7 @@ const apply = {
watch: {
applyTime() {
this.$nextTick(async () => {
await this.queryAllowTime()
await this.queryAllowDay()
})
},
},
@@ -166,7 +166,7 @@ const apply = {
},
async onOpen(row, applyRow = null) {
this.row = row
await this.queryAllowTime()
await this.queryAllowDay()
if(applyRow) {
this.taskId = applyRow.taskId
this.bizId = applyRow.bizId
@@ -231,11 +231,11 @@ const apply = {
}
},
// 查询哪些天是开放的
async queryAllowTime() {
async queryAllowDay() {
const days = Array.from(document.querySelectorAll('.div-Calendar'))
.map(el => el.getAttribute('data-day'))
.sort()
const {data} = await this.$axios.post("/platform/site/apply/queryAllowTime", {
const {data} = await this.$axios.post("/platform/site/apply/queryAllowDay", {
siteId: this.row.id,
startTime: days[0],
endTime: days[days.length - 1],
@@ -254,17 +254,17 @@ const apply = {
},
},
style: /*language=CSS*/ `
.div-Calendar {
::v-deep .div-Calendar {
box-sizing: border-box;
height: 100%;
}
.div-Calendar p {
::v-deep .div-Calendar p {
margin: 0;
}
.el-calendar-day:has(.not-allow-day) {
::v-deep .el-calendar-day:has(.not-allow-day) {
background-color: #F5F5F5;
}
.el-dialog__body {
::v-deep .el-dialog__body {
padding-top: 0;
}
`
@@ -3,19 +3,7 @@ layout("/layouts/platform.html"){
#-->
<style>
.div-Calendar {
box-sizing: border-box;
height: 100%;
}
.div-Calendar p {
margin: 0;
}
.el-calendar-day:has(.not-allow-day) {
background-color: #F5F5F5;
}
.el-dialog__body {
padding-top: 0;
}
</style>
<div id="app" v-cloak>
@@ -140,7 +140,7 @@ const basicForm = {
style="width: 100%"
placeholder="开始时间"
v-model="row.startTime"
:picker-options="{ start: '00:00',step: '00:30',end: '24:00'}">
:picker-options="{ start: '00:00',step: '00:30',end: '23:59'}">
</el-time-select>
</template>
</el-table-column>
@@ -150,7 +150,7 @@ const basicForm = {
style="width: 100%"
placeholder="结束时间"
v-model="row.endTime"
:picker-options="{start: '00:00',step: '00:30',end: '24:00',minTime: row.start_time }">
:picker-options="{start: '00:00',step: '00:30',end: '23:59',minTime: row.start_time }">
</el-time-select>
</template>
</el-table-column>
@@ -36,22 +36,26 @@ layout("/layouts/platform_h5.html"){
<i class="fa fa-eye"></i>
<span>查看</span>
</div>
<div class="action-btn" @click="onEdit(row)">
<div class="action-btn" @click="onApply(row)">
<i class="fa fa-edit"></i>
<span>预约</span>
</div>
</template>
</table-list>
<info ref="infoRef"></info>
<site-apply ref="applyRef"></site-apply>
</div>
<script>
<!--#include('../common/siteInfo.js'){}#-->
<!--#include('../common/apply.js'){}#-->
new Vue({
el: "#app",
store,
components: {
"info": siteInfo,
"site-apply": apply,
},
data() {
return {
@@ -63,9 +67,16 @@ layout("/layouts/platform_h5.html"){
year: new Date().getFullYear(),
type: null
},
typeOptions: [],
}
},
methods: {
onView(row) {
this.$refs.infoRef.onOpen(row)
},
onApply(row) {
this.$refs.applyRef.onOpen(row)
},
async onReady() {
const typeList = await this.querySiteType()
this.typeOptions = [
@@ -0,0 +1,327 @@
const apply = {
template: /*language=HTML*/ `
<div>
<van-popup v-model:show="visible" :style="{ height: '100%',width: '100%', 'background-color': '#F7F8FA'}" position="right" safe-area-inset-bottom>
<van-nav-bar :title="row.name" left-text="返回" left-arrow @click-left="visible = false" fixed placeholder></van-nav-bar>
<div class="top-calendar">
<div class="calendar-left">
<div :class="getDayClass(item)" @click="dayClick(item)" v-for="item in weekList">
<div class="day-info-week">
{{item.weekdayCN}}
</div>
<div class="day-info-month">
{{$moment(item.day).format('MM-DD')}}
</div>
</div>
</div>
</div>
<div class="container">
<table v-if="weekList.find(o => $moment(o.day).unix() === $moment(selectDate).unix())?.disabled === false" style="width: 100%">
<template v-for="item in allowTimeList">
<tr>
<td class="container-times">{{item.startTime + '-' + item.endTime}}</td>
<td>
<div v-if="item.disabled === true" class="container-state">{{ item.tooltip }}</div>
<div @click="selectTime(item)" v-else class="container-state" style="background-color: #e8ffef; color: #52986a">
<label v-if="(item.dateStr + ' ' + item.startTime + '-' + item.endTime) !== (selected.dateStr + ' ' + selected.startTime + '-' + selected.endTime)">
可预约
</label>
<span v-else>
<van-icon name="passed" size="26" style="line-height: 36px;position: unset"></van-icon>
</span>
</div>
</td>
</tr>
</template>
</table>
<van-empty v-else image="error" :description="selectDate + '不能预约'"></van-empty>
</div>
<div style="position: fixed; bottom: 0; width: 100%">
<van-button @click="onApply" type="primary" color="#246fb4" style="width: 100%">确定预约</van-button>
</div>
</van-popup>
<van-action-sheet v-model="formVisible" title="确认预约信息">
<van-notice-bar left-icon="volume-o"
:text="'您已选择的预约日期为:' + selectDate"></van-notice-bar>
<van-form ref="formRef" class="form-container">
<van-field label="预约人" :rules="[{ required: true }]" v-model="formData.applyUserName" readonly
required name="applyUserName"></van-field>
<van-field label="性别" :rules="[{ required: true }]" v-model="formData.sex" readonly
required name="sex"></van-field>
<van-field label="工号" :rules="[{ required: true }]" v-model="formData.applyLoginName" readonly
required name="applyLoginName"></van-field>
<van-field label="所属单位" :rules="[{ required: true }]" v-model="formData.applyUnitName" readonly
required name="applyUnitName"></van-field>
<van-field label="联系电话" :rules="[{ required: true }]" v-model="formData.applyMobile" type="number"
required name="applyMobile"></van-field>
<van-field label="预约时间" :rules="[{ required: true }]" v-model="formData.applyTime"
required readonly name="applyTime"></van-field>
<van-field name="stepper" label="预约人数" required :rules="[{ required: true }]">
<template #input>
<van-stepper
:disabled="row.reserveTarget === 1 || row.reserveTarget === 3"
v-model="formData.joinCount"></van-stepper>
</template>
</van-field>
<van-field
v-model="formData.applyCause"
rows="4"
autosize
label="预约事由"
type="textarea"
maxlength="50"
placeholder="请输入预约事由"
show-word-limit
required
name="applyCause"
:rules="[{ required: true }]"
></van-field>
<div class="form-actions">
<van-button @click="formVisible = false" type="info" plain round>关闭</van-button>
<van-button @click="onSubmit" v-if="!taskId" type="info" round>提交</van-button>
<van-button @click="onFinishTask" type="info" round>提交</van-button>
</div>
</van-form>
</van-action-sheet>
</div>
`,
store,
data() {
return {
taskId: '',
bizId: '',
row: {},
visible: false,
selectDate: '',
selected: {},
weekList: [],
allowDayList: [],
allowTimeList: [],
weekdayCNMap: {0: '周日', 1: '周一', 2: '周二', 3: '周三', 4: '周四', 5: '周五', 6: '周六'},
formVisible: false,
formData: {},
}
},
watch: {
},
methods: {
async onOpen(row, applyRow = null) {
this.row = row
this.visible = true
await this.init()
if(applyRow) {
this.taskId = applyRow.taskId
this.bizId = applyRow.bizId
this.applyTime = applyRow.applyDay
this.selectDate = applyRow.applyDay
this.selected = {
dateStr: applyRow.applyDay,
startTime: applyRow.startTime,
endTime: applyRow.endTime,
}
this.formVisible = true
this.formData = clone(applyRow)
this.$set(this.formData, 'applyTime', this.formData.startTime + '-' + this.formData.endTime)
this.$set(this.formData, 'sex', this.$store.state.user.sex)
const day = this.weekList.find(o => o.dateStr === applyRow.applyDay)
if(day) {
await this.dayClick(day)
}
}
},
async init() {
this.selectDate = this.$moment().format('YYYY-MM-DD')
await this.queryAllowDay()
await this.queryTimesByDay()
this.setWeekList(this.selectDate)
},
onApply() {
if(Object.keys(this.selected).length === 0) {
this.$toast('请选择要预约的时间')
return
}
this.$set(this.formData, "applyUserId", this.$store.state.user.id)
this.$set(this.formData, "applyUserName", this.$store.state.user.username)
this.$set(this.formData, "applyLoginName", this.$store.state.user.loginname,)
this.$set(this.formData, "applyUnitId", this.$store.state.user?.unit?.id)
this.$set(this.formData, "applyUnitName", this.$store.state.user?.unit?.name)
this.$set(this.formData, "applyUnionId", this.$store.state.user?.union?.id)
this.$set(this.formData, "applyUnionName", this.$store.state.user?.union?.name)
this.$set(this.formData, "applyMobile", this.$store.state.user.mobile)
this.$set(this.formData, "sex", this.$store.state.user.sex)
this.$set(this.formData, "siteId", this.row.id)
this.$set(this.formData, "applyTime", this.selected.startTime + '-' + this.selected.endTime)
if (this.row.reserveTarget === 1 || this.row.reserveTarget === 3) {
this.$set(this.formData, "joinCount", this.row.maxNum)
} else {
this.$set(this.formData, "joinCount", 1)
}
this.formVisible = true
},
onSubmit() {
this.$refs.formRef.validate().then(() => {
this.$dialog.confirm({
title: "提示",
message: "您确定要提交吗?"
}).then(async () => {
const res = await this.$axios.post("/platform/site/apply/submit", {
data: JSON.stringify(this.formData),
days: JSON.stringify([this.selected.dateStr])
})
this.$toast(res.msg)
if (res.code === 0) {
this.$pjaxReplace("/platform/site/mine/h5")
}
})
})
},
onFinishTask() {
if (!this.formData.applyTime) {
this.$toast('未选择预约时间')
return
}
this.$refs.formRef.validate().then(() => {
this.$dialog.confirm({
title: "提示",
message: "您确定要提交吗?"
}).then(() => {
this.$axios.post('/platform/site/apply/submitAgain', {
data: JSON.stringify(this.formData),
days: JSON.stringify([this.selected.dateStr]),
taskId: this.taskId
}).then(res => {
this.$toast(res.msg)
if (res.code === 0) {
this.$pjaxReplace("/platform/site/mine/h5")
}
})
})
})
},
selectTime(item) {
if((item.dateStr + ' ' + item.startTime + '-' + item.endTime) !== (this.selected.dateStr + ' ' + this.selected.startTime + '-' + this.selected.endTime)) {
this.$set(this.selected, 'day', item.dateStr)
this.$set(this.selected, 'startTime', item.startTime)
this.$set(this.selected, 'endTime', item.endTime)
} else {
this.selected = {}
}
},
// 获取每天的样式
getDayClass(row) {
let classStr = 'calendar-left-day'
if(row.disabled) {
classStr += ' left-day-disabled'
} else {
classStr += this.$moment(row.day).unix() === this.$moment(this.selectDate).unix() ? ' left-day-active' : ''
}
return classStr
},
// 点击某一天
async dayClick(item) {
this.selectDate = item.dateStr
if(item.disabled) {
this.$toast(this.$moment(item.day).format('YYYY-MM-DD') + '不可预约')
} else {
await this.queryTimesByDay()
}
},
// 获取一周
setWeekList(startDate) {
const start = this.$moment(startDate)
const allowDaySet = new Set(this.allowDayList)
this.weekList = Array.from({ length: 8 }, (_, index) => {
const day = start.clone().add(index, 'd')
const dateStr = day.format('YYYY-MM-DD')
const disabled = this.allowDayList.length > 0 && !allowDaySet.has(dateStr)
const weekdayCN = this.weekdayCNMap[day.day()]
return { day, disabled, weekdayCN, dateStr }
})
},
// 查询哪些天是开放的
async queryAllowDay() {
const startTime = this.weekList.length === 0 ? this.$moment().format('YYYY-MM-DD') : this.weekList[0].dateStr
const endTime = this.weekList.length === 0 ? this.$moment().add(8, 'd').format('YYYY-MM-DD') : this.weekList[this.weekList.length - 1].dateStr
const {data} = await this.$axios.post("/platform/site/apply/queryAllowDay", {
siteId: this.row.id,
startTime: startTime,
endTime: endTime,
})
this.allowDayList = data
},
// 查询时间段
async queryTimesByDay() {
const {data} = await this.$axios.post("/platform/site/apply/queryTimesByDay", {
siteId: this.row.id,
day: this.selectDate,
})
this.allowTimeList = data
},
},
style: /*language=CSS*/ `
::v-deep .top-calendar {
height: 70px;
max-height: 70px;
position: sticky;
top: 0;
left: 0;
width: 100%;
max-width: 100%;
display: flex;
align-items: center;
background-color: #0e78c5;
}
::v-deep .calendar-left {
/*width: calc(100% - 20px);*/
overflow-x: auto;
display: flex;
height: 90%;
}
::v-deep .calendar-left-day {
min-width: 65px;
height: 100%;
margin: 0 5px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: #FFF;
border-radius: 10px;
}
::v-deep .left-day-active {
background-color: #0000cc;
}
::v-deep .left-day-disabled {
background-color: lightgrey;
}
::v-deep .container {
background-color: white;
margin: 10px 0;
padding: 10px 0;
overflow-y: auto;
height: calc(100vh - 46px - 70px - 56px - 30px);
}
::v-deep .container-times {
width: 58%;
text-align: center;
}
::v-deep .container-state {
width: 80px;
height: 36px;
line-height: 36px;
text-align: center;
background-color: #f2f2f2;
border-radius: 2px;
color: #929292;
}
::v-deep table {
border-collapse: collapse;
}
`
}
@@ -0,0 +1,76 @@
const applyInfo = {
template:
/*language=HTML*/
`
<van-action-sheet v-model="visible" title="查看详情">
<div class="detail-container">
<van-cell-group title="基本信息">
<van-cell title="预约场地">{{ viewData.siteName }}</van-cell>
<van-cell title="预约人">{{ viewData.applyUserName }}</van-cell>
<van-cell title="预约人工号">{{ viewData.applyLoginName }}</van-cell>
<van-cell title="所属单位">{{ viewData.applyUnitName }}</van-cell>
<van-cell title="预约日期">{{ viewData.applyDay }}</van-cell>
<van-cell title="开始时间">{{ viewData.startTime }}</van-cell>
<van-cell title="结束时间">{{ viewData.endTime }}</van-cell>
<van-cell title="联系电话">{{ viewData.applyMobile }}</van-cell>
<van-cell title="预约人数">{{ viewData.joinCount }}</van-cell>
<van-cell title="预约事由" class="direction-column-cell">{{ viewData.applyCause }}</van-cell>
</van-cell-group>
<template v-for="task in doneTasks">
<van-cell-group :title="task.displayName" v-if="task.ext.isFirstTaskNode">
<van-cell title="申请用户">{{ task.ext.initiatorName }}({{task.ext.initiatorAccount}})
</van-cell>
<van-cell title="申请时间">{{ task.finishTime }}</van-cell>
<van-cell title="办理结果">
<dict-tag :options="dict.type.PROCESS_TASK_SUBMIT_TYPE"
:value="task.ext.submitType"></dict-tag>
</van-cell>
</van-cell-group>
<van-cell-group :title="task.displayName" v-else>
<van-cell title="办理用户">{{ task.taskFormData.userName }}({{task.taskFormData.loginName}})
</van-cell>
<van-cell title="办理时间">{{ task.finishTime }}</van-cell>
<van-cell title="办理结果">
<dict-tag :options="dict.type.PROCESS_TASK_SUBMIT_TYPE"
:value="task.ext.submitType"></dict-tag>
</van-cell>
<van-cell title="办理意见" v-if="!task.ext.isFirstTaskNode" class="direction-column-cell">
<div v-html="task.taskFormData.tf_opinion"></div>
</van-cell>
</van-cell-group>
</template>
</div>
<slot></slot>
</van-action-sheet>
`,
dicts: ["PROCESS_TASK_SUBMIT_TYPE"],
data() {
return {
visible:false,
viewData: {},
doneTasks: [],
row: null,
}
},
methods: {
onOpen(row) {
this.row = row
this.visible = true
this.viewData = row
this.getDoneTasks()
},
onClose(){
this.visible = false
},
getDoneTasks() {
this.$axios.post("/flow/common/doneTasks", {bizId: this.row.id}).then((res) => {
if (res.code === 0) {
this.doneTasks = res.data
}
})
},
},
style: /*language=CSS*/ `
`
}
@@ -0,0 +1,123 @@
const siteInfo = {
template: /*language=HTML*/ `
<div>
<van-action-sheet v-model="visible" title="场地信息">
<div class="detail-container">
<van-cell-group title="基本信息">
<van-cell title="创建人">{{ viewData.createUserName }}</van-cell>
<van-cell title="创建时间">{{ viewData.createTime }}</van-cell>
<van-cell title="场地名称">{{ viewData.name }}</van-cell>
<van-cell title="场地地址" class="direction-column-cell">{{ viewData.address }}</van-cell>
<van-cell title="联系人">{{ viewData.contactName }}</van-cell>
<van-cell title="联系电话">{{ viewData.contactPhone }}</van-cell>
<van-cell title="排序编号">{{ viewData.sortNum }}</van-cell>
<van-cell title="容纳人数">{{ viewData.maxNum }}</van-cell>
<van-cell title="场地类型">{{ viewData.typeName }}</van-cell>
<van-cell title="面向对象">
<span v-if="viewData.reserveTarget === 1">面向分工会</span>
<span v-if="viewData.reserveTarget === 2">面向个人</span>
<span v-if="viewData.reserveTarget === 3">面向集体</span>
</van-cell>
<van-cell title="性别限制">
<span v-if="viewData.sexLimit === 0">不限制</span>
<span v-if="viewData.sexLimit === 1">男</span>
<span v-if="viewData.sexLimit === 2">女</span>
</van-cell>
<van-cell title="开启状态">
<span v-if="viewData.state">开启</span>
<span v-else>禁用</span>
</van-cell>
<van-cell title="排除节假日">
<span v-if="viewData.state">是</span>
<span v-else>否</span>
</van-cell>
<van-cell title="场地介绍" class="direction-column-cell">
<div v-if="viewData.introduce" v-html="viewData.introduce"></div>
<div v-else>暂无场地介绍</div>
</van-cell>
</van-cell-group>
<van-cell-group title="禁用时间" v-if="viewData.notApplyTimeList && viewData.notApplyTimeList.length > 0">
<table class="table-class">
<thead>
<tr>
<th>日期</th>
<th>开始时间</th>
<th>结束时间</th>
</tr>
</thead>
<tbody>
<tr v-for="(item,index) in viewData.notApplyTimeList" :key="index">
<td>{{ item.date }}</td>
<td>{{ item.startTime }}</td>
<td>{{ item.endTime }}</td>
</tr>
</tbody>
</table>
</van-cell-group>
<van-cell-group title="场次" v-if="viewData.openHours && viewData.openHours.length > 0">
<table class="table-class">
<thead>
<tr>
<th>星期</th>
<th>开始时间</th>
<th>结束时间</th>
<th>预约时间单位(小时)</th>
</tr>
</thead>
<tbody>
<tr v-for="(item,index) in viewData.openHours" :key="index">
<td>
<span v-if="item.weekNum === 1">周一</span>
<span v-if="item.weekNum === 2">周二</span>
<span v-if="item.weekNum === 3">周三</span>
<span v-if="item.weekNum === 4">周四</span>
<span v-if="item.weekNum === 5">周五</span>
<span v-if="item.weekNum === 6">周六</span>
<span v-if="item.weekNum === 0">周日</span>
</td>
<td>{{ item.startTime }}</td>
<td>{{ item.endTime }}</td>
<td>{{ item.timeUnit }}</td>
</tr>
</tbody>
</table>
</van-cell-group>
</div>
</van-action-sheet>
</div>
`,
data() {
return {
viewData: {},
visible: false
}
},
methods: {
onOpen(row) {
this.viewData = row
this.visible = true
},
},
style: /*language=CSS*/ `
::v-deep .table-class{
width: 100%;
border-radius: 5px;
overflow: hidden;
line-height: 1.5rem;
font-size: 13px;
table-layout: fixed;
border-collapse: collapse;
}
::v-deep .table-class th {
background-color: #f2f2f2;
border: 1px solid #dddddd;
}
::v-deep .table-class tr {
text-align: center;
border-bottom: 1px solid #dddddd;
}
::v-deep .table-class td {
border: 1px solid #dddddd;
}
`
}
@@ -0,0 +1,154 @@
<!--#
layout("/layouts/platform_h5.html"){
#-->
<style scoped>
</style>
<div id="app">
<van-nav-bar title="我的申请" left-text="返回" left-arrow @click-left="historyBack" fixed placeholder></van-nav-bar>
<van-sticky offset-top="46px">
<van-search
v-model="pageForm.searchKeyword"
:show-action="false"
:reverse-color="false"
input-align="left"
placeholder="请输入姓名或者工号搜索"
@search="doSearch"
></van-search>
<van-dropdown-menu :close-on-click-outside="false" :close-on-click-overlay="false">
<year-van-dropdown-item :num="5" @change="doSearch" v-model="pageForm.year"></year-van-dropdown-item>
<van-dropdown-item v-model="pageForm.siteType" :options="typeOptions" :multiple="false"
@change="doSearch"></van-dropdown-item>
</van-dropdown-menu>
</van-sticky>
<table-list api="/platform/site/mine/pageData" :page_form.sync="pageForm" ref="tableListRef" title="applyUserName" @ready="onReady">
<template v-slot="{index,row}">
<table-column label="场地名称">{{row.siteName}}</table-column>
<table-column label="所属单位">{{row.applyUnitName}}</table-column>
<table-column label="预约日期">{{row.applyDay}}</table-column>
<table-column label="开始时间">{{row.startTime}}</table-column>
<table-column label="结束时间">{{row.endTime}}</table-column>
<table-column label="当前节点">{{row.taskName}}</table-column>
</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" @click="onEdit(row)"
v-if="row.taskKey === 'startTask' || !row.instanceId">
<i class="fa fa-edit"></i>
<span>编辑</span>
</div>
<div class="action-btn delete" @click="onRevoke(row)"
v-if="row.canRevoke">
<i class="fa fa-undo"></i>
<span>撤回</span>
</div>
<div class="action-btn delete" @click="onDelete(row)"
v-if="row.taskKey === 'startTask' || !row.instanceId">
<i class="fa fa-trash"></i>
<span>删除</span>
</div>
</template>
</table-list>
<info ref="infoRef"></info>
<site-apply ref="applyRef"></site-apply>
</div>
<script>
<!--#include('../common/apply.js'){}#-->
<!--#include('../common/info.js'){}#-->
new Vue({
el: "#app",
store,
components: {
info: applyInfo,
"site-apply": apply,
},
data() {
return {
pageForm: {
pageNumber: 1,
pageSize: 10,
totalCount: 0,
year: new Date().getFullYear(),
siteType: null
},
typeOptions: [],
}
},
methods: {
async onReady() {
const typeList = await this.querySiteType()
this.typeOptions = [
{
text: "全部类型",
value: null
}
].concat(typeList.map((v) => ({ text: v.name, value: v.id })))
if (this.typeOptions.length > 0) {
this.pageForm.siteType = this.typeOptions[0].value
this.doSearch()
}
},
onRevoke(row) {
this.$dialog.confirm({
title: "提示",
message: "您确定要撤回吗?"
}).then(() => {
this.$axios.post("/flow/common/revokeTask", { taskId: row.startTaskId }).then((res) => {
if (res.code === 0) {
this.$toast(res.msg)
this.doSearch()
}
})
})
},
onView(row) {
this.$refs.infoRef.onOpen(row)
},
async onEdit(row) {
const res = await this.$axios.post('/platform/site/manage/info', { id: row.siteId })
this.$refs.applyRef.onOpen(res.data, row)
},
onDelete(id) {
this.$dialog.confirm({
title: "提示",
message: "确定要删除此申请吗?"
})
.then(() => {
this.$axios.post("/platform/site/mine/delete", { id: id }).then((res) => {
if (res.code === 0) {
this.$toast.success(res.msg)
this.doSearch()
} else {
this.$toast.fail(res.msg)
}
})
})
.catch(() => {})
},
async querySiteType() {
const res = await this.$axios.post("/platform/site/type/querySiteType")
return res.data
},
doSearch() {
this.$nextTick(() => {
this.pageForm.pageNumber = 1
this.pageForm.totalCount = 0
this.$refs.tableListRef.doSearch()
})
}
},
})
</script>
<!--#
}
#-->
@@ -0,0 +1,189 @@
<!--#
layout("/layouts/platform_h5.html"){
#-->
<style scoped>
</style>
<div id="app">
<van-nav-bar title="校工会审核" left-text="返回" left-arrow @click-left="historyBack" fixed placeholder></van-nav-bar>
<van-sticky offset-top="46px">
<van-search
v-model="pageForm.searchKeyword"
:show-action="false"
:reverse-color="false"
input-align="left"
placeholder="请输入姓名或者工号搜索"
@search="doSearch"
></van-search>
<van-dropdown-menu :close-on-click-outside="false" :close-on-click-overlay="false">
<year-van-dropdown-item :num="5" @change="doSearch" v-model="pageForm.year"></year-van-dropdown-item>
<van-dropdown-item v-model="pageForm.siteType" :options="typeOptions" :multiple="false"
@change="doSearch"></van-dropdown-item>
</van-dropdown-menu>
<van-tabs v-model="pageForm.approvalText"
@change="(val)=>{this.pageForm.approval = val==='1';this.doSearch();}">
<van-tab title="已审核" name="1"></van-tab>
<van-tab title="未审核" name="0"></van-tab>
</van-tabs>
</van-sticky>
<table-list api="/platform/site/schoolUnionAudit/pageData" :page_form.sync="pageForm" ref="tableListRef" title="applyUserName" @ready="onReady">
<template v-slot="{index,row}">
<table-column label="场地名称">{{row.siteName}}</table-column>
<table-column label="所属单位">{{row.applyUnitName}}</table-column>
<table-column label="预约日期">{{row.applyDay}}</table-column>
<table-column label="开始时间">{{row.startTime}}</table-column>
<table-column label="结束时间">{{row.endTime}}</table-column>
<table-column label="当前节点">{{row.taskName}}</table-column>
</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="onApproval(row)">
<i class="fa fa-edit"></i>
<span>审核</span>
</div>
<div class="action-btn delete" v-if="row.canRevoke" @click="onRevoke(row)">
<i class="fa fa-reply"></i>
<span>撤回</span>
</div>
</template>
</table-list>
<info ref="infoRef">
<div v-if="showApprovalForm">
<div class="process-title">{{formData.taskName}}</div>
<van-form ref="formRef">
<van-field
v-model="formData.tf_opinion"
name="tf_opinion"
label="审批意见"
placeholder="请输入审批意见"
:rules="[{ required: true, message: '请填写审批意见' }]"
required
maxlength="100"
show-word-limit
></van-field>
</van-form>
<div style="display: flex; justify-content: space-between; column-gap: 10px; padding: 10px">
<van-button type="danger" block @click="handleTaskAction(6)">退回</van-button>
<van-button type="danger" block @click="handleTaskAction(20)">不同意</van-button>
<van-button type="primary" block @click="handleTaskAction(1)">同意</van-button>
</div>
</div>
</info>
</div>
<script>
<!--#include('../common/info.js'){}#-->
new Vue({
el: "#app",
store,
components: {
info: applyInfo,
},
data() {
return {
pageForm: {
pageNumber: 1,
pageSize: 10,
totalCount: 0,
searchKeyword: '',
approvalText: "0",
approval: false,
year: new Date().getFullYear(),
siteType: null,
},
typeOptions: [],
formData: {},
showApprovalForm: false
}
},
methods: {
async onReady() {
const typeList = await this.querySiteType()
this.typeOptions = [
{
text: "全部类型",
value: null
}
].concat(typeList.map((v) => ({ text: v.name, value: v.id })))
if (this.typeOptions.length > 0) {
this.pageForm.siteType = this.typeOptions[0].value
this.doSearch()
}
},
onView(row) {
this.showApprovalForm = false
this.$refs.infoRef.onOpen(row)
},
onApproval(row) {
this.showApprovalForm = true
this.$refs.infoRef.onOpen(row)
this.formData = {
processTaskId: row.taskId,
taskName: row.curTaskName
}
},
async handleTaskAction(val) {
try {
await this.$refs.formRef.validate();
this.$dialog.confirm({
title: "提示",
message: "您确定要提交吗?"
}).then(() => {
this.$axios.post("/flow/common/executeTask", {
data: JSON.stringify({
...this.formData,
submitType: val
})
}).then((res) => {
if (res.code === 0) {
this.$refs.infoRef.onClose()
this.$toast.success(res.msg)
this.doSearch()
}
})
}).catch(() => {
})
} catch (error) {
}
},
onRevoke(row){
this.$dialog.confirm({
title: "提示",
message: "您确定要撤回吗?"
}).then(() => {
this.$axios.post("/flow/common/revokeTask", {taskId: row.taskId}).then((res) => {
if (res.code === 0) {
this.$toast.success(res.msg)
this.doSearch()
}
})
})
},
async querySiteType() {
const res = await this.$axios.post("/platform/site/type/querySiteType")
return res.data
},
doSearch() {
this.$nextTick(() => {
this.pageForm.pageNumber = 1
this.pageForm.totalCount = 0
this.$refs.tableListRef.doSearch()
})
}
},
})
</script>
<!--#
}
#-->
@@ -95,7 +95,6 @@ layout("/layouts/platform_h5.html"){
pageSize: 10,
totalCount: 0,
searchKeyword: '',
name: null,
approvalText: "0",
approval: false,
year: new Date().getFullYear(),
@@ -95,7 +95,6 @@ layout("/layouts/platform_h5.html"){
pageSize: 10,
totalCount: 0,
searchKeyword: '',
name: null,
approvalText: "0",
approval: false,
year: new Date().getFullYear(),