From 0769ed619cd7fde13671a8a73e9689d6af5aa17c Mon Sep 17 00:00:00 2001 From: shixiaoman <531268472@qq.com> Date: Mon, 29 Nov 2021 19:08:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B1=9F=E6=B2=B3=E6=A8=A1=E5=9D=97=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/ecology/river-site.js | 5 + src/api/ecology/river-station.js | 5 + src/api/ecology/river.js | 7 + src/api/ecology/water-function-area.js | 5 + src/views/water/river/collect/index.vue | 470 ++++++++++++------ src/views/water/river/collect/utils.js | 4 + src/views/water/river/statistic/base.vue | 29 +- .../water-function-area/collect/colums.js | 1 + 8 files changed, 374 insertions(+), 152 deletions(-) diff --git a/src/api/ecology/river-site.js b/src/api/ecology/river-site.js index bb9b3a2..a9b360a 100644 --- a/src/api/ecology/river-site.js +++ b/src/api/ecology/river-site.js @@ -1,6 +1,10 @@ import axios from 'axios'; // -------------------江河--水站水功能区数据列表----------------------- const pageBillUrl = '/surfaceWaterSection/waterSiteBill/page'; +// 判断是否有重复数据 +const saveJudgeInfoSite = function (data) { + return axios.post("/surfaceWaterSection/waterSiteBill/judgeInfo",data) +} // 添加 const saveRiverSiteBill = function (data) { return axios.post("/surfaceWaterSection/waterSiteBill/importBatch",data) @@ -59,6 +63,7 @@ const getColumnOptions = function(column){ export { pageBillUrl, saveRiverSiteBill, + saveJudgeInfoSite, removeRiverStationBill, updateRiverStationBill, removeBatchRiverStationBill, diff --git a/src/api/ecology/river-station.js b/src/api/ecology/river-station.js index e524c1d..9e34dee 100644 --- a/src/api/ecology/river-station.js +++ b/src/api/ecology/river-station.js @@ -1,6 +1,10 @@ import axios from 'axios'; // -------------------区控水站水功能区数据列表----------------------- const pageBillUrl = '/waterFunctionArea/waterStationWaterFunctionAreaBill/page'; +// 判断是否有重复数据 +const saveJudgeInfoStation = function (data) { + return axios.post("/waterFunctionArea/waterStationWaterFunctionAreaBill/judgeInfo",data) +} // 添加 const saveRiverStationBill = function (data) { return axios.post("/waterFunctionArea/waterStationWaterFunctionAreaBill/batch",data) @@ -72,6 +76,7 @@ const getGisArea = function(data){ } export { pageBillUrl, + saveJudgeInfoStation, saveRiverStationBill, removeRiverStationBill, updateRiverStationBill, diff --git a/src/api/ecology/river.js b/src/api/ecology/river.js index a8794f5..3bccadf 100644 --- a/src/api/ecology/river.js +++ b/src/api/ecology/river.js @@ -1,6 +1,12 @@ import axios from 'axios'; // ----------------------列表----------------------- const pageBillUrl = '/surfaceWaterSection/surfaceWaterSectionBill/page'; + +//判断数据是否重复 +const saveJudgeInfo = function (data) { + return axios.post("/surfaceWaterSection/surfaceWaterSectionBill/judgeInfo",data) +} + // 添加 const saveRiverBill = function (data) { return axios.post("/surfaceWaterSection/surfaceWaterSectionBill/importBatch",data) @@ -63,6 +69,7 @@ const getColumnOptions = function(column){ export { pageBillUrl, + saveJudgeInfo, saveRiverBill, removeRiverBill, updateRiverBill, diff --git a/src/api/ecology/water-function-area.js b/src/api/ecology/water-function-area.js index eb173a7..042c4b5 100644 --- a/src/api/ecology/water-function-area.js +++ b/src/api/ecology/water-function-area.js @@ -1,6 +1,10 @@ import axios from 'axios'; // ----------------------列表----------------------- const pageBillUrl = '/waterFunctionArea/nationalLevelWaterFunctionAreaBill/page'; +// 判断是否有重复数据 +const saveJudgeInfoWater = function (data) { + return axios.post("/waterFunctionArea/nationalLevelWaterFunctionAreaBill/judgeInfo",data) +} // 添加 const saveWaterFunctionAreaBill = function (data) { return axios.post("/waterFunctionArea/nationalLevelWaterFunctionAreaBill/importBatch",data) @@ -73,6 +77,7 @@ const getGisArea = function(data){ export { pageBillUrl, saveWaterFunctionAreaBill, + saveJudgeInfoWater, removeWaterFunctionAreaBill, updateWaterFunctionAreaBill, removeBatchWaterFunctionAreaBill, diff --git a/src/views/water/river/collect/index.vue b/src/views/water/river/collect/index.vue index 3b73c77..62adeaf 100644 --- a/src/views/water/river/collect/index.vue +++ b/src/views/water/river/collect/index.vue @@ -11,12 +11,14 @@ + 水站导入 + + + @@ -85,13 +92,16 @@ DownOutlined } from "@ant-design/icons-vue"; import { - saveWaterFunctionAreaBill + saveWaterFunctionAreaBill, + saveJudgeInfoWater, } from "@/api/ecology/water-function-area" import { - saveRiverBill + saveRiverBill, + saveJudgeInfo, } from "@/api/ecology/river"; import { - saveRiverStationBill + saveRiverStationBill, + saveJudgeInfoStation, } from "@/api/ecology/river-station"; import { @@ -99,7 +109,8 @@ } from "@/api/ecology/water/river-water"; import { - saveRiverSiteBill + saveRiverSiteBill, + saveJudgeInfoSite, } from "@/api/ecology/river-site"; import { downloadTemplatexls, @@ -120,40 +131,42 @@ visible: false, exportType: String, visibleWater: false, + visibleConfirm: false, + confirmTitle: String, form: [], param: {} }; }, - created(){ - this.form=[]; + created() { + this.form = []; listInfo().then((res) => { - if (res.data.code == 0) { - console.log(res.data.data) - this.visibleWater = true; - res.data.data.forEach(e => { - this.form.push(e); - }); - console.log("this.form"+this.form[0].stationName) - } else { - this.$message.error(res.data.msg); - } - }) - }, - - - methods: { - showModalWater(){ - listInfo().then((res) => { - if (res.data.code == 0) { - console.log(res.data.data) - this.visibleWater = true; - this.form = res.data.data - console.log("this.form"+this.form.stationName) - } else { - this.$message.error(res.data.msg); - } - }) + if (res.data.code == 0) { + console.log(res.data.data) + this.visibleWater = true; + res.data.data.forEach(e => { + this.form.push(e); + }); + console.log("this.form" + this.form[0].stationName) + } else { + this.$message.error(res.data.msg); + } + }) }, + + + methods: { + showModalWater() { + listInfo().then((res) => { + if (res.data.code == 0) { + console.log(res.data.data) + this.visibleWater = true; + this.form = res.data.data + console.log("this.form" + this.form.stationName) + } else { + this.$message.error(res.data.msg); + } + }) + }, //模板下载 download(filename, fileType) { if (fileType == "xls") { @@ -175,6 +188,14 @@ showModal() { this.visible = true; }, + // hideModal() { + // saveRiverBill({ + // reportTime: new Date(reportDate).getTime(), + // billName: billName, + // regionLevel: "市级", + // surfaceWaterSectionList: billData, + // }); + // }, /* 导入本地excel文件 */ importFileCity(file) { const hide = this.$message.loading("导入中..", 0); @@ -215,44 +236,76 @@ } const tasks = []; if (billData.length > 0) { - tasks.push( - saveRiverBill({ - reportTime: new Date(reportDate).getTime(), - billName: billName, - regionLevel: "市级", - surfaceWaterSectionList: billData, - }) - ); - } + hide(); + saveJudgeInfo({ + surfaceWaterSectionList: billData, + }).then(resp => { + console.log('判断111' + resp.data.code); + if (resp.data.code == 0) { + console.log('判断222' + resp.data.data); + if (resp.data.data == "true") { + Modal.confirm({ + title: resp.data.msg + '有重复数据,确认是否覆盖?', + onOk() { + tasks.push( + saveRiverBill({ + reportTime: new Date(reportDate).getTime(), + billName: billName, + regionLevel: "市级", + surfaceWaterSectionList: billData, + }).then((res) => { + console.log("res" + res.data.code) + if (res.data.code == 0) { + Modal.success({ + title: "导入成功", + content: `成功导入${billData.length}条数据`, + }); + this.$refs.water && this.$refs.water.reload(); + } else { + Modal.error({ + title: "导入失败", + content: "数据上传出错", + }); + } + }) + ); + }, + onCancel() { + console.log('Cancel'); + }, + }); + } else { + saveRiverBill({ + reportTime: new Date(reportDate).getTime(), + billName: billName, + regionLevel: "市级", + surfaceWaterSectionList: billData, + }).then((res) => { + console.log("res" + res.data.code) + if (res.data.code == 0) { + Modal.success({ + title: "导入成功", + content: `成功导入${billData.length}条数据`, + }); + this.$refs.water && this.$refs.water.reload(); + } else { + Modal.error({ + title: "导入失败", + content: "数据上传出错", + }); + } + }) + } - - // 上传到服务器 - - Promise.all(tasks) - .then((res) => { - if (res[0].data.code == 0) { - Modal.success({ - title: "导入成功", - content: `成功导入${billData.length}条数据`, - }); - this.$refs.water && this.$refs.water.reload(); } else { Modal.error({ - title: "导入失败", - content: "数据上传出错", + title: resp.data.msg, }); } + }) + + } - }) - .catch(() => { - Modal.error({ - title: "导入失败", - content: "数据上传出错", - }); - }) - .finally(() => { - hide(); - }); } catch (error) { hide(); Modal.error({ @@ -282,7 +335,8 @@ let aoa = XLSX.utils.sheet_to_json(workbook.Sheets[sheetNames[0]], { header: 1, }); - const riverList = aoa.filter( + var riverList = []; + riverList = aoa.filter( (item) => { console.log("export" + this.exportType) if (this.exportType == "1") { //国家级水功能 @@ -312,56 +366,141 @@ return; } const tasks = []; + var varType = this.exportType; if (billData.length > 0) { if (this.exportType == "1") { - console.log(billName); - tasks.push( - saveWaterFunctionAreaBill({ - billName: billName, - regionLevel: this.exportType, - nationalLevelWaterFunctionAreaList: billData, - }) - ); + hide(); + saveJudgeInfoWater({ + nationalLevelWaterFunctionAreaList: billData, + }).then(resp => { + if (resp.data.code == 0) { + if (resp.data.data == "true") { + Modal.confirm({ + title: resp.data.msg + '有重复数据,确认是否覆盖?', + onOk() { + tasks.push( + saveWaterFunctionAreaBill({ + billName: billName, + regionLevel: varType, + nationalLevelWaterFunctionAreaList: billData, + }).then((res) => { + console.log("res" + res.data.code) + if (res.data.code == 0) { + Modal.success({ + title: "导入成功", + content: `成功导入${billData.length}条数据`, + }); + this.$refs.water && this.$refs.water.reload(); + } else { + Modal.error({ + title: "导入失败", + content: "数据上传出错", + }); + } + }) + ) + }, + onCancel() { + console.log('Cancel'); + }, + }); + } else { + saveWaterFunctionAreaBill({ + billName: billName, + regionLevel: varType, + nationalLevelWaterFunctionAreaList: billData, + }).then((res) => { + console.log("res" + res.data.code) + if (res.data.code == 0) { + Modal.success({ + title: "导入成功", + content: `成功导入${billData.length}条数据`, + }); + this.$refs.water && this.$refs.water.reload(); + } else { + Modal.error({ + title: "导入失败", + content: "数据上传出错", + }); + } + }) + } + + } else { + Modal.error({ + title: resp.data.msg, + }); + } + }) + } else { - console.log(billName); - tasks.push( - saveRiverStationBill({ - billName: billName, - regionLevel: this.exportType, - waterStationWaterFunctionAreaList: billData, - }) - ); + hide(); + saveJudgeInfoStation({ + waterStationWaterFunctionAreaList: billData, + }).then(resp => { + if (resp.data.code == 0) { + console.log('判断222' + resp.data.data); + if (resp.data.data == "true") { + Modal.confirm({ + title: resp.data.msg + '有重复数据,确认是否覆盖?', + onOk() { + tasks.push( + saveRiverStationBill({ + billName: billName, + regionLevel: varType, + waterStationWaterFunctionAreaList: billData, + }).then((res) => { + console.log("res" + res.data.code) + if (res.data.code == 0) { + Modal.success({ + title: "导入成功", + content: `成功导入${billData.length}条数据`, + }); + this.$refs.water && this.$refs.water.reload(); + } else { + Modal.error({ + title: "导入失败", + content: "数据上传出错", + }); + } + }) + ) + }, + onCancel() { + console.log('Cancel'); + }, + }); + } else { + saveRiverStationBill({ + billName: billName, + regionLevel: varType, + waterStationWaterFunctionAreaList: billData, + }).then((res) => { + console.log("res" + res.data.code) + if (res.data.code == 0) { + Modal.success({ + title: "导入成功", + content: `成功导入${billData.length}条数据`, + }); + this.$refs.water && this.$refs.water.reload(); + } else { + Modal.error({ + title: "导入失败", + content: "数据上传出错", + }); + } + }) + } + } else { + Modal.error({ + title:resp.data.msg, + }); + } + }) + } } - // 上传到服务器 - console.log(tasks); - Promise.all(tasks) - .then((res) => { - if (res[0].data.code == 0) { - Modal.success({ - title: "导入成功", - content: `成功导入${billData.length}条数据`, - }); - this.visible = false; - this.$refs.functionWater && this.$refs.functionWater.reload(); - } else { - Modal.error({ - title: "导入失败", - content: res[0].data.msg, - }); - } - - }) - .catch(() => { - Modal.error({ - title: "导入失败", - content: "数据上传出错", - }); - }) - .finally(() => { - hide(); - }); } catch (error) { hide(); Modal.error({ @@ -422,43 +561,74 @@ return; } const tasks = []; + var system = this.param.system; if (billData.length > 0) { - tasks.push( - saveRiverSiteBill({ - billName: billName, - systemType: this.param.system, - waterSiteList: billData, - }) - ); - } - // 上传到服务器 + hide(); + saveJudgeInfoSite({ + waterSiteList: billData, + }).then(resp => { + if (resp.data.code == 0) { + if (resp.data.data == "true") { + Modal.confirm({ + title: resp.data.msg + '有重复数据,确认是否覆盖?', + onOk() { + tasks.push( + saveRiverSiteBill({ + billName: billName, + systemType: system, + waterSiteList: billData, + }).then((res) => { + console.log("res" + res.data.code) + if (res.data.code == 0) { + Modal.success({ + title: "导入成功", + content: `成功导入${billData.length}条数据`, + }); + this.$refs.water && this.$refs.water.reload(); + } else { + Modal.error({ + title: "导入失败", + content: "数据上传出错", + }); + } + }) + ) + }, + onCancel() { + console.log('Cancel'); + }, + }); + } else { + saveRiverSiteBill({ + billName: billName, + systemType: system, + waterSiteList: billData, + }).then((res) => { + console.log("res" + res.data.code) + if (res.data.code == 0) { + Modal.success({ + title: "导入成功", + content: `成功导入${billData.length}条数据`, + }); + this.$refs.water && this.$refs.water.reload(); + } else { + Modal.error({ + title: "导入失败", + content: "数据上传出错", + }); + } + }) + } - Promise.all(tasks) - .then((res) => { - if (res[0].data.code == 0) { - Modal.success({ - title: "导入成功", - content: `成功导入${billData.length}条数据`, - }); - this.visibleWater = false; - this.$refs.station && this.$refs.station.reload(); } else { Modal.error({ - title: "导入失败", - content: "数据上传出错", + title: resp.data.msg, }); } + }) + + } - }) - .catch(() => { - Modal.error({ - title: "导入失败", - content: "数据上传出错", - }); - }) - .finally(() => { - hide(); - }); } catch (error) { hide(); Modal.error({ diff --git a/src/views/water/river/collect/utils.js b/src/views/water/river/collect/utils.js index 95d4371..959149d 100644 --- a/src/views/water/river/collect/utils.js +++ b/src/views/water/river/collect/utils.js @@ -120,13 +120,17 @@ export default { let year = date.getFullYear(); // 年 var time; var samplingTime=""; + console.log(item); if(item[14]){ time = item[14].replace('月','-').replace('日','').trim(); + console.log(time); samplingTime = year+"-"+time; } + console.log(samplingTime); if(samplingTime != ''){ dataTime = samplingTime; } + console.log(dataTime); const row = { waterSystem:item[1], riverLakeLibrary:item[2], diff --git a/src/views/water/river/statistic/base.vue b/src/views/water/river/statistic/base.vue index 11fb4c0..b7c1535 100644 --- a/src/views/water/river/statistic/base.vue +++ b/src/views/water/river/statistic/base.vue @@ -3,7 +3,7 @@
- @@ -29,7 +29,32 @@ - + --> + + + + + + + + + + + {{ item.sectionName }} + + + + + + + 查询 + 重置 + 导出Excel + + diff --git a/src/views/water/water-function-area/collect/colums.js b/src/views/water/water-function-area/collect/colums.js index 0224995..1a6deb7 100644 --- a/src/views/water/water-function-area/collect/colums.js +++ b/src/views/water/water-function-area/collect/colums.js @@ -11,6 +11,7 @@ const tableColumns = [ {title: "化学需氧量", dataIndex: "cod", sorter: true,}, {title: "五日生化需氧量", dataIndex: "fiveDayBod", sorter: true,}, {title: "氨氮", dataIndex: "ammonia", sorter: true,}, + {title: "总磷", dataIndex: "totalPhosphorus", sorter: true,}, {title: "铜", dataIndex: "cu", sorter: true,}, {title: "锌", dataIndex: "zn", sorter: true,}, {title: "氟化物", dataIndex: "f", sorter: true,},