新增/修复农村饮用水板块,修复市级县级饮用水板块

This commit is contained in:
710356044
2021-11-22 13:03:50 +08:00
parent 05f2424bea
commit 534db1163c
23 changed files with 901 additions and 615 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -50,6 +50,10 @@ const removeBatchDrinkingWater = function (ids) {
const updateDrinkingWater = function (data) {
return axios.put("/drinkingWater/drinkingWater",data)
}
//批量修改取水量
const updateWaterWithdrawal=function(data){
return axios.put("/drinkingWater/drinkingWater/updateWater",data)
}
@@ -89,6 +93,7 @@ export {
getColumnOptions,
listAll,
getGisBase,
getGisArea
getGisArea,
updateWaterWithdrawal
}

View File

@@ -1,14 +1,15 @@
const tableColumns = [
{title:"断面代码",dataIndex:"sectionCode",sorter:true},
{title: "省",dataIndex: "province",sorter: true,},
{title: "市",dataIndex: "city",sorter: true,},
{title: "城区",dataIndex: "城区",sorter: true,},
// {title: "城区",dataIndex: "城区",sorter: true,},
{title: "县",dataIndex: "county",sorter: true,},
{title: "乡镇",dataIndex: "township",sorter: true,},
{title: "村",dataIndex: "village",sorter: true,},
{title: "点位名称",dataIndex: "place",sorter: true,},
// {title: "监测时间",dataIndex: "monitorTime",sorter: true,},
{title: "湖库(是/否)",dataIndex: "lakeLibraryFlag",sorter: true,},
{title: "必测村庄(是/否) ",dataIndex: "mustTestVillagesFlag",sorter: true,},
// {title: "必测村庄(是/否) ",dataIndex: "mustTestVillagesFlag",sorter: true,},
{title: "经度(°)",dataIndex: "longitude",sorter: true,},
{title: "纬度(°)",dataIndex: "latitude",sorter: true,},
{title: "服务人口数量(人)",dataIndex: "numberServingPopulation",sorter: true,},
@@ -65,6 +66,6 @@ const tableColumns = [
{title: "总α放射性(Bq/L)",dataIndex: "totalAlphaRadioactivity",sorter: true,},
{title: "总β放射性(Bq/L)",dataIndex: "totalBetaRadioactivity",sorter: true,},
{title: "备注",dataIndex: "remark",sorter: true,},
];
];
export {tableColumns}
export {tableColumns}

View File

@@ -18,6 +18,18 @@
<a-button>农村地下水导入</a-button>
</a-upload>
</a-space>
<a-dropdown>
<template #overlay>
<a-menu>
<a-menu-item @click="download('农村村庄地表水饮用水','xlsx')"> 农村村庄地表水饮用水</a-menu-item>
<a-menu-item @click="download('农村村庄地表水饮用水','xlsx')"> 农村村庄地表水饮用水</a-menu-item>
</a-menu>
</template>
<a-button type="primary" style="left: 10px">
模板下载
<DownOutlined />
</a-button>
</a-dropdown>
</template>
<a-tabs v-model:activeKey="activeKey">
<a-tab-pane tab="农村饮用水" key="water">
@@ -33,11 +45,18 @@ import XLSX from "xlsx";
import utils from "./utils";
import { Modal } from "ant-design-vue";
import WaterBill from "./water-bill.vue";
import { DownOutlined } from "@ant-design/icons-vue";
import { saveDrinkingWaterVillageBill } from "@/api/ecology/drinking-water-village";
import {
downloadTemplatexls,
downloadTemplate,
downloadTemplatexlsm,
} from "@/utils/excel-util";
export default {
name: "DrinkWaterVillageCollectIndex",
components: {
WaterBill,
DownOutlined,
},
data() {
return {
@@ -45,7 +64,7 @@ export default {
};
},
methods: {
/* 导入本地excel文件 */
/* 导入农村地表水文件 */
importFileTop(file) {
const hide = this.$message.loading("导入中..", 0);
let reader = new FileReader();
@@ -58,19 +77,23 @@ export default {
//0.昼间数据 1.夜间数据 2.其他信息
let sheetNames = workbook.SheetNames;
// 解析成二维数组
let aoa1 = XLSX.utils.sheet_to_json(workbook.Sheets[sheetNames[0]], {
let aoa1 = XLSX.utils.sheet_to_json(
workbook.Sheets[sheetNames[0]], {
header: 1,
});
const drinkingWaterVillageList = aoa1.filter((item) => {
return item.length >= 40 && typeof item[0] == "number";
// return item.length >= 40 && typeof item[0] == "number";
return (
item.length >= 40 && item[0] && !item[0].includes("断面代码") && !item[0].includes("导出人") && !item[0].includes("地表水")
);
});
// 解析成对象数组
console.log(file);
// console.log(file);
const billName1 = file.name;
const billData1 = utils.toVillageTop(drinkingWaterVillageList);
// console.log(billData1);
if (!billData1 || billData1.length == 0) {
hide();
Modal.error({
@@ -126,6 +149,7 @@ export default {
reader.readAsArrayBuffer(file);
return false;
},
/* 导入农村地下水文件 */
importFileBottom(file) {
const hide = this.$message.loading("导入中..", 0);
let reader = new FileReader();
@@ -138,19 +162,22 @@ export default {
//0.昼间数据 1.夜间数据 2.其他信息
let sheetNames = workbook.SheetNames;
// 解析成二维数组
let aoa1 = XLSX.utils.sheet_to_json(workbook.Sheets[sheetNames[0]], {
let aoa1 = XLSX.utils.sheet_to_json(
workbook.Sheets[sheetNames[0]], {
header: 1,
});
const drinkingWaterVillageList = aoa1.filter((item) => {
return item.length >= 40 && typeof item[0] == "number";
return (
item.length >= 40 && item[0] && !item[0].includes("点位代码") && !item[0].includes("导出人") && !item[0].includes("地下水")
);
});
// 解析成对象数组
console.log(file);
const billName1 = file.name;
const billData1 = utils.toVillageBottom(drinkingWaterVillageList);
console.log(billData1);
if (!billData1 || billData1.length == 0) {
hide();
Modal.error({
@@ -206,6 +233,16 @@ export default {
reader.readAsArrayBuffer(file);
return false;
},
//下载文件
download(filename, fileType) {
if (fileType == "xls") {
downloadTemplatexls(filename);
} else if (fileType == "xlsm") {
downloadTemplatexlsm(filename);
} else if (fileType == "xlsx") {
downloadTemplate(filename);
}
},
},
};
</script>

View File

@@ -4,11 +4,12 @@ export default {
toVillageTop(excelData){
return excelData.map(item=>{
const monitorTime = new Date();
monitorTime.setFullYear(item[11]);
monitorTime.setMonth(item[12] - 1);
monitorTime.setDate(item[13]);
monitorTime.setFullYear(item[12]);
monitorTime.setMonth(item[13] - 1);
monitorTime.setDate(item[14]);
const row = {
monitorTime: monitorTime.getTime(),
sectionCode:item[0],
province: item[1],
city: item[2],
area: item[3].includes("区")?item[3]:null,
@@ -17,46 +18,46 @@ export default {
village: item[5],
place: item[6],
lakeLibraryFlag: item[7],
mustTestVillagesFlag: item[8],
longitude: item[9],
latitude: item[10],
// mustTestVillagesFlag: item[8],
longitude: item[8],
latitude: item[9],
numberServingPopulation: item[10],
dailyWaterSupplyScale: item[11],
// province: item[11],
// province: item[12],
// province: item[13],
numberServingPopulation: item[14],
dailyWaterSupplyScale: item[15],
waterTemperature: item[16],
ph: item[17],
dissolvedOxygen: item[18],
permanganateIndex: item[19],
fiveDayBod: item[20],
ammonia: item[21],
totalPhosphorus: item[22],
totalNitrogen: item[23],
cu: item[24],
zn: item[25],
fluoride: item[26],
se: item[27],
as: item[28],
hg: item[29],
cd: item[30],
cr: item[31],
pb: item[32],
cyanide: item[33],
volatilePhenol: item[34],
petro: item[35],
anionicSurfactant: item[36],
sulfide: item[37],
fecalColiforms: item[38],
sulfate: item[39],
chloride: item[40],
nitrateNitrogen: item[41],
fe: item[42],
mn: item[43],
waterQualityCategory: item[44],
characteristicPollutantMonitoringProjectName: item[45],
characteristicPollutantMonitoringValue: item[46],
remark: item[47],
waterTemperature: item[15],
ph: item[16],
dissolvedOxygen: item[17],
permanganateIndex: item[18],
fiveDayBod: item[19],
ammonia: item[20],
totalPhosphorus: item[21],
totalNitrogen: item[22],
cu: item[23],
zn: item[24],
fluoride: item[25],
se: item[26],
as: item[27],
hg: item[28],
cd: item[29],
cr: item[30],
pb: item[31],
cyanide: item[32],
volatilePhenol: item[33],
petro: item[34],
anionicSurfactant: item[35],
sulfide: item[36],
fecalColiforms: item[37],
sulfate: item[38],
chloride: item[39],
nitrateNitrogen: item[40],
fe: item[41],
mn: item[42],
// waterQualityCategory: item[44],
characteristicPollutantMonitoringProjectName: item[43],
characteristicPollutantMonitoringValue: item[44],
remark: item[45],
};
return row;
@@ -66,70 +67,70 @@ export default {
toVillageBottom(excelData){
return excelData.map(item=>{
const monitorTime = new Date();
monitorTime.setFullYear(item[10]);
monitorTime.setMonth(item[11] - 1);
monitorTime.setDate(item[12]);
monitorTime.setFullYear(item[11]);
monitorTime.setMonth(item[12] - 1);
monitorTime.setDate(item[13]);
const row = {
lakeLibraryFlag: "否",
monitorTime: monitorTime.getTime(),
sectionCode:item[0],
province: item[1],
city: item[2],
area: item[3].includes("区")?item[3]:null,
county: !item[3].includes("区")?item[3]:null,
township: item[4],
village: item[5],
mustTestVillagesFlag: item[6],
place: item[7],
longitude: item[8],
latitude: item[9],
// latitude: item[10],
place: item[6],
// lakeLibraryFlag: item[7],
// mustTestVillagesFlag: item[8],
longitude: item[7],
latitude: item[8],
numberServingPopulation: item[9],
dailyWaterSupplyScale: item[10],
// province: item[11],
// province: item[12],
numberServingPopulation: item[13],
dailyWaterSupplyScale: item[14],
color: item[15],
smellAndTaste: item[16],
turbidity: item[17],
visibleNakedEye: item[18],
ph: item[19],
totalHardness: item[20],
totalDissolvedSolids: item[21],
sulfate: item[22],
chloride: item[23],
fe: item[24],
mn: item[25],
cu: item[26],
zn: item[27],
ai: item[28],
volatilePhenol: item[29],
anionicSurfactant: item[30],
oxygenConsumption: item[31],
nitrate: item[32],
nitrite: item[33],
ammonia: item[34],
sulfide: item[35],
na: item[36],
fluoride: item[37],
cyanide: item[38],
lodide: item[39],
hg: item[40],
as: item[41],
se: item[42],
cd: item[43],
cr: item[44],
pb: item[45],
totalColiform: item[46],
totalNumberColonies: item[47],
chcl3: item[48],
ccl4: item[49],
c6h6: item[50],
c7h8: item[51],
totalAlphaRadioactivity: item[52],
totalBetaRadioactivity: item[53],
waterQualityCategory: item[54],
characteristicPollutantMonitoringProjectName: item[55],
characteristicPollutantMonitoringValue: item[56],
remark: item[57],
// province: item[13],
color:item[14],
smellAndTaste: item[15],
turbidity: item[16],
visibleNakedEye: item[17],
ph: item[18],
totalHardness: item[19],
totalDissolvedSolids: item[20],
totalNitrsulfateogen: item[21],
chloride: item[22],
fe: item[23],
mn: item[24],
cu: item[25],
zn: item[26],
ai: item[27],
volatilePhenol: item[28],
anionicSurfactant: item[29],
oxygenConsumption: item[30],
nitrate: item[31],
nitrite: item[32],
ammonia: item[33],
sulfide: item[34],
na: item[35],
fluoride: item[36],
cyanide: item[37],
lodide: item[38],
hg: item[39],
as: item[40],
se: item[41],
cd: item[42],
cr: item[43],
pb: item[44],
totalColiform: item[45],
totalNumberColonies: item[46],
chcl3: item[47],
ccl4: item[48],
c6h6: item[49],
c7h8: item[50],
totalAlphaRadioactivity: item[51],
totalBetaRadioactivity: item[52],
characteristicPollutantMonitoringProjectName: item[53],
characteristicPollutantMonitoringValue: item[54],
remark: item[55],
};
return row;
})

View File

@@ -173,17 +173,17 @@
// dataIndex: 'title',
// sorter: true
// },
{
title: '监测时间',
dataIndex: 'reportTime',
sorter: true,
slots: {
customRender: 'reportTime',
},
// customRender: ({
// text
// }) => this.$util.toDateString(text)
},
// {
// title: '监测时间',
// dataIndex: 'reportTime',
// sorter: true,
// slots: {
// customRender: 'reportTime',
// },
// // customRender: ({
// // text
// // }) => this.$util.toDateString(text)
// },
{
title: '导入时间',
dataIndex: 'createTime',
@@ -303,24 +303,37 @@
let {
drinkingWaterVillageBillId,
billName,
reportTime
// reportTime
regionLevel,
createTime,
checked,
waterSourceType,
drinkingWaterType,
userId
} = this.editableData[record.drinkingWaterVillageBillId];
if (!drinkingWaterVillageBillId || !reportTime) {
// if (!drinkingWaterVillageBillId || !reportTime) {
if (!drinkingWaterVillageBillId) {
this.$message.error('请填写完整信息再提交')
return
}
const hide = this.$message.loading('请求中..', 0);
reportTime = reportTime.format("x")
reportTime = Number(reportTime)
// reportTime = reportTime.format("x")
// reportTime = Number(reportTime)
updateDrinkingWaterVillageBill({
drinkingWaterVillageBillId,
billName,
reportTime
// reportTime
regionLevel,
createTime,
checked,
waterSourceType,
drinkingWaterType,
userId
}).then(res => {
if (res.data.code == 0) {
this.$message.success(res.data.msg);
record.billName = billName;
record.reportTime = reportTime
// record.reportTime = reportTime
} else {
this.$message.error(res.data.msg);
}

View File

@@ -53,14 +53,14 @@
/>
</a-form-item>
</a-col>
<a-col :md="12" :sm="24">
<!-- <a-col :md="12" :sm="24">
<a-form-item label="时间" name="monitorTime">
<a-time-picker
v-model:value="form.monitorTime"
format="HH:mm"
/>
</a-form-item>
</a-col>
</a-col> -->
<a-col v-for="(item,index) in tableColumns" :key="index" :md="12" :sm="24">
<a-form-item :label="item.title" :name="item.dataIndex">
<a-input
@@ -159,7 +159,15 @@ export default {
tableColumns,
// 表格列配置
columns: [
{
title: "监测日期",
dataIndex: "monitorTime",
sorter: true,
customRender: ({text})=> moment(text).format("YYYY-MM-DD")
},
...tableColumns,
{
title: "区域等级",
dataIndex: "regionLevel",

View File

@@ -1,6 +1,9 @@
const tableColumns = [
{title: "点位名称",dataIndex: "place",sorter: true,},
{title: "取水量",dataIndex: "waterWithdrawal",sorter: true,},
{title: "'水温(℃)",dataIndex: "waterTemperature",sorter: true,},
// {title: "采样时间",dataIndex: "monitorTime",sorter: true,},
{title: "pH(无量纲)",dataIndex: "ph",sorter: true,},
{title: "溶解氧",dataIndex: "dissolvedOxygen",sorter: true,},
{title: "高锰酸盐指数",dataIndex: "permanganateIndex",sorter: true,},
@@ -124,7 +127,10 @@ const tableColumns = [
//新增
{title: "叶绿素mg/m3)",dataIndex:"chlorophyll",sorter:true,},
{title: "透明度cm",dataIndex:"transparency",sorter:true,},
{title: "总α放射性",dataIndex:"totalAlphaRadioactivity",sorter:true,},
{title: "总β放射性",dataIndex:"totalBetaRadioactivity",sorter:true,},
{title: "1,1,1-三氯乙烷(mg/L)",dataIndex:"c2h3cl3_111",sorter:true,},
{title: "1,1,2-三氯乙烷(mg/L)",dataIndex:"c2h3cl3_112",sorter:true,},
];
export {tableColumns}

View File

@@ -71,11 +71,11 @@
<a-dropdown>
<template #overlay>
<a-menu style="word-spacing:10px;">
<a-menu-item @click="download('市级地表水(在用)导入','xls')"> 市级在用导入{{"\xa0"}} <span style="color:#1890FF">模板下载</span> </a-menu-item>
<a-menu-item @click="download('市级地表水(备用)导入','xlsx')"> 市级备用导入{{"\xa0"}} <span style="color:#1890FF">模板下载</span> </a-menu-item>
<a-menu-item @click="download('县级地表水(在用)','xlsm')"> 县级在用导入{{"\xa0"}} <span style="color:#1890FF">模板下载</span> </a-menu-item>
<a-menu-item @click="download('县级地表水(备用)','xls')"> 县级备用导入{{"\xa0"}} <span style="color:#1890FF">模板下载</span> </a-menu-item>
<a-menu-item @click="download('县级地下水','xlsx')" style="word-spacing:3px"> 县级地下水导入{{"\xa0"}} <span style="color:#1890FF">模板下载</span> </a-menu-item>
<a-menu-item @click="download('市级(在用)地表水饮用水','xls')" > 市级在用地表水饮用水 </a-menu-item>
<a-menu-item @click="download('市级(备用)地表水饮用水','xlsx')" > 市级备用地表水饮用水 </a-menu-item>
<a-menu-item @click="download('县级(在用)地表水饮用水','xlsm')" > 县级在用地表水饮用水 </a-menu-item>
<a-menu-item @click="download('县级(备用、规划)地表水饮用水','xls')"> 县级备用规划地表水饮用水 </a-menu-item>
<a-menu-item @click="download('县级地下水饮用水','xlsx')" > 县级地下水饮用水 </a-menu-item>
</a-menu>
</template>
<a-button type="primary" style="left: 60px">
@@ -84,8 +84,10 @@
</a-button>
</a-dropdown>
</template>
<a-tabs v-model:activeKey="activeKey">
<a-tab-pane tab="饮用水" key="water">
<a-tab-pane tab="饮用水页面" key="water">
<water-bill ref="water"></water-bill>
</a-tab-pane>
</a-tabs>
@@ -149,7 +151,7 @@ export default {
});
// 解析成对象数组
const billName1 = aoa1[0][0] + aoa1[1][0];
const billName1 = file.name;
const billData1 = utils.toCityUseTopWaterObjData(drinkingWaterList);
if (!billData1 || billData1.length == 0) {
@@ -237,7 +239,7 @@ export default {
});
// 解析成对象数组
const billName1 = aoa1[0][0] + aoa1[1][0];
const billName1 = file.name;
const billData1 = utils.toCitySpareTopWaterObjData(drinkingWaterList);
if (!billData1 || billData1.length == 0) {
@@ -325,7 +327,7 @@ export default {
});
// 解析成对象数组
const billName1 = aoa1[0][0];
const billName1 = file.name;
const billData1 = utils.toCountyUseTopWaterObjData(drinkingWaterList);
if (!billData1 || billData1.length == 0) {
@@ -413,7 +415,7 @@ export default {
});
// 解析成对象数组
const billName1 = aoa1[0][0];
const billName1 = file.name;
const billData1 = utils.toCountyUseTopWaterObjData(drinkingWaterList);
if (!billData1 || billData1.length == 0) {
@@ -501,10 +503,10 @@ export default {
});
// 解析成对象数组
const billName1 = aoa1[0][1];
const billName1 = file.name;
const billData1 =
utils.toCountyUseBottomWaterObjData(drinkingWaterList);
console.log(billData1);
if (!billData1 || billData1.length == 0) {
hide();
Modal.error({
@@ -571,19 +573,6 @@ export default {
downloadTemplate(filename);
}
},
// //下载市级在用地表水文件
// downloadCityUseFile(){
// downloadTemplate();
// },
// //下载市级在用地表水文件
// downloadCityUseFile(){
// downloadTemplate();
// },
// //下载市级在用地表水文件
// downloadCityUseFile(){
// downloadTemplate();
// },
},
};
</script>

View File

@@ -1,4 +1,4 @@
import moment from "moment";
// import moment from "moment";
export default {
// 市级在用地表水 已可用
toCityUseTopWaterObjData(excelData) {
@@ -509,7 +509,7 @@ export default {
county: item[0],
place: item[1],
waterSourceType: 2, // 1地表水、2地下水
monitorTime: moment(item[3], "YYYY年M月D日H:m").valueOf(),
// monitorTime: moment(item[3], "YYYY年MM月DD日HH:mm").valueOf(),
waterTemperature: item[4],
chroma: item[5],
smellAndTaste: item[6],
@@ -622,4 +622,13 @@ export default {
})
},
importWaterWithdrawalData(excelData){
return excelData.map(item => {
const row = {
place:item[0],
waterWithdrawal:item[1],
}
return row;
})
}
}

View File

@@ -1,34 +1,52 @@
<template>
<div>
<!-- 表格 -->
<ele-pro-table v-model:selection="selectionList" ref="table" row-key="drinkingWaterBillId" :datasource="url"
:columns="columns" :where="where" :scroll="{x: 'max-content'}">
<ele-pro-table
v-model:selection="selectionList"
ref="table"
row-key="drinkingWaterBillId"
:datasource="url"
:columns="columns"
:where="where"
:scroll="{ x: 'max-content' }"
>
<template #toolbar>
<!-- 搜索表单 -->
<a-form layout="inline" :model="where" :labelCol="{ offset: 1}">
<a-form layout="inline" :model="where" :labelCol="{ offset: 1 }">
<a-form-item label="区域等级:">
<a-select v-model:value="where.regionLevel" allowClear placeholder="未选择">
<a-select
v-model:value="where.regionLevel"
allowClear
placeholder="未选择"
>
<a-select-option :value="'市级'">市级</a-select-option>
<a-select-option :value="'县级'">县级</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="审核状态:">
<a-select v-model:value="where.checked" allowClear placeholder="未选择">
<a-select
v-model:value="where.checked"
allowClear
placeholder="未选择"
>
<a-select-option :value="1">已审核</a-select-option>
<a-select-option :value="0">未审核</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="表格名称:">
<a-input v-model:value.trim="where.billName" placeholder="请输入" allow-clear />
<a-input
v-model:value.trim="where.billName"
placeholder="请输入"
allow-clear
/>
</a-form-item>
<a-form-item label="上报时间:">
<a-range-picker separator="~" v-model:value="reportTimeScope" />
</a-form-item>
<a-form-item class="ele-text-right" :wrapper-col="{span: 24}">
<a-form-item class="ele-text-right" :wrapper-col="{ span: 24 }">
<a-space>
<a-button type="primary" @click="reload">查询</a-button>
<a-button @click="reset">重置</a-button>
@@ -37,38 +55,68 @@
</a-form>
</template>
<template #toolkit>
<a-popconfirm :disabled="selectionList.length == 0" :title="`确认删除${selectionList.length}条数据吗?`" ok-text="Yes"
cancel-text="No" @confirm="removeBatch">
<a-button :disabled="selectionList.length == 0" type="primary" ghost danger>批量删除</a-button>
<a-popconfirm
:disabled="selectionList.length == 0"
:title="`确认删除${selectionList.length}条数据吗?`"
ok-text="Yes"
cancel-text="No"
@confirm="removeBatch"
>
<a-button
:disabled="selectionList.length == 0"
type="primary"
ghost
danger
>批量删除</a-button
>
</a-popconfirm>
</template>
<template #billName="{ text, record }">
<div class="editable-cell">
<div v-if="editableData[record.drinkingWaterBillId]" class="editable-cell-input-wrapper">
<a-input v-model:value="editableData[record.drinkingWaterBillId].billName"
@pressEnter="save(record)" />
<check-outlined class="editable-cell-icon-check" @click="save(record)" />
<div
v-if="editableData[record.drinkingWaterBillId]"
class="editable-cell-input-wrapper"
>
<a-input
v-model:value="editableData[record.drinkingWaterBillId].billName"
@pressEnter="save(record)"
/>
<check-outlined
class="editable-cell-icon-check"
@click="save(record)"
/>
</div>
<div v-else class="editable-cell-text-wrapper">
{{ text || ' ' }}
{{ text || " " }}
<edit-outlined class="editable-cell-icon" @click="edit(record)" />
</div>
</div>
</template>
<template #reportTime="{ text, record }">
<div class="editable-cell">
<div v-if="editableData[record.drinkingWaterBillId]" class="editable-cell-input-wrapper">
<a-date-picker v-model:value="editableData[record.drinkingWaterBillId].reportTime " @pressEnter="save(record)"></a-date-picker>
<div
v-if="editableData[record.drinkingWaterBillId]"
class="editable-cell-input-wrapper"
>
<a-date-picker
v-model:value="
editableData[record.drinkingWaterBillId].reportTime
"
@pressEnter="save(record)"
></a-date-picker>
<!-- <a-input v-model:value="editableData[record.drinkingWaterBillId].reportTime" @pressEnter="save(record)" /> -->
<check-outlined class="editable-cell-icon-check" @click="save(record)" />
<check-outlined
class="editable-cell-icon-check"
@click="save(record)"
/>
</div>
<div v-else class="editable-cell-text-wrapper">
{{ $util.toDateString(text,'yyyy-MM-dd') || ' ' }}
{{ $util.toDateString(text, "yyyy-MM-dd") || " " }}
<edit-outlined class="editable-cell-icon" @click="edit(record)" />
</div>
</div>
</template>
<template #checked="{text}">
<template #checked="{ text }">
<span>
<a-tag v-if="text" color="green">已审核</a-tag>
<a-tag v-else color="orange">未审核</a-tag>
@@ -77,21 +125,55 @@
<template #action="{ record }">
<a-space>
<a-button @click="detail(record)" shape="round" size="small">查看</a-button>
<a-button @click="detail(record)" shape="round" size="small"
>查看</a-button
>
<!-- <span v-hasPermi="['ecology:sound:verify']"> -->
<span>
<a-popconfirm v-if="record.checked != 1" :title="`审核通过后将无法修改,确认?`" ok-text="Yes" cancel-text="No"
@confirm="verify(record,1)">
<a-button type="primary" shape="round" size="small">审核</a-button>
<a-popconfirm
v-if="record.checked != 1"
:title="`审核通过后将无法修改,确认?`"
ok-text="Yes"
cancel-text="No"
@confirm="verify(record, 1)"
>
<a-button type="primary" shape="round" size="small"
>审核</a-button
>
</a-popconfirm>
<a-popconfirm v-else :title="`撤回重新编辑,确认?`" ok-text="Yes" cancel-text="No"
@confirm="verify(record,0)">
<a-popconfirm
v-else
:title="`撤回重新编辑,确认?`"
ok-text="Yes"
cancel-text="No"
@confirm="verify(record, 0)"
>
<a-button type="dashed" shape="round" size="small">撤回</a-button>
</a-popconfirm>
</span>
<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-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-popconfirm>
<a-upload
:before-upload="importWaterWithdrawal"
:showUploadList="false"
accept=".xls,.xlsx,.csv"
>
<a-button
:disabled="isCity(record)"
type="primary"
shape="round"
size="small"
>取水量导入</a-button
>
</a-upload>
</a-space>
</template>
</ele-pro-table>
@@ -99,75 +181,71 @@
</template>
<script>
import _ from "lodash"
import {
CheckOutlined,
EditOutlined
} from '@ant-design/icons-vue';
import { Modal } from 'ant-design-vue';
import {
import _ from "lodash";
import XLSX from "xlsx";
import { CheckOutlined, EditOutlined } from "@ant-design/icons-vue";
import utils from "./utils";
import { Modal } from "ant-design-vue";
// import {saveWaterWithdrawal} from './water.vue'
import {
pageBillUrl,
// saveDrinkingWaterBill,
removeDrinkingWaterBill,
removeBatchDrinkingWaterBill,
updateDrinkingWaterBill,
verifyDrinkingWaterBill
} from "@/api/ecology/drinking-water";
import moment from "moment";
export default {
name: 'DrinkingCollectWaterBill',
verifyDrinkingWaterBill,
updateWaterWithdrawal
} from "@/api/ecology/drinking-water";
import moment from "moment";
export default {
name: "DrinkingCollectWaterBill",
components: {
CheckOutlined,
EditOutlined
EditOutlined,
},
data() {
return {
// 表格数据接口
url: pageBillUrl,
selection: [],
// 表格列配置
columns: [{
key: 'index',
dataIndex: 'index',
columns: [
{
key: "index",
dataIndex: "index",
width: 48,
align: 'center',
customRender: ({
index
}) => index + 1
align: "center",
customRender: ({ index }) => index + 1,
},
{
title: '表格名称',
dataIndex: 'billName',
title: "表格名称",
dataIndex: "billName",
sorter: true,
slots: {
customRender: 'billName',
customRender: "billName",
},
},
{
title: '区域等级',
dataIndex: 'regionLevel',
title: "区域等级",
dataIndex: "regionLevel",
sorter: true,
},
{
title: '水源类型',
dataIndex: 'waterSourceType',
title: "水源类型",
dataIndex: "waterSourceType",
sorter: true,
customRender: ({text})=> text == 1?"地表水":"地下水"
customRender: ({ text }) => (text == 1 ? "地表水" : "地下水"),
},
{
title: '水源状态',
dataIndex: 'drinkingWaterType',
title: "水源状态",
dataIndex: "drinkingWaterType",
sorter: true,
customRender: ({text})=> text == 1?"在用":"备用"
customRender: ({ text }) => (text == 1 ? "在用" : "备用"),
},
{
title: '条目',
dataIndex: 'recordSize',
title: "条目",
dataIndex: "recordSize",
sorter: true,
},
// {
// title: '菜单名称',
@@ -175,23 +253,21 @@
// sorter: true
// },
{
title: '监测时间',
dataIndex: 'reportTime',
title: "监测时间",
dataIndex: "reportTime",
sorter: true,
slots: {
customRender: 'reportTime',
customRender: "reportTime",
},
// customRender: ({
// text
// }) => this.$util.toDateString(text)
},
{
title: '导入时间',
dataIndex: 'createTime',
title: "导入时间",
dataIndex: "createTime",
sorter: true,
customRender: ({
text
}) => this.$util.toDateString(text)
customRender: ({ text }) => this.$util.toDateString(text),
},
// {
// title: '最后更新时间',
@@ -202,17 +278,16 @@
// }) => this.$util.toDateString(text)
// },
{
title: '审核状态',
dataIndex: 'checked',
title: "审核状态",
dataIndex: "checked",
sorter: true,
slots: {
customRender: 'checked',
customRender: "checked",
},
},
{
title: '创建人',
dataIndex: 'userId',
title: "创建人",
dataIndex: "userId",
sorter: true,
customRender: ({ text }) => (text == 1 ? "admin" : ""),
},
@@ -225,14 +300,14 @@
// }) => this.$util.toDateString(text)
// },
{
title: '操作',
key: 'action',
title: "操作",
key: "action",
width: 150,
align: 'center',
align: "center",
slots: {
customRender: 'action'
}
}
customRender: "action",
},
},
],
// 表格搜索条件
where: {
@@ -247,19 +322,141 @@
current: null,
};
},
methods: {
/* 判断是否是市级,用于取水量导入 */
isCity(record) {
if (record.regionLevel === "市级") {
return false;
} else {
return true;
}
},
/*市级取水量导入 */
importWaterWithdrawal(file) {
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",
});
//0.昼间数据 1.夜间数据 2.其他信息
// let sheetNames = workbook.SheetNames;
// 解析成二维数组
let aoa1 = XLSX.utils.sheet_to_json(workbook.Sheets["Sheet1"], {
header: 1,
});
const drinkingWaterList = aoa1.filter((item) => {
return (
item[0] && !item[0].includes("取水点") && !item[0].includes("合计")
);
});
// 解析成对象数组
// const billName1 = file.name;
const billData1 = utils.importWaterWithdrawalData(drinkingWaterList);
console.log(billData1);
// console.log(billData1.place);
if (!billData1 || billData1.length == 0) {
hide();
Modal.error({
title: "导入失败",
content: "找不到可用数据",
});
return;
}
if (billData1.length > 0) {
updateWaterWithdrawal({
drinkingWaterList: billData1,
})
.then((res) => {
if (res.data.code == 0) {
Modal.success({
title: "导入成功",
});
this.$refs.water && this.$refs.water.reload();
} else {
Modal.error({
title: "导入失败",
content: "数据上传出错1",
});
}
})
.catch(() => {
Modal.error({
title: "导入失败",
content: "数据上传出错2",
});
})
.finally(() => {
hide();
});
}
// if (billData1.length > 0) {
// // 上传到服务器
// saveDrinkingWaterBill({
// billName: billName1,
// regionLevel: "县级",
// waterSourceType: 1,
// drinkingWaterType: 2,
// drinkingWaterList: billData1,
// // reportTime: new Date(`${this.year}-01-01 00:00:00`).getTime(),
// })
// .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: "数据上传出错",
// });
// }
// })
// .catch(() => {
// Modal.error({
// title: "导入失败",
// content: "数据上传出错",
// });
// })
// .finally(() => {
// hide();
// });
// }
} catch (error) {
hide();
Modal.error({
title: "导入失败",
content: error.message,
});
console.log(error);
}
};
reader.readAsArrayBuffer(file);
return false;
},
/* 刷新表格 */
reload() {
this.where.reportTimeStart = null;
this.where.reportTimeEnd = null;
if (this.reportTimeScope && this.reportTimeScope.length == 2) {
this.where.reportTimeStart = this.reportTimeScope[0].format("Y-M-D H:m:s")
this.where.reportTimeEnd = this.reportTimeScope[1].format("Y-M-D H:m:s")
this.where.reportTimeStart =
this.reportTimeScope[0].format("Y-M-D H:m:s");
this.where.reportTimeEnd =
this.reportTimeScope[1].format("Y-M-D H:m:s");
}
this.$refs.table.reload({
where: this.where
where: this.where,
});
},
/* 重置搜索 */
@@ -270,36 +467,42 @@
},
detail(record) {
this.$router.replace({
path: "/water/drinking-water/collect/water/" + record.drinkingWaterBillId
})
path:
"/water/drinking-water/collect/water/" + record.drinkingWaterBillId,
});
},
edit(record) {
this.editableData[record.drinkingWaterBillId] = _.cloneDeep(record);
this.editableData[record.drinkingWaterBillId].reportTime = moment(this.editableData[record.drinkingWaterBillId].reportTime);
this.editableData[record.drinkingWaterBillId].reportTime = moment(
this.editableData[record.drinkingWaterBillId].reportTime
);
},
verify(record,checked) {
const hide = this.$message.loading('请求中..', 0);
verify(record, checked) {
const hide = this.$message.loading("请求中..", 0);
verifyDrinkingWaterBill({
drinkingWaterBillId: record.drinkingWaterBillId,
checked
}).then(res => {
checked,
})
.then((res) => {
if (res.data.code == 0) {
record.checked = checked
record.checked = checked;
Modal.success({
title: "提示",
content: checked?"审核成功":"撤回成功"
content: checked ? "审核成功" : "撤回成功",
});
} else {
Modal.error({
title: "提示",
content: res.data.msg
content: res.data.msg,
});
}
}).catch((e) => {
this.$message.error(e.message);
}).finally(() => {
hide();
})
.catch((e) => {
this.$message.error(e.message);
})
.finally(() => {
hide();
});
},
save(record) {
let {
@@ -311,16 +514,15 @@
checked,
waterSourceType,
drinkingWaterType,
userId
userId,
} = this.editableData[record.drinkingWaterBillId];
if (!drinkingWaterBillId || !reportTime) {
this.$message.error('请填写完整信息再提交')
return
this.$message.error("请填写完整信息再提交");
return;
}
const hide = this.$message.loading('请求中..', 0);
reportTime = reportTime.format("x")
reportTime = Number(reportTime)
const hide = this.$message.loading("请求中..", 0);
reportTime = reportTime.format("x");
reportTime = Number(reportTime);
updateDrinkingWaterBill({
drinkingWaterBillId,
billName,
@@ -330,8 +532,9 @@
checked,
waterSourceType,
drinkingWaterType,
userId
}).then(res => {
userId,
})
.then((res) => {
if (res.data.code == 0) {
this.$message.success(res.data.msg);
record.billName = billName;
@@ -339,51 +542,56 @@
} else {
this.$message.error(res.data.msg);
}
}).catch(e => {
})
.catch((e) => {
console.log(e);
this.$message.error(e.message);
}).finally(() => {
delete this.editableData[record.drinkingWaterBillId]
hide()
})
.finally(() => {
delete this.editableData[record.drinkingWaterBillId];
hide();
});
},
/* 删除单个 */
remove(row) {
const hide = this.$message.loading('请求中..', 0);
removeDrinkingWaterBill(row.drinkingWaterBillId).then(res => {
const hide = this.$message.loading("请求中..", 0);
removeDrinkingWaterBill(row.drinkingWaterBillId)
.then((res) => {
if (res.data.code === 0) {
this.$message.success(res.data.msg);
this.reload();
} else {
this.$message.error(res.data.msg);
}
}).catch(e => {
})
.catch((e) => {
this.$message.error(e.msg);
}).finally(() => hide());
})
.finally(() => hide());
},
removeBatch() {
const ids = this.selectionList.map(item => item.drinkingWaterBillId);
const hide = this.$message.loading('请求中..', 0);
removeBatchDrinkingWaterBill(ids).then(res => {
const ids = this.selectionList.map((item) => item.drinkingWaterBillId);
const hide = this.$message.loading("请求中..", 0);
removeBatchDrinkingWaterBill(ids)
.then((res) => {
if (res.data.code === 0) {
this.$message.success(res.data.msg);
this.reload();
} else {
this.$message.error(res.data.msg);
}
}).catch(e => {
})
.catch((e) => {
this.$message.error(e.msg);
}).finally(() => hide());
})
.finally(() => hide());
},
}
}
},
};
</script>
<style lang="less">
.editable-cell {
.editable-cell {
position: relative;
.editable-cell-input-wrapper,
@@ -420,9 +628,9 @@
.editable-add-btn {
margin-bottom: 8px;
}
}
}
.editable-cell:hover .editable-cell-icon {
.editable-cell:hover .editable-cell-icon {
display: inline-block;
}
}
</style>

View File

@@ -53,14 +53,14 @@
/>
</a-form-item>
</a-col>
<a-col :md="12" :sm="24">
<!-- <a-col :md="12" :sm="24">
<a-form-item label="时间" name="monitorTime">
<a-time-picker
v-model:value="form.monitorTime"
format="HH:mm"
/>
</a-form-item>
</a-col>
</a-col> -->
<a-col v-for="(item,index) in tableColumns" :key="index" :md="12" :sm="24">
<a-form-item :label="item.title" :name="item.dataIndex">
<a-input
@@ -159,6 +159,12 @@ export default {
tableColumns,
// 表格列配置
columns: [
// {
// title: "监测日期",
// dataIndex: "monitorTime",
// sorter: true,
// customRender: ({text})=> moment(text).format("YYYY年MM月DD日HH:mm")
// },
...tableColumns,
{
title: "区域等级",
@@ -254,19 +260,22 @@ export default {
save() {
const hide = this.$message.loading("请求中..", 0);
const form = _.cloneDeep(this.form);
const date = new Date();
date.setFullYear(form.monitorDate.year());
date.setMonth(form.monitorDate.month());
date.setDate(form.monitorDate.date());
date.setHours(form.monitorTime.hour());
date.setMinutes(form.monitorTime.minutes());
form.monitorTime = date.getTime();
form.monitorYear = date.getFullYear();
form.monitorMonth = date.getMonth() + 1;
form.monitorDay = date.getDate();
form.monitorHour = date.getHours();
form.monitorMinute = date.getMinutes();
delete form["monitorDate"];
// const date = new Date();
// date.setFullYear(form.monitorDate.year());
// date.setMonth(form.monitorDate.month());
// date.setDate(form.monitorDate.date());
// date.setHours(form.monitorTime.hour());
// date.setMinutes(form.monitorTime.minutes());
// form.monitorTime = date.getTime();
// form.monitorYear = date.getFullYear();
// form.monitorMonth = date.getMonth() + 1;
// form.monitorDay = date.getDate();
// form.monitorHour = date.getHours();
// form.monitorMinute = date.getMinutes();
// delete form["monitorDate"];
console.log(form,'form');
const { billId } = this.$route.params;
form.drinkingWaterBillId = billId;
if (form.drinkingWaterId) {
updateDrinkingWater(form)
.then((res) => {