Merge remote-tracking branch 'origin/master'

This commit is contained in:
2022-01-22 10:07:33 +08:00
7 changed files with 191 additions and 23 deletions

View File

@@ -51,7 +51,10 @@ const updateDrinkingWaterVillage = function (data) {
return axios.put("/drinkingWaterVillage/drinkingWaterVillage",data) return axios.put("/drinkingWaterVillage/drinkingWaterVillage",data)
} }
//批量修改取水量
const updateVillageWaterWithdrawal=function(data){
return axios.put("/drinkingWaterVillage/drinkingWaterVillage/updateVillageWater",data)
}
// -------------------------统计--------------------- // -------------------------统计---------------------
const pageDrinkingWaterVillageStatisticUrl = '/drinkingWaterVillage/drinkingWaterVillage/VillageAnalysePage'; const pageDrinkingWaterVillageStatisticUrl = '/drinkingWaterVillage/drinkingWaterVillage/VillageAnalysePage';
@@ -89,6 +92,6 @@ export {
getColumnOptions, getColumnOptions,
listAll, listAll,
getGisBase, getGisBase,
getGisArea getGisArea,
updateVillageWaterWithdrawal
} }

View File

@@ -4,10 +4,14 @@
<a-form :model="queryParams" :label-col="{ md: { span: 6 }, sm: { span: 24 } }" :wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }" labelAlign="left" layout="vertical"> <a-form :model="queryParams" :label-col="{ md: { span: 6 }, sm: { span: 24 } }" :wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }" labelAlign="left" layout="vertical">
<a-row> <a-row>
<a-col :lg="6" :md="12" :sm="24" :xs="24"> <a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="年度:"><a-select mode="multiple" v-model:value="queryParams.yearList" :options="yearOptions" placeholder="请选择年度"></a-select></a-form-item> <a-form-item label="年度:">
<a-select mode="multiple" v-model:value="queryParams.yearList" :options="yearOptions" allowClear placeholder="请选择年度"></a-select>
</a-form-item>
</a-col> </a-col>
<a-col :lg="6" :md="12" :sm="24" :xs="24"> <a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="月份:"><a-select mode="multiple" v-model:value="queryParams.monthList" :options="monthOptions" placeholder="请选择月份"></a-select></a-form-item> <a-form-item label="月份:">
<a-select mode="multiple" @change="handleMonthChange" v-model:value="queryParams.monthList" :options="monthOptions" allowClear placeholder="请选择月份"></a-select>
</a-form-item>
</a-col> </a-col>
<a-col :lg="6" :md="12" :sm="24" :xs="24"> <a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="区域等级:"> <a-form-item label="区域等级:">
@@ -18,12 +22,12 @@
</a-col> </a-col>
<a-col :lg="6" :md="12" :sm="24" :xs="24"> <a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="测点名称:"> <a-form-item label="测点名称:">
<a-select mode="multiple" v-model:value="queryParams.placeList" :options="placeOptions" placeholder="请选择测点名称"></a-select> <a-select mode="multiple" v-model:value="queryParams.placeList" :options="placeOptions" allowClear placeholder="请选择测点名称"></a-select>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="6" :md="12" :sm="24" :xs="24"> <a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="项目类别:"> <a-form-item label="项目类别:">
<a-select mode="multiple" @change="handleCategoryChange" v-model:value="queryParams.categoryList" :options="categoryOptions" placeholder="请选择项目类别"></a-select> <a-select mode="multiple" @change="handleCategoryChange" v-model:value="queryParams.categoryList" :options="categoryOptions" allowClear placeholder="请选择项目类别"></a-select>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="6" :md="12" :sm="24" :xs="24"> <a-col :lg="6" :md="12" :sm="24" :xs="24">
@@ -133,6 +137,11 @@ export default {
this.getPlaceOptions(value) this.getPlaceOptions(value)
} }
}, },
handleMonthChange(value) {
if (value.includes('全部')) {
this.queryParams.monthList = [1,2,3,4,5,6,7,8,9,10,11,12]
}
},
// 纵坐标变化 // 纵坐标变化
handleYcoChange(value) { handleYcoChange(value) {
if (value.includes('rate') && !this.queryParams.categoryList.includes('酸雨频率')) { if (value.includes('rate') && !this.queryParams.categoryList.includes('酸雨频率')) {

View File

@@ -4,10 +4,14 @@
<a-form :model="queryParams" :label-col="{ md: { span: 6 }, sm: { span: 24 } }" :wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }" labelAlign="left" layout="vertical"> <a-form :model="queryParams" :label-col="{ md: { span: 6 }, sm: { span: 24 } }" :wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }" labelAlign="left" layout="vertical">
<a-row> <a-row>
<a-col :lg="6" :md="12" :sm="24" :xs="24"> <a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="年度:"><a-select mode="multiple" v-model:value="queryParams.yearList" :options="yearOptions" placeholder="请选择年度"></a-select></a-form-item> <a-form-item label="年度:">
<a-select mode="multiple" v-model:value="queryParams.yearList" :options="yearOptions" allowClear placeholder="请选择年度"></a-select>
</a-form-item>
</a-col> </a-col>
<a-col :lg="6" :md="12" :sm="24" :xs="24"> <a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="月份:"><a-select mode="multiple" v-model:value="queryParams.monthList" :options="monthOptions" placeholder="请选择月份"></a-select></a-form-item> <a-form-item label="月份:">
<a-select mode="multiple" @change="handleMonthChange" v-model:value="queryParams.monthList" :options="monthOptions" allowClear placeholder="请选择月份"></a-select>
</a-form-item>
</a-col> </a-col>
<a-col :lg="6" :md="12" :sm="24" :xs="24"> <a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="区域等级:"> <a-form-item label="区域等级:">
@@ -17,16 +21,18 @@
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="6" :md="12" :sm="24" :xs="24"> <a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="区域:"><a-select mode="multiple" v-model:value="queryParams.areaList" :options="areaOptions" placeholder="请选择区域"></a-select></a-form-item> <a-form-item label="区域:">
<a-select mode="multiple" v-model:value="queryParams.areaList" :options="areaOptions" allowClear placeholder="请选择区域"></a-select>
</a-form-item>
</a-col> </a-col>
<a-col :lg="6" :md="12" :sm="24" :xs="24"> <a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="测点名称:"> <a-form-item label="测点名称:">
<a-select mode="multiple" v-model:value="queryParams.placeList" :options="placeOptions" placeholder="请选择测点名称"></a-select> <a-select mode="multiple" v-model:value="queryParams.placeList" :options="placeOptions" allowClear placeholder="请选择测点名称"></a-select>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="6" :md="12" :sm="24" :xs="24"> <a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="监测指标:"> <a-form-item label="监测指标:">
<a-select mode="multiple" @change="handleIndicatorChange" v-model:value="queryParams.indicatorList" :options="indicatorOptions" placeholder="请选择监测指标"></a-select> <a-select mode="multiple" @change="handleIndicatorChange" v-model:value="queryParams.indicatorList" :options="indicatorOptions" allowClear placeholder="请选择监测指标"></a-select>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="6" :md="12" :sm="24" :xs="24"> <a-col :lg="6" :md="12" :sm="24" :xs="24">
@@ -188,6 +194,11 @@ export default {
this.getCountryPlace(); this.getCountryPlace();
} }
}, },
handleMonthChange(value) {
if (value.includes('全部')) {
this.queryParams.monthList = [1,2,3,4,5,6,7,8,9,10,11,12]
}
},
// 纵坐标变化 // 纵坐标变化
handleYcoChange(value) { handleYcoChange(value) {
if (value.length > 2) { if (value.length > 2) {
@@ -286,10 +297,29 @@ export default {
return value.toFixed(1); return value.toFixed(1);
} }
}; };
let yMax = 0
this.trendData.series && this.trendData.series.forEach(item => {
yMax = Math.max(...item.data) > yMax ? Math.max(...item.data) : yMax
if (item.name === '二氧化氮') {
yMax = yMax > 40 ? yMax : 40
} else if (item.name === '二氧化硫') {
yMax = yMax > 60 ? yMax : 60
} else if (item.name === '可吸入颗粒物') {
yMax = yMax > 70 ? yMax : 70
} else if (item.name === '一氧化碳') {
yMax = yMax > 4 ? yMax : 4
} else if (item.name === '臭氧') {
yMax = yMax > 160 ? yMax : 160
} else if (item.name === '细颗粒物') {
yMax = yMax > 35 ? yMax : 35
}
})
console.log("yMax", yMax);
this.trendData.yAxis && this.trendData.yAxis.forEach(item=>{ this.trendData.yAxis && this.trendData.yAxis.forEach(item=>{
console.log("item", item); console.log("item", item);
if (item.name === '浓度') { if (item.name === '浓度') {
item.name = '浓度 单位:微克/立方米(一氧化碳:毫克/立方米)' item.name = '浓度 单位:微克/立方米(一氧化碳:毫克/立方米)'
item.max = yMax
} }
}) })
if (trendChart != null && trendChart != '' && trendChart != undefined) { if (trendChart != null && trendChart != '' && trendChart != undefined) {

View File

@@ -1,5 +1,6 @@
//地表水表格 //地表水表格
const tableColumns = [ const tableColumns = [
{title:"取水量",dataIndex:"waterWithdrawal",sorter:true},
{title:"断面代码",dataIndex:"sectionCode",sorter:true}, {title:"断面代码",dataIndex:"sectionCode",sorter:true},
{title: "省",dataIndex: "province",sorter: true,}, {title: "省",dataIndex: "province",sorter: true,},
{title: "市",dataIndex: "city",sorter: true,}, {title: "市",dataIndex: "city",sorter: true,},

View File

@@ -136,5 +136,14 @@ export default {
}; };
return row; return row;
}) })
},
importWaterWithdrawalData(excelData){
return excelData.map(item => {
const row = {
place:item[0],
waterWithdrawal:item[1],
} }
return row;
})
}
} }

View File

@@ -118,6 +118,25 @@
<a-popconfirm :title="`确认删除${record.billName}吗?`" ok-text="Yes" cancel-text="No" @confirm="remove(record)"> <a-popconfirm :title="`确认删除${record.billName}吗?`" ok-text="Yes" cancel-text="No" @confirm="remove(record)">
<a-button type="primary" danger shape="round" size="small">删除</a-button> <a-button type="primary" danger shape="round" size="small">删除</a-button>
</a-popconfirm> </a-popconfirm>
<a-upload
:before-upload="file=>importWaterWithdrawal(file,record)"
:showUploadList="false"
accept=".xls,.xlsx,.csv"
>
<!-- <a-button
:disabled="isCity(record)"
type="primary"
shape="round"
size="small"
>取水量导入</a-button
> -->
<a-button
type="primary"
shape="round"
size="small"
>取水量导入</a-button
>
</a-upload>
</a-space> </a-space>
</template> </template>
</ele-pro-table> </ele-pro-table>
@@ -132,13 +151,16 @@
EditOutlined EditOutlined
} from '@ant-design/icons-vue'; } from '@ant-design/icons-vue';
import { Modal } from 'ant-design-vue'; import { Modal } from 'ant-design-vue';
import utils from "./utils";
import XLSX from "xlsx";
import { import {
pageBillUrl, pageBillUrl,
// saveDrinkingWaterVillageBill, // saveDrinkingWaterVillageBill,
removeDrinkingWaterVillageBill, removeDrinkingWaterVillageBill,
removeBatchDrinkingWaterVillageBill, removeBatchDrinkingWaterVillageBill,
updateDrinkingWaterVillageBill, updateDrinkingWaterVillageBill,
verifyDrinkingWaterVillageBill verifyDrinkingWaterVillageBill,
updateVillageWaterWithdrawal
} from "@/api/ecology/drinking-water-village"; } from "@/api/ecology/drinking-water-village";
import moment from "moment"; import moment from "moment";
export default { export default {
@@ -271,7 +293,94 @@
}; };
}, },
methods: { methods: {
/*取水量导入 */
importWaterWithdrawal(file,record) {
const hide = this.$message.loading("导入中..", 0);
let reader = new FileReader();
reader.onload = (e) => {
try {
let data = new Uint8Array(e.target.result);
let workbook = XLSX.read(data, {
type: "array",
});
let sheetNames = workbook.SheetNames;
// 解析成二维数组
let aoa1 = XLSX.utils.sheet_to_json(
workbook.Sheets[sheetNames[0]], {
header: 1,
});
const drinkingWaterList = aoa1.filter((item) => {
return (
item[0] && !item[0].includes("取水点") && !item[0].includes("合计")
);
});
const drinkingWaterVillageBillId=record.drinkingWaterVillageBillId;
// drinkingWaterList.drinkingWaterBillId=record.drinkingWaterBillId;
// 解析成对象数组
// const billName1 = file.name;
const billData1 = utils.importWaterWithdrawalData(drinkingWaterList);
// console.log(drinkingWaterList.length);
// console.log(billData1.place);
if (!billData1 || billData1.length == 0) {
hide();
Modal.error({
title: "导入失败",
content: "找不到可用数据",
});
return;
}
if (billData1.length > 0) {
updateVillageWaterWithdrawal({
// drinkingWaterBillId:record.drinkingWaterBillId,
id:drinkingWaterVillageBillId,
waterWithdrawals: billData1,
})
.then((res) => {
if (res.data.code == 0) {
Modal.success({
title: "导入成功",
content: `成功导入${billData1.length}条数据`,
});
this.$refs.water && this.$refs.water.reload();
} else {
Modal.error({
title: "导入失败",
content: "数据上传出错1",
});
}
})
.catch(() => {
Modal.error({
title: "导入失败",
content: "数据上传出错2",
});
})
.finally(() => {
hide();
});
}
} catch (error) {
hide();
Modal.error({
title: "导入失败",
content: error.message,
});
console.log(error);
}
};
reader.readAsArrayBuffer(file);
return false;
},
/* 刷新表格 */ /* 刷新表格 */
reload() { reload() {

View File

@@ -196,12 +196,18 @@
accept=".xls,.xlsx,.csv" accept=".xls,.xlsx,.csv"
> >
<a-button <!-- <a-button
:disabled="isCity(record)" :disabled="isCity(record)"
type="primary" type="primary"
shape="round" shape="round"
size="small" size="small"
>取水量导入</a-button >取水量导入</a-button
> -->
<a-button
type="primary"
shape="round"
size="small"
>取水量导入</a-button
> >
</a-upload> </a-upload>
</a-space> </a-space>
@@ -355,14 +361,15 @@ export default {
methods: { methods: {
/* 判断是否是市级,用于取水量导入 */ /* 判断是否是市级,用于取水量导入 */
isCity(record) { // isCity(record) {
if (record.regionLevel === "市级") { // if (record.regionLevel === "市级") {
return false; // return false;
} else { // } else {
return true; // return true;
} // }
}, // },
/*市级取水量导入 */
/*取水量导入 */
importWaterWithdrawal(file,record) { importWaterWithdrawal(file,record) {
const hide = this.$message.loading("导入中..", 0); const hide = this.$message.loading("导入中..", 0);
let reader = new FileReader(); let reader = new FileReader();