index.js 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. var template = ''
  2. $.ajax('../../../component/statistics/ActivityHoldDetail/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-hold-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. activityStatus: '',
  26. eventForm: '',
  27. eventAim: ''
  28. },
  29. tableData: [],
  30. dialogShow: false,
  31. info: {},
  32. page1: 1,
  33. size1: 10,
  34. total1: 0,
  35. page2: 1,
  36. size2: 10,
  37. total2: 0,
  38. loading: false,
  39. exportLoading: false,
  40. rangeOptions: [
  41. { label: '按区', value: 'town' },
  42. { label: '按社区', value: 'hospital' }
  43. ],
  44. areaOptions: [
  45. { label: '思明区', value: '350203' },
  46. { label: '海沧区', value: '350205' },
  47. { label: '湖里区', value: '350206' },
  48. { label: '集美区', value: '350211' },
  49. { label: '同安区', value: '350212' },
  50. { label: '翔安区', value: '350213' }
  51. ],
  52. level: 0,
  53. tableHeader: [
  54. { label: '活动名称', prop: 'title', width: '120' },
  55. { label: '活动一级类别', prop: 'firstClassify', width: '120' },
  56. { label: '活动二级类别', prop: 'secondClassify', width: '120' },
  57. { label: '活动状态', prop: 'activityStatus' },
  58. { label: '举办形式', prop: 'eventForm' },
  59. { label: '举办目的', prop: 'eventAim' },
  60. { label: '主办机构', prop: 'organizer', width: '140' },
  61. { label: '预计报名人数', prop: 'num', width: '120' },
  62. { label: '已报名人数', prop: 'joinNum' },
  63. { label: '参与社区医院数量', prop: 'hospitalNum', width: '140' },
  64. { label: '活动创建时间', prop: 'createTime', width: '120' },
  65. { label: '报名截止时间', prop: 'registrationEndTime', width: '120' },
  66. { label: '活动下线时间', prop: 'offlineEndTime', width: '120' }
  67. ],
  68. dialogShow: false,
  69. query: {},
  70. dialogTableData: [],
  71. dialogHeader: [
  72. { label: '姓名', prop: 'name' },
  73. { label: '性别', prop: 'sex' },
  74. { label: '年龄', prop: 'age' },
  75. { label: '证件号码', prop: 'idcard', width: '120' },
  76. { label: '手机号码', prop: 'mobile' },
  77. { label: '签约机构', prop: 'hospitalName' },
  78. { label: '签约医生', prop: 'doctorName' },
  79. { label: '积分', prop: 'jfTotal' },
  80. { label: '奖励', prop: 'couponTotal' },
  81. { label: '排名', prop: 'ranking' }
  82. ],
  83. dialogLoading: false,
  84. activityId: null
  85. }
  86. },
  87. methods: {
  88. init() {
  89. var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
  90. if (selectedRole.code.indexOf('350200') > -1) {
  91. this.level = 1 // 市卫健委
  92. this.areaOptions = [
  93. { label: '思明区', value: '350203' },
  94. { label: '海沧区', value: '350205' },
  95. { label: '湖里区', value: '350206' },
  96. { label: '集美区', value: '350211' },
  97. { label: '同安区', value: '350212' },
  98. { label: '翔安区', value: '350213' }
  99. ]
  100. } else if (selectedRole.code.length == 6) {
  101. this.level = 2 // 区管理
  102. this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code }]
  103. this.form = {
  104. range: 'town',
  105. area: selectedRole.code,
  106. firstClassify: '',
  107. secondClassify: '',
  108. activityStatus: '',
  109. eventForm: '',
  110. eventAim: ''
  111. }
  112. this.getHospital(selectedRole.code)
  113. }
  114. this.initTime()
  115. this.searchFn()
  116. },
  117. initTime() {
  118. var vm = this
  119. var now = new Date()
  120. vm.nowyear = vm.chooseYear = now.getFullYear()
  121. vm.years = []
  122. for (i = vm.nowyear; i >= 2013; i--) {
  123. vm.years.push(i)
  124. }
  125. },
  126. searchFn() {
  127. var vm = this
  128. this.loading = true
  129. var params = {
  130. ...this.form,
  131. page: this.page1,
  132. size: this.size1
  133. }
  134. vm.tableData = []
  135. if (this.yearType == '1') {
  136. params.startDate = this.chooseYear + '-01-01'
  137. params.endDate = this.chooseYear + '-12-31'
  138. } else {
  139. if (this.chooseTime) {
  140. params.startDate = this.chooseTime[0]
  141. params.endDate = this.chooseTime[1]
  142. }
  143. }
  144. httpRequest.get('doctor/healthBank/eventDetail', { data: params }).then(function (res) {
  145. if (res.status == 200) {
  146. vm.tableData = res.detailModelList
  147. vm.total1 = res.totalCount
  148. }
  149. vm.loading = false
  150. })
  151. },
  152. exportTable() {
  153. var vm = this
  154. var params = {
  155. ...this.form,
  156. page: this.page,
  157. pageSize: this.size
  158. }
  159. if (this.yearType == '1') {
  160. params.startDate = this.chooseYear + '-01-01'
  161. params.endDate = this.chooseYear + '-12-31'
  162. } else {
  163. if (this.chooseTime) {
  164. params.startDate = this.chooseTime[0]
  165. params.endDate = this.chooseTime[1]
  166. }
  167. }
  168. this.exportLoading = true
  169. var fileName = `活动举办明细${new Date().getTime()}.xls`
  170. httpRequest.downLoadFileForAjax('doctor/healthBank/exportEventDetail', fileName, params).then(function () {
  171. vm.exportLoading = false
  172. })
  173. },
  174. eliminateClick() {
  175. var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
  176. if (this.level == 1) {
  177. this.form = {
  178. range: 'town',
  179. firstClassify: '',
  180. secondClassify: '',
  181. activityStatus: '',
  182. eventForm: '',
  183. eventAim: ''
  184. }
  185. } else if (this.level == 2) {
  186. this.form = {
  187. range: 'town',
  188. area: selectedRole.code,
  189. firstClassify: '',
  190. secondClassify: '',
  191. activityStatus: '',
  192. eventForm: '',
  193. eventAim: ''
  194. }
  195. this.getHospital(selectedRole.code)
  196. }
  197. this.yearType = '1'
  198. this.chooseYear = new Date().getFullYear()
  199. this.chooseTime = null
  200. this.$forceUpdate()
  201. },
  202. closeDialog() {
  203. this.dialogShow = false
  204. },
  205. previewDetailData(row) {
  206. this.dialogShow = true
  207. this.activityId = row.id
  208. this.query = {
  209. // sex: ''
  210. }
  211. this.page1 = 1
  212. this.dialogSearch()
  213. },
  214. getHospital(code) {
  215. var vm = this
  216. delete this.form.hospital
  217. delete this.form.team
  218. var params = {
  219. type: 5,
  220. code: code
  221. }
  222. httpRequest.post('common/district', { data: params }).then(function (res) {
  223. vm.hospitalOptions = [{ code: '', name: '全部' }]
  224. vm.hospitalOptions = vm.hospitalOptions.concat(res.list)
  225. })
  226. },
  227. resetArea() {
  228. if (this.level == 1) {
  229. delete this.form.area
  230. delete this.form.hospital
  231. delete this.form.team
  232. } else if (this.level == 2) {
  233. delete this.form.hospital
  234. delete this.form.team
  235. } else {
  236. delete this.form.team
  237. }
  238. },
  239. dialogSearch() {
  240. var vm = this
  241. this.dialogLoading = true
  242. var params = {
  243. ...this.query,
  244. activityId: this.activityId,
  245. page: this.page2,
  246. size: this.size2
  247. }
  248. httpRequest.get('doctor/healthBank/eventDataDetail', { data: params }).then(function (res) {
  249. if (res.status == 200) {
  250. vm.dialogTableData = res.detailModelList
  251. vm.total2 = res.totalCount
  252. }
  253. vm.dialogLoading = false
  254. })
  255. },
  256. dialogExport() {
  257. var vm = this
  258. var params = {
  259. ...this.query,
  260. activityId: this.activityId
  261. }
  262. if (this.yearType == '1') {
  263. params.startDate = this.chooseYear + '-01-01'
  264. params.endDate = this.chooseYear + '-12-31'
  265. } else {
  266. if (this.chooseTime) {
  267. params.startDate = this.chooseTime[0]
  268. params.endDate = this.chooseTime[1]
  269. }
  270. }
  271. this.exportLoading = true
  272. var fileName = `活动数据明细${new Date().getTime()}.xls`
  273. httpRequest.downLoadFileForAjax('doctor/healthBank/exportEventDataDetail', fileName, params).then(function () {
  274. vm.exportLoading = false
  275. })
  276. },
  277. getSecondClassifyList(val) {
  278. switch (val) {
  279. case '':
  280. return [
  281. { label: '全部', value: '' },
  282. { label: '健康运动', value: '健康运动' },
  283. { label: '健康问答', value: '健康问答' },
  284. { label: '健康咨询', value: '健康咨询' }
  285. ]
  286. case '健康运动':
  287. return [
  288. { label: '全部', value: '' },
  289. { label: '健康运动', value: '健康运动' }
  290. ]
  291. case '健康教育':
  292. return [
  293. { label: '全部', value: '' },
  294. { label: '健康问答', value: '健康问答' }
  295. ]
  296. case '促进业务':
  297. return [
  298. { label: '全部', value: '' },
  299. { label: '健康咨询', value: '健康咨询' }
  300. ]
  301. }
  302. }
  303. },
  304. mounted() {
  305. this.init()
  306. }
  307. })