饮用水取水量修改
This commit is contained in:
BIN
public/template/各取水点取水量情况表.xlsx
Normal file
BIN
public/template/各取水点取水量情况表.xlsx
Normal file
Binary file not shown.
@@ -76,6 +76,7 @@
|
|||||||
<a-menu-item @click="download('县级(在用)地表水饮用水','xlsm')" > 县级(在用)地表水饮用水 </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('县级(备用、规划)地表水饮用水','xls')"> 县级(备用、规划)地表水饮用水 </a-menu-item>
|
||||||
<a-menu-item @click="download('县级地下水饮用水','xlsx')" > 县级地下水饮用水 </a-menu-item>
|
<a-menu-item @click="download('县级地下水饮用水','xlsx')" > 县级地下水饮用水 </a-menu-item>
|
||||||
|
<a-menu-item @click="download('各取水点取水量情况表','xlsx')" > 各取水点取水量取水量表 </a-menu-item>
|
||||||
</a-menu>
|
</a-menu>
|
||||||
</template>
|
</template>
|
||||||
<a-button type="primary" style="left: 60px">
|
<a-button type="primary" style="left: 60px">
|
||||||
|
|||||||
@@ -162,8 +162,9 @@
|
|||||||
>
|
>
|
||||||
</a-popconfirm>
|
</a-popconfirm>
|
||||||
<a-upload
|
<a-upload
|
||||||
:before-upload="importWaterWithdrawal"
|
:before-upload="file=>importWaterWithdrawal(file,record)"
|
||||||
:showUploadList="false"
|
:showUploadList="false"
|
||||||
|
|
||||||
accept=".xls,.xlsx,.csv"
|
accept=".xls,.xlsx,.csv"
|
||||||
>
|
>
|
||||||
<a-button
|
<a-button
|
||||||
@@ -333,7 +334,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
/*市级取水量导入 */
|
/*市级取水量导入 */
|
||||||
importWaterWithdrawal(file) {
|
importWaterWithdrawal(file,record) {
|
||||||
const hide = this.$message.loading("导入中..", 0);
|
const hide = this.$message.loading("导入中..", 0);
|
||||||
let reader = new FileReader();
|
let reader = new FileReader();
|
||||||
|
|
||||||
@@ -343,23 +344,29 @@ export default {
|
|||||||
let workbook = XLSX.read(data, {
|
let workbook = XLSX.read(data, {
|
||||||
type: "array",
|
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,
|
header: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
const drinkingWaterList = aoa1.filter((item) => {
|
const drinkingWaterList = aoa1.filter((item) => {
|
||||||
return (
|
return (
|
||||||
item[0] && !item[0].includes("取水点") && !item[0].includes("合计")
|
item[0] && !item[0].includes("取水点") && !item[0].includes("合计")
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
const id=record.drinkingWaterBillId;
|
||||||
|
|
||||||
|
// drinkingWaterList.drinkingWaterBillId=record.drinkingWaterBillId;
|
||||||
// 解析成对象数组
|
// 解析成对象数组
|
||||||
// const billName1 = file.name;
|
// const billName1 = file.name;
|
||||||
const billData1 = utils.importWaterWithdrawalData(drinkingWaterList);
|
const billData1 = utils.importWaterWithdrawalData(drinkingWaterList);
|
||||||
console.log(billData1);
|
// console.log(drinkingWaterList.length);
|
||||||
// console.log(billData1.place);
|
// console.log(billData1.place);
|
||||||
if (!billData1 || billData1.length == 0) {
|
if (!billData1 || billData1.length == 0) {
|
||||||
hide();
|
hide();
|
||||||
@@ -369,9 +376,11 @@ export default {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (billData1.length > 0) {
|
if (billData1.length > 0) {
|
||||||
updateWaterWithdrawal({
|
updateWaterWithdrawal({
|
||||||
|
// drinkingWaterBillId:record.drinkingWaterBillId,
|
||||||
|
drinkingWaterBillId:id,
|
||||||
drinkingWaterList: billData1,
|
drinkingWaterList: billData1,
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
@@ -384,7 +393,7 @@ export default {
|
|||||||
Modal.error({
|
Modal.error({
|
||||||
title: "导入失败",
|
title: "导入失败",
|
||||||
content: "数据上传出错1",
|
content: "数据上传出错1",
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -397,7 +406,7 @@ export default {
|
|||||||
.finally(() => {
|
.finally(() => {
|
||||||
hide();
|
hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
// if (billData1.length > 0) {
|
// if (billData1.length > 0) {
|
||||||
// // 上传到服务器
|
// // 上传到服务器
|
||||||
@@ -633,4 +642,4 @@ export default {
|
|||||||
.editable-cell:hover .editable-cell-icon {
|
.editable-cell:hover .editable-cell-icon {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user