router.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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.post('/ledger/batch-insert', sessionAuth, 'ledgerController.batchInsert');
  36. app.get('/ledger/change', sessionAuth, 'ledgerController.change');
  37. app.get('/ledger/index', sessionAuth, 'ledgerController.index');
  38. // 签约清单
  39. app.post('/deal/get-data', sessionAuth, 'dealBillsController.getData');
  40. app.post('/deal/upload-excel', sessionAuth, 'dealBillsController.loadExcel');
  41. app.get('/deal/download/:file', sessionAuth, 'dealBillsController.download');
  42. // 个人账号相关
  43. app.get('/profile/info', sessionAuth, 'profileController.info');
  44. app.post('/profile/save', sessionAuth, 'profileController.saveBase');
  45. app.post('/profile/password', sessionAuth, 'profileController.modifyPassword');
  46. app.post('/profile/code', sessionAuth, 'profileController.getCode');
  47. app.post('/profile/bind', sessionAuth, 'profileController.bindMobile');
  48. // 标段管理相关
  49. app.get('/tender', sessionAuth, 'tenderController.index');
  50. app.post('/tender/add', sessionAuth, datetimeFill, 'tenderController.add');
  51. app.get('/tender/switch/:tenderId', sessionAuth, 'tenderController.switchTender');
  52. app.post('/tender/save', sessionAuth, datetimeFill, 'tenderController.save');
  53. app.post('/tender/delete', sessionAuth, datetimeFill, 'tenderController.delete');
  54. // 计量管理相关
  55. app.get('/measure/middle', sessionAuth, 'measureController.middle');
  56. app.get('/measure/stage', sessionAuth, 'measureController.stage');
  57. //标准库相关
  58. app.post('/std/bills/get-data', sessionAuth, 'stdBillsController.getData');
  59. app.post('/std/bills/get-children', sessionAuth, 'stdBillsController.getChildren');
  60. app.post('/std/chapter/get-data', sessionAuth, 'stdChapterController.getData');
  61. app.post('/std/chapter/get-children', sessionAuth, 'stdChapterController.getChildren');
  62. };