var TemplateList = {
    template: '<div>\
	    			<div class="title-name c-f16">\
	    				<span class="c-vam">模板库</span>\
	    			</div>\
					<ul>\
						<li v-for="(o,i) in items" class="temp-item c-nowrap c-t-center" @click="showTemplateDetail(o)">{{o.title}}</li>\
						<li class="temp-item c-nowrap c-t-center add" @click="newTemplate">添加新模板</li>\
					</ul>\
	   	 		</div>',
    props: [],
    data: function() {
        return {
        	items: []
        }
    },
    created: function() {
    	var vm = this
    	
    	vm.findTemplateList()
    	EventBus.$on("refresh-index",function() {
    		vm.findTemplateList()
    	})
    },
    mounted: function() {
    	var vm = this
		
    },
    methods: {
    	findTemplateList: function() {
    		var vm = this
    		rehaAPI.findTemplateList({
	    		doctor: storage.docInfo.code
	    	}).then(function(res) {
	    		vm.items = res.data
	    	})
    	},
    	showTemplateDetail: function(o) {
    		var vm = this
    		vm.$router.push({
    			path:'/template-items',
    			query: {
    				name: o.title,
    				isNew: false,
    				templateId: o.id
    			}
    		})
    	},
    	newTemplate: function() {
    		var vm = this
    		vm.$router.push('/new-template-form')
    	}
    }
}