Przeglądaj źródła

修改如下:
1.产品声像信息界面进度动态获取
2.修改返回的动画和系统默认保持一致

zhangxike 1 dzień temu
rodzic
commit
20ffd26a4f
3 zmienionych plików z 66 dodań i 8 usunięć
  1. 14 1
      api/work.uts
  2. 10 7
      pages/work/record/InfoList.uvue
  3. 42 0
      utils/sqlite.uts

+ 14 - 1
api/work.uts

@@ -1,5 +1,5 @@
 // #ifdef APP-ANDROID
-import {selectTableData, insertTableData, updateTableData, selectJoinTableData, selectRecordData} from '@/utils/sqlite'
+import {selectTableData, insertTableData, updateTableData, selectJoinTableData, selectRecordData, selectRecordInfo} from '@/utils/sqlite'
 // #endif
 
 export type Download = {
@@ -119,6 +119,19 @@ export async function getRecordCalculate(tableName: string, value?:string|null,
 	return result;
 	// #endif
    
+  // #ifdef H5
+   return offlineData(initData)
+  // #endif
+}
+
+export async function getRecordInfoList(initData?:UTSJSONObject|null):Promise<UTSJSONObject> {
+   
+    // #ifdef APP-ANDROID
+    const result = await selectRecordInfo();
+    console.log(result); 
+	return result;
+	// #endif
+   
   // #ifdef H5
    return offlineData(initData)
   // #endif

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

@@ -38,10 +38,10 @@
 			<view class="info-row">
 				<text class="label">进度:</text>
 				<text class="process-value" :class="{
-					'bg-green': item.status === 3,
-					'bg-yellow': item.status === 2,
-					'bg-black': item.status === 1
-				  }">{{ item.progress }}</text>
+					'bg-green': item.statusRecordCount === item.totalRecord,
+					'bg-yellow': item.statusRecordCount < item.totalRecord,
+					'bg-black': item.statusRecordCount === 0
+				  }">{{ item.statusRecordCount}}  / {{item.totalRecord}} </text>
 			</view>
 		</view>
 	<!-- #ifdef APP -->
@@ -53,7 +53,7 @@
 	import {
 		ref
 	} from 'vue'
-	import { getList } from '@/api/work';
+	import { getRecordInfoList } from '@/api/work';
 
 	const backPressOptions = reactive({
 		from: 'backbutton'
@@ -79,7 +79,10 @@
 		processno : string,
 		updatetime : string,
 		progress : string,
-		status : number
+		status : number,
+		totalRecord: number,
+		statusRecordCount: number,
+		status4RecordCount: number
 	}
 
 	var initDownloads = [] as Download[]
@@ -87,7 +90,7 @@
 	const map = ref(new Map<number, string>([[1, '未执行'], [2, '执行中'], [3, '执行完'], [4, '有错误']]))
 
 	// #ifdef APP-ANDROID
-	getList('app_media_info', null, null, null, null, null).then((res : UTSJSONObject) => {
+	getRecordInfoList(null).then((res : UTSJSONObject) => {
 		console.log(res)
 		let dataList = res?.['data'] as UTSJSONObject[] ?? Array<UTSJSONObject>()
 		if (dataList != null && dataList.length > 0) {

+ 42 - 0
utils/sqlite.uts

@@ -396,4 +396,46 @@ export function selectRecordData(
 	}
 }
 
+export function selectRecordInfo() : Promise<UTSJSONObject> {
+
+	var sql = `SELECT
+							m.*, 
+							COUNT(DISTINCT r.photoitem) AS totalRecord,
+							SUM(CASE WHEN r.status in (3,4) THEN 1 ELSE 0 END) AS statusRecordCount,
+							SUM(CASE WHEN r.status = 4 THEN 1 ELSE 0 END) AS status4RecordCount
+						FROM
+							app_media_info m
+						LEFT JOIN
+							app_media_record r ON m.pdid = r.pid  
+						GROUP BY
+							m.pdid
+						ORDER BY m.updatetime desc`;
+
+
+	const sqlite = createSQLiteContext(dbName);
+
+	return new Promise<UTSJSONObject>((resolve, reject) => {
+		const selectSqlOptions = {
+			sql: sql,
+			success: (e : selectSqlOptionsResult) => {
+				console.log(e)
+
+			},
+			fail: (e : selectSqlOptionsResult) => {
+				console.error(e)
+			}
+		} as selectSqlOptions
+
+		const info = sqlite.selectSql(selectSqlOptions) as selectSqlOptionsResult
+
+		console.log(info)
+		const ret = {
+			errMsg: info?.errMsg ?? '',
+			data: info?.data ?? ['']
+		} as UTSJSONObject
+		resolve(ret)
+	});
+
+}
+