This commit is contained in:
@@ -20,23 +20,23 @@
|
||||
|
||||
<!-- 请假类型 -->
|
||||
<view class="form-row">
|
||||
<text class="label required">请假类型</text>
|
||||
<view class="picker" @click="openLeaveTypePopup">
|
||||
<text
|
||||
:class="leaveTypeIndex === 0 ? 'placeholder' : ''">{{ leaveTypes[leaveTypeIndex] || '请选择' }}</text>
|
||||
<image class="right-arrow" src="/static/ic_right_arrow_g.png" />
|
||||
<text class="label required">请假类型</text>
|
||||
<view class="picker" @click="openLeaveTypePopup">
|
||||
<text
|
||||
:class="leaveTypeIndex === 0 ? 'placeholder' : ''">{{ leaveTypes[leaveTypeIndex] || '请选择' }}</text>
|
||||
<image class="right-arrow" src="/static/ic_right_arrow_g.png" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 开始时间 -->
|
||||
<view class="form-row">
|
||||
<text class="label required">开始时间</text>
|
||||
<picker mode="date" @change="startDateChange">
|
||||
<view class="picker">
|
||||
<!-- <picker mode="date" @change="startDateChange"> -->
|
||||
<view class="picker" @click="startDateSelect">
|
||||
<text :class="!startDate ? 'placeholder' : ''">{{ startDate || '请选择' }}</text>
|
||||
<image class="right-arrow" src="/static/ic_right_arrow_g.png" />
|
||||
</view>
|
||||
</picker>
|
||||
<!-- </picker> -->
|
||||
</view>
|
||||
|
||||
<!-- 结束时间 -->
|
||||
@@ -63,8 +63,8 @@
|
||||
</view>
|
||||
|
||||
<!-- 上传图片 -->
|
||||
<u-upload class="upload-style" :fileList="selectedImages" @on-list-change="onListChange" @delete="deletePic" name="upload"
|
||||
multiple maxCount="3" width="180" height="180" :autoUpload="false"></u-upload>
|
||||
<u-upload class="upload-style" :fileList="selectedImages" @on-list-change="onListChange" @delete="deletePic"
|
||||
name="upload" multiple maxCount="3" width="180" height="180" :autoUpload="false"></u-upload>
|
||||
|
||||
<!-- 提交按钮 -->
|
||||
<button class="submit-btn" @click="submitLeave">提交</button>
|
||||
@@ -113,13 +113,8 @@
|
||||
<view class="popup-content">
|
||||
<view class="popup-title">请假类型</view>
|
||||
<view class="popup-options">
|
||||
<view
|
||||
v-for="(type, index) in leaveTypes"
|
||||
:key="index"
|
||||
class="popup-option"
|
||||
:class="{ 'selected': leaveTypeIndex === index }"
|
||||
@click="selectLeaveType(index)"
|
||||
>
|
||||
<view v-for="(type, index) in leaveTypes" :key="index" class="popup-option"
|
||||
:class="{ selected: leaveTypeIndex === index }" @click="selectLeaveType(index)">
|
||||
{{ type }}
|
||||
</view>
|
||||
</view>
|
||||
@@ -127,127 +122,133 @@
|
||||
</view>
|
||||
</u-popup>
|
||||
|
||||
<SelectCalendarDialog :visible.sync="showCalendarDialog" @confirm="onConfirm" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
tabs: ['发起申请', '请假记录', '已完成'],
|
||||
activeTab: 0,
|
||||
leaveTypes: ['事假', '调休', '病假', '年假', '产假', '陪产假', '婚假', '例假', '丧假', '哺乳假', '其他'],
|
||||
leaveTypeIndex: -1, // 初始化为-1表示未选择
|
||||
startDate: '',
|
||||
endDate: '',
|
||||
hours: '',
|
||||
reason: '',
|
||||
selectedImages: [],
|
||||
leaveRecords: [],
|
||||
loading: false,
|
||||
hasMore: true,
|
||||
refreshing: false,
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
showLeaveTypePopup: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changeTab(idx) {
|
||||
this.activeTab = idx;
|
||||
},
|
||||
bindPickerChange(e) {
|
||||
this.leaveTypeIndex = e.detail.value;
|
||||
},
|
||||
startDateChange(e) {
|
||||
this.startDate = e.detail.value;
|
||||
},
|
||||
endDateChange(e) {
|
||||
this.endDate = e.detail.value;
|
||||
},
|
||||
submitLeave() {
|
||||
// 提交请假逻辑
|
||||
},
|
||||
deletePic(event) {
|
||||
this.selectedImages.splice(event.index, 1);
|
||||
},
|
||||
onListChange(list) {
|
||||
this.selectedImages = list;
|
||||
},
|
||||
goToDetail(item) {
|
||||
// 跳转到详情页逻辑
|
||||
},
|
||||
async onRefresh() {
|
||||
this.refreshing = true;
|
||||
this.pageNum = 1;
|
||||
await this.loadLeaveRecords();
|
||||
this.refreshing = false;
|
||||
},
|
||||
async onLoadMore() {
|
||||
if (!this.hasMore || this.loading) return;
|
||||
this.pageNum++;
|
||||
await this.loadLeaveRecords();
|
||||
},
|
||||
async loadLeaveRecords() {
|
||||
this.loading = true;
|
||||
let data = [
|
||||
{
|
||||
type: '请假',
|
||||
leaveType: '病假',
|
||||
status: '已通过',
|
||||
statusClass: 'green',
|
||||
startTime: '2025-07-13',
|
||||
endTime: '2025-07-15',
|
||||
userName: '余永乐',
|
||||
avatarText: '余',
|
||||
avatarColor: '#4B7BF5',
|
||||
dateTime: '07-12 18:28:22'
|
||||
},
|
||||
{
|
||||
type: '请假',
|
||||
leaveType: '病假',
|
||||
status: '待审核',
|
||||
statusClass: 'orange',
|
||||
startTime: '2025-07-13',
|
||||
endTime: '2025-07-15',
|
||||
userName: '余永乐',
|
||||
avatarText: '余',
|
||||
avatarColor: '#4B7BF5',
|
||||
dateTime: '07-12 18:28:22'
|
||||
}
|
||||
];
|
||||
const start = (this.pageNum - 1) * this.pageSize;
|
||||
const end = start + this.pageSize;
|
||||
const pageData = data.slice(start, end);
|
||||
await new Promise(res => setTimeout(res, 300));
|
||||
if (this.pageNum === 1) {
|
||||
this.leaveRecords = pageData;
|
||||
} else {
|
||||
this.leaveRecords = [...this.leaveRecords, ...pageData];
|
||||
import SelectCalendarDialog from '@/components/SelectCalendarDialog.vue'
|
||||
export default {
|
||||
components: { SelectCalendarDialog },
|
||||
data() {
|
||||
return {
|
||||
tabs: ['发起申请', '请假记录', '已完成'],
|
||||
activeTab: 0,
|
||||
leaveTypes: ['事假', '调休', '病假', '年假', '产假', '陪产假', '婚假', '例假', '丧假', '哺乳假', '其他'],
|
||||
leaveTypeIndex: -1, // 初始化为-1表示未选择
|
||||
startDate: '',
|
||||
endDate: '',
|
||||
hours: '',
|
||||
reason: '',
|
||||
selectedImages: [],
|
||||
leaveRecords: [],
|
||||
loading: false,
|
||||
hasMore: true,
|
||||
refreshing: false,
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
showLeaveTypePopup: false,
|
||||
showCalendarDialog: false,
|
||||
}
|
||||
this.hasMore = end < data.length;
|
||||
this.loading = false;
|
||||
},
|
||||
openLeaveTypePopup() {
|
||||
this.showLeaveTypePopup = true;
|
||||
},
|
||||
selectLeaveType(index) {
|
||||
this.leaveTypeIndex = index;
|
||||
},
|
||||
confirmLeaveType() {
|
||||
if (this.leaveTypeIndex !== -1) {
|
||||
this.showLeaveTypePopup = false;
|
||||
// 更新表单中的请假类型
|
||||
this.leaveType = this.leaveTypes[this.leaveTypeIndex];
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '请选择请假类型',
|
||||
icon: 'none'
|
||||
});
|
||||
methods: {
|
||||
changeTab(idx) {
|
||||
this.activeTab = idx;
|
||||
},
|
||||
bindPickerChange(e) {
|
||||
this.leaveTypeIndex = e.detail.value;
|
||||
},
|
||||
startDateSelect() {
|
||||
this.showCalendarDialog = true
|
||||
},
|
||||
onConfirm(selectedDate){
|
||||
this.startDate = selectedDate
|
||||
},
|
||||
endDateChange(e) {
|
||||
this.endDate = e.detail.value;
|
||||
},
|
||||
submitLeave() {
|
||||
// 提交请假逻辑
|
||||
},
|
||||
deletePic(event) {
|
||||
this.selectedImages.splice(event.index, 1);
|
||||
},
|
||||
onListChange(list) {
|
||||
this.selectedImages = list;
|
||||
},
|
||||
goToDetail(item) {
|
||||
// 跳转到详情页逻辑
|
||||
},
|
||||
async onRefresh() {
|
||||
this.refreshing = true;
|
||||
this.pageNum = 1;
|
||||
await this.loadLeaveRecords();
|
||||
this.refreshing = false;
|
||||
},
|
||||
async onLoadMore() {
|
||||
if (!this.hasMore || this.loading) return;
|
||||
this.pageNum++;
|
||||
await this.loadLeaveRecords();
|
||||
},
|
||||
async loadLeaveRecords() {
|
||||
this.loading = true;
|
||||
let data = [{
|
||||
type: '请假',
|
||||
leaveType: '病假',
|
||||
status: '已通过',
|
||||
statusClass: 'green',
|
||||
startTime: '2025-07-13',
|
||||
endTime: '2025-07-15',
|
||||
userName: '余永乐',
|
||||
avatarText: '余',
|
||||
avatarColor: '#4B7BF5',
|
||||
dateTime: '07-12 18:28:22'
|
||||
},
|
||||
{
|
||||
type: '请假',
|
||||
leaveType: '病假',
|
||||
status: '待审核',
|
||||
statusClass: 'orange',
|
||||
startTime: '2025-07-13',
|
||||
endTime: '2025-07-15',
|
||||
userName: '余永乐',
|
||||
avatarText: '余',
|
||||
avatarColor: '#4B7BF5',
|
||||
dateTime: '07-12 18:28:22'
|
||||
}
|
||||
];
|
||||
const start = (this.pageNum - 1) * this.pageSize;
|
||||
const end = start + this.pageSize;
|
||||
const pageData = data.slice(start, end);
|
||||
await new Promise(res => setTimeout(res, 300));
|
||||
if (this.pageNum === 1) {
|
||||
this.leaveRecords = pageData;
|
||||
} else {
|
||||
this.leaveRecords = [...this.leaveRecords, ...pageData];
|
||||
}
|
||||
this.hasMore = end < data.length;
|
||||
this.loading = false;
|
||||
},
|
||||
openLeaveTypePopup() {
|
||||
this.showLeaveTypePopup = true;
|
||||
},
|
||||
selectLeaveType(index) {
|
||||
this.leaveTypeIndex = index;
|
||||
},
|
||||
confirmLeaveType() {
|
||||
if (this.leaveTypeIndex !== -1) {
|
||||
this.showLeaveTypePopup = false;
|
||||
// 更新表单中的请假类型
|
||||
this.leaveType = this.leaveTypes[this.leaveTypeIndex];
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '请选择请假类型',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@@ -513,7 +514,8 @@ export default {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
}
|
||||
.upload-style{
|
||||
|
||||
.upload-style {
|
||||
margin-left: 15rpx;
|
||||
margin-right: 15rpx;
|
||||
}
|
||||
@@ -548,22 +550,21 @@ export default {
|
||||
}
|
||||
|
||||
.popup-options {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
/* 三列,可改成2/4列 */
|
||||
gap: 20rpx;
|
||||
/* 行列间距 */
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.popup-option {
|
||||
width: 30%;
|
||||
height: 80rpx;
|
||||
background-color: #f7f7f7;
|
||||
text-align: center;
|
||||
padding: 20rpx 0;
|
||||
border-radius: 12rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 32rpx;
|
||||
background-color: #f5f5f5;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.popup-option.selected {
|
||||
@@ -580,4 +581,4 @@ export default {
|
||||
color: #fff;
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
</style>
|
||||
</style>
|
Reference in New Issue
Block a user