|
@@ -1,16 +1,19 @@
|
|
|
|
+import 'dart:typed_data';
|
|
|
|
+
|
|
import 'package:domain/entity/response/attendance_entity.dart';
|
|
import 'package:domain/entity/response/attendance_entity.dart';
|
|
|
|
+import 'package:domain/entity/response/check_success_entity.dart';
|
|
import 'package:domain/repository/job_repository.dart';
|
|
import 'package:domain/repository/job_repository.dart';
|
|
-import 'package:flutter/material.dart';
|
|
|
|
import 'package:get/get.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:plugin_basic/service/user_service.dart';
|
|
import 'package:plugin_basic/service/user_service.dart';
|
|
|
|
+import 'package:plugin_platform/engine/dialog/dialog_engine.dart';
|
|
import 'package:plugin_platform/engine/toast/toast_engine.dart';
|
|
import 'package:plugin_platform/engine/toast/toast_engine.dart';
|
|
import 'package:plugin_platform/http/dio/dio_cancelable_mixin.dart';
|
|
import 'package:plugin_platform/http/dio/dio_cancelable_mixin.dart';
|
|
import 'package:shared/utils/date_time_utils.dart';
|
|
import 'package:shared/utils/date_time_utils.dart';
|
|
import 'package:widgets/load_state_layout.dart';
|
|
import 'package:widgets/load_state_layout.dart';
|
|
-import 'package:widgets/picker/option_pick_util.dart';
|
|
|
|
import 'package:widgets/picker/date_picker_util.dart';
|
|
import 'package:widgets/picker/date_picker_util.dart';
|
|
import 'package:widgets/widget_export.dart';
|
|
import 'package:widgets/widget_export.dart';
|
|
|
|
|
|
|
|
+import '../../widget/attendance_sign_in_out.dart';
|
|
import 'sign_in_sign_out_state.dart';
|
|
import 'sign_in_sign_out_state.dart';
|
|
|
|
|
|
class SignInSignOutController extends GetxController with DioCancelableMixin {
|
|
class SignInSignOutController extends GetxController with DioCancelableMixin {
|
|
@@ -97,6 +100,36 @@ class SignInSignOutController extends GetxController with DioCancelableMixin {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /// 签到签出
|
|
|
|
+ void requestCheckInCheckOut(bool isCheckIn, AttendanceList item, ByteData byteData) async {
|
|
|
|
+ //请求接口
|
|
|
|
+ final String? token = UserService.to.token;
|
|
|
|
+
|
|
|
|
+ var result = await jobRepository.submitCheckInOut(
|
|
|
|
+ token,
|
|
|
|
+ item.appliedId.toString(),
|
|
|
|
+ byteData,
|
|
|
|
+ isCheckIn: isCheckIn,
|
|
|
|
+ cancelToken: cancelToken,
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ if (result.isSuccess) {
|
|
|
|
+ CheckSuccessEntity entity = result.data!;
|
|
|
|
+ if (isCheckIn) {
|
|
|
|
+ item.checkInImg = entity.checkImg;
|
|
|
|
+ item.checkInTime = entity.checkTime;
|
|
|
|
+ } else {
|
|
|
|
+ item.checkOutImg = entity.checkImg;
|
|
|
|
+ item.checkOutTime = entity.checkTime;
|
|
|
|
+ }
|
|
|
|
+ //更新状态
|
|
|
|
+ update();
|
|
|
|
+ } else {
|
|
|
|
+ errorMessage = result.errorMsg;
|
|
|
|
+ ToastEngine.show(errorMessage ?? "Network Load Error".tr);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
//执行搜索
|
|
//执行搜索
|
|
void doSearch() {
|
|
void doSearch() {
|
|
var keywordController = state.formData['keyword']!['controller'];
|
|
var keywordController = state.formData['keyword']!['controller'];
|
|
@@ -118,12 +151,24 @@ class SignInSignOutController extends GetxController with DioCancelableMixin {
|
|
|
|
|
|
/// 用户签到
|
|
/// 用户签到
|
|
void userSignIn(AttendanceList item) {
|
|
void userSignIn(AttendanceList item) {
|
|
- ToastEngine.show("用户签到");
|
|
|
|
|
|
+ DialogEngine.show(
|
|
|
|
+ widget: AttendanceSignInOut(
|
|
|
|
+ confirmAction: (byteData) {
|
|
|
|
+ requestCheckInCheckOut(true, item, byteData);
|
|
|
|
+ },
|
|
|
|
+ ),
|
|
|
|
+ );
|
|
}
|
|
}
|
|
|
|
|
|
/// 用户签出
|
|
/// 用户签出
|
|
void userSignOut(AttendanceList item) {
|
|
void userSignOut(AttendanceList item) {
|
|
- ToastEngine.show("用户签出");
|
|
|
|
|
|
+ DialogEngine.show(
|
|
|
|
+ widget: AttendanceSignInOut(
|
|
|
|
+ confirmAction: (byteData) {
|
|
|
|
+ requestCheckInCheckOut(false, item, byteData);
|
|
|
|
+ },
|
|
|
|
+ ),
|
|
|
|
+ );
|
|
}
|
|
}
|
|
|
|
|
|
/// 重置筛选条件
|
|
/// 重置筛选条件
|