统计代码优化
This commit is contained in:
@@ -54,6 +54,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import moment from "moment";
|
||||
import {
|
||||
listNationalYoy,
|
||||
} from "@/api/ecology/river-statis";
|
||||
@@ -69,7 +70,7 @@
|
||||
return {
|
||||
data: [],
|
||||
locale,
|
||||
datasource: {},
|
||||
datasource: [],
|
||||
// 表格数据接口
|
||||
// url: autonomyWaterFunctionTotalUrl,
|
||||
selection: [],
|
||||
@@ -84,6 +85,7 @@
|
||||
title: "时间",
|
||||
dataIndex: "samplingTime",
|
||||
sorter: true,
|
||||
customRender: ({text})=> moment(text,"YYYY/MM").format("YYYY-MM")
|
||||
},
|
||||
{
|
||||
title: "水质目标",
|
||||
@@ -136,8 +138,13 @@
|
||||
this.loading = true;
|
||||
listNationalYoy(this.where).then((res) => {
|
||||
console.log(res.data.data);
|
||||
this.datasource = [];
|
||||
if (res.data.code == 0) {
|
||||
this.datasource = res.data.data;
|
||||
if (res.data.data) {
|
||||
res.data.data.forEach(e => {
|
||||
this.datasource.push(e);
|
||||
})
|
||||
}
|
||||
} else {
|
||||
this.$message.error(res.data.msg);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user