diff --git a/src/Common/HostUrl.ts b/src/Common/HostUrl.ts
index c41e136d7..f7a6dadfa 100644
--- a/src/Common/HostUrl.ts
+++ b/src/Common/HostUrl.ts
@@ -193,3 +193,13 @@ export const GalleryURL = {
//UE图纸分享
export const RenderShare = CURRENT_HOST + '/CAD-renderShare';
+
+//私有企业库
+export const PrivateModule = {
+ QueryModuleDirs: CURRENT_HOST + "/CAD-queryPriviteModuleDirs",//目录列表
+ CreateModuleDirs: CURRENT_HOST + "/CAD-createPrivteModuleDir",//创建目录
+ UpdateModuleDirs: CURRENT_HOST + "/CAD-updatePrivteModuleDir",//修改目录
+ DeleteModuleDirs: CURRENT_HOST + "/CAD-deletePrivateModuleDir",//删除目录
+ GetModuleList: CURRENT_HOST + "/CAD-privateModuleLists",//模型列表
+ UpdateModule: CURRENT_HOST + "/CAD-privateModuleUpdate"//修改模型信息
+};
diff --git a/src/DatabaseServices/Entity/EntityRef.ts b/src/DatabaseServices/Entity/EntityRef.ts
index 8598fe8fa..ce6882c73 100644
--- a/src/DatabaseServices/Entity/EntityRef.ts
+++ b/src/DatabaseServices/Entity/EntityRef.ts
@@ -1,9 +1,10 @@
-import { Box3, Matrix3, Matrix4, Mesh, MeshPhongMaterial, MeshPhysicalMaterial, Object3D, Vector3 } from "three";
+import { Box3, Group, Matrix3, Matrix4, Mesh, MeshPhongMaterial, MeshPhysicalMaterial, Object3D, Vector3 } from "three";
import { BoxLine } from "../../Add-on/testEntity/BoxLine";
import { ConverMaterial2, ParseBoxUrl, ParseFBXUrl, UE_FBX_LOADER } from "../../Add-on/testEntity/ParseMaterialImage";
import { HostApplicationServices } from "../../ApplicationServices/HostApplicationServices";
import { ColorMaterial } from "../../Common/ColorPalette";
import { DisposeThreeObj, Object3DRemoveAll } from "../../Common/Dispose";
+import { Log, LogType } from "../../Common/Log";
import { UpdateDraw } from "../../Common/Status";
import { ObjectSnapMode } from "../../Editor/ObjectSnapMode";
import { Box3Ext } from "../../Geometry/Box";
@@ -236,19 +237,37 @@ export class EntityRef extends Entity
IndexedDbStore.CADStore().then(async store =>
{
let array = await store.Get(StoreName.FBX, this.Url);
+ let needSave = false;
if (!array)
{
+ needSave = true;
let fbxurl = ParseFBXUrl(this._url);
let res = await fetch(fbxurl);
- array = await res.arrayBuffer();
-
- store.Put(StoreName.FBX, this.Url, array);
+ if (res.status === 200)
+ array = await res.arrayBuffer();
+ else
+ {
+ let errorMsg = "错误:网络异常或者服务端资源不存在!无法请求到服务器FBX资源:" + this._url;
+ Log(errorMsg, LogType.Error, [this]);
+ //TODO:模型请求失败 是不是应该做点什么 过会重试?
+ reportError(errorMsg);
+ return;
+ }
}
- // let fbxUrl = require("./LOD_DEAA_0055.FBX").default;
- // let res = await fetch(fbxUrl);
- // array = await res.arrayBuffer();
- let newObject = UE_FBX_LOADER.parse(array, UE_FBX_LOADER.path);
+ let newObject: Group;
+ try
+ {
+ newObject = UE_FBX_LOADER.parse(array, UE_FBX_LOADER.path);
+ } catch (error)
+ {
+ let errorMsg = "错误:FBX资源无法解析:" + this._url;
+ Log(errorMsg, LogType.Error, [this]);
+ reportError(new Error(errorMsg));
+ return;
+ }
+ if (needSave)
+ store.Put(StoreName.FBX, this.Url, array);
fbxloaded = true;
DisposeThreeObj(dObj);
diff --git a/src/UI/Components/ToolBar/ResourceLibrary/ResourceInterfaces.ts b/src/UI/Components/ToolBar/ResourceLibrary/ResourceInterfaces.ts
index 70a3634fb..afb610acf 100644
--- a/src/UI/Components/ToolBar/ResourceLibrary/ResourceInterfaces.ts
+++ b/src/UI/Components/ToolBar/ResourceLibrary/ResourceInterfaces.ts
@@ -86,7 +86,7 @@ export interface Folder
{
dir_id: string;
dir_name: string;
- create_date: string;
+ create_date?: string;
}
export interface UserFolder extends IResponseData
{
@@ -98,3 +98,56 @@ export interface UserCollections extends IResponseData
modules: ModuleData[];
class: any;
}
+
+export interface PrivateDirsParams
+{
+ curr_page: number;
+ page_count: number;
+ order: string;
+ dir_id?: string;
+ name?: string;
+ sn?: string;
+ module_id?: string;
+}
+
+export interface PrivateDirs
+{
+ dir_id: string;
+ dir_name: string;
+ dir_level?: string;
+ create_date?: string;
+ update_date?: string;
+ childs?: PrivateDirs[];
+}
+
+export interface PrivateModuleDirs extends IResponseData
+{
+ dirs: PrivateDirs[];
+}
+
+export interface PrivateModuleItem
+{
+ module_id: string;
+ dir_id: string;
+ name: string;
+ sn: String;
+ logo: string;
+ path: string;
+ dimension: string;
+ state: string;
+ create_date: string;
+ update_data: string;
+ comments: string;
+}
+
+export interface PrivateModuleList extends IResponseData
+{
+ count: number;
+ modules: PrivateModuleItem[];
+}
+
+export enum ModuleType
+{
+ Public = 0,//公有模型
+ Private = 1,//私有企业库模型
+}
diff --git a/src/UI/Components/ToolBar/ResourceLibrary/ResourceLibrary.less b/src/UI/Components/ToolBar/ResourceLibrary/ResourceLibrary.less
index ea6d8112f..521dd0c1d 100644
--- a/src/UI/Components/ToolBar/ResourceLibrary/ResourceLibrary.less
+++ b/src/UI/Components/ToolBar/ResourceLibrary/ResourceLibrary.less
@@ -1,6 +1,6 @@
.resourcePanel{
position : relative;
- width : 300px;
+ width : 350px;
background: #ffffff;
box-sizing: border-box;
ul{
@@ -38,7 +38,6 @@
margin : 10px 0;
display : flex;
justify-content : space-between;
- padding : 0 5px;
align-items : center;
}
.resources{
@@ -165,7 +164,6 @@
box-sizing: border-box;
position : absolute;
width : 300px;
- box-sizing: border-box;
.radioGroup{
display : flex;
flex-direction: row;
@@ -190,7 +188,7 @@
overflow-y : auto;
.pagination{
height : 50px;
- width : 280px;
+ width : 100%;
z-index : 3;
box-sizing : border-box;
display : flex;
@@ -234,8 +232,8 @@
margin-top: 10px;
position : relative;
.items{
- width : 120px;
- height : 120px;
+ width : 144px;
+ height : 144px;
position : relative;
margin-left : 10px;
margin-top : 10px;
@@ -250,7 +248,7 @@
transition : opacity 0.1s ease-in 0s;
position : absolute;
box-sizing : border-box;
- width : 120px;
+ width : 100%;
opacity : 0;
display : flex;
justify-content: space-between;
@@ -412,6 +410,7 @@
flex-direction : column;
justify-content: space-around;
overflow-y : auto;
+
.bp3-navbar-group
{
width : 100%;
@@ -508,3 +507,149 @@
padding-bottom : 10px;
}
}
+
+.enterprise
+{
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+ overflow: hidden;
+
+ .bp3-tree-node
+ {
+ .bp3-input
+ {
+ &:focus
+ {
+ border-radius: 0px;
+ border: 1px solid #eeeeee;
+ }
+ }
+ }
+
+ .navbarGroup
+ {
+ display: flex;
+ justify-content: space-between;
+ float: none;
+ }
+ .bp3-tree
+ {
+ flex: 1;
+ height: 100%;
+ >ul
+ {
+ height: 95%;
+ overflow-y: auto;
+ }
+ }
+
+ li
+ {
+ &:hover{
+ background: none !important;
+ }
+ }
+
+ .moduleList
+ {
+ height: 100%;
+ overflow: hidden;
+ display: flex;
+ flex-direction: column;
+
+ .moduleControl{
+ display: flex;
+ flex-direction:row-reverse;
+ align-items: center;
+ border-bottom: 1px solid #c3c4c5;
+ padding-bottom: 4px;
+ }
+
+ .itemList
+ {
+ width: 100%;
+ height: 100vh;
+ overflow-y: auto;
+ overflow-x: hidden;
+ box-sizing: border-box;
+ margin: 0px;
+ position: relative;
+
+ .items
+ {
+ float: none;
+ margin: 0
+ }
+
+ .moduleName
+ {
+ width: 144px;
+
+ >div
+ {
+ padding: 6px;
+ cursor: default;
+ }
+ }
+ }
+ .itemOptions
+ {
+ flex-direction: row-reverse;
+ }
+ }
+
+ .moduleItem
+ {
+ text-align: center;
+ padding: 4px;
+ padding-bottom: 0px;
+ border-radius: 2px;
+ display: inline-block;
+ margin-left: 10px;
+ margin-top: 10px;
+ }
+
+ .moduleSelected
+ {
+ background-color: #52aee7;
+ }
+
+ .privateDirName
+ {
+ height: auto;
+ }
+
+ .enterpriseOption{
+ .pagination{
+ height : 50px;
+ width : 100%;
+ z-index : 3;
+ box-sizing : border-box;
+ display : flex;
+ justify-content : center;
+ align-content : center;
+ padding : 0px 20px;
+ padding-top : 5px;
+ span{
+ display : block;
+ line-height: 30px;
+ font-size : 14px;
+ margin-left: -20px;
+ }
+ button {
+ >span {
+ transform: rotate(90deg);
+ }
+ }
+ button:nth-child(1){
+ left: 80px;
+ }
+ button:nth-child(2){
+ height : 30px;
+ position: absolute;
+ left : -90px;
+ }
+ }
+ }
+}
diff --git a/src/UI/Components/ToolBar/ResourceLibrary/ResourcePanel.tsx b/src/UI/Components/ToolBar/ResourceLibrary/ResourcePanel.tsx
index 67772d78d..feb9dde5d 100644
--- a/src/UI/Components/ToolBar/ResourceLibrary/ResourcePanel.tsx
+++ b/src/UI/Components/ToolBar/ResourceLibrary/ResourcePanel.tsx
@@ -6,6 +6,7 @@ import Resource_By_Image from "./Resource_By_Image";
import Resource_CategoriesList from "./Resource_CategoriesList";
import Resource_ResourceList from "./Resource_ResourceList";
import Resource_Search from "./Resource_Search";
+import Resoure_Enterprise from "./Resoure_Enterprise";
import ResourceStore from "./RsourceStore";
import UserCollect from "./UserCollect";
@@ -16,6 +17,8 @@ export const ResourcePanelType = {
myCollect: Symbol("用户收藏"),
collectList: Symbol("收藏列表"),
resourceByImg: Symbol("按图搜索"),
+ enterpriseFolder: Symbol("企业库文件"),
+ enterpriseModule: Symbol("企业库模型")
};
@observer
export class ResourcePanel extends Component<{}, {}>
@@ -36,6 +39,7 @@ export class ResourcePanel extends Component<{}, {}>
{Boolean(this.resourceStore.currentState === ResourcePanelType.resourceList) && }
{Boolean(this.resourceStore.currentState === ResourcePanelType.myCollect) && }
{Boolean(this.resourceStore.currentState === ResourcePanelType.resourceByImg) && }
+ {Boolean(this.resourceStore.currentState === ResourcePanelType.enterpriseFolder) && }
);
diff --git a/src/UI/Components/ToolBar/ResourceLibrary/Resource_By_Image.tsx b/src/UI/Components/ToolBar/ResourceLibrary/Resource_By_Image.tsx
index 54b262db2..50fe65c0b 100644
--- a/src/UI/Components/ToolBar/ResourceLibrary/Resource_By_Image.tsx
+++ b/src/UI/Components/ToolBar/ResourceLibrary/Resource_By_Image.tsx
@@ -2,7 +2,7 @@ import { Spinner } from '@blueprintjs/core';
import { observer } from 'mobx-react';
import React, { Component } from 'react';
import { ModuleData } from './ResourceInterfaces';
-import { ResourceItem, R_Pagination } from './Resource_ResourceList';
+import { R_Pagination, ResourceItem } from './Resource_ResourceList';
import ResourceStore, { pageCount } from './RsourceStore';
import { RenderNoResult } from './UserCollect';
diff --git a/src/UI/Components/ToolBar/ResourceLibrary/Resource_ResourceList.tsx b/src/UI/Components/ToolBar/ResourceLibrary/Resource_ResourceList.tsx
index b2a9651c0..f5f20a331 100644
--- a/src/UI/Components/ToolBar/ResourceLibrary/Resource_ResourceList.tsx
+++ b/src/UI/Components/ToolBar/ResourceLibrary/Resource_ResourceList.tsx
@@ -317,8 +317,6 @@ export default class Resource_ResourceList extends Component<{}, {}>
}
}
-
-
/**
*
* @param props
diff --git a/src/UI/Components/ToolBar/ResourceLibrary/Resource_Search.tsx b/src/UI/Components/ToolBar/ResourceLibrary/Resource_Search.tsx
index 7a89322f3..c9469dda0 100644
--- a/src/UI/Components/ToolBar/ResourceLibrary/Resource_Search.tsx
+++ b/src/UI/Components/ToolBar/ResourceLibrary/Resource_Search.tsx
@@ -109,6 +109,7 @@ export default class Resource_Search extends Component<{}, {}>
render()
{
+ const isEnterprise = [ResourcePanelType.enterpriseFolder, ResourcePanelType.enterpriseModule].includes(this.resourceStore.currentState);
return (
<>
@@ -125,7 +126,7 @@ export default class Resource_Search extends Component<{}, {}>
/>
}
- {Boolean(this.resourceStore.currentState !== ResourcePanelType.myCollect) &&
+ {Boolean(![ResourcePanelType.myCollect, ResourcePanelType.enterpriseFolder].includes(this.resourceStore.currentState)) &&
}
- {Boolean(this.resourceStore.currentState !== ResourcePanelType.myCollect) &&
+ {Boolean(![ResourcePanelType.myCollect, ResourcePanelType.enterpriseFolder].includes(this.resourceStore.currentState)) &&
// Boolean(this.resourceStore.currentState !== ResourcePanelType.resourceList) &&
/>
}
-