Merge branch 'master' of https://gitee.com/weishaoyang/star_lock
# 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:
commit
a7f5300f50
@ -40,7 +40,7 @@
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
buildConfiguration = "Release"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
|
||||
@ -2,6 +2,7 @@ import 'package:get/get.dart';
|
||||
import 'package:star_lock/common/safetyVerification/safetyVerification_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/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/massSendReceiver/massSendReceiver_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/checkingInSetAddStaff/checkingInAddStaff_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/checkingInSetWorkdaySet/checkingInSetWorkdaySet_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/uploadElectricQuantity/uploadElectricQuantity_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/diagnose/diagnose_page.dart';
|
||||
import 'main/lockDetail/lcokSet/doorMagnetic/addDoorMagnetic/addDoorMagnetic_page.dart';
|
||||
@ -195,6 +196,7 @@ abstract class Routers {
|
||||
static const importOtherLockDataPage = '/ImportOtherLockDataPage'; // 导入其他锁数据
|
||||
static const lockEscalationPage = '/LockEscalationPage'; // 锁升级
|
||||
static const markedHouseStatePage = '/MarkedHouseStatePage'; // 标记房态
|
||||
static const checkInCreatCompanyPage = '/CheckInCreatCompanyPage'; // 创建公司
|
||||
static const checkingInListPage = '/CheckingInListPage'; // 考勤
|
||||
static const checkingInSetPage = '/CheckingInSetPage'; // 考勤设置
|
||||
static const checkingInStaffManagePage = '/CheckingInStaffManagePage'; // 员工管理
|
||||
@ -544,7 +546,7 @@ abstract class AppRouters {
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.checkingInStaffManagePage,
|
||||
page: () => const CheckingInStaffManagePage(),
|
||||
page: () => const CheckingInStaffListPage(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.checkingInAddStaffPage,
|
||||
@ -749,6 +751,9 @@ abstract class AppRouters {
|
||||
name: Routers.massSendReceiverPage,
|
||||
page: () => const MassSendReceiverPage()),
|
||||
GetPage(
|
||||
name: Routers.lockUserListPage, page: () => const LockUserListPage())
|
||||
name: Routers.lockUserListPage, page: () => const LockUserListPage()),
|
||||
GetPage(
|
||||
name: Routers.checkInCreatCompanyPage,
|
||||
page: () => const CheckInCreatCompanyPage())
|
||||
];
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ class BlueManage{
|
||||
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;
|
||||
print('ConnectionState for device $deviceMAC : ${connectionStateUpdate.connectionState}');
|
||||
|
||||
@ -13,6 +13,7 @@ import 'package:star_lock/translations/trans_lib.dart';
|
||||
|
||||
import 'appRouters.dart';
|
||||
import 'baseWidget.dart';
|
||||
import 'tools/appRouteObserver.dart';
|
||||
import 'tools/store_service.dart';
|
||||
|
||||
void main() async {
|
||||
@ -46,7 +47,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
|
||||
|
||||
GetMaterialApp _initMaterialApp() => GetMaterialApp(
|
||||
title: 'Star Lock',
|
||||
navigatorObservers: [routeObserver],
|
||||
navigatorObservers: [routeObserver, AppRouteObserver().routeObserver],
|
||||
translations: TranslationMessage(),
|
||||
supportedLocales: appDept.deptSupportedLocales,
|
||||
localizationsDelegates: const [
|
||||
|
||||
@ -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
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -8,6 +8,7 @@ import '../../../../tools/showBottomSheetTool.dart';
|
||||
import '../../../../tools/showCalendar.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
import 'checkingInList_logic.dart';
|
||||
|
||||
class CheckingInListPage extends StatefulWidget {
|
||||
const CheckingInListPage({Key? key}) : super(key: key);
|
||||
@ -17,6 +18,9 @@ class CheckingInListPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _CheckingInListPageState extends State<CheckingInListPage> {
|
||||
final logic = Get.put(CheckingInListLogic());
|
||||
final state = Get.find<CheckingInListLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@ -29,7 +33,10 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
|
||||
actionsList: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.pushNamed(context, Routers.checkingInSetPage);
|
||||
Get.toNamed(Routers.checkingInSetPage, arguments: {
|
||||
"getKeyInfosData": state.getKeyInfosData.value,
|
||||
"companyId": state.companyId.value
|
||||
});
|
||||
},
|
||||
child: Image.asset(
|
||||
'images/main/icon_lockDetail_checkIn_set.png',
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
|
||||
import '../../../../tools/baseGetXController.dart';
|
||||
import 'checkingInSet_state.dart';
|
||||
|
||||
class CheckingInSetLogic extends BaseGetXController{
|
||||
CheckingInSetState state = CheckingInSetState();
|
||||
|
||||
|
||||
}
|
||||
@ -9,6 +9,7 @@ import '../../../../tools/showTFView.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
import 'checkingInSet_logic.dart';
|
||||
|
||||
class CheckingInSetPage extends StatefulWidget {
|
||||
const CheckingInSetPage({Key? key}) : super(key: key);
|
||||
@ -18,6 +19,9 @@ class CheckingInSetPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
||||
final logic = Get.put(CheckingInSetLogic());
|
||||
final state = Get.find<CheckingInSetLogic>().state;
|
||||
|
||||
final TextEditingController _changeNameController = TextEditingController();
|
||||
|
||||
@override
|
||||
@ -46,7 +50,10 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Navigator.pushNamed(context, Routers.checkingInStaffManagePage);
|
||||
Get.toNamed(Routers.checkingInStaffManagePage, arguments: {
|
||||
"getKeyInfosData": state.getKeyInfosData.value,
|
||||
"companyId": state.companyId.value
|
||||
});
|
||||
}),
|
||||
CommonItem(
|
||||
leftTitel:
|
||||
@ -96,10 +103,15 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return ShowTFView(
|
||||
title:
|
||||
"${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}",
|
||||
tipTitle: "",
|
||||
controller: _changeNameController);
|
||||
title: "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}",
|
||||
tipTitle: "",
|
||||
controller: _changeNameController,
|
||||
sureClick: () {
|
||||
|
||||
},
|
||||
cancelClick: () {
|
||||
Navigator.pop(context);
|
||||
},);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -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"];
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -8,6 +8,7 @@ import '../../../../tools/showBottomSheetTool.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
import 'checkingInAddStaff_logic.dart';
|
||||
|
||||
class CheckingInAddStaffPage extends StatefulWidget {
|
||||
const CheckingInAddStaffPage({Key? key}) : super(key: key);
|
||||
@ -17,6 +18,9 @@ class CheckingInAddStaffPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
||||
final logic = Get.put(CheckingInAddStaffLogic());
|
||||
final state = Get.find<CheckingInAddStaffLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@ -97,7 +101,7 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
||||
}
|
||||
|
||||
Widget getTFWidget(String tfStr) {
|
||||
return Container(
|
||||
return SizedBox(
|
||||
height: 50.h,
|
||||
width: 300.w,
|
||||
// color: Colors.red,
|
||||
@ -107,7 +111,7 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
||||
child: TextField(
|
||||
//输入框一行
|
||||
maxLines: 1,
|
||||
// controller: _controller,
|
||||
controller: state.staffNameController,
|
||||
autofocus: false,
|
||||
textAlign: TextAlign.end,
|
||||
decoration: InputDecoration(
|
||||
@ -127,7 +131,10 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
||||
|
||||
void _showSeletClockInType() {
|
||||
var list = [
|
||||
"15080825640",
|
||||
"APP",
|
||||
"密码",
|
||||
"卡",
|
||||
"指纹",
|
||||
];
|
||||
ShowBottomSheetTool().showSingleRowPicker(
|
||||
//上下文
|
||||
|
||||
@ -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"];
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
|
||||
}
|
||||
}
|
||||
@ -6,16 +6,20 @@ import '../../../../appRouters.dart';
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
import 'checkingInStaffList_logic.dart';
|
||||
|
||||
class CheckingInStaffManagePage extends StatefulWidget {
|
||||
const CheckingInStaffManagePage({Key? key}) : super(key: key);
|
||||
class CheckingInStaffListPage extends StatefulWidget {
|
||||
const CheckingInStaffListPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<CheckingInStaffManagePage> createState() =>
|
||||
_CheckingInStaffManagePageState();
|
||||
State<CheckingInStaffListPage> createState() =>
|
||||
_CheckingInStaffListPageState();
|
||||
}
|
||||
|
||||
class _CheckingInStaffManagePageState extends State<CheckingInStaffManagePage> {
|
||||
class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
|
||||
final logic = Get.put(CheckingInStaffManageLogic());
|
||||
final state = Get.find<CheckingInStaffManageLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@ -27,7 +31,11 @@ class _CheckingInStaffManagePageState extends State<CheckingInStaffManagePage> {
|
||||
actionsList: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.pushNamed(context, Routers.checkingInAddStaffPage);
|
||||
Navigator.pushNamed(context, Routers.checkingInAddStaffPage,
|
||||
arguments: {
|
||||
"getKeyInfosData": state.getKeyInfosData.value,
|
||||
"companyId": state.companyId.value
|
||||
});
|
||||
},
|
||||
child: Image.asset(
|
||||
'images/icon_add_white.png',
|
||||
@ -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"];
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
|
||||
import 'checkingInSetWorkTime_state.dart';
|
||||
|
||||
class CheckingInSetWorkTimeLogic extends BaseGetXController{
|
||||
CheckingInSetWorkTimeState state = CheckingInSetWorkTimeState();
|
||||
|
||||
}
|
||||
@ -1,12 +1,16 @@
|
||||
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:get/get.dart';
|
||||
import 'package:star_lock/tools/toast.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 'checkingInSetWorkTime_logic.dart';
|
||||
|
||||
class CheckingInSetWorkTimePage extends StatefulWidget {
|
||||
const CheckingInSetWorkTimePage({Key? key}) : super(key: key);
|
||||
@ -16,6 +20,8 @@ class CheckingInSetWorkTimePage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _CheckingInSetWorkTimePageState extends State<CheckingInSetWorkTimePage> {
|
||||
final logic = Get.put(CheckingInSetWorkTimeLogic());
|
||||
final state = Get.find<CheckingInSetWorkTimeLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -29,16 +35,28 @@ class _CheckingInSetWorkTimePageState extends State<CheckingInSetWorkTimePage> {
|
||||
Widget buildMainUI(){
|
||||
return Column(
|
||||
children: [
|
||||
CommonItem(leftTitel:TranslationLoader.lanKeys!.officeHours!.tr, rightTitle:"11:49", 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) {
|
||||
//
|
||||
// });
|
||||
}),
|
||||
CommonItem(leftTitel:TranslationLoader.lanKeys!.closingTime!.tr, rightTitle:"11:49", isHaveDirection: true, action:(){
|
||||
// ShowSeletDateTime().showDatePicker(context, '00:00', '00:00', getNowDate(),'HH:mm', (dateTime, List<int> index) {
|
||||
//
|
||||
// });
|
||||
}),
|
||||
Obx(() => CommonItem(leftTitel:TranslationLoader.lanKeys!.officeHours!.tr, rightTitle:state.beginTime.value, isHaveDirection: true, isHaveLine: true, action:(){
|
||||
Pickers.showDatePicker(context, mode: DateMode.HM,
|
||||
onConfirm: (p) {
|
||||
setState(() {
|
||||
DateTime today = DateTime.now();
|
||||
state.beginTimeTimestamp.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.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,),
|
||||
SubmitBtn(btnName: TranslationLoader.lanKeys!.sure!.tr,
|
||||
borderRadius: 20.w,
|
||||
@ -46,7 +64,16 @@ class _CheckingInSetWorkTimePageState extends State<CheckingInSetWorkTimePage> {
|
||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 20.w),
|
||||
padding: EdgeInsets.only(top: 20.w, bottom: 20.w),
|
||||
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,
|
||||
});
|
||||
}
|
||||
),
|
||||
],
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class CheckingInSetWorkTimeState{
|
||||
var beginTime = "".obs;// 开始时间
|
||||
var endTime = "".obs;// 结束时间
|
||||
var beginTimeTimestamp = "".obs;// 开始时间时间戳
|
||||
var endTimeTimestamp = "".obs;// 结束时间时间戳
|
||||
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
|
||||
import 'checkingInSetWorkdaySet_state.dart';
|
||||
|
||||
class CheckingInSetWorkdaySetLogic extends BaseGetXController{
|
||||
CheckingInSetWorkdaySetState state = CheckingInSetWorkdaySetState();
|
||||
|
||||
|
||||
}
|
||||
@ -7,6 +7,7 @@ import '../../../../tools/commonItem.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
import 'checkingInSetWorkdaySet_logic.dart';
|
||||
|
||||
class CheckingInSetWorkdaySet extends StatefulWidget {
|
||||
const CheckingInSetWorkdaySet({Key? key}) : super(key: key);
|
||||
@ -17,6 +18,9 @@ class CheckingInSetWorkdaySet extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _CheckingInSetWorkdaySetState extends State<CheckingInSetWorkdaySet> {
|
||||
final logic = Get.put(CheckingInSetWorkdaySetLogic());
|
||||
final state = Get.find<CheckingInSetWorkdaySetLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@ -29,15 +33,17 @@ class _CheckingInSetWorkdaySetState extends State<CheckingInSetWorkdaySet> {
|
||||
body: ListView(
|
||||
children: [
|
||||
topBtnWidget(),
|
||||
Visibility(visible: true, child: bottomCustomSeletBtn()),
|
||||
Visibility(visible: false, child: bottomOddOrEvenDaysOffSeletBtn()),
|
||||
SizedBox(
|
||||
height: 50.h,
|
||||
),
|
||||
Obx(() => Visibility(visible: state.isCustom.value == true, child: bottomCustomSeletBtn())),
|
||||
Obx(() => Visibility(visible: !state.isCustom.value, child: bottomOddOrEvenDaysOffSeletBtn())),
|
||||
SizedBox(height: 50.h,),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 20.w, right: 20.w),
|
||||
child: SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.sure!.tr, onClick: () {}),
|
||||
child: SubmitBtn(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,
|
||||
// color: Colors.red,
|
||||
padding: EdgeInsets.all(10.w),
|
||||
child: Row(
|
||||
child: Obx(() => Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
width: (1.sw - 5.w * 2) / 2,
|
||||
height: 100.h,
|
||||
color: AppColors.mainColor,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Center(
|
||||
child: Text(TranslationLoader.lanKeys!.custom!.tr,
|
||||
style:
|
||||
TextStyle(fontSize: 26.sp, color: Colors.white))),
|
||||
],
|
||||
GestureDetector(
|
||||
onTap: (){
|
||||
setState(() {
|
||||
state.isCustom.value = true;
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
width: (1.sw - 5.w * 2) / 2,
|
||||
height: 100.h,
|
||||
color: state.isCustom.value ? AppColors.mainColor : AppColors.btnDisableColor,
|
||||
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,),
|
||||
Container(
|
||||
width: (1.sw - 10 * 3) / 2,
|
||||
height: 100.h,
|
||||
color: AppColors.btnDisableColor,
|
||||
padding: EdgeInsets.all(10.w),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: Text(
|
||||
TranslationLoader.lanKeys!.oddOrEvenDaysOff!.tr,
|
||||
style: TextStyle(fontSize: 26.sp, color: Colors.white),
|
||||
textAlign: TextAlign.center,
|
||||
))),
|
||||
],
|
||||
GestureDetector(
|
||||
onTap: (){
|
||||
setState(() {
|
||||
state.isCustom.value = false;
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
width: (1.sw - 10 * 3) / 2,
|
||||
height: 100.h,
|
||||
color: state.isCustom.value ? AppColors.btnDisableColor : AppColors.mainColor,
|
||||
padding: EdgeInsets.all(10.w),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.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: "",
|
||||
allHeight: 60.h,
|
||||
isHaveLine: true),
|
||||
CommonItem(
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.singleDayWeekend!.tr,
|
||||
rightTitle: "",
|
||||
allHeight: 60.h,
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: GestureDetector(
|
||||
onTap: () {},
|
||||
onTap: () {
|
||||
setState(() {
|
||||
state.isSingledayWeekend.value = 0;
|
||||
state.weekDays.value = [1, 2 , 3, 4, 5, 6];
|
||||
});
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
'images/icon_round_unSelet.png',
|
||||
width: 30.w,
|
||||
height: 30.w,
|
||||
),
|
||||
Image.asset(state.isSingledayWeekend.value == 0 ? 'images/icon_round_selet.png' : 'images/icon_round_unSelet.png', width: 30.w, height: 30.w,),
|
||||
],
|
||||
),
|
||||
)),
|
||||
CommonItem(
|
||||
)
|
||||
)),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.twoDaysOff!.tr,
|
||||
rightTitle: "",
|
||||
allHeight: 60.h,
|
||||
isHaveLine: false,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: GestureDetector(
|
||||
onTap: () {},
|
||||
onTap: () {
|
||||
setState(() {
|
||||
state.isSingledayWeekend.value = 1;
|
||||
state.weekDays.value = [1, 2 , 3, 4, 5];
|
||||
});
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
'images/icon_round_unSelet.png',
|
||||
width: 30.w,
|
||||
height: 30.w,
|
||||
),
|
||||
Image.asset(state.isSingledayWeekend.value == 1 ? 'images/icon_round_selet.png' : 'images/icon_round_unSelet.png', width: 30.w, height: 30.w,),
|
||||
],
|
||||
),
|
||||
)),
|
||||
)
|
||||
)),
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -145,136 +166,66 @@ class _CheckingInSetWorkdaySetState extends State<CheckingInSetWorkdaySet> {
|
||||
Widget bottomCustomSeletBtn() {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 10.w, right: 10.w),
|
||||
child: Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.monday!.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!.tuesday!.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!.wednesday!.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!.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,
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
],
|
||||
height: 420.h,
|
||||
child: ListView.builder(
|
||||
itemCount: 7,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemBuilder: (c, index) {
|
||||
index += 1;
|
||||
String dateStr;
|
||||
switch (index) {
|
||||
case 1:
|
||||
dateStr = TranslationLoader.lanKeys!.monday!.tr;
|
||||
break;
|
||||
case 2:
|
||||
dateStr = TranslationLoader.lanKeys!.tuesday!.tr;
|
||||
break;
|
||||
case 3:
|
||||
dateStr = TranslationLoader.lanKeys!.wednesday!.tr;
|
||||
break;
|
||||
case 4:
|
||||
dateStr = TranslationLoader.lanKeys!.thursday!.tr;
|
||||
break;
|
||||
case 5:
|
||||
dateStr = TranslationLoader.lanKeys!.friday!.tr;
|
||||
break;
|
||||
case 6:
|
||||
dateStr = TranslationLoader.lanKeys!.saturday!.tr;
|
||||
break;
|
||||
case 7:
|
||||
dateStr = TranslationLoader.lanKeys!.sunday!.tr;
|
||||
break;
|
||||
default:
|
||||
dateStr = "";
|
||||
break;
|
||||
}
|
||||
return CommonItem(
|
||||
leftTitel: dateStr,
|
||||
rightTitle: "",
|
||||
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: 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,),
|
||||
],
|
||||
))
|
||||
);
|
||||
}
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class CheckingInSetWorkdaySetState{
|
||||
var isCustom = true.obs;
|
||||
var isSingledayWeekend = 2.obs; // 0单休 1双休
|
||||
var weekDays = [].obs;// 工作天数
|
||||
|
||||
}
|
||||
@ -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: "设置成功");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -1,9 +1,49 @@
|
||||
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
|
||||
import '../../../../network/api_repository.dart';
|
||||
import '../../../../tools/eventBusEventManage.dart';
|
||||
import '../../../../tools/toast.dart';
|
||||
import 'diagnose_state.dart';
|
||||
|
||||
class DiagnoseLogic extends BaseGetXController{
|
||||
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
|
||||
}
|
||||
|
||||
}
|
||||
@ -6,6 +6,7 @@ import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
import 'diagnose_logic.dart';
|
||||
|
||||
class DiagnosePage extends StatefulWidget {
|
||||
const DiagnosePage({Key? key}) : super(key: key);
|
||||
@ -15,6 +16,9 @@ class DiagnosePage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _DiagnosePageState extends State<DiagnosePage> {
|
||||
final logic = Get.put(DiagnoseLogic());
|
||||
final state = Get.find<DiagnoseLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@ -47,7 +51,9 @@ class _DiagnosePageState extends State<DiagnosePage> {
|
||||
fontSize: 32.sp,
|
||||
// margin: EdgeInsets.only(left: 03.w, right: 30.w, top: 20.w),
|
||||
padding: EdgeInsets.only(top: 20.w, bottom: 20.w),
|
||||
onClick: () {}),
|
||||
onClick: () {
|
||||
logic.setLockDiagnose();
|
||||
}),
|
||||
],
|
||||
),
|
||||
));
|
||||
|
||||
@ -1,4 +1,12 @@
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../lockMian/entity/lockInfoEntity.dart';
|
||||
|
||||
class DiagnoseState{
|
||||
var getKeyInfosData = KeyInfos().obs;
|
||||
|
||||
DiagnoseState() {
|
||||
getKeyInfosData.value = Get.arguments as KeyInfos;
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||
@ -16,27 +15,81 @@ import '../../../../network/api_repository.dart';
|
||||
import '../../../../tools/baseGetXController.dart';
|
||||
import '../../../../tools/eventBusEventManage.dart';
|
||||
import '../../../../tools/storage.dart';
|
||||
import '../../../../tools/toast.dart';
|
||||
import 'CheckingInInfoDataEntity.dart';
|
||||
import 'lockSet_state.dart';
|
||||
|
||||
typedef BlockSetStateCallback = void Function();
|
||||
class LockSetLogic extends BaseGetXController{
|
||||
typedef BlockSetCheckInCallback = void Function(
|
||||
CheckingInInfoDataEntity checkingInInfoDataEntity);
|
||||
|
||||
class LockSetLogic extends BaseGetXController {
|
||||
final LockSetState state = LockSetState();
|
||||
|
||||
// 删除锁调用后台接口
|
||||
void deletLockInfoData() async{
|
||||
void deletLockInfoData() async {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
// 开启考勤获取是否有公司
|
||||
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", // 1开启,2关闭
|
||||
);
|
||||
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;
|
||||
void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) {
|
||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||
_passCurrentLockInformationEvent = eventBus.on<PassCurrentLockInformationEvent>().listen((event) {
|
||||
_passCurrentLockInformationEvent =
|
||||
eventBus.on<PassCurrentLockInformationEvent>().listen((event) {
|
||||
state.getKeyInfosData.value = event.keyInfo;
|
||||
blockSetStateCallback();
|
||||
});
|
||||
@ -45,8 +98,9 @@ class LockSetLogic extends BaseGetXController{
|
||||
// 监听蓝牙协议返回结果
|
||||
late StreamSubscription<Reply> _replySubscription;
|
||||
void _initReplySubscription() {
|
||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
||||
if(reply is DeletUserReply) {
|
||||
_replySubscription =
|
||||
EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
||||
if (reply is DeletUserReply) {
|
||||
var tokenData = reply.data.sublist(2, 6);
|
||||
var saveStrList = changeIntListToStringList(tokenData);
|
||||
print("openDoorToken:$tokenData");
|
||||
@ -54,45 +108,46 @@ class LockSetLogic extends BaseGetXController{
|
||||
|
||||
int status = reply.data[6];
|
||||
print("status:$status");
|
||||
switch(status){
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
//成功
|
||||
print("${reply.commandType}解析成功");
|
||||
deletLockInfoData();
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
//无权限
|
||||
print("${reply.commandType}需要鉴权");
|
||||
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
List<int> getPrivateKeyList =
|
||||
changeStringListToIntList(privateKey!);
|
||||
|
||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
|
||||
IoSenderManage.deletUser(
|
||||
lockID:state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName,
|
||||
authUserID:await Storage.getUid(),
|
||||
keyID:"1",
|
||||
delUserID:await Storage.getUid(),
|
||||
needAuthor:1,
|
||||
publicKey:publicKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
token: tokenData
|
||||
);
|
||||
lockID:
|
||||
state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName,
|
||||
authUserID: await Storage.getUid(),
|
||||
keyID: "1",
|
||||
delUserID: await Storage.getUid(),
|
||||
needAuthor: 1,
|
||||
publicKey: publicKeyDataList,
|
||||
privateKey: getPrivateKeyList,
|
||||
token: tokenData);
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
//无权限
|
||||
print("${reply.commandType}用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
// 权限校验错误
|
||||
print("${reply.commandType}权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
//失败
|
||||
print("${reply.commandType}失败");
|
||||
|
||||
break;
|
||||
@ -103,8 +158,10 @@ class LockSetLogic extends BaseGetXController{
|
||||
|
||||
// 删除用户蓝牙协议
|
||||
Future<void> deletUserAction() async {
|
||||
BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState connectionState) async {
|
||||
if (connectionState == DeviceConnectionState.connected){
|
||||
BlueManage().judgeReconnect(
|
||||
BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName,
|
||||
(DeviceConnectionState connectionState) async {
|
||||
if (connectionState == DeviceConnectionState.connected) {
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
@ -114,17 +171,17 @@ class LockSetLogic extends BaseGetXController{
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
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(
|
||||
lockID:state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName,
|
||||
authUserID:"100001",
|
||||
keyID:"1",
|
||||
delUserID:"100001",
|
||||
needAuthor:1,
|
||||
publicKey:publicKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
token: getTokenList
|
||||
);
|
||||
lockID: state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName,
|
||||
authUserID: "100001",
|
||||
keyID: "1",
|
||||
delUserID: "100001",
|
||||
needAuthor: 1,
|
||||
publicKey: publicKeyDataList,
|
||||
privateKey: getPrivateKeyList,
|
||||
token: getTokenList);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -143,8 +200,6 @@ class LockSetLogic extends BaseGetXController{
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
print("onInit()");
|
||||
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
@ -153,5 +208,4 @@ class LockSetLogic extends BaseGetXController{
|
||||
_replySubscription.cancel();
|
||||
_passCurrentLockInformationEvent!.cancel();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,8 +7,10 @@ import 'package:get/get.dart';
|
||||
|
||||
import '../../../../appRouters.dart';
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/appRouteObserver.dart';
|
||||
import '../../../../tools/commonItem.dart';
|
||||
import '../../../../tools/eventBusEventManage.dart';
|
||||
import '../../../../tools/showIosTipView.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../tools/toast.dart';
|
||||
@ -22,7 +24,7 @@ class LockSetPage extends StatefulWidget {
|
||||
State<LockSetPage> createState() => _LockSetPageState();
|
||||
}
|
||||
|
||||
class _LockSetPageState extends State<LockSetPage> {
|
||||
class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
||||
final logic = Get.put(LockSetLogic());
|
||||
final state = Get.find<LockSetLogic>().state;
|
||||
StreamSubscription? _passCurrentLockInformationEvent;
|
||||
@ -207,13 +209,15 @@ class _LockSetPageState extends State<LockSetPage> {
|
||||
rightTitle: "",
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(width: 60.w, child: _switch())),
|
||||
rightWidget:
|
||||
SizedBox(width: 60.w, child: _openCheckInSwitch())),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.unlockReminder!.tr,
|
||||
rightTitle: "",
|
||||
isHaveLine: false,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(width: 60.w, child: _switch())),
|
||||
rightWidget:
|
||||
SizedBox(width: 60.w, child: _lockRemindSwitch())),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
@ -241,7 +245,8 @@ class _LockSetPageState extends State<LockSetPage> {
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Get.toNamed(Routers.diagnosePage);
|
||||
Get.toNamed(Routers.diagnosePage,
|
||||
arguments: state.getKeyInfosData.value);
|
||||
}),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.uploadData!.tr,
|
||||
@ -288,18 +293,110 @@ class _LockSetPageState extends State<LockSetPage> {
|
||||
));
|
||||
}
|
||||
|
||||
CupertinoSwitch _switch() {
|
||||
bool _isOn = false;
|
||||
CupertinoSwitch _openCheckInSwitch() {
|
||||
return CupertinoSwitch(
|
||||
activeColor: CupertinoColors.activeBlue,
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: _isOn,
|
||||
value: (state.getKeyInfosData.value.isAttendance == 1) ? true : false,
|
||||
onChanged: (value) {
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,12 @@ import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
||||
class LockSetState {
|
||||
final getKeyInfosData = KeyInfos().obs;
|
||||
|
||||
var isAttendance = 1.obs;// 是否开启考勤
|
||||
var isLockPickingReminder = 1.obs;// 是否开启开锁提醒
|
||||
|
||||
LockSetState() {
|
||||
getKeyInfosData.value = Get.arguments as KeyInfos;
|
||||
isAttendance.value = getKeyInfosData.value.isAttendance!;
|
||||
isLockPickingReminder.value = getKeyInfosData.value.monitorFlag!;
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,5 @@
|
||||
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||
|
||||
|
||||
@ -417,9 +417,9 @@ class LockDetailLogic extends BaseGetXController{
|
||||
print("onReady()");
|
||||
_initReplySubscription();
|
||||
|
||||
// BlueManage().startScan((v){
|
||||
//
|
||||
// });
|
||||
BlueManage().startScan((v){
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -8,6 +8,7 @@ import '../../../app_settings/app_colors.dart';
|
||||
import '../../../blue/blue_manage.dart';
|
||||
import '../../../blue/io_tool/io_manager.dart';
|
||||
import '../../../blue/io_tool/io_tool.dart';
|
||||
import '../../../tools/appRouteObserver.dart';
|
||||
import '../../../tools/storage.dart';
|
||||
import '../../../translations/trans_lib.dart';
|
||||
import '../../lockMian/entity/lockInfoEntity.dart';
|
||||
@ -29,7 +30,7 @@ class LockDetailPage extends StatefulWidget {
|
||||
State<LockDetailPage> createState() => _LockDetailPageState();
|
||||
}
|
||||
|
||||
class _LockDetailPageState extends State<LockDetailPage> {
|
||||
class _LockDetailPageState extends State<LockDetailPage> with RouteAware {
|
||||
final logic = Get.put(LockDetailLogic());
|
||||
final state = Get.find<LockDetailLogic>().state;
|
||||
|
||||
@ -190,10 +191,13 @@ class _LockDetailPageState extends State<LockDetailPage> {
|
||||
var showWidgetArr = <Widget>[];
|
||||
|
||||
// 考勤
|
||||
showWidgetArr.add(bottomItem('images/main/icon_main_clockingIn.png',
|
||||
TranslationLoader.lanKeys!.checkingIn!.tr, () {
|
||||
Get.toNamed(Routers.checkingInListPage);
|
||||
}));
|
||||
if (state.keyInfos.value.isAttendance == 1) {
|
||||
showWidgetArr.add(bottomItem('images/main/icon_main_clockingIn.png',
|
||||
TranslationLoader.lanKeys!.checkingIn!.tr, () {
|
||||
Get.toNamed(Routers.checkingInListPage,
|
||||
arguments: state.keyInfos.value);
|
||||
}));
|
||||
}
|
||||
|
||||
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() {}
|
||||
}
|
||||
|
||||
@ -51,8 +51,16 @@ abstract class Api {
|
||||
final String configPassageModeUrl = '/room/configPassageMode'; // 配置锁的常开模式
|
||||
final String updateSettingUrl = '/room/updateSetting'; // 锁声音/防撬报警/重置键/考勤
|
||||
final String roomQueryDateUrl = '/room/queryDate'; // 获取网关时间
|
||||
final String lockDiagnoseUrl = '/room/uploadLockInfo'; // 锁诊断
|
||||
final String getServerDatetimeUrl = '/check/getServerDatetime'; // 获取服务器当前时间
|
||||
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 lockUserListURL = '/keyUser/listKeyUser'; //锁用户列表
|
||||
final String canSendKeyURL = '/keyUser/canSendKey'; //群发钥匙检查
|
||||
|
||||
@ -504,6 +504,29 @@ class ApiProvider extends BaseProvider {
|
||||
'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(
|
||||
getLockVersionInfoUrl.toUrl,
|
||||
@ -511,6 +534,73 @@ class ApiProvider extends BaseProvider {
|
||||
'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(
|
||||
listLockByGroupURL.toUrl,
|
||||
jsonEncode({'type': type, 'keyGroupId': keyGroupId}));
|
||||
|
||||
@ -27,8 +27,10 @@ class BaseProvider extends GetConnect with Api {
|
||||
Map<String, String>? headers,
|
||||
Map<String, dynamic>? query,
|
||||
Decoder<T>? decoder,
|
||||
Progress? uploadProgress}) async {
|
||||
Progress? uploadProgress,
|
||||
bool? isShowLoading}) async {
|
||||
// print("post: url:${url} body:${body} contentType:${contentType} headers:${headers} query:${query}");
|
||||
if(isShowLoading == true) EasyLoading.show();
|
||||
|
||||
print('哈喽请求body体为:${body}');
|
||||
var res = await super.post(url, body,
|
||||
|
||||
@ -13,6 +13,7 @@ import '../common/safetyVerification/entity/SafetyVerificationEntity.dart';
|
||||
import '../login/login/entity/LoginEntity.dart';
|
||||
import '../login/register/entity/SendValidationCodeEntity.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/normallyOpenMode/GetPassageModeConfigEntity.dart';
|
||||
import '../main/lockMian/entity/lockInfoEntity.dart';
|
||||
@ -488,6 +489,29 @@ class ApiRepository {
|
||||
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({
|
||||
required String lockId,
|
||||
@ -549,4 +573,59 @@ class ApiRepository {
|
||||
usernameType);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,6 +7,5 @@ FutureOr<Request> requestLogInterceptor(Request request) async {
|
||||
Get.log(
|
||||
'GET HTTP REQUEST \n${request.url} \n${request.headers} ${request.toString()} ');
|
||||
Get.log(request.headers.toString());
|
||||
EasyLoading.show();
|
||||
return request;
|
||||
}
|
||||
|
||||
21
star_lock/lib/tools/appRouteObserver.dart
Normal file
21
star_lock/lib/tools/appRouteObserver.dart
Normal 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;
|
||||
}
|
||||
}
|
||||
76
star_lock/lib/tools/showIosTipView.dart
Normal file
76
star_lock/lib/tools/showIosTipView.dart
Normal 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("确定");
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user