This commit is contained in:
@jyuhsin
2024-09-20 10:01:52 +08:00
parent ca104cd831
commit dd30ea7322
4 changed files with 151 additions and 18 deletions
@@ -237,13 +237,20 @@ layout("/mobile/platform.html"){
<van-button v-if="o.isJoin === true" size="small" disabled color="grey">已签到</van-button>-->
<van-button
:disabled="moment().valueOf() > moment(o.leaveDeadline).valueOf() || o.isCanLeave === false"
@click="needLeave(o, false)"
@click="needLeave(o, true, true)"
color="#1867b0" size="small" style="margin-right: 8px"
v-if="${@shiro.hasRole('H04')}"
type="primary">替他人请假
</van-button>
<van-button
:disabled="moment().valueOf() > moment(o.leaveDeadline).valueOf() || o.isCanLeave === false"
@click="needLeave(o, false, false)"
color="#1867b0" size="small" style="margin-right: 8px"
type="primary">查看请假状态
</van-button>
<van-button
:disabled="moment().valueOf() > moment(o.leaveDeadline).valueOf() || o.isCanLeave === false"
@click="needLeave(o, true)"
@click="needLeave(o, true, false)"
color="#1867b0" size="small" style="margin-right: 8px"
type="primary">我要请假
</van-button>
@@ -275,16 +282,28 @@ layout("/mobile/platform.html"){
</div>
<div class="content">
<div class="van-doc-card" v-for="(item, index) in timeList">
<van-field
v-if="helpLeave"
v-model="needLeaveUser.userName"
label="请假人"
readonly=""
@click="helpUserShow = true"
placeholder="请点击选择请假人"
input-align="right"
></van-field>
<div v-if="timeList.length > 0" class="van-doc-card" v-for="(item, index) in timeList">
<div>
<div><span style="color: grey">会议名称:</span>{{item.timePeriodName}}</div>
<div>
<span style="color: grey">会议名称:</span>
<span>{{item.timePeriodName}}</span>
</div>
</div>
<div @click="leaveClick(item, index)"
style="display: flex; justify-content: space-between">
<div>
<div>
<span style="color: grey">会议时间:</span>
{{moment(item.startTime).format('YYYY-MM-DD HH:mm')}}
<span>{{moment(item.startTime).format('YYYY-MM-DD HH:mm')}}</span>
</div>
<!--<div><span style="color: grey">结束时间:</span>{{moment(item.endTime).format('YYYY-MM-DD HH:mm')}}</div>-->
</div>
@@ -297,12 +316,15 @@ layout("/mobile/platform.html"){
</div>
</div>
<div v-if="item.isJoin === false">
<div><span style="color: grey">审核状态:</span>{{item.stateName}}</div>
<div>
<span style="color: grey">审核状态:</span>
<span>{{item.stateName}}</span>
</div>
</div>
<div>
<span style="float: left; color: grey">请假原因:</span>
<van-field :disabled="item.isJoin === false" placeholder="请输入请假原因" rows="1"
style="font-size: 12px; padding: 0; width: 70%; line-height: 20px"
style="font-size: 12px; padding: 0; width: 70%; line-height: 20px; margin-left: 69px"
type="textarea" autosize
v-model="item.leaveReason"></van-field>
</div>
@@ -318,6 +340,7 @@ layout("/mobile/platform.html"){
</van-button>
</div>
</div>
</div>
<div v-if="flag === true">
<div style="display: flex; justify-content: space-evenly; position: fixed; bottom: 20px; width: 100%">
@@ -330,6 +353,24 @@ layout("/mobile/platform.html"){
</div>
</div>
</van-action-sheet>
<van-popup position="bottom" round v-model="helpUserShow" :style="{ height: '70%' }" closeable>
<van-search v-model="searchResult" show-action style="padding: 10px;margin-top: 45px" placeholder="请输入工号或姓名搜索"
@input="delaySearch">
</van-search>
<van-cell-group>
<div>
<van-checkbox-group style="text-align: center">
<van-cell-group>
<van-cell v-for="(item, index) in userList" :key="item.index" clickable
:title="item.name"
@click="toResult(item.loginname)">
</van-cell>
</van-cell-group>
</van-checkbox-group>
</div>
</van-cell-group>
</van-popup>
</div>
<script>
@@ -340,6 +381,14 @@ layout("/mobile/platform.html"){
mixins: [mobileMixins],
data() {
return {
searchResult: '',
userList: [],
helpUserShow: false,
needLeaveUser: {
userName: '',
userId: '',
},
helpLeave: false,
timeList: [],
checked: [],
checkboxRefs: [],
@@ -361,12 +410,34 @@ layout("/mobile/platform.html"){
}
},
methods: {
async delaySearch(query) {
if (query) {
const data = await this.searchUser(query)
data.forEach(v => {
v.name = v.username + '(' + v.loginname + ')'
return v
})
this.userList = data
}
},
async searchUser(query) {
const res = await $.post('/mobile/meeting/mine/searchUser', {query: query, meetId: this.clickRow.id})
return res.data
},
toResult(loginname) {
this.timeList = []
const data = this.userList.find(o => o.loginname === loginname)
this.$set(this.needLeaveUser, 'userName', data.username)
this.$set(this.needLeaveUser, 'userId', data.id)
this.helpUserShow = false
this.findTimeList(this.clickRow)
},
refreshApply(o) {
vant.Dialog.confirm({
title: '温馨提示',
message: '您确定要重新申请吗?',
}).then(async () => {
await this.needLeave(this.clickRow, true)
await this.needLeave(this.clickRow, true, false)
this.timeList.forEach((re, index) => {
if (re.stateAuditType === 1) {
re.isJoin = null
@@ -437,23 +508,39 @@ layout("/mobile/platform.html"){
this.loading = false
})
},
async needLeave(o, flag) {
async needLeave(o, flag, helpLeave) {
this.flag = flag
this.clickRow = o
this.helpLeave = helpLeave
this.timeList = []
this.needLeaveUser = {
userName: '',
userId: '',
}
if (moment().valueOf() > moment(o.leaveDeadline).valueOf() || o.isCanLeave === false) {
vant.Toast('抱歉,已过请假截止时间');
return
}
this.leaveReason = ''
this.checked = []
const res = await $.post('/mobile/meeting/mine/findMyMeetPeriod', {meetingId: o.id})
if(helpLeave) {
this.leaveShow = true
} else {
await this.findTimeList(o)
}
},
async findTimeList(o) {
const res = await $.post('/mobile/meeting/mine/findMyMeetPeriod', {
meetingId: o.id,
helpLeave: this.helpLeave,
userId: this.needLeaveUser.userId
})
if (res.code === 0) {
this.timeList = res.data
if (this.timeList.length === 0) {
vant.Toast('您暂无可请假的假时间段');
vant.Toast('暂无可请假的假时间段');
return
}
this.leaveShow = true
this.$nextTick(function () {
this.timeList.forEach((re, index) => {
@@ -474,7 +561,7 @@ layout("/mobile/platform.html"){
}
const array = this.timeList.find(o => o.stateCode === null || o.stateCode < this.clickRow.firstState)
if (array === undefined) {
vant.Toast('您的所有请假均已处于审核阶段');
vant.Toast('所有请假均已处于审核阶段');
return
}
const paramArray = []
@@ -502,6 +589,15 @@ layout("/mobile/platform.html"){
if (valid) {
return
}
if(this.helpLeave) {
const confirm = await vant.Dialog.confirm({
title: '提示',
message: '您确定要替' + this.needLeaveUser.userName + '报名吗?',
})
if (confirm !== 'confirm') {
return
}
}
const resp = await $.post('/mobile/meeting/mine/askForLeave', {
meetingId: this.clickRow.id,
data: JSON.stringify(paramArray)