Files
zhxg_app_v1.0/pages/applyleave/list.vue

231 lines
4.9 KiB
Vue
Raw Normal View History

2025-07-16 15:34:34 +08:00
<template>
<view class="leave-list">
<view class="head" @tap="toAddApply">
<view class="add">
<uni-icons type="plus" size="28"></uni-icons>新增
</view>
</view>
<view class="list">
<view class="item" v-for="(leave,index) in leaveLists" :key="index">
<view>
<text class="label">学号</text>
<text>{{leave.stuNo}}</text>
</view>
<view>
<text class="label">姓名</text>
<text>{{leave.name}}</text>
</view>
<view>
<text class="label">请假信息</text>
<text>{{leave.leaveType==1?'事假':'病假'}}/{{leave.reason}}/{{leave.leaveDays}}</text>
</view>
<view>
<text class="label">起止时间</text>
<text>{{leave.startDate}}~{{leave.endDate}}</text>
</view>
<view>
<text class="label">申请时间</text>
<text>{{leave.createTime}}</text>
</view>
<view>
<text class="label">假条状态</text>
<text>{{leave.leaveStatus==1?'已提交':'保存中'}}</text>
</view>
<view class="status">
<view class="left">
<text class="primary" v-if="leave.status == 0">待审批</text>
<text class="success" v-else-if="leave.status == 1">已通过</text>
<text class="warn" v-else-if="leave.status == 2">已驳回</text>
<text class="warn" v-if="leave.cancellation == 0">未销假</text>
<text class="primary" v-else-if="leave.cancellation == 1">销假申请中</text>
<text class="success" v-else-if="leave.cancellation == 2">已销假</text>
</view>
<view class="right">
<view class="edit" @tap="onEdit(leave.leaveApplicationId)" v-if="leave.leaveStatus==0">
<!-- compose -->
<uni-icons color="#1890ff" type="compose" size="18"></uni-icons>
修改
</view>
<view class="del" v-if="leave.leaveStatus==0" @tap="onDel(leave.leaveApplicationId)">
<uni-icons color="#ff2019" type="trash" size="18"></uni-icons>
删除
</view>
</view>
</view>
<!-- <view class="cancellation-leave" @tap="toCancellationLeave">
销假
</view> -->
</view>
</view>
</view>
</template>
<script>
import {
leaveList,
leaveDel
} from "@/api/applyleave/applyleave.js";
export default {
data() {
return {
leaveLists: []
}
},
created() {
this.getLeaveList()
},
methods: {
// //销假
toCancellationLeave(){
uni.navigateTo({
url:"/pages/applyleave/cancellationLeave"
})
},
toAddApply() {
uni.navigateTo({
url: "/pages/applyleave/applyleave"
})
},
getLeaveList() {
leaveList().then(res => {
console.log(res);
this.leaveLists = res.rows;
})
},
onDel(id) {
uni.showModal({
title: "确定删除吗?",
success: (res) => {
if (res.confirm) {
leaveDel(id).then(res => {
console.log(res);
if (res.code == 200) {
uni.showToast({
title: "删除成功"
})
this.getLeaveList();
} else {
uni.showToast({
title: "删除失败"
})
}
})
}
}
})
},
onEdit(id) {
uni.navigateTo({
url: "/pages/applyleave/editLeave?id=" + id
})
}
}
}
</script>
<style scoped lang="scss">
.leave-list {
min-height: 100vh;
background-color: #F6F6F6;
padding: 15px;
padding-top: 55px;
.head {
background-color: white;
margin-bottom: 15px;
padding: 8px 25px;
position: fixed;
left: 0;
right: 0;
border-top: 1px solid #e9e4e6;
box-sizing: border-box;
/* #ifndef MP-WEIXIN */
top: 44px;
/* #endif */
/* #ifdef MP-WEIXIN */
top: 0;
/* #endif */
.add {
display: flex;
align-items: center;
justify-content: flex-end;
}
}
.list {
.item {
background-color: white;
padding: 20px;
border-radius: 10px;
margin-bottom: 10px;
&>view {
font-size: 32rpx;
.right{
display: flex;
font-size: 28rpx;
.edit {
color: #1890ff;
margin-right: 8px;
}
.del {
color: #ff2019;
}
}
&:not(:first-child) {
margin-top: 10px;
}
&.status {
margin-top: 20px;
display: flex;
justify-content: space-between;
padding-bottom: 10px;
text {
padding: 4px 5px;
border-radius: 5px;
font-size: 28rpx;
}
.left {
text {
margin-right: 5px;
&.success {
color: #55aa00;
background-color: rgba(85, 170, 0, 0.1);
}
&.primary {
color: #55aaff;
background-color: rgba(85, 170, 255, 0.2);
}
&.warn {
color: #ff0000;
background-color: rgba(255, 0, 0, 0.2);
}
}
}
}
.label {
color: #B1B1B1;
margin-right: 15px;
}
}
.cancellation-leave{
padding: 15px 0 0 0;
text-align: center;
border-top: 1px solid #b6b6b6;
color: #55aaff;
}
}
}
}
</style>