var NewTemplateForm = { template: '
\
\ 模板未命名\
\
\ 模板名称: \ \ 保存\
\
', props: [], data: function() { return { name:'' } }, beforeRouteEnter: function (to, from, next) { next(function(vm) { vm.name = "" }) }, mounted: function() { var vm = this }, methods: { save: function() { var vm = this if(vm.name) { rehaAPI.createTemplate({ doctor: storage.docInfo.code, title: vm.name }).then(function(res) { if(res.status == 200) { vm.$router.push({ path:'/template-items', query: { name: vm.name, isNew: true, templateId: res.data } }) } else { toastr && toastr.error(res.msg) } }).catch(function(e) { console.error(e) }) } } } }