fix:修复 第4栏应都要显示,星锁只显示后部分
This commit is contained in:
parent
c978444330
commit
b3d0c04ddc
@ -4,6 +4,8 @@ import 'dart:ffi';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/app_settings/app_settings.dart';
|
||||
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import '../../../../../network/api_repository.dart';
|
||||
import '../../../../../tools/eventBusEventManage.dart';
|
||||
@ -23,30 +25,30 @@ class CheckingInAddStaffLogic extends BaseGetXController {
|
||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||
_getNumberEvent = eventBus
|
||||
.on<ChickInAddStaffCardAndFingerprintBlockNumberEvent>()
|
||||
.listen((event) {
|
||||
.listen((ChickInAddStaffCardAndFingerprintBlockNumberEvent event) {
|
||||
state.attendanceWayNumber.value = event.number;
|
||||
isCanClickAction();
|
||||
});
|
||||
}
|
||||
|
||||
// 添加员工
|
||||
void addStaffLoadData() async {
|
||||
var usernameType = "1";
|
||||
if (state.appUnHaveAccount.value && state.staffAccount.contains("@")) {
|
||||
usernameType = "2";
|
||||
Future<void> addStaffLoadData() async {
|
||||
String usernameType = '1';
|
||||
if (state.appUnHaveAccount.value && state.staffAccount.contains('@')) {
|
||||
usernameType = '2';
|
||||
}
|
||||
|
||||
// 当是app且没有钥匙时,直接把账号赋值给attendanceWayNumber
|
||||
if (state.appUnHaveAccount.value &&
|
||||
state.selectPrintingMethodType.value == "1") {
|
||||
state.selectPrintingMethodType.value == '1') {
|
||||
state.attendanceWayNumber.value = state.staffAccountController.text;
|
||||
}
|
||||
|
||||
var entity = await ApiRepository.to.addStaffData(
|
||||
final LoginEntity entity = await ApiRepository.to.addStaffData(
|
||||
attendanceType: state.selectPrintingMethodType.value,
|
||||
attendanceWay: state.attendanceWayNumber.value,
|
||||
companyId: state.companyId.value,
|
||||
have: state.appUnHaveAccount.value ? "2" : "1",
|
||||
have: state.appUnHaveAccount.value ? '2' : '1',
|
||||
staffName: state.staffNameController.text,
|
||||
countryCode: state.countryCode.value,
|
||||
usernameType: usernameType,
|
||||
@ -54,7 +56,7 @@ class CheckingInAddStaffLogic extends BaseGetXController {
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
eventBus.fire(RefreshCheckInSetDataEvent());
|
||||
eventBus.fire(RefreshCheckInListEvent());
|
||||
Get.back(result: "addScuess");
|
||||
Get.back(result: 'addScuess');
|
||||
} else if (entity.errorCode! == 425) {
|
||||
showToast(entity.errorMsg!);
|
||||
}
|
||||
@ -62,8 +64,9 @@ class CheckingInAddStaffLogic extends BaseGetXController {
|
||||
|
||||
// 考勤设置添加员工-选择钥匙 1为APP,2为密码,3为卡,4为指纹,返回数据中,
|
||||
// attendanceWay分别为用户名、密码、卡号、指纹号
|
||||
void addStaffSelectKey(KeyClickCallback kyClickCallback) async {
|
||||
var entity = await ApiRepository.to.addStaffSelectKeyData(
|
||||
Future<void> addStaffSelectKey(KeyClickCallback kyClickCallback) async {
|
||||
final CheckingInAddStaffSelectKeyEntity entity =
|
||||
await ApiRepository.to.addStaffSelectKeyData(
|
||||
companyId: state.companyId.value,
|
||||
type: state.selectPrintingMethodType.value,
|
||||
);
|
||||
@ -74,18 +77,17 @@ class CheckingInAddStaffLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
// 编辑员工
|
||||
void editStaffLoadData() async {
|
||||
var usernameType = "1";
|
||||
if (state.appUnHaveAccount.value && state.staffAccount.contains("@")) {
|
||||
usernameType = "2";
|
||||
Future<void> editStaffLoadData() async {
|
||||
String usernameType = '1';
|
||||
if (state.appUnHaveAccount.value && state.staffAccount.contains('@')) {
|
||||
usernameType = '2';
|
||||
}
|
||||
|
||||
|
||||
var entity = await ApiRepository.to.editStaffData(
|
||||
final LoginEntity entity = await ApiRepository.to.editStaffData(
|
||||
attendanceType: state.selectPrintingMethodType.value,
|
||||
attendanceWay: state.attendanceWayNumber.value,
|
||||
staffId: state.staffListItemData.value.staffId.toString(),
|
||||
have: state.appUnHaveAccount.value ? "2" : "1",
|
||||
have: state.appUnHaveAccount.value ? '2' : '1',
|
||||
staffName: state.staffNameController.text,
|
||||
countryCode: state.countryCode.value,
|
||||
usernameType: usernameType,
|
||||
@ -99,13 +101,13 @@ class CheckingInAddStaffLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
//获取密码请求
|
||||
void getKeyboardPwdRequest() async {
|
||||
Future<void> getKeyboardPwdRequest() async {
|
||||
if (state.staffNameController.text.isEmpty) {
|
||||
showToast("请输入姓名");
|
||||
showToast('请输入姓名');
|
||||
return;
|
||||
}
|
||||
var entity = await ApiRepository.to.getPasswordKey(
|
||||
endDate: "0",
|
||||
final PasswordKeyEntity entity = await ApiRepository.to.getPasswordKey(
|
||||
endDate: '0',
|
||||
keyboardPwdName: state.staffNameController.text,
|
||||
keyboardPwdType: 2.toString(),
|
||||
lockId: state.getKeyInfosData.value.lockId.toString(),
|
||||
@ -136,7 +138,7 @@ class CheckingInAddStaffLogic extends BaseGetXController {
|
||||
|
||||
// 是否能点击
|
||||
void isCanClickAction() {
|
||||
if (state.selectPrintingMethodType.value == "1" &&
|
||||
if (state.selectPrintingMethodType.value == '1' &&
|
||||
state.appUnHaveAccount.value) {
|
||||
// 没有账号的时候直接判断姓名和账号是否为空
|
||||
state.isCanClick.value =
|
||||
@ -154,6 +156,8 @@ class CheckingInAddStaffLogic extends BaseGetXController {
|
||||
_initLoadDataAction();
|
||||
|
||||
changeInput(state.staffNameController);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaffSelectKey_entity.dart';
|
||||
@ -62,7 +63,7 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
||||
if (state.getKeyInfosData.value.lockName!.contains('T9A')) {
|
||||
list.add('人脸'.tr);
|
||||
}
|
||||
_showSelectClockInType(list, list, '1', '选择钥匙'.tr);
|
||||
_showSelectClockInType(list, list, list, '1', '选择钥匙'.tr);
|
||||
})),
|
||||
SizedBox(height: 10.h),
|
||||
//员工是否有App、卡、钥匙、指纹必须显示
|
||||
@ -96,10 +97,8 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
||||
))),
|
||||
// 当选择App时且没有钥匙的时候 显示输入账号输入框和选择国家 其他隐藏
|
||||
Obx(() => Visibility(
|
||||
visible: (state.appUnHaveAccount.value &&
|
||||
state.selectPrintingMethodType.value == '1')
|
||||
? true
|
||||
: false,
|
||||
visible: state.appUnHaveAccount.value &&
|
||||
state.selectPrintingMethodType.value == '1',
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
CommonItem(
|
||||
@ -166,7 +165,7 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
||||
return;
|
||||
}
|
||||
|
||||
final data = await Get.toNamed(
|
||||
final dynamic data = await Get.toNamed(
|
||||
Routers.addCardPage,
|
||||
arguments: <String, Object?>{
|
||||
'lockId':
|
||||
@ -228,9 +227,14 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
||||
// 当选择钥匙类型为有时 必显示
|
||||
Obx(() {
|
||||
final bool isPass = state.selectPrintingMethodType.value == '2';
|
||||
String rightTitle = state.attendanceWayNumber.value;
|
||||
String attendanceWayNumber = state.attendanceWayNumber.value;
|
||||
final String attendanceWayName = state.attendanceWayName.value;
|
||||
if (isPass) {
|
||||
rightTitle = showPass(rightTitle);
|
||||
attendanceWayNumber = showPass(attendanceWayNumber);
|
||||
}
|
||||
String rightTitle = attendanceWayNumber;
|
||||
if (attendanceWayName.trim() != '') {
|
||||
rightTitle = '$attendanceWayName - ' + rightTitle;
|
||||
}
|
||||
return Visibility(
|
||||
visible: !state.appUnHaveAccount.value,
|
||||
@ -243,6 +247,7 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
||||
logic.addStaffSelectKey(
|
||||
(List<CheckingInAddStaffKeyEntity> v) {
|
||||
final List<String> showList = <String>[];
|
||||
final List<String> nameList = <String>[];
|
||||
final List<String> numberList = <String>[];
|
||||
for (final CheckingInAddStaffKeyEntity element in v) {
|
||||
final bool isPass =
|
||||
@ -252,12 +257,13 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
||||
attendanceWay = showPass(attendanceWay);
|
||||
}
|
||||
final String text =
|
||||
'${element.staffName}-$attendanceWay';
|
||||
'${element.staffName} - $attendanceWay';
|
||||
showList.add(text);
|
||||
numberList.add(element.attendanceWay ?? '');
|
||||
nameList.add(element.staffName ?? '');
|
||||
}
|
||||
_showSelectClockInType(showList, numberList, '2',
|
||||
addStaffSelectKeySelectClockInType());
|
||||
_showSelectClockInType(showList, numberList, nameList,
|
||||
'2', addStaffSelectKeySelectClockInType());
|
||||
});
|
||||
}),
|
||||
);
|
||||
@ -344,8 +350,8 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
||||
}
|
||||
|
||||
// type 1 打卡方式 2选择钥匙
|
||||
void _showSelectClockInType(List showList, List numberList,
|
||||
String showBottomSheetToolType, String title) {
|
||||
void _showSelectClockInType(List<String> showList, List<String> numberList,
|
||||
List<String> nameList, String showBottomSheetToolType, String title) {
|
||||
ShowBottomSheetTool().showSingleRowPicker(
|
||||
//上下文
|
||||
context,
|
||||
@ -364,8 +370,10 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
||||
if (showBottomSheetToolType == '1') {
|
||||
state.selectPrintingMethodType.value = (index + 1).toString();
|
||||
state.selectPrintingMethodStr.value = str.toString();
|
||||
state.attendanceWayName.value = '';
|
||||
state.attendanceWayNumber.value = '';
|
||||
} else {
|
||||
state.attendanceWayName.value = nameList[index].toString();
|
||||
state.attendanceWayNumber.value = numberList[index].toString();
|
||||
}
|
||||
logic.isCanClickAction();
|
||||
|
||||
@ -6,27 +6,28 @@ import '../checkingInSetStaffList/checkingInStaffList_entity.dart';
|
||||
import 'checkingInAddStaffSelectKey_entity.dart';
|
||||
|
||||
class CheckingInAddStaffState {
|
||||
final getKeyInfosData = LockListInfoItemEntity().obs;
|
||||
final companyId = "".obs;
|
||||
final staffListItemData = CheckingInAddStaffListItemEntity().obs;
|
||||
final Rx<LockListInfoItemEntity> getKeyInfosData = LockListInfoItemEntity().obs;
|
||||
final RxString companyId = ''.obs;
|
||||
final Rx<CheckingInAddStaffListItemEntity> staffListItemData = CheckingInAddStaffListItemEntity().obs;
|
||||
|
||||
final TextEditingController staffNameController = TextEditingController();
|
||||
final TextEditingController staffAccountController = TextEditingController();
|
||||
|
||||
final selectPrintingMethodType = "1".obs; // 选择打卡类型 1APP 2密码 3卡 4指纹 5人脸
|
||||
final selectPrintingMethodStr = "APP".obs; // 选择打卡类型字符串
|
||||
final RxString selectPrintingMethodType = '1'.obs; // 选择打卡类型 1APP 2密码 3卡 4指纹 5人脸
|
||||
final RxString selectPrintingMethodStr = 'APP'.obs; // 选择打卡类型字符串
|
||||
|
||||
final countryName = "中国".tr.obs;
|
||||
final countryCode = "86".obs;
|
||||
final RxString countryName = '中国'.tr.obs;
|
||||
final RxString countryCode = '86'.obs;
|
||||
|
||||
final appUnHaveAccount = true.obs; // 默认没有账号
|
||||
final keyEntity = <CheckingInAddStaffKeyEntity>[].obs; // 选择钥匙数据
|
||||
final RxBool appUnHaveAccount = true.obs; // 默认没有账号
|
||||
final RxList<CheckingInAddStaffKeyEntity> keyEntity = <CheckingInAddStaffKeyEntity>[].obs; // 选择钥匙数据
|
||||
|
||||
final isAdd = "1".obs; // 1添加 2编辑
|
||||
final attendanceWayNumber = "".obs;
|
||||
final isCanClick = false.obs;
|
||||
var staffName = ''.obs;
|
||||
var staffAccount = ''.obs;
|
||||
final RxString isAdd = '1'.obs; // 1添加 2编辑
|
||||
final RxString attendanceWayName = ''.obs;
|
||||
final RxString attendanceWayNumber = ''.obs;
|
||||
final RxBool isCanClick = false.obs;
|
||||
RxString staffName = ''.obs;
|
||||
RxString staffAccount = ''.obs;
|
||||
|
||||
bool get staffNameIsNotEmpty => staffName.value.isNotEmpty;
|
||||
|
||||
@ -37,28 +38,28 @@ class CheckingInAddStaffState {
|
||||
|
||||
CheckingInAddStaffState() {
|
||||
Map map = Get.arguments;
|
||||
getKeyInfosData.value = map["getKeyInfosData"];
|
||||
companyId.value = map["companyId"];
|
||||
getKeyInfosData.value = map['getKeyInfosData'];
|
||||
companyId.value = map['companyId'];
|
||||
|
||||
isAdd.value = map["isAdd"];
|
||||
if (isAdd.value == "2") {
|
||||
staffListItemData.value = map["staffListItem"];
|
||||
isAdd.value = map['isAdd'];
|
||||
if (isAdd.value == '2') {
|
||||
staffListItemData.value = map['staffListItem'];
|
||||
staffNameController.text = staffListItemData.value.staffName!;
|
||||
|
||||
selectPrintingMethodType.value =
|
||||
staffListItemData.value.attendanceType.toString();
|
||||
switch (staffListItemData.value.attendanceType) {
|
||||
case 1:
|
||||
selectPrintingMethodStr.value = "APP";
|
||||
selectPrintingMethodStr.value = 'APP';
|
||||
break;
|
||||
case 2:
|
||||
selectPrintingMethodStr.value = "密码".tr;
|
||||
selectPrintingMethodStr.value = '密码'.tr;
|
||||
break;
|
||||
case 3:
|
||||
selectPrintingMethodStr.value = "卡".tr;
|
||||
selectPrintingMethodStr.value = '卡'.tr;
|
||||
break;
|
||||
case 4:
|
||||
selectPrintingMethodStr.value = "指纹".tr;
|
||||
selectPrintingMethodStr.value = '指纹'.tr;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_state.dart';
|
||||
import 'package:star_lock/tools/showTipView.dart';
|
||||
|
||||
import '../../../../../appRouters.dart';
|
||||
@ -23,8 +24,8 @@ class CheckingInStaffListPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
|
||||
final logic = Get.put(CheckingInStaffManageLogic());
|
||||
final state = Get.find<CheckingInStaffManageLogic>().state;
|
||||
final CheckingInStaffManageLogic logic = Get.put(CheckingInStaffManageLogic());
|
||||
final CheckingInStaffManageState state = Get.find<CheckingInStaffManageLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -34,13 +35,13 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
|
||||
barTitle: TranslationLoader.lanKeys!.staff!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
actionsList: [
|
||||
actionsList: <Widget>[
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
var data = await Get.toNamed(Routers.checkingInAddStaffPage, arguments: {
|
||||
"getKeyInfosData": state.getKeyInfosData.value,
|
||||
"companyId": state.companyId.value,
|
||||
"isAdd": "1",
|
||||
final dynamic data = await Get.toNamed(Routers.checkingInAddStaffPage, arguments: <String, Object>{
|
||||
'getKeyInfosData': state.getKeyInfosData.value,
|
||||
'companyId': state.companyId.value,
|
||||
'isAdd': '1',
|
||||
});
|
||||
if(data != null) {
|
||||
logic.getStaffList();
|
||||
@ -62,23 +63,23 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
|
||||
SlidableAutoCloseBehavior(
|
||||
child: ListView.separated(
|
||||
itemCount: state.staffListData.value.length,
|
||||
itemBuilder: (c, index) {
|
||||
CheckingInAddStaffListItemEntity staffListItem = state.staffListData[index];
|
||||
itemBuilder: (BuildContext c, int index) {
|
||||
final CheckingInAddStaffListItemEntity staffListItem = state.staffListData[index];
|
||||
return Slidable(
|
||||
key:ValueKey(staffListItem.staffId),
|
||||
endActionPane: ActionPane(
|
||||
extentRatio: 0.2,
|
||||
motion: const ScrollMotion(),
|
||||
children: [
|
||||
children: <Widget>[
|
||||
SlidableAction(
|
||||
onPressed: (BuildContext context){
|
||||
// 1APP 2密码 3卡 4指纹 5人脸
|
||||
if(staffListItem.attendanceType == 1){
|
||||
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除员工钥匙'.tr, (isAllData) {
|
||||
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除员工钥匙'.tr, (bool isAllData) {
|
||||
logic.deletStaff(staffListItem.staffId!, (isAllData ? 1 : 0));
|
||||
});
|
||||
}else{
|
||||
ShowTipView().showIosTipWithContentDialog("确定要删除员工吗?".tr, () {
|
||||
ShowTipView().showIosTipWithContentDialog('确定要删除员工吗?'.tr, () {
|
||||
logic.deletStaff(staffListItem.staffId!, 0);
|
||||
});
|
||||
// showIosTipViewDialog(staffListItem.staffId!, context);
|
||||
@ -92,10 +93,10 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
|
||||
],
|
||||
),
|
||||
child: _checkingInStaffManageItem(staffListItem, () {
|
||||
Get.toNamed(Routers.checkingInStaffDetailPage, arguments: {
|
||||
"staffListItem": staffListItem,
|
||||
"getKeyInfosData": state.getKeyInfosData.value,
|
||||
"companyId": state.companyId.value,
|
||||
Get.toNamed(Routers.checkingInStaffDetailPage, arguments: <String, Object>{
|
||||
'staffListItem': staffListItem,
|
||||
'getKeyInfosData': state.getKeyInfosData.value,
|
||||
'companyId': state.companyId.value,
|
||||
});
|
||||
}),
|
||||
);
|
||||
@ -108,7 +109,7 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
|
||||
// });
|
||||
// });
|
||||
},
|
||||
separatorBuilder: (context, index) {
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return Divider(height: 1.h, indent: 20.w, color: AppColors.greyLineColor);
|
||||
},
|
||||
),
|
||||
@ -125,14 +126,14 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
|
||||
color: Colors.white,
|
||||
margin: EdgeInsets.only(right: 10.w, top: 10.h, bottom: 10.h),
|
||||
child: Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
SizedBox(width: 20.w,),
|
||||
// CustomNetworkImage(url: staffListItem.headurl!, width: 40.w , height: 40.w),
|
||||
Image.asset(getTypeIcon(staffListItem.attendanceType!), width: 60.w, height: 60.w),
|
||||
SizedBox(width: 20.w,),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: 1.sw - 20.w - 60.w - 20.w - 30.w,
|
||||
child: Text(staffListItem.staffName!,
|
||||
@ -153,7 +154,7 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
|
||||
borderRadius: BorderRadius.circular(5.w),
|
||||
color: AppColors.openPassageModeColor,
|
||||
),
|
||||
child: Text("打卡方式无效".tr, style: TextStyle(fontSize: 18.sp, color: AppColors.appBarIconColor)),
|
||||
child: Text('打卡方式无效'.tr, style: TextStyle(fontSize: 18.sp, color: AppColors.appBarIconColor)),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user