对接考勤相关接口

规程管理添加文件查看功能
hmxc
张萌 4 years ago
parent ecd0f7085f
commit 59581ad737

@ -9,6 +9,7 @@ class API {
static String get resource => '$host/static'; static String get resource => '$host/static';
static String image(String path) => '$resource$path'; static String image(String path) => '$resource$path';
static String file(String path) => '$resource$path';
static const int networkTimeOut = 10000; static const int networkTimeOut = 10000;
static _Auth auth = _Auth(); static _Auth auth = _Auth();
@ -230,6 +231,21 @@ class _Manage {
///app ///app
String get submitFacilitiesCheckInfo => '/user/facilitiesCheck/submitCheck'; String get submitFacilitiesCheckInfo => '/user/facilitiesCheck/submitCheck';
///app
String get todayClockRecord => '/user/attendance/todayClockRecord';
///app
String get clockInOut => '/user/attendance/clock';
///app
String get clockRecord => '/user/attendance/clockRecord';
///app /
String get clockApplyRecord => '/user/attendance/applyRecord';
///app /
String get clockApply => '/user/attendance/apply';
} }
class _Upload { class _Upload {

@ -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);
}

@ -4,14 +4,24 @@ class RulesManageListModel {
int id; int id;
String title; String title;
String content; String content;
String fileDocUrl;
String fileDocName;
String releaseDate; String releaseDate;
RulesManageListModel({this.id, this.title, this.content, this.releaseDate}); RulesManageListModel(
{this.id,
this.title,
this.content,
this.fileDocUrl,
this.fileDocName,
this.releaseDate});
RulesManageListModel.fromJson(Map<String, dynamic> json) { RulesManageListModel.fromJson(Map<String, dynamic> json) {
id = json['id']; id = json['id'];
title = json['title']; title = json['title'];
content = json['content']; content = json['content'];
fileDocUrl = json['fileDocUrl'];
fileDocName = json['fileDocName'];
releaseDate = json['releaseDate']; releaseDate = json['releaseDate'];
} }
@ -20,6 +30,8 @@ class RulesManageListModel {
data['id'] = this.id; data['id'] = this.id;
data['title'] = this.title; data['title'] = this.title;
data['content'] = this.content; data['content'] = this.content;
data['fileDocUrl'] = this.fileDocUrl;
data['fileDocName'] = this.fileDocName;
data['releaseDate'] = this.releaseDate; data['releaseDate'] = this.releaseDate;
return data; return data;
} }

@ -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;
}
}

@ -1,3 +1,4 @@
import 'package:aku_community_manager/models/manager/clock_in_out/clock_apply_record_list_model.dart';
import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/tools/aku_divider.dart'; import 'package:aku_community_manager/tools/aku_divider.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -6,7 +7,8 @@ import 'package:velocity_x/velocity_x.dart';
import 'package:aku_community_manager/tools/extensions/list_extension_tool.dart'; import 'package:aku_community_manager/tools/extensions/list_extension_tool.dart';
class ClockInOutApplyCard extends StatefulWidget { class ClockInOutApplyCard extends StatefulWidget {
ClockInOutApplyCard({Key key}) : super(key: key); final ClockApplyRecordListModel model;
ClockInOutApplyCard({Key key, this.model}) : super(key: key);
@override @override
_ClockInOutApplyCardState createState() => _ClockInOutApplyCardState(); _ClockInOutApplyCardState createState() => _ClockInOutApplyCardState();
@ -25,9 +27,17 @@ class _ClockInOutApplyCardState extends State<ClockInOutApplyCard> {
children: [ children: [
Row( Row(
children: [ children: [
'Name'.text.size(32.sp).color(kTextPrimaryColor).bold.make(), widget.model.typeString.text
.size(32.sp)
.color(kTextPrimaryColor)
.bold
.make(),
Spacer(), Spacer(),
'待审核'.text.size(28.sp).bold.color(kPrimaryColor).make() widget.model.statusString.text
.size(28.sp)
.bold
.color(widget.model.statusColor)
.make()
], ],
), ),
16.w.heightBox, 16.w.heightBox,
@ -35,18 +45,16 @@ class _ClockInOutApplyCardState extends State<ClockInOutApplyCard> {
24.w.heightBox, 24.w.heightBox,
...<Widget>[ ...<Widget>[
_rowTile( _rowTile(
R.ASSETS_MANAGE_IC_RENWU_PNG, R.ASSETS_MANAGE_IC_TIME_PNG,
'开始时间', '开始时间',
'2021-05-19 10:00:00' widget.model.startTimeString.text
.text
.size(24.sp) .size(24.sp)
.color(kTextSubColor) .color(kTextSubColor)
.make()), .make()),
_rowTile( _rowTile(
R.ASSETS_MANAGE_LOCK_PNG, R.ASSETS_MANAGE_IC_TIME_PNG,
'结束时间', '结束时间',
'2021-05-19 10:00:00' widget.model.endTimeString.text
.text
.size(24.sp) .size(24.sp)
.color(kTextSubColor) .color(kTextSubColor)
.make()), .make()),
@ -67,23 +75,22 @@ class _ClockInOutApplyCardState extends State<ClockInOutApplyCard> {
160.w.widthBox, 160.w.widthBox,
Row( Row(
children: [ children: [
'弟弟结婚,需要回趟家帮忙张罗婚礼的筹备' widget.model.reason.text
.text
.size(24.sp) .size(24.sp)
.maxLines(2) .maxLines(2)
.overflow(TextOverflow.ellipsis) .overflow(TextOverflow.ellipsis)
.align(TextAlign.end) .align(TextAlign.end)
.color(kTextSubColor) .color(kTextSubColor)
.make().expand() .make()
.expand()
], ],
).expand() ).expand()
], ],
), ),
_rowTile( _rowTile(
R.ASSETS_MANAGE_LOCK_PNG, R.ASSETS_MANAGE_IC_TIME_PNG,
'申请时间', '申请时间',
'2021-05-19 10:00:00' widget.model.applyTimeString.text
.text
.size(24.sp) .size(24.sp)
.color(kTextSubColor) .color(kTextSubColor)
.make()), .make()),

@ -1,8 +1,10 @@
import 'dart:async'; import 'dart:async';
import 'package:aku_community_manager/models/manager/clock_in_out/today_clock_record_model.dart';
import 'package:aku_community_manager/provider/app_provider.dart'; import 'package:aku_community_manager/provider/app_provider.dart';
import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/tools/user_tool.dart'; import 'package:aku_community_manager/tools/user_tool.dart';
import 'package:aku_community_manager/ui/manage_pages/clock_in_out/clock_func.dart';
import 'package:aku_community_manager/utils/weekdays_to_chinese.dart'; import 'package:aku_community_manager/utils/weekdays_to_chinese.dart';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
import 'package:common_utils/common_utils.dart'; import 'package:common_utils/common_utils.dart';
@ -19,10 +21,11 @@ class ClockInOutMainPage extends StatefulWidget {
_ClockInOutMainPageState createState() => _ClockInOutMainPageState(); _ClockInOutMainPageState createState() => _ClockInOutMainPageState();
} }
class _ClockInOutMainPageState extends State<ClockInOutMainPage> { class _ClockInOutMainPageState extends State<ClockInOutMainPage> with AutomaticKeepAliveClientMixin {
EasyRefreshController _refreshController; EasyRefreshController _refreshController;
Timer _clockSetState; Timer _clockSetState;
DateTime _lastPressed; DateTime _lastPressed;
TodayClockRecordModel _model;
bool get canTap { bool get canTap {
if (_lastPressed == null || if (_lastPressed == null ||
DateTime.now().difference(_lastPressed) > Duration(seconds: 15)) { DateTime.now().difference(_lastPressed) > Duration(seconds: 15)) {
@ -42,7 +45,6 @@ class _ClockInOutMainPageState extends State<ClockInOutMainPage> {
_clockSetState = Timer.periodic(Duration(seconds: 1), (_timer) { _clockSetState = Timer.periodic(Duration(seconds: 1), (_timer) {
setState(() {}); setState(() {});
}); });
UserTool.appProvider.initClock();
} }
@override @override
@ -59,7 +61,24 @@ class _ClockInOutMainPageState extends State<ClockInOutMainPage> {
firstRefresh: true, firstRefresh: true,
header: MaterialHeader(), header: MaterialHeader(),
controller: _refreshController, controller: _refreshController,
onRefresh: () async {}, onRefresh: () async {
UserTool.appProvider.initClock();
_model = await ClockFunc.initClockInfo();
if (_model != null) {
UserTool.appProvider.resetClock(); //
if (_model.startClockDate != null) {
//
UserTool.appProvider.setClockInTime(_model.clockInTime);
}
if (_model.endClockDate != null) {
//
UserTool.appProvider.setClockOutTime(_model.clockOutTime);
}
}
setState(() {});
},
child: Container( child: Container(
margin: EdgeInsets.all(32.w), margin: EdgeInsets.all(32.w),
padding: EdgeInsets.all(32.w), padding: EdgeInsets.all(32.w),
@ -96,14 +115,18 @@ class _ClockInOutMainPageState extends State<ClockInOutMainPage> {
); );
} }
/// WORKCLOCK
clockInOut() { clockInOut() {
DateTime _currentTime = DateTime.now();
switch (UserTool.appProvider.clockStatus) { switch (UserTool.appProvider.clockStatus) {
case WORKCLOCK.NOTIN: case WORKCLOCK.NOTIN:
UserTool.appProvider.setClockInTime(DateTime.now()); ClockFunc.clockIn(_model.id, _currentTime);
UserTool.appProvider.setClockInTime(_currentTime);
BotToast.showText(text: '上班打卡成功'); BotToast.showText(text: '上班打卡成功');
break; break;
case WORKCLOCK.IN: case WORKCLOCK.IN:
UserTool.appProvider.setClockOutTime(DateTime.now()); ClockFunc.clockOut(_model.id, _currentTime);
UserTool.appProvider.setClockOutTime(_currentTime);
BotToast.showText(text: '下班打卡成功'); BotToast.showText(text: '下班打卡成功');
break; break;
case WORKCLOCK.OUT: case WORKCLOCK.OUT:
@ -227,4 +250,7 @@ class _ClockInOutMainPageState extends State<ClockInOutMainPage> {
} }
return '$_hour小时$_min分钟'; return '$_hour小时$_min分钟';
} }
@override
bool get wantKeepAlive => true;
} }

@ -1,11 +1,12 @@
import 'package:aku_community_manager/models/manager/clock_in_out/clock_record_list_model.dart';
import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/style/app_style.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
class ClockInOutRecordCard extends StatefulWidget { class ClockInOutRecordCard extends StatefulWidget {
ClockInOutRecordCard({Key key}) : super(key: key); final ClockRecordListModel model;
ClockInOutRecordCard({Key key, this.model}) : super(key: key);
@override @override
_ClockInOutRecordCardState createState() => _ClockInOutRecordCardState(); _ClockInOutRecordCardState createState() => _ClockInOutRecordCardState();
@ -24,15 +25,18 @@ class _ClockInOutRecordCardState extends State<ClockInOutRecordCard> {
children: [ children: [
Row( Row(
children: [ children: [
'2021.05.19' widget.model.clockDateString.text
.text
.size(28.sp) .size(28.sp)
.bold .bold
.color(kTextPrimaryColor) .color(kTextPrimaryColor)
.bold .bold
.make(), .make(),
Spacer(), Spacer(),
'周三'.text.size(32.sp).bold.color(kTextPrimaryColor).make(), widget.model.weekDay.text
.size(32.sp)
.bold
.color(kTextPrimaryColor)
.make(),
], ],
), ),
40.w.heightBox, 40.w.heightBox,
@ -48,12 +52,14 @@ class _ClockInOutRecordCardState extends State<ClockInOutRecordCard> {
width: 16.w, width: 16.w,
height: 16.w, height: 16.w,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xFF3F8FFE), color: widget.model.startClockDate == null
? Color(0xFFE60E0E)
: Color(0xFF3F8FFE),
borderRadius: BorderRadius.circular(8.w), borderRadius: BorderRadius.circular(8.w),
), ),
), ),
8.w.widthBox, 8.w.widthBox,
'上班打卡时间' (widget.model.startClockDate == null ? '上班未打卡' : '上班打卡时间')
.text .text
.size(28.sp) .size(28.sp)
.color(kTextPrimaryColor) .color(kTextPrimaryColor)
@ -61,12 +67,14 @@ class _ClockInOutRecordCardState extends State<ClockInOutRecordCard> {
.make(), .make(),
], ],
), ),
...widget.model.startClockDate == null
? []
: [
16.w.heightBox, 16.w.heightBox,
Row( Row(
children: [ children: [
24.w.widthBox, 24.w.widthBox,
(DateUtil.formatDateStr('2020-10-11 08:24:30', (widget.model.startClockString)
format: 'HH:mm:ss'))
.text .text
.size(32.sp) .size(32.sp)
.color(kTextPrimaryColor) .color(kTextPrimaryColor)
@ -74,6 +82,7 @@ class _ClockInOutRecordCardState extends State<ClockInOutRecordCard> {
.make(), .make(),
], ],
), ),
]
], ],
), ),
130.w.widthBox, 130.w.widthBox,
@ -86,12 +95,14 @@ class _ClockInOutRecordCardState extends State<ClockInOutRecordCard> {
width: 16.w, width: 16.w,
height: 16.w, height: 16.w,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xFF3F8FFE), color: widget.model.startClockDate == null
? Color(0xFFE60E0E)
: Color(0xFF3F8FFE),
borderRadius: BorderRadius.circular(8.w), borderRadius: BorderRadius.circular(8.w),
), ),
), ),
8.w.widthBox, 8.w.widthBox,
'下班打卡时间' (widget.model.startClockDate == null ? '下班未打卡' : '下班打卡时间')
.text .text
.size(28.sp) .size(28.sp)
.color(kTextPrimaryColor) .color(kTextPrimaryColor)
@ -99,18 +110,21 @@ class _ClockInOutRecordCardState extends State<ClockInOutRecordCard> {
.make(), .make(),
], ],
), ),
...widget.model.startClockDate == null
? []
: [
16.w.heightBox, 16.w.heightBox,
Row( Row(
children: [ children: [
24.w.widthBox, 24.w.widthBox,
DateUtil.formatDateStr('08:24:09', format: 'HH:mm:ss') widget.model.endClockString.text
.text
.size(32.sp) .size(32.sp)
.color(kTextPrimaryColor) .color(kTextPrimaryColor)
.bold .bold
.make(), .make(),
], ],
), ),
]
], ],
), ),
], ],

@ -1,7 +1,13 @@
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/manager/clock_in_out/clock_apply_record_list_model.dart';
import 'package:aku_community_manager/models/manager/clock_in_out/clock_record_list_model.dart';
import 'package:aku_community_manager/ui/manage_pages/clock_in_out/clock_in_out_apply_card.dart'; import 'package:aku_community_manager/ui/manage_pages/clock_in_out/clock_in_out_apply_card.dart';
import 'package:aku_community_manager/ui/manage_pages/clock_in_out/clock_in_out_record_card.dart'; import 'package:aku_community_manager/ui/manage_pages/clock_in_out/clock_in_out_record_card.dart';
import 'package:aku_community_manager/ui/widgets/common/bee_list_view.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart';
class ClockInOutView extends StatefulWidget { class ClockInOutView extends StatefulWidget {
final int index; final int index;
@ -12,20 +18,71 @@ class ClockInOutView extends StatefulWidget {
} }
class _ClockInOutViewState extends State<ClockInOutView> { class _ClockInOutViewState extends State<ClockInOutView> {
EasyRefreshController _refreshController;
@override
void initState() {
super.initState();
_refreshController = EasyRefreshController();
}
@override
void dispose() {
_refreshController?.dispose();
super.dispose();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return widget.index == 1 return _getView();
? ListView( }
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
children: [ _getView() {
ClockInOutRecordCard(), switch (widget.index) {
], case 1:
) return BeeListView(
: ListView( path: API.manage.clockRecord,
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), controller: _refreshController,
children: [ convert: (models) {
ClockInOutApplyCard(), return models.tableList
], .map((e) => ClockRecordListModel.fromJson(e))
.toList();
},
builder: (items) {
return ListView.separated(
padding: EdgeInsets.all(32.w),
itemBuilder: (context, index) {
return ClockInOutRecordCard(
model: items[index],
); );
},
separatorBuilder: (_, __) {
return 24.w.heightBox;
},
itemCount: items.length);
});
case 2:
return BeeListView(
path: API.manage.clockApplyRecord,
controller: _refreshController,
convert: (models) {
return models.tableList
.map((e) => ClockApplyRecordListModel.fromJson(e))
.toList();
},
builder: (items) {
return ListView.separated(
padding: EdgeInsets.all(32.w),
itemBuilder: (context, index) {
return ClockInOutApplyCard(
model: items[index],
);
},
separatorBuilder: (_, __) {
return 24.w.heightBox;
},
itemCount: items.length);
});
default:
}
} }
} }

@ -1,5 +1,6 @@
import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/tools/aku_divider.dart'; import 'package:aku_community_manager/tools/aku_divider.dart';
import 'package:aku_community_manager/ui/manage_pages/clock_in_out/clock_func.dart';
import 'package:aku_community_manager/ui/widgets/app_widgets/aku_single_check_button.dart'; import 'package:aku_community_manager/ui/widgets/app_widgets/aku_single_check_button.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_community_manager/ui/widgets/common/bee_date_picker.dart'; import 'package:aku_community_manager/ui/widgets/common/bee_date_picker.dart';
@ -9,6 +10,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
class WorkApplyPage extends StatefulWidget { class WorkApplyPage extends StatefulWidget {
@ -21,25 +23,25 @@ class WorkApplyPage extends StatefulWidget {
class _WorkApplyPageState extends State<WorkApplyPage> { class _WorkApplyPageState extends State<WorkApplyPage> {
int _type = 1; //1 2 int _type = 1; //1 2
TextEditingController _nameController; // TextEditingController _nameController;
TextEditingController _positionController; // TextEditingController _positionController;
TextEditingController _phoneController; TextEditingController _reasonController;
DateTime _beginTime; DateTime _beginTime;
DateTime _endTime; DateTime _endTime;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_nameController = TextEditingController(); // _nameController = TextEditingController();
_positionController = TextEditingController(); // _positionController = TextEditingController();
_phoneController = TextEditingController(); _reasonController = TextEditingController();
} }
@override @override
void dispose() { void dispose() {
_nameController?.dispose(); // _nameController?.dispose();
_positionController?.dispose(); // _positionController?.dispose();
_phoneController?.dispose(); _reasonController?.dispose();
super.dispose(); super.dispose();
} }
@ -52,15 +54,19 @@ class _WorkApplyPageState extends State<WorkApplyPage> {
padding: EdgeInsets.all(32.w), padding: EdgeInsets.all(32.w),
children: [ children: [
_headType(), _headType(),
_inputRowTile('姓名', _nameController), _inputRowTile('理由', _reasonController),
_inputRowTile('职位', _positionController),
_inputRowTile('联系方式', _phoneController),
_timePick(), _timePick(),
], ],
), ),
bottom: AkuBottomButton( bottom: AkuBottomButton(
title: '确认提交', title: '确认提交',
onTap: () {}, onTap: () async {
bool _result = await ClockFunc.clockApply(
_reasonController.text, _type, _beginTime, _endTime);
if (_result) {
Get.back();
}
},
), ),
); );
} }
@ -151,7 +157,7 @@ class _WorkApplyPageState extends State<WorkApplyPage> {
: _beginTime, : _beginTime,
max: _beginTime == null max: _beginTime == null
? DateTime.now().add(Duration(days: 1)) ? DateTime.now().add(Duration(days: 1))
: (_beginTime).add(Duration(days: 1)), : (_beginTime).add(Duration(days: 7)),
mode: CupertinoDatePickerMode.dateAndTime, mode: CupertinoDatePickerMode.dateAndTime,
); );
if (date != null) { if (date != null) {

@ -1,10 +1,15 @@
import 'package:aku_community_manager/models/manager/rules_manage/rules_manage_list_model.dart'; import 'package:aku_community_manager/models/manager/rules_manage/rules_manage_list_model.dart';
import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_community_manager/ui/widgets/common/bee_download_view.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:common_utils/common_utils.dart'; import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:open_file/open_file.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
import 'package:aku_community_manager/const/resource.dart';
class RulesManageDetailPage extends StatefulWidget { class RulesManageDetailPage extends StatefulWidget {
final RulesManageListModel model; final RulesManageListModel model;
@ -21,7 +26,8 @@ class _RulesManageDetailPageState extends State<RulesManageDetailPage> {
return AkuScaffold( return AkuScaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
title: '规程管理', title: '规程管理',
body: ListView( body: Stack(
children:[ ListView(
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
children: [ children: [
_detailModel.title.text _detailModel.title.text
@ -70,9 +76,56 @@ class _RulesManageDetailPageState extends State<RulesManageDetailPage> {
.color(kTextSubColor) .color(kTextSubColor)
.make(), .make(),
], ],
) ),
// docView(
// widget.model?.fileDocName ?? '', widget.model?.fileDocUrl ?? '')
], ],
), ),
Positioned(
bottom: MediaQuery.of(context).padding.bottom+88.w,
left: 32.w,
right: 32.w,
child: docView(
widget.model?.fileDocName ?? '', widget.model?.fileDocUrl ?? '') ),
]
),
);
}
Widget docView(String title, String path) {
// if (title?.isEmpty ?? true) return SizedBox();
return Container(
// margin: EdgeInsets.only(right: 113.w),
alignment: Alignment.centerLeft,
child: MaterialButton(
minWidth: 606.w,
height: 154.w,
padding: EdgeInsets.symmetric(horizontal: 32.w),
child: Row(
children: [
title.text.size(32.sp).make().expand(),
Image.asset(
R.ASSETS_MANAGE_IC_RENWU_PNG,
height: 52.w,
width: 52.w,
),
],
),
onPressed: path.isEmptyOrNull
? () {
BotToast.showText(text: '文件为空!');
}
: () async {
String result = await Get.dialog(BeeDownloadView(file: path));
if (result != null) OpenFile.open(result);
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.w),
side: BorderSide(color: Color(0xFFD4CFBE)),
),
color: Colors.white,
),
); );
} }
} }

@ -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,
),
),
);
}
}

@ -19,4 +19,25 @@ class WeekDaysToChinese {
return '未知'; return '未知';
} }
} }
static String fromInt(int weekday) {
switch (weekday) {
case 1:
return '周一';
case 2:
return '周二';
case 3:
return '周三';
case 4:
return '周四';
case 5:
return '周五';
case 6:
return '周六';
case 7:
return '周日';
default:
return '未知';
}
}
} }

@ -655,6 +655,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.0" version: "1.0.0"
open_file:
dependency: "direct main"
description:
name: open_file
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.2.1"
package_config: package_config:
dependency: transitive dependency: transitive
description: description:

@ -71,6 +71,8 @@ dependencies:
shimmer: ^2.0.0-nullsafety.0 shimmer: ^2.0.0-nullsafety.0
badges: ^2.0.0-nullsafety.1 badges: ^2.0.0-nullsafety.1
equatable: ^2.0.0 equatable: ^2.0.0
#打开文件
open_file: ^3.2.1
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

Loading…
Cancel
Save