| | |
| | | <view class="table-section"> |
| | | <!-- 生产巡检列表 --> |
| | | <view class="task-list"> |
| | | <view |
| | | v-for="(item, index) in taskTableData" |
| | | :key="index" |
| | | class="task-item" |
| | | > |
| | | <view v-for="(item, index) in taskTableData" :key="index" class="task-item"> |
| | | <view class="task-header"> |
| | | <view class="task-info"> |
| | | <text class="task-name">{{ item.taskName }}</text> |
| | | <text class="task-location">{{ item.inspectionLocation }}</text> |
| | | </view> |
| | | <view class="task-actions"> |
| | | <u-button |
| | | type="primary" |
| | | size="small" |
| | | @click.stop="startScanForTask(item)" |
| | | :customStyle="{ |
| | | <u-button type="primary" size="small" @click.stop="startScanForTask(item)" :customStyle="{ |
| | | borderRadius: '15px', |
| | | height: '30px', |
| | | fontSize: '12px', |
| | | marginRight: '8px' |
| | | }" |
| | | > |
| | | }"> |
| | | 扫码上传 |
| | | </u-button> |
| | | <u-button |
| | | type="success" |
| | | size="small" |
| | | @click.stop="viewAttachments(item)" |
| | | :customStyle="{ |
| | | <u-button type="success" size="small" @click.stop="viewAttachments(item)" :customStyle="{ |
| | | borderRadius: '15px', |
| | | height: '30px', |
| | | fontSize: '12px' |
| | | }" |
| | | > |
| | | }"> |
| | | 查看附件 |
| | | </u-button> |
| | | </view> |
| | |
| | | <text class="detail-label">任务下发日期</text> |
| | | <text class="detail-value">{{ item.dateStr }}</text> |
| | | </view> |
| | | <view class="detail-item"> |
| | | <text class="detail-label">巡检状态</text> |
| | | <view class="detail-value"> |
| | | <uni-tag v-if="item.fileStatus==2" text="已完成" size="small" type="success" inverted></uni-tag> |
| | | <uni-tag v-else-if="item.fileStatus==1" text="巡检中" size="small" type="primary" inverted></uni-tag> |
| | | <uni-tag v-else="" text="未巡检" size="small" type="warning" inverted></uni-tag> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <uni-load-more :status="loadMoreStatus"></uni-load-more> |
| | | </view> |
| | | |
| | | <!-- 空状态 --> |
| | | <view v-if="taskTableData.length === 0" class="no-data"> |
| | | <view v-if="taskTableData?.length === 0" class="no-data"> |
| | | <text>暂无数据</text> |
| | | </view> |
| | | |
| | |
| | | <view class="qr-scan-container"> |
| | | <view class="scan-header"> |
| | | <text class="scan-title">扫描二维码</text> |
| | | <u-button |
| | | type="error" |
| | | size="small" |
| | | @click.stop="stopScan" |
| | | :customStyle="{ |
| | | <u-button type="error" size="small" @click.stop="stopScan" :customStyle="{ |
| | | borderRadius: '15px', |
| | | height: '30px', |
| | | fontSize: '12px' |
| | | }" |
| | | > |
| | | }"> |
| | | 关闭 |
| | | </u-button> |
| | | </view> |
| | | <camera |
| | | class="qr-camera" |
| | | device-position="back" |
| | | flash="off" |
| | | @scancode="handleScanCode" |
| | | @error="handleCameraError" |
| | | ></camera> |
| | | <camera class="qr-camera" device-position="back" flash="off" @scancode="handleScanCode" |
| | | @error="handleCameraError"></camera> |
| | | <view class="scan-frame-wrapper"> |
| | | <view class="scan-frame"></view> |
| | | <view class="scan-tip">请将二维码放入框内</view> |
| | | </view> |
| | | <u-alert |
| | | v-if="cameraError" |
| | | :title="cameraError" |
| | | type="error" |
| | | :showIcon="true" |
| | | :closable="true" |
| | | @close="cameraError = ''" |
| | | :customStyle="{ |
| | | <u-alert v-if="cameraError" :title="cameraError" type="error" :showIcon="true" :closable="true" |
| | | @close="cameraError = ''" :customStyle="{ |
| | | margin: '10px 0' |
| | | }" |
| | | ></u-alert> |
| | | }"></u-alert> |
| | | </view> |
| | | </view> |
| | | |
| | |
| | | <view class="upload-popup-body"> |
| | | <!-- 分类标签页 --> |
| | | <view class="upload-tabs"> |
| | | <view |
| | | class="tab-item" |
| | | :class="{ active: currentUploadType === 'before' }" |
| | | @click="switchUploadType('before')" |
| | | > |
| | | <view class="tab-item" :class="{ active: currentUploadType === 'before' }" |
| | | @click="switchUploadType('before')"> |
| | | 生产前 |
| | | </view> |
| | | <view |
| | | class="tab-item" |
| | | :class="{ active: currentUploadType === 'after' }" |
| | | @click="switchUploadType('after')" |
| | | > |
| | | <view class="tab-item" :class="{ active: currentUploadType === 'after' }" |
| | | @click="switchUploadType('after')"> |
| | | 生产中 |
| | | </view> |
| | | <view |
| | | class="tab-item" |
| | | :class="{ active: currentUploadType === 'issue' }" |
| | | @click="switchUploadType('issue')" |
| | | > |
| | | <view class="tab-item" :class="{ active: currentUploadType === 'issue' }" |
| | | @click="switchUploadType('issue')"> |
| | | 生产后 |
| | | </view> |
| | | </view> |
| | |
| | | <view class="exception-section"> |
| | | <text class="section-title">是否存在异常?</text> |
| | | <view class="exception-options"> |
| | | <view |
| | | class="exception-option" |
| | | :class="{ active: hasException === false }" |
| | | @click="setExceptionStatus(false)" |
| | | > |
| | | <view class="exception-option" :class="{ active: hasException === false }" |
| | | @click="setExceptionStatus(false)"> |
| | | <u-icon name="checkmark-circle" size="20" color="#52c41a"></u-icon> |
| | | <text>正常</text> |
| | | </view> |
| | | <view |
| | | class="exception-option" |
| | | :class="{ active: hasException === true }" |
| | | @click="setExceptionStatus(true)" |
| | | > |
| | | <view class="exception-option" :class="{ active: hasException === true }" |
| | | @click="setExceptionStatus(true)"> |
| | | <u-icon name="close-circle" size="20" color="#ff4d4f"></u-icon> |
| | | <text>存在异常</text> |
| | | </view> |
| | |
| | | <!-- 当前分类的上传区域 --> |
| | | <view class="simple-upload-area"> |
| | | <view class="upload-buttons"> |
| | | <u-button |
| | | type="primary" |
| | | @click="chooseMedia('image')" |
| | | :loading="uploading" |
| | | <u-button type="primary" @click="chooseMedia('image')" :loading="uploading" |
| | | :disabled="getCurrentFiles().length >= uploadConfig.limit" |
| | | :customStyle="{ marginRight: '10px', flex: 1 }" |
| | | > |
| | | :customStyle="{ marginRight: '10px', flex: 1 }"> |
| | | <u-icon name="camera" size="18" color="#fff" style="margin-right: 5px;"></u-icon> |
| | | {{ uploading ? '上传中...' : '拍照' }} |
| | | </u-button> |
| | | <u-button |
| | | type="success" |
| | | @click="chooseMedia('video')" |
| | | :loading="uploading" |
| | | :disabled="getCurrentFiles().length >= uploadConfig.limit" |
| | | :customStyle="{ flex: 1 }" |
| | | > |
| | | <uni-icons type="videocam" name="videocam" size="18" color="#fff" style="margin-right: 5px;"></uni-icons> |
| | | <u-button type="success" @click="chooseMedia('video')" :loading="uploading" |
| | | :disabled="getCurrentFiles().length >= uploadConfig.limit" :customStyle="{ flex: 1 }"> |
| | | <uni-icons type="videocam" name="videocam" size="18" color="#fff" |
| | | style="margin-right: 5px;"></uni-icons> |
| | | {{ uploading ? '上传中...' : '拍视频' }} |
| | | </u-button> |
| | | </view> |
| | | |
| | | <!-- 上传进度 --> |
| | | <view v-if="uploading" class="upload-progress"> |
| | | <u-line-progress |
| | | :percentage="uploadProgress" |
| | | :showText="true" |
| | | activeColor="#409eff" |
| | | ></u-line-progress> |
| | | <u-line-progress :percentage="uploadProgress" :showText="true" activeColor="#409eff"></u-line-progress> |
| | | </view> |
| | | |
| | | <!-- 当前分类的文件列表 --> |
| | | <view v-if="getCurrentFiles().length > 0" class="file-list"> |
| | | <view |
| | | v-for="(file, index) in getCurrentFiles()" |
| | | :key="index" |
| | | class="file-item" |
| | | > |
| | | <view v-for="(file, index) in getCurrentFiles()" :key="index" class="file-item"> |
| | | <view class="file-preview-container"> |
| | | <image |
| | | v-if="file?.path?.fileType === 'image'" |
| | | <image v-if="file?.path?.fileType === 'image'" |
| | | :src="file?.url || file?.tempFilePath?.tempFilePath || file?.path?.tempFilePath" |
| | | class="file-preview" |
| | | mode="aspectFill" |
| | | /> |
| | | class="file-preview" mode="aspectFill" /> |
| | | <view v-else class="video-preview"> |
| | | <uni-icons type="videocam" name="videocam" size="18" color="#fff" style="margin-right: 5px;"></uni-icons> |
| | | <uni-icons type="videocam" name="videocam" size="18" color="#fff" |
| | | style="margin-right: 5px;"></uni-icons> |
| | | <text class="video-text">视频</text> |
| | | </view> |
| | | |
| | |
| | | </view> |
| | | |
| | | <view class="file-info"> |
| | | <text class="file-name">{{ file.bucketFilename || file.name || (file.type === 'image' ? '图片' : '视频') }}</text> |
| | | <text class="file-name">{{ file.bucketFilename || file.name || (file.type === 'image' ? '图片' : '视频') |
| | | }}</text> |
| | | <text class="file-size">{{ formatFileSize(file.size) }}</text> |
| | | </view> |
| | | </view> |
| | |
| | | |
| | | <view class="upload-popup-footer"> |
| | | <u-button @click="closeUploadDialog" :customStyle="{ marginRight: '10px' }">取消</u-button> |
| | | <u-button |
| | | v-if="hasException === true" |
| | | type="warning" |
| | | @click="goToRepair" |
| | | :customStyle="{ marginRight: '10px' }" |
| | | > |
| | | <u-button v-if="hasException === true" type="warning" @click="goToRepair" |
| | | :customStyle="{ marginRight: '10px' }"> |
| | | 新增报修 |
| | | </u-button> |
| | | <u-button type="primary" @click="submitUpload">提交</u-button> |
| | |
| | | <view class="attachment-popup-body"> |
| | | <!-- 分类标签页 --> |
| | | <view class="attachment-tabs"> |
| | | <view |
| | | class="tab-item" |
| | | :class="{ active: currentViewType === 'before' }" |
| | | @click="switchViewType('before')" |
| | | > |
| | | <view class="tab-item" :class="{ active: currentViewType === 'before' }" |
| | | @click="switchViewType('before')"> |
| | | 生产前 ({{ getAttachmentsByType(0).length }}) |
| | | </view> |
| | | <view |
| | | class="tab-item" |
| | | :class="{ active: currentViewType === 'after' }" |
| | | @click="switchViewType('after')" |
| | | > |
| | | <view class="tab-item" :class="{ active: currentViewType === 'after' }" @click="switchViewType('after')"> |
| | | 生产中 ({{ getAttachmentsByType(1).length }}) |
| | | </view> |
| | | <view |
| | | class="tab-item" |
| | | :class="{ active: currentViewType === 'issue' }" |
| | | @click="switchViewType('issue')" |
| | | > |
| | | <view class="tab-item" :class="{ active: currentViewType === 'issue' }" @click="switchViewType('issue')"> |
| | | 生产后 ({{ getAttachmentsByType(2).length }}) |
| | | </view> |
| | | </view> |
| | |
| | | <!-- 当前分类的附件列表 --> |
| | | <view class="attachment-content"> |
| | | <view v-if="getCurrentViewAttachments().length > 0" class="attachment-list"> |
| | | <view |
| | | v-for="(file, index) in getCurrentViewAttachments()" |
| | | :key="index" |
| | | class="attachment-item" |
| | | @click="previewAttachment(file)" |
| | | > |
| | | <view v-for="(file, index) in getCurrentViewAttachments()" :key="index" class="attachment-item" |
| | | @click="previewAttachment(file)"> |
| | | <view class="attachment-preview-container"> |
| | | <image |
| | | v-if="file.type === 'image' || isImageFile(file)" |
| | | :src="file.url || file.downloadUrl" |
| | | class="attachment-preview" |
| | | mode="aspectFill" |
| | | /> |
| | | <image v-if="file.type === 'image' || isImageFile(file)" :src="file.url || file.downloadUrl" |
| | | class="attachment-preview" mode="aspectFill" /> |
| | | <view v-else class="attachment-video-preview"> |
| | | <u-icon name="video" size="24" color="#409eff"></u-icon> |
| | | <text class="video-text">视频</text> |
| | |
| | | </view> |
| | | |
| | | <view class="attachment-info"> |
| | | <text class="attachment-name">{{ file.originalFilename || file.bucketFilename || file.name || '附件' }}</text> |
| | | <text class="attachment-name">{{ file.originalFilename || file.bucketFilename || file.name || '附件' |
| | | }}</text> |
| | | <text class="attachment-size">{{ formatFileSize(file.byteSize || file.size) }}</text> |
| | | </view> |
| | | </view> |
| | |
| | | </view> |
| | | </view> |
| | | <view class="video-modal-body"> |
| | | <video |
| | | v-if="currentVideoFile" |
| | | :src="currentVideoFile.url || currentVideoFile.downloadUrl" |
| | | class="video-player" |
| | | controls |
| | | autoplay |
| | | @error="handleVideoError" |
| | | ></video> |
| | | <video v-if="currentVideoFile" :src="currentVideoFile.url || currentVideoFile.downloadUrl" |
| | | class="video-player" controls autoplay @error="handleVideoError"></video> |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { onMounted, onUnmounted, ref, nextTick, computed } from 'vue' |
| | | import { onShow } from '@dcloudio/uni-app' |
| | | import { onMounted, onUnmounted, ref, nextTick, computed, reactive } from 'vue' |
| | | import { onShow, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app' |
| | | import PageHeader from '@/components/PageHeader.vue' |
| | | import { getLedgerById } from '@/api/equipmentManagement/ledger.js' |
| | | import {inspectionTaskList, uploadInspectionTask} from "@/api/inspectionManagement"; |
| | |
| | | const isScanning = ref(false) |
| | | const cameraError = ref('') |
| | | |
| | | const pagesPames = reactive({ |
| | | size: 10, |
| | | current:1 |
| | | }) |
| | | |
| | | const loadMoreStatus = computed(()=>{ |
| | | if(loading.value){ |
| | | return 'loading' |
| | | } |
| | | if(noMore.value){ |
| | | return 'noMore' |
| | | } |
| | | return 'more' |
| | | }) |
| | | const totalSize = ref(0) |
| | | const noMore = computed(()=>{ |
| | | return taskTableData.value.length>=totalSize.value |
| | | }) |
| | | const loading = ref(false) |
| | | |
| | | const reloadPage = ()=>{ |
| | | pagesPames.current = 1 |
| | | taskTableData.value = [] |
| | | getList() |
| | | } |
| | | const loadPage = ()=>{ |
| | | if(noMore.value||loading.value)return; |
| | | pagesPames.current += 1 |
| | | getList() |
| | | } |
| | | |
| | | // 生命周期 |
| | | onMounted(() => { |
| | | // 延迟初始化,确保DOM已渲染 |
| | | nextTick(() => { |
| | | getList() |
| | | // nextTick(() => { |
| | | // getList() |
| | | // }) |
| | | }) |
| | | |
| | | onReachBottom(() => { |
| | | loadPage() |
| | | }) |
| | | onPullDownRefresh(() => { |
| | | reloadPage() |
| | | uni.stopPullDownRefresh() |
| | | }) |
| | | |
| | | onShow(() => { |
| | | // 页面显示时刷新数据 |
| | | getList() |
| | | reloadPage() |
| | | }) |
| | | |
| | | // 组件销毁时的清理 |
| | |
| | | uni.navigateBack() |
| | | } |
| | | |
| | | // 查询数据 |
| | | const handleQuery = () => { |
| | | getList() |
| | | } |
| | | |
| | | // 获取列表数据 |
| | | const getList = () => { |
| | | // 显示加载提示 |
| | | showLoadingToast('加载中...') |
| | | // showLoadingToast('加载中...') |
| | | |
| | | // 设置取消标志 |
| | | isRequestCancelled = false |
| | | |
| | | inspectionTaskList({}).then(res => { |
| | | loading.value = true |
| | | inspectionTaskList({...pagesPames}).then(res => { |
| | | // 检查组件是否还存在且请求未被取消 |
| | | if (!isRequestCancelled) { |
| | | // 处理不同的数据结构 |
| | | let records = []; |
| | | if (res && res.data) { |
| | | // 尝试多种可能的数据结构 |
| | | totalSize.value = res.data.total |
| | | if (Array.isArray(res.data.records)) { |
| | | records = res.data.records; |
| | | } else if (Array.isArray(res.data.rows)) { |
| | |
| | | } |
| | | |
| | | if (records.length > 0) { |
| | | taskTableData.value = records; |
| | | taskTableData.value = [...taskTableData.value,...records.map((record)=>{ |
| | | record.fileStatus = getFileStatus(record) |
| | | return record |
| | | })]; |
| | | } else { |
| | | taskTableData.value = []; |
| | | uni.showToast({ |
| | |
| | | }); |
| | | } |
| | | } |
| | | loading.value =false |
| | | // 关闭加载提示 |
| | | closeToast() |
| | | // closeToast() |
| | | }).catch(err => { |
| | | // 检查组件是否还存在且请求未被取消 |
| | | if (!isRequestCancelled) { |
| | |
| | | icon: 'error' |
| | | }) |
| | | } |
| | | loading.value =false |
| | | // 关闭加载提示 |
| | | closeToast() |
| | | // closeToast() |
| | | }) |
| | | } |
| | | |
| | | const getFileStatus = (record)=>{ |
| | | let _beforeProduction = record.beforeProduction&&record.beforeProduction.length |
| | | let _afterProduction = record.afterProduction&&record.afterProduction.length |
| | | let _productionIssues = record.productionIssues&&record.productionIssues.length |
| | | if(_beforeProduction&&_afterProduction&&_productionIssues){ |
| | | return 2 |
| | | }else if(_beforeProduction||_afterProduction||_productionIssues){ |
| | | return 1 |
| | | }else{ |
| | | return 0 |
| | | } |
| | | } |
| | | |
| | | // 为指定任务开始扫码 |
| | |
| | | const getCurrentFiles = () => { |
| | | switch (currentUploadType.value) { |
| | | case 'before': |
| | | return beforeModelValue.value |
| | | return beforeModelValue.value||[] |
| | | case 'after': |
| | | return afterModelValue.value |
| | | return afterModelValue.value||[] |
| | | case 'issue': |
| | | return issueModelValue.value |
| | | return issueModelValue.value||[] |
| | | default: |
| | | return [] |
| | | } |
| | |
| | | |
| | | // 刷新列表 |
| | | setTimeout(() => { |
| | | getList() |
| | | reloadPage() |
| | | }, 500) |
| | | |
| | | } else { |