Commit be51012f by 吴春元

bug 修改

parent f8c76167
...@@ -7,11 +7,11 @@ class Api { ...@@ -7,11 +7,11 @@ class Api {
// IS_DEBUG ? "https://special.sxyztech.cn/" : "http://192.168.19.165:2212/"; // IS_DEBUG ? "https://special.sxyztech.cn/" : "http://192.168.19.165:2212/";
///演示 ip ///演示 ip
// static String URL = "http://47.92.138.92:8009/"; 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.164:8087/";
static String URL = "http://192.168.19.165:2212/"; // static String URL = "http://192.168.19.165:2212/";
static String START_URL = "special/a/", static String START_URL = "special/a/",
END_URL = "__ajax=true&mobileLogin=true"; END_URL = "__ajax=true&mobileLogin=true";
......
...@@ -4,6 +4,7 @@ import 'dart:developer'; ...@@ -4,6 +4,7 @@ import 'dart:developer';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/route_manager.dart';
import 'package:special_equipment_flutter/dio/dio/do_utils.dart'; import 'package:special_equipment_flutter/dio/dio/do_utils.dart';
import 'package:special_equipment_flutter/model/app_is_open.dart'; import 'package:special_equipment_flutter/model/app_is_open.dart';
import 'package:special_equipment_flutter/model/app_roles.dart'; import 'package:special_equipment_flutter/model/app_roles.dart';
...@@ -44,6 +45,7 @@ import 'package:special_equipment_flutter/model/upload_multifile.dart'; ...@@ -44,6 +45,7 @@ import 'package:special_equipment_flutter/model/upload_multifile.dart';
import 'package:special_equipment_flutter/model/user_list.dart'; import 'package:special_equipment_flutter/model/user_list.dart';
import 'package:special_equipment_flutter/model/week_control_list_sy_bo.dart'; import 'package:special_equipment_flutter/model/week_control_list_sy_bo.dart';
import 'package:special_equipment_flutter/ui/common/data.dart'; import 'package:special_equipment_flutter/ui/common/data.dart';
import 'package:special_equipment_flutter/utils/eventbus_utils.dart';
import 'package:special_equipment_flutter/utils/storage_util.dart'; import 'package:special_equipment_flutter/utils/storage_util.dart';
import 'package:special_equipment_flutter/utils/toast_utils.dart'; import 'package:special_equipment_flutter/utils/toast_utils.dart';
...@@ -1238,6 +1240,7 @@ class HttpUtils { ...@@ -1238,6 +1240,7 @@ class HttpUtils {
'交卷中'); '交卷中');
try { try {
BaseModel entity = BaseModel.fromJson(response); BaseModel entity = BaseModel.fromJson(response);
if (entity.success!) {
Map<String, dynamic> resultData = entity.body; Map<String, dynamic> resultData = entity.body;
ExamResultBo examResultBo = ExamResultBo.fromJson(resultData); ExamResultBo examResultBo = ExamResultBo.fromJson(resultData);
if (entity.errorCode == "-1") { if (entity.errorCode == "-1") {
...@@ -1246,6 +1249,34 @@ class HttpUtils { ...@@ -1246,6 +1249,34 @@ class HttpUtils {
ToastUtils.showCenter(entity.msg!); ToastUtils.showCenter(entity.msg!);
return; return;
} }
} else {
showDialog(
context: context,
barrierDismissible: false,
builder: (context) {
return AlertDialog(
title: const Text("温馨提示"),
content: Text(entity.msg!),
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: () {
//发出通知
EventBusUtils.getInstance()?.fire("1");
Get.back();
Get.back();
})
],
);
});
return;
}
} catch (e) { } catch (e) {
log(e.toString()); log(e.toString());
return {"message": e.toString()}; return {"message": e.toString()};
......
...@@ -162,8 +162,10 @@ class NetUtils { ...@@ -162,8 +162,10 @@ class NetUtils {
ToastUtils.showCenter(entity.msg!); ToastUtils.showCenter(entity.msg!);
} }
} else { } else {
if (entity.msg != '试卷已被安全监察人员删除,请查看是否有新试卷!') {
ToastUtils.showCenter(entity.msg!); ToastUtils.showCenter(entity.msg!);
} }
}
isLoading ? Loading.dismiss() : null; isLoading ? Loading.dismiss() : null;
return response.data; return response.data;
} on DioError catch (e) { } on DioError catch (e) {
......
...@@ -53,6 +53,8 @@ class UserLists { ...@@ -53,6 +53,8 @@ class UserLists {
String? roleNames; String? roleNames;
bool? admin; bool? admin;
bool? isChecked = false; bool? isChecked = false;
bool? isUserSafetyDirectorChecked = true;
bool? isUserSafetyOfficerChecked = true;
UserLists copyWith({ UserLists copyWith({
String? id, String? id,
......
...@@ -108,7 +108,39 @@ class ExamPageState extends State<ExamPage> with TickerProviderStateMixin { ...@@ -108,7 +108,39 @@ class ExamPageState extends State<ExamPage> with TickerProviderStateMixin {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return WillPopScope(
onWillPop: () async {
Get.dialog(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),
shape: const RoundedRectangleBorder(
// 这里设置shape属性
borderRadius: BorderRadius.all(Radius.circular(10.0))),
actions: <Widget>[
TextButton(
child: const Text("取消", style: TextStyle(fontSize: 16)),
onPressed: () {
Get.back();
},
),
TextButton(
child: const Text("确定", style: TextStyle(fontSize: 16)),
onPressed: () {
Get.back();
Get.back();
},
),
],
));
return true; // 控制是否可以侧滑返回,true为允许,false为不允许
},
child: Scaffold(
backgroundColor: Colors.grey[100], backgroundColor: Colors.grey[100],
appBar: AppBarCustom( appBar: AppBarCustom(
leading: IconButton( leading: IconButton(
...@@ -212,7 +244,8 @@ class ExamPageState extends State<ExamPage> with TickerProviderStateMixin { ...@@ -212,7 +244,8 @@ class ExamPageState extends State<ExamPage> with TickerProviderStateMixin {
color: ColorConst.blueColor, color: ColorConst.blueColor,
fontWeight: FontWeight.bold)), fontWeight: FontWeight.bold)),
TextSpan( TextSpan(
text: " /${examQuestionList!.length}", text:
" /${examQuestionList!.length}",
style: const TextStyle( style: const TextStyle(
fontSize: 15, fontSize: 15,
color: Colors.black87)), color: Colors.black87)),
...@@ -224,8 +257,8 @@ class ExamPageState extends State<ExamPage> with TickerProviderStateMixin { ...@@ -224,8 +257,8 @@ class ExamPageState extends State<ExamPage> with TickerProviderStateMixin {
), ),
Container( Container(
height: 380, height: 380,
margin: margin: const EdgeInsets.only(
const EdgeInsets.only(top: 0, left: 10, right: 10), top: 0, left: 10, right: 10),
padding: const EdgeInsets.all(10), padding: const EdgeInsets.all(10),
decoration: const BoxDecoration( decoration: const BoxDecoration(
color: Colors.white, color: Colors.white,
...@@ -259,7 +292,8 @@ class ExamPageState extends State<ExamPage> with TickerProviderStateMixin { ...@@ -259,7 +292,8 @@ class ExamPageState extends State<ExamPage> with TickerProviderStateMixin {
///内容区 ///内容区
body: Column(children: [buildExpanded()]), body: Column(children: [buildExpanded()]),
)); )),
);
} }
Container buildSliverToBoxAdapter(var text) { Container buildSliverToBoxAdapter(var text) {
...@@ -519,8 +553,6 @@ class ExamPageState extends State<ExamPage> with TickerProviderStateMixin { ...@@ -519,8 +553,6 @@ class ExamPageState extends State<ExamPage> with TickerProviderStateMixin {
onPressed: () { onPressed: () {
//关闭弹窗 //关闭弹窗
Get.back(); Get.back();
// printLog(
// "《考核-交卷》提交json数据----->${json.encode(examineQuestionsBo)}");
HttpUtils.getExamSubmit(context, examineQuestionsBo) HttpUtils.getExamSubmit(context, examineQuestionsBo)
.then((value) { .then((value) {
ExamResultBo examResultBo = value; ExamResultBo examResultBo = value;
......
...@@ -54,10 +54,43 @@ class _ExamResultPageState extends State<ExamResultPage> { ...@@ -54,10 +54,43 @@ class _ExamResultPageState extends State<ExamResultPage> {
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
), ),
), ),
body: Container( body: Column(
children: [
Container(
width: double.infinity,
margin:
const EdgeInsets.only(left: 15, right: 15, top: 20, bottom: 0),
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: const Text.rich(
softWrap: true,
TextSpan(children: [
TextSpan(
text: "小提示:考核成绩 ",
style: TextStyle(fontSize: 14, color: Colors.orange)),
TextSpan(
text: '90',
style: TextStyle(
fontSize: 20,
color: Colors.green,
fontWeight: FontWeight.bold)),
TextSpan(
text: " 为合格",
style: TextStyle(fontSize: 14, color: Colors.orange))
])),
),
Container(
height: 300, height: 300,
width: double.infinity, width: double.infinity,
margin: const EdgeInsets.only(top: 15, left: 15, right: 15, bottom: 15), margin:
const EdgeInsets.only(top: 5, left: 15, right: 15, bottom: 15),
padding: const EdgeInsets.all(10), padding: const EdgeInsets.all(10),
decoration: const BoxDecoration( decoration: const BoxDecoration(
color: Colors.white, color: Colors.white,
...@@ -65,7 +98,6 @@ class _ExamResultPageState extends State<ExamResultPage> { ...@@ -65,7 +98,6 @@ class _ExamResultPageState extends State<ExamResultPage> {
), ),
child: Column( child: Column(
children: [ children: [
const SizedBox(height: 10),
const Row( const Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
...@@ -84,8 +116,9 @@ class _ExamResultPageState extends State<ExamResultPage> { ...@@ -84,8 +116,9 @@ class _ExamResultPageState extends State<ExamResultPage> {
Text( Text(
examResultDataBo!.score!.round().toString(), examResultDataBo!.score!.round().toString(),
style: TextStyle( style: TextStyle(
color: color: examResultDataBo!.score! < 90
examResultDataBo!.score! < 90 ? Colors.red : Colors.green, ? Colors.red
: Colors.green,
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.bold), fontWeight: FontWeight.bold),
), ),
...@@ -119,10 +152,11 @@ class _ExamResultPageState extends State<ExamResultPage> { ...@@ -119,10 +152,11 @@ class _ExamResultPageState extends State<ExamResultPage> {
TextSpan(children: [ TextSpan(children: [
const TextSpan( const TextSpan(
text: "答对 ", text: "答对 ",
style: style: TextStyle(
TextStyle(fontSize: 14, color: Colors.grey)), fontSize: 14, color: Colors.grey)),
TextSpan( TextSpan(
text: "${examResultDataBo!.correct.toString()}题", text:
"${examResultDataBo!.correct.toString()}题",
style: const TextStyle( style: const TextStyle(
fontSize: 14, color: Colors.black87)), fontSize: 14, color: Colors.black87)),
])), ])),
...@@ -132,10 +166,11 @@ class _ExamResultPageState extends State<ExamResultPage> { ...@@ -132,10 +166,11 @@ class _ExamResultPageState extends State<ExamResultPage> {
TextSpan(children: [ TextSpan(children: [
const TextSpan( const TextSpan(
text: "答错 ", text: "答错 ",
style: style: TextStyle(
TextStyle(fontSize: 14, color: Colors.grey)), fontSize: 14, color: Colors.grey)),
TextSpan( TextSpan(
text: "${examResultDataBo!.error.toString()}题", text:
"${examResultDataBo!.error.toString()}题",
style: const TextStyle( style: const TextStyle(
fontSize: 14, color: Colors.black87)), fontSize: 14, color: Colors.black87)),
])), ])),
...@@ -145,8 +180,8 @@ class _ExamResultPageState extends State<ExamResultPage> { ...@@ -145,8 +180,8 @@ class _ExamResultPageState extends State<ExamResultPage> {
TextSpan(children: [ TextSpan(children: [
const TextSpan( const TextSpan(
text: "总题 ", text: "总题 ",
style: style: TextStyle(
TextStyle(fontSize: 14, color: Colors.grey)), fontSize: 14, color: Colors.grey)),
TextSpan( TextSpan(
text: text:
"${examResultDataBo!.questionNum.toString()}题", "${examResultDataBo!.questionNum.toString()}题",
...@@ -186,6 +221,8 @@ class _ExamResultPageState extends State<ExamResultPage> { ...@@ -186,6 +221,8 @@ class _ExamResultPageState extends State<ExamResultPage> {
], ],
), ),
), ),
],
),
); );
} }
......
...@@ -3,17 +3,13 @@ import 'package:get/get.dart'; ...@@ -3,17 +3,13 @@ import 'package:get/get.dart';
import 'package:sliding_up_panel/sliding_up_panel.dart'; import 'package:sliding_up_panel/sliding_up_panel.dart';
import 'package:special_equipment_flutter/common/color_const.dart'; import 'package:special_equipment_flutter/common/color_const.dart';
import 'package:special_equipment_flutter/dio/http_utils.dart'; import 'package:special_equipment_flutter/dio/http_utils.dart';
import 'package:special_equipment_flutter/model/exam/exam_result_bo.dart';
import 'package:special_equipment_flutter/model/exam/test_questions_bo.dart'; import 'package:special_equipment_flutter/model/exam/test_questions_bo.dart';
import 'package:special_equipment_flutter/model/exam/test_setting_bo.dart'; import 'package:special_equipment_flutter/model/exam/test_setting_bo.dart';
import 'package:special_equipment_flutter/ui/examine/test/custom/bottom_sheet.dart'; import 'package:special_equipment_flutter/ui/examine/test/custom/bottom_sheet.dart';
import 'package:special_equipment_flutter/ui/examine/test/custom/choice_item.dart'; import 'package:special_equipment_flutter/ui/examine/test/custom/choice_item.dart';
import 'package:special_equipment_flutter/utils/toast_utils.dart';
import 'package:special_equipment_flutter/widgets/app_bar/custom_app_bar_back.dart'; import 'package:special_equipment_flutter/widgets/app_bar/custom_app_bar_back.dart';
import 'package:special_equipment_flutter/widgets/custom_button.dart'; import 'package:special_equipment_flutter/widgets/custom_button.dart';
import '../../../common/route_string.dart';
///考核答题页面 ///考核答题页面
class TestPage extends StatefulWidget { class TestPage extends StatefulWidget {
var arguments = Get.arguments; var arguments = Get.arguments;
...@@ -85,7 +81,39 @@ class TestPageState extends State<TestPage> with TickerProviderStateMixin { ...@@ -85,7 +81,39 @@ class TestPageState extends State<TestPage> with TickerProviderStateMixin {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return WillPopScope(
onWillPop: () async {
Get.dialog(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),
shape: const RoundedRectangleBorder(
// 这里设置shape属性
borderRadius: BorderRadius.all(Radius.circular(10.0))),
actions: <Widget>[
TextButton(
child: const Text("取消", style: TextStyle(fontSize: 16)),
onPressed: () {
Get.back();
},
),
TextButton(
child: const Text("确定", style: TextStyle(fontSize: 16)),
onPressed: () {
Get.back();
Get.back();
},
),
],
));
return true; // 控制是否可以侧滑返回,true为允许,false为不允许
},
child: Scaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
appBar: AppBarCustom( appBar: AppBarCustom(
leading: IconButton( leading: IconButton(
...@@ -189,7 +217,8 @@ class TestPageState extends State<TestPage> with TickerProviderStateMixin { ...@@ -189,7 +217,8 @@ class TestPageState extends State<TestPage> with TickerProviderStateMixin {
color: ColorConst.blueColor, color: ColorConst.blueColor,
fontWeight: FontWeight.bold)), fontWeight: FontWeight.bold)),
TextSpan( TextSpan(
text: " /${examQuestionList!.length}", text:
" /${examQuestionList!.length}",
style: const TextStyle( style: const TextStyle(
fontSize: 15, fontSize: 15,
color: Colors.black87)), color: Colors.black87)),
...@@ -201,8 +230,8 @@ class TestPageState extends State<TestPage> with TickerProviderStateMixin { ...@@ -201,8 +230,8 @@ class TestPageState extends State<TestPage> with TickerProviderStateMixin {
), ),
Container( Container(
height: 380, height: 380,
margin: margin: const EdgeInsets.only(
const EdgeInsets.only(top: 0, left: 10, right: 10), top: 0, left: 10, right: 10),
padding: const EdgeInsets.all(10), padding: const EdgeInsets.all(10),
decoration: const BoxDecoration( decoration: const BoxDecoration(
color: Colors.white, color: Colors.white,
...@@ -236,7 +265,8 @@ class TestPageState extends State<TestPage> with TickerProviderStateMixin { ...@@ -236,7 +265,8 @@ class TestPageState extends State<TestPage> with TickerProviderStateMixin {
///内容区 ///内容区
body: Column(children: [buildExpanded()]), body: Column(children: [buildExpanded()]),
)); )),
);
} }
Container buildSliverToBoxAdapter(var text) { Container buildSliverToBoxAdapter(var text) {
......
...@@ -82,6 +82,7 @@ class _HomePageState extends State<HomePage> ...@@ -82,6 +82,7 @@ class _HomePageState extends State<HomePage>
List<CountData>? findCountList = []; List<CountData>? findCountList = [];
ExaminePersonBo? mExaminePersonBo = ExaminePersonBo(); ExaminePersonBo? mExaminePersonBo = ExaminePersonBo();
OverseerHistoryListBo? mOverseerHistoryListBo = OverseerHistoryListBo(); OverseerHistoryListBo? mOverseerHistoryListBo = OverseerHistoryListBo();
int mOverseerHistoryCount = 0;
List<HistoryListData>? mHistoryListData = []; List<HistoryListData>? mHistoryListData = [];
//声明,后面需要销毁 //声明,后面需要销毁
...@@ -152,6 +153,7 @@ class _HomePageState extends State<HomePage> ...@@ -152,6 +153,7 @@ class _HomePageState extends State<HomePage>
if (mounted) { if (mounted) {
setState(() { setState(() {
mOverseerHistoryListBo = value; mOverseerHistoryListBo = value;
mOverseerHistoryCount = mOverseerHistoryListBo!.count!;
mHistoryListData = mOverseerHistoryListBo!.data; mHistoryListData = mOverseerHistoryListBo!.data;
}); });
} }
...@@ -489,7 +491,9 @@ class _HomePageState extends State<HomePage> ...@@ -489,7 +491,9 @@ class _HomePageState extends State<HomePage>
onTap: () { onTap: () {
Get.toNamed(RouteString.OVERSEER_HISTORY_LIST_PAGE, Get.toNamed(RouteString.OVERSEER_HISTORY_LIST_PAGE,
arguments: {})?.then((value) { arguments: {})?.then((value) {
if (value != null && value) {} if (value != null && value) {
getOverseerHistoryList();
}
}); });
}, },
child: Container( child: Container(
...@@ -524,7 +528,7 @@ class _HomePageState extends State<HomePage> ...@@ -524,7 +528,7 @@ class _HomePageState extends State<HomePage>
style: TextStyle(fontSize: 12, color: Colors.orange)), style: TextStyle(fontSize: 12, color: Colors.orange)),
TextSpan( TextSpan(
text: mOverseerHistoryListBo != null text: mOverseerHistoryListBo != null
? mOverseerHistoryListBo!.count.toString() ? mOverseerHistoryCount.toString()
: '0', : '0',
style: const TextStyle( style: const TextStyle(
fontSize: 16, fontSize: 16,
...@@ -544,7 +548,8 @@ class _HomePageState extends State<HomePage> ...@@ -544,7 +548,8 @@ class _HomePageState extends State<HomePage>
}), }),
] else ...[ ] else ...[
Container( Container(
margin: const EdgeInsets.only(left: 5, right: 5, top: 0, bottom: 0), margin:
const EdgeInsets.only(left: 5, right: 5, top: 0, bottom: 30),
child: ListView.separated( child: ListView.separated(
shrinkWrap: true, shrinkWrap: true,
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
...@@ -562,7 +567,9 @@ class _HomePageState extends State<HomePage> ...@@ -562,7 +567,9 @@ class _HomePageState extends State<HomePage>
arguments: { arguments: {
'id': mHistoryListData![index].id, 'id': mHistoryListData![index].id,
})?.then((value) { })?.then((value) {
if (value != null && value) {} if (value != null && value) {
getOverseerHistoryList();
}
}); });
}, },
child: Card( child: Card(
...@@ -746,6 +753,7 @@ class _HomePageState extends State<HomePage> ...@@ -746,6 +753,7 @@ class _HomePageState extends State<HomePage>
mHistoryListData! mHistoryListData!
.removeAt( .removeAt(
index); index);
mOverseerHistoryCount--;
ToastUtils ToastUtils
.showCenter( .showCenter(
'删除成功'); '删除成功');
...@@ -788,7 +796,9 @@ class _HomePageState extends State<HomePage> ...@@ -788,7 +796,9 @@ class _HomePageState extends State<HomePage>
'id': mHistoryListData![index] 'id': mHistoryListData![index]
.id, .id,
})?.then((value) { })?.then((value) {
if (value != null && value) {} if (value != null && value) {
getOverseerHistoryList();
}
}); });
}, },
width: 60, width: 60,
......
...@@ -8,6 +8,7 @@ import 'package:special_equipment_flutter/model/exam/overseer_history_informatio ...@@ -8,6 +8,7 @@ import 'package:special_equipment_flutter/model/exam/overseer_history_informatio
import 'package:special_equipment_flutter/utils/size_config.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/storage_util.dart';
import 'package:special_equipment_flutter/utils/time_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/divider_custom.dart'; import 'package:special_equipment_flutter/widgets/divider_custom.dart';
import '../../widgets/app_bar/custom_app_bar.dart'; import '../../widgets/app_bar/custom_app_bar.dart';
...@@ -69,7 +70,12 @@ class _OverseerHistroyDetailsPageState ...@@ -69,7 +70,12 @@ class _OverseerHistroyDetailsPageState
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return WillPopScope(
onWillPop: () async {
Get.back(result: true);
return true; // 控制是否可以侧滑返回,true为允许,false为不允许
},
child: Scaffold(
backgroundColor: ColorConst.grayf5Color, backgroundColor: ColorConst.grayf5Color,
appBar: AppBarCustom( appBar: AppBarCustom(
text: '监察记录详情', text: '监察记录详情',
...@@ -193,7 +199,7 @@ class _OverseerHistroyDetailsPageState ...@@ -193,7 +199,7 @@ class _OverseerHistroyDetailsPageState
style: TextStyle( style: TextStyle(
fontSize: 14, color: Colors.black54)), fontSize: 14, color: Colors.black54)),
TextSpan( TextSpan(
text: timestampToDate( text: timestampToDate2(
data != null ? data!.createDate! : 0), data != null ? data!.createDate! : 0),
style: const TextStyle( style: const TextStyle(
fontSize: 14, color: Colors.black54)), fontSize: 14, color: Colors.black54)),
...@@ -228,7 +234,8 @@ class _OverseerHistroyDetailsPageState ...@@ -228,7 +234,8 @@ class _OverseerHistroyDetailsPageState
ListView.separated( ListView.separated(
shrinkWrap: true, shrinkWrap: true,
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: EdgeInsetsConst.padding_horizontal), horizontal:
EdgeInsetsConst.padding_horizontal),
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return Container( return Container(
...@@ -246,7 +253,8 @@ class _OverseerHistroyDetailsPageState ...@@ -246,7 +253,8 @@ class _OverseerHistroyDetailsPageState
child: Column( child: Column(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.spaceBetween, MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Row( Row(
mainAxisAlignment: mainAxisAlignment:
...@@ -265,8 +273,9 @@ class _OverseerHistroyDetailsPageState ...@@ -265,8 +273,9 @@ class _OverseerHistroyDetailsPageState
: '已完成', : '已完成',
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
color: color: rowList![index]
rowList![index].adopt == "0" .adopt ==
"0"
? ColorConst.red1BgColor ? ColorConst.red1BgColor
: ColorConst.greenColor, : ColorConst.greenColor,
fontWeight: FontWeight.bold)), fontWeight: FontWeight.bold)),
...@@ -319,8 +328,8 @@ class _OverseerHistroyDetailsPageState ...@@ -319,8 +328,8 @@ class _OverseerHistroyDetailsPageState
.toString(), .toString(),
style: const TextStyle( style: const TextStyle(
fontSize: 16, fontSize: 16,
color: color: ColorConst
ColorConst.greenColor, .greenColor,
fontWeight: fontWeight:
FontWeight.bold)), FontWeight.bold)),
const TextSpan( const TextSpan(
...@@ -380,7 +389,8 @@ class _OverseerHistroyDetailsPageState ...@@ -380,7 +389,8 @@ class _OverseerHistroyDetailsPageState
// ), // ),
// ) // )
], ],
)); )),
);
} }
Container buildTitleContainer( Container buildTitleContainer(
......
...@@ -6,6 +6,7 @@ import 'package:special_equipment_flutter/common/edgeInsets_const.dart'; ...@@ -6,6 +6,7 @@ import 'package:special_equipment_flutter/common/edgeInsets_const.dart';
import 'package:special_equipment_flutter/common/route_string.dart'; import 'package:special_equipment_flutter/common/route_string.dart';
import 'package:special_equipment_flutter/dio/http_utils.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/model/exam/overseer_history_list_bo.dart';
import 'package:special_equipment_flutter/utils/eventbus_utils.dart';
import 'package:special_equipment_flutter/utils/storage_util.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/string_utils.dart';
import 'package:special_equipment_flutter/utils/time_util.dart'; import 'package:special_equipment_flutter/utils/time_util.dart';
...@@ -69,7 +70,12 @@ class _OverseerHistoryListPageState extends State<OverseerHistoryListPage> { ...@@ -69,7 +70,12 @@ class _OverseerHistoryListPageState extends State<OverseerHistoryListPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return WillPopScope(
onWillPop: () async {
Get.back(result: true);
return true; // 控制是否可以侧滑返回,true为允许,false为不允许
},
child: Scaffold(
appBar: AppBarCustom(text: '考核列表', height: 50), appBar: AppBarCustom(text: '考核列表', height: 50),
backgroundColor: Colors.grey[100], backgroundColor: Colors.grey[100],
body: Column( body: Column(
...@@ -101,6 +107,7 @@ class _OverseerHistoryListPageState extends State<OverseerHistoryListPage> { ...@@ -101,6 +107,7 @@ class _OverseerHistoryListPageState extends State<OverseerHistoryListPage> {
)), )),
], ],
), ),
),
); );
} }
...@@ -271,6 +278,9 @@ class _OverseerHistoryListPageState extends State<OverseerHistoryListPage> { ...@@ -271,6 +278,9 @@ class _OverseerHistoryListPageState extends State<OverseerHistoryListPage> {
setState(() { setState(() {
mHistoryListData! mHistoryListData!
.removeAt(index); .removeAt(index);
//发出通知
EventBusUtils.getInstance()
?.fire("2");
ToastUtils.showCenter('删除成功'); ToastUtils.showCenter('删除成功');
Get.back(); Get.back();
}); });
......
...@@ -512,10 +512,33 @@ class _OverseerSettingsState extends State<OverseerSettingsPage> { ...@@ -512,10 +512,33 @@ class _OverseerSettingsState extends State<OverseerSettingsPage> {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
setState(() { setState(() {
///当前状态是否禁止选中 true 可选 可以操作
if (userSafetyDirectorList![index].isUserSafetyDirectorChecked!) {
///如果当前选择状态为 true,选中
if (userSafetyDirectorList![index].isChecked!) { if (userSafetyDirectorList![index].isChecked!) {
userSafetyDirectorList![index].isChecked = false; userSafetyDirectorList![index].isChecked = false;
for (var i = 0; i < userSafetyOfficerList!.length; i++) {
///安全总监--->判断安全员是否有相同人员
if (userSafetyDirectorList![index].id ==
userSafetyOfficerList![i].id) {
userSafetyOfficerList![i].isUserSafetyOfficerChecked =
true;
}
}
} else { } else {
///未选中
userSafetyDirectorList![index].isChecked = true; userSafetyDirectorList![index].isChecked = true;
for (var i = 0; i < userSafetyOfficerList!.length; i++) {
///安全总监--->判断安全员是否有相同人员
if (userSafetyDirectorList![index].id ==
userSafetyOfficerList![i].id) {
userSafetyOfficerList![i].isUserSafetyOfficerChecked =
false;
}
}
}
} else {
///禁止选中
} }
}); });
}, },
...@@ -530,14 +553,70 @@ class _OverseerSettingsState extends State<OverseerSettingsPage> { ...@@ -530,14 +553,70 @@ class _OverseerSettingsState extends State<OverseerSettingsPage> {
child: Row( child: Row(
children: [ children: [
Checkbox( Checkbox(
value: userSafetyDirectorList![index].isChecked, value: userSafetyDirectorList![index]
onChanged: (value) { .isUserSafetyDirectorChecked!
? userSafetyDirectorList![index].isChecked
: false,
side: MaterialStateBorderSide.resolveWith(
(Set<MaterialState> states) {
//设置未选中为灰色
return userSafetyDirectorList![index]
.isUserSafetyDirectorChecked!
? null
: const BorderSide(width: 2, color: Colors.black12);
},
),
onChanged: userSafetyDirectorList![index]
.isUserSafetyDirectorChecked!
? (value) {
if (value != null) {
setState(() { setState(() {
// selectedSafetyDirectorIndex = value!; ///当前状态是否禁止选中 true 可选 可以操作
if (userSafetyDirectorList![index]
.isUserSafetyDirectorChecked!) {
///如果当前选择状态为 true,选中
if (userSafetyDirectorList![index].isChecked!) {
userSafetyDirectorList![index].isChecked =
false;
for (var i = 0;
i < userSafetyOfficerList!.length;
i++) {
///安全总监--->判断安全员是否有相同人员
if (userSafetyDirectorList![index].id ==
userSafetyOfficerList![i].id) {
userSafetyOfficerList![i]
.isUserSafetyOfficerChecked = true;
}
}
} else {
///未选中
userSafetyDirectorList![index].isChecked =
true;
for (var i = 0;
i < userSafetyOfficerList!.length;
i++) {
///安全总监--->判断安全员是否有相同人员
if (userSafetyDirectorList![index].id ==
userSafetyOfficerList![i].id) {
userSafetyOfficerList![i]
.isUserSafetyOfficerChecked = false;
}
}
}
} else {
///禁止选中
}
}); });
}, }
}
: null,
), ),
Text(userSafetyDirectorList![index].name!) Text(userSafetyDirectorList![index].name!,
style: TextStyle(
color: userSafetyDirectorList![index]
.isUserSafetyDirectorChecked!
? Colors.black
: Colors.black12))
], ],
), ),
), ),
...@@ -554,21 +633,39 @@ class _OverseerSettingsState extends State<OverseerSettingsPage> { ...@@ -554,21 +633,39 @@ class _OverseerSettingsState extends State<OverseerSettingsPage> {
itemCount: userSafetyOfficerList!.length, itemCount: userSafetyOfficerList!.length,
// 列表项数量 // 列表项数量
itemBuilder: (context, index) { itemBuilder: (context, index) {
return GestureDetector( return InkWell(
onTap: () { onTap: () {
setState(() { setState(() {
///当前状态是否禁止选中 true 可选 可以操作
if (userSafetyOfficerList![index].isUserSafetyOfficerChecked!) {
///如果当前选择状态为 true,选中
if (userSafetyOfficerList![index].isChecked!) { if (userSafetyOfficerList![index].isChecked!) {
userSafetyOfficerList![index].isChecked = false; userSafetyOfficerList![index].isChecked = false;
for (var i = 0; i < userSafetyDirectorList!.length; i++) {
///安全总监--->判断安全员是否有相同人员
if (userSafetyOfficerList![index].id ==
userSafetyDirectorList![i].id) {
userSafetyDirectorList![i].isUserSafetyDirectorChecked =
true;
}
}
} else { } else {
///未选中
userSafetyOfficerList![index].isChecked = true; userSafetyOfficerList![index].isChecked = true;
for (var i = 0; i < userSafetyDirectorList!.length; i++) {
///安全总监--->判断安全员是否有相同人员
if (userSafetyOfficerList![index].id ==
userSafetyDirectorList![i].id) {
userSafetyDirectorList![i].isUserSafetyDirectorChecked =
false;
}
}
}
} }
}); });
}, },
child: Container( child: Container(
height: 40, height: 40,
// color: _selectedIndex == index
// ? Colors.grey.withOpacity(0.3)
// : Colors.transparent, // 选中时高亮背景色
decoration: BoxDecoration( decoration: BoxDecoration(
color: userSafetyOfficerList![index].isChecked! color: userSafetyOfficerList![index].isChecked!
? Colors.grey.withOpacity(0.3) ? Colors.grey.withOpacity(0.3)
...@@ -578,14 +675,68 @@ class _OverseerSettingsState extends State<OverseerSettingsPage> { ...@@ -578,14 +675,68 @@ class _OverseerSettingsState extends State<OverseerSettingsPage> {
child: Row( child: Row(
children: [ children: [
Checkbox( Checkbox(
value: userSafetyOfficerList![index].isChecked, value:
onChanged: (value) { userSafetyOfficerList![index].isUserSafetyOfficerChecked!
? userSafetyOfficerList![index].isChecked
: false,
side: MaterialStateBorderSide.resolveWith(
(Set<MaterialState> states) {
//设置未选中为灰色
return userSafetyOfficerList![index]
.isUserSafetyOfficerChecked!
? null
: const BorderSide(width: 2, color: Colors.black12);
},
),
onChanged: userSafetyOfficerList![index]
.isUserSafetyOfficerChecked!
? (value) {
if (value != null) {
setState(() { setState(() {
// selectedSafetyDirectorIndex = value!; ///当前状态是否禁止选中 true 可选 可以操作
if (userSafetyOfficerList![index]
.isUserSafetyOfficerChecked!) {
///如果当前选择状态为 true,选中
if (userSafetyOfficerList![index].isChecked!) {
userSafetyOfficerList![index].isChecked =
false;
for (var i = 0;
i < userSafetyDirectorList!.length;
i++) {
///安全总监--->判断安全员是否有相同人员
if (userSafetyOfficerList![index].id ==
userSafetyDirectorList![i].id) {
userSafetyDirectorList![i]
.isUserSafetyDirectorChecked = true;
}
}
} else {
///未选中
userSafetyOfficerList![index].isChecked =
true;
for (var i = 0;
i < userSafetyDirectorList!.length;
i++) {
///安全总监--->判断安全员是否有相同人员
if (userSafetyOfficerList![index].id ==
userSafetyDirectorList![i].id) {
userSafetyDirectorList![i]
.isUserSafetyDirectorChecked = false;
}
}
}
}
}); });
}, }
}
: null,
), ),
Text(userSafetyOfficerList![index].name!) Text(userSafetyOfficerList![index].name!,
style: TextStyle(
color: userSafetyOfficerList![index]
.isUserSafetyOfficerChecked!
? Colors.black
: Colors.black12))
], ],
), ),
), ),
......
...@@ -54,3 +54,9 @@ String timestampToDate(int timestamp) { ...@@ -54,3 +54,9 @@ String timestampToDate(int timestamp) {
var formatter = DateFormat('yyyy-MM-dd HH:mm:ss'); var formatter = DateFormat('yyyy-MM-dd HH:mm:ss');
return formatter.format(date); return formatter.format(date);
} }
String timestampToDate2(int timestamp) {
var date = DateTime.fromMillisecondsSinceEpoch(timestamp);
var formatter = DateFormat('yyyy-MM-dd');
return formatter.format(date);
}
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