This commit is contained in:
wang710356044
2021-11-18 16:41:08 +08:00
parent f58090ad06
commit 5ad38c0b1d
15 changed files with 945 additions and 372 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,41 @@
import axios from 'axios';
// ----------------------列表-----------------------
const pageDictUrl = '/drinkingWater/drinkingWaterDict';
const listAllUrl = pageDictUrl + "";
// 添加
const saveDrinkingWaterDict = function (data) {
return axios.post("/drinkingWater/drinkingWaterDict/",data)
}
// 删除
const removeDrinkingWaterDict = function (id) {
return axios.delete(`/drinkingWater/drinkingWaterDict/${id}`,)
}
// 批量删除
const removeBatchDrinkingWaterDict = function (ids) {
return axios.delete("/drinkingWater/drinkingWaterDict/batch",{data:ids})
}
// 修改
const updateDrinkingWaterDict = function (data) {
return axios.put("/drinkingWater/drinkingWaterDict",data)
}
const getColumnOptions = function(column){
return axios.get("/drinkingWater/drinkingWaterDict/options",{params:{column}})
}
const copyBatchPlace = function (data){
return axios.post("/drinkingWater/drinkingWaterDict/copyBatch",data)
}
export {
pageDictUrl,
listAllUrl,
saveDrinkingWaterDict,
removeDrinkingWaterDict,
removeBatchDrinkingWaterDict,
updateDrinkingWaterDict,
getColumnOptions,
copyBatchPlace
}

View File

@@ -15,6 +15,27 @@ const downloadTemplate = function (name){
a.remove(); // 一次性的用完就删除a标签 a.remove(); // 一次性的用完就删除a标签
} }
//下载xls文件
const downloadTemplatexls = function (name){
var a = document.createElement("a"); //创建一个<a></a>标签
a.href = `/template/${name}.xls`; // 给a标签的href属性值加上地址注意这里是绝对路径不用加 点.
a.download = `${name}-导入模板.xls`; //设置下载文件文件名,这里加上.xlsx指定文件类型pdf文件就指定.fpd即可
a.style.display = "none"; // 障眼法藏起来a标签
document.body.appendChild(a); // 将a标签追加到文档对象中
a.click(); // 模拟点击了a标签会触发a标签的href的读取浏览器就会自动下载了
a.remove(); // 一次性的用完就删除a标签
}
//下载xlsm文件
const downloadTemplatexlsm = function (name){
var a = document.createElement("a"); //创建一个<a></a>标签
a.href = `/template/${name}.xlsm`; // 给a标签的href属性值加上地址注意这里是绝对路径不用加 点.
a.download = `${name}-导入模板.xlsm`; //设置下载文件文件名,这里加上.xlsx指定文件类型pdf文件就指定.fpd即可
a.style.display = "none"; // 障眼法藏起来a标签
document.body.appendChild(a); // 将a标签追加到文档对象中
a.click(); // 模拟点击了a标签会触发a标签的href的读取浏览器就会自动下载了
a.remove(); // 一次性的用完就删除a标签
}
const excelToJson = async function (buffer){ const excelToJson = async function (buffer){
const wb = new ExcelJS.Workbook(); const wb = new ExcelJS.Workbook();
await wb.xlsx.load(buffer); await wb.xlsx.load(buffer);
@@ -37,7 +58,10 @@ const excelToJson = async function (buffer){
export { export {
exportTableData, exportTableData,
downloadTemplate, downloadTemplate,
excelToJson excelToJson,
downloadTemplatexls,
downloadTemplatexlsm
} }

View File

@@ -77,7 +77,8 @@
<template #action="{ record }"> <template #action="{ record }">
<a-space> <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 v-hasPermi="['ecology:sound:verify']"> -->
<span>
<a-popconfirm v-if="record.checked != 1" :title="`审核通过后将无法修改,确认?`" ok-text="Yes" cancel-text="No" <a-popconfirm v-if="record.checked != 1" :title="`审核通过后将无法修改,确认?`" ok-text="Yes" cancel-text="No"
@confirm="verify(record,1)"> @confirm="verify(record,1)">
<a-button type="primary" shape="round" size="small">审核</a-button> <a-button type="primary" shape="round" size="small">审核</a-button>
@@ -191,14 +192,14 @@
text text
}) => this.$util.toDateString(text) }) => this.$util.toDateString(text)
}, },
{ // {
title: '导入时间', // title: '导入时间',
dataIndex: 'createTime', // dataIndex: 'createTime',
sorter: true, // sorter: true,
customRender: ({ // customRender: ({
text // text
}) => this.$util.toDateString(text) // }) => this.$util.toDateString(text)
}, // },
{ {
title: '审核状态', title: '审核状态',
dataIndex: 'checked', dataIndex: 'checked',

View File

@@ -121,7 +121,9 @@ const tableColumns = [
{title: "余氯",dataIndex: "residualChlorine",sorter: true,}, {title: "余氯",dataIndex: "residualChlorine",sorter: true,},
{title: "六六六",dataIndex: "c6h6cl6666",sorter: true,}, {title: "六六六",dataIndex: "c6h6cl6666",sorter: true,},
{title: "2,4,6-三氯酚",dataIndex: "c6h3cl3o246",sorter: true,}, {title: "2,4,6-三氯酚",dataIndex: "c6h3cl3o246",sorter: true,},
//新增
{title: "叶绿素mg/m3)",dataIndex:"chlorophyll",sorter:true,},
{title: "透明度cm",dataIndex:"transparency",sorter:true,},
]; ];

View File

@@ -1,30 +1,88 @@
<template> <template>
<div class="ele-body"> <div class="ele-body">
<a-card style="width: 100%" :bordered="false"> <a-card :bordered="false">
<template #title> <template #title>
<a-space> <a-dropdown>
<template #overlay>
<a-menu>
<a-menu-item>
<a-upload <a-upload
:before-upload="importFileCity" :before-upload="importUseFileCity"
:showUploadList="false" :showUploadList="false"
accept=".xls,.xlsx,.csv" accept=".xls,.xlsx,.csv"
> >
<a-button>市级地表水导入</a-button> 市级在用导入
</a-upload> </a-upload>
</a-menu-item>
<a-menu-item>
<a-upload <a-upload
:before-upload="importFileCountyTop" :before-upload="importSpareFileCity"
:showUploadList="false" :showUploadList="false"
accept=".xls,.xlsx,.csv" accept=".xls,.xlsx,.csv"
> >
<a-button>县级地表水导入</a-button> 市级备用导入
</a-upload> </a-upload>
</a-menu-item>
</a-menu>
</template>
<a-button>
市级导入
<DownOutlined />
</a-button>
</a-dropdown>
<a-dropdown>
<template #overlay>
<a-menu>
<a-menu-item>
<a-upload
:before-upload="importUseFileCountyTop"
:showUploadList="false"
accept=".xls,.xlsx,.csv,.xlsm"
>
县级在用导入
</a-upload>
</a-menu-item>
<a-menu-item>
<a-upload
:before-upload="importSpareFileCountyTop"
:showUploadList="false"
accept=".xls,.xlsx,.csv"
>
县级备用导入
</a-upload>
</a-menu-item>
<a-menu-item>
<a-upload <a-upload
:before-upload="importFileCountyBottom" :before-upload="importFileCountyBottom"
:showUploadList="false" :showUploadList="false"
accept=".xls,.xlsx,.csv" accept=".xls,.xlsx,.csv"
> >
<a-button>县级地下水导入</a-button> 县级地下水导入
</a-upload> </a-upload>
</a-space> </a-menu-item>
</a-menu>
</template>
<a-button style="left: 30px">
县级导入
<DownOutlined />
</a-button>
</a-dropdown>
<a-dropdown>
<template #overlay>
<a-menu @click="importUseFileCity" style="word-spacing:10px;">
<a-menu-item> 市级在用导入{{"\xa0"}} <span style="color:#1890FF">模板下载</span> </a-menu-item>
<a-menu-item> 市级备用导入{{"\xa0"}} <span style="color:#1890FF">模板下载</span> </a-menu-item>
<a-menu-item> 县级在用导入{{"\xa0"}} <span style="color:#1890FF">模板下载</span> </a-menu-item>
<a-menu-item> 县级备用导入{{"\xa0"}} <span style="color:#1890FF">模板下载</span> </a-menu-item>
<a-menu-item style="word-spacing:3px"> 县级地下水导入{{"\xa0"}} <span style="color:#1890FF">模板下载</span> </a-menu-item>
</a-menu>
</template>
<a-button type="primary" style="left: 60px">
模板下载
<DownOutlined />
</a-button>
</a-dropdown>
</template> </template>
<a-tabs v-model:activeKey="activeKey"> <a-tabs v-model:activeKey="activeKey">
<a-tab-pane tab="饮用水" key="water"> <a-tab-pane tab="饮用水" key="water">
@@ -38,147 +96,32 @@
<script> <script>
import XLSX from "xlsx"; import XLSX from "xlsx";
import utils from "./utils"; import utils from "./utils";
import { DownOutlined } from "@ant-design/icons-vue";
import { Modal } from "ant-design-vue"; import { Modal } from "ant-design-vue";
import WaterBill from "./water-bill.vue"; import WaterBill from "./water-bill.vue";
import moment from "moment";
import { saveDrinkingWaterBill } from "@/api/ecology/drinking-water"; import { saveDrinkingWaterBill } from "@/api/ecology/drinking-water";
import {
downloadTemplatexls,
downloadTemplate,
downloadTemplatexlsm,
} from "@/utils/excel-util";
export default { export default {
name: "DrinkWaterCollectIndex", name: "DrinkWaterCollectIndex",
components: { components: {
WaterBill, WaterBill,
DownOutlined,
}, },
data() { data() {
return { return {
activeKey: "water", activeKey: "water",
time: moment(),
year: new Date().getFullYear(),
}; };
}, },
methods: { methods: {
/* 导入本地excel文件 */ /* 导入市级在用地表水文件 */
importFileCity(file) { importUseFileCity(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["地表水数据录入表"],
{
header: 1,
}
);
let aoa2 = XLSX.utils.sheet_to_json(
workbook.Sheets["备用水源数据录入表"],
{
header: 1,
}
);
console.log(sheetNames);
const reportDate1 = aoa1[2][0].replace(/[^\d]+/g, "-");
const reportDate2 = aoa2[2][0].replace(/[^\d]+/g, "-");
const drinkingWaterList = aoa1.filter((item) => {
return (
item.length >= 100 && item[0] && !item[0].includes("点位名称")
);
});
const drinkingWaterList2 = aoa2.filter((item) => {
return (
item.length >= 100 && item[0] && !item[0].includes("点位名称")
);
});
// 解析成对象数组
const billName1 = aoa1[0][0] + aoa1[1][0];
const billData1 = utils.toCityUseTopWaterObjData(drinkingWaterList);
const billName2 = aoa2[0][0] + aoa2[1][0];
const billData2 =
utils.toCitySpareTopWaterObjData(drinkingWaterList2);
if (
(!billData1 || billData1.length == 0) &&
(!billData2 || billData2.length == 0)
) {
hide();
Modal.error({
title: "导入失败",
content: "找不到数据",
});
return;
}
const tasks = [];
if (billData1.length > 0) {
tasks.push(
saveDrinkingWaterBill({
reportTime: new Date(reportDate1).getTime(),
billName: billName1,
regionLevel: "市级",
waterSourceType: 1,
drinkingWaterType: 1,
drinkingWaterList: billData1,
})
);
}
if (billData2.length > 0) {
tasks.push(
saveDrinkingWaterBill({
reportTime: new Date(reportDate2).getTime(),
billName: billName2,
regionLevel: "市级",
waterSourceType: 1,
drinkingWaterType: 2,
drinkingWaterList: billData2,
})
);
}
// 上传到服务器
Promise.all(tasks)
.then((res) => {
// const sum = res
if (res[0].data.code == 0) {
Modal.success({
title: "导入成功",
content: `成功导入${
billData1.length + billData2.length
}条数据`,
});
this.$refs.water && this.$refs.water.reload();
this.$refs.place && this.$refs.place.reload();
}
})
.catch(() => {
Modal.error({
title: "导入失败",
content: "数据上传出错",
});
})
.finally(() => {
hide();
});
} catch (error) {
console.log(error);
hide();
Modal.error({
title: "导入失败",
content: error.message,
});
}
// console.log(billData1);
};
reader.readAsArrayBuffer(file);
return false;
},
importFileCountyTop(file) {
const hide = this.$message.loading("导入中..", 0); const hide = this.$message.loading("导入中..", 0);
let reader = new FileReader(); let reader = new FileReader();
@@ -192,13 +135,193 @@ export default {
//0.昼间数据 1.夜间数据 2.其他信息 //0.昼间数据 1.夜间数据 2.其他信息
// let sheetNames = workbook.SheetNames; // let sheetNames = workbook.SheetNames;
// 解析成二维数组 // 解析成二维数组
let aoa1 = XLSX.utils.sheet_to_json(workbook.Sheets["地表水数据录入表"], { let aoa1 = XLSX.utils.sheet_to_json(
workbook.Sheets["地表水数据录入表"],
{
header: 1, header: 1,
}
);
const drinkingWaterList = aoa1.filter((item) => {
return (
item.length >= 80 && item[0] && !item[0].includes("点位名称")
);
}); });
const reportDate = aoa1[1][0].replace(/[^\d]+/g, "-"); // 解析成对象数组
const billName1 = aoa1[0][0] + aoa1[1][0];
const billData1 = utils.toCityUseTopWaterObjData(drinkingWaterList);
if (!billData1 || billData1.length == 0) {
hide();
Modal.error({
title: "导入失败",
content: "找不到可用数据",
});
return;
}
if (billData1.length > 0) {
// 上传到服务器
saveDrinkingWaterBill({
billName: billName1,
regionLevel: "市级",
waterSourceType: 1,
drinkingWaterType: 1,
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;
},
// 市级备用地表水
importSpareFileCity(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["备用水源数据录入表"],
{
header: 1,
}
);
const drinkingWaterList = aoa1.filter((item) => { const drinkingWaterList = aoa1.filter((item) => {
return item.length >= 100 && item[0] && item[0] != "点位名称"; return (
item.length >= 60 && item[0] && !item[0].includes("点位名称")
);
});
// 解析成对象数组
const billName1 = aoa1[0][0] + aoa1[1][0];
const billData1 = utils.toCitySpareTopWaterObjData(drinkingWaterList);
if (!billData1 || billData1.length == 0) {
hide();
Modal.error({
title: "导入失败",
content: "找不到可用数据",
});
return;
}
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: "数据上传出错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;
},
//县级在用地表水
importUseFileCountyTop(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["地表水数据录入表"],
{
header: 1,
}
);
const drinkingWaterList = aoa1.filter((item) => {
return (
item.length >= 62 && item[0] && !item[0].includes("点位名称")
);
}); });
// 解析成对象数组 // 解析成对象数组
@@ -218,93 +341,12 @@ export default {
if (billData1.length > 0) { if (billData1.length > 0) {
// 上传到服务器 // 上传到服务器
saveDrinkingWaterBill({ saveDrinkingWaterBill({
reportTime: new Date(reportDate).getTime(),
billName: billName1, billName: billName1,
regionLevel: "县级", regionLevel: "县级",
waterSourceType: 1, waterSourceType: 1,
drinkingWaterType: 2, drinkingWaterType: 1,
drinkingWaterList: 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: "数据上传出错",
});
}
})
.catch(() => {
Modal.error({
title: "导入失败",
content: "数据上传出错",
});
})
.finally(() => {
hide();
});
}
} catch (error) {
hide();
Modal.error({
title: "导入失败",
content: error.message,
});
}
// console.log(billData1);
};
reader.readAsArrayBuffer(file);
return false;
},
importFileCountyBottom(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["县级地下水录入版"], {
header: 1,
});
const drinkingWaterList = aoa1.filter((item) => {
return item.length >= 80 && item[0] && !item[0].includes("县域名称");
});
// 解析成对象数组
const billName1 = aoa1[0][1];
const billData1 = utils.toCountyUseBottomWaterObjData(drinkingWaterList);
if (!billData1 || billData1.length == 0) {
hide();
Modal.error({
title: "导入失败",
content: "找不到可用数据",
});
return;
}
if (billData1.length > 0) {
// 上传到服务器
saveDrinkingWaterBill({
billName: billName1,
regionLevel: "县级",
waterSourceType: 2,
drinkingWaterType: 2,
drinkingWaterList: billData1, drinkingWaterList: billData1,
// reportTime: new Date(`${this.year}-01-01 00:00:00`).getTime(),
}) })
.then((res) => { .then((res) => {
if (res.data.code == 0) { if (res.data.code == 0) {
@@ -337,15 +379,215 @@ export default {
content: error.message, content: error.message,
}); });
console.log(error); console.log(error);
} }
}; };
reader.readAsArrayBuffer(file); reader.readAsArrayBuffer(file);
return false; return false;
}, },
//县级备用地表水
importSpareFileCountyTop(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["地表水数据录入表"],
{
header: 1,
}
);
const drinkingWaterList = aoa1.filter((item) => {
return (
item.length >= 80 && item[0] && !item[0].includes("点位名称")
);
});
// 解析成对象数组
const billName1 = aoa1[0][0];
const billData1 = utils.toCountyUseTopWaterObjData(drinkingWaterList);
if (!billData1 || billData1.length == 0) {
hide();
Modal.error({
title: "导入失败",
content: "找不到可用数据",
});
return;
}
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;
},
//县级地下水
importFileCountyBottom(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["县级地下水录入版"],
{
header: 1,
}
);
const drinkingWaterList = aoa1.filter((item) => {
return (
item.length >= 80 && item[0] && !item[0].includes("县域名称")
);
});
// 解析成对象数组
const billName1 = aoa1[0][1];
const billData1 =
utils.toCountyUseBottomWaterObjData(drinkingWaterList);
if (!billData1 || billData1.length == 0) {
hide();
Modal.error({
title: "导入失败",
content: "找不到可用数据",
});
return;
}
if (billData1.length > 0) {
// 上传到服务器
saveDrinkingWaterBill({
billName: billName1,
regionLevel: "县级",
waterSourceType: 2,
drinkingWaterType: 1,
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;
},
//下载文件
download(filename, fileType) {
if (fileType == "xls") {
downloadTemplatexls(filename);
} else if (fileType == "xlsm") {
downloadTemplatexlsm(filename);
} else if (fileType == "xlsx") {
downloadTemplate(filename);
}
},
// //下载市级在用地表水文件
// downloadCityUseFile(){
// downloadTemplate();
// },
// //下载市级在用地表水文件
// downloadCityUseFile(){
// downloadTemplate();
// },
// //下载市级在用地表水文件
// downloadCityUseFile(){
// downloadTemplate();
// },
}, },
}; };
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
</style> </style>

View File

@@ -1,6 +1,6 @@
import moment from "moment"; import moment from "moment";
export default { export default {
// 市级在用地表水 // 市级在用地表水 已可用
toCityUseTopWaterObjData(excelData) { toCityUseTopWaterObjData(excelData) {
return excelData.map(item => { return excelData.map(item => {
const row = { const row = {
@@ -125,7 +125,7 @@ export default {
}) })
}, },
// 市级备用地表水 // 市级备用地表水 待修改
toCitySpareTopWaterObjData(excelData) { toCitySpareTopWaterObjData(excelData) {
return excelData.map(item => { return excelData.map(item => {
const row = { const row = {
@@ -250,8 +250,133 @@ export default {
}) })
}, },
// 县级在用地表水 // 县级在用地表水 待修改
toCountyUseTopWaterObjData(excelData) { toCountyUseTopWaterObjData(excelData) {
return excelData.map(item => {
const row = {
regionLevel: "县级",
drinkingWaterType: 1, // 1在用、2备用
waterSourceType: 1, // 1地表水、2地下水
place: item[0],
waterTemperature: item[1],
ph: item[2],
dissolvedOxygen: item[3],
permanganateIndex: item[4],
cod: item[5],
fiveDayBod: item[6],
ammonia: item[7],
totalPhosphorus: item[8],
totalNitrogen: item[9],
cu: item[10],
zn: item[11],
fluoride: item[12],
se: item[13],
as: item[14],
hg: item[15],
cd: item[16],
cr: item[17],
pb: item[18],
cyanide: item[19],
volatilePhenol: item[20],
petro: item[21],
anionicSurfactant: item[22],
sulfide: item[23],
fecalColiforms: item[24],
sulfate: item[25],
chloride: item[26],
nitrateNitrogen: item[27],
fe: item[28],
mn: item[29],
chcl3: item[30],
ccl4: item[31],
chbr3: item[32],
ch2cl2: item[33],
c2h4cl2: item[34],
c3h5clO: item[35],
c2h3cl: item[36],
c2h2cl211: item[37],
c2h2cl212: item[38],
c2hcl3: item[39],
c2cl4: item[40],
c4h5cl: item[41],
c4cl6: item[42],
c8h8: item[43],
ch2o: item[44],
c2h4o: item[45],
c3h4o: item[46],
c2hcl3o: item[47],
c6h6: item[48],
c7h8: item[49],
c8h10Ethylbenzene: item[50],
c8h10Dimethylbenzene: item[51],
c9h12: item[52],
c6h5cl: item[53],
c6h4cl212: item[54],
c6h4cl214: item[55],
c6h3cl3: item[56],
c6h2cl4: item[57],
c6cl6: item[58],
c6h5no2: item[59],
c6h4n2o4: item[60],
c7h6n2o4: item[61],
c7h5o6n3: item[62],
c6h4clno2: item[63],
c6h3cln2o4: item[64],
c6h4cl2o: item[65],
c6h3cl3o: item[66],
c6hcl5o: item[67],
c6h7n: item[68],
c6h4nh22: item[69],
c3h5no: item[70],
c3h3n: item[71],
c16h22o4: item[72],
c16h35o4p: item[73],
n2h4h2o: item[74],
c8h20pd: item[75],
c5h5n: item[76],
turpentine: item[77],
c6h3n3o7: item[78],
butylXanthogenAcid: item[79],
activeChlorine: item[80],
c14h9cl5: item[81],
c6h6cl6: item[82],
c10h5cl7O: item[83],
c10h14no5ps: item[84],
c8h10o5nps: item[85],
c10h19o6ps2: item[86],
c5h12no3ps2: item[87],
c4h7cl2o4p: item[88],
c4h8cl3o4p: item[89],
c8h19o3ps2: item[90],
c8cl4n2: item[91],
c12h11no2: item[92],
c22h19br2no3: item[93],
c8h14cln5: item[94],
c20h12: item[95],
ch3hg: item[96],
c12h10Xclx: item[97],
c49h74n10o12: item[98],
p4: item[99],
mo: item[100],
co: item[101],
be: item[102],
b: item[103],
sb: item[104],
ni: item[105],
ba: item[106],
v: item[107],
ti: item[108],
tl: item[109],
phosphate: item[110],
transparency: item[111],
chlorophyll: item[112],
}
return row;
})
},
//县级备用地表水 待修改
toCountySpareTopWaterObjData(excelData) {
return excelData.map(item => { return excelData.map(item => {
const row = { const row = {
regionLevel: "县级", regionLevel: "县级",
@@ -375,15 +500,15 @@ export default {
}) })
}, },
// 县级在用地下水 // 县级在用地下水 已可用
toCountyUseBottomWaterObjData(excelData) { toCountyUseBottomWaterObjData(excelData) {
return excelData.map(item => { return excelData.map(item => {
const row = { const row = {
regionLevel: "县级", regionLevel: "县级",
drinkingWaterType: 2, // 1在用、2备用 drinkingWaterType: 1, // 1在用、2备用
county: item[0], county: item[0],
place: item[1], place: item[1],
waterSourceType: (item[2] && item[2].includes("地下")) ? 2 : 1, // 1地表水、2地下水 waterSourceType: 2, // 1地表水、2地下水
monitorTime: moment(item[3], "YYYY年M月D日H:m").valueOf(), monitorTime: moment(item[3], "YYYY年M月D日H:m").valueOf(),
waterTemperature: item[4], waterTemperature: item[4],
chroma: item[5], chroma: item[5],

View File

@@ -45,7 +45,8 @@
<template #billName="{ text, record }"> <template #billName="{ text, record }">
<div class="editable-cell"> <div class="editable-cell">
<div v-if="editableData[record.drinkingWaterBillId]" class="editable-cell-input-wrapper"> <div v-if="editableData[record.drinkingWaterBillId]" class="editable-cell-input-wrapper">
<a-input v-model:value="editableData[record.drinkingWaterBillId].billName" @pressEnter="save(record)" /> <a-input v-model:value="editableData[record.drinkingWaterBillId].billName"
@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>
<div v-else class="editable-cell-text-wrapper"> <div v-else class="editable-cell-text-wrapper">
@@ -57,7 +58,7 @@
<template #reportTime="{ text, record }"> <template #reportTime="{ text, record }">
<div class="editable-cell"> <div class="editable-cell">
<div v-if="editableData[record.drinkingWaterBillId]" class="editable-cell-input-wrapper"> <div v-if="editableData[record.drinkingWaterBillId]" class="editable-cell-input-wrapper">
<a-date-picker v-model:value="editableData[record.drinkingWaterBillId].reportTime"></a-date-picker> <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)" /> --> <!-- <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>
@@ -77,7 +78,8 @@
<template #action="{ record }"> <template #action="{ record }">
<a-space> <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 v-hasPermi="['ecology:sound:verify']"> -->
<span>
<a-popconfirm v-if="record.checked != 1" :title="`审核通过后将无法修改,确认?`" ok-text="Yes" cancel-text="No" <a-popconfirm v-if="record.checked != 1" :title="`审核通过后将无法修改,确认?`" ok-text="Yes" cancel-text="No"
@confirm="verify(record,1)"> @confirm="verify(record,1)">
<a-button type="primary" shape="round" size="small">审核</a-button> <a-button type="primary" shape="round" size="small">审核</a-button>
@@ -191,14 +193,14 @@
text text
}) => this.$util.toDateString(text) }) => this.$util.toDateString(text)
}, },
{ // {
title: '导入时间', // title: '最后更新时间',
dataIndex: 'createTime', // dataIndex: 'updateTime',
sorter: true, // sorter: true,
customRender: ({ // customRender: ({
text // text
}) => this.$util.toDateString(text) // }) => this.$util.toDateString(text)
}, // },
{ {
title: '审核状态', title: '审核状态',
dataIndex: 'checked', dataIndex: 'checked',
@@ -210,9 +212,9 @@
}, },
{ {
title: '创建人', title: '创建人',
dataIndex: 'userName', dataIndex: 'userId',
sorter: true, sorter: true,
customRender: ({ text }) => (text == 1 ? "admin" : ""),
}, },
// { // {
// title: '更新时间', // title: '更新时间',
@@ -233,7 +235,10 @@
} }
], ],
// 表格搜索条件 // 表格搜索条件
where: {}, where: {
// sort: "createTime",
// order: "desc"
},
reportTimeScope: [], reportTimeScope: [],
// 表格选中数据 // 表格选中数据
selectionList: [], selectionList: [],
@@ -270,8 +275,7 @@
}, },
edit(record) { edit(record) {
this.editableData[record.drinkingWaterBillId] = _.cloneDeep(record); this.editableData[record.drinkingWaterBillId] = _.cloneDeep(record);
this.editableData[record.drinkingWaterBillId].reportTime = moment(this.editableData[record.drinkingWaterBillId] this.editableData[record.drinkingWaterBillId].reportTime = moment(this.editableData[record.drinkingWaterBillId].reportTime);
.reportTime)
}, },
verify(record,checked) { verify(record,checked) {
const hide = this.$message.loading('请求中..', 0); const hide = this.$message.loading('请求中..', 0);
@@ -298,11 +302,17 @@
}) })
}, },
save(record) { save(record) {
let { let {
drinkingWaterBillId, drinkingWaterBillId,
billName, billName,
reportTime reportTime,
regionLevel,
createTime,
checked,
waterSourceType,
drinkingWaterType,
userId
} = this.editableData[record.drinkingWaterBillId]; } = this.editableData[record.drinkingWaterBillId];
if (!drinkingWaterBillId || !reportTime) { if (!drinkingWaterBillId || !reportTime) {
this.$message.error('请填写完整信息再提交') this.$message.error('请填写完整信息再提交')
@@ -314,12 +324,18 @@
updateDrinkingWaterBill({ updateDrinkingWaterBill({
drinkingWaterBillId, drinkingWaterBillId,
billName, billName,
reportTime reportTime,
regionLevel,
createTime,
checked,
waterSourceType,
drinkingWaterType,
userId
}).then(res => { }).then(res => {
if (res.data.code == 0) { if (res.data.code == 0) {
this.$message.success(res.data.msg); this.$message.success(res.data.msg);
record.billName = billName; record.billName = billName;
record.reportTime = reportTime record.reportTime = reportTime;
} else { } else {
this.$message.error(res.data.msg); this.$message.error(res.data.msg);
} }

View File

@@ -179,7 +179,7 @@ export default {
}, },
{ {
title: "创建人", title: "创建人",
dataIndex: "username", dataIndex: "userName",
sorter: true, sorter: true,
}, },
{ {

View File

@@ -5,9 +5,9 @@
<a-tab-pane key="place" tab="点位信息"> <a-tab-pane key="place" tab="点位信息">
<place></place> <place></place>
</a-tab-pane> </a-tab-pane>
<a-tab-pane key="standard" tab="标准限值"> <!-- <a-tab-pane key="standard" tab="标准限值">
<leq-level></leq-level> <leq-level></leq-level>
</a-tab-pane> </a-tab-pane> -->
</a-tabs> </a-tabs>
</a-card> </a-card>
@@ -20,19 +20,19 @@
* *
* *
*/ */
import LeqLevel from "./surface-water" // import LeqLevel from "./surface-water"
import Place from "./place" import Place from "./place"
export default { export default {
name: 'DrinkingWaterDictIndex', name: 'DrinkingWaterDictIndex',
components: { components: {
LeqLevel, // LeqLevel,
Place Place
}, },
data() { data() {
return { return {
activeKey: 'standard' activeKey: 'place'
}; };
}, },

View File

@@ -1,13 +1,40 @@
<template> <template>
<div class="ele-body"> <div class="ele-body">
<a-card :bordered="false"> <a-card :bordered="false">
<a-form
:model="where"
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
>
<a-row>
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="年份:">
<a-select v-model:value="where.year" allow-clear show-search>
<a-select-option
v-for="(item) in yearOptions"
:key="item.value"
>{{ item.label }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-space>
<a-button type="primary" @click="reload">查询</a-button>
<a-button @click="reset">重置</a-button>
<a-button @click="exportData" type="primary">按年份导出</a-button>
</a-space>
</a-col>
</a-row>
<a-row>
</a-row>
</a-form>
<a-modal <a-modal
v-model:visible="showEdit" v-model:visible="showNYear"
:title="form.roadNoisePlaceId !== undefined ? '修改' : '添加'" :title="'批量复制'"
:confirm-loading="loading" :confirm-loading="loading"
:width="800"
:body-style="{ paddingBottom: '8px' }" :body-style="{ paddingBottom: '8px' }"
@ok="save" @ok="copyBatch"
> >
<a-form <a-form
ref="form" ref="form"
@@ -16,53 +43,71 @@
:label-col="{ md: { span: 6 }, sm: { span: 24 } }" :label-col="{ md: { span: 6 }, sm: { span: 24 } }"
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }" :wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
> >
<a-form-item label="测点名称" name="placeName"> <a-form-item label="新年份" name="nYear">
<a-input v-model:value="form.placeName" placeholder="请输入测点名称" allow-clear /> <a-input-number id="inputNumber" v-model:value="nYear" :min="1970" :max="2050" />
</a-form-item> </a-form-item>
<a-form-item label="测点经度" name="placeLng"> </a-form>
<a-input v-model:value="form.placeLng" placeholder="请输入测点经度" allow-clear /> </a-modal>
<a-modal
v-model:visible="showEdit"
:title="form.drinkingWaterDictId !== undefined ? '修改' : '添加'"
:confirm-loading="loading"
:width="800"
:body-style="{ paddingBottom: '8px' }"
@ok="save"
>
<a-form
ref="form"
:model="form"
:rules="rules"
:label-col="{ md: { span: 6 }, sm: { span: 24 } }"
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
>
<a-form-item label="年份" name="year">
<a-input-number v-model:value="form.year" :min="1970" :max="2050" />
</a-form-item> </a-form-item>
<a-form-item label="测点纬度" name="placeLat"> <a-form-item label="" name="province">
<a-input v-model:value="form.placeLat" placeholder="请输入测点纬度" allow-clear /> <a-input v-model:value="form.province" placeholder="请输入省名称" allow-clear />
</a-form-item> </a-form-item>
<a-form-item label="机动车车道数" name="motorway"> <a-form-item label="省份代码" name="provinceCode">
<a-input type="number" v-model:value="form.motorway" placeholder="请输入机动车车道数" allow-clear /> <a-input v-model:value="form.provinceCode" placeholder="请输入省份代码" allow-clear />
</a-form-item> </a-form-item>
<a-form-item label="车道类别" name="motorwayType"> <a-form-item label="" name="city">
<a-input v-model:value="form.motorwayType" placeholder="请输入车道类别" allow-clear /> <a-input v-model:value="form.city" placeholder="请输入市名称" allow-clear />
</a-form-item> </a-form-item>
<a-form-item label="道路等级" name="motorwayLevel"> <a-form-item label="城市代码" name="cityCode">
<a-input v-model:value="form.motorwayLevel" placeholder="请输入道路等级" allow-clear /> <a-input v-model:value="form.cityCode" placeholder="请输入城市代码" allow-clear />
</a-form-item> </a-form-item>
<a-form-item label="测点参照物" name="refObj"> <a-form-item label="重点城市区分" name="keyCity">
<a-input v-model:value="form.refObj" placeholder="请输入测点参照物" allow-clear /> <a-input v-model:value="form.keyCity" placeholder="请输入重点城市区分" allow-clear />
</a-form-item> </a-form-item>
<a-form-item label="道路覆盖人口(万人)" name="people"> <a-form-item label="城市方位" name="cityOrientation">
<a-input v-model:value="form.people" placeholder="请输入道路覆盖人口(万人)" allow-clear /> <a-input v-model:value="form.cityOrientation" placeholder="请输入城市方位" allow-clear />
</a-form-item> </a-form-item>
<a-form-item label="监测站名" name="station"> <a-form-item label="断面名称" name="sectionName">
<a-input v-model:value="form.station" placeholder="请输入监测站名" allow-clear /> <a-input v-model:value="form.sectionName" placeholder="请输入断面名称" allow-clear />
</a-form-item> </a-form-item>
<a-form-item label="监测仪器型号" name="monitorInstrumentModel"> <a-form-item label="断面代码" name="sectionCode">
<a-input v-model:value="form.monitorInstrumentModel" placeholder="请输入测监测仪器型号" allow-clear /> <a-input v-model:value="form.sectionCode" placeholder="请输入断面代码" allow-clear />
</a-form-item> </a-form-item>
<a-form-item label="监测仪器编号" name="monitorInstrumentCode"> <a-form-item label="水源名称" name="sourceWaterName">
<a-input v-model:value="form.monitorInstrumentCode" placeholder="请输入监测仪器编号" allow-clear /> <a-input v-model:value="form.sourceWaterName" placeholder="请输入水源名称" allow-clear />
</a-form-item> </a-form-item>
<a-form-item label="监测前校准值" name="beforeMonitorValue"> <a-form-item label="所属水系" name="subordinateWater">
<a-input v-model:value="form.beforeMonitorValue" placeholder="请输入监测前校准值" allow-clear /> <a-input v-model:value="form.subordinateWater" placeholder="请输入所属水系" allow-clear />
</a-form-item> </a-form-item>
<a-form-item label="监测后校准值" name="afterMonitorValue"> <a-form-item label="水源地性质" name="waterSourceProperty">
<a-input v-model:value="form.afterMonitorValue" placeholder="请输入监测后校准值" allow-clear /> <a-input v-model:value="form.waterSourceProperty" placeholder="请输入水源地性质" allow-clear />
</a-form-item> </a-form-item>
<a-form-item label="声校准器测量声压值" name="soundPressureValue"> <a-form-item label="经度(°)" name="longitude">
<a-input v-model:value="form.soundPressureValue" placeholder="请输入声校准器测量声压值" allow-clear /> <a-input v-model:value="form.longitude" placeholder="请输入经度(°)" allow-clear />
</a-form-item> </a-form-item>
<a-form-item label="声校准仪器型号" name="soundInstrumentModel"> <a-form-item label="纬度(°)" name="latitude">
<a-input v-model:value="form.soundInstrumentModel" placeholder="请输入声校准仪器型号" allow-clear /> <a-input v-model:value="form.latitude" placeholder="请输入纬度(°)" allow-clear />
</a-form-item> </a-form-item>
<a-form-item label="声校准仪器编号" name="soundInstrumentCode"> <a-form-item label="饮用水类型" name="drinkingWaterType">
<a-input v-model:value="form.soundInstrumentCode" placeholder="请输入声校准仪器编号" allow-clear /> <a-input v-model:value="form.drinkingWaterType" placeholder="请输入饮用水类型1在用、2备用" allow-clear />
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-modal> </a-modal>
@@ -70,15 +115,29 @@
<ele-pro-table <ele-pro-table
v-model:selection="selectionList" v-model:selection="selectionList"
ref="table" ref="table"
row-key="roadNoisePlaceId" row-key="drinkingWaterDictId"
:datasource="url" :datasource="url"
:columns="columns" :columns="columns"
:where="where" :where="where"
:scroll="{ x: 'max-content' }" :scroll="{ x: 'max-content' }"
@done="(d) => (data = d.data)"
> >
<template #toolbar> <template #toolbar>
<a-space> <a-space>
<a-button @click="openEdit" type="primary">新增</a-button> <a-button @click="openEdit" type="primary">新增</a-button>
<a-dropdown>
<template #overlay>
<a-menu @click="setCYear">
<a-menu-item v-for="item in yearOptions" :key="item.value">
{{ item.label }}
</a-menu-item>
</a-menu>
</template>
<a-button>
批量复制
<DownOutlined/>
</a-button>
</a-dropdown>
<a-popconfirm <a-popconfirm
:disabled="selectionList.length == 0" :disabled="selectionList.length == 0"
:title="`确认删除${selectionList.length}条数据吗?`" :title="`确认删除${selectionList.length}条数据吗?`"
@@ -94,6 +153,7 @@
>删除 >删除
</a-button> </a-button>
</a-popconfirm> </a-popconfirm>
</a-space> </a-space>
</template> </template>
<template #action="{ record }"> <template #action="{ record }">
@@ -126,98 +186,104 @@
<script> <script>
// import _ from "lodash"; // import _ from "lodash";
import { import {
listAllUrl, pageDictUrl,
savePlace, saveDrinkingWaterDict,
updatePlace, removeDrinkingWaterDict,
removePlace, removeBatchDrinkingWaterDict,
removeBatchPlace updateDrinkingWaterDict,
} from "@/api/ecology/noise/road-noise-place"; // verifyDrinkingWaterDict,
// getDrinkingWaterDict
getColumnOptions,
copyBatchPlace
} from "@/api/ecology/drinking-water-dict";
// import moment from "moment"; // import moment from "moment";
import {DownOutlined} from '@ant-design/icons-vue';
import XLSX from "xlsx";
export default { export default {
name: "RoadNoisePlace", name: "DrinkWaterDict",
components: {}, components: {DownOutlined},
data() { data() {
return { return {
data: [], data: [],
// 表格数据接口 // 表格数据接口
url: listAllUrl, url: pageDictUrl,
selection: [], selection: [],
// 表格列配置 // 表格列配置
columns: [ columns: [
{ {title: "年份",
title: "测点名称", dataIndex: "year",
dataIndex: "placeName",
sorter: true, sorter: true,
}, },
{ {
title: "测点经度", title: "",
dataIndex: "placeLng", dataIndex: "province",
sorter: true, sorter: true,
}, },
{ {
title: "测点纬度", title: "省份代码",
dataIndex: "placeLat", dataIndex: "provinceCode",
sorter: true, sorter: true,
}, },
{ {
title: "机动车车道数", title: "",
dataIndex: "motorway", dataIndex: "city",
sorter: true, sorter: true,
}, },
{ {
title: "车道类别", title: "城市代码",
dataIndex: "motorwayType", dataIndex: "cityCode",
sorter: true, sorter: true,
}, },
{ {
title: "道路等级", title: "重点城市区分",
dataIndex: "motorwayLevel", dataIndex: "keyCity",
sorter: true, sorter: true,
}, },
{ {
title: "测点参照物", title: "城市方位",
dataIndex: "refObj", dataIndex: "cityOrientation",
sorter: true, sorter: true,
}, },
{ {
title: "道路覆盖人口(万人)", title: "断面名称",
dataIndex: "people", dataIndex: "sectionName",
sorter: true, sorter: true,
}, },
{ {
title: "监测站名", title: "断面代码",
dataIndex: "station", dataIndex: "sectionCode",
sorter: true, sorter: true,
}, },
{ {
title: "监测仪器型号", title: "水源名称",
dataIndex: "monitorInstrumentModel", dataIndex: "sourceWaterName",
sorter: true, sorter: true,
}, },
{ {
title: "监测仪器编号", title: "所属水系",
dataIndex: "monitorInstrumentCode", dataIndex: "subordinateWater",
sorter: true, sorter: true,
}, },
{ {
title: "监测前校准值", title: "水源地性质",
dataIndex: "beforeMonitorValue", dataIndex: "waterSourceProperty",
sorter: true, sorter: true,
}, },
{ {
title: "声校准器测量声压值", title: "经度(°)",
dataIndex: "soundPressureValue", dataIndex: "longitude",
sorter: true, sorter: true,
}, },
{ {
title: "声校准仪器型号", title: "纬度(°)",
dataIndex: "soundInstrumentModel", dataIndex: "latitude",
sorter: true, sorter: true,
}, },
{ {
title: "声校准仪器编号", title: "饮用水类型",
dataIndex: "soundInstrumentCode", dataIndex: "drinkingWaterType",
sorter: true, sorter: true,
customRender: ({text})=> text == 1?"在用":"备用"
}, },
{ {
title: "操作", title: "操作",
@@ -232,7 +298,9 @@ export default {
], ],
// 表格搜索条件 // 表格搜索条件
where: {}, where: {
sort: "sectionCode",
},
// 表格选中数据 // 表格选中数据
selectionList: [], selectionList: [],
// 是否显示编辑弹窗 // 是否显示编辑弹窗
@@ -241,13 +309,19 @@ export default {
form: {}, form: {},
loading: false, loading: false,
rules: { rules: {
placeName:[{required: true,message: '请选择测点名称'}], year: [{required: true, message: '请输入年份'}],
placeLng: [{required: true,message: '请输入测点经度',},], sourceWaterName:[{required: true,message: '请选择水源名称'}],
placeLat: [{required: true,message: '请输入测点纬度',},], longitude: [{required: true,message: '请输入度',},],
latitude: [{required: true,message: '请输入纬度',},],
}, },
yearOptions: [],
showNYear:false,
cYear: undefined,
nYear:undefined,
}; };
}, },
mounted() { mounted() {
this.getOptions();
}, },
methods: { methods: {
/* 刷新表格 */ /* 刷新表格 */
@@ -275,8 +349,8 @@ export default {
await this.$refs.form.validate(); await this.$refs.form.validate();
const hide = this.$message.loading('请求中..', 0); const hide = this.$message.loading('请求中..', 0);
const form = this.form; const form = this.form;
if (form.roadNoisePlaceId) { if (form.drinkingWaterDictId) {
updatePlace(form) updateDrinkingWaterDict(form)
.then((res) => { .then((res) => {
if (res.data.code == 0) { if (res.data.code == 0) {
this.showEdit = false; this.showEdit = false;
@@ -293,7 +367,7 @@ export default {
hide(); hide();
}); });
} else { } else {
savePlace(form) saveDrinkingWaterDict(form)
.then((res) => { .then((res) => {
if (res.data.code == 0) { if (res.data.code == 0) {
this.showEdit = false; this.showEdit = false;
@@ -314,7 +388,7 @@ export default {
/* 删除单个 */ /* 删除单个 */
remove(row) { remove(row) {
const hide = this.$message.loading('请求中..', 0); const hide = this.$message.loading('请求中..', 0);
removePlace(row.roadNoisePlaceId).then((res) => { removeDrinkingWaterDict(row.drinkingWaterDictId).then((res) => {
hide(); hide();
if (res.data.code === 0) { if (res.data.code === 0) {
this.$message.success(res.data.msg); this.$message.success(res.data.msg);
@@ -330,8 +404,8 @@ export default {
/* 批量删除 */ /* 批量删除 */
removeBatch() { removeBatch() {
const hide = this.$message.loading('请求中..', 0); const hide = this.$message.loading('请求中..', 0);
const ids = this.selectionList.map((item) => item.roadNoisePlaceId); const ids = this.selectionList.map((item) => item.drinkingWaterDictId);
removeBatchPlace(ids).then((res) => { removeBatchDrinkingWaterDict(ids).then((res) => {
if (res.data.code === 0) { if (res.data.code === 0) {
this.$message.success(res.data.msg); this.$message.success(res.data.msg);
this.reload(); this.reload();
@@ -343,8 +417,56 @@ export default {
}).finally(() => { }).finally(() => {
hide(); hide();
}) })
} },
getOptions(){
getColumnOptions("year").then(res => {
console.log(res)
if (res.data.code == 0) {
this.yearOptions = res.data.data.map(item => {
return {
label: item,
value: item
}
})
}
})
},
setCYear(e){
this.cYear = e.key;
this.showNYear = true;
},
copyBatch(){
const hide = this.$message.loading('请求中..', 0);
copyBatchPlace({cyear:Number(this.cYear),nyear:this.nYear}).then(res=>{
if (res.data.code === 0) {
this.$message.success(res.data.msg);
this.reload();
this.getOptions();
} else {
this.$message.error(res.data.msg);
}
this.showNYear = false;
}).catch(e => {
this.$message.error(e.message);
}).finally(() => {
hide();
})
},
exportData(){
const columns = this.columns.filter(item=>item.dataIndex);
const arr = [];
const th = columns.map((item) => item.title);
arr.push(th);
this.data.forEach((d) => {
const td = columns.map((item) => d[item.dataIndex]);
arr.push(td);
});
console.log(arr);
let sheet = XLSX.utils.aoa_to_sheet(arr);
console.log(arr);
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
}
}, },
}; };
</script> </script>