var docInfo = JSON.parse(window.localStorage.getItem('wlyyAgent'));
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) {
if(vm.name=='系统模板'){
layer.msg('不能创建系统模板!', {
icon: 5
})
return false
}
rehaAPI.createTemplate({
doctor: docInfo.uid,
title: vm.name,
adminTeamCode:vm.$route.query.teamCode
}).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)
})
}
}
}
}