新增/修复农村饮用水板块,修复市级县级饮用水板块
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user