1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <template>
- <div>
- <a-input
- v-model="showValue"
- placeholder="请选择半年"
- style="width:138px;"
- @focus="showSeason = true"
- >
- </a-input>
- <a-card
- v-show="showSeason"
- class="box-card"
- style="position:fixed;z-index:9999;width:322px;padding: 0 3px 20px;margin-top:10px"
- >
- <div class="ant-calendar-month-panel-header">
- <a
- role="button"
- title="上一年 (Control键加左方向键)"
- class="ant-calendar-month-panel-prev-year-btn"
- @click="prev"
- ></a>
- <a role="button" title="选择年份" class="ant-calendar-month-panel-year-select">
- <span class="ant-calendar-month-panel-year-select-content">{{ year }}年</span>
- </a>
- <a
- role="button"
- title="下一年 (Control键加右方向键)"
- class="ant-calendar-month-panel-next-year-btn"
- @click="next"
- ></a>
- </div>
- <div class="text item" style="text-align:center;">
- <a-button
- type="text"
- style="float:left;width:40%;margin-top: 30px;color: #606266"
- @click="selectSeason(0)"
- >上半年</a-button
- >
- <a-button
- type="text"
- style="float:right;width:40%;margin-top: 30px;color: #606266"
- @click="selectSeason(1)"
- >下半年</a-button
- >
- </div>
- </a-card>
- </div>
- </template>
- <script>
- import components from './_import-components/kpi-halfyear-picker-import'
- export default {
- name: 'KpiHalfyearPicker',
- components,
- data() {
- return {
- showSeason: false,
- season: '',
- year: new Date().getFullYear(),
- showValue: '',
- }
- },
- methods: {
- one() {
- this.showSeason = false
- },
- prev() {
- this.year = this.year * 1 - 1
- },
- next() {
- this.year = this.year * 1 + 1
- },
- selectSeason(i) {
- this.season = i + 1
- const quarter = ['上半年', '下半年']
- this.showSeason = false
- this.showValue = `${this.year}年${quarter[i]}`
- const value = JSON.stringify({
- year: this.year,
- quarter: quarter[i],
- full: this.year + '' + quarter[i],
- })
- this.$emit('setvalue', value)
- },
- },
- }
- </script>
- <style module lang="scss">
- @use '@/common/design' as *;
- </style>
|