浏览代码

上传按钮一直显示,添加判断逻辑

zhangxike 2 月之前
父节点
当前提交
c64ed88edf
共有 1 个文件被更改,包括 8 次插入2 次删除
  1. 8 2
      pages/work/record/InfoList.uvue

+ 8 - 2
pages/work/record/InfoList.uvue

@@ -56,7 +56,7 @@
 		</view>  
 		
 		<view class="info-row">
-			<button class="btn btn-second" @click="upload">
+			<button class="btn btn-second" @click="upload(item.statusRecordCount === item.totalRecord)">
 			  上传数据
 			</button>
 		</view>
@@ -74,7 +74,7 @@
   import { downloadDataFromAPI, uploadDataToAPI } from '@/utils/dataProcessor';
 
   // 产品号输入框数据
-  const productNo = ref('YH07202507000005');
+  const productNo = ref('');
   
   const backPressOptions = reactive({
     from: 'backbutton'
@@ -187,6 +187,12 @@
   }
   
   const upload = async (e : any) => {
+	if(e == false) {
+		uni.showToast({
+		  title: '当前任务还未完成!',
+		  icon: 'error'
+		});
+	}
     console.log("开始上传...")
     uploadDataToAPI(productNo.value, () => {
 	  // 回调函数中执行刷新,确保数据都保存好,进度条跑完