index.js 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. var template = ''
  2. $.ajax('../../../component/statistics/ActivityRegisterDetail/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('activity-register-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. firstClassify: '',
  24. secondClassify: ''
  25. },
  26. tableData: [],
  27. dialogShow: false,
  28. info: {},
  29. page: 1,
  30. size: 10,
  31. total: 0,
  32. loading: false,
  33. exportLoading: false,
  34. rangeOptions: [
  35. { label: '区', value: 'town' },
  36. { label: '社区', value: 'hospital' },
  37. { label: '团队', value: 'team' }
  38. ],
  39. areaOptions: [
  40. { label: '思明区', value: '350203' },
  41. { label: '海沧区', value: '350205' },
  42. { label: '湖里区', value: '350206' },
  43. { label: '集美区', value: '350211' },
  44. { label: '同安区', value: '350212' },
  45. { label: '翔安区', value: '350213' }
  46. ],
  47. level: 0,
  48. tableHeader: [
  49. { label: '姓名', prop: 'name' },
  50. { label: '性别', prop: 'sex' },
  51. { label: '年龄', prop: 'age' },
  52. { label: '证件号码', prop: 'idcard' },
  53. { label: '手机号码', prop: 'mobile' },
  54. { label: '签约机构', prop: 'hospitalName' },
  55. { label: '签约医生', prop: 'doctorName' },
  56. { label: '活动名称', prop: 'title' },
  57. { label: '活动一级类别', prop: 'firstClassify' },
  58. { label: '活动二级类别', prop: 'secondClassify' },
  59. { label: '主办机构', prop: 'organizer' },
  60. { label: '获得积分', prop: 'total' },
  61. { label: '获得奖励金额', prop: 'feeTotal' },
  62. { label: '参与活动时间', prop: 'updateTime' }
  63. ],
  64. hospitalOptions: [],
  65. teamOptions: []
  66. }
  67. },
  68. methods: {
  69. init() {
  70. var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
  71. if (selectedRole.code.indexOf('350200') > -1) {
  72. this.level = 1 // 市卫健委
  73. this.areaOptions = [
  74. { label: '思明区', value: '350203' },
  75. { label: '海沧区', value: '350205' },
  76. { label: '湖里区', value: '350206' },
  77. { label: '集美区', value: '350211' },
  78. { label: '同安区', value: '350212' },
  79. { label: '翔安区', value: '350213' }
  80. ]
  81. } else if (selectedRole.code.length == 6) {
  82. this.level = 2 // 区管理
  83. this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code }]
  84. this.form = {
  85. range: 'town',
  86. area: selectedRole.code
  87. }
  88. this.getHospital(selectedRole.code)
  89. } else {
  90. this.level = 3 // 社区管理
  91. this.rangeOptions = [
  92. { label: '社区', value: 'hospital' },
  93. { label: '团队', value: 'team' }
  94. ]
  95. this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code.substring(0, 6) }]
  96. this.hospitalOptions = [{ name: selectedRole.name, code: selectedRole.code }]
  97. this.form = {
  98. range: 'hospital',
  99. area: selectedRole.code.substring(0, 6),
  100. hospital: selectedRole.code
  101. }
  102. this.getTeam(selectedRole.code)
  103. }
  104. this.initTime()
  105. this.searchFn()
  106. },
  107. initTime() {
  108. var vm = this
  109. var now = new Date()
  110. vm.nowyear = vm.chooseYear = now.getFullYear()
  111. vm.years = []
  112. for (i = vm.nowyear; i >= 2013; i--) {
  113. vm.years.push(i)
  114. }
  115. },
  116. searchFn() {
  117. var vm = this
  118. this.loading = true
  119. var params = {
  120. ...this.form,
  121. page: this.page,
  122. size: this.size
  123. }
  124. vm.tableData = []
  125. if (this.yearType == '1') {
  126. params.startDate = this.chooseYear + '-01-01'
  127. params.endDate = this.chooseYear + '-12-31'
  128. } else {
  129. if (this.chooseTime) {
  130. params.startDate = this.chooseTime[0]
  131. params.endDate = this.chooseTime[1]
  132. }
  133. }
  134. httpRequest.get('doctor/healthBank/eventRegistrationDetail', { data: params }).then(function (res) {
  135. if (res.status == 200) {
  136. vm.tableData = res.detailModelList
  137. vm.total = res.totalCount
  138. }
  139. vm.loading = false
  140. })
  141. },
  142. exportTable() {
  143. var vm = this
  144. var params = {
  145. ...this.form,
  146. page: this.page,
  147. pageSize: this.size
  148. }
  149. if (this.yearType == '1') {
  150. params.startDate = this.chooseYear + '-01-01 00:00'
  151. params.endDate = this.chooseYear + '-12-31 23:59'
  152. } else {
  153. if (this.chooseTime) {
  154. params.startDate = this.chooseTime[0] + ' 00:00'
  155. params.endDate = this.chooseTime[1] + ' 23:59'
  156. }
  157. }
  158. this.exportLoading = true
  159. var fileName = `居民活动报名明细${new Date().getTime()}.xls`
  160. httpRequest.downLoadFileForAjax('doctor/healthBank/exportEventRegistrationDetail', fileName, params).then(function () {
  161. vm.exportLoading = false
  162. })
  163. },
  164. eliminateClick() {
  165. var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
  166. if (this.level == 1) {
  167. this.form = {
  168. range: 'town',
  169. firstClassify: '',
  170. secondClassify: ''
  171. }
  172. } else if (this.level == 2) {
  173. this.form = {
  174. range: 'town',
  175. area: selectedRole.code,
  176. firstClassify: '',
  177. secondClassify: ''
  178. }
  179. this.getHospital(selectedRole.code)
  180. }
  181. this.yearType = '1'
  182. this.chooseYear = new Date().getFullYear()
  183. this.chooseTime = null
  184. this.$forceUpdate()
  185. },
  186. getHospital(code) {
  187. var vm = this
  188. delete this.form.hospital
  189. delete this.form.team
  190. var params = {
  191. type: 5,
  192. code: code
  193. }
  194. httpRequest.post('common/district', { data: params }).then(function (res) {
  195. vm.hospitalOptions = [{ code: '', name: '全部' }]
  196. vm.hospitalOptions = vm.hospitalOptions.concat(res.list)
  197. })
  198. },
  199. resetArea() {
  200. if (this.level == 1) {
  201. delete this.form.area
  202. delete this.form.hospital
  203. delete this.form.team
  204. } else if (this.level == 2) {
  205. delete this.form.hospital
  206. delete this.form.team
  207. } else {
  208. delete this.form.team
  209. }
  210. },
  211. handleCurrentChange(val) {
  212. this.page = val
  213. this.searchFn()
  214. },
  215. handleSizeChange(val) {
  216. this.size = val
  217. this.searchFn()
  218. },
  219. getTeam(code) {
  220. var vm = this
  221. delete this.form.team
  222. var params = {
  223. hospital: code,
  224. area: this.form.area
  225. }
  226. httpRequest.get('statisticsExport/teamList', { data: params }).then(function (res) {
  227. vm.teamOptions = [{ id: '', name: '全部' }]
  228. vm.teamOptions = vm.teamOptions.concat(res.data)
  229. })
  230. },
  231. getSecondClassifyList(val) {
  232. switch (val) {
  233. case '':
  234. return [
  235. { label: '全部', value: '' },
  236. { label: '健康运动', value: '健康运动' },
  237. { label: '健康问答', value: '健康问答' },
  238. { label: '健康咨询', value: '健康咨询' }
  239. ]
  240. case '健康运动':
  241. return [
  242. { label: '全部', value: '' },
  243. { label: '健康运动', value: '健康运动' }
  244. ]
  245. case '健康教育':
  246. return [
  247. { label: '全部', value: '' },
  248. { label: '健康问答', value: '健康问答' }
  249. ]
  250. case '促进业务':
  251. return [
  252. { label: '全部', value: '' },
  253. { label: '健康咨询', value: '健康咨询' }
  254. ]
  255. }
  256. }
  257. },
  258. mounted() {
  259. this.init()
  260. }
  261. })