江河模块修改
This commit is contained in:
@@ -11,12 +11,14 @@
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item>
|
||||
<a-upload :before-upload="importFileFunctionArea" @change="currentVal(1)" :showUploadList="false" accept=".xls,.xlsx,.csv">
|
||||
<a-upload :before-upload="importFileFunctionArea" @change="currentVal(1)" :showUploadList="false"
|
||||
accept=".xls,.xlsx,.csv">
|
||||
国家级水功能
|
||||
</a-upload>
|
||||
</a-menu-item>
|
||||
<a-menu-item>
|
||||
<a-upload :before-upload="importFileFunctionArea" @change="currentVal(2)" :showUploadList="false" accept=".xls,.xlsx,.csv">
|
||||
<a-upload :before-upload="importFileFunctionArea" @change="currentVal(2)" :showUploadList="false"
|
||||
accept=".xls,.xlsx,.csv">
|
||||
区控水站水功能
|
||||
</a-upload>
|
||||
</a-menu-item>
|
||||
@@ -30,16 +32,19 @@
|
||||
<a-dropdown>
|
||||
<template #overlay>
|
||||
<a-menu @click="handleMenuClick">
|
||||
<a-menu-item v-for="item in form" :key="item.waterStationPointId">
|
||||
{{ item.stationName }}
|
||||
<a-upload :before-upload="importFileStation" @change="currentSel(item)" :showUploadList="false" accept=".xls,.xlsx,.csv">
|
||||
水站数据导入
|
||||
</a-upload>
|
||||
</a-menu-item>
|
||||
<a-menu-item v-for="item in form" :key="item.waterStationPointId">
|
||||
{{ item.stationName }}
|
||||
<a-upload :before-upload="importFileStation" @change="currentSel(item)" :showUploadList="false"
|
||||
accept=".xls,.xlsx,.csv">
|
||||
水站数据导入
|
||||
</a-upload>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
<a-button >水站导入 <DownOutlined /></a-button>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
<a-button>水站导入
|
||||
<DownOutlined />
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
<a-dropdown>
|
||||
<template #overlay>
|
||||
<a-menu style="word-spacing:10px;">
|
||||
@@ -69,6 +74,8 @@
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</a-card>
|
||||
<a-modal v-model:visible="visibleConfirm" ok-text="确认" cancel-text="取消" @ok="hideModal" title="confirmTitle">
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -85,13 +92,16 @@
|
||||
DownOutlined
|
||||
} from "@ant-design/icons-vue";
|
||||
import {
|
||||
saveWaterFunctionAreaBill
|
||||
saveWaterFunctionAreaBill,
|
||||
saveJudgeInfoWater,
|
||||
} from "@/api/ecology/water-function-area"
|
||||
import {
|
||||
saveRiverBill
|
||||
saveRiverBill,
|
||||
saveJudgeInfo,
|
||||
} from "@/api/ecology/river";
|
||||
import {
|
||||
saveRiverStationBill
|
||||
saveRiverStationBill,
|
||||
saveJudgeInfoStation,
|
||||
} from "@/api/ecology/river-station";
|
||||
|
||||
import {
|
||||
@@ -99,7 +109,8 @@
|
||||
} from "@/api/ecology/water/river-water";
|
||||
|
||||
import {
|
||||
saveRiverSiteBill
|
||||
saveRiverSiteBill,
|
||||
saveJudgeInfoSite,
|
||||
} from "@/api/ecology/river-site";
|
||||
import {
|
||||
downloadTemplatexls,
|
||||
@@ -120,40 +131,42 @@
|
||||
visible: false,
|
||||
exportType: String,
|
||||
visibleWater: false,
|
||||
visibleConfirm: false,
|
||||
confirmTitle: String,
|
||||
form: [],
|
||||
param: {}
|
||||
};
|
||||
},
|
||||
created(){
|
||||
this.form=[];
|
||||
created() {
|
||||
this.form = [];
|
||||
listInfo().then((res) => {
|
||||
if (res.data.code == 0) {
|
||||
console.log(res.data.data)
|
||||
this.visibleWater = true;
|
||||
res.data.data.forEach(e => {
|
||||
this.form.push(e);
|
||||
});
|
||||
console.log("this.form"+this.form[0].stationName)
|
||||
} else {
|
||||
this.$message.error(res.data.msg);
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
methods: {
|
||||
showModalWater(){
|
||||
listInfo().then((res) => {
|
||||
if (res.data.code == 0) {
|
||||
console.log(res.data.data)
|
||||
this.visibleWater = true;
|
||||
this.form = res.data.data
|
||||
console.log("this.form"+this.form.stationName)
|
||||
} else {
|
||||
this.$message.error(res.data.msg);
|
||||
}
|
||||
})
|
||||
if (res.data.code == 0) {
|
||||
console.log(res.data.data)
|
||||
this.visibleWater = true;
|
||||
res.data.data.forEach(e => {
|
||||
this.form.push(e);
|
||||
});
|
||||
console.log("this.form" + this.form[0].stationName)
|
||||
} else {
|
||||
this.$message.error(res.data.msg);
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
methods: {
|
||||
showModalWater() {
|
||||
listInfo().then((res) => {
|
||||
if (res.data.code == 0) {
|
||||
console.log(res.data.data)
|
||||
this.visibleWater = true;
|
||||
this.form = res.data.data
|
||||
console.log("this.form" + this.form.stationName)
|
||||
} else {
|
||||
this.$message.error(res.data.msg);
|
||||
}
|
||||
})
|
||||
},
|
||||
//模板下载
|
||||
download(filename, fileType) {
|
||||
if (fileType == "xls") {
|
||||
@@ -175,6 +188,14 @@
|
||||
showModal() {
|
||||
this.visible = true;
|
||||
},
|
||||
// hideModal() {
|
||||
// saveRiverBill({
|
||||
// reportTime: new Date(reportDate).getTime(),
|
||||
// billName: billName,
|
||||
// regionLevel: "市级",
|
||||
// surfaceWaterSectionList: billData,
|
||||
// });
|
||||
// },
|
||||
/* 导入本地excel文件 */
|
||||
importFileCity(file) {
|
||||
const hide = this.$message.loading("导入中..", 0);
|
||||
@@ -215,44 +236,76 @@
|
||||
}
|
||||
const tasks = [];
|
||||
if (billData.length > 0) {
|
||||
tasks.push(
|
||||
saveRiverBill({
|
||||
reportTime: new Date(reportDate).getTime(),
|
||||
billName: billName,
|
||||
regionLevel: "市级",
|
||||
surfaceWaterSectionList: billData,
|
||||
})
|
||||
);
|
||||
}
|
||||
hide();
|
||||
saveJudgeInfo({
|
||||
surfaceWaterSectionList: billData,
|
||||
}).then(resp => {
|
||||
console.log('判断111' + resp.data.code);
|
||||
if (resp.data.code == 0) {
|
||||
console.log('判断222' + resp.data.data);
|
||||
if (resp.data.data == "true") {
|
||||
Modal.confirm({
|
||||
title: resp.data.msg + '有重复数据,确认是否覆盖?',
|
||||
onOk() {
|
||||
tasks.push(
|
||||
saveRiverBill({
|
||||
reportTime: new Date(reportDate).getTime(),
|
||||
billName: billName,
|
||||
regionLevel: "市级",
|
||||
surfaceWaterSectionList: billData,
|
||||
}).then((res) => {
|
||||
console.log("res" + res.data.code)
|
||||
if (res.data.code == 0) {
|
||||
Modal.success({
|
||||
title: "导入成功",
|
||||
content: `成功导入${billData.length}条数据`,
|
||||
});
|
||||
this.$refs.water && this.$refs.water.reload();
|
||||
} else {
|
||||
Modal.error({
|
||||
title: "导入失败",
|
||||
content: "数据上传出错",
|
||||
});
|
||||
}
|
||||
})
|
||||
);
|
||||
},
|
||||
onCancel() {
|
||||
console.log('Cancel');
|
||||
},
|
||||
});
|
||||
} else {
|
||||
saveRiverBill({
|
||||
reportTime: new Date(reportDate).getTime(),
|
||||
billName: billName,
|
||||
regionLevel: "市级",
|
||||
surfaceWaterSectionList: billData,
|
||||
}).then((res) => {
|
||||
console.log("res" + res.data.code)
|
||||
if (res.data.code == 0) {
|
||||
Modal.success({
|
||||
title: "导入成功",
|
||||
content: `成功导入${billData.length}条数据`,
|
||||
});
|
||||
this.$refs.water && this.$refs.water.reload();
|
||||
} else {
|
||||
Modal.error({
|
||||
title: "导入失败",
|
||||
content: "数据上传出错",
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 上传到服务器
|
||||
|
||||
Promise.all(tasks)
|
||||
.then((res) => {
|
||||
if (res[0].data.code == 0) {
|
||||
Modal.success({
|
||||
title: "导入成功",
|
||||
content: `成功导入${billData.length}条数据`,
|
||||
});
|
||||
this.$refs.water && this.$refs.water.reload();
|
||||
} else {
|
||||
Modal.error({
|
||||
title: "导入失败",
|
||||
content: "数据上传出错",
|
||||
title: resp.data.msg,
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
.catch(() => {
|
||||
Modal.error({
|
||||
title: "导入失败",
|
||||
content: "数据上传出错",
|
||||
});
|
||||
})
|
||||
.finally(() => {
|
||||
hide();
|
||||
});
|
||||
} catch (error) {
|
||||
hide();
|
||||
Modal.error({
|
||||
@@ -282,7 +335,8 @@
|
||||
let aoa = XLSX.utils.sheet_to_json(workbook.Sheets[sheetNames[0]], {
|
||||
header: 1,
|
||||
});
|
||||
const riverList = aoa.filter(
|
||||
var riverList = [];
|
||||
riverList = aoa.filter(
|
||||
(item) => {
|
||||
console.log("export" + this.exportType)
|
||||
if (this.exportType == "1") { //国家级水功能
|
||||
@@ -312,56 +366,141 @@
|
||||
return;
|
||||
}
|
||||
const tasks = [];
|
||||
var varType = this.exportType;
|
||||
if (billData.length > 0) {
|
||||
if (this.exportType == "1") {
|
||||
console.log(billName);
|
||||
tasks.push(
|
||||
saveWaterFunctionAreaBill({
|
||||
billName: billName,
|
||||
regionLevel: this.exportType,
|
||||
nationalLevelWaterFunctionAreaList: billData,
|
||||
})
|
||||
);
|
||||
hide();
|
||||
saveJudgeInfoWater({
|
||||
nationalLevelWaterFunctionAreaList: billData,
|
||||
}).then(resp => {
|
||||
if (resp.data.code == 0) {
|
||||
if (resp.data.data == "true") {
|
||||
Modal.confirm({
|
||||
title: resp.data.msg + '有重复数据,确认是否覆盖?',
|
||||
onOk() {
|
||||
tasks.push(
|
||||
saveWaterFunctionAreaBill({
|
||||
billName: billName,
|
||||
regionLevel: varType,
|
||||
nationalLevelWaterFunctionAreaList: billData,
|
||||
}).then((res) => {
|
||||
console.log("res" + res.data.code)
|
||||
if (res.data.code == 0) {
|
||||
Modal.success({
|
||||
title: "导入成功",
|
||||
content: `成功导入${billData.length}条数据`,
|
||||
});
|
||||
this.$refs.water && this.$refs.water.reload();
|
||||
} else {
|
||||
Modal.error({
|
||||
title: "导入失败",
|
||||
content: "数据上传出错",
|
||||
});
|
||||
}
|
||||
})
|
||||
)
|
||||
},
|
||||
onCancel() {
|
||||
console.log('Cancel');
|
||||
},
|
||||
});
|
||||
} else {
|
||||
saveWaterFunctionAreaBill({
|
||||
billName: billName,
|
||||
regionLevel: varType,
|
||||
nationalLevelWaterFunctionAreaList: billData,
|
||||
}).then((res) => {
|
||||
console.log("res" + res.data.code)
|
||||
if (res.data.code == 0) {
|
||||
Modal.success({
|
||||
title: "导入成功",
|
||||
content: `成功导入${billData.length}条数据`,
|
||||
});
|
||||
this.$refs.water && this.$refs.water.reload();
|
||||
} else {
|
||||
Modal.error({
|
||||
title: "导入失败",
|
||||
content: "数据上传出错",
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
} else {
|
||||
Modal.error({
|
||||
title: resp.data.msg,
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
console.log(billName);
|
||||
tasks.push(
|
||||
saveRiverStationBill({
|
||||
billName: billName,
|
||||
regionLevel: this.exportType,
|
||||
waterStationWaterFunctionAreaList: billData,
|
||||
})
|
||||
);
|
||||
hide();
|
||||
saveJudgeInfoStation({
|
||||
waterStationWaterFunctionAreaList: billData,
|
||||
}).then(resp => {
|
||||
if (resp.data.code == 0) {
|
||||
console.log('判断222' + resp.data.data);
|
||||
if (resp.data.data == "true") {
|
||||
Modal.confirm({
|
||||
title: resp.data.msg + '有重复数据,确认是否覆盖?',
|
||||
onOk() {
|
||||
tasks.push(
|
||||
saveRiverStationBill({
|
||||
billName: billName,
|
||||
regionLevel: varType,
|
||||
waterStationWaterFunctionAreaList: billData,
|
||||
}).then((res) => {
|
||||
console.log("res" + res.data.code)
|
||||
if (res.data.code == 0) {
|
||||
Modal.success({
|
||||
title: "导入成功",
|
||||
content: `成功导入${billData.length}条数据`,
|
||||
});
|
||||
this.$refs.water && this.$refs.water.reload();
|
||||
} else {
|
||||
Modal.error({
|
||||
title: "导入失败",
|
||||
content: "数据上传出错",
|
||||
});
|
||||
}
|
||||
})
|
||||
)
|
||||
},
|
||||
onCancel() {
|
||||
console.log('Cancel');
|
||||
},
|
||||
});
|
||||
} else {
|
||||
saveRiverStationBill({
|
||||
billName: billName,
|
||||
regionLevel: varType,
|
||||
waterStationWaterFunctionAreaList: billData,
|
||||
}).then((res) => {
|
||||
console.log("res" + res.data.code)
|
||||
if (res.data.code == 0) {
|
||||
Modal.success({
|
||||
title: "导入成功",
|
||||
content: `成功导入${billData.length}条数据`,
|
||||
});
|
||||
this.$refs.water && this.$refs.water.reload();
|
||||
} else {
|
||||
Modal.error({
|
||||
title: "导入失败",
|
||||
content: "数据上传出错",
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
Modal.error({
|
||||
title:resp.data.msg,
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// 上传到服务器
|
||||
console.log(tasks);
|
||||
Promise.all(tasks)
|
||||
.then((res) => {
|
||||
if (res[0].data.code == 0) {
|
||||
Modal.success({
|
||||
title: "导入成功",
|
||||
content: `成功导入${billData.length}条数据`,
|
||||
});
|
||||
this.visible = false;
|
||||
this.$refs.functionWater && this.$refs.functionWater.reload();
|
||||
} else {
|
||||
Modal.error({
|
||||
title: "导入失败",
|
||||
content: res[0].data.msg,
|
||||
});
|
||||
}
|
||||
|
||||
})
|
||||
.catch(() => {
|
||||
Modal.error({
|
||||
title: "导入失败",
|
||||
content: "数据上传出错",
|
||||
});
|
||||
})
|
||||
.finally(() => {
|
||||
hide();
|
||||
});
|
||||
} catch (error) {
|
||||
hide();
|
||||
Modal.error({
|
||||
@@ -422,43 +561,74 @@
|
||||
return;
|
||||
}
|
||||
const tasks = [];
|
||||
var system = this.param.system;
|
||||
if (billData.length > 0) {
|
||||
tasks.push(
|
||||
saveRiverSiteBill({
|
||||
billName: billName,
|
||||
systemType: this.param.system,
|
||||
waterSiteList: billData,
|
||||
})
|
||||
);
|
||||
}
|
||||
// 上传到服务器
|
||||
hide();
|
||||
saveJudgeInfoSite({
|
||||
waterSiteList: billData,
|
||||
}).then(resp => {
|
||||
if (resp.data.code == 0) {
|
||||
if (resp.data.data == "true") {
|
||||
Modal.confirm({
|
||||
title: resp.data.msg + '有重复数据,确认是否覆盖?',
|
||||
onOk() {
|
||||
tasks.push(
|
||||
saveRiverSiteBill({
|
||||
billName: billName,
|
||||
systemType: system,
|
||||
waterSiteList: billData,
|
||||
}).then((res) => {
|
||||
console.log("res" + res.data.code)
|
||||
if (res.data.code == 0) {
|
||||
Modal.success({
|
||||
title: "导入成功",
|
||||
content: `成功导入${billData.length}条数据`,
|
||||
});
|
||||
this.$refs.water && this.$refs.water.reload();
|
||||
} else {
|
||||
Modal.error({
|
||||
title: "导入失败",
|
||||
content: "数据上传出错",
|
||||
});
|
||||
}
|
||||
})
|
||||
)
|
||||
},
|
||||
onCancel() {
|
||||
console.log('Cancel');
|
||||
},
|
||||
});
|
||||
} else {
|
||||
saveRiverSiteBill({
|
||||
billName: billName,
|
||||
systemType: system,
|
||||
waterSiteList: billData,
|
||||
}).then((res) => {
|
||||
console.log("res" + res.data.code)
|
||||
if (res.data.code == 0) {
|
||||
Modal.success({
|
||||
title: "导入成功",
|
||||
content: `成功导入${billData.length}条数据`,
|
||||
});
|
||||
this.$refs.water && this.$refs.water.reload();
|
||||
} else {
|
||||
Modal.error({
|
||||
title: "导入失败",
|
||||
content: "数据上传出错",
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Promise.all(tasks)
|
||||
.then((res) => {
|
||||
if (res[0].data.code == 0) {
|
||||
Modal.success({
|
||||
title: "导入成功",
|
||||
content: `成功导入${billData.length}条数据`,
|
||||
});
|
||||
this.visibleWater = false;
|
||||
this.$refs.station && this.$refs.station.reload();
|
||||
} else {
|
||||
Modal.error({
|
||||
title: "导入失败",
|
||||
content: "数据上传出错",
|
||||
title: resp.data.msg,
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
.catch(() => {
|
||||
Modal.error({
|
||||
title: "导入失败",
|
||||
content: "数据上传出错",
|
||||
});
|
||||
})
|
||||
.finally(() => {
|
||||
hide();
|
||||
});
|
||||
} catch (error) {
|
||||
hide();
|
||||
Modal.error({
|
||||
|
||||
Reference in New Issue
Block a user