uk_labour_repository.dart 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911
  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_addstaff_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? location,
  175. String? certificate, // 多个逗号隔开
  176. String? challenge25,
  177. String? vehicle, // 多个逗号隔开
  178. String? description,
  179. String? employmentType,
  180. String? eventName,
  181. String? eventType,
  182. String? passengers,
  183. String? estRevenue,
  184. String? position,
  185. String? estCost,
  186. dynamic? attUrl,
  187. String? videoText,
  188. dynamic? videoCover,
  189. dynamic? video,
  190. dynamic? otherImage,
  191. dynamic? otherDocument,
  192. CancelToken? cancelToken,
  193. }) async {
  194. //参数
  195. Map<String, dynamic> params = {};
  196. params['request_id'] = requestId ?? "";
  197. params['template_id'] = templateId ?? "";
  198. params['job_start'] = jobStart ?? "";
  199. params['job_end'] = jobEnd ?? "";
  200. params['need_num'] = needNum ?? "";
  201. if (!Utils.isEmpty(departmentId)) {
  202. params["co_department_id"] = departmentId!;
  203. }
  204. params['salary_by'] = salaryBy ?? "";
  205. if (!Utils.isEmpty(amount)) {
  206. params["amount"] = amount!;
  207. }
  208. if (!Utils.isEmpty(location)) {
  209. params["location"] = location!;
  210. }
  211. if(!Utils.isEmpty(certificate)){
  212. params["certificate"] = certificate!;
  213. }
  214. if(!Utils.isEmpty(challenge25)){
  215. params["challenge_25"] = challenge25!;
  216. }
  217. if(!Utils.isEmpty(vehicle)){
  218. params["vehicle"] = vehicle!;
  219. }
  220. if(!Utils.isEmpty(repeatDateStr)) {
  221. params["select"] = repeatDateStr!;
  222. }
  223. params['description'] = description ?? "";
  224. params['employment_type'] = employmentType ?? "";
  225. params['event_name'] = eventName ?? "";
  226. params['event_type'] = eventType ?? "";
  227. params['passengers'] = passengers ?? "";
  228. params['est_revenue'] = estRevenue ?? "";
  229. params['position'] = position ?? "";
  230. params['est_cost'] = estCost ?? "";
  231. //可能是file 也可能是 url
  232. Map<String, String> filePathParams = {};
  233. // 判断 http 或者 https 开头
  234. if(Utils.isNotEmpty(attUrl)){
  235. if(attUrl!.startsWith("http") || attUrl!.startsWith("https")){
  236. params['att_url'] = attUrl;
  237. }else {
  238. filePathParams['att_url'] = attUrl;
  239. }
  240. }
  241. // 视频部分的参数
  242. params['video_text'] = videoText ?? "";
  243. //可能是file 也可能是 url
  244. // 判断 http 或者 https 开头
  245. if(Utils.isNotEmpty(videoCover)){
  246. if(videoCover!.startsWith("http") || videoCover!.startsWith("https")){
  247. params['video_cover'] = videoCover;
  248. }else {
  249. filePathParams['video_cover'] = videoCover;
  250. }
  251. }
  252. //可能是file 也可能是 url
  253. // 判断 http 或者 https 开头
  254. if(Utils.isNotEmpty(video)){
  255. if(video!.startsWith("http") || video!.startsWith("https")){
  256. params['video'] = video;
  257. }else {
  258. filePathParams['video'] = video;
  259. }
  260. }
  261. //可能是file 也可能是 url
  262. // 判断 http 或者 https 开头
  263. if(Utils.isNotEmpty(otherImage)){
  264. if(otherImage!.startsWith("http") || otherImage!.startsWith("https")){
  265. params['other_image'] = otherImage;
  266. }else {
  267. filePathParams['other_image'] = otherImage;
  268. }
  269. }
  270. //可能是file 也可能是 url
  271. // 判断 http 或者 https 开头
  272. if(Utils.isNotEmpty(otherDocument)){
  273. if(otherDocument!.startsWith("http") || otherDocument!.startsWith("https")){
  274. params['other_document'] = otherDocument;
  275. }else {
  276. filePathParams['other_document'] = otherDocument;
  277. }
  278. }
  279. final result = await httpProvider.requestNetResult(
  280. ApiConstants.apiLabourRequestEditSubmit,
  281. method: HttpMethod.POST,
  282. params: params,
  283. paths: filePathParams,
  284. networkDebounce: true,
  285. isShowLoadingDialog: true,
  286. cancelToken: cancelToken,
  287. );
  288. //根据返回的结果,封装原始数据为Bean/Entity对象
  289. if (result.isSuccess) {
  290. //重新赋值data或list
  291. return result.convert();
  292. }
  293. return result.convert();
  294. }
  295. /// lab-request-review 的编辑用工请求发布
  296. Future<HttpResult> editLabourRequestReviewSubmit({
  297. String? requestId,
  298. String? templateId,
  299. String? jobStart,
  300. String? jobEnd,
  301. String? departmentId,
  302. String? needNum,
  303. String? location,
  304. String? salaryBy,
  305. String? repeatDateStr,
  306. String? amount,
  307. String? certificate, // 多个逗号隔开
  308. String? challenge25,
  309. String? vehicle, // 多个逗号隔开
  310. String? description,
  311. String? employmentType,
  312. String? eventName,
  313. String? eventType,
  314. String? passengers,
  315. String? estRevenue,
  316. String? position,
  317. String? estCost,
  318. dynamic? attUrl,
  319. String? videoText,
  320. dynamic? videoCover,
  321. dynamic? video,
  322. dynamic? otherImage,
  323. dynamic? otherDocument,
  324. CancelToken? cancelToken,
  325. }) async {
  326. //参数
  327. Map<String, dynamic> params = {};
  328. params['request_id'] = requestId ?? "";
  329. params['template_id'] = templateId ?? "";
  330. params['job_start'] = jobStart ?? "";
  331. params['job_end'] = jobEnd ?? "";
  332. params['need_num'] = needNum ?? "";
  333. if (!Utils.isEmpty(departmentId)) {
  334. params["co_department_id"] = departmentId!;
  335. }
  336. params['salary_by'] = salaryBy ?? "";
  337. if (!Utils.isEmpty(amount)) {
  338. params["amount"] = amount!;
  339. }
  340. if (!Utils.isEmpty(location)) {
  341. params["location"] = location!;
  342. }
  343. if(!Utils.isEmpty(certificate)){
  344. params["certificate"] = certificate!;
  345. }
  346. if(!Utils.isEmpty(challenge25)){
  347. params["challenge_25"] = challenge25!;
  348. }
  349. if(!Utils.isEmpty(vehicle)){
  350. params["vehicle"] = vehicle!;
  351. }
  352. if(!Utils.isEmpty(repeatDateStr)) {
  353. params["select"] = repeatDateStr!;
  354. }
  355. params['description'] = description ?? "";
  356. params['employment_type'] = employmentType ?? "";
  357. params['event_name'] = eventName ?? "";
  358. params['event_type'] = eventType ?? "";
  359. params['passengers'] = passengers ?? "";
  360. params['est_revenue'] = estRevenue ?? "";
  361. params['position'] = position ?? "";
  362. params['est_cost'] = estCost ?? "";
  363. //可能是file 也可能是 url
  364. Map<String, String> filePathParams = {};
  365. // 判断 http 或者 https 开头
  366. if(Utils.isNotEmpty(attUrl)){
  367. if(attUrl!.startsWith("http") || attUrl!.startsWith("https")){
  368. params['att_url'] = attUrl;
  369. }else {
  370. filePathParams['att_url'] = attUrl;
  371. }
  372. }
  373. // 视频部分的参数
  374. params['video_text'] = videoText ?? "";
  375. //可能是file 也可能是 url
  376. // 判断 http 或者 https 开头
  377. if(Utils.isNotEmpty(videoCover)){
  378. if(videoCover!.startsWith("http") || videoCover!.startsWith("https")){
  379. params['video_cover'] = videoCover;
  380. }else {
  381. filePathParams['video_cover'] = videoCover;
  382. }
  383. }
  384. //可能是file 也可能是 url
  385. // 判断 http 或者 https 开头
  386. if(Utils.isNotEmpty(video)){
  387. if(video!.startsWith("http") || video!.startsWith("https")){
  388. params['video'] = video;
  389. }else {
  390. filePathParams['video'] = video;
  391. }
  392. }
  393. //可能是file 也可能是 url
  394. // 判断 http 或者 https 开头
  395. if(Utils.isNotEmpty(otherImage)){
  396. if(otherImage!.startsWith("http") || otherImage!.startsWith("https")){
  397. params['other_image'] = otherImage;
  398. }else {
  399. filePathParams['other_image'] = otherImage;
  400. }
  401. }
  402. //可能是file 也可能是 url
  403. // 判断 http 或者 https 开头
  404. if(Utils.isNotEmpty(otherDocument)){
  405. if(otherDocument!.startsWith("http") || otherDocument!.startsWith("https")){
  406. params['other_document'] = otherDocument;
  407. }else {
  408. filePathParams['other_document'] = otherDocument;
  409. }
  410. }
  411. final result = await httpProvider.requestNetResult(
  412. ApiConstants.apiLabourRequestReViewEditUK,
  413. method: HttpMethod.POST,
  414. params: params,
  415. paths: filePathParams,
  416. networkDebounce: true,
  417. isShowLoadingDialog: true,
  418. cancelToken: cancelToken,
  419. );
  420. //根据返回的结果,封装原始数据为Bean/Entity对象
  421. if (result.isSuccess) {
  422. //重新赋值data或list
  423. return result.convert();
  424. }
  425. return result.convert();
  426. }
  427. /// lab-request 的新增 labourequest用工请求发布
  428. Future<HttpResult> addLabourRequestSubmit({
  429. String? templateId,
  430. String? jobDate,
  431. String? jobStart,
  432. String? jobEnd,
  433. String? departmentId,
  434. String? needNum,
  435. String? salaryBy,
  436. String? repeatDateStr,
  437. String? amount,
  438. String? location,
  439. String? certificate, // 多个逗号隔开
  440. String? challenge25,
  441. String? vehicle, // 多个逗号隔开
  442. String? jobApplyPreId,
  443. String? description,
  444. String? employmentType,
  445. String? eventName,
  446. String? eventType,
  447. String? passengers,
  448. String? estRevenue,
  449. String? position,
  450. String? estCost,
  451. dynamic? attUrl,
  452. String? videoText,
  453. dynamic? videoCover,
  454. dynamic? video,
  455. dynamic? otherImage,
  456. dynamic? otherDocument,
  457. CancelToken? cancelToken,
  458. }) async {
  459. //参数
  460. Map<String, dynamic> params = {};
  461. params['template_id'] = templateId ?? "";
  462. params['job_date'] = jobDate ?? "";
  463. params['start_time'] = jobStart ?? "";
  464. params['end_time'] = jobEnd ?? "";
  465. params['need_num'] = needNum ?? "";
  466. if (!Utils.isEmpty(departmentId)) {
  467. params["co_department_id"] = departmentId!;
  468. }
  469. params['salary_by'] = salaryBy ?? "";
  470. if(!Utils.isEmpty(repeatDateStr)){
  471. params["select"] = repeatDateStr!;
  472. }
  473. if(!Utils.isEmpty(jobApplyPreId)){
  474. params["job_apply_pre_id"] = jobApplyPreId!;
  475. }
  476. if (!Utils.isEmpty(amount)) {
  477. params["amount"] = amount!;
  478. }
  479. if (!Utils.isEmpty(location)) {
  480. params["location"] = location!;
  481. }
  482. if(!Utils.isEmpty(certificate)){
  483. params["certificate"] = certificate!;
  484. }
  485. if(!Utils.isEmpty(challenge25)){
  486. params["challenge_25"] = challenge25!;
  487. }
  488. if(!Utils.isEmpty(vehicle)){
  489. params["vehicle"] = vehicle!;
  490. }
  491. params['description'] = description ?? "";
  492. params['employment_type'] = employmentType ?? "";
  493. params['event_name'] = eventName ?? "";
  494. params['event_type'] = eventType ?? "";
  495. params['passengers'] = passengers ?? "";
  496. params['est_revenue'] = estRevenue ?? "";
  497. params['position'] = position ?? "";
  498. params['est_cost'] = estCost ?? "";
  499. //可能是file 也可能是 url
  500. Map<String, String> filePathParams = {};
  501. // 判断 http 或者 https 开头
  502. if(Utils.isNotEmpty(attUrl)){
  503. if(attUrl!.startsWith("http") || attUrl!.startsWith("https")){
  504. params['att_url'] = attUrl;
  505. }else {
  506. filePathParams['att_url'] = attUrl;
  507. }
  508. }
  509. // 视频部分的参数
  510. params['video_text'] = videoText ?? "";
  511. //可能是file 也可能是 url
  512. // 判断 http 或者 https 开头
  513. if(Utils.isNotEmpty(videoCover)){
  514. if(videoCover!.startsWith("http") || videoCover!.startsWith("https")){
  515. params['video_cover'] = videoCover;
  516. }else {
  517. filePathParams['video_cover'] = videoCover;
  518. }
  519. }
  520. //可能是file 也可能是 url
  521. // 判断 http 或者 https 开头
  522. if(Utils.isNotEmpty(video)){
  523. if(video!.startsWith("http") || video!.startsWith("https")){
  524. params['video'] = video;
  525. }else {
  526. filePathParams['video'] = video;
  527. }
  528. }
  529. //可能是file 也可能是 url
  530. // 判断 http 或者 https 开头
  531. if(Utils.isNotEmpty(otherImage)){
  532. if(otherImage!.startsWith("http") || otherImage!.startsWith("https")){
  533. params['other_image'] = otherImage;
  534. }else {
  535. filePathParams['other_image'] = otherImage;
  536. }
  537. }
  538. //可能是file 也可能是 url
  539. // 判断 http 或者 https 开头
  540. if(Utils.isNotEmpty(otherDocument)){
  541. if(otherDocument!.startsWith("http") || otherDocument!.startsWith("https")){
  542. params['other_document'] = otherDocument;
  543. }else {
  544. filePathParams['other_document'] = otherDocument;
  545. }
  546. }
  547. final result = await httpProvider.requestNetResult(
  548. ApiConstants.apiLabourRequestAddSubmit,
  549. method: HttpMethod.POST,
  550. params: params,
  551. paths: filePathParams,
  552. networkDebounce: true,
  553. isShowLoadingDialog: true,
  554. cancelToken: cancelToken,
  555. );
  556. //根据返回的结果,封装原始数据为Bean/Entity对象
  557. if (result.isSuccess) {
  558. //重新赋值data或list
  559. return result.convert();
  560. }
  561. return result.convert();
  562. }
  563. /// 用工请求 快速复制
  564. Future<HttpResult> quickCopyLabourRequestSubmit(
  565. String? requestId,
  566. // 格式[Y-m-d]
  567. String? jobDate,
  568. //格式[H:m]
  569. String? startTime,
  570. //格式[H:m]
  571. String? endTime,
  572. {
  573. CancelToken? cancelToken,
  574. }) async {
  575. //参数
  576. Map<String, String> params = {};
  577. params['request_id'] = requestId ?? "";
  578. params['job_date'] = jobDate ?? "";
  579. params['start_time'] = startTime ?? "";
  580. params['end_time'] = endTime ?? "";
  581. final result = await httpProvider.requestNetResult(
  582. ApiConstants.apiLabourRequestQuickCopyUK,
  583. method: HttpMethod.POST,
  584. params: params,
  585. networkDebounce: true,
  586. isShowLoadingDialog: true,
  587. cancelToken: cancelToken,
  588. );
  589. //根据返回的结果,封装原始数据为Bean/Entity对象
  590. if (result.isSuccess) {
  591. //重新赋值data或list
  592. return result.convert();
  593. }
  594. return result.convert();
  595. }
  596. /// 获取 labourequest preselected 列表
  597. Future<HttpResult<UkLabourRequestPreselectedListEntity>> fetchLabourRequestPreselectedList(
  598. String reQuestId,
  599. {
  600. required int curPage,
  601. CancelToken? cancelToken,
  602. }) async {
  603. //参数
  604. Map<String, String> params = {};
  605. params["cur_page"] = curPage.toString();
  606. params["page_size"] = "20";
  607. if (!Utils.isEmpty(reQuestId)) {
  608. params["request_id"] = reQuestId;
  609. }
  610. final result = await httpProvider.requestNetResult(
  611. ApiConstants.apiLabourRequestPreSelectListUK,
  612. params: params,
  613. cancelToken: cancelToken,
  614. );
  615. //根据返回的结果,封装原始数据为Bean/Entity对象
  616. if (result.isSuccess) {
  617. //重新赋值data或list
  618. final json = result.getDataJson();
  619. var data = UkLabourRequestPreselectedListEntity.fromJson(json!);
  620. //重新赋值data或list
  621. return result.convert<UkLabourRequestPreselectedListEntity>(data: data);
  622. }
  623. return result.convert();
  624. }
  625. /// 预选人-添加员工的列表
  626. Future<HttpResult<UkLabourRequestPreselectAddstaffListEntity>> fetchtPreselectedAddStaffList(
  627. String? keyword,
  628. String? reQuestId,
  629. String? industryId,
  630. String? skillId,
  631. {
  632. required int curPage,
  633. CancelToken? cancelToken,
  634. }) async {
  635. //参数
  636. Map<String, String> params = {};
  637. params["cur_page"] = curPage.toString();
  638. params["page_size"] = "20";
  639. if (!Utils.isEmpty(keyword)) {
  640. params["keyword"] = keyword!;
  641. }
  642. if (!Utils.isEmpty(reQuestId)) {
  643. params["request_id"] = reQuestId!;
  644. }
  645. if (!Utils.isEmpty(industryId)) {
  646. params["industry_id"] = industryId!;
  647. }
  648. if (!Utils.isEmpty(skillId)) {
  649. params["skill_id"] = skillId!;
  650. }
  651. final result = await httpProvider.requestNetResult(
  652. ApiConstants.apiLabourRequestPreSelectAddStaffListUK,
  653. params: params,
  654. cancelToken: cancelToken,
  655. );
  656. //根据返回的结果,封装原始数据为Bean/Entity对象
  657. if (result.isSuccess) {
  658. //重新赋值data或list
  659. final json = result.getDataJson();
  660. var data = UkLabourRequestPreselectAddstaffListEntity.fromJson(json!);
  661. //重新赋值data或list
  662. return result.convert<UkLabourRequestPreselectAddstaffListEntity>(data: data);
  663. }
  664. return result.convert();
  665. }
  666. //// 添加预选员工
  667. Future<HttpResult> labourRequestPreselectedAddStaffSubmit(
  668. String reQuestId,
  669. String staffIds,
  670. {
  671. CancelToken? cancelToken,
  672. }) async {
  673. //参数
  674. Map<String, String> params = {};
  675. params['request_id'] = reQuestId ?? "";
  676. params['staff_ids'] = staffIds ?? "";
  677. final result = await httpProvider.requestNetResult(
  678. ApiConstants.apiLabourRequestPreSelectAddBatchUK,
  679. method: HttpMethod.POST,
  680. params: params,
  681. networkDebounce: true,
  682. isShowLoadingDialog: true,
  683. cancelToken: cancelToken,
  684. );
  685. //根据返回的结果,封装原始数据为Bean/Entity对象
  686. if (result.isSuccess) {
  687. //重新赋值data或list
  688. return result.convert();
  689. }
  690. return result.convert();
  691. }
  692. /// 删除预选员工
  693. Future<HttpResult> labourRequestPreselectedDelete(
  694. String selectedId,
  695. {
  696. CancelToken? cancelToken,
  697. }) async {
  698. //参数
  699. Map<String, String> params = {};
  700. params['selected_id'] = selectedId ?? "";
  701. final result = await httpProvider.requestNetResult(
  702. ApiConstants.apiLabourRequestPreSelectDeleteUK,
  703. method: HttpMethod.POST,
  704. params: params,
  705. networkDebounce: true,
  706. isShowLoadingDialog: true,
  707. cancelToken: cancelToken,
  708. );
  709. //根据返回的结果,封装原始数据为Bean/Entity对象
  710. if (result.isSuccess) {
  711. //重新赋值data或list
  712. return result.convert();
  713. }
  714. return result.convert();
  715. }
  716. /// labourequest -review ------------
  717. /// 获取用工请求审核的主列表
  718. Future<HttpResult<UkLabourRequestReviewListEntity>> fetchLabourRequestReViewList({
  719. String? keyword,
  720. String? startDate,
  721. String? endDate,
  722. String? departmentId,
  723. required int curPage,
  724. CancelToken? cancelToken,
  725. }) async {
  726. //参数
  727. Map<String, String> params = {};
  728. params["cur_page"] = curPage.toString();
  729. params["page_size"] = "20";
  730. if (!Utils.isEmpty(keyword)) {
  731. params["job_title"] = keyword!;
  732. }
  733. if (!Utils.isEmpty(startDate)) {
  734. params["job_start"] = startDate!;
  735. }
  736. if (!Utils.isEmpty(endDate)) {
  737. params["job_end"] = endDate!;
  738. }
  739. if (!Utils.isEmpty(departmentId)) {
  740. params["co_department_id"] = departmentId!;
  741. }
  742. final result = await httpProvider.requestNetResult(
  743. ApiConstants.apiLabourRequestReViewListUK,
  744. params: params,
  745. cancelToken: cancelToken,
  746. );
  747. //根据返回的结果,封装原始数据为Bean/Entity对象
  748. if (result.isSuccess) {
  749. //重新赋值data或list
  750. final json = result.getDataJson();
  751. var data = UkLabourRequestReviewListEntity.fromJson(json!);
  752. //重新赋值data或list
  753. return result.convert<UkLabourRequestReviewListEntity>(data: data);
  754. }
  755. return result.convert();
  756. }
  757. /// labourrequest -review 批量审核(批量同意/批量拒绝)
  758. Future<HttpResult> labourRequestReviewBatchSubmit(
  759. {
  760. // 多个Record Ids以逗号分隔
  761. String? recordIds,
  762. // 审核类型Type【approve|reject】
  763. String? type,
  764. CancelToken? cancelToken,
  765. }) async {
  766. //参数
  767. Map<String, String> params = {};
  768. params['record_ids'] = recordIds ?? "";
  769. params['type'] = type ?? "";
  770. final result = await httpProvider.requestNetResult(
  771. ApiConstants.apiLabourRequestReViewBatchSubmitUK,
  772. method: HttpMethod.POST,
  773. params: params,
  774. networkDebounce: true,
  775. isShowLoadingDialog: true,
  776. cancelToken: cancelToken,
  777. );
  778. //根据返回的结果,封装原始数据为Bean/Entity对象
  779. if (result.isSuccess) {
  780. //重新赋值data或list
  781. return result.convert();
  782. }
  783. return result.convert();
  784. }
  785. /// 用工审核的审核流程列表
  786. Future<HttpResult<UkLabourReviewStatusEntity>> fetchLabourReviewStatusView(
  787. String? requestId, {
  788. CancelToken? cancelToken,
  789. }) async {
  790. //参数
  791. Map<String, String> params = {};
  792. params['request_id'] = requestId ?? "";
  793. final result = await httpProvider.requestNetResult(
  794. ApiConstants.apiLabourRequestStateWorkFlow,
  795. params: params,
  796. cancelToken: cancelToken,
  797. );
  798. //根据返回的结果,封装原始数据为Bean/Entity对象
  799. if (result.isSuccess) {
  800. //重新赋值data或list
  801. final json = result.getDataJson();
  802. var data = UkLabourReviewStatusEntity.fromJson(json!);
  803. //重新赋值data或list
  804. return result.convert<UkLabourReviewStatusEntity>(data: data);
  805. }
  806. return result.convert();
  807. }
  808. }