# Conflicts:
#	star_lock/lib/appRouters.dart
#	star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart
#	star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart
#	star_lock/lib/network/api_repository.dart
This commit is contained in:
Daisy 2023-09-11 10:20:44 +08:00
commit a7f5300f50
42 changed files with 1305 additions and 275 deletions

View File

@ -40,7 +40,7 @@
</Testables> </Testables>
</TestAction> </TestAction>
<LaunchAction <LaunchAction
buildConfiguration = "Debug" buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0" launchStyle = "0"

View File

@ -2,6 +2,7 @@ import 'package:get/get.dart';
import 'package:star_lock/common/safetyVerification/safetyVerification_binding.dart'; import 'package:star_lock/common/safetyVerification/safetyVerification_binding.dart';
import 'package:star_lock/login/register/starLock_register_binding.dart'; import 'package:star_lock/login/register/starLock_register_binding.dart';
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_page.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_page.dart';
import 'package:star_lock/main/lockDetail/checkingIn/checkingInSetStaffList/checkingInStaffList_page.dart';
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_page.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_page.dart';
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiver_page.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiver_page.dart';
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_main_page.dart'; import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_main_page.dart';
@ -26,7 +27,6 @@ import 'main/lockDetail/checkingIn/checkingInList/checkingInList_page.dart';
import 'main/lockDetail/checkingIn/checkingInSet/checkingInSet_page.dart'; import 'main/lockDetail/checkingIn/checkingInSet/checkingInSet_page.dart';
import 'main/lockDetail/checkingIn/checkingInSetAddStaff/checkingInAddStaff_page.dart'; import 'main/lockDetail/checkingIn/checkingInSetAddStaff/checkingInAddStaff_page.dart';
import 'main/lockDetail/checkingIn/checkingInSetHolidays/checkingInSetHolidays_page.dart'; import 'main/lockDetail/checkingIn/checkingInSetHolidays/checkingInSetHolidays_page.dart';
import 'main/lockDetail/checkingIn/checkingInSetStaffManage/checkingInStaffManage_page.dart';
import 'main/lockDetail/checkingIn/checkingInSetWorkTime/checkingInSetWorkTime_page.dart'; import 'main/lockDetail/checkingIn/checkingInSetWorkTime/checkingInSetWorkTime_page.dart';
import 'main/lockDetail/checkingIn/checkingInSetWorkdaySet/checkingInSetWorkdaySet_page.dart'; import 'main/lockDetail/checkingIn/checkingInSetWorkdaySet/checkingInSetWorkdaySet_page.dart';
import 'main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord_page.dart'; import 'main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord_page.dart';
@ -37,6 +37,7 @@ import 'main/lockDetail/lcokSet/basicInformation/editLockName/editLockName_page.
import 'main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/lockSeletGrouping_page.dart'; import 'main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/lockSeletGrouping_page.dart';
import 'main/lockDetail/lcokSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_page.dart'; import 'main/lockDetail/lcokSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_page.dart';
import 'main/lockDetail/lcokSet/burglarAlarm/burglarAlarm_page.dart'; import 'main/lockDetail/lcokSet/burglarAlarm/burglarAlarm_page.dart';
import 'main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_page.dart';
import 'main/lockDetail/lcokSet/configuringWifi/configuringWifi_page.dart'; import 'main/lockDetail/lcokSet/configuringWifi/configuringWifi_page.dart';
import 'main/lockDetail/lcokSet/diagnose/diagnose_page.dart'; import 'main/lockDetail/lcokSet/diagnose/diagnose_page.dart';
import 'main/lockDetail/lcokSet/doorMagnetic/addDoorMagnetic/addDoorMagnetic_page.dart'; import 'main/lockDetail/lcokSet/doorMagnetic/addDoorMagnetic/addDoorMagnetic_page.dart';
@ -195,6 +196,7 @@ abstract class Routers {
static const importOtherLockDataPage = '/ImportOtherLockDataPage'; // static const importOtherLockDataPage = '/ImportOtherLockDataPage'; //
static const lockEscalationPage = '/LockEscalationPage'; // static const lockEscalationPage = '/LockEscalationPage'; //
static const markedHouseStatePage = '/MarkedHouseStatePage'; // static const markedHouseStatePage = '/MarkedHouseStatePage'; //
static const checkInCreatCompanyPage = '/CheckInCreatCompanyPage'; //
static const checkingInListPage = '/CheckingInListPage'; // static const checkingInListPage = '/CheckingInListPage'; //
static const checkingInSetPage = '/CheckingInSetPage'; // static const checkingInSetPage = '/CheckingInSetPage'; //
static const checkingInStaffManagePage = '/CheckingInStaffManagePage'; // static const checkingInStaffManagePage = '/CheckingInStaffManagePage'; //
@ -544,7 +546,7 @@ abstract class AppRouters {
), ),
GetPage( GetPage(
name: Routers.checkingInStaffManagePage, name: Routers.checkingInStaffManagePage,
page: () => const CheckingInStaffManagePage(), page: () => const CheckingInStaffListPage(),
), ),
GetPage( GetPage(
name: Routers.checkingInAddStaffPage, name: Routers.checkingInAddStaffPage,
@ -749,6 +751,9 @@ abstract class AppRouters {
name: Routers.massSendReceiverPage, name: Routers.massSendReceiverPage,
page: () => const MassSendReceiverPage()), page: () => const MassSendReceiverPage()),
GetPage( GetPage(
name: Routers.lockUserListPage, page: () => const LockUserListPage()) name: Routers.lockUserListPage, page: () => const LockUserListPage()),
GetPage(
name: Routers.checkInCreatCompanyPage,
page: () => const CheckInCreatCompanyPage())
]; ];
} }

View File

@ -101,7 +101,7 @@ class BlueManage{
EasyLoading.dismiss(); EasyLoading.dismiss();
} }
}); });
_flutterReactiveBle!.connectToDevice(id: connectDeviceMacAddress, connectionTimeout: const Duration(seconds: 15)).listen((connectionStateUpdate) async { _flutterReactiveBle!.connectToDevice(id: connectDeviceMacAddress, connectionTimeout: const Duration(seconds: 100000)).listen((connectionStateUpdate) async {
// //
deviceConnectionState = connectionStateUpdate.connectionState; deviceConnectionState = connectionStateUpdate.connectionState;
print('ConnectionState for device $deviceMAC : ${connectionStateUpdate.connectionState}'); print('ConnectionState for device $deviceMAC : ${connectionStateUpdate.connectionState}');

View File

@ -13,6 +13,7 @@ import 'package:star_lock/translations/trans_lib.dart';
import 'appRouters.dart'; import 'appRouters.dart';
import 'baseWidget.dart'; import 'baseWidget.dart';
import 'tools/appRouteObserver.dart';
import 'tools/store_service.dart'; import 'tools/store_service.dart';
void main() async { void main() async {
@ -46,7 +47,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
GetMaterialApp _initMaterialApp() => GetMaterialApp( GetMaterialApp _initMaterialApp() => GetMaterialApp(
title: 'Star Lock', title: 'Star Lock',
navigatorObservers: [routeObserver], navigatorObservers: [routeObserver, AppRouteObserver().routeObserver],
translations: TranslationMessage(), translations: TranslationMessage(),
supportedLocales: appDept.deptSupportedLocales, supportedLocales: appDept.deptSupportedLocales,
localizationsDelegates: const [ localizationsDelegates: const [

View File

@ -0,0 +1,43 @@
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../network/api_repository.dart';
import 'checkingInList_state.dart';
class CheckingInListLogic extends BaseGetXController{
CheckingInListState state = CheckingInListState();
//
void openCheckingInData() async{
var entity = await ApiRepository.to.openCheckingInData(
lockId:state.getKeyInfosData.value.lockId.toString(),
);
if(entity.errorCode!.codeIsSuccessful){
state.companyId.value = entity.data!.companyId.toString();
}
}
@override
void onReady() {
// TODO: implement onReady
super.onReady();
print("onReady()");
openCheckingInData();
}
@override
void onInit() {
// TODO: implement onInit
super.onInit();
print("onInit()");
}
@override
void onClose() {
// TODO: implement onClose
}
}

View File

@ -8,6 +8,7 @@ import '../../../../tools/showBottomSheetTool.dart';
import '../../../../tools/showCalendar.dart'; import '../../../../tools/showCalendar.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart'; import '../../../../translations/trans_lib.dart';
import 'checkingInList_logic.dart';
class CheckingInListPage extends StatefulWidget { class CheckingInListPage extends StatefulWidget {
const CheckingInListPage({Key? key}) : super(key: key); const CheckingInListPage({Key? key}) : super(key: key);
@ -17,6 +18,9 @@ class CheckingInListPage extends StatefulWidget {
} }
class _CheckingInListPageState extends State<CheckingInListPage> { class _CheckingInListPageState extends State<CheckingInListPage> {
final logic = Get.put(CheckingInListLogic());
final state = Get.find<CheckingInListLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -29,7 +33,10 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
actionsList: [ actionsList: [
GestureDetector( GestureDetector(
onTap: () { onTap: () {
Navigator.pushNamed(context, Routers.checkingInSetPage); Get.toNamed(Routers.checkingInSetPage, arguments: {
"getKeyInfosData": state.getKeyInfosData.value,
"companyId": state.companyId.value
});
}, },
child: Image.asset( child: Image.asset(
'images/main/icon_lockDetail_checkIn_set.png', 'images/main/icon_lockDetail_checkIn_set.png',

View File

@ -0,0 +1,14 @@
import 'package:get/get.dart';
import '../../../lockMian/entity/lockInfoEntity.dart';
class CheckingInListState{
final getKeyInfosData = KeyInfos().obs;
final companyId = "".obs;
CheckingInListState() {
getKeyInfosData.value = Get.arguments as KeyInfos;
}
}

View File

@ -0,0 +1,9 @@
import '../../../../tools/baseGetXController.dart';
import 'checkingInSet_state.dart';
class CheckingInSetLogic extends BaseGetXController{
CheckingInSetState state = CheckingInSetState();
}

View File

@ -9,6 +9,7 @@ import '../../../../tools/showTFView.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart'; import '../../../../translations/trans_lib.dart';
import 'checkingInSet_logic.dart';
class CheckingInSetPage extends StatefulWidget { class CheckingInSetPage extends StatefulWidget {
const CheckingInSetPage({Key? key}) : super(key: key); const CheckingInSetPage({Key? key}) : super(key: key);
@ -18,6 +19,9 @@ class CheckingInSetPage extends StatefulWidget {
} }
class _CheckingInSetPageState extends State<CheckingInSetPage> { class _CheckingInSetPageState extends State<CheckingInSetPage> {
final logic = Get.put(CheckingInSetLogic());
final state = Get.find<CheckingInSetLogic>().state;
final TextEditingController _changeNameController = TextEditingController(); final TextEditingController _changeNameController = TextEditingController();
@override @override
@ -46,7 +50,10 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Navigator.pushNamed(context, Routers.checkingInStaffManagePage); Get.toNamed(Routers.checkingInStaffManagePage, arguments: {
"getKeyInfosData": state.getKeyInfosData.value,
"companyId": state.companyId.value
});
}), }),
CommonItem( CommonItem(
leftTitel: leftTitel:
@ -96,10 +103,15 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return ShowTFView( return ShowTFView(
title: title: "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}",
"${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}", tipTitle: "",
tipTitle: "", controller: _changeNameController,
controller: _changeNameController); sureClick: () {
},
cancelClick: () {
Navigator.pop(context);
},);
}); });
} }
} }

View File

@ -0,0 +1,15 @@
import 'package:get/get.dart';
import '../../../lockMian/entity/lockInfoEntity.dart';
class CheckingInSetState{
final getKeyInfosData = KeyInfos().obs;
final companyId = "".obs;
CheckingInSetState() {
Map map = Get.arguments;
getKeyInfosData.value = map["getKeyInfosData"];
companyId.value = map["companyId"];
}
}

View File

@ -0,0 +1,47 @@
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../network/api_repository.dart';
import 'checkingInAddStaff_state.dart';
class CheckingInAddStaffLogic extends BaseGetXController{
CheckingInAddStaffState state = CheckingInAddStaffState();
//
void addStaffLoadData() async{
var entity = await ApiRepository.to.addStaffData(
attendanceType: '',
attendanceWay: '',
companyId: state.companyId.value,
have: '',
staffName: '',
countryCode: '',
usernameType: '',
);
if(entity.errorCode!.codeIsSuccessful){
}
}
@override
void onReady() {
// TODO: implement onReady
super.onReady();
print("onReady()");
}
@override
void onInit() {
// TODO: implement onInit
super.onInit();
print("onInit()");
}
@override
void onClose() {
// TODO: implement onClose
}
}

View File

@ -8,6 +8,7 @@ import '../../../../tools/showBottomSheetTool.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart'; import '../../../../translations/trans_lib.dart';
import 'checkingInAddStaff_logic.dart';
class CheckingInAddStaffPage extends StatefulWidget { class CheckingInAddStaffPage extends StatefulWidget {
const CheckingInAddStaffPage({Key? key}) : super(key: key); const CheckingInAddStaffPage({Key? key}) : super(key: key);
@ -17,6 +18,9 @@ class CheckingInAddStaffPage extends StatefulWidget {
} }
class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> { class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
final logic = Get.put(CheckingInAddStaffLogic());
final state = Get.find<CheckingInAddStaffLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -97,7 +101,7 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
} }
Widget getTFWidget(String tfStr) { Widget getTFWidget(String tfStr) {
return Container( return SizedBox(
height: 50.h, height: 50.h,
width: 300.w, width: 300.w,
// color: Colors.red, // color: Colors.red,
@ -107,7 +111,7 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
child: TextField( child: TextField(
// //
maxLines: 1, maxLines: 1,
// controller: _controller, controller: state.staffNameController,
autofocus: false, autofocus: false,
textAlign: TextAlign.end, textAlign: TextAlign.end,
decoration: InputDecoration( decoration: InputDecoration(
@ -127,7 +131,10 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
void _showSeletClockInType() { void _showSeletClockInType() {
var list = [ var list = [
"15080825640", "APP",
"密码",
"",
"指纹",
]; ];
ShowBottomSheetTool().showSingleRowPicker( ShowBottomSheetTool().showSingleRowPicker(
// //

View File

@ -0,0 +1,18 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../../lockMian/entity/lockInfoEntity.dart';
class CheckingInAddStaffState{
final getKeyInfosData = KeyInfos().obs;
final companyId = "".obs;
final TextEditingController staffNameController = TextEditingController();
CheckingInAddStaffState() {
Map map = Get.arguments;
getKeyInfosData.value = map["getKeyInfosData"];
companyId.value = map["companyId"];
}
}

View File

@ -0,0 +1,44 @@
import 'package:date_format/date_format.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../network/api_repository.dart';
import 'checkingInStaffList_state.dart';
class CheckingInStaffManageLogic extends BaseGetXController{
CheckingInStaffManageState state = CheckingInStaffManageState();
//
void getStaffList() async{
var entity = await ApiRepository.to.getStaffListData(
companyId: state.companyId.value,
lockId:state.getKeyInfosData.value.lockId.toString(),
);
if(entity.errorCode!.codeIsSuccessful){
}
}
@override
void onReady() {
// TODO: implement onReady
super.onReady();
print("onReady()");
getStaffList();
}
@override
void onInit() {
// TODO: implement onInit
super.onInit();
print("onInit()");
}
@override
void onClose() {
// TODO: implement onClose
}
}

View File

@ -6,16 +6,20 @@ import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart'; import '../../../../translations/trans_lib.dart';
import 'checkingInStaffList_logic.dart';
class CheckingInStaffManagePage extends StatefulWidget { class CheckingInStaffListPage extends StatefulWidget {
const CheckingInStaffManagePage({Key? key}) : super(key: key); const CheckingInStaffListPage({Key? key}) : super(key: key);
@override @override
State<CheckingInStaffManagePage> createState() => State<CheckingInStaffListPage> createState() =>
_CheckingInStaffManagePageState(); _CheckingInStaffListPageState();
} }
class _CheckingInStaffManagePageState extends State<CheckingInStaffManagePage> { class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
final logic = Get.put(CheckingInStaffManageLogic());
final state = Get.find<CheckingInStaffManageLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -27,7 +31,11 @@ class _CheckingInStaffManagePageState extends State<CheckingInStaffManagePage> {
actionsList: [ actionsList: [
GestureDetector( GestureDetector(
onTap: () { onTap: () {
Navigator.pushNamed(context, Routers.checkingInAddStaffPage); Navigator.pushNamed(context, Routers.checkingInAddStaffPage,
arguments: {
"getKeyInfosData": state.getKeyInfosData.value,
"companyId": state.companyId.value
});
}, },
child: Image.asset( child: Image.asset(
'images/icon_add_white.png', 'images/icon_add_white.png',

View File

@ -0,0 +1,16 @@
import 'package:get/get.dart';
import '../../../lockMian/entity/lockInfoEntity.dart';
class CheckingInStaffManageState{
final getKeyInfosData = KeyInfos().obs;
final companyId = "".obs;
CheckingInStaffManageState() {
Map map = Get.arguments;
getKeyInfosData.value = map["getKeyInfosData"];
companyId.value = map["companyId"];
}
}

View File

@ -0,0 +1,9 @@
import 'package:star_lock/tools/baseGetXController.dart';
import 'checkingInSetWorkTime_state.dart';
class CheckingInSetWorkTimeLogic extends BaseGetXController{
CheckingInSetWorkTimeState state = CheckingInSetWorkTimeState();
}

View File

@ -1,12 +1,16 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_pickers/pickers.dart';
import 'package:flutter_pickers/time_picker/model/date_mode.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/tools/toast.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
import '../../../../tools/commonItem.dart'; import '../../../../tools/commonItem.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart'; import '../../../../translations/trans_lib.dart';
import 'checkingInSetWorkTime_logic.dart';
class CheckingInSetWorkTimePage extends StatefulWidget { class CheckingInSetWorkTimePage extends StatefulWidget {
const CheckingInSetWorkTimePage({Key? key}) : super(key: key); const CheckingInSetWorkTimePage({Key? key}) : super(key: key);
@ -16,6 +20,8 @@ class CheckingInSetWorkTimePage extends StatefulWidget {
} }
class _CheckingInSetWorkTimePageState extends State<CheckingInSetWorkTimePage> { class _CheckingInSetWorkTimePageState extends State<CheckingInSetWorkTimePage> {
final logic = Get.put(CheckingInSetWorkTimeLogic());
final state = Get.find<CheckingInSetWorkTimeLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -29,16 +35,28 @@ class _CheckingInSetWorkTimePageState extends State<CheckingInSetWorkTimePage> {
Widget buildMainUI(){ Widget buildMainUI(){
return Column( return Column(
children: [ children: [
CommonItem(leftTitel:TranslationLoader.lanKeys!.officeHours!.tr, rightTitle:"11:49", isHaveDirection: true, isHaveLine: true, action:(){ Obx(() => CommonItem(leftTitel:TranslationLoader.lanKeys!.officeHours!.tr, rightTitle:state.beginTime.value, isHaveDirection: true, isHaveLine: true, action:(){
// ShowSeletDateTime().showDatePicker(context, '2100-01-01 00:00', '1900-01-01 00:00', getNowDate(),'yyyy-MMMM-dd HH:mm', (dateTime, List<int> index) { Pickers.showDatePicker(context, mode: DateMode.HM,
// onConfirm: (p) {
// }); setState(() {
}), DateTime today = DateTime.now();
CommonItem(leftTitel:TranslationLoader.lanKeys!.closingTime!.tr, rightTitle:"11:49", isHaveDirection: true, action:(){ state.beginTimeTimestamp.value = DateTime.parse(
// ShowSeletDateTime().showDatePicker(context, '00:00', '00:00', getNowDate(),'HH:mm', (dateTime, List<int> index) { '${today.year}-${today.month.toString().padLeft(2,'0')}-${today.day.toString().padLeft(2,'0')} ${p.hour!.toString().padLeft(2,'0')}:${p.minute!.toString().padLeft(2,'0')}').millisecondsSinceEpoch.toString();
// state.beginTime.value = "${p.hour.toString().padLeft(2,'0')}:${p.minute!.toString().padLeft(2,'0')}";
// }); });
}), });
})),
Obx(() => CommonItem(leftTitel:TranslationLoader.lanKeys!.closingTime!.tr, rightTitle:state.endTime.value, isHaveDirection: true, action:(){
Pickers.showDatePicker(context, mode: DateMode.HM,
onConfirm: (p) {
setState(() {
DateTime today = DateTime.now();
state.endTimeTimestamp.value = DateTime.parse(
'${today.year}-${today.month.toString().padLeft(2,'0')}-${today.day.toString().padLeft(2,'0')} ${p.hour!.toString().padLeft(2,'0')}:${p.minute!.toString().padLeft(2,'0')}').millisecondsSinceEpoch.toString();
state.endTime.value = "${p.hour.toString().padLeft(2,'0')}:${p.minute!.toString().padLeft(2,'0')}";
});
});
})),
SizedBox(height: 30.h,), SizedBox(height: 30.h,),
SubmitBtn(btnName: TranslationLoader.lanKeys!.sure!.tr, SubmitBtn(btnName: TranslationLoader.lanKeys!.sure!.tr,
borderRadius: 20.w, borderRadius: 20.w,
@ -46,7 +64,16 @@ class _CheckingInSetWorkTimePageState extends State<CheckingInSetWorkTimePage> {
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 20.w), margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 20.w),
padding: EdgeInsets.only(top: 20.w, bottom: 20.w), padding: EdgeInsets.only(top: 20.w, bottom: 20.w),
onClick: () { onClick: () {
if(int.parse(state.beginTimeTimestamp.value) > int.parse(state.endTimeTimestamp.value)){
Toast.show(msg: "结束时间不能大于开始时间");
return;
}
Get.back(result: {
"beginTime":state.beginTime.value,
"beginTimeTimestamp":state.beginTimeTimestamp.value,
"endTime":state.endTime.value,
"endTimeTimestamp":state.endTimeTimestamp.value,
});
} }
), ),
], ],

View File

@ -0,0 +1,10 @@
import 'package:get/get.dart';
class CheckingInSetWorkTimeState{
var beginTime = "".obs;//
var endTime = "".obs;//
var beginTimeTimestamp = "".obs;//
var endTimeTimestamp = "".obs;//
}

View File

@ -0,0 +1,9 @@
import 'package:star_lock/tools/baseGetXController.dart';
import 'checkingInSetWorkdaySet_state.dart';
class CheckingInSetWorkdaySetLogic extends BaseGetXController{
CheckingInSetWorkdaySetState state = CheckingInSetWorkdaySetState();
}

View File

@ -7,6 +7,7 @@ import '../../../../tools/commonItem.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart'; import '../../../../translations/trans_lib.dart';
import 'checkingInSetWorkdaySet_logic.dart';
class CheckingInSetWorkdaySet extends StatefulWidget { class CheckingInSetWorkdaySet extends StatefulWidget {
const CheckingInSetWorkdaySet({Key? key}) : super(key: key); const CheckingInSetWorkdaySet({Key? key}) : super(key: key);
@ -17,6 +18,9 @@ class CheckingInSetWorkdaySet extends StatefulWidget {
} }
class _CheckingInSetWorkdaySetState extends State<CheckingInSetWorkdaySet> { class _CheckingInSetWorkdaySetState extends State<CheckingInSetWorkdaySet> {
final logic = Get.put(CheckingInSetWorkdaySetLogic());
final state = Get.find<CheckingInSetWorkdaySetLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -29,15 +33,17 @@ class _CheckingInSetWorkdaySetState extends State<CheckingInSetWorkdaySet> {
body: ListView( body: ListView(
children: [ children: [
topBtnWidget(), topBtnWidget(),
Visibility(visible: true, child: bottomCustomSeletBtn()), Obx(() => Visibility(visible: state.isCustom.value == true, child: bottomCustomSeletBtn())),
Visibility(visible: false, child: bottomOddOrEvenDaysOffSeletBtn()), Obx(() => Visibility(visible: !state.isCustom.value, child: bottomOddOrEvenDaysOffSeletBtn())),
SizedBox( SizedBox(height: 50.h,),
height: 50.h,
),
Container( Container(
margin: EdgeInsets.only(left: 20.w, right: 20.w), margin: EdgeInsets.only(left: 20.w, right: 20.w),
child: SubmitBtn( child: SubmitBtn(btnName: TranslationLoader.lanKeys!.sure!.tr, onClick: () {
btnName: TranslationLoader.lanKeys!.sure!.tr, onClick: () {}), Get.back(result: {
"attendanceType":state.isCustom.value,
"weekDays":state.weekDays.value,
});
}),
), ),
], ],
), ),
@ -50,44 +56,55 @@ class _CheckingInSetWorkdaySetState extends State<CheckingInSetWorkdaySet> {
height: 100.h, height: 100.h,
// color: Colors.red, // color: Colors.red,
padding: EdgeInsets.all(10.w), padding: EdgeInsets.all(10.w),
child: Row( child: Obx(() => Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Container( GestureDetector(
width: (1.sw - 5.w * 2) / 2, onTap: (){
height: 100.h, setState(() {
color: AppColors.mainColor, state.isCustom.value = true;
child: Row( });
mainAxisAlignment: MainAxisAlignment.center, },
children: [ child: Container(
Center( width: (1.sw - 5.w * 2) / 2,
child: Text(TranslationLoader.lanKeys!.custom!.tr, height: 100.h,
style: color: state.isCustom.value ? AppColors.mainColor : AppColors.btnDisableColor,
TextStyle(fontSize: 26.sp, color: Colors.white))), child: Row(
], mainAxisAlignment: MainAxisAlignment.center,
children: [
Center(child: Text(TranslationLoader.lanKeys!.custom!.tr, style: TextStyle(fontSize: 26.sp, color: Colors.white))),
],
),
), ),
), ),
// SizedBox(width: 10.w,), // SizedBox(width: 10.w,),
Container( GestureDetector(
width: (1.sw - 10 * 3) / 2, onTap: (){
height: 100.h, setState(() {
color: AppColors.btnDisableColor, state.isCustom.value = false;
padding: EdgeInsets.all(10.w), });
child: Row( },
mainAxisAlignment: MainAxisAlignment.center, child: Container(
children: [ width: (1.sw - 10 * 3) / 2,
Expanded( height: 100.h,
child: Center( color: state.isCustom.value ? AppColors.btnDisableColor : AppColors.mainColor,
child: Text( padding: EdgeInsets.all(10.w),
TranslationLoader.lanKeys!.oddOrEvenDaysOff!.tr, child: Row(
style: TextStyle(fontSize: 26.sp, color: Colors.white), mainAxisAlignment: MainAxisAlignment.center,
textAlign: TextAlign.center, children: [
))), Expanded(
], child: Center(
child: Text(
TranslationLoader.lanKeys!.oddOrEvenDaysOff!.tr,
style: TextStyle(fontSize: 26.sp, color: Colors.white),
textAlign: TextAlign.center,
))),
],
),
), ),
), ),
], ],
), )),
); );
} }
@ -101,42 +118,46 @@ class _CheckingInSetWorkdaySetState extends State<CheckingInSetWorkdaySet> {
rightTitle: "", rightTitle: "",
allHeight: 60.h, allHeight: 60.h,
isHaveLine: true), isHaveLine: true),
CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.singleDayWeekend!.tr, leftTitel: TranslationLoader.lanKeys!.singleDayWeekend!.tr,
rightTitle: "", rightTitle: "",
allHeight: 60.h, allHeight: 60.h,
isHaveLine: true, isHaveLine: true,
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: GestureDetector( rightWidget: GestureDetector(
onTap: () {}, onTap: () {
setState(() {
state.isSingledayWeekend.value = 0;
state.weekDays.value = [1, 2 , 3, 4, 5, 6];
});
},
child: Row( child: Row(
children: [ children: [
Image.asset( Image.asset(state.isSingledayWeekend.value == 0 ? 'images/icon_round_selet.png' : 'images/icon_round_unSelet.png', width: 30.w, height: 30.w,),
'images/icon_round_unSelet.png',
width: 30.w,
height: 30.w,
),
], ],
), ),
)), )
CommonItem( )),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.twoDaysOff!.tr, leftTitel: TranslationLoader.lanKeys!.twoDaysOff!.tr,
rightTitle: "", rightTitle: "",
allHeight: 60.h, allHeight: 60.h,
isHaveLine: false, isHaveLine: false,
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: GestureDetector( rightWidget: GestureDetector(
onTap: () {}, onTap: () {
setState(() {
state.isSingledayWeekend.value = 1;
state.weekDays.value = [1, 2 , 3, 4, 5];
});
},
child: Row( child: Row(
children: [ children: [
Image.asset( Image.asset(state.isSingledayWeekend.value == 1 ? 'images/icon_round_selet.png' : 'images/icon_round_unSelet.png', width: 30.w, height: 30.w,),
'images/icon_round_unSelet.png',
width: 30.w,
height: 30.w,
),
], ],
), ),
)), )
)),
], ],
), ),
); );
@ -145,136 +166,66 @@ class _CheckingInSetWorkdaySetState extends State<CheckingInSetWorkdaySet> {
Widget bottomCustomSeletBtn() { Widget bottomCustomSeletBtn() {
return Container( return Container(
padding: EdgeInsets.only(left: 10.w, right: 10.w), padding: EdgeInsets.only(left: 10.w, right: 10.w),
child: Column( height: 420.h,
children: [ child: ListView.builder(
CommonItem( itemCount: 7,
leftTitel: TranslationLoader.lanKeys!.monday!.tr, physics: const NeverScrollableScrollPhysics(),
rightTitle: "", itemBuilder: (c, index) {
allHeight: 60.h, index += 1;
isHaveLine: true, String dateStr;
isHaveRightWidget: true, switch (index) {
rightWidget: GestureDetector( case 1:
onTap: () {}, dateStr = TranslationLoader.lanKeys!.monday!.tr;
child: Row( break;
children: [ case 2:
Image.asset( dateStr = TranslationLoader.lanKeys!.tuesday!.tr;
'images/icon_round_unSelet.png', break;
width: 30.w, case 3:
height: 30.w, dateStr = TranslationLoader.lanKeys!.wednesday!.tr;
), break;
], case 4:
), dateStr = TranslationLoader.lanKeys!.thursday!.tr;
)), break;
CommonItem( case 5:
leftTitel: TranslationLoader.lanKeys!.tuesday!.tr, dateStr = TranslationLoader.lanKeys!.friday!.tr;
rightTitle: "", break;
allHeight: 60.h, case 6:
isHaveLine: true, dateStr = TranslationLoader.lanKeys!.saturday!.tr;
isHaveRightWidget: true, break;
rightWidget: GestureDetector( case 7:
onTap: () {}, dateStr = TranslationLoader.lanKeys!.sunday!.tr;
child: Row( break;
children: [ default:
Image.asset( dateStr = "";
'images/icon_round_unSelet.png', break;
width: 30.w, }
height: 30.w, return CommonItem(
), leftTitel: dateStr,
], rightTitle: "",
), allHeight: 60.h,
)), isHaveLine: true,
CommonItem( isHaveRightWidget: true,
leftTitel: TranslationLoader.lanKeys!.wednesday!.tr, rightWidget: GestureDetector(
rightTitle: "", onTap: () {
allHeight: 60.h, setState(() {
isHaveLine: true, state.isSingledayWeekend.value = 2;
isHaveRightWidget: true, if(state.weekDays.value.contains(index)){
rightWidget: GestureDetector( state.weekDays.value.remove(index);
onTap: () {}, }else{
child: Row( state.weekDays.value.add(index);
children: [ }
Image.asset( state.weekDays.value.sort();
'images/icon_round_unSelet.png', });
width: 30.w, },
height: 30.w, child: Row(
), children: [
], Image.asset(state.weekDays.value.contains(index) ? 'images/icon_round_selet.png' : 'images/icon_round_unSelet.png', width: 30.w, height: 30.w,),
), ],
)), ))
CommonItem( );
leftTitel: TranslationLoader.lanKeys!.thursday!.tr, }
rightTitle: "",
allHeight: 60.h,
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: GestureDetector(
onTap: () {},
child: Row(
children: [
Image.asset(
'images/icon_round_unSelet.png',
width: 30.w,
height: 30.w,
),
],
),
)),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.friday!.tr,
rightTitle: "",
allHeight: 60.h,
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: GestureDetector(
onTap: () {},
child: Row(
children: [
Image.asset(
'images/icon_round_unSelet.png',
width: 30.w,
height: 30.w,
),
],
),
)),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.saturday!.tr,
rightTitle: "",
allHeight: 60.h,
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: GestureDetector(
onTap: () {},
child: Row(
children: [
Image.asset(
'images/icon_round_unSelet.png',
width: 30.w,
height: 30.w,
),
],
),
)),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.sunday!.tr,
rightTitle: "",
allHeight: 60.h,
isHaveLine: false,
isHaveRightWidget: true,
rightWidget: GestureDetector(
onTap: () {},
child: Row(
children: [
Image.asset(
'images/icon_round_unSelet.png',
width: 30.w,
height: 30.w,
),
],
),
)),
],
), ),
); );
} }
} }

View File

@ -0,0 +1,10 @@
import 'package:get/get.dart';
class CheckingInSetWorkdaySetState{
var isCustom = true.obs;
var isSingledayWeekend = 2.obs; // 0 1
var weekDays = [].obs;//
}

View File

@ -0,0 +1,45 @@
import 'package:get/get.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../network/api_repository.dart';
import '../../../../tools/eventBusEventManage.dart';
import '../../../../tools/toast.dart';
import 'checkInCreatCompany_state.dart';
class CheckInCreatCompanyLogic extends BaseGetXController{
CheckInCreatCompanyState state = CheckInCreatCompanyState();
//
void setCheckInCreateCompany() async{
var entity = await ApiRepository.to.setCheckInCreateCompanyData(
lockId: state.getKeyInfosData.value.lockId.toString(),
attendanceType: state.isCustom.value ? "0" :"1",
companyName: state.companyNameController.text,
workDay: state.weekDays.value,
workEndTime: state.endTimeTimestamp.value,
workStartTime: state.beginTimeTimestamp.value,
);
if(entity.errorCode!.codeIsSuccessful){
setLockSetGeneralSetting();
}
}
//
void setLockSetGeneralSetting() async{
var entity = await ApiRepository.to.setLockSetGeneralSettingData(
lockId: state.getKeyInfosData.value.lockId.toString(),
changeType:"1",
isOn:"1",
type:"1",
);
if(entity.errorCode!.codeIsSuccessful){
eventBus.fire(RefreshLockListInfoDataEvent());
state.getKeyInfosData.value.isAttendance = 1;
eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value));
Get.back();
Toast.show(msg: "设置成功");
}
}
}

View File

@ -0,0 +1,119 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/commonItem.dart';
import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
import 'checkInCreatCompany_logic.dart';
class CheckInCreatCompanyPage extends StatefulWidget {
const CheckInCreatCompanyPage({Key? key}) : super(key: key);
@override
State<CheckInCreatCompanyPage> createState() => _CheckInCreatCompanyPageState();
}
class _CheckInCreatCompanyPageState extends State<CheckInCreatCompanyPage> {
final logic = Get.put(CheckInCreatCompanyLogic());
final state = Get.find<CheckInCreatCompanyLogic>().state;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: "创建公司",
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Column(
children: [
CommonItem(
leftTitel: "${TranslationLoader.lanKeys!.company!.tr}${TranslationLoader.lanKeys!.name!.tr}",
rightTitle: "",
isHaveRightWidget: true,
rightWidget: getTFWidget(false, TranslationLoader.lanKeys!.enterYourName!.tr, 2)),
Obx(() => CommonItem(
leftTitel:
"${TranslationLoader.lanKeys!.work!.tr}${TranslationLoader.lanKeys!.time!.tr}",
rightTitle: (state.beginTime.value.isNotEmpty) ? "${state.beginTime.value} - ${state.endTime.value}" : "",
isHaveLine: true,
isHaveDirection: true,
action: () async {
var data = await Get.toNamed(Routers.checkingInSetWorkTimePage);
if(data != null) {
setState(() {
state.beginTime.value = data["beginTime"];
state.endTime.value = data["endTime"];
state.beginTimeTimestamp.value = data["beginTimeTimestamp"];
state.endTimeTimestamp.value = data["endTimeTimestamp"];
});
}
})),
Obx(() => CommonItem(
leftTitel:
"${TranslationLoader.lanKeys!.workday!.tr}${TranslationLoader.lanKeys!.set!.tr}",
rightTitle: state.weekDaysStr.value,
isHaveLine: true,
isHaveDirection: true,
action: () async {
var data = await Get.toNamed(Routers.checkingInSetWorkdaySet);
if(data != null) {
setState(() {
state.isCustom.value = data["attendanceType"];
state.weekDays.value = data["weekDays"];
state.weekDaysStr.value = "";
state.weekDaysStr.value = state.weekDays.value.join(",");
});
}
})),
SizedBox(
height: 30.h,
),
SubmitBtn(
btnName: TranslationLoader.lanKeys!.sure!.tr,
borderRadius: 20.w,
fontSize: 32.sp,
isDelete: false,
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 20.w),
padding: EdgeInsets.only(top: 20.w, bottom: 20.w),
onClick: () {
logic.setCheckInCreateCompany();
}),
],
),
);
}
Widget getTFWidget(bool isHaveBtn, String tfStr, int lineIndex) {
return SizedBox(
height: 50.h,
width: 320.w,
child: Row(
children: [
Expanded(
child: TextField(
controller:state.companyNameController,
//
maxLines: 1,
autofocus: false,
textAlign: TextAlign.end,
decoration: InputDecoration(
//
contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr,
hintStyle: TextStyle(fontSize: 22.sp),
//线
border: InputBorder.none,
),
),
)
],
),
);
}
}

View File

@ -0,0 +1,24 @@
import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import '../../../lockMian/entity/lockInfoEntity.dart';
class CheckInCreatCompanyState{
var getKeyInfosData = KeyInfos().obs;
TextEditingController companyNameController = TextEditingController();
var isCustom = true.obs;
var weekDays = [].obs;//
var weekDaysStr = "".obs;//
var beginTime = "".obs;//
var endTime = "".obs;//
var beginTimeTimestamp = "".obs;//
var endTimeTimestamp = "".obs;//
CheckInCreatCompanyState() {
getKeyInfosData.value = Get.arguments as KeyInfos;
}
}

View File

@ -1,9 +1,49 @@
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../network/api_repository.dart';
import '../../../../tools/eventBusEventManage.dart';
import '../../../../tools/toast.dart';
import 'diagnose_state.dart'; import 'diagnose_state.dart';
class DiagnoseLogic extends BaseGetXController{ class DiagnoseLogic extends BaseGetXController{
DiagnoseState state = DiagnoseState(); DiagnoseState state = DiagnoseState();
//
Future<void> setLockDiagnose() async{
var entity = await ApiRepository.to.setLockDiagnoseData(
lockId: state.getKeyInfosData.value.lockId.toString(),
electricQuantity:"23",
firmwareRevision:"1.0", // 1-2-;
hardwareRevision:"1.3", // 4
lockDate:"1689410557000",
modelNum:"123456",
pwdInfo:"123456",
timestamp:"1689410559456000",
);
if(entity.errorCode!.codeIsSuccessful){
Toast.show(msg: "操作成功");
}
}
@override
void onReady() {
// TODO: implement onReady
super.onReady();
print("onReady()");
}
@override
void onInit() {
// TODO: implement onInit
super.onInit();
print("onInit()");
}
@override
void onClose() {
// TODO: implement onClose
}
} }

View File

@ -6,6 +6,7 @@ import '../../../../app_settings/app_colors.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart'; import '../../../../translations/trans_lib.dart';
import 'diagnose_logic.dart';
class DiagnosePage extends StatefulWidget { class DiagnosePage extends StatefulWidget {
const DiagnosePage({Key? key}) : super(key: key); const DiagnosePage({Key? key}) : super(key: key);
@ -15,6 +16,9 @@ class DiagnosePage extends StatefulWidget {
} }
class _DiagnosePageState extends State<DiagnosePage> { class _DiagnosePageState extends State<DiagnosePage> {
final logic = Get.put(DiagnoseLogic());
final state = Get.find<DiagnoseLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -47,7 +51,9 @@ class _DiagnosePageState extends State<DiagnosePage> {
fontSize: 32.sp, fontSize: 32.sp,
// margin: EdgeInsets.only(left: 03.w, right: 30.w, top: 20.w), // margin: EdgeInsets.only(left: 03.w, right: 30.w, top: 20.w),
padding: EdgeInsets.only(top: 20.w, bottom: 20.w), padding: EdgeInsets.only(top: 20.w, bottom: 20.w),
onClick: () {}), onClick: () {
logic.setLockDiagnose();
}),
], ],
), ),
)); ));

View File

@ -1,4 +1,12 @@
import 'package:get/get.dart';
import '../../../lockMian/entity/lockInfoEntity.dart';
class DiagnoseState{ class DiagnoseState{
var getKeyInfosData = KeyInfos().obs;
DiagnoseState() {
getKeyInfosData.value = Get.arguments as KeyInfos;
}
} }

View File

@ -0,0 +1,60 @@
class CheckingInInfoDataEntity {
int? errorCode;
String? description;
String? errorMsg;
Data? data;
CheckingInInfoDataEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
CheckingInInfoDataEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
data = json['data'] != null ? Data.fromJson(json['data']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['errorCode'] = errorCode;
data['description'] = description;
data['errorMsg'] = errorMsg;
if (this.data != null) {
data['data'] = this.data!.toJson();
}
return data;
}
}
class Data {
int? workEndTime;
int? attendanceType;
int? companyId;
int? workStartTime;
List<int>? workDay;
Data(
{this.workEndTime,
this.attendanceType,
this.companyId,
this.workStartTime,
this.workDay});
Data.fromJson(Map<String, dynamic> json) {
workEndTime = json['workEndTime'];
attendanceType = json['attendanceType'];
companyId = json['companyId'];
workStartTime = json['workStartTime'];
workDay = json['workDay'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['workEndTime'] = workEndTime;
data['attendanceType'] = attendanceType;
data['companyId'] = companyId;
data['workStartTime'] = workStartTime;
data['workDay'] = workDay;
return data;
}
}

View File

@ -1,4 +1,3 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart'; import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
@ -16,27 +15,81 @@ import '../../../../network/api_repository.dart';
import '../../../../tools/baseGetXController.dart'; import '../../../../tools/baseGetXController.dart';
import '../../../../tools/eventBusEventManage.dart'; import '../../../../tools/eventBusEventManage.dart';
import '../../../../tools/storage.dart'; import '../../../../tools/storage.dart';
import '../../../../tools/toast.dart';
import 'CheckingInInfoDataEntity.dart';
import 'lockSet_state.dart'; import 'lockSet_state.dart';
typedef BlockSetStateCallback = void Function(); typedef BlockSetStateCallback = void Function();
class LockSetLogic extends BaseGetXController{ typedef BlockSetCheckInCallback = void Function(
CheckingInInfoDataEntity checkingInInfoDataEntity);
class LockSetLogic extends BaseGetXController {
final LockSetState state = LockSetState(); final LockSetState state = LockSetState();
// //
void deletLockInfoData() async{ void deletLockInfoData() async {
var entity = await ApiRepository.to.deletLockData( var entity = await ApiRepository.to.deletLockData(
lockId:state.getKeyInfosData.value.lockId.toString(), lockId: state.getKeyInfosData.value.lockId.toString(),
); );
if(entity.errorCode!.codeIsSuccessful){ if (entity.errorCode!.codeIsSuccessful) {
Get.offAllNamed(Routers.starLockMain); Get.offAllNamed(Routers.starLockMain);
} }
} }
//
void openCheckingInData(
BlockSetCheckInCallback blockSetCheckInCallback) async {
var entity = await ApiRepository.to.openCheckingInData(
lockId: state.getKeyInfosData.value.lockId.toString(),
);
if (entity.errorCode!.codeIsSuccessful) {
blockSetCheckInCallback(entity);
}
}
//
void setLockSetGeneralSetting(String isOn) async {
var entity = await ApiRepository.to.setLockSetGeneralSettingData(
lockId: state.getKeyInfosData.value.lockId.toString(),
changeType: "1",
isOn: isOn,
type: "1",
);
if (entity.errorCode!.codeIsSuccessful) {
eventBus.fire(RefreshLockListInfoDataEvent());
state.getKeyInfosData.value.isAttendance = int.parse(isOn);
eventBus
.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value));
Toast.show(msg: "设置成功");
} else {}
}
//
void setLockPickingReminder() async {
var entity = await ApiRepository.to.setLockPickingReminderData(
lockId: state.getKeyInfosData.value.lockId.toString(),
keyId: state.getKeyInfosData.value.keyId.toString(),
monitorFlag:
state.isLockPickingReminder.value == 1 ? "1" : "2", // 12
);
if (entity.errorCode!.codeIsSuccessful) {
eventBus.fire(RefreshLockListInfoDataEvent());
state.getKeyInfosData.value.monitorFlag =
state.isLockPickingReminder.value;
eventBus
.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value));
Toast.show(msg: "设置成功");
} else {}
}
// //
StreamSubscription? _passCurrentLockInformationEvent; StreamSubscription? _passCurrentLockInformationEvent;
void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) { void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) {
// eventBus // eventBus
_passCurrentLockInformationEvent = eventBus.on<PassCurrentLockInformationEvent>().listen((event) { _passCurrentLockInformationEvent =
eventBus.on<PassCurrentLockInformationEvent>().listen((event) {
state.getKeyInfosData.value = event.keyInfo; state.getKeyInfosData.value = event.keyInfo;
blockSetStateCallback(); blockSetStateCallback();
}); });
@ -45,8 +98,9 @@ class LockSetLogic extends BaseGetXController{
// //
late StreamSubscription<Reply> _replySubscription; late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() { void _initReplySubscription() {
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) async { _replySubscription =
if(reply is DeletUserReply) { EventBusManager().eventBus!.on<Reply>().listen((reply) async {
if (reply is DeletUserReply) {
var tokenData = reply.data.sublist(2, 6); var tokenData = reply.data.sublist(2, 6);
var saveStrList = changeIntListToStringList(tokenData); var saveStrList = changeIntListToStringList(tokenData);
print("openDoorToken:$tokenData"); print("openDoorToken:$tokenData");
@ -54,45 +108,46 @@ class LockSetLogic extends BaseGetXController{
int status = reply.data[6]; int status = reply.data[6];
print("status:$status"); print("status:$status");
switch(status){ switch (status) {
case 0x00: case 0x00:
// //
print("${reply.commandType}解析成功"); print("${reply.commandType}解析成功");
deletLockInfoData(); deletLockInfoData();
break; break;
case 0x06: case 0x06:
// //
print("${reply.commandType}需要鉴权"); print("${reply.commandType}需要鉴权");
var privateKey = await Storage.getStringList(saveBluePrivateKey); var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!);
var publicKey = await Storage.getStringList(saveBluePublicKey); var publicKey = await Storage.getStringList(saveBluePublicKey);
List<int> publicKeyDataList = changeStringListToIntList(publicKey!); List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
IoSenderManage.deletUser( IoSenderManage.deletUser(
lockID:state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName, lockID:
authUserID:await Storage.getUid(), state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName,
keyID:"1", authUserID: await Storage.getUid(),
delUserID:await Storage.getUid(), keyID: "1",
needAuthor:1, delUserID: await Storage.getUid(),
publicKey:publicKeyDataList, needAuthor: 1,
privateKey:getPrivateKeyList, publicKey: publicKeyDataList,
token: tokenData privateKey: getPrivateKeyList,
); token: tokenData);
break; break;
case 0x07: case 0x07:
// //
print("${reply.commandType}用户无权限"); print("${reply.commandType}用户无权限");
break; break;
case 0x09: case 0x09:
// //
print("${reply.commandType}权限校验错误"); print("${reply.commandType}权限校验错误");
break; break;
default: default:
// //
print("${reply.commandType}失败"); print("${reply.commandType}失败");
break; break;
@ -103,8 +158,10 @@ class LockSetLogic extends BaseGetXController{
// //
Future<void> deletUserAction() async { Future<void> deletUserAction() async {
BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState connectionState) async { BlueManage().judgeReconnect(
if (connectionState == DeviceConnectionState.connected){ BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName,
(DeviceConnectionState connectionState) async {
if (connectionState == DeviceConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey); var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
@ -114,17 +171,17 @@ class LockSetLogic extends BaseGetXController{
var token = await Storage.getStringList(saveBlueToken); var token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!); List<int> getTokenList = changeStringListToIntList(token!);
print("openDoorTokenPubToken:$getTokenList"); print("openDoorTokenPubToken:$getTokenList");
print("state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName:${state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName}"); print(
"state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName:${state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName}");
IoSenderManage.deletUser( IoSenderManage.deletUser(
lockID:state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName, lockID: state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName,
authUserID:"100001", authUserID: "100001",
keyID:"1", keyID: "1",
delUserID:"100001", delUserID: "100001",
needAuthor:1, needAuthor: 1,
publicKey:publicKeyDataList, publicKey: publicKeyDataList,
privateKey:getPrivateKeyList, privateKey: getPrivateKeyList,
token: getTokenList token: getTokenList);
);
} }
}); });
} }
@ -143,8 +200,6 @@ class LockSetLogic extends BaseGetXController{
// TODO: implement onInit // TODO: implement onInit
super.onInit(); super.onInit();
print("onInit()"); print("onInit()");
} }
@override @override
@ -153,5 +208,4 @@ class LockSetLogic extends BaseGetXController{
_replySubscription.cancel(); _replySubscription.cancel();
_passCurrentLockInformationEvent!.cancel(); _passCurrentLockInformationEvent!.cancel();
} }
} }

View File

@ -7,8 +7,10 @@ import 'package:get/get.dart';
import '../../../../appRouters.dart'; import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
import '../../../../tools/appRouteObserver.dart';
import '../../../../tools/commonItem.dart'; import '../../../../tools/commonItem.dart';
import '../../../../tools/eventBusEventManage.dart'; import '../../../../tools/eventBusEventManage.dart';
import '../../../../tools/showIosTipView.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
import '../../../../tools/toast.dart'; import '../../../../tools/toast.dart';
@ -22,7 +24,7 @@ class LockSetPage extends StatefulWidget {
State<LockSetPage> createState() => _LockSetPageState(); State<LockSetPage> createState() => _LockSetPageState();
} }
class _LockSetPageState extends State<LockSetPage> { class _LockSetPageState extends State<LockSetPage> with RouteAware {
final logic = Get.put(LockSetLogic()); final logic = Get.put(LockSetLogic());
final state = Get.find<LockSetLogic>().state; final state = Get.find<LockSetLogic>().state;
StreamSubscription? _passCurrentLockInformationEvent; StreamSubscription? _passCurrentLockInformationEvent;
@ -207,13 +209,15 @@ class _LockSetPageState extends State<LockSetPage> {
rightTitle: "", rightTitle: "",
isHaveLine: true, isHaveLine: true,
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: SizedBox(width: 60.w, child: _switch())), rightWidget:
SizedBox(width: 60.w, child: _openCheckInSwitch())),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.unlockReminder!.tr, leftTitel: TranslationLoader.lanKeys!.unlockReminder!.tr,
rightTitle: "", rightTitle: "",
isHaveLine: false, isHaveLine: false,
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: SizedBox(width: 60.w, child: _switch())), rightWidget:
SizedBox(width: 60.w, child: _lockRemindSwitch())),
SizedBox( SizedBox(
height: 10.h, height: 10.h,
), ),
@ -241,7 +245,8 @@ class _LockSetPageState extends State<LockSetPage> {
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.diagnosePage); Get.toNamed(Routers.diagnosePage,
arguments: state.getKeyInfosData.value);
}), }),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.uploadData!.tr, leftTitel: TranslationLoader.lanKeys!.uploadData!.tr,
@ -288,18 +293,110 @@ class _LockSetPageState extends State<LockSetPage> {
)); ));
} }
CupertinoSwitch _switch() { CupertinoSwitch _openCheckInSwitch() {
bool _isOn = false;
return CupertinoSwitch( return CupertinoSwitch(
activeColor: CupertinoColors.activeBlue, activeColor: CupertinoColors.activeBlue,
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: _isOn, value: (state.getKeyInfosData.value.isAttendance == 1) ? true : false,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
_isOn = value; int isOnStr;
if (value == true) {
isOnStr = 1;
} else {
isOnStr = 2;
}
logic.openCheckingInData((checkingInInfoDataEntity) {
if (checkingInInfoDataEntity.data!.companyId == 0) {
showCupertinoAlertDialog(context);
} else {
logic.setLockSetGeneralSetting(isOnStr.toString());
}
});
}); });
}, },
); );
} }
CupertinoSwitch _lockRemindSwitch() {
return CupertinoSwitch(
activeColor: CupertinoColors.activeBlue,
trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white,
value: state.isLockPickingReminder.value == 1 ? true : false,
onChanged: (value) {
setState(() {
state.isLockPickingReminder.value =
state.isLockPickingReminder.value == 1 ? 2 : 1;
logic.setLockPickingReminder();
});
},
);
}
void showCupertinoAlertDialog(
BuildContext context,
) {
showDialog(
context: context,
builder: (BuildContext context) {
return ShowIosTipView(
title: "提示",
tipTitle: "创建公司号,考勤功能才能使用",
sureClick: () {
//
Navigator.pop(context);
Get.toNamed(Routers.checkInCreatCompanyPage,
arguments: state.getKeyInfosData.value);
},
cancelClick: () {
Navigator.pop(context);
},
);
},
);
}
@override
void didChangeDependencies() {
// TODO: implement didChangeDependencies
super.didChangeDependencies();
///
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
}
@override
void dispose() {
// TODO: implement dispose
///
AppRouteObserver().routeObserver.unsubscribe(this);
super.dispose();
}
///
@override
void didPush() {
print("lockSet===didPush");
}
///
@override
void didPop() {
print("lockSet===didPop");
}
///
@override
void didPopNext() {
print("lockSet===didPopNext");
}
///
@override
void didPushNext() {
print("lockSet===didPushNext");
}
} }

View File

@ -6,7 +6,12 @@ import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
class LockSetState { class LockSetState {
final getKeyInfosData = KeyInfos().obs; final getKeyInfosData = KeyInfos().obs;
var isAttendance = 1.obs;//
var isLockPickingReminder = 1.obs;//
LockSetState() { LockSetState() {
getKeyInfosData.value = Get.arguments as KeyInfos; getKeyInfosData.value = Get.arguments as KeyInfos;
isAttendance.value = getKeyInfosData.value.isAttendance!;
isLockPickingReminder.value = getKeyInfosData.value.monitorFlag!;
} }
} }

View File

@ -1,7 +1,5 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert';
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart'; import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';

View File

@ -417,9 +417,9 @@ class LockDetailLogic extends BaseGetXController{
print("onReady()"); print("onReady()");
_initReplySubscription(); _initReplySubscription();
// BlueManage().startScan((v){ BlueManage().startScan((v){
//
// }); });
} }
@override @override

View File

@ -8,6 +8,7 @@ import '../../../app_settings/app_colors.dart';
import '../../../blue/blue_manage.dart'; import '../../../blue/blue_manage.dart';
import '../../../blue/io_tool/io_manager.dart'; import '../../../blue/io_tool/io_manager.dart';
import '../../../blue/io_tool/io_tool.dart'; import '../../../blue/io_tool/io_tool.dart';
import '../../../tools/appRouteObserver.dart';
import '../../../tools/storage.dart'; import '../../../tools/storage.dart';
import '../../../translations/trans_lib.dart'; import '../../../translations/trans_lib.dart';
import '../../lockMian/entity/lockInfoEntity.dart'; import '../../lockMian/entity/lockInfoEntity.dart';
@ -29,7 +30,7 @@ class LockDetailPage extends StatefulWidget {
State<LockDetailPage> createState() => _LockDetailPageState(); State<LockDetailPage> createState() => _LockDetailPageState();
} }
class _LockDetailPageState extends State<LockDetailPage> { class _LockDetailPageState extends State<LockDetailPage> with RouteAware {
final logic = Get.put(LockDetailLogic()); final logic = Get.put(LockDetailLogic());
final state = Get.find<LockDetailLogic>().state; final state = Get.find<LockDetailLogic>().state;
@ -190,10 +191,13 @@ class _LockDetailPageState extends State<LockDetailPage> {
var showWidgetArr = <Widget>[]; var showWidgetArr = <Widget>[];
// //
showWidgetArr.add(bottomItem('images/main/icon_main_clockingIn.png', if (state.keyInfos.value.isAttendance == 1) {
TranslationLoader.lanKeys!.checkingIn!.tr, () { showWidgetArr.add(bottomItem('images/main/icon_main_clockingIn.png',
Get.toNamed(Routers.checkingInListPage); TranslationLoader.lanKeys!.checkingIn!.tr, () {
})); Get.toNamed(Routers.checkingInListPage,
arguments: state.keyInfos.value);
}));
}
var defaultWidgetArr = [ var defaultWidgetArr = [
// //
@ -301,4 +305,37 @@ class _LockDetailPageState extends State<LockDetailPage> {
)), )),
); );
} }
@override
void didChangeDependencies() {
// TODO: implement didChangeDependencies
super.didChangeDependencies();
///
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
}
@override
void dispose() {
// TODO: implement dispose
///
AppRouteObserver().routeObserver.unsubscribe(this);
super.dispose();
}
///
@override
void didPush() {}
/// Called when the current route has been popped off.
@override
void didPop() {}
/// Called when the current route has been popped off.
@override
void didPopNext() {}
/// Called when the current route has been popped off.
@override
void didPushNext() {}
} }

View File

@ -51,8 +51,16 @@ abstract class Api {
final String configPassageModeUrl = '/room/configPassageMode'; // final String configPassageModeUrl = '/room/configPassageMode'; //
final String updateSettingUrl = '/room/updateSetting'; // /// final String updateSettingUrl = '/room/updateSetting'; // ///
final String roomQueryDateUrl = '/room/queryDate'; // final String roomQueryDateUrl = '/room/queryDate'; //
final String lockDiagnoseUrl = '/room/uploadLockInfo'; //
final String getServerDatetimeUrl = '/check/getServerDatetime'; // final String getServerDatetimeUrl = '/check/getServerDatetime'; //
final String getLockVersionInfoUrl = '/room/update'; // final String getLockVersionInfoUrl = '/room/update'; //
final String openCheckingInURL = '/attendanceCompany/isExistenceCompany'; //
final String setCheckInCreateCompanyURL = '/attendanceCompany/add'; //
final String setLockPickingReminderDataURL = '/key/updateMonitorFlag'; //
final String getStaffListURL = '/staff/list'; //
final String addStaffURL = '/staff/add'; //
final String getKeyDetailURL = '/key/get'; // final String getKeyDetailURL = '/key/get'; //
final String lockUserListURL = '/keyUser/listKeyUser'; // final String lockUserListURL = '/keyUser/listKeyUser'; //
final String canSendKeyURL = '/keyUser/canSendKey'; // final String canSendKeyURL = '/keyUser/canSendKey'; //

View File

@ -504,6 +504,29 @@ class ApiProvider extends BaseProvider {
'lockId': lockId, 'lockId': lockId,
})); }));
//
Future<Response> setLockDiagnoseData(
String lockId,
String electricQuantity,
String firmwareRevision,
String hardwareRevision,
String lockDate,
String modelNum,
String pwdInfo,
String timestamp) =>
post(
lockDiagnoseUrl.toUrl,
jsonEncode({
'lockId': lockId,
'electricQuantity': electricQuantity,
'firmwareRevision': firmwareRevision,
'hardwareRevision': hardwareRevision,
'lockDate': lockDate,
'modelNum': modelNum,
'pwdInfo': pwdInfo,
'timestamp': timestamp,
}));
// //
Future<Response> getLockVersionInfoLoadData(String lockId) => post( Future<Response> getLockVersionInfoLoadData(String lockId) => post(
getLockVersionInfoUrl.toUrl, getLockVersionInfoUrl.toUrl,
@ -511,6 +534,73 @@ class ApiProvider extends BaseProvider {
'lockId': lockId, 'lockId': lockId,
})); }));
//
Future<Response> openCheckingInGetData(String lockId) => post(
openCheckingInURL.toUrl,
jsonEncode({
'lockId': lockId,
}),
isShowLoading: false);
//
Future<Response> setCheckInCreateCompanyData(
String lockId,
String attendanceType,
String companyName,
List workDay,
String workEndTime,
String workStartTime) =>
post(
setCheckInCreateCompanyURL.toUrl,
jsonEncode({
'lockId': lockId,
'attendanceType': attendanceType,
'companyName': companyName,
'workDay': workDay,
'workEndTime': workEndTime,
'workStartTime': workStartTime,
}));
//
Future<Response> setLockPickingReminderData(
String lockId, String keyId, String monitorFlag) =>
post(
setLockPickingReminderDataURL.toUrl,
jsonEncode({
'lockId': lockId,
'keyId': keyId,
'monitorFlag': monitorFlag,
}));
//
Future<Response> getStaffListData(String companyId, String lockId) => post(
getStaffListURL.toUrl,
jsonEncode({
'companyId': companyId,
'lockId': lockId,
}));
//
Future<Response> addStaffData(
String attendanceType,
String attendanceWay,
String companyId,
String have,
String staffName,
String countryCode,
String usernameType) =>
post(
addStaffURL.toUrl,
jsonEncode({
'attendanceType': attendanceType,
'attendanceWay': attendanceWay,
'companyId': companyId,
'have': have,
'staffName': staffName,
'countryCode': countryCode,
'usernameType': usernameType,
}));
Future<Response> listLockByGroup(String type, String keyGroupId) => post( Future<Response> listLockByGroup(String type, String keyGroupId) => post(
listLockByGroupURL.toUrl, listLockByGroupURL.toUrl,
jsonEncode({'type': type, 'keyGroupId': keyGroupId})); jsonEncode({'type': type, 'keyGroupId': keyGroupId}));

View File

@ -27,8 +27,10 @@ class BaseProvider extends GetConnect with Api {
Map<String, String>? headers, Map<String, String>? headers,
Map<String, dynamic>? query, Map<String, dynamic>? query,
Decoder<T>? decoder, Decoder<T>? decoder,
Progress? uploadProgress}) async { Progress? uploadProgress,
bool? isShowLoading}) async {
// print("post: url:${url} body:${body} contentType:${contentType} headers:${headers} query:${query}"); // print("post: url:${url} body:${body} contentType:${contentType} headers:${headers} query:${query}");
if(isShowLoading == true) EasyLoading.show();
print('哈喽请求body体为${body}'); print('哈喽请求body体为${body}');
var res = await super.post(url, body, var res = await super.post(url, body,

View File

@ -13,6 +13,7 @@ import '../common/safetyVerification/entity/SafetyVerificationEntity.dart';
import '../login/login/entity/LoginEntity.dart'; import '../login/login/entity/LoginEntity.dart';
import '../login/register/entity/SendValidationCodeEntity.dart'; import '../login/register/entity/SendValidationCodeEntity.dart';
import '../main/lockDetail/lcokSet/configuringWifi/configuringWifiEntity.dart'; import '../main/lockDetail/lcokSet/configuringWifi/configuringWifiEntity.dart';
import '../main/lockDetail/lcokSet/lockSet/CheckingInInfoDataEntity.dart';
import '../main/lockDetail/lcokSet/lockTime/GetServerDatetimeEntity.dart'; import '../main/lockDetail/lcokSet/lockTime/GetServerDatetimeEntity.dart';
import '../main/lockDetail/lcokSet/normallyOpenMode/GetPassageModeConfigEntity.dart'; import '../main/lockDetail/lcokSet/normallyOpenMode/GetPassageModeConfigEntity.dart';
import '../main/lockMian/entity/lockInfoEntity.dart'; import '../main/lockMian/entity/lockInfoEntity.dart';
@ -488,6 +489,29 @@ class ApiRepository {
return GetServerDatetimeEntity.fromJson(res.body); return GetServerDatetimeEntity.fromJson(res.body);
} }
//
Future<LoginEntity> setLockDiagnoseData({
required String lockId,
required String electricQuantity,
required String firmwareRevision,
required String hardwareRevision,
required String lockDate,
required String modelNum,
required String pwdInfo,
required String timestamp,
}) async {
final res = await apiProvider.setLockDiagnoseData(
lockId,
electricQuantity,
firmwareRevision,
hardwareRevision,
lockDate,
modelNum,
pwdInfo,
timestamp);
return LoginEntity.fromJson(res.body);
}
// //
Future<GetServerDatetimeEntity> getLockVersionInfoData({ Future<GetServerDatetimeEntity> getLockVersionInfoData({
required String lockId, required String lockId,
@ -549,4 +573,59 @@ class ApiRepository {
usernameType); usernameType);
return KeyDetailEntity.fromJson(res.body); return KeyDetailEntity.fromJson(res.body);
} }
//
Future<CheckingInInfoDataEntity> openCheckingInData(
{required String lockId}) async {
final res = await apiProvider.openCheckingInGetData(lockId);
return CheckingInInfoDataEntity.fromJson(res.body);
}
//
Future<LoginEntity> setCheckInCreateCompanyData(
{required String lockId,
required String attendanceType,
required String companyName,
required List workDay,
required String workEndTime,
required String workStartTime}) async {
final res = await apiProvider.setCheckInCreateCompanyData(lockId,
attendanceType, companyName, workDay, workEndTime, workStartTime);
return LoginEntity.fromJson(res.body);
}
//
Future<LoginEntity> setLockPickingReminderData({
required String lockId,
required String keyId,
required String monitorFlag,
}) async {
final res = await apiProvider.setLockPickingReminderData(
lockId, keyId, monitorFlag);
return LoginEntity.fromJson(res.body);
}
//
Future<LoginEntity> getStaffListData({
required String companyId,
required String lockId,
}) async {
final res = await apiProvider.getStaffListData(companyId, lockId);
return LoginEntity.fromJson(res.body);
}
//
Future<LoginEntity> addStaffData({
required String attendanceType,
required String attendanceWay,
required String companyId,
required String have,
required String staffName,
required String countryCode,
required String usernameType,
}) async {
final res = await apiProvider.addStaffData(attendanceType, attendanceWay,
companyId, have, staffName, countryCode, usernameType);
return LoginEntity.fromJson(res.body);
}
} }

View File

@ -7,6 +7,5 @@ FutureOr<Request> requestLogInterceptor(Request request) async {
Get.log( Get.log(
'GET HTTP REQUEST \n${request.url} \n${request.headers} ${request.toString()} '); 'GET HTTP REQUEST \n${request.url} \n${request.headers} ${request.toString()} ');
Get.log(request.headers.toString()); Get.log(request.headers.toString());
EasyLoading.show();
return request; return request;
} }

View File

@ -0,0 +1,21 @@
import 'package:flutter/material.dart';
class AppRouteObserver {
//
static final RouteObserver<ModalRoute<void>> _routeObserver =
RouteObserver<ModalRoute<void>>();
//
static final AppRouteObserver _appRouteObserver =
AppRouteObserver._internal();
AppRouteObserver._internal() {}
//get方法轻松获取路由监听器
RouteObserver<ModalRoute<void>> get routeObserver {
return _routeObserver;
}
factory AppRouteObserver() {
return _appRouteObserver;
}
}

View File

@ -0,0 +1,76 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import '../translations/trans_lib.dart';
class ShowIosTipView extends StatelessWidget {
String? title;
String? tipTitle;
Function()? sureClick;
Function()? cancelClick;
ShowIosTipView(
{Key? key,
this.title,
this.tipTitle,
this.sureClick,
this.cancelClick})
: super(key: key);
@override
Widget build(BuildContext context) {
return Card(
color: const Color(0x00FFFFFF),
child: Builder(
builder: (context) {
return Theme(
data: ThemeData.light(),
child: CupertinoAlertDialog(
title: Text(title!),
content: Column(
children: <Widget>[
const SizedBox(
height: 10,
),
Column(
children: [
Text(tipTitle!, style: TextStyle(fontSize: 24.sp))
],
)
],
),
actions: <Widget>[
CupertinoDialogAction(
child: Text(
TranslationLoader.lanKeys!.cancel!.tr,
style: const TextStyle(color: Colors.black),
),
onPressed: () {
// Navigator.pop(context);
// print("取消");
if (cancelClick != null) {
cancelClick!();
}
},
),
CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys!.sure!.tr,
style: const TextStyle(color: Colors.black)),
onPressed: () {
if (sureClick != null) {
sureClick!();
}
// Navigator.pop(context);
// print("确定");
},
),
],
),
);
}
),
);
}
}