diff --git a/public/static/libs/mapbox/extend/RainsLayer.js b/public/static/libs/mapbox/extend/RainsLayer.js
index 158a271..e988422 100644
--- a/public/static/libs/mapbox/extend/RainsLayer.js
+++ b/public/static/libs/mapbox/extend/RainsLayer.js
@@ -125,14 +125,17 @@
// this.init();
}
- async init(images = []) {
+ async init(images = [],callback) {
this.images = images.length?images:this.images;
this.imagesFiles = [];
+ this.index = 0;
if (this.bbox.length && this.images.length) {
Object.keys(this.scales).forEach(key => plotInit(key, this.scales[key]));
if (!this.canvas) this.canvas = createCanvas(0);
this.imagesFiles = await Promise.all(this.images.map(url => urlToFile(url, _.last(_.split(url, '/')))));
this.callback && this.callback(this);
+ callback && callback(this);
+ setRainImage(this.imagesFiles[this.index], this.canvas, '1', this);
}
}
diff --git a/public/static/libs/mapbox/extend/RainsLayer.js b/public/static/libs/mapbox/extend/RainsLayer.js
index 158a271..e988422 100644
--- a/public/static/libs/mapbox/extend/RainsLayer.js
+++ b/public/static/libs/mapbox/extend/RainsLayer.js
@@ -125,14 +125,17 @@
// this.init();
}
- async init(images = []) {
+ async init(images = [],callback) {
this.images = images.length?images:this.images;
this.imagesFiles = [];
+ this.index = 0;
if (this.bbox.length && this.images.length) {
Object.keys(this.scales).forEach(key => plotInit(key, this.scales[key]));
if (!this.canvas) this.canvas = createCanvas(0);
this.imagesFiles = await Promise.all(this.images.map(url => urlToFile(url, _.last(_.split(url, '/')))));
this.callback && this.callback(this);
+ callback && callback(this);
+ setRainImage(this.imagesFiles[this.index], this.canvas, '1', this);
}
}
diff --git a/src/views/pictureOnMap/LayerControl.vue b/src/views/pictureOnMap/LayerControl.vue
index eea6c5e..e7922b6 100644
--- a/src/views/pictureOnMap/LayerControl.vue
+++ b/src/views/pictureOnMap/LayerControl.vue
@@ -19,6 +19,8 @@
{{ node.label }}
+
+
恢复默认
@@ -62,11 +64,13 @@
class: 'target-class',
children: [
{
+ id:"1-0",
value: '雨水分区',
label: '雨水系统',
icon: getImageUrl('yuliangzhan.png', 'images/NewLayercontrol'),
},
{
+ id:"1-1",
value: '污水分区',
label: '污水系统',
icon: getImageUrl('zishuidian.png', 'images/NewLayercontrol'),
@@ -109,9 +113,8 @@
// 这个方法会出现当前已勾选节点,或者半节点的状态
function check(data, node) {
+ setLayerVisible([],selectList.value);
selectList.value = [];
- console.log('node', node, data.value);
-
if (node) {
let arr = [...node.checkedNodes];
arr.map(item => {
@@ -121,50 +124,28 @@
});
}
- nextTick(() => {
- let arr = [];
- dataSource.value[0].children.map(p => {
- arr.push(p.value);
- });
- console.log('arr', arr);
+ console.log('node',node);
+ nextTick(() => {
+ let arr = dataSource.value[0].children.map(p => p.value);
arr.map(item => {
if (selectList.value.includes(item)) {
selectList.value.splice(selectList.value.indexOf(item), 1);
}
});
- selectList.value.push(data.value);
if (arr.includes(data.value)) {
+ selectList.value.push(data.value);
proxy.$refs.layertree.setCheckedKeys(selectList.value);
}
-
- console.log('selectList.value', selectList.value);
});
}
function setLayerVisible(newVal = [], oldVal = []) {
+ console.log('setLayerVisible',newVal,oldVal);
const openLayer = _.difference(newVal, oldVal);
const closeLayer = _.difference(oldVal, newVal);
- openLayer.length &&
- openLayer
- .map(i => i.split(','))
- .flat(Infinity)
- .forEach(key =>
- bus.emit('setLayerVisible', {
- layername: key,
- isCheck: key.includes('!') ? false : true,
- })
- );
- closeLayer.length &&
- closeLayer
- .map(i => i.split(','))
- .flat(Infinity)
- .forEach(key =>
- bus.emit('setLayerVisible', {
- layername: key,
- isCheck: key.includes('!') ? true : false,
- })
- );
+ openLayer.length && openLayer.map(i => i.split(',')).flat(Infinity).forEach(key => bus.emit('setLayerVisible', {layername: key, isCheck: key.includes('!') ? false : true,}));
+ closeLayer.length && closeLayer.map(i => i.split(',')).flat(Infinity).forEach(key => bus.emit('setLayerVisible', {layername: key, isCheck: key.includes('!') ? true : false,}));
newfiberMap.map.triggerRepaint();
}
diff --git a/public/static/libs/mapbox/extend/RainsLayer.js b/public/static/libs/mapbox/extend/RainsLayer.js
index 158a271..e988422 100644
--- a/public/static/libs/mapbox/extend/RainsLayer.js
+++ b/public/static/libs/mapbox/extend/RainsLayer.js
@@ -125,14 +125,17 @@
// this.init();
}
- async init(images = []) {
+ async init(images = [],callback) {
this.images = images.length?images:this.images;
this.imagesFiles = [];
+ this.index = 0;
if (this.bbox.length && this.images.length) {
Object.keys(this.scales).forEach(key => plotInit(key, this.scales[key]));
if (!this.canvas) this.canvas = createCanvas(0);
this.imagesFiles = await Promise.all(this.images.map(url => urlToFile(url, _.last(_.split(url, '/')))));
this.callback && this.callback(this);
+ callback && callback(this);
+ setRainImage(this.imagesFiles[this.index], this.canvas, '1', this);
}
}
diff --git a/src/views/pictureOnMap/LayerControl.vue b/src/views/pictureOnMap/LayerControl.vue
index eea6c5e..e7922b6 100644
--- a/src/views/pictureOnMap/LayerControl.vue
+++ b/src/views/pictureOnMap/LayerControl.vue
@@ -19,6 +19,8 @@
{{ node.label }}
+
+
恢复默认
@@ -62,11 +64,13 @@
class: 'target-class',
children: [
{
+ id:"1-0",
value: '雨水分区',
label: '雨水系统',
icon: getImageUrl('yuliangzhan.png', 'images/NewLayercontrol'),
},
{
+ id:"1-1",
value: '污水分区',
label: '污水系统',
icon: getImageUrl('zishuidian.png', 'images/NewLayercontrol'),
@@ -109,9 +113,8 @@
// 这个方法会出现当前已勾选节点,或者半节点的状态
function check(data, node) {
+ setLayerVisible([],selectList.value);
selectList.value = [];
- console.log('node', node, data.value);
-
if (node) {
let arr = [...node.checkedNodes];
arr.map(item => {
@@ -121,50 +124,28 @@
});
}
- nextTick(() => {
- let arr = [];
- dataSource.value[0].children.map(p => {
- arr.push(p.value);
- });
- console.log('arr', arr);
+ console.log('node',node);
+ nextTick(() => {
+ let arr = dataSource.value[0].children.map(p => p.value);
arr.map(item => {
if (selectList.value.includes(item)) {
selectList.value.splice(selectList.value.indexOf(item), 1);
}
});
- selectList.value.push(data.value);
if (arr.includes(data.value)) {
+ selectList.value.push(data.value);
proxy.$refs.layertree.setCheckedKeys(selectList.value);
}
-
- console.log('selectList.value', selectList.value);
});
}
function setLayerVisible(newVal = [], oldVal = []) {
+ console.log('setLayerVisible',newVal,oldVal);
const openLayer = _.difference(newVal, oldVal);
const closeLayer = _.difference(oldVal, newVal);
- openLayer.length &&
- openLayer
- .map(i => i.split(','))
- .flat(Infinity)
- .forEach(key =>
- bus.emit('setLayerVisible', {
- layername: key,
- isCheck: key.includes('!') ? false : true,
- })
- );
- closeLayer.length &&
- closeLayer
- .map(i => i.split(','))
- .flat(Infinity)
- .forEach(key =>
- bus.emit('setLayerVisible', {
- layername: key,
- isCheck: key.includes('!') ? true : false,
- })
- );
+ openLayer.length && openLayer.map(i => i.split(',')).flat(Infinity).forEach(key => bus.emit('setLayerVisible', {layername: key, isCheck: key.includes('!') ? false : true,}));
+ closeLayer.length && closeLayer.map(i => i.split(',')).flat(Infinity).forEach(key => bus.emit('setLayerVisible', {layername: key, isCheck: key.includes('!') ? true : false,}));
newfiberMap.map.triggerRepaint();
}
diff --git a/src/views/pictureOnMap/page/FloodControlAndDrainage/Pailaohuigu/index.vue b/src/views/pictureOnMap/page/FloodControlAndDrainage/Pailaohuigu/index.vue
index 8a0483c..95bc1e3 100644
--- a/src/views/pictureOnMap/page/FloodControlAndDrainage/Pailaohuigu/index.vue
+++ b/src/views/pictureOnMap/page/FloodControlAndDrainage/Pailaohuigu/index.vue
@@ -270,7 +270,7 @@
dataLoad.value=true
let parms = { time: huiguActiveTime.value };
reviewApi.rainMapDataBack(parms).then((res) => {
-
+
if (res.code == 200) {
hoursList.value = res.data;
hoursList.value.activeIndex = 0;
@@ -397,8 +397,9 @@
});
});
}
- newfiberMap.RainsLayer.show()
- newfiberMap.RainsLayer.init([res.data.weatherwarningFileurl.fileUrl])
+
+ // newfiberMap.RainsLayer.init([ 'https://server1.wh-nf.cn:9000/newfiber-donghugaoxin/2024/11/27/2024-07-02-4%E5%B0%8F%E6%97%B6-4_20241127201053A060.tif'])
+ newfiberMap.RainsLayer.init([res.data.weatherwarningFileurl.fileUrl],(self)=> self.show())
dataLoad.value=false
debugger
console.log("shangtu", res.data);