gaoshp
2024-06-23 fbee7228e2f6e43b417d4c3f03020704831261cd
update
已添加1个文件
59 ■■■■■ 文件已修改
src/layout/components/exportDialog.vue 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/layout/components/exportDialog.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,59 @@
<!--
 * @Date: 2024-06-22 18:18:22
 * @LastEditors: Sneed
 * @LastEditTime: 2024-06-22 18:52:18
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/layout/components/exportDialog.vue
-->
<template>
    <el-button type="primary" @click="openimport">导出</el-button>
    <scDialog v-model="visible" style="width: 400px;">
        <el-radio-group v-model="statisticalMethod" class="ml-4">
            <el-radio label="SHIFT">按班次</el-radio>
            <el-radio label="DAY">按日</el-radio>
            <el-radio label="WEEK">按周</el-radio>
            <el-radio label="MONTH">按月</el-radio>
        </el-radio-group>
        <template #footer>
            <el-button type="primary" @click="save">确定</el-button>
        </template>
    </scDialog>
</template>
<script>
import moment from 'moment'
export default {
    props: {
    },
    data() {
        return {
            visible: false,
            statisticalMethod: 'SHIFT'
        }
    },
    methods: {
        openimport() {
            this.visible = true
        },
        save() {
            this.visible = false
            this.$emit('export', this.statisticalMethod)
        },
        format(start, end, statisticalMethod) {
            if (['WEEK', 'MONTH'].includes(this.statisticalMethod)) {
                return {
                    start: moment(start).startOf(statisticalMethod.toLowerCase()).format('YYYY-MM-DD'),
                    end: moment(end).endOf(statisticalMethod.toLowerCase()).format('YYYY-MM-DD')
                }
            } else {
                return {
                    start,
                    end
                }
            }
        }
    },
}
</script>
<style lang="scss" scoped></style>