service-sheet-analysis.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. var reqList = [];
  2. var util = {};
  3. util.treeTableXcode = function(data, xcode) {
  4. xcode = xcode || "";
  5. for(var i = 0; i < data.length; i++) {
  6. var item = data[i];
  7. item.xcode = xcode + i;
  8. if(item.children && item.children.length > 0) {
  9. util.treeTableXcode(item.children, item.xcode + "-");
  10. }
  11. }
  12. };
  13. Vue.use(Vuedals.default);
  14. new Vue({
  15. el: "#main",
  16. data: {
  17. tableData: [],
  18. valueArea: "350203",
  19. optionsArea: [{code:"350203",name:"思明区"}],
  20. valueType:'',
  21. optionsType:[{name:'全部',code:''},{name:'家医代预约',code:'3'},{name:'居民自主预约',code:'1'}],//发起类型(1本人发起 2家人待预约 3家医代预约)
  22. dateValue: [],
  23. pickerOptions: {
  24. disabledDate: function(d) {
  25. return d > new Date();
  26. }
  27. },
  28. isloading:false, //加载中
  29. },
  30. components: {
  31. vuedals: Vuedals.Component
  32. },
  33. mounted: function() {
  34. var vm = this
  35. //初始化时间
  36. var end = new Date();
  37. var start = new Date();
  38. start.setDate(1)
  39. // start.setFullYear(start.getFullYear() - 1);
  40. vm.dateValue = [start.format("yyyy-MM-dd"), end.format("yyyy-MM-dd")]
  41. //初始化数据
  42. vm.initData()
  43. // vm.getDistrict()
  44. $("#main").removeClass("c-hide");
  45. //监听后退按钮的操作
  46. EventBus.$on("back-click", function(arg) {
  47. history.go(-1);
  48. });
  49. //监听页面刷新
  50. EventBus.$on("refresh-click", function(arg) {
  51. // alert("刷新")
  52. vm.initData()
  53. });
  54. window.onresize = function() {
  55. }
  56. },
  57. methods: {
  58. initData: function() {
  59. var vm=this
  60. var startDate,endDate
  61. if(vm.dateValue[0]>vm.dateValue[1]){
  62. vm.$message.warning("开始时间应小于结束时间")
  63. return false
  64. }
  65. vm.isloading=true
  66. startDate=vm.dateValue[0]
  67. endDate=vm.dateValue[1]
  68. var params={
  69. userAgent:localStorage.getItem('wlyyAgentForDoc'),
  70. area:vm.valueArea,startDate:startDate,endDate:endDate,
  71. type:vm.valueType
  72. }
  73. statisticAPI.doorServiceOrderAnalyze(params).then(function(res) {
  74. vm.isloading=false
  75. if(res.status == 200) {
  76. vm.tableData=res.data
  77. util.treeTableXcode(vm.tableData);
  78. } else {
  79. vm.$message.error(res.msg)
  80. }
  81. })
  82. },
  83. seleType:function(){
  84. // this.initData()
  85. },
  86. changeDateValue: function() {
  87. alert(JSON.stringify(this.dateValue))
  88. },
  89. getDistrict: function() {
  90. var vm=this
  91. var params={
  92. type:3,code:"350200"
  93. }
  94. homeAPI.getDistrict(params).then(function(res) {
  95. if(res.status == 200) {
  96. vm.optionsArea=res.list
  97. vm.valueArea=vm.optionsArea[0].code
  98. vm.initData()
  99. } else {
  100. vm.$message.error(res.msg)
  101. }
  102. })
  103. },
  104. exportData: function() {
  105. var vm=this
  106. var startDate,endDate
  107. if(typeof(vm.dateValue[0])!="string"){
  108. startDate=vm.dateValue[0].format("yyyy-MM-dd")
  109. endDate=vm.dateValue[1].format("yyyy-MM-dd")
  110. }else{
  111. startDate=vm.dateValue[0]
  112. endDate=vm.dateValue[1]
  113. }
  114. var params={
  115. userAgent:localStorage.getItem('wlyyAgentForDoc'),
  116. area:vm.valueArea,startDate:startDate,endDate:endDate,
  117. type:vm.valueType
  118. }
  119. var str = statisticAPI.doorServiceOrderAnalyzeExport+"?area="+vm.valueArea+"&startDate="+startDate+"&endDate="+endDate;
  120. window.open(str, "接收包数据导出")//导出数据
  121. },
  122. treeClick: function(item, index) {
  123. if(item.open) {
  124. this.collapse(item, index);
  125. } else {
  126. this.expand(item, index);
  127. }
  128. },
  129. expand: function(item, index) {
  130. if(!item.children) {
  131. return index;
  132. }
  133. //展开
  134. for(var i = 0; item.children && i < item.children.length; i++) {
  135. var child = item.children[i];
  136. this.tableData.splice(++index, 0, child);
  137. if(child.children && child.children.length > 0 && child.open) {
  138. index = this.expand(child, index);
  139. }
  140. }
  141. item.open = true;
  142. return index;
  143. },
  144. collapse: function(item, index) {
  145. if(!item.children) {
  146. return index;
  147. }
  148. //收缩
  149. item.open = false;
  150. var len = this.tableData[index].children.length;
  151. this.tableData.splice(index + 1, len);
  152. },
  153. customFieldColumn: function (h, { column, $index }) {
  154. return h('span', {style:'height:23px;line-height:28px;'}, [
  155. h('el-popover', { props: { placement: 'top', width: '200',trigger: 'hover', content: '评价均分=“已完成”工单总评分/“已完成”工单数量' }}, [
  156. h('span', {slot: 'reference',class:'font-normal'}, ['评价均分(分)',h('span',{class:'wenhao'},'....')])
  157. ])
  158. ])
  159. },
  160. }
  161. });