fix: 优化考生列表界面一些逻辑
This commit is contained in:
parent
c80ab32e5d
commit
59a54c0ec7
@ -45,10 +45,10 @@ export async function faceCompare(params: FaceCompareParams) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export async function getExaminationStudentInfo(params: ESObject) {
|
export async function getExaminationStudentInfo(params: ExaminationStuAbsentParams) {
|
||||||
return request<GetExaminationStudentInfoResponse>({
|
return request<GetExaminationStudentInfoResponse>({
|
||||||
url: '/der2/services/exam/getExaminationStudentInfo.ws',
|
url: '/der2/services/exam/getExaminationStudentInfo.ws',
|
||||||
data: params,
|
data: `<getExaminationStudentInfoReq><head><checkCode>${params.md5Message}</checkCode></head><body><carId>${params.carId}</carId><examinationRoomId>${params.examinationRoomId}</examinationRoomId><examinerName>${params.username}</examinerName><sfzmhm></sfzmhm></body></getExaminationStudentInfoReq>`,
|
||||||
method: http.RequestMethod.POST,
|
method: http.RequestMethod.POST,
|
||||||
xml: true
|
xml: true
|
||||||
})
|
})
|
||||||
|
|||||||
@ -34,3 +34,46 @@ export interface CheckItemType {
|
|||||||
audio: string;
|
audio: string;
|
||||||
message: string;
|
message: string;
|
||||||
}
|
}
|
||||||
|
// const SYSSET_VNO = {
|
||||||
|
// SERIAL_NUMBER: '901',
|
||||||
|
// EXAM_SYSTEM_CODE: '902',
|
||||||
|
// STUDENT_REFRESH: '452',
|
||||||
|
// OPEN_CHECK_FLAG: '17',
|
||||||
|
// FACE_PARAM: '2413',
|
||||||
|
// JUDGMENT_TIMING: '364',
|
||||||
|
// SECOND_EXAM_PREPARE: '398',
|
||||||
|
// NO_ABSENT_FUNCTION: '770',
|
||||||
|
// SEATBELT_DOOR: '803',
|
||||||
|
// EXAM_ORDER: '341',
|
||||||
|
// EXAM_TRIGGER: '612',
|
||||||
|
// NO_ABSENT_AFTER_ONCE: '352',
|
||||||
|
// EXAMINER_DISPLAY: '828',
|
||||||
|
// VIDEO_SAVE_DAYS: '305'
|
||||||
|
// };
|
||||||
|
export const SYSSET_VNO_MAP=new Map([
|
||||||
|
['SERIAL_NUMBER', '901'],
|
||||||
|
['EXAM_SYSTEM_CODE', '902'],
|
||||||
|
['STUDENT_REFRESH', '452'],
|
||||||
|
['OPEN_CHECK_FLAG', '17'],
|
||||||
|
['FACE_PARAM', '2413'],
|
||||||
|
['JUDGMENT_TIMING', '364'],
|
||||||
|
['SECOND_EXAM_PREPARE', '398'],
|
||||||
|
['NO_ABSENT_FUNCTION', '770'],
|
||||||
|
['SEATBELT_DOOR', '803'],
|
||||||
|
['EXAM_ORDER', '341'],
|
||||||
|
['EXAM_TRIGGER', '612'],
|
||||||
|
['NO_ABSENT_AFTER_ONCE', '352'],
|
||||||
|
['EXAMINER_DISPLAY', '828'],
|
||||||
|
['VIDEO_SAVE_DAYS', '305']
|
||||||
|
])
|
||||||
|
// // 定义更新策略常量
|
||||||
|
// const REFRESH_STRATEGY = {
|
||||||
|
// NO_AUTO: '0',
|
||||||
|
// AUTO_UNLIMITED: '1',
|
||||||
|
// AUTO_TWICE: '2'
|
||||||
|
// };
|
||||||
|
export const REFRESH_STRATEGY_MAP=new Map([
|
||||||
|
['NO_AUTO', '0'],
|
||||||
|
['AUTO_UNLIMITED', '1'],
|
||||||
|
['AUTO_TWICE', '2']
|
||||||
|
])
|
||||||
@ -276,9 +276,10 @@ interface GetExaminationItemRspBody {
|
|||||||
|
|
||||||
export interface ExaminationStuAbsentParams {
|
export interface ExaminationStuAbsentParams {
|
||||||
carId: string;
|
carId: string;
|
||||||
sfzmhm: string;
|
sfzmhm?: string;
|
||||||
examinationRoomId: string;
|
examinationRoomId: string;
|
||||||
username: string;
|
username: string;
|
||||||
lsh: string;
|
lsh?: string;
|
||||||
|
md5Message?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -25,9 +25,11 @@ import {
|
|||||||
IdCard,
|
IdCard,
|
||||||
LabelBlockType,
|
LabelBlockType,
|
||||||
MASYSSETTableType,
|
MASYSSETTableType,
|
||||||
|
REFRESH_STRATEGY_MAP,
|
||||||
RegulatoryInterfaceParams,
|
RegulatoryInterfaceParams,
|
||||||
RouteParamsType,
|
RouteParamsType,
|
||||||
SckType,
|
SckType,
|
||||||
|
SYSSET_VNO_MAP,
|
||||||
SystemParamType,
|
SystemParamType,
|
||||||
UDPParamType,
|
UDPParamType,
|
||||||
User
|
User
|
||||||
@ -362,7 +364,6 @@ struct UserInfoPage {
|
|||||||
})
|
})
|
||||||
this.dataList = this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4)
|
this.dataList = this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4)
|
||||||
if (!flag) {
|
if (!flag) {
|
||||||
|
|
||||||
AppStorage.setOrCreate('lsh', '0000000000000')
|
AppStorage.setOrCreate('lsh', '0000000000000')
|
||||||
await SqlInsertTable('USER', [])
|
await SqlInsertTable('USER', [])
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -459,9 +460,6 @@ struct UserInfoPage {
|
|||||||
AppStorage.setOrCreate('examinerInfo', this.examinerLoginInfo)
|
AppStorage.setOrCreate('examinerInfo', this.examinerLoginInfo)
|
||||||
AppStorage.setOrCreate('lsh', this.lsh)
|
AppStorage.setOrCreate('lsh', this.lsh)
|
||||||
}
|
}
|
||||||
|
|
||||||
// const syssetParams = await getSyncData('MA_SYSSET');
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async heartMsg() {
|
async heartMsg() {
|
||||||
@ -484,117 +482,146 @@ struct UserInfoPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async initSysset() {
|
async initSysset() {
|
||||||
const that = this;
|
// 使用 try-catch 处理可能的异常
|
||||||
GetSyncData<MASYSSETTableType>("MA_SYSSET").then((syssetParams: MASYSSETTableType[]) => {
|
try {
|
||||||
const serialNumberArr = syssetParams.filter(sys => sys.v_no === '901')
|
const syssetParams = await GetSyncData<MASYSSETTableType>("MA_SYSSET");
|
||||||
that.jkxlh = serialNumberArr?.[0]?.v_value || ''
|
// 创建映射表以避免多次 filter 操作
|
||||||
const ksxtbhArr = syssetParams.filter(sys => sys.v_no === '902')
|
const syssetMap = new Map<string, MASYSSETTableType>();
|
||||||
that.ksxtbh = ksxtbhArr?.[0]?.v_value || '222'
|
syssetParams.forEach(sys => syssetMap.set(sys.v_no!, sys));
|
||||||
const studentRefreshParam = syssetParams.filter(sys => sys.v_no === '452') //判断自动更新
|
|
||||||
that.studentRefreshStatue = studentRefreshParam?.[0]?.v_value || '0'
|
|
||||||
const openCheckFlagParam = syssetParams.filter(sys => sys.v_no == '17') //0
|
|
||||||
const openCheckFlag = openCheckFlagParam?.[0]?.v_value == '1' ? '1' : '0'
|
|
||||||
|
|
||||||
const faceParam = syssetParams.filter(sys => sys.v_no == '2413') //3
|
// 使用映射表获取所需参数
|
||||||
dConsole.log('FaceOpenStatue', openCheckFlag, this.FaceOpenStatue)
|
this.jkxlh = syssetMap.get(SYSSET_VNO_MAP.get('SERIAL_NUMBER')!)?.v_value || '';
|
||||||
// 1身份证读卡器 2指纹 3人脸
|
this.ksxtbh = syssetMap.get(SYSSET_VNO_MAP.get("EXAM_SYSTEM_CODE")!)?.v_value || '222';
|
||||||
if (openCheckFlag == '1') {
|
this.studentRefreshStatue = syssetMap.get(SYSSET_VNO_MAP.get("STUDENT_REFRESH")!)?.v_value || '0';
|
||||||
that.FaceOpenStatue = faceParam?.[0]?.v_value == '3' ? '1' : '0'
|
|
||||||
this.faceFlag = faceParam?.[0]?.v_value || '0'
|
// 获取验证标志和人脸参数
|
||||||
if (faceParam?.[0]?.v_value == '1') {
|
const openCheckFlagParam = syssetMap.get(SYSSET_VNO_MAP.get("OPEN_CHECK_FLAG")!);
|
||||||
that.openDeviceByIDCard()
|
const openCheckFlag = openCheckFlagParam?.v_value === '1' ? '1' : '0';
|
||||||
|
const faceParam = syssetMap.get(SYSSET_VNO_MAP.get("FACE_PARAM")!);
|
||||||
|
|
||||||
|
dConsole.log('FaceOpenStatue', openCheckFlag, this.FaceOpenStatue);
|
||||||
|
|
||||||
|
// 处理人脸识别状态
|
||||||
|
if (openCheckFlag === '1') {
|
||||||
|
const faceValue = faceParam?.v_value || '0';
|
||||||
|
this.FaceOpenStatue = faceValue === '3' ? '1' : '0';
|
||||||
|
this.faceFlag = faceValue;
|
||||||
|
|
||||||
|
if (faceValue === '1') {
|
||||||
|
this.openDeviceByIDCard();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// let a = await this.fileUtil.initFolder("/config/temptable")
|
|
||||||
// this.fileUtil.addFile("temp.log", JSON.stringify(syssetParams))
|
// 遍历处理系统参数
|
||||||
syssetParams.forEach(sys => {
|
syssetParams.forEach(sys => {
|
||||||
//364 绕车一周评判时机(1-开始考试后判 2-开始考试前判)
|
const vNo = sys.v_no;
|
||||||
if (sys.v_no === '364' && decodeURIComponent(sys.v_value || "") == '2') {
|
const vValue = decodeURIComponent(sys.v_value || '');
|
||||||
this.systemParam.Param364 = sys.v_value || ""
|
|
||||||
that.isBoardPrePareSetPopupOpen = true;
|
|
||||||
that.isFirstBoardPrePareSetPopupBtnShow = false
|
|
||||||
}
|
|
||||||
|
|
||||||
//398参数为1 第二场考试上车准备不考
|
switch (vNo) {
|
||||||
if (sys.v_no === '398' && decodeURIComponent(sys.v_value || "") == '1') {
|
case SYSSET_VNO_MAP.get("JUDGMENT_TIMING"):
|
||||||
that.systemParam.Param398 = decodeURIComponent(sys.v_value || "")
|
// 绕车一周评判时机
|
||||||
that.isSecondBoardPrePareSetPopupOpen = true;
|
if (vValue === '2') {
|
||||||
|
this.systemParam.Param364 = sys.v_value || '';
|
||||||
|
this.isBoardPrePareSetPopupOpen = true;
|
||||||
|
this.isFirstBoardPrePareSetPopupBtnShow = false;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SYSSET_VNO_MAP.get("SECOND_EXAM_PREPARE"):
|
||||||
|
// 第二场考试上车准备不考
|
||||||
|
if (vValue === '1') {
|
||||||
|
this.systemParam.Param398 = vValue;
|
||||||
|
this.isSecondBoardPrePareSetPopupOpen = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SYSSET_VNO_MAP.get("NO_ABSENT_FUNCTION"):
|
||||||
// 车上没有缺考功能
|
// 车上没有缺考功能
|
||||||
if (sys.v_no === '770') {
|
this.systemParam.Param770Str = sys.v_value || '';
|
||||||
that.systemParam.Param770Str = sys.v_value || "";
|
break;
|
||||||
}
|
|
||||||
|
case SYSSET_VNO_MAP.get("SEATBELT_DOOR"):
|
||||||
// 开始考试前必须解开安全带或关车门
|
// 开始考试前必须解开安全带或关车门
|
||||||
if (sys.v_no === '803') {
|
this.systemParam.Param803Str = sys.v_value + '';
|
||||||
that.systemParam.Param803Str = sys.v_value + '';
|
break;
|
||||||
}
|
|
||||||
//判断是否考生是否按顺序考试
|
|
||||||
if (sys.v_no === '341' && decodeURIComponent(sys.v_value || "") == '1') {
|
|
||||||
that.systemParam.Param341 = true
|
|
||||||
} else {
|
|
||||||
//todo
|
|
||||||
that.systemParam.Param341 = true
|
|
||||||
}
|
|
||||||
//开始考试触发方式
|
|
||||||
if (sys.v_no === '612') {
|
|
||||||
that.systemParam.Param612Str = decodeURIComponent(sys.v_value || "")
|
|
||||||
}
|
|
||||||
//车上考试过一次就不能缺考
|
|
||||||
if (sys.v_no === '352') {
|
|
||||||
that.systemParam.Param352Str = decodeURIComponent(sys.v_value || "")
|
|
||||||
}
|
|
||||||
//828考生待考界面,安全员显示考试员
|
|
||||||
if (sys.v_no === '828') {
|
|
||||||
that.systemParam.Param828Str = decodeURIComponent(sys.v_value || "")
|
|
||||||
if (that.systemParam.Param828Str == '1') {
|
|
||||||
that.labelBlocks[5].label = '安全员名'
|
|
||||||
} else {
|
|
||||||
that.labelBlocks[5].label = '考试员名'
|
|
||||||
}
|
|
||||||
that.labelBlocks = JSON.parse(JSON.stringify(this.labelBlocks))
|
|
||||||
|
|
||||||
}
|
case SYSSET_VNO_MAP.get("EXAM_ORDER"):
|
||||||
//视频保存天数
|
// 判断是否考生是否按顺序考试
|
||||||
if (sys.v_no === '305') {
|
this.systemParam.Param341 = vValue === '1';
|
||||||
that.systemParam.Param305Str = decodeURIComponent(sys.v_value || "")
|
break;
|
||||||
|
|
||||||
|
case SYSSET_VNO_MAP.get("EXAM_TRIGGER"):
|
||||||
|
// 开始考试触发方式
|
||||||
|
this.systemParam.Param612Str = vValue;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SYSSET_VNO_MAP.get("NO_ABSENT_AFTER_ONCE"):
|
||||||
|
// 车上考试过一次就不能缺考
|
||||||
|
this.systemParam.Param352Str = vValue;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SYSSET_VNO_MAP.get("EXAMINER_DISPLAY"):
|
||||||
|
// 考生待考界面,安全员显示考试员
|
||||||
|
this.systemParam.Param828Str = vValue;
|
||||||
|
this.labelBlocks[5].label = vValue === '1' ? '安全员名' : '考试员名';
|
||||||
|
// 使用 Array.from 创建新数组,避免使用扩展运算符
|
||||||
|
this.labelBlocks = Array.from(this.labelBlocks);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SYSSET_VNO_MAP.get("VIDEO_SAVE_DAYS"):
|
||||||
|
// 视频保存天数
|
||||||
|
this.systemParam.Param305Str = vValue;
|
||||||
if (!Number(this.systemParam.Param305Str)) {
|
if (!Number(this.systemParam.Param305Str)) {
|
||||||
that.systemParam.Param305Str = '2'
|
this.systemParam.Param305Str = '2';
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
|
// 处理考生刷新逻辑
|
||||||
|
const handleStudentRefresh = () => {
|
||||||
|
// 清除旧的定时器
|
||||||
|
if (this.interval) {
|
||||||
|
clearInterval(this.interval);
|
||||||
|
this.interval = -1;
|
||||||
|
}
|
||||||
|
|
||||||
//0不自动更新 1自动更新(不限次数) 2没有考生更新2次
|
// 如果列表为空,设置定时器
|
||||||
if (that.studentRefreshStatue == '2') {
|
if (this.list.length === 0) {
|
||||||
if (that.list.length == 0) {
|
switch (this.studentRefreshStatue) {
|
||||||
clearInterval(that.interval)
|
case REFRESH_STRATEGY_MAP.get("AUTO_TWICE"):
|
||||||
that.interval = setInterval(() => {
|
this.interval = setInterval(() => {
|
||||||
if (that.numCount < 3) {
|
if (this.numCount < 3) {
|
||||||
that.numCount++
|
this.numCount++;
|
||||||
if (that.list.length == 0) {
|
if (this.list.length === 0) {
|
||||||
that.getExaminationStudentInfoFn()
|
this.getExaminationStudentInfoFn();
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 5000)
|
|
||||||
} else {
|
|
||||||
that.getExaminationStudentInfoFn()
|
|
||||||
}
|
|
||||||
} else if (that.studentRefreshStatue == '1') {
|
|
||||||
if (that.list.length == 0) {
|
|
||||||
clearInterval(that.interval)
|
|
||||||
that.interval = setInterval(() => {
|
|
||||||
if (that.list.length == 0) {
|
|
||||||
that.getExaminationStudentInfoFn()
|
|
||||||
}
|
|
||||||
}, 5000)
|
|
||||||
} else {
|
|
||||||
that.getExaminationStudentInfoFn()
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// this.getExaminationItemFn()
|
clearInterval(this.interval);
|
||||||
|
this.interval = -1;
|
||||||
|
}
|
||||||
|
}, 5000);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case REFRESH_STRATEGY_MAP.get("AUTO_UNLIMITED"):
|
||||||
|
this.interval = setInterval(() => {
|
||||||
|
if (this.list.length === 0) {
|
||||||
|
this.getExaminationStudentInfoFn();
|
||||||
|
}
|
||||||
|
}, 5000);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 获取考生信息
|
||||||
|
this.getExaminationStudentInfoFn();
|
||||||
|
};
|
||||||
|
|
||||||
|
handleStudentRefresh();
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
dConsole.error('初始化系统设置失败:', error);
|
||||||
|
// 可以添加错误处理逻辑
|
||||||
}
|
}
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//人脸比对窗口关闭
|
//人脸比对窗口关闭
|
||||||
@ -632,7 +659,6 @@ struct UserInfoPage {
|
|||||||
this.isExamStart = false
|
this.isExamStart = false
|
||||||
this.startExam = false
|
this.startExam = false
|
||||||
this.updateTimeLimit = false
|
this.updateTimeLimit = false
|
||||||
// this.isBoardPrePareSetPopupOpen=true
|
|
||||||
this.isFirstBoardPrePareSetPopupBtnShow = false
|
this.isFirstBoardPrePareSetPopupBtnShow = false
|
||||||
dConsole.log('isFirstBoardPrePareSetPopupBtnShow', this.isFirstBoardPrePareSetPopupBtnShow,
|
dConsole.log('isFirstBoardPrePareSetPopupBtnShow', this.isFirstBoardPrePareSetPopupBtnShow,
|
||||||
this.isBoardPrePareSetPopupOpen)
|
this.isBoardPrePareSetPopupOpen)
|
||||||
@ -643,8 +669,12 @@ struct UserInfoPage {
|
|||||||
let md5Message: string = CryptoJS.MD5(this.carInfo.carId! +
|
let md5Message: string = CryptoJS.MD5(this.carInfo.carId! +
|
||||||
this.carInfo.examinationRoomId! +
|
this.carInfo.examinationRoomId! +
|
||||||
this.examinerLoginInfo.username!).toString();
|
this.examinerLoginInfo.username!).toString();
|
||||||
const param =
|
const param: ExaminationStuAbsentParams = {
|
||||||
`<getExaminationStudentInfoReq><head><checkCode>${md5Message}</checkCode></head><body><carId>${this.carInfo.carId}</carId><examinationRoomId>${this.carInfo.examinationRoomId}</examinationRoomId><examinerName>${this.examinerLoginInfo.username}</examinerName><sfzmhm></sfzmhm></body></getExaminationStudentInfoReq>`
|
md5Message: md5Message,
|
||||||
|
carId: this.carInfo.carId || "",
|
||||||
|
examinationRoomId: this.carInfo.examinationRoomId || "",
|
||||||
|
username: this.examinerLoginInfo.username || ""
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
getExaminationStudentInfo(param).then(async (res) => {
|
getExaminationStudentInfo(param).then(async (res) => {
|
||||||
dConsole.log("temp log ", JSON.stringify(res))
|
dConsole.log("temp log ", JSON.stringify(res))
|
||||||
@ -946,7 +976,7 @@ struct UserInfoPage {
|
|||||||
this.stepFlag = false
|
this.stepFlag = false
|
||||||
this.stopDeviceById()
|
this.stopDeviceById()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
dConsole.error(UserInfoTag, JSON.stringify(e))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user