<!--
|
* @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>
|