Explorar o código

限制模板管理按钮显示

zhangyanfang %!s(int64=4) %!d(string=hai) anos
pai
achega
ecba110cbb

+ 4 - 1
api/healthy-control-api.js

@ -18,7 +18,10 @@
        doctorBaseinfo: function(data){
			return httpRequest.get('doctor/baseinfo',{data:data})
		},
         
        //获取医生团队信息
		getDoctorTeam: function(uid){
			return httpRequest.get('doctor/admin-teams/team/'+uid+'/teams')
		},		
    }
    exports.healthAPI = healthAPI;

+ 1 - 1
app/rehabilitation/html/health_control.html

@ -72,7 +72,7 @@
            
            <div class="neironglef">
                <button @click="newRecover()">新建计划</button>
                <button @click="modelControl()">模版管理</button>
                <button v-if="doctorTeamList.length>0" @click="modelControl()">模版管理</button>
            </div>
        </div>
        <div class="neirong2">

+ 12 - 0
app/rehabilitation/js/health_control.js

@ -136,6 +136,7 @@ layui.use('element', function () {
            docInfo: {},
            isLeader: 0,
            planCreateUser: "",
            doctorTeamList:[],
            healthyConditionType:0
        },
@ -234,6 +235,7 @@ layui.use('element', function () {
            var vm = this
            vm.getDatas()
            vm.gettypes()
            vm.getDoctorTeam()
        },
@ -242,6 +244,16 @@ layui.use('element', function () {
                var str = httpRequest.getImgUrl(src)
                return str
            },
            getDoctorTeam:function(){
                var vm=this
                var wlyyAgent=JSON.parse(window.localStorage.getItem('wlyyAgent'));
                var uid=wlyyAgent && wlyyAgent.uid;
                healthAPI.getDoctorTeam(uid).then(function(res){
                    if(res.status==200){
                        vm.doctorTeamList=res.data;
                    }
                })
            },
            getDatas: function () {
                var vm = this
                var params = {

+ 73 - 5
component/rehabilitation/template-items.js

@ -98,6 +98,11 @@ var TemplateItems = {
			dialogVisible:false,
			item: null,
			seletc:'',
			frequencysList1:[{"code":"qd_10-week1","name":"1周/次","type":1,mode:"week"},
			{"code":"qd_10-week1","name":"2周/次","type":2,mode:"week"},
			{"code":"qd_10-month1","name":"1月/次","type":1,mode:"month"},
			{"code":"qd_10-month1","name":"2月/次","type":2,mode:"month"},
			{"code":"qd_10-month1","name":"3月/次","type":3,mode:"month"}],  //频次列表-multiple	
			options:[{label:'0',value:'0'}]
        }
    },
@ -121,6 +126,37 @@ var TemplateItems = {
		var vm = this
		EventBus.$on("add-template-item", function(o) {
			vm.items.push(o)
			_.map(vm.items, function (item) {
				item.plan=[]
				// 过滤有执行时间的数组
				var arr=[]
				arr=_.filter(item.list,function(ee){
					return ee.executeTimes
				})    
				item.num=arr.length
				if(item.num){
					item.plan =item.list||[]
					item.remark=item.list[0].remark
					_.map(item.plan,function(item2){
						item2.executeTimes?item2.executeTimesArr=item2.executeTimes.split(','):''
						item2.mode='multiple'    //模板
						item2.show=false
						item2.doctorName=item2.type==1?'家庭医生':'专科医生'
						item2.doctor=item2.type
						_.map(vm.frequencysList1,function(it){
							if(it.name==item2.frequencyName){
								item2.frequencyName?item2.frequencyCode=it.code:''
							}
						})
						item2.date=_.map(item2.executeTimesArr,function(item3){
							return item3.substring(0,item3.length-6)
							 
						})
						return item2
					})  
				}
				return item
			})
		})
	},
    mounted: function() {
@ -138,18 +174,50 @@ var TemplateItems = {
		},
    	saveTemplate: function() {
    		var vm = this
			var vm = this
			if(this.name=='系统模板'){
				showErrorMessage('不能编辑系统模板!')
				return false
			}
			var params = []
            _.each(vm.items, function (item, index) {
                if (item.plan && item.plan.length) {
                    _.each(item.plan, function (citem, cindex) {
                        var param = {
                            'templateId': vm.templateId,
                            "hospitalServiceItemId": item.code,
                            "type": citem.type,  //1家医2专医
                            "executeTimes": citem.executeTimes,
                            "frequencyCode": citem.frequencyCode.split("-")[0],
                            'frequencyName':citem.frequencyName,
                            'dateName':citem.dateName,
                            'dateCode':citem.dateCode,
                            "timeType": 0,   //1白天2晚上0全天
                            "remark": item.remark,
                        }
                        params.push(param)
                    })
                } else {
                    var param = {
                        'templateId': vm.templateId,
                        "hospitalServiceItemId": item.code,
                        "type": '',  //1家医2专医
                        "executeTimes": "",
                        "frequencyCode": "",
                        "timeType": 0,   //1白天2晚上0全天
                        "remark": ""
                    }
                    params.push(param)
                }
            })
            if (params.length == 0) {
                mui.toast("请选择配置康复服务项");
                return false
            }
    		vm.loading.showModal()
    		rehaAPI.createTemplateDetail({
    			doctor: docInfo.uid,
    			json: JSON.stringify({
    				templateId: vm.templateId,
    				hospitalServiceItemId: _.pluck(vm.items, 'code').join(',')
    			}),
				json:JSON.stringify(params),
    			type: vm.isNew?"create":"edit"
    		}).then(function(res) {
    			if(res.status == 200) {