gaoshp
2024-11-03 3931e2728f618d0090f129b2665bc1285c4440c3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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>