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