job_applied_page.dart 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. import 'package:cs_resources/constants/color_constants.dart';
  2. import 'package:flutter/cupertino.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:get/get.dart';
  5. import 'package:widgets/ext/ex_widget.dart';
  6. import 'package:widgets/load_state_layout.dart';
  7. import 'package:widgets/my_button.dart';
  8. import 'package:widgets/my_text_view.dart';
  9. import 'package:widgets/search_app_bar.dart';
  10. import 'package:widgets/widget_export.dart';
  11. import 'applied_staff_item.dart';
  12. import 'job_applied_controller.dart';
  13. import 'package:plugin_basic/base/base_state.dart';
  14. import 'package:plugin_basic/base/base_stateful_page.dart';
  15. import 'package:plugin_basic/utils/ext_get_nav.dart';
  16. import 'package:router/path/router_path.dart';
  17. import 'package:shared/utils/screen_util.dart';
  18. import 'package:widgets/my_appbar.dart';
  19. import 'job_applied_state.dart';
  20. /**
  21. * 已申请的页面,可以签到签出、加人、修改状态、评论等操作
  22. */
  23. class JobAppliedPage extends BaseStatefulPage<JobAppliedController> {
  24. JobAppliedPage({Key? key}) : super(key: key);
  25. //启动当前页面
  26. static void startInstance(String? jobId) {
  27. return Get.start(RouterPath.jobAppliedStaffList, arguments: {'jobId': jobId});
  28. }
  29. @override
  30. JobAppliedController createRawController() {
  31. return JobAppliedController();
  32. }
  33. @override
  34. State<JobAppliedPage> createState() => _JobAppliedState();
  35. }
  36. class _JobAppliedState extends BaseState<JobAppliedPage, JobAppliedController> {
  37. late JobAppliedState state;
  38. @override
  39. void initState() {
  40. super.initState();
  41. state = controller.state;
  42. state.jobId = Get.arguments['jobId'];
  43. }
  44. @override
  45. Widget build(BuildContext context) {
  46. return autoCtlGetBuilder(builder: (controller) {
  47. return SafeArea(
  48. bottom: true,
  49. top: false,
  50. child: Container(
  51. width: double.infinity,
  52. height: double.infinity,
  53. padding: EdgeInsets.only(top: ScreenUtil.getStatusBarH(context)),
  54. decoration: const BoxDecoration(
  55. gradient: LinearGradient(
  56. colors: [
  57. Color(0xFF091D44),
  58. Color(0xFF245A8A),
  59. Color(0xFF7F7CEC),
  60. ],
  61. begin: Alignment.topCenter,
  62. end: Alignment.bottomCenter,
  63. ),
  64. ),
  65. child: Column(
  66. children: [
  67. MyAppBar.titleBar(
  68. context,
  69. state.jobInfo?.jobTitle ?? "Title".tr,
  70. subTitle: "(${state.jobInfo?.jobDate ?? "-"})",
  71. subTitleColor: ColorConstants.textGrayAECAE5,
  72. ),
  73. //搜索的条件
  74. Row(
  75. children: [
  76. SearchAppBar(
  77. value: state.keyword,
  78. onSearch: (keyword) {
  79. controller.doSearch(keyword);
  80. },
  81. hintText: "Staff Name".tr,
  82. controller: state.searchController,
  83. ).expanded(),
  84. MyButton(
  85. onPressed: () {
  86. FocusScope.of(context).unfocus();
  87. controller.resetFiltering();
  88. },
  89. text: "Reset".tr,
  90. textColor: ColorConstants.white,
  91. backgroundColor: hexToColor("#2BA9F9", opacity: 0.5),
  92. radius: 20,
  93. minWidth: 60,
  94. minHeight: 35,
  95. ),
  96. ],
  97. ).marginOnly(top: 10, left: 15, right: 15, bottom: 5),
  98. // 添加按钮
  99. Visibility(
  100. visible: state.jobInfo?.canAppend == true,
  101. child: MyButton(
  102. type: ClickType.throttle,
  103. milliseconds: 500,
  104. onPressed: () {
  105. FocusScope.of(context).unfocus();
  106. controller.showAddStaffDialog();
  107. },
  108. text: "Add Staff".tr,
  109. textColor: ColorConstants.white,
  110. fontSize: 16,
  111. radius: 20,
  112. backgroundColor: hexToColor("#FFBB1B"),
  113. fontWeight: FontWeight.w500,
  114. ).marginOnly(left: 15, right: 15, top: 5, bottom: 10),
  115. ),
  116. //底部的列表
  117. EasyRefresh(
  118. controller: controller.refreshController,
  119. onRefresh: controller.onRefresh,
  120. onLoad: controller.loadMore,
  121. child: LoadStateLayout(
  122. state: controller.loadingState,
  123. errorMessage: controller.errorMessage,
  124. errorRetry: () {
  125. controller.retryRequest();
  126. },
  127. successSliverWidget: [
  128. SliverList(
  129. delegate: SliverChildBuilderDelegate(
  130. (context, index) {
  131. return AppliedStaffItem(
  132. index: index,
  133. jobInfo: state.jobInfo,
  134. item: state.datas[index],
  135. onEditAction: () {
  136. controller.gotoAppliedEditPage(state.datas[index]);
  137. },
  138. onRemarkAction: () {
  139. controller.showRemarkDialog(state.datas[index]);
  140. },
  141. onStatusAction: () {
  142. controller.gotoAppliedWorkflowPage(state.datas[index]);
  143. },
  144. onItemAction: () {
  145. controller.doSelectedOrNot(state.datas[index]);
  146. },
  147. onMemberAction: (){
  148. controller.gotoStaffDetailPage(state.datas[index]);
  149. },
  150. );
  151. },
  152. childCount: state.datas.length,
  153. ))
  154. ],
  155. ),
  156. ).expanded(),
  157. Row(
  158. mainAxisSize: MainAxisSize.max,
  159. children: [
  160. //批量Approve
  161. MyTextView(
  162. "Operation Approve".tr,
  163. fontSize: 17,
  164. isFontMedium: true,
  165. boxHeight: 48,
  166. onClick: () {
  167. controller.operationApprove();
  168. },
  169. alignment: Alignment.center,
  170. textAlign: TextAlign.center,
  171. textColor: Colors.white,
  172. backgroundColor: Color(0XFF0AC074),
  173. ).expanded(),
  174. //批量修改时间
  175. MyTextView(
  176. "Batch Modify".tr,
  177. fontSize: 17,
  178. isFontMedium: true,
  179. boxHeight: 48,
  180. onClick: () {
  181. controller.showBatchModifyDialog();
  182. },
  183. alignment: Alignment.center,
  184. textAlign: TextAlign.center,
  185. textColor: Colors.white,
  186. backgroundColor: Color(0XFFFFBB1B),
  187. ).expanded(),
  188. ],
  189. ),
  190. ],
  191. ),
  192. ),
  193. );
  194. });
  195. }
  196. }