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' ...@@ -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_page.dart';
import 'package:special_equipment_flutter/ui/examine/test/test_result_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/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/login/login_page.dart';
import 'package:special_equipment_flutter/ui/main/tab_home_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/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_details_page.dart';
import 'package:special_equipment_flutter/ui/overseer/overseer_history_list_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/overseer/unit_list_page.dart';
import 'package:special_equipment_flutter/ui/register/address_page.dart'; import 'package:special_equipment_flutter/ui/register/address_page.dart';
import 'package:special_equipment_flutter/ui/register/register_page1.dart'; import 'package:special_equipment_flutter/ui/register/register_page1.dart';
...@@ -142,6 +143,9 @@ class RouteString { ...@@ -142,6 +143,9 @@ class RouteString {
static const String OVERSEER_HISTROY_DETAILS_PAGE = static const String OVERSEER_HISTROY_DETAILS_PAGE =
"/OverseerHistroyDetailsPage"; "/OverseerHistroyDetailsPage";
///文件预览
static const String FILE_LIST_PAGE = "/FileListPage";
static final routes = [ static final routes = [
///登录 ///登录
GetPage(name: LOGIN, page: () => const LoginPage()), GetPage(name: LOGIN, page: () => const LoginPage()),
...@@ -222,7 +226,7 @@ class RouteString { ...@@ -222,7 +226,7 @@ class RouteString {
GetPage(name: EXAM_RESULT_PAGE, page: () => ExamResultPage()), 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()), GetPage(name: UNIT_LIST_PAGE, page: () => UnitListPage()),
...@@ -246,6 +250,9 @@ class RouteString { ...@@ -246,6 +250,9 @@ class RouteString {
name: OVERSEER_HISTROY_DETAILS_PAGE, name: OVERSEER_HISTROY_DETAILS_PAGE,
page: () => OverseerHistroyDetailsPage()), page: () => OverseerHistroyDetailsPage()),
///文件预览
GetPage(name: FILE_LIST_PAGE, page: () => FileListPage()),
// GetPage( // GetPage(
// name: "/shop", // name: "/shop",
// page: () => const ShopPage(), // page: () => const ShopPage(),
......
...@@ -3,15 +3,15 @@ ...@@ -3,15 +3,15 @@
class Api { class Api {
static var IS_DEBUG = true; static var IS_DEBUG = true;
static String URL = // static String URL =
IS_DEBUG ? "https://special.sxyztech.cn/" : "http://192.168.19.165:2212/"; // IS_DEBUG ? "https://special.sxyztech.cn/" : "http://192.168.19.165:2222/";
///演示 ip ///演示 ip
// static String URL = "http://47.92.138.92:8009/"; // static String URL = "http://47.92.138.92:8009/";
// static String URL = "http://192.168.19.164:8087/"; // static String URL = "http://192.168.19.164:8087/";
// static String URL = "http://192.168.19.165:2212/"; static String URL = "http://192.168.19.215:8181/";
static String START_URL = "special/a/", static String START_URL = "special/a/",
END_URL = "__ajax=true&mobileLogin=true"; END_URL = "__ajax=true&mobileLogin=true";
...@@ -239,6 +239,9 @@ class Api { ...@@ -239,6 +239,9 @@ class Api {
/// 监察记录 删除 /// 监察记录 删除
static String EXAM_SETUP_DELETE = "${URL + START_URL}exam/examSetup/delete"; 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"; // static String EXAMINE_PERSON = "${URL + START_URL}/exam/examPerson/checkHaveExam";
} }
...@@ -8,6 +8,7 @@ import 'package:get/route_manager.dart'; ...@@ -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/dio/dio/do_utils.dart';
import 'package:special_equipment_flutter/model/app_is_open.dart'; import 'package:special_equipment_flutter/model/app_is_open.dart';
import 'package:special_equipment_flutter/model/app_roles.dart'; import 'package:special_equipment_flutter/model/app_roles.dart';
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/base_model.dart';
import 'package:special_equipment_flutter/model/base/result_obj_bo.dart'; import 'package:special_equipment_flutter/model/base/result_obj_bo.dart';
import 'package:special_equipment_flutter/model/city_address_bo.dart'; import 'package:special_equipment_flutter/model/city_address_bo.dart';
...@@ -1705,6 +1706,30 @@ class HttpUtils { ...@@ -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) { // HttpUtils.getList(context, _page, 20).then((value) {
// ListBo listBo = value; // ListBo listBo = value;
// print(listBo); // 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 { ...@@ -43,6 +43,7 @@ class EquiList {
String? id; String? id;
String? name; String? name;
bool isChecked = false;
EquiList copyWith({ EquiList copyWith({
String? id, 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 // 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 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
...@@ -11,7 +12,9 @@ import 'package:special_equipment_flutter/common/route_string.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/dio/http_utils.dart';
import 'package:special_equipment_flutter/model/app_is_open.dart'; import 'package:special_equipment_flutter/model/app_is_open.dart';
import 'package:special_equipment_flutter/model/login_bo.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/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/storage_util.dart';
import 'package:special_equipment_flutter/utils/toast_utils.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_button.dart';
...@@ -88,10 +91,12 @@ class EditTextState extends State<EditTextWidget> ...@@ -88,10 +91,12 @@ class EditTextState extends State<EditTextWidget>
late final Animation<double> logoAnimation; late final Animation<double> logoAnimation;
var versionName; var versionName;
String? isOpen = '0'; String? isOpen = '0';
bool isPassword = true;
@override @override
void initState() { void initState() {
_initPackageInfo(); _initPackageInfo();
getAccountList();
phoneController = TextEditingController(); phoneController = TextEditingController();
passController = TextEditingController(); passController = TextEditingController();
phoneController.addListener(() { phoneController.addListener(() {
...@@ -101,8 +106,10 @@ class EditTextState extends State<EditTextWidget> ...@@ -101,8 +106,10 @@ class EditTextState extends State<EditTextWidget>
phoneController.value = phoneController.value.copyWith( phoneController.value = phoneController.value.copyWith(
text: Api.IS_DEBUG ? StorageUtil.getInstance().getUserName() : 'tyjcr'); text: Api.IS_DEBUG ? StorageUtil.getInstance().getUserName() : 'tyjcr');
passController.value = passController.value = passController.value.copyWith(
passController.value.copyWith(text: Api.IS_DEBUG ? '' : 'Aa123456.'); text: Api.IS_DEBUG
? StorageUtil.getInstance().getPassword()
: 'Aa123456.');
super.initState(); super.initState();
logoController = AnimationController( logoController = AnimationController(
...@@ -194,9 +201,194 @@ class EditTextState extends State<EditTextWidget> ...@@ -194,9 +201,194 @@ class EditTextState extends State<EditTextWidget>
buildTips(), buildTips(),
const SizedBox(height: 30), const SizedBox(height: 30),
accountTextField(context), //账号
const SizedBox(height: 12), //账号和密码间距 accountTextField(context),
buildPasswordTextField(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), //密码和登录按钮间距 const SizedBox(height: 40), //密码和登录按钮间距
//嵌套SizedBox, 设置button的宽高 //嵌套SizedBox, 设置button的宽高
...@@ -229,6 +421,14 @@ class EditTextState extends State<EditTextWidget> ...@@ -229,6 +421,14 @@ class EditTextState extends State<EditTextWidget>
)); ));
} }
List<UserBo> listAccount = [];
///获取历史用户
void getAccountList() async {
listAccount.clear();
listAccount.addAll(await SPAccountUtil.getUsers());
}
GradientButton buildRigister() { GradientButton buildRigister() {
return GradientButton( return GradientButton(
tapCallback: () { tapCallback: () {
...@@ -538,14 +738,15 @@ class EditTextState extends State<EditTextWidget> ...@@ -538,14 +738,15 @@ class EditTextState extends State<EditTextWidget>
} }
//登录 //登录
_startLogin(username, pwd) async { _startLogin(userName, pwd) async {
///清除本地所有数据 ///清除本地所有数据
// StorageUtil.getInstance().clearAll(); // StorageUtil.getInstance().clearAll();
StorageUtil.getInstance().remove(SpKeys.JSESSION_ID); StorageUtil.getInstance().remove(SpKeys.JSESSION_ID);
HttpUtils.doLogin(context, username, pwd, onSuccess: (value) { HttpUtils.doLogin(context, userName, pwd, onSuccess: (value) {
if (value != null) { if (value != null) {
LoginBo loginBo = value; LoginBo loginBo = value;
StorageUtil.getInstance().set(SpKeys.USER_NAME, loginBo.username); 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.NAME, loginBo.name);
StorageUtil.getInstance().set(SpKeys.JSESSION_ID, loginBo.jsessionid); StorageUtil.getInstance().set(SpKeys.JSESSION_ID, loginBo.jsessionid);
StorageUtil.getInstance().set(SpKeys.USER_ID, loginBo.userId); StorageUtil.getInstance().set(SpKeys.USER_ID, loginBo.userId);
...@@ -558,6 +759,14 @@ class EditTextState extends State<EditTextWidget> ...@@ -558,6 +759,14 @@ class EditTextState extends State<EditTextWidget>
StorageUtil.getInstance() StorageUtil.getInstance()
.set(SpKeys.ROLE_NAMES, loginBo.user!.roleNames); .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)!) { if (isUnitRoles(loginBo.user!.roleNames)!) {
Get.offAllNamed(RouteString.HOME); Get.offAllNamed(RouteString.HOME);
......
...@@ -13,6 +13,7 @@ import 'package:special_equipment_flutter/common/edgeInsets_const.dart'; ...@@ -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/common/route_string.dart';
import 'package:special_equipment_flutter/dio/http_utils.dart'; import 'package:special_equipment_flutter/dio/http_utils.dart';
import 'package:special_equipment_flutter/model/app_is_open.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/check_update.dart';
import 'package:special_equipment_flutter/model/count_bo.dart'; import 'package:special_equipment_flutter/model/count_bo.dart';
import 'package:special_equipment_flutter/model/echart_bo.dart'; import 'package:special_equipment_flutter/model/echart_bo.dart';
...@@ -33,6 +34,8 @@ import 'package:special_equipment_flutter/utils/size_config.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/storage_util.dart';
import 'package:special_equipment_flutter/utils/time_util.dart'; import 'package:special_equipment_flutter/utils/time_util.dart';
import 'package:special_equipment_flutter/utils/toast_utils.dart'; import 'package:special_equipment_flutter/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/custom_button.dart';
import 'package:special_equipment_flutter/widgets/divider_custom.dart'; import 'package:special_equipment_flutter/widgets/divider_custom.dart';
import 'package:special_equipment_flutter/widgets/easy_refresh_header1.dart'; import 'package:special_equipment_flutter/widgets/easy_refresh_header1.dart';
...@@ -79,6 +82,7 @@ class _HomePageState extends State<HomePage> ...@@ -79,6 +82,7 @@ class _HomePageState extends State<HomePage>
late final Animation<double> _animation; late final Animation<double> _animation;
List<ChargeUserList>? chargeList = []; List<ChargeUserList>? chargeList = [];
List<OfficeDtoLists>? deviceList = []; List<OfficeDtoLists>? deviceList = [];
FindChargeListBo? chargeBo = FindChargeListBo(); FindChargeListBo? chargeBo = FindChargeListBo();
List<CountData>? findCountList = []; List<CountData>? findCountList = [];
ExaminePersonBo? mExaminePersonBo = ExaminePersonBo(); ExaminePersonBo? mExaminePersonBo = ExaminePersonBo();
...@@ -86,10 +90,16 @@ class _HomePageState extends State<HomePage> ...@@ -86,10 +90,16 @@ class _HomePageState extends State<HomePage>
int mOverseerHistoryCount = 0; int mOverseerHistoryCount = 0;
List<HistoryListData>? mHistoryListData = []; List<HistoryListData>? mHistoryListData = [];
String? isOpen = '0'; String? isOpen = '0';
List<Data>? bannerList = [];
//声明,后面需要销毁 //声明,后面需要销毁
StreamSubscription? event; StreamSubscription? event;
// List<Map> banner = [
// {"url": "assets/banner/banner0.png"},
// {"url": "assets/banner/banner1.png"}
// ];
@override @override
void initState() { void initState() {
super.initState(); super.initState();
...@@ -118,6 +128,11 @@ class _HomePageState extends State<HomePage> ...@@ -118,6 +128,11 @@ class _HomePageState extends State<HomePage>
StorageUtil.getInstance().set(SpKeys.UNIT_STATUS, unitId); StorageUtil.getInstance().set(SpKeys.UNIT_STATUS, unitId);
} }
// _requestPermission(); // _requestPermission();
Future.delayed(const Duration(seconds: 2), () {
// 延迟执行的代码
getBannerList();
});
///获取日管控、周排查、月调度数量 ///获取日管控、周排查、月调度数量
getCount(); getCount();
getGirdviewData(); getGirdviewData();
...@@ -149,6 +164,23 @@ class _HomePageState extends State<HomePage> ...@@ -149,6 +164,23 @@ class _HomePageState extends State<HomePage>
getDeviceData(); 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() { void doAppIsOpen() {
if (Platform.isIOS) { if (Platform.isIOS) {
...@@ -481,6 +513,13 @@ class _HomePageState extends State<HomePage> ...@@ -481,6 +513,13 @@ class _HomePageState extends State<HomePage>
getOverseerHistoryList(); getOverseerHistoryList();
} }
}); });
// Get.toNamed(RouteString.FILE_LIST_PAGE, arguments: {})
// ?.then((value) {
// if (value != null && value) {
// getOverseerHistoryList();
// }
// });
}, },
), ),
), ),
...@@ -935,6 +974,27 @@ class _HomePageState extends State<HomePage> ...@@ -935,6 +974,27 @@ class _HomePageState extends State<HomePage>
), ),
// buildTitle(Icons.equalizer, '考核练习'), // buildTitle(Icons.equalizer, '考核练习'),
// buildSliverGridExamination() // 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> ...@@ -1819,20 +1879,24 @@ class _HomePageState extends State<HomePage>
SliverAppBar buildSliverAppBar() { SliverAppBar buildSliverAppBar() {
return SliverAppBar( return SliverAppBar(
expandedHeight: SizeConfig.isIpad()! ? 300 : 170.0, expandedHeight: SizeConfig.isIpad()! ? 300 : 190.0,
floating: true, floating: true,
pinned: true, pinned: true,
flexibleSpace: FlexibleSpaceBar( flexibleSpace: FlexibleSpaceBar(
centerTitle: true, centerTitle: true,
background: Stack( background: Stack(
children: [ children: [
Image.asset('assets/home/top_bg_icon.png', // Image.asset('assets/home/top_bg_icon.png',
width: MediaQuery.of(context).size.width, fit: BoxFit.fill), // width: MediaQuery.of(context).size.width, fit: BoxFit.fill),
CardSwiper(
bannerList: bannerList,
),
Positioned( Positioned(
bottom: SizeConfig.isIpad()! ? 190 : 90, bottom: SizeConfig.isIpad()! ? 190 : 5,
left: SizeConfig.isIpad()! // left: SizeConfig.isIpad()!
? MediaQuery.of(context).size.width / 2 - 70 // ? MediaQuery.of(context).size.width / 2 - 70
: MediaQuery.of(context).size.width / 2 - 50, // : MediaQuery.of(context).size.width / 2 - 50,
child: isRolesName(StorageUtil.getInstance().getRoleNames()) child: isRolesName(StorageUtil.getInstance().getRoleNames())
? _buildCheckUnit() ? _buildCheckUnit()
: const SizedBox(), : const SizedBox(),
...@@ -1840,14 +1904,14 @@ class _HomePageState extends State<HomePage> ...@@ -1840,14 +1904,14 @@ class _HomePageState extends State<HomePage>
], ],
), ),
), ),
title: Column( // title: Column(
children: [ // children: [
Text( // Text(
'晋特保助手', // '晋特保助手',
style: TextStyle(fontSize: SizeConfig.isIpad()! ? 35 : 20), // style: TextStyle(fontSize: SizeConfig.isIpad()! ? 35 : 20),
), // ),
], // ],
), // ),
actions: [ actions: [
InkWell( InkWell(
onTap: () { onTap: () {
...@@ -1873,10 +1937,16 @@ class _HomePageState extends State<HomePage> ...@@ -1873,10 +1937,16 @@ class _HomePageState extends State<HomePage>
}); });
}, },
child: Padding( 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, child: Icon(Icons.power_settings_new,
size: SizeConfig.isIpad()! ? 35 : 20), size: SizeConfig.isIpad()! ? 40 : 25, color: Colors.orange),
), )),
), ),
const SizedBox( const SizedBox(
width: 10, width: 10,
...@@ -1900,34 +1970,57 @@ class _HomePageState extends State<HomePage> ...@@ -1900,34 +1970,57 @@ class _HomePageState extends State<HomePage>
///切换单位 ///切换单位
Row _buildCheckUnit() { Row _buildCheckUnit() {
return Row( return Row(
mainAxisAlignment: MainAxisAlignment.center, // mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
PopupMenuButton<int>( Container(
padding: const EdgeInsets.all(0), decoration: BoxDecoration(
shadowColor: ColorConst.themeBgColor, borderRadius: BorderRadius.circular(10.0),
offset: const Offset(3.5, 30), 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( shape: RoundedRectangleBorder(
// side: BorderSide(color: Colors.red, width: 2), // side: BorderSide(color: Colors.red, width: 2),
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(5),
), ),
child: Container( child: Container(
padding: padding:
const EdgeInsets.only(left: 20, top: 5, right: 10, bottom: 5), const EdgeInsets.only(left: 10, top: 3, right: 3, bottom: 5),
decoration: BoxDecoration( // decoration: BoxDecoration(
border: Border.all(color: Colors.white, width: 0.5), // border: Border.all(color: ColorConst.whiteColor, width: 0.5),
borderRadius: BorderRadius.circular(10), // borderRadius: const BorderRadius.only(
), // topLeft: Radius.circular(0),
// topRight: Radius.circular(5),
// bottomLeft: Radius.circular(0),
// bottomRight: Radius.circular(5)),
// ),
child: Row( child: Row(
children: [ children: [
const SizedBox(width: 0), const SizedBox(width: 0),
Text(unitName, Text(unitName,
style: TextStyle( style: TextStyle(
fontSize: SizeConfig.isIpad()! ? 25 : 14, fontSize: SizeConfig.isIpad()! ? 25 : 14,
color: Colors.white)), color: ColorConst.whiteColor,
fontWeight: FontWeight.bold)),
const Icon( const Icon(
Icons.arrow_drop_down, Icons.arrow_drop_down,
color: Colors.white, color: ColorConst.whiteColor,
size: 18, size: 20,
) )
], ],
), ),
...@@ -1940,7 +2033,8 @@ class _HomePageState extends State<HomePage> ...@@ -1940,7 +2033,8 @@ class _HomePageState extends State<HomePage>
left: 25, right: 0, top: 0, bottom: 0), left: 25, right: 0, top: 0, bottom: 0),
value: i, value: i,
child: Text('${unitList[i].name}', 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> ...@@ -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() { void getCount() {
///判断是否是公司账户、管理员、市场监管局登录,是:显示统计图 ///判断是否是公司账户、管理员、市场监管局登录,是:显示统计图
...@@ -2280,6 +2440,7 @@ class _HomePageState extends State<HomePage> ...@@ -2280,6 +2440,7 @@ class _HomePageState extends State<HomePage>
name: '单位设置', name: '单位设置',
isContains: roleNames.contains(StandingConfig.PERSON_CHARGE))); isContains: roleNames.contains(StandingConfig.PERSON_CHARGE)));
} }
// _requestPermission() async { // _requestPermission() async {
// // var camera = await Permission.camera.status; // // var camera = await Permission.camera.status;
// // var storage = await Permission.storage.status; // // var storage = await Permission.storage.status;
......
...@@ -42,6 +42,25 @@ class EquipmentPersonnelTable extends StatelessWidget { ...@@ -42,6 +42,25 @@ class EquipmentPersonnelTable extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
buildTitle(Icons.compare, '设备人员对比'), 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), const SizedBox(height: 10),
Table( Table(
border: TableBorder.all(color: ColorConst.blueColor), border: TableBorder.all(color: ColorConst.blueColor),
......
import 'package:flutter/material.dart'; // import 'package:flutter/material.dart';
import 'package:get/get.dart'; // import 'package:get/get.dart';
import 'package:special_equipment_flutter/dio/http_utils.dart'; // import 'package:special_equipment_flutter/common/color_const.dart';
import 'package:special_equipment_flutter/model/exam/equipment_list_bo.dart'; // import 'package:special_equipment_flutter/dio/http_utils.dart';
import 'package:special_equipment_flutter/model/exam/exam_unit_list.dart'; // import 'package:special_equipment_flutter/model/exam/equipment_list_bo.dart';
import 'package:special_equipment_flutter/utils/storage_util.dart'; // import 'package:special_equipment_flutter/model/exam/exam_unit_list.dart';
import 'package:special_equipment_flutter/widgets/app_bar/custom_app_bar.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';
class EquipmentListPage extends StatefulWidget { // import 'package:special_equipment_flutter/widgets/custom_button.dart';
var arguments = Get.arguments; //
// ///设备选择
EquipmentListPage({super.key}); // class EquipmentListPage extends StatefulWidget {
// var arguments = Get.arguments;
@override //
State<EquipmentListPage> createState() => _EquipmentListPageState(); // EquipmentListPage({super.key});
} //
// @override
class _EquipmentListPageState extends State<EquipmentListPage> { // State<EquipmentListPage> createState() => _EquipmentListPageState();
List<EquiList>? officeLists = []; // }
List<EquiList>? filterOfficeLists = []; //
var officeId = ''; // class _EquipmentListPageState extends State<EquipmentListPage> {
// List<EquiList>? officeLists = [];
@override // List<EquiList>? filterOfficeLists = [];
void initState() { // var officeId = '';
super.initState(); //
officeId = widget.arguments['officeId']; // @override
getEquipmentList(); // void initState() {
} // super.initState();
// officeId = widget.arguments['officeId'];
///获取设备类型 // getEquipmentList();
void getEquipmentList() { // }
HttpUtils.getEquipmentList(context, officeId).then((value) { //
EquipmentListBo listBo = value; // ///获取设备类型
if (mounted) { // void getEquipmentList() {
setState(() { // HttpUtils.getEquipmentList(context, officeId).then((value) {
officeLists = listBo.list; // EquipmentListBo listBo = value;
filterOfficeLists = officeLists; // 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()); // void _filterData(String query) {
}).toList(); // 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), // @override
body: Column( // Widget build(BuildContext context) {
children: [ // return Scaffold(
const SizedBox(height: 10), // appBar: AppBarCustom(text: '选择设备', height: 50),
Container( // body: Stack(
margin: const EdgeInsets.only(left: 10, right: 10), // children: [
decoration: BoxDecoration( // Column(
color: Colors.grey[200], // children: [
borderRadius: BorderRadius.circular(10), // const SizedBox(height: 10),
), // Container(
child: Row( // margin: const EdgeInsets.only(left: 10, right: 10),
children: [ // decoration: BoxDecoration(
IconButton( // color: Colors.grey[200],
icon: const Icon(Icons.search), // borderRadius: BorderRadius.circular(10),
onPressed: () { // ),
// 处理搜索逻辑 // child: Row(
}, // children: [
), // IconButton(
Expanded( // icon: const Icon(Icons.search),
child: TextField( // onPressed: () {
onChanged: (value) { // // 处理搜索逻辑
_filterData(value); // },
}, // ),
decoration: const InputDecoration( // Expanded(
hintText: '请输入搜索关键字', // child: TextField(
border: InputBorder.none, // 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), // const SizedBox(height: 10),
itemCount: filterOfficeLists!.length, // Flexible(
// 列表项数量 // child: ListView.builder(
itemBuilder: (context, index) { // shrinkWrap: true,
return GestureDetector( // padding: const EdgeInsets.only(
onTap: () { // top: 0, left: 0, bottom: 0, right: 0),
setState(() { // itemCount: filterOfficeLists!.length,
Get.back(result: filterOfficeLists![index]); // // 列表项数量
}); // itemBuilder: (context, index) {
}, // return InkWell(
child: Container( // onTap: () {
padding: const EdgeInsets.only( // setState(() {
left: 30, right: 15, top: 10, bottom: 10), // filterOfficeLists![index].isChecked =
child: Text( // !filterOfficeLists![index].isChecked;
filterOfficeLists![index].name!, // });
style: const TextStyle(fontSize: 18), // },
), // 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/material.dart';
import 'package:flutter/services.dart'; // import 'package:flutter/services.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; // import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart'; // import 'package:get/get.dart';
import 'package:special_equipment_flutter/common/color_const.dart'; // import 'package:special_equipment_flutter/common/color_const.dart';
import 'package:special_equipment_flutter/common/route_string.dart'; // import 'package:special_equipment_flutter/common/route_string.dart';
import 'package:special_equipment_flutter/dio/http_utils.dart'; // import 'package:special_equipment_flutter/dio/http_utils.dart';
import 'package:special_equipment_flutter/model/base/base_model.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/eq_question_bo.dart';
import 'package:special_equipment_flutter/model/exam/equipment_list_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_setting_submit_bo.dart';
import 'package:special_equipment_flutter/model/exam/exam_unit_list.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/find_question_num.dart';
import 'package:special_equipment_flutter/model/exam/unit_person_list_bo.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/storage_util.dart';
import 'package:special_equipment_flutter/utils/toast_utils.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_button.dart';
import 'package:special_equipment_flutter/widgets/custom_textfield.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/first_refresh_widget.dart';
// import 'package:special_equipment_flutter/widgets/num_change_widget.dart';
///监察人设置考核机构、考核题信息 //
class OverseerSettingsPage extends StatefulWidget { // ///监察人设置考核机构、考核题信息
const OverseerSettingsPage({super.key}); // class OverseerSettingsPage extends StatefulWidget {
// const OverseerSettingsPage({super.key});
@override //
State<OverseerSettingsPage> createState() => _OverseerSettingsState(); // @override
} // State<OverseerSettingsPage> createState() => _OverseerSettingsState();
// }
class _OverseerSettingsState extends State<OverseerSettingsPage> { //
TextEditingController? unitText = TextEditingController(); // class _OverseerSettingsState extends State<OverseerSettingsPage> {
FocusNode? unitFocusNode = FocusNode(); // TextEditingController? unitText = TextEditingController();
TextEditingController? equipmentText = TextEditingController(); // FocusNode? unitFocusNode = FocusNode();
FocusNode? equipmentFocusNode = FocusNode(); //
TextEditingController? singleZJText = TextEditingController(); // TextEditingController? equipmentText = TextEditingController();
FocusNode? singleZJFocusNode = FocusNode(); // FocusNode? equipmentFocusNode = FocusNode();
TextEditingController? judgmentZJText = TextEditingController(); // TextEditingController? singleZJText = TextEditingController();
FocusNode? judgmentZJFocusNode = FocusNode(); // FocusNode? singleZJFocusNode = FocusNode();
// TextEditingController? judgmentZJText = TextEditingController();
TextEditingController? singleAQYText = TextEditingController(); // FocusNode? judgmentZJFocusNode = FocusNode();
FocusNode? singleAQYFocusNode = FocusNode(); //
TextEditingController? judgmentAQYText = TextEditingController(); // TextEditingController? singleAQYText = TextEditingController();
FocusNode? judgmentAQYFocusNode = FocusNode(); // FocusNode? singleAQYFocusNode = FocusNode();
// TextEditingController? judgmentAQYText = TextEditingController();
OfficeList? mOfficeList; // FocusNode? judgmentAQYFocusNode = FocusNode();
EquiList? mEquiList; //
DataEq? mDataEq; // OfficeList? mOfficeList;
int allAQY = 0, allZJ = 0; //
// // EquiList? mEquiList;
List<UserLists>? userSafetyDirectorList = [], userSafetyOfficerList = []; // List<EquiList>? mEquiLists = [];
UnitPersonListBo? mUnitPersonListBo; // DataEq? mDataEq;
var unitStatus = ''; // int allAQY = 0, allZJ = 0;
//
@override // List<UserLists>? userSafetyDirectorList = [], userSafetyOfficerList = [];
void initState() { // UnitPersonListBo? mUnitPersonListBo;
super.initState(); // var unitStatus = '';
getFindQuestionNum(); // var equipmentIsNullStr = "暂无设备类型,请先选择单位",
unitStatus = StorageUtil.getInstance().getUnitStatus(); // userSafetyDirectorIsNullStr = "暂无(质量)安全总监,请先选择设备类型",
} // userSafetyOfficerIsNullStr = "暂无(质量)安全员,请先选择设备类型";
//
///获取设备类型 // @override
void getEquipmentList() { // void initState() {
HttpUtils.getEquipmentList(context, mOfficeList!.id).then((value) { // super.initState();
EquipmentListBo listBo = value; // getFindQuestionNum();
if (mounted) { // unitStatus = StorageUtil.getInstance().getUnitStatus();
setState(() { // }
mEquiList = listBo.list![0]; //
equipmentText!.text = mEquiList!.name!; // ///获取设备类型
}); // void getEquipmentList() {
} // // HttpUtils.getEquipmentList(context, mOfficeList!.id).then((value) {
}); // // EquipmentListBo listBo = value;
} // // if (mounted) {
// // setState(() {
///获取题数 // // mEquiList = listBo.list![0];
void getFindQuestionNum() { // // equipmentText!.text = mEquiList!.name!;
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(); // void getFindQuestionNum() {
singleAQYText!.text = dataNum.aqyDx!.toString(); // HttpUtils.getFindQuestionNum(context).then((value) {
judgmentAQYText!.text = dataNum.aqyPd!.toString(); // FindQuestionNum listBo = value;
allAQY = dataNum.aqzjDx! + dataNum.aqzjPd!; // if (mounted) {
allZJ = dataNum.aqyDx! + dataNum.aqyPd!; // 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!;
void getUnitPersonList(var roleId) { // allZJ = dataNum.aqyDx! + dataNum.aqyPd!;
HttpUtils.getUnitPerson(context, mOfficeList!.id, mEquiList!.id, roleId) // });
.then((value) { // }
mUnitPersonListBo = value; // });
if (mounted) { // }
setState(() { //
///安全总监 // ///获取人员
if (roleId == 'f801011eb2c1481892dba5bc15023733') { // void getUnitPersonList(var roleId) {
userSafetyDirectorList = mUnitPersonListBo!.userList; // // HttpUtils.getUnitPerson(context, mOfficeList!.id, mEquiList!.id, roleId)
// // .then((value) {
///安全员 // // mUnitPersonListBo = value;
} else if (roleId == '77584ba03b4545fba9d23fd670b66c10') { // // if (mounted) {
userSafetyOfficerList = mUnitPersonListBo!.userList; // // 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(); // void getFindEqQuestionNum() {
allZJ = (singleZJText!.text.isNotEmpty // // HttpUtils.getFindEqQuestionNum(context, mEquiList!.id!).then((value) {
? int.parse(singleZJText!.text) // // EqQuestionBo listBo = value;
: 0) + // // if (mounted) {
(judgmentZJText!.text.isNotEmpty // // setState(() {
? int.parse(judgmentZJText!.text) // // mDataEq = listBo.data!;
: 0); // // if (int.parse(singleZJText!.text) > mDataEq!.dxNum!) {
} // // singleZJText!.text = mDataEq!.dxNum!.toString();
if (int.parse(judgmentZJText!.text) > mDataEq!.pdNum!) { // // allZJ = (singleZJText!.text.isNotEmpty
judgmentZJText!.text = mDataEq!.pdNum!.toString(); // // ? int.parse(singleZJText!.text)
allZJ = (singleZJText!.text.isNotEmpty // // : 0) +
? int.parse(singleZJText!.text) // // (judgmentZJText!.text.isNotEmpty
: 0) + // // ? int.parse(judgmentZJText!.text)
(judgmentZJText!.text.isNotEmpty // // : 0);
? int.parse(judgmentZJText!.text) // // }
: 0); // // if (int.parse(judgmentZJText!.text) > mDataEq!.pdNum!) {
} // // judgmentZJText!.text = mDataEq!.pdNum!.toString();
if (int.parse(singleAQYText!.text) > mDataEq!.dxNum!) { // // allZJ = (singleZJText!.text.isNotEmpty
singleAQYText!.text = mDataEq!.dxNum!.toString(); // // ? int.parse(singleZJText!.text)
allAQY = (singleAQYText!.text.isNotEmpty // // : 0) +
? int.parse(singleAQYText!.text) // // (judgmentZJText!.text.isNotEmpty
: 0) + // // ? int.parse(judgmentZJText!.text)
(judgmentAQYText!.text.isNotEmpty // // : 0);
? int.parse(judgmentAQYText!.text) // // }
: 0); // // if (int.parse(singleAQYText!.text) > mDataEq!.dxNum!) {
} // // singleAQYText!.text = mDataEq!.dxNum!.toString();
if (int.parse(judgmentAQYText!.text) > mDataEq!.pdNum!) { // // allAQY = (singleAQYText!.text.isNotEmpty
judgmentAQYText!.text = mDataEq!.pdNum!.toString(); // // ? int.parse(singleAQYText!.text)
allAQY = (singleAQYText!.text.isNotEmpty // // : 0) +
? int.parse(singleAQYText!.text) // // (judgmentAQYText!.text.isNotEmpty
: 0) + // // ? int.parse(judgmentAQYText!.text)
(judgmentAQYText!.text.isNotEmpty // // : 0);
? 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)
@override // // : 0);
Widget build(BuildContext context) { // // }
return Scaffold( // // });
backgroundColor: Colors.grey[100], // // }
body: Stack( // // });
children: [ // }
Image.asset('assets/home/rigister_bg.png'), //
Container( // ///获取设备类型
margin: // void getEquipmentLists(String officeId) {
const EdgeInsets.only(left: 15, top: 110, right: 15, bottom: 0), // HttpUtils.getEquipmentList(context, officeId).then((value) {
decoration: const BoxDecoration( // EquipmentListBo listBo = value;
color: ColorConst.whiteColor, // if (mounted) {
borderRadius: BorderRadius.all(Radius.circular(10)), // setState(() {
), // mEquiLists!.clear();
child: CustomScrollView( // mEquiLists = listBo.list;
primary: false, // equipmentIsNullStr = "该单位暂无添加设备类型";
shrinkWrap: true, // });
slivers: <Widget>[ // }
SliverToBoxAdapter( // });
child: Column( // }
children: [ //
buildUnitInformation(), // @override
// buildSubmit(), // Widget build(BuildContext context) {
const SizedBox(height: 30) // return Scaffold(
], // backgroundColor: Colors.grey[100],
), // body: Stack(
), // children: [
], // Image.asset('assets/home/rigister_bg.png'),
), // Container(
), // margin:
buildTopTitle(context) // 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,
Container buildUnitInformation() { // shrinkWrap: true,
return Container( // slivers: <Widget>[
margin: const EdgeInsets.only(left: 10, top: 10, right: 10, bottom: 10), // SliverToBoxAdapter(
child: Stack( // child: Column(
children: [ // children: [
Column( // buildUnitInformation(),
crossAxisAlignment: CrossAxisAlignment.start, // // buildSubmit(),
children: <Widget>[ // const SizedBox(height: 30)
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( // buildTopTitle(context)
enabled: true, // ],
readOnly: true, // ),
hintText: '请选择单位名称', // );
controller: unitText, // }
focusNode: unitFocusNode, //
onTop: () { // ///单位信息
Get.toNamed(RouteString.UNIT_LIST_PAGE)?.then((map) { // Container buildUnitInformation() {
if (map != null) { // return Container(
mOfficeList = map; // margin: const EdgeInsets.only(left: 10, top: 10, right: 10, bottom: 10),
setState(() { // child: Stack(
unitText!.text = mOfficeList!.name!; // children: [
mEquiList = null; // Column(
equipmentText!.text = ''; // crossAxisAlignment: CrossAxisAlignment.start,
userSafetyDirectorList = []; // children: <Widget>[
userSafetyOfficerList = []; // const SizedBox(height: 10),
}); // const Row(children: [
} // Icon(Icons.touch_app, color: ColorConst.orangeColor, size: 15),
}); // Text('单位名称', style: TextStyle(fontSize: 14))
}), // ]),
const SizedBox(height: 15), // const SizedBox(height: 5),
const Row(children: [ // CustomTextField(
Icon(Icons.touch_app, color: ColorConst.orangeColor, size: 15), // enabled: true,
Text('设备类型', style: TextStyle(fontSize: 14)) // readOnly: true,
]), // hintText: '请选择单位名称',
const SizedBox(height: 5), // controller: unitText,
CustomTextField( // focusNode: unitFocusNode,
enabled: true, // onTop: () {
readOnly: true, // Get.toNamed(RouteString.UNIT_LIST_PAGE)?.then((map) {
hintText: '请选择设备类型', // if (map != null) {
controller: equipmentText, // mOfficeList = map;
focusNode: equipmentFocusNode, // setState(() {
onTop: () { // // getEquipmentLists(mOfficeList!.id!);
if (mOfficeList != null && mOfficeList!.id!.isNotEmpty) { // unitText!.text = mOfficeList!.name!;
Get.toNamed(RouteString.EQUIPMENT_LIST_PAGE, // // equipmentText!.text = '';
arguments: {'officeId': mOfficeList!.id}) // userSafetyDirectorList = [];
?.then((map) { // userSafetyOfficerList = [];
if (map != null) { // });
mEquiList = map; // }
setState(() { // });
equipmentText!.text = mEquiList!.name!; // }),
getUnitPersonList( // const SizedBox(height: 15),
'f801011eb2c1481892dba5bc15023733'); // const Row(children: [
getUnitPersonList( // Icon(Icons.touch_app, color: ColorConst.orangeColor, size: 15),
'77584ba03b4545fba9d23fd670b66c10'); // Text('设备类型', style: TextStyle(fontSize: 14))
getFindEqQuestionNum(); // ]),
}); // const SizedBox(height: 5),
} // CustomTextField(
}); // enabled: true,
} else { // readOnly: true,
ToastUtils.showCenter('请先选择单位'); // hintText: '请选择设备类型',
} // controller: equipmentText,
}), // focusNode: equipmentFocusNode,
const SizedBox(height: 15), // onTop: () {
Container( // if (mOfficeList != null && mOfficeList!.id!.isNotEmpty) {
padding: const EdgeInsets.only( // Get.toNamed(RouteString.EQUIPMENT_LIST_PAGE,
left: 5, top: 10, right: 5, bottom: 10), // arguments: {'officeId': mOfficeList!.id})
decoration: const BoxDecoration( // ?.then((map) {
color: ColorConst.grayf5Color, // if (map != null) {
borderRadius: BorderRadius.all(Radius.circular(10)), // setState(() {
), // mEquiLists = map;
child: Column( // equipmentText!.text = "已选择";
children: [ //
const Row(children: [ // // getUnitPersonList(
Icon(Icons.touch_app, // // 'f801011eb2c1481892dba5bc15023733');
color: ColorConst.orangeColor, size: 15), // // getUnitPersonList(
Text('安全总监', style: TextStyle(fontSize: 14)) // // '77584ba03b4545fba9d23fd670b66c10');
]), // // getFindEqQuestionNum();
const SizedBox(height: 5), // });
if (mUnitPersonListBo != null && // }
userSafetyDirectorList!.isEmpty) ...{ // });
Container( // } else {
padding: const EdgeInsets.only( // ToastUtils.showCenter('请先选择单位');
left: 0, top: 15, right: 0, bottom: 15), // }
child: const Text( // }),
"该单位暂无录入(质量)安全总监", // Container(
style: TextStyle( // width: double.infinity,
color: ColorConst.blueColor, // margin:
fontWeight: FontWeight.bold), // 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(
buildSafetyDirectorListView(), // color: Colors.orange[50],
const SizedBox(height: 10), // borderRadius: const BorderRadius.only(
Container( // topLeft: Radius.circular(5),
padding: const EdgeInsets.only( // topRight: Radius.circular(5),
left: 5, top: 0, right: 5, bottom: 0), // bottomLeft: Radius.circular(5),
child: Row( // bottomRight: Radius.circular(5))),
mainAxisAlignment: MainAxisAlignment.spaceBetween, // child: const Text.rich(
children: [ // softWrap: true,
Row(children: [ // TextSpan(children: [
const Text('单选题数', style: TextStyle(fontSize: 14)), // TextSpan(
SizedBox( // text: "小提示:选择设备,可自定义单选题、判断题考核数量",
width: 40, // style: TextStyle(fontSize: 12, color: Colors.orange)),
height: 30, // ])),
child: TextFormField( // ),
textAlign: TextAlign.center, //
inputFormatters: [ // ///设备类型列表
FilteringTextInputFormatter.digitsOnly, // buildEquiListView(),
LengthLimitingTextInputFormatter(3), // if (mEquiLists != null && mEquiLists!.isEmpty) ...[
], // Container(
focusNode: singleZJFocusNode, // alignment: Alignment.center,
controller: singleZJText, // height: 50,
onChanged: (num) { // child: Text(
setState(() { // equipmentIsNullStr,
if (num.isEmpty) { // style:
num = '0'; // const TextStyle(color: Colors.black26, fontSize: 14),
} // ))
if (mDataEq != null && // ],
int.parse(num) > mDataEq!.dxNum!) { //
ToastUtils.showCenter( // const SizedBox(height: 10),
'题库只有${mDataEq!.dxNum}道单选题'); // const Row(children: [
setState(() { // Icon(Icons.touch_app, color: ColorConst.orangeColor, size: 15),
singleZJText!.text = // Text('安全总监', style: TextStyle(fontSize: 14))
mDataEq!.dxNum.toString(); // ]),
}); // if (userSafetyDirectorList != null &&
} // userSafetyDirectorList!.isEmpty) ...{
allZJ = (singleZJText!.text.isNotEmpty // Container(
? int.parse(singleZJText!.text) // alignment: Alignment.center,
: 0) + // height: 50,
(judgmentZJText!.text.isNotEmpty // child: Text(userSafetyDirectorIsNullStr,
? int.parse(judgmentZJText!.text) // style: const TextStyle(
: 0); // color: Colors.black26, fontSize: 14)))
}); // },
}, // buildSafetyDirectorListView(),
), // const SizedBox(height: 10),
) // const Row(children: [
]), // Icon(Icons.touch_app, color: ColorConst.orangeColor, size: 15),
Row(children: [ // Text('安全员', style: TextStyle(fontSize: 14)),
const Text('判断题数', style: TextStyle(fontSize: 14)), // ]),
SizedBox( // const SizedBox(height: 5),
width: 40, //
height: 30, // if (userSafetyOfficerList != null &&
child: TextFormField( // userSafetyOfficerList!.isEmpty) ...{
textAlign: TextAlign.center, // Container(
inputFormatters: [ // alignment: Alignment.center,
FilteringTextInputFormatter.digitsOnly, // height: 50,
LengthLimitingTextInputFormatter(3), // child: Text(userSafetyOfficerIsNullStr,
], // style: const TextStyle(
focusNode: judgmentZJFocusNode, // color: Colors.black26, fontSize: 14)))
controller: judgmentZJText, // },
onChanged: (num) { // buildSafetyOfficerListView(),
setState(() { //
if (num.isEmpty) { // buildSubmit()
num = '0'; // ],
} // )
if (mDataEq != null && // ],
int.parse(num) > mDataEq!.pdNum!) { // ),
ToastUtils.showCenter( // );
'题库只有${mDataEq!.pdNum}道判断题'); // }
setState(() { //
judgmentZJText!.text = // ///设备类型列表
mDataEq!.pdNum.toString(); // ListView buildEquiListView() {
}); // return ListView.builder(
} // shrinkWrap: true,
// physics: const NeverScrollableScrollPhysics(),
allZJ = (judgmentZJText!.text.isNotEmpty // padding: const EdgeInsets.only(top: 0, left: 0, bottom: 0, right: 0),
? int.parse(judgmentZJText!.text) // itemCount: mEquiLists!.length,
: 0) + // // 列表项数量
(singleZJText!.text.isNotEmpty // itemBuilder: (context, index) {
? int.parse(singleZJText!.text) // return Container(
: 0); // 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(
Text('总题数: ${allZJ.toString()}', // children: [
style: const TextStyle( // InkWell(
color: Colors.grey, fontSize: 14)), // onTap: () {
], // setState(() {
), // mEquiLists![index].isChecked =
), // !mEquiLists![index].isChecked;
], // userSafetyDirectorIsNullStr = "该单位暂无录入(质量)安全总监";
), // userSafetyOfficerIsNullStr = "该单位暂无录入(质量)安全员";
), // });
const SizedBox(height: 10), // },
Container( // child: Container(
padding: const EdgeInsets.only( // padding: const EdgeInsets.only(
left: 5, top: 10, right: 5, bottom: 10), // left: 10, right: 10, top: 0, bottom: 0),
decoration: const BoxDecoration( // decoration: BoxDecoration(
color: ColorConst.grayf5Color, // color: mEquiLists![index].isChecked
borderRadius: BorderRadius.all(Radius.circular(10)), // ? ColorConst.blueColor.withOpacity(0.1)
), // : Colors.transparent,
child: Column( // borderRadius: const BorderRadius.only(
children: [ // topLeft: Radius.circular(5),
const Row(children: [ // topRight: Radius.circular(5)),
Icon(Icons.touch_app, // ),
color: ColorConst.orangeColor, size: 15), // child: Row(
Text('安全员', style: TextStyle(fontSize: 14)) // mainAxisAlignment: MainAxisAlignment.spaceBetween,
]), // children: [
const SizedBox(height: 5), // Text(
if (mUnitPersonListBo != null && // mEquiLists![index].name!,
userSafetyOfficerList!.isEmpty) ...{ // style: TextStyle(
Container( // fontSize: 15,
padding: const EdgeInsets.only( // color: mEquiLists![index].isChecked
left: 0, top: 15, right: 0, bottom: 15), // ? ColorConst.blueColor
child: const Text( // : Colors.black54),
"该单位暂无录入(质量)安全员", // ),
style: TextStyle( // SizedBox(
color: ColorConst.blueColor, // height: 40,
fontWeight: FontWeight.bold), // child: Checkbox(
), // value: mEquiLists![index].isChecked,
) // onChanged: (value) {
}, // if (value != null) {
buildSafetyOfficerListView(), // setState(() {
const SizedBox(height: 10), // mEquiLists![index].isChecked = value;
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, // if (mEquiLists![index].isChecked) ...[
height: 30, // Container(
child: TextFormField( // padding: const EdgeInsets.only(
textAlign: TextAlign.center, // left: 10, top: 5, right: 10, bottom: 10),
inputFormatters: [ // child: Row(
FilteringTextInputFormatter.digitsOnly, // mainAxisAlignment: MainAxisAlignment.spaceBetween,
LengthLimitingTextInputFormatter(3), // children: [
], // Text('总题数: ${allZJ.toString()}',
focusNode: singleAQYFocusNode, // style: const TextStyle(
controller: singleAQYText, // color: Colors.black54, fontSize: 13)),
onChanged: (num) { // Row(children: [
setState(() { // const Text('单选题数',
if (num.isEmpty) { // style:
num = '0'; // TextStyle(fontSize: 13, color: Colors.black54)),
} // SizedBox(
if (mDataEq != null && // width: 35,
int.parse(num) > mDataEq!.dxNum!) { // height: 25,
ToastUtils.showCenter( // child: TextFormField(
'题库只有${mDataEq!.dxNum}道单选题'); // textAlign: TextAlign.center,
setState(() { // style: const TextStyle(
singleAQYText!.text = // fontSize: 16, color: Colors.black54),
mDataEq!.dxNum.toString(); // inputFormatters: [
}); // FilteringTextInputFormatter.digitsOnly,
} // LengthLimitingTextInputFormatter(3),
allAQY = (singleAQYText!.text.isNotEmpty // ],
? int.parse(singleAQYText!.text) // focusNode: singleZJFocusNode,
: 0) + // controller: singleZJText,
(judgmentAQYText!.text.isNotEmpty // onChanged: (num) {
? int.parse(judgmentAQYText!.text) // setState(() {
: 0); // if (num.isEmpty) {
}); // num = '0';
}, // }
), // if (mDataEq != null &&
) // int.parse(num) > mDataEq!.dxNum!) {
]), // ToastUtils.showCenter(
Row(children: [ // '题库只有${mDataEq!.dxNum}道单选题');
const Text('判断题数', style: TextStyle(fontSize: 14)), // setState(() {
SizedBox( // singleZJText!.text =
width: 40, // mDataEq!.dxNum.toString();
height: 30, // });
child: TextFormField( // }
textAlign: TextAlign.center, // allZJ = (singleZJText!.text.isNotEmpty
inputFormatters: [ // ? int.parse(singleZJText!.text)
FilteringTextInputFormatter.digitsOnly, // : 0) +
LengthLimitingTextInputFormatter(3) // (judgmentZJText!.text.isNotEmpty
], // ? int.parse(judgmentZJText!.text)
focusNode: judgmentAQYFocusNode, // : 0);
controller: judgmentAQYText, // });
onChanged: (num) { // },
setState(() { // ),
if (num.isEmpty) { // )
num = '0'; // ]),
} // Row(children: [
if (mDataEq != null && // const Text('判断题数',
int.parse(num) > mDataEq!.pdNum!) { // style:
ToastUtils.showCenter( // TextStyle(fontSize: 13, color: Colors.black54)),
'题库只有${mDataEq!.pdNum}道判断题'); // SizedBox(
setState(() { // width: 35,
judgmentAQYText!.text = // height: 25,
mDataEq!.pdNum.toString(); // child: TextFormField(
}); // textAlign: TextAlign.center,
} // style: const TextStyle(
allAQY = (judgmentAQYText!.text.isNotEmpty // fontSize: 16, color: Colors.black54),
? int.parse(judgmentAQYText!.text) // inputFormatters: [
: 0) + // FilteringTextInputFormatter.digitsOnly,
(singleAQYText!.text.isNotEmpty // LengthLimitingTextInputFormatter(3),
? int.parse(singleAQYText!.text) // ],
: 0); // focusNode: judgmentZJFocusNode,
}); // controller: judgmentZJText,
}, // onChanged: (num) {
), // setState(() {
) // if (num.isEmpty) {
]), // num = '0';
Text('总题数: ${allAQY.toString()}', // }
style: const TextStyle( // if (mDataEq != null &&
color: Colors.grey, fontSize: 14)), // int.parse(num) > mDataEq!.pdNum!) {
], // ToastUtils.showCenter(
), // '题库只有${mDataEq!.pdNum}道判断题');
), // setState(() {
], // judgmentZJText!.text =
), // mDataEq!.pdNum.toString();
), // });
buildSubmit() // }
], //
) // 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++) { // ListView buildSafetyDirectorListView() {
///安全总监--->判断安全员是否有相同人员 // return ListView.builder(
if (userSafetyDirectorList![index].id == // shrinkWrap: true,
userSafetyOfficerList![i].id) { // physics: const NeverScrollableScrollPhysics(),
userSafetyOfficerList![i].isUserSafetyOfficerChecked = // padding: const EdgeInsets.only(top: 0, left: 0, bottom: 0, right: 0),
true; // itemCount: userSafetyDirectorList!.length,
} // // 列表项数量
} // itemBuilder: (context, index) {
} else { // return GestureDetector(
///未选中 // onTap: () {
userSafetyDirectorList![index].isChecked = true; // setState(() {
for (var i = 0; i < userSafetyOfficerList!.length; i++) { // ///当前状态是否禁止选中 true 可选 可以操作
///安全总监--->判断安全员是否有相同人员 // if (userSafetyDirectorList![index].isUserSafetyDirectorChecked!) {
if (userSafetyDirectorList![index].id == // ///如果当前选择状态为 true,选中
userSafetyOfficerList![i].id) { // if (userSafetyDirectorList![index].isChecked!) {
userSafetyOfficerList![i].isUserSafetyOfficerChecked = // userSafetyDirectorList![index].isChecked = false;
false; // for (var i = 0; i < userSafetyOfficerList!.length; i++) {
} // ///安全总监--->判断安全员是否有相同人员
} // if (userSafetyDirectorList![index].id ==
} // userSafetyOfficerList![i].id) {
} else { // userSafetyOfficerList![i].isUserSafetyOfficerChecked =
///禁止选中 // true;
} // }
}); // }
}, // } else {
child: Container( // ///未选中
height: 40, // userSafetyDirectorList![index].isChecked = true;
decoration: BoxDecoration( // for (var i = 0; i < userSafetyOfficerList!.length; i++) {
color: userSafetyDirectorList![index].isChecked! // ///安全总监--->判断安全员是否有相同人员
? Colors.grey.withOpacity(0.1) // if (userSafetyDirectorList![index].id ==
: Colors.transparent, // userSafetyOfficerList![i].id) {
borderRadius: const BorderRadius.all(Radius.circular(5)), // userSafetyOfficerList![i].isUserSafetyOfficerChecked =
), // false;
child: Row( // }
children: [ // }
Checkbox( // }
value: userSafetyDirectorList![index] // } else {
.isUserSafetyDirectorChecked! // ///禁止选中
? userSafetyDirectorList![index].isChecked // }
: false, // });
side: MaterialStateBorderSide.resolveWith( // },
(Set<MaterialState> states) { // child: Container(
//设置未选中为灰色 // height: 40,
return userSafetyDirectorList![index] // decoration: BoxDecoration(
.isUserSafetyDirectorChecked! // color: userSafetyDirectorList![index].isChecked!
? null // ? Colors.grey.withOpacity(0.1)
: const BorderSide(width: 2, color: Colors.black12); // : Colors.transparent,
}, // borderRadius: const BorderRadius.all(Radius.circular(5)),
), // ),
onChanged: userSafetyDirectorList![index] // child: Row(
.isUserSafetyDirectorChecked! // children: [
? (value) { // Checkbox(
if (value != null) { // value: userSafetyDirectorList![index]
setState(() { // .isUserSafetyDirectorChecked!
///当前状态是否禁止选中 true 可选 可以操作 // ? userSafetyDirectorList![index].isChecked
if (userSafetyDirectorList![index] // : false,
.isUserSafetyDirectorChecked!) { // side: MaterialStateBorderSide.resolveWith(
///如果当前选择状态为 true,选中 // (Set<MaterialState> states) {
if (userSafetyDirectorList![index].isChecked!) { // //设置未选中为灰色
userSafetyDirectorList![index].isChecked = // return userSafetyDirectorList![index]
false; // .isUserSafetyDirectorChecked!
for (var i = 0; // ? null
i < userSafetyOfficerList!.length; // : const BorderSide(width: 2, color: Colors.black12);
i++) { // },
///安全总监--->判断安全员是否有相同人员 // ),
if (userSafetyDirectorList![index].id == // onChanged: userSafetyDirectorList![index]
userSafetyOfficerList![i].id) { // .isUserSafetyDirectorChecked!
userSafetyOfficerList![i] // ? (value) {
.isUserSafetyOfficerChecked = true; // if (value != null) {
} // setState(() {
} // ///当前状态是否禁止选中 true 可选 可以操作
} else { // if (userSafetyDirectorList![index]
///未选中 // .isUserSafetyDirectorChecked!) {
userSafetyDirectorList![index].isChecked = // ///如果当前选择状态为 true,选中
true; // if (userSafetyDirectorList![index].isChecked!) {
for (var i = 0; // userSafetyDirectorList![index].isChecked =
i < userSafetyOfficerList!.length; // false;
i++) { // for (var i = 0;
///安全总监--->判断安全员是否有相同人员 // i < userSafetyOfficerList!.length;
if (userSafetyDirectorList![index].id == // i++) {
userSafetyOfficerList![i].id) { // ///安全总监--->判断安全员是否有相同人员
userSafetyOfficerList![i] // if (userSafetyDirectorList![index].id ==
.isUserSafetyOfficerChecked = false; // userSafetyOfficerList![i].id) {
} // userSafetyOfficerList![i]
} // .isUserSafetyOfficerChecked = true;
} // }
} else { // }
///禁止选中 // } else {
} // ///未选中
}); // userSafetyDirectorList![index].isChecked =
} // true;
} // for (var i = 0;
: null, // i < userSafetyOfficerList!.length;
), // i++) {
Text(userSafetyDirectorList![index].name!, // ///安全总监--->判断安全员是否有相同人员
style: TextStyle( // if (userSafetyDirectorList![index].id ==
color: userSafetyDirectorList![index] // userSafetyOfficerList![i].id) {
.isUserSafetyDirectorChecked! // userSafetyOfficerList![i]
? Colors.black // .isUserSafetyOfficerChecked = false;
: Colors.black12)) // }
], // }
), // }
), // } else {
); // ///禁止选中
}, // }
); // });
} // }
// }
ListView buildSafetyOfficerListView() { // : null,
return ListView.builder( // ),
shrinkWrap: true, // Text(userSafetyDirectorList![index].name!,
physics: const NeverScrollableScrollPhysics(), // style: TextStyle(
padding: const EdgeInsets.only(top: 0, left: 0, bottom: 0, right: 0), // color: userSafetyDirectorList![index]
itemCount: userSafetyOfficerList!.length, // .isUserSafetyDirectorChecked!
// 列表项数量 // ? Colors.black
itemBuilder: (context, index) { // : Colors.black12))
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++) { // ListView buildSafetyOfficerListView() {
///安全总监--->判断安全员是否有相同人员 // return ListView.builder(
if (userSafetyOfficerList![index].id == // shrinkWrap: true,
userSafetyDirectorList![i].id) { // physics: const NeverScrollableScrollPhysics(),
userSafetyDirectorList![i].isUserSafetyDirectorChecked = // padding: const EdgeInsets.only(top: 0, left: 0, bottom: 0, right: 0),
true; // itemCount: userSafetyOfficerList!.length,
} // // 列表项数量
} // itemBuilder: (context, index) {
} else { // return InkWell(
///未选中 // onTap: () {
userSafetyOfficerList![index].isChecked = true; // setState(() {
for (var i = 0; i < userSafetyDirectorList!.length; i++) { // ///当前状态是否禁止选中 true 可选 可以操作
///安全总监--->判断安全员是否有相同人员 // if (userSafetyOfficerList![index].isUserSafetyOfficerChecked!) {
if (userSafetyOfficerList![index].id == // ///如果当前选择状态为 true,选中
userSafetyDirectorList![i].id) { // if (userSafetyOfficerList![index].isChecked!) {
userSafetyDirectorList![i].isUserSafetyDirectorChecked = // userSafetyOfficerList![index].isChecked = false;
false; // for (var i = 0; i < userSafetyDirectorList!.length; i++) {
} // ///安全总监--->判断安全员是否有相同人员
} // if (userSafetyOfficerList![index].id ==
} // userSafetyDirectorList![i].id) {
} // userSafetyDirectorList![i].isUserSafetyDirectorChecked =
}); // true;
}, // }
child: Container( // }
height: 40, // } else {
decoration: BoxDecoration( // ///未选中
color: userSafetyOfficerList![index].isChecked! // userSafetyOfficerList![index].isChecked = true;
? Colors.grey.withOpacity(0.3) // for (var i = 0; i < userSafetyDirectorList!.length; i++) {
: Colors.transparent, // ///安全总监--->判断安全员是否有相同人员
borderRadius: const BorderRadius.all(Radius.circular(5)), // if (userSafetyOfficerList![index].id ==
), // userSafetyDirectorList![i].id) {
child: Row( // userSafetyDirectorList![i].isUserSafetyDirectorChecked =
children: [ // false;
Checkbox( // }
value: // }
userSafetyOfficerList![index].isUserSafetyOfficerChecked! // }
? userSafetyOfficerList![index].isChecked // }
: false, // });
side: MaterialStateBorderSide.resolveWith( // },
(Set<MaterialState> states) { // child: Container(
//设置未选中为灰色 // height: 40,
return userSafetyOfficerList![index] // decoration: BoxDecoration(
.isUserSafetyOfficerChecked! // color: userSafetyOfficerList![index].isChecked!
? null // ? Colors.grey.withOpacity(0.3)
: const BorderSide(width: 2, color: Colors.black12); // : Colors.transparent,
}, // borderRadius: const BorderRadius.all(Radius.circular(5)),
), // ),
onChanged: userSafetyOfficerList![index] // child: Row(
.isUserSafetyOfficerChecked! // children: [
? (value) { // Checkbox(
if (value != null) { // value:
setState(() { // userSafetyOfficerList![index].isUserSafetyOfficerChecked!
///当前状态是否禁止选中 true 可选 可以操作 // ? userSafetyOfficerList![index].isChecked
if (userSafetyOfficerList![index] // : false,
.isUserSafetyOfficerChecked!) { // side: MaterialStateBorderSide.resolveWith(
///如果当前选择状态为 true,选中 // (Set<MaterialState> states) {
if (userSafetyOfficerList![index].isChecked!) { // //设置未选中为灰色
userSafetyOfficerList![index].isChecked = // return userSafetyOfficerList![index]
false; // .isUserSafetyOfficerChecked!
for (var i = 0; // ? null
i < userSafetyDirectorList!.length; // : const BorderSide(width: 2, color: Colors.black12);
i++) { // },
///安全总监--->判断安全员是否有相同人员 // ),
if (userSafetyOfficerList![index].id == // onChanged: userSafetyOfficerList![index]
userSafetyDirectorList![i].id) { // .isUserSafetyOfficerChecked!
userSafetyDirectorList![i] // ? (value) {
.isUserSafetyDirectorChecked = true; // if (value != null) {
} // setState(() {
} // ///当前状态是否禁止选中 true 可选 可以操作
} else { // if (userSafetyOfficerList![index]
///未选中 // .isUserSafetyOfficerChecked!) {
userSafetyOfficerList![index].isChecked = // ///如果当前选择状态为 true,选中
true; // if (userSafetyOfficerList![index].isChecked!) {
for (var i = 0; // userSafetyOfficerList![index].isChecked =
i < userSafetyDirectorList!.length; // false;
i++) { // for (var i = 0;
///安全总监--->判断安全员是否有相同人员 // i < userSafetyDirectorList!.length;
if (userSafetyOfficerList![index].id == // i++) {
userSafetyDirectorList![i].id) { // ///安全总监--->判断安全员是否有相同人员
userSafetyDirectorList![i] // if (userSafetyOfficerList![index].id ==
.isUserSafetyDirectorChecked = false; // userSafetyDirectorList![i].id) {
} // userSafetyDirectorList![i]
} // .isUserSafetyDirectorChecked = true;
} // }
} // }
}); // } else {
} // ///未选中
} // userSafetyOfficerList![index].isChecked =
: null, // true;
), // for (var i = 0;
Text(userSafetyOfficerList![index].name!, // i < userSafetyDirectorList!.length;
style: TextStyle( // i++) {
color: userSafetyOfficerList![index] // ///安全总监--->判断安全员是否有相同人员
.isUserSafetyOfficerChecked! // if (userSafetyOfficerList![index].id ==
? Colors.black // userSafetyDirectorList![i].id) {
: Colors.black12)) // userSafetyDirectorList![i]
], // .isUserSafetyDirectorChecked = false;
), // }
), // }
); // }
}, // }
); // });
} // }
// }
Container buildTopTitle(BuildContext context) { // : null,
return Container( // ),
margin: const EdgeInsets.only(top: 50), // Text(userSafetyOfficerList![index].name!,
child: Row( // style: TextStyle(
crossAxisAlignment: CrossAxisAlignment.start, // color: userSafetyOfficerList![index]
mainAxisAlignment: MainAxisAlignment.start, // .isUserSafetyOfficerChecked!
children: [ // ? Colors.black
IconButton( // : Colors.black12))
onPressed: () { // ],
Navigator.of(context).pop(); // ),
}, // ),
icon: const Icon(Icons.arrow_back, color: Colors.white), // );
iconSize: 30, // },
), // );
Column( // }
crossAxisAlignment: CrossAxisAlignment.start, //
mainAxisAlignment: MainAxisAlignment.start, // Container buildTopTitle(BuildContext context) {
children: [ // return Container(
Container( // margin: const EdgeInsets.only(top: 50),
margin: const EdgeInsets.only(top: 5), // child: Row(
child: const Text( // crossAxisAlignment: CrossAxisAlignment.start,
'考核设置', // mainAxisAlignment: MainAxisAlignment.start,
style: TextStyle( // children: [
fontSize: 23, // IconButton(
color: Colors.white, // onPressed: () {
fontWeight: FontWeight.bold), // Navigator.of(context).pop();
)), // },
Container( // icon: const Icon(Icons.arrow_back, color: Colors.white),
height: 3, // iconSize: 30,
width: 50, // ),
alignment: Alignment.topLeft, // Column(
margin: const EdgeInsets.only(top: 3, bottom: 3), // crossAxisAlignment: CrossAxisAlignment.start,
decoration: const BoxDecoration( // mainAxisAlignment: MainAxisAlignment.start,
color: Colors.white54, // children: [
borderRadius: BorderRadius.all(Radius.circular(5)), // Container(
)), // margin: const EdgeInsets.only(top: 5),
const Text( // child: const Text(
'', // '考核设置',
style: TextStyle(fontSize: 12, color: Colors.white), // 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),
Container buildSubmit() { // decoration: const BoxDecoration(
return Container( // color: Colors.white54,
margin: const EdgeInsets.only(top: 30, bottom: 0), // borderRadius: BorderRadius.all(Radius.circular(5)),
padding: const EdgeInsets.only(left: 20, right: 20, top: 15, bottom: 0), // )),
width: double.infinity, // const Text(
decoration: const BoxDecoration( // '',
color: Colors.white, // style: TextStyle(fontSize: 12, 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('选择设备类型'); // Container buildSubmit() {
return; // return Container(
} // margin: const EdgeInsets.only(top: 30, bottom: 0),
// padding: const EdgeInsets.only(left: 20, right: 20, top: 15, bottom: 0),
if (userSafetyDirectorList!.isEmpty && // width: double.infinity,
userSafetyOfficerList!.isEmpty) { // decoration: const BoxDecoration(
ToastUtils.showCenter('没有可选的\n【安全总监】\n【安全员】\n无法提交'); // color: Colors.white,
return; // borderRadius: BorderRadius.all(Radius.circular(5)),
} // ),
// child: GradientButton(
bool isSafety = false; // tapCallback: () {
bool isSafety1 = false; // if (unitText!.text.isEmpty) {
bool isSafety2 = false; // ToastUtils.showCenter('选择单位名称');
// return;
for (var i = 0; i < userSafetyDirectorList!.length; i++) { // }
if (userSafetyDirectorList![i].isChecked!) { // // if (equipmentText!.text.isEmpty) {
isSafety = true; // // ToastUtils.showCenter('选择设备类型');
isSafety1 = true; // // return;
} // // }
} //
for (var i = 0; i < userSafetyOfficerList!.length; i++) { // if (userSafetyDirectorList!.isEmpty &&
if (userSafetyOfficerList![i].isChecked!) { // userSafetyOfficerList!.isEmpty) {
isSafety = true; // ToastUtils.showCenter('没有可选的\n【安全总监】\n【安全员】\n无法提交');
isSafety2 = true; // return;
} // }
} //
// bool isSafety = false;
if (!isSafety) { // bool isSafety1 = false;
ToastUtils.showCenter('至少选择一个\n【安全总监】\n【安全员】'); // bool isSafety2 = false;
return; //
} // for (var i = 0; i < userSafetyDirectorList!.length; i++) {
// if (userSafetyDirectorList![i].isChecked!) {
if (isSafety1) { // isSafety = true;
if (allZJ == 0) { // isSafety1 = true;
ToastUtils.showCenter('【安全总监】总题数不能为 0'); // }
return; // }
} // for (var i = 0; i < userSafetyOfficerList!.length; i++) {
} // if (userSafetyOfficerList![i].isChecked!) {
if (isSafety2) { // isSafety = true;
if (allAQY == 0) { // isSafety2 = true;
ToastUtils.showCenter('【安全员】总题数不能为 0'); // }
return; // }
} //
} // if (!isSafety) {
// ToastUtils.showCenter('至少选择一个\n【安全总监】\n【安全员】');
Get.dialog(AlertDialog( // return;
title: const Text("温馨提示"), // }
content: const Text("您确定要提交考核吗?"), //
actionsPadding: const EdgeInsets.only( // if (isSafety1) {
left: 0, top: 0, bottom: 10, right: 20), // if (allZJ == 0) {
contentPadding: const EdgeInsets.only( // ToastUtils.showCenter('【安全总监】总题数不能为 0');
left: 20, top: 0, bottom: 10, right: 20), // return;
titlePadding: const EdgeInsets.only( // }
left: 20, top: 20, bottom: 10, right: 20), // }
shape: const RoundedRectangleBorder( // if (isSafety2) {
// 这里设置shape属性 // if (allAQY == 0) {
borderRadius: BorderRadius.all(Radius.circular(10.0))), // ToastUtils.showCenter('【安全员】总题数不能为 0');
actions: <Widget>[ // return;
TextButton( // }
child: const Text("取消", style: TextStyle(fontSize: 16)), // }
onPressed: () { //
Get.back(); // Get.dialog(AlertDialog(
}, // title: const Text("温馨提示"),
), // content: const Text("您确定要提交考核吗?"),
TextButton( // actionsPadding: const EdgeInsets.only(
child: const Text("确定", style: TextStyle(fontSize: 16)), // left: 0, top: 0, bottom: 10, right: 20),
onPressed: () { // contentPadding: const EdgeInsets.only(
//关闭弹窗 // left: 20, top: 0, bottom: 10, right: 20),
Get.back(); // titlePadding: const EdgeInsets.only(
// printLog( // left: 20, top: 20, bottom: 10, right: 20),
// "《考核-交卷》提交json数据----->${json.encode(examineQuestionsBo)}"); // shape: const RoundedRectangleBorder(
// // 这里设置shape属性
ExamSettingSubmitBo mExamSettingSubmitBo = // borderRadius: BorderRadius.all(Radius.circular(10.0))),
ExamSettingSubmitBo(); // actions: <Widget>[
// 安全主管判断题数 // TextButton(
mExamSettingSubmitBo.aqzgPdNum = // child: const Text("取消", style: TextStyle(fontSize: 16)),
judgmentZJText!.text.isNotEmpty // onPressed: () {
? int.parse(judgmentZJText!.text) // Get.back();
: 0; // },
// 安全主管选择题数 // ),
mExamSettingSubmitBo.aqzgXzNum = // TextButton(
singleZJText!.text.isNotEmpty // child: const Text("确定", style: TextStyle(fontSize: 16)),
? int.parse(singleZJText!.text) // onPressed: () {
: 0; // //关闭弹窗
// 安全员判断题数 // Get.back();
mExamSettingSubmitBo.aqyPdNum = // // printLog(
judgmentAQYText!.text.isNotEmpty // // "《考核-交卷》提交json数据----->${json.encode(examineQuestionsBo)}");
? int.parse(judgmentAQYText!.text) //
: 0; // ExamSettingSubmitBo mExamSettingSubmitBo =
// 安全员选择题数 // ExamSettingSubmitBo();
mExamSettingSubmitBo.aqyXzNum = // // 安全主管判断题数
singleAQYText!.text.isNotEmpty // mExamSettingSubmitBo.aqzgPdNum =
? int.parse(singleAQYText!.text) // judgmentZJText!.text.isNotEmpty
: 0; // ? int.parse(judgmentZJText!.text)
mExamSettingSubmitBo.type = mEquiList!.id; // : 0;
List<String>? aqzgIds = []; // // 安全主管选择题数
for (var i = 0; i < userSafetyDirectorList!.length; i++) { // mExamSettingSubmitBo.aqzgXzNum =
if (userSafetyDirectorList![i].isChecked!) { // singleZJText!.text.isNotEmpty
aqzgIds.add(userSafetyDirectorList![i].id.toString()); // ? int.parse(singleZJText!.text)
} // : 0;
} // // 安全员判断题数
mExamSettingSubmitBo.aqzgIds = aqzgIds; // mExamSettingSubmitBo.aqyPdNum =
// judgmentAQYText!.text.isNotEmpty
List<String>? aqyIds = []; // ? int.parse(judgmentAQYText!.text)
for (var i = 0; i < userSafetyOfficerList!.length; i++) { // : 0;
if (userSafetyOfficerList![i].isChecked!) { // // 安全员选择题数
aqyIds.add(userSafetyOfficerList![i].id.toString()); // mExamSettingSubmitBo.aqyXzNum =
} // singleAQYText!.text.isNotEmpty
} // ? int.parse(singleAQYText!.text)
mExamSettingSubmitBo.aqyIds = aqyIds; // : 0;
mExamSettingSubmitBo.unitId = mOfficeList!.id; // // mExamSettingSubmitBo.type = mEquiList!.id;
HttpUtils.getExamSettingSubmit( // List<String>? aqzgIds = [];
context, mExamSettingSubmitBo) // for (var i = 0; i < userSafetyDirectorList!.length; i++) {
.then((value) { // if (userSafetyDirectorList![i].isChecked!) {
BaseModel bo = value; // aqzgIds.add(userSafetyDirectorList![i].id.toString());
if (mounted) { // }
setState(() { // }
ToastUtils.showCenter(bo.msg); // mExamSettingSubmitBo.aqzgIds = aqzgIds;
Get.back(result: true); //
}); // 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;
width: 300, // HttpUtils.getExamSettingSubmit(
height: 40, // context, mExamSettingSubmitBo)
borderRadius: const BorderRadius.only( // .then((value) {
topLeft: Radius.circular(10), // BaseModel bo = value;
topRight: Radius.circular(20), // if (mounted) {
bottomLeft: Radius.circular(20), // setState(() {
bottomRight: Radius.circular(10)), // ToastUtils.showCenter(bo.msg);
disable: false, // Get.back(result: true);
colors: const [ColorConst.blueColor, ColorConst.blue1Color], // });
child: const Text( // }
"提交", // });
style: TextStyle(fontSize: 14, color: ColorConst.whiteColor), // },
))); // ),
} // ],
} // ));
// },
// 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> { ...@@ -171,7 +171,7 @@ class _RegisterPage2State extends State<RegisterPage2> {
), ),
child: const Text( child: const Text(
softWrap: true, softWrap: true,
'密码至少包含以下 3 种类别:大写字母、小写字母、数字、特殊符号( @#*. )、8-20位', '密码至少包含以下 5 种类别:大写字母、小写字母、数字、特殊符号( @#*. )、8-20位',
style: TextStyle(color: Colors.orange, fontSize: 12), style: TextStyle(color: Colors.orange, fontSize: 12),
), ),
), ),
......
...@@ -142,6 +142,31 @@ class _InspectListSyPageState extends State<InspectListSyPage> ...@@ -142,6 +142,31 @@ class _InspectListSyPageState extends State<InspectListSyPage>
backgroundColor: Colors.grey[100], backgroundColor: Colors.grey[100],
body: Column( body: Column(
children: [ 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( Expanded(
flex: 1, flex: 1,
child: EasyRefresh( child: EasyRefresh(
...@@ -282,7 +307,7 @@ class _InspectListSyPageState extends State<InspectListSyPage> ...@@ -282,7 +307,7 @@ class _InspectListSyPageState extends State<InspectListSyPage>
Card buildWeekCard(BuildContext context, int index) { Card buildWeekCard(BuildContext context, int index) {
return Card( 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, elevation: listWeek[index].allow == '0' ? 3 : 0,
color: listWeek[index].allow == '0' ? Colors.white : Colors.grey[300], color: listWeek[index].allow == '0' ? Colors.white : Colors.grey[300],
shape: const RoundedRectangleBorder( shape: const RoundedRectangleBorder(
...@@ -310,7 +335,7 @@ class _InspectListSyPageState extends State<InspectListSyPage> ...@@ -310,7 +335,7 @@ class _InspectListSyPageState extends State<InspectListSyPage>
Card buildMonthsCard(BuildContext context, int index) { Card buildMonthsCard(BuildContext context, int index) {
return Card( 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, elevation: listMonth[index].allow == '0' ? 3 : 0,
color: listMonth[index].allow == '0' ? Colors.white : Colors.grey[300], color: listMonth[index].allow == '0' ? Colors.white : Colors.grey[300],
shape: const RoundedRectangleBorder( shape: const RoundedRectangleBorder(
...@@ -340,7 +365,7 @@ class _InspectListSyPageState extends State<InspectListSyPage> ...@@ -340,7 +365,7 @@ class _InspectListSyPageState extends State<InspectListSyPage>
Card buildDaysCard(BuildContext context, int index) { Card buildDaysCard(BuildContext context, int index) {
return Card( return Card(
elevation: 3, 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, color: Colors.white,
shape: const RoundedRectangleBorder( shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(5)), borderRadius: BorderRadius.all(Radius.circular(5)),
......
...@@ -104,8 +104,8 @@ class _EquipmentSettingsPageState extends State<EquipmentSettingsPage> { ...@@ -104,8 +104,8 @@ class _EquipmentSettingsPageState extends State<EquipmentSettingsPage> {
children: [ children: [
Image.asset('assets/home/rigister_bg.png'), Image.asset('assets/home/rigister_bg.png'),
Container( Container(
margin: margin: EdgeInsets.only(
const EdgeInsets.only(left: 15, top: 130, right: 15, bottom: 0), left: 15, top: type == '1' ? 150 : 130, right: 15, bottom: 0),
decoration: const BoxDecoration( decoration: const BoxDecoration(
color: ColorConst.whiteColor, color: ColorConst.whiteColor,
borderRadius: BorderRadius.all(Radius.circular(10)), borderRadius: BorderRadius.all(Radius.circular(10)),
...@@ -196,6 +196,25 @@ class _EquipmentSettingsPageState extends State<EquipmentSettingsPage> { ...@@ -196,6 +196,25 @@ class _EquipmentSettingsPageState extends State<EquipmentSettingsPage> {
hintText: type == '3' ? '' : '请填写设备名称', hintText: type == '3' ? '' : '请填写设备名称',
controller: nameText, controller: nameText,
focusNode: nameFocusNode), 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), const SizedBox(height: 10),
Row(children: [ Row(children: [
Icon( Icon(
...@@ -216,6 +235,25 @@ class _EquipmentSettingsPageState extends State<EquipmentSettingsPage> { ...@@ -216,6 +235,25 @@ class _EquipmentSettingsPageState extends State<EquipmentSettingsPage> {
controller: codeText, controller: codeText,
focusNode: codeFocusNode, focusNode: codeFocusNode,
isNoChinese: true), 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), const SizedBox(height: 8),
Row(children: [ Row(children: [
Icon(type == '3' ? Icons.assignment_ind : Icons.touch_app, Icon(type == '3' ? Icons.assignment_ind : Icons.touch_app,
...@@ -253,6 +291,25 @@ class _EquipmentSettingsPageState extends State<EquipmentSettingsPage> { ...@@ -253,6 +291,25 @@ class _EquipmentSettingsPageState extends State<EquipmentSettingsPage> {
hintText: type == '3' ? '' : '请填写设备地址详细地址', hintText: type == '3' ? '' : '请填写设备地址详细地址',
controller: addressText, controller: addressText,
focusNode: addressFocusNode), 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> { ...@@ -344,7 +401,7 @@ class _EquipmentSettingsPageState extends State<EquipmentSettingsPage> {
Container buildTopTitle(BuildContext context) { Container buildTopTitle(BuildContext context) {
return Container( return Container(
margin: const EdgeInsets.only(top: 50), margin: const EdgeInsets.only(top: 50, right: 30),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
...@@ -356,7 +413,8 @@ class _EquipmentSettingsPageState extends State<EquipmentSettingsPage> { ...@@ -356,7 +413,8 @@ class _EquipmentSettingsPageState extends State<EquipmentSettingsPage> {
icon: const Icon(Icons.arrow_back, color: Colors.white), icon: const Icon(Icons.arrow_back, color: Colors.white),
iconSize: 30, iconSize: 30,
), ),
Column( Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
...@@ -384,6 +442,7 @@ class _EquipmentSettingsPageState extends State<EquipmentSettingsPage> { ...@@ -384,6 +442,7 @@ class _EquipmentSettingsPageState extends State<EquipmentSettingsPage> {
), ),
], ],
), ),
),
], ],
), ),
); );
...@@ -401,7 +460,7 @@ class _EquipmentSettingsPageState extends State<EquipmentSettingsPage> { ...@@ -401,7 +460,7 @@ class _EquipmentSettingsPageState extends State<EquipmentSettingsPage> {
String? subTitleText() { String? subTitleText() {
if (type == '1') { if (type == '1') {
return '我们将根据您填写的内容来为您【新建设备】'; return '我们将根据您填写的内容来为您【新建设备】\n注意:使用单位需【新建设备】,否则不会生成【日管控】【周排查】【月调度】任务';
} else if (type == '2') { } else if (type == '2') {
return '我们将根据您填写的内容来为您【修改设备】'; return '我们将根据您填写的内容来为您【修改设备】';
} else { } else {
......
...@@ -53,7 +53,11 @@ class _EquipmentListSCPageState extends State<EquipmentListSCPage> { ...@@ -53,7 +53,11 @@ class _EquipmentListSCPageState extends State<EquipmentListSCPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return EasyRefresh( return Stack(
children: [
Container(
margin: EdgeInsets.only(top: 20),
child: EasyRefresh(
firstRefresh: true, firstRefresh: true,
enableControlFinishRefresh: true, enableControlFinishRefresh: true,
// enableControlFinishLoad: true, // enableControlFinishLoad: true,
...@@ -76,6 +80,28 @@ class _EquipmentListSCPageState extends State<EquipmentListSCPage> { ...@@ -76,6 +80,28 @@ class _EquipmentListSCPageState extends State<EquipmentListSCPage> {
// getList(); // getList();
// }, // },
child: buildBody(), 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> { ...@@ -50,7 +50,9 @@ class _EquipmentListSYPageState extends State<EquipmentListSYPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Stack( return Stack(
children: [ children: [
EasyRefresh( Container(
margin: const EdgeInsets.only(top: 20),
child: EasyRefresh(
firstRefresh: true, firstRefresh: true,
enableControlFinishRefresh: true, enableControlFinishRefresh: true,
// enableControlFinishLoad: true, // enableControlFinishLoad: true,
...@@ -73,6 +75,7 @@ class _EquipmentListSYPageState extends State<EquipmentListSYPage> { ...@@ -73,6 +75,7 @@ class _EquipmentListSYPageState extends State<EquipmentListSYPage> {
// }, // },
child: buildBody(), child: buildBody(),
), ),
),
if (isUnitRoles(StorageUtil.getInstance().getRoleNames())!) ...[ if (isUnitRoles(StorageUtil.getInstance().getRoleNames())!) ...[
Positioned( Positioned(
right: 20, right: 20,
...@@ -92,17 +95,40 @@ class _EquipmentListSYPageState extends State<EquipmentListSYPage> { ...@@ -92,17 +95,40 @@ class _EquipmentListSYPageState extends State<EquipmentListSYPage> {
} }
}); });
}, },
width: 60, width: 70,
height: 60, height: 70,
borderRadius: const BorderRadius.all(Radius.circular(360)), borderRadius: const BorderRadius.all(Radius.circular(360)),
disable: false, disable: false,
colors: const [ColorConst.blueColor, ColorConst.blue1Color], colors: const [
ColorConst.orangeColor,
ColorConst.orange2Color
],
child: const Text( child: const Text(
"新建\n设备", "新建\n设备",
style: 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> { ...@@ -95,19 +95,19 @@ class _UserListPageState extends State<UserListPage> {
} }
}); });
}, },
width: 60, width: 70,
height: 60, height: 70,
borderRadius: borderRadius:
const BorderRadius.all(Radius.circular(360)), const BorderRadius.all(Radius.circular(360)),
disable: false, disable: false,
colors: const [ colors: const [
ColorConst.blueColor, ColorConst.orangeColor,
ColorConst.blue1Color ColorConst.orange2Color
], ],
child: const Text( child: const Text(
"新建\n用户", "新建\n用户",
style: TextStyle( style: TextStyle(
fontSize: 14, color: ColorConst.whiteColor), fontSize: 16, color: ColorConst.whiteColor),
))), ))),
), ),
] ]
...@@ -140,9 +140,9 @@ class _UserListPageState extends State<UserListPage> { ...@@ -140,9 +140,9 @@ class _UserListPageState extends State<UserListPage> {
// Get.toNamed(RouteString.USER_SETTINGS, arguments: '3'); // Get.toNamed(RouteString.USER_SETTINGS, arguments: '3');
}, },
child: Card( child: Card(
elevation: 2, elevation: 5,
margin: const EdgeInsets.only(left: 0, right: 0, top: 15, bottom: 0), 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( shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(10)), borderRadius: BorderRadius.all(Radius.circular(10)),
), ),
...@@ -211,8 +211,9 @@ class _UserListPageState extends State<UserListPage> { ...@@ -211,8 +211,9 @@ class _UserListPageState extends State<UserListPage> {
TextSpan( TextSpan(
text: roleNames(index), text: roleNames(index),
style: const TextStyle( style: const TextStyle(
fontSize: 13, fontWeight: FontWeight.bold,
color: Colors.black54)), fontSize: 14,
color: Colors.black87)),
])), ])),
), ),
], ],
......
...@@ -83,6 +83,11 @@ class _UserSettingsPageState extends State<UserSettingsPage> { ...@@ -83,6 +83,11 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
AppRoles appRoles = value; AppRoles appRoles = value;
setState(() { setState(() {
newList.addAll(appRoles.data!); 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> { ...@@ -96,8 +101,8 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
children: [ children: [
Image.asset('assets/home/rigister_bg.png'), Image.asset('assets/home/rigister_bg.png'),
Container( Container(
margin: margin: EdgeInsets.only(
const EdgeInsets.only(left: 15, top: 130, right: 15, bottom: 0), left: 15, top: type == '1' ? 150 : 130, right: 15, bottom: 0),
decoration: const BoxDecoration( decoration: const BoxDecoration(
color: ColorConst.whiteColor, color: ColorConst.whiteColor,
borderRadius: BorderRadius.all(Radius.circular(10)), borderRadius: BorderRadius.all(Radius.circular(10)),
...@@ -148,7 +153,7 @@ class _UserSettingsPageState extends State<UserSettingsPage> { ...@@ -148,7 +153,7 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
///用户信息 ///用户信息
Container buildUnitInformation() { Container buildUnitInformation() {
return Container( 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( child: Stack(
children: [ children: [
Column( Column(
...@@ -261,7 +266,7 @@ class _UserSettingsPageState extends State<UserSettingsPage> { ...@@ -261,7 +266,7 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
), ),
child: const Text( child: const Text(
softWrap: true, softWrap: true,
'密码至少包含以下 3 种类别:大写字母、小写字母、数字、特殊符号( @#*. )、8-20位', '密码至少包含以下 5 种类别:大写字母、小写字母、数字、特殊符号( @#*. )、8-20位',
style: TextStyle(color: Colors.orange, fontSize: 12), style: TextStyle(color: Colors.orange, fontSize: 12),
), ),
), ),
...@@ -307,7 +312,6 @@ class _UserSettingsPageState extends State<UserSettingsPage> { ...@@ -307,7 +312,6 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
Text('*', Text('*',
style: TextStyle(fontSize: 14, color: Colors.red)), style: TextStyle(fontSize: 14, color: Colors.red)),
]), ]),
if (type == '2') ...[ if (type == '2') ...[
///修改 ///修改
buildEditListView(), buildEditListView(),
...@@ -315,14 +319,6 @@ class _UserSettingsPageState extends State<UserSettingsPage> { ...@@ -315,14 +319,6 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
///新建 ///新建
buildAddListView(), buildAddListView(),
] ]
//
// // GridViewAQZJList(
// // equipmentSYBoList:
// // allRolesList[index].officeDtoSYList,
// // equipmentSCBoList:
// // allRolesList[index].officeDtoSCList,
// // isVisbliy: allRolesList[index].isChecked)
], ],
) )
], ],
...@@ -344,11 +340,7 @@ class _UserSettingsPageState extends State<UserSettingsPage> { ...@@ -344,11 +340,7 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
GestureDetector( GestureDetector(
onTap: () { onTap: () {
setState(() { setState(() {
if (newList[index].name == '公司账户') {
newList[index].check = !newList[index].check!; newList[index].check = !newList[index].check!;
} else {
newList[index].check = !newList[index].check!;
}
///如果取消身份勾选,将当前身份下的已选中设备全部取消勾选 ///如果取消身份勾选,将当前身份下的已选中设备全部取消勾选
if (!newList[index].check!) { if (!newList[index].check!) {
...@@ -370,41 +362,26 @@ class _UserSettingsPageState extends State<UserSettingsPage> { ...@@ -370,41 +362,26 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
child: Transform.scale( child: Transform.scale(
scale: 0.8, scale: 0.8,
child: Checkbox( child: Checkbox(
value: newList[index].name == '公司账户' value: newList[index].check!,
? false
: newList[index].check!,
// 指定复选框的状态 // 指定复选框的状态
onChanged: newList[index].name == '公司账户' onChanged: (value) {
? null
: (value) {
setState(() { setState(() {
newList[index].check = newList[index].check =
value!; // 更新 isChecked 的状态值 value!; // 更新 isChecked 的状态值
}); });
}, },
side: MaterialStateBorderSide.resolveWith( ),
(Set<MaterialState> states) {
//修改默认时边框颜色为绿色
return newList[index].name == '公司账户'
? const BorderSide(
width: 2, color: Colors.black12)
: null;
},
)),
), ),
), ),
Text(newList[index].name!, // 设置外层角色文本内容 Text(newList[index].name!, // 设置外层角色文本内容
style: TextStyle( style: const TextStyle(
fontSize: 14, fontSize: 14,
color: newList[index].name == '公司账户' color: Colors.black54,
? Colors.grey[400]
: Colors.black54,
fontWeight: FontWeight.bold)), fontWeight: FontWeight.bold)),
], ],
), ),
), ),
), ),
if (newList[index].check! && if (newList[index].check! &&
newList[index].userDtoList!.isNotEmpty) ...[ newList[index].userDtoList!.isNotEmpty) ...[
Container( Container(
...@@ -487,28 +464,6 @@ class _UserSettingsPageState extends State<UserSettingsPage> { ...@@ -487,28 +464,6 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
fontSize: 12, color: Colors.black), 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> { ...@@ -585,28 +540,6 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
fontSize: 12, color: Colors.black), 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> { ...@@ -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> { ...@@ -677,28 +603,22 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
child: Transform.scale( child: Transform.scale(
scale: 0.8, scale: 0.8,
child: Checkbox( child: Checkbox(
value: value: true,
editList!.roleDtoList![index].name == '公司账户'
? true
: false,
// 指定复选框的状态 // 指定复选框的状态
onChanged: null, onChanged: null,
side: MaterialStateBorderSide.resolveWith( side: MaterialStateBorderSide.resolveWith(
(Set<MaterialState> states) { (Set<MaterialState> states) {
//修改默认时边框颜色为绿色 //修改默认时边框颜色为绿色
return const BorderSide( return const BorderSide(
width: 2, color: Colors.black12); width: 2, color: Colors.grey);
}, },
)), )),
), ),
), ),
Text(editList!.roleDtoList![index].name!, // 设置外层角色文本内容 const Text('公司账户', // 设置外层角色文本内容
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
color: color: Colors.black54,
editList!.roleDtoList![index].name == '公司账户'
? Colors.black54
: Colors.grey[400],
fontWeight: FontWeight.bold)), fontWeight: FontWeight.bold)),
] else ...[ ] else ...[
Container( Container(
...@@ -915,7 +835,8 @@ class _UserSettingsPageState extends State<UserSettingsPage> { ...@@ -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) { separatorBuilder: (BuildContext context, int index) {
return const SizedBox( return const SizedBox(
height: 0, height: 0,
...@@ -978,7 +899,8 @@ class _UserSettingsPageState extends State<UserSettingsPage> { ...@@ -978,7 +899,8 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
icon: const Icon(Icons.arrow_back, color: Colors.white), icon: const Icon(Icons.arrow_back, color: Colors.white),
iconSize: 30, iconSize: 30,
), ),
Column( Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
...@@ -1006,6 +928,7 @@ class _UserSettingsPageState extends State<UserSettingsPage> { ...@@ -1006,6 +928,7 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
), ),
], ],
), ),
),
], ],
), ),
); );
...@@ -1021,7 +944,7 @@ class _UserSettingsPageState extends State<UserSettingsPage> { ...@@ -1021,7 +944,7 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
String? subTitleText() { String? subTitleText() {
if (type == '1') { if (type == '1') {
return '我们将根据您填写的内容来为您【新建用户】'; return '我们将根据您填写的内容来为您【新建用户】\n注:请牢记登录名和密码, 登录该用户账号可做【日管控】【周排查】【月调度】【考核】任务';
} else { } else {
return '我们将根据您填写的内容来为您【修改用户】'; return '我们将根据您填写的内容来为您【修改用户】';
} }
...@@ -1058,7 +981,7 @@ class _UserSettingsPageState extends State<UserSettingsPage> { ...@@ -1058,7 +981,7 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
if (!StringUtils.isValidPassword(passwordText!.text)) { if (!StringUtils.isValidPassword(passwordText!.text)) {
passwordFocusNode!.requestFocus(); passwordFocusNode!.requestFocus();
ToastUtils.showCenter( ToastUtils.showCenter(
'密码至少包含以下 3 种类别:大写字母、小写字母、数字、特殊符号(@#*.)、8-20位'); '密码至少包含以下 5 种类别:大写字母、小写字母、数字、特殊符号(@#*.)、8-20位');
return; return;
} }
if (okPasswordText!.text.isEmpty) { if (okPasswordText!.text.isEmpty) {
...@@ -1075,7 +998,7 @@ class _UserSettingsPageState extends State<UserSettingsPage> { ...@@ -1075,7 +998,7 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
if (!StringUtils.isValidPassword(passwordText!.text)) { if (!StringUtils.isValidPassword(passwordText!.text)) {
passwordFocusNode!.requestFocus(); passwordFocusNode!.requestFocus();
ToastUtils.showCenter( ToastUtils.showCenter(
'密码至少包含以下 3 种类别:大写字母、小写字母、数字、特殊符号(@#*.)、8-20位'); '密码至少包含以下 5 种类别:大写字母、小写字母、数字、特殊符号(@#*.)、8-20位');
return; return;
} }
if (okPasswordText!.text.isEmpty) { 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: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'; import 'package:special_equipment_flutter/utils/string_utils.dart';
class SpKeys { class SpKeys {
static const USER_NAME = "spUserName"; static const USER_NAME = "spUserName";
static const PASSWORD = "spPassword";
static const NAME = "spName"; static const NAME = "spName";
static const JSESSION_ID = "spJsessionId"; static const JSESSION_ID = "spJsessionId";
static const USER_ID = "spUserId"; static const USER_ID = "spUserId";
...@@ -19,6 +22,10 @@ class SpKeys { ...@@ -19,6 +22,10 @@ class SpKeys {
///拍照位置 ///拍照位置
static const CAMERA_ADDRESS = "camera_address"; static const CAMERA_ADDRESS = "camera_address";
static const ACCOUNT_NUMBER = "account_number";
static const ACCOUNT = "account";
static const PASSWORDS = "password";
} }
class StorageUtil { class StorageUtil {
...@@ -77,6 +84,11 @@ class StorageUtil { ...@@ -77,6 +84,11 @@ class StorageUtil {
return userId; return userId;
} }
T getPassword<T>() {
var password = get(SpKeys.PASSWORD);
return password;
}
T getName<T>() { T getName<T>() {
var nickName = get(SpKeys.NAME); var nickName = get(SpKeys.NAME);
return nickName; return nickName;
...@@ -134,4 +146,37 @@ class StorageUtil { ...@@ -134,4 +146,37 @@ class StorageUtil {
return false; 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 // 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:card_swiper/card_swiper.dart';
//import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:flutter/material.dart';
// import 'package:special_equipment_flutter/dio/api.dart';
//class SlideBanner extends StatefulWidget {
// const SlideBanner({super.key}); import '../model/banner_list_bo.dart';
//
// @override class SlideBanner extends StatefulWidget {
// _SwiperPageState createState() => _SwiperPageState(); const SlideBanner({super.key, required this.bannerList});
//}
// final List<Data>? bannerList;
//class _SwiperPageState extends State<SlideBanner> {
@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 = [ // List<Map> imgList = [
// {"url": "assets/images/image0.png"}, // {
// {"url": "assets/images/image1.png"}, // "url":
// {"url": "assets/images/image2.png"}, // "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": "assets/images/image3.png"}, // },
// {"url": "assets/images/image4.png"}, // {
// {"url": "assets/images/image5.png"}, // "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"
// // },
//// List<Map> imgList = [ // {
//// { // "url":
//// "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"
//// "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,
//// );
// }, // },
// autoplay: true, // {
// duration: 300, // "url":
// itemCount: imgList.length, // "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"
//// layout: SwiperLayout.DEFAULT, // },
//// scale: 0.93, // ];
//// viewportFraction: 0.9,
// //指示器样式 @override
// pagination: const SwiperPagination( Widget build(BuildContext context) {
// alignment: Alignment.bottomRight, var MySwiperWidget = Swiper(
// builder: DotSwiperPaginationBuilder( itemBuilder: (BuildContext context, int index) {
// color: Colors.black54, //每次循环遍历时,将i赋值给index
// activeColor: Colors.white, // return Image.asset(
// size: 10, // imgList[index]['url'],
// activeSize: 12, // fit: BoxFit.fill,
// )), // );
// ); return Image.network(
// return Scaffold( '${Api.URL}special${widget.bannerList![index].advertisUrl!}',
// body: SizedBox( fit: BoxFit.fill,
// height: 200, );
// width: double.infinity, },
// child: MySwiperWidget, 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 ...@@ -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 # 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 # 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. # 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: environment:
sdk: '>=3.1.3 <4.0.0' sdk: '>=3.1.3 <4.0.0'
...@@ -57,7 +57,10 @@ dependencies: ...@@ -57,7 +57,10 @@ dependencies:
flutter_bmflocation: ^3.5.0 flutter_bmflocation: ^3.5.0
sliding_up_panel: ^2.0.0+1 sliding_up_panel: ^2.0.0+1
event_bus: ^2.0.0 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 # geolocator: ^7.1.0
# geocoding: ^2.1.1 # geocoding: ^2.1.1
...@@ -73,7 +76,7 @@ dependencies: ...@@ -73,7 +76,7 @@ dependencies:
# event_bus: ^2.0.0 # event_bus: ^2.0.0
# provider: ^6.0.5 # provider: ^6.0.5
# shake_animation_widget: ^3.0.3 # shake_animation_widget: ^3.0.3
# flutter_xupdate: ^2.0.0 # flutter_xupdate: ^0.0.2
dev_dependencies: dev_dependencies:
...@@ -100,7 +103,6 @@ flutter: ...@@ -100,7 +103,6 @@ flutter:
# To add assets to your application, add an assets section, like this: # To add assets to your application, add an assets section, like this:
assets: assets:
- assets/home/top_bg_icon.png
- assets/home/day_control_white_icon.png - assets/home/day_control_white_icon.png
- assets/home/monthly_scheduling_white_icon.png - assets/home/monthly_scheduling_white_icon.png
- assets/home/weekly_survey_white_icon.png - assets/home/weekly_survey_white_icon.png
...@@ -136,6 +138,9 @@ flutter: ...@@ -136,6 +138,9 @@ flutter:
- assets/examine/no_pass_icon.png - assets/examine/no_pass_icon.png
- assets/examine/examine_gary_icon.png - assets/examine/examine_gary_icon.png
- assets/examine/history_icon.png - assets/examine/history_icon.png
- assets/name.pdf
# An image asset can refer to one or more resolution-specific "variants", see # 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