|
|
@@ -1,5 +1,7 @@
|
|
|
<script setup lang="ts">
|
|
|
import dayjs from 'dayjs'
|
|
|
+import { IotRyDailyReportApi } from '@/api/pms/iotrydailyreport'
|
|
|
+import download from '@/utils/download'
|
|
|
import { rangeShortcuts } from '@/utils/formatTime'
|
|
|
import { resolveDailyReportDeptId } from '@/utils/dailyReportDept'
|
|
|
import { useUserStore } from '@/store/modules/user'
|
|
|
@@ -12,6 +14,7 @@ defineOptions({
|
|
|
|
|
|
const route = useRoute()
|
|
|
const pageRouteName = route.name
|
|
|
+const message = useMessage()
|
|
|
const TOP_DEPT_ID = 158
|
|
|
const deptId = resolveDailyReportDeptId(useUserStore().getUser.deptId, TOP_DEPT_ID)
|
|
|
|
|
|
@@ -43,6 +46,7 @@ const query = ref<Query>(createDefaultQuery())
|
|
|
const activeTab = ref<'日报统计' | '非生产时效'>('日报统计')
|
|
|
const deptName = ref('瑞鹰国际钻井')
|
|
|
const refreshKey = ref(0)
|
|
|
+const exportLoading = ref(false)
|
|
|
|
|
|
const getRouteCreateTime = () => {
|
|
|
const createTime = route.query.createTime
|
|
|
@@ -86,12 +90,26 @@ const resetQuery = () => {
|
|
|
handleQuery()
|
|
|
}
|
|
|
|
|
|
+const handleExport = async () => {
|
|
|
+ try {
|
|
|
+ await message.exportConfirm()
|
|
|
+
|
|
|
+ exportLoading.value = true
|
|
|
+ const { pageNo: _pageNo, pageSize: _pageSize, ...params } = query.value
|
|
|
+
|
|
|
+ void _pageNo
|
|
|
+ void _pageSize
|
|
|
+
|
|
|
+ const data = await IotRyDailyReportApi.exportNptStatistics(params)
|
|
|
+ download.excel(data, '瑞鹰钻井非生产时效统计.xlsx')
|
|
|
+ } finally {
|
|
|
+ exportLoading.value = false
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
onMounted(syncQueryFromRoute)
|
|
|
|
|
|
-watch(
|
|
|
- () => [route.query.createTime, route.query.activeTab],
|
|
|
- syncQueryFromRoute
|
|
|
-)
|
|
|
+watch(() => [route.query.createTime, route.query.activeTab], syncQueryFromRoute)
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
@@ -143,6 +161,16 @@ watch(
|
|
|
<el-button size="small" @click="resetQuery">
|
|
|
<Icon icon="ep:refresh" class="mr-5px" /> 重置
|
|
|
</el-button>
|
|
|
+ <el-button
|
|
|
+ v-if="activeTab === '非生产时效'"
|
|
|
+ v-hasPermi="['pms:iot-ry-daily-report:export']"
|
|
|
+ size="small"
|
|
|
+ type="success"
|
|
|
+ plain
|
|
|
+ :loading="exportLoading"
|
|
|
+ @click="handleExport">
|
|
|
+ <Icon icon="ep:download" class="mr-5px" /> 导出
|
|
|
+ </el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
|