Commit 100c118f by 吴春元

修改,公司账号:

1、选择设备样式
2、首页新增设备人员对比表格
3、优化其他问题
parent 4c4db723
......@@ -3,6 +3,7 @@
import 'package:get/get.dart';
import 'package:special_equipment_flutter/ui/login/login_page.dart';
import 'package:special_equipment_flutter/ui/main/tab_home_page.dart';
import 'package:special_equipment_flutter/ui/main/unit/equipment_personnel_page.dart';
import 'package:special_equipment_flutter/ui/register/address_page.dart';
import 'package:special_equipment_flutter/ui/register/register_page1.dart';
import 'package:special_equipment_flutter/ui/register/register_page2.dart';
......@@ -121,7 +122,7 @@ class RouteString {
GetPage(name: UNIT_SETTINGS, page: () => const UnitSettingsPage()),
///公司-首页-设备人员对比表格
// GetPage(name: EQUIPMENT_PERSONNEL, page: () => EquipmentPersonnelPage()),
GetPage(name: EQUIPMENT_PERSONNEL, page: () => EquipmentPersonnelPage()),
///首页
GetPage(name: HOME, page: () => const HomePage()),
......
// ignore_for_file: unnecessary_brace_in_string_interps, non_constant_identifier_names
class Api {
static var IS_DEBUG = false;
static var IS_DEBUG = true;
static String URL =
IS_DEBUG ? "https://special.sxyztech.cn/" : "http://192.168.19.215:8181/";
IS_DEBUG ? "https://special.sxyztech.cn/" : "http://47.92.138.92:8009/";
///演示 ip
// static String URL = "http://47.92.138.92:8009/";
// static String URL = "http://192.168.19.189:8181/";
// static String URL = "http://192.168.19.215:8181/";
......@@ -165,4 +164,7 @@ class Api {
/// 公司账户-首页-设备对比表格 获取主要负责人
static String FIND_CHARGE_LIST = "${URL + START_URL}sys/user/findChargeList";
/// 公司账户-首页-设备对比表格 获取使用单位设备数量
static String FIND_COUNT = "${URL + START_URL}device/deviceInfo/findCount";
}
......@@ -20,6 +20,7 @@ import 'package:special_equipment_flutter/model/device_list_bo.dart';
import 'package:special_equipment_flutter/model/echart_bo.dart';
import 'package:special_equipment_flutter/model/equipment_bo.dart';
import 'package:special_equipment_flutter/model/find_charge_list_bo.dart';
import 'package:special_equipment_flutter/model/find_count_bo.dart';
import 'package:special_equipment_flutter/model/login_bo.dart';
import 'package:special_equipment_flutter/model/month_control_list_sy_bo.dart';
import 'package:special_equipment_flutter/model/office_device.dart';
......@@ -1129,7 +1130,7 @@ class HttpUtils {
DoUtils.get(context,
'${Api.FIND_CHARGE_LIST};JSESSIONID=${StorageUtil.getInstance().getJsessionId()}',
parameters: params,
isLoading: true,
isLoading: false,
loadingText: '正在加载', onSuccess: (Response response) {
var resultObj = ResultObjBo.fromJson(
response.data, (json) => FindChargeListBo.fromJson(json));
......@@ -1138,6 +1139,24 @@ class HttpUtils {
}, onError: (e) {});
}
/// 公司账户-首页-设备对比表格 获取使用单位设备数量
static void doFindCount(BuildContext context,
{Function(FindCountBo bo)? onSuccess}) {
Map<String, dynamic> params = {
'officeId': StorageUtil.getInstance().getOfficeId(),
};
DoUtils.get(context,
'${Api.FIND_COUNT};JSESSIONID=${StorageUtil.getInstance().getJsessionId()}',
parameters: params,
isLoading: false,
loadingText: '正在加载', onSuccess: (Response response) {
var resultObj = ResultObjBo.fromJson(
response.data, (json) => FindCountBo.fromJson(json));
FindCountBo? bo = resultObj.body;
onSuccess!(bo!);
}, onError: (e) {});
}
// HttpUtils.getList(context, _page, 20).then((value) {
// ListBo listBo = value;
// print(listBo);
......
......@@ -12,6 +12,7 @@ class FindChargeListBo {
}
}
String? chargeNames = '';
List<ChargeUserList>? list;
FindChargeListBo copyWith({
......
class FindCountBo {
FindCountBo({
this.list,
});
FindCountBo.fromJson(dynamic json) {
if (json['list'] != null) {
list = [];
json['list'].forEach((v) {
list?.add(CountData.fromJson(v));
});
}
}
List<CountData>? list;
FindCountBo copyWith({
List<CountData>? list,
}) =>
FindCountBo(
list: list ?? this.list,
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
if (list != null) {
map['list'] = list?.map((v) => v.toJson()).toList();
}
return map;
}
}
class CountData {
CountData({
this.deviceTypeId,
this.count,
});
CountData.fromJson(dynamic json) {
deviceTypeId = json['deviceTypeId'];
count = json['count'];
}
String? deviceTypeId;
int? count;
CountData copyWith({
String? deviceTypeId,
int? count,
}) =>
CountData(
deviceTypeId: deviceTypeId ?? this.deviceTypeId,
count: count ?? this.count,
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['deviceTypeId'] = deviceTypeId;
map['count'] = count;
return map;
}
}
import 'package:special_equipment_flutter/model/role_bo.dart';
class OfficeDevice {
OfficeDevice({
this.office,
......@@ -192,7 +194,11 @@ class OfficeDtoLists {
String? sort;
String? delFlag;
String? curType;
String? deviceCount = '';
bool? isChecked = false;
String? safetyOfficer = '';
String? safetyDirector = '';
List<UserData>? list = [];
OfficeDtoLists copyWith({
String? id,
......
......@@ -101,7 +101,7 @@ class EditTextState extends State<EditTextWidget>
});
phoneController.value =
phoneController.value.copyWith(text: Api.IS_DEBUG ? '' : 'laoliu');
phoneController.value.copyWith(text: Api.IS_DEBUG ? '' : 'csgs123');
passController.value =
passController.value.copyWith(text: Api.IS_DEBUG ? '' : 'Aa123456.');
super.initState();
......
......@@ -15,6 +15,7 @@ import 'package:special_equipment_flutter/model/count_bo.dart';
import 'package:special_equipment_flutter/model/device_list_bo.dart';
import 'package:special_equipment_flutter/model/echart_bo.dart';
import 'package:special_equipment_flutter/model/find_charge_list_bo.dart';
import 'package:special_equipment_flutter/model/find_count_bo.dart';
import 'package:special_equipment_flutter/model/office_device.dart';
import 'package:special_equipment_flutter/model/role_bo.dart';
import 'package:special_equipment_flutter/model/version/app_info_bo.dart';
......@@ -26,6 +27,7 @@ import 'package:special_equipment_flutter/ui/main/unit/unit_grid_list.dart';
import 'package:special_equipment_flutter/utils/size_config.dart';
import 'package:special_equipment_flutter/utils/storage_util.dart';
import 'package:special_equipment_flutter/utils/toast_utils.dart';
import 'package:special_equipment_flutter/widgets/custom_button.dart';
import 'package:special_equipment_flutter/widgets/divider_custom.dart';
import 'package:special_equipment_flutter/widgets/easy_refresh_header1.dart';
import 'package:url_launcher/url_launcher.dart';
......@@ -67,6 +69,10 @@ class _HomePageState extends State<HomePage>
String? xDateDayListJson, xDateWeekListJson, xDateMonthListJson;
late final AnimationController _controller;
late final Animation<double> _animation;
List<ChargeUserList>? chargeList = [];
List<OfficeDtoLists>? deviceList = [];
FindChargeListBo? chargeBo = FindChargeListBo();
List<CountData>? findCountList = [];
@override
void initState() {
......@@ -149,90 +155,83 @@ class _HomePageState extends State<HomePage>
getDeviceData();
}
List<Data>? deviceDataSyList = [], deviceDataScList = [];
List<ChargeUserList>? chargeList = [];
getDeviceData() {
if (!isUnitRoles(StorageUtil.getInstance().getRoleNames())!) {
return;
}
///获取对应设备下的人员角色
HttpUtils.doFindNatureDtoList(context, onSuccess: (value) {
///接口返回数据
RoleBo roleBo = value;
if (mounted) {
setState(() {
///使用单位
HttpUtils.doDeviceList(context, '1', '1', onSuccess: (value) {
DeviceListBo deviceListBo = value;
if (mounted) {
setState(() {
deviceDataSyList = deviceListBo.data;
//角色集合
for (var deviceItem in deviceListBo.data!) {
var director = '', officer = '';
List<UserData>? userDataList = [];
for (var rolesItem in roleBo.list!) {
if (rolesItem.deviceTypeId == deviceItem.deviceTypeId) {
userDataList.add(rolesItem);
//安全总监
if (rolesItem.roleEnName == 'director') {
director += '${rolesItem.userName},';
}
//安全员
if (rolesItem.roleEnName == 'officer') {
officer += '${rolesItem.userName},';
}
}
}
deviceItem.list = userDataList;
deviceItem.safetyOfficer = officer;
deviceItem.safetyDirector = director;
}
});
}
});
///设备对比表格 获取使用单位设备数量
HttpUtils.doFindCount(context, onSuccess: (value) {
FindCountBo findCountBo = value;
findCountList = findCountBo.list;
///生产单位
HttpUtils.doDeviceList(context, '1', '2', onSuccess: (value) {
DeviceListBo deviceListBo = value;
///设备对比表格 获取主要负责人
HttpUtils.doFindChargeList(context, onSuccess: (value) {
FindChargeListBo findChargeListBo = value;
if (mounted) {
setState(() {
deviceDataScList = deviceListBo.data;
//角色集合
for (var deviceItem in deviceListBo.data!) {
var director = '', officer = '';
List<UserData>? userDataList = [];
for (var rolesItem in roleBo.list!) {
if (rolesItem.deviceTypeId == deviceItem.deviceTypeId) {
userDataList.add(rolesItem);
//安全总监
if (rolesItem.roleEnName == 'director') {
director += '${rolesItem.userName},';
}
//安全员
if (rolesItem.roleEnName == 'officer') {
officer += '${rolesItem.userName},';
chargeList = findChargeListBo.list;
chargeBo = findChargeListBo;
var charge = '';
for (var deviceItem in chargeBo!.list!) {
charge += '${deviceItem.name}\n';
}
//删除字符串最后一个逗号
int lastIndex = charge.lastIndexOf("\n");
if (lastIndex != -1) {
// 如果字符串中存在逗号
charge = charge.substring(0, lastIndex) +
charge.substring(lastIndex + 1);
}
findChargeListBo.chargeNames = charge;
HttpUtils.getOfficeDevice(context).then((value) {
if (value != null) {
OfficeDevice officeDeviceItem = value;
setState(() {
deviceList = officeDeviceItem.office!.officeDtoList;
//角色集合
for (var deviceItem in deviceList!) {
///将获取到的使用单位的数量放到设备数组中
for (var countItem in findCountList!) {
if (countItem.deviceTypeId ==
deviceItem.deviceTypeId) {
deviceItem.deviceCount = countItem.count.toString();
}
}
var director = '', officer = '';
List<UserData>? userDataList = [];
for (var rolesItem in roleBo.list!) {
if (rolesItem.deviceTypeId ==
deviceItem.deviceTypeId) {
userDataList.add(rolesItem);
//安全总监
if (rolesItem.roleEnName == 'director') {
director += '${rolesItem.userName},';
}
//安全员
if (rolesItem.roleEnName == 'officer') {
officer += '${rolesItem.userName},';
}
}
}
deviceItem.list = userDataList;
deviceItem.safetyOfficer = officer;
deviceItem.safetyDirector = director;
}
}
});
}
deviceItem.list = userDataList;
deviceItem.safetyOfficer = officer;
deviceItem.safetyDirector = director;
}
});
});
}
});
});
}
});
///设备对比表格 获取主要负责人
HttpUtils.doFindChargeList(context, onSuccess: (value) {
FindChargeListBo findChargeListBo = value;
if (mounted) {
setState(() {
chargeList = findChargeListBo.list;
});
}
});
}
@override
......@@ -256,55 +255,50 @@ class _HomePageState extends State<HomePage>
///欢迎、身份
buildStanding(),
if (isUnitRoles(StorageUtil.getInstance().getRoleNames())!) ...[
///用户设置、设备设置、单位设置布局
UnitGridList(onTapUser: () {
Get.toNamed(RouteString.UER_LIST);
Get.toNamed(RouteString.UER_LIST)?.then((value) {
// if (value) {
getDeviceData();
// }
});
}, onTapEquipment: () {
HttpUtils.getOfficeDevice(context).then((value) {
if (value != null) {
OfficeDevice officeDeviceItem = value;
setState(() {
var type = officeDeviceItem.office!.type!.split(',');
Get.toNamed(RouteString.EQUIPMENT_TAB, arguments: type);
Get.toNamed(RouteString.EQUIPMENT_TAB, arguments: type)
?.then((value) {
// if (value) {
getDeviceData();
// }
});
});
}
});
}, onTapUnit: () {
Get.toNamed(RouteString.UNIT_SETTINGS);
Get.toNamed(RouteString.UNIT_SETTINGS)?.then((value) {
// if (value) {
getDeviceData();
// }
});
}),
///设备人员对比
EquipmentPersonnelTable(
deviceDataSyList: deviceDataSyList,
deviceDataScList: deviceDataScList,
chargeList: chargeList,
onTapSyCharge: () {
Get.toNamed(RouteString.EQUIPMENT_PERSONNEL,
arguments: {'title': '主要负责人'});
},
onTapSyDirector: () {
Get.toNamed(RouteString.EQUIPMENT_PERSONNEL,
arguments: {'title': '安全总监'});
},
onTapSyOfficer: () {
Get.toNamed(RouteString.EQUIPMENT_PERSONNEL,
arguments: {'title': '安全员'});
},
onTapScCharge: () {
Get.toNamed(RouteString.EQUIPMENT_PERSONNEL,
arguments: {'title': '主要负责人'});
},
onTapScDirector: () {
Get.toNamed(RouteString.EQUIPMENT_PERSONNEL,
arguments: {'title': '安全总监'});
},
onTapScOfficer: () {
Get.toNamed(RouteString.EQUIPMENT_PERSONNEL,
arguments: {'title': '安全员'});
},
),
deviceList: deviceList,
chargeList: chargeList,
onTapSyCharge: (deviceList, chargeList) {
buildShowChargeDialog(context, deviceList, chargeList!);
},
onTapSyDirector: (value) {
buildShowTableDialog(context, value, true);
},
onTapSyOfficer: (value) {
buildShowTableDialog(context, value, false);
}),
///统计
// buildSliverStatistics(context),
......@@ -324,6 +318,274 @@ class _HomePageState extends State<HomePage>
);
}
Future<dynamic> buildShowChargeDialog(BuildContext context,
List<OfficeDtoLists>? deviceList, List<ChargeUserList>? chargeList) {
return showDialog(
context: context,
barrierDismissible: true,
builder: (context) {
return AlertDialog(
title: const Text('主要负责人'),
content: CustomScrollView(
primary: false,
shrinkWrap: true,
slivers: <Widget>[
SliverToBoxAdapter(
child: buildChargeTable(deviceList!, chargeList),
)
]),
// content: Container(
// height: 150, child: buildChargeTable(deviceList!, chargeList)),
actions: <Widget>[
Center(
child: GradientButton(
tapCallback: () {
setState(() {
Get.back();
});
},
width: 90,
height: 30,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(5),
topRight: Radius.circular(10),
bottomLeft: Radius.circular(10),
bottomRight: Radius.circular(5)),
disable: false,
colors: const [ColorConst.blueColor, Colors.blue],
child: const Text(
"我知道了",
style:
TextStyle(fontSize: 13, color: ColorConst.whiteColor),
)),
),
const SizedBox(height: 10)
],
);
});
}
Table buildChargeTable(
List<OfficeDtoLists>? deviceList, List<ChargeUserList>? chargeList) {
return Table(
border: TableBorder.all(color: ColorConst.blueColor),
textBaseline: TextBaseline.alphabetic,
defaultVerticalAlignment: TableCellVerticalAlignment.middle,
columnWidths: const {
// 0: FixedColumnWidth(100),
// 1: FixedColumnWidth(50),
},
children: [
TableRow(children: [
buildTableTitle(name: '设备类型', color: ColorConst.blueColor),
buildTableTitle(name: '用户名称', color: ColorConst.blueColor),
]),
TableRow(children: [
Table(
border:
TableBorder.all(color: ColorConst.blueColor, width: 0.5),
children: [
for (var item in deviceList!) ...[
TableRow(children: [
Container(
height: 30,
padding: const EdgeInsets.only(top: 5, bottom: 5),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(item.name!,
style: const TextStyle(fontSize: 13)),
Text(
item.deviceCount!.isNotEmpty
? '(${item.deviceCount})'
: '',
style: const TextStyle(
fontSize: 12, color: Colors.red)),
],
)),
]),
],
]),
Center(
child: Padding(
padding: const EdgeInsets.all(5.0),
child: Text(chargeBo!.chargeNames! ?? '',
style: const TextStyle(fontSize: 13, color: Colors.black)),
)),
]),
]);
}
Future<dynamic> buildShowTableDialog(
BuildContext context, OfficeDtoLists? value, isUser) {
return showDialog(
context: context,
barrierDismissible: true,
builder: (context) {
return AlertDialog(
title: Row(
children: [
Text(value!.name!),
Text(
value.deviceCount!.isNotEmpty
? '(${value.deviceCount})'
: '',
style: const TextStyle(fontSize: 12, color: Colors.red)),
],
),
content: buildTable(value!, isUser),
actions: <Widget>[
Center(
child: GradientButton(
tapCallback: () {
setState(() {
Get.back();
});
},
width: 90,
height: 30,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(5),
topRight: Radius.circular(10),
bottomLeft: Radius.circular(10),
bottomRight: Radius.circular(5)),
disable: false,
colors: const [ColorConst.blueColor, Colors.blue],
child: const Text(
"我知道了",
style:
TextStyle(fontSize: 13, color: ColorConst.whiteColor),
)),
),
const SizedBox(height: 10)
],
);
});
}
Table buildTable(OfficeDtoLists value, bool isUser) {
return Table(
border: TableBorder.all(color: ColorConst.blueColor),
textBaseline: TextBaseline.alphabetic,
defaultVerticalAlignment: TableCellVerticalAlignment.middle,
columnWidths: const {
// 0: FixedColumnWidth(130),
// 1: FixedColumnWidth(80),
// 2: FixedColumnWidth(65),
// 3: FixedColumnWidth(50)
},
children: [
TableRow(children: [
buildTableTitle(name: '用户类型', color: ColorConst.blueColor),
buildTableTitle(name: '用户名称', color: ColorConst.blueColor),
]),
TableRow(children: [
Table(
border:
TableBorder.all(color: ColorConst.blueColor, width: 0.5),
children: [
for (UserData item in value.list!) ...[
if (isUser) ...[
if (item.roleEnName == 'director') ...[
TableRow(children: [
GestureDetector(
onTap: () {
// onTapSyDirector!();
},
child: Center(
child: Container(
height: 30,
padding: const EdgeInsets.only(top: 5, bottom: 5),
child: Text(item.roleName!,
style: const TextStyle(
fontSize: 13, color: Colors.black)),
)),
),
]),
],
],
if (!isUser) ...[
if (item.roleEnName == 'officer') ...[
TableRow(children: [
GestureDetector(
onTap: () {
// onTapSyDirector!();
},
child: Center(
child: Container(
height: 30,
padding: const EdgeInsets.only(top: 5, bottom: 5),
child: Text(item.roleName!,
style: const TextStyle(
fontSize: 13, color: Colors.black)),
)),
),
]),
]
]
]
]),
Table(
border: TableBorder.all(color: ColorConst.blueColor),
children: [
for (UserData item in value.list!) ...[
if (isUser) ...[
if (item.roleEnName == 'director') ...[
TableRow(children: [
GestureDetector(
onTap: () {
// onTapSyOfficer!();
},
child: Center(
child: Container(
height: 30,
padding: const EdgeInsets.only(top: 5, bottom: 5),
child: Text(item.userName!,
style: const TextStyle(
fontSize: 13, color: Colors.black)),
)),
),
]),
]
],
if (!isUser) ...[
if (item.roleEnName == 'officer') ...[
TableRow(children: [
GestureDetector(
onTap: () {
// onTapSyOfficer!();
},
child: Center(
child: Container(
height: 30,
padding: const EdgeInsets.only(top: 5, bottom: 5),
child: Text(item.userName!,
style: const TextStyle(
fontSize: 13, color: Colors.black)),
)),
),
]),
]
]
]
]),
]),
]);
}
Center buildTableTitle({color, name}) {
return Center(
child: Padding(
padding: const EdgeInsets.only(top: 8, bottom: 8),
child: Text(name,
style: TextStyle(
fontWeight: FontWeight.bold, color: color, fontSize: 14)),
),
);
}
Column buildTitle(icon, title) {
return Column(
children: [
......
// // ignore_for_file: prefer_typing_uninitialized_variables, library_private_types_in_public_api, use_build_context_synchronously
//
// import 'dart:convert';
// import 'dart:io';
//
// import 'package:flutter/material.dart';
// import 'package:flutter_easyrefresh/easy_refresh.dart';
// import 'package:get/get.dart';
// import 'package:intl/intl.dart';
// import 'package:package_info/package_info.dart';
// import 'package:special_equipment_flutter/common/route_string.dart';
// import 'package:special_equipment_flutter/dio/http_utils.dart';
// import 'package:special_equipment_flutter/model/check_update.dart';
// import 'package:special_equipment_flutter/model/count_bo.dart';
// import 'package:special_equipment_flutter/model/echart_bo.dart';
// import 'package:special_equipment_flutter/model/find_charge_list_bo.dart';
// import 'package:special_equipment_flutter/model/office_device.dart';
// import 'package:special_equipment_flutter/model/role_bo.dart';
// import 'package:special_equipment_flutter/model/version/app_info_bo.dart';
// import 'package:special_equipment_flutter/model/version/version_bo.dart';
// import 'package:special_equipment_flutter/ui/common/data.dart';
// import 'package:special_equipment_flutter/ui/main/echart/home_echart_tabs.dart';
// import 'package:special_equipment_flutter/ui/main/unit/equipment_personnel_table.dart';
// import 'package:special_equipment_flutter/ui/main/unit/unit_grid_list.dart';
// import 'package:special_equipment_flutter/utils/size_config.dart';
// import 'package:special_equipment_flutter/utils/storage_util.dart';
// import 'package:special_equipment_flutter/utils/toast_utils.dart';
// import 'package:special_equipment_flutter/widgets/custom_button.dart';
// import 'package:special_equipment_flutter/widgets/divider_custom.dart';
// import 'package:special_equipment_flutter/widgets/easy_refresh_header1.dart';
// import 'package:url_launcher/url_launcher.dart';
//
// import '../../common/color_const.dart';
// import '../../utils/string_utils.dart';
//
// ///首页
// class HomePage extends StatefulWidget {
// const HomePage({super.key});
//
// @override
// _HomePageState createState() => _HomePageState();
// }
//
// class _HomePageState extends State<HomePage>
// with AutomaticKeepAliveClientMixin, TickerProviderStateMixin {
// @override
// bool get wantKeepAlive => true;
//
// var unitList = [];
// List<HomeMenuItem> checkItemList = [],
// checkItemRiskList = [],
// checkItemSettingsList = [];
// var unitId = '1',
// unitName = '使用单位',
// officeName,
// userName,
// roleNames,
// dayCount,
// weekCount,
// monthCount,
// dayRiskCount,
// weekRiskCount,
// monthRiskCount;
// List<dynamic>? completedDayNum = [], incompletedDayNum = [];
// List<dynamic>? completedWeekNum = [], incompletedWeekNum = [];
// List<dynamic>? completedMonthNum = [], incompletedMonthNum = [];
// String? xDateDayListJson, xDateWeekListJson, xDateMonthListJson;
// late final AnimationController _controller;
// late final Animation<double> _animation;
//
// @override
// void initState() {
// super.initState();
//
// ///获取版本
// checkUpdateVersion();
// officeName = StorageUtil.getInstance().getOfficeName();
// userName = StorageUtil.getInstance().getName();
// roleNames = StorageUtil.getInstance().getRoleNames();
//
// unitList = getUnitList();
// try {
// var unitStatus = StorageUtil.getInstance().getUnitStatus();
// if (!StringUtils.strIsEmpty(unitStatus)) {
// unitId = unitStatus;
// if (unitStatus == '1') {
// unitName = '使用单位';
// } else if (unitStatus == '2') {
// unitName = '生产单位';
// }
// } else {
// StorageUtil.getInstance().set(SpKeys.UNIT_STATUS, unitId);
// }
// } catch (e) {
// StorageUtil.getInstance().set(SpKeys.UNIT_STATUS, unitId);
// }
// // _requestPermission();
//
// ///获取日管控、周排查、月调度数量
// getCount();
// checkItemList.add(HomeMenuItem(
// image: 'assets/home/day_control_white_icon.png',
// name: '日管控',
// isContains: roleNames.contains(StandingConfig.SAFETY_OFFICER)));
// checkItemList.add(HomeMenuItem(
// image: 'assets/home/weekly_survey_white_icon.png',
// name: '周排查',
// isContains: roleNames.contains(StandingConfig.SAFETY_DIRECTOR)));
// checkItemList.add(HomeMenuItem(
// image: 'assets/home/monthly_scheduling_white_icon.png',
// name: '月调度',
// isContains: roleNames.contains(StandingConfig.PERSON_CHARGE)));
//
// checkItemRiskList.add(HomeMenuItem(
// image: 'assets/home/risk_bg_icon.png',
// name: '日整改',
// isContains: roleNames.contains(StandingConfig.SAFETY_OFFICER)));
// checkItemRiskList.add(HomeMenuItem(
// image: 'assets/home/risk_bg_icon.png',
// name: '周整改',
// isContains: roleNames.contains(StandingConfig.SAFETY_DIRECTOR)));
// checkItemRiskList.add(HomeMenuItem(
// image: 'assets/home/risk_bg_icon.png',
// name: '月整改',
// isContains: roleNames.contains(StandingConfig.PERSON_CHARGE)));
//
// checkItemSettingsList.add(HomeMenuItem(
// image: 'assets/home/user_settings_icon.png',
// name: '用户设置',
// isContains: roleNames.contains(StandingConfig.SAFETY_OFFICER)));
// checkItemSettingsList.add(HomeMenuItem(
// image: 'assets/home/equipment_settings_icon.png',
// name: '设备设置',
// isContains: roleNames.contains(StandingConfig.SAFETY_DIRECTOR)));
// checkItemSettingsList.add(HomeMenuItem(
// image: 'assets/home/unit_settings_icon.png',
// name: '单位设置',
// isContains: roleNames.contains(StandingConfig.PERSON_CHARGE)));
//
// _controller = AnimationController(
// duration: const Duration(seconds: 2),
// vsync: this,
// )..forward();
//
// _animation = CurvedAnimation(
// parent: _controller,
// curve: Curves.bounceOut,
// );
// getDeviceData();
// }
//
// // List<Data>? deviceDataSyList = [], deviceDataScList = [];
// List<ChargeUserList>? chargeList = [];
// List<OfficeDtoLists>? deviceList = [];
//
// getDeviceData() {
// ///获取对应设备下的人员角色
// HttpUtils.doFindNatureDtoList(context, onSuccess: (value) {
// ///接口返回数据
// RoleBo roleBo = value;
// if (mounted) {
// setState(() {
// ///设备对比表格 获取主要负责人
// HttpUtils.doFindChargeList(context, onSuccess: (value) {
// FindChargeListBo findChargeListBo = value;
// if (mounted) {
// setState(() {
// chargeList = findChargeListBo.list;
// HttpUtils.getOfficeDevice(context).then((value) {
// if (value != null) {
// OfficeDevice officeDeviceItem = value;
// setState(() {
// deviceList = officeDeviceItem.office!.officeDtoList;
// //角色集合
// for (var deviceItem in deviceList!) {
// var director = '', officer = '';
// List<UserData>? userDataList = [];
// for (var rolesItem in roleBo.list!) {
// if (rolesItem.deviceTypeId ==
// deviceItem.deviceTypeId) {
// userDataList.add(rolesItem);
// //安全总监
// if (rolesItem.roleEnName == 'director') {
// director += '${rolesItem.userName},';
// }
// //安全员
// if (rolesItem.roleEnName == 'officer') {
// officer += '${rolesItem.userName},';
// }
// }
// }
// deviceItem.list = userDataList;
// deviceItem.safetyOfficer = officer;
// deviceItem.safetyDirector = director;
// }
// });
// }
// });
//
// // ///使用单位
// // HttpUtils.doDeviceList(context, '1', '1', onSuccess: (value) {
// // DeviceListBo deviceListBo = value;
// // if (mounted) {
// // setState(() {
// // deviceDataSyList = deviceListBo.data;
// // //角色集合
// // for (var deviceItem in deviceListBo.data!) {
// // var director = '', officer = '';
// // List<UserData>? userDataList = [];
// // for (var rolesItem in roleBo.list!) {
// // if (rolesItem.deviceTypeId ==
// // deviceItem.deviceTypeId) {
// // userDataList.add(rolesItem);
// // //安全总监
// // if (rolesItem.roleEnName == 'director') {
// // director += '${rolesItem.userName},';
// // }
// // //安全员
// // if (rolesItem.roleEnName == 'officer') {
// // officer += '${rolesItem.userName},';
// // }
// // }
// // }
// // deviceItem.list = userDataList;
// // deviceItem.safetyOfficer = officer;
// // deviceItem.safetyDirector = director;
// // }
// //
// // ///将主要负责人加到设备列表下人员数组内
// // for (var deviceItem in deviceListBo.data!) {
// // for (var item in chargeList!) {
// // UserData userData = UserData();
// // userData.userName = item.name;
// // userData.roleName = item.roleNames;
// // deviceItem.list!.add(userData);
// // }
// // }
// // });
// // }
// // });
// //
// // ///生产单位
// // HttpUtils.doDeviceList(context, '1', '2', onSuccess: (value) {
// // DeviceListBo deviceListBo = value;
// // if (mounted) {
// // setState(() {
// // deviceDataScList = deviceListBo.data;
// // //角色集合
// // for (var deviceItem in deviceListBo.data!) {
// // var director = '', officer = '';
// // List<UserData>? userDataList = [];
// // for (var rolesItem in roleBo.list!) {
// // if (rolesItem.deviceTypeId ==
// // deviceItem.deviceTypeId) {
// // userDataList.add(rolesItem);
// // //安全总监
// // if (rolesItem.roleEnName == 'director') {
// // director += '${rolesItem.userName},';
// // }
// // //安全员
// // if (rolesItem.roleEnName == 'officer') {
// // officer += '${rolesItem.userName},';
// // }
// // }
// // }
// // deviceItem.list = userDataList;
// // deviceItem.safetyOfficer = officer;
// // deviceItem.safetyDirector = director;
// // }
// //
// // ///将主要负责人加到设备列表下人员数组内
// // for (var deviceItem in deviceListBo.data!) {
// // for (var item in chargeList!) {
// // UserData userData = UserData();
// // userData.userName = item.name;
// // userData.roleName = item.roleNames;
// // deviceItem.list!.add(userData);
// // }
// // }
// // });
// // }
// // });
// });
// }
// });
// });
// }
// });
// }
//
// @override
// Widget build(BuildContext context) {
// super.build(context);
// return Scaffold(
// backgroundColor: Colors.grey[100],
// body: EasyRefresh(
// header: TaurusHeaders(),
// onRefresh: () async {
// setState(() {
// getCount();
// getDeviceData();
// });
// },
// child: CustomScrollView(
// primary: false,
// shrinkWrap: true,
// slivers: <Widget>[
// buildSliverAppBar(),
//
// ///欢迎、身份
// buildStanding(),
//
// if (isUnitRoles(StorageUtil.getInstance().getRoleNames())!) ...[
// ///用户设置、设备设置、单位设置布局
// UnitGridList(onTapUser: () {
// Get.toNamed(RouteString.UER_LIST);
// }, onTapEquipment: () {
// HttpUtils.getOfficeDevice(context).then((value) {
// if (value != null) {
// OfficeDevice officeDeviceItem = value;
// setState(() {
// var type = officeDeviceItem.office!.type!.split(',');
// Get.toNamed(RouteString.EQUIPMENT_TAB, arguments: type);
// });
// }
// });
// }, onTapUnit: () {
// Get.toNamed(RouteString.UNIT_SETTINGS);
// }),
//
// ///设备人员对比
// EquipmentPersonnelTable(
// deviceDataList: deviceList,
// chargeList: chargeList,
// onTapSyCharge: (list) {},
// onTapSyDirector: (value) {
// showDialog(
// context: context,
// barrierDismissible: true,
// builder: (context) {
// return AlertDialog(
// title: const Text("查看"),
// content: buildTable(value),
// actions: <Widget>[
// GradientButton(
// tapCallback: () {
// setState(() {
// Get.back();
// });
// },
// width: 70,
// height: 25,
// borderRadius: const BorderRadius.only(
// topLeft: Radius.circular(5),
// topRight: Radius.circular(15),
// bottomLeft: Radius.circular(15),
// bottomRight: Radius.circular(5)),
// disable: false,
// colors: const [
// ColorConst.greenColor,
// Colors.green
// ],
// child: const Text(
// "取消",
// style: TextStyle(
// fontSize: 13,
// color: ColorConst.whiteColor),
// ))
// ],
// );
// });
// },
// onTapSyOfficer: (value) {}),
//
// ///统计
// // buildSliverStatistics(context),
// ] else ...[
// ///日管控、周排查、月调度布局
// buildSliverDayWeekMonth(),
//
// ///日管控整改、周排查整改、月调度整改布局
// buildSliverRiskDayWeekMonth(),
//
// ///统计
// buildSliverStatistics(context),
// ]
// ],
// ),
// ),
// );
// }
//
// Table buildTable(value) {
// return Table(
// border: TableBorder.all(color: ColorConst.blueColor),
// textBaseline: TextBaseline.alphabetic,
// defaultVerticalAlignment: TableCellVerticalAlignment.middle,
// columnWidths: const {
// // 0: FixedColumnWidth(130),
// // 1: FixedColumnWidth(80),
// // 2: FixedColumnWidth(65),
// // 3: FixedColumnWidth(50)
// },
// children: [
// TableRow(children: [
// buildTableTitle(name: '用户类型', color: ColorConst.blueColor),
// buildTableTitle(name: '用户名称', color: ColorConst.blueColor),
// ]),
// TableRow(children: [
// Table(
// border:
// TableBorder.all(color: ColorConst.blueColor, width: 0.5),
// children: [
// for (var item in value!.list!) ...[
// TableRow(children: [
// GestureDetector(
// onTap: () {
// // onTapSyDirector!();
// director
// },
// child: Center(
// child: Container(
// height: 30,
// padding: const EdgeInsets.only(top: 5, bottom: 5),
// child: Text(item.roleName!,
// style: const TextStyle(
// fontSize: 13, color: Colors.black)),
// )),
// ),
// ]),
// ]
// ]),
// Table(
// border: TableBorder.all(color: ColorConst.blueColor),
// children: [
// for (var item in value!.list!) ...[
// TableRow(children: [
// GestureDetector(
// onTap: () {
// // onTapSyOfficer!();
// },
// child: Center(
// child: Container(
// height: 30,
// padding: const EdgeInsets.only(top: 5, bottom: 5),
// child: Text(item.userName!,
// style: const TextStyle(
// fontSize: 13, color: Colors.black)),
// )),
// ),
// ]),
// ]
// ]),
// ]),
// ]);
// }
//
// Center buildTableTitle({color, name}) {
// return Center(
// child: Padding(
// padding: const EdgeInsets.only(top: 8, bottom: 8),
// child: Text(name,
// style: TextStyle(
// fontWeight: FontWeight.bold, color: color, fontSize: 14)),
// ),
// );
// }
//
// Column buildTitle(icon, title) {
// return Column(
// children: [
// Row(
// children: [
// Icon(
// icon,
// color: ColorConst.blueColor,
// size: SizeConfig.isIpad()! ? 35 : 18,
// ),
// const SizedBox(width: 5),
// Text(
// title,
// style: TextStyle(
// color: Colors.black54,
// fontSize: SizeConfig.isIpad()! ? 25 : 14,
// fontWeight: FontWeight.bold),
// ),
// ],
// ),
// DividerCustom(Colors.grey[300], 10, 5, 5, 10),
// ],
// );
// }
//
// ///日管控、周排查、月调度布局
// SliverPadding buildSliverDayWeekMonth() {
// return SliverPadding(
// padding: const EdgeInsets.only(left: 0, right: 0, top: 0, bottom: 0),
// // 使用SliverGrid来创建GridView
// sliver: SliverGrid(
// gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
// crossAxisCount: checkItemList.length,
// crossAxisSpacing: 1,
// mainAxisSpacing: 1,
// childAspectRatio: 1 / 0.83, //子项的宽高比,值越大高度越高
// ),
// delegate: SliverChildBuilderDelegate(
// (BuildContext context, int index) {
// return AnimatedBuilder(
// animation: _animation,
// builder: (context, child) {
// return Transform.scale(
// scale: _animation.value,
// child: buildCheckItem(index),
// );
// },
// );
// },
// childCount: checkItemList.length,
// ),
// ),
// );
// }
//
// ///日管控、周排查、月调度布局
// SliverPadding buildSliverRiskDayWeekMonth() {
// return SliverPadding(
// padding: const EdgeInsets.only(left: 0, right: 0, top: 0, bottom: 0),
// // 使用SliverGrid来创建GridView
// sliver: SliverGrid(
// gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
// crossAxisCount: checkItemRiskList.length,
// crossAxisSpacing: 1,
// mainAxisSpacing: 1,
// childAspectRatio:
// 1 / (SizeConfig.isIpad()! ? 0.66 : 0.83), //子项的宽高比,值越大高度越高
// ),
// delegate: SliverChildBuilderDelegate(
// (BuildContext context, int index) {
// return AnimatedBuilder(
// animation: _animation,
// builder: (context, child) {
// return Transform.scale(
// scale: _animation.value,
// child: buildCheckRiskItem(index),
// );
// },
// );
// },
// childCount: checkItemRiskList.length,
// ),
// ),
// );
// }
//
// InkWell buildCheckRiskItem(index) {
// return InkWell(
// splashColor: ColorConst.green1Color,
// child: Column(
// children: [
// SizedBox(height: SizeConfig.isIpad()! ? 0 : 15),
// Stack(
// alignment: Alignment.center,
// children: [
// Container(
// width: SizeConfig.isIpad()! ? 150 : 50,
// height: SizeConfig.isIpad()! ? 150 : 50,
// decoration: BoxDecoration(
// shape: BoxShape.circle, // 设定形状为圆形
// gradient: LinearGradient(
// begin: Alignment.topLeft,
// end: Alignment.bottomRight,
// stops: const [0.4, 0.5],
// colors: [
// checkItemRiskList[index].isContains
// ? ColorConst.orange1Color
// : ColorConst.greyC2Color,
// checkItemRiskList[index].isContains
// ? ColorConst.orangeColor
// : ColorConst.greyC2Color,
// ],
// ),
// ),
// ),
// Image.asset(
// checkItemRiskList[index].image,
// width: SizeConfig.isIpad()! ? 60 : 30,
// height: SizeConfig.isIpad()! ? 60 : 30,
// ),
// Positioned(
// right: SizeConfig.isIpad()! ? 10 : 0,
// top: 0,
// child: Badge(
// largeSize: SizeConfig.isIpad()! ? 25 : 15,
// backgroundColor: Colors.red,
// isLabelVisible: checkItemRiskList[index].isContains,
// label: Text(
// buildCount1(index)!,
// style: TextStyle(fontSize: SizeConfig.isIpad()! ? 18 : 8),
// ),
// ),
// )
// ],
// ),
// buildBottomText(checkItemRiskList[index].name),
// ],
// ),
// onTap: () {
// switch (index) {
// case 0:
// if (checkItemRiskList[index].isContains) {
// Get.toNamed(RouteString.TAB_SY, arguments: {
// 'type': '1',
// 'tabIndex': 1,
// 'titleName': '日管控'
// })?.then((value) {
// if (value != null && value) {
// ///获取日管控、周排查、月调度数量
// getCount();
// }
// });
// } else {
// ToastUtils.showCenter('您没有权限访问');
// }
// break;
// case 1:
// if (checkItemRiskList[index].isContains) {
// Get.toNamed(RouteString.TAB_SY, arguments: {
// 'type': '2',
// 'tabIndex': 1,
// 'titleName': '周排查'
// })?.then((value) {
// if (value != null && value) {
// ///获取日管控、周排查、月调度数量
// getCount();
// }
// });
// } else {
// ToastUtils.showCenter('您没有权限访问');
// }
// break;
// case 2:
// if (checkItemRiskList[index].isContains) {
// Get.toNamed(RouteString.TAB_SY, arguments: {
// 'type': '3',
// 'tabIndex': 1,
// 'titleName': '月调度'
// })?.then((value) {
// if (value != null && value) {
// ///获取日管控、周排查、月调度数量
// getCount();
// }
// });
// } else {
// ToastUtils.showCenter('您没有权限访问');
// }
// break;
// }
// },
// );
// }
//
// InkWell buildCheckItem(index) {
// return InkWell(
// splashColor: ColorConst.green1Color,
// child: Column(
// // mainAxisAlignment: MainAxisAlignment.center,
// children: [
// SizedBox(height: SizeConfig.isIpad()! ? 40 : 15),
// Stack(
// alignment: Alignment.center,
// children: [
// Container(
// width: SizeConfig.isIpad()! ? 150 : 50,
// height: SizeConfig.isIpad()! ? 150 : 50,
// decoration: BoxDecoration(
// shape: BoxShape.circle, // 设定形状为圆形
// gradient: LinearGradient(
// begin: Alignment.topLeft,
// end: Alignment.bottomRight,
// stops: const [0.4, 0.5],
// colors: [
// checkItemList[index].isContains
// ? ColorConst.blue4Color
// : ColorConst.greyC2Color,
// checkItemList[index].isContains
// ? ColorConst.blueColor
// : ColorConst.greyC2Color,
// ],
// ),
// ),
// ),
// Image.asset(
// checkItemList[index].image,
// width: SizeConfig.isIpad()! ? 60 : 25,
// height: SizeConfig.isIpad()! ? 60 : 25,
// ),
// Positioned(
// right: SizeConfig.isIpad()! ? 10 : 0,
// top: 0,
// child: Badge(
// largeSize: SizeConfig.isIpad()! ? 25 : 15,
// backgroundColor: Colors.red,
// isLabelVisible: checkItemList[index].isContains,
// label: Text(
// buildCount(index)!,
// style: TextStyle(fontSize: SizeConfig.isIpad()! ? 18 : 8),
// ),
// ),
// )
// ],
// ),
// buildBottomText(checkItemList[index].name),
// ],
// ),
// onTap: () {
// switch (index) {
// case 0:
// if (checkItemList[index].isContains) {
// Get.toNamed(RouteString.TAB_SY, arguments: {
// 'type': '1',
// 'tabIndex': 0,
// 'titleName': '日管控'
// })?.then((value) {
// if (value != null && value) {
// ///获取日管控、周排查、月调度数量
// getCount();
// }
// });
// } else {
// ToastUtils.showCenter('您没有权限访问');
// }
// break;
// case 1:
// if (checkItemList[index].isContains) {
// Get.toNamed(RouteString.TAB_SY, arguments: {
// 'type': '2',
// 'tabIndex': 0,
// 'titleName': '周排查'
// })?.then((value) {
// if (value != null && value) {
// ///获取日管控、周排查、月调度数量
// getCount();
// }
// });
// } else {
// ToastUtils.showCenter('您没有权限访问');
// }
// break;
// case 2:
// if (checkItemList[index].isContains) {
// Get.toNamed(RouteString.TAB_SY, arguments: {
// 'type': '3',
// 'tabIndex': 0,
// 'titleName': '月调度'
// })?.then((value) {
// if (value != null && value) {
// ///获取日管控、周排查、月调度数量
// getCount();
// }
// });
// } else {
// ToastUtils.showCenter('您没有权限访问');
// }
// break;
// }
// },
// );
// }
//
// ///欢迎、身份
// SliverToBoxAdapter buildStanding() {
// return SliverToBoxAdapter(
// child: Container(
// padding: const EdgeInsets.only(left: 5),
// color: ColorConst.whiteColor,
// child: Column(
// children: [
// const SizedBox(
// height: 5,
// ),
// Row(
// children: [
// const SizedBox(
// width: 3,
// ),
// Icon(
// Icons.volume_down,
// size: SizeConfig.isIpad()! ? 30 : 20,
// color: ColorConst.blueColor,
// ),
// const SizedBox(
// width: 3,
// ),
// Expanded(
// child: Text.rich(
// softWrap: true,
// TextSpan(children: [
// TextSpan(
// text: '欢迎 ',
// style: TextStyle(
// color: Colors.black54,
// fontSize: SizeConfig.isIpad()! ? 20 : 12,
// fontStyle: FontStyle.normal)),
// TextSpan(
// text: officeName + '-' + userName,
// style: TextStyle(
// color: Colors.black54,
// fontSize: SizeConfig.isIpad()! ? 20 : 12,
// fontWeight: FontWeight.bold)),
// ])),
// ),
// ],
// ),
// const SizedBox(
// height: 3,
// ),
// Row(
// children: [
// const SizedBox(
// width: 3,
// ),
// Icon(
// Icons.person_rounded,
// size: SizeConfig.isIpad()! ? 30 : 20,
// color: ColorConst.blueColor,
// ),
// const SizedBox(
// width: 3,
// ),
// Text.rich(TextSpan(children: [
// TextSpan(
// text: '您的身份:',
// style: TextStyle(
// color: Colors.black54,
// fontSize: SizeConfig.isIpad()! ? 20 : 12,
// fontStyle: FontStyle.normal)),
// TextSpan(
// text: roleNames,
// style: TextStyle(
// color: Colors.black54,
// fontSize: SizeConfig.isIpad()! ? 20 : 12,
// fontWeight: FontWeight.bold))
// ])),
// ],
// ),
// const SizedBox(
// height: 5,
// ),
// ],
// ),
// ),
// );
// }
//
// String? buildCount(index) {
// if (index == 0) {
// return dayCount ?? '0';
// } else if (index == 1) {
// return weekCount ?? '0';
// } else if (index == 2) {
// return monthCount ?? '0';
// } else {
// return '0';
// }
// }
//
// String? buildCount1(index) {
// if (index == 0) {
// return dayRiskCount ?? '0';
// } else if (index == 1) {
// return weekRiskCount ?? '0';
// } else if (index == 2) {
// return monthRiskCount ?? '0';
// } else {
// return '0';
// }
// }
//
// //字
// Container buildBottomText(name, [color]) {
// return Container(
// height: SizeConfig.isIpad()! ? 40 : 20,
// margin: const EdgeInsets.only(top: 3),
// child: Text(
// name,
// style:
// TextStyle(fontSize: SizeConfig.isIpad()! ? 25 : 13, color: color),
// ),
// );
// }
//
// SliverToBoxAdapter buildSliverStatistics(BuildContext context) {
// return SliverToBoxAdapter(
// child: Container(
// margin: const EdgeInsets.only(top: 0, left: 8, right: 8),
// padding: const EdgeInsets.all(10),
// decoration: const BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.all(Radius.circular(5)),
// ),
// child: Column(
// children: [
// buildTitle(Icons.equalizer, '统计'),
// HomeEchartTab(
// roleNames,
// completedDayNum,
// incompletedDayNum,
// xDateDayListJson,
// completedWeekNum,
// incompletedWeekNum,
// xDateWeekListJson,
// completedMonthNum,
// incompletedMonthNum,
// xDateMonthListJson),
// ],
// )));
// }
//
// SliverAppBar buildSliverAppBar() {
// return SliverAppBar(
// expandedHeight: SizeConfig.isIpad()! ? 300 : 170.0,
// floating: true,
// pinned: true,
// flexibleSpace: FlexibleSpaceBar(
// centerTitle: true,
// background: Stack(
// children: [
// Image.asset('assets/home/top_bg_icon.png',
// width: MediaQuery.of(context).size.width, fit: BoxFit.fill),
// Positioned(
// bottom: SizeConfig.isIpad()! ? 190 : 90,
// left: SizeConfig.isIpad()!
// ? MediaQuery.of(context).size.width / 2 - 70
// : MediaQuery.of(context).size.width / 2 - 50,
// child: isRolesName(StorageUtil.getInstance().getRoleNames())
// ? _buildCheckUnit()
// : const SizedBox(),
// )
// ],
// ),
// ),
// title: Column(
// children: [
// Text(
// '晋特保助手',
// style: TextStyle(fontSize: SizeConfig.isIpad()! ? 35 : 20),
// ),
// ],
// ),
// actions: [
// InkWell(
// onTap: () {
// showDialog(
// context: context,
// builder: (context) {
// return AlertDialog(
// content: const Text("您确定要退出登录吗?"),
// actions: [
// TextButton(
// child: const Text("取消"),
// onPressed: () {
// Navigator.of(context).pop();
// },
// ),
// TextButton(
// child: const Text("确定"),
// onPressed: () {
// _loginOut();
// })
// ],
// );
// });
// },
// child: Padding(
// padding: const EdgeInsets.only(left: 15, right: 15),
// child: Icon(Icons.power_settings_new,
// size: SizeConfig.isIpad()! ? 35 : 20),
// ),
// ),
// const SizedBox(
// width: 10,
// ),
// ],
// );
// }
//
// ///退出登录
// _loginOut() async {
// HttpUtils.doLoginOut(context).then((value) {
// if (mounted) {
// ///清除本地所有数据
// StorageUtil.getInstance().clearAll();
// Get.offAllNamed(RouteString.LOGIN);
// }
// });
// }
//
// ///切换单位
// 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() {
// ///判断是否是公司账户、管理员、市场监管局登录,是:显示统计图
// if (isRolesName1(StorageUtil.getInstance().getRoleNames())) {
// ///判断是否有权限访问
// if (roleNames.contains(StandingConfig.SAFETY_OFFICER)) {
// ///获取日管控数量
// HttpUtils.doCount(context, '0', '1').then((value) {
// CountBo countBo = value;
// if (mounted) {
// setState(() {
// dayCount = countBo.userAllTaskDayCount.toString();
// });
// }
// });
//
// ///获取日管控整改数量
// HttpUtils.doCount(context, '2', '1').then((value) {
// CountBo countBo = value;
// if (mounted) {
// setState(() {
// dayRiskCount = countBo.userAllTaskDayCount.toString();
// });
// }
// });
//
// HttpUtils.doEchartDay(context, '1').then((value) {
// EchartBo echartBo = value;
// if (mounted) {
// setState(() {
// List<String>? xDateDayList = [];
// completedDayNum!.clear();
// incompletedDayNum!.clear();
// xDateDayList.clear();
// for (var item in echartBo.sevenTaskCounts!) {
// completedDayNum!.add(item.completedNum.toString());
// incompletedDayNum!.add(item.incompletedNum.toString());
// String formattedDate =
// DateFormat('MM.dd').format(DateTime.parse(item.dateStr!));
// xDateDayList.add(formattedDate);
// }
// xDateDayListJson = jsonEncode(xDateDayList);
// });
// }
// });
// }
//
// ///判断是否有权限访问
// if (roleNames.contains(StandingConfig.SAFETY_DIRECTOR)) {
// ///获取周排查数量
// HttpUtils.doCount(context, '0', '2').then((value) {
// CountBo countBo = value;
// if (mounted) {
// setState(() {
// weekCount = countBo.userAllTaskWeekCount.toString();
// });
// }
// });
//
// ///获取周排查数量
// HttpUtils.doCount(context, '2', '2').then((value) {
// CountBo countBo = value;
// if (mounted) {
// setState(() {
// weekRiskCount = countBo.userAllTaskWeekCount.toString();
// });
// }
// });
// HttpUtils.doEchartDay(context, '2').then((value) {
// EchartBo echartBo = value;
// if (mounted) {
// setState(() {
// List<String>? xDateWeekList = [];
// completedWeekNum!.clear();
// incompletedWeekNum!.clear();
// xDateWeekList.clear();
// for (var item in echartBo.sevenTaskCounts!) {
// completedWeekNum!.add(item.completedNum.toString());
// incompletedWeekNum!.add(item.incompletedNum.toString());
// xDateWeekList.add('${item.dateStr}周');
// }
// xDateWeekListJson = jsonEncode(xDateWeekList);
// });
// }
// });
// }
//
// ///判断是否有权限访问
// if (roleNames.contains(StandingConfig.PERSON_CHARGE)) {
// ///获取月调度数量
// HttpUtils.doCount(context, '0', '3').then((value) {
// CountBo countBo = value;
// if (mounted) {
// setState(() {
// monthCount = countBo.userAllTaskMonthCount.toString();
// });
// }
// });
//
// ///获取月调度数量
// HttpUtils.doCount(context, '2', '3').then((value) {
// CountBo countBo = value;
// if (mounted) {
// setState(() {
// monthRiskCount = countBo.userAllTaskMonthCount.toString();
// });
// }
// });
// HttpUtils.doEchartDay(context, '3').then((value) {
// EchartBo echartBo = value;
// if (mounted) {
// setState(() {
// List<String>? xDateMonthList = [];
// completedMonthNum!.clear();
// incompletedMonthNum!.clear();
// xDateMonthList.clear();
// for (var item in echartBo.sevenTaskCounts!) {
// completedMonthNum!.add(item.completedNum.toString());
// incompletedMonthNum!.add(item.incompletedNum.toString());
// xDateMonthList.add('${item.dateStr}月');
// }
// xDateMonthListJson = jsonEncode(xDateMonthList);
// });
// }
// });
// }
// } else {
// HttpUtils.doEchartDay(context, '1').then((value) {
// EchartBo echartBo = value;
// if (mounted) {
// setState(() {
// List<String>? xDateDayList = [];
// completedDayNum!.clear();
// incompletedDayNum!.clear();
// xDateDayList.clear();
// for (var item in echartBo.sevenTaskCounts!) {
// completedDayNum!.add(item.completedNum.toString());
// incompletedDayNum!.add(item.incompletedNum.toString());
// String formattedDate =
// DateFormat('MM.dd').format(DateTime.parse(item.dateStr!));
// xDateDayList.add(formattedDate);
// }
// xDateDayListJson = jsonEncode(xDateDayList);
// });
// }
// });
// HttpUtils.doEchartDay(context, '2').then((value) {
// EchartBo echartBo = value;
// if (mounted) {
// setState(() {
// List<String>? xDateWeekList = [];
// completedWeekNum!.clear();
// incompletedWeekNum!.clear();
// xDateWeekList.clear();
// for (var item in echartBo.sevenTaskCounts!) {
// completedWeekNum!.add(item.completedNum.toString());
// incompletedWeekNum!.add(item.incompletedNum.toString());
// xDateWeekList.add('${item.dateStr}周');
// }
// xDateWeekListJson = jsonEncode(xDateWeekList);
// });
// }
// });
// HttpUtils.doEchartDay(context, '3').then((value) {
// EchartBo echartBo = value;
// if (mounted) {
// setState(() {
// List<String>? xDateMonthList = [];
// completedMonthNum!.clear();
// incompletedMonthNum!.clear();
// xDateMonthList.clear();
// for (var item in echartBo.sevenTaskCounts!) {
// completedMonthNum!.add(item.completedNum.toString());
// incompletedMonthNum!.add(item.incompletedNum.toString());
// xDateMonthList.add('${item.dateStr}月');
// }
// xDateMonthListJson = jsonEncode(xDateMonthList);
// });
// }
// });
// }
// }
//
// /// 检查是否需要版本更新
// Future<bool> checkUpdateVersion() async {
// PackageInfo packageInfo = await PackageInfo.fromPlatform();
// var versionCodeLoc = packageInfo.buildNumber;
// bool check = false;
// HttpUtils.getVersionUpdate(context).then((value) {
// VersionBo versionBo = value;
// var apkVersion = versionBo.apkVersion;
// if (apkVersion == null) {
// return;
// }
// var versionCode = int.parse(apkVersion.verionCode!);
//
// ///本地versionCode小于接口返回versionCode提示升级
// if (int.parse(versionCodeLoc) < versionCode) {
// ///android端
// if (Platform.isAndroid) {
// AppInfo appInfo = AppInfo();
// appInfo.versionCode = versionCode;
// appInfo.updateLog = apkVersion.updateLog;
// appInfo.isForce = true; //是否强制更新
// appInfo.hasUpdate = true; //是否有新版本
// appInfo.isIgnorable = false; //是否可忽略该版本
// appInfo.versionName = apkVersion.versionName;
// appInfo.apkUrl = apkVersion.apkUrl;
// appInfo.apkSize = int.parse(apkVersion.apkSize!);
// appUpdate(appInfo);
// } else if (Platform.isIOS) {
// WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
// showDialog(
// context: context,
// barrierDismissible: false,
// builder: (context) {
// return AlertDialog(
// title: Text("请更新版本到${apkVersion.versionName}"),
// content: Text(apkVersion.updateLog!),
// actions: <Widget>[
// InkWell(
// onTap: () {
// /// 在这里添加打开应用商店的代码
// _launchURL();
// },
// child: Center(
// child: Container(
// alignment: Alignment.center,
// width: MediaQuery.of(context).size.width * 0.6,
// height: 40,
// decoration: const BoxDecoration(
// color: ColorConst.blueColor,
// borderRadius:
// BorderRadius.all(Radius.circular(5)),
// ),
// // color: ColorConst.blueColor,
// child: const Text("去更新",
// style: TextStyle(
// fontSize: 16,
// color: ColorConst.whiteColor)),
// ),
// ),
// ),
// ],
// );
// });
// });
// }
// }
// });
// return check;
// }
//
// final Uri _url = Uri.parse('https://apps.apple.com/cn/app/id6469591631');
//
// _launchURL() async {
// if (await canLaunchUrl(_url)) {
// await launchUrl(_url);
// } else {
// throw 'Could not launch $_url';
// }
// }
//
// void appUpdate(appInfo) async {
// CheckUpdate checkUpdate = CheckUpdate();
// await checkUpdate.initXUpdate();
// await checkUpdate.checkUpdateByUpdateEntity(appInfo);
// }
//
// @override
// void dispose() {
// _controller.dispose();
// super.dispose();
// }
//
// // _requestPermission() async {
// // // var camera = await Permission.camera.status;
// // // var storage = await Permission.storage.status;
// // var location = await Permission.location.status;
// // if (location != PermissionStatus.granted) {
// // var future = await [
// // Permission.location,
// // ].request();
// //
// // for (final item in future.entries) {
// // if (item.value != PermissionStatus.granted) {
// // return false;
// // }
// // }
// // }
// // return true;
// // }
// }
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:special_equipment_flutter/common/color_const.dart';
import 'package:special_equipment_flutter/model/device_list_bo.dart';
import 'package:special_equipment_flutter/widgets/app_bar/custom_app_bar.dart';
///公司-首页-设备人员对比表格
class EquipmentPersonnelPage extends StatefulWidget {
var argsBundle = Get.arguments;
EquipmentPersonnelPage({super.key});
@override
State<EquipmentPersonnelPage> createState() => _EquipmentPersonnelPageState();
}
class _EquipmentPersonnelPageState extends State<EquipmentPersonnelPage> {
Data? deviceData;
@override
void initState() {
super.initState();
deviceData = widget.argsBundle['item'];
print(jsonEncode(deviceData));
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBarCustom(text: deviceData!.name, height: 50),
body: Table(
border: TableBorder.all(color: ColorConst.blueColor),
textBaseline: TextBaseline.alphabetic,
defaultVerticalAlignment: TableCellVerticalAlignment.middle,
columnWidths: const {
// 0: FixedColumnWidth(130),
// 1: FixedColumnWidth(80),
// 2: FixedColumnWidth(65),
// 3: FixedColumnWidth(50)
},
children: [
TableRow(children: [
buildTableTitle(name: '用户类型', color: ColorConst.blueColor),
buildTableTitle(name: '用户名称', color: ColorConst.blueColor),
]),
TableRow(children: [
Table(
border:
TableBorder.all(color: ColorConst.blueColor, width: 0.5),
children: [
for (var item in deviceData!.list!) ...[
TableRow(children: [
GestureDetector(
onTap: () {
// onTapSyDirector!();
},
child: Center(
child: Container(
height: 30,
padding: const EdgeInsets.only(top: 5, bottom: 5),
child: Text(item.roleName!,
style: const TextStyle(
fontSize: 13, color: Colors.black)),
)),
),
]),
]
]),
Table(
border: TableBorder.all(color: ColorConst.blueColor),
children: [
for (var item in deviceData!.list!) ...[
TableRow(children: [
GestureDetector(
onTap: () {
// onTapSyOfficer!();
},
child: Center(
child: Container(
height: 30,
padding: const EdgeInsets.only(top: 5, bottom: 5),
child: Text(item.userName!,
style: const TextStyle(
fontSize: 13, color: Colors.black)),
)),
),
]),
]
]),
]),
]),
);
}
Center buildTableTitle({color, name}) {
return Center(
child: Padding(
padding: const EdgeInsets.only(top: 8, bottom: 8),
child: Text(name,
style: TextStyle(
fontWeight: FontWeight.bold, color: color, fontSize: 14)),
),
);
}
}
import 'package:flutter/material.dart';
import 'package:special_equipment_flutter/common/color_const.dart';
import 'package:special_equipment_flutter/model/device_list_bo.dart';
import 'package:special_equipment_flutter/model/find_charge_list_bo.dart';
import 'package:special_equipment_flutter/model/office_device.dart';
import 'package:special_equipment_flutter/utils/size_config.dart';
import 'package:special_equipment_flutter/widgets/divider_custom.dart';
class EquipmentPersonnelTable extends StatelessWidget {
List<Data>? deviceDataSyList = [], deviceDataScList = [];
List<OfficeDtoLists>? deviceList = [];
List<ChargeUserList>? chargeList = [];
///使用单位:点击主要负责人
final void Function()? onTapSyCharge;
///使用单位、生产单位:点击主要负责人
final void Function(
List<OfficeDtoLists>? deviceList, List<ChargeUserList>? chargeList)?
onTapSyCharge;
///使用单位:点击安全总监
final void Function()? onTapSyDirector;
///使用单位、生产单位:点击安全总监
final void Function(OfficeDtoLists? value)? onTapSyDirector;
///使用单位:点击安全员
final void Function()? onTapSyOfficer;
///生产单位:点击主要负责人
final void Function()? onTapScCharge;
///生产单位:点击安全总监
final void Function()? onTapScDirector;
///生产单位:点击安全员
final void Function()? onTapScOfficer;
///使用单位、生产单位:点击安全员
final void Function(OfficeDtoLists? value)? onTapSyOfficer;
EquipmentPersonnelTable(
{super.key,
this.deviceDataSyList,
this.deviceDataScList,
this.deviceList,
this.chargeList,
this.onTapSyDirector,
this.onTapSyOfficer,
this.onTapSyCharge,
this.onTapScDirector,
this.onTapScOfficer,
this.onTapScCharge});
this.onTapSyCharge});
@override
Widget build(BuildContext context) {
......@@ -53,21 +42,13 @@ class EquipmentPersonnelTable extends StatelessWidget {
child: Column(
children: [
buildTitle(Icons.compare, '设备人员对比'),
const SizedBox(height: 5),
const Text(
'使用单位',
style: TextStyle(
fontWeight: FontWeight.bold,
color: ColorConst.blueColor,
fontSize: 16),
),
const SizedBox(height: 10),
Table(
border: TableBorder.all(color: ColorConst.blueColor),
textBaseline: TextBaseline.alphabetic,
defaultVerticalAlignment: TableCellVerticalAlignment.middle,
columnWidths: const {
0: FixedColumnWidth(130),
0: FixedColumnWidth(140),
1: FixedColumnWidth(80),
2: FixedColumnWidth(65),
3: FixedColumnWidth(50)
......@@ -88,35 +69,45 @@ class EquipmentPersonnelTable extends StatelessWidget {
border: TableBorder.all(
color: ColorConst.blueColor, width: 0.5),
children: [
for (var item in deviceDataSyList!) ...[
for (var item in deviceList!) ...[
TableRow(children: [
Center(
child: Container(
height: 30,
padding: const EdgeInsets.only(
top: 5, bottom: 5),
child: Text(item.name!,
style: const TextStyle(
fontSize: 14)))),
SizedBox(
height: 35,
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Text(item.name!,
style:
const TextStyle(fontSize: 14)),
Text(
item.deviceCount!.isNotEmpty
? '(${item.deviceCount})'
: '',
style: const TextStyle(
fontSize: 12,
color: Colors.red))
],
),
),
]),
],
]),
///使用单位:主要负责人内容
GestureDetector(
onTap: () {
onTapSyCharge!();
},
child: Center(
child: Padding(
padding: const EdgeInsets.all(5.0),
SizedBox(
height: 35,
child: TextButton(
onPressed: () {
onTapSyCharge!(deviceList, chargeList);
},
child: Text(chargeList!.isNotEmpty ? '✔' : '✘',
style: TextStyle(
fontSize: 13,
color: chargeList!.isNotEmpty
? Colors.black
: Colors.red)),
)),
),
),
///使用单位:安全总监内容
......@@ -124,17 +115,14 @@ class EquipmentPersonnelTable extends StatelessWidget {
border: TableBorder.all(
color: ColorConst.blueColor, width: 0.5),
children: [
for (var item in deviceDataSyList!) ...[
for (var item in deviceList!) ...[
TableRow(children: [
GestureDetector(
onTap: () {
onTapSyDirector!();
},
child: Center(
child: Container(
height: 30,
padding: const EdgeInsets.only(
top: 5, bottom: 5),
SizedBox(
height: 35,
child: TextButton(
onPressed: () {
onTapSyDirector!(item);
},
child: Text(
item.safetyDirector!.isNotEmpty
? '✔'
......@@ -145,7 +133,7 @@ class EquipmentPersonnelTable extends StatelessWidget {
.isNotEmpty
? Colors.black
: Colors.red)),
)),
),
),
]),
]
......@@ -156,17 +144,14 @@ class EquipmentPersonnelTable extends StatelessWidget {
border:
TableBorder.all(color: ColorConst.blueColor),
children: [
for (var item in deviceDataSyList!) ...[
for (var item in deviceList!) ...[
TableRow(children: [
GestureDetector(
onTap: () {
onTapSyOfficer!();
},
child: Center(
child: Container(
height: 30,
padding: const EdgeInsets.only(
top: 5, bottom: 5),
SizedBox(
height: 35,
child: TextButton(
onPressed: () {
onTapSyOfficer!(item);
},
child: Text(
item.safetyOfficer!.isNotEmpty
? '✔'
......@@ -177,149 +162,14 @@ class EquipmentPersonnelTable extends StatelessWidget {
item.safetyOfficer!.isNotEmpty
? Colors.black
: Colors.red)),
)),
),
),
]),
]
]),
]),
]),
const SizedBox(height: 10),
const Text(
'生产单位',
style: TextStyle(
fontWeight: FontWeight.bold,
color: ColorConst.orangeColor,
fontSize: 16),
),
const SizedBox(height: 10),
Table(
border: TableBorder.all(color: ColorConst.orangeColor),
textBaseline: TextBaseline.alphabetic,
defaultVerticalAlignment: TableCellVerticalAlignment.middle,
columnWidths: const {
0: FixedColumnWidth(130),
1: FixedColumnWidth(80),
2: FixedColumnWidth(65),
3: FixedColumnWidth(50)
},
children: [
TableRow(children: [
buildTableTitle(
name: '设备名称', color: ColorConst.orangeColor),
buildTableTitle(
name: '主要负责人', color: ColorConst.orangeColor),
buildTableTitle(
name: '安全总监', color: ColorConst.orangeColor),
buildTableTitle(
name: '安全员', color: ColorConst.orangeColor),
]),
TableRow(children: [
Table(
border: TableBorder.all(
color: ColorConst.orangeColor, width: 0.5),
defaultVerticalAlignment:
TableCellVerticalAlignment.middle,
children: [
for (var item in deviceDataScList!) ...[
TableRow(children: [
Center(
child: Container(
height: 30,
padding: const EdgeInsets.only(
top: 5, bottom: 5),
child: Text(item.name!,
style:
const TextStyle(fontSize: 14))),
),
]),
],
]),
///生产单位:主要负责人内容
GestureDetector(
onTap: () {
onTapScCharge!();
},
child: Center(
child: Padding(
padding: const EdgeInsets.all(5.0),
child: Text(chargeList!.isNotEmpty ? '✔' : '✘',
style: TextStyle(
fontSize: 13,
color: chargeList!.isNotEmpty
? Colors.black
: Colors.red)),
)),
),
///生产单位:安全总监内容
Table(
border: TableBorder.all(
color: ColorConst.orangeColor, width: 0.5),
defaultVerticalAlignment:
TableCellVerticalAlignment.middle,
children: [
for (var item in deviceDataScList!) ...[
TableRow(children: [
GestureDetector(
onTap: () {
onTapSyDirector!();
},
child: Center(
child: Container(
height: 30,
padding: const EdgeInsets.only(
top: 5, bottom: 5),
child: Text(
item.safetyDirector!.isNotEmpty
? '✔'
: '✘',
style: TextStyle(
fontSize: 13,
color: item.safetyDirector!
.isNotEmpty
? Colors.black
: Colors.red)),
)),
),
]),
]
]),
///生产单位:安全员内容
Table(
border:
TableBorder.all(color: ColorConst.orangeColor),
children: [
for (var item in deviceDataScList!) ...[
TableRow(children: [
GestureDetector(
onTap: () {
onTapSyOfficer!();
},
child: Center(
child: Container(
height: 30,
padding: const EdgeInsets.only(
top: 5, bottom: 5),
child: Text(
item.safetyOfficer!.isNotEmpty
? '✔'
: '✘',
style: TextStyle(
fontSize: 13,
color:
item.safetyOfficer!.isNotEmpty
? Colors.black
: Colors.red)),
)),
),
]),
]
]),
]),
])
const SizedBox(height: 10)
],
)));
}
......
import 'package:flutter/material.dart';
import 'package:special_equipment_flutter/common/color_const.dart';
import 'package:special_equipment_flutter/model/device_list_bo.dart';
import 'package:special_equipment_flutter/model/find_charge_list_bo.dart';
import 'package:special_equipment_flutter/model/office_device.dart';
import 'package:special_equipment_flutter/utils/size_config.dart';
import 'package:special_equipment_flutter/widgets/divider_custom.dart';
class EquipmentPersonnelTable extends StatelessWidget {
List<OfficeDtoLists>? deviceDataSyList = [], deviceDataScList = [];
List<ChargeUserList>? chargeList = [];
///使用单位:点击主要负责人
final void Function(List<ChargeUserList>? chargeList)? onTapSyCharge;
///使用单位:点击安全总监
final void Function(OfficeDtoLists? value)? onTapSyDirector;
///使用单位:点击安全员
final void Function(OfficeDtoLists? value)? onTapSyOfficer;
///生产单位:点击主要负责人
final void Function(List<ChargeUserList>? chargeList)? onTapScCharge;
///生产单位:点击安全总监
final void Function(OfficeDtoLists? value)? onTapScDirector;
///生产单位:点击安全员
final void Function(OfficeDtoLists? value)? onTapScOfficer;
EquipmentPersonnelTable(
{super.key,
this.deviceDataSyList,
this.deviceDataScList,
this.chargeList,
this.onTapSyDirector,
this.onTapSyOfficer,
this.onTapSyCharge,
this.onTapScDirector,
this.onTapScOfficer,
this.onTapScCharge});
@override
Widget build(BuildContext context) {
return SliverToBoxAdapter(
child: Container(
margin: const EdgeInsets.only(top: 0, left: 8, right: 8),
padding:
const EdgeInsets.only(top: 10, bottom: 10, left: 5, right: 5),
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(5)),
),
child: Column(
children: [
buildTitle(Icons.compare, '设备人员对比'),
const SizedBox(height: 5),
const Text(
'使用单位',
style: TextStyle(
fontWeight: FontWeight.bold,
color: ColorConst.blueColor,
fontSize: 16),
),
const SizedBox(height: 10),
Table(
border: TableBorder.all(color: ColorConst.blueColor),
textBaseline: TextBaseline.alphabetic,
defaultVerticalAlignment: TableCellVerticalAlignment.middle,
columnWidths: const {
0: FixedColumnWidth(130),
1: FixedColumnWidth(80),
2: FixedColumnWidth(65),
3: FixedColumnWidth(50)
},
children: [
TableRow(children: [
buildTableTitle(
name: '设备名称', color: ColorConst.blueColor),
buildTableTitle(
name: '主要负责人', color: ColorConst.blueColor),
buildTableTitle(
name: '安全总监', color: ColorConst.blueColor),
buildTableTitle(
name: '安全员', color: ColorConst.blueColor),
]),
TableRow(children: [
Table(
border: TableBorder.all(
color: ColorConst.blueColor, width: 0.5),
children: [
for (var item in deviceDataSyList!) ...[
TableRow(children: [
Center(
child: Container(
height: 30,
padding: const EdgeInsets.only(
top: 5, bottom: 5),
child: Text(item.name!,
style: const TextStyle(
fontSize: 14)))),
]),
],
]),
///使用单位:主要负责人内容
GestureDetector(
onTap: () {
onTapSyCharge!(chargeList);
},
child: Center(
child: Padding(
padding: const EdgeInsets.all(5.0),
child: Text(chargeList!.isNotEmpty ? '✔' : '✘',
style: TextStyle(
fontSize: 13,
color: chargeList!.isNotEmpty
? Colors.black
: Colors.red)),
)),
),
///使用单位:安全总监内容
Table(
border: TableBorder.all(
color: ColorConst.blueColor, width: 0.5),
children: [
for (var item in deviceDataSyList!) ...[
TableRow(children: [
GestureDetector(
onTap: () {
onTapSyDirector!(item);
},
child: Center(
child: Container(
height: 30,
padding: const EdgeInsets.only(
top: 5, bottom: 5),
child: Text(
item.safetyDirector!.isNotEmpty
? '✔'
: '✘',
style: TextStyle(
fontSize: 13,
color: item.safetyDirector!
.isNotEmpty
? Colors.black
: Colors.red)),
)),
),
]),
]
]),
///使用单位:安全员内容
Table(
border:
TableBorder.all(color: ColorConst.blueColor),
children: [
for (var item in deviceDataSyList!) ...[
TableRow(children: [
GestureDetector(
onTap: () {
onTapSyOfficer!(item);
},
child: Center(
child: Container(
height: 30,
padding: const EdgeInsets.only(
top: 5, bottom: 5),
child: Text(
item.safetyOfficer!.isNotEmpty
? '✔'
: '✘',
style: TextStyle(
fontSize: 13,
color:
item.safetyOfficer!.isNotEmpty
? Colors.black
: Colors.red)),
)),
),
]),
]
]),
]),
]),
const SizedBox(height: 10),
const Text(
'生产单位',
style: TextStyle(
fontWeight: FontWeight.bold,
color: ColorConst.orangeColor,
fontSize: 16),
),
const SizedBox(height: 10),
Table(
border: TableBorder.all(color: ColorConst.orangeColor),
textBaseline: TextBaseline.alphabetic,
defaultVerticalAlignment: TableCellVerticalAlignment.middle,
columnWidths: const {
0: FixedColumnWidth(130),
1: FixedColumnWidth(80),
2: FixedColumnWidth(65),
3: FixedColumnWidth(50)
},
children: [
TableRow(children: [
buildTableTitle(
name: '设备名称', color: ColorConst.orangeColor),
buildTableTitle(
name: '主要负责人', color: ColorConst.orangeColor),
buildTableTitle(
name: '安全总监', color: ColorConst.orangeColor),
buildTableTitle(
name: '安全员', color: ColorConst.orangeColor),
]),
TableRow(children: [
Table(
border: TableBorder.all(
color: ColorConst.orangeColor, width: 0.5),
defaultVerticalAlignment:
TableCellVerticalAlignment.middle,
children: [
for (var item in deviceDataScList!) ...[
TableRow(children: [
Center(
child: Container(
height: 30,
padding: const EdgeInsets.only(
top: 5, bottom: 5),
child: Text(item.name!,
style:
const TextStyle(fontSize: 14))),
),
]),
],
]),
///生产单位:主要负责人内容
GestureDetector(
onTap: () {
onTapScCharge!(chargeList);
},
child: Center(
child: Padding(
padding: const EdgeInsets.all(5.0),
child: Text(chargeList!.isNotEmpty ? '✔' : '✘',
style: TextStyle(
fontSize: 13,
color: chargeList!.isNotEmpty
? Colors.black
: Colors.red)),
)),
),
///生产单位:安全总监内容
Table(
border: TableBorder.all(
color: ColorConst.orangeColor, width: 0.5),
defaultVerticalAlignment:
TableCellVerticalAlignment.middle,
children: [
for (var item in deviceDataScList!) ...[
TableRow(children: [
GestureDetector(
onTap: () {
onTapSyDirector!(item);
},
child: Center(
child: Container(
height: 30,
padding: const EdgeInsets.only(
top: 5, bottom: 5),
child: Text(
item.safetyDirector!.isNotEmpty
? '✔'
: '✘',
style: TextStyle(
fontSize: 13,
color: item.safetyDirector!
.isNotEmpty
? Colors.black
: Colors.red)),
)),
),
]),
]
]),
///生产单位:安全员内容
Table(
border:
TableBorder.all(color: ColorConst.orangeColor),
children: [
for (var item in deviceDataScList!) ...[
TableRow(children: [
GestureDetector(
onTap: () {
onTapSyOfficer!(item);
},
child: Center(
child: Container(
height: 30,
padding: const EdgeInsets.only(
top: 5, bottom: 5),
child: Text(
item.safetyOfficer!.isNotEmpty
? '✔'
: '✘',
style: TextStyle(
fontSize: 13,
color:
item.safetyOfficer!.isNotEmpty
? Colors.black
: Colors.red)),
)),
),
]),
]
]),
]),
])
],
)));
}
Center buildTableTitle({color, name}) {
return Center(
child: Padding(
padding: const EdgeInsets.only(top: 8, bottom: 8),
child: Text(name,
style: TextStyle(
fontWeight: FontWeight.bold, color: color, fontSize: 14)),
),
);
}
Column buildTitle(icon, title) {
return Column(
children: [
Row(
children: [
Icon(
icon,
color: ColorConst.blueColor,
size: SizeConfig.isIpad()! ? 35 : 18,
),
const SizedBox(width: 5),
Text(
title,
style: TextStyle(
color: Colors.black54,
fontSize: SizeConfig.isIpad()! ? 25 : 14,
fontWeight: FontWeight.bold),
),
],
),
DividerCustom(Colors.grey[300], 10, 5, 5, 10),
],
);
}
}
......@@ -389,28 +389,69 @@ class _RegisterPage1State extends State<RegisterPage1> {
!equipmentSYBoList[index].isChecked!;
});
},
child: Container(
decoration: BoxDecoration(
color: equipmentSYBoList[index].isChecked!
? Colors.blue[50]
: Colors.transparent,
border: Border.all(
color: equipmentSYBoList[index].isChecked!
? Colors.blue
: ColorConst.greyD2Color,
width: 1),
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
equipmentSYBoList[index].name!,
style: TextStyle(
fontSize: 12,
color: equipmentSYBoList[index].isChecked!
? Colors.blue
: Colors.black),
),
),
child: equipmentSYBoList[index].isChecked!
? Stack(
children: [
Container(
decoration: BoxDecoration(
color: Colors.blue[100],
borderRadius:
BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
equipmentSYBoList[index].name!,
style: const TextStyle(
fontSize: 12, color: Colors.blue),
),
),
Positioned(
bottom: 0,
right: 0,
child: Image.asset(
'assets/home/select_check_blue.png',
height: 15,
width: 15),
)
],
)
: Container(
decoration: BoxDecoration(
color: Colors.transparent,
border: Border.all(
color: ColorConst.greyD2Color,
width: 0.7),
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
equipmentSYBoList[index].name!,
style: const TextStyle(
fontSize: 12, color: Colors.black),
),
),
// child: Container(
// decoration: BoxDecoration(
// color: equipmentSYBoList[index].isChecked!
// ? Colors.blue[50]
// : Colors.transparent,
// border: Border.all(
// color: equipmentSYBoList[index].isChecked!
// ? Colors.blue
// : ColorConst.greyD2Color,
// width: 1),
// borderRadius: BorderRadius.circular(3),
// ),
// alignment: Alignment.center,
// child: Text(
// equipmentSYBoList[index].name!,
// style: TextStyle(
// fontSize: 12,
// color: equipmentSYBoList[index].isChecked!
// ? Colors.blue
// : Colors.black),
// ),
// ),
);
},
),
......@@ -455,28 +496,70 @@ class _RegisterPage1State extends State<RegisterPage1> {
!equipmentSCBoList[index].isChecked!;
});
},
child: Container(
decoration: BoxDecoration(
color: equipmentSCBoList[index].isChecked!
? Colors.orange[50]
: Colors.transparent,
border: Border.all(
color: equipmentSCBoList[index].isChecked!
? Colors.orange
: ColorConst.greyD2Color,
width: 1),
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
equipmentSCBoList[index].name!,
style: TextStyle(
fontSize: 12,
color: equipmentSCBoList[index].isChecked!
? Colors.orange
: Colors.black),
),
),
child: equipmentSCBoList[index].isChecked!
? Stack(
children: [
Container(
decoration: BoxDecoration(
color: Colors.orange[100],
borderRadius:
BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
equipmentSCBoList[index].name!,
style: TextStyle(
fontSize: 12,
color: Colors.orange[900]),
),
),
Positioned(
bottom: 0,
right: 0,
child: Image.asset(
'assets/home/select_check_orange.png',
height: 15,
width: 15),
)
],
)
: Container(
decoration: BoxDecoration(
color: Colors.transparent,
border: Border.all(
color: ColorConst.greyD2Color,
width: 0.7),
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
equipmentSCBoList[index].name!,
style: const TextStyle(
fontSize: 12, color: Colors.black),
),
),
// child: Container(
// decoration: BoxDecoration(
// color: equipmentSCBoList[index].isChecked!
// ? Colors.orange[50]
// : Colors.transparent,
// border: Border.all(
// color: equipmentSCBoList[index].isChecked!
// ? Colors.orange
// : ColorConst.greyD2Color,
// width: 1),
// borderRadius: BorderRadius.circular(3),
// ),
// alignment: Alignment.center,
// child: Text(
// equipmentSCBoList[index].name!,
// style: TextStyle(
// fontSize: 12,
// color: equipmentSCBoList[index].isChecked!
// ? Colors.orange
// : Colors.black),
// ),
// ),
);
},
),
......
......@@ -46,27 +46,11 @@ class _InspectListSyPageState extends State<InspectListSyPage>
List<TaskMonthList> listMonth = [];
var type, unitStatus;
// late AnimationController animationController;
// late Animation<double> animation;
@override
void initState() {
super.initState();
type = widget.args['type'];
unitStatus = StorageUtil.getInstance().getUnitStatus();
// animationController = AnimationController(
// duration: const Duration(seconds: 1),
// vsync: this,
// )..addListener(() {
// setState(() {});
// });
// final curvedAnimation = CurvedAnimation(
// parent: animationController,
// curve: Curves.bounceOut,
// );
// animation = Tween<double>(begin: 0, end: 1).animate(curvedAnimation);
// animationController.forward();
getData();
}
......@@ -220,32 +204,6 @@ class _InspectListSyPageState extends State<InspectListSyPage>
InkWell buildItem(int index, BuildContext context) {
return InkWell(
onTap: () {
// if (type == '1') {
// Get.toNamed(RouteString.DAY_INSPECT_SUBMIT_SY,
// arguments: {'argsData': widget.args, 'listBo': list(index)})
// ?.then((value) {
// if (value != null && value) {
// getData();
// }
// });
// } else if (type == '2') {
// Get.toNamed(RouteString.WEEK_INSPECT_SUBMIT_SY,
// arguments: {'argsData': widget.args, 'listBo': list(index)})
// ?.then((value) {
// if (value != null && value) {
// getData();
// }
// });
// } else if (type == '3') {
// Get.toNamed(RouteString.MONTH_INSPECT_SUBMIT_SY,
// arguments: {'argsData': widget.args, 'listBo': list(index)})
// ?.then((value) {
// if (value != null && value) {
// getData();
// }
// });
// }
if (type == '1') {
Get.toNamed(RouteString.DAY_INSPECT_SUBMIT_SY,
arguments: {'argsData': widget.args, 'listBo': list(index)})
......
// ignore_for_file: prefer_typing_uninitialized_variables, library_private_types_in_public_api, avoid_print, must_be_immutable
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'package:special_equipment_flutter/common/edgeInsets_const.dart';
import 'package:special_equipment_flutter/common/route_string.dart';
import 'package:special_equipment_flutter/dio/http_utils.dart';
import 'package:special_equipment_flutter/model/day_control_list_sy_bo.dart';
import 'package:special_equipment_flutter/model/month_control_list_sy_bo.dart';
import 'package:special_equipment_flutter/model/system_time.dart';
import 'package:special_equipment_flutter/model/week_control_list_sy_bo.dart';
import 'package:special_equipment_flutter/ui/common/basic_information_page.dart';
import 'package:special_equipment_flutter/ui/common/data.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/emptyI_img_widget.dart';
import 'package:special_equipment_flutter/widgets/first_refresh_widget.dart';
import 'package:special_equipment_flutter/widgets/number_to_chinese.dart';
import '../../../../common/color_const.dart';
import '../../../../widgets/custom_button.dart';
import '../../../../widgets/divider_custom.dart';
///使用单位
///日管控、周排查、月调度
///检查列表
class TestInspectListSyPage extends StatefulWidget {
///区分 日管控、周排查、月调度
var args;
/// 定义一个Function属性 ,父页面回调子页面数据
final Function onDataChanged;
TestInspectListSyPage(this.args, {super.key, required this.onDataChanged});
@override
_TestInspectListSyPageState createState() => _TestInspectListSyPageState();
}
class _TestInspectListSyPageState extends State<TestInspectListSyPage>
with SingleTickerProviderStateMixin {
final EasyRefreshController _controller = EasyRefreshController();
List<TaskDayList> listDay = [];
List<TaskWeekList> listWeek = [];
List<TaskMonthList> listMonth = [];
var type, unitStatus;
@override
void initState() {
super.initState();
type = widget.args['type'];
unitStatus = StorageUtil.getInstance().getUnitStatus();
getData();
}
void getData() {
///获取系统时间
HttpUtils.doTime(context).then((value) {
SystemTime systemTime = value;
if (mounted) {
DateTime date = DateTime.fromMillisecondsSinceEpoch(systemTime.time!);
switch (type) {
case '1':
getDayData(date.toString());
break;
case '2':
getWeekData(date.toString());
break;
case '3':
getMonthData(date.toString());
break;
}
}
});
}
// now.toString().substring(0, 19)
///日管控、风险整改、已完成
void getDayData(date) {
HttpUtils.getFindUserAllTaskDayList(
context, '0', date.substring(0, 19), unitStatus)
.then((value) {
DayControlListSyBo listBo = value;
if (mounted) {
setState(() {
var taskDayList = listBo.taskDayList;
listDay.clear();
listDay.addAll(taskDayList!);
///更新红点数字
widget.onDataChanged(listDay.length.toString());
_controller.finishRefresh();
});
}
});
}
///周排查、风险整改、已完成
void getWeekData(date) {
HttpUtils.getFindUserAllTaskWeekList(
context, '0', date.substring(0, 19), unitStatus)
.then((value) {
WeekControlListSyBo listBo = value;
if (mounted) {
setState(() {
var taskWeekList = listBo.taskWeekList;
listWeek.clear();
listWeek.addAll(taskWeekList!);
///更新红点数字
widget.onDataChanged(listWeek.length.toString());
_controller.finishRefresh();
});
}
});
}
///月调度、风险整改、已完成
void getMonthData(date) {
HttpUtils.getFindUserAllTaskMonthList(
context, '0', date.substring(0, 19), unitStatus)
.then((value) {
MonthControlListSyBo listBo = value;
if (mounted) {
setState(() {
var taskMonthList = listBo.taskMonthList;
listMonth.clear();
listMonth.addAll(taskMonthList!);
///更新红点数字
widget.onDataChanged(listMonth.length.toString());
_controller.finishRefresh();
});
}
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey[100],
body: Stack(
children: [
Expanded(
flex: 1,
child: EasyRefresh(
firstRefresh: true,
enableControlFinishRefresh: true,
// enableControlFinishLoad: true,
firstRefreshWidget: const FirstRefreshWidget(),
emptyWidget: listEmpty()
? EmptyImgWidget(
title: '暂无数据,点击刷新',
onTap: () {
getData();
})
: null,
controller: _controller,
onRefresh: () async {
// page = 1;
getData();
},
// onLoad: () async {
// page++;
// getList();
// },
child: buildBody(),
)),
if (_isChecked) ...[
Positioned(
bottom: 0,
right: 0,
left: 0,
child: Container(
color: Colors.white,
height: 50,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
margin: const EdgeInsets.only(left: 30),
child: const Row(
children: [
Text('已选'),
Text('(0)',
style: TextStyle(
color: ColorConst.blueColor)),
],
)),
Container(
margin: const EdgeInsets.only(right: 30),
child: GradientButton(
tapCallback: () {
setState(() {});
},
width: 70,
height: 30,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(5),
topRight: Radius.circular(10),
bottomLeft: Radius.circular(10),
bottomRight: Radius.circular(5)),
disable: false,
colors: const [
ColorConst.blueColor,
Colors.blue
],
child: const Text(
"提交",
style: TextStyle(
fontSize: 13,
color: ColorConst.whiteColor),
))),
],
)
],
),
))
]
],
),
);
}
Column buildBody() {
return Column(
children: [
//文章列表
ListView.separated(
shrinkWrap: true,
padding: const EdgeInsets.symmetric(
horizontal: EdgeInsetsConst.padding_horizontal),
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (BuildContext context, int index) {
return buildItem(index, context);
},
itemCount: listLength()!,
separatorBuilder: (BuildContext context, int index) {
return const SizedBox(
height: 0,
);
},
),
],
);
}
// SizeTransition(
// sizeFactor: animation,
// child: buildItem(index, context),
// );
InkWell buildItem(int index, BuildContext context) {
return InkWell(
onLongPress: () {
setState(() {
_isChecked = true;
});
},
onTap: () {
if (type == '1') {
Get.toNamed(RouteString.DAY_INSPECT_SUBMIT_SY,
arguments: {'argsData': widget.args, 'listBo': list(index)})
?.then((value) {
if (value != null && value) {
getData();
}
});
} else if (type == '2') {
if (listWeek[index].allow == '0') {
Get.toNamed(RouteString.WEEK_INSPECT_SUBMIT_SY,
arguments: {'argsData': widget.args, 'listBo': list(index)})
?.then((value) {
if (value != null && value) {
getData();
}
});
} else {
ToastUtils.showCenter(
'任务解锁时间:本周${ConvertNumberToChineseMoneyWords.toChinese(listWeek[index].timeConfig!.weekBeginDay! - 1)}');
}
} else if (type == '3') {
if (listMonth[index].allow == '0') {
Get.toNamed(RouteString.MONTH_INSPECT_SUBMIT_SY,
arguments: {'argsData': widget.args, 'listBo': list(index)})
?.then((value) {
if (value != null && value) {
getData();
}
});
} else {
ToastUtils.showCenter(
'任务解锁时间:本月${listMonth[index].timeConfig!.monthBeginDay}号');
}
}
},
child: buildCard(context, index),
);
}
Row? buildCard(BuildContext context, int index) {
if (type == '1') {
return buildDaysCard(context, index);
} else if (type == '2') {
// return buildWeekCard(context, index);
} else if (type == '3') {
// return buildMonthsCard(context, index);
}
return null;
}
Card buildWeekCard(BuildContext context, int index) {
return Card(
margin: const EdgeInsets.only(left: 0, right: 0, top: 15, bottom: 0),
elevation: listWeek[index].allow == '0' ? 3 : 0,
color: listWeek[index].allow == '0' ? Colors.white : Colors.grey[300],
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(5)),
),
child: Column(
children: <Widget>[
///任务名称、任务类型
rowTitle(context, index),
///分割线
DividerCustom(Colors.grey[300], 10, 10, 10, 10),
//周
BasicInformationPage(
informationDataList:
DataConfig.syWeekInformationData('1', false, list(index))),
const SizedBox(
height: 5,
)
// buildSubmits(context, index),
],
),
);
}
Card buildMonthsCard(BuildContext context, int index) {
return Card(
margin: const EdgeInsets.only(left: 0, right: 0, top: 15, bottom: 0),
elevation: listMonth[index].allow == '0' ? 3 : 0,
color: listMonth[index].allow == '0' ? Colors.white : Colors.grey[300],
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(5)),
),
child: Column(
children: <Widget>[
///任务名称、任务类型
rowTitle(context, index),
///分割线
DividerCustom(Colors.grey[300], 10, 10, 10, 10),
//月
BasicInformationPage(
informationDataList:
DataConfig.syMonthInformationData('1', false, list(index))),
const SizedBox(
height: 5,
)
// buildSubmits(context, index),
],
),
);
}
bool _isChecked = false;
Row buildDaysCard(BuildContext context, int index) {
return Row(
children: [
Flexible(
flex: 1,
child: Card(
elevation: 3,
margin:
const EdgeInsets.only(left: 0, right: 0, top: 15, bottom: 0),
color: Colors.white,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(5)),
),
child: Column(
children: <Widget>[
///任务名称、任务类型
rowTitle(context, index),
///分割线
DividerCustom(Colors.grey[300], 10, 10, 10, 10),
//日
BasicInformationPage(
informationDataList: DataConfig.syDayInformationData(
'1', false, list(index))),
const SizedBox(
height: 5,
)
// buildSubmits(context, index),
],
),
),
),
if (_isChecked) ...[
Container(
margin: const EdgeInsets.only(left: 5),
width: 25,
height: 25,
child: Transform.scale(
scale: 0.8,
child: Checkbox(
value: _isChecked, // 指定复选框的状态
onChanged: (value) {
setState(() {
_isChecked = value!; // 更新 isChecked 的状态值
});
},
),
),
),
]
],
);
}
//去点检
Container buildSubmits(BuildContext context, int index) {
return Container(
alignment: Alignment.centerRight,
margin: const EdgeInsets.only(top: 0, right: 10, bottom: 10),
child: GradientButton(
tapCallback: () => print("Button Clicked 6"),
width: 75,
height: 25,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(10),
topRight: Radius.circular(20),
bottomLeft: Radius.circular(20),
bottomRight: Radius.circular(10)),
disable: false,
colors: [
index == 1 ? ColorConst.blueColor : ColorConst.orangeColor,
index == 1 ? ColorConst.blue1Color : ColorConst.orange1Color
],
child: const Text(
"去检查",
style: TextStyle(fontSize: 12, color: ColorConst.whiteColor),
),
));
}
//显示任务名称、任务类型
Row rowTitle(BuildContext context, int index) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Container(
margin: const EdgeInsets.fromLTRB(0, 10, 0, 0),
padding: const EdgeInsets.fromLTRB(5, 2, 10, 2),
decoration: BoxDecoration(
color: typeColor(name(index)),
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(0),
topRight: Radius.circular(0),
bottomLeft: Radius.circular(0),
bottomRight: Radius.circular(10)),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
margin: const EdgeInsets.only(left: 3, right: 3, top: 2),
child: Image.asset(
typeImage(name(index)),
width: 18,
height: 18,
),
),
Text(
name(index)!,
style: const TextStyle(
fontSize: 14,
color: Colors.white,
fontWeight: FontWeight.bold),
)
],
),
),
Container(
margin: const EdgeInsets.fromLTRB(8, 8, 0, 0),
child: Text.rich(TextSpan(children: [
TextSpan(
text: titles(index),
style: const TextStyle(
color: ColorConst.blackColor,
fontSize: 20,
fontStyle: FontStyle.italic)),
])),
),
],
),
if (type == '2') ...[
if (listWeek[index].allow == '1') ...[
Container(
margin: const EdgeInsets.only(right: 10),
child: const Icon(
Icons.lock,
),
),
]
] else if (type == '3') ...[
if (listMonth[index].allow == '1') ...[
Container(
margin: const EdgeInsets.only(right: 10),
child: const Icon(
Icons.lock,
),
),
]
]
],
);
}
String? titles(index) {
///使用单位
if (unitStatus == '1') {
///日(日显示编码,周、月显示周期、月份)
if (type == '1') {
return listDay[index].device!.code;
} else {
return setBeginTime(type, beginTime(index));
}
} else {
///生产单位
return setBeginTime(type, beginTime(index));
}
}
dynamic beginTime(index) {
switch (type) {
case '1':
return listDay[index].beginTime;
case '2':
return listWeek[index].beginTime;
case '3':
return listMonth[index].beginTime;
}
return listDay[index].beginTime;
}
dynamic listEmpty() {
switch (type) {
case '1':
return listDay.isEmpty;
case '2':
return listWeek.isEmpty;
case '3':
return listMonth.isEmpty;
}
return listDay.isEmpty;
}
dynamic list(index) {
switch (type) {
case '1':
return listDay[index];
case '2':
return listWeek[index];
case '3':
return listMonth[index];
}
return listDay[index];
}
int? listLength() {
switch (type) {
case '1':
return listDay.length;
case '2':
return listWeek.length;
case '3':
return listMonth.length;
}
return listDay.length;
}
dynamic name(index) {
switch (type) {
case '1':
return listDay[index].deviceType!.name;
case '2':
return listWeek[index].deviceType!.name;
case '3':
return listMonth[index].deviceType!.name;
}
return listDay[index].deviceType!.name;
}
}
......@@ -5,6 +5,7 @@ import 'package:get/get.dart';
import 'package:special_equipment_flutter/common/color_const.dart';
import 'package:special_equipment_flutter/dio/http_utils.dart';
import 'package:special_equipment_flutter/model/count_bo.dart';
import 'package:special_equipment_flutter/ui/sy/list/test_inspect_list_sy_page.dart';
import 'package:special_equipment_flutter/utils/storage_util.dart';
import '../../widgets/app_bar/custom_app_bar.dart';
......@@ -79,6 +80,11 @@ class _SyTabPageState extends State<SyTabPage> {
num1 = data;
});
}),
// TestInspectListSyPage(widget.args, onDataChanged: (data) {
// setState(() {
// num1 = data;
// });
// }),
RiskListSyPage(widget.args, onDataChanged: (data) {
setState(() {
num2 = data;
......
// import 'package:flutter/material.dart';
// import 'package:special_equipment_flutter/common/color_const.dart';
// import 'package:special_equipment_flutter/model/device_list_bo.dart';
// import 'package:special_equipment_flutter/model/find_charge_list_bo.dart';
// import 'package:special_equipment_flutter/widgets/app_bar/custom_app_bar.dart';
//
// ///公司-首页-设备人员对比表格
// class EquipmentPersonnelPage extends StatefulWidget {
// Data? deviceData;
//
// List<ChargeUserList>? chargeList = [];
//
// EquipmentPersonnelPage({super.key, this.deviceData, this.chargeList});
//
// @override
// State<EquipmentPersonnelPage> createState() => _EquipmentPersonnelPageState();
// }
//
// class _EquipmentPersonnelPageState extends State<EquipmentPersonnelPage> {
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// appBar: AppBarCustom(text: 'cesjo', height: 50),
// body: Table(
// border: TableBorder.all(color: ColorConst.blueColor),
// textBaseline: TextBaseline.alphabetic,
// defaultVerticalAlignment: TableCellVerticalAlignment.middle,
// columnWidths: const {
// 0: FixedColumnWidth(130),
// 1: FixedColumnWidth(80),
// // 2: FixedColumnWidth(65),
// // 3: FixedColumnWidth(50)
// },
// children: [
// TableRow(children: [
// buildTableTitle(name: '设备名称', color: ColorConst.blueColor),
// ]),
// TableRow(children: [
// Table(
// border:
// TableBorder.all(color: ColorConst.blueColor, width: 0.5),
// children: [
// for (var item in deviceDataSyList!) ...[
// TableRow(children: [
// Center(
// child: Container(
// height: 30,
// padding:
// const EdgeInsets.only(top: 5, bottom: 5),
// child: Text(item.name!,
// style: const TextStyle(fontSize: 14)))),
// ]),
// ],
// ]),
//
// ///使用单位:主要负责人内容
// GestureDetector(
// onTap: () {
// // onTapSyCharge!();
// },
// child: Center(
// child: Padding(
// padding: const EdgeInsets.all(5.0),
// child: Text(chargeList!.isNotEmpty ? '✔' : '✘',
// style: TextStyle(
// fontSize: 13,
// color: chargeList!.isNotEmpty
// ? Colors.black
// : Colors.red)),
// )),
// ),
//
// ///使用单位:安全总监内容
// Table(
// border:
// TableBorder.all(color: ColorConst.blueColor, width: 0.5),
// children: [
// for (var item in deviceDataSyList!) ...[
// TableRow(children: [
// GestureDetector(
// onTap: () {
// // onTapSyDirector!();
// },
// child: Center(
// child: Container(
// height: 30,
// padding: const EdgeInsets.only(top: 5, bottom: 5),
// child: Text(
// item.safetyDirector!.isNotEmpty ? '✔' : '✘',
// style: TextStyle(
// fontSize: 13,
// color: item.safetyDirector!.isNotEmpty
// ? Colors.black
// : Colors.red)),
// )),
// ),
// ]),
// ]
// ]),
//
// ///使用单位:安全员内容
// Table(
// border: TableBorder.all(color: ColorConst.blueColor),
// children: [
// for (var item in deviceDataSyList!) ...[
// TableRow(children: [
// GestureDetector(
// onTap: () {
// // onTapSyOfficer!();
// },
// child: Center(
// child: Container(
// height: 30,
// padding: const EdgeInsets.only(top: 5, bottom: 5),
// child: Text(
// item.safetyOfficer!.isNotEmpty ? '✔' : '✘',
// style: TextStyle(
// fontSize: 13,
// color: item.safetyOfficer!.isNotEmpty
// ? Colors.black
// : Colors.red)),
// )),
// ),
// ]),
// ]
// ]),
// ]),
// ]),
// );
// }
//
// Center buildTableTitle({color, name}) {
// return Center(
// child: Padding(
// padding: const EdgeInsets.only(top: 8, bottom: 8),
// child: Text(name,
// style: TextStyle(
// fontWeight: FontWeight.bold, color: color, fontSize: 14)),
// ),
// );
// }
// }
......@@ -362,28 +362,70 @@ class _UnitSettingsPageState extends State<UnitSettingsPage> {
!equipmentSYBoList[index].isChecked!;
});
},
child: Container(
decoration: BoxDecoration(
color: equipmentSYBoList[index].isChecked!
? Colors.blue[50]
: Colors.transparent,
border: Border.all(
color: equipmentSYBoList[index].isChecked!
? Colors.blue
: ColorConst.greyD2Color,
width: 1),
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
equipmentSYBoList[index].name!,
style: TextStyle(
fontSize: 12,
color: equipmentSYBoList[index].isChecked!
? Colors.blue
: Colors.black),
),
),
child: equipmentSYBoList[index].isChecked!
? Stack(
children: [
Container(
decoration: BoxDecoration(
color: Colors.blue[100],
borderRadius:
BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
equipmentSYBoList[index].name!,
style: const TextStyle(
fontSize: 12, color: Colors.blue),
),
),
Positioned(
bottom: 0,
right: 0,
child: Image.asset(
'assets/home/select_check_blue.png',
height: 15,
width: 15),
)
],
)
: Container(
decoration: BoxDecoration(
color: Colors.transparent,
border: Border.all(
color: ColorConst.greyD2Color,
width: 0.7),
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
equipmentSYBoList[index].name!,
style: const TextStyle(
fontSize: 12, color: Colors.black),
),
),
// child: Container(
// decoration: BoxDecoration(
// color: equipmentSYBoList[index].isChecked!
// ? Colors.blue[50]
// : Colors.transparent,
// border: Border.all(
// color: equipmentSYBoList[index].isChecked!
// ? Colors.blue
// : ColorConst.greyD2Color,
// width: 1),
// borderRadius: BorderRadius.circular(3),
// ),
// alignment: Alignment.center,
// child: Text(
// equipmentSYBoList[index].name!,
// style: TextStyle(
// fontSize: 12,
// color: equipmentSYBoList[index].isChecked!
// ? Colors.blue
// : Colors.black),
// ),
// ),
);
},
),
......@@ -431,28 +473,72 @@ class _UnitSettingsPageState extends State<UnitSettingsPage> {
!equipmentSCBoList[index].isChecked!;
});
},
child: Container(
decoration: BoxDecoration(
color: equipmentSCBoList[index].isChecked!
? Colors.orange[50]
: Colors.transparent,
border: Border.all(
color: equipmentSCBoList[index].isChecked!
? Colors.orange
: ColorConst.greyD2Color,
width: 1),
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
equipmentSCBoList[index].name!,
style: TextStyle(
fontSize: 12,
color: equipmentSCBoList[index].isChecked!
? Colors.orange
: Colors.black),
),
),
child: equipmentSCBoList[index].isChecked!
? Stack(
children: [
Container(
decoration: BoxDecoration(
color: Colors.orange[100],
borderRadius:
BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
equipmentSCBoList[index].name!,
style: TextStyle(
fontSize: 12,
color: Colors.orange[900]),
),
),
Positioned(
bottom: 0,
right: 0,
child: Image.asset(
'assets/home/select_check_orange.png',
height: 15,
width: 15),
)
],
)
: Container(
decoration: BoxDecoration(
color: Colors.transparent,
border: Border.all(
color: ColorConst.greyD2Color,
width: 0.7),
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
equipmentSCBoList[index].name!,
style: const TextStyle(
fontSize: 12, color: Colors.black),
),
),
// child: Container(
// decoration: BoxDecoration(
// color: equipmentSCBoList[index].isChecked!
// ? Colors.orange[50]
// : Colors.transparent,
// border: Border.all(
// color: equipmentSCBoList[index].isChecked!
// ? Colors.orange
// : ColorConst.greyD2Color,
// width: 1),
// borderRadius: BorderRadius.circular(3),
// ),
// alignment: Alignment.center,
// child: Text(
// equipmentSCBoList[index].name!,
// style: TextStyle(
// fontSize: 12,
// color: equipmentSCBoList[index].isChecked!
// ? Colors.orange
// : Colors.black),
// ),
// ),
);
},
),
......
......@@ -440,28 +440,68 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
!newSyList(index)![subIndex].check!;
});
},
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),
),
),
child: newSyList(index)![subIndex].check!
? Stack(
children: [
Container(
decoration: BoxDecoration(
color: Colors.blue[100],
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
newSyList(index)![subIndex].name!,
style: const TextStyle(
fontSize: 12, color: Colors.blue),
),
),
Positioned(
bottom: 0,
right: 0,
child: Image.asset(
'assets/home/select_check_blue.png',
height: 15,
width: 15),
)
],
)
: Container(
decoration: BoxDecoration(
color: Colors.transparent,
border: Border.all(
color: ColorConst.greyD2Color,
width: 0.7),
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
newSyList(index)![subIndex].name!,
style: const TextStyle(
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),
// ),
// ),
);
},
),
......@@ -493,28 +533,69 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
!newScList(index)![subIndex].check!;
});
},
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),
),
),
child: newScList(index)![subIndex].check!
? Stack(
children: [
Container(
decoration: BoxDecoration(
color: Colors.orange[100],
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
newScList(index)![subIndex].name!,
style: TextStyle(
fontSize: 12,
color: Colors.orange[900]),
),
),
Positioned(
bottom: 0,
right: 0,
child: Image.asset(
'assets/home/select_check_orange.png',
height: 15,
width: 15),
)
],
)
: Container(
decoration: BoxDecoration(
color: Colors.transparent,
border: Border.all(
color: ColorConst.greyD2Color,
width: 0.7),
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
newScList(index)![subIndex].name!,
style: const TextStyle(
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),
// ),
// ),
);
},
),
......@@ -650,7 +731,6 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
),
),
),
if (editList!.roleDtoList![index].check! &&
editList!.roleDtoList![index].userDtoList!.isNotEmpty) ...[
Container(
......@@ -691,28 +771,69 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
!userDtoSyList(index)![subIndex].check!;
});
},
child: Container(
decoration: BoxDecoration(
color: userDtoSyList(index)![subIndex].check!
? Colors.blue[50]
: Colors.transparent,
border: Border.all(
color: userDtoSyList(index)![subIndex].check!
? Colors.blue
: ColorConst.greyD2Color,
width: 1),
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
userDtoSyList(index)![subIndex].name!,
style: TextStyle(
fontSize: 12,
color: userDtoSyList(index)![subIndex].check!
? Colors.blue
: Colors.black),
),
),
child: userDtoSyList(index)![subIndex].check!
? Stack(
children: [
Container(
decoration: BoxDecoration(
color: Colors.blue[100],
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
userDtoSyList(index)![subIndex].name!,
style: const TextStyle(
fontSize: 12, color: Colors.blue),
),
),
Positioned(
bottom: 0,
right: 0,
child: Image.asset(
'assets/home/select_check_blue.png',
height: 15,
width: 15),
)
],
)
: Container(
decoration: BoxDecoration(
color: Colors.transparent,
border: Border.all(
color: ColorConst.greyD2Color,
width: 0.7),
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
userDtoSyList(index)![subIndex].name!,
style: const TextStyle(
fontSize: 12, color: Colors.black),
),
),
// child: Container(
// decoration: BoxDecoration(
// color: userDtoSyList(index)![subIndex].check!
// ? Colors.blue[50]
// : Colors.transparent,
// border: Border.all(
// color: userDtoSyList(index)![subIndex].check!
// ? Colors.blue
// : ColorConst.greyD2Color,
// width: 1),
// borderRadius: BorderRadius.circular(3),
// ),
// alignment: Alignment.center,
// child: Text(
// userDtoSyList(index)![subIndex].name!,
// style: TextStyle(
// fontSize: 12,
// color: userDtoSyList(index)![subIndex].check!
// ? Colors.blue
// : Colors.black),
// ),
// ),
);
},
),
......@@ -744,28 +865,70 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
!userDtoScList(index)![subIndex].check!;
});
},
child: Container(
decoration: BoxDecoration(
color: userDtoScList(index)![subIndex].check!
? Colors.orange[50]
: Colors.transparent,
border: Border.all(
color: userDtoScList(index)![subIndex].check!
? Colors.orange
: ColorConst.greyD2Color,
width: 1),
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
userDtoScList(index)![subIndex].name!,
style: TextStyle(
fontSize: 12,
color: userDtoScList(index)![subIndex].check!
? Colors.orange
: Colors.black),
),
),
child: userDtoScList(index)![subIndex].check!
? Stack(
children: [
Container(
decoration: BoxDecoration(
color: Colors.orange[100],
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
userDtoScList(index)![subIndex].name!,
style: TextStyle(
fontSize: 12,
color: Colors.orange[900]),
),
),
Positioned(
bottom: 0,
right: 0,
child: Image.asset(
'assets/home/select_check_orange.png',
height: 15,
width: 15),
)
],
)
: Container(
decoration: BoxDecoration(
color: Colors.transparent,
border: Border.all(
color: ColorConst.greyD2Color,
width: 0.7),
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
userDtoScList(index)![subIndex].name!,
style: const TextStyle(
fontSize: 12, color: Colors.black),
),
),
// child: Container(
// decoration: BoxDecoration(
// color: userDtoScList(index)![subIndex].check!
// ? Colors.orange[50]
// : Colors.transparent,
// border: Border.all(
// color: userDtoScList(index)![subIndex].check!
// ? Colors.orange
// : ColorConst.greyD2Color,
// width: 1),
// borderRadius: BorderRadius.circular(3),
// ),
// alignment: Alignment.center,
// child: Text(
// userDtoScList(index)![subIndex].name!,
// style: TextStyle(
// fontSize: 12,
// color: userDtoScList(index)![subIndex].check!
// ? Colors.orange
// : Colors.black),
// ),
// ),
);
},
),
......@@ -773,13 +936,6 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
),
),
],
// GridViewAQZJList(
// equipmentSYBoList:
// allRolesList[index].officeDtoSYList,
// equipmentSCBoList:
// allRolesList[index].officeDtoSCList,
// isVisbliy: allRolesList[index].isChecked)
],
);
},
......
......@@ -120,6 +120,8 @@ flutter:
- assets/home/unit_settings_icon.png
- assets/home/user_settings_icon.png
- assets/home/user_easyico_icon.png
- assets/home/select_check_blue.png
- assets/home/select_check_orange.png
- assets/spalsh.jpeg
# 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