BIM设置

dev_xd
haha 2025-04-22 00:07:38 +08:00
parent cdda19bfae
commit 8c06e14a40
22 changed files with 1194 additions and 313 deletions

View File

@ -0,0 +1,40 @@
package com.yanzhu.manage.bim;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import org.apache.commons.collections4.map.HashedMap;
import javax.sql.DataSource;
import java.util.Map;
public class BimDataSource {
private String dataPath;
public BimDataSource(String dataPath) {
this.dataPath = dataPath;
}
private String driverName="org.sqlite.JDBC";
public String getDbPath(String name){
return dataPath+name+".db";
}
public DataSource getDataSource(String dbName) {
if(dataSourceMap.containsKey(dbName)) {
return dataSourceMap.get(dbName);
}
String url="jdbc:sqlite:"+getDbPath(dbName);
HikariConfig config = new HikariConfig();
config.setDriverClassName(driverName);
config.setJdbcUrl(url);
config.setMaximumPoolSize(100);
config.setConnectionTestQuery("SELECT 1");
DataSource ds= new HikariDataSource(config);
dataSourceMap.put(dbName, ds);
return ds;
}
private Map<String,DataSource> dataSourceMap=new HashedMap<>();
}

View File

@ -0,0 +1,25 @@
package com.yanzhu.manage.bim;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class BimDataSourceConfig {
private static final Logger log = LoggerFactory.getLogger(BimDataSourceConfig.class);
@Value("${bim.dataPath}")
private String dataPath;
@Bean
public BimDataSource bimDataSource() {
return new BimDataSource(dataPath);
}
}

View File

@ -0,0 +1,272 @@
package com.yanzhu.manage.controller.bim;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.yanzhu.common.core.utils.StringUtils;
import com.yanzhu.common.core.web.domain.AjaxResult;
import com.yanzhu.manage.bim.BimDataSource;
import com.yanzhu.manage.bim.BimDataSourceConfig;
import com.yanzhu.manage.domain.bim.ModelPropertyVo;
import com.yanzhu.manage.domain.bim.ModelTreeVo;
import com.yanzhu.manage.domain.bim.ModelTypeVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.sql.DataSource;
import java.io.File;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
@RestController
@RequestMapping("/bim/modelInfo")
public class BimModelController {
@Autowired
private BimDataSource bimDataSource;
/**
* model_tree
* @param name
* @param pid
* @return
*/
@GetMapping("/modelTreeAllChild/{name}")
public AjaxResult getModelTreeAllChild(@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 * from cao where pGlid is not null";
}
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<ModelTreeVo> list = new ArrayList<>();
while (rs.next()) {
ModelTreeVo modelTreeVo = new ModelTreeVo();
modelTreeVo.setId(rs.getLong("id"));
modelTreeVo.setGlid(rs.getString("glid"));
modelTreeVo.setName(rs.getString("name"));
modelTreeVo.setLevel(rs.getInt("level"));
modelTreeVo.setGroupname(rs.getString("groupname"));
modelTreeVo.setExternalId(rs.getString("externalId"));
modelTreeVo.setPGlid(rs.getString("pGlid"));
list.add(modelTreeVo);
}
return AjaxResult.success(list);
} catch (Exception e) {
return AjaxResult.error(e.getMessage());
}
}
/**
* Model_Tree
* @param name
* @param pid
* @return
*/
@GetMapping("/modelTree/{name}")
public AjaxResult getModelTree(@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 where level=0";
}else{
sql="select * from model_tree where pglid = ?";
}
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<ModelTreeVo> list = new ArrayList<>();
while (rs.next()) {
ModelTreeVo modelTreeVo = new ModelTreeVo();
modelTreeVo.setId(rs.getLong("id"));
modelTreeVo.setGlid(rs.getString("glid"));
modelTreeVo.setName(rs.getString("name"));
modelTreeVo.setLevel(rs.getInt("level"));
modelTreeVo.setGroupname(rs.getString("groupname"));
modelTreeVo.setExternalId(rs.getString("externalId"));
modelTreeVo.setPGlid(rs.getString("pGlid"));
list.add(modelTreeVo);
}
return AjaxResult.success(list);
} catch (Exception e) {
return AjaxResult.error(e.getMessage());
}
}
/**
* model_type
* @param name
* @param pid
* @return
*/
@GetMapping("/modelTypeAllChild/{name}")
public AjaxResult getModelTypeAllChild(@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_type ";
}else{
sql="WITH recursive cao AS (\n" +
" SELECT * FROM model_type WHERE\n" +
" glid = ? \n" +
" UNION ALL\n" +
" SELECT model_type.* FROM cao JOIN model_type ON cao.glid = model_type.pGlid\n" +
")\n" +
"SELECT * FROM cao WHERE pGlid IS NOT NULL";
}
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<ModelTypeVo> list = new ArrayList<>();
while (rs.next()) {
ModelTypeVo vo = new ModelTypeVo();
vo.setExternalId(rs.getString("externalId"));
vo.setGlid(rs.getString("glid"));
vo.setName(rs.getString("name"));
vo.setLevel(rs.getInt("level"));
vo.setGroupname(rs.getString("groupname"));
vo.setPGlid(rs.getString("pGlid"));
vo.setId(rs.getLong("id"));
list.add(vo);
}
return AjaxResult.success(list);
} catch (Exception e) {
return AjaxResult.error(e.getMessage());
}
}
/**
* model_type
* @param name
* @param pid
* @return
*/
@GetMapping("/modelType/{name}")
public AjaxResult getModelType(@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_type where level=0";
}else{
sql="select * from model_type where pglid=?";
}
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<ModelTypeVo> list = new ArrayList<>();
while (rs.next()) {
ModelTypeVo vo = new ModelTypeVo();
vo.setExternalId(rs.getString("externalId"));
vo.setGlid(rs.getString("glid"));
vo.setName(rs.getString("name"));
vo.setLevel(rs.getInt("level"));
vo.setGroupname(rs.getString("groupname"));
vo.setPGlid(rs.getString("pGlid"));
vo.setId(rs.getLong("id"));
list.add(vo);
}
return AjaxResult.success(list);
} catch (Exception e) {
return AjaxResult.error(e.getMessage());
}
}
@PostMapping("/modelProperty/{name}")
public AjaxResult getModelProperty(@PathVariable("name") String name,@RequestBody List<Long> glids) {
if(CollectionUtil.isEmpty(glids)){
return AjaxResult.error("glids is null");
}
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < glids.size(); i++) {
stringBuilder.append("?,");
}
String placeHolders = stringBuilder.deleteCharAt(stringBuilder.length() - 1)
.toString();
String sql="select * from model_property where glid in ("+placeHolders+")";
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);
for (int i = 1; i <= glids.size(); i++) {
pss.setLong(i, glids.get(i - 1));
}
ResultSet rs = pss.executeQuery();
List<ModelPropertyVo> list = new ArrayList<>();
while (rs.next()) {
ModelPropertyVo vo = new ModelPropertyVo();
vo.setId(rs.getLong("id"));
vo.setGlid(rs.getString("glid"));
vo.setModelName(rs.getString("modelName"));
vo.setIfcurl(rs.getString("ifcurl"));
vo.setPropertyname(rs.getString("propertyname"));
vo.setGroupname(rs.getString("groupname"));
vo.setExternalId(rs.getString("externalId"));
vo.setValue(rs.getString("value"));
vo.setPropertySetName(rs.getString("propertySetName"));
vo.setPropertyTypeName(rs.getString("propertyTypeName"));
list.add(vo);
}
return AjaxResult.success(list);
} catch (Exception e) {
return AjaxResult.error(e.getMessage());
}
}
}

View File

@ -5,7 +5,6 @@ import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.yanzhu.common.core.constant.ApiConstants; import com.yanzhu.common.core.constant.ApiConstants;
import com.yanzhu.common.core.enums.IsDelEnums; import com.yanzhu.common.core.enums.IsDelEnums;
import com.yanzhu.common.core.text.Convert;
import com.yanzhu.common.core.utils.StringUtils; import com.yanzhu.common.core.utils.StringUtils;
import com.yanzhu.common.core.utils.http.HttpUtils; import com.yanzhu.common.core.utils.http.HttpUtils;
import com.yanzhu.common.core.utils.poi.ExcelUtil; import com.yanzhu.common.core.utils.poi.ExcelUtil;

View File

@ -0,0 +1,53 @@
package com.yanzhu.manage.domain.bim;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
/**
*
*/
@Data
@Getter
@Setter
public class ModelPropertyVo {
/**
* ID
*/
private Long id;
/**
* ID
*/
private String glid;
/**
* IDexternalI
*/
private String externalId;
/**
*
*/
private String propertyTypeName;
/**
*
*/
private String propertySetName;
/**
*
*/
private String propertyname;
/**
* ifc
*/
private String ifcurl;
/**
*
*/
private String value;
/**
*
*/
private String modelName;
/**
*
*/
private String groupname;
}

View File

@ -0,0 +1,42 @@
package com.yanzhu.manage.domain.bim;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
/**
*
*/
@Data
@Getter
@Setter
public class ModelTreeVo {
/**
* ID
*/
private Long id;
/**
* ID
*/
private String glid;
/**
* ID,glid
*/
private String pGlid;
/**
* ID
*/
private Integer level;
/**
*
*/
private String name;
/**
* ID
*/
private String externalId;
/**
*
*/
private String groupname;
}

View File

@ -0,0 +1,42 @@
package com.yanzhu.manage.domain.bim;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
/**
*
*/
@Data
@Getter
@Setter
public class ModelTypeVo {
/**
* ID
*/
private Long id;
/**
* ID
*/
private String glid;
/**
* Id,gli
*/
private String pGlid;
/**
* ID
*/
private Integer level;
/**
*
*/
private String name;
/**
* ID
*/
private String externalId;
/**
*
*/
private String groupname;
}

View File

@ -29,3 +29,6 @@ spring:
logging: logging:
level: level:
com.ycx.manage.mapper: DEBUG com.ycx.manage.mapper: DEBUG
bim:
dataPath: '/Users/mac/code/bimdata/'

View File

@ -15,7 +15,7 @@
src="https://api.map.baidu.com/api?v=1.0&&type=webgl&ak=6zAD8CIavtzWnkGg0a7roush5maGMIPn" src="https://api.map.baidu.com/api?v=1.0&&type=webgl&ak=6zAD8CIavtzWnkGg0a7roush5maGMIPn"
></script> ></script>
<script src="./static/BIMGISEngine.js"></script> <script src="./static/BIMGISEngine.js"></script>
<script src="./gis/config.js"></script> <script src="./config.js"></script>
<!--[if lt IE 11 <!--[if lt IE 11
]><script> ]><script>
window.location.href = "/html/ie.html"; window.location.href = "/html/ie.html";

View File

@ -0,0 +1,123 @@
window.config = {
baseUrl: "https://szgc.jhncidg.com/modelapi",
baseUrl2: "https://szgc.jhncidg.com/modelapi",
modelUrl: "https://model.jhncidg.com:18086",
modelFile: "https://model.jhncidg.com:18086",
secretKey:
"cbe8c300dfb0280d71bf6546087c6d2fa49260085f53fca86c69755ac3a39199e08cb605efce617acfa509d5f3ee4d7f67a84d7c36cc175589405fde5d995a24258c47f45b34485a2edb350010e2f42cd5b388af45c6b070850288d284cbbbcd51e36f41b756a25f38d27dbe2e47e96b9eb56a96b59d61e02a467e881f70b21989b1a50685b6fc0265f528fc20b876d425a89c4bf6b33f829177fda27027e65b8a94867b381ae88ecd6668e8ca6b6d286dce7e5d799b0a1791905fc1eba1be4bd6b2a0d0983e9fd1184d8dbba49a8569257e195e636a849299be5a52d738b8218ae3e55ca95ec2999742c749dda98108ecfe0622c0e7fe1d76ad60b6c191c99adca5f9cf5e5f096c599f1874ee756fe16dce7e5d799b0a175d5afe5554a4332203e774bed8a045353e9bf5abfe83ffe0cca50ef6c618828a9d63dac2d06e44c19cc1e4d0220e60c6fb1ba2643538d1973ae24d1650ef196ed32b1cdbecb9bf3ae2651ff226b8a2383977aeaabb9225d76f8b62bd8891c29bfb1ba2643538d1973ae24d1650ef196ed32b1cdbecb9bf3aded264d2944b7de536ca05b5a67eccf9e531630520dbe4663b2d265fe6a4c8877fcba7ce8189fbc216cdeb3ecbc1d365395fd220141d4e6d9fd317e3dac7bb223013404ec41c18c9cc748e652ce16fe7061c32d550edfda330c1555e0c08e51f698f96b91615d8229cf32d2e110ec91f1211e23c769b5bbe1aa9a9191a2d3da09800e6efdee12ee04fdc9df330134f94052efc320a8c1a143e939c0e3b1ad476cf3630a2823a9a2dc2a17ec077fd21bfa7550ed054853e32510f8a6ea5c1dff9c3d61f7cf5f649cb25f0dbad9f7f66e3b446946685cead0cfac91bea061f4ff49a2f853c245297edc3d61f7cf5f649cb0f9b84173857a7b67c27928b58b4a6a65f517a43f106335ecc43571d292f54baa4596f82cf86665b367e01045009c18a2b543696b93a5bd44ca8168b525235150ffadf3f628aa7e8a20b9e74d76bd3a1e26b026e5297005a780f011db11ddb55fbabdc0f876c1cdfa5ef7db74bbc52e19c6396ffcf10044da26ecd334722494fc515b205e9624a4468762f63f0143583d1eeaaa85ff95ee50d8f953f44140ab40f29957f914b2241fd1309b7be0d5f9e55207069d393244a5be14de83e99956e957e025b859c7dd3cebcdd4589bf15942a17f162a5b95af68b416632dbf24db069995334a82a49d6060f7a5b770b6e18ecf8cb01c0e21b608156b326e2f4461369f266ad62ac2edf64d1767ac6ea3d83c9ba33a4517541406791c384c597539cc1ffcdbe8f3563a125da5d3905c7f92abef0fe8b967e5bc2832940bf4230fe93bdd44267922427c4db140fd5cb164da87f17f480c39e9c1c17bd48d031e3ce8ab3a49456b48f3b49549c2da3f62d2a8da7d5f36e39ce04af5e3f8253971ef20b10b7b200fbc7c3d3f71e19f74e660313cf3630a2823a9a2d0acd9cb22f32e975d8b70082aab5ddbcb644d89a77efad286dee59796b124081510f8a6ea5c1dff9cb0f31d9a93422d1de95a0001376b8d685af667dd7ebaf4bdfc4840ac1126277417910a2ed0df6e3ca2026459a491059689206d702832f51afafd0506174e868c12cc462769b2e685be04514c976edd04ca2ef020dc56bee8321afe91a1dcbb1afafd0506174e8680f18f43fcd13957eef440c21db889c81888bce192514399191b48af868eda487753151533a27704469e5635404d6fdfb753151533a277044afdd825f7197f289753151533a27704484b9cf9eccaf749638930dbe9049f2ae36689b286e75a81e016aa63061505f57a8c1113b833628e3a18dff8ae8ac8eaae0e7c3406ae4dd4e10880b34c16e1b7405884ca1d5603015a7b0730878fafb08",
serverIP: "model.jhncidg.com",
port: "8000",
modelInput: {
ConfigJson: {
style: 1,
zGrid: 1,
viewStyle: 1,
drawing: 0,
accuracy: 3,
parametric: 0,
familyName: "",
writetype: 0,
locationType: 0,
vertexNormal: 1,
isExportLines: 0,
customizedModule: 0,
unitRatio: 0.001,
type: 2,
offsetX: 0,
offsetY: 0,
offsetZ: 0,
isInstance: 1,
maxCountInstance: 100,
isLod: 0,
isCad: 0,
srs: "",
srsOrigin: [],
longitude: 1.9003144895714261,
latitude: 0.5969026041820608,
transHeight: 0,
edgeOn: 0,
level: 1,
xCount: 1,
yCount: 1,
draco: 1,
compressionLevel: 10,
quantizePositionBits: 16,
quantizeNormalBits: 10,
quantizeTexcoordBits: 12,
flipY: 0,
linePercent: 1,
minDistance: 0,
compatible: 0,
faceNumLimit: 300000,
textureLimit: 10240,
textureSizePercent: 50,
textureQuality: 30,
combineTexture: 0,
engineType: 2,
blockRender: 1,
},
},
gisInput: {
Name: "",
LightweightName: "",
InitiatingUser: "",
UniqueCode: "",
Priority: "202",
ModelUploadUrl: "",
OtherInfo: "",
},
videoAddress: "http://c.glendale.top/static/video.mp4",
showLogo: true,
pakList: [
{
id: "3a0b3b5b-2e87-484b-5e58-af7d18c42c0e",
pakPath: "../../../../GL_UEngine_zz-Windows.pak",
packageName: "GL_UEngine_zz",
mapName: "XiangXueZhan-Build-3_jia_zhuang",
},
],
specialType: [],
publicProject: "3a0b3b3f-e463-b8f2-2e34-dc5bd493e216",
deploymentMethod: "private",
projectName: "服务器端渲染3D/BIM/GIS轻量化引擎",
defaultUser: {
username: "guest",
password: "123456",
},
whetherVerify: false,
UpdateLog: [
{
updateTime: "2024-02-22",
remarks: [
"合模预览场景增加碰撞检测功能",
"Tif模型加载问题优化",
"模型上传类型扩展",
"其余已知问题修复。",
],
},
{
updateTime: "2024-01-31",
remarks: [
"模型上传配置调整",
"图纸预览增加",
"测量模块新增面与面测量",
"模型操作模块新增净高分析",
"漫游模块增加漫游类型选择,可切换第一、三人称漫游及飞行漫游",
"区域绘制模块新增绘制面",
"合模接口适配",
"其余已知问题修复。",
],
},
{
updateTime: "2024-01-17",
remarks: [
"模型上传格式补充 3dmax、glb、gltf等。",
"测量结果标识更新,距离测量支持连续测量。",
"视点管理块新增模型视图功能。",
"效果展示模块新增管道流水、液位、火焰效果功能。",
"新增展示风格模块,包括科幻流光、模型边界渲染。",
"其余已知问题修复。",
],
},
],
};

View File

@ -104,4 +104,7 @@ a {
.ant-modal-mask { .ant-modal-mask {
opacity: 0.9 !important; opacity: 0.9 !important;
} }
.blue {
color: rgb(30, 144, 255);
}
</style> </style>

View File

@ -50,3 +50,10 @@ export function checkLightweightName(data) {
data: data, data: data,
}); });
} }
export function getModelTree(name, pid) {
return request({
url: "/manage//bim/modelInfo/modelTree/" + name + "?pid=" + pid,
method: "get",
});
}

View File

@ -258,7 +258,7 @@ export function uploadModelFile(params) {
formData.append("file", params.file, params.input.Name); formData.append("file", params.file, params.input.Name);
formData.append("chunk", params.chunk); formData.append("chunk", params.chunk);
formData.append("chunks", params.chunks); formData.append("chunks", params.chunks);
let input = cloneDeep(store.state.modelInput); let input = cloneDeep(window.config.modelInput);
params.ConfigJson params.ConfigJson
? (input.ConfigJson = { ...input.ConfigJson, ...params.ConfigJson }) ? (input.ConfigJson = { ...input.ConfigJson, ...params.ConfigJson })
: ""; : "";
@ -280,7 +280,7 @@ export function uploadGLBFile(params) {
formData.append("file", params.file, params.input.Name); formData.append("file", params.file, params.input.Name);
formData.append("chunk", params.chunk); formData.append("chunk", params.chunk);
formData.append("chunks", params.chunks); formData.append("chunks", params.chunks);
let input = cloneDeep(store.state.modelInput); let input = cloneDeep(window.config.modelInput);
params.ConfigJson params.ConfigJson
? (input.ConfigJson = { ...input.ConfigJson, ...params.ConfigJson }) ? (input.ConfigJson = { ...input.ConfigJson, ...params.ConfigJson })
: ""; : "";
@ -307,7 +307,7 @@ export function uploadPakFile(params) {
params.input.LightweightName ? params.input.LightweightName : "" params.input.LightweightName ? params.input.LightweightName : ""
); );
formData.append("CallBackUrl", params.CallBackUrl); formData.append("CallBackUrl", params.CallBackUrl);
// let input = cloneDeep(store.state.modelInput) // let input = cloneDeep(window.config.modelInput)
// params.ConfigJson ? input.ConfigJson = { ...input.ConfigJson, ...params.ConfigJson } : '' // params.ConfigJson ? input.ConfigJson = { ...input.ConfigJson, ...params.ConfigJson } : ''
// input = { ...input, ...params.input } // input = { ...input, ...params.input }
// formData.append('input', JSON.stringify(input)) // formData.append('input', JSON.stringify(input))
@ -346,7 +346,7 @@ export function uploadOsgbFile(params) {
formData.append("file", params.file, params.input.Name); //此处name值一直保持一致因此不能用params.fileName formData.append("file", params.file, params.input.Name); //此处name值一直保持一致因此不能用params.fileName
formData.append("chunk", params.chunk); formData.append("chunk", params.chunk);
formData.append("chunks", params.chunks); formData.append("chunks", params.chunks);
let input = store.state.gisInput; let input = window.config.gisInput;
input = { ...input, ...params.input }; input = { ...input, ...params.input };
formData.append("input", JSON.stringify(input)); formData.append("input", JSON.stringify(input));
return requestModel({ return requestModel({
@ -394,7 +394,7 @@ export function uploadOsgbSplitFile(
Priority: "203", Priority: "203",
}; };
let input = store.state.gisInput; let input = window.config.gisInput;
input = { ...input, ...params }; input = { ...input, ...params };
formData.append("input", JSON.stringify(input)); formData.append("input", JSON.stringify(input));
@ -433,7 +433,7 @@ export function uploadShpFile(params) {
formData.append("file", params.file, params.input.Name); formData.append("file", params.file, params.input.Name);
formData.append("chunk", params.chunk); formData.append("chunk", params.chunk);
formData.append("chunks", params.chunks); formData.append("chunks", params.chunks);
let input = store.state.gisInput; let input = window.config.gisInput;
input = { ...input, ...params.input }; input = { ...input, ...params.input };
formData.append("input", JSON.stringify(input)); formData.append("input", JSON.stringify(input));
return requestModel({ return requestModel({
@ -451,7 +451,7 @@ export function uploadPointCloudFile(params) {
formData.append("file", params.file, params.input.Name); formData.append("file", params.file, params.input.Name);
formData.append("chunk", params.chunk); formData.append("chunk", params.chunk);
formData.append("chunks", params.chunks); formData.append("chunks", params.chunks);
let input = store.state.gisInput; let input = window.config.gisInput;
input = { ...input, ...params.input }; input = { ...input, ...params.input };
formData.append("input", JSON.stringify(input)); formData.append("input", JSON.stringify(input));
return requestModel({ return requestModel({
@ -534,7 +534,7 @@ export function uploadCoordinate(params) {
method: "post", method: "post",
headers: { headers: {
"Content-Type": "application/json;charset=utf8", "Content-Type": "application/json;charset=utf8",
Token: store.state.bim.defaults.secretkey, Token: window.config.bim.defaults.secretkey,
}, },
}); });
} }
@ -615,7 +615,7 @@ export function startInitiateCollision(params) {
method: "post", method: "post",
headers: { headers: {
"Content-Type": "application/json;charset=utf8", "Content-Type": "application/json;charset=utf8",
Token: store.state.bim.defaults.secretkey, Token: window.config.bim.defaults.secretkey,
}, },
data: formData, data: formData,
}); });
@ -630,7 +630,7 @@ export function getCollisionInfo(CollisionId) {
method: "get", method: "get",
headers: { headers: {
"Content-Type": "application/json;charset=utf8", "Content-Type": "application/json;charset=utf8",
Token: store.state.bim.defaults.secretkey, Token: window.config.bim.defaults.secretkey,
}, },
}); });
} }
@ -643,7 +643,7 @@ export function downloadCollisionInfo(CollisionId) {
method: "get", method: "get",
headers: { headers: {
"Content-Type": "application/json;charset=utf8", "Content-Type": "application/json;charset=utf8",
Token: store.state.bim.defaults.secretkey, Token: window.config.bim.defaults.secretkey,
}, },
}); });
} }
@ -709,7 +709,7 @@ export function positionChange(params) {
method: "post", method: "post",
headers: { headers: {
"Content-Type": "application/json;charset=utf8", "Content-Type": "application/json;charset=utf8",
Token: store.state.bim.defaults.secretkey, Token: window.config.bim.defaults.secretkey,
}, },
data: params, data: params,
}); });
@ -724,7 +724,7 @@ export function uploadLodModelFile(params) {
formData.append("file", params.file, params.input.Name); formData.append("file", params.file, params.input.Name);
formData.append("chunk", params.chunk); formData.append("chunk", params.chunk);
formData.append("chunks", params.chunks); formData.append("chunks", params.chunks);
let input = cloneDeep(store.state.modelInput); let input = cloneDeep(window.config.modelInput);
params.ConfigJson params.ConfigJson
? (input.ConfigJson = { ...input.ConfigJson, ...params.ConfigJson }) ? (input.ConfigJson = { ...input.ConfigJson, ...params.ConfigJson })
: ""; : "";

View File

@ -33,10 +33,9 @@ const errorHandler = (error) => {
// request interceptor // request interceptor
request.interceptors.request.use((config) => { request.interceptors.request.use((config) => {
debugger;
let bimStore = useBimStore(); let bimStore = useBimStore();
config.baseURL = bimStore.state.modelFile; config.baseURL = window.config.modelFile;
const token = bimStore.state.bim.defaults.secretKey; const token = window.config.secretKey;
// 如果 token 存在 // 如果 token 存在
// 让每个请求携带自定义 token 请根据实际情况自行修改 // 让每个请求携带自定义 token 请根据实际情况自行修改
if (token) { if (token) {

View File

@ -1,18 +1,25 @@
import { parseTime } from './ruoyi' import { parseTime } from "./ruoyi";
/** /**
* 表格时间格式化 * 表格时间格式化
*/ */
export function formatDate(cellValue) { export function formatDate(cellValue) {
if (cellValue == null || cellValue == "") return ""; if (cellValue == null || cellValue == "") return "";
var date = new Date(cellValue) var date = new Date(cellValue);
var year = date.getFullYear() var year = date.getFullYear();
var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1 var month =
var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate() date.getMonth() + 1 < 10
var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours() ? "0" + (date.getMonth() + 1)
var minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes() : date.getMonth() + 1;
var seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds() var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
var minutes =
date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
var seconds =
date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
return (
year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds
);
} }
/** /**
@ -21,40 +28,40 @@ export function formatDate(cellValue) {
* @returns {string} * @returns {string}
*/ */
export function formatTime(time, option) { export function formatTime(time, option) {
if (('' + time).length === 10) { if (("" + time).length === 10) {
time = parseInt(time) * 1000 time = parseInt(time) * 1000;
} else { } else {
time = +time time = +time;
} }
const d = new Date(time) const d = new Date(time);
const now = Date.now() const now = Date.now();
const diff = (now - d) / 1000 const diff = (now - d) / 1000;
if (diff < 30) { if (diff < 30) {
return '刚刚' return "刚刚";
} else if (diff < 3600) { } else if (diff < 3600) {
// less 1 hour // less 1 hour
return Math.ceil(diff / 60) + '分钟前' return Math.ceil(diff / 60) + "分钟前";
} else if (diff < 3600 * 24) { } else if (diff < 3600 * 24) {
return Math.ceil(diff / 3600) + '小时前' return Math.ceil(diff / 3600) + "小时前";
} else if (diff < 3600 * 24 * 2) { } else if (diff < 3600 * 24 * 2) {
return '1天前' return "1天前";
} }
if (option) { if (option) {
return parseTime(time, option) return parseTime(time, option);
} else { } else {
return ( return (
d.getMonth() + d.getMonth() +
1 + 1 +
'月' + "月" +
d.getDate() + d.getDate() +
'日' + "日" +
d.getHours() + d.getHours() +
'时' + "时" +
d.getMinutes() + d.getMinutes() +
'分' "分"
) );
} }
} }
@ -63,18 +70,18 @@ export function formatTime(time, option) {
* @returns {Object} * @returns {Object}
*/ */
export function getQueryObject(url) { export function getQueryObject(url) {
url = url == null ? window.location.href : url url = url == null ? window.location.href : url;
const search = url.substring(url.lastIndexOf('?') + 1) const search = url.substring(url.lastIndexOf("?") + 1);
const obj = {} const obj = {};
const reg = /([^?&=]+)=([^?&=]*)/g const reg = /([^?&=]+)=([^?&=]*)/g;
search.replace(reg, (rs, $1, $2) => { search.replace(reg, (rs, $1, $2) => {
const name = decodeURIComponent($1) const name = decodeURIComponent($1);
let val = decodeURIComponent($2) let val = decodeURIComponent($2);
val = String(val) val = String(val);
obj[name] = val obj[name] = val;
return rs return rs;
}) });
return obj return obj;
} }
/** /**
@ -83,14 +90,14 @@ export function getQueryObject(url) {
*/ */
export function byteLength(str) { export function byteLength(str) {
// returns the byte length of an utf8 string // returns the byte length of an utf8 string
let s = str.length let s = str.length;
for (var i = str.length - 1; i >= 0; i--) { for (var i = str.length - 1; i >= 0; i--) {
const code = str.charCodeAt(i) const code = str.charCodeAt(i);
if (code > 0x7f && code <= 0x7ff) s++ if (code > 0x7f && code <= 0x7ff) s++;
else if (code > 0x7ff && code <= 0xffff) s += 2 else if (code > 0x7ff && code <= 0xffff) s += 2;
if (code >= 0xDC00 && code <= 0xDFFF) i-- if (code >= 0xdc00 && code <= 0xdfff) i--;
} }
return s return s;
} }
/** /**
@ -98,13 +105,13 @@ export function byteLength(str) {
* @returns {Array} * @returns {Array}
*/ */
export function cleanArray(actual) { export function cleanArray(actual) {
const newArray = [] const newArray = [];
for (let i = 0; i < actual.length; i++) { for (let i = 0; i < actual.length; i++) {
if (actual[i]) { if (actual[i]) {
newArray.push(actual[i]) newArray.push(actual[i]);
} }
} }
return newArray return newArray;
} }
/** /**
@ -112,13 +119,13 @@ export function cleanArray(actual) {
* @returns {Array} * @returns {Array}
*/ */
export function param(json) { export function param(json) {
if (!json) return '' if (!json) return "";
return cleanArray( return cleanArray(
Object.keys(json).map(key => { Object.keys(json).map((key) => {
if (json[key] === undefined) return '' if (json[key] === undefined) return "";
return encodeURIComponent(key) + '=' + encodeURIComponent(json[key]) return encodeURIComponent(key) + "=" + encodeURIComponent(json[key]);
}) })
).join('&') ).join("&");
} }
/** /**
@ -126,21 +133,21 @@ export function param(json) {
* @returns {Object} * @returns {Object}
*/ */
export function param2Obj(url) { export function param2Obj(url) {
const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ') const search = decodeURIComponent(url.split("?")[1]).replace(/\+/g, " ");
if (!search) { if (!search) {
return {} return {};
} }
const obj = {} const obj = {};
const searchArr = search.split('&') const searchArr = search.split("&");
searchArr.forEach(v => { searchArr.forEach((v) => {
const index = v.indexOf('=') const index = v.indexOf("=");
if (index !== -1) { if (index !== -1) {
const name = v.substring(0, index) const name = v.substring(0, index);
const val = v.substring(index + 1, v.length) const val = v.substring(index + 1, v.length);
obj[name] = val obj[name] = val;
} }
}) });
return obj return obj;
} }
/** /**
@ -148,9 +155,9 @@ export function param2Obj(url) {
* @returns {string} * @returns {string}
*/ */
export function html2Text(val) { export function html2Text(val) {
const div = document.createElement('div') const div = document.createElement("div");
div.innerHTML = val div.innerHTML = val;
return div.textContent || div.innerText return div.textContent || div.innerText;
} }
/** /**
@ -160,21 +167,21 @@ export function html2Text(val) {
* @returns {Object} * @returns {Object}
*/ */
export function objectMerge(target, source) { export function objectMerge(target, source) {
if (typeof target !== 'object') { if (typeof target !== "object") {
target = {} target = {};
} }
if (Array.isArray(source)) { if (Array.isArray(source)) {
return source.slice() return source.slice();
} }
Object.keys(source).forEach(property => { Object.keys(source).forEach((property) => {
const sourceProperty = source[property] const sourceProperty = source[property];
if (typeof sourceProperty === 'object') { if (typeof sourceProperty === "object") {
target[property] = objectMerge(target[property], sourceProperty) target[property] = objectMerge(target[property], sourceProperty);
} else { } else {
target[property] = sourceProperty target[property] = sourceProperty;
} }
}) });
return target return target;
} }
/** /**
@ -183,18 +190,18 @@ export function objectMerge(target, source) {
*/ */
export function toggleClass(element, className) { export function toggleClass(element, className) {
if (!element || !className) { if (!element || !className) {
return return;
} }
let classString = element.className let classString = element.className;
const nameIndex = classString.indexOf(className) const nameIndex = classString.indexOf(className);
if (nameIndex === -1) { if (nameIndex === -1) {
classString += '' + className classString += "" + className;
} else { } else {
classString = classString =
classString.substr(0, nameIndex) + classString.substr(0, nameIndex) +
classString.substr(nameIndex + className.length) classString.substr(nameIndex + className.length);
} }
element.className = classString element.className = classString;
} }
/** /**
@ -202,10 +209,10 @@ export function toggleClass(element, className) {
* @returns {Date} * @returns {Date}
*/ */
export function getTime(type) { export function getTime(type) {
if (type === 'start') { if (type === "start") {
return new Date().getTime() - 3600 * 1000 * 24 * 90 return new Date().getTime() - 3600 * 1000 * 24 * 90;
} else { } else {
return new Date(new Date().toDateString()) return new Date(new Date().toDateString());
} }
} }
@ -216,38 +223,38 @@ export function getTime(type) {
* @return {*} * @return {*}
*/ */
export function debounce(func, wait, immediate) { export function debounce(func, wait, immediate) {
let timeout, args, context, timestamp, result let timeout, args, context, timestamp, result;
const later = function() { const later = function () {
// 据上一次触发时间间隔 // 据上一次触发时间间隔
const last = +new Date() - timestamp const last = +new Date() - timestamp;
// 上次被包装函数被调用时间间隔 last 小于设定时间间隔 wait // 上次被包装函数被调用时间间隔 last 小于设定时间间隔 wait
if (last < wait && last > 0) { if (last < wait && last > 0) {
timeout = setTimeout(later, wait - last) timeout = setTimeout(later, wait - last);
} else { } else {
timeout = null timeout = null;
// 如果设定为immediate===true因为开始边界已经调用过了此处无需调用 // 如果设定为immediate===true因为开始边界已经调用过了此处无需调用
if (!immediate) { if (!immediate) {
result = func.apply(context, args) result = func.apply(context, args);
if (!timeout) context = args = null if (!timeout) context = args = null;
} }
} }
} };
return function(...args) { return function (...args) {
context = this context = this;
timestamp = +new Date() timestamp = +new Date();
const callNow = immediate && !timeout const callNow = immediate && !timeout;
// 如果延时不存在,重新设定延时 // 如果延时不存在,重新设定延时
if (!timeout) timeout = setTimeout(later, wait) if (!timeout) timeout = setTimeout(later, wait);
if (callNow) { if (callNow) {
result = func.apply(context, args) result = func.apply(context, args);
context = args = null context = args = null;
} }
return result return result;
} };
} }
/** /**
@ -258,18 +265,18 @@ export function debounce(func, wait, immediate) {
* @returns {Object} * @returns {Object}
*/ */
export function deepClone(source) { export function deepClone(source) {
if (!source && typeof source !== 'object') { if (!source && typeof source !== "object") {
throw new Error('error arguments', 'deepClone') throw new Error("error arguments", "deepClone");
} }
const targetObj = source.constructor === Array ? [] : {} const targetObj = source.constructor === Array ? [] : {};
Object.keys(source).forEach(keys => { Object.keys(source).forEach((keys) => {
if (source[keys] && typeof source[keys] === 'object') { if (source[keys] && typeof source[keys] === "object") {
targetObj[keys] = deepClone(source[keys]) targetObj[keys] = deepClone(source[keys]);
} else { } else {
targetObj[keys] = source[keys] targetObj[keys] = source[keys];
} }
}) });
return targetObj return targetObj;
} }
/** /**
@ -277,16 +284,16 @@ export function deepClone(source) {
* @returns {Array} * @returns {Array}
*/ */
export function uniqueArr(arr) { export function uniqueArr(arr) {
return Array.from(new Set(arr)) return Array.from(new Set(arr));
} }
/** /**
* @returns {string} * @returns {string}
*/ */
export function createUniqueString() { export function createUniqueString() {
const timestamp = +new Date() + '' const timestamp = +new Date() + "";
const randomNum = parseInt((1 + Math.random()) * 65536) + '' const randomNum = parseInt((1 + Math.random()) * 65536) + "";
return (+(randomNum + timestamp)).toString(32) return (+(randomNum + timestamp)).toString(32);
} }
/** /**
@ -296,7 +303,7 @@ export function createUniqueString() {
* @returns {boolean} * @returns {boolean}
*/ */
export function hasClass(ele, cls) { export function hasClass(ele, cls) {
return !!ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)')) return !!ele.className.match(new RegExp("(\\s|^)" + cls + "(\\s|$)"));
} }
/** /**
@ -305,7 +312,7 @@ export function hasClass(ele, cls) {
* @param {string} cls * @param {string} cls
*/ */
export function addClass(ele, cls) { export function addClass(ele, cls) {
if (!hasClass(ele, cls)) ele.className += ' ' + cls if (!hasClass(ele, cls)) ele.className += " " + cls;
} }
/** /**
@ -315,76 +322,86 @@ export function addClass(ele, cls) {
*/ */
export function removeClass(ele, cls) { export function removeClass(ele, cls) {
if (hasClass(ele, cls)) { if (hasClass(ele, cls)) {
const reg = new RegExp('(\\s|^)' + cls + '(\\s|$)') const reg = new RegExp("(\\s|^)" + cls + "(\\s|$)");
ele.className = ele.className.replace(reg, ' ') ele.className = ele.className.replace(reg, " ");
} }
} }
export function makeMap(str, expectsLowerCase) { export function makeMap(str, expectsLowerCase) {
const map = Object.create(null) const map = Object.create(null);
const list = str.split(',') const list = str.split(",");
for (let i = 0; i < list.length; i++) { for (let i = 0; i < list.length; i++) {
map[list[i]] = true map[list[i]] = true;
} }
return expectsLowerCase return expectsLowerCase ? (val) => map[val.toLowerCase()] : (val) => map[val];
? val => map[val.toLowerCase()]
: val => map[val]
} }
export const exportDefault = 'export default ' export const exportDefault = "export default ";
export const beautifierConf = { export const beautifierConf = {
html: { html: {
indent_size: '2', indent_size: "2",
indent_char: ' ', indent_char: " ",
max_preserve_newlines: '-1', max_preserve_newlines: "-1",
preserve_newlines: false, preserve_newlines: false,
keep_array_indentation: false, keep_array_indentation: false,
break_chained_methods: false, break_chained_methods: false,
indent_scripts: 'separate', indent_scripts: "separate",
brace_style: 'end-expand', brace_style: "end-expand",
space_before_conditional: true, space_before_conditional: true,
unescape_strings: false, unescape_strings: false,
jslint_happy: false, jslint_happy: false,
end_with_newline: true, end_with_newline: true,
wrap_line_length: '110', wrap_line_length: "110",
indent_inner_html: true, indent_inner_html: true,
comma_first: false, comma_first: false,
e4x: true, e4x: true,
indent_empty_lines: true indent_empty_lines: true,
}, },
js: { js: {
indent_size: '2', indent_size: "2",
indent_char: ' ', indent_char: " ",
max_preserve_newlines: '-1', max_preserve_newlines: "-1",
preserve_newlines: false, preserve_newlines: false,
keep_array_indentation: false, keep_array_indentation: false,
break_chained_methods: false, break_chained_methods: false,
indent_scripts: 'normal', indent_scripts: "normal",
brace_style: 'end-expand', brace_style: "end-expand",
space_before_conditional: true, space_before_conditional: true,
unescape_strings: false, unescape_strings: false,
jslint_happy: true, jslint_happy: true,
end_with_newline: true, end_with_newline: true,
wrap_line_length: '110', wrap_line_length: "110",
indent_inner_html: true, indent_inner_html: true,
comma_first: false, comma_first: false,
e4x: true, e4x: true,
indent_empty_lines: true indent_empty_lines: true,
} },
} };
// 首字母大小 // 首字母大小
export function titleCase(str) { export function titleCase(str) {
return str.replace(/( |^)[a-z]/g, L => L.toUpperCase()) return str.replace(/( |^)[a-z]/g, (L) => L.toUpperCase());
} }
// 下划转驼峰 // 下划转驼峰
export function camelCase(str) { export function camelCase(str) {
return str.replace(/_[a-z]/g, str1 => str1.substr(-1).toUpperCase()) return str.replace(/_[a-z]/g, (str1) => str1.substr(-1).toUpperCase());
} }
export function isNumberStr(str) { export function isNumberStr(str) {
return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str) return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str);
} }
export function fileSize(filesize) {
if (filesize == null || filesize === "") {
return "0 Bytes";
}
var unitArr = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
var index = 0;
var srcsize = parseFloat(filesize);
index = Math.floor(Math.log(srcsize) / Math.log(1024));
var size = srcsize / Math.pow(1024, index);
size = size.toFixed(2); // 保留两位小数
return size + " " + unitArr[index];
}

View File

@ -29,21 +29,25 @@
</el-row> </el-row>
<el-table v-loading="loading" :data="bimModelList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="bimModelList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column label="ID" align="center" prop="modelId" />
<el-table-column label="${comment}" align="center" prop="modelId" /> <el-table-column label="项目" align="center" prop="projectName" />
<el-table-column label="租户id" align="center" prop="comId" /> <el-table-column label="单位" align="center" prop="deptName" />
<el-table-column label="项目id" align="center" prop="projectId" /> <el-table-column label="模型名称" align="center" prop="modelName">
<el-table-column label="单位id" align="center" prop="deptId" /> <template #default="scope">
<el-table-column label="模型名称" align="center" prop="modelName" /> <label class="blue command" @click="showModel(scope.row)">{{scope.row.modelName}}</label>
<el-table-column label="轻量化名称" align="center" prop="lightweightNam lightweightName" /> </template>
<el-table-column label="api服务返回的json" align="center" prop="gisJson" /> </el-table-column>
<el-table-column label="轻量化状态" align="center" prop="modelStatus" /> <el-table-column label="轻量化名称" align="center" prop="lightweightName" />
<el-table-column label="模型类型" align="center" prop="modelType" /> <el-table-column label="模型类型" align="center" prop="modelType" />
<el-table-column label="模型文件类型" align="center" prop="fileType" /> <el-table-column label="模型文件类型" align="center" prop="fileType" />
<el-table-column label="文件大小" align="center" prop="fileSize" /> <el-table-column label="文件大小" align="center" prop="fileSize">
<el-table-column label="是否在沙盘显示0不显示1显示" align="center" prop="showSand" /> <template #default="scope">{{scope.row.fileSize?toSize(scope.row.fileSize):'-'}}</template>
<el-table-column label="${comment}" align="center" prop="status" /> </el-table-column>
<el-table-column label="${comment}" align="center" prop="remark" /> <el-table-column label="是否在沙盘显示" align="center" prop="showSand">
<template #default="scope">
<el-switch v-model="scope.row.sand" active-text="" inactive-text="" />
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope"> <template #default="scope">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['bim:bimModel:edit']"></el-button> <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['bim:bimModel:edit']"></el-button>
@ -56,30 +60,27 @@
<!-- 添加或修改Bim模型对话框 --> <!-- 添加或修改Bim模型对话框 -->
<el-dialog :title="title" v-model="open" width="600px" append-to-body> <el-dialog :title="title" v-model="open" width="600px" append-to-body>
<div style="line-height: 60px;"> <el-form ref="bimModelRef" :model="form" :rules="rules" label-width="120px">
<el-button type="primary" @click="selectModelHandler"></el-button>
</div>
<el-form ref="bimModelRef" :model="form" :rules="rules" label-width="100px">
<el-form-item label="所属单位" prop="deptId"> <el-form-item label="所属单位" prop="deptId">
<el-input v-model="form.deptId" placeholder="请输入单位id" /> <el-select v-model="form.deptId" clearable filterable placeholder="请选择所属单位" style="width: 200px">
<el-option v-for="item in data.subDepts" :key="item.id" :label="item.subDeptName" :value="item.id"></el-option>
</el-select>
<el-button type="primary" style="margin-left:20px;" @click="selectModelHandler"></el-button>
</el-form-item> </el-form-item>
<el-form-item label="模型名称" prop="modelName"> <el-form-item label="模型名称" prop="modelName">
<el-input v-model="form.modelName" placeholder="请输入模型名称" /> <el-input v-model="form.modelName" disabled placeholder="请输入模型名称" />
</el-form-item> </el-form-item>
<el-form-item label="轻量化名称" prop="lightweightNam lightweightName"> <el-form-item label="轻量化名称" prop="lightweightNam lightweightName">
<el-input v-model="form.lightweightName" placeholder="请输入轻量化名称" /> <el-input v-model="form.lightweightName" disabled placeholder="请输入轻量化名称" />
</el-form-item>
<el-form-item label="api服务返回的json" prop="gisJson">
<el-input v-model="form.gisJson" type="textarea" placeholder="请输入内容" />
</el-form-item> </el-form-item>
<el-form-item label="文件大小" prop="fileSize"> <el-form-item label="文件大小" prop="fileSize">
<el-input v-model="form.fileSize" placeholder="请输入文件大小" /> <el-input v-model="form.fileSize" disabled placeholder="请输入文件大小" />
</el-form-item> </el-form-item>
<el-form-item label="是否在沙盘显示0不显示1显示" prop="showSand"> <el-form-item label="在沙盘显示" prop="sand">
<el-input v-model="form.showSand" placeholder="请输入是否在沙盘显示0不显示1显示" /> <el-switch v-model="form.sand" size="large" active-text="" inactive-text="" />
</el-form-item> </el-form-item>
<el-form-item label="${comment}" prop="remark"> <el-form-item label="备注说明" prop="remark">
<el-input v-model="form.remark" placeholder="请输入${comment}" /> <el-input type="textarea" v-model="form.remark" placeholder="请输入备注" />
</el-form-item> </el-form-item>
</el-form> </el-form>
<template #footer> <template #footer>
@ -89,8 +90,9 @@
</div> </div>
</template> </template>
</el-dialog> </el-dialog>
<modelSelectDialog ref="selDlg" /> <modelSelectDialog ref="selDlg" @select="doModelSelect" />
<uploadModelDialog ref="uploadDlg" /> <uploadModelDialog ref="uploadDlg" />
<modelDialog ref="mDlg"></modelDialog>
</div> </div>
</template> </template>
@ -102,6 +104,8 @@ import useUserStore from '@/store/modules/user'
import { onMounted } from 'vue' import { onMounted } from 'vue'
import modelSelectDialog from './modelSelectDialog.vue' import modelSelectDialog from './modelSelectDialog.vue'
import uploadModelDialog from './uploadModelDialog.vue' import uploadModelDialog from './uploadModelDialog.vue'
import modelDialog from './modelDialog2.vue'
import { fileSize } from '@/utils'
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const userStore = useUserStore() const userStore = useUserStore()
@ -116,6 +120,7 @@ const total = ref(0)
const title = ref('') const title = ref('')
const selDlg = ref() const selDlg = ref()
const uploadDlg = ref() const uploadDlg = ref()
const mDlg = ref()
const data = reactive({ const data = reactive({
form: {}, form: {},
queryParams: { queryParams: {
@ -143,10 +148,27 @@ const data = reactive({
projects: [], projects: [],
currentPrjId: null, currentPrjId: null,
subDepts: [], subDepts: [],
selModel: null,
}) })
const { queryParams, form, rules } = toRefs(data) const { queryParams, form, rules } = toRefs(data)
function showModel(row) {
mDlg.value.showDialog(JSON.parse(row.gisJson))
}
function toSize(size) {
return fileSize(size)
}
function doModelSelect(model) {
data.selModel = model
form.value.modelName = model.name
form.value.lightweightName = model.lightweightName
form.value.fileSize = model.fileSize
form.value.gisJson = JSON.stringify(model)
form.value.fileType = model.fileType
form.value.modelType = model.softwareType
form.value.modelStatus = model.status
form.value.sand = true
}
// //
function handleUpload() { function handleUpload() {
//uploadDlg.value.showDialog() //uploadDlg.value.showDialog()
@ -159,7 +181,10 @@ function selectModelHandler() {
function getList() { function getList() {
loading.value = true loading.value = true
listBimModel(queryParams.value).then((response) => { listBimModel(queryParams.value).then((response) => {
bimModelList.value = response.rows bimModelList.value = (response.rows || []).map((it) => {
it.sand = it.showSand == 1
return it
})
total.value = response.total total.value = response.total
loading.value = false loading.value = false
}) })
@ -219,6 +244,13 @@ function handleSelectionChange(selection) {
function handleAdd() { function handleAdd() {
reset() reset()
open.value = true open.value = true
if (data.subDepts.length > 0) {
form.value.deptId = data.subDepts[0].id
} else {
form.value.deptId = null
}
form.value.comId = userStore.currentComId
form.value.projectId = data.currentPrjId
title.value = '添加Bim模型' title.value = '添加Bim模型'
} }
@ -237,6 +269,7 @@ function handleUpdate(row) {
function submitForm() { function submitForm() {
proxy.$refs['bimModelRef'].validate((valid) => { proxy.$refs['bimModelRef'].validate((valid) => {
if (valid) { if (valid) {
form.value.showSand = form.value.sand ? 1 : 0
if (form.value.modelId != null) { if (form.value.modelId != null) {
updateBimModel(form.value).then((response) => { updateBimModel(form.value).then((response) => {
proxy.$modal.msgSuccess('修改成功') proxy.$modal.msgSuccess('修改成功')
@ -310,5 +343,8 @@ onMounted(() => {
data.currentPrjId = userStore.currentPrjId data.currentPrjId = userStore.currentPrjId
getProjectList() getProjectList()
getList() getList()
proxy.$http.get('/manage/bim/modelInfo/modelTree/202310241442202232?pid=2714132083072').then((res) => {
debugger
})
}) })
</script> </script>

View File

@ -52,7 +52,7 @@ export default {
throughwall: true, throughwall: true,
searchbox: false, searchbox: false,
mapbox: true, mapbox: true,
secretkey: window.BIM_CONFIG.secretKey, //token.txt secretkey: window.config.secretKey, //token.txt
editmode: false, editmode: false,
cadmode: false, cadmode: false,
isRequestWebgl2: true, isRequestWebgl2: true,
@ -67,9 +67,10 @@ export default {
defaults.container = this.elId defaults.container = this.elId
defaults.bgcolor = '#c6c9d1' defaults.bgcolor = '#c6c9d1'
defaults.secretkey = window.BIM_CONFIG.secretKey defaults.secretkey = window.config.secretKey
this.sapi_1 = new API(defaults) this.sapi_1 = new API(defaults)
let modelUrl = 'https://model.jhncidg.com:18086/Tools/output/model/5513993365509191778/root.glt' let modelUrl = 'https://model.jhncidg.com:18086/Tools/output/model/5513993365509191778/root.glt'
//https://model.jhncidg.com:18086/Tools/output/model/5570926434042339486/root.glt
//this.sapi_1.Model.add(this.row.modelAccessAddress, this.row.lightweightName) //this.sapi_1.Model.add(this.row.modelAccessAddress, this.row.lightweightName)
this.sapi_1.Model.add(modelUrl, this.row.lightweightName) this.sapi_1.Model.add(modelUrl, this.row.lightweightName)
let mapOptions = { let mapOptions = {

View File

@ -1,7 +1,7 @@
<template> <template>
<div> <div>
<el-dialog v-model="show" append-to-body :close-on-click-modal="false" :close-on-press-escape="false" :title="title" width="960px" modal-class="model-dialog-show"> <el-dialog v-model="show" append-to-body :close-on-click-modal="false" :close-on-press-escape="false" :title="title" width="960px" modal-class="model-dialog-show">
<div :id="elId"></div> <div :id="elId" style="height: 80vh;"></div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
@ -34,15 +34,13 @@ export default {
}) })
}, },
initCesium() { initCesium() {
debugger
var api = new SAPI( var api = new SAPI(
{ {
serverIP: `//model.jhncidg.com`, //ip serverIP: `model.jhncidg.com`, //ip
port: 8000, //HTTP port: 8000, //HTTP
useHttps: true, //使Https useHttps: true, //使Https
container: this.elId, //[]id container: this.elId, //[]id
secretKey: secretKey: window.config.secretKey,
'cbe8c300dfb0280d71bf6546087c6d2fa49260085f53fca8e5bdce7cde8509800e60acd60891a0dfaedaed48706cede62c884a84004218a7c2eb3de18b4f3783258c47f45b34485a2edb350010e2f42cd5b388af45c6b070850288d284cbbbcda2d085ba47169a7d4fc79609ffbef2dc54455448c112333d4b48d4870843cd1a156822f418515a2ad17683749ba4ff5118ae3f686e966fbfdd71fd75e0bbc3738a94867b381ae88ecd6668e8ca6b6d286dce7e5d799b0a175d5afe5554a4332203e774bed8a04535067c9aac0a18108055b1db541f70363b277050951ab91fcbccd8329463d92cd2f81b95abdf8d437c4965454914fcc7b07d28062bc2976948356e76d9d11fd5b479eb391b46cc93e66da10e0ba1fed735c8b1b1f086973f6152b6a2299e3e22c9cc8c33b16ea71cc03013404ec41c18c9cc748e652ce16fe7061c32d550edfda330c1555e0c08e51f698f96b91615d8220acd9cb22f32e9757681487e0680adfbfacb9b5d2ce5a13b664d8466043270f9f3bde6ac6a05cf25ab0ccc0659a290c9669997be7ccc0086c3d61f7cf5f649cb25f0dbad9f7f66e3165cad25065145affac91bea061f4ff485af667dd7ebaf4baeea64611acbe5c74018be5a8b704fcd4f53d18504940411fac91bea061f4ff49a2f853c245297edc3d61f7cf5f649cb0f9b84173857a7b67c27928b58b4a6a65f517a43f106335e8b1d5c423a171723ffa04d0ac4e5c1a1853fcb2bc95ee8056cd5b4826fa55926733ef859a5f169e6afafd0506174e86864d53d967da98ab0b0e08d14be6d452c6c69755ac3a391993370a029761da893cfbf575da87c6b5ca602467b79c6c9532f438aaafb9ec915692f0287a8db979969e5635404d6fdfb753151533a277044afdd825f7197f2896c69755ac3a391993370a029761da893af24d88c02bccfae6cd5b4826fa55926f7722b78090b30b986f9287101582d8841187054ec673ebd2042f9836ea453c3afafd0506174e86800225b7f4102e3585b1923cb186fe0ceee54c6f17ab8555da26ecd334722494fc515b205e9624a4494c772ef4f023a606882e118fa6321c24ddee4821c840fb56aac929d6d0a052d5ff97d71e43811db939f7340826236af6f10316a04bf618d494a26e0fd06f7daa07177989e1680a4cf14829a5847f70377d6c12f1649400fcab44f4ff52989cf129aa6cca660be152a75b8e35648925dbce381b345d9e137c04a02a4c8252625f5625eed58fd34b7be4266e54212e88b23f012bead9abaef9e18aa308f0ecffaf3dda7d7b4efd2e0c4b8de161864620fc1f2af98bde031b29e0865381c96bbc10921b48a068558915ff023d18526f5d399e0893df43db7122415d52565dc982ea24fbd825734dbaefadc6df0f19d925c7f63d343a622134b1c934d130d662447add19064adbbb2fd24a82c0fbfcbc3175fc32761df099156daf4e86455740207eb4e4a5300d9c1a17ffd43703d476c36ef07df2206bd8d232b844ff3c1d7cf7c47ec502183af4e27b644d89a77efad286dee59796b124081510f8a6ea5c1dff9c3d61f7cf5f649cb25f0dbad9f7f66e3e0e7c3406ae4dd4eebc424f09f933d0eb1a881ed05ca8d5c70958237eb5b91d4e574440ea0c9179a582dc966bcfc1f21cf3630a2823a9a2d22bd09a00b213aae3866768ae2f24dde6784fbf292c2cba136689b286e75a81e016aa63061505f57a8c1113b833628e3a18dff8ae8ac8eaa7a4fba6045bc9b4b',
openEarth: false, //[]Gis openEarth: false, //[]Gis
bgColor: 'rgba(135 ,206 ,250,1)', //[]bim, bgColor: 'rgba(135 ,206 ,250,1)', //[]bim,
tintColor: 'rgba(255,255,0,1)', //[]osgb tintColor: 'rgba(255,255,0,1)', //[]osgb
@ -51,9 +49,13 @@ export default {
}, },
() => { () => {
console.log('初始化成功') // console.log('初始化成功') //
this.InitEngine(api)
} }
) )
console.log('---->', api) },
InitEngine(api) {
let url = `${window.config.modelUrl}/Tools/output/model/${this.row.lightweightName}/root.glt`
api.Model.add(url, this.row.lightweightName)
}, },
initCesium2() { initCesium2() {
// const defaults = { ...this.bimStore.defaults } // const defaults = { ...this.bimStore.defaults }

View File

@ -1,7 +1,7 @@
<template> <template>
<div> <div>
<el-dialog v-model="show" append-to-body :close-on-click-modal="false" :close-on-press-escape="false" title="选择模型" width="960px" modal-class="model-select-dialog"> <el-dialog v-model="show" append-to-body :close-on-click-modal="false" :close-on-press-escape="false" title="选择模型" width="960px" modal-class="model-select-dialog">
<el-table v-loading="loading" :data="modelList" height="50vh" highlight-current-row> <el-table ref="modelTable" v-loading="loading" :data="modelList" height="50vh" highlight-current-row @row-click="tbSelectionChange" @row-dblclick="tbDblClick">
<el-table-column label="模型名" align="center" prop="name"> <el-table-column label="模型名" align="center" prop="name">
<template #default="scope"> <template #default="scope">
<label class="blue command" @click="showModel(scope.row)">{{scope.row.name}}</label> <label class="blue command" @click="showModel(scope.row)">{{scope.row.name}}</label>
@ -9,10 +9,11 @@
</el-table-column> </el-table-column>
<el-table-column label="轻量化名称" align="center" prop="lightweightName" /> <el-table-column label="轻量化名称" align="center" prop="lightweightName" />
<el-table-column label="软件类型" align="center" prop="fileType" /> <el-table-column label="软件类型" align="center" prop="fileType" />
<el-table-column label="文件大小" align="center" prop="fileSize" /> <el-table-column label="文件大小" align="center" prop="fileSize">
<template #default="scope">{{scope.row.fileSize?toSize(scope.row.fileSize):'-'}}</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="statusDescription" /> <el-table-column label="状态" align="center" prop="statusDescription" />
<el-table-column label="DB同步状态" align="center" prop="statusDescription"> <el-table-column label="DB同步状态" align="center" prop="statusDescription" v-if="1==2">
<template #default="scope"> <template #default="scope">
<span v-if="scope.row.dbSyncStatus == 2"></span> <span v-if="scope.row.dbSyncStatus == 2"></span>
<span v-else-if="scope.row.dbSyncStatus == 1">同步失败</span> <span v-else-if="scope.row.dbSyncStatus == 1">同步失败</span>
@ -35,8 +36,9 @@
<script> <script>
import { queryModels } from '@/api/bim/bimApi' import { queryModels } from '@/api/bim/bimApi'
import { checkLightweightName, getBimModel, addBimModel, updateBimModel, delBimModel } from '@/api/bim/bimModel' import { checkLightweightName, getBimModel, addBimModel, updateBimModel, delBimModel } from '@/api/bim/bimModel'
import modelDialog from './modelDialog.vue' import modelDialog from './modelDialog2.vue'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import { fileSize } from '../../../utils'
export default { export default {
components: { modelDialog }, components: { modelDialog },
data() { data() {
@ -44,20 +46,28 @@ export default {
loading: true, loading: true,
show: false, show: false,
modelList: [], modelList: [],
selRow: null,
} }
}, },
mounted() { mounted() {
console.log('===>', useUserStore()) console.log('===>', useUserStore())
}, },
methods: { methods: {
tbDblClick() {
this.submitForm()
},
tbSelectionChange(a, b) {
this.selRow = a
},
showDialog() { showDialog() {
this.show = true this.show = true
this.selRow = null
queryModels().then((d) => { queryModels().then((d) => {
let models = d.data.datas || [] let models = d.data.datas || []
let modelIds = models.map((it) => it.lightweightName) let modelIds = models.map((it) => it.lightweightName)
if (modelIds.length > 0) { if (modelIds.length > 0) {
checkLightweightName(modelIds).then((res) => { checkLightweightName(modelIds).then((res) => {
this.modelList = models.filter((item) => res.data.includes(item.lightweightName) && item.fileSize > 0) this.modelList = models.filter((item) => res.data.includes(item.lightweightName))
this.loading = false this.loading = false
}) })
} else { } else {
@ -66,7 +76,22 @@ export default {
} }
}) })
}, },
submitForm() {}, toSize(size) {
return fileSize(size)
},
submitForm() {
if (!this.selRow) {
this.$modal.msgError('请选择模型!')
return
}
if (this.selRow.status !== 100) {
this.$modal.msgError('请选择轻量化成功模型!')
return
} else {
this.show = false
this.$emit('select', this.selRow)
}
},
showModel(row) { showModel(row) {
this.$refs.modelDialog.showDialog(row) this.$refs.modelDialog.showDialog(row)
}, },
@ -92,9 +117,5 @@ export default {
.dialog-footer { .dialog-footer {
text-align: center; text-align: center;
} }
.blue {
color: rgb(30, 144, 255);
}
} }
</style> </style>

View File

@ -163,6 +163,7 @@
<a-input v-model:value="form.visibleDistance" /> <a-input v-model:value="form.visibleDistance" />
</a-form-item> </a-form-item>
<a-form-item label="选择文件" name="files"> <a-form-item label="选择文件" name="files">
{{ form.files }}
<a-form-item-rest> <a-form-item-rest>
<a-input type="hidden" v-model:value="form.files" /> <a-input type="hidden" v-model:value="form.files" />
</a-form-item-rest> </a-form-item-rest>
@ -226,6 +227,7 @@ export default {
openStatus: 2, openStatus: 2,
}, },
form: { form: {
id: null,
files: null, files: null,
options: '', options: '',
longitude: '', longitude: '',
@ -412,7 +414,7 @@ export default {
fileName: item.fileName, fileName: item.fileName,
chunk: index, chunk: index,
chunks: data.chunkListLength, chunks: data.chunkListLength,
CallBackUrl: store.state.baseUrl + '/api/app/document/pakcallback', CallBackUrl: window.config.baseUrl + '/api/app/document/pakcallback',
input: { input: {
Name: file.name, Name: file.name,
LightweightName: file.lightweightName, LightweightName: file.lightweightName,
@ -604,7 +606,7 @@ export default {
that.upload = false that.upload = false
data.file.curentIndex++ data.file.curentIndex++
that.successfullyLoaded++ that.successfullyLoaded++
that.$message.error(`上传失败!`) that.$modal.msgError(`上传失败!`)
} }
}) })
await send(data) await send(data)
@ -612,76 +614,13 @@ export default {
send(requestList) // send(requestList) //
}, },
complete(file) { complete(file) {
var that = this let that = this
that.form.validateFields(async (err, values) => { that.$modal.msgSuccess(`模型${file.name}上传成功`)
const formModel = { that.$emit('fetch')
...that.formModel, that.percent = 100
} that.upload = false
const { id, isPublic, projectId } = Object.assign(formModel, values) that.confirmLoading = false
let modelConfig = { that.hide()
visibleDistance: 10,
isLod: that.isLod,
}
if (that.software == 'osgb') {
modelConfig.visibleDistance = Number.isFinite(that.visibleDistance * 1) ? that.visibleDistance * 1 : 0.5
} else if (that.software == '点云') {
modelConfig.visibleDistance = 0.5
} else {
modelConfig.visibleDistance = 10
}
if (that.isLod == 1) {
modelConfig.visibleDistance = 10
}
let sceneConfig = undefined
if (that.software == 'tif') {
modelConfig = Object.assign({}, modelConfig, {
format: values.format,
})
sceneConfig = {
scene: '1',
isTif: 1,
mapType: 'model_defaultMap',
sun: '1',
} //tifgis
}
const params = {
modelName: file.lightweightName,
parentId: that.parentId,
documentName: file.name,
isPublic: isPublic,
size: file.size,
projectFolderId: id,
projectId: projectId,
documentType: that.category,
modelFormat: that.software,
modelConfig: JSON.stringify(modelConfig),
sceneConfig: sceneConfig ? JSON.stringify(sceneConfig) : undefined,
}
createDocument(params)
.then((res) => {
that.successfullyLoaded++
if (res != null) {
that.$message.success(`模型${res.documentName}上传成功`)
that.$emit('fetch')
if (that.fileList.length == that.successfullyLoaded) {
that.percent = 100
that.upload = false
that.confirmLoading = false
that.hide()
}
} else {
that.$message.error(`模型${res.documentName}上传失败!`)
if (that.fileList.length == that.successfullyLoaded) {
that.confirmLoading = false
that.hide()
}
}
})
.catch((err) => {
that.successfullyLoaded++
that.$message.error(`上传失败!`)
})
})
}, },
// //
show(documentId) { show(documentId) {
@ -732,18 +671,17 @@ export default {
that.$refs.mainFrom that.$refs.mainFrom
.validateFields() .validateFields()
.then((values) => { .then((values) => {
debugger
let total = 0 let total = 0
that.optionsSelect.forEach((item) => { that.optionsSelect.forEach((item) => {
total += item.num * 1 total += item.num * 1
}) })
if (total > 100) { if (total > 100) {
that.cuttingLayerChange(4) that.cuttingLayerChange(4)
that.$message.error('当前层级配比大于100%$,请重新填写') that.$modal.msgError('当前层级配比大于100%$,请重新填写')
return return
} else if (total < 100) { } else if (total < 100) {
that.cuttingLayerChange(4) that.cuttingLayerChange(4)
that.$message.error('当前层级配比小于100%,请重新填写') that.$modal.msgError('当前层级配比小于100%,请重新填写')
return return
} }
that.confirmLoading = true that.confirmLoading = true
@ -751,7 +689,7 @@ export default {
that.upload = true that.upload = true
const parentId = values.id const parentId = values.id
if (that.fileList.length == 0) { if (that.fileList.length == 0) {
that.$message.error('请选择文件') that.$modal.msgError('请选择文件')
return return
} }
if (that.uploadType == '0') { if (that.uploadType == '0') {
@ -798,40 +736,37 @@ export default {
if (suffixName) { if (suffixName) {
await that.splitUploadFile(values, file, res) // await that.splitUploadFile(values, file, res) //
} else { } else {
that.$message.error('暂不支持此格式') that.$modal.msgError('暂不支持此格式')
} }
} }
}, },
onChange(e) { onChange(e) {
const [id] = [...e].reverse() // const [id] = [...e].reverse() //
this.form.setFieldsValue({ this.form.id = id
id: id,
})
}, },
handleRemove(file) { handleRemove(file) {
const index = this.fileList.indexOf(file) const index = this.fileList.indexOf(file)
const newFileList = this.fileList.slice() const newFileList = this.fileList.slice()
newFileList.splice(index, 1) newFileList.splice(index, 1)
this.fileList = newFileList this.fileList = newFileList
this.form.setFieldsValue({ this.form.files = this.fileList.map((x) => x.uid).join(',')
files: this.fileList.map((x) => x.uid).join(','),
})
}, },
beforeUpload(file) { beforeUpload(file) {
debugger
if (this.category == '1' && this.software != 'glt' && this.software != 'gltf' && this.software != 'LOD') { if (this.category == '1' && this.software != 'glt' && this.software != 'gltf' && this.software != 'LOD') {
let size = file.size / 1024 / 1024 let size = file.size / 1024 / 1024
if (this.software == 'navisworks') { if (this.software == 'navisworks') {
if (size > 300 && this.isLod == 0) { if (size > 300 && this.isLod == 0) {
this.$message.warning('当前模型体量过大建议开启lod模式') this.$modal.msgError('当前模型体量过大建议开启lod模式')
} }
} else { } else {
if (size > 2048 && this.isLod == 0) { if (size > 2048 && this.isLod == 0) {
this.$message.warning('当前模型体量过大建议开启lod模式') this.$modal.msgError('当前模型体量过大建议开启lod模式')
} }
} }
} }
if (this.uploadType == '0' && this.fileList.length >= 1) { if (this.uploadType == '0' && this.fileList.length >= 1) {
this.$message.warning('一次只能上传一个文件!') this.$modal.msgError('一次只能上传一个文件!')
return false return false
} }
if (!this.category || !this.software) { if (!this.category || !this.software) {
@ -862,21 +797,17 @@ export default {
}) })
if (suffix === '.zip') { if (suffix === '.zip') {
if (!this.accept.includes('.zip')) { if (!this.accept.includes('.zip')) {
this.$message.error('此格式有多项匹配,请手动选择') this.$modal.msgError('此格式有多项匹配,请手动选择')
this.accept = '' this.accept = ''
this.form.setFieldsValue({ this.form.options = undefined
options: undefined,
})
return false return false
} }
} else { } else {
this.form.setFieldsValue({ this.form.options = options
options: options, this.accept = options.length > 0 ? options[options.length - 1] : ''
})
this.accept = options[options.length - 1]
} }
if (!suffixStr.includes(suffix)) { if (!suffixStr.includes(suffix)) {
this.$message.error('暂不支持此格式') this.$modal.msgError('暂不支持此格式')
return false return false
} }
this.category = options[0] this.category = options[0]
@ -885,11 +816,9 @@ export default {
} }
if (file.name.split('.')[0].length <= 50) { if (file.name.split('.')[0].length <= 50) {
this.fileList = [...this.fileList, file] this.fileList = [...this.fileList, file]
this.form.setFieldsValue({ this.form.files = this.fileList.map((x) => x.uid).join(',')
files: this.fileList.map((x) => x.uid).join(','),
})
} else { } else {
this.$message.warning('文件名称不能超过50个字符') this.$modal.msgError('文件名称不能超过50个字符')
} }
return false return false
}, },

View File

@ -0,0 +1,208 @@
<template>
<div class="model-floor-tree scroll-box" :class="{ 'hide-tree': !showTree }">
<div class="nav-header">
<span class="title">结构树</span>
<span class="toolbar">
<el-icon color="#fff" @click="showTree=!showTree">
<ArrowUpBold v-if="showTree" />
<ArrowDownBold v-else />
</el-icon>
</span>
</div>
<!-- <a-tree
checkable
class="model-tree"
:tree-data="modelTrees"
:load-data="onLoadData"
:replace-fields="replaceFields"
@check="onCheckTree"
v-model="checkedKeys"
:selectedKeys="selectedKeys"
@select="onSelect"
default-expand-all
>
<template #title="{text}">
<span>
{{text.name}}
<a-icon type="loading" v-show="text.disableCheckbox" />
</span>
</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>
</div>
</div>
</template>
<script>
import { getModelTree } from '@/api/bim/bimModel'
import { isLeaf } from 'ant-design-vue/es/vc-cascader/utils/commonUtil'
export default {
props: {
projectMessage: {
type: Object,
default: undefined,
},
},
data() {
return {
modelTrees: [],
replaceFields: {
title: 'name',
key: 'glid',
value: 'glid',
},
expandedKeys: [],
visibleList: [], //
checkedKeys: [], //
selectedKeys: [],
selectedFeature: undefined,
requestedData: [], //
firstClick: true,
isMobile: false,
showTree: true,
}
},
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,
key: 'root',
children: [],
hadLoad: true,
},
]
this.projectMessage
.map((d) => {
d.gis = JSON.parse(d.gisJson)
return d
})
.forEach((d) => {
this.modelTrees[0].children.push({
title: d.modelName,
level: 1,
hasLoad: false,
model: d.lightweightName,
key: d.lightweightName,
glid: '',
children: [],
data: d,
})
})
this.expandedKeys = ['root']
this.$nextTick(() => {})
},
methods: {
loadTree(a, b, c) {
return new Promise((resolve, reject) => {
if (a.hasLoad) {
resolve()
return
}
getModelTree(a.model, a.glid).then((d) => {
;(d.data || []).forEach((e) => {
let title = e.externalId == 0 ? e.name : e.externalId
title = title.replace(/[\/\\"]/g, '')
a.children.push({
title: title,
key: e.glid,
glid: e.glid,
model: a.model,
children: [],
hasLoad: false,
isLeaf: e.externalId != 0,
data: e,
})
})
resolve()
})
})
},
},
}
</script>
<style lang="scss">
.model-floor-tree {
position: absolute;
width: 300px;
top: 20px;
left: 20px;
color: #fff;
background: #274754;
&.hide-tree {
height: 50px;
.ant-tree {
display: none;
}
}
.nav-header {
border-bottom: solid 1px #fff;
line-height: 40px;
padding: 0px 10px;
position: relative;
.title {
color: rgb(0, 255, 212);
font-weight: bold;
}
.toolbar {
position: absolute;
right: 10px;
.el-icon {
cursor: pointer;
}
}
}
.ant-tree {
background: transparent;
color: #fff;
}
.scroll-box {
margin-top: 15px;
height: 64vh;
overflow-y: auto;
&::-webkit-scrollbar {
//
height: 8px;
width: 8px;
}
&::-webkit-scrollbar-thumb {
//
border-radius: 1px;
box-shadow: inset 0 0 1px rgba(255, 255, 255, 0.2);
background: #ffffff;
}
&::-webkit-scrollbar-track {
//
box-shadow: 0;
border-radius: 0;
background: rgba(255, 255, 255, 0.3);
}
.ant-tree-node-content-wrapper {
color: #ffffff;
white-space: nowrap;
&.ant-tree-node-selected {
background: #409eff54 !important;
}
}
.ant-list-empty-text {
padding: 5px;
text-align: left;
}
}
}
</style>

View File

@ -0,0 +1,59 @@
<template>
<div class="bim-setting-page">
<div id="bimSettingContainer"></div>
<model-floor-tree ref="modelFloorTree" :projectMessage="models" v-if="showTree"></model-floor-tree>
</div>
</template>
<script>
import useUserStore from '@/store/modules/user'
import { listBimModel } from '@/api/bim/bimModel'
import ModelFloorTree from './ModelFloorTree.vue'
export default {
components: {
ModelFloorTree,
},
data() {
return {
userStore: {},
isAdmin: false,
projects: [],
currentPrjId: null,
currentComId: null,
subDepts: [],
models: [],
showTree: false,
}
},
mounted() {
this.userStore = useUserStore()
this.isAdmin = this.userStore.isAdmin
this.currentPrjId = this.userStore.currentPrjId
this.currentComId = this.userStore.currentComId
this.initLoadModel()
},
methods: {
initLoadModel() {
listBimModel({
pageNum: 1,
pageSize: 10,
comId: this.currentComId,
projectId: this.currentPrjId,
}).then((d) => {
this.models = d.rows || []
if (this.models.length == 0) {
this.$model.msgError('暂无模型,请先关联模型')
} else {
this.showTree = true
}
})
},
},
}
</script>
<style lang="scss">
.bim-setting-page {
position: relative;
}
</style>