router.js 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. 'use strict';
  2. module.exports = app => {
  3. // session验证中间件
  4. const sessionAuth = app.middlewares.sessionAuth();
  5. // 创建时间自动填充中间件
  6. const datetimeFill = app.middlewares.datetimeFill();
  7. // 项目管理员判断中间件
  8. const projectManagerCheck = app.middlewares.projectManagerCheck();
  9. // 登入登出相关
  10. app.get('/login', 'loginController.index');
  11. app.get('/', 'loginController.index');
  12. app.get('/logout', 'loginController.logout');
  13. app.post('/login', 'loginController.login');
  14. // 用户信息初始化相关
  15. app.get('/boot', sessionAuth, 'bootController.index');
  16. app.post('/boot', sessionAuth, 'bootController.boot');
  17. // 控制面板相关
  18. app.get('/dashboard', sessionAuth, 'dashboardController.index');
  19. // 项目相关
  20. app.get('/project/info', sessionAuth, 'projectController.info');
  21. app.get('/project/account', sessionAuth, projectManagerCheck, 'accountController.index');
  22. app.post('/project/account/permission/:accountId', sessionAuth, projectManagerCheck, 'accountController.savePermission');
  23. app.get('/project/account/enable/:accountId', sessionAuth, projectManagerCheck, 'accountController.enable');
  24. app.get('/project/account/disable/:accountId', sessionAuth, projectManagerCheck, 'accountController.enable');
  25. app.get('/project/switch/:projectId', sessionAuth, projectManagerCheck, 'projectController.switchProject');
  26. app.post('/project/info', sessionAuth, 'projectController.saveInfo');
  27. // 台账管理相关
  28. app.get('/ledger/explode', sessionAuth, 'ledgerController.explode');
  29. app.post('/ledger/get-children', sessionAuth, 'ledgerController.getChildren');
  30. app.post('/ledger/base-operation', sessionAuth, 'ledgerController.baseOperation');
  31. app.post('/ledger/update', sessionAuth, 'ledgerController.update');
  32. app.post('/ledger/update-info', sessionAuth, 'ledgerController.updateInfo');
  33. app.post('/ledger/paste-block', sessionAuth, 'ledgerController.pasteBlock');
  34. app.post('/ledger/add-by-std', sessionAuth, 'ledgerController.addFromStandardLib');
  35. app.get('/ledger/change', sessionAuth, 'ledgerController.change');
  36. app.get('/ledger/index', sessionAuth, 'ledgerController.index');
  37. // 签约清单
  38. app.post('/deal/get-data', sessionAuth, 'dealBillsController.getData');
  39. app.post('/deal/upload-excel', sessionAuth, 'dealBillsController.loadExcel');
  40. app.get('/deal/download/:file', sessionAuth, 'dealBillsController.download');
  41. // 个人账号相关
  42. app.get('/profile/info', sessionAuth, 'profileController.info');
  43. app.post('/profile/save', sessionAuth, 'profileController.saveBase');
  44. app.post('/profile/password', sessionAuth, 'profileController.modifyPassword');
  45. app.post('/profile/code', sessionAuth, 'profileController.getCode');
  46. app.post('/profile/bind', sessionAuth, 'profileController.bindMobile');
  47. // 标段管理相关
  48. app.get('/tender', sessionAuth, 'tenderController.index');
  49. app.post('/tender/add', sessionAuth, datetimeFill, 'tenderController.add');
  50. app.get('/tender/switch/:tenderId', sessionAuth, 'tenderController.switchTender');
  51. app.post('/tender/save', sessionAuth, datetimeFill, 'tenderController.save');
  52. app.post('/tender/delete', sessionAuth, datetimeFill, 'tenderController.delete');
  53. // 计量管理相关
  54. app.get('/measure/middle', sessionAuth, 'measureController.middle');
  55. app.get('/measure/stage', sessionAuth, 'measureController.stage');
  56. //标准库相关
  57. app.post('/std/bills/get-data', sessionAuth, 'stdBillsController.getData');
  58. app.post('/std/bills/get-children', sessionAuth, 'stdBillsController.getChildren');
  59. app.post('/std/chapter/get-data', sessionAuth, 'stdChapterController.getData');
  60. app.post('/std/chapter/get-children', sessionAuth, 'stdChapterController.getChildren');
  61. };