Merge remote-tracking branch 'origin/master'

This commit is contained in:
710356044
2021-11-30 14:46:06 +08:00
8 changed files with 374 additions and 152 deletions

View File

@@ -11,12 +11,14 @@
<template #overlay>
<a-menu>
<a-menu-item>
<a-upload :before-upload="importFileFunctionArea" @change="currentVal(1)" :showUploadList="false" accept=".xls,.xlsx,.csv">
<a-upload :before-upload="importFileFunctionArea" @change="currentVal(1)" :showUploadList="false"
accept=".xls,.xlsx,.csv">
国家级水功能
</a-upload>
</a-menu-item>
<a-menu-item>
<a-upload :before-upload="importFileFunctionArea" @change="currentVal(2)" :showUploadList="false" accept=".xls,.xlsx,.csv">
<a-upload :before-upload="importFileFunctionArea" @change="currentVal(2)" :showUploadList="false"
accept=".xls,.xlsx,.csv">
区控水站水功能
</a-upload>
</a-menu-item>
@@ -30,16 +32,19 @@
<a-dropdown>
<template #overlay>
<a-menu @click="handleMenuClick">
<a-menu-item v-for="item in form" :key="item.waterStationPointId">
{{ item.stationName }}
<a-upload :before-upload="importFileStation" @change="currentSel(item)" :showUploadList="false" accept=".xls,.xlsx,.csv">
水站数据导入
</a-upload>
</a-menu-item>
<a-menu-item v-for="item in form" :key="item.waterStationPointId">
{{ item.stationName }}
<a-upload :before-upload="importFileStation" @change="currentSel(item)" :showUploadList="false"
accept=".xls,.xlsx,.csv">
水站数据导入
</a-upload>
</a-menu-item>
</a-menu>
</template>
<a-button >水站导入 <DownOutlined /></a-button>
</a-dropdown>
</template>
<a-button>水站导入
<DownOutlined />
</a-button>
</a-dropdown>
<a-dropdown>
<template #overlay>
<a-menu style="word-spacing:10px;">
@@ -69,6 +74,8 @@
</a-tab-pane>
</a-tabs>
</a-card>
<a-modal v-model:visible="visibleConfirm" ok-text="确认" cancel-text="取消" @ok="hideModal" title="confirmTitle">
</a-modal>
</div>
</template>
@@ -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({

View File

@@ -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],

View File

@@ -3,7 +3,7 @@
<div class="ele-body">
<a-card :bordered="false">
<!-- 搜索表单 -->
<a-form :model="where" :label-col="{ md: { span: 8 }, sm: { span: 24 } }"
<!-- <a-form :model="where" :label-col="{ md: { span: 8 }, sm: { span: 36 } }"
:wrapper-col="{ md: { span: 16 }, sm: { span: 24 } }">
<a-row>
<a-form-item label="断面名称">
@@ -29,7 +29,32 @@
</a-form-item>
</a-col>
</a-row>
</a-form>
</a-form> -->
<a-form
:model="where"
layout="inline"
>
<a-form-item label="起始日期:">
<a-date-picker valueFormat="YYYY-MM-DD 00:00:00" v-model:value="where.timeStart"></a-date-picker>
</a-form-item>
<a-form-item label="结束日期:">
<a-date-picker valueFormat="YYYY-MM-DD 23:59:59" v-model:value="where.timeEnd"></a-date-picker>
</a-form-item>
<a-form-item label="断面名称">
<a-select v-model:value="where.sectionName" allowClear showSearch style="width: 150px;">
<a-select-option v-for="item in sectionInfo" :key="item.sectionName">{{ item.sectionName }}
</a-select-option>
</a-select>
</a-form-item>
<a-space>
<a-button type="primary" @click="reload">查询</a-button>
<a-button @click="reset">重置</a-button>
<a-button @click="exportFile">导出Excel</a-button>
</a-space>
</a-form>
<!-- 表格 -->
<ele-pro-table ref="table" row-key="surfaceWaterSectionId" :datasource="url" :columns="columns" :where="where"
:scroll="{ x: 'max-content' }" @done="(d) => (data = d.data)">

View File

@@ -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,},