management.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. var routes = [
  2. { path: '/', component: IndexPage,
  3. children: [
  4. {
  5. path: '/',
  6. components: {
  7. leftView: TemplateList,
  8. rightView: NewTemplate
  9. }
  10. },
  11. {
  12. path: '/new-template-form',
  13. components: {
  14. leftView: TemplateList,
  15. rightView: NewTemplateForm
  16. }
  17. },
  18. {
  19. path: '/template-items',
  20. components: {
  21. leftView: TemplateItemsSelect,
  22. rightView: TemplateItems
  23. }
  24. },
  25. {
  26. path: '/template-items-select',
  27. components: {
  28. leftView: TemplateItemsSelect,
  29. rightView: TemplateItems
  30. }
  31. },
  32. {
  33. path: '/template-item-detail',
  34. components: {
  35. leftView: TemplateItemsSelect,
  36. rightView: ItemDetail
  37. }
  38. },
  39. ]
  40. }
  41. ],
  42. router = new VueRouter({
  43. routes: routes
  44. }),
  45. storage = {
  46. docInfo: null,
  47. patient: null, // url中patient,用来来判断是否是"发送"模式
  48. planId: null
  49. }
  50. new Vue({
  51. data: {
  52. },
  53. router: router,
  54. created: function() {
  55. var vm = this
  56. vm.loading.show()
  57. homeAPI.baseinfo().then(function(res) {
  58. if(res.status == 200) {
  59. vm.loading.close()
  60. var infoStr = JSON.stringify(res.data);
  61. localStorage.setItem("docInfo", infoStr);
  62. storage.docInfo = res.data
  63. vm.$mount('#app')
  64. } else {
  65. vm.loading.close()
  66. toastr && toastr.error(res.msg)
  67. }
  68. })
  69. },
  70. methods: {
  71. backPage: function(){
  72. window.history.go(-1);
  73. },
  74. refreshPage: function(){
  75. window.location.reload();
  76. }
  77. },
  78. components: {
  79. }
  80. })