index.js 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. var template = ''
  2. $.ajax('../../../component/statistics/SignSituation/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('sign-situation', {
  14. template: template,
  15. props: [],
  16. data: function () {
  17. return {
  18. years: [],
  19. yearType: '1',
  20. chooseYear: null,
  21. chooseTime: null,
  22. rangeOptions: [
  23. { label: '区', value: 'town' },
  24. { label: '社区', value: 'hospital' },
  25. { label: '团队', value: 'team' }
  26. ],
  27. areaOptions: [
  28. { label: '思明区', value: '350203' },
  29. { label: '海沧区', value: '350205' },
  30. { label: '湖里区', value: '350206' },
  31. { label: '集美区', value: '350211' },
  32. { label: '同安区', value: '350212' },
  33. { label: '翔安区', value: '350213' }
  34. ],
  35. hospitalOptions: [],
  36. teamOptions: [],
  37. form: {
  38. range: 'town'
  39. },
  40. loading: false,
  41. exportLoading: false,
  42. tableData: [],
  43. tableHeader: [
  44. { label: '名称', prop: 'name', width: '110' },
  45. { label: '签约数', prop: 'total', width: '90' },
  46. { label: '0~6岁人群', prop: '1', width: '90' },
  47. { label: '7~18岁人群', prop: '2', width: '110' },
  48. { label: '19~30岁人数', prop: '3', width: '110' },
  49. { label: '31~50岁人群', prop: '4', width: '110' },
  50. { label: '51~64岁人群', prop: '5', width: '110' },
  51. { label: '65岁以上', prop: '6', width: '110' },
  52. ],
  53. page: 1,
  54. size: 10,
  55. total: 0,
  56. level: 0
  57. }
  58. },
  59. methods: {
  60. init() {
  61. var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
  62. if (selectedRole.code.indexOf('350200') > -1) {
  63. this.level = 1 // 市卫健委
  64. this.areaOptions = [
  65. { label: '思明区', value: '350203' },
  66. { label: '海沧区', value: '350205' },
  67. { label: '湖里区', value: '350206' },
  68. { label: '集美区', value: '350211' },
  69. { label: '同安区', value: '350212' },
  70. { label: '翔安区', value: '350213' }
  71. ]
  72. } else if (selectedRole.code.length == 6) {
  73. this.level = 2 // 区管理
  74. this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code }]
  75. this.form = {
  76. range: 'town',
  77. area: selectedRole.code
  78. }
  79. this.getHospital(selectedRole.code)
  80. } else {
  81. this.level = 3 // 社区管理
  82. this.rangeOptions = [
  83. { label: '社区', value: 'hospital' },
  84. { label: '团队', value: 'team' }
  85. ]
  86. this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code.substring(0, 6) }]
  87. this.hospitalOptions = [{ name: selectedRole.name, code: selectedRole.code }]
  88. this.form = {
  89. range: 'hospital',
  90. area: selectedRole.code.substring(0, 6),
  91. hospital: selectedRole.code
  92. }
  93. this.getTeam(selectedRole.code)
  94. }
  95. this.initTime()
  96. this.getList()
  97. },
  98. initTime() {
  99. var vm = this
  100. var now = new Date()
  101. vm.nowyear = vm.chooseYear = now.getFullYear()
  102. vm.years = []
  103. for (i = vm.nowyear; i >= 2013; i--) {
  104. vm.years.push(i)
  105. }
  106. },
  107. resetArea() {
  108. if (this.level == 1) {
  109. delete this.form.area
  110. delete this.form.hospital
  111. delete this.form.team
  112. } else if (this.level == 2) {
  113. delete this.form.hospital
  114. delete this.form.team
  115. } else {
  116. delete this.form.team
  117. }
  118. },
  119. getList() {
  120. var vm = this
  121. this.loading = true
  122. var params = {
  123. ...this.form,
  124. page: this.page,
  125. pageSize: this.size
  126. }
  127. if (this.yearType == '1') {
  128. params.startDate = this.chooseYear + '-01-01'
  129. params.endDate = this.chooseYear + '-12-31'
  130. } else {
  131. if (this.chooseTime) {
  132. params.startDate = this.chooseTime[0]
  133. params.endDate = this.chooseTime[1]
  134. }
  135. }
  136. httpRequest.get('statistics/collaborate/signInfoStatistics', { data: params }).then(function (res) {
  137. if (res.status == 200) {
  138. vm.tableData = res.detailModelList
  139. vm.total = res.totalCount
  140. }
  141. vm.loading = false
  142. })
  143. },
  144. queryDate() {
  145. this.page = 1
  146. this.getList()
  147. },
  148. exportTable() {
  149. var vm = this
  150. var params = {
  151. ...this.form,
  152. page: this.page,
  153. pageSize: this.size
  154. }
  155. if (this.yearType == '1') {
  156. params.startDate = this.chooseYear + '-01-01'
  157. params.endDate = this.chooseYear + '-12-31'
  158. } else {
  159. if (this.chooseTime) {
  160. params.startDate = this.chooseTime[0]
  161. params.endDate = this.chooseTime[1]
  162. }
  163. }
  164. this.exportLoading = true
  165. var fileName = `签约情况统计${new Date().getTime()}.xls`
  166. httpRequest.downLoadFileForAjax('statistics/collaborate/exportSignInfoStatistics', fileName, params).then(function () {
  167. vm.exportLoading = false
  168. })
  169. },
  170. eliminateClick() {
  171. var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
  172. if (this.level == 1) {
  173. this.form = {
  174. range: 'town'
  175. }
  176. } else if (this.level == 2) {
  177. this.form = {
  178. range: 'town',
  179. area: selectedRole.code
  180. }
  181. this.getHospital(selectedRole.code)
  182. } else {
  183. this.form = {
  184. range: 'hospital',
  185. area: selectedRole.code.substring(0, 6),
  186. hospital: selectedRole.code
  187. }
  188. this.getTeam(selectedRole.code)
  189. }
  190. this.yearType = '1'
  191. this.chooseYear = new Date().getFullYear()
  192. this.chooseTime = null
  193. this.$forceUpdate()
  194. },
  195. getHospital(code) {
  196. var vm = this
  197. delete this.form.hospital
  198. delete this.form.team
  199. var params = {
  200. type: 5,
  201. code: code
  202. }
  203. httpRequest.post('common/district', { data: params }).then(function (res) {
  204. vm.hospitalOptions = [{ code: '', name: '全部' }]
  205. vm.hospitalOptions = vm.hospitalOptions.concat(res.list)
  206. })
  207. },
  208. getTeam(code) {
  209. var vm = this
  210. delete this.form.team
  211. var params = {
  212. hospital: code,
  213. area: this.form.area
  214. }
  215. httpRequest.get('statisticsExport/teamList', { data: params }).then(function (res) {
  216. vm.teamOptions = [{ id: '', name: '全部' }]
  217. vm.teamOptions = vm.teamOptions.concat(res.data)
  218. })
  219. },
  220. handleCurrentChange(val) {
  221. this.page = val
  222. this.getList()
  223. },
  224. handleSizeChange(val) {
  225. this.size = val
  226. this.getList()
  227. }
  228. },
  229. mounted() {
  230. this.init()
  231. }
  232. })