dejdsqyysfjd.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. var template = ''
  2. $.ajax('../html/dejdsqyysfjd.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-dejdsqyy-sfjd', {
  15. props: [],
  16. template: template,
  17. data: function() {
  18. return {
  19. mzfSfzmxData:[],
  20. testArr1: [],
  21. testArr2: [],
  22. testArr3: [],
  23. testArr4: [],
  24. testPosition1: 0,
  25. testPosition2: 0,
  26. testPosition3: 0,
  27. testPosition4: 0,
  28. list:[],
  29. startTime:new Date('2023','05','26'),
  30. endTime:new Date(),
  31. regionList:[],
  32. regionData:[
  33. {label:'全市',id:'1',type:'1'}
  34. ],
  35. regionListList:[],
  36. tertiaryHospitalsData:[
  37. {label:'全部',id:'1',type:'2'}
  38. ],
  39. communityHospitalsList:[],
  40. communityHospitalsData:[
  41. {label:'全部',id:'1',type:'3'}
  42. ],
  43. groupingList:[],
  44. groupingData:[
  45. {label:'全部',id:'1',type:'4'}
  46. ],
  47. administrationStatusList:[],
  48. administrationStatusData:[
  49. {label:'全部',id:'1',type:'5'}
  50. ],
  51. show:false,
  52. showTwo:false,
  53. showThree:false,
  54. currentPage:1,
  55. currentSize:10,
  56. datatotal:0, //总数
  57. loadingTwo:false,
  58. setDisabled:{
  59. disabledDate:function(time) {
  60. return time.getTime() < new Date('2023','05','26') || time.getTime() > Date.now();
  61. }
  62. },
  63. s:'',
  64. e:'',
  65. mergeObj: {},
  66. mergeArr: ['areaName', 'gradeHospitalName', 'hospitalName', 'groupName',],
  67. }
  68. },
  69. created: function(){
  70. this.s = this.startTime.format('yyyy-MM-dd')
  71. this.e = this.endTime.format('yyyy-MM-dd')
  72. this.list.unshift({type:'0',id:'time',label:this.s +"~"+ this.e})
  73. this.getCopdFollowDetailData()
  74. },
  75. watch:{
  76. 'startTime':{
  77. handler:function(o) {
  78. if(!o) {
  79. this.list.splice(0,1)
  80. }
  81. },
  82. deep: true,
  83. immediate: true
  84. },
  85. 'endTime':{
  86. handler:function(o) {
  87. if(!o) {
  88. this.list.splice(0,1)
  89. }
  90. },
  91. deep: true,
  92. immediate: true
  93. },
  94. },
  95. methods: {
  96. getCopdFollowDetailData:function() {
  97. var vm = this
  98. vm.loadingTwo = true
  99. var data = {
  100. startTime:this.startTime.format('yyyy-MM-dd'),
  101. endTime:this.endTime.format('yyyy-MM-dd')
  102. }
  103. statisticAPI.getCopdFollowDetailData({
  104. jsonStr:JSON.stringify(data)
  105. }).then(function(res){
  106. if(res.status == 200) {
  107. console.log(res,'sfmx');
  108. vm.loadingTwo = false
  109. vm.mzfSfzmxData = res.data
  110. vm.getSpanArr(vm.mzfSfzmxData)
  111. }
  112. }).catch(function(err){
  113. vm.loadingTwo = false
  114. })
  115. },
  116. startTimeChange:function(o) {
  117. if(!this.list[0] || this.list[0].type!=0) {
  118. this.list.unshift({type:'0',id:'time',label:o.format('yyyy-MM-dd') +"~"+ this.endTime.format('yyyy-MM-dd')})
  119. }else{
  120. this.list[0].label = o.format('yyyy-MM-dd') +"~"+ this.endTime.format('yyyy-MM-dd')
  121. }
  122. },
  123. endTimeChange:function(o) {
  124. if(!this.list[0] || this.list[0].type!=0) {
  125. this.list.unshift({type:'0',id:'time',label:this.startTime.format('yyyy-MM-dd') +"~"+ o.format('yyyy-MM-dd')})
  126. }else{
  127. this.list[0].label = this.startTime.format('yyyy-MM-dd') +"~"+ o.format('yyyy-MM-dd')
  128. }
  129. },
  130. deleteClick:function(item) {
  131. if(item.id == "time") {
  132. this.startTime = ''
  133. this.endTime = ''
  134. this.list.splice(0,1)
  135. }
  136. var index = this.list.findIndex(function(v){
  137. return item.id == v.id
  138. })
  139. this.list.splice(index,1)
  140. },
  141. // 下一页 上一页
  142. handleCurrentChange:function(val) {
  143. var vm = this
  144. vm.currentPage = val
  145. },
  146. change:function(val) {
  147. this.list = this.list.concat(val)
  148. },
  149. // 确定
  150. confirm:function() {
  151. this.getCopdFollowDetailData()
  152. },
  153. // 取消
  154. cancel:function() {
  155. this.startTime = new Date('2023','05','26')
  156. this.endTime = new Date()
  157. if(!this.list[0] || this.list[0].type!=0) {
  158. this.list.unshift({type:'0',id:'time',label:this.startTime.format('yyyy-MM-dd') +"~"+ this.endTime.format('yyyy-MM-dd')})
  159. }else{
  160. this.list[0].label = this.startTime.format('yyyy-MM-dd') +"~"+ this.endTime.format('yyyy-MM-dd')
  161. }
  162. },
  163. // 导出
  164. exportHandle:function() {
  165. var vm = this
  166. vm.loadingTwo = true
  167. var data = {
  168. startTime:this.startTime.format('yyyy-MM-dd'),
  169. endTime:this.endTime.format('yyyy-MM-dd')
  170. }
  171. var jsonStr = JSON.stringify(data)
  172. statisticAPI.exportCopdFollowDetailData({
  173. jsonStr: encodeURIComponent(jsonStr)
  174. },'慢阻肺随访总明细.xls').then(function(res){
  175. vm.loadingTwo = false
  176. })
  177. },
  178. getSpanArr(data) {
  179. this.mergeArr.forEach((key, index1) => {
  180. var count = 0; // 用来记录需要合并行的起始位置
  181. this.mergeObj[key] = []; // 记录每一列的合并信息
  182. data.forEach((item, index) => {
  183. // index == 0表示数据为第一行,直接 push 一个 1
  184. if(index === 0) {
  185. this.mergeObj[key].push(1);
  186. } else {
  187. // 判断当前行是否与上一行其值相等 如果相等 在 count 记录的位置其值 +1 表示当前行需要合并 并push 一个 0 作为占位
  188. if(item[key] === data[index - 1][key]) {
  189. this.mergeObj[key][count] += 1;
  190. this.mergeObj[key].push(0);
  191. } else {
  192. // 如果当前行和上一行其值不相等
  193. count = index; // 记录当前位置
  194. this.mergeObj[key].push(1); // 重新push 一个 1
  195. }
  196. }
  197. })
  198. })
  199. },
  200. //得到行、列的合并值
  201. objectSpanMethod: function({row, column, rowIndex, columnIndex}) {
  202. if(this.mergeArr.indexOf(column.property) !== -1) {
  203. // 判断其值是不是为0
  204. if(this.mergeObj[column.property][rowIndex]) {
  205. return [this.mergeObj[column.property][rowIndex], 1]
  206. } else {
  207. // 如果为0则为需要合并的行
  208. return [0, 0];
  209. }
  210. }
  211. },
  212. }
  213. })