From 642d31285d7aff59415a5eb37f87a79f41d308a8 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期二, 25 三月 2025 17:29:49 +0800
Subject: [PATCH] 新增自动评估扬尘监测数据统计结果上传功能(待完成)
---
src/views/fysp/evaluation/components/precheck/components/CompCheckSource.vue | 192 ++++++++++++++++++++-----------
src/api/index.js | 2
src/views/fysp/evaluation/components/CompDataResultEdit.vue | 105 +++++++++++++++++
src/api/fysp/monitordataApi.js | 28 ++++
src/views/fysp/evaluation/components/precheck/CompPreCheck.vue | 1
src/views/fysp/evaluation/EvalutationRecord.vue | 6 +
6 files changed, 262 insertions(+), 72 deletions(-)
diff --git a/src/api/fysp/monitordataApi.js b/src/api/fysp/monitordataApi.js
new file mode 100644
index 0000000..74bccaa
--- /dev/null
+++ b/src/api/fysp/monitordataApi.js
@@ -0,0 +1,28 @@
+import { $fysp } from '../index';
+
+/**
+ * 鐩戞祴鏁版嵁缁熻鐩稿叧API
+ */
+export default {
+ /**
+ * 涓婁紶鎵皹鐩戞祴鏁版嵁鏈堝害缁熻缁撴灉
+ * @param {Array} dataList 鎵皹鐩戞祴鏁版嵁缁熻缁撴灉鏁扮粍
+ * @returns {Promise}
+ */
+ uploadDustDataResult(dataList) {
+ return $fysp
+ .put(`monitor/data/result/construction/upload`, dataList)
+ .then((res) => res.data);
+ },
+
+ /**
+ * 鑾峰彇鎵皹鐩戞祴鏁版嵁鏈堝害缁熻缁撴灉
+ * @param {Object} area 鏌ヨ鏉′欢琛屾斂鍖哄垝銆佹椂闂淬�佸満鏅被鍨�
+ * @returns
+ */
+ fetchDustDataResult(area) {
+ return $fysp
+ .post(`monitor/data/result/construction/get`, area)
+ .then((res) => res.data);
+ }
+};
diff --git a/src/api/index.js b/src/api/index.js
index 69fae9f..befc092 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -1,7 +1,7 @@
import axios from 'axios';
import { ElMessage } from 'element-plus';
-const debug = false;
+const debug = true;
let ip1 = 'http://47.100.191.150:9005/';
let ip1_file = 'http://47.100.191.150:9005/';
diff --git a/src/views/fysp/evaluation/EvalutationRecord.vue b/src/views/fysp/evaluation/EvalutationRecord.vue
index c47440a..40735b6 100644
--- a/src/views/fysp/evaluation/EvalutationRecord.vue
+++ b/src/views/fysp/evaluation/EvalutationRecord.vue
@@ -278,6 +278,12 @@
if (typeof func === 'function') {
func({ data: this.tableData });
}
+ } else {
+ this.tableData = [];
+ this.orginData = [];
+ if (typeof func === 'function') {
+ func({ data: this.tableData });
+ }
}
});
});
diff --git a/src/views/fysp/evaluation/components/CompDataResultEdit.vue b/src/views/fysp/evaluation/components/CompDataResultEdit.vue
new file mode 100644
index 0000000..8837f56
--- /dev/null
+++ b/src/views/fysp/evaluation/components/CompDataResultEdit.vue
@@ -0,0 +1,105 @@
+<template>
+ <el-row align="top">
+ <el-upload
+ ref="upload"
+ class="upload-file"
+ :limit="1"
+ :on-change="handleChange"
+ :on-exceed="handleExceed"
+ :auto-upload="false"
+ >
+ <template #trigger>
+ <el-button type="primary">涓婁紶鐩戞祴鏁版嵁缁熻缁撴灉</el-button>
+ </template>
+ </el-upload>
+ <el-text>{{ loadTxt }}</el-text>
+ </el-row>
+ <el-table
+ ref="tableRef"
+ :data="data"
+ v-loading="loading"
+ table-layout="fixed"
+ :stripe="true"
+ size="small"
+ height="60vh"
+ border
+ >
+ <el-table-column
+ :show-overflow-tooltip="true"
+ prop="drSceneName"
+ label="鍚嶇О"
+ width="300"
+ />
+ <el-table-column prop="drDeviceCode" label="璁惧鍙�" width="130" />
+ <el-table-column prop="drTime" label="鏃堕棿" width="100">
+ <template #default="{ row }">
+ <span>{{ $fm.formatYMD(row.drTime) }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column prop="drExceedTimes" label="瓒呮爣娆℃暟" />
+ <el-table-column prop="drAvg" label="骞冲潎鍊�" />
+ <el-table-column prop="drMax" label="鏈�澶у��" />
+ <el-table-column prop="drMin" label="鏈�灏忓��" />
+ <el-table-column prop="drOverAvgPer" label="瓒呭尯鍧囧�肩櫨鍒嗘瘮" />
+ <el-table-column prop="drDataNum" label="鏁版嵁閲�" />
+ <el-table-column prop="drEffectiveRate" label="鏈夋晥鐜�" />
+ </el-table>
+</template>
+<script setup>
+import { ref, watch, onMounted } from 'vue';
+import { genFileId } from 'element-plus';
+import monitordataApi from '@/api/fysp/monitordataApi';
+import * as XLSX from 'xlsx';
+
+const props = defineProps({
+ areaInfo: { type: Object }
+});
+
+let workbook;
+const data = ref([]);
+const upload = ref();
+const loadTxt = ref('');
+
+// 鑾峰彇鍘嗗彶缁熻缁撴灉
+function fetchDustDataResult() {
+ monitordataApi.fetchDustDataResult(props.areaInfo).then((res) => {
+ data.value = res.data;
+ });
+}
+
+function handleExceed(files, uploadFiles) {
+ upload.value.clearFiles();
+ const file = files[0];
+ file.uid = genFileId();
+ upload.value.handleStart(file);
+}
+
+function handleChange(uploadFile, uploadFiles) {
+ // console.log(uploadFile, uploadFiles);
+ const fileReader = new FileReader();
+ fileReader.onload = (file) => {
+ const data = file.target.result;
+ workbook = XLSX.read(data, { type: 'array' });
+ console.log(workbook.SheetNames);
+ };
+ fileReader.readAsArrayBuffer(uploadFile.raw);
+}
+
+// 涓婁紶缁熻缁撴灉鏂囨。
+function uploadFile() {}
+
+onMounted(() => {
+ fetchDustDataResult();
+});
+</script>
+<style scoped>
+.upload-file {
+ /* background-color: aliceblue; */
+ width: 300px;
+ min-height: 60px;
+}
+
+:deep(.el-text) {
+ align-self: auto;
+}
+</style>
diff --git a/src/views/fysp/evaluation/components/precheck/CompPreCheck.vue b/src/views/fysp/evaluation/components/precheck/CompPreCheck.vue
index 3bb8745..a2b6e09 100644
--- a/src/views/fysp/evaluation/components/precheck/CompPreCheck.vue
+++ b/src/views/fysp/evaluation/components/precheck/CompPreCheck.vue
@@ -72,6 +72,7 @@
towncode: v._locations.tCode,
townname: v._locations.tName,
starttime: this.$fm.formatYMDH(v.time),
+ endtime: this.$fm.formatYMDH(v.time),
scensetypeid: v._scenetype.value,
online: true,
sourceType: v.sourceType
diff --git a/src/views/fysp/evaluation/components/precheck/components/CompCheckSource.vue b/src/views/fysp/evaluation/components/precheck/components/CompCheckSource.vue
index 33c01fb..82f7e2a 100644
--- a/src/views/fysp/evaluation/components/precheck/components/CompCheckSource.vue
+++ b/src/views/fysp/evaluation/components/precheck/components/CompCheckSource.vue
@@ -1,68 +1,91 @@
<template>
- <el-card shadow="never">
- <template #header>
- <div><el-text tag="b" size="large">鏁版嵁婧愭鏌�</el-text></div>
- <el-text size="small" type="info">妫�鏌ヨ瘎浼版墍闇�鏁版嵁婧愭槸鍚﹀畬鏁�</el-text>
- </template>
- <FormCol>
- <template v-for="(v, i) in checkResults" :key="i">
- <el-row class="h-small" align="middle">
- <el-col :span="14">
- <el-row align="middle">
- <el-text size="default" :class="v.required ? 'required' : 'not-required'">*</el-text>
- <el-text size="default" class="m-l-4">{{ v.name }}</el-text>
- </el-row>
- </el-col>
- <el-col :span="5">
- <el-row align="middle">
- <el-space>
- <template v-if="v.loading">
- <el-icon class="is-loading"><Loading /></el-icon>
- <el-text size="default" type="default">妫�鏌ヤ腑...</el-text>
- </template>
- <template v-else-if="v.pass == true">
- <el-icon color="var(--el-color-success)"><Check /></el-icon>
- <el-text size="default" type="success">閫氳繃</el-text>
- </template>
- <template v-else-if="v.pass == false">
- <el-icon color="var(--el-color-danger)"><Close /></el-icon>
- <el-text size="default" type="danger">缂哄け</el-text>
- </template>
- <template v-else>
- <el-icon color="var(--el-color-warning)"><Warning /></el-icon>
- <el-text size="default" type="warning">鏆傜暐杩�</el-text>
- </template>
- </el-space>
- </el-row>
- </el-col>
- <el-col :span="5">
- <el-button
- v-show="!v.loading"
- :type="v.pass ? '' : 'danger'"
- size="small"
- @click="goto(v.path)"
- :disabled="v.path == ''"
- >
- {{ v.pass ? '鍘讳慨鏀�' : '鍘诲畬鍠�' }}
- <el-icon class="m-l-4"><Right /></el-icon>
- </el-button>
- </el-col>
- </el-row>
- <el-row align="middle" class="m-b-16">
- <el-text size="small" class="not-required">*</el-text>
- <el-text size="small" class="m-l-4 color-i">{{ v.des }}</el-text>
+ <div>
+ <el-card shadow="never">
+ <template #header>
+ <div><el-text tag="b" size="large">鏁版嵁婧愭鏌�</el-text></div>
+ <el-text size="small" type="info">妫�鏌ヨ瘎浼版墍闇�鏁版嵁婧愭槸鍚﹀畬鏁�</el-text>
+ </template>
+ <FormCol>
+ <template v-for="(v, i) in checkResults" :key="i">
+ <el-row class="h-small" align="middle">
+ <el-col :span="14">
+ <el-row align="middle">
+ <el-text
+ size="default"
+ :class="v.required ? 'required' : 'not-required'"
+ >*</el-text
+ >
+ <el-text size="default" class="m-l-4">{{ v.name }}</el-text>
+ </el-row>
+ </el-col>
+ <el-col :span="5">
+ <el-row align="middle">
+ <el-space>
+ <template v-if="v.loading">
+ <el-icon class="is-loading"><Loading /></el-icon>
+ <el-text size="default" type="default">妫�鏌ヤ腑...</el-text>
+ </template>
+ <template v-else-if="v.pass == true">
+ <el-icon color="var(--el-color-success)"><Check /></el-icon>
+ <el-text size="default" type="success">閫氳繃</el-text>
+ </template>
+ <template v-else-if="v.pass == false">
+ <el-icon color="var(--el-color-danger)"><Close /></el-icon>
+ <el-text size="default" type="danger">缂哄け</el-text>
+ </template>
+ <template v-else>
+ <el-icon color="var(--el-color-warning)"
+ ><Warning
+ /></el-icon>
+ <el-text size="default" type="warning">鏆傜暐杩�</el-text>
+ </template>
+ </el-space>
+ </el-row>
+ </el-col>
+ <el-col :span="5">
+ <el-button
+ v-show="!v.loading"
+ :type="v.pass ? '' : 'danger'"
+ size="small"
+ @click="goto(v.path)"
+ :disabled="v.path == ''"
+ >
+ {{ v.pass ? '鍘讳慨鏀�' : '鍘诲畬鍠�' }}
+ <el-icon class="m-l-4"><Right /></el-icon>
+ </el-button>
+ </el-col>
+ </el-row>
+ <el-row align="middle" class="m-b-16">
+ <el-text size="small" class="not-required">*</el-text>
+ <el-text size="small" class="m-l-4 color-i">{{ v.des }}</el-text>
+ </el-row>
+ </template>
+ </FormCol>
+ <template #footer>
+ <el-row justify="space-around">
+ <el-button type="primary" size="default" @click="lastStep"
+ >涓婁竴姝�</el-button
+ >
+ <el-button
+ :disabled="!checkPass"
+ type="primary"
+ size="default"
+ @click="nextStep"
+ >涓嬩竴姝�</el-button
+ >
</el-row>
</template>
- </FormCol>
- <template #footer>
- <el-row justify="space-around">
- <el-button type="primary" size="default" @click="lastStep">涓婁竴姝�</el-button>
- <el-button :disabled="!checkPass" type="primary" size="default" @click="nextStep"
- >涓嬩竴姝�</el-button
- >
- </el-row>
- </template>
- </el-card>
+ </el-card>
+ <el-dialog
+ title="鎵皹鐩戞祴鏁版嵁鏈堝害缁熻绠$悊"
+ v-model="dialog1"
+ destroy-on-close
+ width="90%"
+ >
+ <CompDataResultEdit :areaInfo="areaInfo"></CompDataResultEdit>
+ <template #footer> </template>
+ </el-dialog>
+ </div>
</template>
<script>
@@ -70,14 +93,16 @@
import taskApi from '@/api/fysp/taskApi';
import userMapApi from '@/api/fysp/userMapApi';
import problemApi from '@/api/fysp/problemApi';
+import monitordataApi from '@/api/fysp/monitordataApi';
import complaintApi from '@/api/fytz/complaintApi';
+import CompDataResultEdit from '../../CompDataResultEdit.vue';
/**
- * 鐢熸垚涓�椤规暟鎹簮妫�鏌ヨ褰�
- * @param {*} _name
- * @param {*} _path
- * @param {*} _fetch
- * @param {*} _required
+ * 鐢熸垚涓�椤规暟鎹簮妫�鏌ユ潯鐩�
+ * @param {*} _name 鏉$洰鍚嶇О
+ * @param {*} _path 璺宠浆椤甸潰URL
+ * @param {*} _fetch 鏉$洰鐨勭綉缁滆姹傚嚱鏁�
+ * @param {*} _required 鏄惁蹇呴��
*/
function baseCheckItem(_name, _path, _fetch, _required) {
return {
@@ -90,7 +115,7 @@
async fetch() {
this.loading = true;
setTimeout(async () => {
- if (_fetch != undefined) {
+ if (typeof _fetch === 'function') {
_fetch()
.then((res) => {
this.pass = res ? res.pass : undefined;
@@ -117,6 +142,9 @@
* 璇勪及鏁版嵁婧愬畬鏁存�ф鏌�
*/
export default {
+ components: {
+ CompDataResultEdit
+ },
props: {
// 姝ラ涓嬫爣
modelValue: Number
@@ -173,7 +201,26 @@
});
}),
// 鍖哄煙鑼冨洿鍐呯殑鐩戞祴鏁版嵁鏄惁瀛樺湪銆佹暟鎹椂闂磋法搴︽槸鍚﹀畬鏁淬�佹暟鎹殑鍒濇鍒嗘瀽鏄惁瀹屾垚
- baseCheckItem('鐜板満鐩戞祴鏁版嵁', ''),
+ baseCheckItem(
+ '鐜板満鐩戞祴鏁版嵁',
+ () => {
+ this.dialog1 = true;
+ },
+ () => {
+ return monitordataApi
+ .fetchDustDataResult(this.areaInfo)
+ .then((res) => {
+ const pass = res.data.length > 0;
+ let des = '';
+ if (pass) {
+ des = `鎵惧埌鏈堝害缁熻鍏�${res.data.length}鏉;
+ } else {
+ des = '鏈壘鍒扮浉鍏宠褰�';
+ }
+ return { pass, des };
+ });
+ }
+ ),
// 鍖哄煙鑼冨洿鍐呯殑姣忎釜鐩戠鐐逛綅涓庣洃娴嬩华鍣ㄧ殑鍖归厤璁板綍鏄惁瀛樺湪锛岀己澶辨儏鍐电瓑
baseCheckItem('鐩戠鐐逛綅涓庣洃娴嬬偣鍖归厤', '', () => {
return userMapApi.fetchDeviceMap(this.areaInfo).then((res) => {
@@ -211,7 +258,8 @@
// complaintApi.fetchPunishment();
// 鍖哄煙鑼冨洿鍐呯殑琛屾斂澶勭綒璁板綍鏄惁瀛樺湪锛屽彲闅忔椂琛ュ厖
baseCheckItem('琛屾斂澶勭綒', '')
- ]
+ ],
+ dialog1: false
};
},
computed: {
@@ -243,8 +291,10 @@
},
// 璺宠浆妫�鏌ラ」鐨勯摼鎺�
goto(path) {
- if (path && path != '') {
+ if (typeof path === 'string' && path != '') {
this.$router.push(path);
+ } else if (typeof path === 'function') {
+ path();
}
},
// 寮�濮嬫鏌ヤ换鍔�
--
Gitblit v1.9.3