BIM设置
parent
8c06e14a40
commit
c345857ce7
|
@ -61,6 +61,34 @@ public class BimModelInfo extends BaseEntity
|
|||
@Excel(name = "是否有效")
|
||||
private Long isDel;
|
||||
|
||||
private String comName;
|
||||
private String projectName;
|
||||
private String deptName;
|
||||
|
||||
public String getComName() {
|
||||
return comName;
|
||||
}
|
||||
|
||||
public void setComName(String comName) {
|
||||
this.comName = comName;
|
||||
}
|
||||
|
||||
public String getProjectName() {
|
||||
return projectName;
|
||||
}
|
||||
|
||||
public void setProjectName(String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
public String getDeptName() {
|
||||
return deptName;
|
||||
}
|
||||
|
||||
public void setDeptName(String deptName) {
|
||||
this.deptName = deptName;
|
||||
}
|
||||
|
||||
public Long getIsDel() {
|
||||
return isDel;
|
||||
}
|
||||
|
|
|
@ -8,6 +8,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="modelId" column="model_id" />
|
||||
<result property="comId" column="com_id" />
|
||||
<result property="projectId" column="project_id" />
|
||||
<result property="deptName" column="dept_name" />
|
||||
<result property="comName" column="com_name" />
|
||||
<result property="projectName" column="projectName" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="modelName" column="model_name" />
|
||||
<result property="lightweightName" column="lightweightName" />
|
||||
|
@ -27,33 +30,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectBimModelInfoVo">
|
||||
select model_id, com_id, project_id, dept_id, model_name, lightweightName, gis_json, model_status, model_type,
|
||||
file_type, file_size, show_sand, status, remark, create_by, create_time, update_by, update_time,is_del
|
||||
from bim_model_info
|
||||
select bmi.model_id, bmi.com_id, bmi.project_id,
|
||||
sp.dept_name projectName,
|
||||
sd.dept_name com_name,pd.sub_dept_name dept_name,
|
||||
bmi.dept_id, bmi.model_name, bmi.lightweightName, bmi.gis_json, bmi.model_status, bmi.model_type,
|
||||
bmi.file_type, bmi.file_size, bmi.show_sand, bmi.status, bmi.remark, bmi.create_by, bmi.create_time, bmi.update_by, bmi.update_time,bmi.is_del
|
||||
from bim_model_info bmi
|
||||
left join sys_dept sp on sp.dept_id = bmi.project_id
|
||||
left join sys_dept sd on sd.dept_id = bmi.com_id
|
||||
left join pro_project_info_subdepts pd on pd.id=bmi.dept_id
|
||||
</sql>
|
||||
|
||||
<select id="selectBimModelInfoList" parameterType="BimModelInfo" resultMap="BimModelInfoResult">
|
||||
<include refid="selectBimModelInfoVo"/>
|
||||
<where>
|
||||
is_del <> 1
|
||||
<if test="comId != null "> and com_id = #{comId}</if>
|
||||
<if test="projectId != null "> and project_id = #{projectId}</if>
|
||||
<if test="deptId != null "> and dept_id = #{deptId}</if>
|
||||
<if test="modelName != null and modelName != ''"> and model_name like concat('%', #{modelName}, '%')</if>
|
||||
<if test="lightweightName != null and lightweightName != ''"> and lightweightName like concat('%', #{lightweightName}, '%')</if>
|
||||
<if test="gisJson != null and gisJson != ''"> and gis_json = #{gisJson}</if>
|
||||
<if test="modelStatus != null "> and model_status = #{modelStatus}</if>
|
||||
<if test="modelType != null and modelType != ''"> and model_type = #{modelType}</if>
|
||||
<if test="fileType != null and fileType != ''"> and file_type = #{fileType}</if>
|
||||
<if test="fileSize != null "> and file_size = #{fileSize}</if>
|
||||
<if test="showSand != null "> and show_sand = #{showSand}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
bmi.is_del <> 1
|
||||
<if test="comId != null "> and bmi.com_id = #{comId}</if>
|
||||
<if test="projectId != null "> and bmi.project_id = #{projectId}</if>
|
||||
<if test="deptId != null "> and bmi.dept_id = #{deptId}</if>
|
||||
<if test="modelName != null and modelName != ''"> and bmi.model_name like concat('%', #{modelName}, '%')</if>
|
||||
<if test="lightweightName != null and lightweightName != ''"> and bmi.lightweightName like concat('%', #{lightweightName}, '%')</if>
|
||||
<if test="gisJson != null and gisJson != ''"> and bmi.gis_json = #{gisJson}</if>
|
||||
<if test="modelStatus != null "> and bmi.model_status = #{modelStatus}</if>
|
||||
<if test="modelType != null and modelType != ''"> and bmi.model_type = #{modelType}</if>
|
||||
<if test="fileType != null and fileType != ''"> and bmi.file_type = #{fileType}</if>
|
||||
<if test="fileSize != null "> and bmi.file_size = #{fileSize}</if>
|
||||
<if test="showSand != null "> and bmi.show_sand = #{showSand}</if>
|
||||
<if test="status != null "> and bmi.status = #{status}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectBimModelInfoByModelId" parameterType="Long" resultMap="BimModelInfoResult">
|
||||
<include refid="selectBimModelInfoVo"/>
|
||||
where model_id = #{modelId}
|
||||
where bmi.model_id = #{modelId}
|
||||
</select>
|
||||
|
||||
<insert id="insertBimModelInfo" parameterType="BimModelInfo" useGeneratedKeys="true" keyProperty="modelId">
|
||||
|
|
|
@ -174,7 +174,11 @@
|
|||
<artifactId>mpxj</artifactId>
|
||||
<version>13.5.1</version> <!-- 请检查最新版本 -->
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.xerial</groupId>
|
||||
<artifactId>sqlite-jdbc</artifactId>
|
||||
<version>3.41.2.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -79,6 +79,51 @@ public class BimModelController {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 叶子节点的model_tree查询
|
||||
* @param name
|
||||
* @param pid
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/modelTreeAllLeafChild/{name}")
|
||||
public AjaxResult getModelTreeAllLeafChildren(@PathVariable("name") String name,String pid) {
|
||||
if(StringUtils.isEmpty(name)){
|
||||
return AjaxResult.error("name is null");
|
||||
}
|
||||
String sql="";
|
||||
if(StringUtils.isEmpty(pid)){
|
||||
sql="select * from model_tree ";
|
||||
}else{
|
||||
sql="with recursive\n" +
|
||||
" cao as (\n" +
|
||||
" select * from model_tree where glid = ? \n" +
|
||||
" union all\n" +
|
||||
" select model_tree.* from cao join model_tree on cao.glid = model_tree.pGlid\n" +
|
||||
" )\n" +
|
||||
"select glid from cao where externalid<>0";
|
||||
}
|
||||
String path=bimDataSource.getDbPath(name);
|
||||
if(!new File(path).exists()){
|
||||
return AjaxResult.error("file not found!");
|
||||
}
|
||||
try {
|
||||
DataSource ds = bimDataSource.getDataSource(name);
|
||||
PreparedStatement pss= ds.getConnection().prepareStatement(sql);
|
||||
if(StringUtils.isNotEmpty(pid)) {
|
||||
pss.setString(1,pid);
|
||||
}
|
||||
ResultSet rs = pss.executeQuery();
|
||||
List<String> list = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
list.add(rs.getString("glid"));
|
||||
}
|
||||
return AjaxResult.success(list);
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 不带子节点的Model_Tree查询
|
||||
* @param name
|
||||
|
|
|
@ -5,8 +5,14 @@ window.config = {
|
|||
modelFile: "https://model.jhncidg.com:18086",
|
||||
secretKey:
|
||||
"cbe8c300dfb0280d71bf6546087c6d2fa49260085f53fca86c69755ac3a39199e08cb605efce617acfa509d5f3ee4d7f67a84d7c36cc175589405fde5d995a24258c47f45b34485a2edb350010e2f42cd5b388af45c6b070850288d284cbbbcd51e36f41b756a25f38d27dbe2e47e96b9eb56a96b59d61e02a467e881f70b21989b1a50685b6fc0265f528fc20b876d425a89c4bf6b33f829177fda27027e65b8a94867b381ae88ecd6668e8ca6b6d286dce7e5d799b0a1791905fc1eba1be4bd6b2a0d0983e9fd1184d8dbba49a8569257e195e636a849299be5a52d738b8218ae3e55ca95ec2999742c749dda98108ecfe0622c0e7fe1d76ad60b6c191c99adca5f9cf5e5f096c599f1874ee756fe16dce7e5d799b0a175d5afe5554a4332203e774bed8a045353e9bf5abfe83ffe0cca50ef6c618828a9d63dac2d06e44c19cc1e4d0220e60c6fb1ba2643538d1973ae24d1650ef196ed32b1cdbecb9bf3ae2651ff226b8a2383977aeaabb9225d76f8b62bd8891c29bfb1ba2643538d1973ae24d1650ef196ed32b1cdbecb9bf3aded264d2944b7de536ca05b5a67eccf9e531630520dbe4663b2d265fe6a4c8877fcba7ce8189fbc216cdeb3ecbc1d365395fd220141d4e6d9fd317e3dac7bb223013404ec41c18c9cc748e652ce16fe7061c32d550edfda330c1555e0c08e51f698f96b91615d8229cf32d2e110ec91f1211e23c769b5bbe1aa9a9191a2d3da09800e6efdee12ee04fdc9df330134f94052efc320a8c1a143e939c0e3b1ad476cf3630a2823a9a2dc2a17ec077fd21bfa7550ed054853e32510f8a6ea5c1dff9c3d61f7cf5f649cb25f0dbad9f7f66e3b446946685cead0cfac91bea061f4ff49a2f853c245297edc3d61f7cf5f649cb0f9b84173857a7b67c27928b58b4a6a65f517a43f106335ecc43571d292f54baa4596f82cf86665b367e01045009c18a2b543696b93a5bd44ca8168b525235150ffadf3f628aa7e8a20b9e74d76bd3a1e26b026e5297005a780f011db11ddb55fbabdc0f876c1cdfa5ef7db74bbc52e19c6396ffcf10044da26ecd334722494fc515b205e9624a4468762f63f0143583d1eeaaa85ff95ee50d8f953f44140ab40f29957f914b2241fd1309b7be0d5f9e55207069d393244a5be14de83e99956e957e025b859c7dd3cebcdd4589bf15942a17f162a5b95af68b416632dbf24db069995334a82a49d6060f7a5b770b6e18ecf8cb01c0e21b608156b326e2f4461369f266ad62ac2edf64d1767ac6ea3d83c9ba33a4517541406791c384c597539cc1ffcdbe8f3563a125da5d3905c7f92abef0fe8b967e5bc2832940bf4230fe93bdd44267922427c4db140fd5cb164da87f17f480c39e9c1c17bd48d031e3ce8ab3a49456b48f3b49549c2da3f62d2a8da7d5f36e39ce04af5e3f8253971ef20b10b7b200fbc7c3d3f71e19f74e660313cf3630a2823a9a2d0acd9cb22f32e975d8b70082aab5ddbcb644d89a77efad286dee59796b124081510f8a6ea5c1dff9cb0f31d9a93422d1de95a0001376b8d685af667dd7ebaf4bdfc4840ac1126277417910a2ed0df6e3ca2026459a491059689206d702832f51afafd0506174e868c12cc462769b2e685be04514c976edd04ca2ef020dc56bee8321afe91a1dcbb1afafd0506174e8680f18f43fcd13957eef440c21db889c81888bce192514399191b48af868eda487753151533a27704469e5635404d6fdfb753151533a277044afdd825f7197f289753151533a27704484b9cf9eccaf749638930dbe9049f2ae36689b286e75a81e016aa63061505f57a8c1113b833628e3a18dff8ae8ac8eaae0e7c3406ae4dd4e10880b34c16e1b7405884ca1d5603015a7b0730878fafb08",
|
||||
serverIP: "model.jhncidg.com",
|
||||
port: "8000",
|
||||
serverIP: "model.jhncidg.com", //服务ip地址
|
||||
port: "8000", //HTTP端口
|
||||
useHttps: true, //使用Https
|
||||
openEarth: false, //[可选]开启Gis场景
|
||||
bgColor: "rgba(135 ,206 ,250,1)", //[可选]bim场景背景色, 传值即为纯色天空盒
|
||||
tintColor: "rgba(255,255,0,1)", //[可选]osgb单体化颜色
|
||||
sceneTime: ["13:00", "6:00", "18:00"], //[可选]分别为当前时间、日出时间、日落时间
|
||||
cadMode: false, // 是否是Cad图纸预览模式
|
||||
modelInput: {
|
||||
ConfigJson: {
|
||||
style: 1,
|
||||
|
|
|
@ -57,3 +57,10 @@ export function getModelTree(name, pid) {
|
|||
method: "get",
|
||||
});
|
||||
}
|
||||
|
||||
export function getTreeAllLeafChild(name, pid) {
|
||||
return request({
|
||||
url: "/manage//bim/modelInfo/modelTreeAllLeafChild/" + name + "?pid=" + pid,
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
|
|
|
@ -29,14 +29,13 @@
|
|||
</template>
|
||||
</a-tree>-->
|
||||
<div class="scroll-box">
|
||||
<a-tree ref="tree" v-model:expandedKeys="expandedKeys" v-model:selectedKeys="selectedKeys" :tree-data="modelTrees" checkable default-expand-all :load-data="loadTree"></a-tree>
|
||||
<a-tree ref="tree" v-model:expandedKeys="expandedKeys" @check="onCheckTree" v-model:selectedKeys="selectedKeys" :tree-data="modelTrees" checkable default-expand-all :load-data="loadTree"></a-tree>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getModelTree } from '@/api/bim/bimModel'
|
||||
import { isLeaf } from 'ant-design-vue/es/vc-cascader/utils/commonUtil'
|
||||
import { getModelTree, getTreeAllLeafChild } from '@/api/bim/bimModel'
|
||||
export default {
|
||||
props: {
|
||||
projectMessage: {
|
||||
|
@ -61,21 +60,15 @@ export default {
|
|||
firstClick: true,
|
||||
isMobile: false,
|
||||
showTree: true,
|
||||
visibleList: [],
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// let objs = this.projectMessage.map((d) => JSON.parse(d.gisJson))
|
||||
// for (let i = 0; i < objs.length; i++) {
|
||||
// this.modelTrees.push({
|
||||
// name: objs[i].name,
|
||||
// children: [],
|
||||
// data: objs[i],
|
||||
// })
|
||||
// }
|
||||
this.modelTrees = [
|
||||
{
|
||||
title: '项目模型',
|
||||
level: 0,
|
||||
type: 'root',
|
||||
key: 'root',
|
||||
children: [],
|
||||
hadLoad: true,
|
||||
|
@ -90,9 +83,11 @@ export default {
|
|||
this.modelTrees[0].children.push({
|
||||
title: d.modelName,
|
||||
level: 1,
|
||||
type: 'model',
|
||||
hasLoad: false,
|
||||
model: d.lightweightName,
|
||||
modelId: d.lightweightName,
|
||||
key: d.lightweightName,
|
||||
externalId: '0',
|
||||
glid: '',
|
||||
children: [],
|
||||
data: d,
|
||||
|
@ -108,7 +103,7 @@ export default {
|
|||
resolve()
|
||||
return
|
||||
}
|
||||
getModelTree(a.model, a.glid).then((d) => {
|
||||
getModelTree(a.modelId, a.glid).then((d) => {
|
||||
;(d.data || []).forEach((e) => {
|
||||
let title = e.externalId == 0 ? e.name : e.externalId
|
||||
title = title.replace(/[\/\\"]/g, '')
|
||||
|
@ -116,7 +111,9 @@ export default {
|
|||
title: title,
|
||||
key: e.glid,
|
||||
glid: e.glid,
|
||||
model: a.model,
|
||||
externalId: e.externalId,
|
||||
modelId: a.modelId,
|
||||
type: 'data',
|
||||
children: [],
|
||||
hasLoad: false,
|
||||
isLeaf: e.externalId != 0,
|
||||
|
@ -127,6 +124,128 @@ export default {
|
|||
})
|
||||
})
|
||||
},
|
||||
addModel(modelId, cb) {
|
||||
let url = `${window.config.modelUrl}/Tools/output/model/${modelId}/root.glt`
|
||||
api.Model.add(
|
||||
url,
|
||||
modelId,
|
||||
() => {},
|
||||
() => {
|
||||
console.log('加载模型成功')
|
||||
cb && cb()
|
||||
}
|
||||
)
|
||||
},
|
||||
onCheckTree(heckedKeys, e) {
|
||||
const checkNode = e.node.dataRef
|
||||
const checked = e.checked
|
||||
if (checkNode.type == 'root') {
|
||||
if (checked) {
|
||||
checkNode.children.forEach((m) => {
|
||||
if (api.m_model.has(m.modelId)) {
|
||||
api.Model.setVisible(m.modelId, true)
|
||||
} else {
|
||||
this.addModel(m.modelId)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
if (api.m_model.size == 0) {
|
||||
return
|
||||
}
|
||||
checkNode.children.forEach((m) => {
|
||||
if (api.m_model.has(m.modelId)) {
|
||||
api.Model.setVisible(m.modelId, false)
|
||||
}
|
||||
})
|
||||
}
|
||||
return
|
||||
}
|
||||
if (checkNode.type == 'model') {
|
||||
if (checked) {
|
||||
if (api.m_model.has(checkNode.modelId)) {
|
||||
api.Model.setVisible(checkNode.modelId, true)
|
||||
} else {
|
||||
this.addModel(checkNode.modelId)
|
||||
}
|
||||
} else {
|
||||
if (api.m_model.has(checkNode.modelId)) {
|
||||
api.Model.setVisible(checkNode.modelId, false)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
if (api.m_model.size == 0) {
|
||||
let modelId = checkNode.modelId
|
||||
this.addModel(modelId, () => {
|
||||
this.showItem(e)
|
||||
})
|
||||
} else {
|
||||
this.showItem(e)
|
||||
}
|
||||
},
|
||||
async showItem(e) {
|
||||
const checkNode = e.node.dataRef
|
||||
const checked = e.checked
|
||||
api.Model.setVisible(checkNode.modelId, true)
|
||||
let externalId = checkNode.externalId
|
||||
if (externalId != 0) {
|
||||
if (checked) {
|
||||
this.visibleList.push(externalId)
|
||||
api.Feature.setVisible(this.visibleList.join('#'), true, checkNode.modelId, false)
|
||||
} else {
|
||||
this.visibleList = this.visibleList.filter((item) => item !== externalId)
|
||||
api.Feature.setVisible(externalId, false, checkNode.modelId)
|
||||
}
|
||||
} else {
|
||||
e.node.disableCheckbox = true
|
||||
const res = await getTreeAllLeafChild(checkNode.modelId, checkNode.glid)
|
||||
let nodes = res.data || []
|
||||
if (nodes.length > 0) {
|
||||
if (checked) {
|
||||
this.visibleList = this.MergeArray(nodes, this.visibleList)
|
||||
api.Model.setVisible(checkNode.modelId, true)
|
||||
api.Feature.setVisible(this.visibleList.join('#'), true, checkNode.modelId, false)
|
||||
} else {
|
||||
this.visibleList = this.DelArray(this.visibleList, nodes)
|
||||
api.Feature.setVisible(nodes.join('#'), false, checkNode.modelId)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
MergeArray(arr1, arr2) {
|
||||
var _arr = new Array()
|
||||
for (var i = 0; i < arr1.length; i++) {
|
||||
_arr.push(arr1[i])
|
||||
}
|
||||
for (var i = 0; i < arr2.length; i++) {
|
||||
var flag = true
|
||||
for (var j = 0; j < arr1.length; j++) {
|
||||
if (arr2[i] == arr1[j]) {
|
||||
flag = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
_arr.push(arr2[i])
|
||||
}
|
||||
}
|
||||
return _arr
|
||||
},
|
||||
DelArray(array1, array2) {
|
||||
var result = []
|
||||
for (var i = 0; i < array1.length; i++) {
|
||||
var k = 0
|
||||
for (var j = 0; j < array2.length; j++) {
|
||||
if (array1[i] != array2[j]) {
|
||||
k++
|
||||
if (k == array2.length) {
|
||||
result.push(array1[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -23,16 +23,42 @@ export default {
|
|||
subDepts: [],
|
||||
models: [],
|
||||
showTree: false,
|
||||
initSuccess: false,
|
||||
}
|
||||
},
|
||||
beforeUnmount() {
|
||||
document.body.classList.remove('is-sapi')
|
||||
},
|
||||
mounted() {
|
||||
document.body.classList.add('is-sapi')
|
||||
this.userStore = useUserStore()
|
||||
this.isAdmin = this.userStore.isAdmin
|
||||
this.currentPrjId = this.userStore.currentPrjId
|
||||
this.currentComId = this.userStore.currentComId
|
||||
this.initLoadModel()
|
||||
this.initEngine()
|
||||
},
|
||||
methods: {
|
||||
initEngine() {
|
||||
window.api = new SAPI(
|
||||
{
|
||||
serverIP: window.config.serverIP, //服务ip地址
|
||||
port: window.config.port, //HTTP端口
|
||||
useHttps: window.config.useHttps, //使用Https
|
||||
container: 'bimSettingContainer', //[必须]容器id
|
||||
secretKey: window.config.secretKey,
|
||||
openEarth: window.config.openEarth, //[可选]开启Gis场景
|
||||
bgColor: window.config.bgColor, //[可选]bim场景背景色, 传值即为纯色天空盒
|
||||
tintColor: window.config.tintColor, //[可选]osgb单体化颜色
|
||||
sceneTime: window.config.sceneTime, //[可选]分别为当前时间、日出时间、日落时间
|
||||
cadMode: window.config.cadMode, // 是否是Cad图纸预览模式
|
||||
},
|
||||
() => {
|
||||
this.initSuccess = true
|
||||
console.log('初始化成功')
|
||||
}
|
||||
)
|
||||
},
|
||||
initLoadModel() {
|
||||
listBimModel({
|
||||
pageNum: 1,
|
||||
|
@ -55,5 +81,14 @@ export default {
|
|||
<style lang="scss">
|
||||
.bim-setting-page {
|
||||
position: relative;
|
||||
height: 100%;
|
||||
#bimSettingContainer {
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
body.is-sapi {
|
||||
.app-main {
|
||||
height: calc(100vh - 84px);
|
||||
}
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue