ソースを参照

功能代码优化更新

oyq28 2 日 前
コミット
94d2cb63fb

+ 5 - 17
api/work.uts

@@ -26,7 +26,7 @@ export type Record = {
 		date : string,
 		partno : string,
 		num : number,
-		status : string,
+		status : number,
 		urlspl : string
 		imgname : string[],
 		urlpdt : string[]
@@ -73,23 +73,10 @@ export function offlineData(data:UTSJSONObject):Promise<UTSJSONObject> {
 	});	
 }
 
+export const statusDict = {'1':'未执行','2':'执行中','3':'已执行','4':'执行错误','5':'已取消'}
+export const recordStatusDict = {'1':'未拍照','2':'拍照中','3':'拍照完成','4':'检验不清晰','5':'拍照取消'}
 
-
-
-export async function getList(tableName:string, condition?:string|null, value?:string|null, initData?:UTSJSONObject|null):Promise<UTSJSONObject> {
-   
-    // #ifdef APP-ANDROID
-    const result = await selectTableData(tableName, condition, value, null, null);
-    console.log(result);
-	return result;
-	// #endif
-   
-  // #ifdef H5
-   return offlineData(initData)
-  // #endif
-}
-
-export async function getListFor2Params(tableName:string, condition?:string|null, value?:string|null, condition2?:string|null, value2?:string|null, initData?:UTSJSONObject|null):Promise<UTSJSONObject> {
+export async function getList(tableName:string, condition?:string|null, value?:string|null,condition2?:string|null, value2?:string|null, initData?:UTSJSONObject|null):Promise<UTSJSONObject> {
    
     // #ifdef APP-ANDROID
     const result = await selectTableData(tableName, condition, value, condition2, value2);
@@ -102,6 +89,7 @@ export async function getListFor2Params(tableName:string, condition?:string|null
   // #endif
 }
 
+
 export async function getJoinList(dbTable:string, joinTable:string, labels:string, joinCondition:string, lname?:string, lvalue?:string, others?:string):Promise<UTSJSONObject> {
    
     // #ifdef APP-ANDROID

+ 4 - 3
pages/work/download/DownloadDetail.uvue

@@ -37,7 +37,7 @@
 					<uni-td class="grid-text">
 						<text :class="{
 							'ft-red': taskProcess.status === 4
-						  }">{{ taskProcess.status === 4 ? "检验失败" : "" }}</text>
+						  }">{{ statusDict[taskProcess.status.toString()] }}</text>
 					</uni-td>
 				</uni-tr>
 			</uni-table>
@@ -53,13 +53,14 @@
 		ref,
 		onMounted
 	} from 'vue'
-	import { getList, Download, TaskProcess, getRecordCalculate, RecordCalculate } from '@/api/work';
+	import { getList, Download, TaskProcess, getRecordCalculate, RecordCalculate, statusDict } from '@/api/work';
 
 	const titleList = [{
 		title1: "部位", title2: "进度", title3: "状态"
 	}];
 	var taskProcessList = ref<RecordCalculate[]>([]);
 	var initTasks = [] as RecordCalculate[]
+	//const statusMap = ref(new Map<number, string>([[1,'未执行'],[2,'执行中'],[3,'执行完'],[4,'检验失败']]))
 	
 	const download = ref<Download>({
 		pdid: 0,
@@ -106,7 +107,7 @@
 		// 模拟数据加载,建议替换为后端接口请求
         // #ifdef APP-ANDROID
 		    //获取下载产品数据
-         	getList('app_product', 'pdid', downloadId, null).then((res:UTSJSONObject) => {
+         	getList('app_product', 'pdid', downloadId,null, null, null).then((res:UTSJSONObject) => {
          	 		console.log(res)
          				let dataList = res?.['data'] as UTSJSONObject[] ?? Array<UTSJSONObject>()
          				if(dataList!=null && dataList.length>0){							

+ 1 - 1
pages/work/download/DownloadList.uvue

@@ -67,7 +67,7 @@
 	var downloads = ref<Download[]>([]);
 	
 	// #ifdef APP-ANDROID	 
-	 getList('app_product', null, null, null).then((res:UTSJSONObject) => {
+	 getList('app_product', null, null, null, null, null).then((res:UTSJSONObject) => {
 	  		console.log(res)
 			let dataList = res?.['data'] as UTSJSONObject[] ?? Array<UTSJSONObject>()
 			if(dataList!=null && dataList.length>0){

+ 5 - 6
pages/work/record/InfoDetail.uvue

@@ -37,7 +37,7 @@
 					<uni-td class="grid-text">
 						<text :class="{
 							'ft-red': taskProcess.status === 4
-						  }">{{ taskProcess.status === 4 ? "检验失败" : "" }}</text>
+						  }">{{ statusDict[taskProcess.status.toString()] }}</text>
 					</uni-td>
 				</uni-tr>
 			</uni-table>
@@ -53,7 +53,7 @@
 		ref,
 		onMounted
 	} from 'vue'
-	import { getList, Download, TaskProcess, getRecordCalculate, RecordCalculate } from '@/api/work';
+	import { getList, Download, TaskProcess, getRecordCalculate, RecordCalculate, statusDict } from '@/api/work';
 
 	const titleList = [{
 		title1: "部位", title2: "进度", title3: "状态"
@@ -105,8 +105,8 @@
 		const downloadId = options?.id ?? ""
 		// 模拟数据加载,建议替换为后端接口请求
            // #ifdef APP-ANDROID
-               //获取下载产品数据
-            	getList('app_media_info', 'pdid', downloadId, null).then((res:UTSJSONObject) => {
+               //获取下载产品数据			   
+            	getList('app_media_info', 'pdid', downloadId, null,null, null).then((res:UTSJSONObject) => {
             	 		console.log(res)
             				let dataList = res?.['data'] as UTSJSONObject[] ?? Array<UTSJSONObject>()
             				if(dataList!=null && dataList.length>0){							
@@ -137,8 +137,7 @@
            	 			} 
            		   console.log(initTasks)
            		   taskProcessList.value = initTasks
-           	  })
-           	 
+           	  }) 
            // #endif
 	})
 

+ 4 - 3
pages/work/record/InfoList.uvue

@@ -68,10 +68,11 @@
 	}
 	
 	var initDownloads = [] as Download[]
-	var downloads = ref<Download[]>([]);
-	
+	var downloads = ref<Download[]>([]);	
+	const map = ref(new Map<number, string>([[1,'未执行'],[2,'执行中'],[3,'执行完'],[4,'有错误']]))
+		
 	// #ifdef APP-ANDROID
-	 getList('app_media_info', null, null, null).then((res:UTSJSONObject) => {
+	 getList('app_media_info', null, null, null,null, null).then((res:UTSJSONObject) => {
 	  		console.log(res)
 			let dataList = res?.['data'] as UTSJSONObject[] ?? Array<UTSJSONObject>()
 			if(dataList!=null && dataList.length>0){

+ 8 - 8
pages/work/record/RecordList.uvue

@@ -4,10 +4,10 @@
 			<view class="tag-circle" v-for="(item, index) in initRecords" :key="index" @click="tabsClick(item.senum)"
 				:class="{'checked-tag' : item.senum == current}">
 				<text class="circle" :class="{
-								'bg-green': item.status == '已执行',
-								'bg-yellow': item.status == '执行中',
-								'bg-red': item.status == '异常',
-								'bg-black': item.status == '未执行'
+								'bg-green': item.status == 3,
+								'bg-yellow': item.status == 2,
+								'bg-red': item.status == 4,
+								'bg-black': item.status == 1
 							  }">{{item.senum}}</text>
 			</view>
 		</view>
@@ -21,7 +21,7 @@
 			<view class="header-row">
 				<text class="label">序号:</text>
 				<text class="value">{{ item.senum }}</text>
-				<text class="status" :class="{'status-cancelled': item.status === '已取消', 'bg-red': item.status == '异常'}">{{ item.status }}</text>
+				<text class="status" :class="{'status-cancelled': item.status === 5, 'bg-red': item.status == 4}">{{ recordStatusDict[item.status.toString()] }}</text>
 			</view>
 
 			<view class="info-row">
@@ -54,7 +54,7 @@
 				<text class="value">{{ item.num }}</text>
 			</view>
 
-			<button class="cancel-btn" v-if="item.status == '未执行'" @click="cancel(item.sxid, item.num)">
+			<button class="cancel-btn" v-if="item.status == 1" @click="cancel(item.sxid, item.num)">
 				拍照
 			</button>
 
@@ -98,7 +98,7 @@
 	import {
 		ref
 	} from 'vue'
-	import { getList, Record, getListFor2Params } from '@/api/work';
+	import { getList, Record, recordStatusDict } from '@/api/work';
 
 	//检查项目最大数量
 	var maxcount = 5
@@ -113,7 +113,7 @@
 		const pid = options?.pid ?? "1"
 		maxcount = parseInt(num)
 		// #ifdef APP-ANDROID
-		getListFor2Params('app_media_record', 'photoitem', photoitem, 'pid', pid, null).then((res : UTSJSONObject) => {
+		 getList('app_media_record', 'photoitem', photoitem, 'pid', pid, null).then((res : UTSJSONObject) => {
 			let dataList = res?.['data'] as UTSJSONObject[] ?? Array<UTSJSONObject>()
 			if (dataList != null && dataList.length > 0) {
 				dataList.forEach(item => {

BIN
static/db/QT800.db


+ 2 - 2
utils/sqlite.uts

@@ -349,9 +349,9 @@ export function selectRecordData(
 					  pid,
 						sxid,
 						photoitem,
-						SUM( CASE WHEN status IN ('已执行', '异常') THEN 1 ELSE 0 END ) AS step,
+						SUM( CASE WHEN status IN (3, 4) THEN 1 ELSE 0 END ) AS step,
 						COUNT( 1 ) AS total,
-						SUM( CASE WHEN status = '异常' THEN 1 ELSE 0 END ) AS has_exception 
+						SUM( CASE WHEN status = 4 THEN 1 ELSE 0 END ) AS has_exception 
 					FROM
 						${dbTable} 
 					WHERE