|
@@ -245,6 +245,7 @@ export default {
|
|
|
},
|
|
|
cityList: [],
|
|
|
imagelayers: {},
|
|
|
+ nowlayer: "",
|
|
|
provider: null,
|
|
|
layers: [],
|
|
|
};
|
|
@@ -256,7 +257,7 @@ export default {
|
|
|
created() {
|
|
|
// this.getYear();
|
|
|
// this.GetDate();
|
|
|
- this.typeList = [{ id: "01", label: "耕地" }, ...legends];
|
|
|
+ this.typeList = [{ id: "01", label: "耕地", index: 0 }, ...legends];
|
|
|
},
|
|
|
mounted() {},
|
|
|
methods: {
|
|
@@ -275,25 +276,29 @@ export default {
|
|
|
this.setLnbh(this.lnbndata);
|
|
|
},
|
|
|
dlbmChange() {
|
|
|
- this.gtype = this.typeList.find((x) => x.id == this.dlbm).label;
|
|
|
+ let nowtype = this.typeList.find((x) => x.id == this.dlbm);
|
|
|
+ this.gtype = nowtype.label;
|
|
|
this.regionChange();
|
|
|
- // serverfwmc
|
|
|
- console.log(this.provider);
|
|
|
- if (this.layers.length) {
|
|
|
- this.sourcesshow(false);
|
|
|
- SetParameters(
|
|
|
- this.layers[0].name,
|
|
|
- `dlbm like '${this.dlbm}%'`,
|
|
|
- // `dlbm = ${this.dlbm}`,
|
|
|
- this.provider,
|
|
|
- (lid) => {
|
|
|
- let yobj = this.yearList.find((y) => y.year == this.nowyear);
|
|
|
- console.log(yobj, this.yearList, this.nowyear, "obj");
|
|
|
- if (yobj) this.setImager({ ...yobj, lid });
|
|
|
- }
|
|
|
- );
|
|
|
+ if (this.dlbm == "01") {
|
|
|
+ this.nowlayer = this.nowyear;
|
|
|
+ } else {
|
|
|
+ if (nowtype.layerID) {
|
|
|
+ this.nowlayer = this.nowyear + nowtype.layerID;
|
|
|
+ console.log(nowtype, "----nowtype");
|
|
|
+ } else if (this.layers.length) {
|
|
|
+ let yobj = this.yearList.find((y) => y.year == this.nowyear);
|
|
|
+ if (yobj) this.goLayer(yobj, nowtype);
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
+ goLayer(lobj, nowtype) {
|
|
|
+ let lname = this.layers[0].name; // `dlbm like '${this.dlbm}%'`,
|
|
|
+ SetParameters(lname, `dlbm = '${this.dlbm}'`, this.provider, (lid) => {
|
|
|
+ this.typeList[nowtype.index].layerID = lid;
|
|
|
+ this.nowlayer = this.nowyear + lid;
|
|
|
+ this.setImager({ ...lobj, lid });
|
|
|
+ });
|
|
|
+ },
|
|
|
async GetDate() {
|
|
|
this.yearList = [];
|
|
|
let res = {};
|
|
@@ -315,6 +320,7 @@ export default {
|
|
|
});
|
|
|
|
|
|
this.nowyear = this.yearList.length ? this.yearList[0].year : "";
|
|
|
+ this.nowlayer = this.nowyear;
|
|
|
init_handler(this.yearList[0], this.showInfo);
|
|
|
store.setaddNode([
|
|
|
{ id: "gdbb", url: this.yearList[0].url, label: "耕地保护" },
|
|
@@ -341,17 +347,12 @@ export default {
|
|
|
},
|
|
|
setImager(obj, isshow = true, fun) {
|
|
|
let lkey = obj.year + (obj.lid || "");
|
|
|
- console.log(lkey, isshow, this.imagelayers[lkey], "---");
|
|
|
+ // console.log(lkey, isshow, this.imagelayers[lkey], "---");
|
|
|
if (this.imagelayers[lkey]) this.imagelayers[lkey].show = isshow;
|
|
|
- else if (isshow) {
|
|
|
- let superProvider = new Cesium.SuperMapImageryProvider({
|
|
|
- url: obj.url,
|
|
|
- name: obj.year,
|
|
|
- layersID: obj.lid || undefined,
|
|
|
- });
|
|
|
- if (!obj.lid) this.provider = superProvider;
|
|
|
- this.imagelayers[lkey] =
|
|
|
- viewer.imageryLayers.addImageryProvider(superProvider);
|
|
|
+ else if (isshow && obj.url) {
|
|
|
+ let { supProvider, layer } = addImagery(obj);
|
|
|
+ if (!obj.lid) this.provider = supProvider;
|
|
|
+ this.imagelayers[lkey] = layer;
|
|
|
}
|
|
|
if (obj.top) viewer.imageryLayers.raiseToTop(this.imagelayers[lkey]);
|
|
|
fun && fun(this.imagelayers[lkey]);
|
|
@@ -471,6 +472,11 @@ export default {
|
|
|
region(newValue) {
|
|
|
console.log(newValue, "---");
|
|
|
},
|
|
|
+ nowlayer(newValue, oldVal) {
|
|
|
+ console.log(newValue, oldVal, "-ssssss--");
|
|
|
+ this.setImager({ year: oldVal }, false);
|
|
|
+ this.setImager({ year: newValue }, true);
|
|
|
+ },
|
|
|
},
|
|
|
beforeDestroy() {
|
|
|
store.setaddNode([]);
|