// 慢阻肺患者档案-服务档案 var template = '' $.ajax('../../../component/statistics/CopdServiceRecord/index.html',{ data: {}, dataType: 'html', cache: false, timeout: 60000, async: false, error: function(res) { }, success: function(res) { template = res } }) Vue.component('copd-service-record', { template: template, props: ['detailInfo'], data() { return { dialog: false, loading:false, page:1, size:999, followInfo:{}, events: [ {date: '2023年'}, {title: 'Event 1', date: '05-11 17:00:01', description: 'Description for event 1'}, {date: '2024年', description: 'Description for event 2'}, {date: '2025年', description: 'Description for event 3'}, {date: '2026年', description: 'Description for event 4'}, {title: 'Event 5', date: '2027年', description: 'Description for event 5'} ] } }, methods: { setLeftHeights() { this.$nextTick(() => { this.events.forEach((event, index) => { const rightContent = document.getElementById('right-' + index); const leftContent = document.getElementById('left-' + index); if (rightContent && leftContent) { leftContent.style.height = rightContent.offsetHeight + 'px'; } }); }); }, recordBack(){ EventBus.$emit('copd-reset-select') }, getDealRecord: function () { var vm = this vm.loading = true var params = { page: vm.page, size: vm.size, patient: vm.detailInfo.patient } statisticAPI.dealRecordPage(params).then(function(res){ res.detailModelList.forEach(function (item, index) { var time1 = res.detailModelList[index] && res.detailModelList[index].createTime && res.detailModelList[index].createTime.slice(0, 4) var time2 = res.detailModelList[index + 1] && res.detailModelList[index + 1].createTime && res.detailModelList[index + 1].createTime.slice(0, 4) if (index == 0) { item.flag = 1 } else if (index != res.detailModelList.length - 1 && time1 == time2) { res.detailModelList[index + 1].flag = 0 } else if (res.detailModelList.length - 1 == index&& res.detailModelList[index + 1] && res.detailModelList[index + 1].createTime &&res.detailModelList[index]&&res.detailModelList[index].createTime) { if ( res.detailModelList[index - 1].createTime.slice(0, 4) ==res.detailModelList[index].createTime.slice(0, 4) ) { res.detailModelList[res.detailModelList.length - 1].flag = 0 } else { res.detailModelList[res.detailModelList.length - 1].flag = 1 } } }) vm.loading=false vm.events = res.detailModelList console.log(vm.events,'999999999999') }) }, showDetail(item){ var vm =this console.log(item,'oooooooooooooo') statisticAPI.followupDetail({id:item.jkcopdFollowup.id}).then(function(res){ console.log(res) vm.followInfo=res.obj console.log(vm.followInfo,'sssss') vm.dialog=true }) } }, mounted() { // this.$nextTick(() => { // this.setLeftHeights(); // }); this.getDealRecord() }, });