修复部分bug
This commit is contained in:
parent
872ae68c1c
commit
0a855c6af2
@ -32,17 +32,15 @@ class ElectronicKeyDetailChangeDateLogic extends BaseGetXController {
|
||||
}
|
||||
}
|
||||
|
||||
//修改钥匙名称请求
|
||||
//编辑电子钥匙有效期请求
|
||||
Future<void> updateKeyDateRequest() async {
|
||||
KeyOperationRecordEntity entity = await ApiRepository.to.updateKeyDate(
|
||||
state.itemData.value.keyId.toString(),
|
||||
state.itemData.value.lockId.toString(),
|
||||
state.failureDateTime.millisecondsSinceEpoch.toString(),
|
||||
state.endDay.value,
|
||||
'',
|
||||
state.effectiveDateTime.millisecondsSinceEpoch.toString(),
|
||||
state.startDay.value,
|
||||
state.weekDays.value);
|
||||
state.weekDays.value,
|
||||
state.itemData.value.keyType! == 1 ? 2 : state.itemData.value.keyType!);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("修改成功", something: () {
|
||||
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||
|
||||
@ -20,8 +20,6 @@ class ElectronicKeyDetailChangeDateState {
|
||||
final selectFailureDate = ''.obs; //失效时间
|
||||
DateTime effectiveDateTime = DateTime.now();
|
||||
DateTime failureDateTime = DateTime.now();
|
||||
final endDay = ''.obs;
|
||||
final startDay = ''.obs;
|
||||
final weekDays = [].obs;
|
||||
|
||||
ElectronicKeyDetailChangeDateState() {
|
||||
|
||||
@ -14,40 +14,56 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
||||
|
||||
//发送钥匙请求
|
||||
Future<void> sendElectronicKeyRequest() async {
|
||||
if(state.emailOrPhoneController.text.isEmpty){
|
||||
if (state.emailOrPhoneController.text.isEmpty) {
|
||||
showToast("请输入接收者账号");
|
||||
return;
|
||||
}
|
||||
if(state.keyNameController.text.isEmpty){
|
||||
showToast("请输入接收者姓名");
|
||||
return;
|
||||
}
|
||||
// 姓名变为非必填(同通通锁)
|
||||
// if(state.keyNameController.text.isEmpty){
|
||||
// showToast("请输入接收者姓名");
|
||||
// return;
|
||||
// }
|
||||
|
||||
DateTime startDateTime = DateTime(state.effectiveDateTime.value.year, state.effectiveDateTime.value.month, state.effectiveDateTime.value.day, state.effectiveDateTime.value.hour, state.effectiveDateTime.value.minute);
|
||||
DateTime endDateTime = DateTime(state.failureDateTime.value.year, state.failureDateTime.value.month, state.failureDateTime.value.day, state.failureDateTime.value.hour, state.failureDateTime.value.minute);
|
||||
DateTime startDateTime = DateTime(
|
||||
state.effectiveDateTime.value.year,
|
||||
state.effectiveDateTime.value.month,
|
||||
state.effectiveDateTime.value.day,
|
||||
state.effectiveDateTime.value.hour,
|
||||
state.effectiveDateTime.value.minute);
|
||||
DateTime endDateTime = DateTime(
|
||||
state.failureDateTime.value.year,
|
||||
state.failureDateTime.value.month,
|
||||
state.failureDateTime.value.day,
|
||||
state.failureDateTime.value.hour,
|
||||
state.failureDateTime.value.minute);
|
||||
|
||||
//发送钥匙请求
|
||||
if (state.type.value == "0" || state.type.value == "3") {
|
||||
print("startDateTime:$startDateTime endDateTime:$endDateTime DateTime.now():${DateTime.now()} startDateTime.isBefore(endDateTime):${startDateTime.isBefore(endDateTime)}");
|
||||
if (!startDateTime.isBefore(endDateTime) || startDateTime.isAtSameMomentAs(endDateTime)) {
|
||||
showToast("失效时间需大于生效时间");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!startDateTime.isBefore(DateTime.now()) || startDateTime.isAtSameMomentAs(DateTime.now())) {
|
||||
showToast("生效时间需大于当前时间");
|
||||
return;
|
||||
}
|
||||
if (state.type.value == "0" || state.type.value == "3") {
|
||||
print(
|
||||
"startDateTime:$startDateTime endDateTime:$endDateTime DateTime.now():${DateTime.now()} startDateTime.isBefore(endDateTime):${startDateTime.isBefore(endDateTime)}");
|
||||
if (!startDateTime.isBefore(endDateTime) ||
|
||||
startDateTime.isAtSameMomentAs(endDateTime)) {
|
||||
showToast("失效时间需大于生效时间");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!startDateTime.isBefore(DateTime.now()) ||
|
||||
startDateTime.isAtSameMomentAs(DateTime.now())) {
|
||||
showToast("生效时间需大于当前时间");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
String lockID = state.keyInfo.value.lockId.toString();
|
||||
int typeValue = int.parse(state.type.value);
|
||||
switch (typeValue) {
|
||||
case 0:
|
||||
{
|
||||
typeValue = XSConstantMacro.keyTypeTime;
|
||||
state.failureTimestamp.value = state.failureDateTime.value.millisecondsSinceEpoch;
|
||||
state.effectiveTimestamp.value = state.effectiveDateTime.value.millisecondsSinceEpoch;
|
||||
state.failureTimestamp.value =
|
||||
state.failureDateTime.value.millisecondsSinceEpoch;
|
||||
state.effectiveTimestamp.value =
|
||||
state.effectiveDateTime.value.millisecondsSinceEpoch;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
@ -191,10 +207,14 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
||||
);
|
||||
}
|
||||
|
||||
void resetData(){
|
||||
void resetData() {
|
||||
state.emailOrPhoneController.text = "";
|
||||
state.keyNameController.text = "";
|
||||
state.selectEffectiveDate = '${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'.obs; //默认为当前时间
|
||||
state.selectFailureDate = '${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'.obs; //默认为当前时间
|
||||
state.selectEffectiveDate =
|
||||
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'
|
||||
.obs; //默认为当前时间
|
||||
state.selectFailureDate =
|
||||
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'
|
||||
.obs; //默认为当前时间
|
||||
}
|
||||
}
|
||||
|
||||
@ -102,10 +102,9 @@ class _ExpireLockChangeDatePageState extends State<ExpireLockChangeDatePage> {
|
||||
itemData.keyId.toString(),
|
||||
itemData.lockId.toString(),
|
||||
_failureDateTime.millisecondsSinceEpoch.toString(),
|
||||
'',
|
||||
'',
|
||||
_effectiveDateTime.millisecondsSinceEpoch.toString(),
|
||||
'', []);
|
||||
[],
|
||||
itemData.keyType!);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("修改要是名称成功啦啦啦啦啦");
|
||||
EasyLoading.showToast('修改成功', duration: 2000.milliseconds);
|
||||
|
||||
@ -17,20 +17,22 @@ class ApiProvider extends BaseProvider {
|
||||
}));
|
||||
|
||||
Future<Response> register(
|
||||
int receiverType,
|
||||
int countryCode,
|
||||
String account,
|
||||
String password,
|
||||
String verificationCode,
|
||||
) =>
|
||||
post(registerUrl.toUrl, jsonEncode({
|
||||
'receiverType': receiverType,
|
||||
'countryCode': countryCode,
|
||||
"account": account,
|
||||
'password': password,
|
||||
'verificationCode': verificationCode,
|
||||
'platId': "2",
|
||||
}));
|
||||
int receiverType,
|
||||
int countryCode,
|
||||
String account,
|
||||
String password,
|
||||
String verificationCode,
|
||||
) =>
|
||||
post(
|
||||
registerUrl.toUrl,
|
||||
jsonEncode({
|
||||
'receiverType': receiverType,
|
||||
'countryCode': countryCode,
|
||||
"account": account,
|
||||
'password': password,
|
||||
'verificationCode': verificationCode,
|
||||
'platId': "2",
|
||||
}));
|
||||
|
||||
// post(
|
||||
// registerUrl.toUrl,
|
||||
@ -97,16 +99,16 @@ class ApiProvider extends BaseProvider {
|
||||
post(getCountryRegionURL.toUrl, jsonEncode({'type': type}));
|
||||
|
||||
Future<Response> electronicKeyList(
|
||||
String endDate,
|
||||
String keyId,
|
||||
String keyStatus,
|
||||
String keyRight,
|
||||
String lockId,
|
||||
String pageNo,
|
||||
String pageSize,
|
||||
String startDate,
|
||||
String searchStr,
|
||||
) =>
|
||||
String endDate,
|
||||
String keyId,
|
||||
String keyStatus,
|
||||
String keyRight,
|
||||
String lockId,
|
||||
String pageNo,
|
||||
String pageSize,
|
||||
String startDate,
|
||||
String searchStr,
|
||||
) =>
|
||||
post(
|
||||
electronicKeyListURL.toUrl,
|
||||
jsonEncode({
|
||||
@ -196,26 +198,17 @@ class ApiProvider extends BaseProvider {
|
||||
'operatorUid': operatorUid,
|
||||
}));
|
||||
|
||||
Future<Response> updateKeyDate(
|
||||
String keyId,
|
||||
String lockId,
|
||||
String endDate,
|
||||
String endDay,
|
||||
String operatorUid,
|
||||
String startDate,
|
||||
String startDay,
|
||||
List weekDays) =>
|
||||
Future<Response> updateKeyDate(String keyId, String lockId, String endDate,
|
||||
String startDate, List weekDays, int keyType) =>
|
||||
post(
|
||||
updateKeyDateURL.toUrl,
|
||||
jsonEncode({
|
||||
'keyId': keyId,
|
||||
'lockId': lockId,
|
||||
'endDate': endDate,
|
||||
'endDay': endDay,
|
||||
'operatorUid': operatorUid,
|
||||
'startDate': startDate,
|
||||
'startDay': startDay,
|
||||
'weekDays': weekDays,
|
||||
'keyType': keyType
|
||||
}));
|
||||
|
||||
Future<Response> resetElectronicKey(String lockId, String operatorUid) =>
|
||||
|
||||
@ -325,17 +325,10 @@ class ApiRepository {
|
||||
}
|
||||
|
||||
//编辑电子钥匙有效期
|
||||
Future<KeyOperationRecordEntity> updateKeyDate(
|
||||
String keyId,
|
||||
String lockId,
|
||||
String endDate,
|
||||
String endDay,
|
||||
String operatorUid,
|
||||
String startDate,
|
||||
String startDay,
|
||||
List weekDays) async {
|
||||
final res = await apiProvider.updateKeyDate(keyId, lockId, endDate, endDay,
|
||||
operatorUid, startDate, startDay, weekDays);
|
||||
Future<KeyOperationRecordEntity> updateKeyDate(String keyId, String lockId,
|
||||
String endDate, String startDate, List weekDays, int keyType) async {
|
||||
final res = await apiProvider.updateKeyDate(
|
||||
keyId, lockId, endDate, startDate, weekDays, keyType);
|
||||
return KeyOperationRecordEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user