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:get/get.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 '../../../../app_settings/app_colors.dart';
@ -23,8 +25,8 @@ class CheckingInListPage extends StatefulWidget {
}
class _CheckingInListPageState extends State<CheckingInListPage> {
final logic = Get.put(CheckingInListLogic());
final state = Get.find<CheckingInListLogic>().state;
final CheckingInListLogic logic = Get.put(CheckingInListLogic());
final CheckingInListState state = Get.find<CheckingInListLogic>().state;
@override
Widget build(BuildContext context) {
@ -35,26 +37,33 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
titleWidget: titleWidget(),
haveBack: true,
backgroundColor: AppColors.mainColor,
actionsList: [
(state.getKeyInfosData.value.keyRight == 1) ?
GestureDetector(
onTap: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if(isDemoMode == false){
Get.toNamed(Routers.checkingInSetPage, arguments: {
"getKeyInfosData": state.getKeyInfosData.value,
});
}else{
// Get.toNamed(Routers.selectLockTypePage);
logic.showToast("演示模式");
}
},
child: Image.asset('images/main/icon_lockDetail_checkIn_set.png', width: 36.w, height: 36.w,)) : Container(),
actionsList: <Widget>[
(state.getKeyInfosData.value.keyRight == 1)
? GestureDetector(
onTap: () async {
final bool? isDemoMode =
await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
Get.toNamed(Routers.checkingInSetPage,
arguments: <String, LockListInfoItemEntity>{
'getKeyInfosData': state.getKeyInfosData.value,
});
} else {
// Get.toNamed(Routers.selectLockTypePage);
logic.showToast('演示模式');
}
},
child: Image.asset(
'images/main/icon_lockDetail_checkIn_set.png',
width: 36.w,
height: 36.w,
))
: Container(),
SizedBox(width: 30.w),
],
),
body: Column(
children: [
children: <Widget>[
topInfo(),
SizedBox(height: 10.h),
middleDayInfo(),
@ -70,7 +79,7 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
// height: 280.h,
color: Colors.white,
child: Column(
children: [
children: <Widget>[
SizedBox(height: 30.h),
Obx(() => Container(
width: 110.w,
@ -80,32 +89,38 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
color: AppColors.mainColor,
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),
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),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
children: <Widget>[
// SizedBox(width: 30.w,),
Row(
children: [
SizedBox(width: 20.w,),
children: <Widget>[
SizedBox(
width: 20.w,
),
GestureDetector(
onTap: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if(isDemoMode == false){
final bool? isDemoMode =
await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
setState(() {
state.isDay.value = true;
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(state.checkListDateTimestamp.value);
String beginDate = formatDate(dateTime, [mm,'-',dd]);
final DateTime dateTime =
DateTime.fromMillisecondsSinceEpoch(
state.checkListDateTimestamp.value);
final String beginDate =
formatDate(dateTime, <String>[mm, '-', dd]);
state.checkListDate.value = beginDate;
logic.loadDataByType();
});
}else{
} else {
// Get.toNamed(Routers.selectLockTypePage);
logic.showToast("演示模式");
logic.showToast('演示模式');
}
},
child: Container(
@ -113,37 +128,47 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
// height: 100.h,
color: Colors.white,
child: Obx(() => Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Text(TranslationLoader.lanKeys!.dailyCharts!.tr, style: TextStyle(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
),
)
],
)),
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Text(TranslationLoader.lanKeys!.dailyCharts!.tr,
style: TextStyle(
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),
)
],
)),
),
),
// SizedBox(width: 20.w,),
GestureDetector(
onTap: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if(isDemoMode == false){
final bool? isDemoMode =
await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
setState(() {
state.isDay.value = false;
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(state.checkListDateTimestamp.value);
String beginDate = formatDate(dateTime, [mm]);
final DateTime dateTime =
DateTime.fromMillisecondsSinceEpoch(
state.checkListDateTimestamp.value);
final String beginDate =
formatDate(dateTime, <String>[mm]);
state.checkListDate.value = beginDate;
logic.loadDataByType();
});
}else{
} else {
// Get.toNamed(Routers.selectLockTypePage);
logic.showToast("演示模式");
logic.showToast('演示模式');
}
},
child: Container(
@ -151,49 +176,76 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
// height: 100.h,
color: Colors.white,
child: Obx(() => Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Text(TranslationLoader.lanKeys!.monthlyLeaderboard!.tr, style: TextStyle(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))
],
)),
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Text(
TranslationLoader
.lanKeys!.monthlyLeaderboard!.tr,
style: TextStyle(
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(
onTap: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if(isDemoMode == false){
final bool? isDemoMode =
await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
await showDialog(
context: Get.context!,
builder: (context) {
builder: (BuildContext context) {
return ShowCalendar(
datePickerMode: DatePickerMode.day,
selectAction: (dateTime) {
selectAction: (DateTime dateTime) {
setState(() {
state.checkListDateTimestamp.value = dateTime.millisecondsSinceEpoch;
String beginDate = formatDate(dateTime, state.isDay.value ? [mm,'-',dd] : [mm]);
state.checkListDateTimestamp.value =
dateTime.millisecondsSinceEpoch;
final String beginDate = formatDate(
dateTime,
state.isDay.value
? <String>[mm, '-', dd]
: <String>[mm]);
state.checkListDate.value = beginDate;
logic.loadDataByType();
Get.back();
});
});
});
}else{
} else {
// Get.toNamed(Routers.selectLockTypePage);
logic.showToast("演示模式");
logic.showToast('演示模式');
}
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(state.checkListDate.value, style: TextStyle(color: Colors.black, fontSize: 22.sp),),
Image.asset('images/icon_grayPullDown.png', width: 50.w, height: 30.w,),
SizedBox(width: 10.w,),
children: <Widget>[
Text(
state.checkListDate.value,
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() {
return Obx(() => Visibility(
visible: state.isDay.value,
child: Container(
height: 80.h,
color: Colors.white,
margin: EdgeInsets.only(left: 15.h, right: 15.h, bottom: 10.h),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Column(
visible: state.isDay.value,
child: Container(
height: 80.h,
color: Colors.white,
margin: EdgeInsets.only(left: 15.h, right: 15.h, bottom: 10.h),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
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),
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
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(){
if((state.isDay.value == true && (state.listType.value == "1")) || (state.isDay.value == true && (state.listType.value == "2"))){
Widget getBottomList() {
if ((state.isDay.value == true && (state.listType.value == '1')) ||
(state.isDay.value == true && (state.listType.value == '2'))) {
return bottomDayList();
}else{
} else {
return bottomMonthList();
}
}
Widget bottomDayList() {
return Obx(() => state.checkingInDayListData.value.isNotEmpty ? ListView.separated(
itemCount: state.checkingInDayListData.value.length,
itemBuilder: (c, index) {
AttendanceRecordDayList attendanceRecordList= state.checkingInDayListData.value[index];
return _checkingInListItem(index, attendanceRecordList.headurl, attendanceRecordList.staffName, () {
Get.toNamed(Routers.checkingInDetailPage, arguments: {
// "getKeyInfosData": state.getKeyInfosData.value,
"companyId": state.companyId.value,
"staffId": attendanceRecordList.staffId,
"staffName": attendanceRecordList.staffName,
return Obx(() => state.checkingInDayListData.isNotEmpty
? ListView.separated(
itemCount: state.checkingInDayListData.length,
itemBuilder: (BuildContext c, int index) {
final AttendanceRecordDayList attendanceRecordList =
state.checkingInDayListData[index];
return _checkingInListItem(
index,
attendanceRecordList.headurl,
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: (context, index) {
return const Divider(height: 1, color: AppColors.greyLineColor);
},
) : NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight*2 - 64.h - 280.h - 90.h,));
},
separatorBuilder: (BuildContext context, int index) {
return const Divider(height: 1, color: AppColors.greyLineColor);
},
)
: NoData(
noDataHeight:
1.sh - ScreenUtil().statusBarHeight * 2 - 64.h - 280.h - 90.h,
));
}
Widget bottomMonthList() {
return Obx(() => state.checkingInMonthListData.value.isNotEmpty ? ListView.separated(
itemCount: state.checkingInMonthListData.value.length,
itemBuilder: (c, index) {
AttendanceRecordMonthList attendanceRecordList= state.checkingInMonthListData.value[index];
return _checkingInListItem(index, attendanceRecordList.headurl, attendanceRecordList.staffName, () {
Get.toNamed(Routers.checkingInDetailPage, arguments: {
"companyId": state.companyId.value,
"staffId": attendanceRecordList.staffId,
"staffName": attendanceRecordList.staffName,
});
});
},
separatorBuilder: (context, index) {
return const Divider(height: 1, color: AppColors.greyLineColor);
},
) : NoData(noDataHeight: 1.sh - - ScreenUtil().statusBarHeight - 280.h - 90.h,));
return Obx(() => state.checkingInMonthListData.isNotEmpty
? ListView.separated(
itemCount: state.checkingInMonthListData.length,
itemBuilder: (BuildContext c, int index) {
final AttendanceRecordMonthList attendanceRecordList =
state.checkingInMonthListData[index];
return _checkingInListItem(
index,
attendanceRecordList.headurl,
attendanceRecordList.staffName,
attendanceRecordList.attendanceType, () {
Get.toNamed(Routers.checkingInDetailPage,
arguments: <String, Object?>{
'companyId': state.companyId.value,
'staffId': attendanceRecordList.staffId,
'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(
onTap: action,
child: Container(
// 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(
color: Colors.white,
borderRadius: BorderRadius.circular(10.w),
),
child: Row(
children: [
SizedBox(width: 20.w,),
Text("${index+1}", style: TextStyle(fontSize: 20.sp),),
SizedBox(width: 20.w,),
Image.asset('images/controls_user.png', width: 60.w, height: 60.w,),
children: <Widget>[
SizedBox(
width: 20.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(
// width: 60.h,
// height: 60.h,
@ -328,10 +421,17 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
// )),
SizedBox(width: 20.w),
Expanded(
child: Text(name!, style: TextStyle(fontSize: 24.sp),),
child: Text(
name!,
style: TextStyle(fontSize: 24.sp),
),
),
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),
],
),
@ -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() {
return GestureDetector(
onTap: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if(isDemoMode == false){
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
showListType();
}else{
} else {
// Get.toNamed(Routers.selectLockTypePage);
logic.showToast("演示模式");
logic.showToast('演示模式');
}
},
child: Obx(() => Container(
// width: 200.w,
// height: 60.h,
color: AppColors.mainColor,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(state.listTypeStr.value, 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,)
],
),
)),
// width: 200.w,
// height: 60.h,
color: AppColors.mainColor,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
state.listTypeStr.value,
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() {
var list = [
final List<String> list = <String>[
TranslationLoader.lanKeys!.earlyArrivalList!.tr,
TranslationLoader.lanKeys!.lateList!.tr,
TranslationLoader.lanKeys!.hardWorkingList!.tr
@ -385,39 +521,39 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
//adapter: PickerAdapter(),
data: list,
//
clickCallBack: (int index, var str) {
setState(() {
state.listTypeStr.value = str.toString();
state.isDay.value = true;
if(index == 0){
state.listType.value = "1";
}else if(index == 1){
state.listType.value = "2";
}else if(index == 2){
state.listType.value = "3";
}
logic.loadDataByType();
});
});
clickCallBack: (int index, Object str) {
setState(() {
state.listTypeStr.value = str.toString();
state.isDay.value = true;
if (index == 0) {
state.listType.value = '1';
} else if (index == 1) {
state.listType.value = '2';
} else if (index == 2) {
state.listType.value = '3';
}
logic.loadDataByType();
});
});
}
String getTopImg(){
if(state.listType.value == "1"){
return "images/main/icon_lockDetail_checkInRanking_zd.png";
}else if(state.listType.value == "2"){
return "images/main/icon_lockDetail_checkInRanking_cd.png";
}else{
return "images/main/icon_lockDetail_checkInRanking_qf.png";
String getTopImg() {
if (state.listType.value == '1') {
return 'images/main/icon_lockDetail_checkInRanking_zd.png';
} else if (state.listType.value == '2') {
return 'images/main/icon_lockDetail_checkInRanking_cd.png';
} else {
return 'images/main/icon_lockDetail_checkInRanking_qf.png';
}
}
String getTopTitle(){
if(state.listType.value == "1"){
return "无考勤记录";
}else if(state.listType.value == "2"){
return "大家干劲十足";
}else{
return "工作时长未出炉";
String getTopTitle() {
if (state.listType.value == '1') {
return '无考勤记录';
} else if (state.listType.value == '2') {
return '大家干劲十足';
} else {
return '工作时长未出炉';
}
}
}

View File

@ -24,8 +24,10 @@ class CheckingInStaffListPage extends StatefulWidget {
}
class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
final CheckingInStaffManageLogic logic = Get.put(CheckingInStaffManageLogic());
final CheckingInStaffManageState state = Get.find<CheckingInStaffManageLogic>().state;
final CheckingInStaffManageLogic logic =
Get.put(CheckingInStaffManageLogic());
final CheckingInStaffManageState state =
Get.find<CheckingInStaffManageLogic>().state;
@override
Widget build(BuildContext context) {
@ -38,12 +40,14 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
actionsList: <Widget>[
GestureDetector(
onTap: () async {
final dynamic data = await Get.toNamed(Routers.checkingInAddStaffPage, arguments: <String, Object>{
'getKeyInfosData': state.getKeyInfosData.value,
'companyId': state.companyId.value,
'isAdd': '1',
});
if(data != null) {
final dynamic data = await Get.toNamed(
Routers.checkingInAddStaffPage,
arguments: <String, Object>{
'getKeyInfosData': state.getKeyInfosData.value,
'companyId': state.companyId.value,
'isAdd': '1',
});
if (data != null) {
logic.getStaffList();
}
},
@ -59,65 +63,76 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
),
body: Container(
color: Colors.white,
child: Obx(() => state.staffListData.value.isNotEmpty ?
SlidableAutoCloseBehavior(
child: ListView.separated(
itemCount: state.staffListData.value.length,
itemBuilder: (BuildContext c, int index) {
final CheckingInAddStaffListItemEntity staffListItem = state.staffListData[index];
return Slidable(
key:ValueKey(staffListItem.staffId),
endActionPane: ActionPane(
extentRatio: 0.2,
motion: const ScrollMotion(),
children: <Widget>[
SlidableAction(
onPressed: (BuildContext context){
// 1APP 2 3 4 5
if(staffListItem.attendanceType == 1){
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除员工钥匙'.tr, (bool isAllData) {
logic.deletStaff(staffListItem.staffId!, (isAllData ? 1 : 0));
});
}else{
ShowTipView().showIosTipWithContentDialog('确定要删除员工吗?'.tr, () {
logic.deletStaff(staffListItem.staffId!, 0);
});
// showIosTipViewDialog(staffListItem.staffId!, context);
}
},
backgroundColor: Colors.red,
foregroundColor: Colors.white,
label: '删除'.tr,
padding: EdgeInsets.only(left: 5.w, right: 5.w),
),
],
child: Obx(() => state.staffListData.isNotEmpty
? SlidableAutoCloseBehavior(
child: ListView.separated(
itemCount: state.staffListData.length,
itemBuilder: (BuildContext c, int index) {
final CheckingInAddStaffListItemEntity staffListItem =
state.staffListData[index];
return Slidable(
key: ValueKey<int?>(staffListItem.staffId),
endActionPane: ActionPane(
extentRatio: 0.2,
motion: const ScrollMotion(),
children: <Widget>[
SlidableAction(
onPressed: (BuildContext context) {
// 1APP 2 3 4 5
if (staffListItem.attendanceType == 1) {
ShowTipView()
.showDeleteAdministratorIsHaveAllDataDialog(
'同时删除员工钥匙'.tr, (bool isAllData) {
logic.deletStaff(staffListItem.staffId!,
(isAllData ? 1 : 0));
});
} else {
ShowTipView().showIosTipWithContentDialog(
'确定要删除员工吗?'.tr, () {
logic.deletStaff(staffListItem.staffId!, 0);
});
// showIosTipViewDialog(staffListItem.staffId!, context);
}
},
backgroundColor: Colors.red,
foregroundColor: Colors.white,
label: '删除'.tr,
padding: EdgeInsets.only(left: 5.w, right: 5.w),
),
],
),
child: _checkingInStaffManageItem(staffListItem, () {
Get.toNamed(Routers.checkingInStaffDetailPage,
arguments: <String, Object>{
'staffListItem': staffListItem,
'getKeyInfosData': state.getKeyInfosData.value,
'companyId': state.companyId.value,
});
}),
);
// return _checkingInStaffManageItem(staffListItem, () {
// Get.toNamed(Routers.checkingInStaffDetailPage, arguments: {
// "staffListItem": staffListItem,
// "getKeyInfosData": state.getKeyInfosData.value,
// "companyId": state.companyId.value,
// });
// });
},
separatorBuilder: (BuildContext context, int index) {
return Divider(
height: 1.h,
indent: 20.w,
color: AppColors.greyLineColor);
},
),
child: _checkingInStaffManageItem(staffListItem, () {
Get.toNamed(Routers.checkingInStaffDetailPage, arguments: <String, Object>{
'staffListItem': staffListItem,
'getKeyInfosData': state.getKeyInfosData.value,
'companyId': state.companyId.value,
});
}),
);
// return _checkingInStaffManageItem(staffListItem, () {
// Get.toNamed(Routers.checkingInStaffDetailPage, arguments: {
// "staffListItem": staffListItem,
// "getKeyInfosData": state.getKeyInfosData.value,
// "companyId": state.companyId.value,
// });
// });
},
separatorBuilder: (BuildContext context, int index) {
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(
onTap: action,
child: Container(
@ -127,10 +142,15 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
margin: EdgeInsets.only(right: 10.w, top: 10.h, bottom: 10.h),
child: Row(
children: <Widget>[
SizedBox(width: 20.w,),
SizedBox(
width: 20.w,
),
// CustomNetworkImage(url: staffListItem.headurl!, width: 40.w , height: 40.w),
Image.asset(getTypeIcon(staffListItem.attendanceType!), width: 60.w, height: 60.w),
SizedBox(width: 20.w,),
Image.asset(getTypeIcon(staffListItem.attendanceType!),
width: 60.w, height: 60.w),
SizedBox(
width: 20.w,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
@ -139,22 +159,23 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
child: Text(staffListItem.staffName!,
// maxLines: 1,
// overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 24.sp)
)
),
style: TextStyle(fontSize: 24.sp))),
Visibility(
visible: staffListItem.cardStatus == 1 ? true : false,
child: SizedBox(height: 5.h,)
),
visible: staffListItem.cardStatus == 1,
child: SizedBox(
height: 5.h,
)),
Visibility(
visible: staffListItem.cardStatus == 1 ? true : false,
visible: staffListItem.cardStatus == 1,
child: Container(
padding: EdgeInsets.only(right: 5.w, left: 5.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.w),
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';
switch (type) {
case 1:
//
//
title = 'images/controls_user.png';
break;
case 2:
//
//
title = 'images/icon_password.png';
break;
case 3:
// ic卡
// ic卡
title = 'images/icon_card.png';
break;
case 4:
//
//
title = 'images/icon_fingerprint.png';
break;
default:
@ -191,23 +212,22 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
return title;
}
// void showIosTipViewDialog(int staffId, BuildContext context) {
// showDialog(
// context: context,
// builder: (BuildContext context) {
// return ShowIosTipView(
// title: "提示",
// tipTitle: "确定要删除员工吗?",
// sureClick: () async {
// Get.back();
// logic.deletStaff(staffId, 0);
// },
// cancelClick: () {
// Get.back();
// },
// );
// },
// );
// }
// void showIosTipViewDialog(int staffId, BuildContext context) {
// showDialog(
// context: context,
// builder: (BuildContext context) {
// return ShowIosTipView(
// title: "提示",
// tipTitle: "确定要删除员工吗?",
// sureClick: () async {
// Get.back();
// logic.deletStaff(staffId, 0);
// },
// cancelClick: () {
// Get.back();
// },
// );
// },
// );
// }
}