parent
ecd0f7085f
commit
59581ad737
@ -0,0 +1,104 @@
|
||||
import 'package:aku_community_manager/style/app_style.dart';
|
||||
import 'package:common_utils/common_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ClockApplyRecordListModel {
|
||||
int id;
|
||||
String reason;
|
||||
int status;
|
||||
int type;
|
||||
String startDate;
|
||||
String endDate;
|
||||
String createName;
|
||||
String createTel;
|
||||
String createDate;
|
||||
String reviewerName;
|
||||
String reviewerDate;
|
||||
|
||||
ClockApplyRecordListModel(
|
||||
{this.id,
|
||||
this.reason,
|
||||
this.status,
|
||||
this.type,
|
||||
this.startDate,
|
||||
this.endDate,
|
||||
this.createName,
|
||||
this.createTel,
|
||||
this.createDate,
|
||||
this.reviewerName,
|
||||
this.reviewerDate});
|
||||
|
||||
ClockApplyRecordListModel.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
reason = json['reason'];
|
||||
status = json['status'];
|
||||
type = json['type'];
|
||||
startDate = json['startDate'];
|
||||
endDate = json['endDate'];
|
||||
createName = json['createName'];
|
||||
createTel = json['createTel'];
|
||||
createDate = json['createDate'];
|
||||
reviewerName = json['reviewerName'];
|
||||
reviewerDate = json['reviewerDate'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['reason'] = this.reason;
|
||||
data['status'] = this.status;
|
||||
data['type'] = this.type;
|
||||
data['startDate'] = this.startDate;
|
||||
data['endDate'] = this.endDate;
|
||||
data['createName'] = this.createName;
|
||||
data['createTel'] = this.createTel;
|
||||
data['createDate'] = this.createDate;
|
||||
data['reviewerName'] = this.reviewerName;
|
||||
data['reviewerDate'] = this.reviewerDate;
|
||||
return data;
|
||||
}
|
||||
|
||||
String get typeString {
|
||||
switch (this.type) {
|
||||
case 1:
|
||||
return '请假';
|
||||
case 2:
|
||||
return '加班';
|
||||
default:
|
||||
return '未知';
|
||||
}
|
||||
}
|
||||
|
||||
String get statusString {
|
||||
switch (this.status) {
|
||||
case 1:
|
||||
return '待审核';
|
||||
case 2:
|
||||
return '审核通过';
|
||||
case 3:
|
||||
return '审核驳回';
|
||||
default:
|
||||
return '未知';
|
||||
}
|
||||
}
|
||||
|
||||
Color get statusColor {
|
||||
switch (this.status) {
|
||||
case 1:
|
||||
return kPrimaryColor;
|
||||
case 2:
|
||||
return Colors.green;
|
||||
case 3:
|
||||
return Colors.red;
|
||||
default:
|
||||
return Colors.black;
|
||||
}
|
||||
}
|
||||
|
||||
String get startTimeString =>
|
||||
DateUtil.formatDateStr(this.startDate, format: 'yyyy-MM-dd HH:mm');
|
||||
String get endTimeString =>
|
||||
DateUtil.formatDateStr(this.endDate, format: 'yyyy-MM-dd HH:mm');
|
||||
String get applyTimeString =>
|
||||
DateUtil.formatDateStr(this.createDate, format: 'yyyy-MM-dd HH:mm:ss');
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
import 'package:aku_community_manager/utils/weekdays_to_chinese.dart';
|
||||
import 'package:common_utils/common_utils.dart';
|
||||
|
||||
class ClockRecordListModel {
|
||||
int id;
|
||||
String startClockDate;
|
||||
String endClockDate;
|
||||
String cardReplacementDate;
|
||||
String operatorName;
|
||||
String clockName;
|
||||
String clockTel;
|
||||
String createDate;
|
||||
|
||||
ClockRecordListModel(
|
||||
{this.id,
|
||||
this.startClockDate,
|
||||
this.endClockDate,
|
||||
this.cardReplacementDate,
|
||||
this.operatorName,
|
||||
this.clockName,
|
||||
this.clockTel,
|
||||
this.createDate});
|
||||
|
||||
ClockRecordListModel.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
startClockDate = json['startClockDate'];
|
||||
endClockDate = json['endClockDate'];
|
||||
cardReplacementDate = json['cardReplacementDate'];
|
||||
operatorName = json['operatorName'];
|
||||
clockName = json['clockName'];
|
||||
clockTel = json['clockTel'];
|
||||
createDate = json['createDate'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['startClockDate'] = this.startClockDate;
|
||||
data['endClockDate'] = this.endClockDate;
|
||||
data['cardReplacementDate'] = this.cardReplacementDate;
|
||||
data['operatorName'] = this.operatorName;
|
||||
data['clockName'] = this.clockName;
|
||||
data['clockTel'] = this.clockTel;
|
||||
data['createDate'] = this.createDate;
|
||||
return data;
|
||||
}
|
||||
|
||||
String get startClockString =>
|
||||
DateUtil.formatDateStr(this.startClockDate, format: 'HH:mm:ss');
|
||||
|
||||
String get endClockString =>
|
||||
DateUtil.formatDateStr(this.endClockDate, format: 'HH:mm:ss');
|
||||
|
||||
String get clockDateString =>
|
||||
DateUtil.formatDateStr(this.startClockDate, format: 'yyyy.MM.dd');
|
||||
String get weekDay => WeekDaysToChinese.fromInt(
|
||||
DateUtil.getDateTime(this.startClockDate).weekday);
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
import 'package:common_utils/common_utils.dart';
|
||||
|
||||
class TodayClockRecordModel {
|
||||
int id;
|
||||
String startClockDate;
|
||||
String endClockDate;
|
||||
String cardReplacementDate;
|
||||
String operatorName;
|
||||
String clockName;
|
||||
String clockTel;
|
||||
String createDate;
|
||||
|
||||
TodayClockRecordModel(
|
||||
{this.id,
|
||||
this.startClockDate,
|
||||
this.endClockDate,
|
||||
this.cardReplacementDate,
|
||||
this.operatorName,
|
||||
this.clockName,
|
||||
this.clockTel,
|
||||
this.createDate});
|
||||
|
||||
TodayClockRecordModel.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
startClockDate = json['startClockDate'];
|
||||
endClockDate = json['endClockDate'];
|
||||
cardReplacementDate = json['cardReplacementDate'];
|
||||
operatorName = json['operatorName'];
|
||||
clockName = json['clockName'];
|
||||
clockTel = json['clockTel'];
|
||||
createDate = json['createDate'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['startClockDate'] = this.startClockDate;
|
||||
data['endClockDate'] = this.endClockDate;
|
||||
data['cardReplacementDate'] = this.cardReplacementDate;
|
||||
data['operatorName'] = this.operatorName;
|
||||
data['clockName'] = this.clockName;
|
||||
data['clockTel'] = this.clockTel;
|
||||
data['createDate'] = this.createDate;
|
||||
return data;
|
||||
}
|
||||
|
||||
DateTime get clockInTime => DateUtil.getDateTime(this.startClockDate);
|
||||
DateTime get clockOutTime => DateUtil.getDateTime(this.endClockDate);
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
import 'package:aku_community_manager/const/api.dart';
|
||||
import 'package:aku_community_manager/models/manager/clock_in_out/today_clock_record_model.dart';
|
||||
import 'package:aku_community_manager/utils/network/base_model.dart';
|
||||
import 'package:aku_community_manager/utils/network/net_util.dart';
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:common_utils/common_utils.dart';
|
||||
|
||||
class ClockFunc {
|
||||
static Future initClockInfo() async {
|
||||
BaseModel baseModel = await NetUtil().get(API.manage.todayClockRecord);
|
||||
if (baseModel.status && baseModel.data != null) {
|
||||
return TodayClockRecordModel.fromJson(baseModel.data);
|
||||
} else {
|
||||
BotToast.showText(text: baseModel.message);
|
||||
}
|
||||
}
|
||||
|
||||
static Future clockIn(int id, DateTime dateTime) async {
|
||||
BaseModel baseModel = await NetUtil().post(
|
||||
API.manage.clockInOut,
|
||||
params: {
|
||||
"id": id,
|
||||
"startClockDate":
|
||||
DateUtil.formatDate(dateTime, format: 'yyyy-MM-dd HH:mm:ss'),
|
||||
},
|
||||
showMessage: true,
|
||||
);
|
||||
}
|
||||
|
||||
static Future clockOut(int id, DateTime dateTime) async {
|
||||
BaseModel baseModel = await NetUtil().post(API.manage.clockInOut,
|
||||
params: {
|
||||
"id": id,
|
||||
"endClockDate":
|
||||
DateUtil.formatDate(dateTime, format: 'yyyy-MM-dd HH:mm:ss'),
|
||||
},
|
||||
showMessage: true);
|
||||
}
|
||||
|
||||
static Future clockApply(
|
||||
String reason, int type, DateTime start, DateTime end) async {
|
||||
BaseModel baseModel = await NetUtil().post(API.manage.clockApply,
|
||||
params: {
|
||||
"reason": reason,
|
||||
'type': type,
|
||||
"startDate":
|
||||
DateUtil.formatDate(start, format: 'yyyy-MM-dd HH:mm:ss'),
|
||||
"endDate": DateUtil.formatDate(end, format: 'yyyy-MM-dd HH:mm:ss')
|
||||
},
|
||||
showMessage: true);
|
||||
return baseModel.status;
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:aku_community_manager/const/api.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
||||
|
||||
class BeeDownloadView extends StatefulWidget {
|
||||
final String file;
|
||||
BeeDownloadView({Key key, this.file}) : super(key: key);
|
||||
|
||||
@override
|
||||
_BeeDownloadViewState createState() => _BeeDownloadViewState();
|
||||
}
|
||||
|
||||
class _BeeDownloadViewState extends State<BeeDownloadView> {
|
||||
Dio dio = Dio();
|
||||
double progress;
|
||||
Future download() async {
|
||||
Directory dir = await getApplicationDocumentsDirectory();
|
||||
Directory docPath = Directory('${dir.path}/docs');
|
||||
if (!await (docPath.exists())) {
|
||||
await docPath.create();
|
||||
}
|
||||
await Future.delayed(Duration(milliseconds: 500));
|
||||
await dio.download(
|
||||
API.file(widget.file),
|
||||
'${docPath.path}/${widget.file.split('/').last}',
|
||||
onReceiveProgress: (start, all) {
|
||||
setState(() {
|
||||
progress = start / all;
|
||||
});
|
||||
print('$start,$all');
|
||||
},
|
||||
);
|
||||
Get.back(result: '${docPath.path}/${widget.file.split('/').last}');
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
download();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: Container(
|
||||
width: 100,
|
||||
height: 100,
|
||||
alignment: Alignment.center,
|
||||
child: CircularProgressIndicator(value: progress),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue