|
@@ -22,7 +22,7 @@
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="">
|
|
<el-form-item label="">
|
|
<el-button type="primary" :icon="Filter" @click="fetchList(1)">筛选</el-button>
|
|
<el-button type="primary" :icon="Filter" @click="fetchList(1)">筛选</el-button>
|
|
- <!-- <el-button @click="exportData">导出</el-button> -->
|
|
|
|
|
|
+ <el-button @click="exportData" :icon="Download" :loading="exportLoading">导出</el-button>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
|
|
|
|
@@ -48,13 +48,15 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
-import { reactive, ref, computed } from "vue";
|
|
|
|
|
|
+import { reactive, ref } from "vue";
|
|
import { ElMessage } from "element-plus";
|
|
import { ElMessage } from "element-plus";
|
|
-import { Filter } from "@element-plus/icons-vue";
|
|
|
|
|
|
+import { Filter, Download } from "@element-plus/icons-vue";
|
|
import api from "/@/api/datahub";
|
|
import api from "/@/api/datahub";
|
|
|
|
+import downloadFile from "/@/utils/download";
|
|
|
|
|
|
const visible = ref(false);
|
|
const visible = ref(false);
|
|
const loading = ref(false);
|
|
const loading = ref(false);
|
|
|
|
+const exportLoading = ref(false);
|
|
const dimensions = ref<any[]>([]);
|
|
const dimensions = ref<any[]>([]);
|
|
const dimensionsValues = ref<any[]>([]);
|
|
const dimensionsValues = ref<any[]>([]);
|
|
const dimensionsKey = ref("");
|
|
const dimensionsKey = ref("");
|
|
@@ -66,8 +68,7 @@ const detail = reactive<any>({}); // 详情含 unit/维度等
|
|
const list = ref<any[]>([]);
|
|
const list = ref<any[]>([]);
|
|
const total = ref(0);
|
|
const total = ref(0);
|
|
|
|
|
|
-// 查询参数(对应后端文档)
|
|
|
|
-const query = reactive({
|
|
|
|
|
|
+const baseQuery = {
|
|
searchValue: "",
|
|
searchValue: "",
|
|
keyWord: "",
|
|
keyWord: "",
|
|
dimensions: "",
|
|
dimensions: "",
|
|
@@ -76,7 +77,10 @@ const query = reactive({
|
|
dateRange: [],
|
|
dateRange: [],
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
-});
|
|
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+// 查询参数(对应后端文档)
|
|
|
|
+const query = reactive(JSON.parse(JSON.stringify(baseQuery)));
|
|
|
|
|
|
function handleDimensionChange(value: string) {
|
|
function handleDimensionChange(value: string) {
|
|
if (!value) {
|
|
if (!value) {
|
|
@@ -132,6 +136,9 @@ function fetchList(p?: number) {
|
|
}
|
|
}
|
|
|
|
|
|
function open(row: any) {
|
|
function open(row: any) {
|
|
|
|
+ Object.assign(query, JSON.parse(JSON.stringify(baseQuery)));
|
|
|
|
+ dimensionsKey.value = "";
|
|
|
|
+ dimensionsValue.value = "";
|
|
code.value = row?.code || "";
|
|
code.value = row?.code || "";
|
|
title.value = `${row?.name || "-"} (${code.value})`;
|
|
title.value = `${row?.name || "-"} (${code.value})`;
|
|
visible.value = true;
|
|
visible.value = true;
|
|
@@ -141,6 +148,14 @@ function open(row: any) {
|
|
fetchDetail().then(() => fetchList(1));
|
|
fetchDetail().then(() => fetchList(1));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+function exportData() {
|
|
|
|
+ exportLoading.value = true;
|
|
|
|
+ api.indicator
|
|
|
|
+ .exportData(buildParams())
|
|
|
|
+ .then((res: any) => downloadFile(res, title.value + "指标数据导出.xlsx"))
|
|
|
|
+ .finally(() => (exportLoading.value = false));
|
|
|
|
+}
|
|
|
|
+
|
|
defineExpose({ open });
|
|
defineExpose({ open });
|
|
</script>
|
|
</script>
|
|
|
|
|