index.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. var template = ''
  2. $.ajax('../../../component/statistics/ResidentScoreDetail/index.html', {
  3. data: {},
  4. dataType: 'html',
  5. cache: false,
  6. timeout: 60000,
  7. async: false,
  8. error: function (res) {},
  9. success: function (res) {
  10. template = res
  11. }
  12. })
  13. Vue.component('resident-score-detail', {
  14. template: template,
  15. data() {
  16. return {
  17. years: [],
  18. yearType: '1',
  19. chooseYear: null,
  20. chooseTime: null,
  21. form: {
  22. range: 'town'
  23. },
  24. tableData: [],
  25. info: {},
  26. loading: false,
  27. exportLoading: false,
  28. rangeOptions: [
  29. { label: '按区', value: 'town' },
  30. { label: '按社区', value: 'hospital' }
  31. ],
  32. areaOptions: [
  33. { label: '思明区', value: '350203' },
  34. { label: '海沧区', value: '350205' },
  35. { label: '湖里区', value: '350206' },
  36. { label: '集美区', value: '350211' },
  37. { label: '同安区', value: '350212' },
  38. { label: '翔安区', value: '350213' }
  39. ],
  40. level: 0,
  41. tableHeader: [],
  42. page: 1,
  43. size: 10,
  44. total: 0
  45. }
  46. },
  47. methods: {
  48. init() {
  49. var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
  50. if (selectedRole.code.indexOf('350200') > -1) {
  51. this.level = 1 // 市卫健委
  52. this.areaOptions = [
  53. { label: '思明区', value: '350203' },
  54. { label: '海沧区', value: '350205' },
  55. { label: '湖里区', value: '350206' },
  56. { label: '集美区', value: '350211' },
  57. { label: '同安区', value: '350212' },
  58. { label: '翔安区', value: '350213' }
  59. ]
  60. } else if (selectedRole.code.length == 6) {
  61. this.level = 2 // 区管理
  62. this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code }]
  63. this.form = {
  64. range: 'town',
  65. area: selectedRole.code
  66. }
  67. this.getHospital(selectedRole.code)
  68. }
  69. this.initTime()
  70. this.searchFn()
  71. },
  72. initTime() {
  73. var vm = this
  74. var now = new Date()
  75. vm.nowyear = vm.chooseYear = now.getFullYear()
  76. vm.years = []
  77. for (i = vm.nowyear; i >= 2013; i--) {
  78. vm.years.push(i)
  79. }
  80. },
  81. searchFn() {
  82. var vm = this
  83. this.loading = true
  84. var params = {
  85. ...this.form,
  86. page: this.page,
  87. pageSize: this.size
  88. }
  89. vm.tableData = []
  90. if (this.yearType == '1') {
  91. params.startDate = this.chooseYear + '-01-01'
  92. params.endDate = this.chooseYear + '-12-31'
  93. } else {
  94. if (this.chooseTime) {
  95. params.startDate = this.chooseTime[0]
  96. params.endDate = this.chooseTime[1]
  97. }
  98. }
  99. statisticAPI.patinetIntegralAnalysis(params).then(function (res) {
  100. if (res.status == 200) {
  101. res.data.list.forEach(function (item) {
  102. item.ssc = item.ssc.replace(/^(.{4})(?:\d+)(.{1})$/, '$1****$2')
  103. // item.idcard = item.idcard.replace(/^(.{6})(?:\d+)(.{4})$/,"$1****$2")
  104. })
  105. vm.tableData = res.data.list
  106. vm.total = res.data.total
  107. }
  108. vm.loading = false
  109. })
  110. },
  111. exportTable() {
  112. var vm = this
  113. var params = {
  114. ...this.form,
  115. page: 1,
  116. pageSize: 99999
  117. }
  118. if (this.yearType == '1') {
  119. params.signYear = this.chooseYear
  120. } else {
  121. if (this.chooseTime) {
  122. params.startDate = this.chooseTime[0] + ' 00:00'
  123. params.endDate = this.chooseTime[1] + ' 23:59'
  124. }
  125. }
  126. this.exportLoading = true
  127. var fileName = `居民积分明细${new Date().getTime()}.xls`
  128. httpRequest.downLoadFileForAjax('statisticsExport/exPatinetIntegralAnalysis', fileName, params).then(function () {
  129. vm.exportLoading = false
  130. })
  131. },
  132. eliminateClick() {
  133. var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
  134. if (this.level == 1) {
  135. this.form = {
  136. range: 'town'
  137. }
  138. } else if (this.level == 2) {
  139. this.form = {
  140. range: 'town',
  141. area: selectedRole.code
  142. }
  143. this.getHospital(selectedRole.code)
  144. }
  145. this.yearType = '1'
  146. this.chooseYear = new Date().getFullYear()
  147. this.chooseTime = null
  148. this.$forceUpdate()
  149. },
  150. getHospital(code) {
  151. var vm = this
  152. delete this.form.hospital
  153. delete this.form.team
  154. var params = {
  155. type: 5,
  156. code: code
  157. }
  158. httpRequest.post('common/district', { data: params }).then(function (res) {
  159. vm.hospitalOptions = [{ code: '', name: '全部' }]
  160. vm.hospitalOptions = vm.hospitalOptions.concat(res.list)
  161. })
  162. },
  163. resetArea() {
  164. if (this.level == 1) {
  165. delete this.form.area
  166. delete this.form.hospital
  167. delete this.form.team
  168. } else if (this.level == 2) {
  169. delete this.form.hospital
  170. delete this.form.team
  171. } else {
  172. delete this.form.team
  173. }
  174. },
  175. handleCurrentChange(val) {
  176. this.page = val
  177. this.searchFn()
  178. },
  179. handleSizeChange(val) {
  180. this.size = val
  181. this.searchFn()
  182. }
  183. },
  184. mounted() {
  185. this.init()
  186. }
  187. })