修复考勤模块、修复授权管理员部分bug

This commit is contained in:
魏少阳 2024-02-29 17:31:30 +08:00
parent 0f58f3c757
commit a628860c9c
49 changed files with 867 additions and 540 deletions

View File

@ -459,7 +459,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1430;
LastUpgradeCheck = 1300;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {

View File

@ -292,6 +292,28 @@ class AuthorizedAdminLogic extends BaseGetXController {
}
}
// isOn:: 1 2
Future<void> updateRoomCheckIn() async {
// var entity = await ApiRepository.to
// .updateSetting(state.keyInfo.value.lockId.toString(), '1', '13');
// if (entity.errorCode!.codeIsSuccessful) {
// print("标记为已入住成功啦啦啦啦啦");
// Toast.show(msg: "标记成功");
// setState(() {});
// } else {
// Toast.show(msg: '操作失败');
// }
var entity = await ApiRepository.to.setRoomStatusData(
lockId: state.keyInfo.value.lockId!,
roomStatus: 1,
);
if (entity.errorCode!.codeIsSuccessful) {
print("标记为已入住成功啦啦啦啦啦");
showToast("标记成功");
}
}
//
void _showDialog(String errMsg) {
showCupertinoDialog(

View File

@ -12,6 +12,7 @@ import 'package:star_lock/tools/storage.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/NativeInteractionTool.dart';
import '../../../../tools/commonItem.dart';
import '../../../../tools/submitBtn.dart';
import '../../../../translations/trans_lib.dart';
@ -285,9 +286,15 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
height: 10.h,
),
OutLineBtn(
btnName: '邮件通知',
btnName: state.emailOrPhoneController.text.contains("@")?'邮件通知':"短信通知",
onClick: () {
Navigator.pushNamed(context, Routers.sendEmailNotificationPage);
if(state.emailOrPhoneController.text.contains("@")){
Get.toNamed(Routers.sendEmailNotificationPage);
}else{
// _openModalBottomSheet();
NativeInteractionTool.loadNativeShare(shareText:state.pwdShareStr);
}
// Get.toNamed(state.emailOrPhoneController.text.contains("@")? Routers.sendEmailNotificationPage:Routers.sendEmailNotificationPage);
},
),
SizedBox(
@ -295,7 +302,10 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
),
OutLineBtn(
btnName: '微信通知',
onClick: () {},
onClick: () {
// _openModalBottomSheet();
NativeInteractionTool.loadNativeShare(shareText:state.pwdShareStr);
},
),
SizedBox(
height: 10.h,
@ -303,36 +313,13 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
OutLineBtn(
btnName: '标记为:已入住',
onClick: () {
updateRoomCheckIn();
logic.updateRoomCheckIn();
},
),
],
);
}
// isOn:: 1 2
Future<void> updateRoomCheckIn() async {
// var entity = await ApiRepository.to
// .updateSetting(state.keyInfo.value.lockId.toString(), '1', '13');
// if (entity.errorCode!.codeIsSuccessful) {
// print("标记为已入住成功啦啦啦啦啦");
// Toast.show(msg: "标记成功");
// setState(() {});
// } else {
// Toast.show(msg: '操作失败');
// }
var entity = await ApiRepository.to.setRoomStatusData(
lockId: state.keyInfo.value.lockId!,
roomStatus: 1,
);
if (entity.errorCode!.codeIsSuccessful) {
print("标记为已入住成功啦啦啦啦啦");
logic.showToast("标记成功");
setState(() {});
}
}
//
Widget getTFWidget(bool isHaveBtn, String tfStr, int lineIndex) {
return SizedBox(
@ -400,6 +387,10 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
.phoneNumbers![0]
.replaceAll(RegExp(r"\s+\b|\b\s"), "");
}
if (currentContact.fullName!.isNotEmpty) {
state.keyNameController.text = currentContact.fullName!;
}
});
},
),
@ -428,4 +419,116 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
String intToStr(int v) {
return (v < 10) ? "0$v" : "$v";
}
Future _openModalBottomSheet() async {
showModalBottomSheet(
context: context,
shape: RoundedRectangleBorder(
borderRadius: BorderRadiusDirectional.circular(10)),
constraints: BoxConstraints(maxHeight: 270.h),
builder: (BuildContext context) {
return Column(
children: [
SizedBox(
width: ScreenUtil().screenWidth,
height: 180.h,
child: ListView(
scrollDirection: Axis.horizontal, //
children: initBottomSheetList()),
),
Container(
height: 8.h,
color: AppColors.greyBackgroundColor,
),
TextButton(
style: ButtonStyle(
overlayColor:
MaterialStateProperty.all<Color>(Colors.white)),
child: Text(
'取消',
style: TextStyle(
color: Colors.black, fontSize: ScreenUtil().setSp(24)),
),
onPressed: () {
Navigator.pop(context);
},
)
],
);
});
}
List<Widget> initBottomSheetList() {
List<Widget> widgetList = [];
widgetList.add(buildCenter3('images/icon_wechat.png', '微信好友', 0));
widgetList.add(buildCenter3('images/icon_message.png', '短信', 1));
widgetList.add(buildCenter3('images/icon_email.png', '邮件', 2));
widgetList.add(buildCenter3('images/icon_more.png', '更多', 3));
return widgetList;
}
GestureDetector buildCenter3(String imageName, String titleStr, int itemIndex) {
return GestureDetector(
child: Container(
width: 120.w,
// height: 64.h,
margin:
EdgeInsets.only(top: 20.w, bottom: 20.w, left: 10.w, right: 10.w),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
imageName,
width: 50.w,
height: 50.h,
),
SizedBox(
height: 16.w,
),
Text(
titleStr,
style: TextStyle(
fontSize: ScreenUtil().setSp(20), color: Colors.black),
),
],
),
),
onTap: () => _jumpSmartDeviceRoute(itemIndex),
);
}
//\n生效时间${itemData.startDate}\n类型\n锁名${itemData.keyboardPwdName}
_jumpSmartDeviceRoute(int itemIndex) {
Get.back();
switch (itemIndex) {
case 0:
//
{
NativeInteractionTool.loadNativeShare(shareText:state.pwdShareStr);
}
break;
case 1:
//
{
NativeInteractionTool.loadNativeShare(shareText:state.pwdShareStr);
}
break;
case 2:
//
{
Navigator.pushNamed(context, Routers.sendEmailNotificationPage);
}
break;
case 3:
//
{
NativeInteractionTool.loadNativeShare(shareText:state.pwdShareStr);
}
break;
default:
}
}
}

View File

@ -29,6 +29,9 @@ class AuthorizedAdminState {
var weekdaysList = [].obs;
var isCreateUser = false.obs; //1 0
final widgetType = 0.obs;
String pwdShareStr = '您好,您的授权管理员生成成功';
var addUserId = ''.obs;
AuthorizedAdminState() {
Map map = Get.arguments;

View File

@ -11,7 +11,6 @@ import 'package:star_lock/tools/storage.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/EasyRefreshTool.dart';
import '../../../../tools/left_slide_actions.dart';
import '../../../../tools/showIosTipView.dart';
import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart';

View File

@ -1,5 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
// import 'package:flutter_pickers/pickers.dart';
@ -258,17 +259,31 @@ class _VolumeAuthorizationLockPageState
controller: editController,
//
maxLines: 1,
// controller: _controller,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(30),
],
autofocus: false,
textAlign: TextAlign.end,
decoration: InputDecoration(
//
contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
hintText: tfStr,
hintStyle: TextStyle(fontSize: 22.sp),
//线
border: InputBorder.none,
focusedBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
disabledBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
enabledBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
border: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)),
contentPadding: const EdgeInsets.symmetric(vertical: 0),
),
// decoration: InputDecoration(
// //
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
// hintText: tfStr,
// hintStyle: TextStyle(fontSize: 22.sp),
// //线
// border: InputBorder.none,
// ),
),
),
SizedBox(
@ -295,6 +310,9 @@ class _VolumeAuthorizationLockPageState
.phoneNumbers![0]
.replaceAll(RegExp(r"\s+\b|\b\s"), "");
}
if (currentContact.fullName!.isNotEmpty) {
_keyNameController.text = currentContact.fullName!;
}
});
},
),

View File

@ -29,11 +29,15 @@ class _AddCardManageTabbarState extends State<AddCardManageTabbar>
with SingleTickerProviderStateMixin {
late TabController _tabController;
final List<ItemView> _itemTabs = <ItemView>[
final List<ItemView> _itemTabs = <ItemView>[
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"),
];
final List<ItemView> _fromCheckInTypeItemTabs = <ItemView>[
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
ItemView(
title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"),
];
@override
@ -43,7 +47,7 @@ class _AddCardManageTabbarState extends State<AddCardManageTabbar>
_tabController = TabController(
vsync: this,
length: _itemTabs.length,
length: widget.fromType == 1 ? _itemTabs.length : _fromCheckInTypeItemTabs.length,
initialIndex: widget.initialIndex);
_tabController.addListener(() {
if (_tabController.animation!.value == _tabController.index) {
@ -69,7 +73,7 @@ class _AddCardManageTabbarState extends State<AddCardManageTabbar>
onTap: (index) {
FocusScope.of(context).requestFocus(FocusNode());
},
tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(),
tabs: widget.fromType == 1 ? _itemTabs.map((ItemView item) => _tab(item)).toList() : _fromCheckInTypeItemTabs.map((ItemView item) => _tab(item)).toList(),
isScrollable: true,
indicatorColor: Colors.red,
unselectedLabelColor: Colors.black,
@ -101,13 +105,10 @@ class _AddCardManageTabbarState extends State<AddCardManageTabbar>
return Expanded(
child: TabBarView(
controller: _tabController,
children: _itemTabs
.map((ItemView item) => AddCardPage(
selectType: item.selectType,
lockId: widget.lockId,
fromType: widget.fromType,
fromTypeTwoStaffName: widget.fromTypeTwoStaffName))
.toList(),
children:
widget.fromType == 1
? _itemTabs.map((ItemView item) => AddCardPage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName: widget.fromTypeTwoStaffName)).toList()
: _fromCheckInTypeItemTabs.map((ItemView item) => AddCardPage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName: widget.fromTypeTwoStaffName)).toList(),
),
);
}

View File

@ -40,7 +40,8 @@ class _AddCardPageState extends State<AddCardPage> {
Widget build(BuildContext context) {
state.selectType.value = widget.selectType;
state.lockId.value = widget.lockId;
// state.nameController.text = widget.fromTypeTwoStaffName;
state.nameController.text = widget.fromTypeTwoStaffName;
state.fromType.value = widget.fromType;
WidgetsBinding.instance.addPostFrameCallback((_) {
// Your code here

View File

@ -308,14 +308,6 @@ class AddICCardLogic extends BaseGetXController{
weekDay: state.weekDay.value,
);
if (entity.errorCode!.codeIsSuccessful) {
showToast("添加成功");
if(state.fromType.value == 2){
//
eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent(entity.data!.cardId.toString()));
}else if(state.fromType.value == 1){
eventBus.fire(OtherTypeRefreshListEvent());
}
Get.close(2);
updateIdCardUserNoLoadData(entity.data!.cardId.toString());
}
}
@ -335,6 +327,14 @@ class AddICCardLogic extends BaseGetXController{
// eventBus.fire(OtherTypeRefreshListEvent());
// }
// Get.close(2);
showToast("添加成功");
if(state.fromType.value == 2){
//
eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent(state.cardNumber.value));
}else if(state.fromType.value == 1){
eventBus.fire(OtherTypeRefreshListEvent());
}
Get.close(2);
}
}

View File

@ -118,49 +118,51 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
Widget _buildMainUI() {
return Obx(() => state.fingerprintItemListData.value.isNotEmpty
? ListView.separated(
? SlidableAutoCloseBehavior(
child: ListView.separated(
itemCount: state.fingerprintItemListData.value.length,
itemBuilder: (c, index) {
FingerprintItemData fingerprintItemData = state.fingerprintItemListData.value[index];
return Slidable(
key:ValueKey(fingerprintItemData.fingerprintId),
endActionPane: ActionPane(
extentRatio: 0.2,
motion: const ScrollMotion(),
children: [
SlidableAction(
onPressed: (BuildContext context){
showIosTipViewDialog(context);
},
backgroundColor: Colors.red,
foregroundColor: Colors.white,
label: '删除',
),
],
),
child: _keyItem(
'images/icon_card.png',
fingerprintItemData.cardName!,
(fingerprintItemData.cardType! != 1) ? (fingerprintItemData.endDate! < DateTime.now().millisecondsSinceEpoch ? "已失效" : "") : "",
fingerprintItemData.validTimeStr!,
() async {
var data = await Get.toNamed(
Routers.cardDetailPage, arguments: {
"fingerprintItemData": fingerprintItemData,
});
if (data != null) {
logic.getICCardListData();
}
}),
);
FingerprintItemData fingerprintItemData = state.fingerprintItemListData.value[index];
return Slidable(
key:ValueKey(fingerprintItemData.fingerprintId),
endActionPane: ActionPane(
extentRatio: 0.2,
motion: const ScrollMotion(),
children: [
SlidableAction(
onPressed: (BuildContext context){
showIosTipViewDialog(context);
},
backgroundColor: Colors.red,
foregroundColor: Colors.white,
label: '删除',
),
],
),
child: _keyItem(
'images/icon_card.png',
fingerprintItemData.cardName!,
(fingerprintItemData.cardType! != 1) ? (fingerprintItemData.endDate! < DateTime.now().millisecondsSinceEpoch ? "已失效" : "") : "",
fingerprintItemData.validTimeStr!,
() async {
var data = await Get.toNamed(
Routers.cardDetailPage, arguments: {
"fingerprintItemData": fingerprintItemData,
});
if (data != null) {
logic.getICCardListData();
}
}),
);
},
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 - ScreenUtil().bottomBarHeight - 190.h - 64.h));
),
) : NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h));
}
void showIosTipViewDialog(BuildContext context) {

View File

@ -10,6 +10,17 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
//
void editFingerprintsData() async{
var beginTimeTimestamp = state.beginTimeTimestamp.value ~/ 1000;
var endTimeTimestamp = state.endTimeTimestamp.value ~/ 1000;
if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) {
showToast("失效时间需大于生效时间");
return;
}
if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch ~/ 1000) {
showToast("生效时间需大于当前时间");
return;
}
var entity = await ApiRepository.to.editFingerprintsData(
fingerprintId: state.fingerprintItemData.value.fingerprintId.toString(),
lockId: state.fingerprintItemData.value.lockId.toString(),
@ -32,6 +43,18 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
// iC卡
void editICCardData() async{
var beginTimeTimestamp = state.beginTimeTimestamp.value ~/ 1000;
var endTimeTimestamp = state.endTimeTimestamp.value ~/ 1000;
if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) {
showToast("失效时间需大于生效时间");
return;
}
if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch ~/ 1000) {
showToast("生效时间需大于当前时间");
return;
}
var entity = await ApiRepository.to.editICCardData(
cardId: state.fingerprintItemData.value.cardId.toString(),
lockId: state.fingerprintItemData.value.lockId.toString(),

View File

@ -76,11 +76,8 @@ class _OtherTypeKeyChangeDatePageState
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
setState(() {
state.beginTimeTimestamp.value = DateTime.parse(
'${p.year}-${p.month.toString().padLeft(2, '0')}-${p.day.toString().padLeft(2, '0')} ${p.hour!.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}')
.millisecondsSinceEpoch;
state.beginTime.value =
"${p.year}.${p.month.toString().padLeft(2, '0')}.${p.day.toString().padLeft(2, '0')} ${p.hour.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}";
state.beginTime.value = "${p.year}.${p.month.toString().padLeft(2, '0')}.${p.day.toString().padLeft(2, '0')} ${p.hour.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}";
state.beginTimeTimestamp.value = DateTime.parse(state.beginTime.value).millisecondsSinceEpoch;
});
});
})),
@ -92,11 +89,8 @@ class _OtherTypeKeyChangeDatePageState
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
setState(() {
state.endTimeTimestamp.value = DateTime.parse(
'${p.year}-${p.month.toString().padLeft(2, '0')}-${p.day.toString().padLeft(2, '0')} ${p.hour!.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}')
.millisecondsSinceEpoch;
state.endTime.value =
"${p.year}.${p.month.toString().padLeft(2, '0')}.${p.day.toString().padLeft(2, '0')} ${p.hour.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}";
state.endTime.value = "${p.year}.${p.month.toString().padLeft(2, '0')}.${p.day.toString().padLeft(2, '0')} ${p.hour.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}";
state.endTimeTimestamp.value = DateTime.parse(state.endTime.value).millisecondsSinceEpoch;
});
});
})),

View File

@ -5,7 +5,7 @@ import 'checkingInDetail_entity.dart';
class CheckingInDetailState{
final getKeyInfosData = LockListInfoItemEntity().obs;
// final getKeyInfosData = LockListInfoItemEntity().obs;
final companyId = "".obs;
final staffId = 0.obs;
@ -17,7 +17,7 @@ class CheckingInDetailState{
final monthListData = <MonthList>[].obs;
CheckingInDetailState() {
Map map = Get.arguments;
getKeyInfosData.value = map["getKeyInfosData"];
// getKeyInfosData.value = map["getKeyInfosData"];
companyId.value = map["companyId"];
staffId.value = map["staffId"];
}

View File

@ -36,7 +36,7 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
haveBack: true,
backgroundColor: AppColors.mainColor,
actionsList: [
(state.getKeyInfosData.value.isLockOwner == 1 && state.getKeyInfosData.value.keyRight == 1) ?
(state.getKeyInfosData.value.keyRight == 1) ?
GestureDetector(
onTap: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
@ -67,7 +67,7 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
Widget topInfo() {
return Container(
width: 1.sw,
height: 280.h,
// height: 280.h,
color: Colors.white,
child: Column(
children: [
@ -81,8 +81,7 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
borderRadius: BorderRadius.circular(60.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))),
SizedBox(height: 30.h),
@ -168,7 +167,7 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if(isDemoMode == false){
await showDialog(
context: context,
context: Get.context!,
builder: (context) {
return ShowCalendar(
datePickerMode: DatePickerMode.day,
@ -262,7 +261,7 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
AttendanceRecordDayList attendanceRecordList= state.checkingInDayListData.value[index];
return _checkingInListItem(index, attendanceRecordList.headurl, attendanceRecordList.staffName,() {
Get.toNamed(Routers.checkingInDetailPage, arguments: {
"getKeyInfosData": state.getKeyInfosData.value,
// "getKeyInfosData": state.getKeyInfosData.value,
"companyId": state.companyId.value,
"staffId": attendanceRecordList.staffId,
});
@ -297,18 +296,18 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
return GestureDetector(
onTap: action,
child: Container(
height: 80.h,
// margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
// height: 80.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: 30.w,),
SizedBox(width: 20.w,),
Text("${index+1}", style: TextStyle(fontSize: 20.sp),),
SizedBox(width: 20.w,),
Image.asset('images/controls_user.png', width: 40.w, height: 40.w,),
Image.asset('images/controls_user.png', width: 60.w, height: 60.w,),
// Container(
// width: 60.h,
// height: 60.h,

View File

@ -96,9 +96,8 @@ class _CheckingInSetWorkTimePageState extends State<CheckingInSetWorkTimePage> {
return;
}
if (int.parse(state.beginTimeTimestamp.value) >
int.parse(state.endTimeTimestamp.value)) {
logic.showToast("结束时间不能大于开始时间");
if (int.parse(state.beginTimeTimestamp.value) > int.parse(state.endTimeTimestamp.value)) {
logic.showToast("结束时间必须要比开始时间晚,请重新选择");
return;
}
if (state.pushType.value == "2") {

View File

@ -129,18 +129,16 @@ class _CheckingInSetWorkdaySetState extends State<CheckingInSetWorkdaySet> {
allHeight: 60.h,
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: GestureDetector(
onTap: () {
setState(() {
state.isSingledayWeekend.value = 1;
state.weekDays.value = [1, 2 , 3, 4, 5, 6];
});
},
child: Row(
children: [
Image.asset(state.isSingledayWeekend.value == 0 ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', width: 30.w, height: 30.w,),
],
),
action: (){
setState(() {
state.isSingledayWeekend.value = 0;
state.weekDays.value = [1, 2 , 3, 4, 5, 6];
});
},
rightWidget: Row(
children: [
Image.asset(state.isSingledayWeekend.value == 0 ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', width: 30.w, height: 30.w,),
],
)
)),
Obx(() => CommonItem(
@ -149,18 +147,16 @@ class _CheckingInSetWorkdaySetState extends State<CheckingInSetWorkdaySet> {
allHeight: 60.h,
isHaveLine: false,
isHaveRightWidget: true,
rightWidget: GestureDetector(
onTap: () {
setState(() {
state.isSingledayWeekend.value = 2;
state.weekDays.value = [1, 2 , 3, 4, 5];
});
},
child: Row(
children: [
Image.asset(state.isSingledayWeekend.value == 1 ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', width: 30.w, height: 30.w,),
],
),
action: (){
setState(() {
state.isSingledayWeekend.value = 1;
state.weekDays.value = [6, 7];
});
},
rightWidget: Row(
children: [
Image.asset(state.isSingledayWeekend.value == 1 ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', width: 30.w, height: 30.w,),
],
)
)),
],
@ -210,23 +206,22 @@ class _CheckingInSetWorkdaySetState extends State<CheckingInSetWorkdaySet> {
allHeight: 60.h,
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: GestureDetector(
onTap: () {
setState(() {
state.isSingledayWeekend.value = 2;
if(state.weekDays.value.contains(index)){
state.weekDays.value.remove(index);
}else{
state.weekDays.value.add(index);
}
state.weekDays.value.sort();
});
},
child: Obx(() => Row(
children: [
Image.asset(state.weekDays.value.contains(index) ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', width: 30.w, height: 30.w,),
],
)))
action: (){
setState(() {
state.isSingledayWeekend.value = 2;
if(state.weekDays.value.contains(index)){
state.weekDays.value.remove(index);
}else{
state.weekDays.value.add(index);
}
state.weekDays.value.sort();
});
},
rightWidget: Obx(() => Row(
children: [
Image.asset(state.weekDays.value.contains(index) ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', width: 30.w, height: 30.w,),
],
))
);
}
),

View File

@ -1,5 +1,6 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../../network/api_repository.dart';
@ -15,55 +16,23 @@ class CheckingInAddStaffLogic extends BaseGetXController{
StreamSubscription? _getNumberEvent;
void _initLoadDataAction() {
// eventBus
_getNumberEvent =
eventBus.on<ChickInAddStaffCardAndFingerprintBlockNumberEvent>().listen((event) {
state.getDataPassword.value = event.number;
_getNumberEvent = eventBus.on<ChickInAddStaffCardAndFingerprintBlockNumberEvent>().listen((event) {
state.attendanceWayNumber.value = event.number;
isCanClickAction();
// print("event.number = ${event.number} state.getDataPassword.value = ${state.attendanceWayNumber.value}");
});
}
//
void addStaffLoadData() async{
var attendanceWay = "";
var usernameType = "1";
switch(int.parse(state.selectPrintingMethodType.value)){
case 1:
// APP
if(state.appUnHaveAccount.value){
//
attendanceWay = state.staffAccountController.text;
if(attendanceWay.contains("@")){
usernameType = "2";
}
if(attendanceWay.isEmpty){
showToast("请输入员工账号");
return;
}
}else {
attendanceWay = state.selectKey.value;
if(attendanceWay.isEmpty){
showToast("请选择员工钥匙");
return;
}
}
break;
case 2:
break;
case 3:
break;
case 4:
break;
if(state.appUnHaveAccount.value && state.staffAccount.contains("@")){
usernameType = "2";
}
var entity = await ApiRepository.to.addStaffData(
attendanceType: state.selectPrintingMethodType.value,
attendanceWay: attendanceWay,
attendanceWay: state.attendanceWayNumber.value,
companyId: state.companyId.value,
have: state.appUnHaveAccount.value ? "2" : "1",
staffName: state.staffNameController.text,
@ -91,47 +60,14 @@ class CheckingInAddStaffLogic extends BaseGetXController{
//
void editStaffLoadData() async{
var attendanceWay = "";
var usernameType = "1";
switch(int.parse(state.selectPrintingMethodType.value)){
case 1:
// APP
if(state.appUnHaveAccount.value){
//
attendanceWay = state.staffAccountController.text;
if(attendanceWay.contains("@")){
usernameType = "2";
}
if(attendanceWay.isEmpty){
showToast("请输入员工账号");
return;
}
}else {
attendanceWay = state.selectKey.value;
if(attendanceWay.isEmpty){
showToast("请选择员工钥匙");
return;
}
}
break;
case 2:
break;
case 3:
break;
case 4:
break;
if(state.appUnHaveAccount.value && state.staffAccount.contains("@")){
usernameType = "2";
}
var entity = await ApiRepository.to.editStaffData(
attendanceType: state.selectPrintingMethodType.value,
attendanceWay: attendanceWay,
attendanceWay: state.attendanceWayNumber.value,
staffId: state.staffListItemData.value.staffId.toString(),
have: state.appUnHaveAccount.value ? "2" : "1",
staffName: state.staffNameController.text,
@ -152,29 +88,12 @@ class CheckingInAddStaffLogic extends BaseGetXController{
showToast("请输入姓名");
return;
}
// var entity = await ApiRepository.to.getPasswordKey(
// "0",
// '0',
// state.staffNameController.text,
// 2.toString(),
// '0',
// state.getKeyInfosData.value.lockId.toString(),
// '0',
// "0",
// '0',
// 0,
// 0,
// 1);
var entity = await ApiRepository.to.getPasswordKey(
endDate: "0",
isExclusive: '0',
keyboardPwdName: state.staffNameController.text,
keyboardPwdType: 2.toString(),
keyboardPwdVersion: '0',
lockId: state.getKeyInfosData.value.lockId.toString(),
operatorUid: '0',
startDate: '0',
timezoneRawOffSet: '0',
startHours: 0,
endHours: 0,
isCoerced: 1);
@ -182,13 +101,35 @@ class CheckingInAddStaffLogic extends BaseGetXController{
if (entity.errorCode!.codeIsSuccessful) {
print('获取密码成功');
if (entity.data != null) {
state.getDataPassword.value = entity.data!.keyboardPwd!;
state.attendanceWayNumber.value = entity.data!.keyboardPwd!;
isCanClickAction();
}
} else {
showToast('${entity.errorMsg}');
}
}
void changeInput(TextEditingController controller) {
if (controller == state.staffNameController) {
state.staffName.value = controller.text;
}
if (controller == state.staffAccountController) {
state.staffAccount.value = controller.text;
}
isCanClickAction();
}
//
void isCanClickAction() {
if(state.selectPrintingMethodType.value == "1" && state.appUnHaveAccount.value){
//
state.isCanClick.value = state.staffNameIsNotEmpty && state.staffAccountIsNotEmpty;
}else{
state.isCanClick.value = state.staffNameIsNotEmpty && state.attendanceWayNumberIsNotEmpty;
}
print("state.isCanClick.value = ${state.isCanClick.value}");
}
@override
void onReady() {
// TODO: implement onReady

View File

@ -29,19 +29,21 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle:
"${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.staff!.tr}",
"${state.isAdd.value == "1" ? TranslationLoader.lanKeys!.add!.tr : "编辑"}${TranslationLoader.lanKeys!.staff!.tr}",
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Column(
children: [
//
CommonItem(
leftTitel: TranslationLoader.lanKeys!.name!.tr,
rightTitle: "",
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: getTFWidget(
TranslationLoader.lanKeys!.pleaseEnter!.tr,
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.name!.tr}",
state.staffNameController)),
//
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.punchingMode!.tr,
rightTitle: state.selectPrintingMethodStr.value,
@ -49,11 +51,12 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
isHaveDirection: true,
action: () {
var list = ["APP", "密码", "", "指纹"];
_showSelectClockInType(list, "1");
if(state.getKeyInfosData.value.lockName!.contains("T9A")){
list.add("人脸");
}
_showSelectClockInType(list, list, "1", "选择钥匙");
})),
SizedBox(
height: 10.h,
),
SizedBox(height: 10.h),
//App
Obx(() => CommonItem(
leftTitel: addStaffGetIfHaveKey(),
@ -62,29 +65,28 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
isHaveRightWidget: true,
rightWidget: Row(
children: [
whetherTheEmployeeHasAKeyWidget(
"", state.appUnHaveAccount.value, () {
whetherTheEmployeeHasAKeyWidget("", state.appUnHaveAccount.value, () {
setState(() {
state.appUnHaveAccount.value = true;
state.attendanceWayNumber.value = "";
logic.isCanClickAction();
});
}),
SizedBox(
width: 30.w,
),
whetherTheEmployeeHasAKeyWidget(
"", !state.appUnHaveAccount.value, () {
whetherTheEmployeeHasAKeyWidget("", !state.appUnHaveAccount.value, () {
setState(() {
state.appUnHaveAccount.value = false;
state.attendanceWayNumber.value = "";
logic.isCanClickAction();
});
}),
],
))),
// App时显示
// App时且没有钥匙的时候
Obx(() => Visibility(
visible: (state.appUnHaveAccount.value &&
state.selectPrintingMethodType.value == "1")
? true
: false,
visible: (state.appUnHaveAccount.value && state.selectPrintingMethodType.value == "1") ? true : false,
child: Column(
children: [
CommonItem(
@ -93,7 +95,7 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: getTFWidget(
TranslationLoader.lanKeys!.pleaseEnter!.tr,
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}员工${TranslationLoader.lanKeys!.accountNumber!.tr}",
state.staffAccountController)),
CommonItem(
leftTitel:
@ -125,16 +127,14 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
)),
//
Obx(() => Visibility(
visible: (state.selectPrintingMethodType.value != "1" && state.appUnHaveAccount.value)
? true
: false,
visible: (state.selectPrintingMethodType.value != "1" && state.appUnHaveAccount.value) ? true : false,
child: CommonItem(
leftTitel: addStaffGetKeyType(),
isHaveLine: false,
isHaveRightWidget: true,
rightWidget: Row(
children: [
Obx(() => Text(state.getDataPassword.value, style: TextStyle(fontSize: 24.sp))),
Obx(() => Text(state.attendanceWayNumber.value, style: TextStyle(fontSize: 24.sp))),
SizedBox(width: 30.w),
SizedBox(
width: 150.w,
@ -155,8 +155,7 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
break;
case 3:
//
if (state
.staffNameController.text.isEmpty) {
if (state.staffNameController.text.isEmpty) {
logic.showToast("请输入姓名");
return;
}
@ -164,15 +163,13 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
var data = await Get.toNamed(
Routers.addCardTypeManagePage,
arguments: {
"lockId": state
.getKeyInfosData.value.lockId,
"keyType": 0,
"fromType":
2, // 1 2
"fromTypeTwoStaffName":
state.staffNameController.text
"lockId": state.getKeyInfosData.value.lockId,
"fromType": 2, // 1 2
"fromTypeTwoStaffName": state.staffNameController.text
});
if (data != null) {}
if (data != null) {
}
break;
case 4:
//
@ -184,17 +181,22 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
var data = await Get.toNamed(
Routers.addFingerprintTypeManagePage,
arguments: {
"lockId": state
.getKeyInfosData.value.lockId,
"keyType": 1,
"fromType":
2, // 1 2
"fromTypeTwoStaffName":
state.staffNameController.text
"lockId": state.getKeyInfosData.value.lockId,
"fromType": 2, // 1 2
"fromTypeTwoStaffName": state.staffNameController.text
});
if (data != null) {}
break;
if (data != null) {
}
break;
case 5:
Get.toNamed(Routers.addFaceTypeManagePage, arguments: {
"lockId": state.getKeyInfosData.value.lockId,
"fromType": 2, // 1 2
"fromTypeTwoStaffName": state.staffNameController.text
});
break;
}
}),
),
@ -206,37 +208,35 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
visible: !state.appUnHaveAccount.value,
child: CommonItem(
leftTitel: addStaffGetKeyType(),
rightTitle: state.selectKey.value,
rightTitle: state.attendanceWayNumber.value,
isHaveLine: false,
isHaveDirection: true,
action: () {
logic.addStaffSelectKey((v) {
var list = [];
var showList = [];
List numberList = [];
for (var element in v) {
list.add(element.attendanceWay);
showList.add("${element.staffName}-${element.attendanceWay}");
numberList.add(element.attendanceWay);
}
_showSelectClockInType(list, "2");
_showSelectClockInType(showList, numberList, "2", addStaffSelectKeySelectClockInType());
});
}),
)),
SizedBox(height: 50.w),
SubmitBtn(
Obx(() => SubmitBtn(
btnName: TranslationLoader.lanKeys!.sure!.tr,
borderRadius: 20.w,
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () {
if (state.staffNameController.text.isEmpty) {
logic.showToast("请输入姓名");
return;
}
isDisabled: state.isCanClick.value,
onClick: state.isCanClick.value ? (){
if (state.isAdd.value == "2") {
logic.editStaffLoadData();
} else {
logic.addStaffLoadData();
}
}),
}: null))
],
),
);
@ -255,12 +255,15 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
maxLines: 1,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(30),
// LengthLimitingTextInputFormatter(30),
],
style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
controller: tf,
autofocus: false,
textAlign: TextAlign.end,
onChanged: (v) {
logic.changeInput(tf);
},
decoration: InputDecoration(
//
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
@ -280,58 +283,63 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
}
// type 1 2
void _showSelectClockInType(List list, String type) {
void _showSelectClockInType(List showList, List numberList, String showBottomSheetToolType, String title) {
ShowBottomSheetTool().showSingleRowPicker(
//
context,
//
normalIndex: 0,
title: "选择钥匙",
title: title,
cancelTitle: TranslationLoader.lanKeys!.cancel!.tr,
sureTitle: TranslationLoader.lanKeys!.sure!.tr,
//
//
//adapter: PickerAdapter(),
data: list,
data: showList,
//
clickCallBack: (int index, var str) {
setState(() {
if (type == "1") {
if (showBottomSheetToolType == "1") {
state.selectPrintingMethodType.value = (index + 1).toString();
state.selectPrintingMethodStr.value = str.toString();
state.getDataPassword.value = "";
state.attendanceWayNumber.value = "";
} else {
state.selectKey.value = str.toString();
state.attendanceWayNumber.value = numberList[index].toString();
}
print(
"object:$index str:$str type:$type state.selectPrintingMethodType.value:${state.selectPrintingMethodType.value}");
logic.isCanClickAction();
print("object:$index str:$str type:$showBottomSheetToolType state.selectPrintingMethodType.value:${state.selectPrintingMethodType.value}");
});
});
}
Widget whetherTheEmployeeHasAKeyWidget(
String title, bool appUnHaveAccount, Function() action) {
Widget whetherTheEmployeeHasAKeyWidget(String title, bool appUnHaveAccount, Function() action) {
return GestureDetector(
onTap: action,
child: Row(
children: [
Image.asset(
appUnHaveAccount
? 'images/icon_round_select.png'
: 'images/icon_round_unSelect.png',
width: 26.w,
height: 26.w,
),
SizedBox(
width: 5.w,
),
Text(
title,
style: TextStyle(
fontSize: 22.sp,
child: Container(
// width: 80.w,
height: 65.w,
padding: EdgeInsets.only(left:10.w, right: 10.w),
// color: Colors.red,
child: Row(
children: [
Image.asset(
appUnHaveAccount
? 'images/icon_round_select.png'
: 'images/icon_round_unSelect.png',
width: 26.w,
height: 26.w,
),
),
],
SizedBox(
width: 5.w,
),
Text(
title,
style: TextStyle(
fontSize: 22.sp,
),
),
],
),
),
);
}
@ -351,6 +359,9 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
case 4:
title = TranslationLoader.lanKeys!.whetherTheEmployeeHasFingerprint!.tr;
break;
case 4:
title = "员工是否有人脸";
break;
}
return title;
}
@ -370,6 +381,9 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
case 4:
title = TranslationLoader.lanKeys!.fingerprint!.tr;
break;
case 5:
title = TranslationLoader.lanKeys!.humanFace!.tr;
break;
}
return title;
}
@ -389,7 +403,33 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
case 4:
title = TranslationLoader.lanKeys!.getFingerprint!.tr;
break;
case 5:
title = "获取人脸";
break;
}
return title;
}
String addStaffSelectKeySelectClockInType() {
String title = "";
switch (int.parse(state.selectPrintingMethodType.value)) {
case 1:
title = "选择钥匙".tr;
break;
case 2:
title = "选择密码".tr;
break;
case 3:
title = "选择卡".tr;
break;
case 4:
title = "选择指纹".tr;
break;
case 5:
title = "选择人脸".tr;
break;
}
return title;
}
}

View File

@ -14,7 +14,7 @@ class CheckingInAddStaffState{
final TextEditingController staffNameController = TextEditingController();
final TextEditingController staffAccountController = TextEditingController();
final selectPrintingMethodType = "1".obs;//
final selectPrintingMethodType = "1".obs;// 1APP 2 3 4 5
final selectPrintingMethodStr = "APP".obs;//
final countryName = "中国".obs;
@ -22,10 +22,15 @@ class CheckingInAddStaffState{
final appUnHaveAccount = true.obs;//
final keyEntity = <CheckingInAddStaffKeyEntity>[].obs;//
final selectKey = "".obs;
final isAdd = "1".obs; // 1 2
final getDataPassword = "".obs;
final attendanceWayNumber = "".obs;
final isCanClick = false.obs;
var staffName = ''.obs;
var staffAccount = ''.obs;
bool get staffNameIsNotEmpty => staffName.value.isNotEmpty;
bool get staffAccountIsNotEmpty => staffAccount.value.isNotEmpty;
bool get attendanceWayNumberIsNotEmpty => attendanceWayNumber.value.isNotEmpty;
CheckingInAddStaffState() {
Map map = Get.arguments;
@ -38,6 +43,7 @@ class CheckingInAddStaffState{
staffNameController.text = staffListItemData.value.staffName!;
selectPrintingMethodType.value = staffListItemData.value.attendanceType.toString();
attendanceWayNumber.value = staffListItemData.value.attendanceWay!;
switch(staffListItemData.value.attendanceType){
case 1:
selectPrintingMethodStr.value = "APP";
@ -55,7 +61,7 @@ class CheckingInAddStaffState{
if(staffListItemData.value.attendanceWay!.isNotEmpty){
appUnHaveAccount.value = false;
selectKey.value = staffListItemData.value.attendanceWay!;
attendanceWayNumber.value = staffListItemData.value.attendanceWay!;
}else{
appUnHaveAccount.value = true;
}

View File

@ -37,6 +37,7 @@ class CheckingInAddStaffListItemEntity {
int? staffId;
int? attendanceType;
int? countryCode;
int? cardStatus;
String? attendanceWay;
CheckingInAddStaffListItemEntity(
@ -45,6 +46,7 @@ class CheckingInAddStaffListItemEntity {
this.staffId,
this.attendanceType,
this.countryCode,
this.cardStatus,
this.attendanceWay});
CheckingInAddStaffListItemEntity.fromJson(Map<String, dynamic> json) {
@ -53,6 +55,7 @@ class CheckingInAddStaffListItemEntity {
staffId = json['staffId'];
attendanceType = json['attendanceType'];
countryCode = json['countryCode'];
cardStatus = json['cardStatus'];
attendanceWay = json['attendanceWay'];
}
@ -63,6 +66,7 @@ class CheckingInAddStaffListItemEntity {
data['staffId'] = staffId;
data['attendanceType'] = attendanceType;
data['countryCode'] = countryCode;
data['cardStatus'] = cardStatus;
data['attendanceWay'] = attendanceWay;
return data;
}

View File

@ -20,6 +20,17 @@ class CheckingInStaffManageLogic extends BaseGetXController{
}
}
//
void deletStaff(int staffId) async{
var entity = await ApiRepository.to.deletStaffData(
lockId: state.getKeyInfosData.value.lockId!,
staffId:staffId,
);
if(entity.errorCode!.codeIsSuccessful){
getStaffList();
}
}
late StreamSubscription _teamEvent;
void _initLoadDataAction() {
_teamEvent = eventBus.on<RefreshCheckInStaffListDataEvent>().listen((event) {

View File

@ -1,11 +1,13 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:get/get.dart';
import '../../../../../appRouters.dart';
import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/customNetworkImage.dart';
import '../../../../../tools/noData.dart';
import '../../../../../tools/showIosTipView.dart';
import '../../../../../tools/titleAppBar.dart';
import '../../../../../translations/trans_lib.dart';
import 'checkingInStaffList_entity.dart';
@ -55,22 +57,49 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
),
body: Container(
color: Colors.white,
child: Obx(() => state.staffListData.value.isNotEmpty ? ListView.separated(
itemCount: state.staffListData.value.length,
itemBuilder: (c, index) {
CheckingInAddStaffListItemEntity staffListItem = state.staffListData[index];
return _checkingInStaffManageItem(staffListItem, () {
Get.toNamed(Routers.checkingInStaffDetailPage, arguments: {
"staffListItem": staffListItem,
"getKeyInfosData": state.getKeyInfosData.value,
"companyId": state.companyId.value,
});
});
},
separatorBuilder: (context, index) {
return const Divider(
height: 1, indent: 20, color: AppColors.greyLineColor);
},
child: Obx(() => state.staffListData.value.isNotEmpty ?
SlidableAutoCloseBehavior(
child: ListView.separated(
itemCount: state.staffListData.value.length,
itemBuilder: (c, index) {
CheckingInAddStaffListItemEntity staffListItem = state.staffListData[index];
return Slidable(
key:ValueKey(staffListItem.staffId),
endActionPane: ActionPane(
extentRatio: 0.2,
motion: const ScrollMotion(),
children: [
SlidableAction(
onPressed: (BuildContext context){
showIosTipViewDialog(staffListItem.staffId!, context);
},
backgroundColor: Colors.red,
foregroundColor: Colors.white,
label: '删除',
),
],
),
child: _checkingInStaffManageItem(staffListItem, () {
Get.toNamed(Routers.checkingInStaffDetailPage, arguments: {
"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: (context, index) {
return Divider(height: 1.h, indent: 20.w, color: AppColors.greyLineColor);
},
),
) : NoData()),
));
}
@ -79,20 +108,90 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
return GestureDetector(
onTap: action,
child: Container(
height: 60.h,
// height: 60.h,
width: 1.sw,
color: Colors.white,
margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 10.h, bottom: 10.h),
margin: EdgeInsets.only(right: 10.w, top: 10.h, bottom: 10.h),
child: Row(
children: [
SizedBox(width: 30.w,),
SizedBox(width: 20.w,),
// CustomNetworkImage(url: staffListItem.headurl!, width: 40.w , height: 40.w),
Image.asset('images/controls_user.png', width: 40.w, height: 40.w),
SizedBox(width: 30.w,),
Text(staffListItem.staffName!, style: TextStyle(fontSize: 24.sp)),
Image.asset(getTypeIcon(staffListItem.attendanceType!), width: 60.w, height: 60.w),
SizedBox(width: 20.w,),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
width: 1.sw - 20.w - 60.w - 20.w - 30.w,
child: Text(staffListItem.staffName!,
// maxLines: 1,
// overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 24.sp)
)
),
Visibility(visible: staffListItem.cardStatus == 0, child: SizedBox(height: 5.h,)),
Visibility(
visible: staffListItem.cardStatus == 0,
child: Container(
padding: EdgeInsets.only(right: 5.w, left: 5.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.w),
color: AppColors.openPassageModeColor,
),
child: Text("打卡方式无效", style: TextStyle(fontSize: 18.sp, color: AppColors.appBarIconColor)),
),
),
],
),
],
),
),
);
}
// 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;
}
void showIosTipViewDialog(int staffId, BuildContext context) {
showDialog(
context: context,
builder: (BuildContext context) {
return ShowIosTipView(
title: "提示",
tipTitle: "确定要删除吗?",
sureClick: () async {
Get.back();
logic.deletStaff(staffId);
},
cancelClick: () {
Get.back();
},
);
},
);
}
}

View File

@ -26,7 +26,7 @@ class _CheckingInStaffDetailPageState extends State<CheckingInStaffDetailPage> {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.staff!.tr,
barTitle: "员工信息",
haveBack: true,
backgroundColor: AppColors.mainColor,
actionsList: [
@ -62,7 +62,14 @@ class _CheckingInStaffDetailPageState extends State<CheckingInStaffDetailPage> {
CommonItem(
leftTitel: TranslationLoader.lanKeys!.attendanceRecord!.tr,
rightTitle: "",
isHaveDirection: true),
isHaveDirection: true,
action: (){
Get.toNamed(Routers.checkingInDetailPage, arguments: {
// "getKeyInfosData": state.getKeyInfosData.value,
"companyId": state.companyId.value,
"staffId": state.staffListItemData.value.staffId,
});
}),
],
),
);

View File

@ -25,6 +25,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
Get.back();
showToast("修改成功", something: (){
eventBus.fire(ElectronicKeyListRefreshUI());
eventBus.fire(AuthorizedAdminPageRefreshUI());
});
}
}
@ -37,6 +38,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
print("删除电子钥匙成功");
showToast("删除成功", something: (){
eventBus.fire(ElectronicKeyListRefreshUI());
eventBus.fire(AuthorizedAdminPageRefreshUI());
Get.back();
});
}

View File

@ -10,6 +10,7 @@ import 'package:star_lock/tools/jh_pop_menus.dart';
import '../../../../../appRouters.dart';
import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/commonItem.dart';
import '../../../../../tools/dateTool.dart';
import '../../../../../tools/showIosTipView.dart';
import '../../../../../tools/showTFView.dart';
import '../../../../../tools/submitBtn.dart';
@ -69,7 +70,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
Obx(() => getPeriodValidityWidget()),
Container(height: 10.h),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
leftTitel: "接受账号",
rightTitle: state.itemData.value.username,
action: () {}),
const SizedBox(height: 1),
@ -133,7 +134,6 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
} else if (dateType == XSConstantMacro.keyTypeLoop) {
return getLoopTypeDateWidget();
}
return Container();
}
@ -151,21 +151,19 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
//
Widget getTimeLimitTypeDateWidget() {
DateTime startDateStr =
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!);
DateTime endDateStr =
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!);
String useDateStr =
'${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}';
return CommonItem(
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
allHeight: 90.h,
rightTitle: useDateStr,
rightTitle: '${state.beginTime.value}\n${state.endTime.value}',
isHaveDirection: true,
action: () {
Navigator.pushNamed(context, Routers.electronicKeyDetailChangeDate,
arguments: {"itemData": state.itemData.value});
action: () async {
var data = await Get.toNamed(Routers.electronicKeyDetailChangeDate, arguments: {"itemData": state.itemData.value});
if(data != null) {
state.beginTimeTimestamp.value = data["beginTimeTimestamp"];
state.endTimeTimestamp.value = data["endTimeTimestamp"];
state.beginTime.value = DateTool().dateToYMDHNString(state.beginTimeTimestamp.value.toString());
state.endTime.value = DateTool().dateToYMDHNString(state.endTimeTimestamp.value.toString());
}
});
}

View File

@ -2,15 +2,27 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
import '../../../../../tools/dateTool.dart';
class ElectronicKeyDetailState {
final itemData = ElectronicKeyListItem().obs;
final keyName = "".obs;
final TextEditingController changeNameController = TextEditingController();
var beginTime = "".obs;//
var endTime = "".obs;//
var beginTimeTimestamp = 0.obs;//
var endTimeTimestamp = 0.obs;//
ElectronicKeyDetailState() {
Map map = Get.arguments;
itemData.value = map["itemData"];
changeNameController.text = itemData.value.keyName!;
keyName.value = itemData.value.keyName!;
beginTime.value = DateTool().dateToYMDHNString(itemData.value.startDate.toString());
endTime.value = DateTool().dateToYMDHNString(itemData.value.endDate.toString());
beginTimeTimestamp.value = itemData.value.startDate!;
endTimeTimestamp.value = itemData.value.endDate!;
}
}

View File

@ -18,8 +18,8 @@ class ElectronicKeyDetailChangeDateLogic extends BaseGetXController {
keyboardPwdId: state.pwdId.value.toString(),
keyboardPwdName: state.inputNameController.text,
newKeyboardPwd: state.inputPwdController.text,
startDate: state.startDate.value,
endDate: state.endDate.value,
startDate: state.beginTimeTimestamp.value,
endDate: state.endTimeTimestamp.value,
changeType: state.changeType.value,
hoursStart: state.hoursStart.value,
hoursEnd: state.hoursEnd.value,
@ -27,26 +27,42 @@ class ElectronicKeyDetailChangeDateLogic extends BaseGetXController {
if (entity.errorCode!.codeIsSuccessful) {
showToast("修改成功", something: (){
eventBus.fire(ElectronicKeyListRefreshUI());
eventBus.fire(AuthorizedAdminPageRefreshUI());
Get.back();
});
}
}
//
//
Future<void> updateKeyDateRequest() async {
var beginTimeTimestamp = state.beginTimeTimestamp.value ~/ 1000;
var endTimeTimestamp = state.endTimeTimestamp.value ~/ 1000;
if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) {
showToast("失效时间需大于生效时间");
return;
}
if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch ~/ 1000) {
showToast("生效时间需大于当前时间");
return;
}
KeyOperationRecordEntity entity = await ApiRepository.to.updateKeyDate(
state.itemData.value.keyId.toString(),
state.itemData.value.lockId.toString(),
state.failureDateTime.millisecondsSinceEpoch.toString(),
state.endTimeTimestamp.value.toString(),
state.endDay.value,
'',
state.effectiveDateTime.millisecondsSinceEpoch.toString(),
state.beginTimeTimestamp.value.toString(),
state.startDay.value,
state.weekDays.value);
if (entity.errorCode!.codeIsSuccessful) {
showToast("修改成功", something: (){
eventBus.fire(ElectronicKeyListRefreshUI());
Get.back();
eventBus.fire(AuthorizedAdminPageRefreshUI());
Get.back(result: {
"beginTimeTimestamp":state.beginTimeTimestamp.value,
"endTimeTimestamp":state.endTimeTimestamp.value,
});
});
}
}

View File

@ -56,50 +56,42 @@ class _ElectronicKeyDetailChangeDateState
}
Widget buildMainUI() {
String getStartDate = "";
String getEndDate = "";
if (state.itemData.value.startDate != null) {
DateTime startDateStr =
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!);
getStartDate = startDateStr.toLocal().toString().substring(0, 16);
}
if (state.itemData.value.endDate != null) {
DateTime endDateStr =
DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!);
getEndDate = endDateStr.toLocal().toString().substring(0, 16);
}
// String getStartDate = "";
// String getEndDate = "";
// if (state.itemData.value.startDate != null) {
// DateTime startDateStr =
// DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!);
// getStartDate = startDateStr.toLocal().toString().substring(0, 16);
// }
//
// if (state.itemData.value.endDate != null) {
// DateTime endDateStr =
// DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!);
// getEndDate = endDateStr.toLocal().toString().substring(0, 16);
// }
return Column(
children: [
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
rightTitle: state.selectEffectiveDate.value.isNotEmpty
? state.selectEffectiveDate.value
: getStartDate,
rightTitle: state.beginTime.value,
isHaveLine: true,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
state.selectEffectiveDate.value =
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
state.effectiveDateTime =
DateTime.parse(state.selectEffectiveDate.value);
Pickers.showDatePicker(context, mode: DateMode.YMDHM, onConfirm: (p) {
state.beginTime.value = "${p.year}-${p.month.toString().padLeft(2, '0')}-${p.day.toString().padLeft(2, '0')} ${p.hour.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}";
state.beginTimeTimestamp.value = DateTime.parse(state.beginTime.value).millisecondsSinceEpoch;
print("state.beginTimeTimestamp.value:${state.beginTimeTimestamp.value}");
});
})),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
rightTitle: state.selectFailureDate.value.isNotEmpty
? state.selectFailureDate.value
: getEndDate,
rightTitle: state.endTime.value,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
state.selectFailureDate.value =
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
state.failureDateTime =
DateTime.parse(state.selectFailureDate.value);
Pickers.showDatePicker(context, mode: DateMode.YMDHM, onConfirm: (p) {
state.endTime.value = "${p.year}-${p.month.toString().padLeft(2, '0')}-${p.day.toString().padLeft(2, '0')} ${p.hour.toString().padLeft(2, '0')}:${p.minute!.toString().padLeft(2, '0')}";
state.endTimeTimestamp.value = DateTime.parse(state.endTime.value).millisecondsSinceEpoch;
print("state.endTimeTimestamp.value:${state.endTimeTimestamp.value}");
});
})),
],

View File

@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
import '../../../../../tools/dateTool.dart';
class ElectronicKeyDetailChangeDateState {
final itemData = ElectronicKeyListItem().obs;
final TextEditingController inputPwdController = TextEditingController();
@ -11,15 +13,22 @@ class ElectronicKeyDetailChangeDateState {
final isCoerced = '1'.obs; //:1;:2
final hoursStart = 0.obs;
final hoursEnd = 0.obs;
final startDate = 0.obs;
final endDate = 0.obs;
final pwdId = ''.obs;
final lockId = 0.obs;
final fromType = ''.obs;
final selectEffectiveDate = ''.obs; //
final selectFailureDate = ''.obs; //
DateTime effectiveDateTime = DateTime.now();
DateTime failureDateTime = DateTime.now();
// final startDate = 0.obs;
// final endDate = 0.obs;
// final selectEffectiveDate = ''.obs; //
// final selectFailureDate = ''.obs; //
// DateTime effectiveDateTime = DateTime.now();
// DateTime failureDateTime = DateTime.now();
var beginTime = "".obs;//
var endTime = "".obs;//
var beginTimeTimestamp = 0.obs;//
var endTimeTimestamp = 0.obs;//
final endDay = ''.obs;
final startDay = ''.obs;
final weekDays = [].obs;
@ -29,6 +38,10 @@ class ElectronicKeyDetailChangeDateState {
// itemData.value = map["itemData"];
if ((map["itemData"] != null)) {
itemData.value = map["itemData"];
beginTime.value = DateTool().dateToYMDHNString(itemData.value.startDate.toString());
endTime.value = DateTool().dateToYMDHNString(itemData.value.endDate.toString());
beginTimeTimestamp.value = itemData.value.startDate!;
endTimeTimestamp.value = itemData.value.endDate!;
}
if ((map["pwdId"] != null)) {
pwdId.value = map["pwdId"];

View File

@ -25,21 +25,20 @@ class SendElectronicKeyLogic extends BaseGetXController {
DateTime startDateTime = DateTime(state.effectiveDateTime.value.year, state.effectiveDateTime.value.month, state.effectiveDateTime.value.day, state.effectiveDateTime.value.hour, state.effectiveDateTime.value.minute);
DateTime endDateTime = DateTime(state.failureDateTime.value.year, state.failureDateTime.value.month, state.failureDateTime.value.day, state.failureDateTime.value.hour, state.failureDateTime.value.minute);
//
if (state.type.value == "0" || state.type.value == "3") {
print("startDateTime:$startDateTime endDateTime:$endDateTime DateTime.now():${DateTime.now()} startDateTime.isBefore(endDateTime):${startDateTime.isBefore(endDateTime)}");
if (!startDateTime.isBefore(endDateTime) || startDateTime.isAtSameMomentAs(endDateTime)) {
showToast("失效时间需大于生效时间");
return;
}
if (!startDateTime.isBefore(DateTime.now()) || startDateTime.isAtSameMomentAs(DateTime.now())) {
showToast("生效时间需大于当前时间");
return;
}
if (state.type.value == "0" || state.type.value == "3") {
print("startDateTime:$startDateTime endDateTime:$endDateTime DateTime.now():${DateTime.now()} startDateTime.isBefore(endDateTime):${startDateTime.isBefore(endDateTime)}");
if (!startDateTime.isBefore(endDateTime) || startDateTime.isAtSameMomentAs(endDateTime)) {
showToast("失效时间需大于生效时间");
return;
}
if (!startDateTime.isBefore(DateTime.now()) || startDateTime.isAtSameMomentAs(DateTime.now())) {
showToast("生效时间需大于当前时间");
return;
}
}
String lockID = state.keyInfo.value.lockId.toString();
int typeValue = int.parse(state.type.value);
switch (typeValue) {

View File

@ -5,8 +5,7 @@ import 'package:get/get.dart';
import '../../../../lockMian/entity/lockListInfo_entity.dart';
class SendElectronicKeyState {
TextEditingController emailOrPhoneController =
TextEditingController(); ///
TextEditingController emailOrPhoneController = TextEditingController(); ///
TextEditingController keyNameController = TextEditingController(); //
final FlutterContactPicker contactPicker = FlutterContactPicker();

View File

@ -263,8 +263,7 @@ class AddFaceLogic extends BaseGetXController {
showToast("添加成功");
if (state.fromType.value == 2) {
//
eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent(
faceId.toString()));
eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent(state.faceNumber.value));
} else if (state.fromType.value == 1) {
eventBus.fire(OtherTypeRefreshListEvent());
}

View File

@ -19,7 +19,13 @@ class _AddFaceTypeManagePageState extends State<AddFaceTypeManagePage> {
@override
Widget build(BuildContext context) {
Map map = Get.arguments;
var lockId = map["lockId"];
var fromType = map["fromType"]; // 1 2
var fromTypeTwoStaffName = "";
if(fromType == 2){
fromTypeTwoStaffName = map["fromTypeTwoStaffName"]; //
}
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
@ -29,7 +35,7 @@ class _AddFaceTypeManagePageState extends State<AddFaceTypeManagePage> {
backgroundColor: AppColors.mainColor),
body: Column(
children: [
AddFaceTypeManageTabbar(initialIndex: index),
AddFaceTypeManageTabbar(lockId: lockId, fromType: fromType, fromTypeTwoStaffName: fromTypeTwoStaffName, initialIndex: index),
],
),
);

View File

@ -9,24 +9,27 @@ import '../addFaceType_page.dart';
class AddFaceTypeManageTabbar extends StatefulWidget {
var initialIndex = 1;
AddFaceTypeManageTabbar({Key? key, required this.initialIndex})
: super(key: key);
var lockId = 0;
var fromType = 1; // 1 2
var fromTypeTwoStaffName = "";//
AddFaceTypeManageTabbar({Key? key, required this.lockId, required this.fromType, required this.fromTypeTwoStaffName, required this.initialIndex}) : super(key: key);
@override
State<AddFaceTypeManageTabbar> createState() =>
_AddFaceTypeManageTabbarState();
State<AddFaceTypeManageTabbar> createState() => _AddFaceTypeManageTabbarState();
}
class _AddFaceTypeManageTabbarState extends State<AddFaceTypeManageTabbar>
with SingleTickerProviderStateMixin {
class _AddFaceTypeManageTabbarState extends State<AddFaceTypeManageTabbar> with SingleTickerProviderStateMixin {
late TabController _tabController;
final List<ItemView> _itemTabs = <ItemView>[
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
ItemView(
title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"),
ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"),
];
final List<ItemView> _fromCheckInTypeItemTabs = <ItemView>[
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
];
@override
@ -60,7 +63,7 @@ class _AddFaceTypeManageTabbarState extends State<AddFaceTypeManageTabbar>
TabBar _tabBar() {
return TabBar(
controller: _tabController,
tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(),
tabs: widget.fromType == 1 ? _itemTabs.map((ItemView item) => _tab(item)).toList() : _fromCheckInTypeItemTabs.map((ItemView item) => _tab(item)).toList(),
isScrollable: true,
indicatorColor: Colors.red,
unselectedLabelColor: Colors.black,
@ -92,11 +95,12 @@ class _AddFaceTypeManageTabbarState extends State<AddFaceTypeManageTabbar>
return Expanded(
child: TabBarView(
controller: _tabController,
children: _itemTabs
.map((ItemView item) => AddFaceTypePage(
selectType: item.selectType,
))
.toList(),
children:
widget.fromType == 1
? _itemTabs.map((ItemView item) => AddFaceTypePage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName:widget.fromTypeTwoStaffName)).toList()
:_itemTabs.map((ItemView item) => AddFaceTypePage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName:widget.fromTypeTwoStaffName)).toList(),
// _itemTabs.map((ItemView item) => AddFaceTypePage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName:widget.fromTypeTwoStaffName)).toList(),
),
);
}

View File

@ -13,9 +13,18 @@ import '../../../../translations/trans_lib.dart';
import 'addFaceType_logic.dart';
class AddFaceTypePage extends StatefulWidget {
final String selectType;
final String selectType; //
final int lockId;
final int fromType; // // 1 2
final String fromTypeTwoStaffName; //
const AddFaceTypePage({Key? key, required this.selectType}) : super(key: key);
const AddFaceTypePage(
{Key? key,
required this.selectType,
required this.lockId,
required this.fromType,
required this.fromTypeTwoStaffName})
: super(key: key);
@override
State<AddFaceTypePage> createState() => _AddFaceTypePageState();
@ -28,6 +37,9 @@ class _AddFaceTypePageState extends State<AddFaceTypePage> {
@override
Widget build(BuildContext context) {
state.seletType.value = widget.selectType;
state.lockId.value = widget.lockId;
state.nameController.text = widget.fromTypeTwoStaffName;
state.fromType.value = widget.fromType;
return indexChangeWidget();
}

View File

@ -5,6 +5,7 @@ class AddFaceTypeState {
final lockId = 0.obs;
final seletType = "0".obs; // 0 1 2
final fromType = 1.obs; // // 1 2
var fromTypeTwoStaffName = "".obs; //
final isStressFingerprint = false.obs;
var beginTime = "".obs; //
@ -18,8 +19,14 @@ class AddFaceTypeState {
final TextEditingController nameController = TextEditingController();
AddFaceTypeState() {
Map map = Get.arguments;
lockId.value = map["lockId"];
fromType.value = map["fromType"];
// Map map = Get.arguments;
// lockId.value = map["lockId"];
// fromType.value = map["fromType"];
// if(fromType.value == 2){
// fromTypeTwoStaffName = map["fromTypeTwoStaffName"]; //
// // nameController.text = fromTypeTwoStaffName.value;
// }
// print("lockId:${lockId.value} fromType:${fromType.value}");
}
}

View File

@ -368,7 +368,7 @@ class AddFingerprintLogic extends BaseGetXController {
showToast("添加成功");
if(state.fromType.value == 2){
//
eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent(fingerprintId));
eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent(state.fingerprintNumber.value));
}else if(state.fromType.value == 1){
eventBus.fire(OtherTypeRefreshListEvent());
}

View File

@ -30,6 +30,11 @@ class _AddFingerprintTypeManageTabbarState extends State<AddFingerprintTypeManag
ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"),
];
final List<ItemView> _fromCheckInTypeItemTabs = <ItemView>[
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
];
@override
void initState() {
// TODO: implement initState
@ -63,7 +68,7 @@ class _AddFingerprintTypeManageTabbarState extends State<AddFingerprintTypeManag
onTap: (index){
FocusScope.of(context).requestFocus(FocusNode());
},
tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(),
tabs: widget.fromType == 1 ? _itemTabs.map((ItemView item) => _tab(item)).toList() : _fromCheckInTypeItemTabs.map((ItemView item) => _tab(item)).toList(),
isScrollable: true,
indicatorColor: Colors.red,
unselectedLabelColor: Colors.black,
@ -85,8 +90,7 @@ class _AddFingerprintTypeManageTabbarState extends State<AddFingerprintTypeManag
}
Tab _tab(ItemView item) {
return Tab(
child: SizedBox(
return Tab(child: SizedBox(
width: 1.sw / 5,
child: Text(item.title, textAlign: TextAlign.center)));
}
@ -95,17 +99,14 @@ class _AddFingerprintTypeManageTabbarState extends State<AddFingerprintTypeManag
return Expanded(
child: TabBarView(
controller: _tabController,
children: _itemTabs
.map((ItemView item) => AddFingerprintTypePage(
selectType: item.selectType,
lockId: widget.lockId,
fromType: widget.fromType,
fromTypeTwoStaffName:widget.fromTypeTwoStaffName
))
.toList(),
),
children:
widget.fromType == 1
? _itemTabs.map((ItemView item) => AddFingerprintTypePage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName:widget.fromTypeTwoStaffName)).toList()
:_itemTabs.map((ItemView item) => AddFingerprintTypePage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName:widget.fromTypeTwoStaffName)).toList(),
),
);
}
}
class ItemView {

View File

@ -40,7 +40,8 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
Widget build(BuildContext context) {
state.selectType.value = widget.selectType;
state.lockId.value = widget.lockId;
// state.nameController.text = widget.fromTypeTwoStaffName;
state.nameController.text = widget.fromTypeTwoStaffName;
state.fromType.value = widget.fromType;
WidgetsBinding.instance.addPostFrameCallback((_) {
// Your code here

View File

@ -117,54 +117,56 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
Widget _buildMainUI() {
return Obx(() => state.fingerprintItemListData.value.isNotEmpty
? ListView.separated(
? SlidableAutoCloseBehavior(
child: ListView.separated(
itemCount: state.fingerprintItemListData.value.length,
itemBuilder: (c, index) {
FingerprintItemData fingerprintItemData = state.fingerprintItemListData.value[index];
//
return Slidable(
key:ValueKey(fingerprintItemData.fingerprintId),
endActionPane: ActionPane(
extentRatio: 0.2,
motion: const ScrollMotion(),
children: [
SlidableAction(
onPressed: (BuildContext context){
showIosTipViewDialog(context);
},
backgroundColor: Colors.red,
foregroundColor: Colors.white,
label: '删除',
),
],
),
child: _keyItem(
'images/icon_fingerprint.png',
fingerprintItemData.fingerprintName!,
(fingerprintItemData.fingerprintType! != 1) ? (fingerprintItemData.endDate! < DateTime.now().millisecondsSinceEpoch ? "已失效" : "") : "",
fingerprintItemData.validTimeStr!,
// fingerprintItemData.fingerprintType! == 1
// ? "永久"
// : "${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())}",
() async {
var data = await Get.toNamed(
Routers.fingerprintDetailPage,
arguments: {
"fingerprintItemData": fingerprintItemData,
});
if (data != null) {
logic.getFingerprintsListData();
}
}),
);
FingerprintItemData fingerprintItemData = state.fingerprintItemListData.value[index];
//
return Slidable(
key:ValueKey(fingerprintItemData.fingerprintId),
endActionPane: ActionPane(
extentRatio: 0.2,
motion: const ScrollMotion(),
children: [
SlidableAction(
onPressed: (BuildContext context){
showIosTipViewDialog(context);
},
backgroundColor: Colors.red,
foregroundColor: Colors.white,
label: '删除',
),
],
),
child: _keyItem(
'images/icon_fingerprint.png',
fingerprintItemData.fingerprintName!,
(fingerprintItemData.fingerprintType! != 1) ? (fingerprintItemData.endDate! < DateTime.now().millisecondsSinceEpoch ? "已失效" : "") : "",
fingerprintItemData.validTimeStr!,
// fingerprintItemData.fingerprintType! == 1
// ? "永久"
// : "${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())}",
() async {
var data = await Get.toNamed(
Routers.fingerprintDetailPage,
arguments: {
"fingerprintItemData": fingerprintItemData,
});
if (data != null) {
logic.getFingerprintsListData();
}
}),
);
},
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 - ScreenUtil().bottomBarHeight - 190.h - 64.h));
),
) : NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h));
}
void showIosTipViewDialog(BuildContext context) {

View File

@ -68,7 +68,7 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
rightTitle: logic.getUseKeyTypeStr(
state.lockBasicInfo.value.startDate,
state.lockBasicInfo.value.startDate,
state.lockBasicInfo.value.endDate,
state.lockBasicInfo.value.keyType),
allHeight: 70.h,
isHaveLine: false),

View File

@ -31,7 +31,7 @@ class _EditLockNamePageState extends State<EditLockNamePage> {
actionsList: [
TextButton(
child: Text(
TranslationLoader.lanKeys!.sure!.tr,
TranslationLoader.lanKeys!.save!.tr,
style: TextStyle(color: Colors.white, fontSize: 24.sp),
),
onPressed: () {
@ -45,7 +45,7 @@ class _EditLockNamePageState extends State<EditLockNamePage> {
child: LoginInput(
controller: state.changeLockNameController,
leftWidget: const SizedBox(),
hintText: TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
hintText: "请输入名称",
inputFormatters: [
LengthLimitingTextInputFormatter(50),
]),

View File

@ -98,14 +98,10 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
}
var entity = await ApiRepository.to.getPasswordKey(
endDate: getFailureDateTime,
isExclusive: '0',
keyboardPwdName: state.nameController.text,
keyboardPwdType: getKeyType,
keyboardPwdVersion: '0',
lockId: lockId,
operatorUid: '0',
startDate: getEffectiveDateTime,
timezoneRawOffSet: '0',
startHours: state.loopStartHours.value,
endHours: state.loopEndHours.value,
isCoerced: 1);

View File

@ -644,8 +644,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
return widgetList;
}
GestureDetector buildCenter3(
String imageName, String titleStr, int itemIndex) {
GestureDetector buildCenter3(String imageName, String titleStr, int itemIndex) {
return GestureDetector(
child: Container(
width: 120.w,

View File

@ -85,6 +85,7 @@ abstract class Api {
final String getStaffListURL = '/staff/list'; //
final String addStaffURL = '/staff/add'; //
final String editStaffURL = '/staff/update'; //
final String deleteStaffURL = '/staff/delete'; //
final String addStaffSelectKeyURL = '/staff/attendanceList'; // -
final String addHolidaysURL = '/vacation/add'; //
final String holidaysListURL = '/vacation/list'; //

View File

@ -392,14 +392,10 @@ class ApiProvider extends BaseProvider {
Future<Response> getKeyboardPwd(
String endDate,
String isExclusive,
String keyboardPwdName,
String keyboardPwdType,
String keyboardPwdVersion,
String lockId,
String operatorUid,
String startDate,
String timezoneRawOffSet,
int startHours,
int endHours,
int isCoerced) =>
@ -407,14 +403,10 @@ class ApiProvider extends BaseProvider {
passwordKeyGetURL.toUrl,
jsonEncode({
'endDate': endDate,
'isExclusive': isExclusive,
'keyboardPwdName': keyboardPwdName,
'keyboardPwdType': keyboardPwdType,
'keyboardPwdVersion': keyboardPwdVersion,
'lockId': lockId,
'operatorUid': operatorUid,
'startDate': startDate,
'timezoneRawOffSet': timezoneRawOffSet,
'hoursStart': startHours,
'hoursEnd': endHours,
'isCoerced': isCoerced,
@ -776,6 +768,14 @@ class ApiProvider extends BaseProvider {
'lockId': lockId,
}));
//
Future<Response> deletStaffData(int lockId, int staffId) => post(
deleteStaffURL.toUrl,
jsonEncode({
'lockId': lockId,
'staffId': staffId,
}));
//
Future<Response> addStaffData(
String attendanceType,

View File

@ -398,27 +398,19 @@ class ApiRepository {
//
Future<PasswordKeyEntity> getPasswordKey(
{required String endDate,
required String isExclusive,
required String keyboardPwdName,
required String keyboardPwdType,
required String keyboardPwdVersion,
required String lockId,
required String operatorUid,
required String startDate,
required String timezoneRawOffSet,
required int startHours,
required int endHours,
required int isCoerced}) async {
final res = await apiProvider.getKeyboardPwd(
endDate,
isExclusive,
keyboardPwdName,
keyboardPwdType,
keyboardPwdVersion,
lockId,
operatorUid,
startDate,
timezoneRawOffSet,
startHours,
endHours,
isCoerced);
@ -1016,6 +1008,15 @@ class ApiRepository {
return CheckingInAddStaffListEntity.fromJson(res.body);
}
//
Future<LoginEntity> deletStaffData({
required int lockId,
required int staffId,
}) async {
final res = await apiProvider.deletStaffData(lockId, staffId);
return LoginEntity.fromJson(res.body);
}
//
Future<LoginEntity> addStaffData({
required String attendanceType,
@ -1092,7 +1093,7 @@ class ApiRepository {
}
//
Future<CheckingInSetEntity> editCheckInSetInfoData({
Future<LoginEntity> editCheckInSetInfoData({
required String attendanceType,
required String companyId,
required String type,
@ -1103,7 +1104,7 @@ class ApiRepository {
}) async {
final res = await apiProvider.editCheckInSetInfoData(attendanceType,
companyId, type, companyName, workEndTime, workStartTime, workDay);
return CheckingInSetEntity.fromJson(res.body);
return LoginEntity.fromJson(res.body);
}
//

View File

@ -60,8 +60,8 @@ class CommonItem extends StatelessWidget {
isHaveRightWidget!
? rightWidget!
: SizedBox(
width: 250.w,
child: Text(
width: rightTitle!.isNotEmpty ? 250.w : 0.1.w,
child: Text(
rightTitle ?? "",
textAlign: TextAlign.right,
overflow: TextOverflow.ellipsis,

View File

@ -35,7 +35,7 @@ class DateTool {
int time = int.parse(timeDate);
DateTime nowDate = DateTime.fromMillisecondsSinceEpoch(time);
String appointmentDate = formatDate(nowDate, [yyyy,'.',mm,'.',dd,' ',HH,':',nn]);
String appointmentDate = formatDate(nowDate, [yyyy,'-',mm,'-',dd,' ',HH,':',nn]);
return appointmentDate;
}