|
@@ -28,19 +28,18 @@
|
|
|
@click="eitem.isshow = !eitem.isshow"
|
|
|
></div>
|
|
|
</div>
|
|
|
- <pie
|
|
|
- v-if="eitem.scxstyle == 0"
|
|
|
+ <scjgContent
|
|
|
+ :ref="`contentRef${eitem.id}`"
|
|
|
v-show="eitem.isshow"
|
|
|
- class="echart"
|
|
|
- :class="`echart${eitem.dataList.length <= 6 ? '' : '_vertical'}`"
|
|
|
- unit="亩"
|
|
|
- @echartClick="(name, iseyes) => echartClick(name, iseyes, i)"
|
|
|
- :ref="`echartRef${eitem.id}`"
|
|
|
- ></pie>
|
|
|
+ :litem="eitem"
|
|
|
+ :piseyes="eitem.iseyes"
|
|
|
+ @mapview="changeDataSources"
|
|
|
+ ></scjgContent>
|
|
|
<el-collapse v-if="eitem.lchildren.length" v-show="eitem.isshow">
|
|
|
<collRecursiveTree
|
|
|
:data="eitem.lchildren"
|
|
|
:piseyes="eitem.iseyes"
|
|
|
+ @addrefs="addrefs"
|
|
|
@mapview="changeDataSources"
|
|
|
></collRecursiveTree>
|
|
|
</el-collapse>
|
|
@@ -53,7 +52,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import pie from "@/components/echartsTemplate/pie.vue";
|
|
|
+import scjgContent from "./scjgContent.vue";
|
|
|
import collRecursiveTree from "./collRecursiveTree.vue";
|
|
|
import { GetFxjg } from "@/api/ghss/hgxfx.js";
|
|
|
// import hgxfx from "../../../../static/data/ghss/data.js";
|
|
@@ -72,7 +71,7 @@ let colors = [
|
|
|
"#DCFFAF",
|
|
|
];
|
|
|
export default {
|
|
|
- components: { pie, collRecursiveTree },
|
|
|
+ components: { scjgContent, collRecursiveTree },
|
|
|
props: {
|
|
|
scjgObj: {
|
|
|
type: Object,
|
|
@@ -87,6 +86,7 @@ export default {
|
|
|
fileList: [],
|
|
|
},
|
|
|
fileid: 1,
|
|
|
+ reflist: {},
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
@@ -96,6 +96,9 @@ export default {
|
|
|
compute(mj) {
|
|
|
return mj ? (mj * 0.0015).toFixed(2) : 0;
|
|
|
},
|
|
|
+ addrefs(key, ref) {
|
|
|
+ this.reflist[key] = ref;
|
|
|
+ },
|
|
|
initData() {
|
|
|
this.echarts = [];
|
|
|
this.$emit("updateParent", "loading", true);
|
|
@@ -107,7 +110,7 @@ export default {
|
|
|
ci.name = ci.yslx_name || ci.scxname;
|
|
|
// ci.value = this.compute(ci.mj);
|
|
|
ci.value = ci.mj;
|
|
|
- ci.geom = ci.geom || (ci.data ? ci.data.geom : "");
|
|
|
+ ci.geom = ci.geom || "";
|
|
|
// ci.label = ci.mc_name;
|
|
|
});
|
|
|
this.echarts.push({
|
|
@@ -120,7 +123,7 @@ export default {
|
|
|
scxstyle: e.scxstyle,
|
|
|
});
|
|
|
if (e.scxstyle == 0) this.setEchart(c, e.scxbsm);
|
|
|
- // if (e.children) console.log(e.children)
|
|
|
+ if (e.children) this.lForEach(e.children, "echart");
|
|
|
});
|
|
|
this.$emit("updateParent", "loading", false);
|
|
|
}
|
|
@@ -132,22 +135,39 @@ export default {
|
|
|
// this.changeDataSources(this.echarts[i]);
|
|
|
// } else {
|
|
|
let iseyes = this.echarts[i].iseyes;
|
|
|
- this.echarts[i].dataList.forEach((child, ci) => {
|
|
|
- this.changeDataSources({ ...child, iseyes }, colors[ci]);
|
|
|
- });
|
|
|
- this.lchangeDataSources(this.echarts[i].lchildren, iseyes);
|
|
|
+ if (this.echarts[i].dataList)
|
|
|
+ this.echarts[i].dataList.forEach((child, ci) => {
|
|
|
+ this.changeDataSources({ ...child, iseyes }, colors[ci]);
|
|
|
+ });
|
|
|
+ this.lForEach(this.echarts[i].lchildren, iseyes, "sources");
|
|
|
// }
|
|
|
// emit("eyesChaneg");
|
|
|
},
|
|
|
- lchangeDataSources(data, iseyes) {
|
|
|
- data.forEach((child, ci) => {
|
|
|
+ lForEach(data, fun, iseyes) {
|
|
|
+ data.forEach((child) => {
|
|
|
if (child.dataList) {
|
|
|
child.dataList.forEach((ld, li) => {
|
|
|
- this.changeDataSources({ ...ld, iseyes }, colors[li]);
|
|
|
+ if (fun == "sources")
|
|
|
+ this.changeDataSources({ ...ld, iseyes }, colors[li]);
|
|
|
+ else {
|
|
|
+ ld.name = ld.yslx_name;
|
|
|
+ ld.value = ld.mj;
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
if (child.children) {
|
|
|
- this.lchangeDataSources(child.children, iseyes);
|
|
|
+ this.lForEach(child.children, fun, iseyes);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (
|
|
|
+ fun == "echart" &&
|
|
|
+ child.scxstyle == 0 &&
|
|
|
+ child.scxbsm.indexOf("GGFWSS") >= 0
|
|
|
+ ) {
|
|
|
+ child.id = child.scxbsm;
|
|
|
+ setTimeout(() => {
|
|
|
+ this.setEchart(child.dataList, child.id, child.id);
|
|
|
+ }, 200);
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -158,21 +178,13 @@ export default {
|
|
|
this.addPolygon(geom, id, color);
|
|
|
}
|
|
|
},
|
|
|
- echartClick(name, iseyes, index) {
|
|
|
- if (this.echarts[index].iseyes) {
|
|
|
- let click = this.echarts[index].dataList.filter((c) => c.name == name);
|
|
|
- if (click.length > 0)
|
|
|
- this.changeDataSources({
|
|
|
- geom: click[0].geom,
|
|
|
- id: click[0].id,
|
|
|
- iseyes,
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
- setEchart(data, id) {
|
|
|
+ setEchart(data, id, childid) {
|
|
|
this.$nextTick(() => {
|
|
|
let type = data.length <= 6 ? "horizontal" : "vertical";
|
|
|
- this.$refs[`echartRef${id}`][0].setOptions({ data, type });
|
|
|
+ if (!childid) this.$refs[`contentRef${id}`][0].setEchart(data, type);
|
|
|
+ else {
|
|
|
+ this.reflist[`contentRef${id}`].setEchart(data, type, childid);
|
|
|
+ }
|
|
|
});
|
|
|
},
|
|
|
// 加载GeoJSON数据
|
|
@@ -236,7 +248,7 @@ export default {
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
-<style lang="scss" scoped>
|
|
|
+<style lang="scss">
|
|
|
.scjg {
|
|
|
height: 100%;
|
|
|
overflow-y: auto;
|
|
@@ -295,7 +307,6 @@ export default {
|
|
|
background-image: url("/static/images/ghzc/to_right.png");
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
.echart {
|
|
|
width: 380px;
|
|
|
height: 220px;
|