uk_job_repository.dart 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028
  1. import 'package:get/get.dart';
  2. import 'package:plugin_platform/http/http_provider.dart';
  3. import 'package:plugin_platform/http/http_result.dart';
  4. import 'package:plugin_platform/platform_export.dart';
  5. import 'package:shared/utils/util.dart';
  6. import '../constants/api_constants.dart';
  7. import '../entity/response/uk_attendance_review_entity.dart';
  8. import '../entity/response/uk_attendance_review_remark_entity.dart';
  9. import '../entity/response/uk_job_applied_revise_add_detail_entity.dart';
  10. import '../entity/response/uk_job_applied_revise_edit_detail_entity.dart';
  11. import '../entity/response/uk_job_applied_revise_info_entity.dart';
  12. import '../entity/response/uk_job_applied_revise_log_entity.dart';
  13. import '../entity/response/uk_job_applied_staff_list_entity.dart';
  14. import '../entity/response/uk_job_list_applied_staff_search_entity.dart';
  15. import '../entity/response/uk_job_list_applied_staff_selectoptions_entity.dart';
  16. import '../entity/response/uk_job_template_detail_by_select_title_entity.dart';
  17. import '../entity/response/uk_report_outlet_entity.dart';
  18. import '../entity/response/uk_staff_detail_entity.dart';
  19. import '../entity/response/uk_staff_labour_history_entity.dart';
  20. import '../entity/response/uk_template_detail_entity.dart';
  21. import '../entity/response/uk_template_detail_index_entity.dart';
  22. import '../entity/response/uk_template_table_entity.dart';
  23. import '../entity/response/uk_template_title_option_entity.dart';
  24. /// UK工作相关数据仓库
  25. class UKJobRepository extends GetxService {
  26. HttpProvider httpProvider;
  27. UKJobRepository({required this.httpProvider});
  28. /// 用工模版中的工作标题列表
  29. Future<HttpResult<UkTemplateTableEntity>> fetchJobTemplateList(
  30. String? keyword, {
  31. required int curPage,
  32. CancelToken? cancelToken,
  33. }) async {
  34. //参数
  35. Map<String, String> params = {};
  36. params["cur_page"] = curPage.toString();
  37. params["page_size"] = "10";
  38. if (!Utils.isEmpty(keyword)) {
  39. params["job_title"] = keyword!;
  40. }
  41. final result = await httpProvider.requestNetResult(
  42. ApiConstants.apiJobTemplateListSG,
  43. params: params,
  44. cancelToken: cancelToken,
  45. );
  46. if (result.isSuccess) {
  47. final json = result.getDataJson();
  48. var data = UkTemplateTableEntity.fromJson(json!);
  49. return result.convert<UkTemplateTableEntity>(data: data);
  50. }
  51. return result.convert();
  52. }
  53. /// 添加用工模版 时详情里面的 数据源
  54. Future<HttpResult<UkTemplateDetailIndexEntity>> fetchJobTemplateIndex({
  55. CancelToken? cancelToken,
  56. }) async {
  57. final result = await httpProvider.requestNetResult(
  58. ApiConstants.apiJobTemplateAddIndexUK,
  59. isShowLoadingDialog: true,
  60. cancelToken: cancelToken,
  61. );
  62. if (result.isSuccess) {
  63. final json = result.getDataJson();
  64. var data = UkTemplateDetailIndexEntity.fromJson(json!);
  65. return result.convert<UkTemplateDetailIndexEntity>(data: data);
  66. }
  67. return result.convert();
  68. }
  69. /// 添加用工模版 时详情里 根据所选template 获取工作标题选项
  70. Future<HttpResult<UkTemplateTitleOptionEntity>> fetchJobTitleOptiosByTemplate(
  71. String templateTitle,
  72. {
  73. CancelToken? cancelToken,
  74. }) async {
  75. Map<String, String> params = {};
  76. params['template_title'] = templateTitle;
  77. final result = await httpProvider.requestNetResult(
  78. ApiConstants.apiJobTemplateTitleOptionsUK,
  79. params: params,
  80. isShowLoadingDialog: true,
  81. cancelToken: cancelToken,
  82. );
  83. if (result.isSuccess) {
  84. final jsonList = result.getListJson();
  85. var list = jsonList?.map((e) {
  86. if (e is Map<String, dynamic>) {
  87. return UkTemplateTitleOptionEntity.fromJson(e);
  88. } else {
  89. return null;
  90. }
  91. }).whereType<UkTemplateTitleOptionEntity>().toList();
  92. return result.convert<UkTemplateTitleOptionEntity>(list: list);
  93. }
  94. return result.convert<UkTemplateTitleOptionEntity>();
  95. }
  96. /// 编辑时获取的用工模版中的详情
  97. Future<HttpResult<UkTemplateDetailEntity>> fetchJobTemplateDetail({
  98. required String? templateId,
  99. CancelToken? cancelToken,
  100. }) async {
  101. Map<String, String> params = {};
  102. params['template_id'] = templateId ?? "";
  103. final result = await httpProvider.requestNetResult(
  104. ApiConstants.apiJobTemplateDetailUK,
  105. params: params,
  106. isShowLoadingDialog: true,
  107. cancelToken: cancelToken,
  108. );
  109. if (result.isSuccess) {
  110. final json = result.getDataJson();
  111. var data = UkTemplateDetailEntity.fromJson(json!);
  112. return result.convert<UkTemplateDetailEntity>(data: data);
  113. }
  114. return result.convert();
  115. }
  116. /// 新增时 选择了 jobtitle 后 获取该title对应的模板详情 用于回显当前title 的模板数据
  117. Future<HttpResult<UkJobTemplateDetailBySelectTitleEntity>> fetchSelectJobTitleGetTemplateDetail({
  118. required String? templateId,
  119. CancelToken? cancelToken,
  120. }) async {
  121. Map<String, String> params = {};
  122. params['template_id'] = templateId ?? "";
  123. final result = await httpProvider.requestNetResult(
  124. ApiConstants.apiJobTemplateDetailBySelectTitleUK,
  125. params: params,
  126. isShowLoadingDialog: true,
  127. cancelToken: cancelToken,
  128. );
  129. if (result.isSuccess) {
  130. final json = result.getDataJson();
  131. var data = UkJobTemplateDetailBySelectTitleEntity.fromJson(json!);
  132. return result.convert<UkJobTemplateDetailBySelectTitleEntity>(data: data);
  133. }
  134. return result.convert();
  135. }
  136. /// 工作模板的添加提交
  137. Future<HttpResult> addJobTemplateSubmit({
  138. required String jobTemplateId ,
  139. required String jobTitle,
  140. String? clientName,
  141. List<String>? certificate,
  142. List<String>? vehicle,
  143. String? challenge25, // 1.yes,0.no
  144. String? note,
  145. String? desc,
  146. String? contactName,
  147. String? contactNo,
  148. CancelToken? cancelToken,
  149. }) async {
  150. //参数
  151. Map<String, dynamic> params = {};
  152. params['job_template_id'] = jobTemplateId;
  153. params['job_title'] = jobTitle;
  154. if (Utils.isNotEmpty(clientName)) {
  155. params['client_name'] = clientName ?? "";
  156. }
  157. if (certificate != null && certificate.isNotEmpty) {
  158. params['certificate[]'] = certificate;
  159. }
  160. if (vehicle != null && vehicle.isNotEmpty) {
  161. params['vehicle[]'] = vehicle;
  162. }
  163. if (Utils.isNotEmpty(challenge25)) {
  164. params['challenge_25'] = challenge25 ?? "";
  165. }
  166. if (Utils.isNotEmpty(note)) {
  167. params['note'] = note ?? "";
  168. }
  169. if (Utils.isNotEmpty(contactName)) {
  170. params['contact_name'] = contactName ?? "";
  171. }
  172. if (Utils.isNotEmpty(contactNo)) {
  173. params['contact_no'] = contactNo ?? "";
  174. }
  175. if (Utils.isNotEmpty(desc)) {
  176. params['description'] = desc ?? "";
  177. }
  178. final result = await httpProvider.requestNetResult(
  179. ApiConstants.apiJobTemplateAddSubmitSG,
  180. method: HttpMethod.POST,
  181. params: params,
  182. networkDebounce: true,
  183. isShowLoadingDialog: true,
  184. cancelToken: cancelToken,
  185. );
  186. if (result.isSuccess) {
  187. return result.convert();
  188. }
  189. return result.convert();
  190. }
  191. /// 工作模板的编辑提交
  192. Future<HttpResult> editJobTemplateSubmit({
  193. required String templateId,
  194. required String jobTemplateId,
  195. required String jobTitle,
  196. String? clientName,
  197. List<String>? certificate,
  198. List<String>? vehicle,
  199. String? challenge25, // 1 yse 0 no
  200. String? note,
  201. String? desc,
  202. String? contactName,
  203. String? contactNo,
  204. CancelToken? cancelToken,
  205. }) async {
  206. //参数
  207. Map<String, dynamic> params = {};
  208. params['job_title'] = jobTitle;
  209. params['template_id'] = templateId;
  210. params['job_template_id'] = jobTemplateId;
  211. if (Utils.isNotEmpty(clientName)) {
  212. params['client_name'] = clientName ?? "";
  213. }
  214. if (certificate != null && certificate.isNotEmpty) {
  215. params['certificate[]'] = certificate;
  216. }
  217. if (vehicle != null && vehicle.isNotEmpty) {
  218. params['vehicle[]'] = vehicle;
  219. }
  220. if (Utils.isNotEmpty(challenge25)) {
  221. params['challenge_25'] = challenge25 ?? "";
  222. }
  223. if (Utils.isNotEmpty(note)) {
  224. params['note'] = note ?? "";
  225. }
  226. if (Utils.isNotEmpty(contactName)) {
  227. params['contact_name'] = contactName ?? "";
  228. }
  229. if (Utils.isNotEmpty(contactNo)) {
  230. params['contact_no'] = contactNo ?? "";
  231. }
  232. if (Utils.isNotEmpty(desc)) {
  233. params['description'] = desc ?? "";
  234. }
  235. final result = await httpProvider.requestNetResult(
  236. ApiConstants.apiJobTemplateEditSubmitSG,
  237. method: HttpMethod.POST,
  238. params: params,
  239. networkDebounce: true,
  240. isShowLoadingDialog: true,
  241. cancelToken: cancelToken,
  242. );
  243. if (result.isSuccess) {
  244. return result.convert();
  245. }
  246. return result.convert();
  247. }
  248. ///工作模板的删除
  249. Future<HttpResult> deleteJobTemplate({
  250. required String? templateId,
  251. CancelToken? cancelToken,
  252. }) async {
  253. //参数
  254. Map<String, String> params = {};
  255. params['template_id'] = templateId ?? "";
  256. final result = await httpProvider.requestNetResult(
  257. ApiConstants.apiJobTemplateDeleteSG,
  258. method: HttpMethod.POST,
  259. params: params,
  260. networkDebounce: true,
  261. isShowLoadingDialog: true,
  262. cancelToken: cancelToken,
  263. );
  264. if (result.isSuccess) {
  265. return result.convert();
  266. }
  267. return result.convert();
  268. }
  269. /// 添加用工请求发布
  270. Future<HttpResult> addLabourRequestSubmit({
  271. required String? templateId,
  272. required String? jobDate,
  273. required String? startTime,
  274. required String? endTime,
  275. required String? departmentId,
  276. required String? needNum,
  277. required String? salaryBy,
  278. String? amount,
  279. String? repeatDate,
  280. CancelToken? cancelToken,
  281. }) async {
  282. //参数
  283. Map<String, String> params = {};
  284. params['template_id'] = templateId ?? "";
  285. params['job_date'] = jobDate ?? "";
  286. params['start_time'] = startTime ?? "";
  287. params['end_time'] = endTime ?? "";
  288. params['need_num'] = needNum ?? "";
  289. params['salary_by'] = salaryBy ?? "";
  290. if (!Utils.isEmpty(departmentId)) {
  291. params["co_department_id"] = departmentId!;
  292. }
  293. if (!Utils.isEmpty(amount)) {
  294. params["amount"] = amount!;
  295. }
  296. if (!Utils.isEmpty(repeatDate)) {
  297. params["select"] = repeatDate!;
  298. }
  299. final result = await httpProvider.requestNetResult(
  300. ApiConstants.apiLabourRequestAddSubmit,
  301. method: HttpMethod.POST,
  302. params: params,
  303. networkDebounce: true,
  304. isShowLoadingDialog: true,
  305. cancelToken: cancelToken,
  306. );
  307. //根据返回的结果,封装原始数据为Bean/Entity对象
  308. if (result.isSuccess) {
  309. //重新赋值data或list
  310. return result.convert();
  311. }
  312. return result.convert();
  313. }
  314. // job-list ------------
  315. /// 工作中已申请的成员列表
  316. Future<HttpResult<UkJobAppliedStaffListEntity>> fetchJobAppliedStaffs(
  317. String? jobId,
  318. String? staffName, {
  319. String? appliedId,
  320. required int curPage,
  321. CancelToken? cancelToken,
  322. }) async {
  323. //参数
  324. Map<String, String> params = {};
  325. params["cur_page"] = curPage.toString();
  326. params["page_size"] = "10";
  327. if (!Utils.isEmpty(jobId)) {
  328. params["job_id"] = jobId!;
  329. }
  330. if (!Utils.isEmpty(appliedId)) {
  331. params["applied_id"] = appliedId!;
  332. }
  333. if (!Utils.isEmpty(staffName)) {
  334. params["staff_name"] = staffName!;
  335. }
  336. final result = await httpProvider.requestNetResult(
  337. ApiConstants.apiJobListAppliedStaffList,
  338. params: params,
  339. cancelToken: cancelToken,
  340. );
  341. //根据返回的结果,封装原始数据为Bean/Entity对象
  342. if (result.isSuccess) {
  343. //重新赋值data或list
  344. final json = result.getDataJson();
  345. var data = UkJobAppliedStaffListEntity.fromJson(json!);
  346. //重新赋值data或list
  347. return result.convert<UkJobAppliedStaffListEntity>(data: data);
  348. }
  349. return result.convert();
  350. }
  351. /// 根据ID获取主列表的Item数据,用于刷新Item
  352. Future<HttpResult<UkJobAppliedStaffListEntity>> fetchItemByAppliedIds(
  353. String? jobId,
  354. String? appliedIds, {
  355. CancelToken? cancelToken,
  356. }) async {
  357. //参数
  358. Map<String, String> params = {};
  359. params["cur_page"] = "1";
  360. params["page_size"] = "9999";
  361. if (!Utils.isEmpty(appliedIds)) {
  362. params["applied_ids"] = appliedIds!;
  363. }
  364. if (!Utils.isEmpty(jobId)) {
  365. params["job_id"] = jobId!;
  366. }
  367. final result = await httpProvider.requestNetResult(
  368. ApiConstants.apiJobListAppliedStaffList,
  369. params: params,
  370. isShowLoadingDialog: true,
  371. cancelToken: cancelToken,
  372. );
  373. //根据返回的结果,封装原始数据为Bean/Entity对象
  374. if (result.isSuccess) {
  375. //重新赋值data或list
  376. final json = result.getDataJson();
  377. var data = UkJobAppliedStaffListEntity.fromJson(json!);
  378. //重新赋值data或list
  379. return result.convert<UkJobAppliedStaffListEntity>(data: data);
  380. }
  381. return result.convert();
  382. }
  383. /// 设置小费
  384. Future<HttpResult> appliedStaffBatchSetTipSubmit(
  385. {
  386. // 多个applied_ids 以逗号分隔
  387. String? appliedIds ,
  388. // 设置小费
  389. String? gratuity,
  390. CancelToken? cancelToken,
  391. }) async {
  392. //参数
  393. Map<String, String> params = {};
  394. params['applied_ids'] = appliedIds ?? "";
  395. params['gratuity'] = gratuity ?? "";
  396. final result = await httpProvider.requestNetResult(
  397. ApiConstants.apiAppliedStaffBatchSetTipUK,
  398. method: HttpMethod.POST,
  399. params: params,
  400. networkDebounce: true,
  401. isShowLoadingDialog: true,
  402. cancelToken: cancelToken,
  403. );
  404. //根据返回的结果,封装原始数据为Bean/Entity对象
  405. if (result.isSuccess) {
  406. //重新赋值data或list
  407. return result.convert();
  408. }
  409. return result.convert();
  410. }
  411. /// 获取 添加员工 时的 industry options
  412. Future<HttpResult<UkJobListAppliedStaffSelectoptionsEntity>> fetchAddStaffIndustryOptions(
  413. {
  414. CancelToken? cancelToken,
  415. }
  416. ) async {
  417. //参数
  418. Map<String, String> params = {};
  419. final result = await httpProvider.requestNetResult(
  420. ApiConstants.apiAppliedStaffIndustryListUK,
  421. params: params,
  422. cancelToken: cancelToken,
  423. );
  424. //根据返回的结果,封装原始数据为Bean/Entity对象
  425. if (result.isSuccess) {
  426. //重新赋值data或list
  427. final listJson = result.getListJson();
  428. var list = listJson
  429. ?.map((e) => UkJobListAppliedStaffSelectoptionsEntity.fromJson(e as Map<String, dynamic>))
  430. .toList();
  431. //重新赋值data或list
  432. return result.convert<UkJobListAppliedStaffSelectoptionsEntity>(list: list);
  433. }
  434. return result.convert();
  435. }
  436. /// 获取 添加员工 时根据 industry id 获取jobtitle options
  437. Future<HttpResult<UkJobListAppliedStaffSelectoptionsEntity>> fetchAddStaffJobTitleOptions(
  438. String industryId,
  439. {
  440. CancelToken? cancelToken,
  441. }
  442. ) async {
  443. //参数
  444. Map<String, String> params = {};
  445. params["industry_id"] = industryId;
  446. final result = await httpProvider.requestNetResult(
  447. ApiConstants.apiAppliedStaffJobTitleListUK,
  448. params: params,
  449. cancelToken: cancelToken,
  450. );
  451. //根据返回的结果,封装原始数据为Bean/Entity对象
  452. if (result.isSuccess) {
  453. //重新赋值data或list
  454. final listJson = result.getListJson();
  455. var list = listJson
  456. ?.map((e) => UkJobListAppliedStaffSelectoptionsEntity.fromJson(e as Map<String, dynamic>))
  457. .toList();
  458. //重新赋值data或list
  459. return result.convert<UkJobListAppliedStaffSelectoptionsEntity>(list: list);
  460. }
  461. return result.convert();
  462. }
  463. /// 添加员工的全部员工数据列表
  464. Future<HttpResult<UkJobListAppliedStaffSearchEntity>> searchStaffList(
  465. String? jobId,
  466. String? keyword,
  467. String? industryId,
  468. String? skillId,
  469. {
  470. required int curPage,
  471. CancelToken? cancelToken,
  472. }) async {
  473. //参数
  474. Map<String, String> params = {};
  475. params["cur_page"] = curPage.toString();
  476. params["page_size"] = "10";
  477. if (!Utils.isEmpty(jobId)) {
  478. params["job_id"] = jobId!;
  479. }
  480. if (!Utils.isEmpty(keyword)) {
  481. params["keyword"] = keyword!;
  482. }
  483. if (!Utils.isEmpty(industryId)) {
  484. params["industry_id"] = industryId!;
  485. }
  486. if (!Utils.isEmpty(skillId)) {
  487. params["skill_id"] = skillId!;
  488. }
  489. final result = await httpProvider.requestNetResult(
  490. ApiConstants.apiJobListAppliedStaffSearch,
  491. params: params,
  492. cancelToken: cancelToken,
  493. );
  494. //根据返回的结果,封装原始数据为Bean/Entity对象
  495. if (result.isSuccess) {
  496. //重新赋值data或list
  497. final json = result.getDataJson();
  498. var data = UkJobListAppliedStaffSearchEntity.fromJson(json!);
  499. //重新赋值data或list
  500. return result.convert<UkJobListAppliedStaffSearchEntity>(data: data);
  501. }
  502. return result.convert();
  503. }
  504. /// 添加员工 时 给员工 打标记
  505. Future<HttpResult> staffSetFavourite(
  506. String? memberId,
  507. String? isFavourite, {
  508. CancelToken? cancelToken,
  509. }) async {
  510. //参数
  511. Map<String, String> params = {};
  512. if (!Utils.isEmpty(memberId)) {
  513. params["member_id"] = memberId!;
  514. }
  515. if (!Utils.isEmpty(isFavourite)) {
  516. params["is_favourite"] = isFavourite!;
  517. }
  518. final result = await httpProvider.requestNetResult(
  519. ApiConstants.apiAppliedStaffSetFavouriteUK,
  520. method: HttpMethod.POST,
  521. params: params,
  522. cancelToken: cancelToken,
  523. );
  524. //根据返回的结果,封装原始数据为Bean/Entity对象
  525. if (result.isSuccess) {
  526. //重新赋值data或list
  527. return result.convert();
  528. }
  529. return result.convert();
  530. }
  531. /// 获取revise 列表
  532. Future<HttpResult<UkJobAppliedReviseInfoEntity>> fetchJobAppliedReviseList(
  533. {
  534. String? appliedId,
  535. required int curPage,
  536. CancelToken? cancelToken,
  537. }) async {
  538. //参数
  539. Map<String, String> params = {};
  540. params["cur_page"] = curPage.toString();
  541. params["page_size"] = "10";
  542. if (!Utils.isEmpty(appliedId)) {
  543. params["applied_id"] = appliedId!;
  544. }
  545. final result = await httpProvider.requestNetResult(
  546. ApiConstants.apiAppliedStaffReviseListUK,
  547. params: params,
  548. cancelToken: cancelToken,
  549. );
  550. //根据返回的结果,封装原始数据为Bean/Entity对象
  551. if (result.isSuccess) {
  552. //重新赋值data或list
  553. final json = result.getDataJson();
  554. var data = UkJobAppliedReviseInfoEntity.fromJson(json!);
  555. //重新赋值data或list
  556. return result.convert<UkJobAppliedReviseInfoEntity>(data: data);
  557. }
  558. return result.convert();
  559. }
  560. /// 根据ID获取主列表的Item数据,用于刷新Item
  561. Future<HttpResult<UkJobAppliedReviseInfoEntity>> fetchJobAppliedReviseListById(
  562. {
  563. String? appliedId,
  564. CancelToken? cancelToken,
  565. }) async {
  566. //参数
  567. Map<String, String> params = {};
  568. params["cur_page"] = "1";
  569. params["page_size"] = "9999";
  570. if (!Utils.isEmpty(appliedId)) {
  571. params["applied_id"] = appliedId!;
  572. }
  573. final result = await httpProvider.requestNetResult(
  574. ApiConstants.apiAppliedStaffReviseListUK,
  575. params: params,
  576. isShowLoadingDialog: true,
  577. cancelToken: cancelToken,
  578. );
  579. //根据返回的结果,封装原始数据为Bean/Entity对象
  580. if (result.isSuccess) {
  581. //重新赋值data或list
  582. final json = result.getDataJson();
  583. var data = UkJobAppliedReviseInfoEntity.fromJson(json!);
  584. //重新赋值data或list
  585. return result.convert<UkJobAppliedReviseInfoEntity>(data: data);
  586. }
  587. return result.convert();
  588. }
  589. /// revise add 时 获取详情
  590. Future<HttpResult<UkJobAppliedReviseEditDetailEntity>> fetchAddReviseDetailInfo(
  591. {
  592. String? appliedId,
  593. CancelToken? cancelToken,
  594. }) async {
  595. //参数
  596. Map<String, String> params = {};
  597. if (!Utils.isEmpty(appliedId)) {
  598. params["applied_id"] = appliedId!;
  599. }
  600. final result = await httpProvider.requestNetResult(
  601. ApiConstants.apiAppliedStaffReviseAddUK,
  602. params: params,
  603. cancelToken: cancelToken,
  604. );
  605. //根据返回的结果,封装原始数据为Bean/Entity对象
  606. if (result.isSuccess) {
  607. //重新赋值data或list
  608. final json = result.getDataJson();
  609. var data = UkJobAppliedReviseEditDetailEntity.fromJson(json!);
  610. //重新赋值data或list
  611. return result.convert<UkJobAppliedReviseEditDetailEntity>(data: data);
  612. }
  613. return result.convert();
  614. }
  615. /// revise edit 时 获取详情
  616. Future<HttpResult<UkJobAppliedReviseEditDetailEntity>> fetchEditReviseDetailInfo(
  617. {
  618. String? reviseId,
  619. CancelToken? cancelToken,
  620. }) async {
  621. //参数
  622. Map<String, String> params = {};
  623. if (!Utils.isEmpty(reviseId)) {
  624. params["revise_id"] = reviseId!;
  625. }
  626. final result = await httpProvider.requestNetResult(
  627. ApiConstants.apiAppliedStaffReviseEditUK,
  628. params: params,
  629. cancelToken: cancelToken,
  630. );
  631. //根据返回的结果,封装原始数据为Bean/Entity对象
  632. if (result.isSuccess) {
  633. //重新赋值data或list
  634. final json = result.getDataJson();
  635. var data = UkJobAppliedReviseEditDetailEntity.fromJson(json!);
  636. //重新赋值data或list
  637. return result.convert<UkJobAppliedReviseEditDetailEntity>(data: data);
  638. }
  639. return result.convert();
  640. }
  641. /// revise add 提交
  642. Future<HttpResult> reviseAddSubmit(
  643. {
  644. String? appliedId,
  645. String? reviseHours,
  646. String? reason,
  647. CancelToken? cancelToken,
  648. }) async {
  649. //参数
  650. Map<String, String> params = {};
  651. params['applied_id'] = appliedId ?? "";
  652. params['revise_hours'] = reviseHours ?? "";
  653. params['reason'] = reason ?? "";
  654. final result = await httpProvider.requestNetResult(
  655. ApiConstants.apiAppliedStaffReviseAddSubmitUK,
  656. method: HttpMethod.POST,
  657. params: params,
  658. networkDebounce: true,
  659. isShowLoadingDialog: true,
  660. cancelToken: cancelToken,
  661. );
  662. //根据返回的结果,封装原始数据为Bean/Entity对象
  663. if (result.isSuccess) {
  664. //重新赋值data或list
  665. return result.convert();
  666. }
  667. return result.convert();
  668. }
  669. /// revise edit 提交
  670. Future<HttpResult> reviseEditSubmit(
  671. {
  672. String? reviseId,
  673. String? reviseHours,
  674. String? reason,
  675. CancelToken? cancelToken,
  676. }) async {
  677. //参数
  678. Map<String, String> params = {};
  679. params['revise_id'] = reviseId ?? "";
  680. params['revise_hours'] = reviseHours ?? "";
  681. params['reason'] = reason ?? "";
  682. final result = await httpProvider.requestNetResult(
  683. ApiConstants.apiAppliedStaffReviseEditSubmitUK,
  684. method: HttpMethod.POST,
  685. params: params,
  686. networkDebounce: true,
  687. isShowLoadingDialog: true,
  688. cancelToken: cancelToken,
  689. );
  690. //根据返回的结果,封装原始数据为Bean/Entity对象
  691. if (result.isSuccess) {
  692. //重新赋值data或list
  693. return result.convert();
  694. }
  695. return result.convert();
  696. }
  697. /// revise recall
  698. Future<HttpResult> reviseRecall(
  699. {
  700. String? reviseId,
  701. CancelToken? cancelToken,
  702. }) async {
  703. //参数
  704. Map<String, String> params = {};
  705. params['revise_id'] = reviseId ?? "";
  706. final result = await httpProvider.requestNetResult(
  707. ApiConstants.apiAppliedStaffReviseRecallUK,
  708. method: HttpMethod.POST,
  709. params: params,
  710. networkDebounce: true,
  711. isShowLoadingDialog: true,
  712. cancelToken: cancelToken,
  713. );
  714. //根据返回的结果,封装原始数据为Bean/Entity对象
  715. if (result.isSuccess) {
  716. //重新赋值data或list
  717. return result.convert();
  718. }
  719. return result.convert();
  720. }
  721. /// revise delete
  722. Future<HttpResult> reviseDelete(
  723. {
  724. String? reviseId,
  725. CancelToken? cancelToken,
  726. }) async {
  727. //参数
  728. Map<String, String> params = {};
  729. params['revise_id'] = reviseId ?? "";
  730. final result = await httpProvider.requestNetResult(
  731. ApiConstants.apiAppliedStaffReviseDeleteUK,
  732. method: HttpMethod.POST,
  733. params: params,
  734. networkDebounce: true,
  735. isShowLoadingDialog: true,
  736. cancelToken: cancelToken,
  737. );
  738. //根据返回的结果,封装原始数据为Bean/Entity对象
  739. if (result.isSuccess) {
  740. //重新赋值data或list
  741. return result.convert();
  742. }
  743. return result.convert();
  744. }
  745. /// revise logs
  746. Future<HttpResult<UkJobAppliedReviseLogEntity>> featchReviseLogs(
  747. {
  748. String? reviseId,
  749. CancelToken? cancelToken,
  750. }) async {
  751. //参数
  752. Map<String, String> params = {};
  753. params['revise_id'] = reviseId ?? "";
  754. final result = await httpProvider.requestNetResult(
  755. ApiConstants.apiAppliedStaffReviseLogsUK,
  756. method: HttpMethod.GET,
  757. params: params,
  758. networkDebounce: true,
  759. isShowLoadingDialog: true,
  760. cancelToken: cancelToken,
  761. );
  762. //根据返回的结果,封装原始数据为Bean/Entity对象
  763. if (result.isSuccess) {
  764. //重新赋值data或list
  765. final json = result.getDataJson();
  766. var data = UkJobAppliedReviseLogEntity.fromJson(json!);
  767. //重新赋值data或list
  768. return result.convert<UkJobAppliedReviseLogEntity>(data: data);
  769. }
  770. return result.convert();
  771. }
  772. // -------staff-------
  773. // 员工的信息
  774. Future<HttpResult<UkStaffDetailEntity>> fetchStaffDetail(
  775. String? memberId, {
  776. CancelToken? cancelToken,
  777. }) async {
  778. //参数
  779. Map<String, String> params = {};
  780. if (!Utils.isEmpty(memberId)) {
  781. params["member_id"] = memberId!;
  782. }
  783. final result = await httpProvider.requestNetResult(
  784. ApiConstants.apiStaffDetailUK,
  785. params: params,
  786. cancelToken: cancelToken,
  787. );
  788. //根据返回的结果,封装原始数据为Bean/Entity对象
  789. if (result.isSuccess) {
  790. //重新赋值data或list
  791. final json = result.getDataJson();
  792. var data = UkStaffDetailEntity.fromJson(json!);
  793. //重新赋值data或list
  794. return result.convert<UkStaffDetailEntity>(data: data);
  795. }
  796. return result.convert();
  797. }
  798. // 员工的历史申请记录
  799. Future<HttpResult<UkStaffLabourHistoryEntity>> fetchStaffLabourHistory(
  800. String? memberId,
  801. String? keyword, {
  802. required int curPage,
  803. CancelToken? cancelToken,
  804. }) async {
  805. //参数
  806. Map<String, String> params = {};
  807. params["cur_page"] = curPage.toString();
  808. params["page_size"] = "10";
  809. if (!Utils.isEmpty(memberId)) {
  810. params["member_id"] = memberId!;
  811. }
  812. if (!Utils.isEmpty(keyword)) {
  813. params["keyword"] = keyword!;
  814. }
  815. final result = await httpProvider.requestNetResult(
  816. ApiConstants.apiStaffLabourHistoryUK,
  817. params: params,
  818. cancelToken: cancelToken,
  819. );
  820. //根据返回的结果,封装原始数据为Bean/Entity对象
  821. if (result.isSuccess) {
  822. //重新赋值data或list
  823. final json = result.getDataJson();
  824. var data = UkStaffLabourHistoryEntity.fromJson(json!);
  825. //重新赋值data或list
  826. return result.convert<UkStaffLabourHistoryEntity>(data: data);
  827. }
  828. return result.convert();
  829. }
  830. // --------attentance review---------
  831. /// 考勤审核列表
  832. Future<HttpResult<UkAttendanceReviewEntity>> fetchAttendanceReviewList(
  833. String? keyword, {
  834. required int curPage,
  835. CancelToken? cancelToken,
  836. }) async {
  837. //参数
  838. Map<String, String> params = {};
  839. params["cur_page"] = curPage.toString();
  840. params["page_size"] = "20";
  841. if (!Utils.isEmpty(keyword)) {
  842. params["job_title"] = keyword!;
  843. }
  844. final result = await httpProvider.requestNetResult(
  845. ApiConstants.apiAttendanceReviewTableUK,
  846. params: params,
  847. cancelToken: cancelToken,
  848. );
  849. //根据返回的结果,封装原始数据为Bean/Entity对象
  850. if (result.isSuccess) {
  851. //重新赋值data或list
  852. final json = result.getDataJson();
  853. var data = UkAttendanceReviewEntity.fromJson(json!);
  854. //重新赋值data或list
  855. return result.convert<UkAttendanceReviewEntity>(data: data);
  856. }
  857. return result.convert();
  858. }
  859. // attendance review 获取Remarks 考勤的批量备注
  860. Future<HttpResult<UkAttendanceReviewRemarkEntity>> fetchAttendanceReviewRemarkInfo(
  861. String? appliedId, {
  862. CancelToken? cancelToken,
  863. }) async {
  864. //参数
  865. Map<String, String> params = {};
  866. if (!Utils.isEmpty(appliedId)) {
  867. params["applied_id"] = appliedId!;
  868. }
  869. final result = await httpProvider.requestNetResult(
  870. ApiConstants.apiAttendanceReviewRemarksUK,
  871. params: params,
  872. cancelToken: cancelToken,
  873. );
  874. //根据返回的结果,封装原始数据为Bean/Entity对象
  875. if (result.isSuccess) {
  876. //重新赋值data或list
  877. final json = result.getDataJson();
  878. var data = UkAttendanceReviewRemarkEntity.fromJson(json!);
  879. //重新赋值data或list
  880. return result.convert<UkAttendanceReviewRemarkEntity>(data: data);
  881. }
  882. return result.convert();
  883. }
  884. /// 考勤的批量同意/批量拒绝
  885. Future<HttpResult> attendanceReviewsBatchSubmit(
  886. String? recordIds,
  887. String? type, //审核类型Type【approve|reject】
  888. String? auditMark, // 拒绝原因
  889. {
  890. CancelToken? cancelToken,
  891. }) async {
  892. //参数
  893. Map<String, String> params = {};
  894. params['record_ids'] = recordIds ?? "";
  895. params['type'] = type ?? "";
  896. params['audit_mark'] = auditMark ?? "";
  897. final result = await httpProvider.requestNetResult(
  898. ApiConstants.apiAttendanceReviewBatchSubmitUK,
  899. method: HttpMethod.POST,
  900. params: params,
  901. networkDebounce: true,
  902. isShowLoadingDialog: true,
  903. cancelToken: cancelToken,
  904. );
  905. //根据返回的结果,封装原始数据为Bean/Entity对象
  906. if (result.isSuccess) {
  907. //重新赋值data或list
  908. return result.convert();
  909. }
  910. return result.convert();
  911. }
  912. }