dejdsjyysfjdjczqk.js 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. var template = ''
  2. $.ajax('../html/dejdsjyysfjdjczqk.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-dejdsjyy-sfjdjczqk', {
  15. props: ['type'],
  16. template: template,
  17. data: function() {
  18. return {
  19. dejdsjyyRzDate:[],
  20. testArr1: [],
  21. testArr2: [],
  22. testPosition1: 0,
  23. testPosition2: 0,
  24. list:[],
  25. startTime:new Date('2023','05','26'),
  26. // startTime:new Date(new Date().getTime()-6*24*60*60*1000),
  27. endTime:new Date(),
  28. regionList:[],
  29. regionData:[
  30. {label:'全市',id:'1',type:'1'}
  31. ],
  32. regionListList:[],
  33. tertiaryHospitalsData:[
  34. {label:'全部',id:'1',type:'2'}
  35. ],
  36. communityHospitalsList:[],
  37. communityHospitalsData:[
  38. {label:'全部',id:'1',type:'3'}
  39. ],
  40. groupingList:[],
  41. groupingData:[
  42. {label:'全部',id:'1',type:'4'}
  43. ],
  44. administrationStatusList:[],
  45. administrationStatusData:[
  46. {label:'全部',id:'1',type:'5'}
  47. ],
  48. show:false,
  49. showTwo:false,
  50. showThree:false,
  51. currentPage:1,
  52. currentSize:10,
  53. datatotal:0, //总数
  54. loadingTwo:false,
  55. setDisabled:{
  56. disabledDate:function(time) {
  57. return time.getTime() < new Date('2023','05','26') || time.getTime() > Date.now();
  58. }
  59. },
  60. s:'',
  61. e:'',
  62. mergeObj: {},
  63. mergeArr: ['areaName', 'gradeHospitalName', 'value','communityHospitalName','targetEntryCont','v1AllCount','firstV1FinishDate','v1MonthCount','entryRate'],
  64. }
  65. },
  66. created: function(){
  67. this.s = this.startTime.format('yyyy-MM-dd')
  68. // this.s = (new Date(this.endTime.getTime()-7*24*60*60*1000)) //往前推7天
  69. // console.log(this.s,"sss")
  70. this.e = this.endTime.format('yyyy-MM-dd')
  71. this.list.unshift({type:'0',id:'time',label:this.s +"~"+ this.e})
  72. this.getFollowAndOutData()
  73. },
  74. watch:{
  75. 'startTime':{
  76. handler:function(o) {
  77. if(!o) {
  78. this.list.splice(0,1)
  79. }
  80. },
  81. deep: true,
  82. immediate: true
  83. },
  84. 'endTime':{
  85. handler:function(o) {
  86. if(!o) {
  87. this.list.splice(0,1)
  88. }
  89. },
  90. deep: true,
  91. immediate: true
  92. },
  93. },
  94. methods: {
  95. getFollowAndOutData:function() {
  96. var vm = this
  97. vm.loadingTwo = true
  98. var data = {
  99. startTime:this.startTime.format('yyyy-MM-dd'),
  100. endTime:this.endTime.format('yyyy-MM-dd')
  101. }
  102. statisticAPI.getFollowAndOutData({
  103. jsonStr:JSON.stringify(data)
  104. }).then(function(res){
  105. if(res.status == 200) {
  106. console.log(res,'随访进度及出组情况');
  107. vm.loadingTwo = false
  108. vm.dejdsjyyRzDate = res.data.data
  109. // vm.dejdsjyyRzDate= vm.mergeArrays(res.data.data01,res.data.data02)
  110. console.log('我是第二阶段三级医院随访进度及出组情况',vm.dejdsjyyRzDate)
  111. vm.getSpanArr(vm.dejdsjyyRzDate)
  112. }
  113. }).catch(function(err){
  114. vm.loadingTwo = false
  115. })
  116. },
  117. //合并新数组
  118. mergeArrays:function(array1, array2) {
  119. var mergedArray = [];
  120. array1.forEach(function(item1,index){
  121. array2.slice(index*3,index*3+3).forEach(function(item2){
  122. var mergedObj = Object.assign({}, item1, item2, { newDetail: 'Detail ' + i });
  123. mergedArray.push(mergedObj);
  124. })
  125. })
  126. return mergedArray;
  127. },
  128. startTimeChange:function(o) {
  129. if(!this.list[0] || this.list[0].type!=0) {
  130. this.list.unshift({type:'0',id:'time',label:o.format('yyyy-MM-dd') +"~"+ this.endTime.format('yyyy-MM-dd')})
  131. }else{
  132. this.list[0].label = o.format('yyyy-MM-dd') +"~"+ this.endTime.format('yyyy-MM-dd')
  133. }
  134. },
  135. endTimeChange:function(o) {
  136. if(!this.list[0] || this.list[0].type!=0) {
  137. this.list.unshift({type:'0',id:'time',label:this.startTime.format('yyyy-MM-dd') +"~"+ o.format('yyyy-MM-dd')})
  138. }else{
  139. this.list[0].label = this.startTime.format('yyyy-MM-dd') +"~"+ o.format('yyyy-MM-dd')
  140. }
  141. },
  142. deleteClick:function(item) {
  143. if(item.id == "time") {
  144. this.startTime = ''
  145. this.endTime = ''
  146. this.list.splice(0,1)
  147. }
  148. var index = this.list.findIndex(function(v){
  149. return item.id == v.id
  150. })
  151. this.list.splice(index,1)
  152. },
  153. // 下一页 上一页
  154. handleCurrentChange:function(val) {
  155. var vm = this
  156. vm.currentPage = val
  157. },
  158. change:function(val) {
  159. this.list = this.list.concat(val)
  160. },
  161. // 确定
  162. confirm:function() {
  163. this.getFollowAndOutData()
  164. },
  165. // 取消
  166. cancel:function() {
  167. this.startTime = new Date('2023','05','26')
  168. this.endTime = new Date()
  169. if(!this.list[0] || this.list[0].type!=0) {
  170. this.list.unshift({type:'0',id:'time',label:this.startTime.format('yyyy-MM-dd') +"~"+ this.endTime.format('yyyy-MM-dd')})
  171. }else{
  172. this.list[0].label = this.startTime.format('yyyy-MM-dd') +"~"+ this.endTime.format('yyyy-MM-dd')
  173. }
  174. },
  175. // 导出
  176. exportHandle:function() {
  177. var vm = this
  178. vm.loadingTwo = true
  179. var data = {
  180. startTime:this.startTime.format('yyyy-MM-dd'),
  181. endTime:this.endTime.format('yyyy-MM-dd')
  182. }
  183. var jsonStr = JSON.stringify(data)
  184. statisticAPI.exportFollowAndOutData({
  185. jsonStr: encodeURIComponent(jsonStr)
  186. },'慢阻肺第二阶段三级医院随访进度及出组情况.xls').then(function(res){
  187. vm.loadingTwo = false
  188. })
  189. },
  190. getSpanArr(data) {
  191. this.mergeArr.forEach((key, index1) => {
  192. var count = 0; // 用来记录需要合并行的起始位置
  193. this.mergeObj[key] = []; // 记录每一列的合并信息
  194. data.forEach((item, index) => {
  195. // index == 0表示数据为第一行,直接 push 一个 1
  196. if(index === 0) {
  197. this.mergeObj[key].push(1);
  198. } else {
  199. // 判断当前行是否与上一行其值相等 如果相等 在 count 记录的位置其值 +1 表示当前行需要合并 并push 一个 0 作为占位
  200. if(key==='v1MonthCount'||key==='targetEntryCont'||key==='firstV1FinishDate'||key==='v1AllCount'||key==='entryRate'){
  201. if(item[key] === data[index - 1][key] && this.mergeObj[key][count]%3!=0) {
  202. this.mergeObj[key][count] += 1;
  203. this.mergeObj[key].push(0);
  204. } else {
  205. // 如果当前行和上一行其值不相等
  206. count = index; // 记录当前位置
  207. this.mergeObj[key].push(1); // 重新push 一个 1
  208. }
  209. }else{
  210. if(item[key] === data[index - 1][key] ) {
  211. this.mergeObj[key][count] += 1;
  212. this.mergeObj[key].push(0);
  213. } else {
  214. // 如果当前行和上一行其值不相等
  215. count = index; // 记录当前位置
  216. this.mergeObj[key].push(1); // 重新push 一个 1
  217. }
  218. }
  219. }
  220. })
  221. })
  222. },
  223. //得到行、列的合并值
  224. objectSpanMethod: function({row, column, rowIndex, columnIndex}) {
  225. if(this.mergeArr.indexOf(column.property) !== -1) {
  226. // 判断其值是不是为0
  227. if(this.mergeObj[column.property][rowIndex]) {
  228. return [this.mergeObj[column.property][rowIndex], 1]
  229. } else {
  230. // 如果为0则为需要合并的行
  231. return [0, 0];
  232. }
  233. }
  234. },
  235. renderHeadeRexpert: function(h, item) {
  236. var index = item.$index
  237. return [
  238. index=='2'?'目标V2入组例数':index=='3'?'首例V1入筛时间(YYYY/MM/DD)':index=='7'?'首例V2入组时间(YYYY/MM/DD)':index=='10'?'入组完成率':'',
  239. h(
  240. 'el-tooltip',
  241. {
  242. props: {
  243. content: (function() {
  244. return index=='2'?'即目标入组例数(与管理目标数一致)':index=='3'?'完成V1的提交时间,即“第一例完成V1并成功纳入筛选期的访视日期':index=='7'?'查询第一个入组的时间(访视2触发入组,统计第一个做访视2的患者,且是完成访视2提交的时间。)':index=='10'?'入组完成率=已入组/目标V2入组例数':''
  245. })(),
  246. placement: 'top'
  247. }
  248. },
  249. [
  250. h('span', {
  251. class: {
  252. 'el-icon-question': true
  253. }
  254. })
  255. ]
  256. )
  257. ]
  258. },
  259. }
  260. })