mzfRzjd.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. var template = ''
  2. $.ajax('../html/mzfRzjd.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-rzjd', {
  15. props: [],
  16. template: template,
  17. data: function() {
  18. return {
  19. mzfRzjdData:[],
  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. }
  62. },
  63. created: function(){
  64. this.s = this.startTime.format('yyyy-MM-dd')
  65. this.e = this.endTime.format('yyyy-MM-dd')
  66. this.list.unshift({type:'0',id:'time',label:this.s +"~"+ this.e})
  67. this.getCopdEntryData()
  68. },
  69. watch:{
  70. 'startTime':{
  71. handler:function(o) {
  72. if(!o) {
  73. this.list.splice(0,1)
  74. }
  75. },
  76. deep: true,
  77. immediate: true
  78. },
  79. 'endTime':{
  80. handler:function(o) {
  81. if(!o) {
  82. this.list.splice(0,1)
  83. }
  84. },
  85. deep: true,
  86. immediate: true
  87. },
  88. },
  89. methods: {
  90. getCopdEntryData:function() {
  91. var vm = this
  92. vm.loadingTwo = true
  93. var data = {
  94. startTime:this.startTime.format('yyyy-MM-dd'),
  95. endTime:this.endTime.format('yyyy-MM-dd')
  96. }
  97. statisticAPI.getCopdEntryData({
  98. jsonStr:JSON.stringify(data)
  99. }).then(function(res){
  100. if(res.status == 200) {
  101. console.log(res,'入组随访计划');
  102. vm.loadingTwo = false
  103. vm.mzfRzjdData = res.data
  104. vm.getSpanArr(vm.mzfRzjdData)
  105. }
  106. }).catch(function(err){
  107. vm.loadingTwo = false
  108. })
  109. },
  110. startTimeChange:function(o) {
  111. if(!this.list[0] || this.list[0].type!=0) {
  112. this.list.unshift({type:'0',id:'time',label:o.format('yyyy-MM-dd') +"~"+ this.endTime.format('yyyy-MM-dd')})
  113. }else{
  114. this.list[0].label = o.format('yyyy-MM-dd') +"~"+ this.endTime.format('yyyy-MM-dd')
  115. }
  116. },
  117. endTimeChange:function(o) {
  118. if(!this.list[0] || this.list[0].type!=0) {
  119. this.list.unshift({type:'0',id:'time',label:this.startTime.format('yyyy-MM-dd') +"~"+ o.format('yyyy-MM-dd')})
  120. }else{
  121. this.list[0].label = this.startTime.format('yyyy-MM-dd') +"~"+ o.format('yyyy-MM-dd')
  122. }
  123. },
  124. deleteClick:function(item) {
  125. if(item.id == "time") {
  126. this.startTime = ''
  127. this.endTime = ''
  128. this.list.splice(0,1)
  129. }
  130. var index = this.list.findIndex(function(v){
  131. return item.id == v.id
  132. })
  133. this.list.splice(index,1)
  134. },
  135. // 下一页 上一页
  136. handleCurrentChange:function(val) {
  137. var vm = this
  138. vm.currentPage = val
  139. },
  140. change:function(val) {
  141. this.list = this.list.concat(val)
  142. },
  143. // 确定
  144. confirm:function() {
  145. this.getCopdEntryData()
  146. },
  147. // 取消
  148. // cancel:function() {
  149. // this.startTime = new Date('2023','05','26')
  150. // this.endTime = new Date()
  151. // if(!this.list[0] || this.list[0].type!=0) {
  152. // this.list.unshift({type:'0',id:'time',label:this.startTime.format('yyyy-MM-dd') +"~"+ this.endTime.format('yyyy-MM-dd')})
  153. // }else{
  154. // this.list[0].label = this.startTime.format('yyyy-MM-dd') +"~"+ this.endTime.format('yyyy-MM-dd')
  155. // }
  156. // },
  157. // 导出
  158. exportHandle:function() {
  159. var vm = this
  160. vm.loadingTwo = true
  161. var data = {
  162. startTime:this.startTime.format('yyyy-MM-dd'),
  163. endTime:this.endTime.format('yyyy-MM-dd')
  164. }
  165. var jsonStr = JSON.stringify(data)
  166. statisticAPI.exportCopdEntryData({
  167. jsonStr: encodeURIComponent(jsonStr)
  168. },'慢阻肺入组进度.xls').then(function(res){
  169. vm.loadingTwo = false
  170. })
  171. },
  172. //表格合并单元格跨行,实现首列根据不同类型进行跨行
  173. getSpanArr: function(data) {
  174. this.spanArr = []
  175. for (var i = 0; i < data.length; i++) {
  176. if (i === 0) {
  177. this.spanArr.push(1);
  178. this.podds = 0
  179. } else {
  180. /*判断当前元素与上一个元素type值是否相同
  181. *相同就+1,代表需要合并的行+1
  182. */
  183. if (data[i].areaName === data[i - 1].areaName) {
  184. this.spanArr[this.podds] += 1;
  185. this.spanArr.push(0);
  186. } else {
  187. this.spanArr.push(1);
  188. this.podds = i;
  189. }
  190. }
  191. }
  192. },
  193. //得到行、列的合并值
  194. objectSpanMethod: function({row, column, rowIndex, columnIndex}) {
  195. if (columnIndex === 0) {
  196. const _rows = this.spanArr[rowIndex];
  197. const _cols = _rows > 0 ? 1 : 0;
  198. return {
  199. rowspan: _rows, //跨的行合并数
  200. colspan: _cols //跨的列合并数
  201. }
  202. }
  203. },
  204. }
  205. })