fix: 优化初始化表相关的类型结构
This commit is contained in:
		
							parent
							
								
									636ba1fb15
								
							
						
					
					
						commit
						2a6eb111a3
					
				| @ -6,13 +6,13 @@ export interface User { | ||||
|   lsh: string | ||||
|   ksy1: string | ||||
|   ksy2: string | ||||
|   id: string | ||||
|   id?: string | ||||
|   kszp: string | ||||
|   ksmjzp: string | ||||
|   bz1: string | ||||
|   jxmc: string | ||||
|   kchp: string | ||||
|   kscx: string | ||||
|   kscx?: string | ||||
|   ksdd: string | ||||
|   kssycs: string | ||||
|   ksxl: string | ||||
| @ -177,21 +177,21 @@ export interface centerCallBackMsgType { | ||||
|   sendId: number; | ||||
| } | ||||
| 
 | ||||
| export interface JudgeConfigType{ | ||||
|   isTrajectoryOpen:boolean; | ||||
|   isPhotoOpen:boolean; | ||||
|   kfVoiceOpen:boolean; | ||||
|   ignoreProjects?:string[]; | ||||
|   isCheckFireOpen:boolean; | ||||
|   udpOpen:boolean; | ||||
|   modelPath:string; | ||||
|   trajectoryPath:string; | ||||
|   fourInOneScreen:FourInOneScreenType | ||||
|   systemParamConfig?:SystemParamConfigType | ||||
| export interface JudgeConfigType { | ||||
|   isTrajectoryOpen: boolean; | ||||
|   isPhotoOpen: boolean; | ||||
|   kfVoiceOpen: boolean; | ||||
|   ignoreProjects?: string[]; | ||||
|   isCheckFireOpen: boolean; | ||||
|   udpOpen: boolean; | ||||
|   modelPath: string; | ||||
|   trajectoryPath: string; | ||||
|   fourInOneScreen: FourInOneScreenType | ||||
|   systemParamConfig?: SystemParamConfigType | ||||
| } | ||||
| interface FourInOneScreenType{ | ||||
|   gpsDigit:number | ||||
| } | ||||
| interface SystemParamConfigType{ | ||||
| 
 | ||||
| } | ||||
| interface FourInOneScreenType { | ||||
|   gpsDigit: number | ||||
| } | ||||
| 
 | ||||
| interface SystemParamConfigType {} | ||||
| @ -127,12 +127,12 @@ export interface ES_CARINFOType { | ||||
| // 'id', 'no1', 'no2', 'no3', 'txt1', 'txt2', 'txt3' | ||||
| export interface MA_SYSTEMPARMType { | ||||
|   id?: string | ||||
|   no1: string | ||||
|   no2: string | ||||
|   no3: string | ||||
|   txt1: string | ||||
|   txt2: string | ||||
|   txt3: string | ||||
|   no1?: string | ||||
|   no2?: string | ||||
|   no3?: string | ||||
|   txt1?: string | ||||
|   txt2?: string | ||||
|   txt3?: string | ||||
|   NO1?: number, | ||||
|   NO2?: number, | ||||
|   NO3?: number, | ||||
| @ -143,33 +143,33 @@ export interface MA_SYSTEMPARMType { | ||||
| 
 | ||||
| // 'id', 'sbbm', 'itemsno', 'sbbh', 'kdid', 'bk3' | ||||
| export interface MA_CDSBINFOType { | ||||
|   id: string | ||||
|   sbbm: string | ||||
|   itemsno: string | ||||
|   sbbh: string | ||||
|   kdid: string | ||||
|   bk3: string | ||||
|   id?: string | ||||
|   sbbm?: string | ||||
|   itemsno?: string | ||||
|   sbbh?: string | ||||
|   kdid?: string | ||||
|   bk3?: string | ||||
| } | ||||
| 
 | ||||
| // 'id', 'cininfo', 'setup9', 'nextinfo', 'setup7', 'setup8', 'setup5', 'carlist', 'setup6', 'setup3', | ||||
| // 'setup4', 'setup1', 'setup2', 'itemsno', 'end_cardsno', 'freqinfo' | ||||
| export interface MA_ITEMINFOType { | ||||
|   id: string | ||||
|   cininfo: string | ||||
|   setup9: string | ||||
|   nextinfo: string | ||||
|   setup7: string | ||||
|   setup8: string | ||||
|   setup5: string | ||||
|   carlist: string | ||||
|   setup6: string | ||||
|   setup3: string | ||||
|   setup4: string | ||||
|   setup1: string | ||||
|   setup2: string | ||||
|   itemsno: string | ||||
|   end_cardsno: string | ||||
|   freqinfo: string | ||||
|   id?: string | ||||
|   cininfo?: string | ||||
|   setup9?: string | ||||
|   nextinfo?: string | ||||
|   setup7?: string | ||||
|   setup8?: string | ||||
|   setup5?: string | ||||
|   carlist?: string | ||||
|   setup6?: string | ||||
|   setup3?: string | ||||
|   setup4?: string | ||||
|   setup1?: string | ||||
|   setup2?: string | ||||
|   itemsno?: string | ||||
|   end_cardsno?: string | ||||
|   freqinfo?: string | ||||
| } | ||||
| 
 | ||||
| // 'id', 'point_no', 'point_no_f', 'gps_e', 'gps_e_location', 'gps_n', 'gps_n_location', 'f_gps_e', | ||||
| @ -212,7 +212,4 @@ export interface MA_MARKRULEType { | ||||
|   markshow?: string | ||||
|   txt1?: string | ||||
|   kfxh?: string | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
| @ -1,4 +1,15 @@ | ||||
| import { CarInfoType, DrvexamType } from '.'; | ||||
| import { | ||||
|   CarInfoType, | ||||
|   DrvexamType, | ||||
|   ES_CARINFOType, | ||||
|   MA_CDSBINFOType, | ||||
|   MA_ITEMINFOType, | ||||
|   MA_MAP_POINT_ITEMType, | ||||
|   MA_MAP_POINTType, | ||||
|   MA_MARKRULEType, | ||||
|   MA_SYSTEMPARMType, | ||||
|   User | ||||
| } from '.'; | ||||
| 
 | ||||
| // -----new----- | ||||
| export interface ApiResponseType { | ||||
| @ -147,9 +158,49 @@ interface RegistrationDeviceNoRspDetails { | ||||
| 
 | ||||
| interface ImageCompareRsp { | ||||
|   head: Head; | ||||
|   body: ESObject | ||||
|   body: ImageCompareRspBodyType | ||||
| } | ||||
| 
 | ||||
| interface ImageCompareRspBodyType { | ||||
|   GunCameraInfo: GunCameraInfo, | ||||
|   Sysset: Sysset, | ||||
|   SystemParm: SystemParm, | ||||
|   MarkRule: MarkRuleType, | ||||
|   MarkRuleSet: MarkRuleSet, | ||||
|   Cdsbinfo: Cdsbinfo, | ||||
|   CarInfo: CarInfo, | ||||
|   ItemInfo: ItemInfoType | ||||
| } | ||||
| 
 | ||||
| //-----开始 初始化表结构--- | ||||
| interface RecordContainer<T> { | ||||
|   record: Array<T> | T; | ||||
| } | ||||
| 
 | ||||
| export type PublicInfoType = RecordContainer<RecordType>; | ||||
| 
 | ||||
| export type GunCameraInfo = RecordContainer<RecordType>; | ||||
| 
 | ||||
| export type Sysset = RecordContainer<RecordType>; | ||||
| 
 | ||||
| export type SystemParm = RecordContainer<RecordType>; | ||||
| 
 | ||||
| export type MarkRuleType = RecordContainer<RecordType>; | ||||
| 
 | ||||
| export type MarkRuleSet = RecordContainer<RecordType>; | ||||
| 
 | ||||
| export type Cdsbinfo = RecordContainer<RecordType>; | ||||
| 
 | ||||
| export type CarInfo = RecordContainer<RecordType>; | ||||
| 
 | ||||
| export type ItemInfoType = RecordContainer<RecordType>; | ||||
| 
 | ||||
| 
 | ||||
| export interface RecordType extends User, MA_SYSTEMPARMType, ES_CARINFOType, MA_SYSTEMPARMType, MA_CDSBINFOType, MA_ITEMINFOType, MA_MAP_POINTType, MA_MAP_POINT_ITEMType, MA_MARKRULEType {} | ||||
| 
 | ||||
| 
 | ||||
| //-----结束 初始化表结构--- | ||||
| 
 | ||||
| 
 | ||||
| export interface GetExaminationStudentInfoResponse { | ||||
|   getExaminationStudentInfoRsp: ImageCompareRsp | ||||
|  | ||||
| @ -2,16 +2,14 @@ import common from '@ohos.app.ability.common'; | ||||
| import router from '@ohos.router'; | ||||
| 
 | ||||
| import { JudgeConfig } from '../config'; | ||||
| import promptAction from '@ohos.promptAction'; | ||||
| import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; | ||||
| import { BaseInfoType, centerCallBackMsgType } from '../model/Common'; | ||||
| import { CarInfoType, InitializeTheCentralTableType, MASYSSETTableType, TimeSynchronizationRspBody } from '../model'; | ||||
| import { GetCarInfo, GetDeviceInfo, SetCurrentTime, UseAuth } from './Index/utils'; | ||||
| import { CreateAlbum, GetCarInfo, GetDeviceInfo, SetCurrentTime, UseAuth } from './Index/utils'; | ||||
| import { GetSyncData, InitializeTheCentralTable } from '../utils/table/Operation'; | ||||
| import { BusinessError } from '@ohos.base'; | ||||
| import { delPic } from '../utils/Video'; | ||||
| import { FileHelper } from '../utils/FileHelp'; | ||||
| import { GetCurrentTime } from '../utils/Common'; | ||||
| import { ObtainUdpBusinessInstance } from '../utils/business/ObtainUdpBusiness'; | ||||
| import { CenterUDPBusinessInstance } from '../utils/business/CenterUdpBusiness'; | ||||
| import { DrivingDataStorage } from '../utils/business/DrivingDataStorage'; | ||||
| @ -21,6 +19,7 @@ import HeaderComponent from './compontents/Header'; | ||||
| import CardComponent from './Index/Card'; | ||||
| import BottomMessageComponent from './Index/BottomMessage'; | ||||
| import LoadingComponent from './Index/Loading'; | ||||
| import Prompt from '@system.prompt'; | ||||
| 
 | ||||
| 
 | ||||
| @Entry | ||||
| @ -96,7 +95,7 @@ struct Index { | ||||
|   onlineExam() { | ||||
|     this.customDialogController.open() | ||||
|     if (!this.timeInfo) { | ||||
|       promptAction.showToast({ | ||||
|       Prompt.showToast({ | ||||
|         message: `时间同步接口连接失败`, | ||||
|         duration: 3000 | ||||
|       }); | ||||
| @ -104,14 +103,14 @@ struct Index { | ||||
|       return | ||||
|     } | ||||
|     if (!this.carInfo) { | ||||
|       promptAction.showToast({ | ||||
|       Prompt.showToast({ | ||||
|         message: `车辆信息接口获取失败`, | ||||
|         duration: 3000 | ||||
|       }); | ||||
|       this.customDialogController.close() | ||||
|       return | ||||
|     } | ||||
|     this.testXMLToJSONInWorker() | ||||
|     this.initializationTableRelated() | ||||
|   } | ||||
| 
 | ||||
|   // 单机训练逻辑处理 | ||||
| @ -130,12 +129,12 @@ struct Index { | ||||
|           url: 'pages/UserInfo', | ||||
|         }, router.RouterMode.Single) | ||||
|       } else { | ||||
|         this.testXMLToJSONInWorker() | ||||
|         this.initializationTableRelated() | ||||
|       } | ||||
|     }); | ||||
|   } | ||||
| 
 | ||||
|   async testXMLToJSONInWorker() { | ||||
|   async initializationTableRelated() { | ||||
|     const param: InitializeTheCentralTableType = { | ||||
|       carId: this.carInfo?.carId, | ||||
|       examinationRoomId: this.carInfo?.examinationRoomId, | ||||
| @ -171,18 +170,12 @@ struct Index { | ||||
|             } | ||||
|           }) | ||||
|         }); | ||||
|       } else { | ||||
|         this.customDialogController.close() | ||||
|       } | ||||
|     }) | ||||
|   } | ||||
| 
 | ||||
|   async createAlbum() { | ||||
|     const time = GetCurrentTime() | ||||
|     const date = time.split(' ')[0] | ||||
|     this.fileHelper.createAlbum('jt') | ||||
|     this.fileHelper.createAlbum('pz'); | ||||
|     this.fileHelper.createAlbum(date); | ||||
|   } | ||||
| 
 | ||||
|   async initParams() { | ||||
|     console.log("test1111") | ||||
|     ObtainUdpBusinessInstance.init(); | ||||
| @ -205,7 +198,7 @@ struct Index { | ||||
|     // takePhotoFn(this.context) | ||||
|     // TODO | ||||
|     // CenterUDPBusinessInstance.startHeartBeat() | ||||
|     this.createAlbum() | ||||
|     CreateAlbum(this.fileHelper) | ||||
|   } | ||||
| 
 | ||||
|   build() { | ||||
| @ -225,7 +218,7 @@ struct Index { | ||||
|           this.onlineExam() | ||||
|         } | ||||
|       }) | ||||
|    | ||||
| 
 | ||||
|       BottomMessageComponent({ | ||||
|         version: this.baseInfo.version, | ||||
|         judgeVersion: this.baseInfo.judgeVersion, | ||||
|  | ||||
| @ -19,6 +19,7 @@ import { BusinessError } from '@ohos.base'; | ||||
| import systemTime from '@ohos.systemTime'; | ||||
| import { VideoConfigData } from '../../mock'; | ||||
| import FileUtils from '../../utils/FileUtils'; | ||||
| import { FileHelper } from '../../utils/FileHelp'; | ||||
| 
 | ||||
| //获取设备信息 | ||||
| export async function GetDeviceInfo(context: common.UIAbilityContext): Promise<string> { | ||||
| @ -40,6 +41,7 @@ export async function GetDeviceInfo(context: common.UIAbilityContext): Promise<s | ||||
|   }) | ||||
| } | ||||
| 
 | ||||
| // 获取车辆信息 | ||||
| export async function GetCarInfo(): Promise<CarInfoType> { | ||||
|   let date = new Date(); | ||||
|   let params: ObtainCarExamInfoParams = { | ||||
| @ -156,3 +158,9 @@ export async function SetSerialNumber() { | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| export function CreateAlbum(fileHelper: FileHelper) { | ||||
|   const date = dayTs().format("YYYY-MM-DD") | ||||
|   fileHelper.createAlbum('jt') | ||||
|   fileHelper.createAlbum('pz'); | ||||
|   fileHelper.createAlbum(date); | ||||
| } | ||||
|  | ||||
| @ -10,17 +10,9 @@ import { defaultJudgeConfigObj } from './judgeSDK/utils//judgeCommon'; | ||||
| import { uploadExamMileage } from '../api/judge'; | ||||
| import DwztErrorPopup from './compontents/judge/DwztErrorPopup'; | ||||
| import MsgPopup from './compontents/judge/MsgPopup'; | ||||
| import { | ||||
|   CARINFO, | ||||
|   CDSBInfo, | ||||
|   LANE, | ||||
|   MAPITEMPOINTITEM, | ||||
|   MAPPOINT, | ||||
|   Project, | ||||
|   SYSTEMPARMARR | ||||
| } from './judgeSDK/api/judgeSDK.d'; | ||||
| import { CARINFO, CDSBInfo, LANE, MAPITEMPOINTITEM, MAPPOINT, Project, SYSTEMPARMARR } from './judgeSDK/api/judgeSDK.d'; | ||||
| 
 | ||||
| import {JudgeConfig} from"../config" | ||||
| import { JudgeConfig } from '../config'; | ||||
| 
 | ||||
| import SignDisplayCom from './compontents/SignDisplayCom'; | ||||
| import { | ||||
| @ -33,12 +25,12 @@ import { | ||||
|   JudgeBeginObj, | ||||
|   JudgeCallBacData, | ||||
|   JudgeInitObj, | ||||
|   JudgeUI, | ||||
|   MA_CDSBINFOType, | ||||
|   MA_ITEMINFOType, | ||||
|   MA_MAP_POINT_ITEMType, | ||||
|   MA_MAP_POINTType, | ||||
|   MA_SYSTEMPARMType, | ||||
|   MarkRule, | ||||
|   MarkRules, | ||||
|   MASYSSETTableType, | ||||
|   ProjectInfo, | ||||
| @ -47,8 +39,7 @@ import { | ||||
|   RouteParamsType, | ||||
|   SYSSET, | ||||
|   SyssetConfig, | ||||
|   User, | ||||
|   MarkRule | ||||
|   User | ||||
| } from '../model'; | ||||
| import { GetSyncData } from '../utils/table/Operation'; | ||||
| import dayTs from '../utils/Date'; | ||||
| @ -385,8 +376,8 @@ struct Index { | ||||
|         systemParm.txt3 = systemParm.TXT3!; | ||||
|       } | ||||
|       // const { no1, no2, no3, } = systemParm; | ||||
|       const txt1 = decodeURI(systemParm.txt1) | ||||
|       const txt2 = decodeURI(systemParm.txt2) | ||||
|       const txt1 = decodeURI(systemParm.txt1 || "") | ||||
|       const txt2 = decodeURI(systemParm.txt2 || "") | ||||
| 
 | ||||
|       const no1 = systemParm.no1; | ||||
|       const no2 = systemParm.no2; | ||||
| @ -395,7 +386,7 @@ struct Index { | ||||
|       //获取当前考车的no2 | ||||
|       if (systemParm.no1 == "3" && systemParm.no3 == "1") { | ||||
|         if (txt1 === this.carName) { | ||||
|           carNo = systemParm.no2 | ||||
|           carNo = systemParm?.no2 || "" | ||||
|           this.carlist = carNo | ||||
|         } | ||||
|       } | ||||
| @ -406,28 +397,28 @@ struct Index { | ||||
|       } | ||||
|       //根据车型获取应行驶里程数 | ||||
|       if (systemParm.no1 == "3" && systemParm.no3 == "15" && carNo === systemParm.no2) { | ||||
|         this.examMileage = ((decodeURI(systemParm.txt1)) || '').split('^')[0]; | ||||
|         this.examMileage = ((decodeURI(systemParm.txt1 || "")) || '').split('^')[0]; | ||||
|       } | ||||
|       //获取当前考车的考试项目 | ||||
|       if (carNo !== '' && systemParm.no1 == "3" && systemParm.no2 == carNo && systemParm.no3 == "10") { | ||||
|         allItems = decodeURIComponent(systemParm.txt1).split(',').filter(txt => txt !== '') | ||||
|         allItems = decodeURIComponent(systemParm.txt1 || "").split(',').filter(txt => txt !== '') | ||||
|         console.info('surenjun', JSON.stringify(allItems)) | ||||
|       } | ||||
|       if ( | ||||
|       //科目二获取项目 | ||||
|         (this.examSubject == "2" && allItems.length && systemParm.no1 == '6' && allItems.includes(systemParm.no2)) | ||||
|         (this.examSubject == "2" && allItems.length && systemParm.no1 == '6' && allItems.includes(systemParm?.no2 || "")) | ||||
|           || | ||||
|           //科目三获取项目 | ||||
|           (this.examSubject == "3" && systemParm.no1 == "6") | ||||
|       ) { | ||||
|         const name = decodeURI(systemParm.txt1) | ||||
|         const name = decodeURI(systemParm.txt1 || "") | ||||
|         //小车过滤掉 夜间模拟行驶 | ||||
|         if (sCarTypes.includes(this.carType) && name === '夜间行驶') { | ||||
|           return | ||||
|         } | ||||
|         const currentProject: ProjectInfo = { | ||||
|           name, | ||||
|           abbreviation: decodeURI(systemParm.txt3), | ||||
|           abbreviation: decodeURI(systemParm.txt3 || ""), | ||||
|           projectCode: no2, | ||||
|           projectCodeCenter: txt2, | ||||
|           //是否是必考  加减档设置成非必考 | ||||
| @ -456,9 +447,9 @@ struct Index { | ||||
|         'NO1': Number(systemParm.no1), | ||||
|         'NO2': Number(systemParm.no2), | ||||
|         'NO3': Number(systemParm.no3), | ||||
|         'TXT1': decodeURIComponent(systemParm.txt1), | ||||
|         'TXT2': decodeURIComponent(systemParm.txt2), | ||||
|         'TXT3': decodeURIComponent(systemParm.txt3), | ||||
|         'TXT1': decodeURIComponent(systemParm.txt1 || ""), | ||||
|         'TXT2': decodeURIComponent(systemParm.txt2 || ""), | ||||
|         'TXT3': decodeURIComponent(systemParm.txt3 || ""), | ||||
|       }) | ||||
|     }) | ||||
|     const projects = this.projects; | ||||
| @ -479,7 +470,7 @@ struct Index { | ||||
|     //只记录考试项目的模型 | ||||
|     const projectsObj = this.projectsObj | ||||
|     cdsbParams.forEach((cdsb) => { | ||||
|       const key = decodeURI(cdsb.itemsno) | ||||
|       const key = decodeURI(cdsb.itemsno || "") | ||||
|       const newKey = key.split('~').join('_') | ||||
|       const xmdm = Number(key.split('~')[0]) | ||||
|       const currentProject: ProjectInfo = Reflect.get(projectsObj, xmdm) | ||||
| @ -504,8 +495,8 @@ struct Index { | ||||
|     const carlist = this.carlist; | ||||
|     const projectsObj = this.projectsObj | ||||
|     infoParams.forEach((info) => { | ||||
|       const key = decodeURI(info.itemsno); | ||||
|       const carlistArr = info.carlist === '' ? [] : (decodeURI(info.carlist).split(',') || []); | ||||
|       const key = decodeURI(info.itemsno || ""); | ||||
|       const carlistArr = info.carlist === '' ? [] : (decodeURI(info.carlist || "").split(',') || []); | ||||
|       const newKey = key.split('~').join('_') | ||||
|       const xmdm = Number(key.split('~')[0]) | ||||
|       const currentProject: ProjectInfo = Reflect.get(projectsObj, xmdm) | ||||
|  | ||||
| @ -125,6 +125,42 @@ struct UserInfo { | ||||
|   } | ||||
|   @State startExam: boolean = false | ||||
|   @State singlePlay: boolean = false | ||||
|   private context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; | ||||
|   private title = '' | ||||
|   private type = '2' | ||||
|   errorDialog: CustomDialogController = new CustomDialogController({ | ||||
|     builder: errorMsgDialog({ | ||||
|       title: this.title, | ||||
|       type: this.type, | ||||
|       cancel: () => { | ||||
|       }, | ||||
|       confirm: () => { | ||||
|       } | ||||
|     }), | ||||
|     customStyle: true, | ||||
|     alignment: DialogAlignment.Center, | ||||
|   }, | ||||
|   ) | ||||
|   private filePhoto!: FilePhoto | ||||
|   // 过程照片拍照 | ||||
|   getPhoto = async () => { | ||||
|     //单机模式返回空照片 | ||||
|     if (this.singlePlay) { | ||||
|       return '' | ||||
|     } else { | ||||
|       const photoBase64: string = (await this.filePhoto.getPhoto()) || ""; | ||||
|       return photoBase64 | ||||
|     } | ||||
|   } | ||||
|   private avPlayer!: VoiceAnnounce | ||||
|   private labelBlocks: LabelBlockType[] = [ | ||||
|     { label: '考生姓名', key: 'xm' }, | ||||
|     { label: '身份证号', key: 'sfzmhm' }, | ||||
|     { label: ' 流 水 号 ', key: 'lsh' }, | ||||
|     { label: '考试路线', key: 'ksxl' }, | ||||
|     { label: '待考次数', key: 'kssycs' }, | ||||
|     { label: '考试员名', key: 'ksy2' }, | ||||
|   ] | ||||
|   //开始考试准备 | ||||
|   prePareExam = async () => { | ||||
|     if (this.ksksLimit) { | ||||
| @ -171,42 +207,6 @@ struct UserInfo { | ||||
|     } | ||||
| 
 | ||||
|   } | ||||
|   private context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; | ||||
|   private title = '' | ||||
|   private type = '2' | ||||
|   errorDialog: CustomDialogController = new CustomDialogController({ | ||||
|     builder: errorMsgDialog({ | ||||
|       title: this.title, | ||||
|       type: this.type, | ||||
|       cancel: () => { | ||||
|       }, | ||||
|       confirm: () => { | ||||
|       } | ||||
|     }), | ||||
|     customStyle: true, | ||||
|     alignment: DialogAlignment.Center, | ||||
|   }, | ||||
|   ) | ||||
|   private filePhoto!: FilePhoto | ||||
|   // 过程照片拍照 | ||||
|   getPhoto = async () => { | ||||
|     //单机模式返回空照片 | ||||
|     if (this.singlePlay) { | ||||
|       return '' | ||||
|     } else { | ||||
|       const photoBase64: string = (await this.filePhoto.getPhoto()) || ""; | ||||
|       return photoBase64 | ||||
|     } | ||||
|   } | ||||
|   private avPlayer!: VoiceAnnounce | ||||
|   private labelBlocks: LabelBlockType[] = [ | ||||
|     { label: '考生姓名', key: 'xm' }, | ||||
|     { label: '身份证号', key: 'sfzmhm' }, | ||||
|     { label: ' 流 水 号 ', key: 'lsh' }, | ||||
|     { label: '考试路线', key: 'ksxl' }, | ||||
|     { label: '待考次数', key: 'kssycs' }, | ||||
|     { label: '考试员名', key: 'ksy2' }, | ||||
|   ] | ||||
| 
 | ||||
|   aboutToAppear() { | ||||
|     this.avPlayer = new VoiceAnnounce(this.context); | ||||
| @ -682,7 +682,7 @@ struct UserInfo { | ||||
|         //   } | ||||
|         // } | ||||
|         for (const key of Object.keys(res.getExaminationStudentInfoRsp.body)) { | ||||
|           const a: User[] | User = res.getExaminationStudentInfoRsp.body[key]; | ||||
|           const a: User[] | User = Reflect.get(res.getExaminationStudentInfoRsp.body, key); | ||||
|           if (Array.isArray(a)) { | ||||
|             dataList = a; | ||||
|           } else { | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| import { User } from "../../model"; | ||||
| import { User } from '../../model'; | ||||
| 
 | ||||
| export const GetCurrentUserKeyValue = (user: User, key: string): string => { | ||||
|   switch (key) { | ||||
| @ -13,7 +13,7 @@ export const GetCurrentUserKeyValue = (user: User, key: string): string => { | ||||
|     case "ksy2": | ||||
|       return user.ksy2; | ||||
|     case "id": | ||||
|       return user.id; | ||||
|       return user.id!; | ||||
|     case "kszp": | ||||
|       return user.kszp; | ||||
|     case "ksmjzp": | ||||
| @ -25,7 +25,7 @@ export const GetCurrentUserKeyValue = (user: User, key: string): string => { | ||||
|     case "kchp": | ||||
|       return user.kchp; | ||||
|     case "kscx": | ||||
|       return user.kscx; | ||||
|       return user.kscx!; | ||||
|     case "ksdd": | ||||
|       return user.ksdd; | ||||
|     case "kssycs": | ||||
|  | ||||
| @ -16,6 +16,7 @@ interface RequestOption { | ||||
| 
 | ||||
| 
 | ||||
| function xmlToJSON(target: string): object { | ||||
|   console.log("进入xml解析") | ||||
|   let conv = new convertxml.ConvertXML() | ||||
|   const result: object = conv.convertToJSObject(target, { | ||||
|     trim: false, | ||||
| @ -31,6 +32,7 @@ function xmlToJSON(target: string): object { | ||||
|     nameKey: "_name", | ||||
|     elementsKey: "_elements", | ||||
|   }) | ||||
|   console.log("xml解析完成", JSON.stringify(result)) | ||||
|   return transfer(result['_elements']) | ||||
| } | ||||
| 
 | ||||
| @ -131,6 +133,7 @@ export default function Request<T extends RequestResult>(options: RequestOption) | ||||
|     }).then(async data => { | ||||
|       console.log(RequestTag, options.url, "返回的数据", JSON.stringify(data)) | ||||
|       let result = options.xml ? xmlToJSON(data.result as string) : data.result | ||||
|       console.log("结束xml解析") | ||||
|       let resObj: object = new Object() | ||||
|       if (typeof result === 'string') { | ||||
|         result = JSON.parse(result) | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| import { InitializeTheCentralTableType, ResponseDataType, User } from '../../model'; | ||||
| import { InitializeTheCentralTableType, PublicInfoType, RecordType, ResponseDataType } from '../../model'; | ||||
| import DB, { ColumnInfo, ColumnType } from '../DbSql'; | ||||
| import { CenterMap, ParameterPlatform, RemappingTableName } from './Relationship'; | ||||
| import { BusinessError } from '@ohos.base'; | ||||
| @ -19,7 +19,7 @@ export async function InitTable() { | ||||
| } | ||||
| 
 | ||||
| // 插表操作 | ||||
| export function SqlInsertTable(tableName: string, data: Array<User>, delFlag = true): Promise<boolean> { | ||||
| export function SqlInsertTable(tableName: string, data: Array<RecordType>, delFlag = true): Promise<boolean> { | ||||
|   return new Promise((resolve, reject) => { | ||||
|     data.forEach((element, index) => { | ||||
|       element.id = !delFlag ? `${index + data.length}` : `${index}` | ||||
| @ -51,7 +51,7 @@ export function SqlInsertTable(tableName: string, data: Array<User>, delFlag = t | ||||
| 
 | ||||
| // TODO 后续废弃这个方法,直接调用SqlInsertTable | ||||
| // 依据数组和表名更新sql表 | ||||
| export function UpdateTableByArray(tableName: string, arr: Array<User>): Promise<boolean> { | ||||
| export function UpdateTableByArray(tableName: string, arr: Array<RecordType>): Promise<boolean> { | ||||
|   return SqlInsertTable(tableName, arr) | ||||
| } | ||||
| 
 | ||||
| @ -126,6 +126,7 @@ export async function InitializeTheCentralTable(params: InitializeTheCentralTabl | ||||
|       host: params.host | ||||
|     } | ||||
|     const res: ResponseDataType = await initialization(str) | ||||
|     console.log("解析完成") | ||||
|     if (!res || !res.initializationRsp || res.initializationRsp.head.resultCode === "1") { | ||||
|       resolve(false); | ||||
|     } | ||||
| @ -134,12 +135,12 @@ export async function InitializeTheCentralTable(params: InitializeTheCentralTabl | ||||
|         if (CenterMap[key]) { | ||||
|           continue | ||||
|         } | ||||
|         // TODO 后续替换类型 | ||||
|         let arrList: ESObject[] = [] | ||||
|         if (res.initializationRsp.body[key] instanceof Array) { | ||||
|           arrList = res.initializationRsp.body[key] | ||||
|         let arrList: Array<RecordType> | RecordType = [] | ||||
|         let value: PublicInfoType = Reflect.get(res.initializationRsp.body, key) | ||||
|         if (value.record instanceof Array) { | ||||
|           arrList = value.record | ||||
|         } else { | ||||
|           arrList.push(res.initializationRsp.body[key]) | ||||
|           arrList.push(value.record) | ||||
|         } | ||||
|         const folderPath = await fileUtil.initFolder(`/config/tableList`); | ||||
|         fileUtil.addFile(`${folderPath}/${RemappingTableName.get(key)}.txt`, JSON.stringify(arrList)) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user