|
@@ -6,10 +6,10 @@
|
|
|
</template>
|
|
|
<template v-for="field of Object.keys(BaseColumn)" #[`cell_${field}`]="scope">
|
|
|
<DataCompare
|
|
|
- :field="field"
|
|
|
+ :field="field"
|
|
|
:value="scope.row[field]"
|
|
|
:prev-val="scope.row[`prev${field}`]"
|
|
|
- :gap-val="scope.row[`gap${field}`]"
|
|
|
+ :gap-val="scope.row[`gap${field}`]"
|
|
|
:date-range="dateRange"
|
|
|
:show-compare="showCompare"/>
|
|
|
</template>
|
|
@@ -24,15 +24,14 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { ref, onMounted, Ref, watch } from 'vue'
|
|
|
-import { useFs, FsPage } from '@fast-crud/fast-crud'
|
|
|
-import { createCrudOptions } from './crud'
|
|
|
-import { usePublicData } from '/@/stores/publicData'
|
|
|
-import { storeToRefs } from 'pinia'
|
|
|
+import {onMounted, ref, watch} from 'vue'
|
|
|
+import {FsPage, useFs} from '@fast-crud/fast-crud'
|
|
|
+import {createCrudOptions} from './crud'
|
|
|
+import {usePublicData} from '/@/stores/publicData'
|
|
|
+import {storeToRefs} from 'pinia'
|
|
|
import DateRangePicker from '/@/components/DateRangePicker/index.vue'
|
|
|
-import { GetList } from './api'
|
|
|
-import { BaseColumn } from '/@/views/adManage/utils/commonTabColumn.js'
|
|
|
-import { LocationQueryValue } from 'vue-router'
|
|
|
+import {BaseColumn} from '/@/views/adManage/utils/commonTabColumn.js'
|
|
|
+import {LocationQueryValue} from 'vue-router'
|
|
|
import DataCompare from '/@/components/dataCompare/index.vue'
|
|
|
|
|
|
defineOptions({
|
|
@@ -44,32 +43,23 @@ interface Props {
|
|
|
campaignId: LocationQueryValue | LocationQueryValue[]
|
|
|
}
|
|
|
const props = defineProps<Props>()
|
|
|
-const loading = ref(true)
|
|
|
+// const loading = ref(true)
|
|
|
|
|
|
const showCompare = ref(false)
|
|
|
-const fetchData = async () => {
|
|
|
- loading.value = true
|
|
|
- const resp = await GetList({
|
|
|
- campaignId: props.campaignId,
|
|
|
- startDate: dateRange.value[0],
|
|
|
- endDate: dateRange.value[1]
|
|
|
- })
|
|
|
- crudExpose.setTableData(resp.data)
|
|
|
- loading.value = false
|
|
|
-}
|
|
|
|
|
|
-const context = { fetchData }
|
|
|
+const queryParams = ref({
|
|
|
+ campaignId: props.campaignId,
|
|
|
+ dateRange
|
|
|
+})
|
|
|
+const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context: queryParams })
|
|
|
|
|
|
-const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context })
|
|
|
onMounted(async () => {
|
|
|
- await fetchData()
|
|
|
+ crudExpose.doRefresh()
|
|
|
})
|
|
|
|
|
|
-
|
|
|
-
|
|
|
watch(
|
|
|
- dateRange,
|
|
|
- async () => await fetchData()
|
|
|
+ dateRange,
|
|
|
+ async () => crudExpose.doRefresh()
|
|
|
)
|
|
|
|
|
|
</script>
|
|
@@ -81,4 +71,4 @@ watch(
|
|
|
.green {
|
|
|
color: #1cbc0e;
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|