header-prompt.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. Vue.component('header-prompt', {
  2. template: '<div class="cb-ebebf5 height-30 lheight-30 pl20 c-f12">\
  3. <span class="c-666">{{areaName}}</span> (\
  4. </div>',
  5. props: [],
  6. data: function() {
  7. return {
  8. areaName:"",
  9. jieZhiTime:"",
  10. selectDate:"",
  11. dimensionVal:"",
  12. dimensionVal2: ""
  13. }
  14. },
  15. mounted: function() {
  16. var vm = this;
  17. getJieZhiTime(vm);
  18. //更新区域名称
  19. EventBus.$on('update-area-name', function(arg) {
  20. vm.areaName = arg.areaName;
  21. });
  22. //更新统计时间
  23. EventBus.$on('update-statistics-time', function(arg) {
  24. getJieZhiTime(vm);
  25. });
  26. //更新年份
  27. EventBus.$on('update-statistics-year', function(arg) {
  28. vm.selectDate = arg.selectDate;
  29. });
  30. //更新维度名称
  31. EventBus.$on('update-dimension-name', function(arg) {
  32. vm.dimensionVal = arg.dimensionVal;
  33. });
  34. //更新维度2名称
  35. EventBus.$on('update-dimension2-name', function(arg){
  36. vm.dimensionVal2 = arg.dimensionVal2;
  37. });
  38. //更新所有信息
  39. EventBus.$on('update-all-prompt-info', function(arg) {
  40. vm.areaName = arg.areaName;
  41. getJieZhiTime(vm);
  42. vm.selectDate = arg.selectDate;
  43. vm.dimensionVal = arg.dimensionVal;
  44. });
  45. },
  46. methods: {
  47. }
  48. })
  49. //获取统计时间
  50. function getJieZhiTime(vm){
  51. statisticAPI.statisticsTime({}).then(function(res) {
  52. if(res.status=="200"){
  53. var date = (res.data && res.data.substring(11,16)) || "";
  54. vm.jieZhiTime = date;
  55. }
  56. })
  57. }