123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- var docInfo = JSON.parse(window.localStorage.getItem('wlyyAgent'));
- var TemplateList = {
- template: '<div>\
- <div class="title-name c-f16">\
- <span class="c-vam">模板库</span>\
- </div>\
- <ul>\
- <li class="setSelect mt20" v-if="doctorList.length>1">\
- <el-select v-model="teamCode" @change="changeTeam">\
- <el-option\
- v-for="item in doctorList"\
- :key="item.id"\
- :label="item.name"\
- :value="item.id"\
- >\
- </el-option>\
- </el-select>\
- </li>\
- <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: [],
- 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
- }
- })
- }
- }
- }
|