var docInfo = JSON.parse(window.localStorage.getItem('wlyyAgent')); var TemplateList = { template: '
\
\ 模板库\
\ \
', props: [], data: function() { return { items: [], teamCode:'', doctorList:[] } }, created: function() { var vm = this vm.getDoctorTeam().then(function(){ vm.findTemplateList() EventBus.$emit('getTeamCode',{ teamCode:vm.teamCode }) }) EventBus.$on("refresh-index",function() { vm.findTemplateList() }) }, mounted: function() { var vm = this }, methods: { findTemplateList: function() { var vm = this rehaAPI.findTemplateList({ doctor: storage.docInfo.uid, adminTeamCode:vm.teamCode }).then(function(res) { vm.items = _.filter(res.data,function(item){ return item.id!='808080eb708b19a20170995c982f0014' }) }) }, getDoctorTeam:function(){ var vm=this var wlyyAgentForDoc=JSON.parse(window.localStorage.getItem('wlyyAgentForDoc')); var uid=wlyyAgentForDoc && wlyyAgentForDoc.uid; return new Promise(function(resolve, reject) { rehaAPI.getDoctorTeam(uid).then(function(res){ if(res.status==200){ resolve() vm.doctorList=res.data; vm.teamCode=vm.doctorList[0].id } }) }) }, changeTeam:function(){ var vm=this EventBus.$emit('getTeamCode',{ teamCode:vm.teamCode }) vm.findTemplateList() }, 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({ path:'/new-template-form', query:{ teamCode:vm.teamCode } }) } } }