mzfWorksheet.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. var template = ''
  2. $.ajax('../html/mzfWorksheet.html',{
  3. data: {},
  4. dataType: 'html',
  5. cache: false,
  6. timeout: 60000,
  7. async: false,
  8. error: function(res) {
  9. },
  10. success: function(res) {
  11. template = res
  12. }
  13. })
  14. Vue.component('mzf-worksheet', {
  15. props: [],
  16. template: template,
  17. data: function() {
  18. return {
  19. mzfWorksheetData:[],
  20. list:[],
  21. startTime:new Date('2023','05','26'),
  22. endTime:new Date(),
  23. regionList:[],
  24. regionData:[
  25. {label:'全市',id:'1',type:'1'}
  26. ],
  27. regionListList:[],
  28. tertiaryHospitalsData:[
  29. {label:'全部',id:'1',type:'2'}
  30. ],
  31. communityHospitalsList:[],
  32. communityHospitalsData:[
  33. {label:'全部',id:'1',type:'3'}
  34. ],
  35. groupingList:[],
  36. groupingData:[
  37. {label:'全部',id:'1',type:'4'}
  38. ],
  39. administrationStatusList:[],
  40. administrationStatusData:[
  41. {label:'全部',id:'1',type:'5'}
  42. ],
  43. show:false,
  44. showTwo:false,
  45. showThree:false,
  46. currentPage:1,
  47. currentSize:10,
  48. datatotal:0, //总数
  49. loadingTwo:false,
  50. setDisabled:{
  51. disabledDate:function(time) {
  52. return time.getTime() < new Date('2023','05','26') || time.getTime() > Date.now();
  53. }
  54. },
  55. s:'',
  56. e:'',
  57. }
  58. },
  59. created: function(){
  60. this.s = this.startTime.format('yyyy-MM-dd')
  61. this.e = this.endTime.format('yyyy-MM-dd')
  62. this.list.unshift({type:'0',id:'time',label:this.s +"~"+ this.e})
  63. this.hospitalWorkStatistics()
  64. },
  65. watch:{
  66. 'startTime':{
  67. handler:function(o) {
  68. if(!o) {
  69. this.list.splice(0,1)
  70. }
  71. },
  72. deep: true,
  73. immediate: true
  74. },
  75. 'endTime':{
  76. handler:function(o) {
  77. if(!o) {
  78. this.list.splice(0,1)
  79. }
  80. },
  81. deep: true,
  82. immediate: true
  83. },
  84. },
  85. methods: {
  86. hospitalWorkStatistics:function() {
  87. var vm = this
  88. vm.loadingTwo = true
  89. statisticAPI.hospitalWorkStatistics({
  90. startDate:this.startTime.format('yyyy-MM-dd'),
  91. endDate:this.endTime.format('yyyy-MM-dd')
  92. }).then(function(res){
  93. if(res.status == 200) {
  94. vm.loadingTwo = false
  95. vm.mzfWorksheetData = res.data
  96. }
  97. }).catch(function(err){
  98. vm.loadingTwo = false
  99. })
  100. },
  101. startTimeChange:function(o) {
  102. if(!this.list[0] || this.list[0].type!=0) {
  103. this.list.unshift({type:'0',id:'time',label:o.format('yyyy-MM-dd') +"~"+ this.endTime.format('yyyy-MM-dd')})
  104. }else{
  105. this.list[0].label = o.format('yyyy-MM-dd') +"~"+ this.endTime.format('yyyy-MM-dd')
  106. }
  107. },
  108. endTimeChange:function(o) {
  109. if(!this.list[0] || this.list[0].type!=0) {
  110. this.list.unshift({type:'0',id:'time',label:this.startTime.format('yyyy-MM-dd') +"~"+ o.format('yyyy-MM-dd')})
  111. }else{
  112. this.list[0].label = this.startTime.format('yyyy-MM-dd') +"~"+ o.format('yyyy-MM-dd')
  113. }
  114. },
  115. deleteClick:function(item) {
  116. if(item.id == "time") {
  117. this.startTime = ''
  118. this.endTime = ''
  119. this.list.splice(0,1)
  120. }
  121. var index = this.list.findIndex(function(v){
  122. return item.id == v.id
  123. })
  124. this.list.splice(index,1)
  125. },
  126. // 下一页 上一页
  127. handleCurrentChange:function(val) {
  128. var vm = this
  129. vm.currentPage = val
  130. },
  131. change:function(val) {
  132. this.list = this.list.concat(val)
  133. },
  134. // 确定
  135. confirm:function() {
  136. this.hospitalWorkStatistics()
  137. },
  138. // 取消
  139. cancel:function() {
  140. this.startTime = new Date('2023','05','26')
  141. this.endTime = new Date()
  142. if(!this.list[0] || this.list[0].type!=0) {
  143. this.list.unshift({type:'0',id:'time',label:this.startTime.format('yyyy-MM-dd') +"~"+ this.endTime.format('yyyy-MM-dd')})
  144. }else{
  145. this.list[0].label = this.startTime.format('yyyy-MM-dd') +"~"+ this.endTime.format('yyyy-MM-dd')
  146. }
  147. },
  148. // 导出
  149. exportHandle:function() {
  150. var vm = this
  151. vm.loadingTwo = true
  152. statisticAPI.exportHospitalWorkStatistics({
  153. startDate:this.startTime.format('yyyy-MM-dd'),
  154. endDate:this.endTime.format('yyyy-MM-dd')
  155. },'慢阻肺医院工作量表.xls').then(function(res){
  156. vm.loadingTwo = false
  157. })
  158. },
  159. }
  160. })