kpi-quarter-picker.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <div>
  3. <mark
  4. v-show="showSeason"
  5. style="position:fixed;top:0;right:0;bottom:0;left:0;z-index:999;background:rgba(0,0,0,0);"
  6. @click.stop="showSeason = false"
  7. ></mark>
  8. <a-input
  9. v-model="showValue"
  10. placeholder="请选择季度"
  11. style="width:138px;"
  12. @focus="showSeason = true"
  13. >
  14. </a-input>
  15. <a-card
  16. v-show="showSeason"
  17. class="box-card"
  18. style="position:fixed;z-index:9999;width:322px;padding: 0 3px 20px;margin-top:10px"
  19. >
  20. <div class="ant-calendar-month-panel-header">
  21. <a
  22. role="button"
  23. title="上一年 (Control键加左方向键)"
  24. class="ant-calendar-month-panel-prev-year-btn"
  25. @click="prev"
  26. ></a>
  27. <a role="button" title="选择年份" class="ant-calendar-month-panel-year-select">
  28. <span class="ant-calendar-month-panel-year-select-content">{{ year }}年</span>
  29. </a>
  30. <a
  31. role="button"
  32. title="下一年 (Control键加右方向键)"
  33. class="ant-calendar-month-panel-next-year-btn"
  34. @click="next"
  35. ></a>
  36. </div>
  37. <div class="text item" style="text-align:center;">
  38. <a-button
  39. type="text"
  40. style="float:left;width:40%;margin-top: 30px;color: #606266"
  41. @click="selectSeason(0)"
  42. >第一季度</a-button
  43. >
  44. <a-button
  45. type="text"
  46. style="float:right;width:40%;margin-top: 30px;color: #606266"
  47. @click="selectSeason(1)"
  48. >第二季度</a-button
  49. >
  50. </div>
  51. <div class="text item" style="text-align:center;">
  52. <a-button
  53. type="text"
  54. style="float:left;width:40%;margin-top: 30px;color: #606266"
  55. @click="selectSeason(2)"
  56. >第三季度</a-button
  57. >
  58. <a-button
  59. type="text"
  60. style="float:right;width:40%;margin-top: 30px;color: #606266"
  61. @click="selectSeason(3)"
  62. >第四季度</a-button
  63. >
  64. </div>
  65. </a-card>
  66. </div>
  67. </template>
  68. <script>
  69. import components from './_import-components/kpi-quarter-picker-import'
  70. export default {
  71. name: 'KpiQuarterPicker',
  72. components,
  73. data() {
  74. return {
  75. showSeason: false,
  76. season: '',
  77. year: new Date().getFullYear(),
  78. showValue: '',
  79. }
  80. },
  81. methods: {
  82. one() {
  83. this.showSeason = false
  84. },
  85. prev() {
  86. this.year = this.year * 1 - 1
  87. },
  88. next() {
  89. this.year = this.year * 1 + 1
  90. },
  91. selectSeason(i) {
  92. const that = this
  93. that.season = i + 1
  94. const quarter = ['一季度', '二季度', '三季度', '四季度']
  95. that.showSeason = false
  96. this.showValue = `${this.year}年${this.season}季度`
  97. const value = JSON.stringify({
  98. year: this.year,
  99. quarter: `第${this.season}季度`,
  100. full: this.year + '' + quarter[i],
  101. })
  102. this.$emit('setvalue', value)
  103. },
  104. },
  105. }
  106. </script>
  107. <style module lang="scss">
  108. @use '@/common/design' as *;
  109. </style>