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 =
if(isDemoMode == false){ await Storage.getBool(ifIsDemoModeOrNot);
Get.toNamed(Routers.checkingInSetPage, arguments: { if (isDemoMode == false) {
"getKeyInfosData": state.getKeyInfosData.value, Get.toNamed(Routers.checkingInSetPage,
}); arguments: <String, LockListInfoItemEntity>{
}else{ 'getKeyInfosData': state.getKeyInfosData.value,
// Get.toNamed(Routers.selectLockTypePage); });
logic.showToast("演示模式"); } else {
} // Get.toNamed(Routers.selectLockTypePage);
}, 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 =
if(isDemoMode == false){ await Storage.getBool(ifIsDemoModeOrNot);
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(
@ -113,37 +128,47 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
// height: 100.h, // height: 100.h,
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,
SizedBox(height: 10.h), style: TextStyle(
Visibility( color: state.isDay.value
visible: state.isDay.value, ? AppColors.mainColor
child: Container( : Colors.black,
width: 20.w, fontSize: 22.sp)),
height: 2.h, SizedBox(height: 10.h),
color: state.isDay.value ? AppColors.mainColor : Colors.black Visibility(
), visible: state.isDay.value,
) child: Container(
], width: 20.w,
)), height: 2.h,
color: state.isDay.value
? AppColors.mainColor
: Colors.black),
)
],
)),
), ),
), ),
// SizedBox(width: 20.w,), // SizedBox(width: 20.w,),
GestureDetector( GestureDetector(
onTap: () async { onTap: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); final bool? isDemoMode =
if(isDemoMode == false){ await Storage.getBool(ifIsDemoModeOrNot);
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(
@ -151,49 +176,76 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
// height: 100.h, // height: 100.h,
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(
SizedBox(height: 10.h), TranslationLoader
Visibility( .lanKeys!.monthlyLeaderboard!.tr,
visible: !state.isDay.value, style: TextStyle(
child: Container(width: 20.w, height: 2.h, color: !state.isDay.value ? AppColors.mainColor : Colors.black)) color: !state.isDay.value
], ? AppColors.mainColor
)), : Colors.black,
fontSize: 22.sp)),
SizedBox(height: 10.h),
Visibility(
visible: !state.isDay.value,
child: Container(
width: 20.w,
height: 2.h,
color: !state.isDay.value
? AppColors.mainColor
: Colors.black))
],
)),
), ),
), ),
], ],
), ),
GestureDetector( GestureDetector(
onTap: () async { onTap: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); final bool? isDemoMode =
if(isDemoMode == false){ await Storage.getBool(ifIsDemoModeOrNot);
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();
}); });
}); });
}); });
}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,
),
], ],
), ),
) )
@ -207,110 +259,151 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
Widget middleDayInfo() { Widget middleDayInfo() {
return Obx(() => Visibility( return Obx(() => Visibility(
visible: state.isDay.value, visible: state.isDay.value,
child: Container( child: Container(
height: 80.h, height: 80.h,
color: Colors.white, color: Colors.white,
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,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: <Widget>[
SizedBox(height: 5.h), Column(
Text(state.lateTimes.value, style: TextStyle(color: Colors.black, fontSize: 20.sp)), mainAxisAlignment: MainAxisAlignment.spaceAround,
Text(TranslationLoader.lanKeys!.beLate!.tr, style: TextStyle(color: Colors.black, fontSize: 22.sp)), children: <Widget>[
SizedBox(height: 5.h), SizedBox(height: 5.h),
Text(state.lateTimes.value,
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),
],
),
Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
SizedBox(height: 5.h),
Text(state.earlyTimes.value,
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),
],
),
Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
SizedBox(height: 5.h),
Text(state.noPunchTimes.value,
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),
],
),
], ],
), ),
Column( ),
mainAxisAlignment: MainAxisAlignment.spaceAround, ));
children: [
SizedBox(height: 5.h),
Text(state.earlyTimes.value, 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),
],
),
Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
SizedBox(height: 5.h),
Text(state.noPunchTimes.value, 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),
],
),
],
),
),
));
} }
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();
} }
} }
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];
// "getKeyInfosData": state.getKeyInfosData.value, return _checkingInListItem(
"companyId": state.companyId.value, index,
"staffId": attendanceRecordList.staffId, attendanceRecordList.headurl,
"staffName": attendanceRecordList.staffName, attendanceRecordList.staffName,
attendanceRecordList.attendanceType, () {
Get.toNamed(Routers.checkingInDetailPage,
arguments: <String, Object?>{
// "getKeyInfosData": state.getKeyInfosData.value,
'companyId': state.companyId.value,
'staffId': attendanceRecordList.staffId,
'staffName': attendanceRecordList.staffName,
});
}); });
}); },
}, separatorBuilder: (BuildContext context, int index) {
separatorBuilder: (context, 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,
separatorBuilder: (context, index) { arguments: <String, Object?>{
return const Divider(height: 1, color: AppColors.greyLineColor); 'companyId': state.companyId.value,
}, 'staffId': attendanceRecordList.staffId,
) : NoData(noDataHeight: 1.sh - - ScreenUtil().statusBarHeight - 280.h - 90.h,)); 'staffName': attendanceRecordList.staffName,
});
});
},
separatorBuilder: (BuildContext context, int index) {
return const Divider(height: 1, color: AppColors.greyLineColor);
},
)
: 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,35 +439,71 @@ 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(
// width: 200.w, // width: 200.w,
// height: 60.h, // height: 60.h,
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,
)
],
),
)),
); );
} }
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,39 +521,39 @@ 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();
}); });
}); });
} }
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,12 +40,14 @@ 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(
'getKeyInfosData': state.getKeyInfosData.value, Routers.checkingInAddStaffPage,
'companyId': state.companyId.value, arguments: <String, Object>{
'isAdd': '1', 'getKeyInfosData': state.getKeyInfosData.value,
}); 'companyId': state.companyId.value,
if(data != null) { 'isAdd': '1',
});
if (data != null) {
logic.getStaffList(); logic.getStaffList();
} }
}, },
@ -59,65 +63,76 @@ 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 =
return Slidable( state.staffListData[index];
key:ValueKey(staffListItem.staffId), return Slidable(
endActionPane: ActionPane( key: ValueKey<int?>(staffListItem.staffId),
extentRatio: 0.2, endActionPane: ActionPane(
motion: const ScrollMotion(), extentRatio: 0.2,
children: <Widget>[ motion: const ScrollMotion(),
SlidableAction( children: <Widget>[
onPressed: (BuildContext context){ SlidableAction(
// 1APP 2 3 4 5 onPressed: (BuildContext context) {
if(staffListItem.attendanceType == 1){ // 1APP 2 3 4 5
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除员工钥匙'.tr, (bool isAllData) { if (staffListItem.attendanceType == 1) {
logic.deletStaff(staffListItem.staffId!, (isAllData ? 1 : 0)); ShowTipView()
}); .showDeleteAdministratorIsHaveAllDataDialog(
}else{ '同时删除员工钥匙'.tr, (bool isAllData) {
ShowTipView().showIosTipWithContentDialog('确定要删除员工吗?'.tr, () { logic.deletStaff(staffListItem.staffId!,
logic.deletStaff(staffListItem.staffId!, 0); (isAllData ? 1 : 0));
}); });
// showIosTipViewDialog(staffListItem.staffId!, context); } else {
} ShowTipView().showIosTipWithContentDialog(
}, '确定要删除员工吗?'.tr, () {
backgroundColor: Colors.red, logic.deletStaff(staffListItem.staffId!, 0);
foregroundColor: Colors.white, });
label: '删除'.tr, // showIosTipViewDialog(staffListItem.staffId!, context);
padding: EdgeInsets.only(left: 5.w, right: 5.w), }
), },
], backgroundColor: Colors.red,
), foregroundColor: Colors.white,
child: _checkingInStaffManageItem(staffListItem, () { label: '删除'.tr,
Get.toNamed(Routers.checkingInStaffDetailPage, arguments: <String, Object>{ padding: EdgeInsets.only(left: 5.w, right: 5.w),
'staffListItem': staffListItem, ),
'getKeyInfosData': state.getKeyInfosData.value, ],
'companyId': state.companyId.value, ),
}); child: _checkingInStaffManageItem(staffListItem, () {
}), Get.toNamed(Routers.checkingInStaffDetailPage,
); arguments: <String, Object>{
'staffListItem': staffListItem,
'getKeyInfosData': state.getKeyInfosData.value,
'companyId': state.companyId.value,
});
}),
);
// return _checkingInStaffManageItem(staffListItem, () { // return _checkingInStaffManageItem(staffListItem, () {
// Get.toNamed(Routers.checkingInStaffDetailPage, arguments: { // Get.toNamed(Routers.checkingInStaffDetailPage, arguments: {
// "staffListItem": staffListItem, // "staffListItem": staffListItem,
// "getKeyInfosData": state.getKeyInfosData.value, // "getKeyInfosData": state.getKeyInfosData.value,
// "companyId": state.companyId.value, // "companyId": state.companyId.value,
// }); // });
// }); // });
}, },
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,
) : NoData()), color: AppColors.greyLineColor);
},
),
)
: 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)),
), ),
), ),
], ],
@ -170,19 +191,19 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
String title = 'images/controls_user.png'; String title = 'images/controls_user.png';
switch (type) { switch (type) {
case 1: case 1:
// //
title = 'images/controls_user.png'; title = 'images/controls_user.png';
break; break;
case 2: case 2:
// //
title = 'images/icon_password.png'; title = 'images/icon_password.png';
break; break;
case 3: case 3:
// ic卡 // ic卡
title = 'images/icon_card.png'; title = 'images/icon_card.png';
break; break;
case 4: case 4:
// //
title = 'images/icon_fingerprint.png'; title = 'images/icon_fingerprint.png';
break; break;
default: default:
@ -191,23 +212,22 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
return title; return title;
} }
// void showIosTipViewDialog(int staffId, BuildContext context) { // void showIosTipViewDialog(int staffId, BuildContext context) {
// showDialog( // showDialog(
// context: context, // context: context,
// builder: (BuildContext context) { // builder: (BuildContext context) {
// return ShowIosTipView( // return ShowIosTipView(
// title: "提示", // title: "提示",
// tipTitle: "确定要删除员工吗?", // tipTitle: "确定要删除员工吗?",
// sureClick: () async { // sureClick: () async {
// Get.back(); // Get.back();
// logic.deletStaff(staffId, 0); // logic.deletStaff(staffId, 0);
// }, // },
// cancelClick: () { // cancelClick: () {
// Get.back(); // Get.back();
// }, // },
// ); // );
// }, // },
// ); // );
// } // }
} }