Commit 79bc250a by York

增加广告位,修改 bug

parent 05716b0f
File added
......@@ -7,13 +7,14 @@ import 'package:special_equipment_flutter/ui/examine/exam/exam_result_page.dart'
import 'package:special_equipment_flutter/ui/examine/test/test_page.dart';
import 'package:special_equipment_flutter/ui/examine/test/test_result_page.dart';
import 'package:special_equipment_flutter/ui/examine/test/test_setting_page.dart';
import 'package:special_equipment_flutter/ui/file/file_list_page.dart';
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/equipment_list_page1.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/overseer_settings_pages.dart';
import 'package:special_equipment_flutter/ui/overseer/unit_list_page.dart';
import 'package:special_equipment_flutter/ui/register/address_page.dart';
import 'package:special_equipment_flutter/ui/register/register_page1.dart';
......@@ -142,6 +143,9 @@ class RouteString {
static const String OVERSEER_HISTROY_DETAILS_PAGE =
"/OverseerHistroyDetailsPage";
///文件预览
static const String FILE_LIST_PAGE = "/FileListPage";
static final routes = [
///登录
GetPage(name: LOGIN, page: () => const LoginPage()),
......@@ -222,7 +226,7 @@ class RouteString {
GetPage(name: EXAM_RESULT_PAGE, page: () => ExamResultPage()),
///监察人设置考核
GetPage(name: OVERSEER_SETTINGS_PAGE, page: () => OverseerSettingsPage()),
GetPage(name: OVERSEER_SETTINGS_PAGE, page: () => OverseerSettingsPages()),
///监察人选择单位
GetPage(name: UNIT_LIST_PAGE, page: () => UnitListPage()),
......@@ -246,6 +250,9 @@ class RouteString {
name: OVERSEER_HISTROY_DETAILS_PAGE,
page: () => OverseerHistroyDetailsPage()),
///文件预览
GetPage(name: FILE_LIST_PAGE, page: () => FileListPage()),
// GetPage(
// name: "/shop",
// page: () => const ShopPage(),
......
......@@ -3,15 +3,15 @@
class Api {
static var IS_DEBUG = true;
static String URL =
IS_DEBUG ? "https://special.sxyztech.cn/" : "http://192.168.19.165:2212/";
// static String URL =
// IS_DEBUG ? "https://special.sxyztech.cn/" : "http://192.168.19.165:2222/";
///演示 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.215:8181/";
static String START_URL = "special/a/",
END_URL = "__ajax=true&mobileLogin=true";
......@@ -239,6 +239,9 @@ class Api {
/// 监察记录 删除
static String EXAM_SETUP_DELETE = "${URL + START_URL}exam/examSetup/delete";
/// 首页广告 banner
static String BANNER = "${URL + START_URL}advertis/advertis/appAdvertisList";
/// 获取考核信息
// static String EXAMINE_PERSON = "${URL + START_URL}/exam/examPerson/checkHaveExam";
}
......@@ -8,6 +8,7 @@ import 'package:get/route_manager.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_roles.dart';
import 'package:special_equipment_flutter/model/banner_list_bo.dart';
import 'package:special_equipment_flutter/model/base/base_model.dart';
import 'package:special_equipment_flutter/model/base/result_obj_bo.dart';
import 'package:special_equipment_flutter/model/city_address_bo.dart';
......@@ -1705,6 +1706,30 @@ class HttpUtils {
}
}
///首页广告 banner
static Future getBannerList(BuildContext context) async {
Map<String, dynamic> params = {};
var response = await NetUtils.get(
context,
'${Api.BANNER};JSESSIONID=${StorageUtil.getInstance().getJsessionId()}',
false,
params);
try {
BaseModel entity = BaseModel.fromJson(response);
Map<String, dynamic> resultData = entity.body;
BannerListBo mBannerListBo = BannerListBo.fromJson(resultData);
if (entity.errorCode == "-1") {
return mBannerListBo;
} 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);
......
class BannerListBo {
BannerListBo({
this.data,
});
BannerListBo.fromJson(dynamic json) {
if (json['data'] != null) {
data = [];
json['data'].forEach((v) {
data?.add(Data.fromJson(v));
});
}
}
List<Data>? data;
BannerListBo copyWith({
List<Data>? data,
}) =>
BannerListBo(
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 Data {
Data({
this.id,
this.remarks,
this.createBy,
this.createDate,
this.updateBy,
this.updateDate,
this.businessName,
this.advertisUrl,
this.advertisPosition,
this.linkUrl,
this.isShow,
});
Data.fromJson(dynamic json) {
id = json['id'];
remarks = json['remarks'];
createBy =
json['createBy'] != null ? CreateBy.fromJson(json['createBy']) : null;
createDate = json['createDate'];
updateBy =
json['updateBy'] != null ? UpdateBy.fromJson(json['updateBy']) : null;
updateDate = json['updateDate'];
businessName = json['businessName'];
advertisUrl = json['advertisUrl'];
advertisPosition = json['advertisPosition'];
linkUrl = json['linkUrl'];
isShow = json['isShow'];
}
String? id;
String? remarks;
CreateBy? createBy;
String? createDate;
UpdateBy? updateBy;
String? updateDate;
String? businessName;
String? advertisUrl;
String? advertisPosition;
String? linkUrl;
String? isShow;
Data copyWith({
String? id,
String? remarks,
CreateBy? createBy,
String? createDate,
UpdateBy? updateBy,
String? updateDate,
String? businessName,
String? advertisUrl,
String? advertisPosition,
String? linkUrl,
String? isShow,
}) =>
Data(
id: id ?? this.id,
remarks: remarks ?? this.remarks,
createBy: createBy ?? this.createBy,
createDate: createDate ?? this.createDate,
updateBy: updateBy ?? this.updateBy,
updateDate: updateDate ?? this.updateDate,
businessName: businessName ?? this.businessName,
advertisUrl: advertisUrl ?? this.advertisUrl,
advertisPosition: advertisPosition ?? this.advertisPosition,
linkUrl: linkUrl ?? this.linkUrl,
isShow: isShow ?? this.isShow,
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = id;
map['remarks'] = remarks;
if (createBy != null) {
map['createBy'] = createBy?.toJson();
}
map['createDate'] = createDate;
if (updateBy != null) {
map['updateBy'] = updateBy?.toJson();
}
map['updateDate'] = updateDate;
map['businessName'] = businessName;
map['advertisUrl'] = advertisUrl;
map['advertisPosition'] = advertisPosition;
map['linkUrl'] = linkUrl;
map['isShow'] = isShow;
return map;
}
}
class UpdateBy {
UpdateBy({
this.id,
this.loginFlag,
this.roleNames,
this.admin,
});
UpdateBy.fromJson(dynamic json) {
id = json['id'];
loginFlag = json['loginFlag'];
roleNames = json['roleNames'];
admin = json['admin'];
}
String? id;
String? loginFlag;
String? roleNames;
bool? admin;
UpdateBy copyWith({
String? id,
String? loginFlag,
String? roleNames,
bool? admin,
}) =>
UpdateBy(
id: id ?? this.id,
loginFlag: loginFlag ?? this.loginFlag,
roleNames: roleNames ?? this.roleNames,
admin: admin ?? this.admin,
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = id;
map['loginFlag'] = loginFlag;
map['roleNames'] = roleNames;
map['admin'] = admin;
return map;
}
}
class CreateBy {
CreateBy({
this.id,
this.loginFlag,
this.roleNames,
this.admin,
});
CreateBy.fromJson(dynamic json) {
id = json['id'];
loginFlag = json['loginFlag'];
roleNames = json['roleNames'];
admin = json['admin'];
}
String? id;
String? loginFlag;
String? roleNames;
bool? admin;
CreateBy copyWith({
String? id,
String? loginFlag,
String? roleNames,
bool? admin,
}) =>
CreateBy(
id: id ?? this.id,
loginFlag: loginFlag ?? this.loginFlag,
roleNames: roleNames ?? this.roleNames,
admin: admin ?? this.admin,
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = id;
map['loginFlag'] = loginFlag;
map['roleNames'] = roleNames;
map['admin'] = admin;
return map;
}
}
......@@ -43,6 +43,7 @@ class EquiList {
String? id;
String? name;
bool isChecked = false;
EquiList copyWith({
String? id,
......
class UserBo {
String? account;
String? password;
UserBo(this.account, this.password);
Map<String, dynamic> toJson() {
return {
'account': account,
'password': password,
};
}
}
import 'package:flutter/material.dart';
class FileListPage extends StatefulWidget {
const FileListPage({Key? key}) : super(key: key);
@override
State<FileListPage> createState() => _FileListPageState();
}
class _FileListPageState extends State<FileListPage> {
final String filePath = 'assets/name.pdf';
final sampleUrl = 'http://www.pdf995.com/samples/pdf.pdf';
// final pdfController = PdfController(
// document: PdfDocument.openAsset('assets/name.pdf'),
// );
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Builder(builder: (context) {
return Scaffold(
backgroundColor: Colors.black,
appBar: AppBar(
title: Text('Plugin example app'),
),
body: Container(),
);
}),
);
}
// dynamic buildPdfView() {
// return PdfView(
// controller: pdfController,
// );
// }
}
// ignore_for_file: use_build_context_synchronously, sort_child_properties_last, unnecessary_null_comparison, prefer_typing_uninitialized_variables
import 'dart:convert';
import 'dart:io';
import 'package:flutter/material.dart';
......@@ -11,7 +12,9 @@ import 'package:special_equipment_flutter/common/route_string.dart';
import 'package:special_equipment_flutter/dio/http_utils.dart';
import 'package:special_equipment_flutter/model/app_is_open.dart';
import 'package:special_equipment_flutter/model/login_bo.dart';
import 'package:special_equipment_flutter/model/user_bo.dart';
import 'package:special_equipment_flutter/ui/common/data.dart';
import 'package:special_equipment_flutter/utils/sp_account_utils.dart';
import 'package:special_equipment_flutter/utils/storage_util.dart';
import 'package:special_equipment_flutter/utils/toast_utils.dart';
import 'package:special_equipment_flutter/widgets/custom_button.dart';
......@@ -88,10 +91,12 @@ class EditTextState extends State<EditTextWidget>
late final Animation<double> logoAnimation;
var versionName;
String? isOpen = '0';
bool isPassword = true;
@override
void initState() {
_initPackageInfo();
getAccountList();
phoneController = TextEditingController();
passController = TextEditingController();
phoneController.addListener(() {
......@@ -101,8 +106,10 @@ class EditTextState extends State<EditTextWidget>
phoneController.value = phoneController.value.copyWith(
text: Api.IS_DEBUG ? StorageUtil.getInstance().getUserName() : 'tyjcr');
passController.value =
passController.value.copyWith(text: Api.IS_DEBUG ? '' : 'Aa123456.');
passController.value = passController.value.copyWith(
text: Api.IS_DEBUG
? StorageUtil.getInstance().getPassword()
: 'Aa123456.');
super.initState();
logoController = AnimationController(
......@@ -194,9 +201,194 @@ class EditTextState extends State<EditTextWidget>
buildTips(),
const SizedBox(height: 30),
accountTextField(context), //账号
const SizedBox(height: 12), //账号和密码间距
buildPasswordTextField(context), //密码
accountTextField(context),
//账号
const SizedBox(height: 12),
//账号和密码间距
buildPasswordTextField(context),
//密码
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
GestureDetector(
onTap: () {
setState(() {
isPassword = !isPassword;
});
},
child: Row(
children: [
Container(
width: 30,
margin: const EdgeInsets.only(left: 35),
child: Checkbox(
value: isPassword,
onChanged: (bool? value) {
setState(() {
isPassword =
value!; // 更新 isChecked 的状态值
});
},
),
),
Container(
child: const Text('记住密码'),
margin: const EdgeInsets.only(bottom: 3),
),
],
),
),
GestureDetector(
onTap: () {
// List<UserBo> userList =
// StorageUtil.getInstance().getUserList();
setState(() {
if (listAccount.isNotEmpty) {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
titlePadding: const EdgeInsets.only(
left: 20, right: 20, top: 10),
title: const Text('历史登录账号、密码'),
actions: <Widget>[
ListView.separated(
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: listAccount.length,
itemBuilder: (BuildContext context,
int index) {
return InkWell(
splashColor:
ColorConst.themeBgColor,
onTap: () {
setState(() {
phoneController.value =
phoneController.value
.copyWith(
text: listAccount[
index]
.account);
passController.value =
passController.value
.copyWith(
text: listAccount[
index]
.password);
Get.back();
});
},
child: Padding(
padding:
const EdgeInsets.only(
left: 10),
child: Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Row(
children: [
Icon(
Icons.person,
size: 25,
color: Colors.grey,
),
Text(
listAccount[index]
.account!,
style: const TextStyle(
fontSize: 16,
color: ColorConst
.blueColor),
),
],
),
InkWell(
onTap: () {
setState(() {
showDialog(
context:
context,
builder:
(context) {
return AlertDialog(
content: Text(
"您确定要清除【${listAccount[index].account}】这个历史纪录账号吗?"),
actions: [
TextButton(
child: const Text(
"取消"),
onPressed:
() {
Navigator.of(context)
.pop();
},
),
TextButton(
child: const Text(
"确定"),
onPressed:
() {
ToastUtils.showCenter("已清除【${listAccount[index].account}】的历史账号");
SPAccountUtil.delUser(listAccount[index],
index);
debugPrint(jsonEncode(listAccount));
listAccount.remove(listAccount[index]);
Get.back();
Get.back();
})
],
);
});
});
},
child: const Padding(
padding:
EdgeInsets.all(
13.0),
child: Icon(
Icons.clear,
size: 18,
color: Colors.grey,
),
),
)
],
),
),
);
},
separatorBuilder:
(BuildContext context,
int index) {
return Container(
height: 1,
color: Colors.grey[100],
);
},
)
],
);
},
);
} else {
ToastUtils.showCenter('暂无历史登录账号');
}
});
},
child: Container(
margin: const EdgeInsets.only(bottom: 3),
child: const Text(
'历史登录账号>',
style: TextStyle(color: ColorConst.blueColor),
),
),
),
],
),
const SizedBox(height: 40), //密码和登录按钮间距
//嵌套SizedBox, 设置button的宽高
......@@ -229,6 +421,14 @@ class EditTextState extends State<EditTextWidget>
));
}
List<UserBo> listAccount = [];
///获取历史用户
void getAccountList() async {
listAccount.clear();
listAccount.addAll(await SPAccountUtil.getUsers());
}
GradientButton buildRigister() {
return GradientButton(
tapCallback: () {
......@@ -538,14 +738,15 @@ class EditTextState extends State<EditTextWidget>
}
//登录
_startLogin(username, pwd) async {
_startLogin(userName, pwd) async {
///清除本地所有数据
// StorageUtil.getInstance().clearAll();
StorageUtil.getInstance().remove(SpKeys.JSESSION_ID);
HttpUtils.doLogin(context, username, pwd, onSuccess: (value) {
HttpUtils.doLogin(context, userName, pwd, onSuccess: (value) {
if (value != null) {
LoginBo loginBo = value;
StorageUtil.getInstance().set(SpKeys.USER_NAME, loginBo.username);
StorageUtil.getInstance().set(SpKeys.PASSWORD, pwd);
StorageUtil.getInstance().set(SpKeys.NAME, loginBo.name);
StorageUtil.getInstance().set(SpKeys.JSESSION_ID, loginBo.jsessionid);
StorageUtil.getInstance().set(SpKeys.USER_ID, loginBo.userId);
......@@ -558,6 +759,14 @@ class EditTextState extends State<EditTextWidget>
StorageUtil.getInstance()
.set(SpKeys.ROLE_NAMES, loginBo.user!.roleNames);
///记住密码
if (isPassword) {
///将账号密码保存到本地历史纪录
SPAccountUtil.saveUser(UserBo(userName, pwd));
SPAccountUtil.addNoRepeat(listAccount, UserBo(userName, pwd));
debugPrint(jsonEncode(listAccount));
}
///公司账户
if (isUnitRoles(loginBo.user!.roleNames)!) {
Get.offAllNamed(RouteString.HOME);
......
......@@ -13,6 +13,7 @@ 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/app_is_open.dart';
import 'package:special_equipment_flutter/model/banner_list_bo.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';
......@@ -33,6 +34,8 @@ 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/banner_view.dart';
import 'package:special_equipment_flutter/widgets/card_swiper.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';
......@@ -79,6 +82,7 @@ class _HomePageState extends State<HomePage>
late final Animation<double> _animation;
List<ChargeUserList>? chargeList = [];
List<OfficeDtoLists>? deviceList = [];
FindChargeListBo? chargeBo = FindChargeListBo();
List<CountData>? findCountList = [];
ExaminePersonBo? mExaminePersonBo = ExaminePersonBo();
......@@ -86,10 +90,16 @@ class _HomePageState extends State<HomePage>
int mOverseerHistoryCount = 0;
List<HistoryListData>? mHistoryListData = [];
String? isOpen = '0';
List<Data>? bannerList = [];
//声明,后面需要销毁
StreamSubscription? event;
// List<Map> banner = [
// {"url": "assets/banner/banner0.png"},
// {"url": "assets/banner/banner1.png"}
// ];
@override
void initState() {
super.initState();
......@@ -118,6 +128,11 @@ class _HomePageState extends State<HomePage>
StorageUtil.getInstance().set(SpKeys.UNIT_STATUS, unitId);
}
// _requestPermission();
Future.delayed(const Duration(seconds: 2), () {
// 延迟执行的代码
getBannerList();
});
///获取日管控、周排查、月调度数量
getCount();
getGirdviewData();
......@@ -149,6 +164,23 @@ class _HomePageState extends State<HomePage>
getDeviceData();
}
///获取轮播图接口
void getBannerList() {
HttpUtils.getBannerList(context).then((value) {
BannerListBo mBannerListBo = value;
if (mounted) {
setState(() {
List<Data>? mList = mBannerListBo.data;
for (var item in mList!) {
if (item.advertisPosition == "0") {
bannerList!.add(item);
}
}
});
}
});
}
///版本显示控制
void doAppIsOpen() {
if (Platform.isIOS) {
......@@ -481,6 +513,13 @@ class _HomePageState extends State<HomePage>
getOverseerHistoryList();
}
});
// Get.toNamed(RouteString.FILE_LIST_PAGE, arguments: {})
// ?.then((value) {
// if (value != null && value) {
// getOverseerHistoryList();
// }
// });
},
),
),
......@@ -935,6 +974,27 @@ class _HomePageState extends State<HomePage>
),
// buildTitle(Icons.equalizer, '考核练习'),
// buildSliverGridExamination()
if (name == '考核练习') ...[
Container(
alignment: Alignment.centerLeft,
margin: const EdgeInsets.only(left: 10, right: 10, top: 10),
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(
softWrap: true,
'小提示:【安全监察人】会对各单位监督抽查【考核】.',
style: TextStyle(color: Colors.orange, fontSize: 13),
),
),
]
],
)));
}
......@@ -1819,20 +1879,24 @@ class _HomePageState extends State<HomePage>
SliverAppBar buildSliverAppBar() {
return SliverAppBar(
expandedHeight: SizeConfig.isIpad()! ? 300 : 170.0,
expandedHeight: SizeConfig.isIpad()! ? 300 : 190.0,
floating: true,
pinned: true,
flexibleSpace: FlexibleSpaceBar(
centerTitle: true,
background: Stack(
children: [
Image.asset('assets/home/top_bg_icon.png',
width: MediaQuery.of(context).size.width, fit: BoxFit.fill),
// Image.asset('assets/home/top_bg_icon.png',
// width: MediaQuery.of(context).size.width, fit: BoxFit.fill),
CardSwiper(
bannerList: bannerList,
),
Positioned(
bottom: SizeConfig.isIpad()! ? 190 : 90,
left: SizeConfig.isIpad()!
? MediaQuery.of(context).size.width / 2 - 70
: MediaQuery.of(context).size.width / 2 - 50,
bottom: SizeConfig.isIpad()! ? 190 : 5,
// left: SizeConfig.isIpad()!
// ? MediaQuery.of(context).size.width / 2 - 70
// : MediaQuery.of(context).size.width / 2 - 50,
child: isRolesName(StorageUtil.getInstance().getRoleNames())
? _buildCheckUnit()
: const SizedBox(),
......@@ -1840,14 +1904,14 @@ class _HomePageState extends State<HomePage>
],
),
),
title: Column(
children: [
Text(
'晋特保助手',
style: TextStyle(fontSize: SizeConfig.isIpad()! ? 35 : 20),
),
],
),
// title: Column(
// children: [
// Text(
// '晋特保助手',
// style: TextStyle(fontSize: SizeConfig.isIpad()! ? 35 : 20),
// ),
// ],
// ),
actions: [
InkWell(
onTap: () {
......@@ -1873,10 +1937,16 @@ class _HomePageState extends State<HomePage>
});
},
child: Padding(
padding: const EdgeInsets.only(left: 15, right: 15),
padding: const EdgeInsets.only(
left: 15, right: 5, top: 12, bottom: 12),
child: Container(
width: 35,
decoration: BoxDecoration(
color: Colors.white24,
borderRadius: BorderRadius.circular(15.0)),
child: Icon(Icons.power_settings_new,
size: SizeConfig.isIpad()! ? 35 : 20),
),
size: SizeConfig.isIpad()! ? 40 : 25, color: Colors.orange),
)),
),
const SizedBox(
width: 10,
......@@ -1900,34 +1970,57 @@ class _HomePageState extends State<HomePage>
///切换单位
Row _buildCheckUnit() {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
// mainAxisAlignment: MainAxisAlignment.center,
children: [
PopupMenuButton<int>(
padding: const EdgeInsets.all(0),
shadowColor: ColorConst.themeBgColor,
offset: const Offset(3.5, 30),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
boxShadow: const [
BoxShadow(
color: Colors.black87,
offset: Offset(-30.0, 0),
blurRadius: 20.0,
spreadRadius: 0,
),
BoxShadow(
color: Colors.black87,
offset: Offset(5.0, 0),
blurRadius: 20.0,
spreadRadius: 0,
)
],
),
margin: const EdgeInsets.only(top: 1),
child: PopupMenuButton<int>(
shadowColor: ColorConst.whiteColor,
offset: const Offset(-10, 25),
shape: RoundedRectangleBorder(
// side: BorderSide(color: Colors.red, width: 2),
borderRadius: BorderRadius.circular(10),
borderRadius: BorderRadius.circular(5),
),
child: Container(
padding:
const EdgeInsets.only(left: 20, top: 5, right: 10, bottom: 5),
decoration: BoxDecoration(
border: Border.all(color: Colors.white, width: 0.5),
borderRadius: BorderRadius.circular(10),
),
const EdgeInsets.only(left: 10, top: 3, right: 3, bottom: 5),
// decoration: BoxDecoration(
// border: Border.all(color: ColorConst.whiteColor, width: 0.5),
// borderRadius: const BorderRadius.only(
// topLeft: Radius.circular(0),
// topRight: Radius.circular(5),
// bottomLeft: Radius.circular(0),
// bottomRight: Radius.circular(5)),
// ),
child: Row(
children: [
const SizedBox(width: 0),
Text(unitName,
style: TextStyle(
fontSize: SizeConfig.isIpad()! ? 25 : 14,
color: Colors.white)),
color: ColorConst.whiteColor,
fontWeight: FontWeight.bold)),
const Icon(
Icons.arrow_drop_down,
color: Colors.white,
size: 18,
color: ColorConst.whiteColor,
size: 20,
)
],
),
......@@ -1940,7 +2033,8 @@ class _HomePageState extends State<HomePage>
left: 25, right: 0, top: 0, bottom: 0),
value: i,
child: Text('${unitList[i].name}',
style: const TextStyle(color: Colors.black, fontSize: 14)),
style:
const TextStyle(color: Colors.black, fontSize: 13)),
),
],
],
......@@ -1958,10 +2052,76 @@ class _HomePageState extends State<HomePage>
});
},
),
),
],
);
}
// ///切换单位
// Row _buildCheckUnit() {
// return Row(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// PopupMenuButton<int>(
// padding: const EdgeInsets.all(0),
// shadowColor: ColorConst.themeBgColor,
// offset: const Offset(3.5, 30),
// shape: RoundedRectangleBorder(
// // side: BorderSide(color: Colors.red, width: 2),
// borderRadius: BorderRadius.circular(10),
// ),
// child: Container(
// padding:
// const EdgeInsets.only(left: 20, top: 5, right: 10, bottom: 5),
// decoration: BoxDecoration(
// border: Border.all(color: Colors.white, width: 0.5),
// borderRadius: BorderRadius.circular(10),
// ),
// child: Row(
// children: [
// const SizedBox(width: 0),
// Text(unitName,
// style: TextStyle(
// fontSize: SizeConfig.isIpad()! ? 25 : 14,
// color: Colors.white)),
// const Icon(
// Icons.arrow_drop_down,
// color: Colors.white,
// size: 18,
// )
// ],
// ),
// ),
// itemBuilder: (context) => [
// for (var i = 0; i < unitList.length; i++) ...[
// PopupMenuItem(
// height: 35,
// padding: const EdgeInsets.only(
// left: 25, right: 0, top: 0, bottom: 0),
// value: i,
// child: Text('${unitList[i].name}',
// style: const TextStyle(color: Colors.black, fontSize: 14)),
// ),
// ],
// ],
// onSelected: (value) {
// setState(() {
// unitName = unitList[value].name;
// unitId = unitList[value].id;
// StorageUtil.getInstance().set(SpKeys.UNIT_STATUS, unitId);
// getCount();
// Get.snackbar("提示", "您已切换到<$unitName>",
// colorText: Colors.black,
// backgroundColor: ColorConst.whiteColor,
// snackPosition: SnackPosition.TOP, // 这里设置弹窗出现在顶部
// duration: const Duration(seconds: 1));
// });
// },
// ),
// ],
// );
// }
///获取数据
void getCount() {
///判断是否是公司账户、管理员、市场监管局登录,是:显示统计图
......@@ -2280,6 +2440,7 @@ class _HomePageState extends State<HomePage>
name: '单位设置',
isContains: roleNames.contains(StandingConfig.PERSON_CHARGE)));
}
// _requestPermission() async {
// // var camera = await Permission.camera.status;
// // var storage = await Permission.storage.status;
......
......@@ -42,6 +42,25 @@ class EquipmentPersonnelTable extends StatelessWidget {
child: Column(
children: [
buildTitle(Icons.compare, '设备人员对比'),
Container(
alignment: Alignment.centerLeft,
margin: const EdgeInsets.only(left: 5, right: 5, top: 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: const Text(
softWrap: true,
'设备人员对比表格,是对比每个设备是否配备了相关负责人员,请在【用户设置】内配置相关负责人员.',
style: TextStyle(color: Colors.orange, fontSize: 13),
),
),
const SizedBox(height: 10),
Table(
border: TableBorder.all(color: ColorConst.blueColor),
......
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:special_equipment_flutter/dio/http_utils.dart';
import 'package:special_equipment_flutter/model/exam/equipment_list_bo.dart';
import 'package:special_equipment_flutter/model/exam/exam_unit_list.dart';
import 'package:special_equipment_flutter/utils/storage_util.dart';
import 'package:special_equipment_flutter/widgets/app_bar/custom_app_bar.dart';
///设备选择
class EquipmentListPage extends StatefulWidget {
var arguments = Get.arguments;
EquipmentListPage({super.key});
@override
State<EquipmentListPage> createState() => _EquipmentListPageState();
}
class _EquipmentListPageState extends State<EquipmentListPage> {
List<EquiList>? officeLists = [];
List<EquiList>? filterOfficeLists = [];
var officeId = '';
@override
void initState() {
super.initState();
officeId = widget.arguments['officeId'];
getEquipmentList();
}
///获取设备类型
void getEquipmentList() {
HttpUtils.getEquipmentList(context, officeId).then((value) {
EquipmentListBo listBo = value;
if (mounted) {
setState(() {
officeLists = listBo.list;
filterOfficeLists = officeLists;
});
}
});
}
void _filterData(String query) {
setState(() {
filterOfficeLists = officeLists!.where((EquiList item) {
return item.name!.toLowerCase().contains(query.toLowerCase());
}).toList();
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBarCustom(text: '选择设备', height: 50),
body: Column(
children: [
const SizedBox(height: 10),
Container(
margin: const EdgeInsets.only(left: 10, right: 10),
decoration: BoxDecoration(
color: Colors.grey[200],
borderRadius: BorderRadius.circular(10),
),
child: Row(
children: [
IconButton(
icon: const Icon(Icons.search),
onPressed: () {
// 处理搜索逻辑
},
),
Expanded(
child: TextField(
onChanged: (value) {
_filterData(value);
},
decoration: const InputDecoration(
hintText: '请输入搜索关键字',
border: InputBorder.none,
),
),
),
],
),
),
const SizedBox(height: 10),
Flexible(
child: ListView.builder(
shrinkWrap: true,
padding:
const EdgeInsets.only(top: 0, left: 0, bottom: 0, right: 0),
itemCount: filterOfficeLists!.length,
// 列表项数量
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
setState(() {
Get.back(result: filterOfficeLists![index]);
});
},
child: Container(
padding: const EdgeInsets.only(
left: 30, right: 15, top: 10, bottom: 10),
child: Text(
filterOfficeLists![index].name!,
style: const TextStyle(fontSize: 18),
),
),
);
},
),
),
],
),
);
}
}
// import 'package:flutter/material.dart';
// import 'package:get/get.dart';
// import 'package:special_equipment_flutter/common/color_const.dart';
// import 'package:special_equipment_flutter/dio/http_utils.dart';
// import 'package:special_equipment_flutter/model/exam/equipment_list_bo.dart';
// import 'package:special_equipment_flutter/model/exam/exam_unit_list.dart';
// import 'package:special_equipment_flutter/utils/storage_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';
//
// ///设备选择
// class EquipmentListPage extends StatefulWidget {
// var arguments = Get.arguments;
//
// EquipmentListPage({super.key});
//
// @override
// State<EquipmentListPage> createState() => _EquipmentListPageState();
// }
//
// class _EquipmentListPageState extends State<EquipmentListPage> {
// List<EquiList>? officeLists = [];
// List<EquiList>? filterOfficeLists = [];
// var officeId = '';
//
// @override
// void initState() {
// super.initState();
// officeId = widget.arguments['officeId'];
// getEquipmentList();
// }
//
// ///获取设备类型
// void getEquipmentList() {
// HttpUtils.getEquipmentList(context, officeId).then((value) {
// EquipmentListBo listBo = value;
// if (mounted) {
// setState(() {
// officeLists = listBo.list;
// filterOfficeLists = officeLists;
// });
// }
// });
// }
//
// void _filterData(String query) {
// setState(() {
// filterOfficeLists = officeLists!.where((EquiList item) {
// return item.name!.toLowerCase().contains(query.toLowerCase());
// }).toList();
// });
// }
//
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// appBar: AppBarCustom(text: '选择设备', height: 50),
// body: Stack(
// children: [
// Column(
// children: [
// const SizedBox(height: 10),
// Container(
// margin: const EdgeInsets.only(left: 10, right: 10),
// decoration: BoxDecoration(
// color: Colors.grey[200],
// borderRadius: BorderRadius.circular(10),
// ),
// child: Row(
// children: [
// IconButton(
// icon: const Icon(Icons.search),
// onPressed: () {
// // 处理搜索逻辑
// },
// ),
// Expanded(
// child: TextField(
// onChanged: (value) {
// _filterData(value);
// },
// decoration: const InputDecoration(
// hintText: '请输入搜索关键字',
// border: InputBorder.none,
// ),
// ),
// ),
// ],
// ),
// ),
// const SizedBox(height: 10),
// Flexible(
// child: ListView.builder(
// shrinkWrap: true,
// padding: const EdgeInsets.only(
// top: 0, left: 0, bottom: 0, right: 0),
// itemCount: filterOfficeLists!.length,
// // 列表项数量
// itemBuilder: (context, index) {
// return InkWell(
// onTap: () {
// setState(() {
// filterOfficeLists![index].isChecked =
// !filterOfficeLists![index].isChecked;
// });
// },
// child: Container(
// padding: const EdgeInsets.only(
// left: 20, right: 20, top: 5, bottom: 5),
// child: Column(
// children: [
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Text(
// filterOfficeLists![index].name!,
// style: const TextStyle(fontSize: 18),
// ),
// Checkbox(
// value: filterOfficeLists![index].isChecked,
// onChanged: (value) {
// if (value != null) {
// setState(() {
// filterOfficeLists![index].isChecked =
// value;
// });
// }
// },
// ),
// ],
// ),
// Container(
// color: Colors.grey[200],
// height: 1,
// width: double.infinity,
// )
// ],
// ),
// ),
// );
// },
// ),
// ),
// buildSubmit()
// ],
// ),
// ],
// ),
// );
// }
//
// ///提交
// Container buildSubmit() {
// return Container(
// margin: const EdgeInsets.only(top: 20, bottom: 0),
// padding: const EdgeInsets.only(left: 20, right: 20, top: 0, bottom: 20),
// width: double.infinity,
// decoration: const BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.all(Radius.circular(5)),
// ),
// child: GradientButton(
// tapCallback: () {
// bool isChecked = false;
// List<EquiList>? selectList = [];
// for (var i = 0; i < filterOfficeLists!.length; i++) {
// if (filterOfficeLists![i].isChecked) {
// isChecked = true;
// selectList.add(filterOfficeLists![i]);
// }
// }
// if (!isChecked) {
// ToastUtils.showCenter('至少选择一项内容');
// return;
// }
// Get.back(result: selectList);
// },
// width: 300,
// height: 40,
// 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:get/get.dart';
import 'package:special_equipment_flutter/dio/http_utils.dart';
import 'package:special_equipment_flutter/model/exam/equipment_list_bo.dart';
import 'package:special_equipment_flutter/model/exam/exam_unit_list.dart';
import 'package:special_equipment_flutter/utils/storage_util.dart';
import 'package:special_equipment_flutter/widgets/app_bar/custom_app_bar.dart';
///设备选择
class EquipmentListPage extends StatefulWidget {
var arguments = Get.arguments;
EquipmentListPage({super.key});
@override
State<EquipmentListPage> createState() => _EquipmentListPageState();
}
class _EquipmentListPageState extends State<EquipmentListPage> {
List<EquiList>? officeLists = [];
List<EquiList>? filterOfficeLists = [];
var officeId = '';
@override
void initState() {
super.initState();
officeId = widget.arguments['officeId'];
getEquipmentList();
}
///获取设备类型
void getEquipmentList() {
HttpUtils.getEquipmentList(context, officeId).then((value) {
EquipmentListBo listBo = value;
if (mounted) {
setState(() {
officeLists = listBo.list;
filterOfficeLists = officeLists;
});
}
});
}
void _filterData(String query) {
setState(() {
filterOfficeLists = officeLists!.where((EquiList item) {
return item.name!.toLowerCase().contains(query.toLowerCase());
}).toList();
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBarCustom(text: '选择设备', height: 50),
body: Column(
children: [
const SizedBox(height: 10),
Container(
margin: const EdgeInsets.only(left: 10, right: 10),
decoration: BoxDecoration(
color: Colors.grey[200],
borderRadius: BorderRadius.circular(10),
),
child: Row(
children: [
IconButton(
icon: const Icon(Icons.search),
onPressed: () {
// 处理搜索逻辑
},
),
Expanded(
child: TextField(
onChanged: (value) {
_filterData(value);
},
decoration: const InputDecoration(
hintText: '请输入搜索关键字',
border: InputBorder.none,
),
),
),
],
),
),
const SizedBox(height: 10),
Flexible(
child: ListView.builder(
shrinkWrap: true,
padding:
const EdgeInsets.only(top: 0, left: 0, bottom: 0, right: 0),
itemCount: filterOfficeLists!.length,
// 列表项数量
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
setState(() {
Get.back(result: filterOfficeLists![index]);
});
},
child: Container(
padding: const EdgeInsets.only(
left: 30, right: 15, top: 10, bottom: 10),
child: Text(
filterOfficeLists![index].name!,
style: const TextStyle(fontSize: 18),
),
),
);
},
),
),
],
),
);
}
}
import 'package:flutter/material.dart';
import 'package:flutter/services.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/route_string.dart';
import 'package:special_equipment_flutter/dio/http_utils.dart';
import 'package:special_equipment_flutter/model/base/base_model.dart';
import 'package:special_equipment_flutter/model/exam/eq_question_bo.dart';
import 'package:special_equipment_flutter/model/exam/equipment_list_bo.dart';
import 'package:special_equipment_flutter/model/exam/exam_setting_submit_bo.dart';
import 'package:special_equipment_flutter/model/exam/exam_unit_list.dart';
import 'package:special_equipment_flutter/model/exam/find_question_num.dart';
import 'package:special_equipment_flutter/model/exam/unit_person_list_bo.dart';
import 'package:special_equipment_flutter/utils/storage_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/custom_textfield.dart';
import 'package:special_equipment_flutter/widgets/first_refresh_widget.dart';
///监察人设置考核机构、考核题信息
class OverseerSettingsPage extends StatefulWidget {
const OverseerSettingsPage({super.key});
@override
State<OverseerSettingsPage> createState() => _OverseerSettingsState();
}
class _OverseerSettingsState extends State<OverseerSettingsPage> {
TextEditingController? unitText = TextEditingController();
FocusNode? unitFocusNode = FocusNode();
TextEditingController? equipmentText = TextEditingController();
FocusNode? equipmentFocusNode = FocusNode();
TextEditingController? singleZJText = TextEditingController();
FocusNode? singleZJFocusNode = FocusNode();
TextEditingController? judgmentZJText = TextEditingController();
FocusNode? judgmentZJFocusNode = FocusNode();
TextEditingController? singleAQYText = TextEditingController();
FocusNode? singleAQYFocusNode = FocusNode();
TextEditingController? judgmentAQYText = TextEditingController();
FocusNode? judgmentAQYFocusNode = FocusNode();
OfficeList? mOfficeList;
EquiList? mEquiList;
DataEq? mDataEq;
int allAQY = 0, allZJ = 0;
List<UserLists>? userSafetyDirectorList = [], userSafetyOfficerList = [];
UnitPersonListBo? mUnitPersonListBo;
var unitStatus = '';
@override
void initState() {
super.initState();
getFindQuestionNum();
unitStatus = StorageUtil.getInstance().getUnitStatus();
}
///获取设备类型
void getEquipmentList() {
HttpUtils.getEquipmentList(context, mOfficeList!.id).then((value) {
EquipmentListBo listBo = value;
if (mounted) {
setState(() {
mEquiList = listBo.list![0];
equipmentText!.text = mEquiList!.name!;
});
}
});
}
///获取题数
void getFindQuestionNum() {
HttpUtils.getFindQuestionNum(context).then((value) {
FindQuestionNum listBo = value;
if (mounted) {
setState(() {
DataNum dataNum = listBo.data!;
singleZJText!.text = dataNum.aqzjDx!.toString();
judgmentZJText!.text = dataNum.aqzjPd!.toString();
singleAQYText!.text = dataNum.aqyDx!.toString();
judgmentAQYText!.text = dataNum.aqyPd!.toString();
allAQY = dataNum.aqzjDx! + dataNum.aqzjPd!;
allZJ = dataNum.aqyDx! + dataNum.aqyPd!;
});
}
});
}
///获取人员
void getUnitPersonList(var roleId) {
HttpUtils.getUnitPerson(context, mOfficeList!.id, mEquiList!.id, roleId)
.then((value) {
mUnitPersonListBo = value;
if (mounted) {
setState(() {
///安全总监
if (roleId == 'f801011eb2c1481892dba5bc15023733') {
userSafetyDirectorList = mUnitPersonListBo!.userList;
///安全员
} else if (roleId == '77584ba03b4545fba9d23fd670b66c10') {
userSafetyOfficerList = mUnitPersonListBo!.userList;
}
});
}
});
}
///根据设备类型获取总题数
void getFindEqQuestionNum() {
HttpUtils.getFindEqQuestionNum(context, mEquiList!.id!).then((value) {
EqQuestionBo listBo = value;
if (mounted) {
setState(() {
mDataEq = listBo.data!;
if (int.parse(singleZJText!.text) > mDataEq!.dxNum!) {
singleZJText!.text = mDataEq!.dxNum!.toString();
allZJ = (singleZJText!.text.isNotEmpty
? int.parse(singleZJText!.text)
: 0) +
(judgmentZJText!.text.isNotEmpty
? int.parse(judgmentZJText!.text)
: 0);
}
if (int.parse(judgmentZJText!.text) > mDataEq!.pdNum!) {
judgmentZJText!.text = mDataEq!.pdNum!.toString();
allZJ = (singleZJText!.text.isNotEmpty
? int.parse(singleZJText!.text)
: 0) +
(judgmentZJText!.text.isNotEmpty
? int.parse(judgmentZJText!.text)
: 0);
}
if (int.parse(singleAQYText!.text) > mDataEq!.dxNum!) {
singleAQYText!.text = mDataEq!.dxNum!.toString();
allAQY = (singleAQYText!.text.isNotEmpty
? int.parse(singleAQYText!.text)
: 0) +
(judgmentAQYText!.text.isNotEmpty
? int.parse(judgmentAQYText!.text)
: 0);
}
if (int.parse(judgmentAQYText!.text) > mDataEq!.pdNum!) {
judgmentAQYText!.text = mDataEq!.pdNum!.toString();
allAQY = (singleAQYText!.text.isNotEmpty
? int.parse(singleAQYText!.text)
: 0) +
(judgmentAQYText!.text.isNotEmpty
? int.parse(judgmentAQYText!.text)
: 0);
}
});
}
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey[100],
body: Stack(
children: [
Image.asset('assets/home/rigister_bg.png'),
Container(
margin:
const EdgeInsets.only(left: 15, top: 110, right: 15, bottom: 0),
decoration: const BoxDecoration(
color: ColorConst.whiteColor,
borderRadius: BorderRadius.all(Radius.circular(10)),
),
child: CustomScrollView(
primary: false,
shrinkWrap: true,
slivers: <Widget>[
SliverToBoxAdapter(
child: Column(
children: [
buildUnitInformation(),
// buildSubmit(),
const SizedBox(height: 30)
],
),
),
],
),
),
buildTopTitle(context)
],
),
);
}
///单位信息
Container buildUnitInformation() {
return Container(
margin: const EdgeInsets.only(left: 10, top: 10, right: 10, bottom: 10),
child: Stack(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const SizedBox(height: 10),
const Row(children: [
Icon(Icons.touch_app, color: ColorConst.orangeColor, size: 15),
Text('单位名称', style: TextStyle(fontSize: 14))
]),
const SizedBox(height: 5),
CustomTextField(
enabled: true,
readOnly: true,
hintText: '请选择单位名称',
controller: unitText,
focusNode: unitFocusNode,
onTop: () {
Get.toNamed(RouteString.UNIT_LIST_PAGE)?.then((map) {
if (map != null) {
mOfficeList = map;
setState(() {
unitText!.text = mOfficeList!.name!;
mEquiList = null;
equipmentText!.text = '';
userSafetyDirectorList = [];
userSafetyOfficerList = [];
});
}
});
}),
const SizedBox(height: 15),
const Row(children: [
Icon(Icons.touch_app, color: ColorConst.orangeColor, size: 15),
Text('设备类型', style: TextStyle(fontSize: 14))
]),
const SizedBox(height: 5),
CustomTextField(
enabled: true,
readOnly: true,
hintText: '请选择设备类型',
controller: equipmentText,
focusNode: equipmentFocusNode,
onTop: () {
if (mOfficeList != null && mOfficeList!.id!.isNotEmpty) {
Get.toNamed(RouteString.EQUIPMENT_LIST_PAGE,
arguments: {'officeId': mOfficeList!.id})
?.then((map) {
if (map != null) {
mEquiList = map;
setState(() {
equipmentText!.text = mEquiList!.name!;
getUnitPersonList(
'f801011eb2c1481892dba5bc15023733');
getUnitPersonList(
'77584ba03b4545fba9d23fd670b66c10');
getFindEqQuestionNum();
});
}
});
} else {
ToastUtils.showCenter('请先选择单位');
}
}),
const SizedBox(height: 15),
Container(
padding: const EdgeInsets.only(
left: 5, top: 10, right: 5, bottom: 10),
decoration: const BoxDecoration(
color: ColorConst.grayf5Color,
borderRadius: BorderRadius.all(Radius.circular(10)),
),
child: Column(
children: [
const Row(children: [
Icon(Icons.touch_app,
color: ColorConst.orangeColor, size: 15),
Text('安全总监', style: TextStyle(fontSize: 14))
]),
const SizedBox(height: 5),
if (mUnitPersonListBo != null &&
userSafetyDirectorList!.isEmpty) ...{
Container(
padding: const EdgeInsets.only(
left: 0, top: 15, right: 0, bottom: 15),
child: const Text(
"该单位暂无录入(质量)安全总监",
style: TextStyle(
color: ColorConst.blueColor,
fontWeight: FontWeight.bold),
),
)
},
buildSafetyDirectorListView(),
const SizedBox(height: 10),
Container(
padding: const EdgeInsets.only(
left: 5, top: 0, right: 5, bottom: 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(children: [
const Text('单选题数', style: TextStyle(fontSize: 14)),
SizedBox(
width: 40,
height: 30,
child: TextFormField(
textAlign: TextAlign.center,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
LengthLimitingTextInputFormatter(3),
],
focusNode: singleZJFocusNode,
controller: singleZJText,
onChanged: (num) {
setState(() {
if (num.isEmpty) {
num = '0';
}
if (mDataEq != null &&
int.parse(num) > mDataEq!.dxNum!) {
ToastUtils.showCenter(
'题库只有${mDataEq!.dxNum}道单选题');
setState(() {
singleZJText!.text =
mDataEq!.dxNum.toString();
});
}
allZJ = (singleZJText!.text.isNotEmpty
? int.parse(singleZJText!.text)
: 0) +
(judgmentZJText!.text.isNotEmpty
? int.parse(judgmentZJText!.text)
: 0);
});
},
),
)
]),
Row(children: [
const Text('判断题数', style: TextStyle(fontSize: 14)),
SizedBox(
width: 40,
height: 30,
child: TextFormField(
textAlign: TextAlign.center,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
LengthLimitingTextInputFormatter(3),
],
focusNode: judgmentZJFocusNode,
controller: judgmentZJText,
onChanged: (num) {
setState(() {
if (num.isEmpty) {
num = '0';
}
if (mDataEq != null &&
int.parse(num) > mDataEq!.pdNum!) {
ToastUtils.showCenter(
'题库只有${mDataEq!.pdNum}道判断题');
setState(() {
judgmentZJText!.text =
mDataEq!.pdNum.toString();
});
}
allZJ = (judgmentZJText!.text.isNotEmpty
? int.parse(judgmentZJText!.text)
: 0) +
(singleZJText!.text.isNotEmpty
? int.parse(singleZJText!.text)
: 0);
});
},
),
)
]),
Text('总题数: ${allZJ.toString()}',
style: const TextStyle(
color: Colors.grey, fontSize: 14)),
],
),
),
],
),
),
const SizedBox(height: 10),
Container(
padding: const EdgeInsets.only(
left: 5, top: 10, right: 5, bottom: 10),
decoration: const BoxDecoration(
color: ColorConst.grayf5Color,
borderRadius: BorderRadius.all(Radius.circular(10)),
),
child: Column(
children: [
const Row(children: [
Icon(Icons.touch_app,
color: ColorConst.orangeColor, size: 15),
Text('安全员', style: TextStyle(fontSize: 14))
]),
const SizedBox(height: 5),
if (mUnitPersonListBo != null &&
userSafetyOfficerList!.isEmpty) ...{
Container(
padding: const EdgeInsets.only(
left: 0, top: 15, right: 0, bottom: 15),
child: const Text(
"该单位暂无录入(质量)安全员",
style: TextStyle(
color: ColorConst.blueColor,
fontWeight: FontWeight.bold),
),
)
},
buildSafetyOfficerListView(),
const SizedBox(height: 10),
Container(
padding: const EdgeInsets.only(
left: 5, top: 0, right: 5, bottom: 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(children: [
const Text('单选题数', style: TextStyle(fontSize: 14)),
SizedBox(
width: 40,
height: 30,
child: TextFormField(
textAlign: TextAlign.center,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
LengthLimitingTextInputFormatter(3),
],
focusNode: singleAQYFocusNode,
controller: singleAQYText,
onChanged: (num) {
setState(() {
if (num.isEmpty) {
num = '0';
}
if (mDataEq != null &&
int.parse(num) > mDataEq!.dxNum!) {
ToastUtils.showCenter(
'题库只有${mDataEq!.dxNum}道单选题');
setState(() {
singleAQYText!.text =
mDataEq!.dxNum.toString();
});
}
allAQY = (singleAQYText!.text.isNotEmpty
? int.parse(singleAQYText!.text)
: 0) +
(judgmentAQYText!.text.isNotEmpty
? int.parse(judgmentAQYText!.text)
: 0);
});
},
),
)
]),
Row(children: [
const Text('判断题数', style: TextStyle(fontSize: 14)),
SizedBox(
width: 40,
height: 30,
child: TextFormField(
textAlign: TextAlign.center,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
LengthLimitingTextInputFormatter(3)
],
focusNode: judgmentAQYFocusNode,
controller: judgmentAQYText,
onChanged: (num) {
setState(() {
if (num.isEmpty) {
num = '0';
}
if (mDataEq != null &&
int.parse(num) > mDataEq!.pdNum!) {
ToastUtils.showCenter(
'题库只有${mDataEq!.pdNum}道判断题');
setState(() {
judgmentAQYText!.text =
mDataEq!.pdNum.toString();
});
}
allAQY = (judgmentAQYText!.text.isNotEmpty
? int.parse(judgmentAQYText!.text)
: 0) +
(singleAQYText!.text.isNotEmpty
? int.parse(singleAQYText!.text)
: 0);
});
},
),
)
]),
Text('总题数: ${allAQY.toString()}',
style: const TextStyle(
color: Colors.grey, fontSize: 14)),
],
),
),
],
),
),
buildSubmit()
],
)
],
),
);
}
ListView buildSafetyDirectorListView() {
return ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
padding: const EdgeInsets.only(top: 0, left: 0, bottom: 0, right: 0),
itemCount: userSafetyDirectorList!.length,
// 列表项数量
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
setState(() {
///当前状态是否禁止选中 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 {
///禁止选中
}
});
},
child: Container(
height: 40,
decoration: BoxDecoration(
color: userSafetyDirectorList![index].isChecked!
? Colors.grey.withOpacity(0.1)
: Colors.transparent,
borderRadius: const BorderRadius.all(Radius.circular(5)),
),
child: Row(
children: [
Checkbox(
value: userSafetyDirectorList![index]
.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(() {
///当前状态是否禁止选中 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!,
style: TextStyle(
color: userSafetyDirectorList![index]
.isUserSafetyDirectorChecked!
? Colors.black
: Colors.black12))
],
),
),
);
},
);
}
ListView buildSafetyOfficerListView() {
return ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
padding: const EdgeInsets.only(top: 0, left: 0, bottom: 0, right: 0),
itemCount: userSafetyOfficerList!.length,
// 列表项数量
itemBuilder: (context, index) {
return InkWell(
onTap: () {
setState(() {
///当前状态是否禁止选中 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;
}
}
}
}
});
},
child: Container(
height: 40,
decoration: BoxDecoration(
color: userSafetyOfficerList![index].isChecked!
? Colors.grey.withOpacity(0.3)
: Colors.transparent,
borderRadius: const BorderRadius.all(Radius.circular(5)),
),
child: Row(
children: [
Checkbox(
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(() {
///当前状态是否禁止选中 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!,
style: TextStyle(
color: userSafetyOfficerList![index]
.isUserSafetyOfficerChecked!
? Colors.black
: Colors.black12))
],
),
),
);
},
);
}
Container buildTopTitle(BuildContext context) {
return Container(
margin: const EdgeInsets.only(top: 50),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
IconButton(
onPressed: () {
Navigator.of(context).pop();
},
icon: const Icon(Icons.arrow_back, color: Colors.white),
iconSize: 30,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
margin: const EdgeInsets.only(top: 5),
child: const Text(
'考核设置',
style: TextStyle(
fontSize: 23,
color: Colors.white,
fontWeight: FontWeight.bold),
)),
Container(
height: 3,
width: 50,
alignment: Alignment.topLeft,
margin: const EdgeInsets.only(top: 3, bottom: 3),
decoration: const BoxDecoration(
color: Colors.white54,
borderRadius: BorderRadius.all(Radius.circular(5)),
)),
const Text(
'',
style: TextStyle(fontSize: 12, color: Colors.white),
),
],
),
],
),
);
}
///交卷
Container buildSubmit() {
return Container(
margin: const EdgeInsets.only(top: 30, bottom: 0),
padding: const EdgeInsets.only(left: 20, right: 20, top: 15, bottom: 0),
width: double.infinity,
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(5)),
),
child: GradientButton(
tapCallback: () {
if (unitText!.text.isEmpty) {
ToastUtils.showCenter('选择单位名称');
return;
}
if (equipmentText!.text.isEmpty) {
ToastUtils.showCenter('选择设备类型');
return;
}
if (userSafetyDirectorList!.isEmpty &&
userSafetyOfficerList!.isEmpty) {
ToastUtils.showCenter('没有可选的\n【安全总监】\n【安全员】\n无法提交');
return;
}
bool isSafety = false;
bool isSafety1 = false;
bool isSafety2 = false;
for (var i = 0; i < userSafetyDirectorList!.length; i++) {
if (userSafetyDirectorList![i].isChecked!) {
isSafety = true;
isSafety1 = true;
}
}
for (var i = 0; i < userSafetyOfficerList!.length; i++) {
if (userSafetyOfficerList![i].isChecked!) {
isSafety = true;
isSafety2 = true;
}
}
if (!isSafety) {
ToastUtils.showCenter('至少选择一个\n【安全总监】\n【安全员】');
return;
}
if (isSafety1) {
if (allZJ == 0) {
ToastUtils.showCenter('【安全总监】总题数不能为 0');
return;
}
}
if (isSafety2) {
if (allAQY == 0) {
ToastUtils.showCenter('【安全员】总题数不能为 0');
return;
}
}
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();
// printLog(
// "《考核-交卷》提交json数据----->${json.encode(examineQuestionsBo)}");
ExamSettingSubmitBo mExamSettingSubmitBo =
ExamSettingSubmitBo();
// 安全主管判断题数
mExamSettingSubmitBo.aqzgPdNum =
judgmentZJText!.text.isNotEmpty
? int.parse(judgmentZJText!.text)
: 0;
// 安全主管选择题数
mExamSettingSubmitBo.aqzgXzNum =
singleZJText!.text.isNotEmpty
? int.parse(singleZJText!.text)
: 0;
// 安全员判断题数
mExamSettingSubmitBo.aqyPdNum =
judgmentAQYText!.text.isNotEmpty
? int.parse(judgmentAQYText!.text)
: 0;
// 安全员选择题数
mExamSettingSubmitBo.aqyXzNum =
singleAQYText!.text.isNotEmpty
? int.parse(singleAQYText!.text)
: 0;
mExamSettingSubmitBo.type = mEquiList!.id;
List<String>? aqzgIds = [];
for (var i = 0; i < userSafetyDirectorList!.length; i++) {
if (userSafetyDirectorList![i].isChecked!) {
aqzgIds.add(userSafetyDirectorList![i].id.toString());
}
}
mExamSettingSubmitBo.aqzgIds = aqzgIds;
List<String>? aqyIds = [];
for (var i = 0; i < userSafetyOfficerList!.length; i++) {
if (userSafetyOfficerList![i].isChecked!) {
aqyIds.add(userSafetyOfficerList![i].id.toString());
}
}
mExamSettingSubmitBo.aqyIds = aqyIds;
mExamSettingSubmitBo.unitId = mOfficeList!.id;
HttpUtils.getExamSettingSubmit(
context, mExamSettingSubmitBo)
.then((value) {
BaseModel bo = value;
if (mounted) {
setState(() {
ToastUtils.showCenter(bo.msg);
Get.back(result: true);
});
}
});
},
),
],
));
},
width: 300,
height: 40,
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/services.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/route_string.dart';
// import 'package:special_equipment_flutter/dio/http_utils.dart';
// import 'package:special_equipment_flutter/model/base/base_model.dart';
// import 'package:special_equipment_flutter/model/exam/eq_question_bo.dart';
// import 'package:special_equipment_flutter/model/exam/equipment_list_bo.dart';
// import 'package:special_equipment_flutter/model/exam/exam_setting_submit_bo.dart';
// import 'package:special_equipment_flutter/model/exam/exam_unit_list.dart';
// import 'package:special_equipment_flutter/model/exam/find_question_num.dart';
// import 'package:special_equipment_flutter/model/exam/unit_person_list_bo.dart';
// import 'package:special_equipment_flutter/utils/storage_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/custom_textfield.dart';
// import 'package:special_equipment_flutter/widgets/first_refresh_widget.dart';
// import 'package:special_equipment_flutter/widgets/num_change_widget.dart';
//
// ///监察人设置考核机构、考核题信息
// class OverseerSettingsPage extends StatefulWidget {
// const OverseerSettingsPage({super.key});
//
// @override
// State<OverseerSettingsPage> createState() => _OverseerSettingsState();
// }
//
// class _OverseerSettingsState extends State<OverseerSettingsPage> {
// TextEditingController? unitText = TextEditingController();
// FocusNode? unitFocusNode = FocusNode();
//
// TextEditingController? equipmentText = TextEditingController();
// FocusNode? equipmentFocusNode = FocusNode();
// TextEditingController? singleZJText = TextEditingController();
// FocusNode? singleZJFocusNode = FocusNode();
// TextEditingController? judgmentZJText = TextEditingController();
// FocusNode? judgmentZJFocusNode = FocusNode();
//
// TextEditingController? singleAQYText = TextEditingController();
// FocusNode? singleAQYFocusNode = FocusNode();
// TextEditingController? judgmentAQYText = TextEditingController();
// FocusNode? judgmentAQYFocusNode = FocusNode();
//
// OfficeList? mOfficeList;
//
// // EquiList? mEquiList;
// List<EquiList>? mEquiLists = [];
// DataEq? mDataEq;
// int allAQY = 0, allZJ = 0;
//
// List<UserLists>? userSafetyDirectorList = [], userSafetyOfficerList = [];
// UnitPersonListBo? mUnitPersonListBo;
// var unitStatus = '';
// var equipmentIsNullStr = "暂无设备类型,请先选择单位",
// userSafetyDirectorIsNullStr = "暂无(质量)安全总监,请先选择设备类型",
// userSafetyOfficerIsNullStr = "暂无(质量)安全员,请先选择设备类型";
//
// @override
// void initState() {
// super.initState();
// getFindQuestionNum();
// unitStatus = StorageUtil.getInstance().getUnitStatus();
// }
//
// ///获取设备类型
// void getEquipmentList() {
// // HttpUtils.getEquipmentList(context, mOfficeList!.id).then((value) {
// // EquipmentListBo listBo = value;
// // if (mounted) {
// // setState(() {
// // mEquiList = listBo.list![0];
// // equipmentText!.text = mEquiList!.name!;
// // });
// // }
// // });
// }
//
// ///获取题数
// void getFindQuestionNum() {
// HttpUtils.getFindQuestionNum(context).then((value) {
// FindQuestionNum listBo = value;
// if (mounted) {
// setState(() {
// DataNum dataNum = listBo.data!;
// singleZJText!.text = dataNum.aqzjDx!.toString();
// judgmentZJText!.text = dataNum.aqzjPd!.toString();
// singleAQYText!.text = dataNum.aqyDx!.toString();
// judgmentAQYText!.text = dataNum.aqyPd!.toString();
// allAQY = dataNum.aqzjDx! + dataNum.aqzjPd!;
// allZJ = dataNum.aqyDx! + dataNum.aqyPd!;
// });
// }
// });
// }
//
// ///获取人员
// void getUnitPersonList(var roleId) {
// // HttpUtils.getUnitPerson(context, mOfficeList!.id, mEquiList!.id, roleId)
// // .then((value) {
// // mUnitPersonListBo = value;
// // if (mounted) {
// // setState(() {
// // ///安全总监
// // if (roleId == 'f801011eb2c1481892dba5bc15023733') {
// // userSafetyDirectorList = mUnitPersonListBo!.userList;
// //
// // ///安全员
// // } else if (roleId == '77584ba03b4545fba9d23fd670b66c10') {
// // userSafetyOfficerList = mUnitPersonListBo!.userList;
// // }
// // });
// // }
// // });
// }
//
// ///根据设备类型获取总题数
// void getFindEqQuestionNum() {
// // HttpUtils.getFindEqQuestionNum(context, mEquiList!.id!).then((value) {
// // EqQuestionBo listBo = value;
// // if (mounted) {
// // setState(() {
// // mDataEq = listBo.data!;
// // if (int.parse(singleZJText!.text) > mDataEq!.dxNum!) {
// // singleZJText!.text = mDataEq!.dxNum!.toString();
// // allZJ = (singleZJText!.text.isNotEmpty
// // ? int.parse(singleZJText!.text)
// // : 0) +
// // (judgmentZJText!.text.isNotEmpty
// // ? int.parse(judgmentZJText!.text)
// // : 0);
// // }
// // if (int.parse(judgmentZJText!.text) > mDataEq!.pdNum!) {
// // judgmentZJText!.text = mDataEq!.pdNum!.toString();
// // allZJ = (singleZJText!.text.isNotEmpty
// // ? int.parse(singleZJText!.text)
// // : 0) +
// // (judgmentZJText!.text.isNotEmpty
// // ? int.parse(judgmentZJText!.text)
// // : 0);
// // }
// // if (int.parse(singleAQYText!.text) > mDataEq!.dxNum!) {
// // singleAQYText!.text = mDataEq!.dxNum!.toString();
// // allAQY = (singleAQYText!.text.isNotEmpty
// // ? int.parse(singleAQYText!.text)
// // : 0) +
// // (judgmentAQYText!.text.isNotEmpty
// // ? int.parse(judgmentAQYText!.text)
// // : 0);
// // }
// // if (int.parse(judgmentAQYText!.text) > mDataEq!.pdNum!) {
// // judgmentAQYText!.text = mDataEq!.pdNum!.toString();
// // allAQY = (singleAQYText!.text.isNotEmpty
// // ? int.parse(singleAQYText!.text)
// // : 0) +
// // (judgmentAQYText!.text.isNotEmpty
// // ? int.parse(judgmentAQYText!.text)
// // : 0);
// // }
// // });
// // }
// // });
// }
//
// ///获取设备类型
// void getEquipmentLists(String officeId) {
// HttpUtils.getEquipmentList(context, officeId).then((value) {
// EquipmentListBo listBo = value;
// if (mounted) {
// setState(() {
// mEquiLists!.clear();
// mEquiLists = listBo.list;
// equipmentIsNullStr = "该单位暂无添加设备类型";
// });
// }
// });
// }
//
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// backgroundColor: Colors.grey[100],
// body: Stack(
// children: [
// Image.asset('assets/home/rigister_bg.png'),
// Container(
// margin:
// const EdgeInsets.only(left: 15, top: 110, right: 15, bottom: 0),
// decoration: const BoxDecoration(
// color: ColorConst.whiteColor,
// borderRadius: BorderRadius.all(Radius.circular(10)),
// ),
// child: CustomScrollView(
// primary: false,
// shrinkWrap: true,
// slivers: <Widget>[
// SliverToBoxAdapter(
// child: Column(
// children: [
// buildUnitInformation(),
// // buildSubmit(),
// const SizedBox(height: 30)
// ],
// ),
// ),
// ],
// ),
// ),
// buildTopTitle(context)
// ],
// ),
// );
// }
//
// ///单位信息
// Container buildUnitInformation() {
// return Container(
// margin: const EdgeInsets.only(left: 10, top: 10, right: 10, bottom: 10),
// child: Stack(
// children: [
// Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: <Widget>[
// const SizedBox(height: 10),
// const Row(children: [
// Icon(Icons.touch_app, color: ColorConst.orangeColor, size: 15),
// Text('单位名称', style: TextStyle(fontSize: 14))
// ]),
// const SizedBox(height: 5),
// CustomTextField(
// enabled: true,
// readOnly: true,
// hintText: '请选择单位名称',
// controller: unitText,
// focusNode: unitFocusNode,
// onTop: () {
// Get.toNamed(RouteString.UNIT_LIST_PAGE)?.then((map) {
// if (map != null) {
// mOfficeList = map;
// setState(() {
// // getEquipmentLists(mOfficeList!.id!);
// unitText!.text = mOfficeList!.name!;
// // equipmentText!.text = '';
// userSafetyDirectorList = [];
// userSafetyOfficerList = [];
// });
// }
// });
// }),
// const SizedBox(height: 15),
// const Row(children: [
// Icon(Icons.touch_app, color: ColorConst.orangeColor, size: 15),
// Text('设备类型', style: TextStyle(fontSize: 14))
// ]),
// const SizedBox(height: 5),
// CustomTextField(
// enabled: true,
// readOnly: true,
// hintText: '请选择设备类型',
// controller: equipmentText,
// focusNode: equipmentFocusNode,
// onTop: () {
// if (mOfficeList != null && mOfficeList!.id!.isNotEmpty) {
// Get.toNamed(RouteString.EQUIPMENT_LIST_PAGE,
// arguments: {'officeId': mOfficeList!.id})
// ?.then((map) {
// if (map != null) {
// setState(() {
// mEquiLists = map;
// equipmentText!.text = "已选择";
//
// // getUnitPersonList(
// // 'f801011eb2c1481892dba5bc15023733');
// // getUnitPersonList(
// // '77584ba03b4545fba9d23fd670b66c10');
// // getFindEqQuestionNum();
// });
// }
// });
// } else {
// ToastUtils.showCenter('请先选择单位');
// }
// }),
// Container(
// width: double.infinity,
// margin:
// const EdgeInsets.only(left: 5, right: 5, top: 0, bottom: 0),
// padding:
// const EdgeInsets.only(left: 5, right: 5, top: 2, bottom: 2),
// 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: 12, color: Colors.orange)),
// ])),
// ),
//
// ///设备类型列表
// buildEquiListView(),
// if (mEquiLists != null && mEquiLists!.isEmpty) ...[
// Container(
// alignment: Alignment.center,
// height: 50,
// child: Text(
// equipmentIsNullStr,
// style:
// const TextStyle(color: Colors.black26, fontSize: 14),
// ))
// ],
//
// const SizedBox(height: 10),
// const Row(children: [
// Icon(Icons.touch_app, color: ColorConst.orangeColor, size: 15),
// Text('安全总监', style: TextStyle(fontSize: 14))
// ]),
// if (userSafetyDirectorList != null &&
// userSafetyDirectorList!.isEmpty) ...{
// Container(
// alignment: Alignment.center,
// height: 50,
// child: Text(userSafetyDirectorIsNullStr,
// style: const TextStyle(
// color: Colors.black26, fontSize: 14)))
// },
// buildSafetyDirectorListView(),
// const SizedBox(height: 10),
// const Row(children: [
// Icon(Icons.touch_app, color: ColorConst.orangeColor, size: 15),
// Text('安全员', style: TextStyle(fontSize: 14)),
// ]),
// const SizedBox(height: 5),
//
// if (userSafetyOfficerList != null &&
// userSafetyOfficerList!.isEmpty) ...{
// Container(
// alignment: Alignment.center,
// height: 50,
// child: Text(userSafetyOfficerIsNullStr,
// style: const TextStyle(
// color: Colors.black26, fontSize: 14)))
// },
// buildSafetyOfficerListView(),
//
// buildSubmit()
// ],
// )
// ],
// ),
// );
// }
//
// ///设备类型列表
// ListView buildEquiListView() {
// return ListView.builder(
// shrinkWrap: true,
// physics: const NeverScrollableScrollPhysics(),
// padding: const EdgeInsets.only(top: 0, left: 0, bottom: 0, right: 0),
// itemCount: mEquiLists!.length,
// // 列表项数量
// itemBuilder: (context, index) {
// return Container(
// margin: const EdgeInsets.only(left: 5, right: 5, top: 5, bottom: 5),
// decoration: BoxDecoration(
// color: Colors.black.withOpacity(0.05),
// borderRadius: const BorderRadius.all(Radius.circular(5)),
// ),
// child: Column(
// children: [
// InkWell(
// onTap: () {
// setState(() {
// mEquiLists![index].isChecked =
// !mEquiLists![index].isChecked;
// userSafetyDirectorIsNullStr = "该单位暂无录入(质量)安全总监";
// userSafetyOfficerIsNullStr = "该单位暂无录入(质量)安全员";
// });
// },
// child: Container(
// padding: const EdgeInsets.only(
// left: 10, right: 10, top: 0, bottom: 0),
// decoration: BoxDecoration(
// color: mEquiLists![index].isChecked
// ? ColorConst.blueColor.withOpacity(0.1)
// : Colors.transparent,
// borderRadius: const BorderRadius.only(
// topLeft: Radius.circular(5),
// topRight: Radius.circular(5)),
// ),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Text(
// mEquiLists![index].name!,
// style: TextStyle(
// fontSize: 15,
// color: mEquiLists![index].isChecked
// ? ColorConst.blueColor
// : Colors.black54),
// ),
// SizedBox(
// height: 40,
// child: Checkbox(
// value: mEquiLists![index].isChecked,
// onChanged: (value) {
// if (value != null) {
// setState(() {
// mEquiLists![index].isChecked = value;
// });
// }
// },
// ),
// ),
// ],
// ),
// ),
// ),
// if (mEquiLists![index].isChecked) ...[
// Container(
// padding: const EdgeInsets.only(
// left: 10, top: 5, right: 10, bottom: 10),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Text('总题数: ${allZJ.toString()}',
// style: const TextStyle(
// color: Colors.black54, fontSize: 13)),
// Row(children: [
// const Text('单选题数',
// style:
// TextStyle(fontSize: 13, color: Colors.black54)),
// SizedBox(
// width: 35,
// height: 25,
// child: TextFormField(
// textAlign: TextAlign.center,
// style: const TextStyle(
// fontSize: 16, color: Colors.black54),
// inputFormatters: [
// FilteringTextInputFormatter.digitsOnly,
// LengthLimitingTextInputFormatter(3),
// ],
// focusNode: singleZJFocusNode,
// controller: singleZJText,
// onChanged: (num) {
// setState(() {
// if (num.isEmpty) {
// num = '0';
// }
// if (mDataEq != null &&
// int.parse(num) > mDataEq!.dxNum!) {
// ToastUtils.showCenter(
// '题库只有${mDataEq!.dxNum}道单选题');
// setState(() {
// singleZJText!.text =
// mDataEq!.dxNum.toString();
// });
// }
// allZJ = (singleZJText!.text.isNotEmpty
// ? int.parse(singleZJText!.text)
// : 0) +
// (judgmentZJText!.text.isNotEmpty
// ? int.parse(judgmentZJText!.text)
// : 0);
// });
// },
// ),
// )
// ]),
// Row(children: [
// const Text('判断题数',
// style:
// TextStyle(fontSize: 13, color: Colors.black54)),
// SizedBox(
// width: 35,
// height: 25,
// child: TextFormField(
// textAlign: TextAlign.center,
// style: const TextStyle(
// fontSize: 16, color: Colors.black54),
// inputFormatters: [
// FilteringTextInputFormatter.digitsOnly,
// LengthLimitingTextInputFormatter(3),
// ],
// focusNode: judgmentZJFocusNode,
// controller: judgmentZJText,
// onChanged: (num) {
// setState(() {
// if (num.isEmpty) {
// num = '0';
// }
// if (mDataEq != null &&
// int.parse(num) > mDataEq!.pdNum!) {
// ToastUtils.showCenter(
// '题库只有${mDataEq!.pdNum}道判断题');
// setState(() {
// judgmentZJText!.text =
// mDataEq!.pdNum.toString();
// });
// }
//
// allZJ = (judgmentZJText!.text.isNotEmpty
// ? int.parse(judgmentZJText!.text)
// : 0) +
// (singleZJText!.text.isNotEmpty
// ? int.parse(singleZJText!.text)
// : 0);
// });
// },
// ),
// )
// ]),
// ],
// ),
// ),
// ],
// ],
// ),
// );
// },
// );
// }
//
// ListView buildSafetyDirectorListView() {
// return ListView.builder(
// shrinkWrap: true,
// physics: const NeverScrollableScrollPhysics(),
// padding: const EdgeInsets.only(top: 0, left: 0, bottom: 0, right: 0),
// itemCount: userSafetyDirectorList!.length,
// // 列表项数量
// itemBuilder: (context, index) {
// return GestureDetector(
// onTap: () {
// setState(() {
// ///当前状态是否禁止选中 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 {
// ///禁止选中
// }
// });
// },
// child: Container(
// height: 40,
// decoration: BoxDecoration(
// color: userSafetyDirectorList![index].isChecked!
// ? Colors.grey.withOpacity(0.1)
// : Colors.transparent,
// borderRadius: const BorderRadius.all(Radius.circular(5)),
// ),
// child: Row(
// children: [
// Checkbox(
// value: userSafetyDirectorList![index]
// .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(() {
// ///当前状态是否禁止选中 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!,
// style: TextStyle(
// color: userSafetyDirectorList![index]
// .isUserSafetyDirectorChecked!
// ? Colors.black
// : Colors.black12))
// ],
// ),
// ),
// );
// },
// );
// }
//
// ListView buildSafetyOfficerListView() {
// return ListView.builder(
// shrinkWrap: true,
// physics: const NeverScrollableScrollPhysics(),
// padding: const EdgeInsets.only(top: 0, left: 0, bottom: 0, right: 0),
// itemCount: userSafetyOfficerList!.length,
// // 列表项数量
// itemBuilder: (context, index) {
// return InkWell(
// onTap: () {
// setState(() {
// ///当前状态是否禁止选中 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;
// }
// }
// }
// }
// });
// },
// child: Container(
// height: 40,
// decoration: BoxDecoration(
// color: userSafetyOfficerList![index].isChecked!
// ? Colors.grey.withOpacity(0.3)
// : Colors.transparent,
// borderRadius: const BorderRadius.all(Radius.circular(5)),
// ),
// child: Row(
// children: [
// Checkbox(
// 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(() {
// ///当前状态是否禁止选中 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!,
// style: TextStyle(
// color: userSafetyOfficerList![index]
// .isUserSafetyOfficerChecked!
// ? Colors.black
// : Colors.black12))
// ],
// ),
// ),
// );
// },
// );
// }
//
// Container buildTopTitle(BuildContext context) {
// return Container(
// margin: const EdgeInsets.only(top: 50),
// child: Row(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.start,
// children: [
// IconButton(
// onPressed: () {
// Navigator.of(context).pop();
// },
// icon: const Icon(Icons.arrow_back, color: Colors.white),
// iconSize: 30,
// ),
// Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.start,
// children: [
// Container(
// margin: const EdgeInsets.only(top: 5),
// child: const Text(
// '考核设置',
// style: TextStyle(
// fontSize: 23,
// color: Colors.white,
// fontWeight: FontWeight.bold),
// )),
// Container(
// height: 3,
// width: 50,
// alignment: Alignment.topLeft,
// margin: const EdgeInsets.only(top: 3, bottom: 3),
// decoration: const BoxDecoration(
// color: Colors.white54,
// borderRadius: BorderRadius.all(Radius.circular(5)),
// )),
// const Text(
// '',
// style: TextStyle(fontSize: 12, color: Colors.white),
// ),
// ],
// ),
// ],
// ),
// );
// }
//
// ///交卷
// Container buildSubmit() {
// return Container(
// margin: const EdgeInsets.only(top: 30, bottom: 0),
// padding: const EdgeInsets.only(left: 20, right: 20, top: 15, bottom: 0),
// width: double.infinity,
// decoration: const BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.all(Radius.circular(5)),
// ),
// child: GradientButton(
// tapCallback: () {
// if (unitText!.text.isEmpty) {
// ToastUtils.showCenter('选择单位名称');
// return;
// }
// // if (equipmentText!.text.isEmpty) {
// // ToastUtils.showCenter('选择设备类型');
// // return;
// // }
//
// if (userSafetyDirectorList!.isEmpty &&
// userSafetyOfficerList!.isEmpty) {
// ToastUtils.showCenter('没有可选的\n【安全总监】\n【安全员】\n无法提交');
// return;
// }
//
// bool isSafety = false;
// bool isSafety1 = false;
// bool isSafety2 = false;
//
// for (var i = 0; i < userSafetyDirectorList!.length; i++) {
// if (userSafetyDirectorList![i].isChecked!) {
// isSafety = true;
// isSafety1 = true;
// }
// }
// for (var i = 0; i < userSafetyOfficerList!.length; i++) {
// if (userSafetyOfficerList![i].isChecked!) {
// isSafety = true;
// isSafety2 = true;
// }
// }
//
// if (!isSafety) {
// ToastUtils.showCenter('至少选择一个\n【安全总监】\n【安全员】');
// return;
// }
//
// if (isSafety1) {
// if (allZJ == 0) {
// ToastUtils.showCenter('【安全总监】总题数不能为 0');
// return;
// }
// }
// if (isSafety2) {
// if (allAQY == 0) {
// ToastUtils.showCenter('【安全员】总题数不能为 0');
// return;
// }
// }
//
// 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();
// // printLog(
// // "《考核-交卷》提交json数据----->${json.encode(examineQuestionsBo)}");
//
// ExamSettingSubmitBo mExamSettingSubmitBo =
// ExamSettingSubmitBo();
// // 安全主管判断题数
// mExamSettingSubmitBo.aqzgPdNum =
// judgmentZJText!.text.isNotEmpty
// ? int.parse(judgmentZJText!.text)
// : 0;
// // 安全主管选择题数
// mExamSettingSubmitBo.aqzgXzNum =
// singleZJText!.text.isNotEmpty
// ? int.parse(singleZJText!.text)
// : 0;
// // 安全员判断题数
// mExamSettingSubmitBo.aqyPdNum =
// judgmentAQYText!.text.isNotEmpty
// ? int.parse(judgmentAQYText!.text)
// : 0;
// // 安全员选择题数
// mExamSettingSubmitBo.aqyXzNum =
// singleAQYText!.text.isNotEmpty
// ? int.parse(singleAQYText!.text)
// : 0;
// // mExamSettingSubmitBo.type = mEquiList!.id;
// List<String>? aqzgIds = [];
// for (var i = 0; i < userSafetyDirectorList!.length; i++) {
// if (userSafetyDirectorList![i].isChecked!) {
// aqzgIds.add(userSafetyDirectorList![i].id.toString());
// }
// }
// mExamSettingSubmitBo.aqzgIds = aqzgIds;
//
// List<String>? aqyIds = [];
// for (var i = 0; i < userSafetyOfficerList!.length; i++) {
// if (userSafetyOfficerList![i].isChecked!) {
// aqyIds.add(userSafetyOfficerList![i].id.toString());
// }
// }
// mExamSettingSubmitBo.aqyIds = aqyIds;
// mExamSettingSubmitBo.unitId = mOfficeList!.id;
// HttpUtils.getExamSettingSubmit(
// context, mExamSettingSubmitBo)
// .then((value) {
// BaseModel bo = value;
// if (mounted) {
// setState(() {
// ToastUtils.showCenter(bo.msg);
// Get.back(result: true);
// });
// }
// });
// },
// ),
// ],
// ));
// },
// width: 300,
// height: 40,
// 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/services.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/route_string.dart';
import 'package:special_equipment_flutter/dio/http_utils.dart';
import 'package:special_equipment_flutter/model/base/base_model.dart';
import 'package:special_equipment_flutter/model/exam/eq_question_bo.dart';
import 'package:special_equipment_flutter/model/exam/equipment_list_bo.dart';
import 'package:special_equipment_flutter/model/exam/exam_setting_submit_bo.dart';
import 'package:special_equipment_flutter/model/exam/exam_unit_list.dart';
import 'package:special_equipment_flutter/model/exam/find_question_num.dart';
import 'package:special_equipment_flutter/model/exam/unit_person_list_bo.dart';
import 'package:special_equipment_flutter/utils/storage_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/custom_textfield.dart';
import 'package:special_equipment_flutter/widgets/first_refresh_widget.dart';
///监察人设置考核机构、考核题信息
class OverseerSettingsPages extends StatefulWidget {
const OverseerSettingsPages({super.key});
@override
State<OverseerSettingsPages> createState() => _OverseerSettingsPagesState();
}
class _OverseerSettingsPagesState extends State<OverseerSettingsPages> {
TextEditingController? unitText = TextEditingController();
FocusNode? unitFocusNode = FocusNode();
TextEditingController? equipmentText = TextEditingController();
FocusNode? equipmentFocusNode = FocusNode();
TextEditingController? singleZJText = TextEditingController();
FocusNode? singleZJFocusNode = FocusNode();
TextEditingController? judgmentZJText = TextEditingController();
FocusNode? judgmentZJFocusNode = FocusNode();
TextEditingController? singleAQYText = TextEditingController();
FocusNode? singleAQYFocusNode = FocusNode();
TextEditingController? judgmentAQYText = TextEditingController();
FocusNode? judgmentAQYFocusNode = FocusNode();
OfficeList? mOfficeList;
EquiList? mEquiList;
DataEq? mDataEq;
int allAQY = 0, allZJ = 0;
List<UserLists>? userSafetyDirectorList = [], userSafetyOfficerList = [];
UnitPersonListBo? mUnitPersonListBo;
var unitStatus = '';
@override
void initState() {
super.initState();
getFindQuestionNum();
unitStatus = StorageUtil.getInstance().getUnitStatus();
}
///获取设备类型
void getEquipmentList() {
HttpUtils.getEquipmentList(context, mOfficeList!.id).then((value) {
EquipmentListBo listBo = value;
if (mounted) {
setState(() {
mEquiList = listBo.list![0];
equipmentText!.text = mEquiList!.name!;
});
}
});
}
///获取题数
void getFindQuestionNum() {
HttpUtils.getFindQuestionNum(context).then((value) {
FindQuestionNum listBo = value;
if (mounted) {
setState(() {
DataNum dataNum = listBo.data!;
singleZJText!.text = dataNum.aqzjDx!.toString();
judgmentZJText!.text = dataNum.aqzjPd!.toString();
singleAQYText!.text = dataNum.aqyDx!.toString();
judgmentAQYText!.text = dataNum.aqyPd!.toString();
allAQY = dataNum.aqzjDx! + dataNum.aqzjPd!;
allZJ = dataNum.aqyDx! + dataNum.aqyPd!;
});
}
});
}
///获取人员
void getUnitPersonList(var roleId) {
HttpUtils.getUnitPerson(context, mOfficeList!.id, mEquiList!.id, roleId)
.then((value) {
mUnitPersonListBo = value;
if (mounted) {
setState(() {
///安全总监
if (roleId == 'f801011eb2c1481892dba5bc15023733') {
userSafetyDirectorList = mUnitPersonListBo!.userList;
///安全员
} else if (roleId == '77584ba03b4545fba9d23fd670b66c10') {
userSafetyOfficerList = mUnitPersonListBo!.userList;
}
});
}
});
}
///根据设备类型获取总题数
void getFindEqQuestionNum() {
HttpUtils.getFindEqQuestionNum(context, mEquiList!.id!).then((value) {
EqQuestionBo listBo = value;
if (mounted) {
setState(() {
mDataEq = listBo.data!;
if (int.parse(singleZJText!.text) > mDataEq!.dxNum!) {
singleZJText!.text = mDataEq!.dxNum!.toString();
allZJ = (singleZJText!.text.isNotEmpty
? int.parse(singleZJText!.text)
: 0) +
(judgmentZJText!.text.isNotEmpty
? int.parse(judgmentZJText!.text)
: 0);
}
if (int.parse(judgmentZJText!.text) > mDataEq!.pdNum!) {
judgmentZJText!.text = mDataEq!.pdNum!.toString();
allZJ = (singleZJText!.text.isNotEmpty
? int.parse(singleZJText!.text)
: 0) +
(judgmentZJText!.text.isNotEmpty
? int.parse(judgmentZJText!.text)
: 0);
}
if (int.parse(singleAQYText!.text) > mDataEq!.dxNum!) {
singleAQYText!.text = mDataEq!.dxNum!.toString();
allAQY = (singleAQYText!.text.isNotEmpty
? int.parse(singleAQYText!.text)
: 0) +
(judgmentAQYText!.text.isNotEmpty
? int.parse(judgmentAQYText!.text)
: 0);
}
if (int.parse(judgmentAQYText!.text) > mDataEq!.pdNum!) {
judgmentAQYText!.text = mDataEq!.pdNum!.toString();
allAQY = (singleAQYText!.text.isNotEmpty
? int.parse(singleAQYText!.text)
: 0) +
(judgmentAQYText!.text.isNotEmpty
? int.parse(judgmentAQYText!.text)
: 0);
}
});
}
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey[100],
body: Stack(
children: [
Image.asset('assets/home/rigister_bg.png'),
Container(
margin:
const EdgeInsets.only(left: 15, top: 110, right: 15, bottom: 0),
decoration: const BoxDecoration(
color: ColorConst.whiteColor,
borderRadius: BorderRadius.all(Radius.circular(10)),
),
child: CustomScrollView(
primary: false,
shrinkWrap: true,
slivers: <Widget>[
SliverToBoxAdapter(
child: Column(
children: [
buildUnitInformation(),
// buildSubmit(),
const SizedBox(height: 30)
],
),
),
],
),
),
buildTopTitle(context)
],
),
);
}
///单位信息
Container buildUnitInformation() {
return Container(
margin: const EdgeInsets.only(left: 10, top: 10, right: 10, bottom: 10),
child: Stack(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const SizedBox(height: 10),
const Row(children: [
Icon(Icons.touch_app, color: ColorConst.orangeColor, size: 15),
Text('单位名称', style: TextStyle(fontSize: 14))
]),
const SizedBox(height: 5),
CustomTextField(
enabled: true,
readOnly: true,
hintText: '请选择单位名称',
controller: unitText,
focusNode: unitFocusNode,
onTop: () {
Get.toNamed(RouteString.UNIT_LIST_PAGE)?.then((map) {
if (map != null) {
mOfficeList = map;
setState(() {
unitText!.text = mOfficeList!.name!;
mEquiList = null;
equipmentText!.text = '';
userSafetyDirectorList = [];
userSafetyOfficerList = [];
});
}
});
}),
const SizedBox(height: 15),
const Row(children: [
Icon(Icons.touch_app, color: ColorConst.orangeColor, size: 15),
Text('设备类型', style: TextStyle(fontSize: 14))
]),
const SizedBox(height: 5),
CustomTextField(
enabled: true,
readOnly: true,
hintText: '请选择设备类型',
controller: equipmentText,
focusNode: equipmentFocusNode,
onTop: () {
if (mOfficeList != null && mOfficeList!.id!.isNotEmpty) {
Get.toNamed(RouteString.EQUIPMENT_LIST_PAGE,
arguments: {'officeId': mOfficeList!.id})
?.then((map) {
if (map != null) {
mEquiList = map;
setState(() {
equipmentText!.text = mEquiList!.name!;
getUnitPersonList(
'f801011eb2c1481892dba5bc15023733');
getUnitPersonList(
'77584ba03b4545fba9d23fd670b66c10');
getFindEqQuestionNum();
});
}
});
} else {
ToastUtils.showCenter('请先选择单位');
}
}),
const SizedBox(height: 15),
Container(
padding: const EdgeInsets.only(
left: 5, top: 10, right: 5, bottom: 10),
decoration: const BoxDecoration(
color: ColorConst.grayf5Color,
borderRadius: BorderRadius.all(Radius.circular(10)),
),
child: Column(
children: [
const Row(children: [
Icon(Icons.touch_app,
color: ColorConst.orangeColor, size: 15),
Text('安全总监', style: TextStyle(fontSize: 14))
]),
const SizedBox(height: 5),
if (mUnitPersonListBo != null &&
userSafetyDirectorList!.isEmpty) ...{
Container(
padding: const EdgeInsets.only(
left: 0, top: 15, right: 0, bottom: 15),
child: const Text(
"该单位暂无录入(质量)安全总监",
style: TextStyle(
color: ColorConst.blueColor,
fontWeight: FontWeight.bold),
),
)
},
buildSafetyDirectorListView(),
const SizedBox(height: 10),
Container(
padding: const EdgeInsets.only(
left: 5, top: 0, right: 5, bottom: 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(children: [
const Text('单选题数', style: TextStyle(fontSize: 14)),
SizedBox(
width: 40,
height: 30,
child: TextFormField(
textAlign: TextAlign.center,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
LengthLimitingTextInputFormatter(3),
],
focusNode: singleZJFocusNode,
controller: singleZJText,
onChanged: (num) {
setState(() {
if (num.isEmpty) {
num = '0';
}
if (mDataEq != null &&
int.parse(num) > mDataEq!.dxNum!) {
ToastUtils.showCenter(
'题库只有${mDataEq!.dxNum}道单选题');
setState(() {
singleZJText!.text =
mDataEq!.dxNum.toString();
});
}
allZJ = (singleZJText!.text.isNotEmpty
? int.parse(singleZJText!.text)
: 0) +
(judgmentZJText!.text.isNotEmpty
? int.parse(judgmentZJText!.text)
: 0);
});
},
),
)
]),
Row(children: [
const Text('判断题数', style: TextStyle(fontSize: 14)),
SizedBox(
width: 40,
height: 30,
child: TextFormField(
textAlign: TextAlign.center,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
LengthLimitingTextInputFormatter(3),
],
focusNode: judgmentZJFocusNode,
controller: judgmentZJText,
onChanged: (num) {
setState(() {
if (num.isEmpty) {
num = '0';
}
if (mDataEq != null &&
int.parse(num) > mDataEq!.pdNum!) {
ToastUtils.showCenter(
'题库只有${mDataEq!.pdNum}道判断题');
setState(() {
judgmentZJText!.text =
mDataEq!.pdNum.toString();
});
}
allZJ = (judgmentZJText!.text.isNotEmpty
? int.parse(judgmentZJText!.text)
: 0) +
(singleZJText!.text.isNotEmpty
? int.parse(singleZJText!.text)
: 0);
});
},
),
)
]),
Text('总题数: ${allZJ.toString()}',
style: const TextStyle(
color: Colors.grey, fontSize: 14)),
],
),
),
],
),
),
const SizedBox(height: 10),
Container(
padding: const EdgeInsets.only(
left: 5, top: 10, right: 5, bottom: 10),
decoration: const BoxDecoration(
color: ColorConst.grayf5Color,
borderRadius: BorderRadius.all(Radius.circular(10)),
),
child: Column(
children: [
const Row(children: [
Icon(Icons.touch_app,
color: ColorConst.orangeColor, size: 15),
Text('安全员', style: TextStyle(fontSize: 14))
]),
const SizedBox(height: 5),
if (mUnitPersonListBo != null &&
userSafetyOfficerList!.isEmpty) ...{
Container(
padding: const EdgeInsets.only(
left: 0, top: 15, right: 0, bottom: 15),
child: const Text(
"该单位暂无录入(质量)安全员",
style: TextStyle(
color: ColorConst.blueColor,
fontWeight: FontWeight.bold),
),
)
},
buildSafetyOfficerListView(),
const SizedBox(height: 10),
Container(
padding: const EdgeInsets.only(
left: 5, top: 0, right: 5, bottom: 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(children: [
const Text('单选题数', style: TextStyle(fontSize: 14)),
SizedBox(
width: 40,
height: 30,
child: TextFormField(
textAlign: TextAlign.center,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
LengthLimitingTextInputFormatter(3),
],
focusNode: singleAQYFocusNode,
controller: singleAQYText,
onChanged: (num) {
setState(() {
if (num.isEmpty) {
num = '0';
}
if (mDataEq != null &&
int.parse(num) > mDataEq!.dxNum!) {
ToastUtils.showCenter(
'题库只有${mDataEq!.dxNum}道单选题');
setState(() {
singleAQYText!.text =
mDataEq!.dxNum.toString();
});
}
allAQY = (singleAQYText!.text.isNotEmpty
? int.parse(singleAQYText!.text)
: 0) +
(judgmentAQYText!.text.isNotEmpty
? int.parse(judgmentAQYText!.text)
: 0);
});
},
),
)
]),
Row(children: [
const Text('判断题数', style: TextStyle(fontSize: 14)),
SizedBox(
width: 40,
height: 30,
child: TextFormField(
textAlign: TextAlign.center,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
LengthLimitingTextInputFormatter(3)
],
focusNode: judgmentAQYFocusNode,
controller: judgmentAQYText,
onChanged: (num) {
setState(() {
if (num.isEmpty) {
num = '0';
}
if (mDataEq != null &&
int.parse(num) > mDataEq!.pdNum!) {
ToastUtils.showCenter(
'题库只有${mDataEq!.pdNum}道判断题');
setState(() {
judgmentAQYText!.text =
mDataEq!.pdNum.toString();
});
}
allAQY = (judgmentAQYText!.text.isNotEmpty
? int.parse(judgmentAQYText!.text)
: 0) +
(singleAQYText!.text.isNotEmpty
? int.parse(singleAQYText!.text)
: 0);
});
},
),
)
]),
Text('总题数: ${allAQY.toString()}',
style: const TextStyle(
color: Colors.grey, fontSize: 14)),
],
),
),
],
),
),
buildSubmit()
],
)
],
),
);
}
ListView buildSafetyDirectorListView() {
return ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
padding: const EdgeInsets.only(top: 0, left: 0, bottom: 0, right: 0),
itemCount: userSafetyDirectorList!.length,
// 列表项数量
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
setState(() {
///当前状态是否禁止选中 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 {
///禁止选中
}
});
},
child: Container(
height: 40,
decoration: BoxDecoration(
color: userSafetyDirectorList![index].isChecked!
? Colors.grey.withOpacity(0.1)
: Colors.transparent,
borderRadius: const BorderRadius.all(Radius.circular(5)),
),
child: Row(
children: [
Checkbox(
value: userSafetyDirectorList![index]
.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(() {
///当前状态是否禁止选中 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!,
style: TextStyle(
color: userSafetyDirectorList![index]
.isUserSafetyDirectorChecked!
? Colors.black
: Colors.black12))
],
),
),
);
},
);
}
ListView buildSafetyOfficerListView() {
return ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
padding: const EdgeInsets.only(top: 0, left: 0, bottom: 0, right: 0),
itemCount: userSafetyOfficerList!.length,
// 列表项数量
itemBuilder: (context, index) {
return InkWell(
onTap: () {
setState(() {
///当前状态是否禁止选中 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;
}
}
}
}
});
},
child: Container(
height: 40,
decoration: BoxDecoration(
color: userSafetyOfficerList![index].isChecked!
? Colors.grey.withOpacity(0.3)
: Colors.transparent,
borderRadius: const BorderRadius.all(Radius.circular(5)),
),
child: Row(
children: [
Checkbox(
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(() {
///当前状态是否禁止选中 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!,
style: TextStyle(
color: userSafetyOfficerList![index]
.isUserSafetyOfficerChecked!
? Colors.black
: Colors.black12))
],
),
),
);
},
);
}
Container buildTopTitle(BuildContext context) {
return Container(
margin: const EdgeInsets.only(top: 50),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
IconButton(
onPressed: () {
Navigator.of(context).pop();
},
icon: const Icon(Icons.arrow_back, color: Colors.white),
iconSize: 30,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
margin: const EdgeInsets.only(top: 5),
child: const Text(
'考核设置',
style: TextStyle(
fontSize: 23,
color: Colors.white,
fontWeight: FontWeight.bold),
)),
Container(
height: 3,
width: 50,
alignment: Alignment.topLeft,
margin: const EdgeInsets.only(top: 3, bottom: 3),
decoration: const BoxDecoration(
color: Colors.white54,
borderRadius: BorderRadius.all(Radius.circular(5)),
)),
const Text(
'',
style: TextStyle(fontSize: 12, color: Colors.white),
),
],
),
],
),
);
}
///交卷
Container buildSubmit() {
return Container(
margin: const EdgeInsets.only(top: 30, bottom: 0),
padding: const EdgeInsets.only(left: 20, right: 20, top: 15, bottom: 0),
width: double.infinity,
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(5)),
),
child: GradientButton(
tapCallback: () {
if (unitText!.text.isEmpty) {
ToastUtils.showCenter('选择单位名称');
return;
}
if (equipmentText!.text.isEmpty) {
ToastUtils.showCenter('选择设备类型');
return;
}
if (userSafetyDirectorList!.isEmpty &&
userSafetyOfficerList!.isEmpty) {
ToastUtils.showCenter('没有可选的\n【安全总监】\n【安全员】\n无法提交');
return;
}
bool isSafety = false;
bool isSafety1 = false;
bool isSafety2 = false;
for (var i = 0; i < userSafetyDirectorList!.length; i++) {
if (userSafetyDirectorList![i].isChecked!) {
isSafety = true;
isSafety1 = true;
}
}
for (var i = 0; i < userSafetyOfficerList!.length; i++) {
if (userSafetyOfficerList![i].isChecked!) {
isSafety = true;
isSafety2 = true;
}
}
if (!isSafety) {
ToastUtils.showCenter('至少选择一个\n【安全总监】\n【安全员】');
return;
}
if (isSafety1) {
if (allZJ == 0) {
ToastUtils.showCenter('【安全总监】总题数不能为 0');
return;
}
}
if (isSafety2) {
if (allAQY == 0) {
ToastUtils.showCenter('【安全员】总题数不能为 0');
return;
}
}
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();
// printLog(
// "《考核-交卷》提交json数据----->${json.encode(examineQuestionsBo)}");
ExamSettingSubmitBo mExamSettingSubmitBo =
ExamSettingSubmitBo();
// 安全主管判断题数
mExamSettingSubmitBo.aqzgPdNum =
judgmentZJText!.text.isNotEmpty
? int.parse(judgmentZJText!.text)
: 0;
// 安全主管选择题数
mExamSettingSubmitBo.aqzgXzNum =
singleZJText!.text.isNotEmpty
? int.parse(singleZJText!.text)
: 0;
// 安全员判断题数
mExamSettingSubmitBo.aqyPdNum =
judgmentAQYText!.text.isNotEmpty
? int.parse(judgmentAQYText!.text)
: 0;
// 安全员选择题数
mExamSettingSubmitBo.aqyXzNum =
singleAQYText!.text.isNotEmpty
? int.parse(singleAQYText!.text)
: 0;
mExamSettingSubmitBo.type = mEquiList!.id;
List<String>? aqzgIds = [];
for (var i = 0; i < userSafetyDirectorList!.length; i++) {
if (userSafetyDirectorList![i].isChecked!) {
aqzgIds.add(userSafetyDirectorList![i].id.toString());
}
}
mExamSettingSubmitBo.aqzgIds = aqzgIds;
List<String>? aqyIds = [];
for (var i = 0; i < userSafetyOfficerList!.length; i++) {
if (userSafetyOfficerList![i].isChecked!) {
aqyIds.add(userSafetyOfficerList![i].id.toString());
}
}
mExamSettingSubmitBo.aqyIds = aqyIds;
mExamSettingSubmitBo.unitId = mOfficeList!.id;
HttpUtils.getExamSettingSubmit(
context, mExamSettingSubmitBo)
.then((value) {
BaseModel bo = value;
if (mounted) {
setState(() {
ToastUtils.showCenter(bo.msg);
Get.back(result: true);
});
}
});
},
),
],
));
},
width: 300,
height: 40,
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),
)));
}
}
......@@ -171,7 +171,7 @@ class _RegisterPage2State extends State<RegisterPage2> {
),
child: const Text(
softWrap: true,
'密码至少包含以下 3 种类别:大写字母、小写字母、数字、特殊符号( @#*. )、8-20位',
'密码至少包含以下 5 种类别:大写字母、小写字母、数字、特殊符号( @#*. )、8-20位',
style: TextStyle(color: Colors.orange, fontSize: 12),
),
),
......
......@@ -142,6 +142,31 @@ class _InspectListSyPageState extends State<InspectListSyPage>
backgroundColor: Colors.grey[100],
body: Column(
children: [
Container(
alignment: Alignment.centerLeft,
margin: const EdgeInsets.only(left: 10, right: 10, top: 10),
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(
softWrap: true,
type == '1'
? '小提示:当天新建的设备和用户,会在第二天生成【日管控】任务.'
: type == '2'
? '小提示:【周排查】可在 每周四-周日 完成任务.'
: type == '3'
? '小提示:【月调度】可在 每月25日-月底 完成任务.'
: '',
style: const TextStyle(color: Colors.orange, fontSize: 14),
),
),
Expanded(
flex: 1,
child: EasyRefresh(
......@@ -282,7 +307,7 @@ class _InspectListSyPageState extends State<InspectListSyPage>
Card buildWeekCard(BuildContext context, int index) {
return Card(
margin: const EdgeInsets.only(left: 0, right: 0, top: 15, bottom: 0),
margin: const EdgeInsets.only(left: 0, right: 0, top: 10, bottom: 0),
elevation: listWeek[index].allow == '0' ? 3 : 0,
color: listWeek[index].allow == '0' ? Colors.white : Colors.grey[300],
shape: const RoundedRectangleBorder(
......@@ -310,7 +335,7 @@ class _InspectListSyPageState extends State<InspectListSyPage>
Card buildMonthsCard(BuildContext context, int index) {
return Card(
margin: const EdgeInsets.only(left: 0, right: 0, top: 15, bottom: 0),
margin: const EdgeInsets.only(left: 0, right: 0, top: 10, bottom: 0),
elevation: listMonth[index].allow == '0' ? 3 : 0,
color: listMonth[index].allow == '0' ? Colors.white : Colors.grey[300],
shape: const RoundedRectangleBorder(
......@@ -340,7 +365,7 @@ class _InspectListSyPageState extends State<InspectListSyPage>
Card buildDaysCard(BuildContext context, int index) {
return Card(
elevation: 3,
margin: const EdgeInsets.only(left: 0, right: 0, top: 15, bottom: 0),
margin: const EdgeInsets.only(left: 0, right: 0, top: 10, bottom: 0),
color: Colors.white,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(5)),
......
......@@ -104,8 +104,8 @@ class _EquipmentSettingsPageState extends State<EquipmentSettingsPage> {
children: [
Image.asset('assets/home/rigister_bg.png'),
Container(
margin:
const EdgeInsets.only(left: 15, top: 130, right: 15, bottom: 0),
margin: EdgeInsets.only(
left: 15, top: type == '1' ? 150 : 130, right: 15, bottom: 0),
decoration: const BoxDecoration(
color: ColorConst.whiteColor,
borderRadius: BorderRadius.all(Radius.circular(10)),
......@@ -196,6 +196,25 @@ class _EquipmentSettingsPageState extends State<EquipmentSettingsPage> {
hintText: type == '3' ? '' : '请填写设备名称',
controller: nameText,
focusNode: nameFocusNode),
Container(
alignment: Alignment.centerLeft,
margin: const EdgeInsets.only(left: 5, right: 5, top: 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: const Text(
softWrap: true,
'设备名称可识别对应设备即可,没有特殊要求;\n例如:曳引驱动乘客电梯-1;曳引驱动乘客电梯-2',
style: TextStyle(color: Colors.orange, fontSize: 12),
),
),
const SizedBox(height: 10),
Row(children: [
Icon(
......@@ -216,6 +235,25 @@ class _EquipmentSettingsPageState extends State<EquipmentSettingsPage> {
controller: codeText,
focusNode: codeFocusNode,
isNoChinese: true),
Container(
alignment: Alignment.centerLeft,
margin: const EdgeInsets.only(left: 5, right: 5, top: 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: const Text(
softWrap: true,
'内部编码可识别对应设备即可,没有特殊要求;\n例如:DT-1;DT-2',
style: TextStyle(color: Colors.orange, fontSize: 12),
),
),
const SizedBox(height: 8),
Row(children: [
Icon(type == '3' ? Icons.assignment_ind : Icons.touch_app,
......@@ -253,6 +291,25 @@ class _EquipmentSettingsPageState extends State<EquipmentSettingsPage> {
hintText: type == '3' ? '' : '请填写设备地址详细地址',
controller: addressText,
focusNode: addressFocusNode),
Container(
alignment: Alignment.centerLeft,
margin: const EdgeInsets.only(left: 5, right: 5, top: 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: const Text(
softWrap: true,
'当前设备的具体位置;例如:1号楼1单元左侧电梯',
style: TextStyle(color: Colors.orange, fontSize: 12),
),
),
],
)
],
......@@ -344,7 +401,7 @@ class _EquipmentSettingsPageState extends State<EquipmentSettingsPage> {
Container buildTopTitle(BuildContext context) {
return Container(
margin: const EdgeInsets.only(top: 50),
margin: const EdgeInsets.only(top: 50, right: 30),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
......@@ -356,7 +413,8 @@ class _EquipmentSettingsPageState extends State<EquipmentSettingsPage> {
icon: const Icon(Icons.arrow_back, color: Colors.white),
iconSize: 30,
),
Column(
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
......@@ -384,6 +442,7 @@ class _EquipmentSettingsPageState extends State<EquipmentSettingsPage> {
),
],
),
),
],
),
);
......@@ -401,7 +460,7 @@ class _EquipmentSettingsPageState extends State<EquipmentSettingsPage> {
String? subTitleText() {
if (type == '1') {
return '我们将根据您填写的内容来为您【新建设备】';
return '我们将根据您填写的内容来为您【新建设备】\n注意:使用单位需【新建设备】,否则不会生成【日管控】【周排查】【月调度】任务';
} else if (type == '2') {
return '我们将根据您填写的内容来为您【修改设备】';
} else {
......
......@@ -53,7 +53,11 @@ class _EquipmentListSCPageState extends State<EquipmentListSCPage> {
@override
Widget build(BuildContext context) {
return EasyRefresh(
return Stack(
children: [
Container(
margin: EdgeInsets.only(top: 20),
child: EasyRefresh(
firstRefresh: true,
enableControlFinishRefresh: true,
// enableControlFinishLoad: true,
......@@ -76,6 +80,28 @@ class _EquipmentListSCPageState extends State<EquipmentListSCPage> {
// getList();
// },
child: buildBody(),
),
),
Container(
alignment: Alignment.centerLeft,
height: 25,
margin: const EdgeInsets.only(left: 10, right: 10, top: 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: const Text(
softWrap: true,
'小提示:生产单位无需【新建设备】.',
style: TextStyle(color: Colors.orange, fontSize: 12),
),
),
],
);
}
......
......@@ -50,7 +50,9 @@ class _EquipmentListSYPageState extends State<EquipmentListSYPage> {
Widget build(BuildContext context) {
return Stack(
children: [
EasyRefresh(
Container(
margin: const EdgeInsets.only(top: 20),
child: EasyRefresh(
firstRefresh: true,
enableControlFinishRefresh: true,
// enableControlFinishLoad: true,
......@@ -73,6 +75,7 @@ class _EquipmentListSYPageState extends State<EquipmentListSYPage> {
// },
child: buildBody(),
),
),
if (isUnitRoles(StorageUtil.getInstance().getRoleNames())!) ...[
Positioned(
right: 20,
......@@ -92,17 +95,40 @@ class _EquipmentListSYPageState extends State<EquipmentListSYPage> {
}
});
},
width: 60,
height: 60,
width: 70,
height: 70,
borderRadius: const BorderRadius.all(Radius.circular(360)),
disable: false,
colors: const [ColorConst.blueColor, ColorConst.blue1Color],
colors: const [
ColorConst.orangeColor,
ColorConst.orange2Color
],
child: const Text(
"新建\n设备",
style:
TextStyle(fontSize: 14, color: ColorConst.whiteColor),
TextStyle(fontSize: 16, color: ColorConst.whiteColor),
))),
),
Container(
alignment: Alignment.centerLeft,
height: 25,
margin: const EdgeInsets.only(left: 10, right: 10, top: 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: const Text(
softWrap: true,
'小提示:使用单位需要【新建设备】.',
style: TextStyle(color: Colors.orange, fontSize: 14),
),
),
]
],
);
......
......@@ -95,19 +95,19 @@ class _UserListPageState extends State<UserListPage> {
}
});
},
width: 60,
height: 60,
width: 70,
height: 70,
borderRadius:
const BorderRadius.all(Radius.circular(360)),
disable: false,
colors: const [
ColorConst.blueColor,
ColorConst.blue1Color
ColorConst.orangeColor,
ColorConst.orange2Color
],
child: const Text(
"新建\n用户",
style: TextStyle(
fontSize: 14, color: ColorConst.whiteColor),
fontSize: 16, color: ColorConst.whiteColor),
))),
),
]
......@@ -140,9 +140,9 @@ class _UserListPageState extends State<UserListPage> {
// Get.toNamed(RouteString.USER_SETTINGS, arguments: '3');
},
child: Card(
elevation: 2,
elevation: 5,
margin: const EdgeInsets.only(left: 0, right: 0, top: 15, bottom: 0),
color: Colors.white,
color: isItemRoleNames(roleNames(index))?ColorConst.orange1Color :Colors.white ,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(10)),
),
......@@ -211,8 +211,9 @@ class _UserListPageState extends State<UserListPage> {
TextSpan(
text: roleNames(index),
style: const TextStyle(
fontSize: 13,
color: Colors.black54)),
fontWeight: FontWeight.bold,
fontSize: 14,
color: Colors.black87)),
])),
),
],
......
......@@ -83,6 +83,11 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
AppRoles appRoles = value;
setState(() {
newList.addAll(appRoles.data!);
for (int i = 0; i < newList.length; i++) {
if (newList[i].name!.contains('公司账户')) {
newList.removeAt(i);
}
}
});
}
});
......@@ -96,8 +101,8 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
children: [
Image.asset('assets/home/rigister_bg.png'),
Container(
margin:
const EdgeInsets.only(left: 15, top: 130, right: 15, bottom: 0),
margin: EdgeInsets.only(
left: 15, top: type == '1' ? 150 : 130, right: 15, bottom: 0),
decoration: const BoxDecoration(
color: ColorConst.whiteColor,
borderRadius: BorderRadius.all(Radius.circular(10)),
......@@ -148,7 +153,7 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
///用户信息
Container buildUnitInformation() {
return Container(
margin: const EdgeInsets.only(left: 10, top: 20, right: 10, bottom: 30),
margin: const EdgeInsets.only(left: 10, top: 10, right: 10, bottom: 30),
child: Stack(
children: [
Column(
......@@ -261,7 +266,7 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
),
child: const Text(
softWrap: true,
'密码至少包含以下 3 种类别:大写字母、小写字母、数字、特殊符号( @#*. )、8-20位',
'密码至少包含以下 5 种类别:大写字母、小写字母、数字、特殊符号( @#*. )、8-20位',
style: TextStyle(color: Colors.orange, fontSize: 12),
),
),
......@@ -307,7 +312,6 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
Text('*',
style: TextStyle(fontSize: 14, color: Colors.red)),
]),
if (type == '2') ...[
///修改
buildEditListView(),
......@@ -315,14 +319,6 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
///新建
buildAddListView(),
]
//
// // GridViewAQZJList(
// // equipmentSYBoList:
// // allRolesList[index].officeDtoSYList,
// // equipmentSCBoList:
// // allRolesList[index].officeDtoSCList,
// // isVisbliy: allRolesList[index].isChecked)
],
)
],
......@@ -344,11 +340,7 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
GestureDetector(
onTap: () {
setState(() {
if (newList[index].name == '公司账户') {
newList[index].check = !newList[index].check!;
} else {
newList[index].check = !newList[index].check!;
}
///如果取消身份勾选,将当前身份下的已选中设备全部取消勾选
if (!newList[index].check!) {
......@@ -370,41 +362,26 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
child: Transform.scale(
scale: 0.8,
child: Checkbox(
value: newList[index].name == '公司账户'
? false
: newList[index].check!,
value: newList[index].check!,
// 指定复选框的状态
onChanged: newList[index].name == '公司账户'
? null
: (value) {
onChanged: (value) {
setState(() {
newList[index].check =
value!; // 更新 isChecked 的状态值
});
},
side: MaterialStateBorderSide.resolveWith(
(Set<MaterialState> states) {
//修改默认时边框颜色为绿色
return newList[index].name == '公司账户'
? const BorderSide(
width: 2, color: Colors.black12)
: null;
},
)),
),
),
),
Text(newList[index].name!, // 设置外层角色文本内容
style: TextStyle(
style: const TextStyle(
fontSize: 14,
color: newList[index].name == '公司账户'
? Colors.grey[400]
: Colors.black54,
color: Colors.black54,
fontWeight: FontWeight.bold)),
],
),
),
),
if (newList[index].check! &&
newList[index].userDtoList!.isNotEmpty) ...[
Container(
......@@ -487,28 +464,6 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
fontSize: 12, color: Colors.black),
),
),
// child: Container(
// decoration: BoxDecoration(
// color: newSyList(index)![subIndex].check!
// ? Colors.blue[50]
// : Colors.transparent,
// border: Border.all(
// color: newSyList(index)![subIndex].check!
// ? Colors.blue
// : ColorConst.greyD2Color,
// width: 1),
// borderRadius: BorderRadius.circular(3),
// ),
// alignment: Alignment.center,
// child: Text(
// newSyList(index)![subIndex].name!,
// style: TextStyle(
// fontSize: 12,
// color: newSyList(index)![subIndex].check!
// ? Colors.blue
// : Colors.black),
// ),
// ),
);
},
),
......@@ -585,28 +540,6 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
fontSize: 12, color: Colors.black),
),
),
// child: Container(
// decoration: BoxDecoration(
// color: newScList(index)![subIndex].check!
// ? Colors.orange[50]
// : Colors.transparent,
// border: Border.all(
// color: newScList(index)![subIndex].check!
// ? Colors.orange
// : ColorConst.greyD2Color,
// width: 1),
// borderRadius: BorderRadius.circular(3),
// ),
// alignment: Alignment.center,
// child: Text(
// newScList(index)![subIndex].name!,
// style: TextStyle(
// fontSize: 12,
// color: newScList(index)![subIndex].check!
// ? Colors.orange
// : Colors.black),
// ),
// ),
);
},
),
......@@ -615,13 +548,6 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
),
),
],
// GridViewAQZJList(
// equipmentSYBoList:
// allRolesList[index].officeDtoSYList,
// equipmentSCBoList:
// allRolesList[index].officeDtoSCList,
// isVisbliy: allRolesList[index].isChecked)
],
);
},
......@@ -677,28 +603,22 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
child: Transform.scale(
scale: 0.8,
child: Checkbox(
value:
editList!.roleDtoList![index].name == '公司账户'
? true
: false,
value: true,
// 指定复选框的状态
onChanged: null,
side: MaterialStateBorderSide.resolveWith(
(Set<MaterialState> states) {
//修改默认时边框颜色为绿色
return const BorderSide(
width: 2, color: Colors.black12);
width: 2, color: Colors.grey);
},
)),
),
),
Text(editList!.roleDtoList![index].name!, // 设置外层角色文本内容
const Text('公司账户', // 设置外层角色文本内容
style: TextStyle(
fontSize: 14,
color:
editList!.roleDtoList![index].name == '公司账户'
? Colors.black54
: Colors.grey[400],
color: Colors.black54,
fontWeight: FontWeight.bold)),
] else ...[
Container(
......@@ -915,7 +835,8 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
],
);
},
itemCount: editList!.roleDtoList!.length,
itemCount:
roleNames().contains('公司账户') ? 1 : editList!.roleDtoList!.length - 1,
separatorBuilder: (BuildContext context, int index) {
return const SizedBox(
height: 0,
......@@ -978,7 +899,8 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
icon: const Icon(Icons.arrow_back, color: Colors.white),
iconSize: 30,
),
Column(
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
......@@ -1006,6 +928,7 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
),
],
),
),
],
),
);
......@@ -1021,7 +944,7 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
String? subTitleText() {
if (type == '1') {
return '我们将根据您填写的内容来为您【新建用户】';
return '我们将根据您填写的内容来为您【新建用户】\n注:请牢记登录名和密码, 登录该用户账号可做【日管控】【周排查】【月调度】【考核】任务';
} else {
return '我们将根据您填写的内容来为您【修改用户】';
}
......@@ -1058,7 +981,7 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
if (!StringUtils.isValidPassword(passwordText!.text)) {
passwordFocusNode!.requestFocus();
ToastUtils.showCenter(
'密码至少包含以下 3 种类别:大写字母、小写字母、数字、特殊符号(@#*.)、8-20位');
'密码至少包含以下 5 种类别:大写字母、小写字母、数字、特殊符号(@#*.)、8-20位');
return;
}
if (okPasswordText!.text.isEmpty) {
......@@ -1075,7 +998,7 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
if (!StringUtils.isValidPassword(passwordText!.text)) {
passwordFocusNode!.requestFocus();
ToastUtils.showCenter(
'密码至少包含以下 3 种类别:大写字母、小写字母、数字、特殊符号(@#*.)、8-20位');
'密码至少包含以下 5 种类别:大写字母、小写字母、数字、特殊符号(@#*.)、8-20位');
return;
}
if (okPasswordText!.text.isEmpty) {
......
import 'package:shared_preferences/shared_preferences.dart';
import 'package:special_equipment_flutter/model/user_bo.dart';
///数据库相关的工具
class SPAccountUtil {
static const String ACCOUNT_NUMBER = "account_number";
static const String USERNAME = "username";
static const String PASSWORD = "password";
///删掉单个账号
static void delUser(UserBo user, index) async {
SharedPreferences sp = await SharedPreferences.getInstance();
List<UserBo> list = await getUsers();
// list.remove(user);
list.removeAt(index);
saveUsers(list, sp);
}
///保存账号,如果重复,就将最近登录账号放在第一个
static void saveUser(UserBo user) async {
SharedPreferences sp = await SharedPreferences.getInstance();
List<UserBo> list = await getUsers();
addNoRepeat(list, user);
saveUsers(list, sp);
}
///去重并维持次序
static void addNoRepeat(List<UserBo> users, UserBo user) {
for (int i = 0; i < users.length; i++) {
if (users[i].account == user.account) {
users.removeAt(i);
}
}
users.insert(0, user);
}
///获取已经登录的账号列表
static Future<List<UserBo>> getUsers() async {
List<UserBo> list = [];
SharedPreferences sp = await SharedPreferences.getInstance();
int num = sp.getInt(ACCOUNT_NUMBER) ?? 0;
for (int i = 0; i < num; i++) {
String? username = sp.getString("$USERNAME$i");
String? password = sp.getString("$PASSWORD$i");
list.add(UserBo(username, password));
}
return list;
}
///保存账号列表
static saveUsers(List<UserBo> users, SharedPreferences sp) {
sp.clear();
int size = users.length;
for (int i = 0; i < size; i++) {
sp.setString("$USERNAME$i", users[i].account!);
sp.setString("$PASSWORD$i", users[i].password!);
}
sp.setInt(ACCOUNT_NUMBER, size);
}
}
import 'dart:convert';
import 'package:get_storage/get_storage.dart';
import 'package:special_equipment_flutter/ui/common/data.dart';
import 'package:special_equipment_flutter/model/user_bo.dart';
import 'package:special_equipment_flutter/utils/string_utils.dart';
class SpKeys {
static const USER_NAME = "spUserName";
static const PASSWORD = "spPassword";
static const NAME = "spName";
static const JSESSION_ID = "spJsessionId";
static const USER_ID = "spUserId";
......@@ -19,6 +22,10 @@ class SpKeys {
///拍照位置
static const CAMERA_ADDRESS = "camera_address";
static const ACCOUNT_NUMBER = "account_number";
static const ACCOUNT = "account";
static const PASSWORDS = "password";
}
class StorageUtil {
......@@ -77,6 +84,11 @@ class StorageUtil {
return userId;
}
T getPassword<T>() {
var password = get(SpKeys.PASSWORD);
return password;
}
T getName<T>() {
var nickName = get(SpKeys.NAME);
return nickName;
......@@ -134,4 +146,37 @@ class StorageUtil {
return false;
}
}
///删掉单个账号
// delUser(UserBo user) {
// List<UserBo> list = getUsers();
// list.remove(user);
// saveUsers(list);
// }
///保存账号,如果重复,就将最近登录账号放在第一个
saveUser(UserBo user) {
List<UserBo>? userList = get(SpKeys.ACCOUNT_NUMBER);
userList ??= [];
bool isFlag = true;
for (int i = 0; i < userList.length; i++) {
if (userList[i].account == user.account) {
userList.removeAt(i);
isFlag = false;
}
}
if (isFlag) {
userList.add(user);
} else {
userList.insert(0, user);
}
set(SpKeys.ACCOUNT_NUMBER, userList);
}
getUserList<T>() {
List<UserBo>? userList = get(SpKeys.ACCOUNT_NUMBER);
userList ??= [];
return userList;
}
}
//// ignore_for_file: non_constant_identifier_names, library_private_types_in_public_api, import_of_legacy_library_into_null_safe
//
//import 'package:flutter/material.dart';
//import 'package:flutter_swiper/flutter_swiper.dart';
//
//class SlideBanner extends StatefulWidget {
// const SlideBanner({super.key});
//
// @override
// _SwiperPageState createState() => _SwiperPageState();
//}
//
//class _SwiperPageState extends State<SlideBanner> {
// ignore_for_file: non_constant_identifier_names, library_private_types_in_public_api, import_of_legacy_library_into_null_safe
import 'package:card_swiper/card_swiper.dart';
import 'package:flutter/material.dart';
import 'package:special_equipment_flutter/dio/api.dart';
import '../model/banner_list_bo.dart';
class SlideBanner extends StatefulWidget {
const SlideBanner({super.key, required this.bannerList});
final List<Data>? bannerList;
@override
_SwiperPageState createState() => _SwiperPageState();
}
class _SwiperPageState extends State<SlideBanner> {
List<Map> imgList = [
{"url": "assets/images/image0.png"},
{"url": "assets/images/image1.png"},
{"url": "assets/images/image2.png"},
{"url": "assets/images/image3.png"},
{"url": "assets/images/image4.png"},
{"url": "assets/images/image5.png"},
];
// List<Map> imgList = [
// {"url": "assets/images/image0.png"},
// {"url": "assets/images/image1.png"},
// {"url": "assets/images/image2.png"},
// {"url": "assets/images/image3.png"},
// {"url": "assets/images/image4.png"},
// {"url": "assets/images/image5.png"},
// ];
//
//// List<Map> imgList = [
//// {
//// "url":
//// "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fcdn.aitecar.com%2Fwp-content%2Fuploads%2F2014%2F11%2F20141119113831dc84baa9b3e7d0c7a37a.jpg&refer=http%3A%2F%2Fcdn.aitecar.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1671264681&t=d919a7187f42bd7c0ac775ce08fc63bd"
//// },
//// {
//// "url":
//// "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww2.autoimg.cn%2Fchejiahaodfs%2Fg8%2FM12%2FA3%2F22%2Fautohomecar__ChwEmmDmZhSAUiI3AAHEf6vp_kw118.png&refer=http%3A%2F%2Fwww2.autoimg.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1671264664&t=0a7d80e389aab22d6e724df0183e8f57"
//// },
//// {
//// "url":
//// "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fp4.itc.cn%2Fimages01%2F20211023%2F55209e5c4f324f2ba3a0a27e51c7486a.jpeg&refer=http%3A%2F%2Fp4.itc.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1671264668&t=c0395ee14ae1b7674d3283c4ba4bb4bc"
//// },
//// {
//// "url":
//// "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww2.autoimg.cn%2Fchejiahaodfs%2Fg8%2FM12%2FA3%2F22%2Fautohomecar__ChwEmmDmZhSAUiI3AAHEf6vp_kw118.png&refer=http%3A%2F%2Fwww2.autoimg.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1671264664&t=0a7d80e389aab22d6e724df0183e8Qf57"
//// },
//// ];
//
// @override
// Widget build(BuildContext context) {
// var MySwiperWidget = Swiper(
// itemBuilder: (BuildContext context, int index) {
// //每次循环遍历时,将i赋值给index
// return Image.asset(
// imgList[index]['url'],
// fit: BoxFit.fill,
// );
//// return Image.network(
//// imgList[index]['url'],
//// fit: BoxFit.fill,
//// );
// {
// "url":
// "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fcdn.aitecar.com%2Fwp-content%2Fuploads%2F2014%2F11%2F20141119113831dc84baa9b3e7d0c7a37a.jpg&refer=http%3A%2F%2Fcdn.aitecar.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1671264681&t=d919a7187f42bd7c0ac775ce08fc63bd"
// },
// {
// "url":
// "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww2.autoimg.cn%2Fchejiahaodfs%2Fg8%2FM12%2FA3%2F22%2Fautohomecar__ChwEmmDmZhSAUiI3AAHEf6vp_kw118.png&refer=http%3A%2F%2Fwww2.autoimg.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1671264664&t=0a7d80e389aab22d6e724df0183e8f57"
// },
// {
// "url":
// "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fp4.itc.cn%2Fimages01%2F20211023%2F55209e5c4f324f2ba3a0a27e51c7486a.jpeg&refer=http%3A%2F%2Fp4.itc.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1671264668&t=c0395ee14ae1b7674d3283c4ba4bb4bc"
// },
// autoplay: true,
// duration: 300,
// itemCount: imgList.length,
//// layout: SwiperLayout.DEFAULT,
//// scale: 0.93,
//// viewportFraction: 0.9,
// //指示器样式
// pagination: const SwiperPagination(
// alignment: Alignment.bottomRight,
// builder: DotSwiperPaginationBuilder(
// color: Colors.black54,
// activeColor: Colors.white,
// size: 10,
// activeSize: 12,
// )),
// );
// return Scaffold(
// body: SizedBox(
// height: 200,
// width: double.infinity,
// child: MySwiperWidget,
// ));
// }
//}
// {
// "url":
// "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww2.autoimg.cn%2Fchejiahaodfs%2Fg8%2FM12%2FA3%2F22%2Fautohomecar__ChwEmmDmZhSAUiI3AAHEf6vp_kw118.png&refer=http%3A%2F%2Fwww2.autoimg.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1671264664&t=0a7d80e389aab22d6e724df0183e8Qf57"
// },
// ];
@override
Widget build(BuildContext context) {
var MySwiperWidget = Swiper(
itemBuilder: (BuildContext context, int index) {
//每次循环遍历时,将i赋值给index
// return Image.asset(
// imgList[index]['url'],
// fit: BoxFit.fill,
// );
return Image.network(
'${Api.URL}special${widget.bannerList![index].advertisUrl!}',
fit: BoxFit.fill,
);
},
autoplay: true,
duration: 2000,
autoplayDelay: 5000,
itemCount: widget.bannerList!.length,
// pagination: const SwiperPagination(
// builder: DotSwiperPaginationBuilder(
// color: Color(0xFFD39C7F), activeColor: Color(0xFFFF4646))),
// layout: SwiperLayout.DEFAULT,
// scale: 0.93,
// viewportFraction: 0.9,
//指示器样式
// pagination: const SwiperPagination(
// alignment: Alignment.bottomRight,
// builder: DotSwiperPaginationBuilder(
// color: Colors.black54,
// activeColor: Colors.white,
// size: 10,
// activeSize: 12,
// )),
);
return Scaffold(
body: SizedBox(
height: 200,
width: double.infinity,
child: MySwiperWidget,
));
}
}
import 'package:card_swiper/card_swiper.dart';
import 'package:flutter/material.dart';
import 'package:special_equipment_flutter/dio/api.dart';
import '../model/banner_list_bo.dart';
//layouts swiper
class CardSwiper extends StatefulWidget {
const CardSwiper({super.key, required this.bannerList});
final List<Data>? bannerList;
@override
_CardSwiperState createState() => _CardSwiperState();
}
class _CardSwiperState extends State<CardSwiper> {
// List<Map> banner = [
// {"url": "assets/banner/banner1.jpg"},
// {"url": "assets/banner/banner2.jpg"},
// {"url": "assets/banner/banner1.jpg"}
// ];
@override
Widget build(BuildContext context) {
return SizedBox(
height: 230,
child: Swiper(
itemBuilder: (BuildContext context, int index) {
// return Image.asset(
// widget.bannerList[index].advertisUrl,
// fit: BoxFit.fill,
// );
return Image.network(
'${Api.URL}special${widget.bannerList![index].advertisUrl!}',
fit: BoxFit.fill,
errorBuilder: (context, error, stackTrace) {
return Image.asset('assets/day/no_data_icon.png');
},
);
},
onTap: (index) {
print(index);
},
itemCount: widget.bannerList!.length,
pagination: const SwiperPagination(
builder: DotSwiperPaginationBuilder(
color: Color(0xFFD39C7F), activeColor: Color(0xFFFF4646))),
// loop: false,
autoplay: true,
duration: 2000,
autoplayDelay: 5000
// viewportFraction: 0.8,
// scale: 0.9,
),
);
}
}
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class NumChangeWidget extends StatefulWidget {
final double height;
int num;
final ValueChanged<int> onValueChanged;
final bool disabled;
NumChangeWidget(
{Key? key,
this.height = 25.0,
this.num = 0,
this.disabled = false,
required this.onValueChanged})
: super(key: key);
@override
_NumChangeWidgetState createState() {
return _NumChangeWidgetState();
}
}
class _NumChangeWidgetState extends State<NumChangeWidget> {
TextEditingController _numcontroller = TextEditingController();
@override
void initState() {
super.initState();
_numcontroller.addListener(_onNumChange);
}
void _onNumChange() {
String text = _numcontroller.text;
if (text.isNotEmpty) {
String result = text.replaceAll(RegExp(r'^[0]+'), ''); // 去掉首位0的正则替换
if (result != '') {
widget.num = int.parse(result);
widget.onValueChanged(widget.num);
}
if (result != text) {
_numcontroller.selection =
TextSelection.fromPosition(TextPosition(offset: result.length));
}
}
}
@override
Widget build(BuildContext context) {
_numcontroller.text = widget.num.toString();
return Container(
height: widget.height,
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(2.0)),
color: Colors.black54),
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
GestureDetector(
onTap: _minusNum,
child: Container(
width: 25.0,
alignment: Alignment.center,
child: Icon(Icons.horizontal_rule_outlined,
color: widget.num == 0 || widget.disabled
? Color.fromRGBO(255, 255, 255, .4)
: Colors.white),
),
),
Container(
width: 0.5,
color: Colors.black54,
),
Container(
width: 32.0,
alignment: Alignment.center,
child: TextField(
controller: _numcontroller,
//TextEditingController,用于获取文本值
keyboardType: TextInputType.number,
//设置键盘为数字
textAlign: TextAlign.center,
// 内容左右居中
maxLines: 1,
decoration: const InputDecoration(
border: InputBorder.none,
contentPadding: EdgeInsets.only(bottom: 10),
),
inputFormatters: [
FilteringTextInputFormatter.digitsOnly, //设置只允许输入整数
],
style: TextStyle(fontSize: 16, color: Colors.white),
readOnly: widget.disabled),
),
Container(
width: 0.5,
color: Colors.black54,
),
GestureDetector(
onTap: _addNum,
child: Container(
width: 25.0,
alignment: Alignment.center,
child: Icon(
Icons.add_outlined,
color: widget.disabled
? const Color.fromRGBO(255, 255, 255, .4)
: Colors.white,
), // 设计图
),
),
],
),
);
}
void _minusNum() {
if (widget.num == 0 || widget.disabled) {
return;
}
setState(() {
widget.num -= 1;
if (widget.onValueChanged != null) {
widget.onValueChanged(widget.num);
}
});
}
void _addNum() {
if (widget.disabled) {
return;
}
setState(() {
widget.num += 1;
if (widget.onValueChanged != null) {
widget.onValueChanged(widget.num);
}
});
}
}
......@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.6+6
version: 1.0.7+7
environment:
sdk: '>=3.1.3 <4.0.0'
......@@ -57,7 +57,10 @@ dependencies:
flutter_bmflocation: ^3.5.0
sliding_up_panel: ^2.0.0+1
event_bus: ^2.0.0
card_swiper: ^3.0.1
# pdf: ^3.11.0
# printing: ^5.12.0
# pdfx: ^2.6.0
# geolocator: ^7.1.0
# geocoding: ^2.1.1
......@@ -73,7 +76,7 @@ dependencies:
# event_bus: ^2.0.0
# provider: ^6.0.5
# shake_animation_widget: ^3.0.3
# flutter_xupdate: ^2.0.0
# flutter_xupdate: ^0.0.2
dev_dependencies:
......@@ -100,7 +103,6 @@ flutter:
# To add assets to your application, add an assets section, like this:
assets:
- assets/home/top_bg_icon.png
- assets/home/day_control_white_icon.png
- assets/home/monthly_scheduling_white_icon.png
- assets/home/weekly_survey_white_icon.png
......@@ -136,6 +138,9 @@ flutter:
- assets/examine/no_pass_icon.png
- assets/examine/examine_gary_icon.png
- assets/examine/history_icon.png
- assets/name.pdf
# 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