Commit f8c76167 by 吴春元

考试系统

监察记录
parent eef72d47
......@@ -11,7 +11,8 @@ import 'package:special_equipment_flutter/ui/login/login_page.dart';
import 'package:special_equipment_flutter/ui/main/tab_home_page.dart';
import 'package:special_equipment_flutter/ui/main/unit/equipment_personnel_page.dart';
import 'package:special_equipment_flutter/ui/overseer/equipment_list_page.dart';
import 'package:special_equipment_flutter/ui/overseer/overseer_list_page.dart';
import 'package:special_equipment_flutter/ui/overseer/overseer_history_details_page.dart';
import 'package:special_equipment_flutter/ui/overseer/overseer_history_list_page.dart';
import 'package:special_equipment_flutter/ui/overseer/overseer_settings_page.dart';
import 'package:special_equipment_flutter/ui/overseer/unit_list_page.dart';
import 'package:special_equipment_flutter/ui/register/address_page.dart';
......@@ -129,7 +130,7 @@ class RouteString {
static const String EQUIPMENT_LIST_PAGE = "/EquipmentListPage";
///监察人-考核列表
static const String OVERSEER_LIST_PAGE = "/OverseerListPage";
static const String OVERSEER_HISTORY_LIST_PAGE = "/OverseerHistoryListPage";
///测试练习结果页面
static const String TEST_RESULT_PAGE = "/TestResultPage";
......@@ -137,6 +138,10 @@ class RouteString {
///测试练习设置
static const String TEST_SETTING_PAGE = "/TestSettingPage";
///监察记录
static const String OVERSEER_HISTROY_DETAILS_PAGE =
"/OverseerHistroyDetailsPage";
static final routes = [
///登录
GetPage(name: LOGIN, page: () => const LoginPage()),
......@@ -226,7 +231,9 @@ class RouteString {
GetPage(name: EQUIPMENT_LIST_PAGE, page: () => EquipmentListPage()),
///考核列表
GetPage(name: OVERSEER_LIST_PAGE, page: () => OverseerListPage()),
GetPage(
name: OVERSEER_HISTORY_LIST_PAGE,
page: () => OverseerHistoryListPage()),
///测试练习结果
GetPage(name: TEST_RESULT_PAGE, page: () => TestResultPage()),
......@@ -234,6 +241,11 @@ class RouteString {
///测试练习设置
GetPage(name: TEST_SETTING_PAGE, page: () => TestSettingPage()),
///监察记录
GetPage(
name: OVERSEER_HISTROY_DETAILS_PAGE,
page: () => OverseerHistroyDetailsPage()),
// GetPage(
// name: "/shop",
// page: () => const ShopPage(),
......
......@@ -8,9 +8,10 @@ class Api {
///演示 ip
// static String URL = "http://47.92.138.92:8009/";
static String URL = "http://192.168.19.164:8087/";
// static String URL = "http://192.168.19.165:2212/";
// static String URL = "http://192.168.19.164:8087/";
static String URL = "http://192.168.19.165:2212/";
static String START_URL = "special/a/",
END_URL = "__ajax=true&mobileLogin=true";
......@@ -223,6 +224,21 @@ class Api {
/// 考核 是否显示答案
static String SHOW_ANSWER = "${URL + START_URL}sys/dict/showAnswer";
/// 监察记录 列表
static String EXAM_SETUP_GET_PAPERS =
"${URL + START_URL}exam/examSetup/getPapers";
/// 获取详情基本信息
static String GET_PAPERS_DETAIL =
"${URL + START_URL}exam/examSetup/getPapersDetail";
/// 监察记录 详情
static String EXAM_PERSON_DATA =
"${URL + START_URL}exam/examPerson/getDetail";
/// 监察记录 删除
static String EXAM_SETUP_DELETE = "${URL + START_URL}exam/examSetup/delete";
/// 获取考核信息
// static String EXAMINE_PERSON = "${URL + START_URL}/exam/examPerson/checkHaveExam";
}
......@@ -26,6 +26,9 @@ import 'package:special_equipment_flutter/model/exam/exam_unit_list.dart';
import 'package:special_equipment_flutter/model/exam/examine_person_bo.dart';
import 'package:special_equipment_flutter/model/exam/examine_questions_bo.dart';
import 'package:special_equipment_flutter/model/exam/find_question_num.dart';
import 'package:special_equipment_flutter/model/exam/overseer_history_details_bo.dart';
import 'package:special_equipment_flutter/model/exam/overseer_history_information_bo.dart';
import 'package:special_equipment_flutter/model/exam/overseer_history_list_bo.dart';
import 'package:special_equipment_flutter/model/exam/show_answer_bo.dart';
import 'package:special_equipment_flutter/model/exam/test_questions_bo.dart';
import 'package:special_equipment_flutter/model/exam/unit_person_list_bo.dart';
......@@ -1563,6 +1566,114 @@ class HttpUtils {
}
}
///监察记录 详情基本信息
static Future getPapers2(
BuildContext context, String inspectorsId, String setup) async {
Map<String, dynamic> params = {
"inspectorsId": inspectorsId,
"setup": setup
};
var response = await NetUtils.get(
context,
'${Api.GET_PAPERS_DETAIL};JSESSIONID=${StorageUtil.getInstance().getJsessionId()}',
false,
params);
try {
BaseModel entity = BaseModel.fromJson(response);
Map<String, dynamic> resultData = entity.body;
OverseerHistoryInformationBo mOverseerHistoryListBo =
OverseerHistoryInformationBo.fromJson(resultData);
if (entity.errorCode == "-1") {
return mOverseerHistoryListBo;
} else {
ToastUtils.showCenter(entity.msg!);
return;
}
} catch (e) {
log(e.toString());
return {"message": e.toString()};
}
}
///监察记录 列表
static Future getPapers(BuildContext context, String inspectorsId, int pageNo,
int pageSize) async {
Map<String, dynamic> params = {
"inspectorsId": inspectorsId,
"pageNo": pageNo,
"pageSize": pageSize
};
var response = await NetUtils.get(
context,
'${Api.EXAM_SETUP_GET_PAPERS};JSESSIONID=${StorageUtil.getInstance().getJsessionId()}',
false,
params);
try {
BaseModel entity = BaseModel.fromJson(response);
Map<String, dynamic> resultData = entity.body;
OverseerHistoryListBo mOverseerHistoryListBo =
OverseerHistoryListBo.fromJson(resultData);
if (entity.errorCode == "-1") {
return mOverseerHistoryListBo;
} else {
ToastUtils.showCenter(entity.msg!);
return;
}
} catch (e) {
log(e.toString());
return {"message": e.toString()};
}
}
///监察记录 详情
static Future getExamPersonData(BuildContext context, String setup) async {
Map<String, dynamic> params = {"setup": setup};
var response = await NetUtils.get(
context,
'${Api.EXAM_PERSON_DATA};JSESSIONID=${StorageUtil.getInstance().getJsessionId()}',
false,
params);
try {
BaseModel entity = BaseModel.fromJson(response);
Map<String, dynamic> resultData = entity.body;
OverseerHistoryDetailsBo mOverseerHistoryDetailsBo =
OverseerHistoryDetailsBo.fromJson(resultData);
if (entity.errorCode == "-1") {
return mOverseerHistoryDetailsBo;
} else {
ToastUtils.showCenter(entity.msg!);
return;
}
} catch (e) {
log(e.toString());
return {"message": e.toString()};
}
}
///监察记录 删除
static Future getExamSetupDelete(BuildContext context, String id) async {
Map<String, dynamic> params = {"id": id};
var response = await NetUtils.get(
context,
'${Api.EXAM_SETUP_DELETE};JSESSIONID=${StorageUtil.getInstance().getJsessionId()}',
false,
params);
try {
BaseModel entity = BaseModel.fromJson(response);
Map<String, dynamic> resultData = entity.body;
ShowAnswerBo mShowAnswerBo = ShowAnswerBo.fromJson(resultData);
if (entity.errorCode == "-1") {
return mShowAnswerBo;
} else {
ToastUtils.showCenter(entity.msg!);
return;
}
} catch (e) {
log(e.toString());
return {"message": e.toString()};
}
}
// HttpUtils.getList(context, _page, 20).then((value) {
// ListBo listBo = value;
// print(listBo);
......
......@@ -7,6 +7,7 @@ class ExamSettingSubmitBo {
this.aqzgIds,
this.aqyIds,
this.type,
this.unitId,
});
ExamSettingSubmitBo.fromJson(dynamic json) {
......@@ -17,6 +18,7 @@ class ExamSettingSubmitBo {
aqzgIds = json['aqzgIds'] != null ? json['aqzgIds'].cast<String>() : [];
aqyIds = json['aqyIds'] != null ? json['aqyIds'].cast<String>() : [];
type = json['type'];
unitId = json['unitId'];
}
int? aqzgPdNum;
......@@ -26,6 +28,7 @@ class ExamSettingSubmitBo {
List<String>? aqzgIds;
List<String>? aqyIds;
String? type;
String? unitId;
ExamSettingSubmitBo copyWith({
int? aqzgPdNum,
......@@ -35,6 +38,7 @@ class ExamSettingSubmitBo {
List<String>? aqzgIds,
List<String>? aqyIds,
String? type,
String? unitId,
}) =>
ExamSettingSubmitBo(
aqzgPdNum: aqzgPdNum ?? this.aqzgPdNum,
......@@ -44,6 +48,7 @@ class ExamSettingSubmitBo {
aqzgIds: aqzgIds ?? this.aqzgIds,
aqyIds: aqyIds ?? this.aqyIds,
type: type ?? this.type,
unitId: unitId ?? this.unitId,
);
Map<String, dynamic> toJson() {
......@@ -55,6 +60,7 @@ class ExamSettingSubmitBo {
map['aqzgIds'] = aqzgIds;
map['aqyIds'] = aqyIds;
map['type'] = type;
map['unitId'] = unitId;
return map;
}
}
class OverseerHistoryDetailsBo {
OverseerHistoryDetailsBo({
this.data,
});
OverseerHistoryDetailsBo.fromJson(dynamic json) {
if (json['data'] != null) {
data = [];
json['data'].forEach((v) {
data?.add(DataHistoryDetails.fromJson(v));
});
}
}
List<DataHistoryDetails>? data;
OverseerHistoryDetailsBo copyWith({
List<DataHistoryDetails>? data,
}) =>
OverseerHistoryDetailsBo(
data: data ?? this.data,
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
if (data != null) {
map['data'] = data?.map((v) => v.toJson()).toList();
}
return map;
}
}
class DataHistoryDetails {
DataHistoryDetails({
this.id,
this.inspectors,
this.user,
this.examDate,
this.pdNum,
this.xzNum,
this.type,
this.positionType,
this.setup,
this.unit,
this.adopt,
this.score,
});
DataHistoryDetails.fromJson(dynamic json) {
id = json['id'];
inspectors = json['inspectors'] != null
? Inspectors.fromJson(json['inspectors'])
: null;
user = json['user'] != null ? User.fromJson(json['user']) : null;
examDate = json['examDate'];
pdNum = json['pdNum'];
xzNum = json['xzNum'];
type = json['type'] != null ? Type.fromJson(json['type']) : null;
positionType = json['positionType'];
setup = json['setup'];
unit = json['unit'] != null ? Unit.fromJson(json['unit']) : null;
adopt = json['adopt'];
score = json['score'];
}
String? id;
Inspectors? inspectors;
User? user;
String? examDate;
num? pdNum;
num? xzNum;
Type? type;
String? positionType;
String? setup;
Unit? unit;
String? adopt;
num? score;
DataHistoryDetails copyWith({
String? id,
Inspectors? inspectors,
User? user,
String? examDate,
num? pdNum,
num? xzNum,
Type? type,
String? positionType,
String? setup,
Unit? unit,
String? adopt,
num? score,
}) =>
DataHistoryDetails(
id: id ?? this.id,
inspectors: inspectors ?? this.inspectors,
user: user ?? this.user,
examDate: examDate ?? this.examDate,
pdNum: pdNum ?? this.pdNum,
xzNum: xzNum ?? this.xzNum,
type: type ?? this.type,
positionType: positionType ?? this.positionType,
setup: setup ?? this.setup,
unit: unit ?? this.unit,
adopt: adopt ?? this.adopt,
score: score ?? this.score,
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = id;
if (inspectors != null) {
map['inspectors'] = inspectors?.toJson();
}
if (user != null) {
map['user'] = user?.toJson();
}
map['examDate'] = examDate;
map['pdNum'] = pdNum;
map['xzNum'] = xzNum;
if (type != null) {
map['type'] = type?.toJson();
}
map['positionType'] = positionType;
map['setup'] = setup;
if (unit != null) {
map['unit'] = unit?.toJson();
}
map['adopt'] = adopt;
map['score'] = score;
return map;
}
}
class Unit {
Unit({
this.id,
this.name,
this.sort,
this.hasChildren,
this.parentId,
});
Unit.fromJson(dynamic json) {
id = json['id'];
name = json['name'];
sort = json['sort'];
hasChildren = json['hasChildren'];
parentId = json['parentId'];
}
String? id;
String? name;
num? sort;
bool? hasChildren;
String? parentId;
Unit copyWith({
String? id,
String? name,
num? sort,
bool? hasChildren,
String? parentId,
}) =>
Unit(
id: id ?? this.id,
name: name ?? this.name,
sort: sort ?? this.sort,
hasChildren: hasChildren ?? this.hasChildren,
parentId: parentId ?? this.parentId,
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = id;
map['name'] = name;
map['sort'] = sort;
map['hasChildren'] = hasChildren;
map['parentId'] = parentId;
return map;
}
}
class Type {
Type({
this.id,
this.name,
});
Type.fromJson(dynamic json) {
id = json['id'];
name = json['name'];
}
String? id;
String? name;
Type copyWith({
String? id,
String? name,
}) =>
Type(
id: id ?? this.id,
name: name ?? this.name,
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = id;
map['name'] = name;
return map;
}
}
class User {
User({
this.id,
this.name,
this.loginFlag,
this.admin,
this.roleNames,
});
User.fromJson(dynamic json) {
id = json['id'];
name = json['name'];
loginFlag = json['loginFlag'];
admin = json['admin'];
roleNames = json['roleNames'];
}
String? id;
String? name;
String? loginFlag;
bool? admin;
String? roleNames;
User copyWith({
String? id,
String? name,
String? loginFlag,
bool? admin,
String? roleNames,
}) =>
User(
id: id ?? this.id,
name: name ?? this.name,
loginFlag: loginFlag ?? this.loginFlag,
admin: admin ?? this.admin,
roleNames: roleNames ?? this.roleNames,
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = id;
map['name'] = name;
map['loginFlag'] = loginFlag;
map['admin'] = admin;
map['roleNames'] = roleNames;
return map;
}
}
class Inspectors {
Inspectors({
this.id,
this.name,
this.loginFlag,
this.admin,
this.roleNames,
});
Inspectors.fromJson(dynamic json) {
id = json['id'];
name = json['name'];
loginFlag = json['loginFlag'];
admin = json['admin'];
roleNames = json['roleNames'];
}
String? id;
String? name;
String? loginFlag;
bool? admin;
String? roleNames;
Inspectors copyWith({
String? id,
String? name,
String? loginFlag,
bool? admin,
String? roleNames,
}) =>
Inspectors(
id: id ?? this.id,
name: name ?? this.name,
loginFlag: loginFlag ?? this.loginFlag,
admin: admin ?? this.admin,
roleNames: roleNames ?? this.roleNames,
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = id;
map['name'] = name;
map['loginFlag'] = loginFlag;
map['admin'] = admin;
map['roleNames'] = roleNames;
return map;
}
}
class OverseerHistoryInformationBo {
OverseerHistoryInformationBo({
this.data,
});
OverseerHistoryInformationBo.fromJson(dynamic json) {
data = json['data'] != null ? Data.fromJson(json['data']) : null;
}
Data? data;
OverseerHistoryInformationBo copyWith({
Data? data,
}) =>
OverseerHistoryInformationBo(
data: data ?? this.data,
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
if (data != null) {
map['data'] = data?.toJson();
}
return map;
}
}
class Data {
Data({
this.officeName,
this.incomplete,
this.officeId,
this.typeName,
this.count,
this.typeId,
this.id,
this.state,
this.complete,
this.createDate,
});
Data.fromJson(dynamic json) {
officeName = json['officeName'];
incomplete = json['incomplete'];
officeId = json['officeId'];
typeName = json['typeName'];
count = json['count'];
typeId = json['typeId'];
id = json['id'];
state = json['state'];
complete = json['complete'];
createDate = json['createDate'];
}
String? officeName;
int? incomplete;
String? officeId;
String? typeName;
int? count;
String? typeId;
String? id;
String? state;
int? complete;
int? createDate;
Data copyWith({
String? officeName,
int? incomplete,
String? officeId,
String? typeName,
int? count,
String? typeId,
String? id,
String? state,
int? complete,
int? createDate,
}) =>
Data(
officeName: officeName ?? this.officeName,
incomplete: incomplete ?? this.incomplete,
officeId: officeId ?? this.officeId,
typeName: typeName ?? this.typeName,
count: count ?? this.count,
typeId: typeId ?? this.typeId,
id: id ?? this.id,
state: state ?? this.state,
complete: complete ?? this.complete,
createDate: createDate ?? this.createDate,
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['officeName'] = officeName;
map['incomplete'] = incomplete;
map['officeId'] = officeId;
map['typeName'] = typeName;
map['count'] = count;
map['typeId'] = typeId;
map['id'] = id;
map['state'] = state;
map['complete'] = complete;
map['createDate'] = createDate;
return map;
}
}
class OverseerHistoryListBo {
OverseerHistoryListBo({
this.data,
this.count,
});
OverseerHistoryListBo.fromJson(dynamic json) {
if (json['data'] != null) {
data = [];
json['data'].forEach((v) {
data?.add(HistoryListData.fromJson(v));
});
}
count = json['count'];
}
List<HistoryListData>? data;
int? count;
OverseerHistoryListBo copyWith({
List<HistoryListData>? data,
int? count,
}) =>
OverseerHistoryListBo(
data: data ?? this.data,
count: count ?? this.count,
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
if (data != null) {
map['data'] = data?.map((v) => v.toJson()).toList();
}
map['count'] = count;
return map;
}
}
class HistoryListData {
HistoryListData({
this.officeName,
this.incomplete,
this.officeId,
this.typeName,
this.count,
this.typeId,
this.id,
this.state,
this.complete,
this.createDate,
});
HistoryListData.fromJson(dynamic json) {
officeName = json['officeName'];
incomplete = json['incomplete'];
officeId = json['officeId'];
typeName = json['typeName'];
count = json['count'];
typeId = json['typeId'];
id = json['id'];
state = json['state'];
complete = json['complete'];
createDate = json['createDate'];
}
String? officeName;
int? incomplete;
String? officeId;
String? typeName;
int? count;
String? typeId;
String? id;
String? state;
int? complete;
int? createDate;
HistoryListData copyWith({
String? officeName,
int? incomplete,
String? officeId,
String? typeName,
int? count,
String? typeId,
String? id,
String? state,
int? complete,
int? createDate,
}) =>
HistoryListData(
officeName: officeName ?? this.officeName,
incomplete: incomplete ?? this.incomplete,
officeId: officeId ?? this.officeId,
typeName: typeName ?? this.typeName,
count: count ?? this.count,
typeId: typeId ?? this.typeId,
id: id ?? this.id,
state: state ?? this.state,
complete: complete ?? this.complete,
createDate: createDate ?? this.createDate,
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['officeName'] = officeName;
map['incomplete'] = incomplete;
map['officeId'] = officeId;
map['typeName'] = typeName;
map['count'] = count;
map['typeId'] = typeId;
map['id'] = id;
map['state'] = state;
map['complete'] = complete;
map['createDate'] = createDate;
return map;
}
}
......@@ -10,7 +10,7 @@ class StandingConfig {
static const String SAFETY_OFFICER = "安全员";
static const String SAFETY_DIRECTOR = "安全总监";
static const String PERSON_CHARGE = "主要负责人";
static const String INSPECTOR = "监察人员";
static const String INSPECTOR = "安全监察人员";
static const String SY_DEVICE = '客运索道,电梯,起重机械,锅炉,压力管道,压力容器,大型游乐设施,场车,气瓶';
}
......
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:special_equipment_flutter/common/color_const.dart';
import 'package:special_equipment_flutter/common/edgeInsets_const.dart';
import 'package:special_equipment_flutter/dio/http_utils.dart';
import 'package:special_equipment_flutter/model/day_control_list_sy_bo.dart';
import 'package:special_equipment_flutter/widgets/app_bar/custom_app_bar.dart';
import 'package:special_equipment_flutter/widgets/divider_custom.dart';
///考核历史页面
class ExamHistoryPage extends StatefulWidget {
......@@ -9,8 +16,149 @@ class ExamHistoryPage extends StatefulWidget {
}
class _ExamHistoryPageState extends State<ExamHistoryPage> {
final EasyRefreshController _controller = EasyRefreshController();
List<TaskDayList> list = [];
@override
void initState() {
super.initState();
// getData();
}
void getData() {
HttpUtils.getOverseerList(context, '0', '', '').then((value) {
DayControlListSyBo listBo = value;
if (mounted) {
setState(() {
var taskDayList = listBo.taskDayList;
list.clear();
list.addAll(taskDayList!);
_controller.finishRefresh();
});
}
});
}
@override
Widget build(BuildContext context) {
return Container();
return Scaffold(
appBar: AppBarCustom(text: '考核记录', height: 50),
backgroundColor: Colors.grey[100],
body: Column(
children: [
Expanded(
flex: 1,
child: EasyRefresh(
firstRefresh: true,
enableControlFinishRefresh: true,
// enableControlFinishLoad: true,
// firstRefreshWidget: const FirstRefreshWidget(),
// emptyWidget: list.isEmpty
// ? EmptyImgWidget(
// title: '暂无数据,点击刷新',
// onTap: () {
// getData();
// })
// : null,
controller: _controller,
onRefresh: () async {
// page = 1;
// getData();
},
// onLoad: () async {
// page++;
// getList();
// },
child: buildBody(),
)),
],
),
);
}
Column buildBody() {
return Column(
children: [
//文章列表
ListView.separated(
shrinkWrap: true,
padding: const EdgeInsets.symmetric(
horizontal: EdgeInsetsConst.padding_horizontal),
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (BuildContext context, int index) {
return buildItem(index, context);
},
itemCount: 4,
separatorBuilder: (BuildContext context, int index) {
return const SizedBox(
height: 0,
);
},
),
],
);
}
InkWell buildItem(int index, BuildContext context) {
return InkWell(
onTap: () {
// Get.toNamed(RouteString.DAY_INSPECT_SUBMIT_SY,
// arguments: {'argsData': widget.args, 'listBo': list(index)})
// ?.then((value) {
// if (value != null && value) {
// getData();
// }
// });
},
child: buildCard(context, index),
);
}
Card buildCard(BuildContext context, int index) {
return Card(
elevation: 3,
margin: const EdgeInsets.only(left: 0, right: 0, top: 15, bottom: 0),
color: Colors.white,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(5)),
),
child: Container(
padding:
const EdgeInsets.only(left: 10, right: 10, top: 10, bottom: 10),
child: Column(
children: <Widget>[
const Column(
children: [
Text('山西盈中科技有限公司山西盈中科技有限公司',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18,
color: Colors.black87)),
Text('2024-05-21',
style: TextStyle(fontSize: 14, color: Colors.grey)),
],
),
///分割线
DividerCustom(Colors.grey[300], 8, 8, 0, 0),
Container(
margin:
const EdgeInsets.only(left: 8, top: 0, right: 0, bottom: 0),
child: const Row(children: [
Text('设备类型:',
style: TextStyle(
fontSize: 14,
color: ColorConst.blueColor,
fontWeight: FontWeight.bold)),
Text('电梯,锅炉', style: TextStyle()),
]),
),
],
),
),
);
}
}
......@@ -4,19 +4,19 @@ import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:event_bus/event_bus.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';
import 'package:package_info/package_info.dart';
import 'package:special_equipment_flutter/common/edgeInsets_const.dart';
import 'package:special_equipment_flutter/common/route_string.dart';
import 'package:special_equipment_flutter/dio/http_utils.dart';
import 'package:special_equipment_flutter/model/check_update.dart';
import 'package:special_equipment_flutter/model/count_bo.dart';
import 'package:special_equipment_flutter/model/echart_bo.dart';
import 'package:special_equipment_flutter/model/exam/eventbus_push.dart';
import 'package:special_equipment_flutter/model/exam/examine_person_bo.dart';
import 'package:special_equipment_flutter/model/exam/overseer_history_list_bo.dart';
import 'package:special_equipment_flutter/model/find_charge_list_bo.dart';
import 'package:special_equipment_flutter/model/find_count_bo.dart';
import 'package:special_equipment_flutter/model/office_device.dart';
......@@ -30,10 +30,12 @@ import 'package:special_equipment_flutter/ui/main/unit/unit_grid_list.dart';
import 'package:special_equipment_flutter/utils/eventbus_utils.dart';
import 'package:special_equipment_flutter/utils/size_config.dart';
import 'package:special_equipment_flutter/utils/storage_util.dart';
import 'package:special_equipment_flutter/utils/time_util.dart';
import 'package:special_equipment_flutter/utils/toast_utils.dart';
import 'package:special_equipment_flutter/widgets/custom_button.dart';
import 'package:special_equipment_flutter/widgets/divider_custom.dart';
import 'package:special_equipment_flutter/widgets/easy_refresh_header1.dart';
import 'package:special_equipment_flutter/widgets/emptyI_img_widget.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../common/color_const.dart';
......@@ -78,14 +80,15 @@ class _HomePageState extends State<HomePage>
List<OfficeDtoLists>? deviceList = [];
FindChargeListBo? chargeBo = FindChargeListBo();
List<CountData>? findCountList = [];
ExaminePersonBo? mExaminePersonBo;
ExaminePersonBo? mExaminePersonBo = ExaminePersonBo();
OverseerHistoryListBo? mOverseerHistoryListBo = OverseerHistoryListBo();
List<HistoryListData>? mHistoryListData = [];
//声明,后面需要销毁
StreamSubscription? event;
@override
void initState() {
getQuestionsPerson();
super.initState();
///获取版本
......@@ -115,6 +118,13 @@ class _HomePageState extends State<HomePage>
getCount();
getGirdviewData();
///监察人身份获取
if (isInspectorRoles(StorageUtil.getInstance().getRoleNames())!) {
getOverseerHistoryList();
} else {
getQuestionsPerson();
}
_controller = AnimationController(
duration: const Duration(seconds: 2),
vsync: this,
......@@ -128,7 +138,6 @@ class _HomePageState extends State<HomePage>
//通知监听
event = EventBusUtils.getInstance()?.on().listen((event) {
if (event.toString() == "1") {
//do something here
getQuestionsPerson();
}
});
......@@ -136,6 +145,19 @@ class _HomePageState extends State<HomePage>
getDeviceData();
}
///获取监察记录列表
void getOverseerHistoryList() {
HttpUtils.getPapers(context, StorageUtil.getInstance().getUserId(), 1, 10)
.then((value) {
if (mounted) {
setState(() {
mOverseerHistoryListBo = value;
mHistoryListData = mOverseerHistoryListBo!.data;
});
}
});
}
///获取考核试卷
void getQuestionsPerson() {
HttpUtils.getExaminePerson(context).then((value) {
......@@ -296,6 +318,13 @@ class _HomePageState extends State<HomePage>
setState(() {
getCount();
getDeviceData();
///监察人身份获取
if (isInspectorRoles(StorageUtil.getInstance().getRoleNames())!) {
getOverseerHistoryList();
} else {
getQuestionsPerson();
}
});
},
child: CustomScrollView(
......@@ -358,118 +387,19 @@ class _HomePageState extends State<HomePage>
///监察人员
] else if (isInspectorRoles(
StorageUtil.getInstance().getRoleNames())!) ...[
SliverToBoxAdapter(
child: Container(
margin: const EdgeInsets.only(left: 35, top: 20),
child: InkWell(
splashColor: ColorConst.green1Color,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: SizeConfig.isIpad()! ? 30 : 5),
Image.asset(
'assets/examine/examine_icon.png',
width: SizeConfig.isIpad()! ? 150 : 50,
height: SizeConfig.isIpad()! ? 150 : 50,
),
Container(
height: SizeConfig.isIpad()! ? 40 : 20,
margin: const EdgeInsets.only(top: 3),
child: Text(
'考核设置',
style: TextStyle(
fontSize: SizeConfig.isIpad()! ? 25 : 13,
color: Colors.black54),
),
)
],
),
onTap: () {
Get.toNamed(RouteString.OVERSEER_SETTINGS_PAGE,
arguments: {
// 'type': '1',
// 'tabIndex': 0,
// 'titleName': '考核'
})?.then((value) {
if (value != null && value) {}
});
},
),
),
)
buildOverseerLable(),
] else ...[
SliverToBoxAdapter(
child: Container(
margin: const EdgeInsets.only(top: 10, left: 0, right: 0),
padding: const EdgeInsets.all(10),
decoration: const BoxDecoration(
// color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(0)),
),
child: Column(
children: [
Row(
children: [
Image.asset(
'assets/examine/check_title_icon.png',
width: SizeConfig.isIpad()! ? 35 : 18,
height: SizeConfig.isIpad()! ? 35 : 18,
),
// Icon(
// Icons.equalizer,
// color: ColorConst.blueColor,
// size: SizeConfig.isIpad()! ? 35 : 18,
// ),
const SizedBox(width: 5),
Text(
'检查整改',
style: TextStyle(
color: Colors.black54,
fontSize: SizeConfig.isIpad()! ? 25 : 14,
fontWeight: FontWeight.bold),
),
],
),
],
))),
buildSliverToBoxAdapter(
'assets/examine/check_title_icon.png', '检查整改'),
///日管控、周排查、月调度布局
buildSliverDayWeekMonth(),
///日管控整改、周排查整改、月调度整改布局
buildSliverRiskDayWeekMonth(),
//TODO
SliverToBoxAdapter(
child: Container(
margin: const EdgeInsets.only(top: 0, left: 0, right: 0),
padding: const EdgeInsets.all(10),
decoration: const BoxDecoration(
// color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(5)),
),
child: Column(
children: [
Row(
children: [
Image.asset(
'assets/examine/exam_title_icon.png',
width: SizeConfig.isIpad()! ? 35 : 18,
height: SizeConfig.isIpad()! ? 35 : 18,
),
const SizedBox(width: 5),
Text(
'考核练习',
style: TextStyle(
color: Colors.black54,
fontSize: SizeConfig.isIpad()! ? 25 : 14,
fontWeight: FontWeight.bold),
),
],
),
// buildTitle(Icons.equalizer, '考核练习'),
// buildSliverGridExamination()
],
))),
buildSliverToBoxAdapter(
'assets/examine/exam_title_icon.png', '考核练习'),
buildSliverGridExamination(),
......@@ -482,6 +412,495 @@ class _HomePageState extends State<HomePage>
);
}
///监察人员布局
SliverToBoxAdapter buildOverseerLable() {
return SliverToBoxAdapter(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
buildLableTitle('assets/examine/exam_title_icon.png', '监察考核'),
Container(
margin: const EdgeInsets.only(left: 35, top: 10),
child: InkWell(
splashColor: ColorConst.green1Color,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: SizeConfig.isIpad()! ? 30 : 5),
Image.asset(
'assets/examine/examine_icon.png',
width: SizeConfig.isIpad()! ? 150 : 50,
height: SizeConfig.isIpad()! ? 150 : 50,
),
Container(
height: SizeConfig.isIpad()! ? 40 : 20,
margin: const EdgeInsets.only(top: 3),
child: Text(
'考核设置',
style: TextStyle(
fontSize: SizeConfig.isIpad()! ? 25 : 13,
color: Colors.black54),
),
)
],
),
onTap: () {
Get.toNamed(RouteString.OVERSEER_SETTINGS_PAGE, arguments: {})
?.then((value) {
if (value != null && value) {
getOverseerHistoryList();
}
});
},
),
),
Container(
margin: const EdgeInsets.only(top: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
margin: const EdgeInsets.only(left: 5),
padding: const EdgeInsets.all(10),
child: Column(
children: [
Row(
children: [
Image.asset(
'assets/examine/history_icon.png',
width: SizeConfig.isIpad()! ? 35 : 18,
height: SizeConfig.isIpad()! ? 35 : 18,
),
const SizedBox(width: 5),
Text(
'监察记录',
style: TextStyle(
color: Colors.black54,
fontSize: SizeConfig.isIpad()! ? 25 : 14,
fontWeight: FontWeight.bold),
),
],
),
// buildTitle(Icons.equalizer, '考核练习'),
// buildSliverGridExamination()
],
)),
InkWell(
onTap: () {
Get.toNamed(RouteString.OVERSEER_HISTORY_LIST_PAGE,
arguments: {})?.then((value) {
if (value != null && value) {}
});
},
child: Container(
padding: const EdgeInsets.all(10),
child: const Text(
'更多监察记录 >',
style: TextStyle(color: ColorConst.blueColor, fontSize: 14),
),
),
)
],
),
),
//TODO
Container(
width: double.infinity,
margin: const EdgeInsets.only(left: 15, right: 15, top: 0, bottom: 5),
padding: const EdgeInsets.only(left: 5, right: 5, top: 3, bottom: 3),
decoration: BoxDecoration(
color: Colors.orange[50],
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(5),
topRight: Radius.circular(5),
bottomLeft: Radius.circular(5),
bottomRight: Radius.circular(5)),
),
child: Text.rich(
softWrap: true,
TextSpan(children: [
const TextSpan(
text: "历史监察记录共 ",
style: TextStyle(fontSize: 12, color: Colors.orange)),
TextSpan(
text: mOverseerHistoryListBo != null
? mOverseerHistoryListBo!.count.toString()
: '0',
style: const TextStyle(
fontSize: 16,
color: Colors.orange,
fontWeight: FontWeight.bold)),
const TextSpan(
text: " 条",
style: TextStyle(fontSize: 12, color: Colors.orange))
])),
),
if (mHistoryListData!.isEmpty) ...[
EmptyImgWidget(
title: '暂无监察记录,点击刷新',
onTap: () {
getOverseerHistoryList();
}),
] else ...[
Container(
margin: const EdgeInsets.only(left: 5, right: 5, top: 0, bottom: 0),
child: ListView.separated(
shrinkWrap: true,
padding: const EdgeInsets.symmetric(
horizontal: EdgeInsetsConst.padding_horizontal),
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (BuildContext context, int index) {
return AnimatedBuilder(
animation: _animation,
builder: (context, child) {
return Transform.scale(
scale: _animation.value,
child: InkWell(
onTap: () {
Get.toNamed(RouteString.OVERSEER_HISTROY_DETAILS_PAGE,
arguments: {
'id': mHistoryListData![index].id,
})?.then((value) {
if (value != null && value) {}
});
},
child: Card(
elevation: 10,
shadowColor: mHistoryListData![index].incomplete != 0
? ColorConst.orangeColor
: ColorConst.greenColor,
margin: EdgeInsets.only(
left: 0,
right: 0,
top: index == 0 ? 0 : 15,
bottom: 0),
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(10)),
),
child: Container(
padding: const EdgeInsets.only(
left: 15, right: 15, top: 10, bottom: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(mHistoryListData![index].officeName!,
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16,
color: Colors.black54)),
///分割线
DividerCustom(Colors.grey[300], 8, 8, 0, 0),
Row(children: [
const Text('设备类型:',
style: TextStyle(
fontSize: 14, color: Colors.black54)),
Text(mHistoryListData![index].typeName!,
style: const TextStyle(
fontSize: 14, color: Colors.black54)),
]),
const SizedBox(height: 5),
Text.rich(
softWrap: true,
TextSpan(children: [
const TextSpan(
text: "考核人数:",
style: TextStyle(
fontSize: 14,
color: Colors.black54)),
TextSpan(
text: mHistoryListData![index]
.count!
.toString(),
style: const TextStyle(
fontSize: 18,
color: ColorConst.greenColor,
fontWeight: FontWeight.bold)),
const TextSpan(
text: "人",
style: TextStyle(
fontSize: 14,
color: Colors.black54)),
])),
const SizedBox(height: 5),
Text.rich(
softWrap: true,
TextSpan(children: [
const TextSpan(
text: "考核状态:",
style: TextStyle(
fontSize: 14,
color: Colors.black54)),
const TextSpan(
text: "已完成 ",
style: TextStyle(
color: ColorConst.greenColor)),
TextSpan(
text: mHistoryListData![index]
.complete!
.toString(),
style: const TextStyle(
color: ColorConst.greenColor,
fontSize: 18,
fontWeight: FontWeight.bold)),
const TextSpan(
text: " 人",
style: TextStyle(
color: ColorConst.greenColor)),
if (mHistoryListData![index].incomplete !=
0) ...[
const TextSpan(
text: " | ",
style: TextStyle(
color: ColorConst.greyD2Color)),
const TextSpan(
text: "进行中 ",
style: TextStyle(
color: ColorConst.red1BgColor)),
TextSpan(
text: mHistoryListData![index]
.incomplete!
.toString(),
style: const TextStyle(
color: ColorConst.red1BgColor,
fontSize: 18,
fontWeight: FontWeight.bold)),
const TextSpan(
text: " 人",
style: TextStyle(
color: ColorConst.red1BgColor)),
]
])),
const SizedBox(height: 5),
Text.rich(
softWrap: true,
TextSpan(children: [
const TextSpan(
text: "考核时间:",
style: TextStyle(
fontSize: 14,
color: Colors.black54)),
TextSpan(
text: timestampToDate(
mHistoryListData![index]
.createDate!),
style: const TextStyle(
fontSize: 14,
color: Colors.black54)),
])),
const SizedBox(height: 10),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
if (mHistoryListData![index].incomplete !=
0) ...[
GradientButton(
tapCallback: () {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: const Text("温馨提示"),
content: const Text(
"您确定要删除该监察记录吗?"),
actionsPadding:
const EdgeInsets.only(
left: 0,
top: 0,
bottom: 10,
right: 20),
contentPadding:
const EdgeInsets.only(
left: 20,
top: 0,
bottom: 10,
right: 20),
titlePadding:
const EdgeInsets.only(
left: 20,
top: 20,
bottom: 10,
right: 20),
actions: [
TextButton(
child: const Text("取消"),
onPressed: () {
Get.back();
},
),
TextButton(
child:
const Text("确定"),
onPressed: () {
///删除监察记录
HttpUtils.getExamSetupDelete(
context,
mHistoryListData![
index]
.id!)
.then((value) {
if (mounted) {
setState(() {
mHistoryListData!
.removeAt(
index);
ToastUtils
.showCenter(
'删除成功');
Get.back();
});
}
});
})
],
);
});
},
width: 60,
height: 23,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(10),
topRight: Radius.circular(20),
bottomLeft: Radius.circular(20),
bottomRight: Radius.circular(10)),
disable: false,
colors: const [
ColorConst.red1BgColor,
ColorConst.red3BgColor
],
child: const Text(
"删除",
style: TextStyle(
fontSize: 14,
color: ColorConst.whiteColor),
)),
],
Container(
margin: const EdgeInsets.only(left: 20),
child: GradientButton(
tapCallback: () {
Get.toNamed(
RouteString
.OVERSEER_HISTROY_DETAILS_PAGE,
arguments: {
'id': mHistoryListData![index]
.id,
})?.then((value) {
if (value != null && value) {}
});
},
width: 60,
height: 23,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(10),
topRight: Radius.circular(20),
bottomLeft: Radius.circular(20),
bottomRight: Radius.circular(10)),
disable: false,
colors: const [
ColorConst.blueColor,
ColorConst.blue1Color
],
child: const Text(
"详情",
style: TextStyle(
fontSize: 14,
color: ColorConst.whiteColor),
)),
)
],
)
],
),
),
),
),
);
},
);
},
itemCount: mHistoryListData!.length,
separatorBuilder: (BuildContext context, int index) {
return const SizedBox(
height: 0,
);
},
),
),
],
],
));
}
Container buildLableTitle(String imageAsset, String name) {
return Container(
margin: const EdgeInsets.only(top: 10, left: 5, right: 0),
padding: const EdgeInsets.all(10),
decoration: const BoxDecoration(
// color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(5)),
),
child: Column(
children: [
Row(
children: [
Image.asset(
imageAsset,
width: SizeConfig.isIpad()! ? 35 : 18,
height: SizeConfig.isIpad()! ? 35 : 18,
),
const SizedBox(width: 5),
Text(
name,
style: TextStyle(
color: Colors.black54,
fontSize: SizeConfig.isIpad()! ? 25 : 14,
fontWeight: FontWeight.bold),
),
],
),
// buildTitle(Icons.equalizer, '考核练习'),
// buildSliverGridExamination()
],
));
}
SliverToBoxAdapter buildSliverToBoxAdapter(String imageAsset, String name) {
return SliverToBoxAdapter(
child: Container(
margin: const EdgeInsets.only(top: 10, left: 5, right: 0),
padding: const EdgeInsets.all(10),
decoration: const BoxDecoration(
// color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(5)),
),
child: Column(
children: [
Row(
children: [
Image.asset(
imageAsset,
width: SizeConfig.isIpad()! ? 35 : 18,
height: SizeConfig.isIpad()! ? 35 : 18,
),
const SizedBox(width: 5),
Text(
name,
style: TextStyle(
color: Colors.black54,
fontSize: SizeConfig.isIpad()! ? 25 : 14,
fontWeight: FontWeight.bold),
),
],
),
// buildTitle(Icons.equalizer, '考核练习'),
// buildSliverGridExamination()
],
)));
}
Future<dynamic> buildShowChargeDialog(BuildContext context,
List<OfficeDtoLists>? deviceList, List<ChargeUserList>? chargeList) {
return showDialog(
......
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:special_equipment_flutter/common/color_const.dart';
import 'package:special_equipment_flutter/common/edgeInsets_const.dart';
import 'package:special_equipment_flutter/dio/http_utils.dart';
import 'package:special_equipment_flutter/model/exam/overseer_history_details_bo.dart';
import 'package:special_equipment_flutter/model/exam/overseer_history_information_bo.dart';
import 'package:special_equipment_flutter/utils/size_config.dart';
import 'package:special_equipment_flutter/utils/storage_util.dart';
import 'package:special_equipment_flutter/utils/time_util.dart';
import 'package:special_equipment_flutter/widgets/divider_custom.dart';
import '../../widgets/app_bar/custom_app_bar.dart';
///监察记录详情
class OverseerHistroyDetailsPage extends StatefulWidget {
var arguments = Get.arguments;
OverseerHistroyDetailsPage({super.key});
@override
State<OverseerHistroyDetailsPage> createState() =>
_OverseerHistroyDetailsPageState();
}
class _OverseerHistroyDetailsPageState
extends State<OverseerHistroyDetailsPage> {
String? id;
OverseerHistoryInformationBo? mOverseerHistoryInformationBo;
Data? data;
OverseerHistoryDetailsBo? mOverseerHistoryDetailsBo =
OverseerHistoryDetailsBo();
List<DataHistoryDetails>? rowList = [];
@override
void initState() {
id = widget.arguments['id'];
getOverseerHistoryInformationDetails();
getOverseerHistoryDetails();
super.initState();
}
///获取监察记录基本信息
void getOverseerHistoryInformationDetails() {
HttpUtils.getPapers2(context, StorageUtil.getInstance().getUserId(), id!)
.then((value) {
mOverseerHistoryInformationBo = value;
if (mounted) {
setState(() {
data = mOverseerHistoryInformationBo!.data;
});
}
});
}
///获取监察记录详情
void getOverseerHistoryDetails() {
HttpUtils.getExamPersonData(context, id!).then((value) {
mOverseerHistoryDetailsBo = value;
if (mounted) {
setState(() {
rowList = mOverseerHistoryDetailsBo!.data;
});
}
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: ColorConst.grayf5Color,
appBar: AppBarCustom(
text: '监察记录详情',
height: 50,
),
body: CustomScrollView(
primary: false,
shrinkWrap: true,
slivers: <Widget>[
SliverToBoxAdapter(
child: Card(
elevation: 0,
margin: const EdgeInsets.only(
left: 0, right: 0, top: 15, bottom: 0),
color: Colors.white,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(5)),
),
child: Column(
children: [
buildTitleContainer(Icons.insert_drive_file_outlined,
ColorConst.blueColor, '基本信息', Colors.black54),
Container(
padding: const EdgeInsets.only(
left: 40, right: 15, top: 0, bottom: 15),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(data != null ? data!.officeName! : '',
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16,
color: Colors.black54)),
///分割线
DividerCustom(Colors.grey[300], 8, 8, 0, 0),
Row(children: [
const Text('设备类型:',
style: TextStyle(
fontSize: 14, color: Colors.black54)),
Text(data != null ? data!.typeName! : '',
style: TextStyle(
fontSize: 14, color: Colors.black54)),
]),
const SizedBox(height: 5),
Text.rich(
softWrap: true,
TextSpan(children: [
const TextSpan(
text: "考核人数:",
style: TextStyle(
fontSize: 14, color: Colors.black54)),
TextSpan(
text: data != null
? data!.count.toString()
: '',
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold)),
const TextSpan(
text: "人",
style: TextStyle(
fontSize: 14, color: Colors.black54)),
])),
const SizedBox(height: 5),
Text.rich(
softWrap: true,
TextSpan(children: [
const TextSpan(
text: "考核状态:",
style: TextStyle(
fontSize: 14, color: Colors.black54)),
const TextSpan(
text: "已完成 ",
style: TextStyle(
color: ColorConst.greenColor)),
TextSpan(
text: data != null
? data!.complete.toString()
: '',
style: const TextStyle(
color: ColorConst.greenColor,
fontSize: 18,
fontWeight: FontWeight.bold)),
const TextSpan(
text: " 人",
style: TextStyle(
color: ColorConst.greenColor)),
if (data != null
? data!.incomplete != 0
: true) ...[
const TextSpan(
text: " | ",
style: TextStyle(
color: ColorConst.greyD2Color)),
const TextSpan(
text: "进行中 ",
style: TextStyle(
color: ColorConst.red1BgColor)),
TextSpan(
text: data != null
? data!.incomplete.toString()
: '',
style: const TextStyle(
color: ColorConst.red1BgColor,
fontSize: 18,
fontWeight: FontWeight.bold)),
const TextSpan(
text: " 人",
style: TextStyle(
color: ColorConst.red1BgColor)),
]
])),
const SizedBox(height: 5),
Text.rich(
softWrap: true,
TextSpan(children: [
const TextSpan(
text: "考核时间:",
style: TextStyle(
fontSize: 14, color: Colors.black54)),
TextSpan(
text: timestampToDate(
data != null ? data!.createDate! : 0),
style: const TextStyle(
fontSize: 14, color: Colors.black54)),
])),
],
),
)
],
),
),
),
SliverToBoxAdapter(
child: Card(
elevation: 0,
margin: const EdgeInsets.only(
left: 0, right: 0, top: 15, bottom: 0),
color: Colors.white,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(5)),
),
child: Column(
children: [
buildTitleContainer(Icons.event_repeat,
ColorConst.blueColor, '考核状态', Colors.black54),
Container(
padding: const EdgeInsets.only(
left: 30, right: 15, top: 0, bottom: 15),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
//文章列表
ListView.separated(
shrinkWrap: true,
padding: const EdgeInsets.symmetric(
horizontal: EdgeInsetsConst.padding_horizontal),
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (BuildContext context, int index) {
return Container(
padding: const EdgeInsets.only(
left: 10, right: 10, top: 10, bottom: 10),
margin: const EdgeInsets.only(
left: 0, right: 0, top: 0, bottom: 5),
decoration: BoxDecoration(
color: rowList![index].adopt == "0"
? ColorConst.red4BgColor
: Colors.green[50],
borderRadius: const BorderRadius.all(
Radius.circular(5)),
),
child: Column(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(rowList![index].user!.name!,
style: const TextStyle(
fontSize: 16,
color: Colors.black54,
fontWeight: FontWeight.bold)),
Text(
rowList![index].adopt == "0"
? "进行中"
: '已完成',
style: TextStyle(
fontSize: 14,
color:
rowList![index].adopt == "0"
? ColorConst.red1BgColor
: ColorConst.greenColor,
fontWeight: FontWeight.bold)),
],
),
Container(
height: 3,
width: 48,
margin: const EdgeInsets.only(top: 2),
decoration: BoxDecoration(
color: rowList![index].adopt == "0"
? Colors.red
: Colors.green,
borderRadius: const BorderRadius.all(
Radius.circular(5)),
),
),
Container(
margin: const EdgeInsets.only(top: 5),
child: Text.rich(
softWrap: true,
TextSpan(children: [
const TextSpan(
text: "考核人员身份:",
style: TextStyle(
color: Colors.black54)),
TextSpan(
text: rowList![index]
.positionType ==
'1'
? '安全总监'
: '安全员',
style: const TextStyle(
color: Colors.black54))
])),
),
if (rowList![index].adopt == "1") ...[
Container(
margin: const EdgeInsets.only(top: 5),
child: Text.rich(
softWrap: true,
TextSpan(children: [
const TextSpan(
text: "考核得分 ",
style: TextStyle(
color: Colors.black54)),
TextSpan(
text: rowList![index]
.score!
.toString(),
style: const TextStyle(
fontSize: 16,
color:
ColorConst.greenColor,
fontWeight:
FontWeight.bold)),
const TextSpan(
text: " 分",
style: TextStyle(
color: Colors.black54)),
])),
)
]
],
),
);
},
itemCount: rowList!.length,
separatorBuilder:
(BuildContext context, int index) {
return const SizedBox(
height: 0,
);
},
),
],
),
)
],
),
),
),
// SliverToBoxAdapter(
// child: Card(
// elevation: 5,
// shadowColor: ColorConst.greenColor,
// margin: const EdgeInsets.only(
// left: 0, right: 0, top: 15, bottom: 0),
// color: Colors.white,
// shape: const RoundedRectangleBorder(
// borderRadius: BorderRadius.all(Radius.circular(5)),
// ),
// child: Column(
// children: [
// buildTitleContainer(Icons.event_available,
// ColorConst.greenColor, '已完成', ColorConst.greenColor),
// Container(
// padding: const EdgeInsets.only(
// left: 40, right: 15, top: 0, bottom: 15),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: <Widget>[
//
//
//
// ],
// ),
// )
// ],
// ),
// ),
// )
],
));
}
Container buildTitleContainer(
IconData imageAsset, Color imageColor, String name, Color nameColor) {
return Container(
margin: const EdgeInsets.only(top: 0, left: 0, right: 0),
padding: const EdgeInsets.all(10),
decoration: const BoxDecoration(
// color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(5)),
),
child: Column(
children: [
Row(
children: [
Icon(
imageAsset,
color: imageColor,
),
const SizedBox(width: 5),
Text(
name,
style: TextStyle(
color: nameColor,
fontSize: SizeConfig.isIpad()! ? 25 : 14,
fontWeight: FontWeight.bold),
),
],
),
// buildTitle(Icons.equalizer, '考核练习'),
// buildSliverGridExamination()
],
));
}
}
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'package:special_equipment_flutter/common/color_const.dart';
import 'package:special_equipment_flutter/common/edgeInsets_const.dart';
import 'package:special_equipment_flutter/common/route_string.dart';
import 'package:special_equipment_flutter/dio/http_utils.dart';
import 'package:special_equipment_flutter/model/exam/overseer_history_list_bo.dart';
import 'package:special_equipment_flutter/utils/storage_util.dart';
import 'package:special_equipment_flutter/utils/string_utils.dart';
import 'package:special_equipment_flutter/utils/time_util.dart';
import 'package:special_equipment_flutter/utils/toast_utils.dart';
import 'package:special_equipment_flutter/widgets/app_bar/custom_app_bar.dart';
import 'package:special_equipment_flutter/widgets/custom_button.dart';
import 'package:special_equipment_flutter/widgets/divider_custom.dart';
import 'package:special_equipment_flutter/widgets/emptyI_img_widget.dart';
import 'package:special_equipment_flutter/widgets/first_refresh_widget.dart';
///考核记录列表
class OverseerHistoryListPage extends StatefulWidget {
const OverseerHistoryListPage({super.key});
@override
State<OverseerHistoryListPage> createState() =>
_OverseerHistoryListPageState();
}
class _OverseerHistoryListPageState extends State<OverseerHistoryListPage> {
final EasyRefreshController _controller = EasyRefreshController();
// List<TaskDayList> list = [];
// OverseerHistoryListBo? mOverseerHistoryListBo = OverseerHistoryListBo();
List<HistoryListData>? mHistoryListData = [];
int page = 1;
bool isLastPage = true;
@override
void initState() {
super.initState();
getOverseerHistoryList();
}
///获取监察记录列表
void getOverseerHistoryList() {
HttpUtils.getPapers(context, StorageUtil.getInstance().getUserId(), 1, 10)
.then((value) {
OverseerHistoryListBo mOverseerHistoryListBo = value;
if (mounted) {
setState(() {
if (page == 1) {
mHistoryListData!.clear();
}
List<HistoryListData>? rows = mOverseerHistoryListBo.data;
mHistoryListData!.addAll(rows!);
int totalPage =
StringUtils.totalPage(mOverseerHistoryListBo.count, 10);
print('$totalPage==== $page');
if (totalPage == page) {
isLastPage = true;
} else {
isLastPage = false;
}
});
_controller.finishRefresh();
_controller.finishLoad(noMore: isLastPage);
}
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBarCustom(text: '考核列表', height: 50),
backgroundColor: Colors.grey[100],
body: Column(
children: [
Expanded(
flex: 1,
child: EasyRefresh(
firstRefresh: true,
enableControlFinishRefresh: true,
enableControlFinishLoad: true,
firstRefreshWidget: const FirstRefreshWidget(),
emptyWidget: mHistoryListData!.isEmpty
? EmptyImgWidget(
title: '暂无数据,点击刷新',
onTap: () {
getOverseerHistoryList();
})
: null,
controller: _controller,
onRefresh: () async {
page = 1;
getOverseerHistoryList();
},
onLoad: () async {
page++;
getOverseerHistoryList();
},
child: buildBody(),
)),
],
),
);
}
Column buildBody() {
return Column(
children: [
//文章列表
ListView.separated(
shrinkWrap: true,
padding: const EdgeInsets.symmetric(
horizontal: EdgeInsetsConst.padding_horizontal),
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (BuildContext context, int index) {
return buildItem(index, context);
},
itemCount: mHistoryListData!.length,
separatorBuilder: (BuildContext context, int index) {
return const SizedBox(
height: 0,
);
},
),
],
);
}
InkWell buildItem(int index, BuildContext context) {
return InkWell(
onTap: () {
// Get.toNamed(RouteString.DAY_INSPECT_SUBMIT_SY,
// arguments: {'argsData': widget.args, 'listBo': list(index)})
// ?.then((value) {
// if (value != null && value) {
// getData();
// }
// });
},
child: Card(
elevation: 10,
shadowColor: mHistoryListData![index].incomplete != 0
? ColorConst.orangeColor
: ColorConst.greenColor,
margin: const EdgeInsets.only(left: 0, right: 0, top: 15, bottom: 0),
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(10)),
),
child: Container(
padding:
const EdgeInsets.only(left: 15, right: 15, top: 10, bottom: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(mHistoryListData![index].officeName!,
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16,
color: Colors.black54)),
///分割线
DividerCustom(Colors.grey[300], 8, 8, 0, 0),
Row(children: [
const Text('设备类型:',
style: TextStyle(fontSize: 14, color: Colors.black54)),
Text(mHistoryListData![index].typeName!,
style:
const TextStyle(fontSize: 14, color: Colors.black54)),
]),
const SizedBox(height: 5),
Text.rich(
softWrap: true,
TextSpan(children: [
const TextSpan(
text: "考核人数:",
style: TextStyle(fontSize: 14, color: Colors.black54)),
TextSpan(
text: mHistoryListData![index].count!.toString(),
style: const TextStyle(
fontSize: 18,
color: ColorConst.greenColor,
fontWeight: FontWeight.bold)),
const TextSpan(
text: "人",
style: TextStyle(fontSize: 14, color: Colors.black54)),
])),
const SizedBox(height: 5),
Text.rich(
softWrap: true,
TextSpan(children: [
const TextSpan(
text: "考核状态:",
style: TextStyle(fontSize: 14, color: Colors.black54)),
const TextSpan(
text: "已完成 ",
style: TextStyle(color: ColorConst.greenColor)),
TextSpan(
text: mHistoryListData![index].complete!.toString(),
style: const TextStyle(
color: ColorConst.greenColor,
fontSize: 18,
fontWeight: FontWeight.bold)),
const TextSpan(
text: " 人",
style: TextStyle(color: ColorConst.greenColor)),
const TextSpan(
text: " | ",
style: TextStyle(color: ColorConst.greyD2Color)),
const TextSpan(
text: "进行中 ",
style: TextStyle(color: ColorConst.red1BgColor)),
TextSpan(
text: mHistoryListData![index].incomplete!.toString(),
style: const TextStyle(
color: ColorConst.red1BgColor,
fontSize: 18,
fontWeight: FontWeight.bold)),
const TextSpan(
text: " 人",
style: TextStyle(color: ColorConst.red1BgColor)),
])),
const SizedBox(height: 5),
Text.rich(
softWrap: true,
TextSpan(children: [
const TextSpan(
text: "考核时间:",
style: TextStyle(fontSize: 14, color: Colors.black54)),
TextSpan(
text: timestampToDate(
mHistoryListData![index].createDate!),
style: const TextStyle(
fontSize: 14, color: Colors.black54)),
])),
const SizedBox(height: 10),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
if (mHistoryListData![index].incomplete != 0) ...[
GradientButton(
tapCallback: () {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: const Text("温馨提示"),
content: const Text("您确定要删除该监察记录吗?"),
actionsPadding: const EdgeInsets.only(
left: 0, top: 0, bottom: 10, right: 20),
contentPadding: const EdgeInsets.only(
left: 20, top: 0, bottom: 10, right: 20),
titlePadding: const EdgeInsets.only(
left: 20, top: 20, bottom: 10, right: 20),
actions: [
TextButton(
child: const Text("取消"),
onPressed: () {
Get.back();
},
),
TextButton(
child: const Text("确定"),
onPressed: () {
///删除监察记录
HttpUtils.getExamSetupDelete(context,
mHistoryListData![index].id!)
.then((value) {
if (mounted) {
setState(() {
mHistoryListData!
.removeAt(index);
ToastUtils.showCenter('删除成功');
Get.back();
});
}
});
})
],
);
});
},
width: 60,
height: 23,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(10),
topRight: Radius.circular(20),
bottomLeft: Radius.circular(20),
bottomRight: Radius.circular(10)),
disable: false,
colors: const [
ColorConst.red1BgColor,
ColorConst.red3BgColor
],
child: const Text(
"删除",
style: TextStyle(
fontSize: 14, color: ColorConst.whiteColor),
)),
],
Container(
margin: const EdgeInsets.only(left: 20),
child: GradientButton(
tapCallback: () {
Get.toNamed(RouteString.OVERSEER_HISTROY_DETAILS_PAGE,
arguments: {
'id': mHistoryListData![index].id,
})?.then((value) {
if (value != null && value) {}
});
},
width: 60,
height: 23,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(10),
topRight: Radius.circular(20),
bottomLeft: Radius.circular(20),
bottomRight: Radius.circular(10)),
disable: false,
colors: const [
ColorConst.blueColor,
ColorConst.blue1Color
],
child: const Text(
"详情",
style: TextStyle(
fontSize: 14, color: ColorConst.whiteColor),
)),
)
],
)
],
),
),
),
);
}
}
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:special_equipment_flutter/common/color_const.dart';
import 'package:special_equipment_flutter/common/edgeInsets_const.dart';
import 'package:special_equipment_flutter/dio/http_utils.dart';
import 'package:special_equipment_flutter/model/day_control_list_sy_bo.dart';
import 'package:special_equipment_flutter/widgets/app_bar/custom_app_bar.dart';
import 'package:special_equipment_flutter/widgets/divider_custom.dart';
///设置的考核列表
class OverseerListPage extends StatefulWidget {
const OverseerListPage({super.key});
@override
State<OverseerListPage> createState() => _OverseerListPageState();
}
class _OverseerListPageState extends State<OverseerListPage> {
final EasyRefreshController _controller = EasyRefreshController();
List<TaskDayList> list = [];
@override
void initState() {
super.initState();
// getData();
}
void getData() {
HttpUtils.getOverseerList(context, '0', '', '').then((value) {
DayControlListSyBo listBo = value;
if (mounted) {
setState(() {
var taskDayList = listBo.taskDayList;
list.clear();
list.addAll(taskDayList!);
_controller.finishRefresh();
});
}
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBarCustom(text: '考核列表', height: 50),
backgroundColor: Colors.grey[100],
body: Column(
children: [
Expanded(
flex: 1,
child: EasyRefresh(
firstRefresh: true,
enableControlFinishRefresh: true,
// enableControlFinishLoad: true,
// firstRefreshWidget: const FirstRefreshWidget(),
// emptyWidget: list.isEmpty
// ? EmptyImgWidget(
// title: '暂无数据,点击刷新',
// onTap: () {
// getData();
// })
// : null,
controller: _controller,
onRefresh: () async {
// page = 1;
// getData();
},
// onLoad: () async {
// page++;
// getList();
// },
child: buildBody(),
)),
],
),
);
}
Column buildBody() {
return Column(
children: [
//文章列表
ListView.separated(
shrinkWrap: true,
padding: const EdgeInsets.symmetric(
horizontal: EdgeInsetsConst.padding_horizontal),
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (BuildContext context, int index) {
return buildItem(index, context);
},
itemCount: 4,
separatorBuilder: (BuildContext context, int index) {
return const SizedBox(
height: 0,
);
},
),
],
);
}
InkWell buildItem(int index, BuildContext context) {
return InkWell(
onTap: () {
// Get.toNamed(RouteString.DAY_INSPECT_SUBMIT_SY,
// arguments: {'argsData': widget.args, 'listBo': list(index)})
// ?.then((value) {
// if (value != null && value) {
// getData();
// }
// });
},
child: buildCard(context, index),
);
}
Card buildCard(BuildContext context, int index) {
return Card(
elevation: 3,
margin: const EdgeInsets.only(left: 0, right: 0, top: 15, bottom: 0),
color: Colors.white,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(5)),
),
child: Container(
padding:
const EdgeInsets.only(left: 10, right: 10, top: 10, bottom: 10),
child: Column(
children: <Widget>[
const Column(
children: [
Text('山西盈中科技有限公司山西盈中科技有限公司',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18,
color: Colors.black87)),
Text('2024-05-21',
style: TextStyle(fontSize: 14, color: Colors.grey)),
],
),
///分割线
DividerCustom(Colors.grey[300], 8, 8, 0, 0),
Container(
margin:
const EdgeInsets.only(left: 8, top: 0, right: 0, bottom: 0),
child: const Row(children: [
Text('设备类型:',
style: TextStyle(
fontSize: 14,
color: ColorConst.blueColor,
fontWeight: FontWeight.bold)),
Text('电梯,锅炉', style: TextStyle()),
]),
),
Container(
padding:
const EdgeInsets.only(left: 10, top: 5, right: 5, bottom: 5),
margin:
const EdgeInsets.only(left: 0, top: 10, right: 0, bottom: 0),
decoration: const BoxDecoration(
color: ColorConst.grayf5Color,
borderRadius: BorderRadius.all(Radius.circular(10)),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Row(children: [
Text('安全总监:',
style: TextStyle(
fontSize: 14,
color: ColorConst.blueColor,
fontWeight: FontWeight.bold)),
Text('张三,李四', style: TextStyle()),
]),
const SizedBox(height: 5),
Container(
padding: const EdgeInsets.only(
left: 0, top: 0, right: 5, bottom: 0),
child: const Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('总题数:20',
style: TextStyle(color: Colors.grey, fontSize: 14)),
Text('单选题数:10',
style: TextStyle(color: Colors.grey, fontSize: 14)),
Text('判断题数:10',
style: TextStyle(color: Colors.grey, fontSize: 14)),
],
),
),
],
),
),
Container(
padding:
const EdgeInsets.only(left: 10, top: 5, right: 5, bottom: 5),
margin:
const EdgeInsets.only(left: 0, top: 10, right: 0, bottom: 0),
decoration: const BoxDecoration(
color: ColorConst.grayf5Color,
borderRadius: BorderRadius.all(Radius.circular(10)),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Row(children: [
Text('安全员:',
style: TextStyle(
fontSize: 14,
color: ColorConst.blueColor,
fontWeight: FontWeight.bold)),
Text('张三,李四', style: TextStyle()),
]),
const SizedBox(height: 5),
Container(
padding: const EdgeInsets.only(
left: 0, top: 0, right: 5, bottom: 0),
child: const Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('总题数:20',
style: TextStyle(color: Colors.grey, fontSize: 14)),
Text('单选题数:10',
style: TextStyle(color: Colors.grey, fontSize: 14)),
Text('判断题数:10',
style: TextStyle(color: Colors.grey, fontSize: 14)),
],
),
),
],
),
),
const SizedBox(
height: 5,
)
// buildSubmits(context, index),
],
),
),
);
}
}
......@@ -756,6 +756,7 @@ class _OverseerSettingsState extends State<OverseerSettingsPage> {
}
}
mExamSettingSubmitBo.aqyIds = aqyIds;
mExamSettingSubmitBo.unitId = mOfficeList!.id;
HttpUtils.getExamSettingSubmit(
context, mExamSettingSubmitBo)
.then((value) {
......@@ -763,7 +764,7 @@ class _OverseerSettingsState extends State<OverseerSettingsPage> {
if (mounted) {
setState(() {
ToastUtils.showCenter(bo.msg);
Get.back();
Get.back(result: true);
});
}
});
......
......@@ -62,7 +62,8 @@ class StringUtils {
/// @param pageSize 一页几条
/// @return
static int totalPage(int? count, int? pageSize) {
var pageTotle = (count! / pageSize!).truncate();
//向上取整(返回int)
var pageTotle = (count! / pageSize!).ceil();
return pageTotle;
}
......
......@@ -48,3 +48,9 @@ Future<String> getNetworkTimess() async {
throw Exception('Failed to get time data');
}
}
String timestampToDate(int timestamp) {
var date = DateTime.fromMillisecondsSinceEpoch(timestamp);
var formatter = DateFormat('yyyy-MM-dd HH:mm:ss');
return formatter.format(date);
}
......@@ -135,6 +135,7 @@ flutter:
- assets/examine/pass_icon.png
- assets/examine/no_pass_icon.png
- assets/examine/examine_gary_icon.png
- assets/examine/history_icon.png
# An image asset can refer to one or more resolution-specific "variants", see
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment