Bläddra i källkod

添加下载后刷新页面,更新时间展示逻辑修改

ZhangLeo 6 dagar sedan
förälder
incheckning
51ff30f64d
2 ändrade filer med 8 tillägg och 22 borttagningar
  1. 7 21
      pages/work/record/InfoList.uvue
  2. 1 1
      utils/sqlite.uts

+ 7 - 21
pages/work/record/InfoList.uvue

@@ -33,7 +33,7 @@
 			</view>
 			<view class="info-row">
 				<text class="label">最近更新时间:</text>
-				<text class="value">{{ item.updatetime }}</text>
+				<text class="value">{{ item.updatetime == "" ? item.createtime : item.updatetime }}</text>
 			</view>
 			<view class="info-row">
 				<text class="label">进度:</text>
@@ -79,6 +79,7 @@
 		cardno : string,
 		processno : string,
 		updatetime : string,
+		createtime: string,
 		progress : string,
 		status : number,
 		totalRecord : number,
@@ -105,6 +106,7 @@
 			});
 		}
 		downloads.value = initDownloads
+		console.log(initDownloads)
 	})
 	// #endif
 
@@ -149,26 +151,10 @@
 		// 调用数据处理工具中的方法下载数据
 		// 调用数据处理工具中的方法下载数据
 		await downloadDataFromAPI(() => {
-			// 重新加载页面数据的回调函数
-			getRecordInfoList(null).then((res : UTSJSONObject) => {
-				console.log('下载完成后刷新数据:', res)
-				let dataList = res?.['data'] as UTSJSONObject[] ?? Array<UTSJSONObject>()
-				// 清空现有数据,确保不重复添加
-				initDownloads = []
-				if (dataList != null && dataList.length > 0) {
-					dataList.forEach(item => {
-						if (item != null) {
-							let download = JSON.parse<Download>(item.toJSONString());
-							if (download != null) {
-								initDownloads.push(download)
-							}
-						}
-					});
-				}
-				console.log('刷新后的数据列表:', initDownloads)
-				// 更新响应式数据,触发页面刷新
-				downloads.value = [...initDownloads]
-			})
+			
+		}).then((res) => {
+			// 刷新整个页面
+			uni.reLaunch({ url: '/pages/work/record/InfoList' })
 		})
 	}
 	const upload = (e : any) => {

+ 1 - 1
utils/sqlite.uts

@@ -444,7 +444,7 @@ export function selectRecordInfo() : Promise<UTSJSONObject> {
 						GROUP BY
 							m.pdid
 						ORDER BY
-							m.updatetime DESC`;
+							m.pdid DESC`;
 
 
 	const sqlite = createSQLiteContext(dbName);