首次提交
commit
26bb470495
|
|
@ -0,0 +1,15 @@
|
|||
/node_modules
|
||||
/oh_modules
|
||||
/local.properties
|
||||
/.idea
|
||||
**/build
|
||||
/.hvigor
|
||||
.cxx
|
||||
/.clangd
|
||||
/.clang-format
|
||||
/.clang-tidy
|
||||
**/.test
|
||||
/.appanalyzer
|
||||
/entry/.preview/
|
||||
/entry/build/
|
||||
/entry/oh_modules/
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"app": {
|
||||
"bundleName": "com.rs.rchl",
|
||||
"vendor": "example",
|
||||
"versionCode": 1002,
|
||||
"versionName": "1.0.2",
|
||||
"icon": "$media:ic_applogin",
|
||||
"label": "$string:app_name",
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "app_name",
|
||||
"value": "人车物核验"
|
||||
}
|
||||
]
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
|
|
@ -0,0 +1,55 @@
|
|||
{
|
||||
"app": {
|
||||
"signingConfigs": [
|
||||
{
|
||||
"name": "default",
|
||||
"type": "HarmonyOS",
|
||||
"material": {
|
||||
"storeFile": "D:/HuaweiKey/ruansee.p12",
|
||||
"storePassword": "00000019B0DB8FE574FD50A879BBF742834E5E7C42686D2544E206B2B9574BD89950A2BC085D9EB5DA",
|
||||
"keyAlias": "ruansee",
|
||||
"keyPassword": "00000019EB933EC3D92A04C62A54ED52F7E484900F0D627B11FFF05C3C1C1024D88A15D218823F5BF5",
|
||||
"signAlg": "SHA256withECDSA",
|
||||
"profile": "D:/HuaweiKey/rcwhy/ruanss_rcwhy_debugDebug.p7b",
|
||||
"certpath": "D:/HuaweiKey/rcwhy/ruansee_rcwhy_debug.cer"
|
||||
}
|
||||
}
|
||||
],
|
||||
"products": [
|
||||
{
|
||||
"name": "default",
|
||||
"signingConfig": "default",
|
||||
"compatibleSdkVersion": "5.0.1(13)",
|
||||
"runtimeOS": "HarmonyOS",
|
||||
"buildOption": {
|
||||
"strictMode": {
|
||||
"caseSensitiveCheck": true,
|
||||
"useNormalizedOHMUrl": true
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"buildModeSet": [
|
||||
{
|
||||
"name": "debug",
|
||||
},
|
||||
{
|
||||
"name": "release"
|
||||
}
|
||||
]
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
"name": "entry",
|
||||
"srcPath": "./entry",
|
||||
"targets": [
|
||||
{
|
||||
"name": "default",
|
||||
"applyToProducts": [
|
||||
"default"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"files": [
|
||||
"**/*.ets"
|
||||
],
|
||||
"ignore": [
|
||||
"**/src/ohosTest/**/*",
|
||||
"**/src/test/**/*",
|
||||
"**/src/mock/**/*",
|
||||
"**/node_modules/**/*",
|
||||
"**/oh_modules/**/*",
|
||||
"**/build/**/*",
|
||||
"**/.preview/**/*"
|
||||
],
|
||||
"ruleSet": [
|
||||
"plugin:@performance/recommended",
|
||||
"plugin:@typescript-eslint/recommended"
|
||||
],
|
||||
"rules": {
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
/node_modules
|
||||
/oh_modules
|
||||
/.preview
|
||||
/build
|
||||
/.cxx
|
||||
/.test
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"apiType": "stageMode",
|
||||
"buildOption": {
|
||||
},
|
||||
"buildOptionSet": [
|
||||
{
|
||||
"name": "release",
|
||||
"arkOptions": {
|
||||
"obfuscation": {
|
||||
"ruleOptions": {
|
||||
"enable": false,
|
||||
"files": [
|
||||
"./obfuscation-rules.txt"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
],
|
||||
"targets": [
|
||||
{
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"name": "ohosTest",
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
import { hapTasks } from '@ohos/hvigor-ohos-plugin';
|
||||
|
||||
export default {
|
||||
system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
|
||||
plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
|
||||
}
|
||||
Binary file not shown.
|
|
@ -0,0 +1,23 @@
|
|||
# Define project specific obfuscation rules here.
|
||||
# You can include the obfuscation configuration files in the current module's build-profile.json5.
|
||||
#
|
||||
# For more details, see
|
||||
# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
|
||||
|
||||
# Obfuscation options:
|
||||
# -disable-obfuscation: disable all obfuscations
|
||||
# -enable-property-obfuscation: obfuscate the property names
|
||||
# -enable-toplevel-obfuscation: obfuscate the names in the global scope
|
||||
# -compact: remove unnecessary blank spaces and all line feeds
|
||||
# -remove-log: remove all console.* statements
|
||||
# -print-namecache: print the name cache that contains the mapping from the old names to new names
|
||||
# -apply-namecache: reuse the given cache file
|
||||
|
||||
# Keep options:
|
||||
# -keep-property-name: specifies property names that you want to keep
|
||||
# -keep-global-name: specifies names that you want to keep in the global scope
|
||||
|
||||
-enable-property-obfuscation
|
||||
-enable-toplevel-obfuscation
|
||||
-enable-filename-obfuscation
|
||||
-enable-export-obfuscation
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"meta": {
|
||||
"stableOrder": true
|
||||
},
|
||||
"lockfileVersion": 3,
|
||||
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
|
||||
"specifiers": {
|
||||
"@kit/tdos@libs/tdos_sdk_js.har": "@kit/tdos@libs/tdos_sdk_js.har",
|
||||
"@pura/harmony-dialog@1.0.7": "@pura/harmony-dialog@1.1.8",
|
||||
"@pura/spinkit@^1.0.5": "@pura/spinkit@1.0.5"
|
||||
},
|
||||
"packages": {
|
||||
"@kit/tdos@libs/tdos_sdk_js.har": {
|
||||
"name": "@kit/tdos",
|
||||
"version": "5.0.1",
|
||||
"resolved": "libs/tdos_sdk_js.har",
|
||||
"registryType": "local"
|
||||
},
|
||||
"@pura/harmony-dialog@1.1.8": {
|
||||
"name": "@pura/harmony-dialog",
|
||||
"version": "1.1.8",
|
||||
"integrity": "sha512-IG2BJti8LBvJvkAD7yLwk6F2D66BGYPt6mae2yqAB9hMU5HnOTslWJbrReN9qPQl+ssIjSahMC7aJexEFYm5Dw==",
|
||||
"resolved": "https://repo.harmonyos.com/ohpm/@pura/harmony-dialog/-/harmony-dialog-1.1.8.har",
|
||||
"registryType": "ohpm",
|
||||
"dependencies": {
|
||||
"@pura/spinkit": "^1.0.5"
|
||||
}
|
||||
},
|
||||
"@pura/spinkit@1.0.5": {
|
||||
"name": "@pura/spinkit",
|
||||
"version": "1.0.5",
|
||||
"integrity": "sha512-EKG+yzbCj/owI5zUYukIZV+YMRbeS/Ymd281Dj5asCKQHTWoEUVGmow3HCo7rl2Bdh8yliIT/StxPokUf8a6bQ==",
|
||||
"resolved": "https://repo.harmonyos.com/ohpm/@pura/spinkit/-/spinkit-1.0.5.har",
|
||||
"registryType": "ohpm"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"name": "entry",
|
||||
"version": "1.0.0",
|
||||
"description": "Please describe the basic information.",
|
||||
"main": "",
|
||||
"author": "",
|
||||
"license": "",
|
||||
"dependencies": {
|
||||
"@pura/harmony-dialog": "1.0.7",
|
||||
"@kit/tdos": "file:libs/tdos_sdk_js.har"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,309 @@
|
|||
import { buffer, util } from "@kit.ArkTS";
|
||||
import { StringUtils } from "../util/StringUtils";
|
||||
import { geoLocationManager } from "@kit.LocationKit";
|
||||
import { UserInfoModel } from "../request/data/UserInfoModel";
|
||||
import { UserCache } from "./UserCache";
|
||||
import { getCoordinateDescription } from "../request/api/Api";
|
||||
import { AxiosError } from "@ohos/axios";
|
||||
import { IdGeneratedUtils } from "../util/IdGeneratedUtils";
|
||||
|
||||
export class AppCache {
|
||||
private static appCache: AppCache = new AppCache();
|
||||
private idGeneratedUtils :IdGeneratedUtils|undefined=undefined;
|
||||
|
||||
/*请求服务的Ip*/
|
||||
private ip: string | undefined = undefined
|
||||
/*请求服务的端口*/
|
||||
private port: string | undefined = undefined
|
||||
private serviceNodeName:string = "/yhc_out/"
|
||||
|
||||
//用于存放品高的Token
|
||||
private pgToken :string| undefined = undefined;
|
||||
|
||||
//权限状态
|
||||
private permissionsStatus: boolean = false;
|
||||
|
||||
/* TODO 临时人员ID 用于避免每次查询都直接改变peopleId,导致查询失败后,之前查询的人员信息和ID对不上 */
|
||||
private peopleTemporarilyId: string = ""
|
||||
/* TODO 人员ID 只有当查询成功时才将 tempPeopleId的值 赋给 peopleId */
|
||||
private peopleId: string = ""
|
||||
/*车辆ID*/
|
||||
private carId: string = ""
|
||||
/* TODO 主ID 由APP生成 传递给后端 */
|
||||
private historyId: string = ""
|
||||
/*物品ID*/
|
||||
// private goodsId:string =""
|
||||
|
||||
/*缓存的物品数据*/
|
||||
private goodsJson: string = ""
|
||||
//本机IP
|
||||
private localIp: string |undefined= "";
|
||||
|
||||
/*任务id*/
|
||||
private taskId: string|undefined = ""
|
||||
|
||||
private taskName:string|undefined = ""
|
||||
/*卡点id*/
|
||||
private cardPointId: string|undefined = ""
|
||||
private cardPointName :string|undefined= ""
|
||||
|
||||
//定位的坐标
|
||||
private locationX: number = 0.0;
|
||||
private locationY: number = 0.0;
|
||||
|
||||
//卡点的坐标
|
||||
private cardPointX: string = "0.0";
|
||||
private cardPointY: string = "0.0";
|
||||
|
||||
private locationAddress:string|undefined="";
|
||||
private cardPointAddress:string|undefined="";
|
||||
|
||||
private constructor() {
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
public static getAppCache(): AppCache {
|
||||
if (AppCache.appCache == null) {
|
||||
AppCache.appCache = new AppCache()
|
||||
}
|
||||
return AppCache.appCache;
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务节点
|
||||
* @param ip
|
||||
* @param port
|
||||
* @param serviceName
|
||||
*/
|
||||
public setIpOrPort(ip:string,port:string,serviceNodeName:string){
|
||||
this.ip = ip;
|
||||
this.port = port;
|
||||
this.serviceNodeName = serviceNodeName;
|
||||
}
|
||||
|
||||
public getServiceAddress(){
|
||||
return 'http://'+this.ip+":"+this.port+this.serviceNodeName
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取一个随机ID 生存规则 四位随机数 + 随机UUID+ 四位随机数
|
||||
* @returns
|
||||
*/
|
||||
public getRandomId(): string {
|
||||
if (this.idGeneratedUtils == undefined) {
|
||||
this.idGeneratedUtils = IdGeneratedUtils.getInstance(UserCache.getUserCache().getIdCardNum)
|
||||
}
|
||||
return this.idGeneratedUtils.generatedRandomID();
|
||||
// return (Math.round(1000) + 1000) + util.generateRandomUUID(false) + (Math.round(1000) + 1000)
|
||||
}
|
||||
|
||||
/**
|
||||
* 将临时人员ID设为ID
|
||||
* 在查询人员成功后调用
|
||||
*/
|
||||
public temporarilyPeopleIdEffect() {
|
||||
this.peopleId = this.peopleTemporarilyId
|
||||
this.peopleTemporarilyId = "";
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO 创建一个临时的人员ID,用于查询人员信息时传参,当查询人员成功后,再赋值给{ peopleId }
|
||||
*
|
||||
*/
|
||||
public createPeopleTemporarilyId() {
|
||||
this.peopleTemporarilyId = this.getRandomId();
|
||||
}
|
||||
|
||||
public getPeopleTemporarilyId(): string {
|
||||
if (StringUtils.isNullOrEmpty(this.peopleTemporarilyId)) {
|
||||
this.peopleTemporarilyId = this.getRandomId();
|
||||
}
|
||||
return this.peopleTemporarilyId;
|
||||
}
|
||||
|
||||
public getPeopleId(): string {
|
||||
if (StringUtils.isNullOrEmpty(this.peopleId)) {
|
||||
this.peopleId = this.getPeopleTemporarilyId();
|
||||
}
|
||||
return this.peopleId
|
||||
}
|
||||
|
||||
public getCarId(): string {
|
||||
if (StringUtils.isNullOrEmpty(this.carId)) {
|
||||
this.carId = this.getRandomId();
|
||||
}
|
||||
return this.carId;
|
||||
}
|
||||
|
||||
public getHistoryId(): string {
|
||||
if (StringUtils.isNullOrEmpty(this.historyId)) {
|
||||
this.historyId = this.getRandomId();
|
||||
}
|
||||
return this.historyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO 仅在初始化页面和提交或移交完成后调用
|
||||
* 重置ID
|
||||
*/
|
||||
public resetIds(){
|
||||
this.historyId = this.getRandomId();
|
||||
this.peopleId = this.getRandomId();
|
||||
this.carId = this.getRandomId();
|
||||
this.createPeopleTemporarilyId()
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交成功重置id Submitted successfully
|
||||
*/
|
||||
public submitSuccessResetIDs(){
|
||||
this.peopleId = ""
|
||||
this.peopleTemporarilyId = ""
|
||||
this.carId = ""
|
||||
this.historyId = ""
|
||||
this.peopleId = ""
|
||||
this.peopleId = ""
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 权限状态
|
||||
* @returns
|
||||
*/
|
||||
get getPermissionsStatus(): boolean {
|
||||
return this.permissionsStatus;
|
||||
}
|
||||
|
||||
set setPermissionsStatus(permissionsStatus: boolean) {
|
||||
this.permissionsStatus = permissionsStatus;
|
||||
}
|
||||
|
||||
public setLocation(location :geoLocationManager.Location){
|
||||
if (location == null) return
|
||||
this.locationX = location.longitude;
|
||||
this.locationY = location.latitude;
|
||||
}
|
||||
|
||||
public getLocationX():number{
|
||||
return this.locationX;
|
||||
}
|
||||
public getLocationY():number{
|
||||
return this.locationY;
|
||||
}
|
||||
|
||||
public setCardLocation(cardPointX:string,cardPointY:string,address:string){
|
||||
this.cardPointX = cardPointX;
|
||||
this.cardPointY = cardPointY;
|
||||
this.cardPointAddress = address;
|
||||
}
|
||||
|
||||
public getCardPointLocationX():string{
|
||||
return this.cardPointX;
|
||||
}
|
||||
public getCardPointLocationY():string{
|
||||
return this.cardPointY;
|
||||
}
|
||||
|
||||
public set setLocalIp(localIp :string|undefined){
|
||||
this.localIp = localIp;
|
||||
}
|
||||
|
||||
public get getLocalIp():string|undefined{
|
||||
return this.localIp;
|
||||
}
|
||||
|
||||
public get getPgToken():string|undefined{
|
||||
return this.pgToken
|
||||
}
|
||||
|
||||
public set setPgToken(pgToken:string){
|
||||
this.pgToken = pgToken;
|
||||
}
|
||||
|
||||
public get getTaskId(){
|
||||
if(StringUtils.isNullOrEmpty(this.taskId)){
|
||||
return "";
|
||||
}
|
||||
if (this.taskId != undefined){
|
||||
return this.taskId;
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
public set setTaskId(taskId:string|undefined){
|
||||
this.taskId = taskId;
|
||||
}
|
||||
|
||||
public get getTaskName():string{
|
||||
if(StringUtils.isNullOrEmpty(this.taskName)){
|
||||
return "";
|
||||
}
|
||||
if (this.taskName != undefined){
|
||||
return this.taskName;
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
public set setTaskName(taskName:string|undefined){
|
||||
this.taskName = taskName;
|
||||
}
|
||||
|
||||
public get getCardPointIdId(){
|
||||
if(StringUtils.isNullOrEmpty(this.cardPointId)){
|
||||
return "";
|
||||
}
|
||||
if (this.cardPointId != undefined){
|
||||
return this.cardPointId;
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
public set setCardPointId(cardPointId:string|undefined){
|
||||
this.cardPointId = cardPointId;
|
||||
}
|
||||
|
||||
public get getCardPointName():string{
|
||||
if(StringUtils.isNullOrEmpty(this.cardPointName)){
|
||||
return "";
|
||||
}
|
||||
if (this.cardPointName != undefined){
|
||||
return this.cardPointName;
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
public set setCardPointName(cardPointName:string|undefined){
|
||||
this.cardPointName = cardPointName;
|
||||
}
|
||||
|
||||
public get getLocationAddress():string{
|
||||
if(StringUtils.isNullOrEmpty(this.locationAddress)){
|
||||
return "";
|
||||
}
|
||||
if (this.locationAddress != undefined){
|
||||
return this.locationAddress;
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
public set setLocationAddress(locationAddress:string|undefined){
|
||||
this.locationAddress = locationAddress;
|
||||
}
|
||||
|
||||
public get getCardPointAddress():string{
|
||||
if(StringUtils.isNullOrEmpty(this.cardPointAddress)){
|
||||
return "";
|
||||
}
|
||||
if (this.cardPointAddress != undefined){
|
||||
return this.cardPointAddress;
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
convertPhotoUrl(photoUrl:string):string{
|
||||
if (StringUtils.isNullOrEmpty(photoUrl)) return""
|
||||
return photoUrl.replace("http://53.1.214.228:9000/ypc","http://20.90.2.2/rcwhy_image_out")
|
||||
.replace("http://53.1.227.17:9000/ypc","http://20.90.2.2/rcwhy_image_out")
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
|
||||
export default class AppConstants {
|
||||
|
||||
/**
|
||||
* Maximum width.
|
||||
*/
|
||||
static readonly PERCENTAGE_MAX: string = '100%';
|
||||
|
||||
/**
|
||||
* 品高的appID和secret
|
||||
*/
|
||||
static readonly PG_APP_KEY_SECRET='ksSt5bxNze8SBsPXGt6f:pkPaXjZCHTnzhZhMAhAn8YYbZ6r2H7'
|
||||
|
||||
/**
|
||||
* 盘查方式 - 输入
|
||||
*/
|
||||
static readonly CHECK_TYPE_INPUT = 0;
|
||||
/**
|
||||
* 盘查方式 - NFC读卡
|
||||
*/
|
||||
static readonly CHECK_TYPE_NFC = 1;
|
||||
/**
|
||||
* 盘查方式 - 人像识别
|
||||
*/
|
||||
static readonly CHECK_TYPE_FACE = 2;
|
||||
/**
|
||||
* 盘查方式 - 语音
|
||||
*/
|
||||
static readonly CHECK_TYPE_AUDIO = 3;
|
||||
/**
|
||||
* 盘查方式 - OCR识别
|
||||
*/
|
||||
static readonly CHECK_TYPE_OCR = 4;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
import { HashMap } from "@kit.ArkTS";
|
||||
|
||||
|
||||
// 定义联合类型(根据实际需求调整泛型参数)
|
||||
export type CustomUnionType =
|
||||
string | // 字符串类型
|
||||
Map<string, CustomUnionType> | // 键为string、值为number的Map
|
||||
Array<CustomUnionType>; // 元素为string的数组
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
import { JSONUtil } from "@pura/harmony-utils/src/main/ets/utils/JSONUtil";
|
||||
import { StrUtil } from "@pura/harmony-utils/src/main/ets/utils/StrUtil";
|
||||
import { CarData } from "../model/resultModel/CheckCarResultModel";
|
||||
|
||||
export class PCCacheData {
|
||||
public static pcCacheData: PCCacheData = new PCCacheData();
|
||||
/*盘查人员总数*/
|
||||
zcCount: number = 0;
|
||||
/*异常人员数*/
|
||||
yiCount: number = 0;
|
||||
/*物品数据*/
|
||||
wpCount: number = 0;
|
||||
/*现场照片url*/
|
||||
xczpUrl: string = "";
|
||||
/*现场照片Id*/
|
||||
xczpId: string = "";
|
||||
/*照片文件*/
|
||||
// photoFile: string = "";
|
||||
/*人员关注类型*/
|
||||
// focusType: number = 0;
|
||||
carJson: string = "";
|
||||
carPeopleTypeJson: string = "";
|
||||
goodsJson: string = "";
|
||||
/*是否有现场招片 1 :true 0 :false*/
|
||||
isXczp: boolean = false;
|
||||
/*已盘查的身份证集合 避免一次盘查 核查同一个人多次*/
|
||||
sfzhArray: Array<string> = new Array
|
||||
idCardPhoto: string | Resource = "";
|
||||
|
||||
private constructor() {
|
||||
|
||||
}
|
||||
|
||||
public addYcPeople() {
|
||||
this.yiCount++;
|
||||
}
|
||||
|
||||
public addZcPeople() {
|
||||
this.zcCount++;
|
||||
}
|
||||
|
||||
public get getYiCount(): number {
|
||||
return this.yiCount;
|
||||
}
|
||||
|
||||
public get getZcCount(): number {
|
||||
return this.zcCount;
|
||||
}
|
||||
|
||||
set setYcCount(ycCount: number) {
|
||||
this.yiCount = ycCount;
|
||||
}
|
||||
|
||||
set setZcCount(ZcCount: number) {
|
||||
this.zcCount = ZcCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否一盘查过该人员
|
||||
* @param idCard
|
||||
* @returns true表示已经盘查过
|
||||
*/
|
||||
public isCheck(idCard: string): boolean {
|
||||
let index = this.sfzhArray.indexOf(idCard);
|
||||
if (index > -1) {
|
||||
return true
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public saveQuerySfzh(idCard: string) {
|
||||
if (StrUtil.isNotEmpty(idCard)) {
|
||||
if (this.sfzhArray != null) {
|
||||
this.sfzhArray.push(idCard)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public clear() {
|
||||
this.sfzhArray = new Array;
|
||||
this.isXczp = false;
|
||||
this.zcCount = 0;
|
||||
this.yiCount = 0;
|
||||
this.wpCount = 0;
|
||||
this.carJson = "";
|
||||
this.goodsJson = ""
|
||||
this.carPeopleTypeJson = "";
|
||||
this.idCardPhoto = "";
|
||||
this.xczpUrl = "";
|
||||
this.xczpId = "";
|
||||
}
|
||||
|
||||
|
||||
public isCanExit(carHit: string): boolean {
|
||||
if (this.zcCount != 0) return false
|
||||
if (this.sfzhArray.length>0) return false
|
||||
if (StrUtil.isNotEmpty(this.carJson)&&JSONUtil.isJSONStr(this.carJson)) return false
|
||||
if (StrUtil.isNotEmpty(this.goodsJson)&&JSONUtil.isJSONStr(this.goodsJson)) return false
|
||||
if ("添加随行车辆" != carHit) return false
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
import { AbilityConstant, AbilityStage, Configuration, Want } from "@kit.AbilityKit";
|
||||
import { StringUtils } from "../util/StringUtils";
|
||||
import { hilog } from "@kit.PerformanceAnalysisKit";
|
||||
import { AppCache } from "./AppCache";
|
||||
import { UserCache } from "./UserCache";
|
||||
import { tdvision } from '@kit.TdosVisionkit'
|
||||
|
||||
export class RuanseeAbitityStag extends AbilityStage{
|
||||
|
||||
public static appCache:AppCache;
|
||||
public static userCache:UserCache;
|
||||
|
||||
onCreate(): void {
|
||||
hilog.info(0x0000, 'RuanseeAbitityStag', '%{public}s', 'AbilityStage onCreate()');
|
||||
RuanseeAbitityStag.appCache = AppCache.getAppCache();
|
||||
RuanseeAbitityStag.appCache.setIpOrPort('20.90.2.2', '80', "/ypc_test_out/")
|
||||
RuanseeAbitityStag.userCache = UserCache.getUserCache();
|
||||
tdvision.setup()
|
||||
}
|
||||
|
||||
onAcceptWant(want: Want): string {
|
||||
hilog.info(0x0000, 'RuanseeAbitityStag', '%{public}s', 'AbilityStage onAcceptWant()');
|
||||
return StringUtils.get(want.abilityName,"");
|
||||
}
|
||||
|
||||
onNewProcessRequest(want: Want): string {
|
||||
hilog.info(0x0000, 'RuanseeAbitityStag', '%{public}s', 'AbilityStage onNewProcessRequest()');
|
||||
return StringUtils.get(want.abilityName,"");
|
||||
}
|
||||
|
||||
onMemoryLevel(level: AbilityConstant.MemoryLevel): void {
|
||||
hilog.info(0x0000, 'RuanseeAbitityStag', '%{public}s', 'AbilityStage onMemoryLevel()');
|
||||
|
||||
}
|
||||
|
||||
onConfigurationUpdate(newConfig: Configuration): void {
|
||||
hilog.info(0x0000, 'RuanseeAbitityStag', '%{public}s', 'AbilityStage onConfigurationUpdate()');
|
||||
|
||||
}
|
||||
/**
|
||||
* 转换图片IP和端口
|
||||
*
|
||||
* @return http://ip:端口
|
||||
*/
|
||||
public static convertPhotoUrl( photoUrl:string) :string{
|
||||
if (StringUtils.isNullOrEmpty(photoUrl)) return "";
|
||||
return photoUrl.replace("http://53.1.214.228:9000/ypc","http://20.90.2.2/rcwhy_image_out")
|
||||
.replace("http://53.1.227.17:9000/ypc","http://20.90.2.2/rcwhy_image_out");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
import { StringUtils } from "../util/StringUtils";
|
||||
import { preferences } from '@kit.ArkData';
|
||||
import { UserInfoModel } from "../request/data/UserInfoModel";
|
||||
import { AppCache } from "./AppCache";
|
||||
import { buffer, util } from "@kit.ArkTS";
|
||||
|
||||
const preferencesName = "CacheNae";
|
||||
|
||||
export class UserCache {
|
||||
public static userCache: UserCache = new UserCache();
|
||||
private userName: string = "";
|
||||
private userCode: string = "";
|
||||
private deptName: string = "";
|
||||
private deptCode: string = "";
|
||||
private idCardNum: string = "";
|
||||
private phoneNum: string = "";
|
||||
private userInfo: string = "";
|
||||
private authToken: string = ""
|
||||
private profilePhoto: string = "";
|
||||
|
||||
private constructor() {
|
||||
}
|
||||
|
||||
public static getUserCache(): UserCache {
|
||||
if (UserCache.userCache == null) {
|
||||
UserCache.userCache = new UserCache();
|
||||
}
|
||||
return UserCache.userCache;
|
||||
}
|
||||
|
||||
|
||||
get getUserName(): string {
|
||||
return this.userName;
|
||||
}
|
||||
|
||||
set setUserName(userName:string){
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
get getUserCode(): string {
|
||||
return this.userCode;
|
||||
}
|
||||
|
||||
set setUserCode(userCode:string){
|
||||
this.userCode = userCode;
|
||||
}
|
||||
|
||||
get getDeptName(): string {
|
||||
return this.deptName;
|
||||
}
|
||||
|
||||
set setDeptName(deptName:string){
|
||||
this.deptName = deptName;
|
||||
}
|
||||
|
||||
get getDeptCode(): string {
|
||||
return this.deptCode;
|
||||
}
|
||||
|
||||
set setDeptCode(deptCode:string){
|
||||
this.deptCode = deptCode;
|
||||
}
|
||||
|
||||
get getPhoneNum(): string {
|
||||
return this.phoneNum;
|
||||
}
|
||||
|
||||
set setPhoneNum(phoneNum:string){
|
||||
this.phoneNum = phoneNum;
|
||||
}
|
||||
|
||||
get getIdCardNum(): string {
|
||||
return this.idCardNum;
|
||||
}
|
||||
|
||||
set setIdCardNum(idCardNum:string){
|
||||
this.idCardNum = idCardNum;
|
||||
}
|
||||
|
||||
public getUserInfo():string{
|
||||
if (StringUtils.isNullOrEmpty(this.userInfo)) {
|
||||
let cs: UserInfoModel = {
|
||||
"userName":UserCache.getUserCache().getUserCode ,
|
||||
"realName": UserCache.getUserCache().getUserName,
|
||||
"orgName":UserCache.getUserCache().getDeptName,
|
||||
"orgCode": UserCache.getUserCache().getDeptCode,
|
||||
"idCardNum": UserCache.getUserCache().getIdCardNum,
|
||||
"ip":AppCache.getAppCache().getLocalIp||"10.115.101.1"
|
||||
}
|
||||
let userInfo = JSON.stringify(cs)
|
||||
let byte = new Uint8Array(buffer.from(userInfo, 'utf-8').buffer);
|
||||
this.userInfo = new util.Base64Helper().encodeToStringSync(byte);
|
||||
}
|
||||
return this.userInfo
|
||||
}
|
||||
|
||||
public set setUserInfo(userInfo:string){
|
||||
this.userInfo = userInfo;
|
||||
}
|
||||
|
||||
|
||||
get getAuthToken(): string {
|
||||
return this.authToken;
|
||||
}
|
||||
|
||||
set setAuthToken(authToken:string){
|
||||
this.authToken = authToken;
|
||||
}
|
||||
|
||||
get getProfilePhoto(): string {
|
||||
return this.profilePhoto;
|
||||
}
|
||||
|
||||
set setProfilePhoto(profilePhoto:string){
|
||||
this.profilePhoto = profilePhoto;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
|
||||
export interface ResultCallBack<T> {
|
||||
|
||||
onResult:(model?: T)=> void;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,146 @@
|
|||
import { abilityAccessCtrl, AbilityConstant, bundleManager, Permissions, UIAbility, Want,common } from '@kit.AbilityKit';
|
||||
import { hilog } from '@kit.PerformanceAnalysisKit';
|
||||
import { router, window } from '@kit.ArkUI';
|
||||
import { UserCache } from '../app/UserCache';
|
||||
import { AppCache } from '../app/AppCache';
|
||||
import { ToastUtils } from '../util/ToasUtils';
|
||||
import { AppUtil } from '@pura/harmony-utils';
|
||||
import { DialogHelper } from '@pura/harmony-dialog';
|
||||
import { DBUtils } from '../model/db/DBUtils';
|
||||
import { FileUtils } from '../util/FileUtils';
|
||||
|
||||
export default class EntryAbility extends UIAbility {
|
||||
|
||||
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
|
||||
AppUtil.init(this.context);
|
||||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
|
||||
UserCache.getUserCache()
|
||||
//初始化数据库
|
||||
DBUtils.getInstance().HOInit(this.context)
|
||||
FileUtils.init(this.context)
|
||||
this.applyForPermission()
|
||||
// 在Ability中监听事件
|
||||
this.context.eventHub.on('ui_event', (data:Array<Permissions>) => {
|
||||
// console.log('Received UI event:', data);
|
||||
if (data!=null) {
|
||||
this.requestPermissionsFromUser(data)
|
||||
}
|
||||
});
|
||||
|
||||
//简单初始化(1.0.8版本及以后)
|
||||
//必须在UIAbility的onCreate方法里初始化context。
|
||||
DialogHelper.setDefaultConfig((config) => {
|
||||
config.uiAbilityContext = this.context;
|
||||
})
|
||||
}
|
||||
|
||||
checkPermissionGrant(permissionArray: Array<Permissions>) {
|
||||
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager()
|
||||
// 获取应用程序的accessTokenID
|
||||
let bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION)
|
||||
let appInfo: bundleManager.ApplicationInfo = bundleInfo.appInfo
|
||||
let tokenId: number = appInfo.accessTokenId
|
||||
let wsqPermissionArray = new Array<Permissions>()
|
||||
for (let i = 0; i < permissionArray.length; i++) {
|
||||
let grantStatus = atManager.checkAccessTokenSync(tokenId, permissionArray[i])
|
||||
if (grantStatus == abilityAccessCtrl.GrantStatus.PERMISSION_DENIED) {
|
||||
wsqPermissionArray.push(permissionArray[i])
|
||||
}
|
||||
}
|
||||
if (wsqPermissionArray.length>0) {
|
||||
//有未申请的权限
|
||||
this.requestPermissionsFromUser(wsqPermissionArray)
|
||||
} else {
|
||||
//权限全部申请
|
||||
AppCache.getAppCache().setPermissionsStatus = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*AUTHOR:AbnerMing
|
||||
*INTRODUCE:向用户获取权限授权
|
||||
*/
|
||||
requestPermissionsFromUser(permissions: Array<Permissions>) {
|
||||
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager()
|
||||
let uiContext :common.UIAbilityContext = this.context as common.UIAbilityContext;
|
||||
atManager.requestPermissionsFromUser(uiContext, permissions)
|
||||
.then((data) => {
|
||||
let grantStatus: Array<number> = data.authResults;
|
||||
let length: number = grantStatus.length;
|
||||
for (let i = 0; i < length; i++) {
|
||||
if (grantStatus[i] === 0) {
|
||||
// 用户授权,可以继续访问目标操作
|
||||
console.log("===用户授权")
|
||||
router.replaceUrl({ url: 'ui/pages/MainPages' });
|
||||
} else {
|
||||
// 用户拒绝授权,提示用户必须授权才能访问当前页面的功能,并引导用户到系统设置中打开相应的权限
|
||||
ToastUtils.toastCenter("您拒绝了权限,请到设置里打开!")
|
||||
console.log("===用户拒绝了授权")
|
||||
return
|
||||
}
|
||||
}
|
||||
console.log("===权限授权成功")
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
*AUTHOR:AbnerMing
|
||||
*INTRODUCE:校验应用是否被授予权限
|
||||
*/
|
||||
private getGrantStatus(permissionName: Permissions): abilityAccessCtrl.GrantStatus {
|
||||
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager()
|
||||
// 获取应用程序的accessTokenID
|
||||
let bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION)
|
||||
let appInfo: bundleManager.ApplicationInfo = bundleInfo.appInfo
|
||||
let tokenId: number = appInfo.accessTokenId
|
||||
//检查权限状态
|
||||
let grantStatus = atManager.checkAccessTokenSync(tokenId, permissionName)
|
||||
return grantStatus
|
||||
}
|
||||
|
||||
//申请权限
|
||||
applyForPermission() {
|
||||
let permissions = new Array<Permissions>();
|
||||
permissions.push('ohos.permission.LOCATION')
|
||||
permissions.push('ohos.permission.APPROXIMATELY_LOCATION')
|
||||
permissions.push('ohos.permission.MICROPHONE')
|
||||
permissions.push('ohos.permission.CAMERA')
|
||||
this.checkPermissionGrant(permissions)
|
||||
}
|
||||
|
||||
onDestroy(): void {
|
||||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
|
||||
}
|
||||
|
||||
onWindowStageCreate(windowStage: window.WindowStage): void {
|
||||
// Main window is created, set main page for this ability 600782 3675
|
||||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
|
||||
windowStage.getMainWindow().then((window=>{
|
||||
window.setWindowLayoutFullScreen(true)
|
||||
}))
|
||||
windowStage.loadContent('ui/pages/Index', (err) => {
|
||||
if (err.code) {
|
||||
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
|
||||
return;
|
||||
}
|
||||
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
|
||||
});
|
||||
}
|
||||
|
||||
onWindowStageDestroy(): void {
|
||||
// Main window is destroyed, release UI related resources
|
||||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
|
||||
}
|
||||
|
||||
onForeground(): void {
|
||||
// Ability has brought to foreground
|
||||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
|
||||
}
|
||||
|
||||
onBackground(): void {
|
||||
// Ability has back to background
|
||||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
import { hilog } from '@kit.PerformanceAnalysisKit';
|
||||
import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
|
||||
|
||||
export default class EntryBackupAbility extends BackupExtensionAbility {
|
||||
async onBackup() {
|
||||
hilog.info(0x0000, 'testTag', 'onBackup ok');
|
||||
}
|
||||
|
||||
async onRestore(bundleVersion: BundleVersion) {
|
||||
hilog.info(0x0000, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
import {audio} from '@kit.AudioKit';
|
||||
import { hilog } from '@kit.PerformanceAnalysisKit';
|
||||
|
||||
const TAG = 'AudioCapturer';
|
||||
|
||||
/**
|
||||
* Audio collector tool
|
||||
*/
|
||||
export default class AudioCapturer {
|
||||
/**
|
||||
* Collector object
|
||||
*/
|
||||
private mAudioCapturer = null;
|
||||
|
||||
/**
|
||||
* Audio Data Callback Method
|
||||
*/
|
||||
private mDataCallBack: (data: ArrayBuffer) => void = null;
|
||||
|
||||
/**
|
||||
* Indicates whether recording data can be obtained.
|
||||
*/
|
||||
private mCanWrite: boolean = true;
|
||||
|
||||
/**
|
||||
* Audio stream information
|
||||
*/
|
||||
private audioStreamInfo = {
|
||||
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_16000,
|
||||
channels: audio.AudioChannel.CHANNEL_1,
|
||||
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
|
||||
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
|
||||
}
|
||||
|
||||
/**
|
||||
* Audio collector information
|
||||
*/
|
||||
private audioCapturerInfo = {
|
||||
source: audio.SourceType.SOURCE_TYPE_MIC,
|
||||
capturerFlags: 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Audio Collector Option Information
|
||||
*/
|
||||
private audioCapturerOptions = {
|
||||
streamInfo: this.audioStreamInfo,
|
||||
capturerInfo: this.audioCapturerInfo
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize
|
||||
* @param audioListener
|
||||
*/
|
||||
public async init(dataCallBack: (data: ArrayBuffer) => void) {
|
||||
if (null != this.mAudioCapturer) {
|
||||
hilog.error(0x0000, TAG, 'AudioCapturerUtil already init');
|
||||
return;
|
||||
}
|
||||
this.mDataCallBack = dataCallBack;
|
||||
this.mAudioCapturer = await audio.createAudioCapturer(this.audioCapturerOptions).catch(error => {
|
||||
hilog.error(0x0000, TAG, `AudioCapturerUtil init createAudioCapturer failed, code is ${error.code}, message is ${error.message}`);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* start recording
|
||||
*/
|
||||
public async start() {
|
||||
hilog.error(0x0000, TAG, `AudioCapturerUtil start`);
|
||||
let stateGroup = [audio.AudioState.STATE_PREPARED, audio.AudioState.STATE_PAUSED, audio.AudioState.STATE_STOPPED];
|
||||
if (stateGroup.indexOf(this.mAudioCapturer.state) === -1) {
|
||||
hilog.error(0x0000, TAG, `AudioCapturerUtil start failed`);
|
||||
return;
|
||||
}
|
||||
this.mCanWrite = true;
|
||||
await this.mAudioCapturer.start();
|
||||
while (this.mCanWrite) {
|
||||
let bufferSize = await this.mAudioCapturer.getBufferSize();
|
||||
let buffer = await this.mAudioCapturer.read(bufferSize, true);
|
||||
this.mDataCallBack(buffer)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* stop recording
|
||||
*/
|
||||
public async stop() {
|
||||
if (this.mAudioCapturer.state !== audio.AudioState.STATE_RUNNING && this.mAudioCapturer.state !== audio.AudioState.STATE_PAUSED) {
|
||||
hilog.error(0x0000, TAG, `AudioCapturerUtil stop Capturer is not running or paused`);
|
||||
return;
|
||||
}
|
||||
this.mCanWrite = false;
|
||||
await this.mAudioCapturer.stop();
|
||||
if (this.mAudioCapturer.state === audio.AudioState.STATE_STOPPED) {
|
||||
hilog.info(0x0000, TAG, `AudioCapturerUtil Capturer stopped`);
|
||||
} else {
|
||||
hilog.error(0x0000, TAG, `Capturer stop failed`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* release
|
||||
*/
|
||||
public async release() {
|
||||
if (this.mAudioCapturer.state === audio.AudioState.STATE_RELEASED || this.mAudioCapturer.state === audio.AudioState.STATE_NEW) {
|
||||
hilog.error(0x0000, TAG, `Capturer already released`);
|
||||
return;
|
||||
}
|
||||
await this.mAudioCapturer.release();
|
||||
this.mAudioCapturer = null;
|
||||
if (this.mAudioCapturer.state == audio.AudioState.STATE_RELEASED) {
|
||||
hilog.info(0x0000, TAG, `Capturer released`);
|
||||
} else {
|
||||
hilog.error(0x0000, TAG, `Capturer release failed`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
import { EventParamsBaseType, IEventSender, Rdb, RdbDao, RdbDatabase } from "rdbstore"
|
||||
import { relationalStore } from "@kit.ArkData";
|
||||
import { DeptTableEntity } from "./TableEntity";
|
||||
|
||||
export class DBUtils {
|
||||
private static dbUtils: DBUtils = new DBUtils()
|
||||
private static dbVersion = 1;
|
||||
private static dbName = 'rcwhy.db';
|
||||
private static database: RdbDatabase;
|
||||
private static deptDao: RdbDao<DeptTableEntity>
|
||||
|
||||
private constructor() {
|
||||
|
||||
}
|
||||
|
||||
static getInstance(): DBUtils {
|
||||
if (!DBUtils.dbUtils) {
|
||||
DBUtils.dbUtils = new DBUtils();
|
||||
}
|
||||
return DBUtils.dbUtils;
|
||||
}
|
||||
|
||||
getDatabase():RdbDatabase{
|
||||
return DBUtils.database;
|
||||
}
|
||||
|
||||
async getDeptDao(): Promise<RdbDao<DeptTableEntity>> {
|
||||
if (!DBUtils.deptDao) {
|
||||
DBUtils.deptDao = await DBUtils.database.getDao(DeptTableEntity)
|
||||
}
|
||||
return DBUtils.deptDao;
|
||||
}
|
||||
|
||||
|
||||
//TODO 该方法请在 UIAbility onCreate 方法中初始化
|
||||
async HOInit(context: Context) {
|
||||
DBUtils.database = Rdb.databaseBuilder(context, {
|
||||
version: DBUtils.dbVersion,
|
||||
dbName: DBUtils.dbName,
|
||||
entities: [DeptTableEntity],
|
||||
migrations: [],
|
||||
encrypt: false,
|
||||
securityLevel: relationalStore.SecurityLevel.S1,
|
||||
autoMigrate: true
|
||||
})// .setLogger(new DBLog())
|
||||
.setEvent(new EventSender())
|
||||
.build()
|
||||
await DBUtils.database.initTask
|
||||
DBUtils.database.getDao(DeptTableEntity).then((res) => {
|
||||
DBUtils.deptDao = res;
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
export class EventSender implements IEventSender {
|
||||
send(key: string, params: Record<string, EventParamsBaseType>): void {
|
||||
console.log(`rdbStore key: ${key}, params: ${JSON.stringify(params)}`)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
import { Columns, ColumnType, Entity } from "rdbstore";
|
||||
|
||||
@Entity({
|
||||
tableName: 'deptTable'
|
||||
// index: [{ name: 'idIndex', columnName: ['age', 'id'] },
|
||||
// { name: 'idIndex2', columnName: ['id'], unique: true }]
|
||||
})
|
||||
export class DeptTableEntity {
|
||||
|
||||
@Columns({
|
||||
name: 'deptId',
|
||||
type: ColumnType.TEXT,
|
||||
isPrimaryKey: true,
|
||||
})
|
||||
deptId: string | null = null;
|
||||
@Columns({ name: 'deptName', type: ColumnType.TEXT })
|
||||
deptName: string | null = null
|
||||
@Columns({ name: 'parentId', type: ColumnType.TEXT })
|
||||
parentId: string | null = null
|
||||
@Columns({ name: 'updateTime', type: ColumnType.TEXT })
|
||||
updateTime: string | null = null
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,175 @@
|
|||
|
||||
/**
|
||||
* 盘查相关请求数据模型
|
||||
*/
|
||||
|
||||
/*盘查人员请求模型*/
|
||||
export class CheckPersonRequestModel{
|
||||
//人员json数据
|
||||
data?:string;
|
||||
personId?:string;
|
||||
historyId?:string;
|
||||
sfz?:string;
|
||||
checkAddress?:string;
|
||||
pointX?:string;
|
||||
pointY?:string;
|
||||
policeXm?:string;
|
||||
policeId?:string;
|
||||
policeIdCard?:string;
|
||||
policePhone?:string;
|
||||
policeZzjgCode?:string;
|
||||
policeZzjgMc?:string;
|
||||
checkType?:string;
|
||||
}
|
||||
|
||||
export interface RequestCheckPersonCount{
|
||||
sfz:string;
|
||||
}
|
||||
|
||||
export interface UploadFile{
|
||||
contentType:string;
|
||||
filename:string
|
||||
}
|
||||
|
||||
export interface UpdatePersonFocusModel{
|
||||
focusType:string
|
||||
peopleIdCardNum:string
|
||||
policeIdCardNum:string
|
||||
|
||||
}
|
||||
|
||||
export interface UpdateCarFocusModel{
|
||||
focusType:number
|
||||
cjh:string
|
||||
policeIdCardNum: string
|
||||
}
|
||||
|
||||
export interface GetFocusListModel{
|
||||
pageNum:string
|
||||
pageSize:string
|
||||
policeIdCardNum:string
|
||||
}
|
||||
|
||||
|
||||
/*盘查车辆请求模型*/
|
||||
export class CheckCarRequestModel{
|
||||
carNum?:string
|
||||
policeId?:string
|
||||
policeIdCard?:string
|
||||
policeXm?:string
|
||||
policeZzjgCode?:string
|
||||
policeZzjgMc?:string
|
||||
}
|
||||
|
||||
export interface SaveCarDataRequestModel{
|
||||
uuid:string
|
||||
historyId:string
|
||||
policeId:string
|
||||
policeXm:string
|
||||
policeIdCard:string
|
||||
policePhone:string
|
||||
policeZzjgCode:string
|
||||
policeZzjgMc:string
|
||||
pointX:string
|
||||
pointY:string
|
||||
checkAddress:string
|
||||
jdchphm:string
|
||||
clxh:string
|
||||
jdcfdjh:string
|
||||
jdccsys:string
|
||||
jdchpzl:string
|
||||
clsbdh:string
|
||||
jdcsyr:string
|
||||
clpp:string
|
||||
sfzh:string
|
||||
syrstatus:string
|
||||
bdqzt:string
|
||||
checkType:string
|
||||
checkTime:string
|
||||
|
||||
}
|
||||
|
||||
export interface QueryCarCountRequestModel{
|
||||
carNum:string
|
||||
clsbdh:string
|
||||
|
||||
}
|
||||
|
||||
export interface GetPersonListModel{
|
||||
mainId:string,
|
||||
pageNum:number,
|
||||
pageSize:number
|
||||
}
|
||||
|
||||
/**
|
||||
* 实体
|
||||
*/
|
||||
export class CheckSubmitEntity{
|
||||
remark?:string
|
||||
peopleCount?:string
|
||||
unusualPeopleCount?:string
|
||||
carCount?:string
|
||||
unusualCarCount?:string
|
||||
goodsCount?:string
|
||||
type?:string
|
||||
checkReason?:string
|
||||
checkAddress?:string
|
||||
pointX?:string
|
||||
pointY?:string
|
||||
taskId?:string
|
||||
kkid?:string
|
||||
mainId?:string
|
||||
checkTime?:string
|
||||
status?:string
|
||||
groupId?:string
|
||||
yjdw?:string
|
||||
yjdwmc?:string
|
||||
userName?:string
|
||||
idCard?:string
|
||||
deptId?:string
|
||||
deptName?:string
|
||||
orgCode?:string
|
||||
orgName?:string
|
||||
policeName?:string
|
||||
policeIdCard?:string
|
||||
policeNum?:string
|
||||
|
||||
}
|
||||
|
||||
export class CheckSubmitModel{
|
||||
checkHistoryEntity?:CheckSubmitEntity
|
||||
personIds?:Array<string>
|
||||
carIds?:Array<string>
|
||||
}
|
||||
|
||||
export interface RequestTaskModel{
|
||||
nowTime:string
|
||||
orgCode:string
|
||||
taskName:string
|
||||
pageNum:string
|
||||
pageSize:string
|
||||
}
|
||||
|
||||
export interface QueryCardPointModel{
|
||||
taskId:string
|
||||
orgCode:string
|
||||
|
||||
}
|
||||
|
||||
export interface QueryCardFocusModel{
|
||||
cjh:string
|
||||
policeIdCardNum:string
|
||||
}
|
||||
|
||||
export interface RequestCheckPeopleRecordModel{
|
||||
idCardNum:string;
|
||||
pageNum:number;
|
||||
pageSize:string;
|
||||
}
|
||||
|
||||
export interface RequestCheckCarRecordModel{
|
||||
carNum:string;
|
||||
clsbdh:string;
|
||||
pageNum:number;
|
||||
pageSize:string;
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
|
||||
|
||||
export class GetLocationAddress{
|
||||
|
||||
x:string=""
|
||||
y:string=""
|
||||
fromIndex:string=""
|
||||
toIndex:string=""
|
||||
maxReturn:string=""
|
||||
geoDecodingRadius:string=""
|
||||
|
||||
}
|
||||
|
||||
export class LocationDescription{
|
||||
score?:number;
|
||||
address?:string
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
export class GetStatisticsModel {
|
||||
sfz?: string
|
||||
beginTime?: string
|
||||
endTime?: string
|
||||
}
|
||||
|
||||
export interface GetDeptChile {
|
||||
deptId: string,
|
||||
updateTime: string,
|
||||
}
|
||||
|
||||
|
||||
export interface QueryMainHistoryRecordModel {
|
||||
|
||||
policeIdCard: string
|
||||
type: number //0 - 巡逻盘查记录 1 卡点核录记录
|
||||
pageNum: number
|
||||
pageSize: string
|
||||
taskId: string
|
||||
startTime: String
|
||||
beginTime: String
|
||||
endTime: String
|
||||
sfz:string
|
||||
}
|
||||
|
||||
export interface QueryCarRecordByMainModel{
|
||||
historyId:string
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
|
||||
|
||||
export class BaseResultModel<T>{
|
||||
msg?: string;
|
||||
code?: number;
|
||||
total?:number = 0;
|
||||
data?:T;
|
||||
rows?:T;
|
||||
}
|
||||
|
||||
export class PageModel<T>{
|
||||
|
||||
total:number = 0;
|
||||
rows?:Array<T>
|
||||
}
|
||||
|
|
@ -0,0 +1,211 @@
|
|||
import { ArrayList } from "@kit.ArkTS";
|
||||
import { StringUtils } from "../../util/StringUtils";
|
||||
import { ZdlxItem } from "../../model/resultModel/CheckPeopleResultModel";
|
||||
|
||||
|
||||
|
||||
export class CarHpzlType{
|
||||
cacheMap:Map<string,string> = new Map<string,string>();
|
||||
|
||||
constructor() {
|
||||
this.cacheMap.set("01","大型汽车")
|
||||
this.cacheMap.set("02","小型汽车")
|
||||
this.cacheMap.set("03","摩托")
|
||||
this.cacheMap.set("04","摩托")
|
||||
this.cacheMap.set("05","临时行驶车")
|
||||
this.cacheMap.set("99","其他")
|
||||
}
|
||||
|
||||
getValue(key:string):string{
|
||||
return StringUtils.get(this.cacheMap.get(key),"");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export const CAR_HPZL_TYPE :CarHpzlType= new CarHpzlType();
|
||||
|
||||
export interface CheckCarResultModes{
|
||||
stealList:CarAbnormal[]
|
||||
list:CarData[]
|
||||
//临控车辆
|
||||
localCar:string
|
||||
isProvinceSteal:boolean
|
||||
newLkCar:CarTypeOV[]
|
||||
}
|
||||
|
||||
export interface CarAbnormal{
|
||||
jdcfdjh:string
|
||||
clsbdh:string
|
||||
}
|
||||
|
||||
@Observed
|
||||
export class CarData{
|
||||
isSelect:boolean = false
|
||||
|
||||
id:string = ""
|
||||
csys:string=""
|
||||
clsbdh:string=""
|
||||
jdczt:string=""
|
||||
type:number=0
|
||||
syzzjzl:string=""
|
||||
clpp:string=""
|
||||
jdcsyr:string=""
|
||||
sfzh:string=""
|
||||
hpzl:string=""
|
||||
clxh:string=""
|
||||
hphm:string=""
|
||||
fdjh:string=""
|
||||
xczp:string=""
|
||||
xczpId:string=""
|
||||
status:string=""; //盘查结果
|
||||
|
||||
isSteal:boolean=false
|
||||
zdlxBeanList:Array<ZdlxItem>|undefined =undefined
|
||||
|
||||
addZdlxBean(zdlx:ZdlxItem){
|
||||
if (this.zdlxBeanList==null||this.zdlxBeanList == undefined) {
|
||||
this.zdlxBeanList = new Array<ZdlxItem>();
|
||||
}
|
||||
this.zdlxBeanList.push(zdlx)
|
||||
}
|
||||
}
|
||||
|
||||
export class ZdlxBean{
|
||||
zdlx:string="正常人员"
|
||||
//1 正常 2 黄色 3 红色
|
||||
styleType:number = 1
|
||||
|
||||
sqyy?:string
|
||||
czcs?:string
|
||||
jzrq?:string
|
||||
lxdh?:string
|
||||
lxmj?:string
|
||||
lxmjQQ?:string
|
||||
remark?:string
|
||||
xyrPhone?:string
|
||||
peopleType?:string
|
||||
isClickPopup:boolean = false
|
||||
isShow:boolean = false
|
||||
zdsxList?:ArrayList<ZdlxSxItem>
|
||||
|
||||
constructor(zdlx: string, styleType: number) {
|
||||
this.zdlx = zdlx;
|
||||
this.styleType = styleType;
|
||||
}
|
||||
|
||||
addKeyOrValue(key:string,value:string){
|
||||
if (this.zdsxList==null) {
|
||||
this.zdsxList = new ArrayList<ZdlxSxItem>();
|
||||
}
|
||||
this.zdsxList.add(new ZdlxSxItem(key,value))
|
||||
}
|
||||
|
||||
|
||||
public getIcon():Resource {
|
||||
if (this.zdlx.startsWith("被盗抢")) {
|
||||
return $r("app.media.ic_type_bdq")
|
||||
}
|
||||
if (this.zdlx.startsWith("临时")) {
|
||||
return $r("app.media.ic_type_control")
|
||||
}
|
||||
return $r('app.media.ic_type_normal')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export class ZdlxSxItem{
|
||||
key:string=""
|
||||
value:string=""
|
||||
|
||||
testColor:Resource = $r("app.color.black")
|
||||
|
||||
constructor(key: string, value: string) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export class CarTypeOV{
|
||||
|
||||
zdlx:string=""
|
||||
czcs:string=""
|
||||
sqyy:string=""
|
||||
jzrq:string=""
|
||||
lxdh:string=""
|
||||
lxmj:string=""
|
||||
lxmjQQ:string=""
|
||||
remark:string=""
|
||||
xyrPhone:string=""
|
||||
peopleType:string=""
|
||||
order:number = 0;
|
||||
type:number = -1;
|
||||
status:number = 0;
|
||||
show:boolean= false
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
export interface LocalCarData{
|
||||
jdchpzl:string
|
||||
sfzh:string
|
||||
jdcsyr:string
|
||||
policePhone:string
|
||||
zrPoliceName:string
|
||||
reason:string
|
||||
solution:string
|
||||
}
|
||||
|
||||
//复制自己 为适应 Observed
|
||||
export const copyCarData = (value:CarData) => {
|
||||
let car = new CarData();
|
||||
car.id = value.id
|
||||
car.isSelect = value.isSelect
|
||||
car.csys = value.csys
|
||||
car.clsbdh = value.clsbdh
|
||||
car.jdczt = value.jdczt
|
||||
car.type = value.type
|
||||
car.syzzjzl = value.syzzjzl
|
||||
car.clpp = value.clpp
|
||||
car.jdcsyr = value.jdcsyr
|
||||
car.sfzh = value.sfzh
|
||||
car.hpzl = value.hpzl
|
||||
car.clxh = value.clxh
|
||||
car.hphm = value.hphm
|
||||
car.fdjh = value.fdjh
|
||||
car.isSteal = value.isSteal
|
||||
car.zdlxBeanList = value.zdlxBeanList
|
||||
return car;
|
||||
}
|
||||
|
||||
export class CarRecordItem{
|
||||
id:string=""
|
||||
historyId:string=""
|
||||
uuid:string=""
|
||||
carNum:string=""
|
||||
carStatus:string=""
|
||||
status:string=""
|
||||
pinpai:string=""
|
||||
color:string=""
|
||||
fdjh:string=""
|
||||
clsbdh:string=""
|
||||
clsyr:string=""
|
||||
syrzjhm:string=""
|
||||
syrStatus:string=""
|
||||
checkTime:string=""
|
||||
checkType:string=""
|
||||
checkTypeStr:string=""
|
||||
jdchpzl:string=""
|
||||
userName:string=""
|
||||
policeName:string=""
|
||||
idCard:string=""
|
||||
deptId:string=""
|
||||
deptName:string=""
|
||||
pointX:string=""
|
||||
pointY:string=""
|
||||
checkAddress:string=""
|
||||
policePhone:string=""
|
||||
isCommit:string=""
|
||||
photos:string=""
|
||||
}
|
||||
|
|
@ -0,0 +1,344 @@
|
|||
|
||||
import { JSON } from "@kit.ArkTS";
|
||||
import { StringUtils } from "../../util/StringUtils";
|
||||
|
||||
export interface CheckPeopleResultModel {
|
||||
|
||||
NationPoint?:string;
|
||||
newLKRY?:string;
|
||||
zdr: string
|
||||
extend?: string;
|
||||
peopleData: PeopleData;
|
||||
focusType?:number;
|
||||
checkPersonEntity?:string
|
||||
}
|
||||
|
||||
export interface CheckPersonEntity{
|
||||
/**
|
||||
* 0:正常
|
||||
* 1:涉恐
|
||||
* 2:涉稳
|
||||
* 3:在逃
|
||||
* 4: 涉毒
|
||||
* 5:前科
|
||||
* 6:精神病
|
||||
* 7:非访
|
||||
* 8:临控
|
||||
* 此值可能会为多个: 1,5,6 等
|
||||
*/
|
||||
peopleStatus:string
|
||||
}
|
||||
|
||||
|
||||
export class NationPoint {
|
||||
status?: string
|
||||
result?: zdrylbbjType[]
|
||||
}
|
||||
|
||||
export interface zdrylbbjType {
|
||||
zdrylbbj: string
|
||||
ZDRYXL:string
|
||||
LADW:string
|
||||
ZJLASJ:string
|
||||
|
||||
}
|
||||
|
||||
export class LocalLkryData {
|
||||
zdlx: string =""
|
||||
sqyy: string =""
|
||||
czcs: string =""
|
||||
jzrq: string =""
|
||||
lxmj: string =""
|
||||
lxmjQQ: string =""
|
||||
xyrPhone: string =""
|
||||
peopleType: string =""
|
||||
type: string =""
|
||||
status: string =""
|
||||
lxdh: string =""
|
||||
remark: string =""
|
||||
show: boolean = false
|
||||
}
|
||||
|
||||
export class ZdrData {
|
||||
peopleType?: string
|
||||
xyrPhone?: string
|
||||
zrPoliceName?: string
|
||||
policePhone?: string
|
||||
reason?: string
|
||||
householdAddress?: string
|
||||
}
|
||||
|
||||
export class ExtendData {
|
||||
zdlx?: string
|
||||
peopleType?: string
|
||||
zdrPhone?: string
|
||||
householdAddress?: string
|
||||
zrPoliceCode?: string
|
||||
zrPoliceName?: string
|
||||
zrPolicePhone?: string
|
||||
disposal?: string
|
||||
reason?: string
|
||||
terminationTime?: string
|
||||
}
|
||||
|
||||
export class PeopleData {
|
||||
private _xm?: string | undefined;
|
||||
|
||||
public get xm(): string {
|
||||
return StringUtils.get(this._xm, "")
|
||||
}
|
||||
|
||||
private _peopleHJDZ?: string;
|
||||
|
||||
public get peopleHJDZ(): string {
|
||||
return StringUtils.get(this._peopleHJDZ, "")
|
||||
}
|
||||
|
||||
private _mz?: string | undefined;
|
||||
|
||||
public set mz(value: string | undefined) {
|
||||
this._mz = value;
|
||||
}
|
||||
|
||||
public get mz(): string {
|
||||
return StringUtils.get(this._mz, "")
|
||||
}
|
||||
|
||||
public handMz(){
|
||||
if (this.type=="nation") {
|
||||
this.mz = PeopleData.getMzChan(StringUtils.get(this._mz, ""))
|
||||
}
|
||||
this.mz = StringUtils.get(this._mz, "")
|
||||
}
|
||||
|
||||
private _csrq?: string | undefined;
|
||||
|
||||
public get csrq(): string {
|
||||
let csrqs = StringUtils.get(this._csrq, "");
|
||||
if (csrqs.length<8) {
|
||||
return csrqs;
|
||||
}
|
||||
|
||||
return csrqs.substring(0,4)+"年"+csrqs.substring(4,6)+"月"+csrqs.substring(6,8)+"日"
|
||||
}
|
||||
|
||||
private _sfz?: string | undefined;
|
||||
|
||||
public get sfz(): string {
|
||||
return StringUtils.get(this._sfz, "")
|
||||
}
|
||||
|
||||
private _xb?: string | undefined;
|
||||
|
||||
public set xb(value: string | undefined) {
|
||||
this._xb = value;
|
||||
}
|
||||
|
||||
public get xb(): string {
|
||||
return StringUtils.get(this._xb, "");
|
||||
}
|
||||
|
||||
public handXb() {
|
||||
if (this.type=="nation") {
|
||||
if ("1"==this._xb) {
|
||||
this.xb = "男"
|
||||
} else if ("2"==this._xb) {
|
||||
this.xb = "女";
|
||||
}
|
||||
}
|
||||
this.xb = StringUtils.get(this._xb, "");
|
||||
}
|
||||
|
||||
private _type?: string | undefined;
|
||||
|
||||
public get type(): string {
|
||||
return StringUtils.get(this._type, "")
|
||||
}
|
||||
|
||||
private _zp?: string | undefined;
|
||||
|
||||
public get zp(): string {
|
||||
return StringUtils.get(this._zp, "")
|
||||
}
|
||||
|
||||
public static getMzChan(key: string): string {
|
||||
let mzKey =
|
||||
"[{\"id\":\"01\",\"name\":\"汉族\"},{\"id\":\"02\",\"name\":\"蒙古族\"},{\"id\":\"03\",\"name\":\"回族\"}," +
|
||||
"{\"id\":\"04\",\"name\":\"藏族\"},{\"id\":\"05\",\"name\":\"维吾尔族\"},{\"id\":\"06\",\"name\":\"苗族\"}," +
|
||||
"{\"id\":\"07\",\"name\":\"彝族\"},{\"id\":\"08\",\"name\":\"壮族\"},{\"id\":\"09\",\"name\":\"布依族\"}," +
|
||||
"{\"id\":\"10\",\"name\":\"朝鲜族\"},{\"id\":\"11\",\"name\":\"满族\"},{\"id\":\"12\",\"name\":\"侗族\"}," +
|
||||
"{\"id\":\"13\",\"name\":\"瑶族\"},{\"id\":\"14\",\"name\":\"白族\"},{\"id\":\"15\",\"name\":\"土家族\"}," +
|
||||
"{\"id\":\"16\",\"name\":\"哈尼族\"},{\"id\":\"17\",\"name\":\"哈萨克族\"},{\"id\":\"18\",\"name\":\"傣族\"}," +
|
||||
"{\"id\":\"19\",\"name\":\"黎族\"},{\"id\":\"20\",\"name\":\"傈僳族\"},{\"id\":\"21\",\"name\":\"佤族\"}," +
|
||||
"{\"id\":\"22\",\"name\":\"畲族\"},{\"id\":\"23\",\"name\":\"高山族\"},{\"id\":\"24\",\"name\":\"拉祜族\"}," +
|
||||
"{\"id\":\"25\",\"name\":\"水族\"},{\"id\":\"26\",\"name\":\"东乡族\"},{\"id\":\"27\",\"name\":\"纳西族\"}," +
|
||||
"{\"id\":\"28\",\"name\":\"景颇族\"},{\"id\":\"29\",\"name\":\"柯尔克孜族\"},{\"id\":\"30\",\"name\":\"土族\"}," +
|
||||
"{\"id\":\"31\",\"name\":\"达斡尔族\"},{\"id\":\"32\",\"name\":\"仫佬族\"},{\"id\":\"33\",\"name\":\"羌族\"}," +
|
||||
"{\"id\":\"34\",\"name\":\"布朗族\"},{\"id\":\"35\",\"name\":\"撒拉族\"},{\"id\":\"36\",\"name\":\"毛难族\"}," +
|
||||
"{\"id\":\"37\",\"name\":\"仡佬族\"},{\"id\":\"38\",\"name\":\"锡伯族\"},{\"id\":\"39\",\"name\":\"阿昌族\"}," +
|
||||
"{\"id\":\"40\",\"name\":\"普米族\"},{\"id\":\"41\",\"name\":\"塔吉克族\"},{\"id\":\"42\",\"name\":\"怒族\"}," +
|
||||
"{\"id\":\"43\",\"name\":\"乌孜别克族\"},{\"id\":\"44\",\"name\":\"俄罗斯族\"},{\"id\":\"45\",\"name\":\"鄂温克族\"}," +
|
||||
"{\"id\":\"46\",\"name\":\"崩龙族\"},{\"id\":\"47\",\"name\":\"保安族\"},{\"id\":\"48\",\"name\":\"裕固族\"}," +
|
||||
"{\"id\":\"49\",\"name\":\"京族\"},{\"id\":\"50\",\"name\":\"塔塔尔族\"},{\"id\":\"51\",\"name\":\"独龙族\"}," +
|
||||
"{\"id\":\"52\",\"name\":\"鄂伦春族\"},{\"id\":\"53\",\"name\":\"赫哲族\"},{\"id\":\"54\",\"name\":\"门巴族\"}," +
|
||||
"{\"id\":\"55\",\"name\":\"珞巴族\"},{\"id\":\"56\",\"name\":\"基诺族\"}]";
|
||||
|
||||
const param = JSON.parse(mzKey) as MzItem[];
|
||||
|
||||
for (let i = 0; i < param.length; i++) {
|
||||
let item = param[i] as MzItem;
|
||||
if (item.id == key) {
|
||||
return item.name
|
||||
}
|
||||
}
|
||||
return "未知";
|
||||
}
|
||||
}
|
||||
// 1 2 3 4
|
||||
// 珂珂 萧辰 灵士
|
||||
export interface MzItem {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export class ZdlxItem{
|
||||
zdlx:string="正常人员"
|
||||
//1 正常 2 黄色 3 红色
|
||||
styleType:number = 1
|
||||
zdxqArray?:Array<ZdXqItem>
|
||||
isShow :boolean = false;
|
||||
|
||||
constructor(zdlx: string, styleType: number) {
|
||||
this.zdlx = zdlx;
|
||||
this.styleType = styleType;
|
||||
}
|
||||
|
||||
addXQ(zdXqItem:ZdXqItem){
|
||||
if (this.zdxqArray == null) {
|
||||
this.zdxqArray = new Array();
|
||||
}
|
||||
this.zdxqArray.push(zdXqItem)
|
||||
}
|
||||
|
||||
public getIcon():Resource{
|
||||
if (this.zdlx.startsWith("涉稳")) {
|
||||
return $r("app.media.ic_type_stability")
|
||||
}
|
||||
if (this.zdlx.startsWith("涉恐")) {
|
||||
return $r("app.media.ic_type_fear")
|
||||
}
|
||||
if (this.zdlx.startsWith("关注")) {
|
||||
return $r("app.media.ic_type_focus")
|
||||
}
|
||||
if (this.zdlx.startsWith("云控")) {
|
||||
return $r("app.media.ic_type_control")
|
||||
}
|
||||
if (StringUtils.containsChar(this.zdlx,"精神")) {
|
||||
return $r("app.media.ic_type_fine")
|
||||
}
|
||||
if (this.zdlx.startsWith("非访")) {
|
||||
return $r("app.media.ic_type_non")
|
||||
}
|
||||
if (this.zdlx.startsWith("前科")) {
|
||||
return $r("app.media.ic_type_criminal_record")
|
||||
}
|
||||
if (StringUtils.containsChar(this.zdlx,"毒")) {
|
||||
return $r("app.media.ic_type_poison")
|
||||
}
|
||||
if (StringUtils.containsChar(this.zdlx,"临")) {
|
||||
return $r("app.media.ic_type_control")
|
||||
}
|
||||
if (StringUtils.containsChar(this.zdlx,"逃")) {
|
||||
return $r("app.media.ic_type_escape")
|
||||
}
|
||||
return $r("app.media.ic_type_normal");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export class HistoryBean{
|
||||
id?:string;
|
||||
queryType?:string;
|
||||
mz?:string;
|
||||
xb?:string;
|
||||
hjd?:string;
|
||||
csrq?:string;
|
||||
sfzh?:string;
|
||||
queryPName?:string;
|
||||
queryDate?:string;
|
||||
startDate?:string;
|
||||
endDate?:string;
|
||||
type?:number;
|
||||
isUpdate?:boolean
|
||||
}
|
||||
|
||||
export interface CheckPeopleCount{
|
||||
code:number
|
||||
count:number
|
||||
msg:string
|
||||
}
|
||||
|
||||
export class ZdXqItem{
|
||||
key?:string
|
||||
value?:string
|
||||
textColor:Resource= $r('app.color.black')
|
||||
|
||||
constructor(key: string, value: string, textColor: Resource) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
this.textColor = textColor;
|
||||
}
|
||||
}
|
||||
|
||||
export interface OCRIdCardNumResultModel{
|
||||
name:string
|
||||
sex:string
|
||||
nationality:string
|
||||
address:string
|
||||
birth:string
|
||||
idNumber:string
|
||||
cardImageUri:string
|
||||
originalImageUri:string
|
||||
}
|
||||
|
||||
export class PersonCountModel{
|
||||
count?:number
|
||||
peoplePhone?:string
|
||||
}
|
||||
|
||||
|
||||
export class AccompanPersonBean1{
|
||||
total:number = 0;
|
||||
rows?:Array<AccompanPersonBean>
|
||||
}
|
||||
|
||||
export class AccompanPersonBean{
|
||||
peopleStatusStr?:string
|
||||
checkTime?:string
|
||||
name?:string
|
||||
sfz?:string
|
||||
uuid?:string
|
||||
address?:string
|
||||
mz?:string
|
||||
csrq?:string
|
||||
status?:string
|
||||
idCardPhoto:string = ""
|
||||
id:string = ""
|
||||
sex:number = 0
|
||||
}
|
||||
|
||||
export class CheckPeopleRecordItem{
|
||||
id:string="";
|
||||
policeNum:string="";
|
||||
policeName:string="";
|
||||
checkTime:string="";
|
||||
checkTypeStr:string=""
|
||||
deptName:string=""
|
||||
policePhone:string=""
|
||||
pointX:string=""
|
||||
pointY:string=""
|
||||
checkType:number=1
|
||||
checkAddress:string=""
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
@Observed
|
||||
export class FocusPersonBean{
|
||||
|
||||
updateTime?:string
|
||||
realName?:string
|
||||
idCardNum?:string
|
||||
mz?:string
|
||||
address?:string
|
||||
birthDate?:string
|
||||
sex?:string
|
||||
phone?:string
|
||||
focusType?:number
|
||||
rylx?:string
|
||||
@Track idCardPhoto?:string|Resource
|
||||
|
||||
}
|
||||
|
||||
export class FocusCarBean{
|
||||
updateTime?:string
|
||||
hphm?:string
|
||||
clsyr?:string
|
||||
csys?:string
|
||||
clpp?:string
|
||||
cjh?:string
|
||||
fdjh?:string
|
||||
cllx?:string
|
||||
syrzjhm?:string
|
||||
focusType?:number
|
||||
carStatus?:string
|
||||
}
|
||||
|
||||
export class GetFocusCarData{
|
||||
|
||||
focusType:number =0
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
|
||||
|
||||
export class LocationAddress{
|
||||
address?:string
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
|
||||
export class StatisticsResultModel{
|
||||
|
||||
peopleCount?:number
|
||||
unusualPeopleCount?:number
|
||||
carCount?:number
|
||||
goodsCount?:number
|
||||
unusualCarCount?:number
|
||||
commitPeopleCount?:number
|
||||
commitCarCount?:number
|
||||
allCount?:number
|
||||
}
|
||||
|
||||
export class MainRecordResultModel{
|
||||
id:string=""
|
||||
mainId:string="" //盘查id
|
||||
carNum:string="" //车牌号
|
||||
peopleCount:string="" // 正常人员数
|
||||
unusualPeopleCount:string=""//
|
||||
unusualCarCount:string=""
|
||||
goodsCount:string="" // 物品数
|
||||
checkTime:string="" //盘查时间
|
||||
checkAddress:string="" //盘查地址
|
||||
status:number=0 //移交1、通过0
|
||||
checkReason:string="" //盘查原因
|
||||
yjdw:string="" //移交单位
|
||||
yjdwmc:string="" //移交单位
|
||||
remark:string="" //备注
|
||||
kkid:string="" //卡口id
|
||||
userName:string="" //警号
|
||||
policeName:string="" //警员姓名
|
||||
pointName:string=""
|
||||
taskName:string=""
|
||||
classType:string=""
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
export interface PgTokenModel{
|
||||
access_token:string
|
||||
refresh_token:string
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
|
||||
|
||||
export class TaskModel{
|
||||
baseType:number = 1
|
||||
name?:string
|
||||
id?:string
|
||||
kssj?:string
|
||||
jssj?:string
|
||||
phone?:string
|
||||
description?:string
|
||||
deptId?:string
|
||||
deptName?:string
|
||||
|
||||
}
|
||||
|
||||
export class CardPointModel{
|
||||
name?:string
|
||||
id:string=""
|
||||
address?:string
|
||||
pointX?:string
|
||||
pointY?:string
|
||||
|
||||
}
|
||||
|
||||
export class DeptResultModel{
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
export class UploadPhotoModel{
|
||||
|
||||
status?:number
|
||||
code?:number
|
||||
msg?:string
|
||||
data?:DataBean
|
||||
}
|
||||
|
||||
export class DataBean{
|
||||
photoId?:string
|
||||
url?:string
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
|
||||
export class ErrorOfEmptyModel{
|
||||
// image: Resource = $r('app.media.icon_error') ;
|
||||
|
||||
//0 = 空白页 -1 表示错误页
|
||||
type:number = 0;
|
||||
msg: string | Resource = "";
|
||||
|
||||
|
||||
constructor(type:number, msg: string | Resource) {
|
||||
this.type = type;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
|
||||
getIcon():Resource{
|
||||
if (this.type == 0){
|
||||
return $r('app.media.icon_empty')
|
||||
}
|
||||
return $r('app.media.icon_error')
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
* 图像数据接口
|
||||
*/
|
||||
export interface IImageData {
|
||||
data: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 图像配置接口
|
||||
*/
|
||||
export interface IImageConfig {
|
||||
image: IImageData;
|
||||
face_selection: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据库配置接口
|
||||
*/
|
||||
export interface IDatabaseConfig {
|
||||
db_id: string;
|
||||
top_k: string;
|
||||
min_score: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 人脸识别请求接口
|
||||
*/
|
||||
export interface IFaceRecognitionRequest {
|
||||
image: IImageConfig;
|
||||
dbs: IDatabaseConfig[];
|
||||
type: string;
|
||||
}
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
import { RuanseeAbitityStag } from "../../app/RuanseeAbitityStag";
|
||||
import { StringUtils } from "../../util/StringUtils";
|
||||
|
||||
|
||||
export class GoodsTypeBean {
|
||||
/**
|
||||
* {"dwvalue":"11","thingsname":"非法出版物","thingsvalue":"11","ordersort":2,"dwname":"件"},
|
||||
* {"dwvalue":"8","thingsname":"危化物品","thingsvalue":"8","ordersort":3,"dwname":"千克"},
|
||||
* {"dwvalue":"9","thingsname":"毒品","thingsvalue":"9","ordersort":4,"dwname":"克"},
|
||||
* {"dwvalue":"1","thingsname":"假套车牌","thingsvalue":"1","ordersort":5,"dwname":"套"},
|
||||
*/
|
||||
dwvalue: string = "0";
|
||||
thingsname: string = "0";
|
||||
thingsvalue: string = "0";
|
||||
ordersort: string = "0";
|
||||
dwname: string = "0";
|
||||
}
|
||||
|
||||
export class GoodsBean {
|
||||
name: string = ""
|
||||
count: string = ""
|
||||
createTime: string = ""
|
||||
unit: string = ""
|
||||
dwValue: string = ""
|
||||
thingsValue: string = ""
|
||||
remark: string = ""
|
||||
category: string = ""
|
||||
dangerLevel: string = ""
|
||||
checkTime: string = ""
|
||||
photoUrl: string = ""
|
||||
photoId: string = ""
|
||||
historyId: string = ""
|
||||
deptId: string = ""
|
||||
uuid: string = ""
|
||||
userName: string = ""
|
||||
idCard: string = ""
|
||||
deptName: string = ""
|
||||
policeName: string = ""
|
||||
//是否移交
|
||||
isYj: boolean = false;
|
||||
// isSelect: boolean = true;
|
||||
//
|
||||
// getIcon(): Resource {
|
||||
// if (StringUtils.containsChar(this.name, "车牌")) {
|
||||
// return $r('app.media.log_tp')
|
||||
// }
|
||||
// if (StringUtils.containsChar(this.name, "枪")) {
|
||||
// return $r('app.media.log_qz')
|
||||
// }
|
||||
// if (StringUtils.containsChar(this.name, "子弹")) {
|
||||
// return $r('app.media.log_zd')
|
||||
// }
|
||||
// if (StringUtils.containsChar(this.name, "雷管") || StringUtils.containsChar(this.name, "炸药")) {
|
||||
// return $r('app.media.log_zylg')
|
||||
// }
|
||||
// if (StringUtils.containsChar(this.name, "烟花")) {
|
||||
// return $r('app.media.log_yhbz')
|
||||
// }
|
||||
// if (StringUtils.containsChar(this.name, "危化物品")) {
|
||||
// return $r('app.media.log_whwp')
|
||||
// }
|
||||
// return $r('app.media.icon_qtwp')
|
||||
// }
|
||||
|
||||
setUserData(){
|
||||
this.historyId = RuanseeAbitityStag.appCache.getHistoryId()
|
||||
this.deptId = RuanseeAbitityStag.userCache.getDeptCode
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export class CheckReasonModel{
|
||||
dictLabel?:string
|
||||
dictValue?:string
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
|
||||
@Observed
|
||||
export class PersonItemBean {
|
||||
baseType: number = 1
|
||||
peopleStatusStr?: string
|
||||
checkTime?: string
|
||||
name?: string
|
||||
sfz?: string
|
||||
isSelect:boolean = false;
|
||||
id?: string
|
||||
}
|
||||
|
||||
@Observed
|
||||
export class CarItemBean {
|
||||
hpzl:string=""
|
||||
clxh:string=""
|
||||
hphm:string=""
|
||||
sfzh:string=""
|
||||
carZdlx:string=""
|
||||
isSelect:boolean = false;
|
||||
id?: string
|
||||
}
|
||||
|
||||
@Observed
|
||||
export class GoodsItemBean{
|
||||
name: string = ""
|
||||
count: string = ""
|
||||
createTime: string = ""
|
||||
unit: string = ""
|
||||
dwValue: string = ""
|
||||
thingsValue: string = ""
|
||||
isSelect:boolean = false;
|
||||
id?: string
|
||||
}
|
||||
|
||||
export class HanoverItem {
|
||||
/**
|
||||
* 1 = 标题 2 = 车 3 = 人 4 = 物品
|
||||
*/
|
||||
baseType: number = 1;
|
||||
baseMsg: string = ""
|
||||
id?: string
|
||||
|
||||
personData?:PersonItemBean
|
||||
carData?:CarItemBean
|
||||
goodsData?:GoodsItemBean
|
||||
|
||||
}
|
||||
|
||||
@Observed
|
||||
export class SelectDept{
|
||||
randomId:string = ""
|
||||
deptId: string | null = null;
|
||||
deptName: string | null = null
|
||||
parentId: string | null = null
|
||||
updateTime: string | null = null
|
||||
isSelect:boolean = false;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
/**
|
||||
* 统一认证
|
||||
*/
|
||||
export enum IAuthTaskType {
|
||||
/**
|
||||
* 获取token模式
|
||||
*/
|
||||
AUTH_TASK_TOKEN = 0,
|
||||
/**
|
||||
* token登录模式
|
||||
*/
|
||||
AUTH_TASK_USER = 1,
|
||||
/**
|
||||
* 登录页面模式
|
||||
*/
|
||||
AUTH_TASK_START_AUTH = 2,
|
||||
/**
|
||||
* 多因子绑定模式
|
||||
*/
|
||||
AUTH_TASK_BIND = 3,
|
||||
/**
|
||||
* 多因子解绑模式
|
||||
*/
|
||||
AUTH_TASK_UNBIND = 4,
|
||||
/**
|
||||
* 个人信息修改模式
|
||||
*/
|
||||
AUTH_TASK_SET_UP = 5,
|
||||
}
|
||||
|
||||
|
||||
export class AuthUserModel {
|
||||
age?: number;
|
||||
birthdate?: string;
|
||||
code: string = '';
|
||||
email?: string;
|
||||
orderId: number;
|
||||
orgId: string;
|
||||
orgName: string;
|
||||
phoneNum?: string;
|
||||
policeTypeId: string;
|
||||
policeTypeName: string;
|
||||
profilePhoto?: string;
|
||||
realName: string;
|
||||
token: string;
|
||||
userName: string;
|
||||
userNum: string;
|
||||
workPhone?: string;
|
||||
sysTypeId: string;
|
||||
|
||||
constructor(code: string, orderId: number, orgId: string, orgName: string, policeTypeId: string,
|
||||
policeTypeName: string, realName: string, token: string, userName: string, userNum: string,
|
||||
sysTypeId: string, age?: number, birthdate?: string, email?: string, phoneNum?: string,
|
||||
profilePhoto?: string, workPhone?: string) {
|
||||
|
||||
this.code = code;
|
||||
this.orderId = orderId;
|
||||
this.orgId = orgId;
|
||||
this.orgName = orgName;
|
||||
this.policeTypeId = policeTypeId;
|
||||
this.policeTypeName = policeTypeName;
|
||||
this.realName = realName;
|
||||
this.token = token;
|
||||
this.userName = userName;
|
||||
this.userNum = userNum;
|
||||
this.sysTypeId = sysTypeId;
|
||||
this.age = age === undefined ? 0 : age;
|
||||
this.birthdate = birthdate === undefined ? '' : birthdate;
|
||||
this.email = email === undefined ? '' : email;
|
||||
this.phoneNum = phoneNum === undefined ? '' : phoneNum;
|
||||
this.profilePhoto = profilePhoto === undefined ? '' : profilePhoto;
|
||||
this.workPhone = workPhone === undefined ? '' : workPhone;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
export interface MainButtonBean{
|
||||
icon:Resource;
|
||||
name:string|Resource;
|
||||
routerPage?: string
|
||||
tag?: number
|
||||
|
||||
}
|
||||
|
||||
|
||||
export interface OCRIdCardNumResultModel{
|
||||
name:string
|
||||
sex:string
|
||||
nationality:string
|
||||
address:string
|
||||
birth:string
|
||||
idNumber:string
|
||||
cardImageUri:string
|
||||
originalImageUri:string
|
||||
}
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
|
||||
export class SkipCheckPageModel{
|
||||
|
||||
titleType:number = 0;
|
||||
taskId?:string;
|
||||
taskName?:string;
|
||||
cardPointName?:string;
|
||||
}
|
||||
|
||||
export class SkipCheckCardModel {
|
||||
isCardPoint?:boolean;
|
||||
}
|
||||
|
||||
export class SkipPassPageParam{
|
||||
//是否卡点盘查
|
||||
isCardPoint?:boolean;
|
||||
carNumStatus: number = 0;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到选择移交单位参数
|
||||
*/
|
||||
export class SkipHandOverSelectDeptParam {
|
||||
isCardPoint?:boolean;
|
||||
carNumStatus: number = 0;
|
||||
personIds?: Array<string>
|
||||
carId?:string;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到移交最后一步操作
|
||||
*/
|
||||
export class SkipHandOverParam {
|
||||
isCardPoint?:boolean;
|
||||
carNumStatus: number = 0;
|
||||
personIds?: Array<string>
|
||||
carId?:string;
|
||||
selectDeptId?:string;
|
||||
selectDeptName?:string;
|
||||
}
|
||||
|
||||
|
||||
export interface SkipCheckCountParam{
|
||||
what:number;
|
||||
name :string;
|
||||
sex :string;
|
||||
idCardNum :string;
|
||||
birthDate :string;
|
||||
nation :string;
|
||||
address :string;
|
||||
photoData: string | Resource
|
||||
zdlx: string
|
||||
|
||||
}
|
||||
|
||||
|
||||
export interface SkipCarCountParam{
|
||||
what:number;
|
||||
carNum :string;
|
||||
carYs :string;
|
||||
carZL :string;
|
||||
carPP :string;
|
||||
carJH :string;
|
||||
carFDJH :string;
|
||||
carSYR :string;
|
||||
idCardNum :string;
|
||||
carStatus:string
|
||||
}
|
||||
|
||||
export interface SkipHistoryDetailsParam{
|
||||
pctime:string
|
||||
policenum:string
|
||||
policename:string
|
||||
pcyy:string
|
||||
yjdw:string
|
||||
mainId:string
|
||||
status:number
|
||||
address:string
|
||||
taskName:string
|
||||
type:number
|
||||
}
|
||||
export class RouterResultModel<T>{
|
||||
|
||||
pageTag?:string
|
||||
|
||||
data?:T
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
|
||||
export class BasePageResult{
|
||||
//标识类型
|
||||
type:number=0;
|
||||
//第二标识
|
||||
what:number=0;
|
||||
//传递的参数
|
||||
data?:ESObject;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
|
||||
|
||||
export class PeopleFaceRequestModel{
|
||||
listLibIds:string = ""
|
||||
start:string = ""
|
||||
size:string = ""
|
||||
similarityMin:string = ""
|
||||
picBase64:string = ""
|
||||
// credentialsNum:string = ""
|
||||
}
|
||||
|
||||
|
||||
export class PeopleFaceResultModel{
|
||||
total:number = 0
|
||||
pageNo:number = 0
|
||||
pageSize:number = 0
|
||||
list:Array<FaceItem>=[]
|
||||
success:boolean = false
|
||||
}
|
||||
|
||||
|
||||
export class FaceItem{
|
||||
credentialsNum: string=""
|
||||
humanName: string=""
|
||||
facePicUrl: string=""
|
||||
listLibId?: string
|
||||
similarity: string=""
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
import { SymbolGlyphModifier } from "@ohos.arkui.modifier";
|
||||
|
||||
/**
|
||||
* 任务模型
|
||||
*/
|
||||
export class SelectTaskModel implements SelectOption{
|
||||
|
||||
/**
|
||||
* 任务名称 name
|
||||
*/
|
||||
value: string = "";
|
||||
icon?: ResourceStr | undefined;
|
||||
symbolIcon?: SymbolGlyphModifier | undefined;
|
||||
|
||||
id?:string;
|
||||
kssj?:string;
|
||||
jssj?:string;
|
||||
phone?:string;
|
||||
description?:string;
|
||||
deptId?:string;
|
||||
deptName?:string;
|
||||
|
||||
}
|
||||
|
||||
@Observed
|
||||
export class CardProtModel{
|
||||
orgName?:string;
|
||||
id?:string;
|
||||
orgCode?:string;
|
||||
address?:string
|
||||
pointX?:string
|
||||
pointY?:string
|
||||
isSelect?:boolean = false;
|
||||
}
|
||||
|
||||
@Observed
|
||||
export class SelectTaskObservedModel{
|
||||
baseType:number = 1
|
||||
taskName: string = "";
|
||||
taskId: string = "";
|
||||
isSelect?:boolean = false;
|
||||
}
|
||||
|
|
@ -0,0 +1,166 @@
|
|||
import axios, {
|
||||
AxiosError,
|
||||
AxiosHeaders,
|
||||
AxiosInstance,
|
||||
AxiosRequestConfig,
|
||||
AxiosResponse,
|
||||
InternalAxiosRequestConfig,
|
||||
RawAxiosRequestHeaders
|
||||
} from "@ohos/axios";
|
||||
import { AppCache } from '../app/AppCache';
|
||||
import { UserCache } from '../app/UserCache';
|
||||
import { StringUtils } from '../util/StringUtils';
|
||||
import App from '@system.app';
|
||||
|
||||
// axios 请求配置
|
||||
const config: AxiosRequestConfig = {
|
||||
baseURL: AppCache.getAppCache().getServiceAddress(),
|
||||
// baseURL: '/api',
|
||||
timeout: 1000 * 30,
|
||||
connectTimeout : 30*1000,
|
||||
readTimeout:30*1000,
|
||||
}
|
||||
|
||||
// 定义返回值类型
|
||||
interface Result<T = ESObject> {
|
||||
code: number;
|
||||
message: string;
|
||||
data: T;
|
||||
}
|
||||
|
||||
class Http {
|
||||
// axios 实例
|
||||
private instance: AxiosInstance;
|
||||
|
||||
// 构造函数初始化
|
||||
constructor(config: AxiosRequestConfig) {
|
||||
this.instance = axios.create(config);
|
||||
//定义拦截器
|
||||
this.interceptors();
|
||||
}
|
||||
|
||||
private interceptors() {
|
||||
// axios 发送请求之前的处理
|
||||
this.instance.interceptors.request.use((config: InternalAxiosRequestConfig) => {
|
||||
// 在请求头部携带token
|
||||
// let token = sessionStorage.getItem('token');
|
||||
let token = UserCache.getUserCache().getUserInfo();
|
||||
if (token) {
|
||||
config.headers!['userInfo'] = token;
|
||||
// 把 token 放到 headers 里面
|
||||
// (config.headers as AxiosRequestHeaders).token = token;
|
||||
}
|
||||
let pgToken = AppCache.getAppCache().getPgToken;
|
||||
if (pgToken) {
|
||||
config.headers!['Authorization'] = pgToken;
|
||||
}
|
||||
console.log('' + config);
|
||||
return config;
|
||||
|
||||
}, (error: ESObject) => {
|
||||
error.data = {};
|
||||
error.data.msg = '服务器异常,请联系管理员!'
|
||||
return error;
|
||||
})
|
||||
// axios 请求返回之后的处理
|
||||
// 请求返回处理
|
||||
this.instance.interceptors.response.use((res: AxiosResponse) => {
|
||||
let msg = JSON.stringify(res.data);
|
||||
msg = StringUtils.toJsonParaphrase(msg);
|
||||
console.info('获取到的数据:' + msg);
|
||||
if (res.status != 200) {
|
||||
console.log(res.data.msg || '服务器出错啦');
|
||||
return Promise.reject(res.data.msg || '服务器出错啦');
|
||||
}
|
||||
return res.data;
|
||||
}, (error: AxiosError) => {
|
||||
console.log('进入错误!');
|
||||
// error.data = {};
|
||||
if (error.code == "2300028") {
|
||||
error.message = "网络超时";
|
||||
} else {
|
||||
if (error && error.response) {
|
||||
switch (error.response.status) {
|
||||
case 400:
|
||||
error.message = "错误请求";
|
||||
break;
|
||||
case 401:
|
||||
error.message = "未授权,请登录";
|
||||
break;
|
||||
case 403:
|
||||
error.message = "拒绝访问";
|
||||
break;
|
||||
case 404:
|
||||
error.message = "请求错误,未找到该资源";
|
||||
break;
|
||||
case 405:
|
||||
error.message = "请求方法未允许";
|
||||
break;
|
||||
case 408:
|
||||
error.message = "请求超时";
|
||||
break;
|
||||
case 500:
|
||||
error.message = "服务器端出错";
|
||||
break;
|
||||
case 501:
|
||||
error.message = "网络未实现";
|
||||
break;
|
||||
case 502:
|
||||
error.message = "网络错误";
|
||||
break;
|
||||
case 503:
|
||||
error.message = "服务不可用";
|
||||
break;
|
||||
case 504:
|
||||
error.message = "网络超时";
|
||||
break;
|
||||
case 505:
|
||||
error.message = "http版本不支持该请求";
|
||||
break;
|
||||
default:
|
||||
error.message = `连接错误${error.response.status}`;
|
||||
}
|
||||
} else {
|
||||
error.message = "连接到服务器失败";
|
||||
}
|
||||
}
|
||||
console.log(error.message)
|
||||
return Promise.reject(error);
|
||||
})
|
||||
}
|
||||
|
||||
// GET方法
|
||||
get<T = Result>(url: string, params?: object,headers?: AxiosHeaders): Promise<T> {
|
||||
return this.instance.get(url, { params,headers:headers });
|
||||
}
|
||||
|
||||
// POST方法
|
||||
post<T = Result>(url: string, data?: object,headers?: AxiosHeaders): Promise<T> {
|
||||
return this.instance.post(url, data,{headers:headers});
|
||||
}
|
||||
|
||||
// POST方法
|
||||
postFromJson<T = Result>(url: string, data?: string): Promise<T> {
|
||||
return this.instance.post(url, data, { headers:new AxiosHeaders({ 'Content-Type': 'application/json; charset=utf-8'})});
|
||||
}
|
||||
|
||||
// POST方法
|
||||
postFromBody<T = Result>(url: string, data?: object,headers?: AxiosHeaders): Promise<T> {
|
||||
return this.instance.post(url, null, { params: data ,headers:headers});
|
||||
}
|
||||
|
||||
// PUT方法
|
||||
put<T = Result>(url: string, data?: object): Promise<T> {
|
||||
return this.instance.put(url, data);
|
||||
}
|
||||
|
||||
// DELETE方法
|
||||
delete<T = Result>(url: string): Promise<T> {
|
||||
return this.instance.delete(url);
|
||||
}
|
||||
}
|
||||
|
||||
export default new Http(config);
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
|
||||
import { inspector } from '@kit.ArkUI';
|
||||
import axios, { RawAxiosRequestHeaders, AxiosHeaders, AxiosResponse, AxiosError,
|
||||
InternalAxiosRequestConfig } from '@ohos/axios';
|
||||
import { AppCache } from '../app/AppCache';
|
||||
import { UserCache } from '../app/UserCache';
|
||||
|
||||
export class RequestUtils {
|
||||
instance = axios.create({
|
||||
timeout:20000
|
||||
|
||||
});
|
||||
|
||||
create(){
|
||||
|
||||
// 添加请求拦截器
|
||||
this.instance.interceptors.request.use((config:InternalAxiosRequestConfig) => {
|
||||
// 在发送请求之前做些什么
|
||||
return config;
|
||||
}, (error:AxiosError) => {
|
||||
// 对请求错误做些什么
|
||||
return Promise.reject(error);
|
||||
});
|
||||
|
||||
//响应拦截器,通过响应拦截器进一步对返回的数据做处理
|
||||
this.instance.interceptors.response.use(
|
||||
(response:AxiosResponse) => {
|
||||
return response;
|
||||
}
|
||||
, (error:AxiosError) => {
|
||||
return Promise.reject(error)
|
||||
},
|
||||
{
|
||||
})
|
||||
}
|
||||
|
||||
//街面检查 Street inspection
|
||||
async postRequest<D, T>(disposition: RequestDisposition<D>, callback: RequestCallback<T>) {
|
||||
await axios<string, AxiosResponse<string>, Map<string, string | null>>({
|
||||
method: "post",
|
||||
url: disposition.url,
|
||||
params: disposition.params,
|
||||
headers: {
|
||||
"userInfo": UserCache.getUserCache().getUserInfo(),
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
})
|
||||
.then((response: AxiosResponse<string>) => {
|
||||
let msg = JSON.stringify(response.data);
|
||||
console.info('获取到的数据:' + msg);
|
||||
if (response.status != 200) {
|
||||
callback.error(msg)
|
||||
return
|
||||
}
|
||||
|
||||
const resultModel = JSON.parse(msg) as T;
|
||||
callback.successful(resultModel)
|
||||
// 获取到的数据赋值给users数组
|
||||
})
|
||||
.catch((error: AxiosError) => {
|
||||
console.info('捕获到异常:', JSON.stringify(error));
|
||||
callback.error(JSON.stringify(error))
|
||||
})
|
||||
.then(() => {
|
||||
// 总是会执行
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export interface RequestDisposition<D> {
|
||||
url: string
|
||||
fullUrl?: string
|
||||
params?: D
|
||||
data?: D
|
||||
// headers?: any;
|
||||
timeout?: number;
|
||||
readTimeout?: number;
|
||||
timeoutErrorMessage?: string;
|
||||
connectTimeout?: number;
|
||||
}
|
||||
|
||||
export interface RequestCallback<T> {
|
||||
error(msg: string): void
|
||||
|
||||
successful(resultModel: T): void
|
||||
|
||||
onFinally():void
|
||||
}
|
||||
|
|
@ -0,0 +1,480 @@
|
|||
import { AxiosHeaders, FormData } from "@ohos/axios"
|
||||
import http from "../HttpUtils"
|
||||
import { buffer, util } from "@kit.ArkTS"
|
||||
import AppConstants from "../../app/AppConstant"
|
||||
import { PgTokenModel } from "../../model/resultModel/PgResultModel"
|
||||
import { MainRecordResultModel, StatisticsResultModel } from "../../model/resultModel/MainResultModel"
|
||||
import { ResultPageModel } from "../data/ResultModel"
|
||||
import {
|
||||
CheckCarRequestModel,
|
||||
CheckPersonRequestModel,
|
||||
CheckSubmitModel,
|
||||
GetFocusListModel,
|
||||
GetPersonListModel,
|
||||
QueryCarCountRequestModel,
|
||||
QueryCardFocusModel,
|
||||
QueryCardPointModel,
|
||||
RequestCheckCarRecordModel,
|
||||
RequestCheckPeopleRecordModel,
|
||||
RequestCheckPersonCount,
|
||||
RequestTaskModel,
|
||||
SaveCarDataRequestModel,
|
||||
UpdateCarFocusModel,
|
||||
UpdatePersonFocusModel,
|
||||
UploadFile
|
||||
} from "../../model/requestModel/CheckRequestModel"
|
||||
import { RuanseeAbitityStag } from "../../app/RuanseeAbitityStag"
|
||||
import {
|
||||
AccompanPersonBean,
|
||||
CheckPeopleRecordItem,
|
||||
CheckPeopleResultModel,
|
||||
PersonCountModel
|
||||
} from "../../model/resultModel/CheckPeopleResultModel"
|
||||
import { BaseResultModel, PageModel } from "../../model/resultModel/BaseResultModel"
|
||||
import { UploadPhotoModel } from "../../model/resultModel/UploadPhotoModel"
|
||||
import fs from '@ohos.file.fs';
|
||||
import { LocationDescription, GetLocationAddress } from "../../model/requestModel/LocationRequestModel"
|
||||
import { CarData, CarRecordItem, CheckCarResultModes } from "../../model/resultModel/CheckCarResultModel"
|
||||
import { DateFormat, DateUtils } from "../../util/DateUtils"
|
||||
import { CardPointModel, TaskModel } from "../../model/resultModel/TaskCardPointModel"
|
||||
import { FocusCarBean, FocusPersonBean, GetFocusCarData } from "../../model/resultModel/FocusModel"
|
||||
import { GetDeptChile,
|
||||
QueryCarRecordByMainModel,
|
||||
QueryMainHistoryRecordModel } from "../../model/requestModel/MainRequestModel"
|
||||
import { DeptTableEntity } from "../../model/db/TableEntity"
|
||||
import { DateUtil, JSONUtil } from "@pura/harmony-utils"
|
||||
import { CustomUnionType } from "../../app/JointType"
|
||||
import { StringUtils } from "../../util/StringUtils"
|
||||
import { IFaceRecognitionRequest } from "../../model/uiModel/FaceImageModel"
|
||||
import { GoodsBean } from "../../model/uiModel/GoodsModel"
|
||||
import { UserCache } from "../../app/UserCache"
|
||||
import { PeopleFaceRequestModel, PeopleFaceResultModel } from "../../model/uiModel/PeopleFaceRequestModel"
|
||||
|
||||
|
||||
/*获取首页统计数字*/
|
||||
export const getMainStatistics = (data?: ESObject) => {
|
||||
return http.postFromBody<ResultPageModel<StatisticsResultModel>>("task/getStaticsByPolice", data)
|
||||
}
|
||||
|
||||
/*获取品高认证*/
|
||||
export const getPgToken = (data?: ESObject) => {
|
||||
let byte = new Uint8Array(buffer.from(AppConstants.PG_APP_KEY_SECRET, 'utf-8').buffer);
|
||||
let ac = new util.Base64Helper().encodeToStringSync(byte);
|
||||
return http.postFromBody<PgTokenModel>("http://20.90.2.2/sso_out/oauth2/token?grant_type=client_credentials", data,
|
||||
new AxiosHeaders({
|
||||
'Authorization': 'Basic ' + ac,
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}))
|
||||
}
|
||||
|
||||
/**
|
||||
* 盘查人员
|
||||
* @param checkType 盘查方式(0 身份证 1 nfc 2 人像 3 语音 4 OCR)
|
||||
*/
|
||||
export const checkPerson =
|
||||
(checkType: number, checkIdCard: string, isCardPoint: boolean, data?: CheckPersonRequestModel) => {
|
||||
if (!data) {
|
||||
data = new CheckPersonRequestModel();
|
||||
}
|
||||
data.policeXm = RuanseeAbitityStag.userCache.getUserName;
|
||||
data.policeId = RuanseeAbitityStag.userCache.getUserCode;
|
||||
data.policeZzjgCode = RuanseeAbitityStag.userCache.getDeptCode;
|
||||
data.policeZzjgMc = RuanseeAbitityStag.userCache.getDeptName;
|
||||
data.policeIdCard = RuanseeAbitityStag.userCache.getIdCardNum;
|
||||
data.policePhone = RuanseeAbitityStag.userCache.getPhoneNum;
|
||||
data.sfz = checkIdCard;
|
||||
data.personId = RuanseeAbitityStag.appCache.getPeopleTemporarilyId();
|
||||
data.historyId = RuanseeAbitityStag.appCache.getHistoryId();
|
||||
data.checkType = `${checkType}`
|
||||
if (isCardPoint) {
|
||||
data.pointX = RuanseeAbitityStag.appCache.getCardPointLocationX()
|
||||
data.pointY = RuanseeAbitityStag.appCache.getCardPointLocationY()
|
||||
data.checkAddress = RuanseeAbitityStag.appCache.getCardPointAddress
|
||||
} else {
|
||||
data.pointX = `${RuanseeAbitityStag.appCache.getLocationX()}`
|
||||
data.pointY = `${RuanseeAbitityStag.appCache.getLocationY()}`
|
||||
data.checkAddress = RuanseeAbitityStag.appCache.getLocationAddress
|
||||
}
|
||||
return http.postFromBody<BaseResultModel<CheckPeopleResultModel>>("person/checkPerson", data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询人员被核查次数
|
||||
*/
|
||||
export const checkPersonCount = (idCard: string) => {
|
||||
let data: RequestCheckPersonCount = {
|
||||
sfz: idCard
|
||||
}
|
||||
return http.postFromBody<BaseResultModel<PersonCountModel>>("person/countPeople", data)
|
||||
}
|
||||
|
||||
//上传文件
|
||||
export const uploadFile = (filePath: string, typeId: string) => {
|
||||
let formData = new FormData();
|
||||
|
||||
// 读取文件内容为ArrayBuffer
|
||||
let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY);
|
||||
let stat = fs.statSync(filePath);
|
||||
let arrayBuffer = new ArrayBuffer(stat.size);
|
||||
fs.readSync(file.fd, arrayBuffer);
|
||||
fs.closeSync(file);
|
||||
|
||||
let fileName: UploadFile = {
|
||||
filename: "sf",
|
||||
contentType: "image/jpeg"
|
||||
};
|
||||
|
||||
|
||||
formData.append('photoFile', arrayBuffer, fileName);
|
||||
formData.append('personId', typeId);
|
||||
|
||||
return http.post<UploadPhotoModel>("person/uploadPhoto", formData,
|
||||
new AxiosHeaders({
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}))
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取位置描述
|
||||
*/
|
||||
export const getCoordinateDescription = () => {
|
||||
let queryData: GetLocationAddress = {
|
||||
x: RuanseeAbitityStag.appCache.getLocationX() + "",
|
||||
y: RuanseeAbitityStag.appCache.getLocationY() + "",
|
||||
fromIndex: "0",
|
||||
toIndex: "10",
|
||||
maxReturn: '10',
|
||||
geoDecodingRadius: "-1"
|
||||
}
|
||||
return http.get<Array<LocationDescription>>("http://20.90.2.2/mapserver/services/addressMatch-index/restjsr/v1/address/geodecoding.json",
|
||||
queryData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置关注人员手机号吗
|
||||
*/
|
||||
export const addFocusPersonPhone = (jsonData: string) => {
|
||||
return http.postFromJson<BaseResultModel<string>>("focus/addPhone", jsonData)
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加关注人员
|
||||
* @param jsonData json数据
|
||||
*/
|
||||
export const addFocusPerson = (param: Map<string, CustomUnionType>) => {
|
||||
let userData = RuanseeAbitityStag.userCache;
|
||||
let policeEntity = new Map<string, CustomUnionType>();
|
||||
policeEntity.set("userName", userData.getUserName)
|
||||
policeEntity.set("deptId", userData.getDeptCode)
|
||||
policeEntity.set("deptName", userData.getDeptName)
|
||||
policeEntity.set("idCard", userData.getIdCardNum)
|
||||
policeEntity.set("idCardNum", userData.getIdCardNum)
|
||||
policeEntity.set("orgCode", userData.getDeptCode)
|
||||
policeEntity.set("orgName", userData.getDeptName)
|
||||
policeEntity.set("phoneNum", userData.getPhoneNum)
|
||||
policeEntity.set("policeTypeName", "")
|
||||
policeEntity.set("realName", userData.getUserName)
|
||||
param.set("policeEntity", JSONUtil.mapToJsonStr(policeEntity));
|
||||
let json = JSONUtil.mapToJsonStr(param);
|
||||
let paramJson = StringUtils.toJsonParaphrase(json);
|
||||
return http.postFromJson<BaseResultModel<string>>("focus/addToMyFocus", paramJson);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加关注车辆
|
||||
* @param jsonData json数据
|
||||
*/
|
||||
export const addFocusCar = (param: Map<string, CustomUnionType>) => {
|
||||
let userData = RuanseeAbitityStag.userCache;
|
||||
let policeEntity = new Map<string, CustomUnionType>();
|
||||
policeEntity.set("userName", userData.getUserName)
|
||||
policeEntity.set("deptId", userData.getDeptCode)
|
||||
policeEntity.set("deptName", userData.getDeptName)
|
||||
policeEntity.set("idCard", userData.getIdCardNum)
|
||||
policeEntity.set("idCardNum", userData.getIdCardNum)
|
||||
policeEntity.set("orgCode", userData.getDeptCode)
|
||||
policeEntity.set("orgName", userData.getDeptName)
|
||||
policeEntity.set("phoneNum", userData.getPhoneNum)
|
||||
policeEntity.set("policeTypeName", "")
|
||||
policeEntity.set("realName", userData.getUserName)
|
||||
param.set("policeEntity", JSONUtil.mapToJsonStr(policeEntity));
|
||||
let json = JSONUtil.mapToJsonStr(param);
|
||||
let paramJson = StringUtils.toJsonParaphrase(json);
|
||||
return http.postFromJson<BaseResultModel<string>>("focus/addCarToFocus", paramJson);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询车辆关注信息
|
||||
*/
|
||||
export const checkCarFocus = (cjh: string) => {
|
||||
let param: QueryCardFocusModel = {
|
||||
cjh: cjh,
|
||||
policeIdCardNum: RuanseeAbitityStag.userCache.getIdCardNum
|
||||
}
|
||||
return http.postFromBody<BaseResultModel<GetFocusCarData>>("focus/checkCarFocus",param)
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消关注
|
||||
*/
|
||||
export const updateFocus = (idCardNum: string) => {
|
||||
let data: UpdatePersonFocusModel = {
|
||||
focusType: "0",
|
||||
peopleIdCardNum: idCardNum,
|
||||
policeIdCardNum: RuanseeAbitityStag.userCache.getIdCardNum
|
||||
}
|
||||
return http.postFromBody<UploadPhotoModel>("focus/updateFocus", data)
|
||||
}
|
||||
|
||||
//取消车辆关注
|
||||
export const updateCarFocus = (cjh: string) => {
|
||||
let data: UpdateCarFocusModel = {
|
||||
focusType: 0,
|
||||
cjh: cjh,
|
||||
policeIdCardNum: RuanseeAbitityStag.userCache.getIdCardNum
|
||||
}
|
||||
return http.postFromBody<UploadPhotoModel>("focus/updateCarFocus", data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 盘查车辆
|
||||
*/
|
||||
export const queryCheckCar = (carNum: string) => {
|
||||
let queryModel: CheckCarRequestModel = {
|
||||
carNum: carNum,
|
||||
policeXm: RuanseeAbitityStag.userCache.getUserName,
|
||||
policeId: RuanseeAbitityStag.userCache.getUserCode,
|
||||
policeZzjgCode: RuanseeAbitityStag.userCache.getDeptCode,
|
||||
policeZzjgMc: RuanseeAbitityStag.userCache.getDeptName,
|
||||
policeIdCard: RuanseeAbitityStag.userCache.getIdCardNum
|
||||
}
|
||||
// car/checkCar
|
||||
return http.postFromBody<BaseResultModel<CheckCarResultModes>>("car/checkCar", queryModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存车辆数据
|
||||
*/
|
||||
export const saveCarData = (carData: CarData, isCardPoint: boolean) => {
|
||||
// car/saveCarHistoryV3 this.historyId = this.getRandomId();
|
||||
let pointX = ""
|
||||
let pointY = ""
|
||||
let checkAddress = ""
|
||||
if (isCardPoint) {
|
||||
pointX = `${RuanseeAbitityStag.appCache.getCardPointLocationX()}`
|
||||
pointY = `${RuanseeAbitityStag.appCache.getCardPointLocationY()}`
|
||||
checkAddress = RuanseeAbitityStag.appCache.getCardPointAddress
|
||||
} else {
|
||||
pointX = `${RuanseeAbitityStag.appCache.getLocationX()}`
|
||||
pointY = `${RuanseeAbitityStag.appCache.getLocationY()}`
|
||||
checkAddress = RuanseeAbitityStag.appCache.getLocationAddress
|
||||
}
|
||||
|
||||
let param: SaveCarDataRequestModel = {
|
||||
uuid: RuanseeAbitityStag.appCache.getCarId(),
|
||||
historyId: RuanseeAbitityStag.appCache.getHistoryId(),
|
||||
policeId: RuanseeAbitityStag.userCache.getUserCode,
|
||||
policeXm: RuanseeAbitityStag.userCache.getUserName,
|
||||
policeIdCard: RuanseeAbitityStag.userCache.getIdCardNum,
|
||||
policePhone: RuanseeAbitityStag.userCache.getPhoneNum,
|
||||
policeZzjgCode: RuanseeAbitityStag.userCache.getDeptCode,
|
||||
policeZzjgMc: RuanseeAbitityStag.userCache.getDeptName,
|
||||
pointX: pointX,
|
||||
pointY: pointY,
|
||||
checkAddress: checkAddress,
|
||||
jdchphm: carData.hphm,
|
||||
jdcfdjh: carData.fdjh,
|
||||
jdccsys: carData.csys,
|
||||
jdchpzl: carData.hpzl,
|
||||
clsbdh: carData.clsbdh,
|
||||
jdcsyr: carData.jdcsyr,
|
||||
clpp: carData.clpp,
|
||||
sfzh: carData.sfzh,
|
||||
syrstatus: "1",
|
||||
bdqzt: carData.isSelect ? "1" : "0",
|
||||
checkType: "0",
|
||||
checkTime: DateUtils.formatDateStr(new Date(), DateFormat.YYYYhMMhDDkHHdMMdSSdSSS),
|
||||
clxh: carData.clxh
|
||||
}
|
||||
|
||||
return http.postFromBody<string>("car/saveCarHistoryV3", param);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询车辆盘查次数
|
||||
*/
|
||||
export const getCarCount = (hphm: string, cjh: string) => {
|
||||
let param: QueryCarCountRequestModel = {
|
||||
carNum: hphm,
|
||||
clsbdh: cjh
|
||||
}
|
||||
return http.postFromBody<BaseResultModel<number>>("car/countCar", param)
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据主ID查询人员列表(随行人员/选择移交人员)
|
||||
*/
|
||||
export const getPersonListByMainId = (pageNum: number, pageSize?: number,mainId?:string) => {
|
||||
let param: GetPersonListModel = {
|
||||
mainId: StringUtils.get(mainId,RuanseeAbitityStag.appCache.getHistoryId()),
|
||||
pageNum: pageNum,
|
||||
pageSize: pageSize ? pageSize : 20
|
||||
}
|
||||
return http.postFromBody<BaseResultModel<PageModel<AccompanPersonBean>>>("person/getPersonListByMainId", param)
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存主记录
|
||||
* Json
|
||||
*/
|
||||
export const saveMainHistoryAndChangeStatus = (model: CheckSubmitModel) => {
|
||||
return http.post<BaseResultModel<string>>("main/saveMainHistoryAndChangeStatus", model
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取任务
|
||||
*/
|
||||
export const getTaskList = (searchTaskName ="", pageNum: number,nowTime?:string) => {
|
||||
let param: RequestTaskModel = {
|
||||
nowTime: StringUtils.get(nowTime,""),
|
||||
orgCode: RuanseeAbitityStag.userCache.getDeptCode,
|
||||
taskName: searchTaskName,
|
||||
pageNum: pageNum + "",
|
||||
pageSize: "30"
|
||||
}
|
||||
return http.postFromBody<BaseResultModel<Array<TaskModel>>>("task/getTaskByOrgCode", param);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取卡点
|
||||
*/
|
||||
export const getCardPointList = (taskId: string) => {
|
||||
let param: QueryCardPointModel = {
|
||||
taskId: taskId,
|
||||
orgCode: RuanseeAbitityStag.userCache.getDeptCode
|
||||
}
|
||||
return http.postFromBody<BaseResultModel<Array<CardPointModel>>>("task/getStuckByTaskId", param)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取关注人员
|
||||
*/
|
||||
export const getMyFocusPersonList = (pageNum: number) => {
|
||||
let param: GetFocusListModel = {
|
||||
pageNum: "" + pageNum,
|
||||
pageSize: "30",
|
||||
policeIdCardNum: RuanseeAbitityStag.userCache.getIdCardNum
|
||||
}
|
||||
return http.postFromBody<BaseResultModel<PageModel<FocusPersonBean>>>("focus/getMyFocusList", param)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取关注车辆
|
||||
*/
|
||||
export const getMyFocusCaraList = (pageNum: number) => {
|
||||
let param: GetFocusListModel = {
|
||||
pageNum: "" + pageNum,
|
||||
pageSize: "30",
|
||||
policeIdCardNum: RuanseeAbitityStag.userCache.getIdCardNum
|
||||
}
|
||||
return http.postFromBody<BaseResultModel<PageModel<FocusCarBean>>>("focus/getMyFocusCarList", param)
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送物品数据到后台
|
||||
*/
|
||||
export const saveGoodsData = (goodsJson: string) => {
|
||||
let param = `{"thingsList":${goodsJson}}`
|
||||
return http.postFromJson<string>("things/insertThingsBatch", param)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取组织机构
|
||||
*/
|
||||
export const getDeptChile = (deptId: string, updateTime: string) => {
|
||||
let param: GetDeptChile = {
|
||||
deptId: deptId,
|
||||
updateTime: updateTime
|
||||
}
|
||||
return http.postFromBody<BaseResultModel<Array<DeptTableEntity>>>("dept/getDeptChild", param)
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存处置措施
|
||||
*/
|
||||
export const saveCzcs = (value: string) => {
|
||||
//person/saveCzcs
|
||||
let param = `{"uuid":"${RuanseeAbitityStag.appCache.getPeopleId()}","czcs":"${value}"}`
|
||||
return http.postFromJson<BaseResultModel<string>>("person/saveCzcs", param)
|
||||
}
|
||||
|
||||
//人像比对
|
||||
export const comparisonFace=(data?:PeopleFaceRequestModel)=>{
|
||||
// return http.post<string>("http://20.90.2.2/st_1n_new_out/engine/api-wrapper/v1/face/search_image_in_dbs",data)
|
||||
return http.post<BaseResultModel<PeopleFaceResultModel>>("http://20.90.2.2/st_1n_new_out/artemis/api/ctm01iaconv/v1/iface/identityConfirm",data,
|
||||
new AxiosHeaders({
|
||||
"id_card":UserCache.getUserCache().getIdCardNum,
|
||||
"fizz-appid":"34001",
|
||||
"fizz-sign":"43bd0e9821c04d309e39e61faf8fd21a"
|
||||
}))
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取人员盘查记录
|
||||
*/
|
||||
export const getCheckPeopleRecord = (requestMode: RequestCheckPeopleRecordModel)=>{
|
||||
return http.postFromBody<BaseResultModel<PageModel<CheckPeopleRecordItem>>>("person/getPersonListByIdCardNum",requestMode)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车辆盘查记录
|
||||
*/
|
||||
export const getCheckCarRecord = (requestMode: RequestCheckCarRecordModel)=>{
|
||||
return http.postFromBody<BaseResultModel<Array<CheckPeopleRecordItem>>>("car/getCheckedCarList",requestMode)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询盘查主记录
|
||||
*/
|
||||
export const queryMainRecordList = (type:number,taskId:string,pageNum: number,beginTime: string,endTime: string,sfz?:string)=>{
|
||||
let param : QueryMainHistoryRecordModel= {
|
||||
policeIdCard: RuanseeAbitityStag.userCache.getIdCardNum,
|
||||
type: type,
|
||||
pageNum: pageNum,
|
||||
pageSize: "20",
|
||||
taskId: taskId,
|
||||
startTime: beginTime,
|
||||
beginTime: beginTime,
|
||||
endTime: endTime,
|
||||
sfz:StringUtils.get(sfz,"")
|
||||
}
|
||||
return http.postFromBody<BaseResultModel<PageModel<MainRecordResultModel>>>("main/getMainHistoryList",param)
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据主ID 查询车辆记录
|
||||
*/
|
||||
export const getCarHistoryByMainId = (mainId?:string)=>{
|
||||
let param :QueryCarRecordByMainModel={
|
||||
historyId:StringUtils.get(mainId,RuanseeAbitityStag.appCache.getHistoryId())
|
||||
}
|
||||
return http.postFromBody<BaseResultModel<Array<CarRecordItem>>>("car/getCarListByHistoryId",param);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据主ID 查询物品记录
|
||||
*/
|
||||
export const getGoodsHistoryByMainId = (mainId?:string)=>{
|
||||
let param :QueryCarRecordByMainModel={
|
||||
historyId:StringUtils.get(mainId,RuanseeAbitityStag.appCache.getHistoryId())
|
||||
}
|
||||
return http.postFromBody<BaseResultModel<Array<GoodsBean>>>("things/getListByHistoryId",param);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
|
||||
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
|
||||
|
||||
export interface ResultPageModel<T> {
|
||||
msg: string;
|
||||
code: number;
|
||||
count2: number;
|
||||
page: T;
|
||||
data:T;
|
||||
row:T
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
|
||||
export interface UserInfoModel{
|
||||
"userName": string;
|
||||
"realName": string;
|
||||
"orgName": string;
|
||||
"orgCode": string;
|
||||
"idCardNum": string;
|
||||
"ip": string;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
|
||||
export const cardRoundBorderStyle :BorderOptions={
|
||||
|
||||
width:$r('app.float.default_1'),
|
||||
color:$r('app.color.white'),
|
||||
radius:$r('app.float.default_5')
|
||||
|
||||
}
|
||||
|
||||
|
||||
export const cardRoundBorderGreyStyle :BorderOptions={
|
||||
width:$r('app.float.default_1'),
|
||||
color:$r('app.color.colorGrey2'),
|
||||
radius:$r('app.float.default_5')
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,159 @@
|
|||
import { LitheRefresh, RefreshController } from "@abner/lithe_refresh";
|
||||
import { AxiosError } from "@ohos/axios";
|
||||
import { ToastUtil } from "@pura/harmony-utils";
|
||||
import AppConstants from "../../app/AppConstant";
|
||||
import { CarRecordItem } from "../../model/resultModel/CheckCarResultModel";
|
||||
import { SkipCarCountParam } from "../../model/uiModel/PageParamModel";
|
||||
import { getCarHistoryByMainId } from "../../request/api/Api";
|
||||
import { getCarStatusIcon } from "../../util/StatusIconUtils";
|
||||
import { StringUtils } from "../../util/StringUtils";
|
||||
import { router } from "@kit.ArkUI";
|
||||
|
||||
@Preview({
|
||||
title: 'ContentTable'
|
||||
})
|
||||
@Component
|
||||
export struct CarListFragment {
|
||||
@State mainId :string = ""
|
||||
@State carList:Array<CarRecordItem> = []
|
||||
controller: RefreshController = new RefreshController()
|
||||
scroller: Scroller = new Scroller()
|
||||
|
||||
aboutToAppear(): void {
|
||||
setTimeout(()=>{
|
||||
this.controller.isAutoRefresh = true
|
||||
},300)
|
||||
}
|
||||
|
||||
build() {
|
||||
Column(){
|
||||
LitheRefresh({
|
||||
scroller: this.scroller,
|
||||
controller: this.controller,
|
||||
enableLoadMore:false,
|
||||
itemLayout: () => {
|
||||
this.listView()
|
||||
},
|
||||
onRefresh: () => {
|
||||
this.getRecordListData()
|
||||
}
|
||||
})
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.layoutWeight(1)
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height(AppConstants.PERCENTAGE_MAX)
|
||||
}
|
||||
|
||||
getRecordListData() {
|
||||
getCarHistoryByMainId(this.mainId)
|
||||
.then((res) => {
|
||||
this.controller.finishRefresh()
|
||||
if(res.code == 200){
|
||||
let data = res.data;
|
||||
if (data) {
|
||||
this.carList = data;
|
||||
}else {
|
||||
ToastUtil.showToast(StringUtils.get(res.msg,"未查询到车辆!"))
|
||||
}
|
||||
}else {
|
||||
ToastUtil.showToast(StringUtils.get(res.msg,"查询失败!"))
|
||||
}
|
||||
})
|
||||
.catch((err:AxiosError) => {
|
||||
this.controller.finishRefresh()
|
||||
ToastUtil.showShort(err.message)
|
||||
})
|
||||
}
|
||||
|
||||
@Builder
|
||||
listView() {
|
||||
List({ scroller: this.scroller}) {
|
||||
ForEach(this.carList, (item: CarRecordItem) => {
|
||||
ListItem() {
|
||||
this.itemView(item)
|
||||
}
|
||||
.onClick(() => {
|
||||
let param :SkipCarCountParam = {
|
||||
what: 0,
|
||||
carNum: StringUtils.get(item.carNum, ""),
|
||||
carZL: StringUtils.get(item.jdchpzl, ""),
|
||||
carPP: StringUtils.get(item.pinpai, ""),
|
||||
carJH: StringUtils.get(item.clsbdh, ""),
|
||||
carFDJH: StringUtils.get(item.fdjh, ""),
|
||||
carSYR: StringUtils.get(item.clsyr, ""),
|
||||
idCardNum: StringUtils.get(item.syrzjhm, ""),
|
||||
carYs: StringUtils.get(item.color, ""),
|
||||
carStatus: StringUtils.get(item.carStatus, "")
|
||||
}
|
||||
router.pushUrl({url:"ui/pages/CarCheckDetailsPages",params:param})
|
||||
})
|
||||
})
|
||||
}
|
||||
.divider({
|
||||
strokeWidth: $r('app.float.default_1'),
|
||||
color: $r('app.color.colorGrey2'),
|
||||
startMargin:$r('app.float.default_63')
|
||||
})
|
||||
.listDirection(Axis.Vertical)
|
||||
.scrollBar(BarState.Off)
|
||||
.edgeEffect(EdgeEffect.None)
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.layoutWeight(1)
|
||||
.nestedScroll({
|
||||
scrollForward: NestedScrollMode.PARENT_FIRST,
|
||||
scrollBackward: NestedScrollMode.PARENT_FIRST
|
||||
})
|
||||
}
|
||||
|
||||
@Builder
|
||||
itemView(item: CarRecordItem) {
|
||||
Row() {
|
||||
Image(getCarStatusIcon(item.carStatus))
|
||||
.width($r('app.float.default_43'))
|
||||
.height($r('app.float.default_43'))
|
||||
.margin({ left: $r('app.float.default_10'), right: $r('app.float.default_10') })
|
||||
|
||||
Column() {
|
||||
Row() {
|
||||
Text(item.carNum)
|
||||
.fontSize($r('app.float.default_16'))
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
Text(item.status== "1" ? "移交" : "通过")
|
||||
.fontColor(item.status == "1" ? $r('app.color.colorYellow7') : $r('app.color.colorBluen7'))
|
||||
.backgroundColor(item.status == "1" ? $r('app.color.colorYellow2') : $r('app.color.colorBluen2'))
|
||||
.fontSize($r('app.float.text_size_12'))
|
||||
.border({
|
||||
width: $r('app.float.default_1'),
|
||||
color: item.status == "1" ? $r('app.color.colorYellow6') : $r('app.color.colorBluen6'),
|
||||
radius: $r('app.float.default_20'),
|
||||
})
|
||||
.padding({
|
||||
left: $r('app.float.default_8'),
|
||||
right: $r('app.float.default_8'),
|
||||
top: $r('app.float.default_2'),
|
||||
bottom: $r('app.float.default_2')
|
||||
})
|
||||
.textAlign(TextAlign.Center)
|
||||
.margin({ left: $r('app.float.default_5') })
|
||||
|
||||
}
|
||||
.width('95%')
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.justifyContent(FlexAlign.Start)
|
||||
|
||||
Text(item.pinpai)
|
||||
.fontSize($r('app.float.default_14'))
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.margin({ top: $r('app.float.default_5') })
|
||||
}
|
||||
.layoutWeight(1)
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
}
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.height($r('app.float.default_60'))
|
||||
.padding({ top: $r('app.float.default_8'), bottom: $r('app.float.default_8') })
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,502 @@
|
|||
import { LitheRefresh, RefreshController } from "@abner/lithe_refresh";
|
||||
import { AxiosError } from "@ohos/axios";
|
||||
import { StrUtil, ToastUtil } from "@pura/harmony-utils";
|
||||
import AppConstants from "../../app/AppConstant";
|
||||
import { MainRecordResultModel } from "../../model/resultModel/MainResultModel";
|
||||
import { ErrorOfEmptyModel } from "../../model/uiModel/BeanModel";
|
||||
import { SkipHistoryDetailsParam } from "../../model/uiModel/PageParamModel";
|
||||
import { queryMainRecordList } from "../../request/api/Api";
|
||||
import { cardRoundBorderGreyStyle, cardRoundBorderStyle } from "../../style/BorderStyle";
|
||||
import { StringUtils } from "../../util/StringUtils";
|
||||
import { ToastUtils } from "../../util/ToasUtils";
|
||||
import { router } from "@kit.ArkUI";
|
||||
import { common } from "@kit.AbilityKit";
|
||||
import { SelectTaskObservedModel } from "../../model/uiModel/SelectTask";
|
||||
import { DateUtils } from "../../util/DateUtils";
|
||||
|
||||
/*
|
||||
* 卡点核录记录 街面盘查
|
||||
*/
|
||||
@Preview({
|
||||
title: 'ContentTable'
|
||||
})
|
||||
@Component
|
||||
export struct CheckPointHistoryFragment {
|
||||
// @State selectValue:Array<string> = []
|
||||
@State taskName: string | undefined = undefined
|
||||
@State taskId: string | undefined = undefined
|
||||
@State beginTime: string | undefined = undefined
|
||||
@State endTime: string | undefined = undefined
|
||||
@State recordDescription: string = "共搜索到 0 条"
|
||||
@State recordList: Array<MainRecordResultModel> = [];
|
||||
controller: RefreshController = new RefreshController()
|
||||
scroller: Scroller = new Scroller()
|
||||
total: number = 0;
|
||||
pageNum: number = 1;
|
||||
isRefreshStatus: number = 0;
|
||||
|
||||
aboutToAppear(): void {
|
||||
// this.selectValue.push("任务名称")
|
||||
// this.selectValue.push("人员信息")
|
||||
// this.selectValue.push("车辆信息")
|
||||
// this.selectValue.push("物品类型")
|
||||
|
||||
let context = getContext(this) as common.UIAbilityContext;
|
||||
context.eventHub.on("select_task", (data: SelectTaskObservedModel) => {
|
||||
if (data) {
|
||||
this.taskName = data.taskName
|
||||
this.taskId = data.taskId
|
||||
}
|
||||
})
|
||||
setTimeout(() => {
|
||||
this.controller.isAutoRefresh = true
|
||||
}, 300)
|
||||
}
|
||||
|
||||
aboutToDisappear(): void {
|
||||
let context = getContext(this) as common.UIAbilityContext;
|
||||
context.eventHub.off("select_task")
|
||||
}
|
||||
|
||||
getRecordListData() {
|
||||
queryMainRecordList(1, StringUtils.get(this.taskId, ""), this.pageNum, StringUtils.get(this.beginTime, ""," 00:00:00"),
|
||||
StringUtils.get(this.endTime, ""," 23:59:59"))
|
||||
.then((res) => {
|
||||
console.debug("查询主记录列表成功", JSON.stringify(res))
|
||||
if (res.code == 200) {
|
||||
let data = res.data;
|
||||
if (data) {
|
||||
this.total = data.total;
|
||||
this.recordDescription = `共搜索到 ${data.total} 条`
|
||||
let list = data.rows
|
||||
if (list) {
|
||||
if (this.isRefreshStatus == 1) {
|
||||
this.isRefreshStatus = 0
|
||||
this.recordList = new Array;
|
||||
this.controller.finishRefresh()
|
||||
}
|
||||
if (this.isRefreshStatus = 2) {
|
||||
this.isRefreshStatus = 0
|
||||
this.controller.finishLoadMore()
|
||||
}
|
||||
list.forEach((item) => {
|
||||
this.recordList.push(item)
|
||||
})
|
||||
if (this.pageNum * 20 >= this.total) {
|
||||
this.controller.closeLoadMore = true
|
||||
}
|
||||
} else {
|
||||
this.handlerErrorOrEmpty(new ErrorOfEmptyModel(0, "没有数据!"))
|
||||
}
|
||||
} else {
|
||||
this.handlerErrorOrEmpty(new ErrorOfEmptyModel(0, "没有数据!"))
|
||||
}
|
||||
} else {
|
||||
this.handlerErrorOrEmpty(new ErrorOfEmptyModel(-1, StringUtils.get(res.msg, "获取失败!")));
|
||||
}
|
||||
})
|
||||
.catch((e: AxiosError) => {
|
||||
console.debug("查询主记录列表失败", e.message)
|
||||
this.handlerErrorOrEmpty(new ErrorOfEmptyModel(-1, e.message));
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
handlerErrorOrEmpty(model: ErrorOfEmptyModel) {
|
||||
ToastUtils.toastBottom(model.msg)
|
||||
if (this.isRefreshStatus == 1) {
|
||||
//刷新
|
||||
this.controller.finishRefresh()
|
||||
this.recordList = new Array
|
||||
}
|
||||
if (this.isRefreshStatus == 2) {
|
||||
//加载
|
||||
this.controller.finishLoadMore()
|
||||
}
|
||||
this.isRefreshStatus = 0
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 时间选择
|
||||
* @param type startTime/endTime
|
||||
*/
|
||||
showTimePicker(type: string) {
|
||||
let currentTime = new Date()
|
||||
if (type == 'startTime') {
|
||||
let start = DateUtils.pastStrDate(this.beginTime);
|
||||
currentTime = start == null ? new Date() : start
|
||||
|
||||
}
|
||||
if (type == 'endTime') {
|
||||
let end = DateUtils.pastStrDate(this.endTime);
|
||||
currentTime = end == null ? new Date() : end
|
||||
}
|
||||
|
||||
DatePickerDialog.show({
|
||||
start: new Date('2020-1-1'),
|
||||
end: new Date('2030-12-31'),
|
||||
selected: currentTime,
|
||||
lunar: false, // 是否显示农历
|
||||
showTime: false, // 是否显示时间
|
||||
onAccept: (value: DatePickerResult) => {
|
||||
let month = (value.month? value.month : 0)+1
|
||||
let data = value.year + '-' + DateUtils.padZero(month) + '-' + DateUtils.padZero(value.day)
|
||||
if (type == 'startTime') {
|
||||
this.beginTime = data
|
||||
}
|
||||
if (type == 'endTime') {
|
||||
this.endTime = data
|
||||
}
|
||||
console.info('确认日期:', value.toString());
|
||||
},
|
||||
onCancel: () => {
|
||||
console.info('用户取消选择');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
this.searchContent()
|
||||
|
||||
Text(this.recordDescription)
|
||||
.fontSize($r('app.float.text_size_12'))
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.textAlign(TextAlign.Center)
|
||||
|
||||
LitheRefresh({
|
||||
scroller: this.scroller,
|
||||
controller: this.controller,
|
||||
itemLayout: () => {
|
||||
this.listView()
|
||||
},
|
||||
onRefresh: () => {
|
||||
this.controller.closeLoadMore = false;
|
||||
this.pageNum = 1;
|
||||
this.isRefreshStatus = 1;
|
||||
this.getRecordListData()
|
||||
},
|
||||
onLoadMore: () => {
|
||||
if (this.pageNum * 30 >= this.total) {
|
||||
this.controller.finishLoadMore()
|
||||
this.controller.closeLoadMore = true;
|
||||
ToastUtil.showToast("没有更多数据!")
|
||||
return
|
||||
}
|
||||
this.pageNum++;
|
||||
this.isRefreshStatus = 2;
|
||||
this.getRecordListData()
|
||||
}
|
||||
})
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.layoutWeight(1)
|
||||
}
|
||||
.backgroundColor($r('app.color.page_background'))
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height(AppConstants.PERCENTAGE_MAX)
|
||||
}
|
||||
|
||||
@Builder
|
||||
searchContent() {
|
||||
Column() {
|
||||
Row() {
|
||||
Text('任务名称:')
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.height($r('app.float.default_40'))
|
||||
.margin({
|
||||
left: $r('app.float.default_10'),
|
||||
top: $r('app.float.default_10')
|
||||
})
|
||||
.textAlign(TextAlign.Center);
|
||||
|
||||
Text(StringUtils.get(this.taskName, "请选择任务"))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.fontColor(this.taskName ? $r('app.color.colorGrey8') : $r('app.color.colorGrey6'))
|
||||
.margin({
|
||||
right: $r('app.float.default_10'),
|
||||
top: $r('app.float.default_10')
|
||||
})
|
||||
.padding({
|
||||
left: $r('app.float.default_5'),
|
||||
right: $r('app.float.default_5'),
|
||||
})
|
||||
.height($r('app.float.default_40'))
|
||||
.layoutWeight(1)
|
||||
.width($r('app.float.default_88'))
|
||||
.textAlign(TextAlign.Start)
|
||||
.border(cardRoundBorderGreyStyle)
|
||||
.onClick(() => {
|
||||
router.pushUrl({ url: "ui/pages/SelectTaskListPage" })
|
||||
})
|
||||
|
||||
}
|
||||
.width('95%')
|
||||
.margin({
|
||||
left: $r('app.float.default_10'),
|
||||
right: $r('app.float.default_10'),
|
||||
top: $r('app.float.default_10')
|
||||
});
|
||||
|
||||
Row() {
|
||||
Row() {
|
||||
Text(StringUtils.get(this.beginTime, "开始时间"))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.fontColor(this.beginTime ? $r('app.color.colorGrey8') : $r('app.color.colorGrey6'))
|
||||
.margin({
|
||||
right: $r('app.float.default_5'),
|
||||
})
|
||||
.height($r('app.float.default_40'))
|
||||
.layoutWeight(1)
|
||||
.padding({
|
||||
left: $r('app.float.default_5'),
|
||||
right: $r('app.float.default_5'),
|
||||
})
|
||||
.width($r('app.float.default_88'))
|
||||
.textAlign(TextAlign.Start);
|
||||
|
||||
Image($r('app.media.log_rl'))
|
||||
.width($r('app.float.default_20'))
|
||||
.height($r('app.float.default_20'));
|
||||
}
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.layoutWeight(1)
|
||||
.onClick(() => {
|
||||
this.showTimePicker('startTime')
|
||||
})
|
||||
|
||||
Divider()
|
||||
.width($r('app.float.default_1'))
|
||||
.height($r('app.float.default_40'))
|
||||
.backgroundColor($r('app.color.colorGrey2'))
|
||||
.margin({
|
||||
right: $r('app.float.default_5'),
|
||||
left: $r('app.float.default_5')
|
||||
});
|
||||
|
||||
Row() {
|
||||
Text(StringUtils.get(this.endTime, "结束时间"))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.fontColor(this.endTime ? $r('app.color.colorGrey8') : $r('app.color.colorGrey6'))
|
||||
.margin({
|
||||
right: $r('app.float.default_5'),
|
||||
})
|
||||
.height($r('app.float.default_40'))
|
||||
.layoutWeight(1)
|
||||
.padding({
|
||||
left: $r('app.float.default_5'),
|
||||
right: $r('app.float.default_5'),
|
||||
})
|
||||
.width($r('app.float.default_88'))
|
||||
.textAlign(TextAlign.Start);
|
||||
|
||||
Image($r('app.media.log_rl'))
|
||||
.width($r('app.float.default_20'))
|
||||
.height($r('app.float.default_20'))
|
||||
.margin({
|
||||
right: $r('app.float.default_5'),
|
||||
});
|
||||
}
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.layoutWeight(1)
|
||||
.onClick(() => {
|
||||
this.showTimePicker('endTime')
|
||||
})
|
||||
|
||||
}
|
||||
.border(cardRoundBorderGreyStyle)
|
||||
.width('95%')
|
||||
.margin({
|
||||
left: $r('app.float.default_5'),
|
||||
right: $r('app.float.default_5'),
|
||||
})
|
||||
.margin($r('app.float.default_10'));
|
||||
|
||||
Button("搜索", { type: ButtonType.Normal, stateEffect: true })
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.fontColor($r('app.color.white'))
|
||||
.backgroundColor($r('app.color.bull'))
|
||||
.borderRadius(8)
|
||||
.margin({
|
||||
left: $r('app.float.default_10'),
|
||||
right: $r('app.float.default_10'),
|
||||
bottom: $r('app.float.default_10'),
|
||||
})
|
||||
.onClick(() => {
|
||||
this.controller.isAutoRefresh = true
|
||||
})
|
||||
.width('95%');
|
||||
}
|
||||
.width('95%')
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.border(cardRoundBorderStyle)
|
||||
.margin($r('app.float.default_10'))
|
||||
}
|
||||
|
||||
@Builder
|
||||
listView() {
|
||||
List({ scroller: this.scroller }) {
|
||||
ForEach(this.recordList, (item: MainRecordResultModel, index) => {
|
||||
ListItem() {
|
||||
this.itemView(item)
|
||||
}
|
||||
.onClick(() => {
|
||||
let param: SkipHistoryDetailsParam = {
|
||||
pctime: item.checkTime,
|
||||
policenum: item.policeName,
|
||||
policename: item.policeName,
|
||||
pcyy: item.checkReason,
|
||||
yjdw: item.yjdwmc,
|
||||
mainId: item.mainId,
|
||||
status: item.status,
|
||||
address: item.checkAddress,
|
||||
taskName: item.taskName,
|
||||
type: 1
|
||||
}
|
||||
router.pushUrl({ url: "ui/pages/HistoryDetailsPage", params: param })
|
||||
})
|
||||
})
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.layoutWeight(1)
|
||||
.listDirection(Axis.Vertical)
|
||||
.scrollBar(BarState.Off)
|
||||
.edgeEffect(EdgeEffect.None)
|
||||
.nestedScroll({
|
||||
scrollForward: NestedScrollMode.PARENT_FIRST,
|
||||
scrollBackward: NestedScrollMode.PARENT_FIRST
|
||||
})
|
||||
}
|
||||
|
||||
@Builder
|
||||
itemView(item: MainRecordResultModel) {
|
||||
Column() {
|
||||
Row() {
|
||||
Text("时间:")
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
|
||||
Text(item.checkTime)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.margin({ left: $r('app.float.default_5') })
|
||||
|
||||
Text(item.status == 1 ? "移交" : "通过")
|
||||
.fontColor(item.status == 1 ? $r('app.color.colorYellow7') : $r('app.color.colorBluen7'))
|
||||
.backgroundColor(item.status == 1 ? $r('app.color.colorYellow2') : $r('app.color.colorBluen2'))
|
||||
.fontSize($r('app.float.text_size_12'))
|
||||
.border({
|
||||
width: $r('app.float.default_1'),
|
||||
color: item.status == 1 ? $r('app.color.colorYellow6') : $r('app.color.colorBluen6'),
|
||||
radius: $r('app.float.default_20'),
|
||||
})
|
||||
.padding({
|
||||
left: $r('app.float.default_8'),
|
||||
right: $r('app.float.default_8'),
|
||||
top: $r('app.float.default_2'),
|
||||
bottom: $r('app.float.default_2')
|
||||
})
|
||||
.textAlign(TextAlign.Center)
|
||||
.margin({ left: $r('app.float.default_5') })
|
||||
|
||||
}
|
||||
.width('95%')
|
||||
|
||||
Row() {
|
||||
Text("任务:")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
Text(item.taskName)
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
}
|
||||
.width('95%')
|
||||
.margin({ top: $r('app.float.default_5') })
|
||||
|
||||
Row() {
|
||||
Text("地址:")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
Text(item.checkAddress)
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
}
|
||||
.width('95%')
|
||||
.margin({ top: $r('app.float.default_5') })
|
||||
|
||||
Row() {
|
||||
Column() {
|
||||
Text("总人数/异常数")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
Row() {
|
||||
Text(StringUtils.get(item.peopleCount, "0", "人"))
|
||||
.fontColor($r('app.color.bull'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
Text("/")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
Text(StringUtils.get(item.unusualPeopleCount, "0", "人"))
|
||||
.fontColor($r('app.color.colorYellow8'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
}
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.margin({ top: $r('app.float.default_5') })
|
||||
}
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.height($r('app.float.default_52'))
|
||||
.layoutWeight(1)
|
||||
.border(cardRoundBorderGreyStyle)
|
||||
|
||||
Column() {
|
||||
Text("车牌")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
|
||||
Text(StringUtils.get(item.carNum, "-"))
|
||||
.fontColor(item.unusualCarCount == "0" ? $r('app.color.bull') : $r('app.color.colorYellow7'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.margin({ top: $r('app.float.default_5') })
|
||||
|
||||
}
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.height($r('app.float.default_52'))
|
||||
.layoutWeight(1)
|
||||
.border(cardRoundBorderGreyStyle)
|
||||
.margin({ left: $r('app.float.default_5'), right: $r('app.float.default_5') })
|
||||
|
||||
Column() {
|
||||
Text("物品")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
|
||||
Text(this.getGoodCount(item.goodsCount))
|
||||
.fontColor($r('app.color.bull'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.margin({ top: $r('app.float.default_5') })
|
||||
}
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.height($r('app.float.default_52'))
|
||||
.layoutWeight(1)
|
||||
.border(cardRoundBorderGreyStyle)
|
||||
|
||||
}
|
||||
.width('95%')
|
||||
.margin({ top: $r('app.float.default_5') })
|
||||
}
|
||||
.width('95%')
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.border(cardRoundBorderStyle)
|
||||
.padding($r('app.float.default_10'))
|
||||
.margin($r('app.float.default_10'))
|
||||
}
|
||||
|
||||
getGoodCount(goodsCount: string): string {
|
||||
let count = StringUtils.get(goodsCount, "-")
|
||||
if (count == "0") {
|
||||
return "-"
|
||||
}
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,168 @@
|
|||
import { LitheRefresh, RefreshController } from "@abner/lithe_refresh"
|
||||
import { AxiosError } from "@ohos/axios"
|
||||
import { ToastUtil } from "@pura/harmony-utils"
|
||||
import AppConstants from "../../app/AppConstant"
|
||||
import { RuanseeAbitityStag } from "../../app/RuanseeAbitityStag"
|
||||
import { GoodsBean } from "../../model/uiModel/GoodsModel"
|
||||
import { getGoodsHistoryByMainId } from "../../request/api/Api"
|
||||
import { StringUtils } from "../../util/StringUtils"
|
||||
|
||||
@Preview({
|
||||
title: 'ContentTable'
|
||||
})
|
||||
@Component
|
||||
export struct GoodsListFragment {
|
||||
@State mainId :string = ""
|
||||
@State isYj:boolean = false
|
||||
controller: RefreshController = new RefreshController()
|
||||
scroller: Scroller = new Scroller()
|
||||
@State goodsList:Array<GoodsBean> = []
|
||||
|
||||
aboutToAppear(): void {
|
||||
setTimeout(()=>{
|
||||
this.controller.isAutoRefresh = true
|
||||
},300)
|
||||
}
|
||||
|
||||
getRecordListData() {
|
||||
getGoodsHistoryByMainId(this.mainId)
|
||||
.then(res => {
|
||||
this.controller.finishRefresh()
|
||||
if (res.code == 200) {
|
||||
let data = res.data
|
||||
if (data) {
|
||||
this.goodsList = new Array
|
||||
data.forEach((item)=>{
|
||||
item.isYj = this.isYj
|
||||
this.goodsList.push(item)
|
||||
})
|
||||
}else {
|
||||
ToastUtil.showToast(StringUtils.get(res.msg,"未查询到物品!"))
|
||||
}
|
||||
}else {
|
||||
ToastUtil.showToast(`查询物品失败${StringUtils.get(res.msg,"")}`)
|
||||
}
|
||||
})
|
||||
.catch((err:AxiosError) => {
|
||||
this.controller.finishRefresh()
|
||||
ToastUtil.showToast(`查询物品失败${err.message}`)
|
||||
})
|
||||
}
|
||||
|
||||
build() {
|
||||
Column(){
|
||||
LitheRefresh({
|
||||
scroller: this.scroller,
|
||||
controller: this.controller,
|
||||
enableLoadMore:false,
|
||||
itemLayout: () => {
|
||||
this.listView()
|
||||
},
|
||||
onRefresh: () => {
|
||||
this.getRecordListData()
|
||||
}
|
||||
})
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.layoutWeight(1)
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height(AppConstants.PERCENTAGE_MAX)
|
||||
}
|
||||
|
||||
|
||||
@Builder
|
||||
listView() {
|
||||
List({ scroller: this.scroller}) {
|
||||
ForEach(this.goodsList, (item: GoodsBean) => {
|
||||
ListItem() {
|
||||
this.itemView(item)
|
||||
}
|
||||
.onClick(() => {
|
||||
|
||||
})
|
||||
})
|
||||
}
|
||||
.divider({
|
||||
strokeWidth: $r('app.float.default_1'),
|
||||
color: $r('app.color.colorGrey2'),
|
||||
startMargin:$r('app.float.default_63')
|
||||
})
|
||||
.listDirection(Axis.Vertical)
|
||||
.scrollBar(BarState.Off)
|
||||
.edgeEffect(EdgeEffect.None)
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.layoutWeight(1)
|
||||
.nestedScroll({
|
||||
scrollForward: NestedScrollMode.PARENT_FIRST,
|
||||
scrollBackward: NestedScrollMode.PARENT_FIRST
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
//http://53.1.214.228:9000/ypc/2025/09/25/dd809f10a803450986480b3a50acfa84.jpg
|
||||
@Builder
|
||||
itemView(item: GoodsBean) {
|
||||
Row() {
|
||||
Image(RuanseeAbitityStag.appCache.convertPhotoUrl(item.photoUrl))
|
||||
.width($r('app.float.default_43'))
|
||||
.height($r('app.float.default_43'))
|
||||
.margin({ left: $r('app.float.default_10'), right: $r('app.float.default_10') })
|
||||
|
||||
Column() {
|
||||
Row() {
|
||||
Text(item.name)
|
||||
.fontSize($r('app.float.default_16'))
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
|
||||
Text(String(item.count))
|
||||
.fontSize($r('app.float.default_16'))
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.margin({ left: $r('app.float.default_5') ,right: $r('app.float.default_5')})
|
||||
|
||||
Text(item.unit)
|
||||
.fontSize($r('app.float.default_16'))
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
Text(item.isYj ? "移交" : "通过")
|
||||
.fontColor(item.isYj ? $r('app.color.colorYellow7') : $r('app.color.colorBluen7'))
|
||||
.backgroundColor(item.isYj ? $r('app.color.colorYellow2') : $r('app.color.colorBluen2'))
|
||||
.fontSize($r('app.float.text_size_12'))
|
||||
.border({
|
||||
width: $r('app.float.default_1'),
|
||||
color: item.isYj? $r('app.color.colorYellow6') : $r('app.color.colorBluen6'),
|
||||
radius: $r('app.float.default_20'),
|
||||
})
|
||||
.padding({
|
||||
left: $r('app.float.default_8'),
|
||||
right: $r('app.float.default_8'),
|
||||
top: $r('app.float.default_2'),
|
||||
bottom: $r('app.float.default_2')
|
||||
})
|
||||
.textAlign(TextAlign.Center)
|
||||
.margin({ left: $r('app.float.default_5') })
|
||||
|
||||
}
|
||||
.width('95%')
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.justifyContent(FlexAlign.Start)
|
||||
|
||||
Text(item.remark)
|
||||
.fontSize($r('app.float.default_14'))
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.visibility(item.remark ? Visibility.Visible : Visibility.None)
|
||||
.margin({ top: $r('app.float.default_5') })
|
||||
|
||||
Text(item.checkTime)
|
||||
.fontSize($r('app.float.default_14'))
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.margin({ top: $r('app.float.default_5') })
|
||||
}
|
||||
.layoutWeight(1)
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
}
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.height($r('app.float.default_72'))
|
||||
.padding({ top: $r('app.float.default_8'), bottom: $r('app.float.default_8') })
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,311 @@
|
|||
import { LitheRefresh, RefreshController } from "@abner/lithe_refresh";
|
||||
import { AxiosError } from "@ohos/axios";
|
||||
import { ToastUtil } from "@pura/harmony-utils";
|
||||
import AppConstants from "../../app/AppConstant";
|
||||
import { FocusCarBean } from "../../model/resultModel/FocusModel";
|
||||
import { SkipCarCountParam } from "../../model/uiModel/PageParamModel";
|
||||
import { getMyFocusCaraList } from "../../request/api/Api";
|
||||
import { StringUtils } from "../../util/StringUtils";
|
||||
import router from "@ohos.router";
|
||||
|
||||
@Preview({
|
||||
title: 'ContentTable'
|
||||
})
|
||||
@Component
|
||||
export struct MyAttentionCarFragment{
|
||||
controller: RefreshController = new RefreshController()
|
||||
scroller: Scroller = new Scroller()
|
||||
@State personList: Array<FocusCarBean> = [] ;
|
||||
pageNum: number = 1;
|
||||
total: number = 0;
|
||||
//刷新组件状态 0 = 未触发的状态 1 = 正在刷新状态 2 = 正在加载中
|
||||
isRefreshStatus: number = 0;
|
||||
//获取数据的状态 0 = 加载数据为空此时应该显示加载空界面 -1 = 加载数据失败,显示加载失败页面 1 = 表示正常加载列表页面
|
||||
@State getDataStatus: number = 1;
|
||||
|
||||
aboutToAppear(): void {
|
||||
|
||||
// 模拟网络请求延时(3秒)
|
||||
setTimeout(() => {
|
||||
this.isRefreshStatus = 1
|
||||
this.controller.isAutoRefresh = true
|
||||
}, 300);
|
||||
}
|
||||
|
||||
onPageShow(): void {
|
||||
// this.controller.closeLoadMore = true; 移交
|
||||
|
||||
}
|
||||
|
||||
getAttentionPersonList() {
|
||||
getMyFocusCaraList(this.pageNum)
|
||||
.then((res) => {
|
||||
if (this.isRefreshStatus == 1) {
|
||||
this.isRefreshStatus = 0;
|
||||
this.controller.finishRefresh()
|
||||
if (res.code != 200) {
|
||||
ToastUtil.showToast(res.msg)
|
||||
return
|
||||
}
|
||||
let data = res.data
|
||||
if (data) {
|
||||
this.total = data.total;
|
||||
let rows = data.rows;
|
||||
if (rows) {
|
||||
this.personList = new Array();
|
||||
this.getDataStatus = 1;
|
||||
rows.forEach((item) => {
|
||||
this.personList.push(item)
|
||||
})
|
||||
if (this.total <= this.pageNum * 30) {
|
||||
//没有更多数据
|
||||
this.controller.closeLoadMore = true;
|
||||
}
|
||||
} else {
|
||||
ToastUtil.showToast("你还未关注人员!")
|
||||
this.getDataStatus = 0;
|
||||
}
|
||||
} else {
|
||||
ToastUtil.showToast("你还未关注人员!")
|
||||
this.getDataStatus = 0;
|
||||
}
|
||||
}
|
||||
if (this.isRefreshStatus == 2) {
|
||||
this.isRefreshStatus = 0;
|
||||
this.controller.finishLoadMore()
|
||||
if (res.code != 200) {
|
||||
ToastUtil.showToast(res.msg)
|
||||
return
|
||||
}
|
||||
let data = res.data
|
||||
if (data) {
|
||||
this.total = data.total;
|
||||
let rows = data.rows;
|
||||
if (rows) {
|
||||
this.personList = new Array();
|
||||
rows.forEach((item) => {
|
||||
this.personList.push(item)
|
||||
})
|
||||
if (this.total <= this.pageNum * 30) {
|
||||
//没有更多数据
|
||||
this.controller.closeLoadMore = true;
|
||||
}
|
||||
} else {
|
||||
ToastUtil.showToast("未获取到更多关注人员!")
|
||||
}
|
||||
} else {
|
||||
ToastUtil.showToast("未获取到更多关注人员!")
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((e: AxiosError) => {
|
||||
if (this.isRefreshStatus == 1) {
|
||||
this.isRefreshStatus = 0
|
||||
this.controller.finishRefresh()
|
||||
this.getDataStatus = -1;
|
||||
return
|
||||
}
|
||||
if (this.isRefreshStatus == 2) {
|
||||
this.isRefreshStatus = 0
|
||||
this.controller.finishLoadMore()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
LitheRefresh({
|
||||
scroller: this.scroller,
|
||||
controller: this.controller,
|
||||
itemLayout: () => {
|
||||
if (this.getDataStatus == 1) {
|
||||
this.listView()
|
||||
}
|
||||
},
|
||||
onRefresh: () => {
|
||||
this.pageNum = 1;
|
||||
this.isRefreshStatus = 1;
|
||||
this.controller.closeLoadMore = false;
|
||||
this.getAttentionPersonList()
|
||||
},
|
||||
onLoadMore: () => {
|
||||
if (this.total <= this.pageNum * 30) {
|
||||
//没有更多数据
|
||||
ToastUtil.showToast("没有更多数据!")
|
||||
this.controller.closeLoadMore = true;
|
||||
this.controller.finishLoadMore()
|
||||
return
|
||||
}
|
||||
this.pageNum++;
|
||||
this.isRefreshStatus = 2;
|
||||
this.getAttentionPersonList()
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height(AppConstants.PERCENTAGE_MAX)
|
||||
}
|
||||
|
||||
@Builder
|
||||
listView() {
|
||||
List({ scroller: this.scroller, space: 10 }) {
|
||||
ForEach(this.personList, (item: FocusCarBean) => {
|
||||
ListItem() {
|
||||
this.itemView(item)
|
||||
}
|
||||
.onClick(()=>{
|
||||
let param :SkipCarCountParam = {
|
||||
what: 0,
|
||||
carNum: StringUtils.get(item.hphm, ""),
|
||||
carZL: StringUtils.get(item.cllx, ""),
|
||||
carPP: StringUtils.get(item.clpp, ""),
|
||||
carJH: StringUtils.get(item.cjh, ""),
|
||||
carFDJH: StringUtils.get(item.fdjh, ""),
|
||||
carSYR: StringUtils.get(item.clsyr, ""),
|
||||
idCardNum: StringUtils.get(item.syrzjhm, ""),
|
||||
carYs: StringUtils.get(item.csys, ""),
|
||||
carStatus: StringUtils.get(item.carStatus, "")
|
||||
}
|
||||
router.pushUrl({url:"ui/pages/CarCheckDetailsPages",params:param})
|
||||
})
|
||||
})
|
||||
}
|
||||
.listDirection(Axis.Vertical)
|
||||
.scrollBar(BarState.Off)
|
||||
.edgeEffect(EdgeEffect.None)
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.layoutWeight(1)
|
||||
.nestedScroll({
|
||||
scrollForward: NestedScrollMode.PARENT_FIRST,
|
||||
scrollBackward: NestedScrollMode.PARENT_FIRST
|
||||
})
|
||||
}
|
||||
|
||||
@Builder
|
||||
itemView(bean: FocusCarBean) {
|
||||
Row() {
|
||||
|
||||
|
||||
Column() {
|
||||
Row() {
|
||||
Text(bean.hphm)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
|
||||
Image(this.getIcon(StringUtils.get(bean.carStatus, "")))
|
||||
.width($r('app.float.default_24'))
|
||||
.height($r('app.float.default_24'))
|
||||
.margin({ left: $r('app.float.default_5') })
|
||||
}
|
||||
|
||||
Row(){
|
||||
|
||||
Text(bean.cllx)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.layoutWeight(1)
|
||||
.margin({ top: $r('app.float.default_10'), bottom: $r('app.float.default_10') })
|
||||
|
||||
Text(bean.csys)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.layoutWeight(1)
|
||||
.margin({ top: $r('app.float.default_10'), bottom: $r('app.float.default_10') })
|
||||
}
|
||||
|
||||
Text(bean.updateTime)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
}
|
||||
.height($r('app.float.default_120'))
|
||||
.layoutWeight(1)
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.margin({ left: $r('app.float.default_10') })
|
||||
|
||||
|
||||
//关注图标
|
||||
Column() {
|
||||
Image(this.getAttentionRes(1))
|
||||
.width($r('app.float.default_26'))
|
||||
.height($r('app.float.default_26'))
|
||||
}
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
.justifyContent(FlexAlign.Start)
|
||||
.width($r('app.float.default_26'))
|
||||
.height($r('app.float.default_120'))
|
||||
|
||||
//又箭头
|
||||
Column() {
|
||||
Image($r('app.media.ic_row_right'))
|
||||
.width($r('app.float.default_26'))
|
||||
.height($r('app.float.default_26'))
|
||||
}
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.width($r('app.float.default_26'))
|
||||
.margin({ left: $r('app.float.default_8'), right: $r('app.float.default_10') })
|
||||
.height($r('app.float.default_120'))
|
||||
|
||||
}
|
||||
.width(`calc(100% - 20vp)`)
|
||||
.height($r('app.float.default_120'))
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.justifyContent(FlexAlign.Start)
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.border({
|
||||
width: $r('app.float.default_1'),
|
||||
color: $r('app.color.colorGrey2'),
|
||||
radius: $r('app.float.default_5')
|
||||
})
|
||||
.margin({ left: $r('app.float.default_10'), right: $r('app.float.default_10') })
|
||||
}
|
||||
|
||||
getAttentionRes(attentionStatus: number): Resource {
|
||||
if (attentionStatus == 1) {
|
||||
return $r('app.media.icon_attention_leven1');
|
||||
}
|
||||
if (attentionStatus == 2) {
|
||||
return $r('app.media.icon_attention_leven2');
|
||||
}
|
||||
if (attentionStatus == 1) {
|
||||
return $r('app.media.icon_attention_leven3');
|
||||
}
|
||||
return $r('app.media.icon_attention_leven1');
|
||||
}
|
||||
|
||||
getIcon(peopleStatus: string): Resource {
|
||||
if (peopleStatus.startsWith("涉稳")) {
|
||||
return $r("app.media.ic_type_stability")
|
||||
}
|
||||
if (peopleStatus.startsWith("涉恐")) {
|
||||
return $r("app.media.ic_type_fear")
|
||||
}
|
||||
if (peopleStatus.startsWith("关注")) {
|
||||
return $r("app.media.ic_type_focus")
|
||||
}
|
||||
if (peopleStatus.startsWith("云控")) {
|
||||
return $r("app.media.ic_type_control")
|
||||
}
|
||||
if (StringUtils.containsChar(peopleStatus, "精神")) {
|
||||
return $r("app.media.ic_type_fine")
|
||||
}
|
||||
if (peopleStatus.startsWith("非访")) {
|
||||
return $r("app.media.ic_type_non")
|
||||
}
|
||||
if (peopleStatus.startsWith("前科")) {
|
||||
return $r("app.media.ic_type_criminal_record")
|
||||
}
|
||||
if (StringUtils.containsChar(peopleStatus, "毒")) {
|
||||
return $r("app.media.ic_type_poison")
|
||||
}
|
||||
if (StringUtils.containsChar(peopleStatus, "临")) {
|
||||
return $r("app.media.ic_type_control")
|
||||
}
|
||||
if (StringUtils.containsChar(peopleStatus, "逃")) {
|
||||
return $r("app.media.ic_type_escape")
|
||||
}
|
||||
return $r("app.media.ic_type_normal");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,280 @@
|
|||
import { LitheRefresh, RefreshController } from "@abner/lithe_refresh";
|
||||
import { AxiosError } from "@ohos/axios";
|
||||
import { ToastUtil } from "@pura/harmony-utils/src/main/ets/action/ToastUtil";
|
||||
import AppConstants from "../../app/AppConstant";
|
||||
import { FocusPersonBean } from "../../model/resultModel/FocusModel";
|
||||
import { getMyFocusPersonList } from "../../request/api/Api";
|
||||
import { StringUtils } from "../../util/StringUtils";
|
||||
import { fileUri } from "@kit.CoreFileKit";
|
||||
import { getPersonStatusIcon } from "../../util/StatusIconUtils";
|
||||
import { SkipCheckCountParam } from "../../model/uiModel/PageParamModel";
|
||||
import { FileUtils } from "../../util/FileUtils";
|
||||
import router from "@ohos.router";
|
||||
|
||||
@Preview({
|
||||
title: 'ContentTable'
|
||||
})
|
||||
@Component
|
||||
export struct MyAttentionPersonFragment {
|
||||
controller: RefreshController = new RefreshController()
|
||||
scroller: Scroller = new Scroller()
|
||||
@State personList: Array<FocusPersonBean> = [] ;
|
||||
fileDir: string = "";
|
||||
pageNum: number = 1;
|
||||
total: number = 0;
|
||||
//刷新组件状态 0 = 未触发的状态 1 = 正在刷新状态 2 = 正在加载中
|
||||
isRefreshStatus: number = 0;
|
||||
//获取数据的状态 0 = 加载数据为空此时应该显示加载空界面 -1 = 加载数据失败,显示加载失败页面 1 = 表示正常加载列表页面
|
||||
@State getDataStatus: number = 1;
|
||||
|
||||
aboutToAppear(): void {
|
||||
this.fileDir = FileUtils.ID_CARD_DIR
|
||||
// 模拟网络请求延时(3秒)
|
||||
setTimeout(() => {
|
||||
this.isRefreshStatus = 1
|
||||
this.controller.isAutoRefresh = true
|
||||
}, 300);
|
||||
}
|
||||
|
||||
|
||||
getAttentionPersonList() {
|
||||
getMyFocusPersonList(this.pageNum)
|
||||
.then((res) => {
|
||||
if (this.isRefreshStatus == 1) {
|
||||
this.isRefreshStatus = 0;
|
||||
this.controller.finishRefresh()
|
||||
if (res.code != 200) {
|
||||
ToastUtil.showToast(res.msg)
|
||||
return
|
||||
}
|
||||
let data = res.data
|
||||
if (data) {
|
||||
this.total = data.total;
|
||||
let rows = data.rows;
|
||||
if (rows) {
|
||||
this.personList = new Array();
|
||||
this.getDataStatus = 1;
|
||||
rows.forEach((item) => {
|
||||
let filePate = `${this.fileDir}/${item.idCardNum}.png`;
|
||||
item.idCardPhoto = fileUri.getUriFromPath(filePate)
|
||||
this.personList.push(item)
|
||||
})
|
||||
if (this.total <= this.pageNum * 30) {
|
||||
//没有更多数据
|
||||
this.controller.closeLoadMore = true;
|
||||
}
|
||||
} else {
|
||||
ToastUtil.showToast("你还未关注人员!")
|
||||
this.getDataStatus = 0;
|
||||
}
|
||||
} else {
|
||||
ToastUtil.showToast("你还未关注人员!")
|
||||
this.getDataStatus = 0;
|
||||
}
|
||||
}
|
||||
if (this.isRefreshStatus == 2) {
|
||||
this.isRefreshStatus = 0;
|
||||
this.controller.finishLoadMore()
|
||||
if (res.code != 200) {
|
||||
ToastUtil.showToast(res.msg)
|
||||
return
|
||||
}
|
||||
let data = res.data
|
||||
if (data) {
|
||||
this.total = data.total;
|
||||
let rows = data.rows;
|
||||
if (rows) {
|
||||
this.personList = new Array();
|
||||
rows.forEach((item) => {
|
||||
let filePate = `${this.fileDir}/${item.idCardNum}.png`;
|
||||
item.idCardPhoto = fileUri.getUriFromPath(filePate)
|
||||
this.personList.push(item)
|
||||
})
|
||||
if (this.total <= this.pageNum * 30) {
|
||||
//没有更多数据
|
||||
this.controller.closeLoadMore = true;
|
||||
}
|
||||
} else {
|
||||
ToastUtil.showToast("未获取到更多关注人员!")
|
||||
}
|
||||
} else {
|
||||
ToastUtil.showToast("未获取到更多关注人员!")
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((e: AxiosError) => {
|
||||
if (this.isRefreshStatus == 1) {
|
||||
this.isRefreshStatus = 0
|
||||
this.controller.finishRefresh()
|
||||
this.getDataStatus = -1;
|
||||
return
|
||||
}
|
||||
if (this.isRefreshStatus == 2) {
|
||||
this.isRefreshStatus = 0
|
||||
this.controller.finishLoadMore()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
LitheRefresh({
|
||||
scroller: this.scroller,
|
||||
controller: this.controller,
|
||||
itemLayout: () => {
|
||||
if (this.getDataStatus == 1) {
|
||||
this.listView()
|
||||
}
|
||||
},
|
||||
onRefresh: () => {
|
||||
this.pageNum = 1;
|
||||
this.isRefreshStatus = 1;
|
||||
this.controller.closeLoadMore = false;
|
||||
this.getAttentionPersonList()
|
||||
},
|
||||
onLoadMore: () => {
|
||||
if (this.total <= this.pageNum * 30) {
|
||||
//没有更多数据
|
||||
ToastUtil.showToast("没有更多数据!")
|
||||
this.controller.closeLoadMore = true;
|
||||
this.controller.finishLoadMore()
|
||||
return
|
||||
}
|
||||
this.pageNum++;
|
||||
this.isRefreshStatus = 2;
|
||||
this.getAttentionPersonList()
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height(AppConstants.PERCENTAGE_MAX)
|
||||
}
|
||||
|
||||
@Builder
|
||||
listView() {
|
||||
List({ scroller: this.scroller, space: 10 }) {
|
||||
ForEach(this.personList, (item: FocusPersonBean) => {
|
||||
ListItem() {
|
||||
this.itemView(item)
|
||||
}
|
||||
.onClick(()=>{
|
||||
let param : SkipCheckCountParam = {
|
||||
what: 0,
|
||||
name: StringUtils.get(item.realName, ""),
|
||||
sex: StringUtils.get(item.sex, ""),
|
||||
idCardNum: StringUtils.get(item.idCardNum, ""),
|
||||
birthDate: StringUtils.get(item.birthDate, ""),
|
||||
nation: StringUtils.get(item.mz, ""),
|
||||
address: StringUtils.get(item.address, ""),
|
||||
photoData: "",
|
||||
zdlx:StringUtils.get(item.rylx, ""),
|
||||
}
|
||||
router.pushUrl({url:"ui/pages/PeopleCheckDetailsPages",params:param})
|
||||
|
||||
})
|
||||
})
|
||||
}
|
||||
.listDirection(Axis.Vertical)
|
||||
.scrollBar(BarState.Off)
|
||||
.edgeEffect(EdgeEffect.None)
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.layoutWeight(1)
|
||||
.nestedScroll({
|
||||
scrollForward: NestedScrollMode.PARENT_FIRST,
|
||||
scrollBackward: NestedScrollMode.PARENT_FIRST
|
||||
})
|
||||
}
|
||||
|
||||
@Builder
|
||||
itemView(bean: FocusPersonBean) {
|
||||
Row() {
|
||||
Image(bean.idCardPhoto)
|
||||
.width($r('app.float.default_88'))
|
||||
.height($r('app.float.default_100'))
|
||||
.margin({ left: $r('app.float.default_10') })
|
||||
.alt($r('app.media.icon_load_image'))
|
||||
.onError(() => {
|
||||
bean.idCardPhoto = $r('app.media.icon_error_image')
|
||||
})
|
||||
|
||||
Column() {
|
||||
Row() {
|
||||
Text(bean.realName)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
|
||||
Image(getPersonStatusIcon(StringUtils.get(bean.rylx, "")))
|
||||
.width($r('app.float.default_24'))
|
||||
.height($r('app.float.default_24'))
|
||||
.margin({ left: $r('app.float.default_5') })
|
||||
}
|
||||
|
||||
Text(bean.idCardNum)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.margin({ top: $r('app.float.default_10'), bottom: $r('app.float.default_10') })
|
||||
|
||||
Text(bean.address)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
}
|
||||
.height($r('app.float.default_120'))
|
||||
.layoutWeight(1)
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.margin({ left: $r('app.float.default_10') })
|
||||
|
||||
|
||||
//关注图标
|
||||
Column() {
|
||||
Image(this.getAttentionRes(1))
|
||||
.width($r('app.float.default_26'))
|
||||
.height($r('app.float.default_26'))
|
||||
}
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
.justifyContent(FlexAlign.Start)
|
||||
.width($r('app.float.default_26'))
|
||||
.height($r('app.float.default_120'))
|
||||
|
||||
//又箭头
|
||||
Column() {
|
||||
Image($r('app.media.ic_row_right'))
|
||||
.width($r('app.float.default_26'))
|
||||
.height($r('app.float.default_26'))
|
||||
}
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.width($r('app.float.default_26'))
|
||||
.margin({ left: $r('app.float.default_8'), right: $r('app.float.default_10') })
|
||||
.height($r('app.float.default_120'))
|
||||
|
||||
}
|
||||
.width(`calc(100% - 20vp)`)
|
||||
.height($r('app.float.default_120'))
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.justifyContent(FlexAlign.Start)
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.border({
|
||||
width: $r('app.float.default_1'),
|
||||
color: $r('app.color.colorGrey2'),
|
||||
radius: $r('app.float.default_5')
|
||||
})
|
||||
.margin({ left: $r('app.float.default_10'), right: $r('app.float.default_10') })
|
||||
}
|
||||
|
||||
getAttentionRes(attentionStatus: number): Resource {
|
||||
if (attentionStatus == 1) {
|
||||
return $r('app.media.icon_attention_leven1');
|
||||
}
|
||||
if (attentionStatus == 2) {
|
||||
return $r('app.media.icon_attention_leven2');
|
||||
}
|
||||
if (attentionStatus == 1) {
|
||||
return $r('app.media.icon_attention_leven3');
|
||||
}
|
||||
return $r('app.media.icon_attention_leven1');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,230 @@
|
|||
import { LitheRefresh, RefreshController } from "@abner/lithe_refresh"
|
||||
import { AxiosError } from "@ohos/axios";
|
||||
import { JSONUtil, ToastUtil } from "@pura/harmony-utils";
|
||||
import AppConstants from "../../app/AppConstant"
|
||||
import { AccompanPersonBean } from "../../model/resultModel/CheckPeopleResultModel";
|
||||
import { SkipCheckCountParam } from "../../model/uiModel/PageParamModel";
|
||||
import { getPersonListByMainId } from "../../request/api/Api";
|
||||
import { getPersonStatusIcon } from "../../util/StatusIconUtils";
|
||||
import { StringUtils } from "../../util/StringUtils";
|
||||
import { router } from "@kit.ArkUI";
|
||||
|
||||
@Preview({
|
||||
title: 'ContentTable'
|
||||
})
|
||||
@Component
|
||||
export struct PeopleListFragment {
|
||||
@State mainId: string = ""
|
||||
@State personList: Array<AccompanPersonBean> = new Array;
|
||||
controller: RefreshController = new RefreshController()
|
||||
scroller: Scroller = new Scroller()
|
||||
total: number = 0;
|
||||
pageNum: number = 1;
|
||||
isRefreshStatus: number = 0;
|
||||
|
||||
aboutToAppear(): void {
|
||||
setTimeout(() => {
|
||||
this.controller.isAutoRefresh = true
|
||||
}, 300)
|
||||
}
|
||||
|
||||
getRecordListData() {
|
||||
getPersonListByMainId(this.pageNum,20,this.mainId)
|
||||
.then((res) => {
|
||||
console.debug(JSONUtil.beanToJsonStr(res))
|
||||
if (this.isRefreshStatus == 1) {
|
||||
this.isRefreshStatus = 0
|
||||
this.controller.finishRefresh()
|
||||
if (res.code != 200) {
|
||||
ToastUtil.showToast(res.msg)
|
||||
return
|
||||
}
|
||||
if (res.data) {
|
||||
this.total = res.data.total;
|
||||
let rows = res.data.rows;
|
||||
if (rows && rows != undefined) {
|
||||
this.personList = new Array
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
let bean = rows[i];
|
||||
// let filePate = `${this.fileDir}/${bean.sfz}.png`;
|
||||
// bean.idCardPhoto = fileUri.getUriFromPath(filePate)
|
||||
this.personList.push(bean);
|
||||
}
|
||||
} else {
|
||||
ToastUtil.showToast("未查询到数据!")
|
||||
return
|
||||
}
|
||||
} else {
|
||||
ToastUtil.showToast("未查询到数据!")
|
||||
return
|
||||
}
|
||||
}
|
||||
if (this.isRefreshStatus == 2) {
|
||||
this.isRefreshStatus = 0
|
||||
this.controller.finishLoadMore()
|
||||
if (res.code != 200) {
|
||||
ToastUtil.showToast(res.msg)
|
||||
return
|
||||
}
|
||||
if (res.data) {
|
||||
this.total = res.data.total;
|
||||
let rows = res.data.rows;
|
||||
if (rows && rows != undefined) {
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
let bean = rows[i];
|
||||
// let filePate = `${this.fileDir}/${bean.sfz}.png`;
|
||||
// bean.idCardPhoto = fileUri.getUriFromPath(filePate)
|
||||
this.personList.push(bean);
|
||||
}
|
||||
if (this.pageNum * 20 >= this.total) {
|
||||
this.controller.closeLoadMore = true;
|
||||
ToastUtil.showToast("没有更多数据!")
|
||||
return
|
||||
}
|
||||
} else {
|
||||
ToastUtil.showToast("没有更多数据!")
|
||||
return
|
||||
}
|
||||
} else {
|
||||
ToastUtil.showToast("没有更多数据!")
|
||||
return
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((e: AxiosError) => {
|
||||
console.error(e.message)
|
||||
ToastUtil.showToast(e.message)
|
||||
if (this.isRefreshStatus == 1) {
|
||||
this.isRefreshStatus = 0
|
||||
this.controller.finishRefresh()
|
||||
return
|
||||
}
|
||||
if (this.isRefreshStatus == 2) {
|
||||
this.isRefreshStatus = 0
|
||||
this.controller.finishLoadMore()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
LitheRefresh({
|
||||
scroller: this.scroller,
|
||||
controller: this.controller,
|
||||
itemLayout: () => {
|
||||
this.listView()
|
||||
},
|
||||
onRefresh: () => {
|
||||
this.controller.closeLoadMore = false;
|
||||
this.pageNum = 1;
|
||||
this.isRefreshStatus = 1;
|
||||
this.getRecordListData()
|
||||
},
|
||||
onLoadMore: () => {
|
||||
if (this.pageNum * 30 >= this.total) {
|
||||
this.controller.finishLoadMore()
|
||||
this.controller.closeLoadMore = true;
|
||||
ToastUtil.showToast("没有更多数据!")
|
||||
return
|
||||
}
|
||||
this.pageNum++;
|
||||
this.isRefreshStatus = 2;
|
||||
this.getRecordListData()
|
||||
}
|
||||
})
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.layoutWeight(1)
|
||||
}.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height(AppConstants.PERCENTAGE_MAX)
|
||||
}
|
||||
|
||||
@Builder
|
||||
listView() {
|
||||
List({ scroller: this.scroller}) {
|
||||
ForEach(this.personList, (item: AccompanPersonBean) => {
|
||||
ListItem() {
|
||||
this.itemView(item)
|
||||
}
|
||||
.onClick(() => {
|
||||
let param : SkipCheckCountParam = {
|
||||
what: 0,
|
||||
name: StringUtils.get(item.name, ""),
|
||||
sex: item.sex==1?"男":item.sex==2?"女":"未知",
|
||||
idCardNum: StringUtils.get(item.sfz, ""),
|
||||
birthDate: StringUtils.get(item.csrq, ""),
|
||||
nation: StringUtils.get(item.mz, ""),
|
||||
address: StringUtils.get(item.address, ""),
|
||||
photoData: "",
|
||||
zdlx:StringUtils.get(item.peopleStatusStr, ""),
|
||||
}
|
||||
router.pushUrl({url:"ui/pages/PeopleCheckDetailsPages",params:param})
|
||||
})
|
||||
})
|
||||
}
|
||||
.divider({
|
||||
strokeWidth: $r('app.float.default_1'),
|
||||
color: $r('app.color.colorGrey2'),
|
||||
startMargin:$r('app.float.default_63')
|
||||
})
|
||||
.listDirection(Axis.Vertical)
|
||||
.scrollBar(BarState.Off)
|
||||
.edgeEffect(EdgeEffect.None)
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.layoutWeight(1)
|
||||
.nestedScroll({
|
||||
scrollForward: NestedScrollMode.PARENT_FIRST,
|
||||
scrollBackward: NestedScrollMode.PARENT_FIRST
|
||||
})
|
||||
}
|
||||
|
||||
@Builder
|
||||
itemView(item: AccompanPersonBean) {
|
||||
Row() {
|
||||
Image(getPersonStatusIcon(item.peopleStatusStr))
|
||||
.width($r('app.float.default_43'))
|
||||
.height($r('app.float.default_43'))
|
||||
.margin({ left: $r('app.float.default_10'), right: $r('app.float.default_10') })
|
||||
|
||||
Column() {
|
||||
Row() {
|
||||
Text(`姓名:${item.name}`)
|
||||
.fontSize($r('app.float.default_16'))
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
Text(item.status == "1" ? "移交" : "通过")
|
||||
.fontColor(item.status == "1" ? $r('app.color.colorYellow7') : $r('app.color.colorBluen7'))
|
||||
.backgroundColor(item.status == "1" ? $r('app.color.colorYellow2') : $r('app.color.colorBluen2'))
|
||||
.fontSize($r('app.float.text_size_12'))
|
||||
.border({
|
||||
width: $r('app.float.default_1'),
|
||||
color: item.status == "1" ? $r('app.color.colorYellow6') : $r('app.color.colorBluen6'),
|
||||
radius: $r('app.float.default_20'),
|
||||
})
|
||||
.padding({
|
||||
left: $r('app.float.default_8'),
|
||||
right: $r('app.float.default_8'),
|
||||
top: $r('app.float.default_2'),
|
||||
bottom: $r('app.float.default_2')
|
||||
})
|
||||
.textAlign(TextAlign.Center)
|
||||
.margin({ left: $r('app.float.default_5') })
|
||||
|
||||
}
|
||||
.width('95%')
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.justifyContent(FlexAlign.Start)
|
||||
|
||||
Text(item.sfz)
|
||||
.fontSize($r('app.float.default_14'))
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.margin({ top: $r('app.float.default_5') })
|
||||
}
|
||||
.layoutWeight(1)
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
}
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.height($r('app.float.default_60'))
|
||||
.padding({ top: $r('app.float.default_8'), bottom: $r('app.float.default_8') })
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,481 @@
|
|||
import { LitheRefresh, RefreshController } from "@abner/lithe_refresh"
|
||||
import { AxiosError } from "@ohos/axios"
|
||||
import { ToastUtil } from "@pura/harmony-utils"
|
||||
import AppConstants from "../../app/AppConstant"
|
||||
import { MainRecordResultModel } from "../../model/resultModel/MainResultModel"
|
||||
import { ErrorOfEmptyModel } from "../../model/uiModel/BeanModel"
|
||||
import { SkipHistoryDetailsParam } from "../../model/uiModel/PageParamModel"
|
||||
import { queryMainRecordList } from "../../request/api/Api"
|
||||
import { cardRoundBorderGreyStyle, cardRoundBorderStyle } from "../../style/BorderStyle"
|
||||
import { IdCardNumUtils } from "../../util/IdCardNumUtils"
|
||||
import { StringUtils } from "../../util/StringUtils"
|
||||
import { ToastUtils } from "../../util/ToasUtils"
|
||||
import { router } from "@kit.ArkUI"
|
||||
import { DateUtils } from "../../util/DateUtils"
|
||||
|
||||
/*
|
||||
* 卡点核录记录 街面盘查
|
||||
*/
|
||||
@Preview({
|
||||
title: 'ContentTable'
|
||||
})
|
||||
@Component
|
||||
export struct StreetSearchHistoryFragment{
|
||||
|
||||
@State inputContent: string | undefined = undefined
|
||||
|
||||
@State beginTime: string | undefined = undefined
|
||||
@State endTime: string | undefined = undefined
|
||||
@State recordDescription: string = "共搜索到 0 条"
|
||||
@State recordList: Array<MainRecordResultModel> = [];
|
||||
controller: RefreshController = new RefreshController()
|
||||
scroller: Scroller = new Scroller()
|
||||
total: number = 0;
|
||||
pageNum: number = 1;
|
||||
isRefreshStatus: number = 0;
|
||||
|
||||
aboutToAppear(): void {
|
||||
setTimeout(() => {
|
||||
this.controller.isAutoRefresh = true
|
||||
}, 300)
|
||||
}
|
||||
|
||||
getRecordListData() {
|
||||
if (this.inputContent){
|
||||
if (!IdCardNumUtils.validateIdCardNum(this.inputContent)) {
|
||||
ToastUtil.showToast("请检查身份证号是否正确!")
|
||||
this.controller.finishRefresh()
|
||||
this.controller.finishLoadMore()
|
||||
this.isRefreshStatus = 0
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
queryMainRecordList(0, "", this.pageNum, StringUtils.get(this.beginTime, ""," 00:00:00"),
|
||||
StringUtils.get(this.endTime, ""," 23:59:59"),StringUtils.get(this.inputContent,""))
|
||||
.then((res) => {
|
||||
console.debug("查询主记录列表成功", JSON.stringify(res))
|
||||
if (res.code == 200) {
|
||||
let data = res.data;
|
||||
if (data) {
|
||||
this.total = data.total;
|
||||
this.recordDescription = `共搜索到 ${data.total} 条`
|
||||
let list = data.rows
|
||||
if (list) {
|
||||
if (this.isRefreshStatus == 1){
|
||||
this.isRefreshStatus = 0
|
||||
this.recordList = new Array;
|
||||
this.controller.finishRefresh()
|
||||
}
|
||||
if (this.isRefreshStatus = 2){
|
||||
this.isRefreshStatus = 0
|
||||
this.controller.finishLoadMore()
|
||||
}
|
||||
list.forEach((item) => {
|
||||
this.recordList.push(item)
|
||||
})
|
||||
if (this.pageNum * 20 >= this.total) {
|
||||
this.controller.closeLoadMore = true
|
||||
}
|
||||
}else {
|
||||
this.handlerErrorOrEmpty(new ErrorOfEmptyModel(0, "没有数据!"))
|
||||
}
|
||||
}else {
|
||||
this.handlerErrorOrEmpty(new ErrorOfEmptyModel(0, "没有数据!"))
|
||||
}
|
||||
} else {
|
||||
this.handlerErrorOrEmpty(new ErrorOfEmptyModel(-1, StringUtils.get(res.msg, "获取失败!")));
|
||||
}
|
||||
})
|
||||
.catch((e: AxiosError) => {
|
||||
console.debug("查询主记录列表失败", e.message)
|
||||
this.handlerErrorOrEmpty(new ErrorOfEmptyModel(-1, e.message));
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
handlerErrorOrEmpty(model: ErrorOfEmptyModel) {
|
||||
ToastUtils.toastBottom(model.msg)
|
||||
if (this.isRefreshStatus == 1) {
|
||||
//刷新
|
||||
this.controller.finishRefresh()
|
||||
this.recordList = new Array
|
||||
}
|
||||
if (this.isRefreshStatus == 2) {
|
||||
//加载
|
||||
this.controller.finishLoadMore()
|
||||
}
|
||||
this.isRefreshStatus = 0
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 时间选择
|
||||
* @param type startTime/endTime
|
||||
*/
|
||||
showTimePicker(type: string) {
|
||||
let currentTime = new Date()
|
||||
if (type == 'startTime') {
|
||||
let start = DateUtils.pastStrDate(this.beginTime);
|
||||
currentTime = start == null ? new Date() : start
|
||||
|
||||
}
|
||||
if (type == 'endTime') {
|
||||
let end = DateUtils.pastStrDate(this.endTime);
|
||||
currentTime = end == null ? new Date() : end
|
||||
}
|
||||
|
||||
DatePickerDialog.show({
|
||||
start: new Date('2020-1-1'),
|
||||
end: new Date('2030-12-31'),
|
||||
selected: currentTime,
|
||||
lunar: false, // 是否显示农历
|
||||
showTime: false, // 是否显示时间
|
||||
onAccept: (value: DatePickerResult) => {
|
||||
let month = (value.month? value.month : 0)+1
|
||||
let data = value.year + '-' + DateUtils.padZero(month) + '-' + DateUtils.padZero(value.day)
|
||||
if (type == 'startTime') {
|
||||
this.beginTime = data
|
||||
}
|
||||
if (type == 'endTime') {
|
||||
this.endTime = data
|
||||
}
|
||||
console.info('确认日期:', value.toString());
|
||||
},
|
||||
onCancel: () => {
|
||||
console.info('用户取消选择');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
this.searchContent()
|
||||
|
||||
Text(this.recordDescription)
|
||||
.fontSize($r('app.float.text_size_12'))
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.textAlign(TextAlign.Center)
|
||||
|
||||
LitheRefresh({
|
||||
scroller: this.scroller,
|
||||
controller: this.controller,
|
||||
itemLayout: () => {
|
||||
this.listView()
|
||||
},
|
||||
onRefresh: () => {
|
||||
this.controller.closeLoadMore = false;
|
||||
this.pageNum = 1;
|
||||
this.isRefreshStatus = 1;
|
||||
this.getRecordListData()
|
||||
},
|
||||
onLoadMore: () => {
|
||||
if (this.pageNum * 30 >= this.total) {
|
||||
this.controller.finishLoadMore()
|
||||
this.controller.closeLoadMore = true;
|
||||
ToastUtil.showToast("没有更多数据!")
|
||||
return
|
||||
}
|
||||
this.pageNum++;
|
||||
this.isRefreshStatus = 2;
|
||||
this.getRecordListData()
|
||||
}
|
||||
})
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.layoutWeight(1)
|
||||
}
|
||||
.backgroundColor($r('app.color.page_background'))
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height(AppConstants.PERCENTAGE_MAX)
|
||||
}
|
||||
|
||||
@Builder
|
||||
searchContent() {
|
||||
Column() {
|
||||
Row() {
|
||||
Text('人员信息:')
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.height($r('app.float.default_40'))
|
||||
.margin({
|
||||
left: $r('app.float.default_10'),
|
||||
top: $r('app.float.default_10')
|
||||
})
|
||||
.textAlign(TextAlign.Center);
|
||||
|
||||
TextInput({text:this.inputContent,placeholder:"请输入被核验人员证件号码"})
|
||||
.placeholderColor( $r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.fontColor($r('app.color.colorGrey8') )
|
||||
.margin({
|
||||
right: $r('app.float.default_10'),
|
||||
top: $r('app.float.default_10')
|
||||
})
|
||||
.padding({
|
||||
left: $r('app.float.default_5'),
|
||||
right: $r('app.float.default_5'),
|
||||
})
|
||||
.onChange((text: string) => {
|
||||
this.inputContent = text;
|
||||
})
|
||||
.height($r('app.float.default_40'))
|
||||
.layoutWeight(1)
|
||||
.width($r('app.float.default_88'))
|
||||
.textAlign(TextAlign.Start)
|
||||
.border(cardRoundBorderGreyStyle);
|
||||
|
||||
}
|
||||
.width('95%')
|
||||
.margin({
|
||||
left: $r('app.float.default_10'),
|
||||
right: $r('app.float.default_10'),
|
||||
top: $r('app.float.default_10')
|
||||
});
|
||||
|
||||
Row() {
|
||||
Row() {
|
||||
Text(StringUtils.get(this.beginTime, "开始时间"))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.fontColor(this.beginTime ? $r('app.color.colorGrey8') : $r('app.color.colorGrey6'))
|
||||
.margin({
|
||||
right: $r('app.float.default_5'),
|
||||
})
|
||||
.height($r('app.float.default_40'))
|
||||
.layoutWeight(1)
|
||||
.padding({
|
||||
left: $r('app.float.default_5'),
|
||||
right: $r('app.float.default_5'),
|
||||
})
|
||||
.width($r('app.float.default_88'))
|
||||
.textAlign(TextAlign.Start);
|
||||
|
||||
Image($r('app.media.log_rl'))
|
||||
.width($r('app.float.default_20'))
|
||||
.height($r('app.float.default_20'));
|
||||
}
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.layoutWeight(1)
|
||||
.onClick(() => {
|
||||
this.showTimePicker('startTime')
|
||||
})
|
||||
|
||||
Divider()
|
||||
.width($r('app.float.default_1'))
|
||||
.height($r('app.float.default_40'))
|
||||
.backgroundColor($r('app.color.colorGrey2'))
|
||||
.margin({
|
||||
right: $r('app.float.default_5'),
|
||||
left: $r('app.float.default_5')
|
||||
});
|
||||
|
||||
Row() {
|
||||
Text(StringUtils.get(this.endTime, "结束时间"))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.fontColor(this.endTime ? $r('app.color.colorGrey8') : $r('app.color.colorGrey6'))
|
||||
.margin({
|
||||
right: $r('app.float.default_5'),
|
||||
})
|
||||
.height($r('app.float.default_40'))
|
||||
.layoutWeight(1)
|
||||
.padding({
|
||||
left: $r('app.float.default_5'),
|
||||
right: $r('app.float.default_5'),
|
||||
})
|
||||
.width($r('app.float.default_88'))
|
||||
.textAlign(TextAlign.Start);
|
||||
|
||||
Image($r('app.media.log_rl'))
|
||||
.width($r('app.float.default_20'))
|
||||
.height($r('app.float.default_20'))
|
||||
.margin({
|
||||
right: $r('app.float.default_5'),
|
||||
});
|
||||
}
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.layoutWeight(1)
|
||||
.onClick(() => {
|
||||
this.showTimePicker('endTime')
|
||||
})
|
||||
|
||||
}
|
||||
.border(cardRoundBorderGreyStyle)
|
||||
.width('95%')
|
||||
.margin({
|
||||
left: $r('app.float.default_5'),
|
||||
right: $r('app.float.default_5'),
|
||||
})
|
||||
.margin($r('app.float.default_10'));
|
||||
|
||||
Button("搜索", { type: ButtonType.Normal, stateEffect: true })
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.fontColor($r('app.color.white'))
|
||||
.backgroundColor($r('app.color.bull'))
|
||||
.borderRadius(8)
|
||||
.margin({
|
||||
left: $r('app.float.default_10'),
|
||||
right: $r('app.float.default_10'),
|
||||
bottom: $r('app.float.default_10'),
|
||||
})
|
||||
.onClick(() => {
|
||||
this.controller.isAutoRefresh = true
|
||||
})
|
||||
.width('95%');
|
||||
}
|
||||
.width('95%')
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.border(cardRoundBorderStyle)
|
||||
.margin($r('app.float.default_10'))
|
||||
}
|
||||
|
||||
@Builder
|
||||
listView() {
|
||||
List({ scroller: this.scroller }) {
|
||||
ForEach(this.recordList, (item: MainRecordResultModel, index) => {
|
||||
ListItem() {
|
||||
this.itemView(item)
|
||||
}
|
||||
.onClick(()=>{
|
||||
let param:SkipHistoryDetailsParam = {
|
||||
pctime: item.checkTime,
|
||||
policenum: item.policeName,
|
||||
policename: item.policeName,
|
||||
pcyy: item.checkReason,
|
||||
yjdw: item.yjdwmc,
|
||||
mainId: item.mainId,
|
||||
status: item.status,
|
||||
address: item.checkAddress,
|
||||
taskName: item.taskName,
|
||||
type: 0
|
||||
}
|
||||
router.pushUrl({url:"ui/pages/HistoryDetailsPage",params:param})
|
||||
})
|
||||
})
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.layoutWeight(1)
|
||||
.listDirection(Axis.Vertical)
|
||||
.scrollBar(BarState.Off)
|
||||
.edgeEffect(EdgeEffect.None)
|
||||
.nestedScroll({
|
||||
scrollForward: NestedScrollMode.PARENT_FIRST,
|
||||
scrollBackward: NestedScrollMode.PARENT_FIRST
|
||||
})
|
||||
}
|
||||
|
||||
@Builder
|
||||
itemView(item: MainRecordResultModel) {
|
||||
Column() {
|
||||
Row() {
|
||||
Text("时间:")
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
|
||||
Text(item.checkTime)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.margin({ left: $r('app.float.default_5') })
|
||||
|
||||
Text(item.status == 1 ? "移交" : "通过")
|
||||
.fontColor(item.status == 1 ? $r('app.color.colorYellow7') : $r('app.color.colorBluen7'))
|
||||
.backgroundColor(item.status == 1 ? $r('app.color.colorYellow2') : $r('app.color.colorBluen2'))
|
||||
.fontSize($r('app.float.text_size_12'))
|
||||
.border({
|
||||
width:$r('app.float.default_1'),
|
||||
color: item.status == 1 ? $r('app.color.colorYellow6') : $r('app.color.colorBluen6'),
|
||||
radius: $r('app.float.default_20'),
|
||||
})
|
||||
.padding({left: $r('app.float.default_8'), right: $r('app.float.default_8'),
|
||||
top: $r('app.float.default_2'), bottom: $r('app.float.default_2')})
|
||||
.textAlign(TextAlign.Center)
|
||||
.margin({ left: $r('app.float.default_5') })
|
||||
|
||||
}
|
||||
.width('95%')
|
||||
|
||||
Row() {
|
||||
Text("地址:")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
Text(item.checkAddress)
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
}
|
||||
.width('95%')
|
||||
.margin({ top: $r('app.float.default_5') })
|
||||
|
||||
Row() {
|
||||
Column() {
|
||||
Text("总人数/异常数")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
Row() {
|
||||
Text(StringUtils.get(item.peopleCount,"0","人"))
|
||||
.fontColor($r('app.color.bull'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
Text("/")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
Text(StringUtils.get(item.unusualPeopleCount,"0","人"))
|
||||
.fontColor($r('app.color.colorYellow8'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
}
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.margin({ top: $r('app.float.default_5') })
|
||||
}
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.height($r('app.float.default_52'))
|
||||
.layoutWeight(1)
|
||||
.border(cardRoundBorderGreyStyle)
|
||||
|
||||
Column() {
|
||||
Text("车牌")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
|
||||
Text(StringUtils.get(item.carNum,"-"))
|
||||
.fontColor($r('app.color.bull'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.margin({ top: $r('app.float.default_5') })
|
||||
}
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.height($r('app.float.default_52'))
|
||||
.layoutWeight(1)
|
||||
.margin({ left: $r('app.float.default_5'), right: $r('app.float.default_5') })
|
||||
.border(cardRoundBorderGreyStyle)
|
||||
|
||||
Column() {
|
||||
Text("物品")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
|
||||
Text(this.getGoodCount(item.goodsCount))
|
||||
.fontColor($r('app.color.bull'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.margin({ top: $r('app.float.default_5') })
|
||||
}
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.height($r('app.float.default_52'))
|
||||
.layoutWeight(1)
|
||||
.border(cardRoundBorderGreyStyle)
|
||||
|
||||
}
|
||||
.width('95%')
|
||||
.margin({ top: $r('app.float.default_5') })
|
||||
}
|
||||
.width('95%')
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.border(cardRoundBorderStyle)
|
||||
.padding($r('app.float.default_10'))
|
||||
.margin($r('app.float.default_10'))
|
||||
|
||||
}
|
||||
|
||||
getGoodCount(goodsCount:string):string{
|
||||
let count = StringUtils.get(goodsCount,"-")
|
||||
if (count == "0") {
|
||||
return "-"
|
||||
}
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,154 @@
|
|||
|
||||
import { bundleManager } from '@kit.AbilityKit';
|
||||
import { LengthUnit } from '@kit.ArkUI';
|
||||
import { BaseTopBar } from '../../view/custom/BaseTopTar';
|
||||
import { createWaterMark } from '../../view/custom/Watermark';
|
||||
|
||||
@Preview
|
||||
@Entry
|
||||
@Component
|
||||
struct AboutPage {
|
||||
@State about1: string = ' 支持NFC、人像、OCR等方式快速实现巡逻、卡点人车物盘查功能。'
|
||||
@State about2: string = ' 提供省厅、地市两级用户盘查统计实时展示分析、任务管理、卡点管理、本地临时关注人员车辆管理等功能。'
|
||||
// @State about3: string = ' 2、实时比对车辆被盗抢库和临时布控库,方便民警快速发现问题车辆。'
|
||||
@State versionName: string = "1.0"
|
||||
@State versionCode: string = "1"
|
||||
|
||||
aboutToAppear(): void {
|
||||
this.getAppVersion()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取应用版本号
|
||||
*/
|
||||
async getAppVersion() {
|
||||
let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION;
|
||||
try {
|
||||
// 使用await等待Promise的结果
|
||||
const data = await bundleManager.getBundleInfoForSelf(bundleFlags);
|
||||
if (data) {
|
||||
console.info('FileUtil', 'getBundleInfoForSelf successfully. Data: %s', JSON.stringify(data));
|
||||
this.versionName = data.versionName
|
||||
this.versionCode = data.versionCode + ""
|
||||
} else {
|
||||
console.error('FileUtil', 'getBundleInfoForSelf returned an empty result.');
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('FileUtil', 'getBundleInfoForSelf failed: %s', err.message);
|
||||
}
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
BaseTopBar({
|
||||
title:$r('app.string.title_About')
|
||||
})
|
||||
|
||||
Column() {
|
||||
|
||||
Image($r('app.media.ic_applogin'))
|
||||
.width($r('app.float.default_68'))
|
||||
.height($r('app.float.default_68'))
|
||||
|
||||
Text($r('app.string.app_name'))
|
||||
.fontColor($r('app.color.black'))
|
||||
.fontSize($r('app.float.text_size_20'))
|
||||
.margin({ top: $r('app.float.default_10') })
|
||||
|
||||
|
||||
Column() {
|
||||
Row() {
|
||||
Text('版本:')
|
||||
.fontColor($r('app.color.grad'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
Text(this.versionName)
|
||||
.fontColor($r('app.color.black'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.margin({ left: $r('app.float.default_3') })
|
||||
}
|
||||
.width('100%')
|
||||
|
||||
Divider()
|
||||
.height($r('app.float.default_1'))
|
||||
.backgroundColor($r('app.color.page_background'))
|
||||
.width('100%')
|
||||
.margin({ top: $r('app.float.default_10') })
|
||||
|
||||
Row() {
|
||||
Text('版本号:')
|
||||
.fontColor($r('app.color.grad'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
Text(this.versionCode)
|
||||
.fontColor($r('app.color.black'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.margin({ left: $r('app.float.default_3') })
|
||||
}
|
||||
.width('100%')
|
||||
.margin({ top: $r('app.float.default_10') })
|
||||
|
||||
Divider()
|
||||
.height($r('app.float.default_1'))
|
||||
.backgroundColor($r('app.color.page_background'))
|
||||
.width('100%')
|
||||
.margin({ top: $r('app.float.default_10') })
|
||||
|
||||
|
||||
Text('功能介绍')
|
||||
.fontColor($r('app.color.grad'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.margin({ top: $r('app.float.default_10') })
|
||||
|
||||
Text(this.about1)
|
||||
.width('100%')
|
||||
.fontColor($r('app.color.black'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.lineSpacing({
|
||||
value: 2,
|
||||
unit: LengthUnit.FP
|
||||
})
|
||||
.margin({ top: $r('app.float.default_10') })
|
||||
Text(this.about2)
|
||||
.width('100%')
|
||||
.fontColor($r('app.color.black'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.lineSpacing({
|
||||
value: 2,
|
||||
unit: LengthUnit.FP
|
||||
})
|
||||
.margin({ top: $r('app.float.default_3') })
|
||||
// Text(this.about3)
|
||||
// .width('100%')
|
||||
// .fontColor($r('app.color.black'))
|
||||
// .fontSize($r('app.float.text_size_16'))
|
||||
// .margin({ top: $r('app.float.default_3') })
|
||||
// .lineSpacing({
|
||||
// value: 2,
|
||||
// unit: LengthUnit.FP
|
||||
// })
|
||||
|
||||
}
|
||||
.width('90%')
|
||||
.padding($r('app.float.default_15'))
|
||||
.margin({ top: $r('app.float.default_40') })
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.border({
|
||||
width: $r('app.float.default_1'),
|
||||
color: $r('app.color.page_background'),
|
||||
radius: $r('app.float.comm_image_radius')
|
||||
})
|
||||
|
||||
}
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.margin({ bottom: $r('app.float.default_40') })
|
||||
.width('100%')
|
||||
.layoutWeight(1)
|
||||
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.backgroundColor($r('app.color.page_background'))
|
||||
.overlay(createWaterMark())
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,257 @@
|
|||
import { LitheRefresh, RefreshController } from "@abner/lithe_refresh";
|
||||
import { AxiosError } from "@ohos/axios";
|
||||
import { ToastUtil } from "@pura/harmony-utils/src/main/ets/action/ToastUtil";
|
||||
import { JSONUtil } from "@pura/harmony-utils/src/main/ets/utils/JSONUtil";
|
||||
import AppConstants from "../../app/AppConstant";
|
||||
import { AccompanPersonBean } from "../../model/resultModel/CheckPeopleResultModel";
|
||||
import { getPersonListByMainId } from "../../request/api/Api";
|
||||
import { StringUtils } from "../../util/StringUtils";
|
||||
import { BaseTopBar } from "../../view/custom/BaseTopTar";
|
||||
import { createWaterMark } from "../../view/custom/Watermark";
|
||||
import { fileUri } from "@kit.CoreFileKit";
|
||||
import { FileUtils } from "../../util/FileUtils";
|
||||
|
||||
/**
|
||||
* 随行人员
|
||||
*/
|
||||
@Preview
|
||||
@Component
|
||||
@Entry
|
||||
export struct AccompPersonPage {
|
||||
controller: RefreshController = new RefreshController()
|
||||
scroller: Scroller = new Scroller()
|
||||
@State personList: Array<AccompanPersonBean> = new Array;
|
||||
fileDir: string = "";
|
||||
pageNum: number = 1;
|
||||
total: number = 0;
|
||||
isRefreshStatus: number = 0;
|
||||
|
||||
aboutToAppear(): void {
|
||||
this.fileDir = FileUtils.ID_CARD_DIR;
|
||||
}
|
||||
|
||||
getAccompanPerson() {
|
||||
getPersonListByMainId(this.pageNum)
|
||||
.then((res) => {
|
||||
console.debug(JSONUtil.beanToJsonStr(res))
|
||||
if (this.isRefreshStatus == 1) {
|
||||
this.isRefreshStatus = 0
|
||||
this.controller.finishRefresh()
|
||||
if (res.code != 200) {
|
||||
ToastUtil.showToast(res.msg)
|
||||
return
|
||||
}
|
||||
if (res.data) {
|
||||
this.total = res.data.total;
|
||||
let rows = res.data.rows;
|
||||
if (rows && rows != undefined) {
|
||||
this.personList = new Array
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
let bean = rows[i];
|
||||
let filePate = `${this.fileDir}/${bean.sfz}.png`;
|
||||
bean.idCardPhoto = fileUri.getUriFromPath(filePate)
|
||||
this.personList.push(bean);
|
||||
}
|
||||
} else {
|
||||
ToastUtil.showToast("未查询到数据!")
|
||||
return
|
||||
}
|
||||
} else {
|
||||
ToastUtil.showToast("未查询到数据!")
|
||||
return
|
||||
}
|
||||
}
|
||||
if (this.isRefreshStatus == 2) {
|
||||
this.isRefreshStatus = 0
|
||||
this.controller.finishLoadMore()
|
||||
if (res.code != 200) {
|
||||
ToastUtil.showToast(res.msg)
|
||||
return
|
||||
}
|
||||
if (res.data) {
|
||||
this.total = res.data.total;
|
||||
let rows = res.data.rows;
|
||||
if (rows && rows != undefined) {
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
let bean = rows[i];
|
||||
let filePate = `${this.fileDir}/${bean.sfz}.png`;
|
||||
bean.idCardPhoto = fileUri.getUriFromPath(filePate)
|
||||
this.personList.push(bean);
|
||||
}
|
||||
if (this.pageNum*20>=this.total) {
|
||||
this.controller.closeLoadMore = true;
|
||||
ToastUtil.showToast("没有更多数据!")
|
||||
return
|
||||
}
|
||||
} else {
|
||||
ToastUtil.showToast("没有更多数据!")
|
||||
return
|
||||
}
|
||||
} else {
|
||||
ToastUtil.showToast("没有更多数据!")
|
||||
return
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((e: AxiosError) => {
|
||||
console.error(e.message)
|
||||
ToastUtil.showToast(e.message)
|
||||
if (this.isRefreshStatus == 1) {
|
||||
this.isRefreshStatus = 0
|
||||
this.controller.finishRefresh()
|
||||
return
|
||||
}
|
||||
if (this.isRefreshStatus == 2) {
|
||||
this.isRefreshStatus = 0
|
||||
this.controller.finishLoadMore()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
onPageShow(): void {
|
||||
this.isRefreshStatus = 1
|
||||
this.controller.isAutoRefresh = true
|
||||
|
||||
}
|
||||
|
||||
public getIcon(peopleStatus: string): Resource {
|
||||
if (peopleStatus.startsWith("涉稳")) {
|
||||
return $r("app.media.ic_type_stability")
|
||||
}
|
||||
if (peopleStatus.startsWith("涉恐")) {
|
||||
return $r("app.media.ic_type_fear")
|
||||
}
|
||||
if (peopleStatus.startsWith("关注")) {
|
||||
return $r("app.media.ic_type_focus")
|
||||
}
|
||||
if (peopleStatus.startsWith("云控")) {
|
||||
return $r("app.media.ic_type_control")
|
||||
}
|
||||
if (StringUtils.containsChar(peopleStatus, "精神")) {
|
||||
return $r("app.media.ic_type_fine")
|
||||
}
|
||||
if (peopleStatus.startsWith("非访")) {
|
||||
return $r("app.media.ic_type_non")
|
||||
}
|
||||
if (peopleStatus.startsWith("前科")) {
|
||||
return $r("app.media.ic_type_criminal_record")
|
||||
}
|
||||
if (StringUtils.containsChar(peopleStatus, "毒")) {
|
||||
return $r("app.media.ic_type_poison")
|
||||
}
|
||||
if (StringUtils.containsChar(peopleStatus, "临")) {
|
||||
return $r("app.media.ic_type_control")
|
||||
}
|
||||
if (StringUtils.containsChar(peopleStatus, "逃")) {
|
||||
return $r("app.media.ic_type_escape")
|
||||
}
|
||||
return $r("app.media.ic_type_normal");
|
||||
}
|
||||
|
||||
@Builder
|
||||
itemView(bean: AccompanPersonBean) {
|
||||
Row() {
|
||||
Image(bean.idCardPhoto)
|
||||
.width($r('app.float.default_88'))
|
||||
.height($r('app.float.default_100'))
|
||||
.margin({ left: $r('app.float.default_10') })
|
||||
|
||||
Column() {
|
||||
Row() {
|
||||
Text(bean.name)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
|
||||
Image(this.getIcon(StringUtils.get(bean.peopleStatusStr, "")))
|
||||
.width($r('app.float.default_24'))
|
||||
.height($r('app.float.default_24'))
|
||||
.margin({left:$r('app.float.default_5')})
|
||||
}
|
||||
|
||||
Text(bean.sfz)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.margin({ top: $r('app.float.default_10'), bottom: $r('app.float.default_10') })
|
||||
|
||||
Text(bean.address)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
}
|
||||
.height($r('app.float.default_120'))
|
||||
.layoutWeight(1)
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.margin({ left: $r('app.float.default_10') })
|
||||
|
||||
}
|
||||
.width(`calc(100% - 20vp)`)
|
||||
.height($r('app.float.default_120'))
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.justifyContent(FlexAlign.Start)
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.border({
|
||||
width: $r('app.float.default_1'),
|
||||
color: $r('app.color.colorGrey2'),
|
||||
radius: $r('app.float.default_5')
|
||||
})
|
||||
.margin({ left: $r('app.float.default_10'), right: $r('app.float.default_10') })
|
||||
}
|
||||
|
||||
@Builder
|
||||
listView() {
|
||||
List({ scroller: this.scroller, space: 10 }) {
|
||||
ForEach(this.personList, (item: AccompanPersonBean) => {
|
||||
ListItem() {
|
||||
this.itemView(item)
|
||||
}
|
||||
})
|
||||
}
|
||||
.listDirection(Axis.Vertical)
|
||||
.scrollBar(BarState.Off)
|
||||
.edgeEffect(EdgeEffect.None)
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.layoutWeight(1)
|
||||
.nestedScroll({
|
||||
scrollForward: NestedScrollMode.PARENT_FIRST,
|
||||
scrollBackward: NestedScrollMode.PARENT_FIRST
|
||||
})
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
BaseTopBar({
|
||||
title: $r('app.string.title_accompan_person'),
|
||||
})
|
||||
|
||||
LitheRefresh({
|
||||
scroller: this.scroller,
|
||||
controller: this.controller,
|
||||
itemLayout: () => {
|
||||
this.listView()
|
||||
},
|
||||
onRefresh: () => {
|
||||
this.controller.closeLoadMore= false;
|
||||
this.pageNum = 1;
|
||||
this.isRefreshStatus = 1;
|
||||
this.getAccompanPerson()
|
||||
},
|
||||
onLoadMore: () => {
|
||||
if (this.pageNum*20>=this.total) {
|
||||
this.controller.finishLoadMore()
|
||||
this.controller.closeLoadMore = true;
|
||||
ToastUtil.showToast("没有更多数据!")
|
||||
return
|
||||
}
|
||||
this.pageNum++;
|
||||
this.isRefreshStatus = 2;
|
||||
this.getAccompanPerson()
|
||||
}
|
||||
})
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height(AppConstants.PERCENTAGE_MAX)
|
||||
.backgroundColor($r('app.color.page_background'))
|
||||
.overlay(createWaterMark())
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,437 @@
|
|||
import { LitheRefresh, RefreshController } from '@abner/lithe_refresh';
|
||||
import { router } from '@kit.ArkUI';
|
||||
import { AxiosError } from '@ohos/axios';
|
||||
import { DateUtil, ToastUtil } from '@pura/harmony-utils';
|
||||
import AppConstants from '../../app/AppConstant';
|
||||
import { RequestCheckCarRecordModel } from '../../model/requestModel/CheckRequestModel';
|
||||
import { CheckPeopleRecordItem, ZdlxItem } from '../../model/resultModel/CheckPeopleResultModel';
|
||||
import { ErrorOfEmptyModel } from '../../model/uiModel/BeanModel';
|
||||
import { SkipCarCountParam } from '../../model/uiModel/PageParamModel';
|
||||
import { getCheckCarRecord } from '../../request/api/Api';
|
||||
import { cardRoundBorderStyle } from '../../style/BorderStyle';
|
||||
import { IdCardNumUtils } from '../../util/IdCardNumUtils';
|
||||
import { getCarStatusIcon, getCheckTypeIcon } from '../../util/StatusIconUtils';
|
||||
import { StringUtils } from '../../util/StringUtils';
|
||||
import { ToastUtils } from '../../util/ToasUtils';
|
||||
import { BaseTopBar } from '../../view/custom/BaseTopTar';
|
||||
import { createWaterMark } from '../../view/custom/Watermark';
|
||||
|
||||
@Preview
|
||||
@Entry
|
||||
@Component
|
||||
struct CarCheckDetailsPages {
|
||||
@State carNum: string = "";
|
||||
@State carZL: string = "";
|
||||
@State carPP: string = "";
|
||||
@State carJH: string = "";
|
||||
@State carFDJH: string = "";
|
||||
@State carSYR: string = "";
|
||||
@State idCardNum: string = "";
|
||||
@State carYS: string = "";
|
||||
//=================== 列表属性 ==================
|
||||
@State dataSet: Array<ESObject> | null = null;
|
||||
controller: RefreshController = new RefreshController()
|
||||
scroller: Scroller = new Scroller()
|
||||
total: number = 0;
|
||||
pageNum: number = 1;
|
||||
isRefreshStatus: number = 0;
|
||||
@State zdlxImg: Array<ZdlxItem> | undefined = undefined;
|
||||
|
||||
aboutToAppear(): void {
|
||||
this.analyzeCar()
|
||||
setTimeout(() => {
|
||||
this.controller.isAutoRefresh = true;
|
||||
}, 800)
|
||||
}
|
||||
|
||||
handlerErrorOrEmpty(model: ErrorOfEmptyModel) {
|
||||
ToastUtils.toastBottom(model.msg)
|
||||
if (this.isRefreshStatus == 1) {
|
||||
//刷新
|
||||
this.controller.finishRefresh()
|
||||
this.dataSet = new Array
|
||||
}
|
||||
if (this.isRefreshStatus == 2) {
|
||||
//加载
|
||||
this.controller.finishLoadMore()
|
||||
}
|
||||
this.isRefreshStatus = 0
|
||||
}
|
||||
|
||||
async getRecordListData() {
|
||||
let requestModel: RequestCheckCarRecordModel = {
|
||||
carNum: this.carNum,
|
||||
pageSize: '30',
|
||||
pageNum: this.pageNum,
|
||||
clsbdh: this.carJH
|
||||
}
|
||||
getCheckCarRecord(requestModel)
|
||||
.then((res) => {
|
||||
if (res.code == 200) {
|
||||
let list = res.rows;
|
||||
if (res.total){
|
||||
this.total =res.total
|
||||
}
|
||||
if (list) {
|
||||
if (this.isRefreshStatus == 1) {
|
||||
//刷新
|
||||
this.controller.finishRefresh()
|
||||
this.dataSet = new Array
|
||||
list.forEach((item) => {
|
||||
this.dataSet?.push(item)
|
||||
})
|
||||
}
|
||||
if (this.isRefreshStatus == 2) {
|
||||
//加载
|
||||
this.controller.finishLoadMore()
|
||||
list.forEach((item) => {
|
||||
this.dataSet?.push(item)
|
||||
})
|
||||
}
|
||||
this.isRefreshStatus = 0
|
||||
if (this.pageNum * 30 >= this.total) {
|
||||
this.controller.closeLoadMore = true;
|
||||
}
|
||||
} else {
|
||||
this.handlerErrorOrEmpty(new ErrorOfEmptyModel(0, "没有数据!"))
|
||||
}
|
||||
} else {
|
||||
this.handlerErrorOrEmpty(new ErrorOfEmptyModel(0, "没有数据!"))
|
||||
}
|
||||
})
|
||||
.catch((error: AxiosError) => {
|
||||
console.error("请求失败:", JSON.stringify(error))
|
||||
this.handlerErrorOrEmpty(new ErrorOfEmptyModel(-1, error.message))
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析车辆数据
|
||||
*/
|
||||
analyzeCar() {
|
||||
let pageParam = router.getParams() as SkipCarCountParam;
|
||||
if (pageParam == null) {
|
||||
return
|
||||
}
|
||||
this.carNum = pageParam.carNum
|
||||
this.carZL = pageParam.carZL
|
||||
this.carPP = pageParam.carPP
|
||||
this.carJH = pageParam.carJH
|
||||
this.carFDJH = pageParam.carFDJH
|
||||
this.carSYR = pageParam.carSYR
|
||||
this.idCardNum = pageParam.idCardNum
|
||||
this.carYS = pageParam.carYs
|
||||
|
||||
this.zdlxImg = new Array;
|
||||
if (StringUtils.containsChar(pageParam.carStatus,"被盗抢车辆")) {
|
||||
this.zdlxImg.push(new ZdlxItem("被盗抢车辆",2));
|
||||
}
|
||||
if (StringUtils.containsChar(pageParam.carStatus,"临控车辆")) {
|
||||
this.zdlxImg.push(new ZdlxItem("临控车辆",3));
|
||||
}
|
||||
if (StringUtils.containsChar(pageParam.carStatus,"临时关注车辆")) {
|
||||
this.zdlxImg.push(new ZdlxItem("临时关注车辆",3));
|
||||
}
|
||||
if (this.zdlxImg.length <=0){
|
||||
this.zdlxImg.push(new ZdlxItem("正常车辆",1));
|
||||
}
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
BaseTopBar({
|
||||
title: "盘查记录",
|
||||
leftClickEvent: () => {
|
||||
if (this.isRefreshStatus!=0){
|
||||
this.controller.finishRefresh()
|
||||
this.controller.finishLoadMore()
|
||||
DateUtil
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
this.carDetails()
|
||||
Row() {
|
||||
Image($r('app.media.icon_history_list'))
|
||||
.height($r('app.float.default_16'))
|
||||
.width($r('app.float.default_16'))
|
||||
Text('核查记录')
|
||||
.fontColor($r('app.float.default_14'))
|
||||
.fontColor($r('app.color.black'))
|
||||
.margin({ left: $r('app.float.default_8') })
|
||||
}
|
||||
.width('100%')
|
||||
.height($r('app.float.default_36'))
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.padding({ left: $r('app.float.default_10') })
|
||||
|
||||
Divider()
|
||||
.width('100%')
|
||||
.height($r('app.float.default_1'))
|
||||
.backgroundColor($r('app.color.page_background'))
|
||||
|
||||
LitheRefresh({
|
||||
scroller: this.scroller,
|
||||
controller: this.controller,
|
||||
itemLayout: () => {
|
||||
this.listView()
|
||||
},
|
||||
onRefresh: () => {
|
||||
this.controller.closeLoadMore = false;
|
||||
this.pageNum = 1;
|
||||
this.isRefreshStatus = 1;
|
||||
this.getRecordListData()
|
||||
},
|
||||
onLoadMore: () => {
|
||||
if (this.pageNum * 30 >= this.total) {
|
||||
this.controller.finishLoadMore()
|
||||
this.controller.closeLoadMore = true;
|
||||
ToastUtil.showToast("没有更多数据!")
|
||||
return
|
||||
}
|
||||
this.pageNum++;
|
||||
this.isRefreshStatus = 2;
|
||||
this.getRecordListData()
|
||||
}
|
||||
})
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.layoutWeight(1)
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.backgroundColor($r('app.color.page_background'))
|
||||
.overlay(createWaterMark())
|
||||
}
|
||||
|
||||
@Builder
|
||||
recordListItem(dataItem: CheckPeopleRecordItem) {
|
||||
Row() {
|
||||
Image(getCheckTypeIcon(dataItem.checkTypeStr))
|
||||
.width($r('app.float.default_32'))
|
||||
.height($r('app.float.default_32'))
|
||||
.margin({ left: $r('app.float.default_10'), right: $r('app.float.default_10') })
|
||||
|
||||
Column() {
|
||||
Row() {
|
||||
Text("警员:")
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
Text(dataItem.policeName)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.layoutWeight(1)
|
||||
Text(dataItem.checkTime)
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_12'))
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.padding({ right: $r('app.float.default_8') })
|
||||
.margin({ top: $r('app.float.default_5') })
|
||||
|
||||
Row() {
|
||||
Text("单位:")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_12'))
|
||||
Text(dataItem.deptName)
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_12'))
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.margin({ top: $r('app.float.default_5') })
|
||||
|
||||
Row() {
|
||||
Text("地址:")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_12'))
|
||||
Text(dataItem.checkAddress)
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_12'))
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.margin({ top: $r('app.float.default_5') })
|
||||
}
|
||||
.layoutWeight(1)
|
||||
}
|
||||
.width('95%')
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.border(cardRoundBorderStyle)
|
||||
.margin({ top: $r('app.float.default_10'), right: $r('app.float.default_10'), left: $r('app.float.default_10') })
|
||||
.padding({ top: $r('app.float.default_8'), bottom: $r('app.float.default_8') })
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新列表
|
||||
*/
|
||||
@Builder
|
||||
listView() {
|
||||
List({ scroller: this.scroller }) {
|
||||
ForEach(this.dataSet, (item: CheckPeopleRecordItem) => {
|
||||
ListItem() {
|
||||
this.recordListItem(item)
|
||||
}
|
||||
})
|
||||
}
|
||||
.listDirection(Axis.Vertical)
|
||||
.scrollBar(BarState.Off)
|
||||
.edgeEffect(EdgeEffect.None)
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.layoutWeight(1)
|
||||
.nestedScroll({
|
||||
scrollForward: NestedScrollMode.PARENT_FIRST,
|
||||
scrollBackward: NestedScrollMode.PARENT_FIRST
|
||||
})
|
||||
}
|
||||
|
||||
@Builder
|
||||
carDetails() {
|
||||
Column() {
|
||||
Row() {
|
||||
Text("机动车所有人:")
|
||||
.fontColor($r('app.color.bull'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
Text(this.carSYR)
|
||||
.fontColor($r('app.color.bull'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.margin({ left: $r('app.float.default_3') })
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.margin({ top: $r('app.float.default_10'), left: $r('app.float.default_8'), right: $r('app.float.default_8') })
|
||||
|
||||
Row() {
|
||||
Text(IdCardNumUtils.validateIdCardNum(this.idCardNum) ? "证件号码:" : '社会统一信用代码:')
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_15'))
|
||||
Text(this.idCardNum)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_15'))
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.margin({ top: $r('app.float.default_8'), left: $r('app.float.default_8'), right: $r('app.float.default_8') })
|
||||
|
||||
Row() {
|
||||
Row() {
|
||||
Text("车牌号码:")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_15'))
|
||||
Text(this.carNum)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_15'))
|
||||
|
||||
}
|
||||
.layoutWeight(1)
|
||||
|
||||
Row() {
|
||||
Text("号牌种类:")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_15'))
|
||||
Text(this.carZL)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_15'))
|
||||
.maxLines(1)
|
||||
.ellipsisMode(EllipsisMode.END)
|
||||
}
|
||||
.layoutWeight(1)
|
||||
|
||||
}
|
||||
.width('90%')
|
||||
.margin({ top: $r('app.float.default_8'), left: $r('app.float.default_8'), right: $r('app.float.default_8') })
|
||||
|
||||
Row() {
|
||||
Row() {
|
||||
Text("车辆颜色:")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_15'))
|
||||
Text(this.carYS)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_15'))
|
||||
|
||||
}
|
||||
.layoutWeight(1)
|
||||
|
||||
Row() {
|
||||
Text("车辆品牌:")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_15'))
|
||||
Text(this.carPP)
|
||||
.maxLines(1)
|
||||
.ellipsisMode(EllipsisMode.END)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_15'))
|
||||
}
|
||||
.layoutWeight(1)
|
||||
|
||||
}
|
||||
.width('90%')
|
||||
.margin({ top: $r('app.float.default_8'), left: $r('app.float.default_8'), right: $r('app.float.default_8') })
|
||||
|
||||
Row() {
|
||||
Text("车架号码:")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_15'))
|
||||
Text(this.carJH)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_15'))
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.margin({ top: $r('app.float.default_8'), left: $r('app.float.default_8'), right: $r('app.float.default_8') })
|
||||
|
||||
Row() {
|
||||
Text("发动机号:")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_15'))
|
||||
Text(this.carFDJH)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_15'))
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.margin({ top: $r('app.float.default_8'), left: $r('app.float.default_8'), right: $r('app.float.default_8') })
|
||||
|
||||
Divider()
|
||||
.width('98%')
|
||||
.height($r('app.float.default_1'))
|
||||
.backgroundColor($r('app.color.colorGrey1'))
|
||||
.margin({ left: $r('app.float.default_10'), top: $r('app.float.default_10') })
|
||||
|
||||
Row() {
|
||||
|
||||
Text('车辆属性:')
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.margin({ left: $r('app.float.default_15') })
|
||||
|
||||
List() {
|
||||
ForEach(this.zdlxImg, (item: ZdlxItem) => {
|
||||
ListItem() {
|
||||
Image(getCarStatusIcon(item.zdlx))
|
||||
.width($r('app.float.default_26'))
|
||||
.height($r('app.float.default_26'))
|
||||
}
|
||||
.onClick(() => {
|
||||
ToastUtils.toastBottom(item.zdlx)
|
||||
})
|
||||
})
|
||||
}
|
||||
.alignListItem(ListItemAlign.Center)
|
||||
.listDirection(Axis.Horizontal)
|
||||
.height(AppConstants.PERCENTAGE_MAX)
|
||||
.layoutWeight(1)
|
||||
}
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.height($r('app.float.default_38'))
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
|
||||
}
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.borderRadius(5)
|
||||
.justifyContent(FlexAlign.Start)
|
||||
.width('92%')
|
||||
.margin({
|
||||
top: $r('app.float.default_15'),
|
||||
left: $r('app.float.default_25'),
|
||||
right: $r('app.float.default_25')
|
||||
})
|
||||
.padding({ bottom: $r('app.float.default_2') })
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,602 @@
|
|||
import AppConstants from "../../app/AppConstant"
|
||||
import { createWaterMark } from "../../view/custom/Watermark"
|
||||
import { BaseTopBar } from "../../view/custom/BaseTopTar"
|
||||
import { GoodsBean, GoodsTypeBean } from "../../model/uiModel/GoodsModel"
|
||||
import { JSONUtil } from "@pura/harmony-utils/src/main/ets/utils/JSONUtil"
|
||||
import { PCCacheData } from "../../app/PCCacheData"
|
||||
import { StrUtil } from "@pura/harmony-utils/src/main/ets/utils/StrUtil"
|
||||
import { bufferToString } from "../../util/BufferUtil"
|
||||
import { uploadFile } from "../../request/api/Api"
|
||||
import { RuanseeAbitityStag } from "../../app/RuanseeAbitityStag"
|
||||
import { ToastUtils } from "../../util/ToasUtils"
|
||||
import { fileIo, fileUri } from "@kit.CoreFileKit"
|
||||
import { camera, cameraPicker } from "@kit.CameraKit"
|
||||
import { ImageUtil } from "@pura/harmony-utils"
|
||||
import { LoadingDialog } from "../../view/dialog/LoadingDialog"
|
||||
import { StringUtils } from "../../util/StringUtils"
|
||||
import { AxiosError } from "@ohos/axios"
|
||||
import { AddGoodsDialog } from "../../view/dialog/AddGoodsDialog"
|
||||
import { DateFormat, DateUtils } from "../../util/DateUtils"
|
||||
import { router } from "@kit.ArkUI"
|
||||
import { BasePageResult } from "../../model/uiModel/PageResultModel"
|
||||
import { FileUtils } from "../../util/FileUtils"
|
||||
|
||||
/**
|
||||
* 街面盘查
|
||||
*/
|
||||
@Preview
|
||||
@Component
|
||||
@Entry
|
||||
export struct CheckGoodsPage {
|
||||
@State backImage: Resource = $r('app.media.icon_back3')
|
||||
@State isShowPopup: boolean = false
|
||||
@State goodsTypeData: Array<GoodsTypeBean> = new Array
|
||||
@State goodsDataList: Array<GoodsBean> = new Array
|
||||
// goodsTypeList: ArrayList<GoodsTypeBean> = new ArrayList()
|
||||
@State loadDialogTips: string | Resource = $r('app.string.loading_check_people')
|
||||
@State goodsXczp: string | undefined = undefined
|
||||
@State goodsXczpId: string | undefined = undefined
|
||||
@State goodsXczpStatus: boolean = false
|
||||
@State selectTypeData: GoodsTypeBean | undefined = undefined
|
||||
@State inputCount: string = "";
|
||||
@State remark: string = "";
|
||||
goodsId: string = "";
|
||||
selectIndex: number = 0;
|
||||
// allCount: number = 0
|
||||
dialogController: CustomDialogController = new CustomDialogController({
|
||||
builder: LoadingDialog({
|
||||
loadingTips: this.loadDialogTips,
|
||||
}),
|
||||
autoCancel: false // 关键参数
|
||||
});
|
||||
selectGoodsTypeController: CustomDialogController = new CustomDialogController({
|
||||
builder: AddGoodsDialog({
|
||||
goodsTypeData: this.goodsTypeData,
|
||||
clickItem: (item, selectIndex) => {
|
||||
this.selectTypeData = item
|
||||
this.selectGoodsTypeController.close()
|
||||
this.isShowPopup = true;
|
||||
this.selectIndex = selectIndex;
|
||||
}
|
||||
}),
|
||||
cornerRadius: 3,
|
||||
autoCancel: false,
|
||||
backgroundColor: Color.Transparent, // 背景透明
|
||||
backgroundBlurStyle: BlurStyle.NONE // 必须关闭模糊材质
|
||||
});
|
||||
|
||||
aboutToAppear(): void {
|
||||
let wpJson = PCCacheData.pcCacheData.goodsJson;
|
||||
this.getUIContext().getHostContext()?.resourceManager.getRawFileContent('checkData/GoodsTypeData.json')
|
||||
.then(value => {
|
||||
let enablementList = JSON.parse(bufferToString(value.buffer)) as GoodsTypeBean[];
|
||||
if (StrUtil.isNotEmpty(wpJson) && JSONUtil.isJSONStr(wpJson)) {
|
||||
this.goodsDataList = JSONUtil.jsonToArray<GoodsBean>(wpJson)
|
||||
}
|
||||
if (this.goodsDataList) {
|
||||
enablementList.forEach(element => {
|
||||
if (!this.isContainGoodsType(this.goodsDataList!, element)) {
|
||||
this.goodsTypeData.push(element);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
enablementList.forEach(element => {
|
||||
this.goodsTypeData.push(element);
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
onPageHide(): void {
|
||||
if (this.goodsDataList && this.goodsDataList.length > 0) {
|
||||
PCCacheData.pcCacheData.goodsJson = JSONUtil.beanToJsonStr(this.goodsDataList)
|
||||
PCCacheData.pcCacheData.wpCount = this.goodsDataList.length
|
||||
}
|
||||
}
|
||||
|
||||
onBackPress(): boolean | void {
|
||||
this.backOneLevelPage()
|
||||
return true;
|
||||
}
|
||||
|
||||
backOneLevelPage() {
|
||||
if (this.goodsDataList && this.goodsDataList.length > 0) {
|
||||
let param: BasePageResult = {
|
||||
type: 3,
|
||||
what: 1,
|
||||
data: this.goodsDataList.length
|
||||
}
|
||||
router.back({ url: "ui/pages/StreetInspectionPages", params: param })
|
||||
} else {
|
||||
router.back();
|
||||
}
|
||||
}
|
||||
|
||||
isContainGoodsType(goodsData: Array<GoodsBean>, typeBean: GoodsTypeBean): boolean {
|
||||
for (let i = 0; i < goodsData.length; i++) {
|
||||
if (goodsData[i].name == typeBean.thingsname) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 拍照
|
||||
*/
|
||||
async takePhoto() {
|
||||
this.isShowPopup = false;
|
||||
let pathDir = FileUtils.IMAGE_DIR;
|
||||
let fileName = `${new Date().getTime()}.JPEG`
|
||||
let filePath = `${pathDir}/${fileName}`
|
||||
let imageFileUri: string | undefined = undefined;
|
||||
fileIo.createRandomAccessFileSync(filePath, fileIo.OpenMode.CREATE);
|
||||
|
||||
let fileUris = fileUri.getUriFromPath(filePath);
|
||||
let pickerProfile: cameraPicker.PickerProfile = {
|
||||
cameraPosition: camera.CameraPosition.CAMERA_POSITION_BACK,
|
||||
saveUri: fileUris,
|
||||
};
|
||||
let result: cameraPicker.PickerResult =
|
||||
await cameraPicker.pick(getContext(), [cameraPicker.PickerMediaType.PHOTO],
|
||||
pickerProfile);
|
||||
console.info(`picker resultCode: ${result.resultCode},resultUri: ${result.resultUri},mediaType: ${result.mediaType}`);
|
||||
if (result.resultCode == 0) {
|
||||
if (result.mediaType === cameraPicker.PickerMediaType.PHOTO) {
|
||||
imageFileUri = result.resultUri
|
||||
imageFileUri = await ImageUtil.compressPhoto(imageFileUri, 150);
|
||||
// this.peoplePhoto = imageFileUri;
|
||||
this.loadDialogTips = "正在上传,请稍后..."
|
||||
this.dialogController.open()
|
||||
this.updatePhoto(imageFileUri);
|
||||
}
|
||||
} else {
|
||||
this.isShowPopup = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传照片
|
||||
* @param imageFileUri
|
||||
*/
|
||||
updatePhoto(imageFileUri: string) {
|
||||
uploadFile(imageFileUri, this.goodsId)
|
||||
.then((res) => {
|
||||
this.dialogController.close()
|
||||
this.isShowPopup = true;
|
||||
console.debug(JSON.stringify(res));
|
||||
if (res.code == 200) {
|
||||
this.goodsXczp = RuanseeAbitityStag.convertPhotoUrl(StringUtils.get(res.data?.url, ""));
|
||||
this.goodsXczpId = StringUtils.get(res.data?.photoId, "");
|
||||
this.goodsXczpStatus = true;
|
||||
}
|
||||
})
|
||||
.catch((error: AxiosError) => {
|
||||
this.dialogController.close()
|
||||
this.isShowPopup = true;
|
||||
ToastUtils.toastCenter(`上传失败:${error.message}}`)
|
||||
console.error(error.message);
|
||||
})
|
||||
}
|
||||
|
||||
@Builder
|
||||
addGoodsPopup() {
|
||||
Column() {
|
||||
Stack({ alignContent: Alignment.TopStart }) {
|
||||
Text("添加物品")
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height($r('app.float.default_46'))
|
||||
.textAlign(TextAlign.Center)
|
||||
.align(Alignment.Center)
|
||||
|
||||
Row(){
|
||||
Image($r('app.media.icon_colse'))
|
||||
.width($r('app.float.default_22'))
|
||||
.height($r('app.float.default_22'))
|
||||
.onClick(() => {
|
||||
this.isShowPopup = false;
|
||||
this.goodsId = RuanseeAbitityStag.appCache.getRandomId()
|
||||
this.inputCount = ""
|
||||
this.goodsXczp = undefined
|
||||
this.goodsXczpStatus = false;
|
||||
})
|
||||
}
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.padding({ left: $r('app.float.default_15') })
|
||||
.justifyContent(FlexAlign.Start)
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height($r('app.float.default_46'))
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height($r('app.float.default_46'))
|
||||
|
||||
|
||||
Divider()
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height($r('app.float.default_1'))
|
||||
.backgroundColor($r('app.color.colorGrey3'))
|
||||
|
||||
Text("请选择物品类别:")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.height($r('app.float.default_40'))
|
||||
.width('90%')
|
||||
.textAlign(TextAlign.Start)
|
||||
.align(Alignment.Start)
|
||||
.margin({ left: $r('app.float.default_10'), right: $r('app.float.default_10') })
|
||||
|
||||
Row() {
|
||||
Text(this.selectTypeData!.thingsname)
|
||||
.fontColor($r('app.color.bull'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.layoutWeight(1)
|
||||
.textAlign(TextAlign.Start)
|
||||
.margin({ left: $r("app.float.default_10") })
|
||||
.align(Alignment.Start)
|
||||
|
||||
Text("点击选择")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_12'))
|
||||
.margin({ left: $r('app.float.default_10'), right: $r('app.float.default_10') })
|
||||
}
|
||||
.width('90%')
|
||||
.height($r('app.float.default_46'))
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.margin({
|
||||
top: $r('app.float.default_5'), left: $r('app.float.default_10'), right: $r('app.float.default_10')
|
||||
})
|
||||
.border({
|
||||
width: $r('app.float.default_1'),
|
||||
color: $r('app.color.colorGrey3'),
|
||||
radius: $r('app.float.default_5')
|
||||
})
|
||||
.onClick(() => {
|
||||
this.isShowPopup = false;
|
||||
this.selectGoodsTypeController.open()
|
||||
})
|
||||
|
||||
Text("请输入物品数量:")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.width('90%')
|
||||
.height($r('app.float.default_40'))
|
||||
.textAlign(TextAlign.Start)
|
||||
.align(Alignment.Start)
|
||||
.margin({
|
||||
left: $r('app.float.default_10'),
|
||||
right: $r('app.float.default_10')
|
||||
})
|
||||
|
||||
Row() {
|
||||
TextInput({ text: this.inputCount, placeholder: "请输入数量" })
|
||||
.border({
|
||||
width: $r('app.float.default_1'),
|
||||
color: $r('app.color.colorGrey3'),
|
||||
radius: $r('app.float.default_5')
|
||||
})
|
||||
.onChange((res) => {
|
||||
this.inputCount = res
|
||||
})
|
||||
.type(InputType.Number)
|
||||
.layoutWeight(1)
|
||||
|
||||
Text(this.selectTypeData!.dwname)
|
||||
.fontColor($r('app.color.bull'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.margin({ left: $r('app.float.default_10'), right: $r('app.float.default_10') })
|
||||
|
||||
}
|
||||
.height($r('app.float.default_48'))
|
||||
.width('90%')
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.margin({ left: $r('app.float.default_10'), right: $r('app.float.default_10') })
|
||||
|
||||
Text("请输入备注:")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.width('90%')
|
||||
.height($r('app.float.default_40'))
|
||||
.textAlign(TextAlign.Start)
|
||||
.align(Alignment.Start)
|
||||
.margin({
|
||||
left: $r('app.float.default_10'),
|
||||
right: $r('app.float.default_10')
|
||||
})
|
||||
|
||||
TextArea({ text: this.remark, placeholder: "请输入备注信息(50字以内)" })
|
||||
.placeholderColor($r('app.color.colorGrey6'))
|
||||
.placeholderFont({
|
||||
size: $r('app.float.text_size_14'),
|
||||
weight: FontWeight.Normal
|
||||
})
|
||||
.height($r('app.float.default_68'))
|
||||
.width("90%")
|
||||
.onChange((res) => {
|
||||
this.remark = res
|
||||
})
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.margin({
|
||||
left: $r('app.float.default_10'),
|
||||
right: $r('app.float.default_10')
|
||||
})
|
||||
.border({
|
||||
width: $r('app.float.default_1'),
|
||||
color: $r('app.color.colorGrey3'),
|
||||
radius: $r('app.float.default_5')
|
||||
})
|
||||
Text("请拍照:")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.width('90%')
|
||||
.height($r('app.float.default_40'))
|
||||
.textAlign(TextAlign.Start)
|
||||
.align(Alignment.Start)
|
||||
.margin({
|
||||
left: $r('app.float.default_10'),
|
||||
right: $r('app.float.default_10')
|
||||
})
|
||||
|
||||
this.goodsPhoto()
|
||||
|
||||
Button("完成")
|
||||
.width('80%')
|
||||
.height($r('app.float.default_40'))
|
||||
.margin({ top: $r('app.float.default_12'), bottom: $r('app.float.default_12') })
|
||||
.onClick(() => {
|
||||
this.addGoodsCompleted()
|
||||
})
|
||||
// 3 + 3*3*3*4
|
||||
}
|
||||
.height('72%')
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
.width("95%")
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.overlay(createWaterMark())
|
||||
.border({
|
||||
radius: { topLeft: $r('app.float.default_20'), topRight: $r('app.float.default_20') }
|
||||
})
|
||||
}
|
||||
|
||||
addGoodsCompleted() {
|
||||
if (StrUtil.isEmpty(this.inputCount) || this.inputCount === "0") {
|
||||
ToastUtils.toastBottom("请输入数量!")
|
||||
return
|
||||
}
|
||||
|
||||
if (StrUtil.isEmpty(this.goodsXczp)) {
|
||||
ToastUtils.toastBottom("请拍摄物品照片!")
|
||||
return
|
||||
}
|
||||
|
||||
// this.allCount += Number.parseFloat(this.inputCount);
|
||||
|
||||
let bean = new GoodsBean();
|
||||
bean.name = StringUtils.get(this.selectTypeData?.thingsname, "")
|
||||
bean.count = StringUtils.get(this.inputCount, "0")
|
||||
bean.createTime = DateUtils.formatDateStr(new Date(), DateFormat.YYYYhMMhDDkHHdMMdSS)
|
||||
bean.unit = StringUtils.get(this.selectTypeData?.dwname, "")
|
||||
bean.dwValue = StringUtils.get(this.selectTypeData?.dwvalue, "")
|
||||
bean.thingsValue = StringUtils.get(this.selectTypeData?.thingsvalue, "")
|
||||
bean.remark = StringUtils.get(this.remark, "")
|
||||
bean.category = StringUtils.get(this.selectTypeData?.thingsname, "")
|
||||
// bean.dangerLevel = StringUtils.get(this.selectTypeData?.thingsname, "")
|
||||
bean.photoUrl = StringUtils.get(this.goodsXczp, "")
|
||||
bean.photoId = StringUtils.get(this.goodsXczpId, "")
|
||||
bean.userName = RuanseeAbitityStag.userCache.getUserCode
|
||||
bean.policeName = RuanseeAbitityStag.userCache.getUserName
|
||||
bean.idCard = RuanseeAbitityStag.userCache.getIdCardNum
|
||||
bean.deptId = RuanseeAbitityStag.userCache.getDeptCode
|
||||
bean.deptName = RuanseeAbitityStag.userCache.getDeptName
|
||||
bean.historyId = RuanseeAbitityStag.appCache.getHistoryId()
|
||||
bean.uuid = this.goodsId
|
||||
bean.checkTime = DateUtils.formatDateStr(new Date(), DateFormat.YYYYhMMhDDkHHdMMdSS)
|
||||
|
||||
this.goodsDataList.splice(0, 0, bean)
|
||||
this.isShowPopup = false;
|
||||
this.goodsTypeData.splice(this.selectIndex, 1);
|
||||
|
||||
this.selectTypeData = this.goodsTypeData[0]
|
||||
this.goodsId = RuanseeAbitityStag.appCache.getRandomId()
|
||||
this.inputCount = ""
|
||||
this.goodsXczp = undefined
|
||||
this.goodsXczpStatus = false;
|
||||
}
|
||||
|
||||
@Builder
|
||||
goodsPhoto() {
|
||||
Row() {
|
||||
RelativeContainer() { // 创建相对布局容器
|
||||
Image(this.goodsXczp)
|
||||
.width($r('app.float.default_92'))
|
||||
.height($r('app.float.default_100'))
|
||||
.alignRules({
|
||||
center: { anchor: '__container__', align: VerticalAlign.Center }, // 水平居中
|
||||
middle: { anchor: '__container__', align: HorizontalAlign.Center } // 垂直居中
|
||||
})
|
||||
.id('image') // 设置唯一ID
|
||||
|
||||
// 删除按钮(使用图标)
|
||||
// Image($r('app.media.icon_delete'))
|
||||
// .width($r('app.float.default_25'))// 按钮宽度
|
||||
// .height($r('app.float.default_25'))// 按钮高度
|
||||
// .alignRules({
|
||||
// 'top': { anchor: 'image', align: VerticalAlign.Top }, // 顶部对齐图片顶部
|
||||
// 'right': { anchor: 'image', align: HorizontalAlign.End } // 右侧对齐图片右侧
|
||||
// })
|
||||
// .id('deleteBtn')
|
||||
}
|
||||
.width($r('app.float.default_110')) // 容器宽度占满父组件
|
||||
.height(AppConstants.PERCENTAGE_MAX) // 容器固定高度
|
||||
.margin({ left: $r('app.float.default_10') })
|
||||
.visibility(this.goodsXczpStatus ? Visibility.Visible : Visibility.Hidden)
|
||||
|
||||
Column() {
|
||||
Image($r('app.media.imp_upload'))
|
||||
.width($r('app.float.default_46'))
|
||||
.height($r('app.float.default_38'))
|
||||
.autoResize(true)
|
||||
.objectFit(ImageFit.Auto)
|
||||
|
||||
Text("添加照片")
|
||||
.fontColor($r('app.color.bull'))
|
||||
.fontSize($r('app.float.text_size_12'))
|
||||
.margin({ top: $r('app.float.default_10') })
|
||||
}
|
||||
.visibility(this.goodsXczpStatus ? Visibility.Hidden : Visibility.Visible)
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.width($r('app.float.default_92'))
|
||||
.height('88%')
|
||||
.onClick(() => {
|
||||
this.takePhoto()
|
||||
})
|
||||
.border({
|
||||
width: $r('app.float.default_1'),
|
||||
radius: 3,
|
||||
color: $r('app.color.colorGrey3')
|
||||
})
|
||||
}
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.borderRadius(5)
|
||||
.height($r('app.float.default_110'))
|
||||
.justifyContent(FlexAlign.Start)
|
||||
.width('92%')
|
||||
.margin({
|
||||
left: $r('app.float.default_25'),
|
||||
right: $r('app.float.default_25')
|
||||
})
|
||||
.margin({ top: $r('app.float.default_24') })
|
||||
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
BaseTopBar({
|
||||
title: "随行物品",
|
||||
rightText: "提交",
|
||||
leftClickEvent: () => {
|
||||
this.backOneLevelPage()
|
||||
},
|
||||
rightClickEvent: () => {
|
||||
this.backOneLevelPage()
|
||||
}
|
||||
})
|
||||
|
||||
List() {
|
||||
ForEach(this.goodsDataList, (item: GoodsBean) => {
|
||||
ListItem() {
|
||||
this.goodsItem(item)
|
||||
}
|
||||
})
|
||||
}
|
||||
.layoutWeight(1)
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
|
||||
Button("点击添加")
|
||||
.width('89%')
|
||||
.margin({ bottom: $r('app.float.default_22') })
|
||||
.onClick(() => {
|
||||
if (this.isShowPopup) {
|
||||
return
|
||||
}
|
||||
if (this.goodsTypeData == null || this.goodsTypeData == undefined || this.goodsTypeData.length < 1) {
|
||||
ToastUtils.toastBottom("获取物品类别失败!")
|
||||
return
|
||||
}
|
||||
if (!this.selectTypeData) {
|
||||
this.selectTypeData = this.goodsTypeData[0]
|
||||
this.goodsId = RuanseeAbitityStag.appCache.getRandomId()
|
||||
this.inputCount = ""
|
||||
this.goodsXczp = undefined
|
||||
this.goodsXczpStatus = false;
|
||||
}
|
||||
this.isShowPopup = true;
|
||||
})
|
||||
.bindPopup(this.isShowPopup, {
|
||||
builder: () => this.addGoodsPopup(),
|
||||
autoCancel: false,
|
||||
placement: Placement.Top,
|
||||
mask: { color: 0x80000000 },
|
||||
maskColor: 0x80000000,
|
||||
onStateChange: (v) => {
|
||||
this.isShowPopup = v.isVisible;
|
||||
}
|
||||
})
|
||||
.onKeyEvent((event: KeyEvent) => {
|
||||
if (event.type === KeyType.Down && event.keyCode === 4) {
|
||||
if (this.isShowPopup) {
|
||||
// 如果弹窗打开,阻止返回键行为
|
||||
return true; // 返回 true 表示已消费该事件
|
||||
}
|
||||
}
|
||||
return false; // 允许默认行为
|
||||
})
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height(AppConstants.PERCENTAGE_MAX)
|
||||
.backgroundColor($r('app.color.page_background'))
|
||||
.overlay(createWaterMark())
|
||||
}
|
||||
|
||||
@Builder
|
||||
goodsItem(item: GoodsBean) {
|
||||
Row() {
|
||||
Image(item.photoUrl)
|
||||
.width($r('app.float.default_58'))
|
||||
.height($r('app.float.default_72'))
|
||||
.margin({ left: $r('app.float.default_10') })
|
||||
|
||||
Column() {
|
||||
Row() {
|
||||
Text(item.name)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
|
||||
Text(item.count)
|
||||
.fontColor($r('app.color.colorYellow7'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({ left: $r('app.float.default_5'), right: $r('app.float.default_5') })
|
||||
|
||||
Text(item.unit)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
|
||||
}
|
||||
.justifyContent(FlexAlign.Start)
|
||||
|
||||
Text(StringUtils.get(item.remark, "暂无"))
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.margin({ top: $r('app.float.default_5'), bottom: $r('app.float.default_5') })
|
||||
|
||||
Text(item.createTime)
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
|
||||
}
|
||||
.margin({ left: $r('app.float.default_6') })
|
||||
.layoutWeight(1)
|
||||
.height($r('app.float.default_84'))
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.justifyContent(FlexAlign.Center)
|
||||
}
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.width('90%')
|
||||
.border({
|
||||
width: $r('app.float.default_1'),
|
||||
color: $r('app.color.colorGrey3'),
|
||||
radius: $r('app.float.default_3')
|
||||
})
|
||||
.height($r('app.float.default_92'))
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.margin({ top: $r('app.float.default_10'), left: $r('app.float.default_10'), right: $r('app.float.default_10') })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,356 @@
|
|||
import { JSONUtil } from "@pura/harmony-utils/src/main/ets/utils/JSONUtil";
|
||||
import AppConstants from "../../app/AppConstant";
|
||||
import { PCCacheData } from "../../app/PCCacheData";
|
||||
import { RuanseeAbitityStag } from "../../app/RuanseeAbitityStag";
|
||||
import { CheckSubmitEntity, CheckSubmitModel } from "../../model/requestModel/CheckRequestModel";
|
||||
import { CheckReasonModel } from "../../model/uiModel/GoodsModel";
|
||||
import { cardRoundBorderGreyStyle } from "../../style/BorderStyle";
|
||||
import { bufferToString } from "../../util/BufferUtil";
|
||||
import { DateFormat, DateUtils } from "../../util/DateUtils";
|
||||
import { StringUtils } from "../../util/StringUtils";
|
||||
import { BaseTopBar } from "../../view/custom/BaseTopTar";
|
||||
import { SelectCheckReasonDialog } from "../../view/dialog/SelectCheckReasonDialog";
|
||||
import router from "@ohos.router";
|
||||
import { SkipHandOverParam } from "../../model/uiModel/PageParamModel";
|
||||
import { getCoordinateDescription, saveMainHistoryAndChangeStatus } from "../../request/api/Api";
|
||||
import { AxiosError } from "@ohos/axios";
|
||||
import { createWaterMark } from "../../view/custom/Watermark";
|
||||
import { ToastUtil } from "@pura/harmony-utils/src/main/ets/action/ToastUtil";
|
||||
import { BasePageResult } from "../../model/uiModel/PageResultModel";
|
||||
import { geoLocationManager } from "@kit.LocationKit";
|
||||
import { AppCache } from "../../app/AppCache";
|
||||
|
||||
/**
|
||||
* 移交操作
|
||||
*/
|
||||
@Preview
|
||||
@Component
|
||||
@Entry
|
||||
export struct HandOverPage {
|
||||
@State checkReasonData: CheckReasonModel[] = []
|
||||
@State checkReason: string = "请选择盘查原因"
|
||||
@State selectCheckReasonValue: string = "1";
|
||||
@State inputAddress: string = "";
|
||||
@State inputRemark: string = "";
|
||||
pageParam: SkipHandOverParam | undefined = undefined;
|
||||
|
||||
//定位状态
|
||||
locationStatus:boolean = false;
|
||||
|
||||
aboutToAppear(): void {
|
||||
this.pageParam = router.getParams() as SkipHandOverParam;
|
||||
this.getUIContext().getHostContext()?.resourceManager.getRawFileContent('checkData/CheckReason.json')
|
||||
.then(value => {
|
||||
this.checkReasonData = JSON.parse(bufferToString(value.buffer)) as CheckReasonModel[];
|
||||
if (this.checkReasonData && this.checkReasonData.length > 0) {
|
||||
this.checkReason = StringUtils.get(this.checkReasonData[0].dictLabel, "");
|
||||
this.selectCheckReasonValue = StringUtils.get(this.checkReasonData[0].dictValue, "1");
|
||||
}
|
||||
})
|
||||
if(StringUtils.isNullOrEmpty(RuanseeAbitityStag.appCache.getLocationAddress)){
|
||||
this.getCurrentLocation()
|
||||
}else {
|
||||
this.inputAddress = RuanseeAbitityStag.appCache.getLocationAddress
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 读取缓存的位置
|
||||
* @returns
|
||||
*/
|
||||
getLastLocation(): geoLocationManager.Location | undefined {
|
||||
try {
|
||||
let location = geoLocationManager.getLastLocation();
|
||||
return location;
|
||||
} catch (err) {
|
||||
console.info("passPage", "errCode:" + err.code + ", message:" + err.message);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
private locationCallback = (data: geoLocationManager.Location) => {
|
||||
console.info("passPage", 'current location: ' + JSON.stringify(data));
|
||||
AppCache.getAppCache().setLocation(data);
|
||||
this.getAddressByLongitudeLatitude(data)
|
||||
}
|
||||
|
||||
onPageHide(): void {
|
||||
if (this.locationStatus) {
|
||||
geoLocationManager.off('locationChange', this.locationCallback);
|
||||
this.locationStatus = false;
|
||||
}
|
||||
// 在页面销毁时解除监听
|
||||
}
|
||||
|
||||
/**
|
||||
* 持续定位 获取位置
|
||||
*/
|
||||
getCurrentLocation() {
|
||||
let request2: geoLocationManager.ContinuousLocationRequest = {
|
||||
"interval": 60,
|
||||
"locationScenario": geoLocationManager.UserActivityScenario.SPORT
|
||||
}
|
||||
try {
|
||||
geoLocationManager.on('locationChange', request2,this.locationCallback )
|
||||
this.locationStatus = true;
|
||||
// let request: geoLocationManager.SingleLocationRequest = {
|
||||
// 'locatingPriority': geoLocationManager.LocatingPriority.PRIORITY_LOCATING_SPEED,
|
||||
// 'locatingTimeoutMs': 10000
|
||||
// }
|
||||
// geoLocationManager.getCurrentLocation(request) 街面盘查 StreetFront Street level search
|
||||
// .then((result) => { // 调用getCurrentLocation获取当前设备位置,通过promise接收上报的位置
|
||||
// console.info(TAG, 'current location: ' + JSON.stringify(result));
|
||||
// })
|
||||
// .catch((error: BusinessError) => { // 接收上报的错误码
|
||||
// console.info(TAG, 'promise, getCurrentLocation: error=' + JSON.stringify(error));
|
||||
// });
|
||||
} catch (err) {
|
||||
console.info("passPage", "errCode:" + JSON.stringify(err));
|
||||
}
|
||||
}
|
||||
|
||||
getAddressByLongitudeLatitude(location :geoLocationManager.Location){
|
||||
getCoordinateDescription()
|
||||
.then((res)=>{
|
||||
console.debug(JSONUtil.beanToJsonStr(res))
|
||||
if (res&&res.length>0) {
|
||||
let address = res[0];
|
||||
if (address) {
|
||||
this.inputAddress = StringUtils.get(address.address,"");
|
||||
if (this.locationStatus) {
|
||||
geoLocationManager.off('locationChange', this.locationCallback);
|
||||
this.locationStatus = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((error:AxiosError)=>{
|
||||
console.error(error.message)
|
||||
})
|
||||
}
|
||||
|
||||
selectCheckReasonController: CustomDialogController = new CustomDialogController({
|
||||
builder: SelectCheckReasonDialog({
|
||||
checkReasonData: this.checkReasonData,
|
||||
clickItem: (item, selectIndex) => {
|
||||
this.checkReason = StringUtils.get(item.dictLabel, "");
|
||||
this.selectCheckReasonValue = StringUtils.get(item.dictValue, "1");
|
||||
this.selectCheckReasonController.close()
|
||||
}
|
||||
}),
|
||||
cornerRadius: 3,
|
||||
autoCancel: false,
|
||||
backgroundColor: Color.Transparent, // 背景透明
|
||||
backgroundBlurStyle: BlurStyle.NONE // 必须关闭模糊材质
|
||||
});
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
BaseTopBar({
|
||||
title: "完善盘查信息"
|
||||
})
|
||||
|
||||
Text("盘查原因:")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.width('90%')
|
||||
.textAlign(TextAlign.Start)
|
||||
.margin({
|
||||
left: $r('app.float.default_10'),
|
||||
bottom: $r('app.float.default_5'),
|
||||
top: $r('app.float.default_20')
|
||||
})
|
||||
|
||||
Row() {
|
||||
Text(this.checkReason)
|
||||
.fontColor($r('app.color.bull'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.layoutWeight(1)
|
||||
.textAlign(TextAlign.Start)
|
||||
.margin({ left: $r("app.float.default_10") })
|
||||
.align(Alignment.Start)
|
||||
|
||||
Text("点击选择")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_12'))
|
||||
.margin({ left: $r('app.float.default_10'), right: $r('app.float.default_10') })
|
||||
}
|
||||
.width(`calc(100% - 20vp)`)
|
||||
.height($r('app.float.default_43'))
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.margin({
|
||||
top: $r('app.float.default_10'),
|
||||
bottom: $r('app.float.default_5'),
|
||||
left: $r('app.float.default_10'),
|
||||
right: $r('app.float.default_10')
|
||||
})
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.border(cardRoundBorderGreyStyle)
|
||||
.padding({left:$r('app.float.default_8'),right:$r('app.float.default_8')})
|
||||
.onClick(() => {
|
||||
this.selectCheckReasonController.open()
|
||||
})
|
||||
|
||||
|
||||
Text("盘查地址:")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.width('90%')
|
||||
.textAlign(TextAlign.Start)
|
||||
.margin({
|
||||
left: $r('app.float.default_10'),
|
||||
bottom: $r('app.float.default_5'),
|
||||
top: $r('app.float.default_10')
|
||||
})
|
||||
|
||||
TextInput({ text: this.inputAddress, placeholder: "请输入地址" })
|
||||
.width(`calc(100% - 20vp)`)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.textAlign(TextAlign.Start)
|
||||
.align(Alignment.Center)
|
||||
.height($r('app.float.default_40'))
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.textAlign(TextAlign.Start)
|
||||
.margin({
|
||||
top: $r('app.float.default_5'),
|
||||
bottom: $r('app.float.default_5'),
|
||||
left: $r('app.float.default_10'),
|
||||
right: $r('app.float.default_10')
|
||||
})
|
||||
.onChange((res) => {
|
||||
this.inputAddress = res;
|
||||
})
|
||||
.border(cardRoundBorderGreyStyle)
|
||||
|
||||
Text("备注信息:")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.width('90%')
|
||||
.textAlign(TextAlign.Start)
|
||||
.margin({
|
||||
left: $r('app.float.default_10'),
|
||||
bottom: $r('app.float.default_5'),
|
||||
top: $r('app.float.default_10')
|
||||
})
|
||||
|
||||
TextArea({ text: this.inputRemark, placeholder: "请输入备注信息" })
|
||||
.width(`calc(100% - 20vp)`)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.textAlign(TextAlign.Start)
|
||||
.align(Alignment.TopStart)
|
||||
.height($r('app.float.default_88'))
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.margin({
|
||||
top: $r('app.float.default_5'),
|
||||
bottom: $r('app.float.default_5'),
|
||||
left: $r('app.float.default_10'),
|
||||
right: $r('app.float.default_10')
|
||||
})
|
||||
.onChange((res) => {
|
||||
this.inputRemark = res;
|
||||
})
|
||||
.border(cardRoundBorderGreyStyle)
|
||||
|
||||
Column()
|
||||
.layoutWeight(1)
|
||||
|
||||
Button('完成', { type: ButtonType.Normal, stateEffect: true })
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height($r('app.float.default_48'))
|
||||
.margin({ bottom: $r('app.float.default_22') })
|
||||
.backgroundColor($r('app.color.colorGreen7'))
|
||||
.onClick(() => {
|
||||
this.submit()
|
||||
})
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height(AppConstants.PERCENTAGE_MAX)
|
||||
.backgroundColor($r('app.color.page_background'))
|
||||
.overlay(createWaterMark())
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 街面/卡点
|
||||
* 车辆类型(重点,正常)
|
||||
*/
|
||||
submit() {
|
||||
let pc = PCCacheData.pcCacheData;
|
||||
let entity: CheckSubmitEntity = new CheckSubmitEntity();
|
||||
entity.peopleCount = pc.zcCount + ""
|
||||
entity.unusualPeopleCount = pc.yiCount + ""
|
||||
|
||||
entity.unusualCarCount = ''
|
||||
|
||||
if (this.pageParam) {
|
||||
if (this.pageParam.carNumStatus == 0) {
|
||||
entity.carCount = "0";
|
||||
entity.unusualCarCount = "0";
|
||||
} else {
|
||||
entity.carCount = "1";
|
||||
if (this.pageParam.carNumStatus == 1) {
|
||||
entity.unusualCarCount = "1";
|
||||
} else {
|
||||
entity.unusualCarCount = "0";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
entity.goodsCount = `${pc.wpCount}`
|
||||
//type 0 = 街面盘查 1 = 卡点盘查
|
||||
entity.type = "0"
|
||||
entity.checkReason = this.selectCheckReasonValue
|
||||
entity.checkAddress = this.inputAddress
|
||||
entity.remark = this.inputRemark
|
||||
entity.pointX = RuanseeAbitityStag.appCache.getLocationX() + ""
|
||||
entity.pointY = RuanseeAbitityStag.appCache.getLocationY() + ""
|
||||
entity.taskId = ""
|
||||
entity.kkid = ""
|
||||
entity.mainId = RuanseeAbitityStag.appCache.getHistoryId()
|
||||
entity.checkTime = DateUtils.formatDateStr(new Date(), DateFormat.YYYYhMMhDDkHHdMMdSS)
|
||||
entity.status = "1"
|
||||
entity.groupId = ""
|
||||
entity.yjdw = this.pageParam?.selectDeptId;
|
||||
entity.yjdwmc = this.pageParam?.selectDeptName;
|
||||
entity.userName = RuanseeAbitityStag.userCache.getUserCode
|
||||
entity.idCard = RuanseeAbitityStag.userCache.getIdCardNum
|
||||
entity.deptId = RuanseeAbitityStag.userCache.getDeptCode
|
||||
entity.deptName = RuanseeAbitityStag.userCache.getDeptName
|
||||
entity.orgCode = RuanseeAbitityStag.userCache.getDeptCode
|
||||
entity.orgName = RuanseeAbitityStag.userCache.getDeptName
|
||||
entity.policeNum = RuanseeAbitityStag.userCache.getUserCode
|
||||
entity.policeName = RuanseeAbitityStag.userCache.getUserName
|
||||
entity.policeIdCard = RuanseeAbitityStag.userCache.getIdCardNum
|
||||
|
||||
let model: CheckSubmitModel = new CheckSubmitModel();
|
||||
model.checkHistoryEntity = entity;
|
||||
model.personIds = this.pageParam?.personIds
|
||||
model.carIds = new Array
|
||||
if (this.pageParam?.carId){
|
||||
model.carIds.push(this.pageParam.carId)
|
||||
}
|
||||
|
||||
saveMainHistoryAndChangeStatus(model)
|
||||
.then((res)=>{
|
||||
console.debug(JSON.stringify(res));
|
||||
if (res.code == 200) {
|
||||
let param: BasePageResult = {
|
||||
type: 5,
|
||||
what: 1,
|
||||
data: "提交成功!"
|
||||
}
|
||||
router.back({ url: "ui/pages/StreetInspectionPages", params: param })
|
||||
}else {
|
||||
ToastUtil.showToast(res.msg)
|
||||
}
|
||||
})
|
||||
.catch((error:AxiosError)=>{
|
||||
console.error(error.message)
|
||||
ToastUtil.showToast(error.message)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,177 @@
|
|||
import AppConstants from "../../app/AppConstant";
|
||||
import { SkipHistoryDetailsParam } from "../../model/uiModel/PageParamModel";
|
||||
import { cardRoundBorderStyle } from "../../style/BorderStyle";
|
||||
import { BaseTopBar } from "../../view/custom/BaseTopTar";
|
||||
import { createWaterMark } from "../../view/custom/Watermark";
|
||||
import { router } from "@kit.ArkUI";
|
||||
import { ToastUtil } from "@pura/harmony-utils";
|
||||
import { PeopleListFragment } from "../fragment/PeopleListFragment";
|
||||
import { CarListFragment } from "../fragment/CarListFragment";
|
||||
import { GoodsListFragment } from "../fragment/GoodsListFragment";
|
||||
|
||||
@Preview
|
||||
@Component
|
||||
@Entry
|
||||
export struct HistoryDetailsPage {
|
||||
@State param: SkipHistoryDetailsParam | undefined = undefined
|
||||
@State selectedIndex: number = 0
|
||||
|
||||
aboutToAppear(): void {
|
||||
this.param = router.getParams() as SkipHistoryDetailsParam
|
||||
if (!this.param) {
|
||||
ToastUtil.showToast("参数错误!")
|
||||
router.back()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
BaseTopBar({
|
||||
title: $r('app.string.title_history_details'),
|
||||
})
|
||||
this.PanCaDetails()
|
||||
|
||||
Tabs({ barPosition: BarPosition.Start }) {
|
||||
TabContent() {
|
||||
PeopleListFragment({ mainId: this.param?.mainId })
|
||||
}.tabBar(this.tabBuilder('人', 0))
|
||||
.onWillShow(() => {
|
||||
console.info("Pink will show")
|
||||
})
|
||||
.onWillHide(() => {
|
||||
console.info("Pink will hide")
|
||||
})
|
||||
|
||||
TabContent() {
|
||||
CarListFragment({ mainId: this.param?.mainId })
|
||||
}.tabBar(this.tabBuilder('车', 1))
|
||||
|
||||
.onWillShow(() => {
|
||||
console.info("Yellow will show")
|
||||
})
|
||||
.onWillHide(() => {
|
||||
console.info("Yellow will hide")
|
||||
})
|
||||
|
||||
TabContent() {
|
||||
GoodsListFragment({ mainId: this.param?.mainId,isYj: this.param?.status == 1})
|
||||
}.tabBar(this.tabBuilder('物', 2))
|
||||
.onWillShow(() => {
|
||||
console.info("Yellow will show")
|
||||
})
|
||||
.onWillHide(() => {
|
||||
console.info("Yellow will hide")
|
||||
})
|
||||
}
|
||||
.onChange(index => {
|
||||
this.selectedIndex = index
|
||||
})
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height(AppConstants.PERCENTAGE_MAX)
|
||||
.backgroundColor($r('app.color.page_background'))
|
||||
.overlay(createWaterMark())
|
||||
}
|
||||
|
||||
@Builder
|
||||
PanCaDetails() {
|
||||
Column() {
|
||||
Row() {
|
||||
Text("警员姓名:")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'));
|
||||
Text(this.param?.policename)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_14'));
|
||||
}
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.justifyContent(FlexAlign.Start)
|
||||
.width(AppConstants.PERCENTAGE_MAX);
|
||||
|
||||
Row() {
|
||||
Text("盘查原因:")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'));
|
||||
Text(this.param?.pcyy)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_14'));
|
||||
|
||||
}
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.justifyContent(FlexAlign.Start)
|
||||
.visibility(this.param?.type == 1 ? Visibility.None : Visibility.Visible)
|
||||
.width(AppConstants.PERCENTAGE_MAX);
|
||||
|
||||
Row() {
|
||||
Text("盘查时间:")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'));
|
||||
Text(this.param?.pctime)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_14'));
|
||||
}
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.justifyContent(FlexAlign.Start)
|
||||
.width(AppConstants.PERCENTAGE_MAX);
|
||||
|
||||
Row() {
|
||||
Text("移交单位:")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'));
|
||||
Text(this.param?.yjdw)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_14'));
|
||||
}
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.justifyContent(FlexAlign.Start)
|
||||
.width(AppConstants.PERCENTAGE_MAX);
|
||||
|
||||
Row() {
|
||||
Text("任务名称:")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'));
|
||||
Text(this.param?.taskName)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_14'));
|
||||
}
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.visibility(this.param?.type == 1 ? Visibility.Visible : Visibility.None)
|
||||
.justifyContent(FlexAlign.Start)
|
||||
.width(AppConstants.PERCENTAGE_MAX);
|
||||
|
||||
Row() {
|
||||
Text("盘查地址:")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'));
|
||||
Text(this.param?.address)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.layoutWeight(1)
|
||||
}
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.justifyContent(FlexAlign.Start)
|
||||
.width(AppConstants.PERCENTAGE_MAX);
|
||||
|
||||
}
|
||||
.width("95%")
|
||||
.justifyContent(FlexAlign.Start)
|
||||
.padding($r("app.float.default_10"))
|
||||
.margin($r("app.float.default_10"))
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.border(cardRoundBorderStyle)
|
||||
}
|
||||
|
||||
@Builder
|
||||
tabBuilder(title: string, targetIndex: number) {
|
||||
Column() {
|
||||
Text(title)
|
||||
.fontColor(this.selectedIndex === targetIndex ? $r('app.color.bull') : $r('app.color.colorGrey7'))
|
||||
}
|
||||
.width('100%')
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
.height($r('app.float.default_46'))
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.backgroundColor(this.selectedIndex === targetIndex ? $r('app.color.white') : $r('app.color.colorGrey2'))
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
import AppConstants from "../../app/AppConstant";
|
||||
import { BaseTopBar } from "../../view/custom/BaseTopTar";
|
||||
import { createWaterMark } from "../../view/custom/Watermark";
|
||||
import { CheckPointHistoryFragment } from "../fragment/CheckPointHistoryFragment";
|
||||
import { StreetSearchHistoryFragment } from "../fragment/StreetSearchHistoryFragment";
|
||||
import router from "@ohos.router";
|
||||
import { BasePageResult } from "../../model/uiModel/PageResultModel";
|
||||
import { common } from "@kit.AbilityKit";
|
||||
|
||||
/**
|
||||
* 历史记录主页
|
||||
*/
|
||||
@Preview
|
||||
@Entry
|
||||
@Component
|
||||
export struct HistoryMainPage{
|
||||
context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext;
|
||||
|
||||
onPageShow(): void {
|
||||
let param :BasePageResult = router.getParams() as BasePageResult;
|
||||
if (param) {
|
||||
if (param.type == 1) {
|
||||
this.context.eventHub.emit("select_task",param.data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
build() {
|
||||
Column(){
|
||||
BaseTopBar({
|
||||
title:"历史记录"
|
||||
})
|
||||
Tabs({ barPosition: BarPosition.Start }) {
|
||||
TabContent() {
|
||||
CheckPointHistoryFragment()
|
||||
}
|
||||
.tabBar(new SubTabBarStyle('卡点核录'))
|
||||
|
||||
TabContent() {
|
||||
StreetSearchHistoryFragment()
|
||||
}
|
||||
.tabBar(new SubTabBarStyle('街面盘查'))
|
||||
}
|
||||
.vertical(false)
|
||||
.scrollable(true)
|
||||
.barMode(BarMode.Fixed)
|
||||
.onChange((index: number) => {
|
||||
console.info(index.toString())
|
||||
})
|
||||
.width('100%')
|
||||
.layoutWeight(1)
|
||||
.backgroundColor(0xF1F3F5)
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height(AppConstants.PERCENTAGE_MAX)
|
||||
.overlay(createWaterMark())
|
||||
.backgroundColor($r('app.color.page_background'))
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,284 @@
|
|||
//导入router
|
||||
import router from '@ohos.router';
|
||||
import { common, Want } from '@kit.AbilityKit';
|
||||
import data_preferences from '@ohos.data.preferences';
|
||||
|
||||
import { connection } from '@kit.NetworkKit'
|
||||
import { BusinessError } from '@kit.BasicServicesKit'
|
||||
import { buffer, util } from '@kit.ArkTS';
|
||||
import { ToastUtils as ToastUtils } from '../../util/ToasUtils';
|
||||
import { AppCache } from '../../app/AppCache';
|
||||
import { UserCache } from '../../app/UserCache';
|
||||
import { createWaterMark } from '../../view/custom/Watermark';
|
||||
import { StringUtils } from '../../util/StringUtils';
|
||||
import { getPgToken } from '../../request/api/Api';
|
||||
import { AxiosError } from '@ohos/axios';
|
||||
import { AuthUserModel, IAuthTaskType } from '../../model/uiModel/IAuthTaskType';
|
||||
import { RuanseeAbitityStag } from '../../app/RuanseeAbitityStag';
|
||||
import { hilog } from '@kit.PerformanceAnalysisKit';
|
||||
|
||||
const H_STORE: string = 'healthAppStore';
|
||||
|
||||
|
||||
interface GeneratedObjectLiteralInterface_1 {
|
||||
"userName": string;
|
||||
"realName": string;
|
||||
"orgName": string;
|
||||
"orgCode": string;
|
||||
"idCardNum": string;
|
||||
"ip": string;
|
||||
}
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
@State message: string = '正在初始化...';
|
||||
context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext;
|
||||
ipAddress: string | undefined = undefined
|
||||
|
||||
onPageShow(): void {
|
||||
|
||||
}
|
||||
|
||||
onPageHide(): void {
|
||||
|
||||
}
|
||||
|
||||
getToken() {
|
||||
getPgToken()
|
||||
.then((res) => {
|
||||
if (res) {
|
||||
AppCache.getAppCache().setPgToken = res.access_token;
|
||||
}
|
||||
console.info(JSON.stringify(res));
|
||||
})
|
||||
.catch((error: AxiosError) => {
|
||||
console.error(JSON.stringify(error));
|
||||
})
|
||||
}
|
||||
|
||||
aboutToAppear() {
|
||||
this.getIpAddress();
|
||||
this.getToken()
|
||||
// 100/4 = 25
|
||||
|
||||
// let date = DateUtils.pastStrDate("2023年10日01日 15:23:33.256");
|
||||
//
|
||||
// let datas = DateUtils.formatDateStr(date,DateFormat.YYYYhMMhDDkHHdMMdSSdSSS);
|
||||
//
|
||||
// console.debug("测试日期",datas)
|
||||
// let preferences = data_preferences.getPreferences(this.context, H_STORE);
|
||||
// preferences.then((res) => {
|
||||
// res.get(IS_PRIVACY, false).then((isPrivate) => {
|
||||
// if (isPrivate === true) {
|
||||
// this.jumpAdPage();
|
||||
// } else {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
}
|
||||
|
||||
handUserInfo(ipAddress: string | undefined) {
|
||||
|
||||
let appCache = AppCache.getAppCache();
|
||||
let userCache = UserCache.getUserCache();
|
||||
|
||||
appCache.setIpOrPort('20.90.2.2', '80', "/ypc_test_out/")
|
||||
|
||||
//设置用户信息,后期改成单点登录获取用户信息
|
||||
// userCache.setUserName = "陈乐(测试)"
|
||||
// userCache.setUserCode = "999013"
|
||||
// userCache.setDeptName = "测试单位001"
|
||||
// userCache.setDeptCode = "340012000000"
|
||||
// userCache.setIdCardNum = "420113199310297548"
|
||||
// userCache.setUserName = "孙福(测试)"
|
||||
// userCache.setUserCode = "009906"
|
||||
// userCache.setDeptName = "科技信息化支队基础设施管理大队"
|
||||
// userCache.setDeptCode = "340100750300"
|
||||
// userCache.setIdCardNum = "32030519930422151X"
|
||||
|
||||
//本机IP
|
||||
appCache.setLocalIp = StringUtils.get(ipAddress, "10.115.101.1");
|
||||
|
||||
let userInfos = userCache.getUserInfo();
|
||||
if (StringUtils.isNullOrEmpty(userInfos)) {
|
||||
let cs: GeneratedObjectLiteralInterface_1 = {
|
||||
"userName": userCache.getUserCode,
|
||||
"realName": userCache.getUserName,
|
||||
"orgName": userCache.getDeptName,
|
||||
"orgCode": userCache.getDeptCode,
|
||||
"idCardNum": userCache.getIdCardNum,
|
||||
"ip": appCache.setLocalIp
|
||||
}
|
||||
let userInfo = JSON.stringify(cs)
|
||||
let byte = new Uint8Array(buffer.from(userInfo, 'utf-8').buffer);
|
||||
let baseUserInfo = new util.Base64Helper().encodeToStringSync(byte);
|
||||
userCache.setUserInfo = JSON.stringify(baseUserInfo);
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
this.message = "正在获取用户信息..."
|
||||
if (appCache.getPermissionsStatus) {
|
||||
this.jumpAdPage();
|
||||
}
|
||||
}, 100)
|
||||
}
|
||||
|
||||
//获取IP地址 原因
|
||||
getIpAddress() {
|
||||
let defNet = connection.getDefaultNet()
|
||||
defNet.then((netHandle: connection.NetHandle) => {
|
||||
connection.getConnectionProperties(netHandle, (error: BusinessError, data: connection.ConnectionProperties) => {
|
||||
if (error) {
|
||||
console.error(`Failed to get connection properties. Code:${error.code}, message:${error.message}`);
|
||||
ToastUtils.toastBottom("获取IP地址失败!")
|
||||
this.authLogin();
|
||||
return;
|
||||
}
|
||||
console.info("Succeeded to get data: " + JSON.stringify(data));
|
||||
try {
|
||||
let ip = data['linkAddresses'][0]['address']['address']
|
||||
console.info('本地ip:', ip)
|
||||
this.ipAddress = ip
|
||||
this.authLogin();
|
||||
} catch (e) {
|
||||
console.error("e", JSON.stringify(e));
|
||||
ToastUtils.toastBottom("获取IP地址失败!")
|
||||
this.authLogin();
|
||||
}
|
||||
});
|
||||
}).catch((error: Error) => {
|
||||
console.error("e", JSON.stringify(error));
|
||||
ToastUtils.toastBottom(error.message)
|
||||
})
|
||||
.finally(() => {
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
authLogin() {
|
||||
let want: Want = {
|
||||
bundleName: 'hm.anhui.police.auth',
|
||||
abilityName: 'OhosAuthAbility',
|
||||
parameters: {
|
||||
'action': 'getAuthUser',
|
||||
'IAuthTaskType': IAuthTaskType.AUTH_TASK_USER,
|
||||
'packageName': 'com.rs.rchl',
|
||||
'sysCode': '63431541a00042e0b1ec1e9326c7aca1'
|
||||
}
|
||||
};
|
||||
try {
|
||||
this.context.startAbilityForResult(want, (err: BusinessError, result: common.AbilityResult) => {
|
||||
if (err.code) {
|
||||
// 处理业务逻辑错误
|
||||
console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`);
|
||||
return;
|
||||
}
|
||||
// 执行正常业务
|
||||
console.info(`startAbility succeed resultCode:${result.resultCode} result:${JSON.stringify(result)} want:${JSON.stringify(want)}`);
|
||||
if (result.resultCode === -1) {
|
||||
this.message = '未获取到用户信息';
|
||||
return;
|
||||
}
|
||||
const iAuthTaskType = result.want?.parameters?.IAuthTaskType
|
||||
const message = result.want?.parameters?.message
|
||||
if (iAuthTaskType === IAuthTaskType.AUTH_TASK_USER) {
|
||||
this.message = `开始处理认证数据`;
|
||||
let authUser = result.want?.parameters?.authUser;
|
||||
hilog.info(0x0000, 'carousel', '%{public}s', `authUser:${authUser}`);
|
||||
if (result.resultCode === 200) {
|
||||
// 获取到用户信息
|
||||
let authUserModel = JSON.parse(StringUtils.get(authUser, "")) as AuthUserModel
|
||||
if (authUserModel) {
|
||||
let userCache = RuanseeAbitityStag.userCache
|
||||
userCache.setUserName = authUserModel.realName
|
||||
userCache.setUserCode = authUserModel.userNum
|
||||
userCache.setDeptCode = authUserModel.orgId
|
||||
userCache.setDeptName = authUserModel.orgName
|
||||
userCache.setIdCardNum = authUserModel.code
|
||||
userCache.setAuthToken = authUserModel.token
|
||||
userCache.setProfilePhoto = StringUtils.get(authUserModel.profilePhoto, "")
|
||||
this.handUserInfo(this.ipAddress)
|
||||
}else {
|
||||
this.loginError("获取用户信息失败!");
|
||||
}
|
||||
} else if (result.resultCode === 100) {
|
||||
this.message = `用户主动关闭登录页面,未获取到用户信息`;
|
||||
this.loginError(`用户主动关闭登录页面,未获取到用户信息`);
|
||||
} else {
|
||||
this.message = `未获取到用户信息,错误码(${result.resultCode})`;
|
||||
this.loginError(`未获取到用户信息,错误码(${result.resultCode})`);
|
||||
}
|
||||
} else {
|
||||
this.message = `获取用户信息失败:${result.want?.parameters?.message}`;
|
||||
this.loginError(`获取用户信息失败:${result.want?.parameters?.message}`);
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
// 处理入参错误异常
|
||||
let code = (err as BusinessError).code;
|
||||
let message = (err as BusinessError).message;
|
||||
console.error(`startAbility failed, code is ${code}, message is ${message}`);
|
||||
this.loginError(`startAbility failed, code is ${code}, message is ${message}`);
|
||||
}
|
||||
}
|
||||
|
||||
loginError(msg:string){
|
||||
ToastUtils.toastBottom(msg)
|
||||
setTimeout(() => {
|
||||
router.back()
|
||||
this.context.terminateSelf()
|
||||
},1500)
|
||||
}
|
||||
build() {
|
||||
Column() {
|
||||
Image($r('app.media.ic_applogin'))
|
||||
.width(100)
|
||||
.aspectRatio(1)
|
||||
.margin({ top: 190 });
|
||||
|
||||
Text($r('app.string.EntryAbility_label'))
|
||||
.fontSize($r('app.float.text_size_24'))
|
||||
.fontColor($r('app.color.bull'))
|
||||
.fontWeight(700)
|
||||
.letterSpacing(1)
|
||||
.margin({
|
||||
top: $r('app.float.default_20'),
|
||||
bottom: $r('app.float.default_8')
|
||||
})
|
||||
|
||||
Text(this.message)
|
||||
.fontColor($r('app.color.grad'))
|
||||
.fontSize($r("app.float.text_size_14"))
|
||||
.margin({ top: 32 })
|
||||
|
||||
Text($r('app.string.ownership_dept'))
|
||||
.fontColor($r('app.color.grad'))
|
||||
.fontSize($r("app.float.text_size_14"))
|
||||
.height('100%')
|
||||
.margin({ bottom: $r('app.float.default_20') })
|
||||
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.expandSafeArea([SafeAreaType.SYSTEM])
|
||||
.overlay(createWaterMark())
|
||||
|
||||
}
|
||||
|
||||
exitApp() {
|
||||
this.context.terminateSelf();
|
||||
let preferences = data_preferences.getPreferences(this.context, H_STORE);
|
||||
preferences.then((res) => {
|
||||
// res.clearSync();
|
||||
})
|
||||
}
|
||||
|
||||
jumpAdPage() {
|
||||
setTimeout(() => {
|
||||
this.message = "正在跳转..."
|
||||
router.replaceUrl({ url: 'ui/pages/MainPages' });
|
||||
}, 800);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,692 @@
|
|||
import AppConstants from "../../app/AppConstant";
|
||||
import { createWaterMark } from "../../view/custom/Watermark";
|
||||
import { font, router } from '@kit.ArkUI';
|
||||
import { cardRoundBorderStyle } from "../../style/BorderStyle";
|
||||
import { ToastUtils } from "../../util/ToasUtils";
|
||||
import app from '@system.app';
|
||||
import { MainButtonBean } from "../../model/uiModel/MainBean";
|
||||
import { abilityAccessCtrl, bundleManager, common, Permissions, } from "@kit.AbilityKit";
|
||||
import { geoLocationManager } from "@kit.LocationKit";
|
||||
import { AppCache } from "../../app/AppCache";
|
||||
import { UserCache } from "../../app/UserCache";
|
||||
import { StringUtils } from "../../util/StringUtils";
|
||||
import { getCoordinateDescription, getDeptChile, getMainStatistics } from "../../request/api/Api";
|
||||
import { hilog } from "@kit.PerformanceAnalysisKit";
|
||||
import { AxiosError } from "@ohos/axios";
|
||||
import { GetStatisticsModel } from "../../model/requestModel/MainRequestModel";
|
||||
import { RuanseeAbitityStag } from "../../app/RuanseeAbitityStag";
|
||||
import { DateFormat, DateUtils } from "../../util/DateUtils";
|
||||
import { SkipCheckPageModel } from "../../model/uiModel/PageParamModel";
|
||||
import { BasePageResult } from "../../model/uiModel/PageResultModel";
|
||||
import { DateUtil, JSONUtil } from "@pura/harmony-utils";
|
||||
import { DBUtils } from "../../model/db/DBUtils";
|
||||
import { DeptTableEntity } from "../../model/db/TableEntity";
|
||||
import { RdbDao } from "rdbstore";
|
||||
import { FileUtils } from "../../util/FileUtils";
|
||||
|
||||
const TAG: string = 'GRLocation';
|
||||
|
||||
@Component
|
||||
@Preview
|
||||
@Entry
|
||||
export struct MainPages {
|
||||
@State isRefresh: boolean = false;
|
||||
// 记录上一次点击时间
|
||||
private pretime: number = -1;
|
||||
private mainButtonArray: Array<MainButtonBean> = new Array()
|
||||
private context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext;
|
||||
@State checkPeopleCount: string = "0";
|
||||
@State unusualPeopleCount: string = "0";
|
||||
@State carCount: string = "0";
|
||||
@State allCount: string = "0";
|
||||
|
||||
//SafeKeyboard
|
||||
|
||||
aboutToAppear(): void {
|
||||
font.registerFont({
|
||||
familyName: "zdyfont",
|
||||
familySrc: $rawfile('pangmenzhengdao.ttf')
|
||||
})
|
||||
this.mainButtonArray = [
|
||||
{
|
||||
icon: $r('app.media.icon_point_check'),
|
||||
name: $r('app.string.str_jmpc'),
|
||||
routerPage: 'ui/pages/StreetInspectionPages'
|
||||
},
|
||||
{
|
||||
icon: $r('app.media.icon_scrutiny'),
|
||||
name: $r('app.string.str_kdhl'),
|
||||
routerPage: 'ui/pages/SelectTaskAndCardPortPages',
|
||||
tag: 1
|
||||
},
|
||||
{
|
||||
icon: $r('app.media.tab_attention'),
|
||||
name: $r('app.string.str_my_concerns'),
|
||||
routerPage: "ui/pages/MyAttentionActivity"
|
||||
},
|
||||
{
|
||||
icon: $r('app.media.icon_historical_record'),
|
||||
name: $r('app.string.str_historical_records'),
|
||||
routerPage: "ui/pages/HistoryMainPage"
|
||||
},
|
||||
{
|
||||
icon: $r('app.media.icon_about'),
|
||||
name: $r('app.string.title_About'),
|
||||
routerPage: "ui/pages/AboutPage"
|
||||
},
|
||||
]
|
||||
this.applyForPermission()
|
||||
setTimeout(()=>{
|
||||
this.getDeptData()
|
||||
},3000)
|
||||
}
|
||||
|
||||
onBackPress(): boolean | void {
|
||||
if (-1 == this.pretime) {
|
||||
// 第一次点击返回键,提示toast
|
||||
ToastUtils.toastBottom("再按一次退出应用")
|
||||
this.pretime = new Date().getTime();
|
||||
setTimeout(() => {
|
||||
this.pretime = -1
|
||||
}, 2000)
|
||||
return true;
|
||||
} else {
|
||||
let currentTime = new Date().getTime();
|
||||
let flag = currentTime - this.pretime;
|
||||
if (flag > 2000) {
|
||||
//两次点击时间太长不做处理
|
||||
this.pretime = currentTime;
|
||||
setTimeout(() => {
|
||||
this.pretime = -1
|
||||
}, 2000)
|
||||
return true;
|
||||
} else {
|
||||
app.terminate(); // 2秒内点击,退出当前Ability。
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取权限后执行此方法
|
||||
*/
|
||||
initPage() {
|
||||
FileUtils.createFileDir()
|
||||
this.getStatistics()
|
||||
this.getCurrentLocation()
|
||||
}
|
||||
|
||||
getAddressByLongitudeLatitude(location: geoLocationManager.Location) {
|
||||
getCoordinateDescription()
|
||||
.then((res) => {
|
||||
console.debug(JSONUtil.beanToJsonStr(res))
|
||||
if (res && res.length > 0) {
|
||||
let address = res[0];
|
||||
if (address) {
|
||||
RuanseeAbitityStag.appCache.setLocationAddress = StringUtils.get(address.address, "")
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((error: AxiosError) => {
|
||||
console.error(error.message)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测权限
|
||||
* @param permissionArray
|
||||
*/
|
||||
checkPermissionGrant(permissionArray: Array<Permissions>) {
|
||||
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager()
|
||||
// 获取应用程序的accessTokenID
|
||||
let bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION)
|
||||
let appInfo: bundleManager.ApplicationInfo = bundleInfo.appInfo
|
||||
let tokenId: number = appInfo.accessTokenId
|
||||
let wsqPermissionArray = new Array<Permissions>()
|
||||
for (let i = 0; i < permissionArray.length; i++) {
|
||||
let grantStatus = atManager.checkAccessTokenSync(tokenId, permissionArray[i])
|
||||
if (grantStatus == abilityAccessCtrl.GrantStatus.PERMISSION_DENIED) {
|
||||
wsqPermissionArray.push(permissionArray[i])
|
||||
}
|
||||
}
|
||||
if (wsqPermissionArray.length > 0) {
|
||||
//有未申请的权限,发送到Ability,由 Ability 发起权限申请
|
||||
// this.requestPermissionsFromUser(wsqPermissionArray)
|
||||
this.context.eventHub.emit('ui_event', wsqPermissionArray);
|
||||
} else {
|
||||
//权限全部申请
|
||||
this.initPage()
|
||||
this.getCurrentLocation()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*AUTHOR:AbnerMing
|
||||
*INTRODUCE:向用户获取权限授权
|
||||
*/
|
||||
requestPermissionsFromUser(permissions: Array<Permissions>) {
|
||||
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager()
|
||||
atManager.requestPermissionsFromUser(this.context, permissions)
|
||||
.then((data) => {
|
||||
let grantStatus: Array<number> = data.authResults;
|
||||
let length: number = grantStatus.length;
|
||||
for (let i = 0; i < length; i++) {
|
||||
if (grantStatus[i] === 0) {
|
||||
// 用户授权,可以继续访问目标操作
|
||||
console.log("===用户授权")
|
||||
} else {
|
||||
// 用户拒绝授权,提示用户必须授权才能访问当前页面的功能,并引导用户到系统设置中打开相应的权限
|
||||
console.log("===用户拒绝了授权")
|
||||
return
|
||||
}
|
||||
}
|
||||
console.log("===权限授权成功")
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
*AUTHOR:AbnerMing
|
||||
*INTRODUCE:校验应用是否被授予权限
|
||||
*/
|
||||
private getGrantStatus(permissionName: Permissions): abilityAccessCtrl.GrantStatus {
|
||||
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager()
|
||||
// 获取应用程序的accessTokenID
|
||||
let bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION)
|
||||
let appInfo: bundleManager.ApplicationInfo = bundleInfo.appInfo
|
||||
let tokenId: number = appInfo.accessTokenId
|
||||
//检查权限状态
|
||||
let grantStatus = atManager.checkAccessTokenSync(tokenId, permissionName)
|
||||
return grantStatus
|
||||
}
|
||||
|
||||
applyForPermission() {
|
||||
let permissions = new Array<Permissions>();
|
||||
permissions.push('ohos.permission.LOCATION')
|
||||
permissions.push('ohos.permission.APPROXIMATELY_LOCATION')
|
||||
this.checkPermissionGrant(permissions)
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取缓存的位置
|
||||
* @returns
|
||||
*/
|
||||
getLastLocation(): geoLocationManager.Location | undefined {
|
||||
try {
|
||||
let location = geoLocationManager.getLastLocation();
|
||||
return location;
|
||||
} catch (err) {
|
||||
console.info(TAG, "errCode:" + err.code + ", message:" + err.message);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 持续定位 获取位置
|
||||
*/
|
||||
getCurrentLocation() {
|
||||
//持续定位 5分钟定位一次
|
||||
let request2: geoLocationManager.ContinuousLocationRequest = {
|
||||
"interval": 300,
|
||||
"locationScenario": geoLocationManager.UserActivityScenario.SPORT
|
||||
}
|
||||
try {
|
||||
geoLocationManager.on('locationChange', request2, (data) => {
|
||||
console.info(TAG, 'current location: ' + JSON.stringify(data));
|
||||
AppCache.getAppCache().setLocation(data);
|
||||
this.getAddressByLongitudeLatitude(data)
|
||||
})
|
||||
|
||||
// let request: geoLocationManager.SingleLocationRequest = {
|
||||
// 'locatingPriority': geoLocationManager.LocatingPriority.PRIORITY_LOCATING_SPEED,
|
||||
// 'locatingTimeoutMs': 10000
|
||||
// }
|
||||
// geoLocationManager.getCurrentLocation(request) 街面盘查 StreetFront Street level search
|
||||
// .then((result) => { // 调用getCurrentLocation获取当前设备位置,通过promise接收上报的位置
|
||||
// console.info(TAG, 'current location: ' + JSON.stringify(result));
|
||||
// })
|
||||
// .catch((error: BusinessError) => { // 接收上报的错误码
|
||||
// console.info(TAG, 'promise, getCurrentLocation: error=' + JSON.stringify(error));
|
||||
// });
|
||||
} catch (err) {
|
||||
console.info(TAG, "errCode:" + JSON.stringify(err));
|
||||
}
|
||||
}
|
||||
|
||||
getStatistics() {
|
||||
let newDay = DateUtils.formatDateStr(new Date(), DateFormat.YYYYhMMhDD);
|
||||
let statisticsModel: GetStatisticsModel = {
|
||||
sfz: RuanseeAbitityStag.userCache.getIdCardNum,
|
||||
beginTime: newDay + " 00:00:00",
|
||||
endTime: newDay + " 23:59:59",
|
||||
}
|
||||
|
||||
getMainStatistics(statisticsModel)
|
||||
.then((res) => {
|
||||
console.debug("mainPage", res)
|
||||
this.isRefresh = false;
|
||||
if (res.code != 200) {
|
||||
ToastUtils.toastCenter(res.msg);
|
||||
return
|
||||
}
|
||||
if (res.data) {
|
||||
this.checkPeopleCount =
|
||||
res.data.peopleCount == null || res.data.peopleCount == undefined ? "0" : res.data.peopleCount + "";
|
||||
this.unusualPeopleCount =
|
||||
res.data.unusualPeopleCount == null || res.data.unusualPeopleCount == undefined ? "0" :
|
||||
res.data.unusualPeopleCount + "";
|
||||
this.carCount = res.data.carCount == null || res.data.carCount == undefined ? "0" : res.data.carCount + "";
|
||||
this.allCount = res.data.allCount == null || res.data.allCount == undefined ? "0" : res.data.allCount + "";
|
||||
}
|
||||
})
|
||||
.catch((error: AxiosError) => {
|
||||
this.isRefresh = false;
|
||||
console.error("mainPage", 'getMainStatistics error' + error.message)
|
||||
})
|
||||
}
|
||||
|
||||
/////////////////////////// UI 相关操作 ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
|
||||
|
||||
build() {
|
||||
Stack({ alignContent: Alignment.TopStart }) {
|
||||
this.underlyingBackground()
|
||||
this.mainContent()
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height(AppConstants.PERCENTAGE_MAX)
|
||||
.overlay(createWaterMark())
|
||||
.backgroundColor($r('app.color.page_background'))
|
||||
}
|
||||
|
||||
/**
|
||||
* 主要内容
|
||||
*/
|
||||
@Builder
|
||||
mainContent() {
|
||||
Column() {
|
||||
Row() {
|
||||
Image($r('app.media.icon_badges'))
|
||||
.width($r('app.float.default_43'))
|
||||
.height($r('app.float.default_43'))
|
||||
|
||||
Text($r('app.string.app_name'))
|
||||
.fontColor($r('app.color.white'))
|
||||
.fontSize($r('app.float.text_size_42'))
|
||||
.margin({ left: $r('app.float.default_8') })
|
||||
.fontFamily('zdyfont')
|
||||
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.margin({ top: $r('app.float.default_68') })
|
||||
|
||||
Refresh({ refreshing: $$this.isRefresh }) {
|
||||
Column() {
|
||||
//个人信息
|
||||
Column() {
|
||||
|
||||
//个人信息
|
||||
Row() {
|
||||
Image($r('app.media.icon_photo'))
|
||||
.width($r('app.float.default_46'))
|
||||
.height($r('app.float.default_46'))
|
||||
|
||||
Column() {
|
||||
Text(`${UserCache.getUserCache().getUserName} ( ${UserCache.getUserCache().getUserCode} )`)
|
||||
.fontColor($r('app.color.black'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
Text(UserCache.getUserCache().getDeptName)
|
||||
.fontColor($r('app.color.grad'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.margin({ top: $r('app.float.default_6') })
|
||||
.maxLines(1)
|
||||
}
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.layoutWeight(1)
|
||||
.margin({ left: $r('app.float.default_15') })
|
||||
}
|
||||
|
||||
// 统计模块
|
||||
Divider()
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height($r('app.float.default_1'))
|
||||
.color($r('app.color.colorGrey2'))
|
||||
.margin({
|
||||
left: $r('app.float.default_5'),
|
||||
right: $r('app.float.default_5'),
|
||||
top: $r('app.float.default_10'),
|
||||
bottom: $r('app.float.default_12')
|
||||
})
|
||||
|
||||
this.statisticsUI()
|
||||
}
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.width('90%')
|
||||
.margin({
|
||||
left: $r('app.float.default_10'),
|
||||
right: $r('app.float.default_10'),
|
||||
top: $r('app.float.default_28')
|
||||
})
|
||||
.padding({
|
||||
left: $r('app.float.default_10'),
|
||||
right: $r('app.float.default_10'),
|
||||
top: $r('app.float.default_18'),
|
||||
bottom: $r('app.float.default_18')
|
||||
})
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.border(cardRoundBorderStyle)
|
||||
|
||||
Divider()
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height($r('app.float.default_1'))
|
||||
.color($r('app.color.page_background'))
|
||||
.margin({ top: $r('app.float.default_10'), bottom: $r('app.float.default_10') })
|
||||
|
||||
this.gridView()
|
||||
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height(AppConstants.PERCENTAGE_MAX)
|
||||
}
|
||||
.onRefreshing(() => {
|
||||
//触发刷新操作
|
||||
this.getStatistics()
|
||||
})
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.layoutWeight(1)
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height(AppConstants.PERCENTAGE_MAX)
|
||||
}
|
||||
|
||||
@Builder
|
||||
statisticsUI() {
|
||||
Text('今日统计:')
|
||||
.fontColor($r('app.color.black'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
|
||||
Row() {
|
||||
Column() {
|
||||
Text('核验人员次数')
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.fontColor($r('app.color.colorBluen7'));
|
||||
|
||||
Text(this.checkPeopleCount)
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.textAlign(TextAlign.End)
|
||||
.fontSize($r('app.float.text_size_18'))
|
||||
.fontColor($r('app.color.read'));
|
||||
}
|
||||
.margin({ right: $r('app.float.default_5') })
|
||||
.layoutWeight(1)
|
||||
.padding({
|
||||
left: $r('app.float.default_5'),
|
||||
right: $r('app.float.default_5'),
|
||||
top: $r('app.float.default_5')
|
||||
})
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.border({
|
||||
width: $r('app.float.default_1'),
|
||||
color: $r('app.color.page_background'),
|
||||
radius: $r('app.float.default_5')
|
||||
})
|
||||
// 阴影效果
|
||||
.shadow({
|
||||
radius: $r('app.float.default_5'),
|
||||
color: $r('app.color.main_tj_a'),
|
||||
offsetX: $r('app.float.default_3'),
|
||||
offsetY: $r('app.float.default_3') // Y轴偏移
|
||||
})
|
||||
.height(AppConstants.PERCENTAGE_MAX);
|
||||
|
||||
Column() {
|
||||
Text('核验车辆次数')
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.fontColor($r('app.color.colorGreen6'));
|
||||
Text(this.carCount)
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.textAlign(TextAlign.End)
|
||||
.fontSize($r('app.float.text_size_18'))
|
||||
.fontColor($r('app.color.read'));
|
||||
|
||||
}
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.margin({ left: $r('app.float.default_5') })
|
||||
.padding({
|
||||
left: $r('app.float.default_5'),
|
||||
right: $r('app.float.default_5'),
|
||||
top: $r('app.float.default_5')
|
||||
})
|
||||
.layoutWeight(1)
|
||||
// 阴影效果
|
||||
.shadow({
|
||||
radius: $r('app.float.default_5'),
|
||||
color: $r('app.color.main_tj_b'),
|
||||
offsetX: $r('app.float.default_3'),
|
||||
offsetY: $r('app.float.default_3') // Y轴偏移
|
||||
})
|
||||
.border({
|
||||
width: $r('app.float.default_1'),
|
||||
color: $r('app.color.page_background'),
|
||||
radius: $r('app.float.default_5')
|
||||
})
|
||||
.height(AppConstants.PERCENTAGE_MAX);
|
||||
|
||||
}
|
||||
.margin({ top: $r('app.float.default_12'), bottom: $r('app.float.default_10') })
|
||||
.padding({ left: $r('app.float.default_10'), right: $r('app.float.default_10') })
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height($r('app.float.default_52'))
|
||||
|
||||
Row() {
|
||||
|
||||
Column() {
|
||||
|
||||
Text('异常人员次数')
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.fontColor($r('app.color.colorYellow8'));
|
||||
|
||||
Text(this.unusualPeopleCount)
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.textAlign(TextAlign.End)
|
||||
.fontSize($r('app.float.text_size_18'))
|
||||
.fontColor($r('app.color.read'));
|
||||
|
||||
}
|
||||
.margin({ right: $r('app.float.default_5') })
|
||||
.layoutWeight(1)
|
||||
.padding({
|
||||
left: $r('app.float.default_5'),
|
||||
right: $r('app.float.default_5'),
|
||||
top: $r('app.float.default_5')
|
||||
})
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.border({
|
||||
width: $r('app.float.default_1'),
|
||||
color: $r('app.color.page_background'),
|
||||
radius: $r('app.float.default_5')
|
||||
})
|
||||
// 阴影效果
|
||||
.shadow({
|
||||
radius: $r('app.float.default_5'),
|
||||
color: $r('app.color.main_tj_c'),
|
||||
offsetX: $r('app.float.default_3'),
|
||||
offsetY: $r('app.float.default_3') // Y轴偏移
|
||||
})
|
||||
.height(AppConstants.PERCENTAGE_MAX);
|
||||
|
||||
Column() {
|
||||
Text('盘查提交数')
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.fontColor($r('app.color.bull'));
|
||||
Text(this.allCount)
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.textAlign(TextAlign.End)
|
||||
.fontSize($r('app.float.text_size_18'))
|
||||
.fontColor($r('app.color.read'));
|
||||
}
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.margin({ left: $r('app.float.default_5') })
|
||||
.padding({
|
||||
left: $r('app.float.default_5'),
|
||||
right: $r('app.float.default_5'),
|
||||
top: $r('app.float.default_5')
|
||||
})
|
||||
.layoutWeight(1)
|
||||
// 阴影效果
|
||||
.shadow({
|
||||
radius: $r('app.float.default_5'),
|
||||
color: $r('app.color.main_tj_d'),
|
||||
offsetX: $r('app.float.default_3'),
|
||||
offsetY: $r('app.float.default_3') // Y轴偏移
|
||||
})
|
||||
.border({
|
||||
width: $r('app.float.default_1'),
|
||||
color: $r('app.color.page_background'),
|
||||
radius: $r('app.float.default_5')
|
||||
})
|
||||
.height(AppConstants.PERCENTAGE_MAX);
|
||||
}
|
||||
.margin({ top: $r('app.float.default_10'), bottom: $r('app.float.default_10') })
|
||||
.padding({ left: $r('app.float.default_10'), right: $r('app.float.default_10') })
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height($r('app.float.default_52'))
|
||||
}
|
||||
|
||||
@Builder
|
||||
gridView() {
|
||||
Grid() {
|
||||
ForEach(this.mainButtonArray, (item: MainButtonBean) => {
|
||||
GridItem() {
|
||||
this.gridItemUI(item)
|
||||
}
|
||||
})
|
||||
}
|
||||
.padding({ left: $r('app.float.default_15'), right: $r('app.float.default_15') })
|
||||
.columnsTemplate('1fr 1fr') // 定义两列
|
||||
.rowsGap($r('app.float.default_18')) // 行间距
|
||||
.columnsGap($r('app.float.default_10')) // 列间距
|
||||
}
|
||||
|
||||
@Builder
|
||||
gridItemUI(item: MainButtonBean) {
|
||||
Row() {
|
||||
Image(item.icon)
|
||||
.width($r('app.float.default_38'))
|
||||
.height($r('app.float.default_38'))
|
||||
.margin({ left: $r('app.float.default_26') })
|
||||
|
||||
Text(item.name)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
|
||||
}
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.border({
|
||||
width: $r('app.float.default_1'),
|
||||
color: $r('app.color.page_background'),
|
||||
radius: $r('app.float.default_5')
|
||||
})
|
||||
// 阴影效果
|
||||
.shadow({
|
||||
radius: $r('app.float.default_5'), // 阴影模糊半径
|
||||
color: $r('app.color.main_tj_c'), // 阴影颜色
|
||||
offsetX: $r('app.float.default_3'), // X轴偏移
|
||||
offsetY: $r('app.float.default_3') // Y轴偏移
|
||||
})
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height($r('app.float.default_72'))
|
||||
.onClick(() => {
|
||||
//判断下有没有选择任务
|
||||
if (item.tag === 1) { //卡点核录
|
||||
if (StringUtils.isNullOrEmpty(AppCache.getAppCache().getTaskId)) {
|
||||
router.pushUrl({ url: item.routerPage })
|
||||
return
|
||||
}
|
||||
|
||||
let skipModel: SkipCheckPageModel = new SkipCheckPageModel();
|
||||
skipModel.titleType = 2
|
||||
skipModel.taskId = RuanseeAbitityStag.appCache.getTaskId
|
||||
skipModel.taskName = RuanseeAbitityStag.appCache.getTaskName
|
||||
skipModel.cardPointName = RuanseeAbitityStag.appCache.getCardPointName
|
||||
|
||||
let param: BasePageResult = {
|
||||
type: 1,
|
||||
what: 1,
|
||||
data: skipModel
|
||||
}
|
||||
router.pushUrl({ url: "ui/pages/StreetInspectionPages", params: param })
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
if (!item.routerPage) {
|
||||
ToastUtils.toastBottom($r('app.string.under_urgent_development'))
|
||||
return
|
||||
}
|
||||
router.pushUrl({ url: item.routerPage })
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 背景图片
|
||||
*/
|
||||
@Builder
|
||||
underlyingBackground() {
|
||||
Column() {
|
||||
Image($r('app.media.icon_home_bg'))
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height('28%')
|
||||
}
|
||||
}
|
||||
|
||||
private getDeptData() {
|
||||
let zzjg = RuanseeAbitityStag.userCache.getDeptCode;
|
||||
let deptID = `${zzjg.substring(0, 4)}00000000`
|
||||
let tableDao :RdbDao<DeptTableEntity>|null = null
|
||||
DBUtils.getInstance().getDeptDao()
|
||||
.then((dao) => {
|
||||
tableDao = dao;
|
||||
dao.querySql("SELECT * FROM deptTable ORDER BY updateTime DESC LIMIT 1 ")
|
||||
.then((bean)=>{
|
||||
if (bean) {
|
||||
let b = bean[0];
|
||||
if (b) {
|
||||
this.getDeptData2(deptID,StringUtils.get(b.updateTime,""),tableDao)
|
||||
return
|
||||
}
|
||||
this.getDeptData2(deptID,"",tableDao)
|
||||
}else {
|
||||
this.getDeptData2(deptID,"",tableDao)
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch((e:Error)=>{
|
||||
this.getDeptData2(deptID,"",tableDao)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
private getDeptData2(deptId:string,updateTime:string,tableDao :RdbDao<DeptTableEntity>|null) {
|
||||
getDeptChile(deptId, updateTime)
|
||||
.then((res)=>{
|
||||
if (res.code == 200) {
|
||||
let data = res.data;
|
||||
if (data && data.length > 0) {
|
||||
data.forEach((item)=>{
|
||||
let updateTime = DateUtils.formatMdyHmA(item.updateTime)
|
||||
item.updateTime = updateTime;
|
||||
if (tableDao) {
|
||||
const queryResult = tableDao.queryRawSqlSync(`delete from deptTable where deptId = ${item.deptId}'`)
|
||||
tableDao.insert(item)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((e:AxiosError)=>{
|
||||
console.error(e.message)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
import AppConstants from "../../app/AppConstant";
|
||||
import { BaseTopBar } from "../../view/custom/BaseTopTar";
|
||||
import { createWaterMark } from "../../view/custom/Watermark";
|
||||
import { MyAttentionCarFragment } from "../fragment/MyAttentionCarFragment";
|
||||
import { MyAttentionPersonFragment } from "../fragment/MyAttentionPersonFragment";
|
||||
|
||||
|
||||
/**
|
||||
* 我的关注的页面
|
||||
*/
|
||||
@Component
|
||||
@Entry
|
||||
@Preview
|
||||
export struct MyAttentionActivity {
|
||||
private tabsController: TabsController = new TabsController()
|
||||
@State currentIndex: number = 0
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
BaseTopBar({
|
||||
title: "我的关注"
|
||||
})
|
||||
|
||||
Tabs({ barPosition: BarPosition.Start }) {
|
||||
TabContent() {
|
||||
|
||||
MyAttentionPersonFragment();
|
||||
|
||||
}.tabBar(new SubTabBarStyle('关注人员'))
|
||||
.onWillShow(() => {
|
||||
console.info("Pink will show")
|
||||
})
|
||||
.onWillHide(() => {
|
||||
console.info("Pink will hide")
|
||||
})
|
||||
|
||||
TabContent() {
|
||||
MyAttentionCarFragment();
|
||||
}.tabBar(new SubTabBarStyle('关注车辆'))
|
||||
|
||||
.onWillShow(() => {
|
||||
console.info("Yellow will show")
|
||||
})
|
||||
.onWillHide(() => {
|
||||
console.info("Yellow will hide")
|
||||
})
|
||||
|
||||
}
|
||||
.vertical(false)
|
||||
.scrollable(true)
|
||||
.barMode(BarMode.Fixed)
|
||||
.onChange((index: number) => {
|
||||
console.info(index.toString())
|
||||
})
|
||||
.width('100%')
|
||||
.backgroundColor(0xF1F3F5)
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.backgroundColor($r('app.color.page_background'))
|
||||
.overlay(createWaterMark())
|
||||
}
|
||||
|
||||
@
|
||||
Builder
|
||||
TabBuilder(title:
|
||||
string, targetIndex:
|
||||
number
|
||||
) {
|
||||
Column() {
|
||||
Text(title)
|
||||
.fontColor(this.currentIndex === targetIndex ? $r('app.color.bull') : $r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
}
|
||||
.width('100%')
|
||||
.height('48vp')
|
||||
.border({
|
||||
width: $r('app.float.default_1'),
|
||||
color: this.currentIndex === targetIndex ? $r('app.color.bull') : $r('app.color.colorGrey4'),
|
||||
radius: $r('app.float.default_2')
|
||||
})
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.align(Alignment.Center)
|
||||
.margin({ left: $r('app.float.default_5'), right: $r('app.float.default_5') })
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
.onClick(() => {
|
||||
this.currentIndex = targetIndex
|
||||
this.tabsController.changeIndex(this.currentIndex)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
|
||||
import { DecodeMode, PlateNumberComponent } from '@kit/tdos';
|
||||
import { BusinessError } from '@kit.BasicServicesKit';
|
||||
import { JSON } from '@kit.ArkTS';
|
||||
import { router } from '@kit.ArkUI';
|
||||
import { BasePageResult } from '../../model/uiModel/PageResultModel';
|
||||
|
||||
/**
|
||||
* 车牌识别
|
||||
*/
|
||||
@Preview
|
||||
@Component
|
||||
@Entry
|
||||
export struct OCRCarNumPages {
|
||||
@State interrupt:boolean = false;
|
||||
|
||||
build() {
|
||||
Column(){
|
||||
PlateNumberComponent({
|
||||
decodeMode:DecodeMode.AUTO,
|
||||
interrupt:this.interrupt,
|
||||
onParseCallback:(plates)=>{
|
||||
console.debug("carNumOcr",`识别结果:${JSON.stringify(plates)}`)
|
||||
if(plates&& plates.length>0){
|
||||
let p = plates[0]
|
||||
if (p) {
|
||||
this.interrupt = true
|
||||
let param: BasePageResult = new BasePageResult();
|
||||
param.type=2
|
||||
param.data=String(p.text)
|
||||
router.back({url:'ui/pages/CheckCarPage',params:param});
|
||||
}
|
||||
}
|
||||
},
|
||||
onParseError:(error:BusinessError)=>{
|
||||
console.error("carNumOcr",`识别结果:${JSON.stringify(error)}`)
|
||||
|
||||
}
|
||||
})
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
//其中CardRecognitionConfig,CardContentConfig,BankCardConfig从API12开始支持
|
||||
import {
|
||||
CardRecognition,
|
||||
CallbackParam,
|
||||
CardType,
|
||||
CardSide,
|
||||
ShootingMode,
|
||||
} from "@kit.VisionKit";
|
||||
import { router } from "@kit.ArkUI";
|
||||
import { ToastUtils } from "../../util/ToasUtils";
|
||||
import { RouterResultModel } from "../../model/uiModel/PageParamModel";
|
||||
import { BasePageResult } from "../../model/uiModel/PageResultModel";
|
||||
|
||||
@Component
|
||||
@Entry
|
||||
export struct OCRTestPages {
|
||||
build() {
|
||||
Column() {
|
||||
//身份证
|
||||
CardRecognition({
|
||||
supportType: CardType.CARD_ID,
|
||||
// 身份证可双面识别
|
||||
cardSide: CardSide.FRONT,
|
||||
cardRecognitionConfig: {
|
||||
defaultShootingMode: ShootingMode.MANUAL,
|
||||
isPhotoSelectionSupported: true
|
||||
},
|
||||
callback: ((params: CallbackParam) => {
|
||||
if (params.code != 200) {
|
||||
ToastUtils.toastCenter('识别失败!')
|
||||
router.back()
|
||||
return
|
||||
}
|
||||
let param = new BasePageResult();
|
||||
param.type = 8;
|
||||
let routerResult = new RouterResultModel<string>();
|
||||
routerResult.pageTag = "OCR"
|
||||
routerResult.data = JSON.stringify(params.cardInfo?.front)
|
||||
param.data = routerResult
|
||||
router.back({ url: 'ui/pages/StreetInspectionPages', params: param });
|
||||
})
|
||||
})
|
||||
}
|
||||
.height('100%')
|
||||
.width('100%')
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,354 @@
|
|||
import { JSONUtil } from "@pura/harmony-utils/src/main/ets/utils/JSONUtil";
|
||||
import AppConstants from "../../app/AppConstant";
|
||||
import { PCCacheData } from "../../app/PCCacheData";
|
||||
import { RuanseeAbitityStag } from "../../app/RuanseeAbitityStag";
|
||||
import { CheckSubmitEntity, CheckSubmitModel } from "../../model/requestModel/CheckRequestModel";
|
||||
import { CheckReasonModel } from "../../model/uiModel/GoodsModel";
|
||||
import { cardRoundBorderGreyStyle } from "../../style/BorderStyle";
|
||||
import { bufferToString } from "../../util/BufferUtil";
|
||||
import { DateFormat, DateUtils } from "../../util/DateUtils";
|
||||
import { StringUtils } from "../../util/StringUtils";
|
||||
import { BaseTopBar } from "../../view/custom/BaseTopTar";
|
||||
import { SelectCheckReasonDialog } from "../../view/dialog/SelectCheckReasonDialog";
|
||||
import router from "@ohos.router";
|
||||
import { SkipPassPageParam } from "../../model/uiModel/PageParamModel";
|
||||
import { getCoordinateDescription, saveMainHistoryAndChangeStatus } from "../../request/api/Api";
|
||||
import { AxiosError } from "@ohos/axios";
|
||||
import { createWaterMark } from "../../view/custom/Watermark";
|
||||
import { ToastUtil } from "@pura/harmony-utils/src/main/ets/action/ToastUtil";
|
||||
import { BasePageResult } from "../../model/uiModel/PageResultModel";
|
||||
import { geoLocationManager } from "@kit.LocationKit";
|
||||
import { AppCache } from "../../app/AppCache";
|
||||
|
||||
/**
|
||||
* 通过
|
||||
*/
|
||||
@Preview
|
||||
@Component
|
||||
@Entry
|
||||
export struct PassPage {
|
||||
@State checkReasonData: CheckReasonModel[] = []
|
||||
@State checkReason: string = "请选择盘查原因"
|
||||
@State selectCheckReasonValue: string = "1";
|
||||
@State inputAddress: string = "";
|
||||
@State inputRemark: string = "";
|
||||
pageParam: SkipPassPageParam | undefined = undefined;
|
||||
|
||||
//定位状态
|
||||
locationStatus:boolean = false;
|
||||
|
||||
aboutToAppear(): void {
|
||||
this.pageParam = router.getParams() as SkipPassPageParam;
|
||||
this.getUIContext().getHostContext()?.resourceManager.getRawFileContent('checkData/CheckReason.json')
|
||||
.then(value => {
|
||||
this.checkReasonData = JSON.parse(bufferToString(value.buffer)) as CheckReasonModel[];
|
||||
if (this.checkReasonData && this.checkReasonData.length > 0) {
|
||||
this.checkReason = StringUtils.get(this.checkReasonData[0].dictLabel, "");
|
||||
this.selectCheckReasonValue = StringUtils.get(this.checkReasonData[0].dictValue, "1");
|
||||
}
|
||||
})
|
||||
if(StringUtils.isNullOrEmpty(RuanseeAbitityStag.appCache.getLocationAddress)){
|
||||
this.getCurrentLocation()
|
||||
}else {
|
||||
this.inputAddress = RuanseeAbitityStag.appCache.getLocationAddress
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 读取缓存的位置
|
||||
* @returns
|
||||
*/
|
||||
getLastLocation(): geoLocationManager.Location | undefined {
|
||||
try {
|
||||
let location = geoLocationManager.getLastLocation();
|
||||
return location;
|
||||
} catch (err) {
|
||||
console.info("passPage", "errCode:" + err.code + ", message:" + err.message);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
private locationCallback = (data: geoLocationManager.Location) => {
|
||||
console.info("passPage", 'current location: ' + JSON.stringify(data));
|
||||
AppCache.getAppCache().setLocation(data);
|
||||
this.getAddressByLongitudeLatitude(data)
|
||||
}
|
||||
|
||||
onPageHide(): void {
|
||||
if (this.locationStatus) {
|
||||
geoLocationManager.off('locationChange', this.locationCallback);
|
||||
this.locationStatus = false;
|
||||
}
|
||||
// 在页面销毁时解除监听
|
||||
}
|
||||
|
||||
/**
|
||||
* 持续定位 获取位置
|
||||
*/
|
||||
getCurrentLocation() {
|
||||
|
||||
let request2: geoLocationManager.ContinuousLocationRequest = {
|
||||
"interval": 60,
|
||||
"locationScenario": geoLocationManager.UserActivityScenario.SPORT
|
||||
}
|
||||
try {
|
||||
geoLocationManager.on('locationChange', request2,this.locationCallback )
|
||||
this.locationStatus = true;
|
||||
// let request: geoLocationManager.SingleLocationRequest = {
|
||||
// 'locatingPriority': geoLocationManager.LocatingPriority.PRIORITY_LOCATING_SPEED,
|
||||
// 'locatingTimeoutMs': 10000
|
||||
// }
|
||||
// geoLocationManager.getCurrentLocation(request) 街面盘查 StreetFront Street level search
|
||||
// .then((result) => { // 调用getCurrentLocation获取当前设备位置,通过promise接收上报的位置
|
||||
// console.info(TAG, 'current location: ' + JSON.stringify(result));
|
||||
// })
|
||||
// .catch((error: BusinessError) => { // 接收上报的错误码
|
||||
// console.info(TAG, 'promise, getCurrentLocation: error=' + JSON.stringify(error));
|
||||
// });
|
||||
} catch (err) {
|
||||
console.info("passPage", "errCode:" + JSON.stringify(err));
|
||||
}
|
||||
}
|
||||
|
||||
getAddressByLongitudeLatitude(location :geoLocationManager.Location){
|
||||
getCoordinateDescription()
|
||||
.then((res)=>{
|
||||
console.debug(JSONUtil.beanToJsonStr(res))
|
||||
if (res&&res.length>0) {
|
||||
let address = res[0];
|
||||
if (address) {
|
||||
this.inputAddress = StringUtils.get(address.address,"");
|
||||
if (this.locationStatus) {
|
||||
geoLocationManager.off('locationChange', this.locationCallback);
|
||||
this.locationStatus = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((error:AxiosError)=>{
|
||||
console.error(error.message)
|
||||
})
|
||||
}
|
||||
|
||||
selectCheckReasonController: CustomDialogController = new CustomDialogController({
|
||||
builder: SelectCheckReasonDialog({
|
||||
checkReasonData: this.checkReasonData,
|
||||
clickItem: (item, selectIndex) => {
|
||||
this.checkReason = StringUtils.get(item.dictLabel, "");
|
||||
this.selectCheckReasonValue = StringUtils.get(item.dictValue, "1");
|
||||
this.selectCheckReasonController.close()
|
||||
}
|
||||
}),
|
||||
cornerRadius: 3,
|
||||
autoCancel: false,
|
||||
backgroundColor: Color.Transparent, // 背景透明
|
||||
backgroundBlurStyle: BlurStyle.NONE // 必须关闭模糊材质
|
||||
});
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
BaseTopBar({
|
||||
title: "完善盘查信息"
|
||||
})
|
||||
|
||||
Text("盘查原因:")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.width('90%')
|
||||
.textAlign(TextAlign.Start)
|
||||
.margin({
|
||||
left: $r('app.float.default_10'),
|
||||
bottom: $r('app.float.default_5'),
|
||||
top: $r('app.float.default_20')
|
||||
})
|
||||
|
||||
Row() {
|
||||
Text(this.checkReason)
|
||||
.fontColor($r('app.color.bull'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.layoutWeight(1)
|
||||
.textAlign(TextAlign.Start)
|
||||
.margin({ left: $r("app.float.default_10") })
|
||||
.align(Alignment.Start)
|
||||
|
||||
Text("点击选择")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_12'))
|
||||
.margin({ left: $r('app.float.default_10'), right: $r('app.float.default_10') })
|
||||
}
|
||||
.width(`calc(100% - 20vp)`)
|
||||
.height($r('app.float.default_43'))
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.margin({
|
||||
top: $r('app.float.default_10'),
|
||||
bottom: $r('app.float.default_5'),
|
||||
left: $r('app.float.default_10'),
|
||||
right: $r('app.float.default_10')
|
||||
})
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.border(cardRoundBorderGreyStyle)
|
||||
.padding({left:$r('app.float.default_8'),right:$r('app.float.default_8')})
|
||||
.onClick(() => {
|
||||
this.selectCheckReasonController.open()
|
||||
})
|
||||
|
||||
|
||||
Text("盘查地址:")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.width('90%')
|
||||
.textAlign(TextAlign.Start)
|
||||
.margin({
|
||||
left: $r('app.float.default_10'),
|
||||
bottom: $r('app.float.default_5'),
|
||||
top: $r('app.float.default_10')
|
||||
})
|
||||
|
||||
TextInput({ text: this.inputAddress, placeholder: "请输入地址" })
|
||||
.width(`calc(100% - 20vp)`)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.textAlign(TextAlign.Start)
|
||||
.align(Alignment.Center)
|
||||
.height($r('app.float.default_40'))
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.textAlign(TextAlign.Start)
|
||||
.margin({
|
||||
top: $r('app.float.default_5'),
|
||||
bottom: $r('app.float.default_5'),
|
||||
left: $r('app.float.default_10'),
|
||||
right: $r('app.float.default_10')
|
||||
})
|
||||
.onChange((res) => {
|
||||
this.inputAddress = res;
|
||||
})
|
||||
.border(cardRoundBorderGreyStyle)
|
||||
|
||||
Text("备注信息:")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.width('90%')
|
||||
.textAlign(TextAlign.Start)
|
||||
.margin({
|
||||
left: $r('app.float.default_10'),
|
||||
bottom: $r('app.float.default_5'),
|
||||
top: $r('app.float.default_10')
|
||||
})
|
||||
|
||||
TextArea({ text: this.inputRemark, placeholder: "请输入备注信息" })
|
||||
.width(`calc(100% - 20vp)`)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.textAlign(TextAlign.Start)
|
||||
.align(Alignment.TopStart)
|
||||
.height($r('app.float.default_88'))
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.margin({
|
||||
top: $r('app.float.default_5'),
|
||||
bottom: $r('app.float.default_5'),
|
||||
left: $r('app.float.default_10'),
|
||||
right: $r('app.float.default_10')
|
||||
})
|
||||
.onChange((res) => {
|
||||
this.inputRemark = res;
|
||||
})
|
||||
.border(cardRoundBorderGreyStyle)
|
||||
|
||||
Column()
|
||||
.layoutWeight(1)
|
||||
|
||||
Button('完成', { type: ButtonType.Normal, stateEffect: true })
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height($r('app.float.default_48'))
|
||||
.margin({ bottom: $r('app.float.default_22') })
|
||||
.backgroundColor($r('app.color.colorGreen7'))
|
||||
.onClick(() => {
|
||||
this.submit()
|
||||
})
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height(AppConstants.PERCENTAGE_MAX)
|
||||
.backgroundColor($r('app.color.page_background'))
|
||||
.overlay(createWaterMark())
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 街面/卡点
|
||||
* 车辆类型(重点,正常)
|
||||
*/
|
||||
submit() {
|
||||
let pc = PCCacheData.pcCacheData;
|
||||
let entity: CheckSubmitEntity = new CheckSubmitEntity();
|
||||
entity.peopleCount = pc.zcCount + ""
|
||||
entity.unusualPeopleCount = pc.yiCount + ""
|
||||
|
||||
entity.unusualCarCount = ''
|
||||
|
||||
if (this.pageParam) {
|
||||
if (this.pageParam.carNumStatus == 0) {
|
||||
entity.carCount = "0";
|
||||
entity.unusualCarCount = "0";
|
||||
} else {
|
||||
entity.carCount = "1";
|
||||
if (this.pageParam.carNumStatus == 1) {
|
||||
entity.unusualCarCount = "1";
|
||||
} else {
|
||||
entity.unusualCarCount = "0";
|
||||
}
|
||||
}
|
||||
}
|
||||
entity.goodsCount = `${pc.wpCount}`
|
||||
|
||||
//type 0 = 街面盘查 1 = 卡点盘查
|
||||
entity.type = "0"
|
||||
entity.checkReason = this.selectCheckReasonValue
|
||||
entity.checkAddress = this.inputAddress
|
||||
entity.remark = this.inputRemark
|
||||
entity.pointX = RuanseeAbitityStag.appCache.getLocationX() + ""
|
||||
entity.pointY = RuanseeAbitityStag.appCache.getLocationY() + ""
|
||||
entity.taskId = ""
|
||||
entity.kkid = ""
|
||||
entity.mainId = RuanseeAbitityStag.appCache.getHistoryId()
|
||||
entity.checkTime = DateUtils.formatDateStr(new Date(), DateFormat.YYYYhMMhDDkHHdMMdSS)
|
||||
entity.status = "0"
|
||||
entity.groupId = ""
|
||||
entity.yjdw = ""
|
||||
entity.userName = RuanseeAbitityStag.userCache.getUserCode
|
||||
entity.idCard = RuanseeAbitityStag.userCache.getIdCardNum
|
||||
entity.deptId = RuanseeAbitityStag.userCache.getDeptCode
|
||||
entity.deptName = RuanseeAbitityStag.userCache.getDeptName
|
||||
entity.orgCode = RuanseeAbitityStag.userCache.getDeptCode
|
||||
entity.orgName = RuanseeAbitityStag.userCache.getDeptName
|
||||
entity.policeNum = RuanseeAbitityStag.userCache.getUserCode
|
||||
entity.policeName = RuanseeAbitityStag.userCache.getUserName
|
||||
entity.policeIdCard = RuanseeAbitityStag.userCache.getIdCardNum
|
||||
|
||||
let model: CheckSubmitModel = new CheckSubmitModel();
|
||||
model.checkHistoryEntity = entity;
|
||||
model.personIds = []
|
||||
model.carIds = []
|
||||
|
||||
saveMainHistoryAndChangeStatus(model)
|
||||
.then((res)=>{
|
||||
console.debug(JSON.stringify(res));
|
||||
if (res.code == 200) {
|
||||
let param: BasePageResult = {
|
||||
type: 5,
|
||||
what: 1,
|
||||
data: "提交成功!"
|
||||
}
|
||||
router.back({ url: "ui/pages/StreetInspectionPages", params: param })
|
||||
}else {
|
||||
ToastUtil.showToast(res.msg)
|
||||
}
|
||||
})
|
||||
.catch((error:AxiosError)=>{
|
||||
console.error(error.message)
|
||||
ToastUtil.showToast(error.message)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,511 @@
|
|||
import router from '@ohos.router';
|
||||
|
||||
import { AxiosError } from '@ohos/axios';
|
||||
import { fileUri } from '@kit.CoreFileKit';
|
||||
import { ToastUtils } from '../../util/ToasUtils';
|
||||
import { createWaterMark } from '../../view/custom/Watermark';
|
||||
import { SkipCheckCountParam } from '../../model/uiModel/PageParamModel';
|
||||
import { RequestCheckPeopleRecordModel } from '../../model/requestModel/CheckRequestModel';
|
||||
import { CheckPeopleRecordItem, ZdlxItem } from '../../model/resultModel/CheckPeopleResultModel';
|
||||
import { ErrorOfEmptyModel } from '../../model/uiModel/BeanModel';
|
||||
import { LitheRefresh, RefreshController } from '@abner/lithe_refresh';
|
||||
import { JSONUtil, StrUtil, ToastUtil } from '@pura/harmony-utils';
|
||||
import AppConstants from '../../app/AppConstant';
|
||||
import { StringUtils } from '../../util/StringUtils';
|
||||
import { BaseTopBar } from '../../view/custom/BaseTopTar';
|
||||
import { getCheckPeopleRecord } from '../../request/api/Api';
|
||||
import { cardRoundBorderStyle } from '../../style/BorderStyle';
|
||||
import { FileUtils } from '../../util/FileUtils';
|
||||
import { getCheckTypeIcon } from '../../util/StatusIconUtils';
|
||||
|
||||
@Preview
|
||||
@Entry
|
||||
@Component
|
||||
struct PeopleCheckDetailsPages {
|
||||
// =============== 人员属性 ===============
|
||||
@State name: string = "";
|
||||
@State sex: string = "";
|
||||
@State idCardNum: string = "";
|
||||
@State birthDate: string = "";
|
||||
@State nation: string = "";
|
||||
@State address: string = "";
|
||||
@State peopleOPhone: string = ""
|
||||
@State photoData: string | Resource = $r('app.media.photo');
|
||||
@State photoStatus: boolean = false
|
||||
idCardPhtot: string = "";
|
||||
xcZpPhtot: string = "";
|
||||
//人员重点信息
|
||||
@State zdlxImg: Array<ZdlxItem> | undefined = undefined;
|
||||
//=================== 列表属性 ==================
|
||||
@State dataSet: Array<CheckPeopleRecordItem> | null = null;
|
||||
controller: RefreshController = new RefreshController()
|
||||
scroller: Scroller = new Scroller()
|
||||
total: number = 0;
|
||||
pageNum: number = 1;
|
||||
isRefreshStatus: number = 0;
|
||||
|
||||
aboutToAppear(): void {
|
||||
getContext(this).filesDir;
|
||||
this.analyzePeople();
|
||||
setTimeout(() => {
|
||||
this.controller.isAutoRefresh = true;
|
||||
}, 800)
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析人员数据
|
||||
*/
|
||||
analyzePeople() {
|
||||
let pageParam = router.getParams() as SkipCheckCountParam;
|
||||
this.name = pageParam.name;
|
||||
this.sex = pageParam.sex;
|
||||
this.idCardNum = pageParam.idCardNum;
|
||||
this.birthDate = pageParam.birthDate;
|
||||
this.nation = pageParam.nation;
|
||||
this.address = pageParam.address;
|
||||
if (!pageParam.photoData) {
|
||||
let filePath = FileUtils.ID_CARD_DIR + "/" + this.idCardNum + '.png';
|
||||
this.photoData = fileUri.getUriFromPath(filePath)
|
||||
} else {
|
||||
this.photoData = pageParam.photoData;
|
||||
}
|
||||
|
||||
this.zdlxImg = new Array;
|
||||
if (StrUtil.isNotEmpty(pageParam.zdlx)) {
|
||||
if (pageParam.zdlx.startsWith("[") && pageParam.zdlx.endsWith("]")) {
|
||||
let array = JSONUtil.jsonToArray<ZdlxItem>(pageParam.zdlx)
|
||||
if (array && array.length > 0) {
|
||||
this.zdlxImg = array;
|
||||
}
|
||||
return
|
||||
}
|
||||
let strings = pageParam.zdlx.split("、");
|
||||
if (strings.length == 0) {
|
||||
this.zdlxImg.push(new ZdlxItem("正常人员", 1));
|
||||
} else {
|
||||
for (let i = 0; i < strings.length; i++) {
|
||||
this.zdlxImg.push(new ZdlxItem(strings[i], 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getRecordListData() {
|
||||
let requestMode: RequestCheckPeopleRecordModel = {
|
||||
idCardNum: this.idCardNum,
|
||||
pageNum: this.pageNum,
|
||||
pageSize: 30 + ""
|
||||
}
|
||||
getCheckPeopleRecord(requestMode)
|
||||
.then((res) => {
|
||||
if (this.controller.isAutoRefresh) {
|
||||
this.controller.isAutoRefresh = false;
|
||||
}
|
||||
if (res.code == 200) {
|
||||
let data = res.data;
|
||||
if (data) {
|
||||
this.total = data.total;
|
||||
let list = data.rows;
|
||||
if (list) {
|
||||
if (this.isRefreshStatus == 1) {
|
||||
//刷新
|
||||
this.controller.finishRefresh()
|
||||
this.dataSet = new Array
|
||||
list.forEach((item) => {
|
||||
this.dataSet?.push(item)
|
||||
})
|
||||
}
|
||||
if (this.isRefreshStatus == 2) {
|
||||
//加载
|
||||
this.controller.finishLoadMore()
|
||||
list.forEach((item) => {
|
||||
this.dataSet?.push(item)
|
||||
})
|
||||
}
|
||||
if (this.pageNum * 30 >= this.total) {
|
||||
this.controller.closeLoadMore = true;
|
||||
}
|
||||
this.isRefreshStatus = 0
|
||||
} else {
|
||||
this.handlerErrorOrEmpty(new ErrorOfEmptyModel(0, "没有数据!"))
|
||||
}
|
||||
} else {
|
||||
this.handlerErrorOrEmpty(new ErrorOfEmptyModel(0, "没有数据!"))
|
||||
}
|
||||
} else {
|
||||
this.handlerErrorOrEmpty(new ErrorOfEmptyModel(-1, StringUtils.get(res.msg, "")))
|
||||
}
|
||||
})
|
||||
.catch((error: AxiosError) => {
|
||||
console.error("请求失败:", JSON.stringify(error))
|
||||
this.handlerErrorOrEmpty(new ErrorOfEmptyModel(-1, error.message))
|
||||
})
|
||||
}
|
||||
|
||||
handlerErrorOrEmpty(model: ErrorOfEmptyModel) {
|
||||
ToastUtils.toastBottom(model.msg)
|
||||
if (this.isRefreshStatus == 1) {
|
||||
//刷新
|
||||
this.controller.finishRefresh()
|
||||
this.dataSet = new Array
|
||||
}
|
||||
if (this.isRefreshStatus == 2) {
|
||||
//加载
|
||||
this.controller.finishLoadMore()
|
||||
}
|
||||
this.isRefreshStatus = 0
|
||||
}
|
||||
|
||||
//066929
|
||||
build() {
|
||||
Column() {
|
||||
BaseTopBar({
|
||||
title: "盘查记录"
|
||||
})
|
||||
this.peopleInfo();
|
||||
|
||||
Row() {
|
||||
Image($r('app.media.icon_history_list'))
|
||||
.height($r('app.float.default_16'))
|
||||
.width($r('app.float.default_16'))
|
||||
Text('核查记录')
|
||||
.fontColor($r('app.float.default_14'))
|
||||
.fontColor($r('app.color.black'))
|
||||
.margin({ left: $r('app.float.default_8') })
|
||||
}
|
||||
.width('100%')
|
||||
.height($r('app.float.default_36'))
|
||||
.margin({ top: $r('app.float.default_10') })
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.padding({ left: $r('app.float.default_10') })
|
||||
|
||||
Divider()
|
||||
.width('100%')
|
||||
.height($r('app.float.default_1'))
|
||||
.backgroundColor($r('app.color.page_background'))
|
||||
|
||||
LitheRefresh({
|
||||
scroller: this.scroller,
|
||||
controller: this.controller,
|
||||
itemLayout: () => {
|
||||
this.listView()
|
||||
},
|
||||
onRefresh: () => {
|
||||
this.controller.closeLoadMore = false;
|
||||
this.pageNum = 1;
|
||||
this.isRefreshStatus = 1;
|
||||
this.getRecordListData()
|
||||
},
|
||||
onLoadMore: () => {
|
||||
if (this.pageNum * 30 >= this.total) {
|
||||
this.controller.finishLoadMore()
|
||||
this.controller.closeLoadMore = true;
|
||||
ToastUtil.showToast("没有更多数据!")
|
||||
return
|
||||
}
|
||||
this.pageNum++;
|
||||
this.isRefreshStatus = 2;
|
||||
this.getRecordListData()
|
||||
}
|
||||
})
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.layoutWeight(1)
|
||||
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.backgroundColor($r('app.color.page_background'))
|
||||
.overlay(createWaterMark())
|
||||
}
|
||||
|
||||
@Builder
|
||||
recordListItem(dataItem: CheckPeopleRecordItem) {
|
||||
Row() {
|
||||
Image(getCheckTypeIcon(dataItem.checkTypeStr))
|
||||
.width($r('app.float.default_38'))
|
||||
.height($r('app.float.default_38'))
|
||||
.margin({ left: $r('app.float.default_10'), right: $r('app.float.default_10') })
|
||||
|
||||
Column() {
|
||||
Row() {
|
||||
Text("警员:")
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
Text(dataItem.policeName)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.layoutWeight(1)
|
||||
Text(dataItem.checkTime)
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_12'))
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.margin({ top: $r('app.float.default_5') })
|
||||
.padding({ right: $r('app.float.default_8') })
|
||||
|
||||
Row() {
|
||||
Text("单位:")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_12'))
|
||||
Text(dataItem.deptName)
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_12'))
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.margin({ top: $r('app.float.default_5') })
|
||||
|
||||
Row() {
|
||||
Text("地址:")
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_12'))
|
||||
Text(dataItem.checkAddress)
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_12'))
|
||||
}
|
||||
.margin({ top: $r('app.float.default_5') })
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
}
|
||||
.layoutWeight(1)
|
||||
}
|
||||
.width('95%')
|
||||
.margin({ top: $r('app.float.default_10'), right: $r('app.float.default_10'), left: $r('app.float.default_10') })
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.border(cardRoundBorderStyle)
|
||||
.padding({ top: $r('app.float.default_8'), bottom: $r('app.float.default_8') })
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新列表
|
||||
*/
|
||||
@Builder
|
||||
listView() {
|
||||
List({ scroller: this.scroller }) {
|
||||
ForEach(this.dataSet, (item: CheckPeopleRecordItem) => {
|
||||
ListItem() {
|
||||
this.recordListItem(item)
|
||||
}
|
||||
})
|
||||
}
|
||||
.listDirection(Axis.Vertical)
|
||||
.scrollBar(BarState.Off)
|
||||
.edgeEffect(EdgeEffect.None)
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.layoutWeight(1)
|
||||
.nestedScroll({
|
||||
scrollForward: NestedScrollMode.PARENT_FIRST,
|
||||
scrollBackward: NestedScrollMode.PARENT_FIRST
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 人员信息
|
||||
*/
|
||||
@Builder
|
||||
peopleInfo() {
|
||||
Column() {
|
||||
Row() {
|
||||
//信息区域
|
||||
Column() {
|
||||
Row() {
|
||||
Text('姓名:')
|
||||
.fontColor($r('app.color.bull'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
Text(this.name)
|
||||
.fontColor($r('app.color.bull'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.margin({ left: $r('app.float.default_2') })
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
|
||||
Row() {
|
||||
Row() {
|
||||
Text('民族:')
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
Text(this.nation)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.margin({ left: $r('app.float.default_2') })
|
||||
}
|
||||
.layoutWeight(1.8)
|
||||
|
||||
Row() {
|
||||
Text('性别:')
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
Text(this.sex)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.margin({ left: $r('app.float.default_2') })
|
||||
}
|
||||
.layoutWeight(1)
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.margin({ top: $r('app.float.default_5') })
|
||||
|
||||
Row() {
|
||||
Text('出生日期:')
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
Text(this.birthDate)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.margin({ left: $r('app.float.default_2') })
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.margin({ top: $r('app.float.default_5') })
|
||||
|
||||
Row() {
|
||||
Text('手机号码:')
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
Text(StringUtils.get(this.peopleOPhone,"暂无"))
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.margin({ left: $r('app.float.default_2') })
|
||||
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.margin({ top: $r('app.float.default_5') })
|
||||
|
||||
Row() {
|
||||
Text('身份证号:')
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
Text(this.idCardNum)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.margin({ left: $r('app.float.default_2') })
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.margin({ top: $r('app.float.default_5') })
|
||||
|
||||
Row() {
|
||||
Text('户籍地址:')
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
|
||||
Text(this.address)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.layoutWeight(1)
|
||||
.margin({ left: $r('app.float.default_2') })
|
||||
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.margin({ top: $r('app.float.default_5') })
|
||||
|
||||
}
|
||||
.layoutWeight(1)
|
||||
.justifyContent(FlexAlign.Start)
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.padding({
|
||||
top: $r('app.float.default_10'),
|
||||
left: $r('app.float.default_10'),
|
||||
right: $r('app.float.default_10')
|
||||
})
|
||||
|
||||
//照片区域
|
||||
Column() {
|
||||
Image(this.photoData)
|
||||
.width($r('app.float.default_84'))
|
||||
.height($r('app.float.default_110'))
|
||||
.border({
|
||||
width: $r('app.float.default_1'),
|
||||
color: $r('app.color.colorGrey4')
|
||||
})
|
||||
.objectFit(ImageFit.Fill)
|
||||
|
||||
Row() {
|
||||
Text('证件')
|
||||
.fontColor(this.photoStatus ? $r('app.color.colorBluen7') : $r('app.color.colorGrey3'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.layoutWeight(1)
|
||||
.textAlign(TextAlign.Center)
|
||||
.onClick(() => {
|
||||
this.photoData = this.idCardPhtot
|
||||
this.photoStatus = true;
|
||||
})
|
||||
|
||||
Divider()
|
||||
.width($r('app.float.default_1'))
|
||||
.height('96%')
|
||||
.color($r('app.color.colorGrey3'))
|
||||
.backgroundColor($r('app.color.colorGrey4'))
|
||||
|
||||
Text('现场')
|
||||
.fontColor(this.photoStatus ? $r('app.color.colorGrey3') : $r('app.color.colorBluen7'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.layoutWeight(1)
|
||||
.onClick(() => {
|
||||
if (this.xcZpPhtot) {
|
||||
this.photoData = this.xcZpPhtot
|
||||
this.photoStatus = false;
|
||||
}
|
||||
})
|
||||
.textAlign(TextAlign.Center)
|
||||
}
|
||||
.width('90%')
|
||||
.height($r('app.float.default_26'))
|
||||
.borderRadius(50)
|
||||
.visibility(StringUtils.isNullOrEmpty(this.xcZpPhtot) ? Visibility.Hidden : Visibility.Visible)
|
||||
.backgroundColor('rgba(1, 1, 1, 0.4)')
|
||||
.margin({ top: $r('app.float.default_5') })
|
||||
|
||||
}
|
||||
.width($r('app.float.default_120'))
|
||||
.padding({ top: $r('app.float.default_15'), bottom: $r('app.float.default_10') })
|
||||
|
||||
}
|
||||
.alignItems(VerticalAlign.Top)
|
||||
|
||||
Divider()
|
||||
.width('98%')
|
||||
.height($r('app.float.default_1'))
|
||||
.backgroundColor($r('app.color.colorGrey1'))
|
||||
.margin({ left: $r('app.float.default_10'), top: $r('app.float.default_10') })
|
||||
|
||||
Row() {
|
||||
Text('人员属性:')
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.margin({ left: $r('app.float.default_15') })
|
||||
|
||||
List() {
|
||||
ForEach(this.zdlxImg, (item: ZdlxItem) => {
|
||||
ListItem() {
|
||||
Image(item.getIcon())
|
||||
.width($r('app.float.default_26'))
|
||||
.height($r('app.float.default_26'))
|
||||
}
|
||||
.onClick(() => {
|
||||
ToastUtils.toastBottom(item.zdlx)
|
||||
})
|
||||
})
|
||||
}
|
||||
.alignListItem(ListItemAlign.Center)
|
||||
.listDirection(Axis.Horizontal)
|
||||
.height(AppConstants.PERCENTAGE_MAX)
|
||||
.layoutWeight(1)
|
||||
|
||||
}
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.height($r('app.float.default_38'))
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
}
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.borderRadius(5)
|
||||
.justifyContent(FlexAlign.Start)
|
||||
.width('95%')
|
||||
.margin({
|
||||
top: $r('app.float.default_15'),
|
||||
left: $r('app.float.default_15'),
|
||||
right: $r('app.float.default_15')
|
||||
})
|
||||
.padding({ bottom: $r('app.float.default_2') })
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,242 @@
|
|||
import { StrUtil, ToastUtil } from "@pura/harmony-utils";
|
||||
import { RdbDao } from "rdbstore";
|
||||
import AppConstants from "../../app/AppConstant";
|
||||
import { DBUtils } from "../../model/db/DBUtils";
|
||||
import { DeptTableEntity } from "../../model/db/TableEntity";
|
||||
import { cardRoundBorderStyle } from "../../style/BorderStyle";
|
||||
import { BaseTopBar } from "../../view/custom/BaseTopTar";
|
||||
import { KeyCode } from "@kit.InputKit";
|
||||
import { createWaterMark } from "../../view/custom/Watermark";
|
||||
import { SelectDept } from "../../model/uiModel/HandOverModel";
|
||||
import { SelectDeptItem } from "../../view/custom/SelectDeptItem";
|
||||
import { RuanseeAbitityStag } from "../../app/RuanseeAbitityStag";
|
||||
import { StringUtils } from "../../util/StringUtils";
|
||||
import { SkipHandOverParam, SkipHandOverSelectDeptParam, SkipPassPageParam } from "../../model/uiModel/PageParamModel";
|
||||
import { router } from "@kit.ArkUI";
|
||||
import { PCCacheData } from "../../app/PCCacheData";
|
||||
import { CheckSubmitEntity, CheckSubmitModel } from "../../model/requestModel/CheckRequestModel";
|
||||
import { DateFormat, DateUtils } from "../../util/DateUtils";
|
||||
import { saveMainHistoryAndChangeStatus } from "../../request/api/Api";
|
||||
import { BasePageResult } from "../../model/uiModel/PageResultModel";
|
||||
import { AxiosError } from "@ohos/axios";
|
||||
|
||||
@Component
|
||||
@Entry
|
||||
export struct SelectDeptPages{
|
||||
@State searchWord:string = ""
|
||||
@State deptData:Array<SelectDept> =[]
|
||||
dao:RdbDao<DeptTableEntity>|undefined
|
||||
pageParam: SkipHandOverSelectDeptParam | undefined = undefined;
|
||||
|
||||
lastIndex:number = -1;
|
||||
selectDeptId:string=""
|
||||
selectDeptName:string=""
|
||||
|
||||
aboutToAppear(): void {
|
||||
this.pageParam = router.getParams() as SkipHandOverSelectDeptParam;
|
||||
DBUtils.getInstance().getDeptDao()
|
||||
.then((dao) => {
|
||||
this.dao = dao
|
||||
this.getDeptData();
|
||||
});
|
||||
}
|
||||
|
||||
getDeptData() {
|
||||
if (StrUtil.isNotEmpty(this.searchWord)){
|
||||
this.dao?.querySql(`SELECT * FROM deptTable WHERE deptName like '%${this.searchWord}%'`)
|
||||
.then((res)=>{
|
||||
if (res) {
|
||||
this.selectDeptId = ""
|
||||
this.selectDeptName = ""
|
||||
this.lastIndex = -1
|
||||
this.deptData = new Array
|
||||
res.forEach(element => {
|
||||
let bean = new SelectDept();
|
||||
bean.randomId = RuanseeAbitityStag.appCache.getRandomId()
|
||||
bean.deptId = element.deptId
|
||||
bean.deptName = element.deptName
|
||||
bean.parentId = element.parentId
|
||||
bean.updateTime = element.updateTime
|
||||
this.deptData.push(bean)
|
||||
});
|
||||
}else {
|
||||
ToastUtil.showToast(`没有数据`)
|
||||
}
|
||||
})
|
||||
.catch((e:Error)=>{
|
||||
ToastUtil.showToast(`查询失败${e.message}`)
|
||||
})
|
||||
}else {
|
||||
this.dao?.queryAll()
|
||||
.then((data)=>{
|
||||
if (data) {
|
||||
this.lastIndex = -1
|
||||
this.selectDeptId = ""
|
||||
this.selectDeptName = ""
|
||||
this.deptData = new Array
|
||||
data.forEach(element => {
|
||||
let bean = new SelectDept();
|
||||
bean.randomId = RuanseeAbitityStag.appCache.getRandomId()
|
||||
bean.deptId = element.deptId
|
||||
bean.deptName = element.deptName
|
||||
bean.parentId = element.parentId
|
||||
bean.updateTime = element.updateTime
|
||||
this.deptData.push(bean)
|
||||
});
|
||||
}else {
|
||||
ToastUtil.showToast(`没有数据`)
|
||||
}
|
||||
})
|
||||
.catch((e:Error)=>{
|
||||
ToastUtil.showToast(`查询失败${e.message}`)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
//提交如果是卡点盘查直接提交
|
||||
private submit(){
|
||||
let pc = PCCacheData.pcCacheData;
|
||||
let entity: CheckSubmitEntity = new CheckSubmitEntity();
|
||||
entity.peopleCount = pc.zcCount + ""
|
||||
entity.unusualPeopleCount = pc.yiCount + ""
|
||||
|
||||
entity.unusualCarCount = ''
|
||||
|
||||
if (this.pageParam) {
|
||||
if (this.pageParam.carNumStatus == 0) {
|
||||
entity.carCount = "0";
|
||||
entity.unusualCarCount = "0";
|
||||
} else {
|
||||
entity.carCount = "1";
|
||||
if (this.pageParam.carNumStatus == 1) {
|
||||
entity.unusualCarCount = "1";
|
||||
} else {
|
||||
entity.unusualCarCount = "0";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
entity.goodsCount = `${pc.wpCount}`
|
||||
//type 0 = 街面盘查 1 = 卡点盘查
|
||||
entity.type = "1"
|
||||
entity.checkReason = "13"
|
||||
entity.checkAddress = RuanseeAbitityStag.appCache.getCardPointAddress
|
||||
entity.remark = ""
|
||||
entity.pointX = RuanseeAbitityStag.appCache.getCardPointLocationX()
|
||||
entity.pointY = RuanseeAbitityStag.appCache.getCardPointLocationY()
|
||||
entity.taskId = RuanseeAbitityStag.appCache.getTaskId
|
||||
entity.kkid = RuanseeAbitityStag.appCache.getCardPointIdId
|
||||
entity.mainId = RuanseeAbitityStag.appCache.getHistoryId()
|
||||
entity.checkTime = DateUtils.formatDateStr(new Date(), DateFormat.YYYYhMMhDDkHHdMMdSS)
|
||||
entity.status = "1"
|
||||
entity.groupId = ""
|
||||
entity.yjdw = this.selectDeptId;
|
||||
entity.yjdwmc = this.selectDeptName;
|
||||
entity.userName = RuanseeAbitityStag.userCache.getUserCode
|
||||
entity.idCard = RuanseeAbitityStag.userCache.getIdCardNum
|
||||
entity.deptId = RuanseeAbitityStag.userCache.getDeptCode
|
||||
entity.deptName = RuanseeAbitityStag.userCache.getDeptName
|
||||
entity.orgCode = RuanseeAbitityStag.userCache.getDeptCode
|
||||
entity.orgName = RuanseeAbitityStag.userCache.getDeptName
|
||||
entity.policeNum = RuanseeAbitityStag.userCache.getUserCode
|
||||
entity.policeName = RuanseeAbitityStag.userCache.getUserName
|
||||
entity.policeIdCard = RuanseeAbitityStag.userCache.getIdCardNum
|
||||
|
||||
let model: CheckSubmitModel = new CheckSubmitModel();
|
||||
model.checkHistoryEntity = entity;
|
||||
model.personIds = this.pageParam?.personIds
|
||||
model.carIds = new Array
|
||||
if (this.pageParam?.carId){
|
||||
model.carIds.push(this.pageParam.carId)
|
||||
}
|
||||
|
||||
saveMainHistoryAndChangeStatus(model)
|
||||
.then((res)=>{
|
||||
console.debug(JSON.stringify(res));
|
||||
if (res.code == 200) {
|
||||
let param: BasePageResult = {
|
||||
type: 5,
|
||||
what: 1,
|
||||
data: "提交成功!"
|
||||
}
|
||||
router.back({ url: "ui/pages/StreetInspectionPages", params: param })
|
||||
}else {
|
||||
ToastUtil.showToast(res.msg)
|
||||
}
|
||||
})
|
||||
.catch((error:AxiosError)=>{
|
||||
console.error(error.message)
|
||||
ToastUtil.showToast(error.message)
|
||||
})
|
||||
}
|
||||
|
||||
build() {
|
||||
Column(){
|
||||
BaseTopBar({
|
||||
title:"选择单位",
|
||||
rightText:this.pageParam?.isCardPoint?"提交":"下一步",
|
||||
rightClickEvent:()=>{
|
||||
if(this.pageParam?.isCardPoint){
|
||||
this.submit()
|
||||
}else {
|
||||
//是街面盘查的跳转完善信息页面
|
||||
let param: SkipHandOverParam = new SkipHandOverParam();
|
||||
param.isCardPoint = false;
|
||||
param.carNumStatus = this.pageParam == undefined ?0:this.pageParam.carNumStatus
|
||||
// param. isCardPoint = this.pageParam == undefined?true:this.pageParam.isCardPoint
|
||||
param.personIds = this.pageParam == undefined?[]:this.pageParam.personIds;
|
||||
param.carId = this.pageParam == undefined?"":this.pageParam.carId;
|
||||
param.selectDeptId = this.selectDeptId;
|
||||
param.selectDeptName = this.selectDeptName;
|
||||
router.pushUrl({ url: "ui/pages/HandOverPage", params: param })
|
||||
}
|
||||
}
|
||||
})
|
||||
Search({value:this.searchWord,placeholder: '输入卡点名称进行搜索' })
|
||||
.width('95%')
|
||||
.height($r('app.float.default_43'))
|
||||
.border(cardRoundBorderStyle)
|
||||
.margin({ top: $r('app.float.default_10') })
|
||||
.onChange((ver) => {
|
||||
this.searchWord = ver
|
||||
})
|
||||
.onKeyEvent((event:KeyEvent)=>{
|
||||
if (event.keyCode === KeyCode.KEYCODE_ENTER) {
|
||||
// 处理回车键触发的搜索逻辑
|
||||
console.log('回车键触发搜索');
|
||||
}
|
||||
})
|
||||
.enterKeyType(EnterKeyType.Search)
|
||||
.onSubmit(()=>{
|
||||
this.getDeptData();
|
||||
})
|
||||
|
||||
List(){
|
||||
ForEach(this.deptData,(item:SelectDept,index:number)=>{
|
||||
ListItem(){
|
||||
SelectDeptItem({ item:item })
|
||||
}
|
||||
.onClick(()=>{
|
||||
if (this.lastIndex >= 0&&this.deptData.length>=this.lastIndex) {
|
||||
//上一个已经选择
|
||||
this.deptData[this.lastIndex].isSelect = false;
|
||||
}
|
||||
this.lastIndex = index;
|
||||
item.isSelect = true;
|
||||
this.selectDeptId = StringUtils.get(item.deptId,"");
|
||||
this.selectDeptName = StringUtils.get(item.deptName,"");
|
||||
})
|
||||
.backgroundColor($r('app.color.white'))
|
||||
},(item:SelectDept)=>item.randomId)
|
||||
}
|
||||
.layoutWeight(1)
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height(AppConstants.PERCENTAGE_MAX)
|
||||
.backgroundColor($r('app.color.page_background'))
|
||||
.overlay(createWaterMark())
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,294 @@
|
|||
import { AxiosError } from "@ohos/axios";
|
||||
import { JSONUtil } from "@pura/harmony-utils/src/main/ets/utils/JSONUtil"
|
||||
import { ToastUtil } from "@pura/harmony-utils";
|
||||
import { StrUtil } from "@pura/harmony-utils/src/main/ets/utils/StrUtil";
|
||||
import AppConstants from "../../app/AppConstant";
|
||||
import { PCCacheData } from "../../app/PCCacheData";
|
||||
import { CarData } from "../../model/resultModel/CheckCarResultModel";
|
||||
import { CarItemBean, GoodsItemBean, HanoverItem, PersonItemBean } from "../../model/uiModel/HandOverModel";
|
||||
import { getPersonListByMainId } from "../../request/api/Api";
|
||||
import { BaseTopBar } from "../../view/custom/BaseTopTar";
|
||||
import { HandOverSelectCarItem } from "../../view/custom/HandOverSelectCarItem";
|
||||
import { HandOverSelectGoodsItem } from "../../view/custom/HandOverSelectGoodsItem";
|
||||
import { HandOverSelectPersonItem } from "../../view/custom/HandOverSelectPersonItem";
|
||||
import { createWaterMark } from "../../view/custom/Watermark";
|
||||
import { GoodsBean } from "../../model/uiModel/GoodsModel"
|
||||
import { RuanseeAbitityStag } from "../../app/RuanseeAbitityStag";
|
||||
import { ArrayList } from "@kit.ArkTS";
|
||||
import { StringUtils } from "../../util/StringUtils";
|
||||
import { router } from "@kit.ArkUI";
|
||||
import { SkipHandOverSelectDeptParam, SkipPassPageParam } from "../../model/uiModel/PageParamModel";
|
||||
|
||||
/**
|
||||
* 选择移交对象
|
||||
*/
|
||||
@Preview
|
||||
@Component
|
||||
@Entry
|
||||
export struct SelectHandOverObject {
|
||||
@State pageData: Array<HanoverItem> = []
|
||||
carData: Array<HanoverItem> = [];
|
||||
goodsData: Array<HanoverItem> = [];
|
||||
personData: Array<HanoverItem> = [];
|
||||
|
||||
selectPeronId: ArrayList<string> = new ArrayList();
|
||||
selectCarId: string = "";
|
||||
pageParam: SkipPassPageParam | undefined = undefined;
|
||||
|
||||
aboutToAppear(): void {
|
||||
this.pageParam = router.getParams() as SkipPassPageParam;
|
||||
this.hanCacheData()
|
||||
this.getPersonList();
|
||||
}
|
||||
|
||||
onPageShow(): void {
|
||||
|
||||
}
|
||||
|
||||
hanCacheData(): Promise<void> {
|
||||
return new Promise(resolve => {
|
||||
let carJson = PCCacheData.pcCacheData.carJson;
|
||||
if (StrUtil.isNotEmpty(carJson) && JSONUtil.isJSONStr(carJson)) {
|
||||
let carData: CarData = JSONUtil.jsonToBean(carJson, CarData) as CarData;
|
||||
if (carData) {
|
||||
let item = new HanoverItem();
|
||||
item.baseType = 1
|
||||
item.baseMsg = "通行车辆"
|
||||
item.id = RuanseeAbitityStag.appCache.getRandomId()
|
||||
this.carData.push(item);
|
||||
|
||||
let item2 = new HanoverItem();
|
||||
item2.baseType = 2
|
||||
let carItem = new CarItemBean()
|
||||
carItem.hphm = carData.hphm
|
||||
carItem.hpzl = carData.hpzl
|
||||
carItem.sfzh = carData.sfzh
|
||||
carItem.carZdlx = "正常车辆"
|
||||
carItem.id = carData.id;
|
||||
item2.id = carData.id;
|
||||
carItem.isSelect = false;
|
||||
let carZt = carData.zdlxBeanList;
|
||||
if (carZt) {
|
||||
for (let i = 0; i < carZt.length; i++) {
|
||||
carItem.carZdlx = carZt[i].zdlx;
|
||||
break
|
||||
}
|
||||
}
|
||||
item2.carData = carItem;
|
||||
this.carData.push(item2);
|
||||
}
|
||||
}
|
||||
let goodsJson = PCCacheData.pcCacheData.goodsJson;
|
||||
if (StrUtil.isNotEmpty(goodsJson) && JSONUtil.isJSONStr(goodsJson)) {
|
||||
let goodsList: Array<GoodsBean> = JSONUtil.jsonToArray<GoodsBean>(goodsJson)
|
||||
if (goodsList && goodsList.length > 0) {
|
||||
let item = new HanoverItem();
|
||||
item.baseType = 1
|
||||
item.baseMsg = "随行物品"
|
||||
item.id = RuanseeAbitityStag.appCache.getRandomId()
|
||||
this.goodsData.push(item);
|
||||
goodsList.forEach((goodsItem) => {
|
||||
let item2 = new HanoverItem();
|
||||
item2.baseType = 4
|
||||
let good = new GoodsItemBean();
|
||||
good.name = goodsItem.name
|
||||
good.count = goodsItem.count
|
||||
good.id = goodsItem.uuid;
|
||||
item2.goodsData = good
|
||||
good.isSelect = true;
|
||||
item2.id = goodsItem.uuid;
|
||||
this.goodsData.push(item2);
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 合并数据
|
||||
*/
|
||||
mergeData() {
|
||||
if (this.carData && this.carData.length > 0) {
|
||||
this.pageData = this.pageData.concat(this.carData)
|
||||
}
|
||||
if (this.personData && this.personData.length > 0) {
|
||||
this.pageData = this.pageData.concat(this.personData)
|
||||
}
|
||||
if (this.goodsData && this.goodsData.length > 0) {
|
||||
this.pageData = this.pageData.concat(this.goodsData)
|
||||
}
|
||||
}
|
||||
|
||||
getPersonList() {
|
||||
getPersonListByMainId(1, 80)
|
||||
.then((res) => {
|
||||
console.debug(JSONUtil.beanToJsonStr(res))
|
||||
if (res.code != 200) {
|
||||
ToastUtil.showToast(res.msg)
|
||||
this.mergeData()
|
||||
return
|
||||
}
|
||||
if (res.data) {
|
||||
// this.total = res.data.total;
|
||||
let rows = res.data.rows;
|
||||
if (rows && rows != undefined && rows.length > 0) {
|
||||
let item = new HanoverItem();
|
||||
item.baseType = 1
|
||||
item.baseMsg = "随行人员"
|
||||
item.id = RuanseeAbitityStag.appCache.getRandomId()
|
||||
this.personData.push(item);
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
let item2 = new HanoverItem();
|
||||
item2.baseType = 3
|
||||
let personBean = new PersonItemBean()
|
||||
let bean = rows[i];
|
||||
personBean.name = bean.name
|
||||
personBean.id = bean.uuid
|
||||
personBean.peopleStatusStr = bean.peopleStatusStr
|
||||
personBean.sfz = bean.sfz
|
||||
personBean.isSelect = false;
|
||||
item2.personData = personBean
|
||||
item2.id = bean.uuid
|
||||
this.personData.push(item2);
|
||||
}
|
||||
this.mergeData()
|
||||
} else {
|
||||
ToastUtil.showToast("未查询到数据!")
|
||||
this.mergeData()
|
||||
return
|
||||
}
|
||||
} else {
|
||||
ToastUtil.showToast("未查询到数据!")
|
||||
this.mergeData()
|
||||
return
|
||||
}
|
||||
})
|
||||
.catch((e: AxiosError) => {
|
||||
console.error(e.message)
|
||||
ToastUtil.showToast(e.message)
|
||||
this.mergeData()
|
||||
})
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
BaseTopBar({
|
||||
title: '处置对象'
|
||||
})
|
||||
|
||||
List() {
|
||||
ForEach(this.pageData, (item: HanoverItem) => {
|
||||
if (item.baseType == 1) {
|
||||
ListItem() {
|
||||
this.labelItem(item)
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
} else if (item.baseType == 2) {
|
||||
ListItem() {
|
||||
HandOverSelectCarItem({ item: item.carData })
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.onClick(() => {
|
||||
if (item.carData) {
|
||||
if (item.carData.isSelect) {
|
||||
item.carData.isSelect = false;
|
||||
this.selectCarId = ""
|
||||
} else {
|
||||
item.carData.isSelect = true;
|
||||
this.selectCarId = StringUtils.get(item.id,"")
|
||||
}
|
||||
}
|
||||
})
|
||||
} else if (item.baseType == 3) {
|
||||
ListItem() {
|
||||
HandOverSelectPersonItem({ item: item.personData })
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.onClick(() => {
|
||||
if (item.personData) {
|
||||
if (item.personData.isSelect) {
|
||||
item.personData.isSelect = false;
|
||||
this.selectPeronId.remove(item.id)
|
||||
} else {
|
||||
item.personData.isSelect = true;
|
||||
this.selectPeronId.add(item.id)
|
||||
}
|
||||
}
|
||||
})
|
||||
} else if (item.baseType == 4) {
|
||||
ListItem() {
|
||||
HandOverSelectGoodsItem({ item: item.goodsData })
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
}
|
||||
|
||||
}, (itme: HanoverItem) => itme.id)
|
||||
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.layoutWeight(1)
|
||||
|
||||
Row() {
|
||||
Image($r('app.media.ic_light'))
|
||||
.width($r('app.float.default_18'))
|
||||
.height($r('app.float.default_18'))
|
||||
|
||||
Text("物品默认全部选中")
|
||||
.fontColor($r('app.color.read'))
|
||||
.fontSize($r('app.float.text_size_12'))
|
||||
|
||||
}
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.align(Alignment.Start)
|
||||
.justifyContent(FlexAlign.Start)
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.padding({ left: $r('app.float.default_15'), right: $r('app.float.default_15') })
|
||||
|
||||
Button("下一步")
|
||||
.width('89%')
|
||||
.margin({ top: $r('app.float.default_8'), bottom: $r('app.float.default_22') })
|
||||
.onClick(() => {
|
||||
if((!this.selectPeronId||this.selectPeronId.length<1)&&StrUtil.isEmpty(this.selectCarId)){
|
||||
ToastUtil.showToast("请先选择移交对象!")
|
||||
return
|
||||
}
|
||||
let param : SkipHandOverSelectDeptParam = {
|
||||
carNumStatus: this.pageParam?.carNumStatus == undefined?0:this.pageParam?.carNumStatus,
|
||||
isCardPoint: this.pageParam?.isCardPoint,
|
||||
personIds:Array.from(this.selectPeronId),
|
||||
carId:this.selectCarId
|
||||
}
|
||||
router.pushUrl({url:"ui/pages/SelectDeptPages",params:param})
|
||||
})
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height(AppConstants.PERCENTAGE_MAX)
|
||||
.backgroundColor($r('app.color.page_background'))
|
||||
.overlay(createWaterMark())
|
||||
}
|
||||
|
||||
@Builder
|
||||
labelItem(item: HanoverItem) {
|
||||
Row() {
|
||||
Blank()
|
||||
.width($r('app.float.default_5'))
|
||||
.height($r('app.float.default_16'))
|
||||
.color($r('app.color.bull'))
|
||||
.border({ radius: $r('app.float.default_2') });
|
||||
|
||||
Text(item.baseMsg)
|
||||
.margin({ left: $r('app.float.default_8') })
|
||||
.fontColor($r('app.color.colorGrey7'))
|
||||
.fontSize($r('app.float.text_size_16'));
|
||||
|
||||
}
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.align(Alignment.Start)
|
||||
.justifyContent(FlexAlign.Start)
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height($r('app.float.default_36'))
|
||||
.padding({ left: $r('app.float.default_10'), right: $r('app.float.default_10') })
|
||||
.margin({ top: $r('app.float.default_10') })
|
||||
.backgroundColor($r('app.color.white'))
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,299 @@
|
|||
import AppConstants from "../../app/AppConstant";
|
||||
import { CardProtModel, SelectTaskModel } from "../../model/uiModel/SelectTask";
|
||||
import { cardRoundBorderStyle } from "../../style/BorderStyle";
|
||||
import { BaseTopBar } from "../../view/custom/BaseTopTar";
|
||||
import { createWaterMark } from "../../view/custom/Watermark";
|
||||
import { StringUtils } from "../../util/StringUtils";
|
||||
import { ToastUtils } from "../../util/ToasUtils";
|
||||
import { router } from "@kit.ArkUI";
|
||||
import { AppCache } from "../../app/AppCache";
|
||||
import { CardPortListItem } from "../../view/custom/CardPortListItem";
|
||||
import { SkipCheckPageModel } from "../../model/uiModel/PageParamModel";
|
||||
import { BasePageResult } from "../../model/uiModel/PageResultModel";
|
||||
import { LoadingDialog } from "../../view/dialog/LoadingDialog";
|
||||
import { getCardPointList, getTaskList } from "../../request/api/Api";
|
||||
import { AxiosError } from "@ohos/axios";
|
||||
import { DateUtil } from "@pura/harmony-utils";
|
||||
|
||||
/**
|
||||
* 选择任务和卡点的页面
|
||||
*/
|
||||
@Component
|
||||
@Entry
|
||||
@Preview
|
||||
export struct SelectTaskAndCardPortPages {
|
||||
@State text: string = "请选择"
|
||||
@State index: number = -1
|
||||
@State arrowPosition: ArrowPosition = ArrowPosition.END
|
||||
@State selectValue: Array<SelectTaskModel> = new Array<SelectTaskModel>();
|
||||
@State taskDescription: string | undefined = undefined
|
||||
@State cardPortArray: Array<CardProtModel> = new Array<CardProtModel>()
|
||||
selectTaskName: string | undefined = "";
|
||||
selectTaskId: string | undefined = "";
|
||||
selectCardName: string | undefined = "";
|
||||
selectCardId: string | undefined = "";
|
||||
cardPointAddress?: string
|
||||
cardPointPointX?: string
|
||||
cardPointPointY?: string
|
||||
@State loadDialogTips: string | Resource = $r('app.string.loading_hint')
|
||||
//加载弹框
|
||||
dialogController: CustomDialogController = new CustomDialogController({
|
||||
builder: LoadingDialog({
|
||||
loadingTips: this.loadDialogTips,
|
||||
})
|
||||
});
|
||||
|
||||
aboutToAppear(): void {
|
||||
|
||||
}
|
||||
|
||||
onPageShow(): void {
|
||||
this.getTaskListData();
|
||||
}
|
||||
|
||||
getTaskListData() {
|
||||
this.loadDialogTips = $r('app.string.loading_hint')
|
||||
this.dialogController.open()
|
||||
getTaskList("",1,DateUtil.getFormatDateStr(new Date()))
|
||||
.then((res) => {
|
||||
this.dialogController.close()
|
||||
console.debug(JSON.stringify(res))
|
||||
this.selectValue = new Array;
|
||||
let mode = new SelectTaskModel();
|
||||
mode.value = "请选择"
|
||||
mode.id = "-1"
|
||||
mode.description = "请先选择任务"
|
||||
this.selectValue.push(mode)
|
||||
if (res.code != 200) {
|
||||
ToastUtils.toastBottom(res.msg!)
|
||||
return
|
||||
}
|
||||
let dataList = res.rows;
|
||||
if (dataList == null || dataList.length < 1) {
|
||||
ToastUtils.toastBottom("暂无任务请联系管理员添加任务")
|
||||
return
|
||||
}
|
||||
dataList!.forEach(element => {
|
||||
let mode = new SelectTaskModel();
|
||||
mode.value = StringUtils.get(element.name, "");
|
||||
mode.id = StringUtils.get(element.id, "");
|
||||
mode.description = StringUtils.get(element.description, "");
|
||||
this.selectValue.push(mode)
|
||||
});
|
||||
ToastUtils.toastBottom("点击“请选择”选择任务")
|
||||
})
|
||||
.catch((e: AxiosError) => {
|
||||
this.dialogController.close()
|
||||
this.selectValue = new Array;
|
||||
let mode = new SelectTaskModel();
|
||||
mode.value = "请选择"
|
||||
mode.id = "-1"
|
||||
mode.description = "请先选择任务"
|
||||
ToastUtils.toastBottom(`获取任务失败:${e.message}`)
|
||||
})
|
||||
}
|
||||
|
||||
createCard() {
|
||||
this.loadDialogTips = $r('app.string.loading_hint')
|
||||
this.dialogController.open()
|
||||
getCardPointList(StringUtils.get(this.selectTaskId, ""))
|
||||
.then((res) => {
|
||||
this.dialogController.close()
|
||||
console.debug(JSON.stringify(res))
|
||||
this.cardPortArray = new Array<CardProtModel>()
|
||||
if (res.code != 200) {
|
||||
ToastUtils.toastBottom(StringUtils.get(res.msg, ""))
|
||||
return
|
||||
}
|
||||
let dateList = res.data;
|
||||
if (dateList) {
|
||||
dateList.forEach((item) => {
|
||||
let model = new CardProtModel();
|
||||
model.orgName = item.name
|
||||
model.id = item.id
|
||||
model.address = item.address
|
||||
model.pointX = item.pointX
|
||||
model.pointY = item.pointY
|
||||
this.cardPortArray.push(model)
|
||||
})
|
||||
} else {
|
||||
ToastUtils.toastBottom("未获取到卡点,请联系管理员添加卡点");
|
||||
}
|
||||
})
|
||||
.catch((e: AxiosError) => {
|
||||
this.dialogController.close()
|
||||
ToastUtils.toastBottom(`获取卡点失败:${e.message}`)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
BaseTopBar({
|
||||
title: "选择任务卡点",
|
||||
leftClickEvent: () => {
|
||||
}
|
||||
})
|
||||
|
||||
Text('选择任务')
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.width('95%')
|
||||
.textAlign(TextAlign.Start)
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.margin({ top: $r('app.float.default_10'), left: $r('app.float.default_10') })
|
||||
|
||||
Select(this.selectValue)
|
||||
.selected(this.index)
|
||||
.width('95%')
|
||||
.height($r('app.float.default_48'))
|
||||
.margin({
|
||||
left: $r('app.float.default_10'),
|
||||
right: $r('app.float.default_10'),
|
||||
top: $r('app.float.default_10')
|
||||
})
|
||||
.value(this.text)
|
||||
.border(cardRoundBorderStyle)
|
||||
.font({ size: 16, weight: 500 })
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.selectedOptionFont({ size: 16, weight: 400 })
|
||||
.optionFont({ size: 16, weight: 400 })
|
||||
.arrowPosition(this.arrowPosition)
|
||||
.menuAlign(MenuAlignType.CENTER, { dx: 0, dy: 0 })
|
||||
.optionWidth(OptionWidthMode.FIT_TRIGGER)
|
||||
.optionHeight($r('app.float.default_400'))
|
||||
.divider(null)
|
||||
.onSelect((index: number, text?: string | undefined) => {
|
||||
console.info('Select:' + index)
|
||||
if (index == 0) {
|
||||
return
|
||||
}
|
||||
this.taskDescription = this.selectValue[index].description;
|
||||
this.selectTaskId = this.selectValue[index].id
|
||||
this.selectTaskName = this.selectValue[index].value
|
||||
this.index = index;
|
||||
if (text) {
|
||||
this.text = text;
|
||||
}
|
||||
this.createCard()
|
||||
})
|
||||
|
||||
Row() {
|
||||
Text('要求:')
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
|
||||
Text(this.taskDescription)
|
||||
.layoutWeight(1)
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.visibility(StringUtils.isNullOrEmpty(this.taskDescription) ? Visibility.Hidden : Visibility.Visible)
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.padding({ left: $r('app.float.default_15'), right: $r('app.float.default_10') })
|
||||
.margin({ top: $r('app.float.default_10') })
|
||||
|
||||
Divider()
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height($r('app.float.default_1'))
|
||||
.backgroundColor($r('app.color.colorGrey3'))
|
||||
.margin({ top: $r('app.float.default_10') })
|
||||
|
||||
Text('选择执勤卡点')
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.width('95%')
|
||||
.textAlign(TextAlign.Start)
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.margin({ top: $r('app.float.default_10'), left: $r('app.float.default_10') })
|
||||
|
||||
Search({ placeholder: '输入卡点名称进行搜索' })
|
||||
.width('95%')
|
||||
.height($r('app.float.default_43'))
|
||||
.border(cardRoundBorderStyle)
|
||||
.margin({ top: $r('app.float.default_10') })
|
||||
.onChange((ver) => {
|
||||
|
||||
})
|
||||
|
||||
List() {
|
||||
ForEach(this.cardPortArray, (item: CardProtModel) => {
|
||||
ListItem() {
|
||||
CardPortListItem({
|
||||
item: item,
|
||||
onSelect: (item) => {
|
||||
this.selectCardId = item.id
|
||||
this.selectCardName = item.orgName
|
||||
this.cardPointAddress = item.address
|
||||
this.cardPointPointX = item.pointX
|
||||
this.cardPointPointY = item.pointY
|
||||
this.updateCardDataStatus(item);
|
||||
}
|
||||
})
|
||||
}
|
||||
}, (item: CardProtModel) => item.id)
|
||||
}
|
||||
.width('95%')
|
||||
// .divider({
|
||||
// strokeWidth: $r('app.float.default_1'),
|
||||
// color: $r('app.color.colorGrey2')
|
||||
// })
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.layoutWeight(1)
|
||||
.padding({ top: $r('app.float.default_10'), bottom: $r('app.float.default_10') })
|
||||
.border(cardRoundBorderStyle)
|
||||
.margin({
|
||||
top: $r('app.float.default_5'),
|
||||
left: $r('app.float.default_10'),
|
||||
right: $r('app.float.default_10'),
|
||||
bottom: $r('app.float.default_10')
|
||||
})
|
||||
|
||||
Button('开始盘查')
|
||||
.fontColor($r('app.color.white'))
|
||||
.width('95%')
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.backgroundColor($r('app.color.bull'))
|
||||
.onClick(() => {
|
||||
if (StringUtils.isNullOrEmpty(this.selectTaskName) || StringUtils.isNullOrEmpty(this.selectTaskId)) {
|
||||
ToastUtils.toastBottom("请先选择任务!")
|
||||
return
|
||||
}
|
||||
AppCache.getAppCache().setTaskName = this.selectTaskName;
|
||||
AppCache.getAppCache().setTaskId = this.selectTaskId;
|
||||
if (StringUtils.isNullOrEmpty(this.selectCardName) || StringUtils.isNullOrEmpty(this.selectCardId?.toString())) {
|
||||
ToastUtils.toastBottom("请选择卡点!")
|
||||
return
|
||||
}
|
||||
AppCache.getAppCache().setCardPointId = this.selectCardId;
|
||||
AppCache.getAppCache().setCardPointName = this.selectCardName;
|
||||
AppCache.getAppCache().setCardLocation(StringUtils.get(this.cardPointPointX, "0.0"),
|
||||
StringUtils.get(this.cardPointPointY, "0.0"), StringUtils.get(this.cardPointAddress, ""))
|
||||
|
||||
let skipModel: SkipCheckPageModel = new SkipCheckPageModel();
|
||||
skipModel.titleType = 2
|
||||
skipModel.taskId = this.selectTaskId
|
||||
skipModel.taskName = this.selectTaskName
|
||||
skipModel.cardPointName = this.selectCardName
|
||||
|
||||
let param: BasePageResult = {
|
||||
type: 1,
|
||||
what: 1,
|
||||
data: skipModel
|
||||
}
|
||||
router.replaceUrl({ url: 'ui/pages/StreetInspectionPages', params: param })
|
||||
})
|
||||
.margin({ bottom: $r('app.float.default_32') })
|
||||
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height(AppConstants.PERCENTAGE_MAX)
|
||||
.backgroundColor($r('app.color.page_background'))
|
||||
.overlay(createWaterMark())
|
||||
}
|
||||
|
||||
updateCardDataStatus(item: CardProtModel) {
|
||||
// 遍历所有项,只将当前选中的项设为true,其他设为false
|
||||
this.cardPortArray.forEach(selectedItem => {
|
||||
selectedItem.isSelect = (item.id === selectedItem.id);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,174 @@
|
|||
import { AxiosError } from "@ohos/axios";
|
||||
import { ToastUtil } from "@pura/harmony-utils";
|
||||
import AppConstants from "../../app/AppConstant";
|
||||
import { BasePageResult } from "../../model/uiModel/PageResultModel";
|
||||
import { SelectTaskObservedModel } from "../../model/uiModel/SelectTask";
|
||||
import { getTaskList } from "../../request/api/Api";
|
||||
import { cardRoundBorderGreyStyle } from "../../style/BorderStyle";
|
||||
import { StringUtils } from "../../util/StringUtils";
|
||||
import { ToastUtils } from "../../util/ToasUtils";
|
||||
import { BaseTopBar } from "../../view/custom/BaseTopTar";
|
||||
import { EmptyOrErrorItemView } from "../../view/custom/EmptyOrErrorItemView";
|
||||
import { SelectTaskListItem } from "../../view/custom/SelectTaskListItem";
|
||||
import { createWaterMark } from "../../view/custom/Watermark";
|
||||
import { LoadingDialog } from "../../view/dialog/LoadingDialog";
|
||||
import { router } from "@kit.ArkUI";
|
||||
|
||||
/**
|
||||
* 选择任务
|
||||
*/
|
||||
@Entry
|
||||
@Component
|
||||
export struct SelectTaskListPage {
|
||||
@State inputContent: string | undefined = undefined
|
||||
@State selectValue: Array<SelectTaskObservedModel> = new Array<SelectTaskObservedModel>();
|
||||
@State loadDialogTips: string | Resource = $r('app.string.loading_hint')
|
||||
private selectItem: SelectTaskObservedModel | undefined;
|
||||
//加载弹框
|
||||
dialogController: CustomDialogController = new CustomDialogController({
|
||||
builder: LoadingDialog({
|
||||
loadingTips: this.loadDialogTips,
|
||||
})
|
||||
});
|
||||
|
||||
aboutToAppear(): void {
|
||||
|
||||
}
|
||||
|
||||
onPageShow(): void {
|
||||
this.getTaskListData();
|
||||
}
|
||||
|
||||
getTaskListData() {
|
||||
this.loadDialogTips = $r('app.string.loading_hint')
|
||||
this.dialogController.open()
|
||||
getTaskList(StringUtils.get(this.inputContent,""), 1)
|
||||
.then((res) => {
|
||||
this.dialogController.close()
|
||||
console.debug(JSON.stringify(res))
|
||||
this.selectValue = new Array;
|
||||
if (res.code != 200) {
|
||||
this.handErrorOrEmPty(-1, StringUtils.get(res.msg, ""))
|
||||
return
|
||||
}
|
||||
let dataList = res.rows;
|
||||
if (dataList == null || dataList.length < 1) {
|
||||
this.handErrorOrEmPty(0, "暂无任务")
|
||||
return
|
||||
}
|
||||
dataList!.forEach(element => {
|
||||
let mode = new SelectTaskObservedModel();
|
||||
mode.taskName = StringUtils.get(element.name, "");
|
||||
mode.taskId = StringUtils.get(element.id, "");
|
||||
this.selectValue.push(mode)
|
||||
});
|
||||
})
|
||||
.catch((e: AxiosError) => {
|
||||
this.dialogController.close()
|
||||
this.handErrorOrEmPty(-1, `查询任务失败:${e.message}`)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 错误或空处理
|
||||
*/
|
||||
handErrorOrEmPty(type: number, msg: string) {
|
||||
ToastUtils.toastBottom(msg)
|
||||
let bean = new SelectTaskObservedModel()
|
||||
bean.baseType = type;
|
||||
bean.taskName = msg;
|
||||
this.selectValue = new Array<SelectTaskObservedModel>();
|
||||
this.selectValue.push(bean)
|
||||
}
|
||||
|
||||
submit() {
|
||||
if (!this.selectItem) {
|
||||
ToastUtil.showLong("请先选择任务")
|
||||
return
|
||||
}
|
||||
let param = new BasePageResult()
|
||||
param.type =1;
|
||||
param.data = this.selectItem
|
||||
router.back({url:"ui/pages/HistoryMainPage",params:param})
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
BaseTopBar({
|
||||
title: $r('app.string.title_select_task'),
|
||||
})
|
||||
|
||||
TextInput({ text: this.inputContent, placeholder: "请输入任务名称进行搜索" })
|
||||
.placeholderColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.margin({
|
||||
left: $r('app.float.default_10'),
|
||||
right: $r('app.float.default_10'),
|
||||
top: $r('app.float.default_10')
|
||||
})
|
||||
.padding({
|
||||
left: $r('app.float.default_5'),
|
||||
right: $r('app.float.default_5'),
|
||||
})
|
||||
.onChange((text: string) => {
|
||||
this.inputContent = text;
|
||||
})
|
||||
.height($r('app.float.default_40'))
|
||||
.width('96%')
|
||||
.textAlign(TextAlign.Start)
|
||||
.border(cardRoundBorderGreyStyle)
|
||||
.enterKeyType(EnterKeyType.Search)// 设置为搜索按钮
|
||||
.onSubmit((enterKey: EnterKeyType, event: SubmitEvent) => {
|
||||
// 点击搜索按钮时触发
|
||||
this.getTaskListData()
|
||||
});
|
||||
|
||||
List() {
|
||||
ForEach(this.selectValue, (item: SelectTaskObservedModel, index: number) => {
|
||||
if (item.baseType == 0 || item.baseType == -1) {
|
||||
EmptyOrErrorItemView({ type: item.baseType, msg: item.taskName })
|
||||
} else {
|
||||
SelectTaskListItem({
|
||||
item: item,
|
||||
onSelect: (item: SelectTaskObservedModel) => {
|
||||
this.selectItem = item;
|
||||
this.updateCardDataStatus(item)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.layoutWeight(1)
|
||||
|
||||
Button("完成", { type: ButtonType.Normal, stateEffect: true })
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.fontColor($r('app.color.white'))
|
||||
.backgroundColor($r('app.color.bull'))
|
||||
.borderRadius(8)
|
||||
.margin({
|
||||
left: $r('app.float.default_10'),
|
||||
right: $r('app.float.default_10'),
|
||||
bottom: $r('app.float.default_28'),
|
||||
})
|
||||
.onClick(() => {
|
||||
this.submit();
|
||||
})
|
||||
.width('95%');
|
||||
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height(AppConstants.PERCENTAGE_MAX)
|
||||
.backgroundColor($r('app.color.page_background'))
|
||||
.overlay(createWaterMark())
|
||||
}
|
||||
|
||||
|
||||
updateCardDataStatus(item: SelectTaskObservedModel) {
|
||||
// 遍历所有项,只将当前选中的项设为true,其他设为false
|
||||
this.selectValue.forEach(selectedItem => {
|
||||
selectedItem.isSelect = (item.taskId === selectedItem.taskId);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,424 @@
|
|||
import { camera, cameraPicker as picker } from '@kit.CameraKit'
|
||||
|
||||
import { faceDetector } from '@kit.CoreVisionKit';
|
||||
import { image } from '@kit.ImageKit';
|
||||
import { hilog } from '@kit.PerformanceAnalysisKit';
|
||||
import { BusinessError } from '@kit.BasicServicesKit';
|
||||
import { fileIo, fileUri } from '@kit.CoreFileKit';
|
||||
import { ToastUtils } from '../../util/ToasUtils';
|
||||
import { BaseTopBar } from '../../view/custom/BaseTopTar';
|
||||
import { createWaterMark } from '../../view/custom/Watermark';
|
||||
import { PixelMapUtils } from '../../util/PixelMapUtils';
|
||||
import { comparisonFace } from '../../request/api/Api';
|
||||
import { FileUtils } from '../../util/FileUtils';
|
||||
import { FaceItem, PeopleFaceRequestModel } from '../../model/uiModel/PeopleFaceRequestModel';
|
||||
import { ComparisonFaceDialog } from '../../view/dialog/ComparisonFaceDialog';
|
||||
import AppConstants from '../../app/AppConstant';
|
||||
import { StringUtils } from '../../util/StringUtils';
|
||||
import { BasePageResult } from '../../model/uiModel/PageResultModel';
|
||||
import { router } from '@kit.ArkUI';
|
||||
|
||||
/**
|
||||
* 静态人像
|
||||
*/
|
||||
@Component
|
||||
@Entry
|
||||
export struct StaticPortraitPage {
|
||||
@State imageFileUri: string | undefined = undefined;
|
||||
@State chooseImage: PixelMap | undefined = undefined;
|
||||
@State faceArray: Array<PixelMap> = new Array()
|
||||
@State resultData: Array<FaceItem> = new Array()
|
||||
@State loadDialogTips: string | Resource = $r('app.string.loading_detection_face')
|
||||
|
||||
dialogController?:CustomDialogController
|
||||
//结果状态 1 = 识别人脸成功,展示识别结果, 2 = 比对成功展示比对结果
|
||||
@State resultStatus :number= 0;
|
||||
|
||||
aboutToAppear(): void {
|
||||
this.takePhoto();
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示提醒框
|
||||
* @param imageFileUri
|
||||
*/
|
||||
showComparisonDialog(imageFileUri: string|image.PixelMap){
|
||||
this.dialogController = new CustomDialogController({
|
||||
builder: ComparisonFaceDialog({
|
||||
loadingTips: this.loadDialogTips,
|
||||
photoPath: imageFileUri
|
||||
}),
|
||||
customStyle:true,
|
||||
autoCancel: false, // 关键参数
|
||||
backgroundColor:Color.Transparent,
|
||||
// maskColor: 0x00000000, // 关键参数:透明遮罩
|
||||
alignment: DialogAlignment.Center
|
||||
});
|
||||
this.dialogController.open()
|
||||
}
|
||||
|
||||
/**
|
||||
* 拍照
|
||||
*/
|
||||
async takePhoto() {
|
||||
let pathDir = FileUtils.IMAGE_DIR
|
||||
let fileName = `${new Date().getTime()}.JPEG`
|
||||
let filePath = `${pathDir}/${fileName}`
|
||||
fileIo.createRandomAccessFileSync(filePath, fileIo.OpenMode.CREATE);
|
||||
|
||||
let fileUris = fileUri.getUriFromPath(filePath);
|
||||
let pickerProfile: picker.PickerProfile = {
|
||||
cameraPosition: camera.CameraPosition.CAMERA_POSITION_BACK,
|
||||
saveUri: fileUris
|
||||
};
|
||||
this.resultStatus = 0;
|
||||
let result: picker.PickerResult =
|
||||
await picker.pick(getContext(), [picker.PickerMediaType.PHOTO, picker.PickerMediaType.VIDEO],
|
||||
pickerProfile);
|
||||
console.info(`picker resultCode: ${result.resultCode},resultUri: ${result.resultUri},mediaType: ${result.mediaType}`);
|
||||
if (result.resultCode == 0) {
|
||||
if (result.mediaType === picker.PickerMediaType.PHOTO) {
|
||||
this.faceArray =[]
|
||||
this.resultStatus = 1;
|
||||
this.imageFileUri = result.resultUri
|
||||
this.createPixelMap()
|
||||
.then((res) => {
|
||||
this.detectionFace(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async createPixelMap(): Promise<PixelMap> {
|
||||
let imageSource: image.ImageSource | undefined = undefined;
|
||||
let fileSource = await fileIo.open(this.imageFileUri!, fileIo.OpenMode.READ_ONLY);
|
||||
imageSource = image.createImageSource(fileSource.fd);
|
||||
return await imageSource.createPixelMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测人脸
|
||||
* @param chooseImage
|
||||
*/
|
||||
detectionFace(chooseImage: PixelMap) {
|
||||
this.loadDialogTips = $r('app.string.loading_detection_face')
|
||||
this.showComparisonDialog(this.imageFileUri!)
|
||||
faceDetector.init();
|
||||
let visionInfo: faceDetector.VisionInfo = {
|
||||
pixelMap: chooseImage!
|
||||
};
|
||||
|
||||
// Call the face detection API.
|
||||
faceDetector.detect(visionInfo)
|
||||
.then(async (data: faceDetector.Face[]) => {
|
||||
this.dialogController?.close()
|
||||
if (data.length === 0) {
|
||||
hilog.error(0x0000, 'faceDetectorSample', '未检测到人脸');
|
||||
ToastUtils.toastCenter("未检测到人脸!")
|
||||
// this.dataValues = "No face is detected in the image. Select an image that contains a face.";
|
||||
} else {
|
||||
let faceString = JSON.stringify(data);
|
||||
hilog.info(0x0000, 'faceDetectorSample', "faceString data is " + faceString);
|
||||
// this.dataValues = faceString;
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
let sbl = data[i].probability;
|
||||
if (sbl > 0.7) {
|
||||
let rect = data[i].rect;
|
||||
let dcjChooseImage = await this.createPixelMap();
|
||||
await this.cropImage(dcjChooseImage, rect.left, rect.top, rect.width, rect.height)
|
||||
}
|
||||
}
|
||||
if (this.faceArray.length < 1) {
|
||||
ToastUtils.toastBottom("未捕获到人脸,请重新拍摄!")
|
||||
return
|
||||
}
|
||||
if (this.faceArray.length == 1) {
|
||||
this.compareFaces(this.faceArray[0]);
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((error: BusinessError) => {
|
||||
this.dialogController?.close()
|
||||
hilog.error(0x0000, 'faceDetectorSample',
|
||||
`Face detection failed. Code: ${error.code}, message: ${error.message}`);
|
||||
ToastUtils.toastCenter("未检测到人脸!")
|
||||
// this.dataValues = `Error: ${error.message}`;
|
||||
});
|
||||
faceDetector.release();
|
||||
}
|
||||
|
||||
/**
|
||||
* 裁剪人脸
|
||||
* @param chooseImage
|
||||
* @param x
|
||||
* @param y
|
||||
* @param w
|
||||
* @param h
|
||||
*/
|
||||
async cropImage(chooseImage: PixelMap, x: number, y: number, w: number, h: number) {
|
||||
await chooseImage?.crop({
|
||||
x: x,
|
||||
y: y,
|
||||
size: {
|
||||
height: h,
|
||||
width: w,
|
||||
}
|
||||
}).then(() => {
|
||||
this.faceArray.push(chooseImage)
|
||||
})
|
||||
.catch((error: Error) => {
|
||||
hilog.error(0x0000, 'faceDetectorSample', `Face detection failed. message: ${error.message}`);
|
||||
ToastUtils.toastCenter("裁剪失败!")
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 比对人脸
|
||||
* @param pixelMap
|
||||
*/
|
||||
async compareFaces(pixelMap: image.PixelMap) {
|
||||
this.loadDialogTips = $r('app.string.loading_comparison_face')
|
||||
this.showComparisonDialog(pixelMap)
|
||||
let base64 = await PixelMapUtils.pixelMapToBase64(pixelMap);
|
||||
|
||||
let param:PeopleFaceRequestModel = {
|
||||
listLibIds: '1618379821036',
|
||||
start: '1',
|
||||
size: '9',
|
||||
similarityMin: '0.9',
|
||||
picBase64: base64,
|
||||
}
|
||||
|
||||
comparisonFace(param)
|
||||
.then((values) => {
|
||||
this.resultStatus = 2;
|
||||
this.dialogController?.close()
|
||||
console.warn('请求结果:', JSON.stringify(values));
|
||||
if (values.code == 0) {
|
||||
let data = values.data;
|
||||
if (data) {
|
||||
let list = data.list;
|
||||
if (list&&list.length>0) {
|
||||
this.resultStatus = 2
|
||||
this.resultData = list;
|
||||
}else {
|
||||
ToastUtils.toastBottom(`未比中人脸!`)
|
||||
}
|
||||
}else {
|
||||
ToastUtils.toastBottom(`未比中人脸!`)
|
||||
}
|
||||
}else {
|
||||
ToastUtils.toastBottom(`比对失败!${values.msg}`)
|
||||
}
|
||||
})
|
||||
.catch((error: Error) => {
|
||||
this.dialogController?.close()
|
||||
console.warn('请求结果:', JSON.stringify(error));
|
||||
ToastUtils.toastBottom(`比对失败!${error.message}`)
|
||||
})
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
BaseTopBar({
|
||||
title: "静态人像",
|
||||
rightText: "重新拍摄",
|
||||
rightClickEvent: () => {
|
||||
this.takePhoto();
|
||||
}
|
||||
})
|
||||
Stack({ alignContent:Alignment.TopStart }) {
|
||||
Image(this.imageFileUri)
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.opacity(0.15)
|
||||
|
||||
Column() {
|
||||
Text('请点击需要比对的人脸')
|
||||
.width('100%')
|
||||
.fontColor($r('app.color.colorRed9'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.margin({ top: $r('app.float.default_68') })
|
||||
.visibility(this.resultStatus == 1? Visibility.Visible:Visibility.None)
|
||||
.textAlign(TextAlign.Center)
|
||||
if (this.resultStatus == 1) {
|
||||
List() {
|
||||
ForEach(this.faceArray, (item: PixelMap) => {
|
||||
ListItem() {
|
||||
Image(item)
|
||||
.width('100%')
|
||||
.height($r('app.float.default_120'))
|
||||
.border({
|
||||
width: $r('app.float.default_1'),
|
||||
color: $r('app.color.grad')
|
||||
})
|
||||
.margin({ top: $r('app.float.default_10') })
|
||||
.onClick(() => {
|
||||
this.compareFaces(item);
|
||||
})
|
||||
}
|
||||
})
|
||||
} .width('100%')
|
||||
.friction(0.6)
|
||||
.margin({ top: $r('app.float.default_20') })
|
||||
.lanes({ minLength: 80, maxLength: 80 })
|
||||
.alignListItem(ListItemAlign.Center)
|
||||
.visibility(this.resultStatus == 1? Visibility.Visible:Visibility.None)
|
||||
.scrollBar(BarState.Off)
|
||||
}
|
||||
if (this.resultStatus == 2) {
|
||||
List(){
|
||||
if (this.resultData.length > 0) {
|
||||
ListItem() {
|
||||
this.resultOne(this.resultData[0])
|
||||
}
|
||||
.onClick(()=>{
|
||||
let param = new BasePageResult();
|
||||
param.type = 7;
|
||||
param.data = this.resultData[0]
|
||||
router.back({url:'ui/pages/StreetInspectionPages',params:param})
|
||||
})
|
||||
}
|
||||
|
||||
ForEach(this.getPairedData(), (item: FaceItem[],index:number) => {
|
||||
ListItem() {
|
||||
Row(){
|
||||
this.resultOthers(item[0])
|
||||
|
||||
if (item.length>1) {
|
||||
this.resultOthers(item[1])
|
||||
} else {
|
||||
// 空白占位符保持布局整齐
|
||||
Blank()
|
||||
.width('46%')
|
||||
.margin({ left: $r('app.float.default_8'), right: $r('app.float.default_8') })
|
||||
}
|
||||
}
|
||||
.width('100%')
|
||||
.justifyContent(FlexAlign.SpaceBetween)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
.width('100%')
|
||||
.margin({ top: $r('app.float.default_10') })
|
||||
.alignListItem(ListItemAlign.Center)
|
||||
.visibility(this.resultStatus == 2? Visibility.Visible:Visibility.None)
|
||||
.scrollBar(BarState.Off)
|
||||
}
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.justifyContent(FlexAlign.Start)
|
||||
}
|
||||
.width('100%')
|
||||
.layoutWeight(1)
|
||||
}
|
||||
.backgroundColor($r('app.color.page_background'))
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.overlay(createWaterMark())
|
||||
}
|
||||
|
||||
@Builder
|
||||
resultOne(item: FaceItem){
|
||||
Stack({ alignContent: Alignment.TopStart }) {
|
||||
Column(){
|
||||
Image(item.facePicUrl.replace("http://53.1.243.135:30080/components", "http://20.90.2.2/st_idcard_img_out"))
|
||||
.width($r('app.float.default_100'))
|
||||
.height($r('app.float.default_130'))
|
||||
.border({
|
||||
width: $r('app.float.default_1'),
|
||||
color: $r('app.color.grad')
|
||||
})
|
||||
.margin({ top: $r('app.float.default_10') })
|
||||
|
||||
Text(item.credentialsNum)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.margin({ top: $r('app.float.default_15') ,bottom: $r('app.float.default_10')})
|
||||
|
||||
Text(StringUtils.convertToPercentage(item.similarity))
|
||||
.fontColor($r('app.color.colorYellow8'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.fontWeight(FontWeight.Bold)
|
||||
}
|
||||
.padding({top: $r('app.float.default_10'),bottom: $r('app.float.default_10')})
|
||||
.width('98%')
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.margin({ left: $r('app.float.default_2'), top: $r('app.float.default_2') })
|
||||
.border({
|
||||
width:$r('app.float.default_1'),
|
||||
color:$r('app.color.white'),
|
||||
radius:$r('app.float.default_3')
|
||||
})
|
||||
|
||||
Row(){
|
||||
Image($r('app.media.icon_max_sbl'))
|
||||
.width('90vp')
|
||||
.height('30vp')
|
||||
}
|
||||
.alignItems(VerticalAlign.Top)
|
||||
.justifyContent(FlexAlign.Start)
|
||||
|
||||
}
|
||||
.width('95%')
|
||||
|
||||
}
|
||||
|
||||
//其他
|
||||
@Builder
|
||||
resultOthers(item: FaceItem) {
|
||||
Column(){
|
||||
Image(item.facePicUrl.replace("http://53.1.243.135:30080/components", "http://20.90.2.2/st_idcard_img_out"))
|
||||
.width($r('app.float.default_100'))
|
||||
.height($r('app.float.default_130'))
|
||||
.border({
|
||||
width: $r('app.float.default_1'),
|
||||
color: $r('app.color.grad')
|
||||
})
|
||||
.margin({ top: $r('app.float.default_10') })
|
||||
|
||||
Text(item.credentialsNum)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.margin({ top: $r('app.float.default_15') ,bottom: $r('app.float.default_10')})
|
||||
|
||||
Text(StringUtils.convertToPercentage(item.similarity))
|
||||
.fontColor($r('app.color.colorYellow8'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.fontWeight(FontWeight.Bold)
|
||||
}
|
||||
.width('46%')
|
||||
.padding({top: $r('app.float.default_10'),bottom: $r('app.float.default_10')})
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
.backgroundColor($r('app.color.white'))
|
||||
.margin({ left: $r('app.float.default_8'), right: $r('app.float.default_8'), top: $r('app.float.default_10') })
|
||||
.border({
|
||||
width:$r('app.float.default_1'),
|
||||
color:$r('app.color.white'),
|
||||
radius:$r('app.float.default_3')
|
||||
})
|
||||
.onClick(()=>{
|
||||
let param =new BasePageResult();
|
||||
param.type = 7;
|
||||
param.data = item
|
||||
router.back({url:'ui/pages/StreetInspectionPages',params:param})
|
||||
})
|
||||
}
|
||||
// 在 StaticPortraitPage 组件中添加辅助方法
|
||||
private getPairedData(): FaceItem[][] {
|
||||
const result: FaceItem[][] = [];
|
||||
for (let i = 1; i < this.resultData.length; i += 2) {
|
||||
const pair: FaceItem[] = [this.resultData[i]];
|
||||
if (i + 1 < this.resultData.length) {
|
||||
pair.push(this.resultData[i + 1]);
|
||||
}
|
||||
result.push(pair);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,10 @@
|
|||
import { ArrayList } from "@kit.ArkTS";
|
||||
|
||||
export class ArrayListUtils {
|
||||
static contain<T>(dataList: ArrayList<T>, data: T): boolean {
|
||||
return dataList.has(data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
import { buffer } from '@kit.ArkTS';
|
||||
import { fileIo } from '@kit.CoreFileKit';
|
||||
import { hilog } from '@kit.PerformanceAnalysisKit';
|
||||
import { image } from '@kit.ImageKit';
|
||||
|
||||
export class BitMapUtils{
|
||||
|
||||
static async writeFile(data: string, filesDir :string,fileName:string): Promise<string> {
|
||||
let fileAbsolutelyPath =""
|
||||
try {
|
||||
let filePath = filesDir+"/" + fileName;
|
||||
// uri = fileUri.getUriFromPath(filePath);
|
||||
fileAbsolutelyPath = filePath
|
||||
let file = fileIo.openSync(filePath, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE);
|
||||
console.info("file fd: " + file.fd);
|
||||
const reg = new RegExp("data:image/\\w+;base64,")
|
||||
const base64 = data.replace(reg, "");
|
||||
console.log("base64flag", base64)
|
||||
const dataBuffer = buffer.from(base64, 'base64')
|
||||
let writeLen = fileIo.writeSync(file.fd, dataBuffer.buffer);
|
||||
hilog.info(0xA0c0d0,'文件长度',writeLen+"")
|
||||
fileIo.closeSync(file);
|
||||
} catch (Error) {
|
||||
hilog.error(0xA0c0d0,'Error',Error.code)
|
||||
}
|
||||
return fileAbsolutelyPath;
|
||||
}
|
||||
|
||||
static async copyPixelMap(pm: image.PixelMap): Promise<image.PixelMap> {
|
||||
const imageInfo: image.ImageInfo = await pm.getImageInfo();
|
||||
const buffer: ArrayBuffer = new ArrayBuffer(pm.getPixelBytesNumber());
|
||||
// TODO 知识点:通过readPixelsToBuffer实现PixelMap的深拷贝,其中readPixelsToBuffer输出为BGRA_8888
|
||||
await pm.readPixelsToBuffer(buffer);
|
||||
// TODO 知识点:readPixelsToBuffer输出为BGRA_8888,此处createPixelMap需转为RGBA_8888
|
||||
const opts: image.InitializationOptions = {
|
||||
editable: true,
|
||||
pixelFormat: image.PixelMapFormat.RGBA_F16,
|
||||
size: { height: imageInfo.size.height, width: imageInfo.size.width }
|
||||
};
|
||||
return await image.createPixelMap(buffer, opts);
|
||||
}
|
||||
|
||||
}
|
||||
// data为需要转换的base64字符串,返回沙箱路径uri
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { util } from '@kit.ArkTS';
|
||||
|
||||
export function bufferToString(buffer: ArrayBufferLike): string {
|
||||
let textDecoder = util.TextDecoder.create('utf-8', {
|
||||
ignoreBOM: true
|
||||
});
|
||||
let result = textDecoder.decodeToString(new Uint8Array(buffer), {
|
||||
stream: true
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
export class Constant{
|
||||
public static REFRESH_PULL_TO_REFRESH : string = "下拉可以刷新";
|
||||
public static REFRESH_FREE_TO_REFRESH :string = "释放立即刷新"
|
||||
public static REFRESH_REFRESHING :string ="正在刷新";
|
||||
public static REFRESH_SUCCESS :string="刷新成功"
|
||||
}
|
||||
|
|
@ -0,0 +1,380 @@
|
|||
export enum DateFormat {
|
||||
//'yyyy-mm-dd'
|
||||
YYYYhMMhDD,
|
||||
//'yyyy-mm-dd HH:mm:ss'
|
||||
YYYYhMMhDDkHHdMMdSS,
|
||||
//'yyyy-mm-dd HH:mm:ss.sss'
|
||||
YYYYhMMhDDkHHdMMdSSdSSS,
|
||||
//yyyy/mm/dd
|
||||
YYYYxMMxDD,
|
||||
//yyyy/mm/dd HH:mm:ss
|
||||
YYYYxMMxDDkHHdMMdSS,
|
||||
//yyyy/mm/dd HH:mm:ss.sss
|
||||
YYYYxMMxDDkHHdMMdSSdSSS,
|
||||
//yyyy年mm月dd
|
||||
YYYYnMMyDDr,
|
||||
//yyyy年mm月dd日 HH:mm:ss
|
||||
YYYYnMMyDDrkHHdMMdSS,
|
||||
//yyyy年mm月dd日 HH:mm:ss.sss
|
||||
YYYYnMMyDDrkHHdMMdSSdSSS,
|
||||
}
|
||||
|
||||
export class DateUtils {
|
||||
static formatDateStr(nowData: Date | undefined | null, format: DateFormat | undefined | null): string {
|
||||
if (nowData == null || nowData == undefined) {
|
||||
nowData = new Date();
|
||||
}
|
||||
//年
|
||||
let year = nowData.getFullYear()
|
||||
//月
|
||||
let month = ("0" + (nowData.getMonth() + 1)).slice(-2); // 月份是从0开始计数的,所以需要加1
|
||||
//日
|
||||
let day = ("0" + nowData.getDate()).slice(-2); // 为了保证始终是两位数,不足两位前面补0
|
||||
//时
|
||||
let hours = nowData.getHours()>9?nowData.getHours():`0${nowData.getHours()}`;
|
||||
//分
|
||||
let minutes = nowData.getMinutes()>9?nowData.getMinutes():`0${nowData.getMinutes()}`;
|
||||
//秒
|
||||
let seconds = nowData.getSeconds()>9?nowData.getSeconds():`0${nowData.getSeconds()}`;
|
||||
//毫秒
|
||||
let milliSeconds = nowData.getMilliseconds();
|
||||
if (format == null || format == undefined) {
|
||||
format = DateFormat.YYYYhMMhDDkHHdMMdSS
|
||||
}
|
||||
if (format == DateFormat.YYYYhMMhDD) {
|
||||
return year + "-" + month + "-" + day
|
||||
}
|
||||
if (format == DateFormat.YYYYhMMhDDkHHdMMdSS) {
|
||||
return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds
|
||||
}
|
||||
if (format == DateFormat.YYYYhMMhDDkHHdMMdSSdSSS) {
|
||||
return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds + "." + milliSeconds
|
||||
}
|
||||
if (format == DateFormat.YYYYxMMxDD) {
|
||||
return year + "/" + month + "/" + day
|
||||
}
|
||||
if (format == DateFormat.YYYYxMMxDDkHHdMMdSS) {
|
||||
return year + "/" + month + "/" + day + " " + hours + ":" + minutes + ":" + seconds
|
||||
}
|
||||
if (format == DateFormat.YYYYxMMxDDkHHdMMdSSdSSS) {
|
||||
return year + "/" + month + "/" + day + " " + hours + ":" + minutes + ":" + seconds + "." + milliSeconds
|
||||
}
|
||||
if (format == DateFormat.YYYYnMMyDDr) {
|
||||
return year + "年" + month + "月" + day + "日"
|
||||
}
|
||||
if (format == DateFormat.YYYYnMMyDDrkHHdMMdSS) {
|
||||
return year + "年" + month + "月" + day + "日 " + hours + ":" + minutes + ":" + seconds
|
||||
}
|
||||
if (format == DateFormat.YYYYnMMyDDrkHHdMMdSSdSSS) {
|
||||
return year + "年" + month + "月" + day + "日 " + hours + ":" + minutes + ":" + seconds + "." + milliSeconds
|
||||
}
|
||||
return year + "-" + month + "-" + day
|
||||
}
|
||||
|
||||
static pastStrDate(strDate: string | null): Date | null {
|
||||
if (strDate == null) {
|
||||
return null;
|
||||
}
|
||||
let formatting = strDate.trim()
|
||||
// .replaceAll(' ', '')
|
||||
// .replace(' ', '')
|
||||
// .replaceAll('-', "")
|
||||
// .replace('-', "")
|
||||
// .replaceAll('.', "")
|
||||
// .replace('.', "")
|
||||
// .replaceAll('/', "")
|
||||
// .replace('/', "")
|
||||
// .replace('年', "")
|
||||
// .replace('月', "")
|
||||
// .replace('日', "")
|
||||
// .replaceAll(':', "")
|
||||
// .replace(':', "")
|
||||
// .replaceAll('—', "")
|
||||
// .replace('—', "")
|
||||
// .replaceAll(':', "")
|
||||
// .replace(':', "")
|
||||
// .replaceAll('。', "")
|
||||
// .replace('。', "")
|
||||
// .trim()
|
||||
|
||||
let f = new Array();
|
||||
for (let i = 0; i < formatting.length; i++) {
|
||||
let s = formatting.charAt(i);
|
||||
if (!this.isNum(s)) {
|
||||
f.push(s)
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < f.length; i++) {
|
||||
formatting = formatting.replace(f[i], "")
|
||||
}
|
||||
|
||||
switch (formatting.length) {
|
||||
case 4:
|
||||
return new Date(formatting)
|
||||
case 6: //202306
|
||||
let y = formatting.substring(0, 4)
|
||||
let m = formatting.substring(4, 6)
|
||||
return new Date(y + "-" + m)
|
||||
case 8: //20230612
|
||||
y = formatting.substring(0, 4)
|
||||
m = formatting.substring(4, 6)
|
||||
let d = formatting.substring(6, 8)
|
||||
return new Date(y + "-" + m + "-" + d)
|
||||
case 10: //2023061211
|
||||
y = formatting.substring(0, 4)
|
||||
m = formatting.substring(4, 6)
|
||||
d = formatting.substring(6, 8)
|
||||
let h = formatting.substring(8, 10)
|
||||
return new Date(y + "-" + m + "-" + d + " " + h)
|
||||
case 12: //2023061211
|
||||
y = formatting.substring(0, 4)
|
||||
m = formatting.substring(4, 6)
|
||||
d = formatting.substring(6, 8)
|
||||
h = formatting.substring(8, 10)
|
||||
let f = formatting.substring(10, 12)
|
||||
return new Date(y + "-" + m + "-" + d + " " + h + ":" + f)
|
||||
case 14: //20230612101533
|
||||
y = formatting.substring(0, 4)
|
||||
m = formatting.substring(4, 6)
|
||||
d = formatting.substring(6, 8)
|
||||
h = formatting.substring(8, 10)
|
||||
f = formatting.substring(10, 12)
|
||||
let ms = formatting.substring(12, 14)
|
||||
return new Date(y + "-" + m + "-" + d + " " + h + ":" + f + ":" + ms)
|
||||
case 17: //20230612101533333
|
||||
y = formatting.substring(0, 4)
|
||||
m = formatting.substring(4, 6)
|
||||
d = formatting.substring(6, 8)
|
||||
h = formatting.substring(8, 10)
|
||||
f = formatting.substring(10, 12)
|
||||
ms = formatting.substring(12, 14)
|
||||
let hms = formatting.substring(14, 17)
|
||||
return new Date(y + "-" + m + "-" + d + " " + h + ":" + f + ":" + ms + '.' + hms)
|
||||
default :
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将 "M/D/YY, h:mm A" 时间格式字符 转换成 "yyyy-MM-dd HH:mm:ss"
|
||||
* @param dateStr 8/12/25, 3:23 PM
|
||||
* @returns 2025-08-12 15:23:00
|
||||
*/
|
||||
static formatMdyHmA(dateStr: string): string {
|
||||
if (dateStr == null||dateStr == undefined ||dateStr.toString().trim().length<1) {
|
||||
return "";
|
||||
}
|
||||
// 解析原始时间字符串
|
||||
const [datePart, timePart] = dateStr.split(", ");
|
||||
const [month, day, year] = datePart.split("/").map(Number);
|
||||
const [time, period] = timePart.split(" ");
|
||||
const [hoursStr, minutesStr] = time.split(":");
|
||||
let hours = parseInt(hoursStr, 10);
|
||||
const minutes = parseInt(minutesStr, 10);
|
||||
|
||||
// 处理 AM/PM
|
||||
if (period === "PM" && hours < 12) hours += 12;
|
||||
if (period === "AM" && hours === 12) hours = 0;
|
||||
|
||||
// 补零操作
|
||||
const pad = (num: number) => num.toString().padStart(2, "0");
|
||||
return "yyyy-MM-dd HH:mm:ss"
|
||||
.replace("yyyy", `${2000 + year}`) // 假设年份简写为后两位(如25表示2025)
|
||||
.replace("MM", pad(month))
|
||||
.replace("dd", pad(day))
|
||||
.replace("HH", pad(hours))
|
||||
.replace("mm", pad(minutes))
|
||||
.replace("ss", "00"); // 秒数未提供,默认补零
|
||||
}
|
||||
|
||||
/**
|
||||
* 数字验证
|
||||
*
|
||||
* @param val 需要验证的字符串
|
||||
*/
|
||||
public static isNum(val: string): boolean {
|
||||
const reg = new RegExp('^[0-9]*$');
|
||||
return val != null && "" != (val) && reg.test(val);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取日期字符
|
||||
* @param nowData 日期
|
||||
* @returns yyyy-MM-dd
|
||||
*/
|
||||
static getNowDats(nowData: Date | null): string {
|
||||
if (!nowData) {
|
||||
nowData = new Date();
|
||||
}
|
||||
let year = nowData.getFullYear()
|
||||
let month = ("0" + (nowData.getMonth() + 1)).slice(-2); // 月份是从0开始计数的,所以需要加1
|
||||
let day = ("0" + nowData.getDate()).slice(-2); // 为了保证始终是两位数,不足两位前面补0
|
||||
return year + "-" + month + "-" + day
|
||||
}
|
||||
|
||||
/**
|
||||
* 当获取指定日期工作周的第一天
|
||||
* @param nowData
|
||||
* @returns yyyy-MM-dd
|
||||
*/
|
||||
static getWeekFirstDay(nowData: Date | null): string {
|
||||
if (!nowData) {
|
||||
nowData = new Date();
|
||||
}
|
||||
const currentDay = nowData.getDay(); // 0(星期日)到 6(星期六)
|
||||
let firstDay = new Date()
|
||||
firstDay.setDate(nowData.getDate() - currentDay + 1)
|
||||
|
||||
return firstDay.getFullYear() + "-" + ("0" + (firstDay.getMonth() + 1)).slice(-2) + "-" +
|
||||
("0" + firstDay.getDate()).slice(-2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 当获取指定日期工作周的最后一天时间
|
||||
* @param nowData
|
||||
* @returns yyyy-MM-dd
|
||||
*/
|
||||
static getWeekLastDay(nowData: Date | null): string {
|
||||
if (!nowData) {
|
||||
nowData = new Date();
|
||||
}
|
||||
const currentDay = nowData.getDay(); // 0(星期日)到 6(星期六)
|
||||
let lastDay = new Date()
|
||||
lastDay.setDate(nowData.getDate() + (6 - currentDay + 1))
|
||||
|
||||
return lastDay.getFullYear() + "-" + ("0" + (lastDay.getMonth() + 1)).slice(-2) + "-" +
|
||||
("0" + lastDay.getDate()).slice(-2);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定日期所在月份的最后一天
|
||||
* @param nowData
|
||||
* @returns yyyy-MM-dd
|
||||
*/
|
||||
static getLastDayOfMonth(nowData: Date | null): string {
|
||||
if (!nowData) {
|
||||
nowData = new Date();
|
||||
}
|
||||
let year = nowData.getFullYear(); // 获取当前年份
|
||||
let month = nowData.getMonth(); // 获取当前月份(从0开始)
|
||||
// 创建一个表示当前月份最后一天的Date对象
|
||||
let lastDayOfMonth = new Date(year, month + 1, 0);
|
||||
return lastDayOfMonth.getFullYear() + "-" + ("0" + (lastDayOfMonth.getMonth() + 1)).slice(-2) + "-" +
|
||||
("0" + lastDayOfMonth.getDate()).slice(-2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前日期是第几周
|
||||
* @param dateTime 当前传入的日期值
|
||||
* @returns 返回第几周数字值
|
||||
*/
|
||||
static getWeek(dateTime: Date): number {
|
||||
const temptTime = new Date(dateTime);
|
||||
const weekday = temptTime.getDay() || 7; // 周几 (0-6,0代表星期天)
|
||||
|
||||
// 调整日期到上周一
|
||||
temptTime.setDate(temptTime.getDate() - weekday + 1);
|
||||
const firstDay = new Date(temptTime.getFullYear(), 0, 1);
|
||||
|
||||
// 获取第一周的第一天
|
||||
const dayOfWeek = firstDay.getDay();
|
||||
const spendDay = dayOfWeek === 0 ? 7 : 7 - dayOfWeek + 1;
|
||||
|
||||
// 计算周数
|
||||
const startOfYear = new Date(temptTime.getFullYear(), 0, 1 + spendDay);
|
||||
const days = Math.ceil((temptTime.getTime() - startOfYear.getTime()) / 86400000);
|
||||
return Math.ceil(days / 7);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将时间转换为 `几秒前`、`几分钟前`、`几小时前`、`几天前`
|
||||
* @param param 当前时间,new Date() 格式或者字符串时间格式
|
||||
* @param format 需要转换的时间格式字符串
|
||||
* @returns 返回拼接后的时间字符串
|
||||
*/
|
||||
static formatPast(param: string | Date, format: string = 'YYYY-mm-dd'): string {
|
||||
const time = new Date().getTime();
|
||||
let t = typeof param === 'string' || param instanceof Date ? new Date(param).getTime() : param;
|
||||
const diff = time - t;
|
||||
|
||||
if (diff < 10000) {
|
||||
return '刚刚';
|
||||
} // 10秒内
|
||||
if (diff < 60000) {
|
||||
return `${Math.floor(diff / 1000)}秒前`;
|
||||
} // 少于1分钟
|
||||
if (diff < 3600000) {
|
||||
return `${Math.floor(diff / 60000)}分钟前`;
|
||||
} // 少于1小时
|
||||
if (diff < 86400000) {
|
||||
return `${Math.floor(diff / 3600000)}小时前`;
|
||||
} // 少于24小时
|
||||
if (diff < 259200000) {
|
||||
return `${Math.floor(diff / 86400000)}天前`;
|
||||
} // 少于3天
|
||||
|
||||
return DateUtils.formatDate(new Date(param), format); // 超过3天
|
||||
}
|
||||
|
||||
/**
|
||||
* 时间日期转换
|
||||
* @param date 当前时间,new Date() 格式
|
||||
* @param format 需要转换的时间格式字符串
|
||||
* @returns 返回拼接后的时间字符串
|
||||
*/
|
||||
static formatDate(date: Date, format: string): string {
|
||||
const week: { [key: string]: string } = {
|
||||
'0': '日',
|
||||
'1': '一',
|
||||
'2': '二',
|
||||
'3': '三',
|
||||
'4': '四',
|
||||
'5': '五',
|
||||
'6': '六',
|
||||
};
|
||||
const quarter: { [key: string]: string } = {
|
||||
'1': '一',
|
||||
'2': '二',
|
||||
'3': '三',
|
||||
'4': '四'
|
||||
};
|
||||
|
||||
const we = date.getDay(); // 星期
|
||||
const z = DateUtils.getWeek(date); // 周
|
||||
const qut = Math.floor((date.getMonth() + 3) / 3).toString(); // 季度
|
||||
|
||||
const opt: { [key: string]: string } = {
|
||||
'Y+': date.getFullYear().toString(),
|
||||
'm+': (date.getMonth() + 1).toString(),
|
||||
'd+': date.getDate().toString(),
|
||||
'H+': date.getHours().toString(),
|
||||
'M+': date.getMinutes().toString(),
|
||||
'S+': date.getSeconds().toString(),
|
||||
'q+': quarter[qut], // 季度
|
||||
};
|
||||
|
||||
// 处理格式中的特殊标记
|
||||
format = format.replace(/(W+)/, (match) => match.length > 1 ? `周${week[we]}` : week[we]);
|
||||
format = format.replace(/(Q+)/, (match) => match.length === 4 ? `第${quarter[qut]}季度` : quarter[qut]);
|
||||
format = format.replace(/(Z+)/, (match) => match.length === 3 ? `第${z}周` : `${z}`);
|
||||
|
||||
// 替换日期格式中的部分
|
||||
Object.keys(opt).forEach((key) => {
|
||||
const reg = new RegExp(`(${key})`);
|
||||
format = format.replace(reg, (match) => match.length === 1 ? opt[key] : opt[key].padStart(match.length, '0'));
|
||||
});
|
||||
|
||||
return format;
|
||||
}
|
||||
|
||||
/**
|
||||
* 补零操作
|
||||
* @param num
|
||||
* @returns
|
||||
*/
|
||||
public static padZero(num: number): string {
|
||||
return num.toString().padStart(2, "0");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
import { FileUtil } from "@pura/harmony-utils";
|
||||
|
||||
export class FileUtils {
|
||||
public static ROOT_DIR: string
|
||||
public static ID_CARD_DIR: string
|
||||
public static FILE_DIR: string
|
||||
public static IMAGE_DIR: string
|
||||
public static LOG_DIR: string
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化应用路径
|
||||
* @param uiContext
|
||||
*/
|
||||
public static init(context: Context) {
|
||||
if (context) {
|
||||
FileUtils.ROOT_DIR = context.filesDir;
|
||||
FileUtils.ID_CARD_DIR = context.filesDir + "/IdCardPhoto";
|
||||
FileUtils.FILE_DIR = context.filesDir + "/File";
|
||||
FileUtils.IMAGE_DIR = context.filesDir + "/Image";
|
||||
FileUtils.LOG_DIR = context.filesDir + "/Log";
|
||||
}
|
||||
}
|
||||
|
||||
public static createFileDir() {
|
||||
if (!FileUtil.accessSync(FileUtils.ID_CARD_DIR)) {
|
||||
FileUtil.mkdirSync(FileUtils.ID_CARD_DIR)
|
||||
}
|
||||
if (!FileUtil.accessSync(FileUtils.FILE_DIR)) {
|
||||
FileUtil.mkdirSync(FileUtils.FILE_DIR)
|
||||
}
|
||||
if (!FileUtil.accessSync(FileUtils.IMAGE_DIR)) {
|
||||
FileUtil.mkdirSync(FileUtils.IMAGE_DIR)
|
||||
}
|
||||
if (!FileUtil.accessSync(FileUtils.LOG_DIR)) {
|
||||
FileUtil.mkdirSync(FileUtils.LOG_DIR)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
import { StringUtils } from "./StringUtils";
|
||||
|
||||
export class IdCardNumUtils {
|
||||
/**
|
||||
* 验证身份证号
|
||||
* @param idCardNum 身份证号
|
||||
* @returns true or false
|
||||
*/
|
||||
public static validateIdCardNum(idCardNum: string): boolean {
|
||||
if (idCardNum == null) {
|
||||
return false;
|
||||
}
|
||||
let idCardNumS = idCardNum.trim();
|
||||
if (idCardNumS.length != 18) {
|
||||
return false;
|
||||
}
|
||||
if (!IdCardNumUtils.checkCode(idCardNumS)) {
|
||||
return false
|
||||
}
|
||||
const date = idCardNumS.substring(6, 14)
|
||||
if (!IdCardNumUtils.checkDate(date)) {
|
||||
return false
|
||||
}
|
||||
if (IdCardNumUtils.checkProv(idCardNumS.substring(0, 2))) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数字验证
|
||||
*
|
||||
* @param val 需要验证的字符串
|
||||
*/
|
||||
public static isNum(val: string): boolean {
|
||||
const reg = new RegExp('^[0-9]*$');
|
||||
return val != null && "" != (val) && reg.test(val);
|
||||
}
|
||||
|
||||
// 省份
|
||||
public static checkProv(val: string) {
|
||||
const pattern = /^[1-9][0-9]/
|
||||
const provs: Record<number, string> = {
|
||||
11: '北京',
|
||||
12: '天津',
|
||||
13: '河北',
|
||||
14: '山西',
|
||||
15: '内蒙古',
|
||||
21: '辽宁',
|
||||
22: '吉林',
|
||||
23: '黑龙江 ',
|
||||
31: '上海',
|
||||
32: '江苏',
|
||||
33: '浙江',
|
||||
34: '安徽',
|
||||
35: '福建',
|
||||
36: '江西',
|
||||
37: '山东',
|
||||
41: '河南',
|
||||
42: '湖北 ',
|
||||
43: '湖南',
|
||||
44: '广东',
|
||||
45: '广西',
|
||||
46: '海南',
|
||||
50: '重庆',
|
||||
51: '四川',
|
||||
52: '贵州',
|
||||
53: '云南',
|
||||
54: '西藏 ',
|
||||
61: '陕西',
|
||||
62: '甘肃',
|
||||
63: '青海',
|
||||
64: '宁夏',
|
||||
65: '新疆',
|
||||
71: '台湾',
|
||||
81: '香港',
|
||||
82: '澳门'
|
||||
}
|
||||
if (pattern.test(val)) {
|
||||
if (provs[val]) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// 出生日期
|
||||
private static checkDate(val: string) {
|
||||
const pattern =
|
||||
/^(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)$/
|
||||
if (pattern.test(val)) {
|
||||
const year = val.substring(0, 4)
|
||||
const month = val.substring(4, 6)
|
||||
const date = val.substring(6, 8)
|
||||
const date2 = new Date(year + '-' + month + '-' + date)
|
||||
if (date2 && date2.getMonth() === parseInt(month) - 1) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// 校验码校验
|
||||
private static checkCode(val: string) {
|
||||
const p =
|
||||
/^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/
|
||||
const factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]
|
||||
const parity = [1, 0, 'X', 9, 8, 7, 6, 5, 4, 3, 2]
|
||||
const code = val.substring(17)
|
||||
if (p.test(val)) {
|
||||
let sum = 0
|
||||
for (let i = 0; i < 17; i++) {
|
||||
sum += Number(val.charAt(i)) * factor[i]
|
||||
}
|
||||
if (parity[sum % 11].toString() === code.toUpperCase()) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static isCarNumberNO(carNumber: string): boolean {
|
||||
if (StringUtils.isNullOrEmpty(carNumber)) {
|
||||
return false;
|
||||
}
|
||||
//两车同用
|
||||
const carTreg =
|
||||
/^([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[a-zA-Z](([ADF]((?![IO])[a-zA-Z0-9](?![IO]))[0-9]{4})|([0-9]{5}[ADF]))|[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1})$/
|
||||
return carTreg.test(carNumber);
|
||||
}
|
||||
|
||||
//简称
|
||||
public static isJc(cph: string): boolean {
|
||||
if (StringUtils.isNullOrEmpty(cph)) {
|
||||
return false;
|
||||
}
|
||||
const ss = /^[A-Z]$/;
|
||||
return ss.test(cph);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
import { util } from "@kit.ArkTS";
|
||||
import { StrUtil } from "@pura/harmony-utils/src/main/ets/utils/StrUtil";
|
||||
import { systemTime } from "@kit.BasicServicesKit";
|
||||
|
||||
export class IdGeneratedUtils {
|
||||
private static idGeneratedUtils = new IdGeneratedUtils("");
|
||||
private static idCardNum: string = "";
|
||||
|
||||
private constructor(idCardNum: string) {
|
||||
IdGeneratedUtils.idCardNum = idCardNum
|
||||
}
|
||||
|
||||
public static getInstance(idCardNum: string): IdGeneratedUtils {
|
||||
if (IdGeneratedUtils.idGeneratedUtils == null || IdGeneratedUtils.idCardNum !== idCardNum) {
|
||||
IdGeneratedUtils.idGeneratedUtils = new IdGeneratedUtils(idCardNum)
|
||||
}
|
||||
return IdGeneratedUtils.idGeneratedUtils;
|
||||
}
|
||||
|
||||
public generatedRandomID(): string {
|
||||
let uuid = util.generateRandomUUID(false).replaceAll("-", "").replaceAll("-", "");
|
||||
if (StrUtil.isNotEmpty(IdGeneratedUtils.idCardNum)) {
|
||||
let start = IdGeneratedUtils.idCardNum.substring(0, IdGeneratedUtils.idCardNum.length - 1);
|
||||
let end = IdGeneratedUtils.idCardNum.substring(IdGeneratedUtils.idCardNum.length - 1);
|
||||
let startStr = parseInt(start).toString(16).toUpperCase()
|
||||
return startStr + end + uuid + (this.getRandomInt(1,1000) + 1000);
|
||||
}else {
|
||||
return Date.now()+uuid+ (this.getRandomInt(1,1000) + 1000);
|
||||
}
|
||||
}
|
||||
|
||||
// 生成指定范围的随机整数
|
||||
getRandomInt(min: number, max: number): number {
|
||||
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
import image from '@ohos.multimedia.image';
|
||||
import fileio from '@ohos.fileio';
|
||||
import buffer from '@ohos.buffer';
|
||||
|
||||
export class PixelMapUtils {
|
||||
static async pixelMapToBase64(pixelMap: image.PixelMap): Promise<string> {
|
||||
// 1. 创建图像打包器
|
||||
const imagePacker = image.createImagePacker();
|
||||
|
||||
// 2. 设置打包选项 (PNG格式)
|
||||
const packOpts: image.PackingOption = {
|
||||
format: "image/png",
|
||||
quality: 100 // 最高质量
|
||||
};
|
||||
|
||||
// 3. 打包到内存缓冲区
|
||||
const arrayBuffer = await imagePacker.packing(pixelMap, packOpts);
|
||||
|
||||
// 4. 转换为Base64
|
||||
const base64Data = buffer.from(arrayBuffer).toString('base64');
|
||||
|
||||
// 5. 添加Data URL前缀
|
||||
return base64Data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
import { StringUtils } from "./StringUtils"
|
||||
|
||||
|
||||
export const getPersonStatusIcon = (peopleStatus: string | undefined) => {
|
||||
if (peopleStatus == null || peopleStatus == undefined) {
|
||||
return $r("app.media.ic_type_normal");
|
||||
}
|
||||
if (peopleStatus.startsWith("涉稳")) {
|
||||
return $r("app.media.ic_type_stability")
|
||||
}
|
||||
if (peopleStatus.startsWith("涉恐")) {
|
||||
return $r("app.media.ic_type_fear")
|
||||
}
|
||||
if (peopleStatus.startsWith("关注")) {
|
||||
return $r("app.media.ic_type_focus")
|
||||
}
|
||||
if (peopleStatus.startsWith("云控")) {
|
||||
return $r("app.media.ic_type_control")
|
||||
}
|
||||
if (StringUtils.containsChar(peopleStatus, "精神")) {
|
||||
return $r("app.media.ic_type_fine")
|
||||
}
|
||||
if (peopleStatus.startsWith("非访")) {
|
||||
return $r("app.media.ic_type_non")
|
||||
}
|
||||
if (peopleStatus.startsWith("前科")) {
|
||||
return $r("app.media.ic_type_criminal_record")
|
||||
}
|
||||
if (StringUtils.containsChar(peopleStatus, "毒")) {
|
||||
return $r("app.media.ic_type_poison")
|
||||
}
|
||||
if (StringUtils.containsChar(peopleStatus, "临")) {
|
||||
return $r("app.media.ic_type_control")
|
||||
}
|
||||
if (StringUtils.containsChar(peopleStatus, "逃")) {
|
||||
return $r("app.media.ic_type_escape")
|
||||
}
|
||||
return $r("app.media.ic_type_normal");
|
||||
}
|
||||
|
||||
export const getCarStatusIcon = (carStatus: string) => {
|
||||
if (StringUtils.isNullOrEmpty(carStatus)) {
|
||||
return $r("app.media.ic_type_normal");
|
||||
}
|
||||
if (StringUtils.containsChar(carStatus, "被盗枪")) {
|
||||
return $r("app.media.ic_type_bdq")
|
||||
}
|
||||
if (carStatus.startsWith("关注")) {
|
||||
return $r("app.media.ic_type_focus")
|
||||
}
|
||||
if (carStatus.startsWith("云控")) {
|
||||
return $r("app.media.ic_type_control")
|
||||
}
|
||||
if (StringUtils.containsChar(carStatus, "临")) {
|
||||
return $r("app.media.ic_type_control")
|
||||
}
|
||||
return $r("app.media.ic_type_normal");
|
||||
}
|
||||
|
||||
export const getGoodsStatusIcon = (goodsName: string) => {
|
||||
if (StringUtils.containsChar(goodsName, "车牌")) {
|
||||
return $r('app.media.log_tp')
|
||||
}
|
||||
if (StringUtils.containsChar(goodsName, "枪")) {
|
||||
return $r('app.media.log_qz')
|
||||
}
|
||||
if (StringUtils.containsChar(goodsName, "炸药") || StringUtils.containsChar(goodsName, "雷管")) {
|
||||
return $r('app.media.log_zylg')
|
||||
}
|
||||
if (StringUtils.containsChar(goodsName, "烟火")) {
|
||||
return $r('app.media.log_yhbz')
|
||||
}
|
||||
if (StringUtils.containsChar(goodsName, "危化物品")) {
|
||||
return $r('app.media.log_whwp')
|
||||
}
|
||||
return $r('app.media.icon_qtwp')
|
||||
}
|
||||
|
||||
|
||||
export const getCheckTypeIcon = (checkTypeStr: string) => {
|
||||
if (StringUtils.containsChar(checkTypeStr, "NFC")) {
|
||||
return $r('app.media.ic_nfc')
|
||||
}
|
||||
if (StringUtils.containsChar(checkTypeStr, "OCR")) {
|
||||
return $r('app.media.ic_ocr')
|
||||
}
|
||||
if (StringUtils.containsChar(checkTypeStr, "人像")) {
|
||||
return $r('app.media.ic_face')
|
||||
}
|
||||
if (StringUtils.containsChar(checkTypeStr, "语音")) {
|
||||
return $r('app.media.ic_voice')
|
||||
}
|
||||
if (StringUtils.containsChar(checkTypeStr, "拍照")) {
|
||||
return $r('app.media.icon_checkcar_pz')
|
||||
}
|
||||
return $r('app.media.ic_keyboard')
|
||||
}
|
||||
|
|
@ -0,0 +1,224 @@
|
|||
import { resourceManager } from "@kit.LocalizationKit";
|
||||
|
||||
export class StringUtils {
|
||||
/**
|
||||
* 获取字符串, 如果为空则返回默认值, 如果非空则返回该值并拼接endStr到末尾
|
||||
* @param value 要获取的字符串
|
||||
* @param defValue 默认值
|
||||
* @param endStr 要拼接的字符串
|
||||
* @returns value+endStr || defValue
|
||||
*/
|
||||
static get(value: string | Object | undefined | null, defValue: string, endStr?: string): string {
|
||||
if (StringUtils.isNullOrEmpty(value)) {
|
||||
return defValue;
|
||||
}
|
||||
if (endStr) {
|
||||
return String(value) + endStr;
|
||||
}
|
||||
return String(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断值是否为空
|
||||
* @param value
|
||||
* @returns
|
||||
*/
|
||||
static isNullOrEmpty(value: string | Object | undefined | null): boolean {
|
||||
return value == null || value == undefined || value.toString().trim().length < 1;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param str 待查找源字符串
|
||||
* @param char 待匹配的目标
|
||||
* @returns true 表示包含 false 表示不包含
|
||||
*/
|
||||
static containsChar(str: string, char: string): boolean {
|
||||
//当 str 内含有 char 则返回 char所在位置索引 即 返回值大与 -1
|
||||
return str.indexOf(char) > -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 去除JSON字符串 转义字符
|
||||
* @param value 需要转译的字符
|
||||
* @return 转译后的JSON格式数据
|
||||
*/
|
||||
public static toJsonParaphrase(value: string): string {
|
||||
if (value == null || value.length < 1) {
|
||||
return "";
|
||||
}
|
||||
let isJx = true;
|
||||
while (isJx) {
|
||||
//去除 \\
|
||||
if (StringUtils.containsChar(value, "\\\\")) {
|
||||
value = value.replace("\\\\", "").replaceAll("\\\\", "");
|
||||
}
|
||||
isJx = StringUtils.containsChar(value, "\\\\");
|
||||
}
|
||||
isJx = true;
|
||||
while (isJx) {
|
||||
//转 \" 替换为 "
|
||||
if (StringUtils.containsChar(value, "\\\"")) {
|
||||
value = value.replace("\\\"", "\"").replaceAll("\\\"", "\"");
|
||||
}
|
||||
isJx = StringUtils.containsChar(value, "\\\"");
|
||||
}
|
||||
isJx = true;
|
||||
while (isJx) {
|
||||
//转 "{ 替换为 {
|
||||
if (StringUtils.containsChar(value, "\"{")) {
|
||||
value = value.replace("\"{", "{").replaceAll("\"{", "{");
|
||||
}
|
||||
isJx = StringUtils.containsChar(value, "\"{");
|
||||
}
|
||||
isJx = true;
|
||||
while (isJx) {
|
||||
//转 }" 替换为 }
|
||||
if (StringUtils.containsChar(value, "}\"")) {
|
||||
value = value.replace("}\"", "}").replaceAll("}\"", "}");
|
||||
}
|
||||
isJx = StringUtils.containsChar(value, "}\"");
|
||||
}
|
||||
isJx = true;
|
||||
while (isJx) {
|
||||
//转 "[ 替换为 [
|
||||
if (StringUtils.containsChar(value, "\"[")) {
|
||||
value = value.replace("\"[", "[").replaceAll("\"[", "[");
|
||||
}
|
||||
isJx = StringUtils.containsChar(value, "\"[");
|
||||
}
|
||||
isJx = true;
|
||||
while (isJx) {
|
||||
//转 ]" 替换为 ]
|
||||
if (StringUtils.containsChar(value, "]\"")) {
|
||||
value = value.replace("]\"", "]").replaceAll("]\"", "]");
|
||||
}
|
||||
isJx = StringUtils.containsChar(value, "]\"");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成指定范围内的随机数
|
||||
* @param min 最小数(包含)
|
||||
* @param max 最大数(不包含)
|
||||
* @return 随机数
|
||||
*/
|
||||
public static randomNumber(min: number, max: number): number {
|
||||
return Math.floor(Math.random() * (max - min) + min);
|
||||
}
|
||||
|
||||
|
||||
public static getResourceString(context: Context, resource: Resource): string {
|
||||
let resourceString: string = '';
|
||||
try {
|
||||
resourceString = context.resourceManager.getStringSync(resource.id);
|
||||
} catch (error) {
|
||||
console.error('getResourceString err:' + JSON.stringify(error));
|
||||
}
|
||||
return resourceString;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将小数转换为百分比
|
||||
* @param decimalString 0.521
|
||||
* @returns 52.10%
|
||||
*/
|
||||
public static convertToPercentage(decimalString: string): string {
|
||||
// 将字符串转换为数字
|
||||
const decimalNumber = parseFloat(decimalString);
|
||||
|
||||
// 转换为百分比并保留两位小数
|
||||
const percentage = (decimalNumber * 100).toFixed(2);
|
||||
|
||||
// 添加百分号
|
||||
return `${percentage}%`;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转译身份证号
|
||||
*/
|
||||
public static translationIdCardNum(value: string): string {
|
||||
if (StringUtils.isNullOrEmpty(value)) {
|
||||
return "";
|
||||
}
|
||||
return value
|
||||
.replaceAll("一", "1")
|
||||
.replaceAll("义", "1")
|
||||
.replaceAll("二", "2")
|
||||
.replaceAll("三", "3")
|
||||
.replaceAll("四", "4")
|
||||
.replaceAll("是", "4")
|
||||
.replaceAll("五", "5")
|
||||
.replaceAll("六", "6")
|
||||
.replaceAll("七", "7")
|
||||
.replaceAll("八", "8")
|
||||
.replaceAll("吧", "8")
|
||||
.replaceAll("九", "9")
|
||||
.replaceAll("十", "10")
|
||||
.replaceAll("零", "0")
|
||||
.replaceAll("壹", "1")
|
||||
.replaceAll("贰", "2")
|
||||
.replaceAll("叁", "3")
|
||||
.replaceAll("肆", "4")
|
||||
.replaceAll("伍", "5")
|
||||
.replaceAll("陆", "6")
|
||||
.replaceAll("柒", "7")
|
||||
.replaceAll("捌", "8")
|
||||
.replaceAll("玖", "9")
|
||||
.replaceAll("拾", "10")
|
||||
.replaceAll("领", "0")
|
||||
.replaceAll("零", "0")
|
||||
.replaceAll("腰", "1")
|
||||
.replaceAll("妖", "1")
|
||||
.replaceAll("幺", "1")
|
||||
.replaceAll("腰", "1")
|
||||
.replaceAll("叉", "X")
|
||||
.replaceAll("×", "X")
|
||||
.toUpperCase()
|
||||
}
|
||||
|
||||
/**
|
||||
* 转译车牌号码
|
||||
*/
|
||||
public static translationCarNum(value: string): string {
|
||||
if (StringUtils.isNullOrEmpty(value)) {
|
||||
return "";
|
||||
}
|
||||
return value
|
||||
.replaceAll("一", "1")
|
||||
.replaceAll("义", "1")
|
||||
.replaceAll("二", "2")
|
||||
.replaceAll("三", "3")
|
||||
.replaceAll("四", "4")
|
||||
.replaceAll("是", "4")
|
||||
.replaceAll("五", "5")
|
||||
.replaceAll("六", "6")
|
||||
.replaceAll("七", "7")
|
||||
.replaceAll("八", "8")
|
||||
.replaceAll("吧", "8")
|
||||
.replaceAll("九", "9")
|
||||
.replaceAll("十", "10")
|
||||
.replaceAll("零", "0")
|
||||
.replaceAll("壹", "1")
|
||||
.replaceAll("贰", "2")
|
||||
.replaceAll("叁", "3")
|
||||
.replaceAll("肆", "4")
|
||||
.replaceAll("伍", "5")
|
||||
.replaceAll("陆", "6")
|
||||
.replaceAll("柒", "7")
|
||||
.replaceAll("捌", "8")
|
||||
.replaceAll("玖", "9")
|
||||
.replaceAll("拾", "10")
|
||||
.replaceAll("领", "0")
|
||||
.replaceAll("零", "0")
|
||||
.replaceAll("腰", "1")
|
||||
.replaceAll("妖", "1")
|
||||
.replaceAll("幺", "1")
|
||||
.replaceAll("腰", "1")
|
||||
.replaceAll("埃克斯", "X")
|
||||
.replaceAll("叉", "X")
|
||||
.replaceAll("×", "X")
|
||||
.toUpperCase()
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
import { promptAction } from "@kit.ArkUI";
|
||||
|
||||
export class ToastUtils{
|
||||
|
||||
public static toastCenter(msg:string|Resource){
|
||||
promptAction.showToast({
|
||||
message: msg,
|
||||
duration: 1200,
|
||||
alignment:Alignment.Center
|
||||
})
|
||||
}
|
||||
public static toastBottom(msg:string|Resource){
|
||||
promptAction.showToast({
|
||||
message: msg,
|
||||
duration: 1200,
|
||||
bottom: 100
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
import vibrator from "@ohos.vibrator"
|
||||
export class VibratorUtils{
|
||||
|
||||
static startVibrator(){
|
||||
vibrator.startVibration({type:"time",duration:1000},{usage:'alarm'})
|
||||
.then(()=>{
|
||||
console.warn("开始震动成功!")
|
||||
})
|
||||
.catch((error:Error)=>{
|
||||
console.error("开始震动失败:"+JSON.stringify(error))
|
||||
})
|
||||
}
|
||||
|
||||
static stopVibrator(){
|
||||
vibrator.stopVibration()
|
||||
.then(()=>{
|
||||
console.warn("停止震动成功!")
|
||||
})
|
||||
.catch((error:Error)=>{
|
||||
console.error("停止震动失败:"+JSON.stringify(error))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
import { router } from "@kit.ArkUI"
|
||||
import AppConstants from "../../app/AppConstant"
|
||||
import { StringUtils } from "../../util/StringUtils"
|
||||
|
||||
@Component
|
||||
export struct BaseTopBar{
|
||||
@State title:string|Resource=''
|
||||
// @State subtitle:string|null=null
|
||||
@State leftText:string|null=null
|
||||
@State leftImage:Resource = $r('app.media.icon_back3')
|
||||
|
||||
@State rightText:string|Resource|null=null
|
||||
@State rightImage:Resource |null =null
|
||||
|
||||
//回退
|
||||
leftClickEvent?:()=>void
|
||||
//右边按钮
|
||||
rightClickEvent?:()=>void
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
Row(){
|
||||
Image(this.leftImage)
|
||||
.width($r('app.float.default_24'))
|
||||
.height($r('app.float.default_24'))
|
||||
|
||||
Text(this.leftText)
|
||||
.fontColor($r('app.color.white'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.visibility(StringUtils.isNullOrEmpty(this.leftText)?Visibility.None:Visibility.Visible)
|
||||
}
|
||||
.height(AppConstants.PERCENTAGE_MAX)
|
||||
.width($r('app.float.default_68'))
|
||||
.alignItems(VerticalAlign.Bottom)
|
||||
.padding({ left:$r('app.float.default_10') })
|
||||
.onTouch((event) => {
|
||||
if (event.type === TouchType.Down) {
|
||||
this.leftImage = $r('app.media.icon_back2');
|
||||
} else if (event.type === TouchType.Up) {
|
||||
this.leftImage = $r('app.media.icon_back3');
|
||||
}
|
||||
})
|
||||
.onClick(() => {
|
||||
if (this.leftClickEvent) {
|
||||
this.leftClickEvent()
|
||||
}
|
||||
router.back()
|
||||
})
|
||||
|
||||
Text(this.title)
|
||||
.fontColor($r('app.color.white'))
|
||||
.fontSize($r('app.float.text_size_18'))
|
||||
.layoutWeight(1)
|
||||
.textAlign(TextAlign.Center)
|
||||
.margin({ bottom: $r('app.float.default_2'), left: $r('app.float.default_10') ,right: $r('app.float.default_10') })
|
||||
|
||||
Row(){
|
||||
Image(this.rightImage)
|
||||
.width($r('app.float.default_24'))
|
||||
.height($r('app.float.default_24'))
|
||||
.visibility(this.rightImage == null?Visibility.None:Visibility.Visible)
|
||||
|
||||
Text(this.rightText)
|
||||
.fontColor($r('app.color.white'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.visibility(StringUtils.isNullOrEmpty(this.rightText)?Visibility.None:Visibility.Visible)
|
||||
|
||||
}
|
||||
.alignItems(VerticalAlign.Bottom)
|
||||
.height(AppConstants.PERCENTAGE_MAX)
|
||||
.width($r('app.float.default_68'))
|
||||
.padding({ right: $r('app.float.default_10') })
|
||||
.onClick(() => {
|
||||
if (this.rightClickEvent) {
|
||||
this.rightClickEvent()
|
||||
}
|
||||
})
|
||||
}
|
||||
.alignItems(VerticalAlign.Bottom)
|
||||
.padding({ bottom: 10 })
|
||||
.width('100%')
|
||||
.backgroundColor($r('app.color.bull'))
|
||||
.height($r('app.float.default_88'))
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
import AppConstants from "../../app/AppConstant";
|
||||
import { CardProtModel } from "../../model/uiModel/SelectTask";
|
||||
|
||||
//64855357
|
||||
|
||||
@Component
|
||||
export struct CardPortListItem {
|
||||
@ObjectLink item: CardProtModel;
|
||||
onSelect?: (item: CardProtModel) => void
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
Text(this.item.orgName)
|
||||
.layoutWeight(1)
|
||||
.fontColor(this.item.isSelect ? $r('app.color.colorBluen8') : $r('app.color.colorGrey7'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.onClick(() => {
|
||||
// 点击文本时触发选择
|
||||
if (this.onSelect) {
|
||||
this.onSelect(this.item)
|
||||
}
|
||||
})
|
||||
|
||||
Radio({
|
||||
value: 'Radio1', group: 'radioGroup',
|
||||
indicatorType: RadioIndicatorType.TICK
|
||||
})
|
||||
.checked(this.item.isSelect)
|
||||
.height($r('app.float.default_20'))
|
||||
.width($r('app.float.default_20'))
|
||||
.onChange((isChecked: boolean) => {
|
||||
// 只有选中时才触发选择事件,实现单选
|
||||
if (isChecked && this.onSelect) {
|
||||
this.onSelect(this.item)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.padding({
|
||||
left: $r('app.float.default_10'),
|
||||
right: $r('app.float.default_10'),
|
||||
top: $r('app.float.default_6'),
|
||||
bottom: $r('app.float.default_6')
|
||||
})
|
||||
// 添加按压效果提升用户体验
|
||||
.useEffect(true)
|
||||
.backgroundColor(this.item.isSelect
|
||||
? $r('app.color.colorBluen1')
|
||||
: Color.Transparent)
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
import AppConstants from "../../app/AppConstant"
|
||||
|
||||
/**
|
||||
* 空数据或者错误Item
|
||||
*/
|
||||
@Component
|
||||
export struct EmptyOrErrorItemView {
|
||||
@State type: number= 0
|
||||
@State msg: string= "暂无数据"
|
||||
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Image(this.type == 0 ? $r('app.media.icon_empty') : $r('app.media.icon_error2'))
|
||||
.width($r('app.float.default_80'))
|
||||
.height($r('app.float.default_80'))
|
||||
|
||||
Text(this.msg)
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.textAlign(TextAlign.Center)
|
||||
.margin({ top: $r('app.float.default_10') })
|
||||
|
||||
}
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.height(AppConstants.PERCENTAGE_MAX)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
import AppConstants from "../../app/AppConstant";
|
||||
import { CarItemBean } from "../../model/uiModel/HandOverModel";
|
||||
import { getCarStatusIcon } from "../../util/StatusIconUtils";
|
||||
|
||||
|
||||
@Component
|
||||
export struct HandOverSelectCarItem {
|
||||
@ObjectLink item: CarItemBean;
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
Image(getCarStatusIcon(this.item.carZdlx))
|
||||
.width($r('app.float.default_36'))
|
||||
.height($r('app.float.default_36'))
|
||||
|
||||
Column() {
|
||||
Text(this.item.hphm)
|
||||
.fontColor($r('app.color.colorGrey8'))
|
||||
.fontSize($r('app.float.text_size_16'))
|
||||
.layoutWeight(1)
|
||||
Text(this.item.hpzl)
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.layoutWeight(1)
|
||||
Text(this.item.sfzh)
|
||||
.fontColor($r('app.color.colorGrey6'))
|
||||
.fontSize($r('app.float.text_size_14'))
|
||||
.layoutWeight(1)
|
||||
}
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.justifyContent(FlexAlign.Start)
|
||||
.align(Alignment.TopStart)
|
||||
.margin({left:$r('app.float.default_8'),right:$r('app.float.default_8')})
|
||||
.layoutWeight(1)
|
||||
.height($r('app.float.default_68'))
|
||||
|
||||
Image(this.item.isSelect?$r('app.media.check_box'):$r('app.media.icon_item_defautle'))
|
||||
.width($r('app.float.default_26'))
|
||||
.height($r('app.float.default_26'))
|
||||
|
||||
}
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.align(Alignment.Start)
|
||||
.justifyContent(FlexAlign.Start)
|
||||
.padding({ top: $r('app.float.default_5'), bottom: $r('app.float.default_5') })
|
||||
.padding({ left: $r('app.float.default_10'), right: $r('app.float.default_10') })
|
||||
.width(AppConstants.PERCENTAGE_MAX)
|
||||
.backgroundColor($r('app.color.white'))
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue