dejdsjyyRzjd.js 7.5 KB

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