Commit 23f82264 authored by 李苏's avatar 李苏 💬

模型操作页面相关调整

parent 62f333a7
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Description: * @Description:
* @Author: lisu lisu@gavelinfo.com * @Author: lisu lisu@gavelinfo.com
* @LastEditors: lisu lisu@gavelinfo.com * @LastEditors: lisu lisu@gavelinfo.com
* @LastEditTime: 2024-09-19 14:40:49 * @LastEditTime: 2024-09-19 15:31:39
* @FilePath: /zghywpc-vue/src/views/yhlywsytst/yhlywsytst/index.vue * @FilePath: /zghywpc-vue/src/views/yhlywsytst/yhlywsytst/index.vue
--> -->
<template> <template>
...@@ -303,8 +303,8 @@ ...@@ -303,8 +303,8 @@
<div class="search-item"> <div class="search-item">
<span class="search-span">近期引入:</span> <span class="search-span">近期引入:</span>
<RelSelect placeholder='' style="width: 100%;" :optionsData="[ <RelSelect placeholder='' style="width: 100%;" :optionsData="[
{id:'Y',name:'是'}, {id:true,name:'是'},
{id:'N',name:'否'} {id:false,name:'否'}
]" filterable clearable :match="{value:'id',label:'name'}" v-model='sypcQueryParams.isrRecentImport'> ]" filterable clearable :match="{value:'id',label:'name'}" v-model='sypcQueryParams.isrRecentImport'>
</RelSelect> </RelSelect>
</div> </div>
...@@ -314,8 +314,8 @@ ...@@ -314,8 +314,8 @@
<el-col :span="8" class="search-col"> <el-col :span="8" class="search-col">
<div class="search-item"> <div class="search-item">
<span class="search-span">规格:</span> <span class="search-span">规格:</span>
<RelSelect placeholder='' style="width: 100%;" src='sbgl/usbxx/init/ggxh ' filterable clearable <RelSelect placeholder='' style="width: 100%;" src='sbgl/usbxx/init/gg' filterable clearable
:match="{value:'id',label:'name'}" v-model='sypcQueryParams.gg'></RelSelect> :match="{value:'name',label:'name'}" v-model='sypcQueryParams.gg'></RelSelect>
</div> </div>
</el-col> </el-col>
<el-col :span="8" class="search-col"> <el-col :span="8" class="search-col">
...@@ -354,9 +354,11 @@ ...@@ -354,9 +354,11 @@
</el-col> </el-col>
<el-col :span="8" class="search-col flex-center"> <el-col :span="8" class="search-col flex-center">
<el-col :span="14" class="search-col flex-center"> <el-col :span="14" class="search-col flex-center">
<el-button v-show='mxbshow' <!-- <el-button v-show='mxbshow'
style="background-color: rgba(7,32,96,0.0);border: 1px solid #68D8FE; color: #68D8FE;" size="mini" style="background-color: rgba(7,32,96,0.0);border: 1px solid #68D8FE; color: #68D8FE;" size="mini"
@click="xsqbmx()" type="primary">显示全部模型</el-button> @click="xsqbmx()" type="primary">显示全部模型</el-button> -->
<el-button style="background-color: rgba(7,32,96,0.0);border: 1px solid #68D8FE; color: #68D8FE;"
size="mini" @click="czmx()" type="primary">重置模型</el-button>
</el-col> </el-col>
<el-col :span="10" class="search-col flex-center"> <el-col :span="10" class="search-col flex-center">
<el-button style="background-color: rgba(7,32,96,0.0);border: 1px solid #68D8FE; color: #68D8FE;" <el-button style="background-color: rgba(7,32,96,0.0);border: 1px solid #68D8FE; color: #68D8FE;"
...@@ -543,7 +545,7 @@ ...@@ -543,7 +545,7 @@
}, },
sypcQueryParams: { sypcQueryParams: {
gnwz: '', gnwz: '',
isrRecentImport: false, isrRecentImport: '',
gj: '', gj: '',
ldtx: '', ldtx: '',
gg: '', gg: '',
...@@ -607,6 +609,21 @@ ...@@ -607,6 +609,21 @@
} }
}, },
methods: { methods: {
czmx() {
this.viewer.scene.traverse((model) => {
if (model.isMesh) {
model.visible = true
}
});
if (this.allFlowObject.length) {
this.allFlowObject.forEach((item) => {
item.removeFromParent();
});
this.allFlowObject = [];
}
},
/* xsqbmx相关设置废除*/
xsqbmx() { xsqbmx() {
this.viewer.scene.traverse((model) => { this.viewer.scene.traverse((model) => {
if (model.isMesh) { if (model.isMesh) {
...@@ -621,6 +638,113 @@ ...@@ -621,6 +638,113 @@
this.apiJzbm() this.apiJzbm()
}, },
/* 点击按钮弹出异物,然后选中*/ /* 点击按钮弹出异物,然后选中*/
sypcMethods(res) {
let sbxxList = res.data.records.kshSbInfos || []
let zbInfos = res.data.records.zbInfos || []
/* 进行标记设备*/
this.$success(`已标记${sbxxList.length}个设备`)
const sbxxCodeList = sbxxList.map(item => item.sbxxCode)
/* 匹配设备信息length==0 */
if (sbxxCodeList.length == 0) {
return
}
/* 解决 先缓存选中色,后渲染黄色,默认选中时颜色不对
bug: 1默认还原为原色
2.高亮为黄色触发默认选中(黄色存储在另一个队列)
3.默认选中会还原上一个颜色
4.还原为原色,触发选中。变为选中色,清除为原色,覆盖了亮色
*/
if (sbxxCodeList.length != 0) {
this.reMaterialQue.forEach(item => {
item.revert()
})
}
this.reMaterialQue.splice(0, this.reMaterialQue.length)
/* 分割,在渲染高亮清空选中的*/
this.viewer.scene.traverse((model) => {
if (model.isMesh) {
if (sbxxCodeList.includes(model.name)) {
model.visible = true
let jzReMaterialQueItem = {
model,
material: model.oldmaterial.clone(),
revert: function() {
this.model.material = this.material
}
}
this.jzReMaterialQue.push(jzReMaterialQueItem)
model.material = new THREE.MeshPhongMaterial({
color: new THREE.Color('rgba(255, 164, 7, 0.8)'),
transparent: true,
opacity: 0.8,
wireframe: false,
})
} else {
/* 隐藏其他设备*/
if (model.name && model.name != '地面') {
model.visible = false
}
}
}
});
/* 显示展示全部按钮*/
this.mxbshow = true
/* 匹配展示数据和本地数据*/
if (this.jzReMaterialQue.length != 0) {
this.viewer.cameraControl.fitTo(this.jzReMaterialQue[0].model);
this.sylbshow = true
this.clickTag(this.jzReMaterialQue[0].model.name)
} else {
this.sylbshow = false
}
if (sbxxList.length > 0 && (this.jzReMaterialQue.length != sbxxList.length)) {
this.$warning('存在与模型数据不匹配的数据!')
}
/* 绘制全部流向*/
this.allPieData = zbInfos.filter((item) => {
return item.children.some((child) => child.data.length >= 2);
});
/* 绘制全部信息*/
if (this.allFlowObject.length) {
this.allFlowObject.forEach((item) => {
item.removeFromParent();
});
this.allFlowObject = [];
}
let flowPieDatas = this.allPieData
flowPieDatas.forEach(flowPieData => {
const children = this.allPieData.find((item) => item.name === flowPieData.name)?.children;
if (!children) {
return;
}
children.forEach((item) => {
if (item.data.length >= 2) {
const o = this.drawPipe(
item.data.map((item) => [item.x, item.y, item.z]),
item.radius,
this.flowDirection,
);
o.traverse((node) => {
if (node.isMesh) {
node._thing_tag = "helper";
}
});
this.allFlowObject.push(o);
const box = new THREE.Box3();
o.points.forEach((item) => {
box.expandByPoint(new THREE.Vector3(...item));
});
o.points.forEach((item) => {
box.expandByPoint(new THREE.Vector3(...item));
});
}
});
})
},
sypc() { sypc() {
if (!this.sypcQueryParams.gnwz) { if (!this.sypcQueryParams.gnwz) {
this.$warning('请输入功能位置后进行查询!') this.$warning('请输入功能位置后进行查询!')
...@@ -632,82 +756,35 @@ ...@@ -632,82 +756,35 @@
}) })
this.jzReMaterialQue.splice(0, this.jzReMaterialQue.length) this.jzReMaterialQue.splice(0, this.jzReMaterialQue.length)
this.$post('ksh/query', this.loading = true
this.sypcQueryParams this.loadingText = '正在处理,请稍等。'
).then(res => {
if (res.success) {
/* 绘制流向*/
let sbxxList = res.data.records || [] if (this.sypcQueryParams.isrRecentImport) {
this.$success(`已标记${sbxxList.length}个设备`) this.$post('ksh/query',
const sbxxCodeList = sbxxList.map(item => item.sbxxCode) this.sypcQueryParams
/* 匹配设备信息length==0 */ ).then(res => {
if (sbxxCodeList.length == 0) { if (res.success) {
return this.sypcMethods(res)
}
/* 解决 先缓存选中色,后渲染黄色,默认选中时颜色不对
bug: 1默认还原为原色
2.高亮为黄色触发默认选中(黄色存储在另一个队列)
3.默认选中会还原上一个颜色
4.还原为原色,触发选中。变为选中色,清除为原色,覆盖了亮色
*/
if (sbxxCodeList.length != 0) {
this.reMaterialQue.forEach(item => {
item.revert()
})
} }
this.reMaterialQue.splice(0, this.reMaterialQue.length) })
/* 分割,在渲染高亮清空选中的*/ }
/* 另外一个接口*/
this.viewer.scene.traverse((model) => { else {
if (model.isMesh) {
if (sbxxCodeList.includes(model.name)) {
model.visible = true
let jzReMaterialQueItem = {
model,
material: model.oldmaterial.clone(),
revert: function() {
this.model.material = this.material
}
}
this.jzReMaterialQue.push(jzReMaterialQueItem)
model.material = new THREE.MeshPhongMaterial({
color: new THREE.Color('rgba(255, 164, 7, 0.8)'),
transparent: true,
opacity: 0.8,
wireframe: false,
})
} else { this.$post('ksh/check/workOrder',
/* 隐藏其他设备*/ this.sypcQueryParams
if (model.name && model.name != '地面') { ).then(res => {
model.visible = false if (res.success) {
} /* 获取加载数据*/
} this.sypcMethods(res)
}
});
/* 绘制全部流向图*/
/* 显示展示全部按钮*/
this.mxbshow = true
/* 匹配展示数据和本地数据*/
if (this.jzReMaterialQue.length != 0) {
this.viewer.cameraControl.fitTo(this.jzReMaterialQue[0].model);
this.sylbshow = true
this.clickTag(this.jzReMaterialQue[0].model.name)
} else {
this.sylbshow = false
}
if (sbxxList.length > 0 && (this.jzReMaterialQue.length != sbxxList.length)) {
this.$warning('存在与模型数据不匹配的数据!')
} }
}).finally(() => {
this.loading = false
})
}
}
})
}, },
apiGetLbjxx() { apiGetLbjxx() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment