fix:修复 开锁页-考勤-日榜和月榜列表里姓名前的图像都一样,应和员工列表里一样区分,另APP如有头像应显示头像

This commit is contained in:
anfe 2024-05-20 15:04:13 +08:00
parent faf006c677
commit 04d2dde5eb
2 changed files with 450 additions and 294 deletions

View File

@ -3,6 +3,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/checkingIn/checkingInList/checkingInListMonth_entity.dart'; import 'package:star_lock/main/lockDetail/checkingIn/checkingInList/checkingInListMonth_entity.dart';
import 'package:star_lock/main/lockDetail/checkingIn/checkingInList/checkingInList_state.dart';
import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart';
import '../../../../appRouters.dart'; import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
@ -23,8 +25,8 @@ class CheckingInListPage extends StatefulWidget {
} }
class _CheckingInListPageState extends State<CheckingInListPage> { class _CheckingInListPageState extends State<CheckingInListPage> {
final logic = Get.put(CheckingInListLogic()); final CheckingInListLogic logic = Get.put(CheckingInListLogic());
final state = Get.find<CheckingInListLogic>().state; final CheckingInListState state = Get.find<CheckingInListLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -35,26 +37,33 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
titleWidget: titleWidget(), titleWidget: titleWidget(),
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
actionsList: [ actionsList: <Widget>[
(state.getKeyInfosData.value.keyRight == 1) ? (state.getKeyInfosData.value.keyRight == 1)
GestureDetector( ? GestureDetector(
onTap: () async { onTap: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); final bool? isDemoMode =
await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) { if (isDemoMode == false) {
Get.toNamed(Routers.checkingInSetPage, arguments: { Get.toNamed(Routers.checkingInSetPage,
"getKeyInfosData": state.getKeyInfosData.value, arguments: <String, LockListInfoItemEntity>{
'getKeyInfosData': state.getKeyInfosData.value,
}); });
} else { } else {
// Get.toNamed(Routers.selectLockTypePage); // Get.toNamed(Routers.selectLockTypePage);
logic.showToast("演示模式"); logic.showToast('演示模式');
} }
}, },
child: Image.asset('images/main/icon_lockDetail_checkIn_set.png', width: 36.w, height: 36.w,)) : Container(), child: Image.asset(
'images/main/icon_lockDetail_checkIn_set.png',
width: 36.w,
height: 36.w,
))
: Container(),
SizedBox(width: 30.w), SizedBox(width: 30.w),
], ],
), ),
body: Column( body: Column(
children: [ children: <Widget>[
topInfo(), topInfo(),
SizedBox(height: 10.h), SizedBox(height: 10.h),
middleDayInfo(), middleDayInfo(),
@ -70,7 +79,7 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
// height: 280.h, // height: 280.h,
color: Colors.white, color: Colors.white,
child: Column( child: Column(
children: [ children: <Widget>[
SizedBox(height: 30.h), SizedBox(height: 30.h),
Obx(() => Container( Obx(() => Container(
width: 110.w, width: 110.w,
@ -80,32 +89,38 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
color: AppColors.mainColor, color: AppColors.mainColor,
borderRadius: BorderRadius.circular(60.w), borderRadius: BorderRadius.circular(60.w),
), ),
child: Image.asset(getTopImg(), width: 120.w, height: 120.w) child: Image.asset(getTopImg(), width: 120.w, height: 120.w))),
)),
SizedBox(height: 10.h), SizedBox(height: 10.h),
Obx(() => Text(getTopTitle(), style: TextStyle(color: Colors.black, fontSize: 24.sp))), Obx(() => Text(getTopTitle(),
style: TextStyle(color: Colors.black, fontSize: 24.sp))),
SizedBox(height: 30.h), SizedBox(height: 30.h),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: <Widget>[
// SizedBox(width: 30.w,), // SizedBox(width: 30.w,),
Row( Row(
children: [ children: <Widget>[
SizedBox(width: 20.w,), SizedBox(
width: 20.w,
),
GestureDetector( GestureDetector(
onTap: () async { onTap: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); final bool? isDemoMode =
await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) { if (isDemoMode == false) {
setState(() { setState(() {
state.isDay.value = true; state.isDay.value = true;
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(state.checkListDateTimestamp.value); final DateTime dateTime =
String beginDate = formatDate(dateTime, [mm,'-',dd]); DateTime.fromMillisecondsSinceEpoch(
state.checkListDateTimestamp.value);
final String beginDate =
formatDate(dateTime, <String>[mm, '-', dd]);
state.checkListDate.value = beginDate; state.checkListDate.value = beginDate;
logic.loadDataByType(); logic.loadDataByType();
}); });
} else { } else {
// Get.toNamed(Routers.selectLockTypePage); // Get.toNamed(Routers.selectLockTypePage);
logic.showToast("演示模式"); logic.showToast('演示模式');
} }
}, },
child: Container( child: Container(
@ -114,16 +129,22 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
color: Colors.white, color: Colors.white,
child: Obx(() => Column( child: Obx(() => Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: <Widget>[
Text(TranslationLoader.lanKeys!.dailyCharts!.tr, style: TextStyle(color: state.isDay.value ? AppColors.mainColor : Colors.black, fontSize: 22.sp)), Text(TranslationLoader.lanKeys!.dailyCharts!.tr,
style: TextStyle(
color: state.isDay.value
? AppColors.mainColor
: Colors.black,
fontSize: 22.sp)),
SizedBox(height: 10.h), SizedBox(height: 10.h),
Visibility( Visibility(
visible: state.isDay.value, visible: state.isDay.value,
child: Container( child: Container(
width: 20.w, width: 20.w,
height: 2.h, height: 2.h,
color: state.isDay.value ? AppColors.mainColor : Colors.black color: state.isDay.value
), ? AppColors.mainColor
: Colors.black),
) )
], ],
)), )),
@ -132,18 +153,22 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
// SizedBox(width: 20.w,), // SizedBox(width: 20.w,),
GestureDetector( GestureDetector(
onTap: () async { onTap: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); final bool? isDemoMode =
await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) { if (isDemoMode == false) {
setState(() { setState(() {
state.isDay.value = false; state.isDay.value = false;
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(state.checkListDateTimestamp.value); final DateTime dateTime =
String beginDate = formatDate(dateTime, [mm]); DateTime.fromMillisecondsSinceEpoch(
state.checkListDateTimestamp.value);
final String beginDate =
formatDate(dateTime, <String>[mm]);
state.checkListDate.value = beginDate; state.checkListDate.value = beginDate;
logic.loadDataByType(); logic.loadDataByType();
}); });
} else { } else {
// Get.toNamed(Routers.selectLockTypePage); // Get.toNamed(Routers.selectLockTypePage);
logic.showToast("演示模式"); logic.showToast('演示模式');
} }
}, },
child: Container( child: Container(
@ -152,12 +177,24 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
color: Colors.white, color: Colors.white,
child: Obx(() => Column( child: Obx(() => Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: <Widget>[
Text(TranslationLoader.lanKeys!.monthlyLeaderboard!.tr, style: TextStyle(color: !state.isDay.value ? AppColors.mainColor : Colors.black, fontSize: 22.sp)), Text(
TranslationLoader
.lanKeys!.monthlyLeaderboard!.tr,
style: TextStyle(
color: !state.isDay.value
? AppColors.mainColor
: Colors.black,
fontSize: 22.sp)),
SizedBox(height: 10.h), SizedBox(height: 10.h),
Visibility( Visibility(
visible: !state.isDay.value, visible: !state.isDay.value,
child: Container(width: 20.w, height: 2.h, color: !state.isDay.value ? AppColors.mainColor : Colors.black)) child: Container(
width: 20.w,
height: 2.h,
color: !state.isDay.value
? AppColors.mainColor
: Colors.black))
], ],
)), )),
), ),
@ -166,17 +203,23 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
), ),
GestureDetector( GestureDetector(
onTap: () async { onTap: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); final bool? isDemoMode =
await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) { if (isDemoMode == false) {
await showDialog( await showDialog(
context: Get.context!, context: Get.context!,
builder: (context) { builder: (BuildContext context) {
return ShowCalendar( return ShowCalendar(
datePickerMode: DatePickerMode.day, datePickerMode: DatePickerMode.day,
selectAction: (dateTime) { selectAction: (DateTime dateTime) {
setState(() { setState(() {
state.checkListDateTimestamp.value = dateTime.millisecondsSinceEpoch; state.checkListDateTimestamp.value =
String beginDate = formatDate(dateTime, state.isDay.value ? [mm,'-',dd] : [mm]); dateTime.millisecondsSinceEpoch;
final String beginDate = formatDate(
dateTime,
state.isDay.value
? <String>[mm, '-', dd]
: <String>[mm]);
state.checkListDate.value = beginDate; state.checkListDate.value = beginDate;
logic.loadDataByType(); logic.loadDataByType();
Get.back(); Get.back();
@ -185,15 +228,24 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
}); });
} else { } else {
// Get.toNamed(Routers.selectLockTypePage); // Get.toNamed(Routers.selectLockTypePage);
logic.showToast("演示模式"); logic.showToast('演示模式');
} }
}, },
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: <Widget>[
Text(state.checkListDate.value, style: TextStyle(color: Colors.black, fontSize: 22.sp),), Text(
Image.asset('images/icon_grayPullDown.png', width: 50.w, height: 30.w,), state.checkListDate.value,
SizedBox(width: 10.w,), style: TextStyle(color: Colors.black, fontSize: 22.sp),
),
Image.asset(
'images/icon_grayPullDown.png',
width: 50.w,
height: 30.w,
),
SizedBox(
width: 10.w,
),
], ],
), ),
) )
@ -214,31 +266,37 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
margin: EdgeInsets.only(left: 15.h, right: 15.h, bottom: 10.h), margin: EdgeInsets.only(left: 15.h, right: 15.h, bottom: 10.h),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: <Widget>[
Column( Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: <Widget>[
SizedBox(height: 5.h), SizedBox(height: 5.h),
Text(state.lateTimes.value, style: TextStyle(color: Colors.black, fontSize: 20.sp)), Text(state.lateTimes.value,
Text(TranslationLoader.lanKeys!.beLate!.tr, style: TextStyle(color: Colors.black, fontSize: 22.sp)), style: TextStyle(color: Colors.black, fontSize: 20.sp)),
Text(TranslationLoader.lanKeys!.beLate!.tr,
style: TextStyle(color: Colors.black, fontSize: 22.sp)),
SizedBox(height: 5.h), SizedBox(height: 5.h),
], ],
), ),
Column( Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: <Widget>[
SizedBox(height: 5.h), SizedBox(height: 5.h),
Text(state.earlyTimes.value, style: TextStyle(color: Colors.black, fontSize: 20.sp)), Text(state.earlyTimes.value,
Text(TranslationLoader.lanKeys!.leaveEarly!.tr, style: TextStyle(color: Colors.black, fontSize: 22.sp)), style: TextStyle(color: Colors.black, fontSize: 20.sp)),
Text(TranslationLoader.lanKeys!.leaveEarly!.tr,
style: TextStyle(color: Colors.black, fontSize: 22.sp)),
SizedBox(height: 5.h), SizedBox(height: 5.h),
], ],
), ),
Column( Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: <Widget>[
SizedBox(height: 5.h), SizedBox(height: 5.h),
Text(state.noPunchTimes.value, style: TextStyle(color: Colors.black, fontSize: 20.sp)), Text(state.noPunchTimes.value,
Text(TranslationLoader.lanKeys!.noCardPunched!.tr, style: TextStyle(color: Colors.black, fontSize: 22.sp)), style: TextStyle(color: Colors.black, fontSize: 20.sp)),
Text(TranslationLoader.lanKeys!.noCardPunched!.tr,
style: TextStyle(color: Colors.black, fontSize: 22.sp)),
SizedBox(height: 5.h), SizedBox(height: 5.h),
], ],
), ),
@ -249,7 +307,8 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
} }
Widget getBottomList() { Widget getBottomList() {
if((state.isDay.value == true && (state.listType.value == "1")) || (state.isDay.value == true && (state.listType.value == "2"))){ if ((state.isDay.value == true && (state.listType.value == '1')) ||
(state.isDay.value == true && (state.listType.value == '2'))) {
return bottomDayList(); return bottomDayList();
} else { } else {
return bottomMonthList(); return bottomMonthList();
@ -257,60 +316,94 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
} }
Widget bottomDayList() { Widget bottomDayList() {
return Obx(() => state.checkingInDayListData.value.isNotEmpty ? ListView.separated( return Obx(() => state.checkingInDayListData.isNotEmpty
itemCount: state.checkingInDayListData.value.length, ? ListView.separated(
itemBuilder: (c, index) { itemCount: state.checkingInDayListData.length,
AttendanceRecordDayList attendanceRecordList= state.checkingInDayListData.value[index]; itemBuilder: (BuildContext c, int index) {
return _checkingInListItem(index, attendanceRecordList.headurl, attendanceRecordList.staffName, () { final AttendanceRecordDayList attendanceRecordList =
Get.toNamed(Routers.checkingInDetailPage, arguments: { state.checkingInDayListData[index];
return _checkingInListItem(
index,
attendanceRecordList.headurl,
attendanceRecordList.staffName,
attendanceRecordList.attendanceType, () {
Get.toNamed(Routers.checkingInDetailPage,
arguments: <String, Object?>{
// "getKeyInfosData": state.getKeyInfosData.value, // "getKeyInfosData": state.getKeyInfosData.value,
"companyId": state.companyId.value, 'companyId': state.companyId.value,
"staffId": attendanceRecordList.staffId, 'staffId': attendanceRecordList.staffId,
"staffName": attendanceRecordList.staffName, 'staffName': attendanceRecordList.staffName,
}); });
}); });
}, },
separatorBuilder: (context, index) { separatorBuilder: (BuildContext context, int index) {
return const Divider(height: 1, color: AppColors.greyLineColor); return const Divider(height: 1, color: AppColors.greyLineColor);
}, },
) : NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight*2 - 64.h - 280.h - 90.h,)); )
: NoData(
noDataHeight:
1.sh - ScreenUtil().statusBarHeight * 2 - 64.h - 280.h - 90.h,
));
} }
Widget bottomMonthList() { Widget bottomMonthList() {
return Obx(() => state.checkingInMonthListData.value.isNotEmpty ? ListView.separated( return Obx(() => state.checkingInMonthListData.isNotEmpty
itemCount: state.checkingInMonthListData.value.length, ? ListView.separated(
itemBuilder: (c, index) { itemCount: state.checkingInMonthListData.length,
AttendanceRecordMonthList attendanceRecordList= state.checkingInMonthListData.value[index]; itemBuilder: (BuildContext c, int index) {
return _checkingInListItem(index, attendanceRecordList.headurl, attendanceRecordList.staffName, () { final AttendanceRecordMonthList attendanceRecordList =
Get.toNamed(Routers.checkingInDetailPage, arguments: { state.checkingInMonthListData[index];
"companyId": state.companyId.value, return _checkingInListItem(
"staffId": attendanceRecordList.staffId, index,
"staffName": attendanceRecordList.staffName, attendanceRecordList.headurl,
attendanceRecordList.staffName,
attendanceRecordList.attendanceType, () {
Get.toNamed(Routers.checkingInDetailPage,
arguments: <String, Object?>{
'companyId': state.companyId.value,
'staffId': attendanceRecordList.staffId,
'staffName': attendanceRecordList.staffName,
}); });
}); });
}, },
separatorBuilder: (context, index) { separatorBuilder: (BuildContext context, int index) {
return const Divider(height: 1, color: AppColors.greyLineColor); return const Divider(height: 1, color: AppColors.greyLineColor);
}, },
) : NoData(noDataHeight: 1.sh - - ScreenUtil().statusBarHeight - 280.h - 90.h,)); )
: NoData(
noDataHeight: 1.sh - -ScreenUtil().statusBarHeight - 280.h - 90.h,
));
} }
Widget _checkingInListItem(int index, String? headUrl, String? name, Function() action) { Widget _checkingInListItem(
int index, String? headUrl, String? name, int? type, Function() action) {
return GestureDetector( return GestureDetector(
onTap: action, onTap: action,
child: Container( child: Container(
// height: 80.h, // height: 80.h,
padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 10.h, bottom: 10.h), padding:
EdgeInsets.only(left: 20.w, right: 20.w, top: 10.h, bottom: 10.h),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(10.w), borderRadius: BorderRadius.circular(10.w),
), ),
child: Row( child: Row(
children: [ children: <Widget>[
SizedBox(width: 20.w,), SizedBox(
Text("${index+1}", style: TextStyle(fontSize: 20.sp),), width: 20.w,
SizedBox(width: 20.w,), ),
Image.asset('images/controls_user.png', width: 60.w, height: 60.w,), Text(
'${index + 1}',
style: TextStyle(fontSize: 20.sp),
),
SizedBox(
width: 20.w,
),
Image.asset(
getTypeIcon(type ?? 0),
width: 60.w,
height: 60.w,
),
// Container( // Container(
// width: 60.h, // width: 60.h,
// height: 60.h, // height: 60.h,
@ -328,10 +421,17 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
// )), // )),
SizedBox(width: 20.w), SizedBox(width: 20.w),
Expanded( Expanded(
child: Text(name!, style: TextStyle(fontSize: 24.sp),), child: Text(
name!,
style: TextStyle(fontSize: 24.sp),
),
), ),
SizedBox(width: 20.h), SizedBox(width: 20.h),
Image.asset("images/icon_right_grey.png", width: 21.w, height: 21.w,), Image.asset(
'images/icon_right_grey.png',
width: 21.w,
height: 21.w,
),
SizedBox(width: 20.h), SizedBox(width: 20.h),
], ],
), ),
@ -339,15 +439,41 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
); );
} }
// 1APP 2 3 4
String getTypeIcon(int type) {
String title = 'images/controls_user.png';
switch (type) {
case 1:
//
title = 'images/controls_user.png';
break;
case 2:
//
title = 'images/icon_password.png';
break;
case 3:
// ic卡
title = 'images/icon_card.png';
break;
case 4:
//
title = 'images/icon_fingerprint.png';
break;
default:
break;
}
return title;
}
Widget titleWidget() { Widget titleWidget() {
return GestureDetector( return GestureDetector(
onTap: () async { onTap: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) { if (isDemoMode == false) {
showListType(); showListType();
} else { } else {
// Get.toNamed(Routers.selectLockTypePage); // Get.toNamed(Routers.selectLockTypePage);
logic.showToast("演示模式"); logic.showToast('演示模式');
} }
}, },
child: Obx(() => Container( child: Obx(() => Container(
@ -356,10 +482,20 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
color: AppColors.mainColor, color: AppColors.mainColor,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: <Widget>[
Text(state.listTypeStr.value, style: TextStyle(color: Colors.white, fontSize: 26.sp),), Text(
SizedBox(width: 5.w,), state.listTypeStr.value,
Image.asset('images/main/icon_lockDetail_checkIn_topTitle.png', width: 22.w, height: 16.w, fit: BoxFit.fill,) style: TextStyle(color: Colors.white, fontSize: 26.sp),
),
SizedBox(
width: 5.w,
),
Image.asset(
'images/main/icon_lockDetail_checkIn_topTitle.png',
width: 22.w,
height: 16.w,
fit: BoxFit.fill,
)
], ],
), ),
)), )),
@ -367,7 +503,7 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
} }
void showListType() { void showListType() {
var list = [ final List<String> list = <String>[
TranslationLoader.lanKeys!.earlyArrivalList!.tr, TranslationLoader.lanKeys!.earlyArrivalList!.tr,
TranslationLoader.lanKeys!.lateList!.tr, TranslationLoader.lanKeys!.lateList!.tr,
TranslationLoader.lanKeys!.hardWorkingList!.tr TranslationLoader.lanKeys!.hardWorkingList!.tr
@ -385,16 +521,16 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
//adapter: PickerAdapter(), //adapter: PickerAdapter(),
data: list, data: list,
// //
clickCallBack: (int index, var str) { clickCallBack: (int index, Object str) {
setState(() { setState(() {
state.listTypeStr.value = str.toString(); state.listTypeStr.value = str.toString();
state.isDay.value = true; state.isDay.value = true;
if (index == 0) { if (index == 0) {
state.listType.value = "1"; state.listType.value = '1';
} else if (index == 1) { } else if (index == 1) {
state.listType.value = "2"; state.listType.value = '2';
} else if (index == 2) { } else if (index == 2) {
state.listType.value = "3"; state.listType.value = '3';
} }
logic.loadDataByType(); logic.loadDataByType();
}); });
@ -402,22 +538,22 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
} }
String getTopImg() { String getTopImg() {
if(state.listType.value == "1"){ if (state.listType.value == '1') {
return "images/main/icon_lockDetail_checkInRanking_zd.png"; return 'images/main/icon_lockDetail_checkInRanking_zd.png';
}else if(state.listType.value == "2"){ } else if (state.listType.value == '2') {
return "images/main/icon_lockDetail_checkInRanking_cd.png"; return 'images/main/icon_lockDetail_checkInRanking_cd.png';
} else { } else {
return "images/main/icon_lockDetail_checkInRanking_qf.png"; return 'images/main/icon_lockDetail_checkInRanking_qf.png';
} }
} }
String getTopTitle() { String getTopTitle() {
if(state.listType.value == "1"){ if (state.listType.value == '1') {
return "无考勤记录"; return '无考勤记录';
}else if(state.listType.value == "2"){ } else if (state.listType.value == '2') {
return "大家干劲十足"; return '大家干劲十足';
} else { } else {
return "工作时长未出炉"; return '工作时长未出炉';
} }
} }
} }

View File

@ -24,8 +24,10 @@ class CheckingInStaffListPage extends StatefulWidget {
} }
class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> { class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
final CheckingInStaffManageLogic logic = Get.put(CheckingInStaffManageLogic()); final CheckingInStaffManageLogic logic =
final CheckingInStaffManageState state = Get.find<CheckingInStaffManageLogic>().state; Get.put(CheckingInStaffManageLogic());
final CheckingInStaffManageState state =
Get.find<CheckingInStaffManageLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -38,7 +40,9 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
actionsList: <Widget>[ actionsList: <Widget>[
GestureDetector( GestureDetector(
onTap: () async { onTap: () async {
final dynamic data = await Get.toNamed(Routers.checkingInAddStaffPage, arguments: <String, Object>{ final dynamic data = await Get.toNamed(
Routers.checkingInAddStaffPage,
arguments: <String, Object>{
'getKeyInfosData': state.getKeyInfosData.value, 'getKeyInfosData': state.getKeyInfosData.value,
'companyId': state.companyId.value, 'companyId': state.companyId.value,
'isAdd': '1', 'isAdd': '1',
@ -59,14 +63,15 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
), ),
body: Container( body: Container(
color: Colors.white, color: Colors.white,
child: Obx(() => state.staffListData.value.isNotEmpty ? child: Obx(() => state.staffListData.isNotEmpty
SlidableAutoCloseBehavior( ? SlidableAutoCloseBehavior(
child: ListView.separated( child: ListView.separated(
itemCount: state.staffListData.value.length, itemCount: state.staffListData.length,
itemBuilder: (BuildContext c, int index) { itemBuilder: (BuildContext c, int index) {
final CheckingInAddStaffListItemEntity staffListItem = state.staffListData[index]; final CheckingInAddStaffListItemEntity staffListItem =
state.staffListData[index];
return Slidable( return Slidable(
key:ValueKey(staffListItem.staffId), key: ValueKey<int?>(staffListItem.staffId),
endActionPane: ActionPane( endActionPane: ActionPane(
extentRatio: 0.2, extentRatio: 0.2,
motion: const ScrollMotion(), motion: const ScrollMotion(),
@ -75,11 +80,15 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
onPressed: (BuildContext context) { onPressed: (BuildContext context) {
// 1APP 2 3 4 5 // 1APP 2 3 4 5
if (staffListItem.attendanceType == 1) { if (staffListItem.attendanceType == 1) {
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除员工钥匙'.tr, (bool isAllData) { ShowTipView()
logic.deletStaff(staffListItem.staffId!, (isAllData ? 1 : 0)); .showDeleteAdministratorIsHaveAllDataDialog(
'同时删除员工钥匙'.tr, (bool isAllData) {
logic.deletStaff(staffListItem.staffId!,
(isAllData ? 1 : 0));
}); });
} else { } else {
ShowTipView().showIosTipWithContentDialog('确定要删除员工吗?'.tr, () { ShowTipView().showIosTipWithContentDialog(
'确定要删除员工吗?'.tr, () {
logic.deletStaff(staffListItem.staffId!, 0); logic.deletStaff(staffListItem.staffId!, 0);
}); });
// showIosTipViewDialog(staffListItem.staffId!, context); // showIosTipViewDialog(staffListItem.staffId!, context);
@ -93,7 +102,8 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
], ],
), ),
child: _checkingInStaffManageItem(staffListItem, () { child: _checkingInStaffManageItem(staffListItem, () {
Get.toNamed(Routers.checkingInStaffDetailPage, arguments: <String, Object>{ Get.toNamed(Routers.checkingInStaffDetailPage,
arguments: <String, Object>{
'staffListItem': staffListItem, 'staffListItem': staffListItem,
'getKeyInfosData': state.getKeyInfosData.value, 'getKeyInfosData': state.getKeyInfosData.value,
'companyId': state.companyId.value, 'companyId': state.companyId.value,
@ -110,14 +120,19 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
// }); // });
}, },
separatorBuilder: (BuildContext context, int index) { separatorBuilder: (BuildContext context, int index) {
return Divider(height: 1.h, indent: 20.w, color: AppColors.greyLineColor); return Divider(
height: 1.h,
indent: 20.w,
color: AppColors.greyLineColor);
}, },
), ),
) : NoData()), )
: NoData()),
)); ));
} }
Widget _checkingInStaffManageItem(CheckingInAddStaffListItemEntity staffListItem, Function() action) { Widget _checkingInStaffManageItem(
CheckingInAddStaffListItemEntity staffListItem, Function() action) {
return GestureDetector( return GestureDetector(
onTap: action, onTap: action,
child: Container( child: Container(
@ -127,10 +142,15 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
margin: EdgeInsets.only(right: 10.w, top: 10.h, bottom: 10.h), margin: EdgeInsets.only(right: 10.w, top: 10.h, bottom: 10.h),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
SizedBox(width: 20.w,), SizedBox(
width: 20.w,
),
// CustomNetworkImage(url: staffListItem.headurl!, width: 40.w , height: 40.w), // CustomNetworkImage(url: staffListItem.headurl!, width: 40.w , height: 40.w),
Image.asset(getTypeIcon(staffListItem.attendanceType!), width: 60.w, height: 60.w), Image.asset(getTypeIcon(staffListItem.attendanceType!),
SizedBox(width: 20.w,), width: 60.w, height: 60.w),
SizedBox(
width: 20.w,
),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
@ -139,22 +159,23 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
child: Text(staffListItem.staffName!, child: Text(staffListItem.staffName!,
// maxLines: 1, // maxLines: 1,
// overflow: TextOverflow.ellipsis, // overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 24.sp) style: TextStyle(fontSize: 24.sp))),
)
),
Visibility( Visibility(
visible: staffListItem.cardStatus == 1 ? true : false, visible: staffListItem.cardStatus == 1,
child: SizedBox(height: 5.h,) child: SizedBox(
), height: 5.h,
)),
Visibility( Visibility(
visible: staffListItem.cardStatus == 1 ? true : false, visible: staffListItem.cardStatus == 1,
child: Container( child: Container(
padding: EdgeInsets.only(right: 5.w, left: 5.w), padding: EdgeInsets.only(right: 5.w, left: 5.w),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.w), borderRadius: BorderRadius.circular(5.w),
color: AppColors.openPassageModeColor, color: AppColors.openPassageModeColor,
), ),
child: Text('打卡方式无效'.tr, style: TextStyle(fontSize: 18.sp, color: AppColors.appBarIconColor)), child: Text('打卡方式无效'.tr,
style: TextStyle(
fontSize: 18.sp, color: AppColors.appBarIconColor)),
), ),
), ),
], ],
@ -209,5 +230,4 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
// }, // },
// ); // );
// } // }
} }