请假 巡检
Some checks failed
Uniapp 自动化打包 CI/CD / 打包 Uniapp 项目 (push) Has been cancelled

This commit is contained in:
2025-09-12 09:24:59 +08:00
parent 9ed827a227
commit 57fe929080
14 changed files with 973 additions and 499 deletions

View File

@@ -34,7 +34,7 @@
<image class="ins-line-image" src="/static/ic_my_repair_03.png" />
<view class="ins-info">巡检人{{ item.actUserName || '' }}</view>
<view class="ins-info">计划完成时间{{ item.planInsTime || '' }}</view>
<view class="ins-info">实际完成时间{{ item.location || '' }}</view>
<view class="ins-info">实际完成时间{{ item.compleTime || '' }}</view>
<view class="ins-info">巡检进度{{ item.inspectionProgress || '' }}</view>
</view>

View File

@@ -56,13 +56,13 @@
</view>
<!-- 操作区宽度跟随标题块内部居中 -->
<view class="ops" v-if="item.inspectionState ==0">
<view class="ops" v-if="item.inspectionState == 0">
<view class="btn-outline" @click="startTask(item)">立即巡检</view>
</view>
<view class="status" v-else v-if="item.inspectionResults == 1" @click="goDetail(item)">
<view class="status" v-else-if="item.inspectionResults == 1" @click="goDetail(item)">
<view>完成巡检</view>
<view class="badge" :class="item.inspectionResults ==1 ? 'badge-success' : 'badge-warn'">
<view class="badge" :class="item.inspectionResults == 1 ? 'badge-success' : 'badge-warn'">
{{ item.inspectionResults == 1 ? '正常' : '异常' }}
</view>
</view>

View File

@@ -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>

View File

@@ -74,11 +74,11 @@
text: '报事报修',
url:'/pages/sys/user/myRepair/myRepair'
},
// {
// icon: 'https://picsum.photos/80/80?random=3',
// text: '工作巡检',
// url:'/pages/sys/workbench/inspection/inspection'
// },
{
icon: 'https://picsum.photos/80/80?random=3',
text: '工作巡检',
url:'/pages/sys/workbench/inspection/inspection'
},
// {
// icon: 'https://picsum.photos/80/80?random=3',
// text: '通讯录',