index.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720
  1. import { get, put, putJ, postJ } from "@/utils/request";
  2. import Vue from "vue";
  3. //获取我的消息列表
  4. export async function notifyMessagePageAPI(params, loding = true) {
  5. const res = await postJ(
  6. Vue.prototype.apiUrl + `/sys/notifymessage/page`,
  7. params,
  8. loding,
  9. );
  10. if (res.code == 0) {
  11. return res.data;
  12. }
  13. return Promise.reject(new Error(res.message));
  14. }
  15. //更新已读-指定消息ID
  16. export async function updateNotifyMessageReadByIdAPI(params, loding = true) {
  17. const res = await postJ(
  18. Vue.prototype.apiUrl + `/sys/notifymessage/updateNotifyMessageRead`,
  19. params,
  20. loding,
  21. );
  22. if (res.code == 0) {
  23. return res.data;
  24. }
  25. return Promise.reject(new Error(res.message));
  26. }
  27. //获取某用户的未读消息条数
  28. export async function getUnreadNotifyMessageCountAPI() {
  29. const res = await get(
  30. Vue.prototype.apiUrl + `/sys/notifymessage/getUnreadNotifyMessageCount`,
  31. "",
  32. false,
  33. );
  34. if (res.code == 0) {
  35. return res.data;
  36. }
  37. return Promise.reject(new Error(res.message));
  38. }
  39. //获取待办事项列表
  40. export async function getTodoTaskPage(query, loding = true) {
  41. const res = await postJ(
  42. Vue.prototype.apiUrl + `/bpm/task/todo-page`,
  43. query,
  44. loding,
  45. );
  46. if (res.code == 0) {
  47. return res.data;
  48. }
  49. return Promise.reject(new Error(res.message));
  50. }
  51. export async function getTodoList(query, loding = true) {
  52. const res = await postJ(
  53. Vue.prototype.apiUrl + `/bpm/task/todo-page`,
  54. query,
  55. loding,
  56. );
  57. if (res.code == 0) {
  58. return res.data;
  59. }
  60. return Promise.reject(new Error(res.message));
  61. }
  62. export async function rejectTask(data) {
  63. const res = await putJ(Vue.prototype.apiUrl + `/bpm/task/reject`, data, true);
  64. if (res.code == 0) {
  65. return res.data;
  66. }
  67. return Promise.reject(new Error(res.message));
  68. }
  69. // 作废
  70. export async function cancelTask(data) {
  71. const res = await postJ(
  72. Vue.prototype.apiUrl + `/bpm/process-instance/cancel`,
  73. data,
  74. );
  75. if (res.code == 0) {
  76. return res.data;
  77. }
  78. return Promise.reject(new Error(res.message));
  79. }
  80. //获取已办事项列表
  81. export async function getDoneTaskPage(query) {
  82. const res = await get(
  83. Vue.prototype.apiUrl + `/bpm/task/done-page`,
  84. query,
  85. true,
  86. );
  87. if (res.code == 0) {
  88. return res.data;
  89. }
  90. return Promise.reject(new Error(res.message));
  91. }
  92. //获取已办事项列表
  93. export async function getDoneTaskList(query) {
  94. const res = await postJ(
  95. Vue.prototype.apiUrl + `/bpm/task/done-page`,
  96. query,
  97. true,
  98. );
  99. if (res.code == 0) {
  100. return res.data;
  101. }
  102. return Promise.reject(new Error(res.message));
  103. }
  104. //获取流程详情
  105. export async function getTaskListByProcessinstanceid(query) {
  106. const res = await get(
  107. Vue.prototype.apiUrl + `/bpm/task/list-by-process-instance-id`,
  108. query,
  109. true,
  110. );
  111. if (res.code == 0) {
  112. return res.data;
  113. }
  114. return Promise.reject(new Error(res.message));
  115. }
  116. //获取流程任务实例
  117. export async function getProcessInstance(id) {
  118. const res = await get(
  119. Vue.prototype.apiUrl + `/bpm/process-instance/get`,
  120. id,
  121. true,
  122. );
  123. if (res.code == 0) {
  124. return res.data;
  125. }
  126. return Promise.reject(new Error(res.message));
  127. }
  128. export async function getTaskListByProcessInstanceId(processInstanceId) {
  129. const res = await get(
  130. Vue.prototype.apiUrl + `/bpm/task/list-by-process-instance-id`,
  131. processInstanceId,
  132. true,
  133. );
  134. if (res.code == 0) {
  135. return res.data;
  136. }
  137. return Promise.reject(new Error(res.message));
  138. }
  139. // 通用流程审核接口
  140. export async function approveTaskWithVariables(data) {
  141. const res = await putJ(
  142. Vue.prototype.apiUrl + `/bpm/task/approveTaskWithVariables`,
  143. data,
  144. true,
  145. );
  146. if (res.code == 0) {
  147. return res.data;
  148. }
  149. return Promise.reject(new Error(res.message));
  150. }
  151. /**
  152. *销售退货审批流程审核接口
  153. */
  154. export async function approveTaskSalesOrderReturn(params) {
  155. const res = await postJ(
  156. Vue.prototype.apiUrl + `/bpm/salesOrderReturnApprove/approve`,
  157. params,
  158. true,
  159. );
  160. if (res.code == 0) {
  161. return res;
  162. }
  163. return Promise.reject(new Error(res.message));
  164. }
  165. //费用申请
  166. // 编辑
  167. export async function feeApplyUpdateAPI(data) {
  168. const res = await putJ(
  169. Vue.prototype.apiUrl + `/eom/finfeeapply/update`,
  170. data,
  171. true,
  172. );
  173. if (res.code == 0) {
  174. return res.data;
  175. }
  176. return Promise.reject(new Error(res.message));
  177. }
  178. // 信息
  179. export async function getFeeApplyInfoAPI(id) {
  180. const res = await get(
  181. Vue.prototype.apiUrl + `/eom/finfeeapply/getById/${id}`,
  182. {},
  183. true,
  184. );
  185. if (res.code == 0) {
  186. return res.data;
  187. }
  188. return Promise.reject(new Error(res.message));
  189. }
  190. //
  191. //
  192. //
  193. //销售合同
  194. /**
  195. * 获取信息详情
  196. */
  197. export async function getDetail(id) {
  198. const res = await get(
  199. Vue.prototype.apiUrl + `/eom/contract/getById/${id}`,
  200. {},
  201. true,
  202. );
  203. if (res.code == 0) {
  204. return res.data;
  205. }
  206. return Promise.reject(new Error(res.message));
  207. }
  208. //
  209. //
  210. //
  211. //
  212. //客户申请
  213. /**
  214. * 客户申请列表
  215. */
  216. export async function contactApplyList(id) {
  217. const res = await get(
  218. Vue.prototype.apiUrl + `/eom/contactlistapply/getById/${id}`,
  219. {},
  220. true,
  221. );
  222. if (res.code == 0) {
  223. return res.data;
  224. }
  225. return Promise.reject(new Error(res.message));
  226. }
  227. //
  228. //
  229. //
  230. //
  231. //商机管理
  232. /**
  233. * /商机管理-获取信息详情
  234. */
  235. export async function getBusinessOpportunityDetailAPI(id) {
  236. const res = await get(
  237. Vue.prototype.apiUrl + `/eom/businessopportunity/getById/${id}`,
  238. {},
  239. true,
  240. );
  241. if (res.code == 0) {
  242. return res.data;
  243. }
  244. return Promise.reject(new Error(res.message));
  245. }
  246. /**
  247. * 更新信息
  248. */
  249. export async function businessOpportunityUpdateAPI(data) {
  250. const res = await postJ(
  251. Vue.prototype.apiUrl + `/eom/businessopportunity/updateProduct`,
  252. data,
  253. true,
  254. );
  255. if (res.code == 0) {
  256. return res.data;
  257. }
  258. return Promise.reject(new Error(res.message));
  259. }
  260. //
  261. //
  262. //
  263. //
  264. //销售订单
  265. /**
  266. * /销售订单-获取信息详情
  267. */
  268. export async function getSaleOrderDetailAPI(id) {
  269. const res = await get(
  270. Vue.prototype.apiUrl + `/eom/saleorder/getById/${id}`,
  271. {},
  272. true,
  273. );
  274. if (res.code == 0) {
  275. return res.data;
  276. }
  277. return Promise.reject(new Error(res.message));
  278. }
  279. //
  280. //
  281. //
  282. //
  283. //销售退货单
  284. /**
  285. * /销售退货单-获取信息详情
  286. */
  287. export async function getSaleOrderReturnGetByIdAPI(id) {
  288. const res = await get(
  289. Vue.prototype.apiUrl + `/eom/saleorderreturnrecord/getById/${id}`,
  290. {},
  291. true,
  292. );
  293. if (res.code == 0) {
  294. return res.data;
  295. }
  296. return Promise.reject(new Error(res.message));
  297. }
  298. //
  299. //
  300. //
  301. //
  302. //获取发货单
  303. /**
  304. * /获取发货单信息详情-获取信息详情
  305. */
  306. export async function getSaleOrderSendRecordDetailAPI(id) {
  307. const res = await get(
  308. Vue.prototype.apiUrl + `/eom/saleordersendrecord/getById/${id}`,
  309. {},
  310. true,
  311. );
  312. if (res.code == 0) {
  313. return res.data;
  314. }
  315. return Promise.reject(new Error(res.message));
  316. }
  317. /**
  318. * 获取发货信息详情(替代料)
  319. */
  320. export async function getByIdOnlyReplaceAPI(id) {
  321. const res = await get(
  322. Vue.prototype.apiUrl + `/eom/saleordersendrecord/getByIdOnlyReplace/${id}`,
  323. {},
  324. true,
  325. );
  326. if (res.code == 0) {
  327. return res.data;
  328. }
  329. return Promise.reject(new Error(res.message));
  330. }
  331. //
  332. //获取仓库信息
  333. /**
  334. * /获取仓库信息
  335. */
  336. export async function getWarehouseListByIdsAPI(data) {
  337. const res = await postJ(
  338. Vue.prototype.apiUrl + `/wms/warehouse/getWarehouseListByIds`,
  339. data,
  340. true,
  341. );
  342. if (res.code == 0) {
  343. return res.data;
  344. }
  345. return Promise.reject(new Error(res.message));
  346. }
  347. //
  348. //
  349. //
  350. //
  351. //
  352. //采购需求
  353. /**
  354. * /获取需求单信息
  355. */
  356. export async function getPurchaseRequirementByIdsAPI(id) {
  357. const res = await get(
  358. Vue.prototype.apiUrl + `/eom/purchaserequirement/getById/${id}`,
  359. {},
  360. true,
  361. );
  362. if (res.code == 0) {
  363. return res.data;
  364. }
  365. return Promise.reject(new Error(res.message));
  366. }
  367. //获取采购计划单信息
  368. export async function getPurchasePlanByIdsAPI(id) {
  369. const res = await get(
  370. Vue.prototype.apiUrl + `/eom/purchaseplan/getById/${id}`,
  371. {},
  372. true,
  373. );
  374. if (res.code == 0) {
  375. return res.data;
  376. }
  377. return Promise.reject(new Error(res.message));
  378. }
  379. /**
  380. * /新增采购需求负责人
  381. */
  382. export async function AssignPurchasePlanUserAPI(data) {
  383. const res = await postJ(
  384. Vue.prototype.apiUrl + `/bpm/purchasePlanApprove/assign`,
  385. data,
  386. true,
  387. );
  388. if (res.code == 0) {
  389. return res.data;
  390. }
  391. return Promise.reject(new Error(res.message));
  392. }
  393. //
  394. //
  395. //
  396. //
  397. /**
  398. * /采购订单
  399. */
  400. //获取采购订单信息
  401. export async function purchaseOrderGetByIdAPI(id) {
  402. const res = await get(
  403. Vue.prototype.apiUrl + `/eom/purchaseorder/getById/${id}`,
  404. {},
  405. true,
  406. );
  407. if (res.code == 0) {
  408. return res.data;
  409. }
  410. return Promise.reject(new Error(res.message));
  411. }
  412. //
  413. //
  414. //
  415. //
  416. /**
  417. * /采购收货
  418. */
  419. //获取采购收货单信息
  420. export async function purchaseOrderReceiveGetByIdAPI(id) {
  421. const res = await get(
  422. Vue.prototype.apiUrl + `/eom/purchaseorderreceive/getById/${id}`,
  423. {},
  424. true,
  425. );
  426. if (res.code == 0) {
  427. return res.data;
  428. }
  429. return Promise.reject(new Error(res.message));
  430. }
  431. //
  432. //
  433. //
  434. //
  435. /**
  436. * /采购退货
  437. */
  438. //获取采购退货单信息
  439. export async function purchaseOrderReturnGetByIdAPI(id) {
  440. const res = await get(
  441. Vue.prototype.apiUrl + `/eom/purchaseorderreturn/getById/${id}`,
  442. {},
  443. true,
  444. );
  445. if (res.code == 0) {
  446. return res.data;
  447. }
  448. return Promise.reject(new Error(res.message));
  449. }
  450. //
  451. //
  452. //
  453. //
  454. /**
  455. * /量具送检
  456. */
  457. //查询量具送检信息
  458. export async function processById(params) {
  459. const res = await get(
  460. Vue.prototype.apiUrl + `/eam/planmaintenance/processById`,
  461. params,
  462. );
  463. if (res.code == 0) {
  464. return res.data;
  465. }
  466. return Promise.reject(new Error(res.data.message));
  467. }
  468. //
  469. // 个人日志列表
  470. export async function getList(params) {
  471. const res = await get("/eom/planToolLog/list", params);
  472. if (res.data.code == 0) {
  473. return res.data;
  474. }
  475. return Promise.reject(new Error(res.data.message));
  476. }
  477. //
  478. //
  479. //
  480. //动态表单 工作流自定义权限过滤表单集合
  481. export async function getBpmCustomFormList(params) {
  482. const res = await get(
  483. Vue.prototype.apiUrl + "/flowable/bpmcustomform/list",
  484. params,
  485. );
  486. if (res.code == 0) {
  487. return res.data;
  488. }
  489. return Promise.reject(new Error(res.data.message));
  490. }
  491. //动态表单 我发起的申请
  492. export async function getProcessInstancePage(params) {
  493. const res = await postJ(
  494. Vue.prototype.apiUrl + "/bpm/process-instance/my-page",
  495. params,
  496. );
  497. if (res.code == 0) {
  498. return res.data;
  499. }
  500. return Promise.reject(new Error(res.data.message));
  501. }
  502. //动态表单 部门发起的申请
  503. export async function getProcessInstanceDeptPage(query) {
  504. const res = await get(
  505. Vue.prototype.apiUrl + "/bpm/process-instance/my-dept-page",
  506. params,
  507. );
  508. if (res.code == 0) {
  509. return res.data;
  510. }
  511. return Promise.reject(new Error(res.data.message));
  512. }
  513. //动态表单 通知我的申请
  514. export async function getProcessInstanceNoticePage(data) {
  515. const res = await postJ(
  516. Vue.prototype.apiUrl + "/bpm/process-instance/my-notice-page",
  517. data,
  518. );
  519. if (res.code == 0) {
  520. return res.data;
  521. }
  522. return Promise.reject(new Error(res.data.message));
  523. }
  524. //发起流程通用接口
  525. export async function processInstanceCreateAPI(params, loding = true) {
  526. const res = await postJ(
  527. Vue.prototype.apiUrl + `/bpm/process-instance/create`,
  528. params,
  529. loding,
  530. );
  531. if (res.code == 0) {
  532. return res.data;
  533. }
  534. return Promise.reject(new Error(res.message));
  535. }
  536. //流程列表
  537. export async function processInstancePage(params, loding = false) {
  538. const res = await get(
  539. Vue.prototype.apiUrl + `/bpm/model/page`,
  540. params,
  541. loding,
  542. );
  543. if (res.code == 0) {
  544. return res.data;
  545. }
  546. return Promise.reject(new Error(res.message));
  547. }
  548. /**
  549. * /获取领料单信息
  550. */
  551. export async function getPickOrderById(id) {
  552. const res = await get(
  553. Vue.prototype.apiUrl + `/pda/mes/pickorder/getPickOrderById/${id}`,
  554. {},
  555. true,
  556. );
  557. if (res.code == 0) {
  558. return res.data;
  559. }
  560. return Promise.reject(new Error(res.message));
  561. }
  562. /**
  563. * 根据来源单号查出库详情
  564. */
  565. export async function getOutInBySourceBizNo(sourceBizNo) {
  566. const res = await get(
  567. Vue.prototype.apiUrl + `/wms/outintwo/getInfoBySourceBizNo/${sourceBizNo}`,
  568. {},
  569. true,
  570. );
  571. if (res.code == 0) {
  572. return res.data;
  573. }
  574. return Promise.reject(new Error(res.message));
  575. }
  576. /**
  577. * 查询所有物品分类
  578. */
  579. export async function allCategoryLevel() {
  580. const res = await get(
  581. Vue.prototype.apiUrl + `/main/categoryLevel/allCategoryLevel`,
  582. {},
  583. false,
  584. );
  585. if (res.code == 0) {
  586. return res.data;
  587. }
  588. return Promise.reject(new Error(res.message));
  589. }
  590. export async function getLoginUser(data) {
  591. const res = await get(
  592. Vue.prototype.apiUrl + "/system/account/getLoginUser",
  593. data,
  594. true,
  595. );
  596. if (res.code == 0) {
  597. return res.data;
  598. }
  599. if (res.data && res.data.code == 0) {
  600. return res.data.data;
  601. }
  602. return Promise.reject(
  603. new Error(res.message || res.data?.message || "获取登录用户数据失败"),
  604. );
  605. }
  606. // 生产入库审批(申请入库)
  607. export async function approveTaskWithVariablesOther(data) {
  608. const res = await postJ(
  609. Vue.prototype.apiUrl + `/bpm/inwarehouse/assign`,
  610. data,
  611. true,
  612. );
  613. if (res.code == 0) {
  614. return res.data;
  615. }
  616. return Promise.reject(new Error(res.message));
  617. }
  618. /**
  619. * 获取部门列表(树)
  620. */
  621. export async function getGroupList() {
  622. const res = await get(
  623. Vue.prototype.apiUrl + `/main/group/getGroupList`,
  624. {},
  625. false,
  626. );
  627. if (res.code == 0) {
  628. return res.data;
  629. }
  630. return Promise.reject(new Error(res.message));
  631. }
  632. /**
  633. * 根据部门获取员工列表
  634. */
  635. export async function getUserPageByGroupId(params) {
  636. const res = await get(
  637. Vue.prototype.apiUrl + `/main/user/getUserPage`,
  638. params,
  639. true,
  640. );
  641. if (res.code == 0) {
  642. return res.data;
  643. }
  644. return Promise.reject(new Error(res.message));
  645. }
  646. /**
  647. * 根据人员id获取用户信息(含部门)
  648. */
  649. export async function getUserById(id) {
  650. const res = await get(
  651. Vue.prototype.apiUrl + `/main/user/getById/${id}`,
  652. {},
  653. true,
  654. );
  655. if (res.code == 0) {
  656. return res.data;
  657. }
  658. return Promise.reject(new Error(res.message));
  659. }
  660. /**
  661. * 生产入库申请单详情
  662. */
  663. export async function getStorageDetail(id) {
  664. const res = await get(
  665. Vue.prototype.apiUrl + `/mes/applystorage/getById/${id}`,
  666. {},
  667. true,
  668. );
  669. if (res.code == 0) {
  670. return res.data;
  671. }
  672. return Promise.reject(new Error(res.message));
  673. }
  674. // 动态表头
  675. export async function fieldModel(params) {
  676. const res = await get(Vue.prototype.apiUrl + `/main/fieldmodel/list`, params, true);
  677. if (res.code == 0) {
  678. return res.data;
  679. }
  680. return Promise.reject(new Error(res.message));
  681. }