index.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. var template = ''
  2. $.ajax('../../../component/statistics/RedBagReward/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('red-bag-reward', {
  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. serviceType: ''
  40. },
  41. loading: false,
  42. exportLoading: false,
  43. tableData: [],
  44. page: 1,
  45. size: 10,
  46. total: 0,
  47. level: 0,
  48. health_bank_service_type: []
  49. }
  50. },
  51. methods: {
  52. init() {
  53. var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
  54. if (selectedRole.code.indexOf('350200') > -1) {
  55. this.level = 1 // 市卫健委
  56. this.areaOptions = [
  57. { label: '思明区', value: '350203' },
  58. { label: '海沧区', value: '350205' },
  59. { label: '湖里区', value: '350206' },
  60. { label: '集美区', value: '350211' },
  61. { label: '同安区', value: '350212' },
  62. { label: '翔安区', value: '350213' }
  63. ]
  64. } else if (selectedRole.code.length == 6) {
  65. this.level = 2 // 区管理
  66. this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code }]
  67. this.form = {
  68. range: 'town',
  69. area: selectedRole.code
  70. }
  71. this.getHospital(selectedRole.code)
  72. } else {
  73. this.level = 3 // 社区管理
  74. this.rangeOptions = [
  75. { label: '社区', value: 'hospital' },
  76. { label: '团队', value: 'team' }
  77. ]
  78. this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code.substring(0, 6) }]
  79. this.hospitalOptions = [{ name: selectedRole.name, code: selectedRole.code }]
  80. this.form = {
  81. range: 'hospital',
  82. area: selectedRole.code.substring(0, 6),
  83. hospital: selectedRole.code
  84. }
  85. this.getTeam(selectedRole.code)
  86. }
  87. this.initTime()
  88. this.getList()
  89. this.getDictData()
  90. },
  91. initTime() {
  92. var vm = this
  93. var now = new Date()
  94. vm.nowyear = vm.chooseYear = now.getFullYear()
  95. vm.years = []
  96. for (i = vm.nowyear; i >= 2013; i--) {
  97. vm.years.push(i)
  98. }
  99. },
  100. resetArea() {
  101. if (this.level == 1) {
  102. delete this.form.area
  103. delete this.form.hospital
  104. delete this.form.team
  105. } else if (this.level == 2) {
  106. delete this.form.hospital
  107. delete this.form.team
  108. } else {
  109. delete this.form.team
  110. }
  111. },
  112. getList() {
  113. var vm = this
  114. this.loading = true
  115. var params = {
  116. ...this.form,
  117. page: this.page,
  118. pageSize: this.size
  119. }
  120. if (this.yearType == '1') {
  121. params.startDate = this.chooseYear + '-01-01'
  122. params.endDate = this.chooseYear + '-12-31'
  123. } else {
  124. if (this.chooseTime) {
  125. params.startDate = this.chooseTime[0]
  126. params.endDate = this.chooseTime[1]
  127. }
  128. }
  129. statisticAPI.patientFeeAnalysis(params).then(function (res) {
  130. if (res.status == 200) {
  131. vm.tableData = res.data.list
  132. vm.total = res.data.total
  133. } else {
  134. vm.$message.error(res.msg)
  135. }
  136. vm.loading = false
  137. })
  138. },
  139. getDictData() {
  140. var vm = this
  141. statisticAPI.getDictByDictName({ name: 'health_bank_service_type' }).then(function (res) {
  142. vm.health_bank_service_type = res.list
  143. })
  144. },
  145. queryDate() {
  146. this.page = 1
  147. this.getList()
  148. },
  149. exportTable() {
  150. var vm = this
  151. var params = {
  152. ...this.form,
  153. page: this.page,
  154. pageSize: this.size
  155. }
  156. if (this.yearType == '1') {
  157. params.startDate = this.chooseYear + '-01-01'
  158. params.endDate = this.chooseYear + '-12-31'
  159. } else {
  160. if (this.chooseTime) {
  161. params.startDate = this.chooseTime[0]
  162. params.endDate = this.chooseTime[1]
  163. }
  164. }
  165. this.exportLoading = true
  166. statisticAPI
  167. .exPatientFeeAnalysis(params, '居民红包奖励明细.xls')
  168. .then(function (res) {
  169. vm.exportLoading = false
  170. })
  171. .catch(function (err) {
  172. vm.exportLoading = false
  173. })
  174. },
  175. eliminateClick() {
  176. this.resetArea()
  177. this.yearType = '1'
  178. this.chooseYear = new Date().getFullYear()
  179. this.chooseTime = null
  180. this.$forceUpdate()
  181. },
  182. getHospital(code) {
  183. var vm = this
  184. delete this.form.hospital
  185. delete this.form.team
  186. var params = {
  187. type: 5,
  188. code: code
  189. }
  190. httpRequest.post('common/district', { data: params }).then(function (res) {
  191. vm.hospitalOptions = [{ code: '', name: '全部' }]
  192. vm.hospitalOptions = vm.hospitalOptions.concat(res.list)
  193. })
  194. },
  195. getTeam(code) {
  196. var vm = this
  197. delete this.form.team
  198. var params = {
  199. hospital: code,
  200. area: this.form.area
  201. }
  202. httpRequest.get('statisticsExport/teamList', { data: params }).then(function (res) {
  203. vm.teamOptions = [{ id: '', name: '全部' }]
  204. vm.teamOptions = vm.teamOptions.concat(res.data)
  205. })
  206. },
  207. handleCurrentChange(val) {
  208. this.page = val
  209. this.getList()
  210. },
  211. handleSizeChange(val) {
  212. this.size = val
  213. this.getList()
  214. }
  215. },
  216. mounted() {
  217. this.init()
  218. }
  219. })