88 lines
3.0 KiB
Dart
Executable File

import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../../../lockMian/entity/lockListInfo_entity.dart';
import '../checkingInSetStaffList/checkingInStaffList_entity.dart';
import 'checkingInAddStaffSelectKey_entity.dart';
class CheckingInAddStaffState {
CheckingInAddStaffState() {
final Map<dynamic, dynamic> map = Get.arguments;
getKeyInfosData.value = map['getKeyInfosData'];
companyId.value = map['companyId'];
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';
break;
case 2:
selectPrintingMethodStr.value = '密码'.tr;
break;
case 3:
selectPrintingMethodStr.value = ''.tr;
break;
case 4:
selectPrintingMethodStr.value = '指纹'.tr;
break;
case 5:
selectPrintingMethodStr.value = '人脸'.tr;
break;
}
if (staffListItemData.value.attendanceWay!.isNotEmpty) {
appUnHaveAccount.value = false;
attendanceWayNumber.value = staffListItemData.value.attendanceWay!;
} else {
appUnHaveAccount.value = true;
}
if ((staffListItemData.value.cardStatus ?? 0) == 1) {
//打卡方式是否是正常状态
appUnHaveAccount.value = true;
attendanceWayNumber.value = '';
}
}
}
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 RxString selectPrintingMethodType =
'1'.obs; // 选择打卡类型 1APP 2密码 3卡 4指纹 5人脸
final RxString selectPrintingMethodStr = 'APP'.obs; // 选择打卡类型字符串
final RxString countryName = '中国'.tr.obs;
final RxString countryCode = '86'.obs;
final RxBool appUnHaveAccount = true.obs; // 默认没有账号
final RxList<CheckingInAddStaffKeyEntity> keyEntity =
<CheckingInAddStaffKeyEntity>[].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;
bool get staffAccountIsNotEmpty => staffAccount.value.isNotEmpty;
bool get attendanceWayNumberIsNotEmpty =>
attendanceWayNumber.value.isNotEmpty;
}