危险作业bug修改0522
parent
76f30a7475
commit
eeeee97244
|
|
@ -5,23 +5,24 @@ export 'modules/hidden_danger_api.dart';
|
||||||
export 'modules/special_work_api.dart';
|
export 'modules/special_work_api.dart';
|
||||||
|
|
||||||
class ApiService {
|
class ApiService {
|
||||||
|
|
||||||
|
/// 是否是港务局环境
|
||||||
|
static final bool isGWJProduct = true;
|
||||||
/// 是否正式环境
|
/// 是否正式环境
|
||||||
static final bool isProduct = true;
|
static final bool isProduct = true;
|
||||||
|
|
||||||
/// 登录及其他管理后台接口
|
/// 登录及其他管理后台接口
|
||||||
// static final String basePath = "https://skqhdg.porthebei.com:9007";
|
static final String basePath = isGWJProduct ? "https://skqhdg.porthebei.com:9007" :
|
||||||
static final String basePath =
|
|
||||||
isProduct
|
isProduct
|
||||||
? "https://gbs-gateway.qhdsafety.com"
|
? "https://gbs-gateway.qhdsafety.com"
|
||||||
: "http://192.168.20.100:30140";
|
: 'http://192.168.198.8:30140';
|
||||||
|
|
||||||
|
|
||||||
/// 图片文件服务
|
/// 图片文件服务
|
||||||
static final String baseImgPath =
|
static final String baseImgPath = isGWJProduct ? "https://skqhdg.porthebei.com:9004/file/uploadFiles2/" :
|
||||||
isProduct
|
isProduct
|
||||||
? "https://jpfz.qhdsafety.com/gbsFileTest/"
|
? "https://jpfz.qhdsafety.com/gbsFileTest/"
|
||||||
: "http://192.168.20.240:9787/mnt/"; //内网图片地址
|
: "https://skqhdg.porthebei.com:9004/file/uploadFiles2/"; //内网图片地址
|
||||||
// static final String baseImgPath = "https://skqhdg.porthebei.com:9004/file/uploadFiles2/";
|
|
||||||
|
|
||||||
|
|
||||||
static const publicKey =
|
static const publicKey =
|
||||||
|
|
|
||||||
|
|
@ -1112,13 +1112,46 @@ class HomePageState extends RouteAwareState<HomePage>
|
||||||
"pageIndex": '1',
|
"pageIndex": '1',
|
||||||
"pageSize": '999',
|
"pageSize": '999',
|
||||||
};
|
};
|
||||||
final result = await TodoApi.getTodoList(data);
|
Future<Map> safeRequest(
|
||||||
final specialWork = await SpecialWorkApi.specialWorkTaskLogTotalCount();
|
Future request,
|
||||||
final keyTasksWork = await KeyTasksApi.getKeyTasksToDoCount(SessionService.instance.accountId??'');
|
Map fallback,
|
||||||
|
String apiName,
|
||||||
|
) async {
|
||||||
|
try {
|
||||||
|
final response = await request;
|
||||||
|
if (response is Map) return response;
|
||||||
|
} catch (e) {
|
||||||
|
debugPrint('$apiName request failed: $e');
|
||||||
|
}
|
||||||
|
return fallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
final responses = await Future.wait([
|
||||||
|
safeRequest(TodoApi.getTodoList(data), {
|
||||||
|
"success": false,
|
||||||
|
"data": [],
|
||||||
|
"totalCount": 0,
|
||||||
|
}, 'TodoApi.getTodoList'),
|
||||||
|
safeRequest(
|
||||||
|
SpecialWorkApi.specialWorkTaskLogTotalCount(),
|
||||||
|
{"success": false, "data": []},
|
||||||
|
'SpecialWorkApi.specialWorkTaskLogTotalCount',
|
||||||
|
),
|
||||||
|
safeRequest(
|
||||||
|
KeyTasksApi.getKeyTasksToDoCount(
|
||||||
|
SessionService.instance.accountId ?? '',
|
||||||
|
),
|
||||||
|
{"success": false, "data": {}},
|
||||||
|
'KeyTasksApi.getKeyTasksToDoCount',
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
final result = responses[0];
|
||||||
|
final specialWork = responses[1];
|
||||||
|
final keyTasksWork = responses[2];
|
||||||
int specialWorkNum = 0;
|
int specialWorkNum = 0;
|
||||||
int keyTasksNum = 0;
|
int keyTasksNum = 0;
|
||||||
try {
|
try {
|
||||||
if (specialWork['success']) {
|
if (FormUtils.hasValue(specialWork, 'success') && specialWork['success']) {
|
||||||
List<dynamic> specialWorkList = specialWork['data'] ?? [];
|
List<dynamic> specialWorkList = specialWork['data'] ?? [];
|
||||||
for (var item in specialWorkList) {
|
for (var item in specialWorkList) {
|
||||||
if (item is Map) {
|
if (item is Map) {
|
||||||
|
|
@ -1127,11 +1160,14 @@ class HomePageState extends RouteAwareState<HomePage>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (keyTasksWork['success']) {
|
if (FormUtils.hasValue(keyTasksWork, 'success') && keyTasksWork['success']) {
|
||||||
int zdzysqCount = int.parse(keyTasksWork['data']['zdzysqCount']??0);
|
final keyTasksData = keyTasksWork['data'];
|
||||||
int bjcrqrCount = int.parse(keyTasksWork['data']['bjcrqrCount']??0);
|
if (keyTasksData is Map) {
|
||||||
int yhdzgCount = int.parse(keyTasksWork['data']['yhdzgCount']??0);
|
int zdzysqCount = int.tryParse('${keyTasksData['zdzysqCount']}') ?? 0;
|
||||||
keyTasksNum = bjcrqrCount+yhdzgCount+zdzysqCount;
|
int bjcrqrCount = int.tryParse('${keyTasksData['bjcrqrCount']}') ?? 0;
|
||||||
|
int yhdzgCount = int.tryParse('${keyTasksData['yhdzgCount']}') ?? 0;
|
||||||
|
keyTasksNum = bjcrqrCount + yhdzgCount + zdzysqCount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
setState(() {
|
setState(() {
|
||||||
for (var section in buttonInfos) {
|
for (var section in buttonInfos) {
|
||||||
|
|
@ -1141,16 +1177,16 @@ class HomePageState extends RouteAwareState<HomePage>
|
||||||
if (section['title'] == '重点作业') {
|
if (section['title'] == '重点作业') {
|
||||||
section['unreadCount'] = keyTasksNum;
|
section['unreadCount'] = keyTasksNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (e) {}
|
} catch (e) {
|
||||||
|
debugPrint('_getToDoWorkList parse failed: $e');
|
||||||
|
}
|
||||||
if (result['success']) {
|
if (result['success']) {
|
||||||
setState(() {
|
setState(() {
|
||||||
workStats['total'] = result['totalCount'];
|
workStats['total'] = result['totalCount'];
|
||||||
checkLists = result['data'];
|
checkLists = result['data'];
|
||||||
// checkLists = result['data'];
|
// checkLists = result['data'];
|
||||||
int m = checkLists.length;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue