template-list.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. var TemplateList = {
  2. template: '<div>\
  3. <div class="title-name c-f16">\
  4. <span class="c-vam">模板库</span>\
  5. </div>\
  6. <ul>\
  7. <li v-for="(o,i) in items" class="temp-item c-nowrap c-t-center" @click="showTemplateDetail(o)">{{o.title}}</li>\
  8. <li class="temp-item c-nowrap c-t-center add" @click="newTemplate">添加新模板</li>\
  9. </ul>\
  10. </div>',
  11. props: [],
  12. data: function() {
  13. return {
  14. items: []
  15. }
  16. },
  17. created: function() {
  18. var vm = this
  19. vm.findTemplateList()
  20. EventBus.$on("refresh-index",function() {
  21. vm.findTemplateList()
  22. })
  23. },
  24. mounted: function() {
  25. var vm = this
  26. },
  27. methods: {
  28. findTemplateList: function() {
  29. var vm = this
  30. rehaAPI.findTemplateList({
  31. doctor: storage.docInfo.code
  32. }).then(function(res) {
  33. vm.items = res.data
  34. })
  35. },
  36. showTemplateDetail: function(o) {
  37. var vm = this
  38. vm.$router.push({
  39. path:'/template-items',
  40. query: {
  41. name: o.title,
  42. isNew: false,
  43. templateId: o.id
  44. }
  45. })
  46. },
  47. newTemplate: function() {
  48. var vm = this
  49. vm.$router.push('/new-template-form')
  50. }
  51. }
  52. }