uk_labour_repository.dart 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888
  1. import 'dart:io';
  2. import 'package:domain/entity/response/uk_labour_request_review_detail_entity.dart';
  3. import 'package:domain/entity/response/uk_labour_request_review_list_entity.dart';
  4. import 'package:domain/entity/server_time.dart';
  5. import 'package:get/get.dart';
  6. import 'package:plugin_platform/platform_export.dart';
  7. import 'package:plugin_platform/http/http_provider.dart';
  8. import 'package:plugin_platform/http/http_result.dart';
  9. import 'package:shared/utils/log_utils.dart';
  10. import 'package:shared/utils/util.dart';
  11. import '../constants/api_constants.dart';
  12. import '../entity/response/uk_lab_req_show_template_entity.dart';
  13. import '../entity/response/uk_labour_request_detail_entity.dart';
  14. import '../entity/response/uk_labour_request_preselect_addstatff_list_entity.dart';
  15. import '../entity/response/uk_labour_request_preselected_list_entity.dart';
  16. import '../entity/response/uk_labour_request_table_entity.dart';
  17. import '../entity/response/uk_labour_review_status_entity.dart';
  18. /// 用工请求相关
  19. class UkLabourRepository extends GetxService {
  20. HttpProvider httpProvider;
  21. UkLabourRepository({required this.httpProvider});
  22. /// 获取用工请求的主列表
  23. Future<HttpResult<UkLabourRequestTableEntity>> fetchLabourRequestList(
  24. String? keyword,
  25. String? startDate,
  26. String? endDate,
  27. String? statusId,
  28. String? departmentId, {
  29. required int curPage,
  30. CancelToken? cancelToken,
  31. }) async {
  32. //参数
  33. Map<String, String> params = {};
  34. params["cur_page"] = curPage.toString();
  35. params["page_size"] = "20";
  36. if (!Utils.isEmpty(keyword)) {
  37. params["job_title"] = keyword!;
  38. }
  39. if (!Utils.isEmpty(startDate)) {
  40. params["job_start"] = startDate!;
  41. }
  42. if (!Utils.isEmpty(endDate)) {
  43. params["job_end"] = endDate!;
  44. }
  45. if (!Utils.isEmpty(statusId)) {
  46. params["co_status"] = statusId!;
  47. }
  48. if (!Utils.isEmpty(departmentId)) {
  49. params["co_department_id"] = departmentId!;
  50. }
  51. final result = await httpProvider.requestNetResult(
  52. ApiConstants.apiLabourRequestList,
  53. params: params,
  54. cancelToken: cancelToken,
  55. );
  56. //根据返回的结果,封装原始数据为Bean/Entity对象
  57. if (result.isSuccess) {
  58. //重新赋值data或list
  59. final json = result.getDataJson();
  60. var data = UkLabourRequestTableEntity.fromJson(json!);
  61. //重新赋值data或list
  62. return result.convert<UkLabourRequestTableEntity>(data: data);
  63. }
  64. return result.convert();
  65. }
  66. /// 根据ID获取主列表的Item数据,用于刷新Item
  67. Future<HttpResult<UkLabourRequestTableEntity>> fetchItemByRequestId(
  68. String? requestId, {
  69. CancelToken? cancelToken,
  70. }) async {
  71. //参数
  72. Map<String, String> params = {};
  73. params["cur_page"] = "1";
  74. params["page_size"] = "1";
  75. if (!Utils.isEmpty(requestId)) {
  76. params["request_id"] = requestId!;
  77. }
  78. final result = await httpProvider.requestNetResult(
  79. ApiConstants.apiLabourRequestList,
  80. params: params,
  81. isShowLoadingDialog: true,
  82. cancelToken: cancelToken,
  83. );
  84. //根据返回的结果,封装原始数据为Bean/Entity对象
  85. if (result.isSuccess) {
  86. //重新赋值data或list
  87. final json = result.getDataJson();
  88. var data = UkLabourRequestTableEntity.fromJson(json!);
  89. //重新赋值data或list
  90. return result.convert<UkLabourRequestTableEntity>(data: data);
  91. }
  92. return result.convert();
  93. }
  94. /// 添加用工的选项
  95. Future<HttpResult<UkLabourRequestDetailEntity>> fetchLabourRequestAddOption({
  96. CancelToken? cancelToken,
  97. }) async {
  98. final result = await httpProvider.requestNetResult(
  99. ApiConstants.apiLabourRequestAddOption,
  100. isShowLoadingDialog: true,
  101. cancelToken: cancelToken,
  102. );
  103. //根据返回的结果,封装原始数据为Bean/Entity对象
  104. if (result.isSuccess) {
  105. //重新赋值data或list
  106. final json = result.getDataJson();
  107. var data = UkLabourRequestDetailEntity.fromJson(json!);
  108. //重新赋值data或list
  109. return result.convert<UkLabourRequestDetailEntity>(data: data);
  110. }
  111. return result.convert();
  112. }
  113. /// 根据模板id 回显 详情页相关数据
  114. Future<HttpResult<UkLabReqShowTemplateEntity>> fetchLabourRequestShowTemplateData(
  115. String templateId,
  116. {
  117. CancelToken? cancelToken,
  118. }) async {
  119. Map<String, dynamic> params = {};
  120. params['template_id'] = templateId;
  121. final result = await httpProvider.requestNetResult(
  122. ApiConstants.apiLabourRequestTemplateShowUK,
  123. params: params,
  124. isShowLoadingDialog: true,
  125. cancelToken: cancelToken,
  126. );
  127. //根据返回的结果,封装原始数据为Bean/Entity对象
  128. if (result.isSuccess) {
  129. //重新赋值data或list
  130. final json = result.getDataJson();
  131. var data = UkLabReqShowTemplateEntity.fromJson(json!);
  132. //重新赋值data或list
  133. return result.convert<UkLabReqShowTemplateEntity>(data: data);
  134. }
  135. return result.convert();
  136. }
  137. /// 获取labourequest 详情
  138. Future<HttpResult<UkLabourRequestDetailEntity>> fetchLabourRequestDetail(
  139. String? requestId, {
  140. CancelToken? cancelToken,
  141. }) async {
  142. //参数
  143. Map<String, String> params = {};
  144. if (!Utils.isEmpty(requestId)) {
  145. params["request_id"] = requestId!;
  146. }
  147. final result = await httpProvider.requestNetResult(
  148. ApiConstants.apiLabourRequestEditDetail,
  149. params: params,
  150. isShowLoadingDialog: true,
  151. cancelToken: cancelToken,
  152. );
  153. //根据返回的结果,封装原始数据为Bean/Entity对象
  154. if (result.isSuccess) {
  155. //重新赋值data或list
  156. final json = result.getDataJson();
  157. var data = UkLabourRequestDetailEntity.fromJson(json!);
  158. //重新赋值data或list
  159. return result.convert<UkLabourRequestDetailEntity>(data: data);
  160. }
  161. return result.convert();
  162. }
  163. /// lab-request 的编辑用工请求发布
  164. Future<HttpResult> editLabourRequestSubmit({
  165. String? requestId,
  166. String? templateId,
  167. String? jobStart,
  168. String? jobEnd,
  169. String? departmentId,
  170. String? needNum,
  171. String? salaryBy,
  172. String? repeatDateStr,
  173. String? amount,
  174. String? certificate, // 多个逗号隔开
  175. String? challenge25,
  176. String? vehicle, // 多个逗号隔开
  177. String? description,
  178. String? employmentType,
  179. String? eventName,
  180. String? eventType,
  181. String? passengers,
  182. String? estRevenue,
  183. String? position,
  184. String? estCost,
  185. dynamic? attUrl,
  186. String? videoText,
  187. dynamic? videoCover,
  188. dynamic? video,
  189. dynamic? otherImage,
  190. dynamic? otherDocument,
  191. CancelToken? cancelToken,
  192. }) async {
  193. //参数
  194. Map<String, dynamic> params = {};
  195. params['request_id'] = requestId ?? "";
  196. params['template_id'] = templateId ?? "";
  197. params['job_start'] = jobStart ?? "";
  198. params['job_end'] = jobEnd ?? "";
  199. params['need_num'] = needNum ?? "";
  200. if (!Utils.isEmpty(departmentId)) {
  201. params["co_department_id"] = departmentId!;
  202. }
  203. params['salary_by'] = salaryBy ?? "";
  204. if (!Utils.isEmpty(amount)) {
  205. params["amount"] = amount!;
  206. }
  207. if(!Utils.isEmpty(certificate)){
  208. params["certificate"] = certificate!;
  209. }
  210. if(!Utils.isEmpty(challenge25)){
  211. params["challenge_25"] = challenge25!;
  212. }
  213. if(!Utils.isEmpty(vehicle)){
  214. params["vehicle"] = vehicle!;
  215. }
  216. if(!Utils.isEmpty(repeatDateStr)) {
  217. params["select"] = repeatDateStr!;
  218. }
  219. params['description'] = description ?? "";
  220. params['employment_type'] = employmentType ?? "";
  221. params['event_name'] = eventName ?? "";
  222. params['event_type'] = eventType ?? "";
  223. params['passengers'] = passengers ?? "";
  224. params['est_revenue'] = estRevenue ?? "";
  225. params['position'] = position ?? "";
  226. params['est_cost'] = estCost ?? "";
  227. //可能是file 也可能是 url
  228. Map<String, String> filePathParams = {};
  229. // 判断 http 或者 https 开头
  230. if(Utils.isNotEmpty(attUrl)){
  231. if(attUrl!.startsWith("http") || attUrl!.startsWith("https")){
  232. params['att_url'] = attUrl;
  233. }else {
  234. filePathParams['att_url'] = attUrl;
  235. }
  236. }
  237. // 视频部分的参数
  238. params['video_text'] = videoText ?? "";
  239. //可能是file 也可能是 url
  240. // 判断 http 或者 https 开头
  241. if(Utils.isNotEmpty(videoCover)){
  242. if(videoCover!.startsWith("http") || videoCover!.startsWith("https")){
  243. params['video_cover'] = videoCover;
  244. }else {
  245. filePathParams['video_cover'] = videoCover;
  246. }
  247. }
  248. //可能是file 也可能是 url
  249. // 判断 http 或者 https 开头
  250. if(Utils.isNotEmpty(video)){
  251. if(video!.startsWith("http") || video!.startsWith("https")){
  252. params['video'] = video;
  253. }else {
  254. filePathParams['video'] = video;
  255. }
  256. }
  257. //可能是file 也可能是 url
  258. // 判断 http 或者 https 开头
  259. if(Utils.isNotEmpty(otherImage)){
  260. if(otherImage!.startsWith("http") || otherImage!.startsWith("https")){
  261. params['other_image'] = otherImage;
  262. }else {
  263. filePathParams['other_image'] = otherImage;
  264. }
  265. }
  266. //可能是file 也可能是 url
  267. // 判断 http 或者 https 开头
  268. if(Utils.isNotEmpty(otherDocument)){
  269. if(otherDocument!.startsWith("http") || otherDocument!.startsWith("https")){
  270. params['other_document'] = otherDocument;
  271. }else {
  272. filePathParams['other_document'] = otherDocument;
  273. }
  274. }
  275. final result = await httpProvider.requestNetResult(
  276. ApiConstants.apiLabourRequestEditSubmit,
  277. method: HttpMethod.POST,
  278. params: params,
  279. paths: filePathParams,
  280. networkDebounce: true,
  281. isShowLoadingDialog: true,
  282. cancelToken: cancelToken,
  283. );
  284. //根据返回的结果,封装原始数据为Bean/Entity对象
  285. if (result.isSuccess) {
  286. //重新赋值data或list
  287. return result.convert();
  288. }
  289. return result.convert();
  290. }
  291. /// lab-request-review 的编辑用工请求发布
  292. Future<HttpResult> editLabourRequestReviewSubmit({
  293. String? requestId,
  294. String? templateId,
  295. String? jobStart,
  296. String? jobEnd,
  297. String? departmentId,
  298. String? needNum,
  299. String? salaryBy,
  300. String? repeatDateStr,
  301. String? amount,
  302. String? certificate, // 多个逗号隔开
  303. String? challenge25,
  304. String? vehicle, // 多个逗号隔开
  305. String? description,
  306. String? employmentType,
  307. String? eventName,
  308. String? eventType,
  309. String? passengers,
  310. String? estRevenue,
  311. String? position,
  312. String? estCost,
  313. dynamic? attUrl,
  314. String? videoText,
  315. dynamic? videoCover,
  316. dynamic? video,
  317. dynamic? otherImage,
  318. dynamic? otherDocument,
  319. CancelToken? cancelToken,
  320. }) async {
  321. //参数
  322. Map<String, dynamic> params = {};
  323. params['request_id'] = requestId ?? "";
  324. params['template_id'] = templateId ?? "";
  325. params['job_start'] = jobStart ?? "";
  326. params['job_end'] = jobEnd ?? "";
  327. params['need_num'] = needNum ?? "";
  328. if (!Utils.isEmpty(departmentId)) {
  329. params["co_department_id"] = departmentId!;
  330. }
  331. params['salary_by'] = salaryBy ?? "";
  332. if (!Utils.isEmpty(amount)) {
  333. params["amount"] = amount!;
  334. }
  335. if(!Utils.isEmpty(certificate)){
  336. params["certificate"] = certificate!;
  337. }
  338. if(!Utils.isEmpty(challenge25)){
  339. params["challenge_25"] = challenge25!;
  340. }
  341. if(!Utils.isEmpty(vehicle)){
  342. params["vehicle"] = vehicle!;
  343. }
  344. if(!Utils.isEmpty(repeatDateStr)) {
  345. params["select"] = repeatDateStr!;
  346. }
  347. params['description'] = description ?? "";
  348. params['employment_type'] = employmentType ?? "";
  349. params['event_name'] = eventName ?? "";
  350. params['event_type'] = eventType ?? "";
  351. params['passengers'] = passengers ?? "";
  352. params['est_revenue'] = estRevenue ?? "";
  353. params['position'] = position ?? "";
  354. params['est_cost'] = estCost ?? "";
  355. //可能是file 也可能是 url
  356. Map<String, String> filePathParams = {};
  357. // 判断 http 或者 https 开头
  358. if(Utils.isNotEmpty(attUrl)){
  359. if(attUrl!.startsWith("http") || attUrl!.startsWith("https")){
  360. params['att_url'] = attUrl;
  361. }else {
  362. filePathParams['att_url'] = attUrl;
  363. }
  364. }
  365. // 视频部分的参数
  366. params['video_text'] = videoText ?? "";
  367. //可能是file 也可能是 url
  368. // 判断 http 或者 https 开头
  369. if(Utils.isNotEmpty(videoCover)){
  370. if(videoCover!.startsWith("http") || videoCover!.startsWith("https")){
  371. params['video_cover'] = videoCover;
  372. }else {
  373. filePathParams['video_cover'] = videoCover;
  374. }
  375. }
  376. //可能是file 也可能是 url
  377. // 判断 http 或者 https 开头
  378. if(Utils.isNotEmpty(video)){
  379. if(video!.startsWith("http") || video!.startsWith("https")){
  380. params['video'] = video;
  381. }else {
  382. filePathParams['video'] = video;
  383. }
  384. }
  385. //可能是file 也可能是 url
  386. // 判断 http 或者 https 开头
  387. if(Utils.isNotEmpty(otherImage)){
  388. if(otherImage!.startsWith("http") || otherImage!.startsWith("https")){
  389. params['other_image'] = otherImage;
  390. }else {
  391. filePathParams['other_image'] = otherImage;
  392. }
  393. }
  394. //可能是file 也可能是 url
  395. // 判断 http 或者 https 开头
  396. if(Utils.isNotEmpty(otherDocument)){
  397. if(otherDocument!.startsWith("http") || otherDocument!.startsWith("https")){
  398. params['other_document'] = otherDocument;
  399. }else {
  400. filePathParams['other_document'] = otherDocument;
  401. }
  402. }
  403. final result = await httpProvider.requestNetResult(
  404. ApiConstants.apiLabourRequestReViewEditUK,
  405. method: HttpMethod.POST,
  406. params: params,
  407. paths: filePathParams,
  408. networkDebounce: true,
  409. isShowLoadingDialog: true,
  410. cancelToken: cancelToken,
  411. );
  412. //根据返回的结果,封装原始数据为Bean/Entity对象
  413. if (result.isSuccess) {
  414. //重新赋值data或list
  415. return result.convert();
  416. }
  417. return result.convert();
  418. }
  419. /// lab-request 的新增 labourequest用工请求发布
  420. Future<HttpResult> addLabourRequestSubmit({
  421. String? templateId,
  422. String? jobDate,
  423. String? jobStart,
  424. String? jobEnd,
  425. String? departmentId,
  426. String? needNum,
  427. String? salaryBy,
  428. String? repeatDateStr,
  429. String? amount,
  430. String? certificate, // 多个逗号隔开
  431. String? challenge25,
  432. String? vehicle, // 多个逗号隔开
  433. String? jobApplyPreId,
  434. String? description,
  435. String? employmentType,
  436. String? eventName,
  437. String? eventType,
  438. String? passengers,
  439. String? estRevenue,
  440. String? position,
  441. String? estCost,
  442. dynamic? attUrl,
  443. String? videoText,
  444. dynamic? videoCover,
  445. dynamic? video,
  446. dynamic? otherImage,
  447. dynamic? otherDocument,
  448. CancelToken? cancelToken,
  449. }) async {
  450. //参数
  451. Map<String, dynamic> params = {};
  452. params['template_id'] = templateId ?? "";
  453. params['job_date'] = jobDate ?? "";
  454. params['start_time'] = jobStart ?? "";
  455. params['end_time'] = jobEnd ?? "";
  456. params['need_num'] = needNum ?? "";
  457. if (!Utils.isEmpty(departmentId)) {
  458. params["co_department_id"] = departmentId!;
  459. }
  460. params['salary_by'] = salaryBy ?? "";
  461. if(!Utils.isEmpty(repeatDateStr)){
  462. params["select"] = repeatDateStr!;
  463. }
  464. if(!Utils.isEmpty(jobApplyPreId)){
  465. params["job_apply_pre_id"] = jobApplyPreId!;
  466. }
  467. if (!Utils.isEmpty(amount)) {
  468. params["amount"] = amount!;
  469. }
  470. if(!Utils.isEmpty(certificate)){
  471. params["certificate"] = certificate!;
  472. }
  473. if(!Utils.isEmpty(challenge25)){
  474. params["challenge_25"] = challenge25!;
  475. }
  476. if(!Utils.isEmpty(vehicle)){
  477. params["vehicle"] = vehicle!;
  478. }
  479. params['description'] = description ?? "";
  480. params['employment_type'] = employmentType ?? "";
  481. params['event_name'] = eventName ?? "";
  482. params['event_type'] = eventType ?? "";
  483. params['passengers'] = passengers ?? "";
  484. params['est_revenue'] = estRevenue ?? "";
  485. params['position'] = position ?? "";
  486. params['est_cost'] = estCost ?? "";
  487. //可能是file 也可能是 url
  488. Map<String, String> filePathParams = {};
  489. // 判断 http 或者 https 开头
  490. if(Utils.isNotEmpty(attUrl)){
  491. if(attUrl!.startsWith("http") || attUrl!.startsWith("https")){
  492. params['att_url'] = attUrl;
  493. }else {
  494. filePathParams['att_url'] = attUrl;
  495. }
  496. }
  497. // 视频部分的参数
  498. params['video_text'] = videoText ?? "";
  499. //可能是file 也可能是 url
  500. // 判断 http 或者 https 开头
  501. if(Utils.isNotEmpty(videoCover)){
  502. if(videoCover!.startsWith("http") || videoCover!.startsWith("https")){
  503. params['video_cover'] = videoCover;
  504. }else {
  505. filePathParams['video_cover'] = videoCover;
  506. }
  507. }
  508. //可能是file 也可能是 url
  509. // 判断 http 或者 https 开头
  510. if(Utils.isNotEmpty(video)){
  511. if(video!.startsWith("http") || video!.startsWith("https")){
  512. params['video'] = video;
  513. }else {
  514. filePathParams['video'] = video;
  515. }
  516. }
  517. //可能是file 也可能是 url
  518. // 判断 http 或者 https 开头
  519. if(Utils.isNotEmpty(otherImage)){
  520. if(otherImage!.startsWith("http") || otherImage!.startsWith("https")){
  521. params['other_image'] = otherImage;
  522. }else {
  523. filePathParams['other_image'] = otherImage;
  524. }
  525. }
  526. //可能是file 也可能是 url
  527. // 判断 http 或者 https 开头
  528. if(Utils.isNotEmpty(otherDocument)){
  529. if(otherDocument!.startsWith("http") || otherDocument!.startsWith("https")){
  530. params['other_document'] = otherDocument;
  531. }else {
  532. filePathParams['other_document'] = otherDocument;
  533. }
  534. }
  535. final result = await httpProvider.requestNetResult(
  536. ApiConstants.apiLabourRequestAddSubmit,
  537. method: HttpMethod.POST,
  538. params: params,
  539. paths: filePathParams,
  540. networkDebounce: true,
  541. isShowLoadingDialog: true,
  542. cancelToken: cancelToken,
  543. );
  544. //根据返回的结果,封装原始数据为Bean/Entity对象
  545. if (result.isSuccess) {
  546. //重新赋值data或list
  547. return result.convert();
  548. }
  549. return result.convert();
  550. }
  551. /// 用工请求 快速复制
  552. Future<HttpResult> quickCopyLabourRequestSubmit(
  553. String? requestId,
  554. // 格式[Y-m-d]
  555. String? jobDate,
  556. //格式[H:m]
  557. String? startTime,
  558. //格式[H:m]
  559. String? endTime,
  560. {
  561. CancelToken? cancelToken,
  562. }) async {
  563. //参数
  564. Map<String, String> params = {};
  565. params['request_id'] = requestId ?? "";
  566. params['job_date'] = jobDate ?? "";
  567. params['start_time'] = startTime ?? "";
  568. params['end_time'] = endTime ?? "";
  569. final result = await httpProvider.requestNetResult(
  570. ApiConstants.apiLabourRequestQuickCopyUK,
  571. method: HttpMethod.POST,
  572. params: params,
  573. networkDebounce: true,
  574. isShowLoadingDialog: true,
  575. cancelToken: cancelToken,
  576. );
  577. //根据返回的结果,封装原始数据为Bean/Entity对象
  578. if (result.isSuccess) {
  579. //重新赋值data或list
  580. return result.convert();
  581. }
  582. return result.convert();
  583. }
  584. /// 获取 labourequest preselected 列表
  585. Future<HttpResult<UkLabourRequestPreselectedListEntity>> fetchLabourRequestPreselectedList(
  586. String reQuestId,
  587. {
  588. required int curPage,
  589. CancelToken? cancelToken,
  590. }) async {
  591. //参数
  592. Map<String, String> params = {};
  593. params["cur_page"] = curPage.toString();
  594. params["page_size"] = "20";
  595. if (!Utils.isEmpty(reQuestId)) {
  596. params["request_id"] = reQuestId;
  597. }
  598. final result = await httpProvider.requestNetResult(
  599. ApiConstants.apiLabourRequestPreSelectListUK,
  600. params: params,
  601. cancelToken: cancelToken,
  602. );
  603. //根据返回的结果,封装原始数据为Bean/Entity对象
  604. if (result.isSuccess) {
  605. //重新赋值data或list
  606. final json = result.getDataJson();
  607. var data = UkLabourRequestPreselectedListEntity.fromJson(json!);
  608. //重新赋值data或list
  609. return result.convert<UkLabourRequestPreselectedListEntity>(data: data);
  610. }
  611. return result.convert();
  612. }
  613. /// 预选人-添加员工的列表
  614. Future<HttpResult<UkLabourRequestPreselectAddstatffListEntity>> fetchtPreselectedAddStaffList(
  615. String? keyWord,
  616. String? reQuestId,
  617. {
  618. required int curPage,
  619. CancelToken? cancelToken,
  620. }) async {
  621. //参数
  622. Map<String, String> params = {};
  623. params["cur_page"] = curPage.toString();
  624. params["page_size"] = "20";
  625. if (!Utils.isEmpty(keyWord)) {
  626. params["keyword"] = keyWord!;
  627. }
  628. if (!Utils.isEmpty(reQuestId)) {
  629. params["request_id"] = reQuestId!;
  630. }
  631. final result = await httpProvider.requestNetResult(
  632. ApiConstants.apiLabourRequestPreSelectAddStaffListUK,
  633. params: params,
  634. cancelToken: cancelToken,
  635. );
  636. //根据返回的结果,封装原始数据为Bean/Entity对象
  637. if (result.isSuccess) {
  638. //重新赋值data或list
  639. final json = result.getDataJson();
  640. var data = UkLabourRequestPreselectAddstatffListEntity.fromJson(json!);
  641. //重新赋值data或list
  642. return result.convert<UkLabourRequestPreselectAddstatffListEntity>(data: data);
  643. }
  644. return result.convert();
  645. }
  646. //// 添加预选员工
  647. Future<HttpResult> labourRequestPreselectedAddStaffSubmit(
  648. String reQuestId,
  649. String staffIds,
  650. {
  651. CancelToken? cancelToken,
  652. }) async {
  653. //参数
  654. Map<String, String> params = {};
  655. params['request_id'] = reQuestId ?? "";
  656. params['staff_ids'] = staffIds ?? "";
  657. final result = await httpProvider.requestNetResult(
  658. ApiConstants.apiLabourRequestPreSelectAddBatchUK,
  659. method: HttpMethod.POST,
  660. params: params,
  661. networkDebounce: true,
  662. isShowLoadingDialog: true,
  663. cancelToken: cancelToken,
  664. );
  665. //根据返回的结果,封装原始数据为Bean/Entity对象
  666. if (result.isSuccess) {
  667. //重新赋值data或list
  668. return result.convert();
  669. }
  670. return result.convert();
  671. }
  672. /// 删除预选员工
  673. Future<HttpResult> labourRequestPreselectedDelete(
  674. String selectedId,
  675. {
  676. CancelToken? cancelToken,
  677. }) async {
  678. //参数
  679. Map<String, String> params = {};
  680. params['selected_id'] = selectedId ?? "";
  681. final result = await httpProvider.requestNetResult(
  682. ApiConstants.apiLabourRequestPreSelectDeleteUK,
  683. method: HttpMethod.POST,
  684. params: params,
  685. networkDebounce: true,
  686. isShowLoadingDialog: true,
  687. cancelToken: cancelToken,
  688. );
  689. //根据返回的结果,封装原始数据为Bean/Entity对象
  690. if (result.isSuccess) {
  691. //重新赋值data或list
  692. return result.convert();
  693. }
  694. return result.convert();
  695. }
  696. /// labourequest -review ------------
  697. /// 获取用工请求审核的主列表
  698. Future<HttpResult<UkLabourRequestReviewListEntity>> fetchLabourRequestReViewList({
  699. String? keyword,
  700. String? startDate,
  701. String? endDate,
  702. String? departmentId,
  703. required int curPage,
  704. CancelToken? cancelToken,
  705. }) async {
  706. //参数
  707. Map<String, String> params = {};
  708. params["cur_page"] = curPage.toString();
  709. params["page_size"] = "20";
  710. if (!Utils.isEmpty(keyword)) {
  711. params["job_title"] = keyword!;
  712. }
  713. if (!Utils.isEmpty(startDate)) {
  714. params["job_start"] = startDate!;
  715. }
  716. if (!Utils.isEmpty(endDate)) {
  717. params["job_end"] = endDate!;
  718. }
  719. if (!Utils.isEmpty(departmentId)) {
  720. params["co_department_id"] = departmentId!;
  721. }
  722. final result = await httpProvider.requestNetResult(
  723. ApiConstants.apiLabourRequestReViewListUK,
  724. params: params,
  725. cancelToken: cancelToken,
  726. );
  727. //根据返回的结果,封装原始数据为Bean/Entity对象
  728. if (result.isSuccess) {
  729. //重新赋值data或list
  730. final json = result.getDataJson();
  731. var data = UkLabourRequestReviewListEntity.fromJson(json!);
  732. //重新赋值data或list
  733. return result.convert<UkLabourRequestReviewListEntity>(data: data);
  734. }
  735. return result.convert();
  736. }
  737. /// labourrequest -review 批量审核(批量同意/批量拒绝)
  738. Future<HttpResult> labourRequestReviewBatchSubmit(
  739. {
  740. // 多个Record Ids以逗号分隔
  741. String? recordIds,
  742. // 审核类型Type【approve|reject】
  743. String? type,
  744. CancelToken? cancelToken,
  745. }) async {
  746. //参数
  747. Map<String, String> params = {};
  748. params['record_ids'] = recordIds ?? "";
  749. params['type'] = type ?? "";
  750. final result = await httpProvider.requestNetResult(
  751. ApiConstants.apiLabourRequestReViewBatchSubmitUK,
  752. method: HttpMethod.POST,
  753. params: params,
  754. networkDebounce: true,
  755. isShowLoadingDialog: true,
  756. cancelToken: cancelToken,
  757. );
  758. //根据返回的结果,封装原始数据为Bean/Entity对象
  759. if (result.isSuccess) {
  760. //重新赋值data或list
  761. return result.convert();
  762. }
  763. return result.convert();
  764. }
  765. /// 用工审核的审核流程列表
  766. Future<HttpResult<UkLabourReviewStatusEntity>> fetchLabourReviewStatusView(
  767. String? requestId, {
  768. CancelToken? cancelToken,
  769. }) async {
  770. //参数
  771. Map<String, String> params = {};
  772. params['request_id'] = requestId ?? "";
  773. final result = await httpProvider.requestNetResult(
  774. ApiConstants.apiLabourRequestStateWorkFlow,
  775. params: params,
  776. cancelToken: cancelToken,
  777. );
  778. //根据返回的结果,封装原始数据为Bean/Entity对象
  779. if (result.isSuccess) {
  780. //重新赋值data或list
  781. final json = result.getDataJson();
  782. var data = UkLabourReviewStatusEntity.fromJson(json!);
  783. //重新赋值data或list
  784. return result.convert<UkLabourReviewStatusEntity>(data: data);
  785. }
  786. return result.convert();
  787. }
  788. }