饮用水取水量修改

This commit is contained in:
710356044
2022-01-04 16:21:28 +08:00
parent a1cad26276
commit 3c6781b85d
3 changed files with 20 additions and 10 deletions

View File

@@ -76,6 +76,7 @@
<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-item @click="download('各取水点取水量情况表','xlsx')" > 各取水点取水量取水量表 </a-menu-item>
</a-menu>
</template>
<a-button type="primary" style="left: 60px">

View File

@@ -162,8 +162,9 @@
>
</a-popconfirm>
<a-upload
:before-upload="importWaterWithdrawal"
:before-upload="file=>importWaterWithdrawal(file,record)"
:showUploadList="false"
accept=".xls,.xlsx,.csv"
>
<a-button
@@ -333,7 +334,7 @@ export default {
}
},
/*市级取水量导入 */
importWaterWithdrawal(file) {
importWaterWithdrawal(file,record) {
const hide = this.$message.loading("导入中..", 0);
let reader = new FileReader();
@@ -343,23 +344,29 @@ export default {
let workbook = XLSX.read(data, {
type: "array",
});
//0.昼间数据 1.夜间数据 2.其他信息
// let sheetNames = workbook.SheetNames;
let sheetNames = workbook.SheetNames;
// 解析成二维数组
let aoa1 = XLSX.utils.sheet_to_json(workbook.Sheets["Sheet1"], {
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 id=record.drinkingWaterBillId;
// drinkingWaterList.drinkingWaterBillId=record.drinkingWaterBillId;
// 解析成对象数组
// const billName1 = file.name;
const billData1 = utils.importWaterWithdrawalData(drinkingWaterList);
console.log(billData1);
// console.log(drinkingWaterList.length);
// console.log(billData1.place);
if (!billData1 || billData1.length == 0) {
hide();
@@ -369,9 +376,11 @@ export default {
});
return;
}
if (billData1.length > 0) {
updateWaterWithdrawal({
// drinkingWaterBillId:record.drinkingWaterBillId,
drinkingWaterBillId:id,
drinkingWaterList: billData1,
})
.then((res) => {
@@ -384,7 +393,7 @@ export default {
Modal.error({
title: "导入失败",
content: "数据上传出错1",
});
}
})
@@ -397,7 +406,7 @@ export default {
.finally(() => {
hide();
});
}
// if (billData1.length > 0) {
// // 上传到服务器
@@ -633,4 +642,4 @@ export default {
.editable-cell:hover .editable-cell-icon {
display: inline-block;
}
</style>
</style>