From f5302b82a348926546410e52dc4c51621e457105 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期四, 14 八月 2025 14:49:07 +0800 Subject: [PATCH] 修改了场景信息导入的模板文件 --- src/views/fysp/data-product/base-data-product/PordProblemRecurrence.vue | 172 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 172 insertions(+), 0 deletions(-) diff --git a/src/views/fysp/data-product/base-data-product/PordProblemRecurrence.vue b/src/views/fysp/data-product/base-data-product/PordProblemRecurrence.vue new file mode 100644 index 0000000..b5ee0fe --- /dev/null +++ b/src/views/fysp/data-product/base-data-product/PordProblemRecurrence.vue @@ -0,0 +1,172 @@ +<template> + <FYTable + id="fyTable" + @search="onSearch" + :data="showData" + :pagination="false" + ref="tableRef" + > + <template #options> + <!-- 鍖哄幙 --> + <FYOptionLocation + :allOption="false" + :level="3" + :checkStrictly="false" + v-model:value="formSearch.locations" + ></FYOptionLocation> + <!-- 鍦烘櫙绫诲瀷 --> + <FYOptionScene + :allOption="false" + :type="2" + v-model:value="formSearch.scenetype" + ></FYOptionScene> + <!-- 鏃堕棿 --> + <FYOptionTime + :initValue="false" + type="daterange" + v-model:value="formSearch.timeArr" + style="width: 300px" + ></FYOptionTime> + </template> + + <template #options-expand> + <el-radio-group v-model="radio"> + <el-radio :value="1">鎸夐棶棰樺悕绉扮粺璁�</el-radio> + <el-radio :value="2">鎸夐棶棰樼被鍨嬬粺璁�</el-radio> + </el-radio-group> + </template> + <template #buttons> + <FYDownloadTableButton + label="涓嬭浇娓呭崟" + table-id="fyTable" + :file-name="fileName" + :disabled="downloadDisabled" + ></FYDownloadTableButton> + </template> + <template #table-column="{ size }"> + <!-- <el-table-column fixed="left" label="搴忓彿" width="53"> + <template #default="{ row }"> + {{ row.index + 1 }} + </template> + </el-table-column> --> + <el-table-column fixed="left" label="鍞竴缂栧彿" width="90" prop="index"> + </el-table-column> + <el-table-column + prop="sceneName" + :show-overflow-tooltip="true" + label="鍚嶇О" + > + </el-table-column> + <el-table-column prop="sceneType" label="绫诲瀷" width="60" /> + <!-- <el-table-column prop="provinceName" label="鐪佷唤" width="90"> + </el-table-column> + <el-table-column prop="cityName" label="鍩庡競" width="90"> + </el-table-column> --> + <el-table-column prop="districtName" label="鍖哄幙" width="90"> + </el-table-column> + <el-table-column prop="townName" label="琛楅晣" width="110"> + </el-table-column> + <el-table-column prop="problemType" label="闂绫诲瀷" width="170"> + </el-table-column> + <el-table-column v-if="radio == 1" prop="problemName" label="闂鍚嶇О"> + </el-table-column> + <el-table-column prop="proNum" label="闂鏁�" width="70"> + </el-table-column> + <el-table-column prop="changeNum" label="鏁存敼鏁�" width="70"> + </el-table-column> + </template> + </FYTable> +</template> +<script setup> +import { ref, computed } from 'vue'; +import dayjs from 'dayjs'; +import dataproductApi from '@/api/fysp/dataproductApi.js'; + +const radio = ref(1); +const tableRef = ref(null); +const tableData = ref([]); +const formSearch = ref({ + locations: {}, + scenetype: {}, + timeArr: [dayjs().add(-1, 'M').date(1).toDate(), dayjs().toDate()] +}); + +const option = computed(() => { + const { locations, scenetype, timeArr } = formSearch.value; + return { + provinceCode: locations.pCode, + cityCode: locations.cCode, + districtCode: locations.dCode, + townCode: locations.tCode, + startTime: dayjs(timeArr[0]).format('YYYY-MM-DD HH:mm:ss'), + endTime: dayjs(timeArr[1]) + .hour(23) + .minute(59) + .second(59) + .format('YYYY-MM-DD HH:mm:ss'), + sceneTypeId: scenetype.value + }; +}); + +const showData = computed(() => { + let res = []; + switch (radio.value) { + case 1: + res = tableData.value; + break; + case 2: + tableData.value.forEach((tb) => { + const r = res.find((v) => { + return v.sceneName == tb.sceneName && v.problemType == tb.problemType; + }); + if (r == undefined) { + res.push({ ...tb }); + } else { + r.proNum += tb.proNum; + r.changeNum += tb.changeNum; + } + }); + break; + default: + res = tableData.value; + break; + } + if (tableRef.value) { + tableRef.value.doLayout(); + } + return res; +}); + +const fileName = computed(() => { + const { locations, scenetype, timeArr } = formSearch.value; + return `${locations.dName}${dayjs(timeArr[0]).format( + 'YYYY骞碝M鏈圖D鏃�' + )}鑷�${dayjs(timeArr[1]).format('YYYY骞碝M鏈圖D鏃�')}${ + scenetype.label + }闂澶嶅彂娓呭崟`; +}); + +const downloadDisabled = computed(() => { + return tableData.value.length == 0; +}); + +function onSearch(page, callback) { + fetchProbRecurrence().finally(() => callback()); +} + +function fetchProbRecurrence() { + return dataproductApi.fetchProbRecurrence(option.value).then((res) => { + tableData.value = res.data; + }); +} +// function handleChange(value) { +// switch (value) { +// case 1: +// break; +// case 2: +// break; +// default: +// break; +// } +// } +</script> -- Gitblit v1.9.3