import 'dart:ui';

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';

import '../config/service_url.dart';
import 'commonFun.dart';

double my_fontSize = 16;
double my_listTileHeight = 30;
double my_listTileHeight2 = 100;
double my_iconSize = 18;
Color my_iconColor = Colors.blue;
double my_textFieldHeight = 8;
double my_marginLeft = 10;
double my_marginLeft2 = 33;
BuildContext my_context;

//黑烟信息处理数据变量
List listContacts2 = [];
List listMessagesInbox2 = [];
List listMessagesOutbox2 = [];
List listMachineGetList2 = [];

bool bFlash;

int g_tabs = 8;

//所有字段中，仅车牌号、车牌颜色、审核意见可供用户修改
Map topTabs_map = {
  'tabs_list': <Widget>[], //顶部Tab标题
  'hycs_info_list': <String>[], //黑烟初审信息
  'car_number_List': <String>[], //可供用户修改的车牌号码
  'cpysText_List': <String>[], //可供用户修改的车牌颜色
  'auditShuoming_Controller_List': <TextEditingController>[], //可供用户修改的审核意见
  'auditTitle': <String>[], //可供用户修改的审核结果
  'carNumberAndCpys_List': <Widget>[], //Tab页面中的车牌号码、车牌颜色组件
  'listView_List': <Widget>[], //Tab页面
};

//控制字段处理数据类
class ItemData {
  ItemData({
    this.fieldName = '',
    this.fieldText = '',
    this.fieldVisible = false,
    this.fieldModifiable = false,
    this.fieldUrlVisible = true,
  }) {}
  String fieldName;
  String fieldText;
  bool fieldVisible;
  bool fieldUrlVisible;
  bool fieldModifiable;
}

//4、非黑烟车查询数据变量
Map mapGetFhycxGetData = {};
Map mapGetFhycxGetDataRet = {};
List listFhycxGetList2 = [];

//3、推送交警数据变量
List listTsjjGetList2 = [];
Map mapGetTsjjGetData = {};
Map mapGetTsjjGetDataRet = {};
Map mapGetTsjjGetListRet = {};

// tszt	整型	推送状态：0-未推送 | 1-推送失败 | 3-推送成功
//_mapTsjjGetTsStatus['tszt']
// 20210529更新：
// tszt	整型	推送状态：0-未推送 | 1-推送失败 | 2-推送成功 | 3-规定时间内已有违章记录，本次不推送 | 4-现场登记，不推送
Map mapTsztText = {
  0: '未推送',
  1: '推送失败',
  2: '推送成功',
  3: '规定时间内已有违章记录，本次不推送',
  4: '现场登记，不推送',
};

// //workflow	整型	审核状态: 1=>待审 | 2=>已初审 | 999=>已复审 | 1000=>非黑烟车
// //mapTsjjlx为推送交警类型数据结构，用于在同一套代码中，处理'tsjj'推送交警、'fhcx'复审查询
// Map<String, Map> mapTsjjlx = {
//   'tsjj': {'get_workflow': 999, 'text': '推送交警', 'audit_workflow': 999},
//   'fhcx': {'get_workflow': 999, 'text': '复审查询', 'audit_workflow': 999},
// };
// //tsjjlx为推送交警类型，用于在同一套代码中，处理'tsjj'推送交警、'fhcx'复审查询
// String tsjjlx = 'fhcx';

// //workflow	整型	审核状态: 1=>待审 | 2=>已初审 | 999=>已复审 | 1000=>非黑烟车
// //mapWzxxlx为违章信息类型数据结构，用于在同一套代码中，处理'wzxx'违章信息查询、'fhycx'非黑烟查询
// Map<String, Map> mapWzxxlx = {
//   'wzxx': {'get_workflow': -1, 'text': '违章信息', 'audit_workflow': -1, 'api': ServicePath.getWzxxGetAllUrl},
//   'fhycx': {'get_workflow': 1000, 'text': '非黑烟查询', 'audit_workflow': -1, 'api': ServicePath.getWzxxGetListUrl},
// };
// //wzxxlx为违章信息类型，用于在同一套代码中，处理'wzxx'违章信息查询、'fhycx'非黑烟查询
// String wzxxlx = 'wzxx';

//3、推送交警数据变量

// App.Car_Hyc.GetList
// 根据审核状态获取分页列表数据
// 接口地址：http://125.64.218.67:9904/?s=App.Car_Hyc.GetList
// 接口文档
// 根据审核状态筛选列表数据，支持分页
//
// 接口参数
// 参数名字	类型	是否必须	默认值	其他	说明
// sign	字符串	必须
// random	字符串	必须
// workflow	整型	可选	1	最小：1	审核状态:1=>待审 | 2=>已初审 | 999=>已复审
// page	整型	可选	1	最小：1	第几页
// perpage	整型	可选	10	最小：1；最大：20	分页数量
// 返回结果
// 返回字段	类型	说明
// items	字符串	列表数据，列表字段请参考get接口
// total	整型	总数量
// page	整型	当前第几页
// perpage	整型	每页数量
// 异常情况
// 错误码	错误描述信息
// 400	表示客户端参数错误
// 404	表示接口服务不存在
// 500	表示服务端内部错误

//1、黑烟初审和复审数据变量

//参数名字    类型    是否必须  默认值  其他       说明
//workflow    整型	可选	    1       最小：1    审核状态:1=>待审 | 2=>已初审 | 999=>已复审

//workflow	整型	审核状态: 1=>待审 | 2=>已初审 | 999=>已复审
//workflow	整型	审核状态: 1=>待审 | 2=>已初审 | 999=>已复审 | 1000=>非黑烟车
//mapHyshlx为黑烟审核类型数据结构。用于在同一套代码中，处理'hycs'黑烟初审、'hyfh'黑烟复审
Map<String, Map> mapHyshlx = {
  'dwdt': {
    'get_workflow': -1,
    'text': '点位地图',
    'nick_text': '地图',
    'audit_workflow': -1,
    'api': ServicePath.getDwinfoGetListUrl
  },
  'dwsp': {
    'get_workflow': -1,
    'text': '点位视频',
    'nick_text': '视频',
    'audit_workflow': -1,
    'api': ServicePath.getDwinfoGetListUrl
  },
  'dwxx': {
    'get_workflow': -1,
    'text': '点位信息',
    'nick_text': '点位',
    'audit_workflow': -1,
    'api': ServicePath.getDwinfoGetListUrl
  },
  'hycs': {
    'get_workflow': 1,
    'text': '黑烟初审',
    'nick_text': '初审',
    'audit_workflow': 2,
    'api': ServicePath.getWzxxGetListUrl
  },
  'hyfh': {
    'get_workflow': 2,
    'text': '黑烟复审',
    'nick_text': '复审',
    'audit_workflow': 999,
    //'apiNtiem': ServicePath.getNtimeUrl, //获取违章间隔时间数据
    'api': ServicePath.getWzxxGetListUrl
  },
  'tsjj': {
    'get_workflow': 999,
    'text': '推送交警',
    'audit_workflow': -1,
    'api': ServicePath.getWzxxGetListUrl,
    'apiNtiem': ServicePath.getNtimeUrl, //获取违章间隔时间数据
    'sfhy': '黑烟车', //增加了一个查询字段 是否黑烟：sfhy	字符串	可选	黑烟车		是否黑烟车:黑烟车|非黑烟车，为空则全部
  },
  'wzxx': {
    'get_workflow': -1,
    'text': '违章信息',
    'audit_workflow': -1,
    'api': ServicePath.getWzxxGetAllUrl
  },
  'fhycx': {
    'get_workflow': -1,
    'text': '非黑烟查询',
    'audit_workflow': -1,
    'api': ServicePath.getWzxxGetListUrl,
    'sfhy': '非黑烟车', //增加了一个查询字段 是否黑烟：sfhy	字符串	可选	黑烟车		是否黑烟车:黑烟车|非黑烟车，为空则全部
  },
  'led_xsxx': {
    'get_workflow': -1,
    'text': '获取LED字幕数据',
    'audit_workflow': -1,
    'api': ServicePath.getLedXsxxGetListUrl,
    'apiItem': ServicePath.getLedXsxxGetUrl,
  },
  'led_update': {
    'get_workflow': -1,
    'text': '更新LED字幕数据',
    'audit_workflow': -1,
    'api': ServicePath.updateLedXsxxGetUrl,
    'apiItem': ServicePath.updateLedXsxxGetUrl,
  },
  'sbbj': {
    'get_workflow': -1,
    'text': '报警信息',
    'nick_text': '报警',
    'audit_workflow': 999,
    'api': ServicePath.getSbbjGetListUrl,
    'apiItem': ServicePath.getSbbjGetUrl,
    'apiAudit': ServicePath.auditSbbjUrl,
  },
  'sbgl': {
    'get_workflow': -1,
    'text': '设备管理信息',
    'audit_workflow': -1,
    'api': ServicePath.getMachineGetListUrl,
    'sblx': '球机1'
  },
};
//hyshlx为黑烟审核类型，用于在同一套代码中，处理'hycs'黑烟初审、'hyfh'黑烟复审
String hyshlx = 'hycs';
//1、黑烟初审和复审数据变量

//mapStatisType 为统计数据类型数据结构。用于在同一套代码中，处理相似类型的多种统计数据
//zptj 是本项目中“抓拍统计”的统一缩写
//sh_hyc_tj 是本项目中“审核黑烟车统计”的统一缩写
//clltj 是本项目中“车流量统计”的统一缩写
Map<String, Map> mapStatisType = {
  'zptj': {
    'text': '抓拍统计',
    'nick_text': '抓拍',
    'api': ServicePath.getStaYjxxUrl,
  },
  'sh_hyc_tj': {
    'text': '审核统计',
    'nick_text': '审核',
    'api': ServicePath.getStaHycUrl,
  },
  'clltj': {
    'text': '车流量统计',
    'nick_text': '车流量',
    'api': ServicePath.getStaCllUrl,
  },
  'cllrtj': {
    'text': '车流量日统计',
    'textTerm': '早高峰 7:30~9:30    晚高峰 17:30~19:30',
    'nick_text': '车流量',
    'startDate': '', // 获得前 31 天的日期：['2021-03-18', '2021-04-17']
    'endDate': '',
    'api': ServicePath.getRStaCllUrl,
  },
};

class cpysItem {
  String cpysText;
  Color cpysFont;
  Color cpysBackground;
  Color cpysBorder;

  cpysItem(
      {@required this.cpysText,
      @required this.cpysBackground,
      @required this.cpysFont,
      @required this.cpysBorder});
}

//车牌颜色Map
Map cpysMap = {
  '蓝色': cpysItem(
      cpysText: '蓝色', cpysBackground: Colors.blue, cpysFont: Colors.white, cpysBorder: Colors.grey),
  '黄色': cpysItem(
      cpysText: '黄色',
      cpysBackground: Colors.yellow,
      cpysFont: Colors.black,
      cpysBorder: Colors.purple),
  '绿色': cpysItem(
      cpysText: '绿色',
      cpysBackground: Colors.green,
      cpysFont: Colors.white,
      cpysBorder: Colors.pink),
  '黑色': cpysItem(
      cpysText: '黑色',
      cpysBackground: Colors.black,
      cpysFont: Colors.white,
      cpysBorder: Colors.blue),
  '白色': cpysItem(
      cpysText: '白色',
      cpysBackground: Colors.white,
      cpysFont: Colors.black,
      cpysBorder: Colors.black),
  '其他': cpysItem(
      cpysText: '其他',
      cpysBackground: Colors.red,
      cpysFont: Colors.white,
      cpysBorder: Colors.black45),
};

//车牌颜色选择
List cpysList = [
  cpysItem(
      cpysText: '蓝色',
      cpysBackground: Colors.blue,
      cpysFont: Colors.white,
      cpysBorder: Colors.orange),
  cpysItem(
      cpysText: '黄色',
      cpysBackground: Colors.yellow,
      cpysFont: Colors.black,
      cpysBorder: Colors.purple),
  cpysItem(
      cpysText: '绿色',
      cpysBackground: Colors.green,
      cpysFont: Colors.white,
      cpysBorder: Colors.pink),
  cpysItem(
      cpysText: '黑色',
      cpysBackground: Colors.black,
      cpysFont: Colors.white,
      cpysBorder: Colors.blue),
  cpysItem(
      cpysText: '白色',
      cpysBackground: Colors.white,
      cpysFont: Colors.black,
      cpysBorder: Colors.black),
  cpysItem(
      cpysText: '其他',
      cpysBackground: Colors.red,
      cpysFont: Colors.white,
      cpysBorder: Colors.black45),
];

int getIndexOfCpysList({@required String colorText}) {
  int len = cpysList.length;
  colorText = colorText.trim();
  for (int i = 0; i < len; i++) {
    if (cpysList[i].cpysText.trim() == colorText) {
      return i;
    }
  }
  return -1;
}

List listHycsGetList2 = [];
List listHycsFliter = [];
Map mapGetHycsGetData = {};
Map mapGetHycsGetDataRet = {
  "ret": 200,
  "data": {
    "id": 9530,
    "plate_id": "贵A5J69X",
    "plate_color": "蓝色",
    "car_color": null,
    "zpsj": 1635061299,
    "yjxx_id": "433425",
    "zp_num": null,
    "workflow": 999,
    "uuid": null,
    "uuname": null,
    "status": 1,
    "sfhy": "黑烟车",
    "pic_url": "/wwwroot/admin/Api/wwwroot/public/uploads/6fd82e935e361db183a991a6a078514e.jpg",
    "checkid": 433425,
    "tszt": 2,
    "ts_time": 1635069760,
    "dwms": "一曼路南山星城南区附近",
    "dwip": "172.16.3.4",
    "clfl": "面包车",
    "cplx": "其它",
    "lgmzs": 3,
    "jczxd": "953",
    "video_url": "new/4_6063_20211024_154139_贵A5J69X.mp4",
    "addtime": "2021-10-24 15:43:09",
    "iffiles": 0,
    "plate": "贵",
    "plate_sd": "贵州",
    "pic_thumb": null,
    "new_zpsj": 1635061299,
    "sfyc": 0,
    "plate_sd_s": "贵阳",
    "cp_url": "/wwwroot/admin/Api/wwwroot/public/uploads/4f045b43d38c45993ad990f68f981ee2.jpg",
    "hpzl_dm": "255",
    "cllx_dm": "4",
    "csys_dm": "1",
    "hpys_dm": "0",
    "waittime": 1635069721,
    "fid": 0,
    "cftype": "系统抓拍",
    "uid": null,
    "uname": null,
    "updatetime": null,
    "shtime": "2021-10-24 17:02:01",
    "gbcs": 0,
    "h5_url": "new/4_6063_20211024_154139_贵A5J69X.mp4",
    "source": "PC",
    "video_check": 1,
    "ts_time_new": null,
    "dwbm": "0",
    "ycxbm": "0"
  },
  "msg": ""
};
// Map mapGetHycsGetDataRet = {
//   "ret": 200,
//   "data": {
//     "id": 1,
//     "uid": 132,
//     "uname": "",
//     "addtime": "2020-05-20 10:10:00",
//     "uuid": 132,
//     "uuname": "",
//     "updatetime": "2020-09-09 20:19:46",
//     "status": 1,
//     "sbbh": "S202001",
//     "sbmc": "摄像头",
//     "pic_url": "hyc/192.168.4.102/违法数据/20200822/12/6063_2_20200822_125252292_川Q09716_P1.jpg",
//     "video_url": "hyc/192.168.4.102/违法数据/20200822/12/6063_2_20200822_125252292_川Q09716.mp4",
//     "car_number": "川Q09716",
//     "car_type": "大型车",
//     "car_color": "白色",
//     "is_yellow": 0,
//     "lgmzs": 3,
//     "workflow": 1,
//     "clfl": "大货车",
//     "xsfx": "上行",
//     "cpys": "黄色",
//     "cplx": "民用双行尾牌",
//     "zpsj": "20200822125252292",
//     "all_url": "hyc\\192.168.4.102\\违法数据\\20200822\\12\\6063_2_20200822_125252292_川Q09716",
//     "cdh": 1,
//     "sjlx": "",
//     "wzlx": "黑烟车",
//     "jczxd": 0,
//     "tp1": "",
//     "tp2": "",
//     "tp3": "",
//     "tp4": ""
//   },
//   "msg": ""
// };

//获取指定id的推送交警记录列表存入listGetTsjj
List listGetTsjj = [];

//获取指定id的抓拍记录列表存入listGetZpjl
List listGetZpjl = [];

//获取待审核黑烟车记录
List listReviewed = [];

//workflow	整型	审核状态: 1=>待审 | 2=>已初审 | 999=>已复审 | 1000=>非黑烟车
Map<int, String> mapAuditStatus = {
  1: "待审",
  2: "已初审",
  999: "已复审",
  1000: "非黑烟车",
};

//Begin 处理修改字段的变量
List<String> listFieldModify = [];

Map mapGetHycsGetListRet = {
  "ret": 200,
  "data": {"items": [], "total": 0, "page": 1, "perpage": 10},
  "msg": ""
};

//7、点位视频数据变量
List listDwspGetData = [];
List listDwspGetList2 = [];

//7、设备管理信息查询数据变量
List listSbglGetData = [];
List listSbglGetList2 = [];

//  今日记录统计信息数据变量
List listTodayList = [];

//6、报警信息查询数据变量
List listSbbjGetData = [];
List listSbbjGetList2 = [
  {
    "id": 1196,
    "bjlx": "风扇",
    "content": "串口COM1获取风扇异常数据",
    "dwip": "172.16.3.12",
    "sbip": "192.168.1.10",
    "addtime": "2021-02-16 09:50:30",
    "workflow": 999
  },
];

//End 处理修改字段的变量

// 返回字段	类型	说明
// id	整型	主键ID
// car_number	字符串	车牌号
// car_type	字符串	车型
// cpys	字符串	车牌颜色
// zpsj	字符串	抓拍时间
// workflow	整型	审核状态: 1=>待审 | 2=>已初审 | 1000=>已复审
// video_url	字符串	视频地址
// lgmzs	整型	林格曼指数
// wzlx	字符串	违章类型
// jczxd	整型	检测置信度
// tp1	字符串	第一张图片地址
// tp2	字符串	第二张图片地址
// tp3	字符串	第三张图片地址
// tp4	字符串	第四张图片地址

//控制字段处理数据类
//class ItemData {
//   ItemData({
//     this.fieldName,
//     this.fieldText,
//     this.fieldVisible,
//     this.fieldModifiable,
//     this.fieldUrlVisible,
//   }) {}
//   String fieldName = '';
//   String fieldText = '';
//   bool fieldVisible = true;
//   bool fieldUrlVisible = true;
//   bool fieldModifiable = true;
// }

//一、违章信息不可修改字段：
// 1、抓拍时间 zpsj
// 2、视频地址 video_url，只显示视频，不显示地址
// 3、审核状态 workflow，此字段也不显示出来（审核状态有调整：1=>待审 | 2=>已初审 | 999=>已复审 | 1000=>非黑烟车）
// 4、林格曼指数 lgmzs
// 5、违章类型 wzlx，此字段不显示出来
// 6、检测置信度 jczxd，此字段不显示
// 7、四张图片地址 tp1,tp2,tp3,tp3，只显示图片本身，不显示地址
// 8、Id 不可修改，不显示
// 其余字段可修改

//App.Car_Yjxx.Update更新时的整型字段只有两项
// lgmzs	整型	必须		最小：1	林格曼指数
// jczxd	整型	必须		最小：1	检测置信度

//Map mapGetHycsGetDataRet = {
//   "ret": 200,
//   "data": {
//     "id": 512,
//     "plate_id": "川Q60387",
//     "plate_color": "黄色",
//     "zpsj": 1611205595,
//     "yjxx_id": "654",
//     "workflow": 1,
//     "video_url": "video/8_6063_20210121_130635_川Q60387.mp4",
//     "pic_url": "http://10.194.142.91:9001/uploads/29f82a29ee17e7d668e1ed2b6239f2b7.jpg",
//     "clfl": "货车",
//     "dwip": "172.16.3.8",
//     "dwms": "宜威路南广镇附近入城方向",
//     "lgmzs": 5,
//     "jczxd": "2"
//   },
//   "msg": ""
// };

//返回字段	类型	说明
// id	整型	主键ID
// plate_id	字符串	车牌号
// plate_color	字符串	车牌颜色
// zpsj	字符串	抓拍时间
// yjxx_id	字符串	抓拍记录ID，可能为多条，用逗号分割。与抓拍记录关联
// workflow	整型	审核状态: 1=>待审 | 2=>已初审 | 999=>已复审
// video_url	字符串	视频地址
// pic_url	字符串	图片地址
// clfl	字符串	车辆分类
// dwip	字符串	抓拍地点位IP
// dwms	字符串	抓拍地点
// lgmzs	整型	林格曼黑度值
// jczxd	整型	检测置信度

//不显示的是4项：0-"id"、17-"workflow"、26-"wzlx"、27-"jczxd"、
//所有字段中，仅仅提供车牌颜色、车牌号、审核意见供修改
Map<String, ItemData> mapGetWzxxGetDataSpecial = {
  "id": ItemData(fieldText: "主键ID", fieldVisible: false),
  "plate_id": ItemData(fieldText: "车牌号码"),
  "plate_color": ItemData(fieldText: "车牌颜色"),
  "zpsj": ItemData(fieldText: "抓拍时间"),
  "yjxx_id": ItemData(fieldText: "抓拍记录ID"), //抓拍记录ID，可能为多条，用逗号分割。与抓拍记录关联（移交信息）
  "workflow": ItemData(fieldText: "审核状态", fieldVisible: false), //审核状态: 1=>待审 | 2=>已初审 | 999=>已复审
  "video_url": ItemData(fieldText: "视频地址", fieldUrlVisible: false),
  "pic_url": ItemData(fieldText: "图片地址", fieldUrlVisible: false),
  "clfl": ItemData(fieldText: "车辆分类"),
  "dwip": ItemData(fieldText: "抓拍地点位IP"),
  "dwms": ItemData(fieldText: "抓拍地点"),
  "lgmzs": ItemData(fieldText: "林格曼黑度值"),
  "jczxd": ItemData(fieldText: "检测置信度", fieldVisible: false),
};

Map<String, String> mapWzxxDataText = {
  // "主键ID": "id",
  "主键ID": "id",
  "车牌号码": "plate_id",
  "车牌颜色": "plate_color",
  "抓拍时间": "zpsj",
  "抓拍记录ID": "yjxx_id",
  "抓拍次数": "yjxx_id", //为排序增加的记录
  "审核状态": "workflow",
  "视频地址": "video_url",
  "图片地址": "pic_url",
  "车辆分类": "clfl",
  "车辆类型": "clfl", //为排序增加的记录
  "抓拍地点位IP": "dwip",
  "抓拍地点": "dwms",
  "林格曼黑度值": "lgmzs",
  "林格曼黑度": "lgmzs", //为排序增加的记录
  "检测置信度": "jczxd",
  "推送状态": "tszt", //为tsjj页面排序增加的记录
  "推送时间": "ts_time", //为tsjj页面排序增加的记录
  //为LED字幕排序增加的记录
  "显示信息": "xsnr",
  "添加时间": "addtime",
  "更新时间": "updatetime",
  //为设备报警信息排序增加的记录
  '设备类型': "bjlx",
  '报警内容': "content",
  '点位IP': "dwip",
  '设备IP': "sbip",
  '处理状态': "workflow",
  //为点位信息排序增加的记录
  '点位名称': "dwmc",
  '点位编号': "dwbh",
  '点位信息': "dwinfo",
  '点位坐标': "dwzb",
  '点位描述': "dwms",
  '点位状态': "dwzt",
};

//点位信息数据
//{
//    "id": 1,
//    "dwip": "172.16.3.1",
//    "dwmc": "江北振兴大道",
//    "dwbh": 1,
//    "dwinfo": "江北振兴大道入城方向",
//    "dwzb": "104.607091|28.807061",
//    "dwms": "江北振兴大道入城方向，识别孜岩、红坝路入城排放黑烟车辆",
//    "dwzt": "正常"
//},

// Map mapZpljTemp =
// {
//   "ret": 200,
//   "data": {
//     "id": 660,
//     "uid": 0,
//     "uname": "",
//     "addtime": "2021-01-21 14:53:48",
//     "uuid": 0,
//     "uuname": "",
//     "updatetime": "0000-00-00 00:00:00",
//     "status": 1,
//     "dwip": "172.16.3.11",
//     "sbmc": "",
//     "pic_url": "/wwwroot/admin/Api/wwwroot/public/uploads/fa656d26ced72b628858eb53aeea2e54.jpg",
//     "video_url": "video/11_6063_20210121_145225_川Q61308.mp4",
//     "car_number": "川Q61308",
//     "car_type": "其它",
//     "car_color": "未识别",
//     "is_yellow": 1,
//     "lgmzs": 5,
//     "workflow": 1,
//     "clfl": "货车",
//     "xsfx": "",
//     "cpys": "黄色",
//     "cplx": "标准民用车与军车",
//     "zpsj": "1611211945",
//     "all_url": null,
//     "cdh": 1,
//     "sjlx": "",
//     "wzlx": "黑烟车",
//     "jczxd": 2,
//     "tp1": null,
//     "tp2": null,
//     "tp3": null,
//     "tp4": null,
//     "dwms": "观斗山隧道入城方向出口",
//     "cp_url": "http://10.194.142.91:9001/uploads/4268007146bf08472bdb92a7e064306d.jpg",
//     "cscd": "0",
//     "clsd": "761",
//     "kkbh": "0",
//     "cdbh": "2",
//     "jcdbh": "12345",
//     "truetime": "2147483647",
//     "dwbh": 11,
//     "plate": "川",
//     "plate_sd": "四川"
//   },
//   "msg": ""
// };

//只显示8个字段
//车牌号
// 车牌颜色
// 车辆类型
// 林格曼黑度
// 抓拍次数
// 首次抓拍时间
// 首次抓拍地点
// 图片地址
// 视频地址
//所有字段中，仅仅提供车牌颜色、车牌号、审核意见供修改
//已经与mapZpljTemp字段进行对应检查
Map<String, ItemData> mapGetZpjlGetDataSpecial = {
  "id": ItemData(fieldText: "主键ID"),
  "uid": ItemData(fieldText: "用户ID"),
  "uname": ItemData(fieldText: "用户名"),
  "addtime": ItemData(fieldText: "添加时间"),
  "uuid": ItemData(fieldText: "更新用户ID"),
  "uuname": ItemData(fieldText: "更新用户名"),
  "updatetime": ItemData(fieldText: "更新时间"),
  "status": ItemData(fieldText: "状态"),
  "dwip": ItemData(fieldText: "抓拍地点位IP"),
  "sbmc": ItemData(fieldText: "设备名称"),
  "pic_url": ItemData(fieldText: "图片地址", fieldUrlVisible: false, fieldVisible: true),
  "video_url": ItemData(fieldText: "视频地址", fieldUrlVisible: false, fieldVisible: true),
  "car_number": ItemData(fieldText: "车牌号码", fieldModifiable: true, fieldVisible: true),
  "car_type": ItemData(fieldText: "车型"),
  "car_color": ItemData(fieldText: "车辆颜色"),
  "is_yellow": ItemData(fieldText: "是否为黄色"),
  "lgmzs": ItemData(fieldText: "林格曼黑度", fieldVisible: true),
  "workflow": ItemData(fieldText: "审核状态"),
  "clfl": ItemData(fieldText: "车辆类型", fieldVisible: true),
  "xsfx": ItemData(fieldText: "行驶方向"),
  "cpys": ItemData(fieldText: "车牌颜色", fieldModifiable: true, fieldVisible: true),
  "cplx": ItemData(fieldText: "民用双行尾牌"),
  "zpsj": ItemData(fieldText: "抓拍时间", fieldVisible: true),
  "all_url": ItemData(fieldText: "资料地址"),
  "cdh": ItemData(fieldText: "出单号"),
  "sjlx": ItemData(fieldText: "审结类型"),
  "wzlx": ItemData(fieldText: "违章类型"),
  "jczxd": ItemData(fieldText: "检测置信度"),
  "tp1": ItemData(fieldText: "第一张图片地址", fieldUrlVisible: false),
  "tp2": ItemData(fieldText: "第二张图片地址", fieldUrlVisible: false),
  "tp3": ItemData(fieldText: "第三张图片地址", fieldUrlVisible: false),
  "tp4": ItemData(fieldText: "第四张图片地址", fieldUrlVisible: false),
  "dwms": ItemData(fieldText: "抓拍地点", fieldVisible: true),
  "cp_url": ItemData(fieldText: "抓拍图片地址", fieldUrlVisible: false),
  "cscd": ItemData(fieldText: "初审出单"),
  "clsd": ItemData(fieldText: "车辆速度"),
  "kkbh": ItemData(fieldText: "扣款编号"),
  "cdbh": ItemData(fieldText: "出单编号"),
  "jcdbh": ItemData(fieldText: "监测点编号"),
  "truetime": ItemData(fieldText: "抓拍时间"),
  "dwbh": ItemData(fieldText: "抓拍地点编号"),
  "plate": ItemData(fieldText: "车牌省份简称"),
  "plate_sd": ItemData(fieldText: "车牌省份属地"),
};

//Map<String, ItemData> mapGetWzxxGetDataSpecial = {
//   "zpsj": ItemData(fieldText: "抓拍时间"),
//   "video_url": ItemData(fieldText: "视频地址", fieldUrlVisible: false),
//   "workflow": ItemData(fieldText: "审核状态", fieldVisible: false),
//   "lgmzs": ItemData(fieldText: "林格曼指数"),
//   "wzlx": ItemData(fieldText: "违章类型", fieldVisible: false),
//   "jczxd": ItemData(fieldText: "检测置信度", fieldVisible: false),
//   "pic_url": ItemData(fieldText: "图片地址", fieldUrlVisible: false),
//   "tp1": ItemData(fieldText: "第一张图片地址", fieldUrlVisible: false),
//   "tp2": ItemData(fieldText: "第二张图片地址", fieldUrlVisible: false),
//   "tp3": ItemData(fieldText: "第三张图片地址", fieldUrlVisible: false),
//   "tp4": ItemData(fieldText: "第四张图片地址", fieldUrlVisible: false),
//   "id": ItemData(fieldText: "主键ID", fieldVisible: false),
//   "uid": ItemData(fieldText: "用户ID"),
//   "uname": ItemData(fieldText: "用户名"),
//   "addtime": ItemData(fieldText: "添加时间"),
//   "uuid": ItemData(fieldText: "更新用户ID"),
//   "uuname": ItemData(fieldText: "更新用户名"),
//   "updatetime": ItemData(fieldText: "更新时间"),
//   "status": ItemData(fieldText: "状态"),
//   "cdh": ItemData(fieldText: "出单号"),
//   "sjlx": ItemData(fieldText: "审结类型"),
//   //"sbbh": ItemData(fieldText: "设备编号"),
//   "dwip": ItemData(fieldText: "抓拍地点IP"),
//   "all_url": ItemData(fieldText: "资料地址"),
//   "sbmc": ItemData(fieldText: "设备名称"),
//   "car_color": ItemData(fieldText: "车辆颜色"),
//   "is_yellow": ItemData(fieldText: "黄色"),
//   "clfl": ItemData(fieldText: "车辆类型"),
//   "xsfx": ItemData(fieldText: "行驶方向"),
//   "cplx": ItemData(fieldText: "民用双行尾牌"),
//   "car_number": ItemData(fieldText: "车牌号", fieldModifiable: true),
//   "car_type": ItemData(fieldText: "车型"),
//   "cpys": ItemData(fieldText: "车牌颜色", fieldModifiable: true),
//   "dwms": ItemData(fieldText: "抓拍地点名称"),
//   "cp_url": ItemData(fieldText: "抓拍图片地址", fieldUrlVisible: false),
//   "cscd": ItemData(fieldText: "初审cd"),
//   "clsd": ItemData(fieldText: "处理sd"),
//   "kkbh": ItemData(fieldText: "kk编号"),
//   "cdbh": ItemData(fieldText: "cd编号"),
//   "jcdbh": ItemData(fieldText: "监测点编号"),
//   "truetime": ItemData(fieldText: "抓拍时间"),
//   "dwbh": ItemData(fieldText: "抓拍地点编号"),
//   "plate": ItemData(fieldText: "车牌省份简称"),
//   "plate_sd": ItemData(fieldText: "车牌省份属地"),
// };

cloneMap({Map mapTarget, Map mapSource}) async {
  if (0 == mapSource.length) {
    return;
  }
  mapTarget.clear();
  mapSource.forEach((key, value) {
    mapTarget[key] = mapSource[key];
  });
}

//usrMap.forEach((k,v) => print('${k}: ${v}'));
copyMapUpdateWzxxData(Map map) async {
  mapUpdateWzxxData.forEach((key, value) {
    //这两个字段为整型，必须单独处理。其他字段都是字符型
    // if("lgmzs" == key || "jczxd" == key) {
    //   mapUpdateWzxxData[key] = map[key];
    // } else if('' == map[key]) {
    //   mapUpdateWzxxData[key] = '（空）';
    // } else {
    //   mapUpdateWzxxData[key] = map[key];
    // }

    if (map[key] is int) {
      mapUpdateWzxxData[key] = map[key] > 0 ? map[key] : 1;
    } else {
      mapUpdateWzxxData[key] = (map[key] == '') ? '（空）' : map[key];
    }
  });
}

Map mapUpdateWzxxData = {
  "id": '',
  "car_number": '',
  "car_type": '',
  "cpys": '',
  "zpsj": '',
  "video_url": '',
  "lgmzs": 1,
  "jczxd": 1,
  "tp1": '',
  "tp2": '',
  "tp3": '',
  "tp4": '',
};

// Map mapGetHycxGetDataText = {
//   "id": "主键ID",
//   "uid": "用户ID",
//   "uname": "用户名",
//   "addtime": "添加时间",
//   "uuid": "更新用户ID",
//   "uuname": "更新用户名",
//   "updatetime": "更新时间",
//   "status": "状态",
//   "sbbh": "设备编号",
//   "sbmc": "设备名称",
//   "pic_url": "图片地址",
//   "video_url": "视频地址",
//   "car_number": "车牌号",
//   "car_type": "车型",
//   "car_color": "车辆颜色",
//   "is_yellow": "黄色",
//   "lgmzs": "林格曼指数",
//   "workflow": "审核状态",
//   "clfl": "车辆类型",
//   "xsfx": "行驶方向",
//   "cpys": "车牌颜色",
//   "cplx": "民用双行尾牌",
//   "zpsj": "抓拍时间",
//   "all_url": "资料地址",
//   "cdh": "出单号",
//   "sjlx": "审结类型",
//   "wzlx": "违章类型",
//   "jczxd": "检测置信度",
//   "tp1": "第一张图片地址",
//   "tp2": "第二张图片地址",
//   "tp3": "第三张图片地址",
//   "tp4": "第四张图片地址",
// };

//4、违章信息查询数据变量
List listWzxxGetData = [];
List listWzxxGetList2 = [
  {
    "id": 1,
    "uid": 132,
    "uname": "",
    "addtime": "2020-05-20 10:10:00",
    "uuid": 132,
    "uuname": "",
    "updatetime": "2020-09-09 20:19:46",
    "status": 1,
    "sbbh": "S202001",
    "sbmc": "摄像头",
    "pic_url": "hyc/192.168.4.102/违法数据/20200822/12/6063_2_20200822_125252292_川Q09716_P1.jpg",
    "video_url": "hyc/192.168.4.102/违法数据/20200822/12/6063_2_20200822_125252292_川Q09716.mp4",
    "car_number": "川Q09716",
    "car_type": "大型车",
    "car_color": "白色",
    "is_yellow": 0,
    "lgmzs": 3,
    "workflow": 1,
    "clfl": "大货车",
    "xsfx": "上行",
    "cpys": "黄色",
    "cplx": "民用双行尾牌",
    "zpsj": "20200822125252292",
    "all_url": "hyc\\192.168.4.102\\违法数据\\20200822\\12\\6063_2_20200822_125252292_川Q09716",
    "cdh": 1,
    "sjlx": "",
    "wzlx": "黑烟车",
    "jczxd": 0,
    "tp1": "",
    "tp2": "",
    "tp3": "",
    "tp4": ""
  },
  {
    "id": 2,
    "uid": 132,
    "uname": "",
    "addtime": "2020-05-20 10:10:00",
    "uuid": 132,
    "uuname": "",
    "updatetime": "2020-09-09 20:19:46",
    "status": 1,
    "sbbh": "S202001",
    "sbmc": "摄像头",
    "pic_url": "hyc/192.168.4.102/违法数据/20200822/12/6063_2_20200822_125252292_川Q09716_P1.jpg",
    "video_url": "hyc/192.168.4.102/违法数据/20200822/12/6063_2_20200822_125252292_川Q09716.mp4",
    "car_number": "川Q09716",
    "car_type": "大型车",
    "car_color": "白色",
    "is_yellow": 0,
    "lgmzs": 3,
    "workflow": 1,
    "clfl": "大货车",
    "xsfx": "上行",
    "cpys": "黄色",
    "cplx": "民用双行尾牌",
    "zpsj": "20200822125252292",
    "all_url": "hyc\\192.168.4.102\\违法数据\\20200822\\12\\6063_2_20200822_125252292_川Q09716",
    "cdh": 1,
    "sjlx": "",
    "wzlx": "黑烟车",
    "jczxd": 0,
    "tp1": "",
    "tp2": "",
    "tp3": "",
    "tp4": ""
  },
  {
    "id": 3,
    "uid": 132,
    "uname": "",
    "addtime": "2020-05-20 10:10:00",
    "uuid": 132,
    "uuname": "",
    "updatetime": "2020-09-09 20:19:46",
    "status": 1,
    "sbbh": "S202001",
    "sbmc": "摄像头",
    "pic_url": "hyc/192.168.4.102/违法数据/20200822/12/6063_2_20200822_125252292_川Q09716_P1.jpg",
    "video_url": "hyc/192.168.4.102/违法数据/20200822/12/6063_2_20200822_125252292_川Q09716.mp4",
    "car_number": "川Q09716",
    "car_type": "大型车",
    "car_color": "白色",
    "is_yellow": 0,
    "lgmzs": 3,
    "workflow": 1,
    "clfl": "大货车",
    "xsfx": "上行",
    "cpys": "黄色",
    "cplx": "民用双行尾牌",
    "zpsj": "20200822125252292",
    "all_url": "hyc\\192.168.4.102\\违法数据\\20200822\\12\\6063_2_20200822_125252292_川Q09716",
    "cdh": 1,
    "sjlx": "",
    "wzlx": "黑烟车",
    "jczxd": 0,
    "tp1": "",
    "tp2": "",
    "tp3": "",
    "tp4": ""
  },
  {
    "id": 4,
    "uid": 132,
    "uname": "",
    "addtime": "2020-05-20 10:10:00",
    "uuid": 132,
    "uuname": "",
    "updatetime": "2020-09-09 20:19:46",
    "status": 1,
    "sbbh": "S202001",
    "sbmc": "摄像头",
    "pic_url": "hyc/192.168.4.102/违法数据/20200822/12/6063_2_20200822_125252292_川Q09716_P1.jpg",
    "video_url": "hyc/192.168.4.102/违法数据/20200822/12/6063_2_20200822_125252292_川Q09716.mp4",
    "car_number": "川Q09716",
    "car_type": "大型车",
    "car_color": "白色",
    "is_yellow": 0,
    "lgmzs": 3,
    "workflow": 1,
    "clfl": "大货车",
    "xsfx": "上行",
    "cpys": "黄色",
    "cplx": "民用双行尾牌",
    "zpsj": "20200822125252292",
    "all_url": "hyc\\192.168.4.102\\违法数据\\20200822\\12\\6063_2_20200822_125252292_川Q09716",
    "cdh": 1,
    "sjlx": "",
    "wzlx": "黑烟车",
    "jczxd": 0,
    "tp1": "",
    "tp2": "",
    "tp3": "",
    "tp4": ""
  },
  {
    "id": 5,
    "uid": 132,
    "uname": "",
    "addtime": "2020-05-20 10:10:00",
    "uuid": 132,
    "uuname": "",
    "updatetime": "2020-09-09 20:19:46",
    "status": 1,
    "sbbh": "S202001",
    "sbmc": "摄像头",
    "pic_url": "hyc/192.168.4.102/违法数据/20200822/12/6063_2_20200822_125252292_川Q09716_P1.jpg",
    "video_url": "hyc/192.168.4.102/违法数据/20200822/12/6063_2_20200822_125252292_川Q09716.mp4",
    "car_number": "川Q09716",
    "car_type": "大型车",
    "car_color": "白色",
    "is_yellow": 0,
    "lgmzs": 3,
    "workflow": 1,
    "clfl": "大货车",
    "xsfx": "上行",
    "cpys": "黄色",
    "cplx": "民用双行尾牌",
    "zpsj": "20200822125252292",
    "all_url": "hyc\\192.168.4.102\\违法数据\\20200822\\12\\6063_2_20200822_125252292_川Q09716",
    "cdh": 1,
    "sjlx": "",
    "wzlx": "黑烟车",
    "jczxd": 0,
    "tp1": "",
    "tp2": "",
    "tp3": "",
    "tp4": ""
  },
];

Map mapGetWzxxGetData = {};

Map mapGetWzxxGetDataRet = {
  "ret": 200,
  "data": {
    "id": 1,
    "uid": 132,
    "uname": "",
    "addtime": "2020-05-20 10:10:00",
    "uuid": 132,
    "uuname": "",
    "updatetime": "2020-09-09 20:19:46",
    "status": 1,
    "sbbh": "S202001",
    "sbmc": "摄像头",
    "pic_url": "hyc/192.168.4.102/违法数据/20200822/12/6063_2_20200822_125252292_川Q09716_P1.jpg",
    "video_url": "hyc/192.168.4.102/违法数据/20200822/12/6063_2_20200822_125252292_川Q09716.mp4",
    "car_number": "川Q09716",
    "car_type": "大型车",
    "car_color": "白色",
    "is_yellow": 0,
    "lgmzs": 3,
    "workflow": 1,
    "clfl": "大货车",
    "xsfx": "上行",
    "cpys": "黄色",
    "cplx": "民用双行尾牌",
    "zpsj": "20200822125252292",
    "all_url": "hyc\\192.168.4.102\\违法数据\\20200822\\12\\6063_2_20200822_125252292_川Q09716",
    "cdh": 1,
    "sjlx": "",
    "wzlx": "黑烟车",
    "jczxd": 0,
    "tp1": "",
    "tp2": "",
    "tp3": "",
    "tp4": ""
  },
  "msg": ""
};

// 返回字段	类型	说明
// id	整型	主键ID
// car_number	字符串	车牌号
// car_type	字符串	车型
// cpys	字符串	车牌颜色
// zpsj	字符串	抓拍时间
// workflow	整型	审核状态: 1=>待审 | 2=>已初审 | 1000=>已复审
// video_url	字符串	视频地址
// lgmzs	整型	林格曼指数
// wzlx	字符串	违章类型
// jczxd	整型	检测置信度
// tp1	字符串	第一张图片地址
// tp2	字符串	第二张图片地址
// tp3	字符串	第三张图片地址
// tp4	字符串	第四张图片地址

//"id": "主键ID"
// "car_number": "车牌号"
// "car_type": "车型"
// "cpys": "车牌颜色"
// "zpsj": "抓拍时间"
// "workflow": "审核状态"
// "video_url": "视频地址"
// "lgmzs": "林格曼指数"
// "wzlx": "违章类型"
// "jczxd": "检测置信度"
// "tp1": "第一张图片地址"
// "tp2": "第二张图片地址"
// "tp3": "第三张图片地址"
// "tp4": "第四张图片地址"

Map mapGetWzxxGetDataText = {
  "id": "主键ID",
  "uid": "用户ID",
  "uname": "用户名",
  "addtime": "添加时间",
  "uuid": "更新用户ID",
  "uuname": "更新用户名",
  "updatetime": "更新时间",
  "status": "状态",
  "sbbh": "设备编号",
  "sbmc": "设备名称",
  "pic_url": "图片地址",
  "video_url": "视频地址",
  "car_number": "车牌号",
  "car_type": "车型",
  "car_color": "车辆颜色",
  "is_yellow": "黄色",
  "lgmzs": "林格曼指数",
  "workflow": "审核状态",
  "clfl": "车辆类型",
  "xsfx": "行驶方向",
  "cpys": "车牌颜色",
  "cplx": "民用双行尾牌",
  "zpsj": "抓拍时间",
  "all_url": "资料地址",
  "cdh": "出单号",
  "sjlx": "审结类型",
  "wzlx": "违章类型",
  "jczxd": "检测置信度",
  "tp1": "第一张图片地址",
  "tp2": "第二张图片地址",
  "tp3": "第三张图片地址",
  "tp4": "第四张图片地址",
};

Map mapGetWzxxGetDataModifiable = {
  "id": false,
  "uid": false,
  "uname": false,
  "addtime": false,
  "uuid": false,
  "uuname": false,
  "updatetime": false,
  "status": false,
  "sbbh": false,
  "sbmc": false,
  "pic_url": false,
  "video_url": false,
  "car_number": false,
  "car_type": false,
  "car_color": false,
  "is_yellow": false,
  "lgmzs": false,
  "workflow": false,
  "clfl": false,
  "xsfx": false,
  "cpys": false,
  "cplx": false,
  "zpsj": false,
  "all_url": false,
  "cdh": false,
  "sjlx": true,
  "wzlx": false,
  "jczxd": false,
  "tp1": false,
  "tp2": false,
  "tp3": false,
  "tp4": false,
};

//App.Car_Led.GetList接口获取的记录数据结构
Map mapGetLedXsxxGetData = {
  "id": 2,
  "xsnr": "绿水青山就是金山银山     宜宾市翠屏生态环境局宣。",
  "addtime": "2021-01-20 10:16:07",
  "updatetime": "2021-02-13 11:48:51"
};

Map mapGetLedXsxxGetDataText = {
  "id": 'ID号',
  "xsnr": "显示内容",
  "addtime": '添加时间',
  "updatetime": '更新时间',
};

Map mapGetLedXsxxGetDataModifiable = {
  "id": false,
  "xsnr": true,
  "addtime": false,
  "updatetime": false,
};

Map mapGetLedXsxxListRet = {
  "ret": 200,
  "data": {"items": [], "total": 12, "page": 1, "perpage": 20},
  "msg": ""
};

List listLedXsxxGetList2 = [
  {
    "id": 2,
    "xsnr": "绿水青山就是金山银山     宜宾市翠屏生态环境局宣。",
    "addtime": "2021-01-20 10:16:07",
    "updatetime": "2021-02-13 11:48:51"
  },
  {
    "id": 1,
    "xsnr": "绿水青山就是金山银山     宜宾市翠屏生态环境局宣。",
    "addtime": "2021-01-06 00:59:43",
    "updatetime": "2021-02-03 19:57:55"
  },
  {
    "id": 3,
    "xsnr": "绿水青山就是金山银山     宜宾市翠屏生态环境局宣。",
    "addtime": "2021-01-20 10:18:50",
    "updatetime": "2021-02-03 19:57:43"
  },
  {
    "id": 8,
    "xsnr": "绿水青山就是金山银山     宜宾市翠屏生态环境局宣。",
    "addtime": "2021-01-20 10:19:22",
    "updatetime": "2021-02-03 19:57:34"
  },
  {
    "id": 6,
    "xsnr": "绿水青山就是金山银山     宜宾市翠屏生态环境局宣。",
    "addtime": "2021-01-20 10:19:09",
    "updatetime": "2021-01-22 22:01:06"
  },
  {
    "id": 5,
    "xsnr": "绿水青山就是金山银山     宜宾市翠屏生态环境局宣。",
    "addtime": "2021-01-20 10:19:02",
    "updatetime": "2021-01-22 22:01:02"
  },
  {
    "id": 7,
    "xsnr": "绿水青山就是金山银山     宜宾市翠屏生态环境局宣。",
    "addtime": "2021-01-20 10:19:16",
    "updatetime": "2021-01-22 22:00:49"
  },
  {
    "id": 4,
    "xsnr": "绿水青山就是金山银山     宜宾市翠屏生态环境局宣。",
    "addtime": "2021-01-20 10:18:56",
    "updatetime": "2021-01-22 22:00:41"
  },
  {
    "id": 9,
    "xsnr": "绿水青山就是金山银山     宜宾市翠屏生态环境局宣。",
    "addtime": "2021-01-20 10:19:29",
    "updatetime": "2021-01-22 22:00:21"
  },
  {
    "id": 10,
    "xsnr": "绿水青山就是金山银山     宜宾市翠屏生态环境局宣。",
    "addtime": "2021-01-20 10:19:36",
    "updatetime": "2021-01-22 22:00:16"
  },
  {
    "id": 11,
    "xsnr": "绿水青山就是金山银山     宜宾市翠屏生态环境局宣。",
    "addtime": "2021-01-20 10:19:50",
    "updatetime": "2021-01-22 22:00:08"
  },
  {
    "id": 12,
    "xsnr": "绿水青山就是金山银山     宜宾市翠屏生态环境局宣。",
    "addtime": "2021-01-20 10:19:58",
    "updatetime": "2021-01-22 21:58:48"
  }
];

//得到 listDwinfoGetList2['dwzt'] 的统计数据
int getOKdw() {
  int i = -1;
  for (var item in listDwinfoGetList2) {
    if (item['dwzt'] == '正常') {
      i++;
    }
  }
  return i;
}

///获取点位信息数据
List listDwinfoGetList2 = [];

///获取点位信息数据
List listDwinfoGetList0 = [
  {
    "id": 1,
    "dwip": "172.16.3.1",
    "dwmc": "江北振兴大道",
    "dwbh": 1,
    "dwinfo": "江北振兴大道入城方向",
    "dwzb": "104.607091|28.807061",
    "dwms": "江北振兴大道入城方向，识别孜岩、红坝路入城排放黑烟车辆",
    "dwzt": "正常"
  },
  {
    "id": 2,
    "dwip": "172.16.3.2",
    "dwmc": "宜飞路",
    "dwbh": 2,
    "dwinfo": "宜宾市翠屏南收费站宜飞路入城方向",
    "dwzb": "104.589904|28.787078",
    "dwms": "宜宾市翠屏南收费站宜飞路入城方向，识别屏山、菜坝入城排放黑烟车辆",
    "dwzt": "正常"
  },
  {
    "id": 3,
    "dwip": "172.16.3.3",
    "dwmc": "宜宾市翠屏南收费站",
    "dwbh": 3,
    "dwinfo": "宜宾市翠屏南收费站出城方向",
    "dwzb": "104.603919|28.765568",
    "dwms": "宜宾市翠屏南收费站出城方向，识别宜宾市翠屏南收费站出城排放黑烟车辆",
    "dwzt": "正常"
  },
  {
    "id": 4,
    "dwip": "172.16.3.4",
    "dwmc": "一曼路",
    "dwbh": 4,
    "dwinfo": "叙州区一曼路出城方向",
    "dwzb": "104.556797|28.718901",
    "dwms": "叙州区一曼路出城方向，识别进入叙州区新城区排放黑烟车辆",
    "dwzt": "正常"
  },
  {
    "id": 5,
    "dwip": "172.16.3.5",
    "dwmc": "柏溪收费站",
    "dwbh": 5,
    "dwinfo": "叙州区柏溪收费站出城方向",
    "dwzb": "104.533476|28.699059",
    "dwms": "叙州区柏溪收费站出城方向，识别叙州区老城区出城车辆排放黑烟",
    "dwzt": "正常"
  },
  {
    "id": 6,
    "dwip": "172.16.3.6",
    "dwmc": "七星路万达广场",
    "dwbh": 6,
    "dwinfo": "南岸七星路万达广场附近入城方向",
    "dwzb": "104.662376|28.755488",
    "dwms": "南岸七星路万达广场附近入城方向，识别高县入城排放黑烟车辆",
    "dwzt": "正常"
  },
  {
    "id": 7,
    "dwip": "172.16.3.7",
    "dwmc": "宜宾市翠屏财政局",
    "dwbh": 7,
    "dwinfo": "高县至宜宾市翠屏财政局入城方向",
    "dwzb": "104.616581|28.731942",
    "dwms": "高县至宜宾市翠屏财政局入城方向，识别高县入城排放黑烟车辆",
    "dwzt": "正常"
  },
  {
    "id": 8,
    "dwip": "172.16.3.8",
    "dwmc": "宜威路南广镇",
    "dwbh": 8,
    "dwinfo": "宜威路南广镇附近入城方向",
    "dwzb": "104.687767|28.731159",
    "dwms": "宜威路南广镇附近入城方向，识别珙县、筠连入城排放黑烟车辆",
    "dwzt": "正常"
  },
  {
    "id": 9,
    "dwip": "172.16.3.9",
    "dwmc": "宜长路",
    "dwbh": 9,
    "dwinfo": "宜长路出城方向",
    "dwzb": "104.717384|28.763214",
    "dwms": "宜长路出城方向，识别长宁、江安方向排放黑烟车辆",
    "dwzt": "正常"
  },
  {
    "id": 10,
    "dwip": "172.16.3.10",
    "dwmc": "宜南快速通道",
    "dwbh": 10,
    "dwinfo": "宜南快速通道入城方向",
    "dwzb": "104.759928|28.816636",
    "dwms": "宜南快速通道入城方向，识别南溪方向入城排放黑烟车辆",
    "dwzt": "正常"
  },
  {
    "id": 11,
    "dwip": "172.16.3.11",
    "dwmc": "观斗山隧道",
    "dwbh": 11,
    "dwinfo": "观斗山隧道入城方向出口",
    "dwzb": "104.641112|28.814636",
    "dwms": "观斗山隧道入城方向出口，识别自观斗山隧道入城排放黑烟车辆",
    "dwzt": "正常"
  },
  {
    "id": 12,
    "dwip": "172.16.3.12",
    "dwmc": "大麦坝",
    "dwbh": 12,
    "dwinfo": "吊黄楼入城方向",
    "dwzb": "104.63116|28.804407",
    "dwms": "大麦坝入城方向，识别省道206入城排放黑烟车辆",
    "dwzt": "正常"
  },
  {
    "id": 13,
    "dwip": "172.16.3.13",
    "dwmc": "外江路",
    "dwbh": 13,
    "dwinfo": "外江路往高铁站方向",
    "dwzb": "104.623547|28.74798",
    "dwms": "外江路往高铁站方向，识别中坝大桥往高铁站排放黑烟车辆",
    "dwzt": "正常"
  }
];

///下拉刷新、上拉加载数据
Header getHeader() {
  return ClassicalHeader(
    // bgColor: Colors.green,
    //textColor: Colors.black,
    refreshText: "下拉刷新",
    refreshReadyText: "释放立即刷新",
    refreshingText: "正在刷新...",
    refreshedText: "刷新完成",
    refreshFailedText: "刷新失败",
    infoText: "上次更新: %T",
    //infoColor: Colors.white,
  );
}

Footer getFooter() {
  return ClassicalFooter(
    // bgColor: Colors.green,
    // textColor: Colors.white,
    loadText: "上拉加载",
    loadReadyText: "释放立即加载",
    loadingText: "正在加载...",
    loadedText: "加载完成",
    loadFailedText: "加载失败",
    noMoreText: "没有更多了",
    infoText: "上次更新: %T",
    //showInfo: true,      //显示额外信息(默认为时间)
    //enableInfiniteLoad: false, //是否开启无限加载
  );
}

//去除 mediaUrl 的前导斜杠
String getMediaUrl(String mediaUrl) {
  while ('/' == mediaUrl[0]) {
    mediaUrl = mediaUrl.substring(1);
  }
  return serviceUrl_ybqx_media + mediaUrl;
}

//通过点位ip获取点位名称
String getDwmc(String _dwip) {
  _dwip = _dwip.trim();
  for (var item in listDwinfoGetList2) {
    if (_dwip == item["dwip"].trim()) {
      return item["dwmc"].trim();
    }
  }
  return '';
}

// 通过名称获取点位ip
Future getDwip(String _dwmc) async {
  _dwmc = _dwmc.trim();
  for (var item in listDwinfoGetList2) {
    if (_dwmc == item['dwmc'].trim()) {
      return item['dwip'].trim();
    }
  }
  return '';
}
