Merge remote-tracking branch 'origin/huku'

This commit is contained in:
2021-12-15 13:02:22 +08:00
14 changed files with 381 additions and 247 deletions

View File

@@ -0,0 +1,24 @@
import axios from 'axios';
const baseUri = '/lakeLibrary/lakeLibraryImport'
export const cityOther = `${baseUri}/cityOther`
export const appointCity = `${baseUri}/appointCity`
export const special = `${baseUri}/special`
// 城市内湖-其他内湖:/lakeLibrary/lakeLibraryImport/
export const importCityOther = function (data) {
return axios.post(cityOther,data)
}
// 城市内湖-五象湖:/lakeLibrary/lakeLibraryImport/appointCity
export const importCppointCity = function (data) {
console.log('data',data)
return axios.post(appointCity,data)
}
// 专项湖库:/lakeLibrary/lakeLibraryImport/special
export const importSpecial = function (data) {
return axios.post(special,data)
}

View File

@@ -61,13 +61,14 @@
</template> </template>
<script> <script>
import XLSX from "xlsx"; // import XLSX from "xlsx";
import utils from "./utils"; // import utils from "./utils";
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 SpecialBill from "./special-bill.vue"; import SpecialBill from "./special-bill.vue";
import {saveLakeBill} from "@/api/ecology/lake"; // import {saveLakeBill} from "@/api/ecology/lake";
import {saveLakeBill as saveSpecialLake} from "@/api/ecology/special-lake"; // import {saveLakeBill as saveSpecialLake} from "@/api/ecology/special-lake";
import {importCityOther,importCppointCity,importSpecial} from "@/api/ecology/water/lake/import";
export default { export default {
name: "LakeCollectIndex", name: "LakeCollectIndex",
@@ -87,255 +88,303 @@ export default {
/* 导入本地excel文件 */ /* 导入本地excel文件 */
importFileInnerCity(file) { importFileInnerCity(file) {
const hide = this.$message.loading("导入中..", 0); const hide = this.$message.loading("导入中..", 0);
const formData = new FormData();
let reader = new FileReader(); formData.append('file', file);
reader.onload = (e) => { importCityOther(formData).then(res=>{
try { console.log(res)
let data = new Uint8Array(e.target.result); if(!res.data.code){
let workbook = XLSX.read(data, { Modal.success({ title:res.data.msg, });
type: "array", }else{
}); Modal.error({ title:res.data.msg || '文件导入失败', });
//0.昼间数据 1.夜间数据 2.其他信息
let sheetNames = workbook.SheetNames;
// 解析成二维数组
let aoa = XLSX.utils.sheet_to_json(workbook.Sheets[sheetNames[0]], {
header: 1,
});
const reportDate = aoa[2][0].replace(/[^\d]+/g, "-");
const lakeList = aoa.filter(
(item) => {
return item.length >= 24 && item[0] && !item[0].includes("点位名称");
}
);
// 解析成对象数组
const billName = file.name;
const billData = utils.toInnerCityLakeObjData(lakeList, reportDate);
if (!billData || billData.length == 0) {
hide()
Modal.error({
title: "导入失败",
content: "找不到数据",
});
return;
}
const tasks = [];
if (billData.length > 0) {
tasks.push(
saveLakeBill({
reportTime: new Date(reportDate).getTime(),
billName: billName,
regionLevel: "市级",
lakeLibraryInnerCityList: billData,
})
);
} }
hide()
}).catch(err=>{
console.log(err)
Modal.error({ title:err.data.msg || '文件导入失败', });
hide()
})
// 上传到服务器 // 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 aoa = XLSX.utils.sheet_to_json(workbook.Sheets[sheetNames[0]], {
// header: 1,
// });
Promise.all(tasks) // const reportDate = aoa[2][0].replace(/[^\d]+/g, "-");
.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: "数据上传出错",
});
}
}) // const lakeList = aoa.filter(
.catch(() => { // (item) => {
Modal.error({ // return item.length >= 24 && item[0] && !item[0].includes("点位名称");
title: "导入失败", // }
content: "数据上传出错", // );
});
})
.finally(() => { // // 解析成对象数组
hide(); // const billName = file.name;
}); // const billData = utils.toInnerCityLakeObjData(lakeList, reportDate);
} catch (error) { // if (!billData || billData.length == 0) {
hide(); // hide()
Modal.error({ // Modal.error({
title: "导入失败", // title: "导入失败",
content: error.message, // content: "找不到数据",
}); // });
} // return;
// console.log(billData); // }
}; // const tasks = [];
reader.readAsArrayBuffer(file); // if (billData.length > 0) {
// tasks.push(
// saveLakeBill({
// reportTime: new Date(reportDate).getTime(),
// billName: billName,
// regionLevel: "市级",
// lakeLibraryInnerCityList: billData,
// })
// );
// }
// // 上传到服务器
// 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: "数据上传出错",
// });
// }
// })
// .catch(() => {
// Modal.error({
// title: "导入失败",
// content: "数据上传出错",
// });
// })
// .finally(() => {
// hide();
// });
// } catch (error) {
// hide();
// Modal.error({
// title: "导入失败",
// content: error.message,
// });
// }
// // console.log(billData);
// };
// reader.readAsArrayBuffer(file);
return false; return false;
}, },
importFileWuxiang(file) { importFileWuxiang(file) {
const hide = this.$message.loading("导入中..", 0); const hide = this.$message.loading("导入中..", 0);
let reader = new FileReader(); const formData = new FormData();
reader.onload = (e) => { formData.append('file', file);
try { importCppointCity(formData).then(res=>{
let data = new Uint8Array(e.target.result); console.log(res)
let workbook = XLSX.read(data, { if(!res.data.code){
type: "array", Modal.success({ title:res.data.msg, });
}); }else{
let sheetNames = workbook.SheetNames; Modal.error({ title:res.data.msg || '文件导入失败', });
// 解析成二维数组
let aoa = XLSX.utils.sheet_to_json(workbook.Sheets[sheetNames[0]], {
header: 1,
});
const lakeList = aoa.filter(
(item) => {
return item.length >= 24 && item[0] && !item[0].includes("点位名称");
}
);
// 解析成对象数组
const billName = file.name;
const billData = utils.toWuxiangLakeObjData(lakeList);
if (!billData || billData.length == 0) {
hide()
Modal.error({
title: "导入失败",
content: "找不到数据",
});
return;
}
const tasks = [];
if (billData.length > 0) {
tasks.push(
saveLakeBill({
billName: billName,
lakeLibraryInnerCityList: billData,
})
);
} }
hide()
}).catch(err=>{
console.log(err)
Modal.error({ title:err.data.msg || '文件导入失败', });
hide()
})
// 上传到服务器 // let reader = new FileReader();
// reader.onload = (e) => {
// try {
// let data = new Uint8Array(e.target.result);
// let workbook = XLSX.read(data, {
// type: "array",
// });
// let sheetNames = workbook.SheetNames;
// // 解析成二维数组
// let aoa = XLSX.utils.sheet_to_json(workbook.Sheets[sheetNames[0]], {
// header: 1,
// });
// const lakeList = aoa.filter(
// (item) => {
// return item.length >= 24 && item[0] && !item[0].includes("点位名称");
// }
// );
// // 解析成对象数组
// const billName = file.name;
// const billData = utils.toWuxiangLakeObjData(lakeList);
// if (!billData || billData.length == 0) {
// hide()
// Modal.error({
// title: "导入失败",
// content: "找不到数据",
// });
// return;
// }
// const tasks = [];
// if (billData.length > 0) {
// tasks.push(
// saveLakeBill({
// billName: billName,
// lakeLibraryInnerCityList: billData,
// })
// );
// }
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: "数据上传出错",
});
}
}) // // 上传到服务器
.catch(() => {
Modal.error({ // Promise.all(tasks)
title: "导入失败", // .then((res) => {
content: "数据上传出错", // if (res[0].data.code == 0) {
}); // Modal.success({
}) // title: "导入成功",
.finally(() => { // content: `成功导入${billData.length}条数据`,
hide(); // });
}); // this.$refs.water && this.$refs.water.reload();
} catch (error) { // } else {
hide(); // Modal.error({
Modal.error({ // title: "导入失败",
title: "导入失败", // content: "数据上传出错",
content: error.message, // });
}); // }
}
// console.log(billData); // })
}; // .catch(() => {
reader.readAsArrayBuffer(file); // Modal.error({
// title: "导入失败",
// content: "数据上传出错",
// });
// })
// .finally(() => {
// hide();
// });
// } catch (error) {
// hide();
// Modal.error({
// title: "导入失败",
// content: error.message,
// });
// }
// // console.log(billData);
// };
// reader.readAsArrayBuffer(file);
return false; return false;
}, },
importFileSpecial(file) { importFileSpecial(file) {
const hide = this.$message.loading("导入中..", 0); const hide = this.$message.loading("导入中..", 0);
const formData = new FormData();
let reader = new FileReader(); formData.append('file', file);
reader.onload = (e) => { importSpecial(formData).then(res=>{
try { console.log(res)
let data = new Uint8Array(e.target.result); if(!res.data.code){
let workbook = XLSX.read(data, { Modal.success({ title:res.data.msg, });
type: "array", }else{
}); Modal.error({ title:res.data.msg || '文件导入失败', });
let sheetNames = workbook.SheetNames;
// 解析成二维数组
let aoa = XLSX.utils.sheet_to_json(workbook.Sheets[sheetNames[0]], {
header: 1,
});
const lakeList = aoa.filter(
(item) => {
return item.length >= 24 && item[1] && !item[1].includes("测站名称");
}
);
// 解析成对象数组
const billName = file.name;
const billData = utils.toSpecialLakeData(lakeList);
if (!billData || billData.length == 0) {
hide()
Modal.error({
title: "导入失败",
content: "找不到数据",
});
return;
}
const tasks = [];
if (billData.length > 0) {
tasks.push(
saveSpecialLake({
billName: billName,
lakeLibrarySpecialList: billData,
})
);
} }
hide()
}).catch(err=>{
console.log(err)
Modal.error({ title:err.data.msg || '文件导入失败', });
hide()
})
// let reader = new FileReader();
// reader.onload = (e) => {
// try {
// let data = new Uint8Array(e.target.result);
// let workbook = XLSX.read(data, {
// type: "array",
// });
// let sheetNames = workbook.SheetNames;
// // 解析成二维数组
// let aoa = XLSX.utils.sheet_to_json(workbook.Sheets[sheetNames[0]], {
// header: 1,
// });
// const lakeList = aoa.filter(
// (item) => {
// return item.length >= 24 && item[1] && !item[1].includes("测站名称");
// }
// );
// // 解析成对象数组
// const billName = file.name;
// const billData = utils.toSpecialLakeData(lakeList);
// if (!billData || billData.length == 0) {
// hide()
// Modal.error({
// title: "导入失败",
// content: "找不到数据",
// });
// return;
// }
// const tasks = [];
// if (billData.length > 0) {
// tasks.push(
// saveSpecialLake({
// billName: billName,
// lakeLibrarySpecialList: billData,
// })
// );
// }
// 上传到服务器 // // 上传到服务器
Promise.all(tasks) // Promise.all(tasks)
.then((res) => { // .then((res) => {
if (res[0].data.code == 0) { // if (res[0].data.code == 0) {
Modal.success({ // Modal.success({
title: "导入成功", // title: "导入成功",
content: `成功导入${billData.length}条数据`, // content: `成功导入${billData.length}条数据`,
}); // });
this.$refs.special && this.$refs.special.reload(); // this.$refs.special && this.$refs.special.reload();
} else { // } else {
Modal.error({ // Modal.error({
title: "导入失败", // title: "导入失败",
content: "数据上传出错", // content: "数据上传出错",
}); // });
} // }
}) // })
.catch(() => { // .catch(() => {
Modal.error({ // Modal.error({
title: "导入失败", // title: "导入失败",
content: "数据上传出错", // content: "数据上传出错",
}); // });
}) // })
.finally(() => { // .finally(() => {
hide(); // hide();
}); // });
} catch (error) { // } catch (error) {
hide(); // hide();
Modal.error({ // Modal.error({
title: "导入失败", // title: "导入失败",
content: error.message, // content: error.message,
}); // });
} // }
// console.log(billData); // // console.log(billData);
}; // };
reader.readAsArrayBuffer(file); // reader.readAsArrayBuffer(file);
return false; return false;
}, },

View File

@@ -6,7 +6,6 @@
<search :searchForm="searchForm" :filterKeys="filterKeys" @search="searchData" @exportFile="exportFile" @filterColumns="changeFilter" :visiable="visiable"/> <search :searchForm="searchForm" :filterKeys="filterKeys" @search="searchData" @exportFile="exportFile" @filterColumns="changeFilter" :visiable="visiable"/>
<!-- 表格 --> <!-- 表格 -->
<ele-pro-table <ele-pro-table
v-model:selection="selectionList"
ref="table" ref="table"
:loading="loading" :loading="loading"
:datasource="datasource" :datasource="datasource"
@@ -145,7 +144,7 @@ export default {
const arr = []; const arr = [];
const th = columns.map((item) => item.title); const th = columns.map((item) => item.title);
arr.push(th); arr.push(th);
this.data.forEach((d) => { this.datasource.forEach((d) => {
const td = columns.map((item) => d[item.dataIndex]); const td = columns.map((item) => d[item.dataIndex]);
arr.push(td); arr.push(td);
}); });

View File

@@ -6,7 +6,6 @@
<search :searchForm="searchForm" :filterKeys="filterKeys" @search="searchData" @exportFile="exportFile" @filterColumns="changeFilter" :visiable="visiable"/> <search :searchForm="searchForm" :filterKeys="filterKeys" @search="searchData" @exportFile="exportFile" @filterColumns="changeFilter" :visiable="visiable"/>
<!-- 表格 --> <!-- 表格 -->
<ele-pro-table <ele-pro-table
v-model:selection="selectionList"
ref="table" ref="table"
:datasource="datasource" :datasource="datasource"
:columns="columns" :columns="columns"
@@ -60,6 +59,13 @@ export default {
selection: [], selection: [],
// 表格列配置 // 表格列配置
columns: [ columns: [
{
key: 'index',
dataIndex: 'index',
width: 48,
align: 'center',
customRender: ({index}) => index + 1
},
{title: "监测时间", dataIndex: "monitorTime", sorter: true,}, {title: "监测时间", dataIndex: "monitorTime", sorter: true,},
{title: "类别", dataIndex: "type", sorter: true,}, {title: "类别", dataIndex: "type", sorter: true,},
{title: "点位名称", dataIndex: "pointName", sorter: true,}, {title: "点位名称", dataIndex: "pointName", sorter: true,},
@@ -125,7 +131,7 @@ export default {
const arr = []; const arr = [];
const th = columns.map((item) => item.title); const th = columns.map((item) => item.title);
arr.push(th); arr.push(th);
this.data.forEach((d) => { this.datasource.forEach((d) => {
const td = columns.map((item) => d[item.dataIndex]); const td = columns.map((item) => d[item.dataIndex]);
arr.push(td); arr.push(td);
}); });

View File

@@ -6,7 +6,6 @@
<search :searchForm="searchForm" :filterKeys="filterKeys" @search="searchData" @exportFile="exportFile" @filterColumns="changeFilter" :visiable="visiable"/> <search :searchForm="searchForm" :filterKeys="filterKeys" @search="searchData" @exportFile="exportFile" @filterColumns="changeFilter" :visiable="visiable"/>
<!-- 表格 --> <!-- 表格 -->
<ele-pro-table <ele-pro-table
v-model:selection="selectionList"
ref="table" ref="table"
:datasource="datasource" :datasource="datasource"
:columns="columns" :columns="columns"
@@ -61,6 +60,13 @@ export default {
selection: [], selection: [],
// 表格列配置 // 表格列配置
columns: [ columns: [
{
key: 'index',
dataIndex: 'index',
width: 48,
align: 'center',
customRender: ({index}) => index + 1
},
{title: "监测时间", dataIndex: "monitorTime", sorter: true,}, {title: "监测时间", dataIndex: "monitorTime", sorter: true,},
{title: "类别", dataIndex: "type", sorter: true,}, {title: "类别", dataIndex: "type", sorter: true,},
{title: "点位名称", dataIndex: "pointName", sorter: true,}, {title: "点位名称", dataIndex: "pointName", sorter: true,},
@@ -129,7 +135,7 @@ export default {
const arr = []; const arr = [];
const th = columns.map((item) => item.title); const th = columns.map((item) => item.title);
arr.push(th); arr.push(th);
this.data.forEach((d) => { this.datasource.forEach((d) => {
const td = columns.map((item) => d[item.dataIndex]); const td = columns.map((item) => d[item.dataIndex]);
arr.push(td); arr.push(td);
}); });

View File

@@ -6,7 +6,6 @@
<search :searchForm="searchForm" :filterKeys="filterKeys" @search="searchData" @exportFile="exportFile" @filterColumns="changeFilter" :visiable="visiable"/> <search :searchForm="searchForm" :filterKeys="filterKeys" @search="searchData" @exportFile="exportFile" @filterColumns="changeFilter" :visiable="visiable"/>
<!-- 表格 --> <!-- 表格 -->
<ele-pro-table <ele-pro-table
v-model:selection="selectionList"
ref="table" ref="table"
:datasource="datasource" :datasource="datasource"
:columns="columns" :columns="columns"
@@ -187,6 +186,13 @@ export default {
}) })
} }
this.columns = [ this.columns = [
{
key: 'index',
dataIndex: 'index',
width: 48,
align: 'center',
customRender: ({index}) => index + 1
},
{ title: "类别", dataIndex: "type", sorter: true }, { title: "类别", dataIndex: "type", sorter: true },
{ title: "点位名称", dataIndex: "pointName", sorter: true}, { title: "点位名称", dataIndex: "pointName", sorter: true},
...addCloumns ...addCloumns
@@ -237,7 +243,7 @@ export default {
arr.push(th1) arr.push(th1)
arr.push(th2) arr.push(th2)
this.data.forEach((d) => { this.datasource.forEach((d) => {
const td = this.sColumns.map((item) => d[item.dataIndex]); const td = this.sColumns.map((item) => d[item.dataIndex]);
arr.push(td); arr.push(td);
}); });

View File

@@ -24,6 +24,13 @@ const innerFilterColumns = [
] ]
const innerTableColumns = [ const innerTableColumns = [
{
key: 'index',
dataIndex: 'index',
width: 48,
align: 'center',
customRender: ({index}) => index + 1
},
{title: "监测时间", dataIndex: "monitorTime", sorter: true,}, {title: "监测时间", dataIndex: "monitorTime", sorter: true,},
{title: "断面名称", dataIndex: "pointName", sorter: true,}, {title: "断面名称", dataIndex: "pointName", sorter: true,},
{title: "水温(℃)", dataIndex: "waterTemperature", sorter: true,}, {title: "水温(℃)", dataIndex: "waterTemperature", sorter: true,},
@@ -53,6 +60,13 @@ const innerTableColumns = [
]; ];
const averageTableColumns = [ const averageTableColumns = [
{
key: 'index',
dataIndex: 'index',
width: 48,
align: 'center',
customRender: ({index}) => index + 1
},
{title: "监测时间", dataIndex: "monitorTime", sorter: true,}, {title: "监测时间", dataIndex: "monitorTime", sorter: true,},
{title: "断面名称", dataIndex: "pointName", sorter: true,}, {title: "断面名称", dataIndex: "pointName", sorter: true,},
{title: "水温(℃)", dataIndex: "waterTemperature", sorter: true,}, {title: "水温(℃)", dataIndex: "waterTemperature", sorter: true,},

View File

@@ -6,12 +6,12 @@
<search :searchForm="searchForm" :filterKeys="filterKeys" @search="searchData" @exportFile="exportFile" @filterColumns="changeFilter" :visiable="visiable"/> <search :searchForm="searchForm" :filterKeys="filterKeys" @search="searchData" @exportFile="exportFile" @filterColumns="changeFilter" :visiable="visiable"/>
<!-- 表格 --> <!-- 表格 -->
<ele-pro-table <ele-pro-table
v-model:selection="selectionList"
ref="table" ref="table"
:datasource="datasource" :datasource="datasource"
:columns="columns" :columns="columns"
:loading="loading" :loading="loading"
:where="where" :where="where"
row-key="lakeLibraryInnerCityId"
:scroll="{ x: 'max-content' }" :scroll="{ x: 'max-content' }"
@done="(d) => (data = d.data)" @done="(d) => (data = d.data)"
> >
@@ -156,7 +156,7 @@ export default {
const arr = []; const arr = [];
const th = columns.map((item) => item.title); const th = columns.map((item) => item.title);
arr.push(th); arr.push(th);
this.data.forEach((d) => { this.datasource.forEach((d) => {
const td = columns.map((item) => d[item.dataIndex]); const td = columns.map((item) => d[item.dataIndex]);
arr.push(td); arr.push(td);
}); });

View File

@@ -6,7 +6,6 @@
<search :searchForm="searchForm" :filterKeys="filterKeys" @search="searchData" @exportFile="exportFile" @filterColumns="changeFilter" :visiable="visiable"/> <search :searchForm="searchForm" :filterKeys="filterKeys" @search="searchData" @exportFile="exportFile" @filterColumns="changeFilter" :visiable="visiable"/>
<!-- 表格 --> <!-- 表格 -->
<ele-pro-table <ele-pro-table
v-model:selection="selectionList"
ref="table" ref="table"
:loading="loading" :loading="loading"
:datasource="datasource" :datasource="datasource"
@@ -144,7 +143,7 @@ export default {
const arr = []; const arr = [];
const th = columns.map((item) => item.title); const th = columns.map((item) => item.title);
arr.push(th); arr.push(th);
this.data.forEach((d) => { this.datasource.forEach((d) => {
const td = columns.map((item) => d[item.dataIndex]); const td = columns.map((item) => d[item.dataIndex]);
arr.push(td); arr.push(td);
}); });

View File

@@ -6,7 +6,6 @@
<search :searchForm="searchForm" :filterKeys="filterKeys" @search="searchData" @exportFile="exportFile" @filterColumns="changeFilter" :visiable="visiable"/> <search :searchForm="searchForm" :filterKeys="filterKeys" @search="searchData" @exportFile="exportFile" @filterColumns="changeFilter" :visiable="visiable"/>
<!-- 表格 --> <!-- 表格 -->
<ele-pro-table <ele-pro-table
v-model:selection="selectionList"
ref="table" ref="table"
:datasource="datasource" :datasource="datasource"
:columns="columns" :columns="columns"
@@ -61,6 +60,13 @@ export default {
selection: [], selection: [],
// 表格列配置 // 表格列配置
columns: [ columns: [
{
key: 'index',
dataIndex: 'index',
width: 48,
align: 'center',
customRender: ({index}) => index + 1
},
{title: "监测时间", dataIndex: "monitorTime", sorter: true,}, {title: "监测时间", dataIndex: "monitorTime", sorter: true,},
{title: "类别", dataIndex: "type", sorter: true,}, {title: "类别", dataIndex: "type", sorter: true,},
{title: "点位名称", dataIndex: "pointName", sorter: true,}, {title: "点位名称", dataIndex: "pointName", sorter: true,},
@@ -126,7 +132,7 @@ export default {
const arr = []; const arr = [];
const th = columns.map((item) => item.title); const th = columns.map((item) => item.title);
arr.push(th); arr.push(th);
this.data.forEach((d) => { this.datasource.forEach((d) => {
const td = columns.map((item) => d[item.dataIndex]); const td = columns.map((item) => d[item.dataIndex]);
arr.push(td); arr.push(td);
}); });

View File

@@ -6,7 +6,6 @@
<search :searchForm="searchForm" :filterKeys="filterKeys" @search="searchData" @exportFile="exportFile" @filterColumns="changeFilter" :visiable="visiable"/> <search :searchForm="searchForm" :filterKeys="filterKeys" @search="searchData" @exportFile="exportFile" @filterColumns="changeFilter" :visiable="visiable"/>
<!-- 表格 --> <!-- 表格 -->
<ele-pro-table <ele-pro-table
v-model:selection="selectionList"
ref="table" ref="table"
:datasource="datasource" :datasource="datasource"
:columns="columns" :columns="columns"
@@ -61,6 +60,13 @@ export default {
selection: [], selection: [],
// 表格列配置 // 表格列配置
columns: [ columns: [
{
key: 'index',
dataIndex: 'index',
width: 48,
align: 'center',
customRender: ({index}) => index + 1
},
{title: "监测时间", dataIndex: "monitorTime", sorter: true,}, {title: "监测时间", dataIndex: "monitorTime", sorter: true,},
{title: "类别", dataIndex: "type", sorter: true,}, {title: "类别", dataIndex: "type", sorter: true,},
{title: "点位名称", dataIndex: "pointName", sorter: true,}, {title: "点位名称", dataIndex: "pointName", sorter: true,},
@@ -129,7 +135,7 @@ export default {
const arr = []; const arr = [];
const th = columns.map((item) => item.title); const th = columns.map((item) => item.title);
arr.push(th); arr.push(th);
this.data.forEach((d) => { this.datasource.forEach((d) => {
const td = columns.map((item) => d[item.dataIndex]); const td = columns.map((item) => d[item.dataIndex]);
arr.push(td); arr.push(td);
}); });

View File

@@ -6,7 +6,6 @@
<search :searchForm="searchForm" :filterKeys="filterKeys" @search="searchData" @exportFile="exportFile" @filterColumns="changeFilter" :visiable="visiable"/> <search :searchForm="searchForm" :filterKeys="filterKeys" @search="searchData" @exportFile="exportFile" @filterColumns="changeFilter" :visiable="visiable"/>
<!-- 表格 --> <!-- 表格 -->
<ele-pro-table <ele-pro-table
v-model:selection="selectionList"
ref="table" ref="table"
:datasource="datasource" :datasource="datasource"
:columns="columns" :columns="columns"
@@ -187,6 +186,13 @@ export default {
}) })
} }
this.columns = [ this.columns = [
{
key: 'index',
dataIndex: 'index',
width: 48,
align: 'center',
customRender: ({index}) => index + 1
},
{ title: "类别", dataIndex: "type", sorter: true }, { title: "类别", dataIndex: "type", sorter: true },
{ title: "点位名称", dataIndex: "pointName", sorter: true}, { title: "点位名称", dataIndex: "pointName", sorter: true},
...addCloumns ...addCloumns
@@ -237,7 +243,7 @@ export default {
arr.push(th1) arr.push(th1)
arr.push(th2) arr.push(th2)
this.data.forEach((d) => { this.datasource.forEach((d) => {
const td = this.sColumns.map((item) => d[item.dataIndex]); const td = this.sColumns.map((item) => d[item.dataIndex]);
arr.push(td); arr.push(td);
}); });

View File

@@ -24,6 +24,13 @@ const innerFilterColumns = [
] ]
const innerTableColumns = [ const innerTableColumns = [
{
key: 'index',
dataIndex: 'index',
width: 48,
align: 'center',
customRender: ({index}) => index + 1
},
{title: "监测时间", dataIndex: "monitorTime", sorter: true,}, {title: "监测时间", dataIndex: "monitorTime", sorter: true,},
{title: "断面名称", dataIndex: "pointName", sorter: true,}, {title: "断面名称", dataIndex: "pointName", sorter: true,},
{title: "水温(℃)", dataIndex: "waterTemperature", sorter: true,}, {title: "水温(℃)", dataIndex: "waterTemperature", sorter: true,},
@@ -53,6 +60,13 @@ const innerTableColumns = [
]; ];
const averageTableColumns = [ const averageTableColumns = [
{
key: 'index',
dataIndex: 'index',
width: 48,
align: 'center',
customRender: ({index}) => index + 1
},
{title: "监测时间", dataIndex: "monitorTime", sorter: true,}, {title: "监测时间", dataIndex: "monitorTime", sorter: true,},
{title: "断面名称", dataIndex: "pointName", sorter: true,}, {title: "断面名称", dataIndex: "pointName", sorter: true,},
{title: "水温(℃)", dataIndex: "waterTemperature", sorter: true,}, {title: "水温(℃)", dataIndex: "waterTemperature", sorter: true,},

View File

@@ -6,7 +6,6 @@
<search :searchForm="searchForm" :filterKeys="filterKeys" @search="searchData" @exportFile="exportFile" @filterColumns="changeFilter" :visiable="visiable"/> <search :searchForm="searchForm" :filterKeys="filterKeys" @search="searchData" @exportFile="exportFile" @filterColumns="changeFilter" :visiable="visiable"/>
<!-- 表格 --> <!-- 表格 -->
<ele-pro-table <ele-pro-table
v-model:selection="selectionList"
ref="table" ref="table"
row-key="lakeLibrarySpecialId" row-key="lakeLibrarySpecialId"
:datasource="datasource" :datasource="datasource"
@@ -157,7 +156,7 @@ export default {
const arr = []; const arr = [];
const th = columns.map((item) => item.title); const th = columns.map((item) => item.title);
arr.push(th); arr.push(th);
this.data.forEach((d) => { this.datasource.forEach((d) => {
const td = columns.map((item) => d[item.dataIndex]); const td = columns.map((item) => d[item.dataIndex]);
arr.push(td); arr.push(td);
}); });