index.js 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. import request from '@/utils/request';
  2. /**
  3. * 查询项目列表
  4. * @data data
  5. */
  6. export async function projectsPageAPI(data) {
  7. const res = await request.post('/pro/projects/page', data);
  8. if (res.data.code == 0) {
  9. return res.data.data;
  10. }
  11. return Promise.reject(new Error(res.data.message));
  12. }
  13. /**
  14. * 我的项目
  15. * @data data
  16. */
  17. export async function getMyProjectsPage(data) {
  18. const res = await request.post('/pro/projects/getMyPage', data);
  19. if (res.data.code == 0) {
  20. return res.data.data;
  21. }
  22. return Promise.reject(new Error(res.data.message));
  23. }
  24. /**
  25. * 项目保存
  26. * @data data
  27. */
  28. export async function projectsSaveAPI(data) {
  29. const res = await request.post('/pro/projects/save', data);
  30. if (res.data.code == 0) {
  31. return res.data.data;
  32. }
  33. return Promise.reject(new Error(res.data.message));
  34. }
  35. /**
  36. * 项目修改
  37. * @data data
  38. */
  39. export async function projectsUpdateAPI(data) {
  40. const res = await request.put('/pro/projects/update', data);
  41. if (res.data.code == 0) {
  42. return res.data.data;
  43. }
  44. return Promise.reject(new Error(res.data.message));
  45. }
  46. /**
  47. * 项目阶段新增
  48. * @data data
  49. */
  50. export async function projectsstageSave(data) {
  51. const res = await request.post('/pro/projectsstage/save', data);
  52. if (res.data.code == 0) {
  53. return res.data.data;
  54. }
  55. return Promise.reject(new Error(res.data.message));
  56. }
  57. export async function projectsstageSaveBatch(data) {
  58. const res = await request.post('/pro/projectsstage/saveBatch', data);
  59. if (res.data.code == 0) {
  60. return res.data.data;
  61. }
  62. return Promise.reject(new Error(res.data.message));
  63. }
  64. /**
  65. * 项目详情
  66. * @id id
  67. */
  68. export async function projectsGetByIdAPI(id) {
  69. const res = await request.get(`/pro/projects/getById/${id}`);
  70. if (res.data.code == 0) {
  71. return res.data.data;
  72. }
  73. return Promise.reject(new Error(res.data.message));
  74. }
  75. /**
  76. * 项目查询项目结构树
  77. * @id id
  78. */
  79. export async function projectsToTreeAPI(params){
  80. const res = await request.get(`/pro/projects/selectProjectsToTree`,{params});
  81. if (res.data.code == 0) {
  82. return res.data.data;
  83. }
  84. return Promise.reject(new Error(res.data.message));
  85. }
  86. /**
  87. * 项目详情明细信息(含子集阶段、计划、任务)
  88. * @id id
  89. */
  90. export async function projectsGetByIdDetailsAPI(id){
  91. const res = await request.get(`/pro/projects/getByIdDetails/${id}`,);
  92. if (res.data.code == 0) {
  93. return res.data.data;
  94. }
  95. return Promise.reject(new Error(res.data.message));
  96. }
  97. /**
  98. * 逐级查询项目各层级列表数据
  99. * @id id
  100. */
  101. export async function projectsSelectTreeDataAPI(params){
  102. const res = await request.get(`/pro/projects/selectTreeDatas`,{params});
  103. if (res.data.code == 0) {
  104. return res.data.data;
  105. }
  106. return Promise.reject(new Error(res.data.message));
  107. }
  108. /**
  109. * 获取项目BOM树数据
  110. * @id id
  111. */
  112. export async function projectsBomGetTreeDataAPI(id){
  113. const res = await request.get(`/pro/projectsbom/getTreeDatas/${id}`,{});
  114. if (res.data.code == 0) {
  115. return res.data.data;
  116. }
  117. return Promise.reject(new Error(res.data.message));
  118. }
  119. /**
  120. * 根据类型获取项目编码
  121. * @id id
  122. */
  123. export async function getProjectCode(type){
  124. const res = await request.get(`/pro/projects/getProjectCode/${type}`,);
  125. if (res.data.code == 0) {
  126. return res.data.data;
  127. }
  128. return Promise.reject(new Error(res.data.message));
  129. }
  130. export async function getProjectCodeG(type){
  131. const res = await request.get(`/main/codemanage/getCode/${type}`,);
  132. if (res.data.code == 0) {
  133. return res.data.data;
  134. }
  135. return Promise.reject(new Error(res.data.message));
  136. }
  137. /**
  138. * 项目删除
  139. * @id id
  140. */
  141. export async function projectsDeleteAPI(data) {
  142. const res = await request.delete(`/pro/projects/delete`,{data});
  143. if (res.data.code == 0) {
  144. return res.data.data;
  145. }
  146. return Promise.reject(new Error(res.data.message));
  147. }
  148. /**
  149. * 提交
  150. */
  151. export async function submit(data) {
  152. const res = await request.post(`/bpm/pro/project/submit`, data);
  153. if (res.data.code == 0) {
  154. return res.data.data;
  155. }
  156. return Promise.reject(new Error(res.data.message));
  157. }
  158. /**
  159. * 获取项目bom和子项目结构树数据
  160. */
  161. export async function getByBomTreeAPI(id) {
  162. const res = await request.get(`/pro/projects/getByBomTree/${id}`);
  163. if (res.data.code == 0) {
  164. return res.data.data;
  165. }
  166. return Promise.reject(new Error(res.data.message));
  167. }/**
  168. * 根据项目id/计划/BOM获取项目计划树结构
  169. */
  170. export async function getPlanAndTaskTreeById(data) {
  171. const res = await request.post(`/pro/targetplan/getPlanTreeByPO`, data);
  172. if (res.data.code == 0) {
  173. return res.data.data;
  174. }
  175. return Promise.reject(new Error(res.data.message));
  176. }
  177. /**
  178. * 根据项目id/计划/BOM获取项目任务树结构
  179. */
  180. export async function getTaskTreeById(data) {
  181. const res = await request.post(`/pro/projects/getTaskTreeByPO`, data);
  182. if (res.data.code == 0) {
  183. return res.data.data;
  184. }
  185. return Promise.reject(new Error(res.data.message));
  186. }
  187. /**
  188. * 据项目对象查询所包含的阶段
  189. */
  190. export async function getProjectStageTree(id) {
  191. const data = {
  192. id: id,
  193. parentId: 0
  194. };
  195. const res = await request.post(`/pro/projects/getProjectStageTree`, data);
  196. if (res.data.code == 0) {
  197. return res.data.data;
  198. }
  199. return Promise.reject(new Error(res.data.message));
  200. }
  201. /**
  202. * 项目阶段删除
  203. * @id id
  204. */
  205. export async function projectsStageDeleteAPI(data) {
  206. const res = await request.delete(`/pro/projectsstage/delete`,{data});
  207. if (res.data.code == 0) {
  208. return res.data.data;
  209. }
  210. return Promise.reject(new Error(res.data.message));
  211. }
  212. export async function projectsStageUpdateAPI(data) {
  213. const res = await request.put(`/pro/projectsstage/update`,data);
  214. if (res.data.code == 0) {
  215. return res.data.data;
  216. }
  217. return Promise.reject(new Error(res.data.message));
  218. }
  219. /**
  220. * 项目完成
  221. * @id id
  222. */
  223. export async function projectsFinishAPI(id) {
  224. const res = await request.get(`/pro/projects/finishStatus/${id}`,{});
  225. if (res.data.code == 0) {
  226. return res.data.data;
  227. }
  228. return Promise.reject(new Error(res.data.message));
  229. }
  230. /**
  231. * 项目暂停
  232. * @id id
  233. */
  234. export async function projectsPauseAPI(id) {
  235. const res = await request.get(`/pro/projects/pauseStatus/${id}`,{});
  236. if (res.data.code == 0) {
  237. return res.data.data;
  238. }
  239. return Promise.reject(new Error(res.data.message));
  240. }
  241. /**
  242. * 项目启动
  243. * @id id
  244. */
  245. export async function projectsStartupAPI(id) {
  246. const res = await request.get(`/pro/projects/startupStatus/${id}`,{});
  247. if (res.data.code == 0) {
  248. return res.data.data;
  249. }
  250. return Promise.reject(new Error(res.data.message));
  251. }
  252. /**
  253. * 项目终止
  254. * @id id
  255. */
  256. export async function projectsTerminationAPI(id) {
  257. const res = await request.get(`/pro/projects/terminationStatus/${id}`,{});
  258. if (res.data.code == 0) {
  259. return res.data.data;
  260. }
  261. return Promise.reject(new Error(res.data.message));
  262. }
  263. /**
  264. * 项目完成
  265. * @id id
  266. */
  267. export async function projectsStageFinishAPI(id) {
  268. const res = await request.get(`/pro/projectsstage/finishStatus/${id}`,{});
  269. if (res.data.code == 0) {
  270. return res.data.data;
  271. }
  272. return Promise.reject(new Error(res.data.message));
  273. }
  274. /**
  275. * 项目暂停
  276. * @id id
  277. */
  278. export async function projectsStagePauseAPI(id) {
  279. const res = await request.get(`/pro/projectsstage/pauseStatus/${id}`,{});
  280. if (res.data.code == 0) {
  281. return res.data.data;
  282. }
  283. return Promise.reject(new Error(res.data.message));
  284. }
  285. /**
  286. * 项目启动
  287. * @id id
  288. */
  289. export async function projectsStageStartupAPI(id) {
  290. const res = await request.get(`/pro/projectsstage/startupStatus/${id}`,{});
  291. if (res.data.code == 0) {
  292. return res.data.data;
  293. }
  294. return Promise.reject(new Error(res.data.message));
  295. }
  296. /**
  297. * 项目终止
  298. * @id id
  299. */
  300. export async function projectsStageTerminationAPI(id) {
  301. const res = await request.get(`/pro/projectsstage/terminationStatus/${id}`,{});
  302. if (res.data.code == 0) {
  303. return res.data.data;
  304. }
  305. return Promise.reject(new Error(res.data.message));
  306. }
  307. /**
  308. * 项目详情获取项目树
  309. * @id id
  310. */
  311. export async function getProjectAndCategoryLevelTree(id) {
  312. const res = await request.get(`/pro/projects/getProjectAndCategoryLevelTree`,{});
  313. if (res.data.code == 0) {
  314. return res.data;
  315. }
  316. return Promise.reject(new Error(res.data.message));
  317. }
  318. /**
  319. * 项目行事历 树
  320. * @id id
  321. */
  322. export async function getProjectCalender(data) {
  323. const res = await request.post(`/pro/projects/getProjectCalender`,data);
  324. if (res.data.code == 0) {
  325. return res.data;
  326. }
  327. return Promise.reject(new Error(res.data.message));
  328. }