|
@@ -18,16 +18,17 @@ import 'package:widgets/picker/date_picker_util.dart';
|
|
|
import 'package:widgets/picker/option_pick_util.dart';
|
|
|
import 'package:widgets/widget_export.dart';
|
|
|
|
|
|
-/**
|
|
|
- * 用工请求列表的筛选
|
|
|
+/*
|
|
|
+ * 工作列表筛选
|
|
|
*/
|
|
|
class JobListFilter extends StatefulWidget {
|
|
|
- void Function(DateTime? selectedStartDate, DateTime? selectedEndDate, String? selectedStatusId, String? selectedOutletId)? onFilterAction;
|
|
|
+ void Function(DateTime? selectedStartDate, DateTime? selectedEndDate, String? selectedStatusId, String? selectedOutletId, String? agencyId)? onFilterAction;
|
|
|
JobListIndexSGEntity optionResult;
|
|
|
DateTime? selectedStartDate;
|
|
|
DateTime? selectedEndDate;
|
|
|
String? selectedStatusId;
|
|
|
String? selectedOutletId;
|
|
|
+ String? selectedAgencyId;
|
|
|
|
|
|
JobListFilter({
|
|
|
required this.optionResult,
|
|
@@ -35,6 +36,7 @@ class JobListFilter extends StatefulWidget {
|
|
|
required this.selectedEndDate,
|
|
|
required this.selectedStatusId,
|
|
|
required this.selectedOutletId,
|
|
|
+ required this.selectedAgencyId,
|
|
|
this.onFilterAction,
|
|
|
});
|
|
|
|
|
@@ -47,6 +49,7 @@ class _JobListFilterState extends State<JobListFilter> {
|
|
|
DateTime? selectedEndDate;
|
|
|
String? selectedStatusId;
|
|
|
String? selectedDepartmentId;
|
|
|
+ String? selectedAgencyId;
|
|
|
|
|
|
@override
|
|
|
void initState() {
|
|
@@ -55,6 +58,7 @@ class _JobListFilterState extends State<JobListFilter> {
|
|
|
this.selectedEndDate = widget.selectedEndDate;
|
|
|
this.selectedStatusId = widget.selectedStatusId;
|
|
|
this.selectedDepartmentId = widget.selectedOutletId;
|
|
|
+ this.selectedAgencyId = widget.selectedAgencyId;
|
|
|
}
|
|
|
|
|
|
@override
|
|
@@ -67,30 +71,69 @@ class _JobListFilterState extends State<JobListFilter> {
|
|
|
height: kToolbarHeight + ScreenUtil.getStatusBarH(context) + 1,
|
|
|
),
|
|
|
Container(
|
|
|
- padding: EdgeInsets.only(left: 15, right: 15, top: 17.5, bottom: 20),
|
|
|
+ padding: const EdgeInsets.only(left: 15, right: 15, top: 17.5, bottom: 20),
|
|
|
width: double.infinity,
|
|
|
- decoration: BoxDecoration(
|
|
|
+ decoration: const BoxDecoration(
|
|
|
color: Colors.white,
|
|
|
),
|
|
|
child: Column(
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
children: [
|
|
|
+ //Source选择
|
|
|
+ MyTextView(
|
|
|
+ "Source".tr,
|
|
|
+ fontSize: 14,
|
|
|
+ isFontMedium: true,
|
|
|
+ textColor: ColorConstants.black33,
|
|
|
+ ),
|
|
|
+
|
|
|
+ //选择Source
|
|
|
+ Container(
|
|
|
+ padding: const EdgeInsets.only(left: 16, right: 10),
|
|
|
+ margin: const EdgeInsets.only(top: 10),
|
|
|
+ height: 45,
|
|
|
+ decoration: const BoxDecoration(
|
|
|
+ color: ColorConstants.grayECECEC,
|
|
|
+ borderRadius: BorderRadius.all(Radius.circular(5)),
|
|
|
+ ),
|
|
|
+ child: Row(
|
|
|
+ mainAxisSize: MainAxisSize.max,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ mainAxisAlignment: MainAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ MyTextView(
|
|
|
+ selectedAgencyId == null
|
|
|
+ ? ""
|
|
|
+ : widget.optionResult.agencyList.firstWhere((element) => element.value.toString() == selectedAgencyId).txt!,
|
|
|
+ hint: "Choose Source".tr,
|
|
|
+ textHintColor: ColorConstants.textBlackHint,
|
|
|
+ fontSize: 14,
|
|
|
+ isFontMedium: true,
|
|
|
+ textColor: ColorConstants.black33,
|
|
|
+ ).expanded(),
|
|
|
+ const MyAssetImage(Assets.baseServiceTriangleDropDownIcon, width: 11.5, height: 6.28),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ).onTap(() {
|
|
|
+ pickerAgency();
|
|
|
+ }),
|
|
|
+
|
|
|
//部门
|
|
|
MyTextView(
|
|
|
"Outlet".tr,
|
|
|
fontSize: 14,
|
|
|
+ marginTop: 11,
|
|
|
isFontMedium: true,
|
|
|
textColor: ColorConstants.black33,
|
|
|
),
|
|
|
-
|
|
|
//选择部门
|
|
|
Container(
|
|
|
- padding: EdgeInsets.only(left: 16, right: 10),
|
|
|
- margin: EdgeInsets.only(top: 10),
|
|
|
+ padding: const EdgeInsets.only(left: 16, right: 10),
|
|
|
+ margin: const EdgeInsets.only(top: 10),
|
|
|
height: 45,
|
|
|
- decoration: BoxDecoration(
|
|
|
+ decoration: const BoxDecoration(
|
|
|
color: ColorConstants.grayECECEC,
|
|
|
- borderRadius: const BorderRadius.all(Radius.circular(5)),
|
|
|
+ borderRadius: BorderRadius.all(Radius.circular(5)),
|
|
|
),
|
|
|
child: Row(
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
@@ -107,7 +150,7 @@ class _JobListFilterState extends State<JobListFilter> {
|
|
|
isFontMedium: true,
|
|
|
textColor: ColorConstants.black33,
|
|
|
).expanded(),
|
|
|
- MyAssetImage(Assets.baseServiceTriangleDropDownIcon, width: 11.5, height: 6.28),
|
|
|
+ const MyAssetImage(Assets.baseServiceTriangleDropDownIcon, width: 11.5, height: 6.28),
|
|
|
],
|
|
|
),
|
|
|
).onTap(() {
|
|
@@ -125,12 +168,12 @@ class _JobListFilterState extends State<JobListFilter> {
|
|
|
|
|
|
//选择状态
|
|
|
Container(
|
|
|
- padding: EdgeInsets.only(left: 16, right: 10),
|
|
|
- margin: EdgeInsets.only(top: 10),
|
|
|
+ padding: const EdgeInsets.only(left: 16, right: 10),
|
|
|
+ margin: const EdgeInsets.only(top: 10),
|
|
|
height: 45,
|
|
|
- decoration: BoxDecoration(
|
|
|
+ decoration: const BoxDecoration(
|
|
|
color: ColorConstants.grayECECEC,
|
|
|
- borderRadius: const BorderRadius.all(Radius.circular(5)),
|
|
|
+ borderRadius: BorderRadius.all(Radius.circular(5)),
|
|
|
),
|
|
|
child: Row(
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
@@ -147,7 +190,7 @@ class _JobListFilterState extends State<JobListFilter> {
|
|
|
isFontMedium: true,
|
|
|
textColor: ColorConstants.black33,
|
|
|
).expanded(),
|
|
|
- MyAssetImage(Assets.baseServiceTriangleDropDownIcon, width: 11.5, height: 6.28),
|
|
|
+ const MyAssetImage(Assets.baseServiceTriangleDropDownIcon, width: 11.5, height: 6.28),
|
|
|
],
|
|
|
),
|
|
|
).onTap(() {
|
|
@@ -165,12 +208,12 @@ class _JobListFilterState extends State<JobListFilter> {
|
|
|
|
|
|
//选择时间
|
|
|
Container(
|
|
|
- padding: EdgeInsets.only(left: 16, right: 10),
|
|
|
- margin: EdgeInsets.only(top: 10),
|
|
|
+ padding: const EdgeInsets.only(left: 16, right: 10),
|
|
|
+ margin: const EdgeInsets.only(top: 10),
|
|
|
height: 45,
|
|
|
- decoration: BoxDecoration(
|
|
|
+ decoration: const BoxDecoration(
|
|
|
color: ColorConstants.grayECECEC,
|
|
|
- borderRadius: const BorderRadius.all(Radius.circular(5)),
|
|
|
+ borderRadius: BorderRadius.all(Radius.circular(5)),
|
|
|
),
|
|
|
child: Row(
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
@@ -185,7 +228,7 @@ class _JobListFilterState extends State<JobListFilter> {
|
|
|
isFontMedium: true,
|
|
|
textColor: ColorConstants.black33,
|
|
|
).expanded(),
|
|
|
- MyAssetImage(Assets.baseServiceTriangleDropDownIcon, width: 11.5, height: 6.28),
|
|
|
+ const MyAssetImage(Assets.baseServiceTriangleDropDownIcon, width: 11.5, height: 6.28),
|
|
|
],
|
|
|
),
|
|
|
).onTap(() {
|
|
@@ -203,12 +246,12 @@ class _JobListFilterState extends State<JobListFilter> {
|
|
|
|
|
|
//选择结束日期
|
|
|
Container(
|
|
|
- padding: EdgeInsets.only(left: 16, right: 10),
|
|
|
- margin: EdgeInsets.only(top: 10),
|
|
|
+ padding: const EdgeInsets.only(left: 16, right: 10),
|
|
|
+ margin: const EdgeInsets.only(top: 10),
|
|
|
height: 45,
|
|
|
- decoration: BoxDecoration(
|
|
|
+ decoration: const BoxDecoration(
|
|
|
color: ColorConstants.grayECECEC,
|
|
|
- borderRadius: const BorderRadius.all(Radius.circular(5)),
|
|
|
+ borderRadius: BorderRadius.all(Radius.circular(5)),
|
|
|
),
|
|
|
child: Row(
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
@@ -240,12 +283,14 @@ class _JobListFilterState extends State<JobListFilter> {
|
|
|
widget.selectedEndDate = null;
|
|
|
widget.selectedStatusId = null;
|
|
|
widget.selectedOutletId = null;
|
|
|
+ widget.selectedAgencyId = null;
|
|
|
|
|
|
setState(() {
|
|
|
selectedStartDate = null;
|
|
|
selectedEndDate = null;
|
|
|
selectedStatusId = null;
|
|
|
selectedDepartmentId = null;
|
|
|
+ selectedAgencyId = null;
|
|
|
});
|
|
|
},
|
|
|
text: "Reset".tr,
|
|
@@ -255,11 +300,11 @@ class _JobListFilterState extends State<JobListFilter> {
|
|
|
minWidth: 60,
|
|
|
minHeight: 36,
|
|
|
).expanded(),
|
|
|
- SizedBox(width: 15),
|
|
|
+ const SizedBox(width: 15),
|
|
|
MyButton(
|
|
|
onPressed: () {
|
|
|
onCancel();
|
|
|
- widget.onFilterAction?.call(selectedStartDate, selectedEndDate, selectedStatusId, selectedDepartmentId);
|
|
|
+ widget.onFilterAction?.call(selectedStartDate, selectedEndDate, selectedStatusId, selectedDepartmentId,selectedAgencyId);
|
|
|
},
|
|
|
text: "Filter".tr,
|
|
|
textColor: ColorConstants.white,
|
|
@@ -273,7 +318,7 @@ class _JobListFilterState extends State<JobListFilter> {
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
- Center(child: MyAssetImage(Assets.baseServiceDialogDeleteIcon, width: 26.5, height: 26.5).marginOnly(top: 35)).onTap(() {
|
|
|
+ Center(child: const MyAssetImage(Assets.baseServiceDialogDeleteIcon, width: 26.5, height: 26.5).marginOnly(top: 35)).onTap(() {
|
|
|
onCancel();
|
|
|
}),
|
|
|
],
|
|
@@ -311,6 +356,30 @@ class _JobListFilterState extends State<JobListFilter> {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ /// 赛选 Source
|
|
|
+ void pickerAgency() {
|
|
|
+ int selectedIndex;
|
|
|
+ if (selectedAgencyId == null) {
|
|
|
+ selectedIndex = 0;
|
|
|
+ } else {
|
|
|
+ selectedIndex = widget.optionResult.agencyList.indexWhere((department) => department.value.toString() == selectedAgencyId);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (selectedIndex < 0) {
|
|
|
+ selectedIndex = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ OptionPickerUtil.showCupertinoOptionPicker(
|
|
|
+ items: widget.optionResult.agencyList.map((e) => e.txt!).toList(growable: false),
|
|
|
+ initialSelectIndex: selectedIndex,
|
|
|
+ onPickerChanged: (_, index) {
|
|
|
+ setState(() {
|
|
|
+ selectedAgencyId = widget.optionResult.agencyList[index].value!.toString();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
/// 筛选部门
|
|
|
void pickerOutlet() {
|
|
|
int selectedDepartmentIndex;
|
|
@@ -358,4 +427,5 @@ class _JobListFilterState extends State<JobListFilter> {
|
|
|
},
|
|
|
);
|
|
|
}
|
|
|
+
|
|
|
}
|