Commit ee9d4ab9 authored by 赵啸非's avatar 赵啸非

Merge remote-tracking branch 'origin/master'

parents d73d80d6 70591c76
......@@ -31,6 +31,7 @@
"quill": "1.3.7",
"screenfull": "5.0.2",
"sockjs-client": "^1.5.1",
"three": "^0.152.2",
"v-charts": "^1.17.10",
"vue": "^2.6.14",
"vue-amap": "^0.5.10",
......
html {
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
box-sizing: border-box;
}
html * {
outline: 0;
outline: 0;
box-sizing: inherit;
-webkit-text-size-adjust: none;
-webkit-tap-highlight-color: rgba(0,0,0,0)
-webkit-text-size-adjust: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
html,body {
height: 100%;
html,
body {
width: 100%;
// height: 100%;
min-height: 100%;
font-family: "Microsoft Yahei", "Helvetica Neue", Helvetica, STHeiTi, Arial, sans-serif;
font-family: "Microsoft Yahei", "Helvetica Neue", Helvetica, STHeiTi, Arial,
sans-serif;
}
body {
overflow-y: auto;
overflow-y: auto;
}
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td,hr,button,article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section {
margin: 0;
padding: 0
body,
div,
dl,
dt,
dd,
ul,
ol,
li,
h1,
h2,
h3,
h4,
h5,
h6,
pre,
code,
form,
fieldset,
legend,
input,
textarea,
p,
blockquote,
th,
td,
hr,
button,
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
margin: 0;
padding: 0;
}
input,select,textarea,button {
font-size: 100%;
input,
select,
textarea,
button {
font-size: 100%;
-webkit-appearance: none;
border:0;
border: 0;
outline: 0;
}
table {
border-collapse: collapse;
border-spacing: 0
border-collapse: collapse;
border-spacing: 0;
}
fieldset,img {
border: 0
fieldset,
img {
border: 0;
}
abbr,acronym {
border: 0;
font-variant: normal
abbr,
acronym {
border: 0;
font-variant: normal;
}
del {
text-decoration: line-through
text-decoration: line-through;
}
address,caption,cite,code,dfn,em,th,var {
font-style: normal;
font-weight: 500
address,
caption,
cite,
code,
dfn,
em,
th,
var {
font-style: normal;
font-weight: 500;
}
ol,ul {
list-style: none
ol,
ul {
list-style: none;
}
caption,th {
text-align: left
caption,
th {
text-align: left;
}
// h1,h2,h3,h4,h5,h6 {
......@@ -67,29 +123,33 @@ caption,th {
// font-weight: 500
// }
q:before,q:after {
content: ''
q:before,
q:after {
content: "";
}
sub,sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -.5em
top: -0.5em;
}
sub {
bottom: -.25em
bottom: -0.25em;
}
ins,a {
text-decoration: none;
cursor: pointer;
ins,
a {
text-decoration: none;
cursor: pointer;
}
/* ============================================================
flex:定义布局为盒模型
flex-v:盒模型垂直布局
......@@ -99,137 +159,196 @@ ins,a {
flex-pack-justify:子元素两端对齐
兼容性:ios 4+、android 2.3+、winphone8+
============================================================ */
.flex{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}
.flex-v{-webkit-box-orient:vertical;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}
.flex-1{-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;}
.flex-align-center{-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;}
.flex-pack-center{-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;}
.flex-pack-justify{-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;}
.clearfix{
&:after{
content: '';
.flex {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
.flex-v {
-webkit-box-orient: vertical;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
}
.flex-1 {
-webkit-box-flex: 1;
-webkit-flex: 1;
-ms-flex: 1;
flex: 1;
}
.flex-align-center {
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
}
.flex-pack-center {
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
}
.flex-pack-justify {
-webkit-box-pack: justify;
-webkit-justify-content: space-between;
-ms-flex-pack: justify;
justify-content: space-between;
}
.clearfix {
&:after {
content: "";
display: table;
clear: both;
font-size: 0;
}
}
}
.fl{float: left};
.fr{float: right};
.hide{display: none;}
.disabled{
pointer-events: none;
.fl {
float: left;
}
#app,.pages{
.flex;
.flex-v;
height: 100%;
.fr {
float: right;
}
.hide {
display: none;
}
.disabled {
pointer-events: none;
}
#app,
.pages {
.flex;
.flex-v;
height: 100%;
}
.ellipsis{
.ellipsis {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
[v-cloak] {
display: none;
}
[disabled] {
pointer-events: none;
}
.el-dialog{
.el-checkbox-group{
.el-checkbox{
margin: 5px 0;
width: 33.33%;
}
.pointBox{
width: 50%;
}
}
}
.table-foot{
display: flex;
justify-content: flex-end;
pointer-events: none;
}
.el-dialog {
.el-checkbox-group {
.el-checkbox {
margin: 5px 0;
width: 33.33%;
}
.pointBox {
width: 50%;
}
}
}
.table-foot {
display: flex;
justify-content: flex-end;
}
.el-table th {
user-select: all;
user-select: all;
}
/* el-table列数据为空自动显示-- */
.cell:empty::before{
content:'--';
color:gray;
.cell:empty::before {
content: "--";
color: gray;
}
.el-progress-bar{
padding-right: 70px;
margin-right: -70px;
.el-progress-bar {
padding-right: 70px;
margin-right: -70px;
}
#operatorUserCabinCheckBox .el-checkbox{
#operatorUserCabinCheckBox .el-checkbox {
white-space: normal !important;
width: 100%
width: 100%;
}
#operatorUserCabinCheckBox .el-checkbox__label{
#operatorUserCabinCheckBox .el-checkbox__label {
display: inline;
}
// 统计页面隔日期变色
.page-statistics{
.chart{
.page-statistics {
.chart {
margin-bottom: 80px;
border: 1px solid #ededed;
height: 400px;
}
.el-table th, .el-table tr{
&.color-gray{
.el-table th,
.el-table tr {
&.color-gray {
background-color: #f0f9eb;
}
}
}
@media screen and (max-width: 800px) {
.page {
margin: 5px 5px;
}
.el-dialog {
width: 98% !important;
.el-checkbox-group {
.el-checkbox {
margin: 5px 0;
width: 50%;
font-size: 12px;
@media screen and (max-width: 800px){
.page{
margin: 5px 5px;
}
.el-dialog{
width: 98%!important;
.el-checkbox-group{
.el-checkbox{
margin: 5px 0;
width: 50%;
font-size: 12px;
.el-checkbox__label{
font-size: 12px;
}
}
}
}
.el-checkbox__label {
font-size: 12px;
}
}
}
}
}
// .is-active{
// background-color: red;
// }
.mobile-table-card{
margin: 10px auto;
padding: 10px;
box-shadow: 0 0 5px #ccc;
.mobile-table-cell{
padding: 5px 0;
border-bottom: 1px dotted #eee;
.cell-title{
font-size: 13px;
color: #666;
}
.cell-content{
padding-left: 5px;
text-align: right;
word-break: break-word;
}
}
}
\ No newline at end of file
.mobile-table-card {
margin: 10px auto;
padding: 10px;
box-shadow: 0 0 5px #ccc;
.mobile-table-cell {
padding: 5px 0;
border-bottom: 1px dotted #eee;
.cell-title {
font-size: 13px;
color: #666;
}
.cell-content {
padding-left: 5px;
text-align: right;
word-break: break-word;
}
}
}
<template>
<div ref="threeDom" id="counter">
<div id="alert-css2"></div>
</div>
</template>
<script>
import * as THREE from "three";
import {
CSS2DRenderer,
CSS2DObject,
} from "three/examples/jsm/renderers/CSS2DRenderer";
import { OrbitControls } from "three/examples/jsm/controls/OrbitControls";
import { OBJLoader } from "three/examples/jsm/loaders/OBJLoader";
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader";
import { MTLLoader } from "three/examples/jsm/loaders/MTLLoader";
import { GUI } from "three/examples/jsm/libs/lil-gui.module.min";
class PositionGUI {
constructor(obj, name) {
this.obj = obj;
this.name = name;
}
get modify() {
return this.obj[this.name];
}
set modify(v) {
this.obj[this.name] = v;
}
}
export default {
props: {
// 楼层
lv: {
type: String,
default: "1",
},
// 楼层图接口数据
floorArr: {
type: Array,
default: () => [],
},
},
data() {
return {
keyobj: {}, //窗口模型
modlObj: {}, //保存模型对象
checkedMesh: null, //选中模型
cloneMttl: null, //窗口材质备份
FPS: 30,
timeS: 0,
renderer: "",
camera: {},
scene: "",
controls: "",
labelRenderer: "",
Tips: "",
ambientLight: "",
directionalLight: "",
TWEENN: "",
SpotLight: "",
threeDate: {
isloading: true,
floorList: {}, //楼层图
floosrNum: "1",
checkWind: {}, //选中窗口
},
};
},
watch: {
lv(newVal) {
this.modlObj[this.threeDate.floosrNum].obj.visible = false; //隐藏未选中模型
this.modlObj[e].obj.visible = true; //显示选中模型
this.threeDate.floosrNum = newVal;
// this.css2DOM()
},
// floorArr: {
// handler: (newVal) => {
// console.log(this);
// let obj = {}; //转换成key为楼层的对象
// newVal.forEach((v) => {
// obj[v.lv] = v;
// });
// this.threeDate.floorList = obj;
// if (this.camera) {
// this._3Dloder();
// } else {
// this._initTree();
// }
// },
// deep: true,
// },
floorArr(newVal) {
let obj = {}; //转换成key为楼层的对象
newVal.forEach((v) => {
obj[v.lv] = v;
});
this.threeDate.floorList = obj;
if (this.camera) {
this._3Dloder();
} else {
this._initTree();
}
},
},
mounted() {
this._initTree();
},
methods: {
updateCamera() {
this.camera.updateProjectionMatrix();
},
// 渲染
animation() {
// TWEEN.update()
let clock = new THREE.Clock();
requestAnimationFrame(this.animation);
let T = clock.getDelta();
this.timeS = this.timeS + T;
let renderT = 1 / this.FPS;
// requestAnimationFrame默认调用render函数60次,通过时间判断,降低renderer.render执行频率
if (this.timeS > renderT) {
// 控制台查看渲染器渲染方法的调用周期,也就是间隔时间是多少
// console.log(`调用.render时间间隔`,timeS*1000+'毫秒');
this.controls.update();
this.renderer.render(this.scene, this.camera);
this.labelRenderer.render(this.scene, this.camera);
//renderer.render每执行一次,timeS置0
this.timeS = 0;
}
},
// 灯光
_Light() {
this.ambientLight = new THREE.AmbientLight(0xffffff, 1);
this.ambientLight.position.set(0, 0, 0);
this.scene.add(this.ambientLight);
this.directionalLight = new THREE.DirectionalLight(0xffffff, 1);
this.directionalLight.castShadow = true;
this.directionalLight.position.set(5, 10, 7.5);
this.scene.add(this.directionalLight);
},
//3d loader
_3Dloder() {
let threeDate = this.threeDate;
let _this = this;
let MTLLoaders = new MTLLoader();
let OBJLoaders = new OBJLoader();
let GLTFLoaders = new GLTFLoader();
OBJLoaders.setCrossOrigin("Anonymous"); //跨域问题
const { floorList } = threeDate;
for (const iterator in floorList) {
const mtl = floorList[iterator].mtl_url;
const obj = floorList[iterator].obj_url;
if (obj.search(/.obj/i) >= 0) {
// 模型
MTLLoaders.load(
"http://192.168.0.98:8090" + mtl,
function (materials) {
//obj的模型会和MaterialCreator包含的材质对应起来
OBJLoaders.setMaterials(materials);
OBJLoaders.load("http://192.168.0.98:8090" + obj, function (obj) {
if (_this.lv !== iterator) {
obj.visible = false;
}
_this.modlObj[iterator] = {
position: {
x: 0,
y: 0,
z: 0,
},
obj: obj,
};
threeDate.isloading = false;
_this.scene.add(obj); //返回的组对象插入场景中
});
}
);
} else if (obj.search(/.gltf/i) >= 0) {
GLTFLoaders.load("http://192.168.0.98:8090" + obj, function (obj) {
console.log(obj, "@@@@@@@");
const children = obj.scene.children[0].children;
children.forEach((element) => {
let objname = element.name;
// 窗口
if (/^\d_/.test(objname)) {
// 获取外部模型具体点击位置 obj模型没有位置
element.geometry.computeBoundingSphere();
// 球体中心点
let realPosition = element.geometry.boundingSphere.center;
element["positions"] = realPosition;
_this.keyobj[objname] = element;
}
});
if (_this.lv !== iterator) {
obj.scene.visible = false;
}
_this.modlObj[iterator] = {
position: {
x: 0,
y: 0,
z: 0,
},
obj: obj.scene,
};
console.log(obj.scene, iterator, _this.lv, "#########");
_this.scene.add(obj.scene); //返回的组对象插入场景中
threeDate.isloading = false;
});
}
}
},
// 初始化相机
_initCamera() {
this.camera.position.x = -500;
this.camera.position.y = 500;
this.camera.position.z = 1000;
},
// css2render
css2renderer() {
let threeDom = this.$refs.threeDom;
let screenW = threeDom.clientWidth;
let screenH = threeDom.clientHeight;
let css2dom = document.getElementById("alert-css2");
this.Tips = new CSS2DObject(css2dom);
this.Tips.position.set(0, 0, 0); //文字地址
this.Tips.visible = false;
this.scene.add(this.Tips);
this.labelRenderer = new CSS2DRenderer(); //新建CSS2DRenderer
this.labelRenderer.setSize(screenW, screenH);
this.labelRenderer.domElement.style.position = "absolute";
this.labelRenderer.domElement.style.top = 0;
threeDom.appendChild(this.labelRenderer.domElement);
},
// css2
css2controls() {
this.css2renderer();
this.controls = new OrbitControls(
this.camera,
this.labelRenderer.domElement
);
const counter = document.getElementById("counter");
counter.appendChild(this.renderer.domElement);
},
// 调试模式
initGui() {
let datGui = new GUI();
//声明一个保存需求修改的相关数据的对象
let gui = {
ambientLight: "#9b9ba3", //环境光源
directionalLight: "#0xffc288", //点光源
intensity: 1, //灯光强度
visible: true, //是否可见
castShadow: true,
exponent: 30,
target: "plane",
debug: false,
};
//将设置属性添加到gui当中,gui.add(对象,属性,最小值,最大值)
datGui.addColor(gui, "ambientLight").onChange(function (e) {
this.ambientLight.color = new THREE.Color(e);
});
datGui.add(gui, "intensity", 0, 5).onChange(function (e) {
this.ambientLight.intensity = e;
});
datGui.addColor(gui, "directionalLight").onChange(function (e) {
this.directionalLight.color = new THREE.Color(e);
});
datGui.add(gui, "intensity", 0, 5).onChange(function (e) {
this.directionalLight.intensity = e;
});
datGui.add(gui, "visible").onChange(function (e) {
this.directionalLight.visible = e;
});
datGui.add(gui, "castShadow").onChange(function (e) {
this.directionalLight.castShadow = e;
});
datGui.add(gui, "debug").onChange(function (e) {
if (e) {
let debug = new THREE.CameraHelper(
this.directionalLight.shadow.camera
);
debug.name = "debug";
this.scene.add(debug);
} else {
// let debug = this.scene.getObjectByName("debug");
// this.scene.remove(debug);
}
});
datGui.add(this.camera, "fov", 1, 18000).onChange(this.updateCamera);
datGui.add(this.camera, "near", 1, 20000).onChange(this.updateCamera);
datGui.add(this.camera, "far", 1, 20000).onChange(this.updateCamera);
const folder = datGui.addFolder("全局Position");
folder
.add(new PositionGUI(this.camera.position, "x"), "modify", 0, 20000)
.name("x");
folder
.add(new PositionGUI(this.camera.position, "y"), "modify", 0, 20000)
.name("y");
folder
.add(new PositionGUI(this.camera.position, "z"), "modify", 0, 20000)
.name("z");
},
// 初始化
_initTree() {
let threeDom = this.$refs.threeDom;
this.scene = new THREE.Scene();
let screenW = threeDom.clientWidth;
let screenH = threeDom.clientHeight;
this.camera = new THREE.PerspectiveCamera(
25,
screenW / screenH,
0.01,
20000
);
this._initCamera();
this.camera.lookAt(this.scene.position);
this.renderer = new THREE.WebGLRenderer({
antialias: true, //开启抗锯齿
logarithmicDepthBuffer: true, //对数深度缓存解决模型重叠
alpha: true, //背景透明
});
this.renderer.shadowMap.enabled = true;
this.renderer.shadowMap.type = THREE.PCFSoftShadowMap; // 设置投影类型, 这边的柔和投影
this.renderer.setSize(screenW, screenH);
threeDom.appendChild(this.renderer.domElement);
this._Light();
this.css2controls();
// controls.autoRotate = true
this.controls.minDistance = 500;
this.controls.maxDistance = 1000;
this.controls.maxPolarAngle = 1.3;
this.controls.minPolarAngle = 0.5;
// if(process.env.NODE_ENV == 'development'){
// // this.initGui()
// }
// initGui()
this.animation();
},
},
};
</script>
<style lang="less" scoped>
#counter {
position: relative;
}
</style>
\ No newline at end of file
......@@ -61,7 +61,9 @@
</div>
</div>
</div>
<div class="center"></div>
<div class="center">
<Three class="three" :lv="lv" :floorArr="floorArr"></Three>
</div>
<div class="right">
<div class="right-content">
<!-- 设备告警汇总 -->
......@@ -95,13 +97,13 @@
</div>
<div class="warning-info-item2">
<div class="item2-info">
<div class="title">危险</div>
<div class="title">次要</div>
<div class="percent">24%</div>
</div>
</div>
<div class="warning-info-item1">
<div class="item1-info">
<div class="title">危险</div>
<div class="title">一般</div>
<div class="percent">24%</div>
</div>
</div>
......@@ -126,10 +128,12 @@
<script>
import HeaderSite from "./components/HeaderSite.vue";
import TitleItem from "./components/TitleItem.vue";
import Three from "@/components/three/Three.vue";
export default {
components: {
HeaderSite,
TitleItem,
Three,
},
data() {
return {
......@@ -217,12 +221,46 @@ export default {
["一楼排号机", "5", "15:00", "在线"],
],
},
floorArr: [],
lv: "1",
};
},
mounted() {
this.getDevTypeDisEchart();
this.getWarningDisEchart();
this.getManufacturersTopEchart();
setTimeout(() => {
this.floorArr = [
{
id: 4,
building: 1,
lv: 1,
picture: "",
phonepicture: "",
mtl_url: "/uploads/floor/yibin2/L1.mtl",
obj_url: "/uploads/floor/L1-1/L1-1.gltf",
siteid: 1,
type: 1,
create_time: "2023-03-13 11:32:38",
update_time: "2023-04-08 11:40:07",
zip_url: "/uploads/floor/L1-1/L1-1.zip",
},
{
id: 5,
building: 1,
lv: 2,
picture: "",
phonepicture: "",
mtl_url: "/uploads/floor/yibin/L2.mtl",
obj_url: "/uploads/floor/L2-1/L2-1.gltf",
siteid: 1,
type: 1,
create_time: "2023-03-13 16:54:14",
update_time: "2023-04-08 11:40:21",
zip_url: "/uploads/floor/L2-1/L2-1.zip",
},
];
});
},
methods: {
// 获取设备类型分布图标
......@@ -430,7 +468,7 @@ export default {
grid: {
top: "0px",
left: "0px",
right: "20px",
right: "0px",
bottom: "-30px",
containLabel: true,
},
......@@ -551,7 +589,7 @@ export default {
},
},
{
// 分隔
// 分隔背景
type: "pictorialBar",
itemStyle: {
color: "#022539",
......@@ -582,10 +620,9 @@ export default {
<style lang="less" scoped>
.analysis {
width: 100%;
height: 100%;
padding-bottom: 40px;
height: 1080px;
background: url("../../assets/images/data/bg.png") no-repeat center;
background-size: 100% 100%;
background-size: 100% 1080px;
color: #fff;
.header {
width: 100%;
......@@ -650,9 +687,13 @@ export default {
.left {
width: 500px;
height: 100%;
position: relative;
}
.left-centent {
width: 100%;
position: absolute;
left: 0px;
top: -20px;
.dev-total {
height: 120px;
}
......@@ -679,12 +720,22 @@ export default {
background-size: 100% 100%;
}
}
.center {
// .three {
// height: 500px;
// width: 500px;
// }
}
.right {
width: 500px;
height: 100%;
position: relative;
}
.right-content {
width: 500px;
position: absolute;
left: 0px;
top: -20px;
.warning-rank-info {
height: 188px;
background: url("~@/assets/images/data/kuang2.png") no-repeat center;
......
......@@ -9076,6 +9076,11 @@ thread-loader@^2.1.3:
loader-utils "^1.1.0"
neo-async "^2.6.0"
three@^0.152.2:
version "0.152.2"
resolved "https://registry.npmmirror.com/three/-/three-0.152.2.tgz#2ee0f2c504d31a4bc29b45495c12bded9fda7bfc"
integrity sha512-Ff9zIpSfkkqcBcpdiFo2f35vA9ZucO+N8TNacJOqaEE6DrB0eufItVMib8bK8Pcju/ZNT6a7blE1GhTpkdsILw==
throttle-debounce@^1.0.1:
version "1.1.0"
resolved "https://registry.nlark.com/throttle-debounce/download/throttle-debounce-1.1.0.tgz"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment