| src/api/login.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/manifest.json | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/pages.json | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/pages/index.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/pages/inspectionUpload/index.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/api/login.js
@@ -41,3 +41,12 @@ params: params }) } // 获取未过期公告数量 export function noticesCount(params) { return request({ url: '/home/noticesCount', method: 'get', params: params }) } src/manifest.json
@@ -1,6 +1,6 @@ { "name" : "信息管理", "appid" : "__UNI__D950DA4", "appid" : "__UNI__E1C100D", "description" : "", "versionName" : "1.0.0", "versionCode" : "100", @@ -19,7 +19,8 @@ /* 模块配置 */ "modules" : { "Camera" : {}, "Barcode" : {} "Barcode" : {}, "Push" : {} }, /* 应用发布信息 */ "distribute" : { @@ -48,7 +49,17 @@ "dSYMs" : false }, /* SDK配置 */ "sdkConfigs" : {}, "sdkConfigs" : { "push" : { "unipush" : { "icons" : { "small" : { "ldpi" : "D:/xindao/wenjian/img/logo/app.png" } } } } }, "icons" : { "android" : { "hdpi" : "unpackage/res/icons/72x72.png", src/pages.json
@@ -411,7 +411,9 @@ "path": "pages/inspectionUpload/index", "style": { "navigationBarTitleText": "巡检上传", "navigationStyle": "custom" "navigationStyle": "custom", "enablePullDownRefresh": true, // 开启下拉刷新 "backgroundColor": "#f8f8f8" // 下拉刷新时的背景色 } }, { src/pages/index.vue
@@ -2,8 +2,8 @@ <view class="content"> <view class="header-section"> <view class="currentFactory"> <up-text type="primary" :text="userStore.currentFactoryName" @click="show = true" size="18" class="factoryName" suffixIcon="arrow-right" :iconStyle="iconStyle"></up-text> <up-text type="primary" :text="userStore.currentFactoryName" @click="show = true" size="18" class="factoryName" suffixIcon="arrow-right" :iconStyle="iconStyle"></up-text> </view> <up-picker :show="show" :columns="factoryList" @confirm="changeFactory" @cancel="show = false"></up-picker> </view> @@ -40,21 +40,10 @@ </view> </view> <view class="module-content"> <up-grid :border="false" col="4" > <up-grid-item v-for="(item, index) in marketingItems" :key="index" @click="handleCommonItemClick(item)" > <up-grid :border="false" col="4"> <up-grid-item v-for="(item, index) in marketingItems" :key="index" @click="handleCommonItemClick(item)"> <view class="icon-container" :style="{ background: item.bgColor }"> <up-icon :name="item.icon" :size="58" color="#ffffff" ></up-icon> <up-icon :name="item.icon" :size="58" color="#ffffff"></up-icon> </view> <text class="item-label">{{item.label}}</text> </up-grid-item> @@ -70,21 +59,10 @@ </view> </view> <view class="module-content"> <up-grid :border="false" col="4" > <up-grid-item v-for="(item, index) in purchaseItems" :key="index" @click="handleCommonItemClick(item)" > <up-grid :border="false" col="4"> <up-grid-item v-for="(item, index) in purchaseItems" :key="index" @click="handleCommonItemClick(item)"> <view class="icon-container" :style="{ background: item.bgColor }"> <up-icon :name="item.icon" :size="58" color="#ffffff" ></up-icon> <up-icon :name="item.icon" :size="58" color="#ffffff"></up-icon> </view> <text class="item-label">{{item.label}}</text> </up-grid-item> @@ -100,21 +78,10 @@ </view> </view> <view class="module-content"> <up-grid :border="false" col="4" > <up-grid-item v-for="(item, index) in collaborationItems" :key="index" @click="handleCommonItemClick(item)" > <up-grid :border="false" col="4"> <up-grid-item v-for="(item, index) in collaborationItems" :key="index" @click="handleCommonItemClick(item)"> <view class="icon-container" :style="{ background: item.bgColor }"> <up-icon :name="item.icon" :size="58" color="#ffffff" ></up-icon> <up-icon :name="item.icon" :size="58" color="#ffffff"></up-icon> </view> <text class="item-label">{{item.label}}</text> </up-grid-item> @@ -129,21 +96,10 @@ </view> </view> <view class="module-content"> <up-grid :border="false" col="4" > <up-grid-item v-for="(item, index) in inventoryManagement" :key="index" @click="handleCommonItemClick(item)" > <up-grid :border="false" col="4"> <up-grid-item v-for="(item, index) in inventoryManagement" :key="index" @click="handleCommonItemClick(item)"> <view class="icon-container" :style="{ background: item.bgColor }"> <up-icon :name="item.icon" :size="58" color="#ffffff" ></up-icon> <up-icon :name="item.icon" :size="58" color="#ffffff"></up-icon> </view> <text class="item-label">{{item.label}}</text> </up-grid-item> @@ -159,21 +115,10 @@ </view> </view> <view class="module-content"> <up-grid :border="false" col="4" > <up-grid-item v-for="(item, index) in productionItems" :key="index" @click="handleCommonItemClick(item)" > <up-grid :border="false" col="4"> <up-grid-item v-for="(item, index) in productionItems" :key="index" @click="handleCommonItemClick(item)"> <view class="icon-container" :style="{ background: item.bgColor }"> <up-icon :name="item.icon" :size="58" color="#ffffff" ></up-icon> <up-icon :name="item.icon" :size="58" color="#ffffff"></up-icon> </view> <text class="item-label">{{item.label}}</text> </up-grid-item> @@ -189,21 +134,10 @@ </view> </view> <view class="module-content"> <up-grid :border="false" col="4" > <up-grid-item v-for="(item, index) in equipmentItems" :key="index" @click="handleCommonItemClick(item)" > <up-grid :border="false" col="4"> <up-grid-item v-for="(item, index) in equipmentItems" :key="index" @click="handleCommonItemClick(item)"> <view class="icon-container" :style="{ background: item.bgColor }"> <up-icon :name="item.icon" :size="58" color="#ffffff" ></up-icon> <up-icon :name="item.icon" :size="58" color="#ffffff"></up-icon> </view> <text class="item-label">{{item.label}}</text> </up-grid-item> @@ -214,10 +148,19 @@ </template> <script setup> import {ref, onMounted, nextTick, reactive} from 'vue'; import {userLoginFacotryList} from "@/api/login"; import { ref, onMounted, nextTick, reactive } from 'vue'; import { userLoginFacotryList, noticesCount } from "@/api/login"; import modal from "@/plugins/modal"; import useUserStore from "@/store/modules/user"; import { onShow } from '@dcloudio/uni-app' const userStore = useUserStore() const factoryId = ref(''); @@ -244,8 +187,7 @@ } // 营销管理功能数据 const marketingItems = reactive([ { const marketingItems = reactive([{ icon: '/static/images/icon/xiaoshoutaizhang@2x.png', label: '销售台账', }, @@ -272,8 +214,7 @@ ]); // 采购管理功能数据 const purchaseItems = reactive([ { const purchaseItems = reactive([{ icon: '/static/images/icon/caigoutaizhang@2x.png', label: '采购台账', }, @@ -300,8 +241,7 @@ ]); // 协同办公功能数据 const collaborationItems = reactive([ { const collaborationItems = reactive([{ icon: '/static/images/icon/gongchuguanli@2x.png', label: '公出管理', }, @@ -323,8 +263,7 @@ } ]); // 协同办公功能数据inventoryManagement/receiptManagement const inventoryManagement = reactive([ { const inventoryManagement = reactive([{ icon: '/static/images/icon/rukuguanli@2x.png', label: '自定义入库', }, @@ -335,8 +274,7 @@ ]); // 生产管控功能数据 const productionItems = reactive([ { const productionItems = reactive([{ icon: '/static/images/icon/shengchandingdan@2x.png', label: '生产订单', bgColor: '#FF9800' @@ -364,8 +302,7 @@ ]); // 设备管理功能数据 const equipmentItems = reactive([ { const equipmentItems = reactive([{ icon: '/static/images/icon/shebeitaizhang@2x.png', label: '设备台账', }, @@ -579,7 +516,9 @@ const uToastRef = ref(null); function getUserLoginFacotryList() { userLoginFacotryList({userName: userStore.nickName}).then(res => { userLoginFacotryList({ userName: userStore.nickName }).then(res => { // 检查res.data是否为数组 factoryList.value[0] = [] if (res.data && Array.isArray(res.data)) { @@ -615,6 +554,7 @@ modal.closeLoading() }) } function loginSuccess(result) { uni.reLaunch({ url: '/pages/index' @@ -627,6 +567,58 @@ uToastRef.value.success(`点击了第${name + 1}个`); // 注意:这里加1是因为通常我们是从第1个开始计数的 } }; const isShowNoticesCount = ref(true) // 获取公告数量 const getNoticesCount = () => { if(!isShowNoticesCount.value){ return } noticesCount({}).then(resp => { if (resp.code != 200 || !resp.data) { return } const res = uni.getAppAuthorizeSetting(); if (res.notificationAuthorized == 'denied') { uni.showModal({ title: '提示', content: '请在设置中开启通知权限', success: (res) => { if (res.confirm) { uni.openAppAuthorizeSetting({ success: (res) => { console.log('openAppAuthorizeSetting',res) // if (res.authSetting['scope.push']) { // createPushMessage(resp.data) // } } }); }else{ isShowNoticesCount.value = false } } }); return } createPushMessage(resp.data) }).catch(error => { modal.msgError('获取公告数量:', error) console.log('获取公告数量:', error) }) } const createPushMessage = (_noticesCount) => { uni.createPushMessage({ title: '公告通知', content: `当前有${_noticesCount}条公告通知,注意查看`, success: (resp) => { console.log('success', resp) isShowNoticesCount.value = false }, fail: (resp) => { console.log('fail', resp) } }) } onMounted(() => { // 设置用户信息 @@ -634,7 +626,11 @@ getUserLoginFacotryList() // 启动通知状态定时器 startStatusTimer() // getNoticesCount() }); onShow(()=>{ getNoticesCount() }) </script> <style scoped lang="scss"> @@ -766,8 +762,15 @@ letter-spacing: 0.03125rem; text-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.5); } .hero-subtitle { font-size: 0.8125rem; margin-top: 0.375rem; } .hero-wave { height: 2.75rem; } .hero-subtitle { font-size: 0.8125rem; margin-top: 0.375rem; } .hero-wave { height: 2.75rem; } .hero-subtitle { color: rgba(255, 255, 255, 0.9); @@ -838,6 +841,7 @@ 0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); } 100% { transform: translateX(100%) translateY(100%) rotate(45deg); } @@ -848,6 +852,7 @@ opacity: 0; transform: translateY(-1.25rem); } to { opacity: 1; transform: translateY(0); @@ -859,6 +864,7 @@ opacity: 0; transform: translateY(1.25rem); } to { opacity: 1; transform: translateY(0); @@ -866,8 +872,15 @@ } @keyframes fadeInScale { 0% { opacity: 0; transform: translateY(0.5rem) scale(0.96); } 100% { opacity: 1; transform: translateY(0) scale(1); } 0% { opacity: 0; transform: translateY(0.5rem) scale(0.96); } 100% { opacity: 1; transform: translateY(0) scale(1); } } .notice-content { @@ -1085,59 +1098,122 @@ .content { background: linear-gradient(135deg, #121317 0%, #161a20 100%); } .content::before { background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="dots" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="1" fill="rgba(255, 255, 255, 0.05)"/></pattern></defs><rect width="100" height="100" fill="url(%23dots)"/></svg>'); } .common-module { background: linear-gradient(135deg, #1e1f24 0%, #23252b 100%); box-shadow: 0 0.375rem 1.5rem rgba(0,0,0,0.35); } .module-title { color: #e9edf3; } .module-subtitle, .item-label, .notice-text, .notice-unit, .notice-label { .module-subtitle, .item-label, .notice-text, .notice-unit, .notice-label { color: #c7cbd3; } .notice { background: linear-gradient(135deg, #1b2330 0%, #1a2432 100%); border-color: rgba(255,255,255,0.06); box-shadow: 0 0.375rem 1.25rem rgba(0,0,0,0.4); } .notice-status, .notice-number { .notice-status, .notice-number { color: #8ab4ff; } .bg-img { background: linear-gradient(135deg, #1f4fb9 0%, #0e3a8a 100%); } } @keyframes rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } from { transform: rotate(0deg); } to { transform: rotate(360deg); } } @keyframes fadeInDown { from { opacity: 0; transform: translateY(-1.25rem); } to { opacity: 1; transform: translateY(0); } from { opacity: 0; transform: translateY(-1.25rem); } to { opacity: 1; transform: translateY(0); } } @keyframes fadeInUp { from { opacity: 0; transform: translateY(1.25rem); } to { opacity: 1; transform: translateY(0); } from { opacity: 0; transform: translateY(1.25rem); } to { opacity: 1; transform: translateY(0); } } @keyframes fadeInScale { 0% { opacity: 0; transform: translateY(0.5rem) scale(0.96); } 100% { opacity: 1; transform: translateY(0) scale(1); } 0% { opacity: 0; transform: translateY(0.5rem) scale(0.96); } .notice-left { margin-right: 1rem; } .notice-status { font-size: 1rem; } .notice-separator { width: 0.0625rem; height: 1.5rem; margin-right: 1rem; } .notice-label { font-size: 0.875rem; margin-right: 0.75rem; } .notice-text { font-size: 0.875rem; } .notice-number { font-size: 1rem; margin-left: 0.25rem; } .notice-unit { font-size: 0.875rem; margin-left: 0.125rem; } 100% { opacity: 1; transform: translateY(0) scale(1); } } .notice-left { margin-right: 1rem; } .notice-status { font-size: 1rem; } .notice-separator { width: 0.0625rem; height: 1.5rem; margin-right: 1rem; } .notice-label { font-size: 0.875rem; margin-right: 0.75rem; } .notice-text { font-size: 0.875rem; } .notice-number { font-size: 1rem; margin-left: 0.25rem; } .notice-unit { font-size: 0.875rem; margin-left: 0.125rem; } .common-module { margin-bottom: 1.5rem; @@ -1240,11 +1316,23 @@ } } .item-label { font-size: 0.8125rem; margin-top: 0.25rem; margin-bottom: 0.625rem; } .grid-text { font-size: 0.875rem; } .item-label { font-size: 0.8125rem; margin-top: 0.25rem; margin-bottom: 0.625rem; } .grid-text { font-size: 0.875rem; } @media (prefers-color-scheme: dark) { .common-module { box-shadow: 0 0.375rem 1.5rem rgba(0,0,0,0.35); } .notice { box-shadow: 0 0.375rem 1.25rem rgba(0,0,0,0.4); } .common-module { box-shadow: 0 0.375rem 1.5rem rgba(0, 0, 0, 0.35); } .notice { box-shadow: 0 0.375rem 1.25rem rgba(0, 0, 0, 0.4); } } </style> src/pages/inspectionUpload/index.vue
@@ -7,40 +7,26 @@ <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> @@ -62,12 +48,21 @@ <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> @@ -78,41 +73,24 @@ <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> @@ -127,25 +105,16 @@ <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> @@ -154,19 +123,13 @@ <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> @@ -176,53 +139,35 @@ <!-- 当前分类的上传区域 --> <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> @@ -233,7 +178,8 @@ </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> @@ -256,12 +202,8 @@ <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> @@ -284,25 +226,14 @@ <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> @@ -310,19 +241,11 @@ <!-- 当前分类的附件列表 --> <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> @@ -330,7 +253,8 @@ </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> @@ -355,14 +279,8 @@ </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> @@ -370,8 +288,8 @@ </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"; @@ -464,17 +382,56 @@ 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() }) // 组件销毁时的清理 @@ -498,26 +455,23 @@ 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)) { @@ -530,7 +484,10 @@ } 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({ @@ -539,8 +496,9 @@ }); } } loading.value =false // 关闭加载提示 closeToast() // closeToast() }).catch(err => { // 检查组件是否还存在且请求未被取消 if (!isRequestCancelled) { @@ -551,9 +509,23 @@ 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 } } // 为指定任务开始扫码 @@ -708,11 +680,11 @@ 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 [] } @@ -836,7 +808,7 @@ // 刷新列表 setTimeout(() => { getList() reloadPage() }, 500) } else {