|
@@ -157,6 +157,7 @@ export default {
|
|
|
mounted() {
|
|
|
this.$nextTick(() => {
|
|
|
try {
|
|
|
+ // 读取静态文件逻辑(commonDataGetUrl为静态文件路径,需要注意的是commonDataGetUrl属性在topSolt属性下面)
|
|
|
if (this.menuData && this.menuData.topSolt && this.menuData.topSolt.commonDataGetUrl) {
|
|
|
this.dataInitLoading = true;
|
|
|
this.$Get("/static/json/home/" + this.menuData.topSolt.commonDataGetUrl).then(
|
|
@@ -233,12 +234,17 @@ export default {
|
|
|
this.dataInitLoading = false;
|
|
|
}
|
|
|
);
|
|
|
- } else if (
|
|
|
- this.menuData &&
|
|
|
- this.menuData.columnId &&
|
|
|
- this.menuData.commonName !== "SUM" &&
|
|
|
- this.menuData.commonName !== "ALLLIST"
|
|
|
- ) {
|
|
|
+ } else if (this.menuData.commonName && this.menuData.commonName === "TOP") {
|
|
|
+ // top列表
|
|
|
+ this.topData(this.$store.state.homeSpecialTown);
|
|
|
+ } else if (this.menuData.commonName && this.menuData.commonName === "ALLLIST") {
|
|
|
+ // conut(*) group by
|
|
|
+ this.allListData(this.$store.state.homeSpecialTown);
|
|
|
+ } else if (this.menuData.commonName && this.menuData.commonName === "SUM") {
|
|
|
+ // for => conut(*) where
|
|
|
+ this.sumData(this.$store.state.homeSpecialTown);
|
|
|
+ } else if (this.menuData && this.menuData.columnId) {
|
|
|
+ // 默认查询DMS数据逻辑
|
|
|
this.dataInitLoading = true;
|
|
|
let params = new FormData();
|
|
|
params.append("columnId", this.menuData.columnId);
|
|
@@ -334,12 +340,6 @@ export default {
|
|
|
this.dataInitLoading = false;
|
|
|
}
|
|
|
);
|
|
|
- } else if (this.menuData.commonName && this.menuData.commonName === "TOP") {
|
|
|
- this.topData(this.$store.state.homeSpecialTown);
|
|
|
- } else if (this.menuData.commonName && this.menuData.commonName === "ALLLIST") {
|
|
|
- this.allListData(this.$store.state.homeSpecialTown);
|
|
|
- } else if (this.menuData.commonName && this.menuData.commonName === "SUM") {
|
|
|
- this.sumData(this.$store.state.homeSpecialTown);
|
|
|
}
|
|
|
// 只有第一次创建该页面,或刷新页面时。
|
|
|
if (this.menuData.menuIndex) {
|
|
@@ -594,22 +594,34 @@ export default {
|
|
|
changeHomeSpecialTown() {
|
|
|
try {
|
|
|
this.dataInitLoading = true;
|
|
|
+ // 如果静态文件中的数据存在,直接返回
|
|
|
if (this.resData[this.$store.state.homeSpecialTown] && this.menuData.topSolt && this.menuData.topSolt.commonData) {
|
|
|
+ // 普通街道
|
|
|
if (this.resData[this.$store.state.homeSpecialTown].categoryData) {
|
|
|
this.menuData.topSolt.commonData[0].categoryData = this.resData[this.$store.state.homeSpecialTown].categoryData;
|
|
|
this.menuData.topSolt.commonData[0].valueData = this.resData[this.$store.state.homeSpecialTown].valueData;
|
|
|
+ this.menuData.topSolt.commonData[0].value =
|
|
|
+ this.resData[this.$store.state.homeSpecialTown].valueData[
|
|
|
+ this.resData[this.$store.state.homeSpecialTown].valueData.length - 1
|
|
|
+ ];
|
|
|
} else {
|
|
|
+ // 全部
|
|
|
let _index = 0;
|
|
|
for (let keys in this.resData["全部"]) {
|
|
|
- this.menuData.topSolt.commonData[_index].title = keys;
|
|
|
- this.menuData.topSolt.commonData[_index].categoryData =
|
|
|
- this.resData[this.$store.state.homeSpecialTown][keys].categoryData;
|
|
|
- this.menuData.topSolt.commonData[_index].valueData =
|
|
|
- this.resData[this.$store.state.homeSpecialTown][keys].valueData;
|
|
|
- this.menuData.topSolt.commonData[_index].value =
|
|
|
- this.resData[this.$store.state.homeSpecialTown][keys].valueData[
|
|
|
- this.resData[this.$store.state.homeSpecialTown][keys].valueData.length - 1
|
|
|
- ];
|
|
|
+ let _commonData = {
|
|
|
+ title: keys,
|
|
|
+ unit: this.menuData.topSolt.commonData[_index].unit,
|
|
|
+ categoryData: this.resData[this.$store.state.homeSpecialTown][keys].categoryData,
|
|
|
+ valueData: this.resData[this.$store.state.homeSpecialTown][keys].valueData,
|
|
|
+ value:
|
|
|
+ this.resData[this.$store.state.homeSpecialTown][keys].valueData[
|
|
|
+ this.resData[this.$store.state.homeSpecialTown][keys].valueData.length - 1
|
|
|
+ ]
|
|
|
+ };
|
|
|
+ if(this.menuData.topSolt.commonData[_index].type){
|
|
|
+ _commonData.type = this.menuData.topSolt.commonData[_index].type
|
|
|
+ }
|
|
|
+ this.menuData.topSolt.commonData[_index] = _commonData;
|
|
|
_index++;
|
|
|
}
|
|
|
}
|