修改转发配置

main
fanluyan 6 months ago
parent e0240c3f1d
commit 01f5f22e17

@ -1,6 +1,8 @@
# base api # base api
# VUE_APP_API_URL = 'http://192.168.145.232:8884/frame-boot-control' # VUE_APP_API_URL = 'http://192.168.145.232:8884/frame-boot-control'
# VUE_APP_API_URL = 'http://192.168.129.88:8882/frame-boot-control' # VUE_APP_API_URL = 'http://192.168.129.88:8882/frame-boot-control'
VUE_APP_BASE_API = '/dev-api' # VUE_APP_BASE_API = '/dev-api'
VUE_APP_MODEL_API = '/api/modelFile' #VUE_APP_MODEL_API = '/api/modelFile'
VUE_APP_BASE_API = '/jkpg-api'
VUE_APP_MODEL_API = '/api/api/modelFile'
VUE_CLI_BABEL_TRANSPILE_MODULES = true VUE_CLI_BABEL_TRANSPILE_MODULES = true

@ -2,8 +2,8 @@ module.exports = {
/** /**
* @description 系统标题,icon * @description 系统标题,icon
*/ */
title: '欣影大数据', title: "欣影大数据",
logo: 'http://www.huatek.com/imgs/home_logo.png', logo: "http://www.huatek.com/imgs/home_logo.png",
/** /**
* @type {boolean} true | false * @type {boolean} true | false
* @description 是否固定导航栏到顶部 * @description 是否固定导航栏到顶部
@ -20,11 +20,10 @@ module.exports = {
* 是否使用阿里云OSS文件存储 * 是否使用阿里云OSS文件存储
*/ */
OSSConfig: { OSSConfig: {
accessKeyId: 'LTAILVNVeJZkF4PV', accessKeyId: "LTAILVNVeJZkF4PV",
accessKeySecret: 'YKBrFuyEQQJBXRklt4kIVS3vwS5q4U', accessKeySecret: "YKBrFuyEQQJBXRklt4kIVS3vwS5q4U",
region: 'huatek-oss.oss-cn-beijing.aliyuncs.com', region: "huatek-oss.oss-cn-beijing.aliyuncs.com",
bucket: 'huatek-oss' bucket: "huatek-oss",
}, },
InfraredPic: "http://192.168.135.81:88", InfraredPic: "http://192.168.135.81:88",
@ -36,7 +35,7 @@ module.exports = {
development: { development: {
// VUE_APP_API_URL: 'http://172.16.12.215:7000',//佳佳 // VUE_APP_API_URL: 'http://172.16.12.215:7000',//佳佳
// VUE_APP_API_URL: 'http://172.16.12.81:7000',//定海 // VUE_APP_API_URL: 'http://172.16.12.81:7000',//定海
VUE_APP_API_URL: 'http://127.0.0.1:7000', VUE_APP_API_URL: "/jkpg-api",
// VUE_APP_API_URL: 'http://172.16.12.226:7000', // VUE_APP_API_URL: 'http://172.16.12.226:7000',
// VUE_APP_API_URL: 'http://222.90.232.142:8171/prod-api', // VUE_APP_API_URL: 'http://222.90.232.142:8171/prod-api',
// VUE_APP_API_URL: 'http://192.168.1.22:8084', // VUE_APP_API_URL: 'http://192.168.1.22:8084',
@ -47,7 +46,8 @@ module.exports = {
// VUE_APP_API_URL_TOW: 'http://127.0.0.1:8080/busi-back-control' // VUE_APP_API_URL_TOW: 'http://127.0.0.1:8080/busi-back-control'
}, },
production: { //h后台代码的访问接口 production: {
//h后台代码的访问接口
// VUE_APP_API_URL: 'http://10.78.34.40:8085' // VUE_APP_API_URL: 'http://10.78.34.40:8085'
// 测试环境 // 测试环境
@ -57,7 +57,8 @@ module.exports = {
// VUE_APP_API_URL: 'http://127.0.0.1:7000', // VUE_APP_API_URL: 'http://127.0.0.1:7000',
// 宜兴 // 宜兴
VUE_APP_API_URL: 'http://192.168.1.22:8084', //VUE_APP_API_URL: "http://192.168.1.22:8084",
VUE_APP_API_URL: "/jkpg-api",
//中广核 //中广核
// VUE_APP_API_URL: 'http://192.168.1.47:8080', // VUE_APP_API_URL: 'http://192.168.1.47:8080',
@ -80,10 +81,9 @@ module.exports = {
// VUE_APP_API_URL: 'http://192.168.1.12:7000', // VUE_APP_API_URL: 'http://192.168.1.12:7000',
// VUE_APP_API_URL: 'http://192.168.128.25:8084', // VUE_APP_API_URL: 'http://192.168.128.25:8084',
}, },
test: { test: {
VUE_APP_API_URL: 'http://192.168.1.161:8088', VUE_APP_API_URL: "http://192.168.1.161:8088",
} },
} },
} };

@ -17,23 +17,23 @@
</template> </template>
<script> <script>
import * as THREE from 'three' import * as THREE from "three";
import C3S3D from '@/utils/c3s-3d-1.0.1-e' import C3S3D from "@/utils/c3s-3d-1.0.1-e";
import { TWEEN } from 'three/examples/jsm/libs/tween.module.min.js' import { TWEEN } from "three/examples/jsm/libs/tween.module.min.js";
// //
import { import {
CAMERA_MOVE_DATA, CAMERA_MOVE_DATA,
getTenToSixteenColor, getTenToSixteenColor,
getPointData getPointData,
} from '@/utils/modelData.js' } from "@/utils/modelData.js";
export default { export default {
name: 'HelloWorld', name: "HelloWorld",
components: {}, components: {},
props: { props: {
modelType: { modelType: {
type: String, type: String,
default: () => 'byq' default: () => "byq",
} },
}, },
data() { data() {
return { return {
@ -55,7 +55,7 @@ export default {
cz: 6000, cz: 6000,
tx: 0, tx: 0,
ty: 0, ty: 0,
tz: 1200 tz: 1200,
}, // }, //
{ {
time: 1200, time: 1200,
@ -64,8 +64,8 @@ export default {
cz: 1500, cz: 1500,
tx: 0, tx: 0,
ty: 0, ty: 0,
tz: 0 tz: 0,
} },
], ],
gisMoveData: [ gisMoveData: [
{ {
@ -75,7 +75,7 @@ export default {
cz: 6000, cz: 6000,
tx: 0, tx: 0,
ty: 800, ty: 800,
tz: 1000 tz: 1000,
}, // }, //
{ {
time: 1200, time: 1200,
@ -84,74 +84,74 @@ export default {
cz: 1000, cz: 1000,
tx: 0, tx: 0,
ty: 0, ty: 0,
tz: 0 tz: 0,
} },
], ],
geometry: null, geometry: null,
modelDataObj: null, modelDataObj: null,
filePath: null, filePath: null,
modelSiteId: {} modelSiteId: {},
} };
}, },
watch: { watch: {
modelType: function (val) { modelType: function (val) {
this.clearModel() this.clearModel();
C3S3D.destory(this.ThreeObjs) C3S3D.destory(this.ThreeObjs);
// this.modelCurrent(val); // this.modelCurrent(val);
// this.createdInit(); // this.createdInit();
this.mountedGetData() this.mountedGetData();
} },
}, },
created() { created() {
const modelParameter = JSON.parse(localStorage.getItem('getModelList')) const modelParameter = JSON.parse(localStorage.getItem("getModelList"));
for (let index = 0; index < modelParameter.length; index++) { for (let index = 0; index < modelParameter.length; index++) {
const element = modelParameter[index] const element = modelParameter[index];
if (element.modelType == '211') { if (element.modelType == "211") {
this.modelDataObj = JSON.parse(element.modelParams) this.modelDataObj = JSON.parse(element.modelParams);
this.modelSiteId = element this.modelSiteId = element;
this.filePath = element.filePath this.filePath = element.filePath;
break break;
} }
} }
}, },
mounted() { mounted() {
this.mountedGetData() this.mountedGetData();
}, },
beforeDestroy() { beforeDestroy() {
C3S3D.destory(this.ThreeObjs) C3S3D.destory(this.ThreeObjs);
}, },
methods: { methods: {
mountedGetData() { mountedGetData() {
this.$store.dispatch('getModelData').then(() => { this.$store.dispatch("getModelData").then(() => {
const type = this.modelType == 'byq' ? '111' : '211' const type = this.modelType == "byq" ? "111" : "211";
const modelParameter = JSON.parse(localStorage.getItem('getModelList')) const modelParameter = JSON.parse(localStorage.getItem("getModelList"));
console.log('-5-95-5-5-5', modelParameter, type) console.log("-5-95-5-5-5", modelParameter, type);
for (let index = 0; index < modelParameter.length; index++) { for (let index = 0; index < modelParameter.length; index++) {
const element = modelParameter[index] const element = modelParameter[index];
if (element.modelType == type) { if (element.modelType == type) {
this.modelDataObj = JSON.parse(element.modelParams) this.modelDataObj = JSON.parse(element.modelParams);
this.filePath = element.filePath this.filePath = element.filePath;
break break;
} }
} }
console.log(!this.modelDataObj, 'wqeqweqewqe') console.log(!this.modelDataObj, "wqeqweqewqe");
if (!this.modelDataObj) { if (!this.modelDataObj) {
this.$bus.$emit('animateState', true) this.$bus.$emit("animateState", true);
return return;
} }
this.$nextTick(() => { this.$nextTick(() => {
this.createdInit() this.createdInit();
}) });
}) });
}, },
createdInit() { createdInit() {
this.modelDataInit() this.modelDataInit();
this.init() this.init();
}, },
modelDataInit() { modelDataInit() {
const data = this.modelDataObj const data = this.modelDataObj;
this.modelData = { this.modelData = {
modelName: '111', // modelName: "111", //
modelZoom: data.modelZoom, // modelZoom: data.modelZoom, //
modelDraco: true, // Draco modelDraco: true, // Draco
modelRotateAct: data.modelRotateAct, // modelRotateAct: data.modelRotateAct, //
@ -161,41 +161,41 @@ export default {
rotationVal: data.rotation, rotationVal: data.rotation,
Point: { Point: {
color: data.pointLight.color, color: data.pointLight.color,
intensity: data.pointLight.intensity intensity: data.pointLight.intensity,
}, },
Ambient: { Ambient: {
color: data.ambientLight.color, color: data.ambientLight.color,
intensity: data.ambientLight.intensity intensity: data.ambientLight.intensity,
}, },
pointIntensity: 0.3 pointIntensity: 0.3,
} };
}, },
// //
init: function () { init: function () {
const data = this.modelData const data = this.modelData;
this.modelState = true this.modelState = true;
const lightList = [ const lightList = [
// //
{ {
type: 'Ambient', type: "Ambient",
color: getTenToSixteenColor(data.Ambient.color), color: getTenToSixteenColor(data.Ambient.color),
intensity: data.Ambient.intensity intensity: data.Ambient.intensity,
} },
] ];
// //
const pointData = getPointData( const pointData = getPointData(
data.Point.intensity, data.Point.intensity,
getTenToSixteenColor(data.Point.color) getTenToSixteenColor(data.Point.color)
) );
if (pointData) { if (pointData) {
for (let index = 0; index < pointData.length; index++) { for (let index = 0; index < pointData.length; index++) {
const element = pointData[index] const element = pointData[index];
lightList.push({ lightList.push({
type: 'Point', type: "Point",
color: element.color, color: element.color,
intensity: element.intensity, intensity: element.intensity,
position: element.position position: element.position,
}) });
} }
} }
this.ThreeObjs = C3S3D.init({ this.ThreeObjs = C3S3D.init({
@ -207,21 +207,21 @@ export default {
position: [ position: [
data.cameraPosition.x, data.cameraPosition.x,
data.cameraPosition.y, data.cameraPosition.y,
data.cameraPosition.z data.cameraPosition.z,
] ],
}, },
controls: { controls: {
noRotate: false, noRotate: false,
autoRotate: true, autoRotate: true,
autoRotateSpeed: 2 autoRotateSpeed: 2,
}, },
renderer: { renderer: {
alpha: 0 alpha: 0,
}, },
// css3dRenderer: {}, // css3dRenderer: {},
light: lightList, light: lightList,
update: (dt) => { update: (dt) => {
this.update(dt) this.update(dt);
}, },
// //
clickCallback: (e) => { clickCallback: (e) => {
@ -231,14 +231,14 @@ export default {
dblclickCallback: () => {}, dblclickCallback: () => {},
// //
mousemoveCallback: (e) => { mousemoveCallback: (e) => {
this.onMouseMove(e) this.onMouseMove(e);
}, },
// //
mousedownCallback: () => {} mousedownCallback: () => {},
}) });
this.loadGltf() this.loadGltf();
this.initOutline() this.initOutline();
}, },
update() { update() {
// C3S3D.update(this.ThreeObjs); // C3S3D.update(this.ThreeObjs);
@ -252,30 +252,30 @@ export default {
pulsePeriod: 5, pulsePeriod: 5,
visibleEdgeColor: 0x00ff00, visibleEdgeColor: 0x00ff00,
hiddenEdgeColor: 0x00ff00, hiddenEdgeColor: 0x00ff00,
downSampleRatio: 1 downSampleRatio: 1,
}) });
}, },
// //
clearModel() { clearModel() {
// //
if (this.ThreeObjs.scene !== null) { if (this.ThreeObjs.scene !== null) {
// divcanvascanvas // divcanvascanvas
const domDiv = document.getElementById('modelContainers') const domDiv = document.getElementById("modelContainers");
if (domDiv !== null) { if (domDiv !== null) {
domDiv.removeChild(domDiv.firstChild) domDiv.removeChild(domDiv.firstChild);
} }
// 3D // 3D
window.cancelAnimationFrame(stop) // window.cancelAnimationFrame(stop); //
this.ThreeObjs.scene = null this.ThreeObjs.scene = null;
this.ThreeObjs.camera = null this.ThreeObjs.camera = null;
this.ThreeObjs.renderer = null this.ThreeObjs.renderer = null;
this.ThreeObjs.orbitControls = null this.ThreeObjs.orbitControls = null;
} }
}, },
loadGltf() { loadGltf() {
const group = new THREE.Object3D() const group = new THREE.Object3D();
this.ThreeObjs.scene.add(group) this.ThreeObjs.scene.add(group);
C3S3D.loadGltf({ C3S3D.loadGltf({
// url: // url:
// process.env.VUE_APP_MODEL_API + // process.env.VUE_APP_MODEL_API +
@ -288,37 +288,37 @@ export default {
rotation: { rotation: {
x: C3S3D.toRadian(this.modelData.rotationVal.x), x: C3S3D.toRadian(this.modelData.rotationVal.x),
y: C3S3D.toRadian(this.modelData.rotationVal.y), y: C3S3D.toRadian(this.modelData.rotationVal.y),
z: C3S3D.toRadian(this.modelData.rotationVal.z) z: C3S3D.toRadian(this.modelData.rotationVal.z),
}, },
draco: this.modelData.modelDraco, draco: this.modelData.modelDraco,
onProgress: (percentage, val) => { onProgress: (percentage, val) => {
if (percentage >= 100) { if (percentage >= 100) {
this.loading = false this.loading = false;
} }
}, },
onLoad: (geometry) => { onLoad: (geometry) => {
this.geometry = geometry this.geometry = geometry;
this.modelState = false this.modelState = false;
if (this.modelType == 'byq') { if (this.modelType == "byq") {
this.startAutoPatrol(this.geometry, this.byqMoveData) this.startAutoPatrol(this.geometry, this.byqMoveData);
} else { } else {
this.startAutoPatrol(this.geometry, this.gisMoveData) this.startAutoPatrol(this.geometry, this.gisMoveData);
} }
} },
}) });
}, },
onMouseClick(event) { onMouseClick(event) {
const selectObject = C3S3D.getIntersectsFirstMesh( const selectObject = C3S3D.getIntersectsFirstMesh(
event, event,
this.ThreeObjs, this.ThreeObjs,
this.ThreeObjs.scene.children this.ThreeObjs.scene.children
) );
if (selectObject) { if (selectObject) {
// //
C3S3D.outlineLight(this.ThreeObjs, [selectObject]) C3S3D.outlineLight(this.ThreeObjs, [selectObject]);
// C3S3D.spreadLeftAndRight(this.geometry, 1, 100, 0, 1000); // C3S3D.spreadLeftAndRight(this.geometry, 1, 100, 0, 1000);
} else { } else {
C3S3D.outlineLight(this.ThreeObjs, []) C3S3D.outlineLight(this.ThreeObjs, []);
} }
}, },
// //
@ -327,24 +327,24 @@ export default {
event, event,
this.ThreeObjs, this.ThreeObjs,
this.ThreeObjs.scene.children this.ThreeObjs.scene.children
) );
if (this.modelData.modelRotateAct) { if (this.modelData.modelRotateAct) {
if (selectObject) { if (selectObject) {
this.ThreeObjs.orbitControls.autoRotate = false this.ThreeObjs.orbitControls.autoRotate = false;
} else { } else {
this.ThreeObjs.orbitControls.autoRotate = true this.ThreeObjs.orbitControls.autoRotate = true;
} }
} }
}, },
startAutoPatrol(val, data) { startAutoPatrol(val, data) {
this.patrolPoints = data this.patrolPoints = data;
this.patrolIndex = 0 this.patrolIndex = 0;
this.doPatrol(this.patrolPoints[this.patrolIndex]) this.doPatrol(this.patrolPoints[this.patrolIndex]);
}, },
// //
doPatrol(point) { doPatrol(point) {
const cameraPos = this.ThreeObjs.camera.position.clone() const cameraPos = this.ThreeObjs.camera.position.clone();
const targetPos = this.ThreeObjs.orbitControls.target.clone() const targetPos = this.ThreeObjs.orbitControls.target.clone();
this.patrolTween = C3S3D.createTween({ this.patrolTween = C3S3D.createTween({
start: { start: {
cx: cameraPos.x, cx: cameraPos.x,
@ -352,7 +352,7 @@ export default {
cz: cameraPos.z, cz: cameraPos.z,
tx: targetPos.x, tx: targetPos.x,
ty: targetPos.y, ty: targetPos.y,
tz: targetPos.z tz: targetPos.z,
}, },
to: { to: {
cx: point.cx, cx: point.cx,
@ -360,36 +360,36 @@ export default {
cz: point.cz, cz: point.cz,
tx: point.tx, tx: point.tx,
ty: point.ty, ty: point.ty,
tz: point.tz tz: point.tz,
}, },
duration: point.time, duration: point.time,
delayTime: 1, delayTime: 1,
onUpdate: (obj) => { onUpdate: (obj) => {
this.ThreeObjs.camera.position.set(obj.cx, obj.cy, obj.cz) this.ThreeObjs.camera.position.set(obj.cx, obj.cy, obj.cz);
this.ThreeObjs.orbitControls.target.set(obj.tx, obj.ty, obj.tz) this.ThreeObjs.orbitControls.target.set(obj.tx, obj.ty, obj.tz);
}, },
onComplete: () => { onComplete: () => {
this.patrolTween = null this.patrolTween = null;
this.patrolIndex++ this.patrolIndex++;
if (this.patrolIndex >= this.patrolPoints.length) { if (this.patrolIndex >= this.patrolPoints.length) {
// //
return return;
} }
}, },
easing: TWEEN.Easing.Linear.None easing: TWEEN.Easing.Linear.None,
}) });
}, },
// //
startAutoPatrol(val, data) { startAutoPatrol(val, data) {
this.patrolPoints = data this.patrolPoints = data;
this.patrolIndex = 0 this.patrolIndex = 0;
this.doPatrol(this.patrolPoints[this.patrolIndex]) this.doPatrol(this.patrolPoints[this.patrolIndex]);
}, },
// //
doPatrol(point) { doPatrol(point) {
const cameraPos = this.ThreeObjs.camera.position.clone() const cameraPos = this.ThreeObjs.camera.position.clone();
const targetPos = this.ThreeObjs.orbitControls.target.clone() const targetPos = this.ThreeObjs.orbitControls.target.clone();
this.patrolTween = C3S3D.createTween({ this.patrolTween = C3S3D.createTween({
start: { start: {
cx: cameraPos.x, cx: cameraPos.x,
@ -397,7 +397,7 @@ export default {
cz: cameraPos.z, cz: cameraPos.z,
tx: targetPos.x, tx: targetPos.x,
ty: targetPos.y, ty: targetPos.y,
tz: targetPos.z tz: targetPos.z,
}, },
to: { to: {
cx: point.cx, cx: point.cx,
@ -405,29 +405,29 @@ export default {
cz: point.cz, cz: point.cz,
tx: point.tx, tx: point.tx,
ty: point.ty, ty: point.ty,
tz: point.tz tz: point.tz,
}, },
duration: point.time, duration: point.time,
delayTime: 1, delayTime: 1,
onUpdate: (obj) => { onUpdate: (obj) => {
this.ThreeObjs.camera.position.set(obj.cx, obj.cy, obj.cz) this.ThreeObjs.camera.position.set(obj.cx, obj.cy, obj.cz);
this.ThreeObjs.orbitControls.target.set(obj.tx, obj.ty, obj.tz) this.ThreeObjs.orbitControls.target.set(obj.tx, obj.ty, obj.tz);
}, },
onComplete: () => { onComplete: () => {
this.patrolTween = null this.patrolTween = null;
this.patrolIndex++ this.patrolIndex++;
if (this.patrolIndex >= this.patrolPoints.length) { if (this.patrolIndex >= this.patrolPoints.length) {
this.moveSatate = true this.moveSatate = true;
this.$bus.$emit('animateState', true) this.$bus.$emit("animateState", true);
return return;
} }
this.doPatrol(this.patrolPoints[this.patrolIndex]) this.doPatrol(this.patrolPoints[this.patrolIndex]);
}, },
easing: TWEEN.Easing.Linear.None easing: TWEEN.Easing.Linear.None,
}) });
} },
} },
} };
</script> </script>
<style lang="scss"> <style lang="scss">

@ -42,7 +42,13 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item v-if="modelType != 'dixingmodel_draco' && modelType != 'bdzgmodel_draco' " label="传感器列表" prop="sensorId"> <el-form-item
v-if="
modelType != 'dixingmodel_draco' && modelType != 'bdzgmodel_draco'
"
label="传感器列表"
prop="sensorId"
>
<el-select v-model="fields.sensorId" @change="selectSensor"> <el-select v-model="fields.sensorId" @change="selectSensor">
<el-option <el-option
v-for="(item, key) in sensorTypeList" v-for="(item, key) in sensorTypeList"
@ -60,7 +66,13 @@
maxlength="64" maxlength="64"
/> />
</el-form-item> </el-form-item>
<el-form-item v-if="modelType != 'dixingmodel_draco' && modelType != 'bdzgmodel_draco' " label="检测数据" prop="dataItems"> <el-form-item
v-if="
modelType != 'dixingmodel_draco' && modelType != 'bdzgmodel_draco'
"
label="检测数据"
prop="dataItems"
>
<el-select <el-select
v-model="fields.dataItems" v-model="fields.dataItems"
multiple multiple
@ -97,170 +109,172 @@
</template> </template>
<script> <script>
import form from './form' import form from "./form";
import { import {
selectDeviceListByModelType, selectDeviceListByModelType,
selectMasterStationDeviceListByModelType, selectMasterStationDeviceListByModelType,
selectDataltemsByDeviceCode, selectDataltemsByDeviceCode,
selectMainEquipmentListByModelType, selectMainEquipmentListByModelType,
selectSensors selectSensors,
} from '@/api/system' } from "@/api/system";
export default { export default {
name: 'OrgUpdate', name: "OrgUpdate",
props: { props: {
value: { value: {
type: Object, type: Object,
default: () => Object.create({}) default: () => Object.create({}),
}, },
selectData: { selectData: {
type: Object, type: Object,
default: () => Object.create({}) default: () => Object.create({}),
}, },
routerParams: { routerParams: {
type: Object, type: Object,
default: () => Object.create({}) default: () => Object.create({}),
}, },
deviceType: { deviceType: {
type: String, type: String,
default: () => '' default: () => "",
}, },
modelType: { modelType: {
type: String, type: String,
default: () => '' default: () => "",
} },
}, },
data() { data() {
return { return {
...form(this, this.value), ...form(this, this.value),
isShow: true, isShow: true,
loading: false, loading: false,
title: `${this.value.id ? '编辑' : '新建'}部件数据`, title: `${this.value.id ? "编辑" : "新建"}部件数据`,
deviceTypeList: [], deviceTypeList: [],
statusList: [ statusList: [
{ {
name: '启用', name: "启用",
id: '1' id: "1",
}, },
{ {
name: '禁用', name: "禁用",
id: '0' id: "0",
} },
], ],
mainTreeList: [], mainTreeList: [],
dataItemList: [], dataItemList: [],
sensorTypeList: [], sensorTypeList: [],
selectsbData: {}, selectsbData: {},
selectzzData: {}, selectzzData: {},
selectcgqData: {} selectcgqData: {},
} };
}, },
watch: { watch: {
isShow: function () { isShow: function () {
this.$emit('input', null) this.$emit("input", null);
} },
}, },
created() { created() {
this.getMainTreeList() this.getMainTreeList();
this.fields.componentId = this.value.id this.fields.componentId = this.value.id
? this.value.componentId ? this.value.componentId
: this.selectData.name : this.selectData.name;
this.fields.positionX = this.selectData.positionX || '' this.fields.positionX = this.selectData.positionX || "";
this.fields.positionY = this.selectData.positionY || '' this.fields.positionY = this.selectData.positionY || "";
this.fields.positionZ = this.selectData.positionZ || '' this.fields.positionZ = this.selectData.positionZ || "";
// //
if (this.value.id) { if (this.value.id) {
this.loading = true this.loading = true;
this.fields.dataItems = [] this.fields.dataItems = [];
for (let index = 0; index < this.value.dataItems.length; index++) { for (let index = 0; index < this.value.dataItems.length; index++) {
const element = this.value.dataItems[index] const element = this.value.dataItems[index];
this.fields.dataItems.push(element.itemCode) this.fields.dataItems.push(element.itemCode);
} }
// //
Promise.all([ Promise.all([
this.getDeviceListByModelType('init'), this.getDeviceListByModelType("init"),
this.getSensorList(this.value) this.getSensorList(this.value),
]) ])
.then((result) => { .then((result) => {
this.loading = false this.loading = false;
}) })
.catch(() => { .catch(() => {
this.loading = false this.loading = false;
}) });
} }
}, },
mounted() { mounted() {},
},
methods: { methods: {
onOkBtnClick() { onOkBtnClick() {
this.submitForm() this.submitForm();
}, },
// //
getDeviceListByModelType(type) { getDeviceListByModelType(type) {
if (this.modelType != 'dixingmodel_draco' && this.modelType != 'bdzgmodel_draco') { if (
this.modelType != "dixingmodel_draco" &&
this.modelType != "bdzgmodel_draco"
) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const parmas = { const parmas = {
modelType: this.routerParams.modelType, modelType: this.routerParams.modelType,
siteId: this.routerParams.siteId siteId: this.routerParams.siteId,
} };
selectDeviceListByModelType(parmas).then((res) => { selectDeviceListByModelType(parmas).then((res) => {
if (res.code == 0) { if (res.code == 0) {
this.deviceTypeList = res.data this.deviceTypeList = res.data;
resolve() resolve();
} else { } else {
reject() reject();
} }
}) });
}) });
} else { } else {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const parmas = { const parmas = {
modelType: this.deviceType, modelType: this.deviceType,
id: this.fields.mainTreeId id: this.fields.mainTreeId,
} };
selectMasterStationDeviceListByModelType(parmas).then((res) => { selectMasterStationDeviceListByModelType(parmas).then((res) => {
if (res.code == 0) { if (res.code == 0) {
this.deviceTypeList = res.data this.deviceTypeList = res.data;
resolve() resolve();
} else { } else {
reject() reject();
} }
}) });
}) });
} }
}, },
isEmptyObject(obj) { isEmptyObject(obj) {
return Object.keys(obj).length === 0 return Object.keys(obj).length === 0;
}, },
// //
async getAllDeviceCode(val, amplType) { async getAllDeviceCode(val, amplType) {
// //
let valAmplType = null let valAmplType = null;
if (!this.isEmptyObject(this.value)) { if (!this.isEmptyObject(this.value)) {
for (let index = 0; index < this.sensorTypeList.length; index++) { for (let index = 0; index < this.sensorTypeList.length; index++) {
const element = this.sensorTypeList[index] const element = this.sensorTypeList[index];
if (this.value.sensorId == element.id) { if (this.value.sensorId == element.id) {
valAmplType = element.amplType valAmplType = element.amplType;
break break;
} }
} }
} }
const parmas = { const parmas = {
deviceCode: val, deviceCode: val,
amplType: amplType || valAmplType || null amplType: amplType || valAmplType || null,
} };
const res = await selectDataltemsByDeviceCode(parmas) const res = await selectDataltemsByDeviceCode(parmas);
this.dataItemList = res.data this.dataItemList = res.data;
}, },
// //
async getMainTreeList() { async getMainTreeList() {
const parmas = { const parmas = {
modelType: this.routerParams.modelType, modelType: this.routerParams.modelType,
siteId: this.routerParams.siteId siteId: this.routerParams.siteId,
} };
const res = await selectMainEquipmentListByModelType(parmas) const res = await selectMainEquipmentListByModelType(parmas);
this.mainTreeList = res.data this.mainTreeList = res.data;
}, },
// //
getSensorList(data) { getSensorList(data) {
@ -268,144 +282,149 @@ export default {
const parmas = { const parmas = {
deviceCode: data ? data.deviceCode : this.selectzzData.deviceCode, deviceCode: data ? data.deviceCode : this.selectzzData.deviceCode,
mainTreeId: data ? data.mainTreeId : this.selectsbData.id, mainTreeId: data ? data.mainTreeId : this.selectsbData.id,
modelType: this.routerParams.modelType modelType: this.routerParams.modelType,
} };
selectSensors(parmas).then((res) => { selectSensors(parmas).then((res) => {
if (res.code == 0) { if (res.code == 0) {
this.sensorTypeList = res.data this.sensorTypeList = res.data;
if (this.value.id && data) { if (this.value.id && data) {
// //
for (let index = 0; index < this.deviceTypeList.length; index++) { for (let index = 0; index < this.deviceTypeList.length; index++) {
const element = this.deviceTypeList[index] const element = this.deviceTypeList[index];
if (element.deviceCode == this.value.deviceCode) { if (element.deviceCode == this.value.deviceCode) {
this.getAllDeviceCode(element.deviceCode) this.getAllDeviceCode(element.deviceCode);
} }
} }
} }
resolve() resolve();
} else { } else {
reject() reject();
} }
}) });
}) });
}, },
selectDeviceType(val) { selectDeviceType(val) {
for (let index = 0; index < this.deviceTypeList.length; index++) { for (let index = 0; index < this.deviceTypeList.length; index++) {
const element = this.deviceTypeList[index] const element = this.deviceTypeList[index];
if (element.deviceCode == val) { if (element.deviceCode == val) {
this.selectzzData = element this.selectzzData = element;
} }
} }
if (this.fields.sensorId != '') { if (this.fields.sensorId != "") {
this.sensorTypeList = [] this.sensorTypeList = [];
this.$set(this.fields, 'sensorId', '') this.$set(this.fields, "sensorId", "");
} }
if (this.fields.dataItems.length != 0) { if (this.fields.dataItems.length != 0) {
this.dataItemList = [] this.dataItemList = [];
this.$set(this.fields, 'dataItems', []) this.$set(this.fields, "dataItems", []);
} }
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.form.clearValidate(['sensorId', 'dataItems']) this.$refs.form.clearValidate(["sensorId", "dataItems"]);
}) });
// //
this.getSensorList() this.getSensorList();
// //
if ( if (
this.modelType != 'fdjmodel_draco' && this.modelType != "fdjmodel_draco" &&
this.fields.deviceCode != 'zd' this.fields.deviceCode != "zd"
) { ) {
this.getAllDeviceCode(this.selectzzData.deviceCode) this.getAllDeviceCode(this.selectzzData.deviceCode);
} }
}, },
selectMainTree(val) { selectMainTree(val) {
for (let index = 0; index < this.mainTreeList.length; index++) { for (let index = 0; index < this.mainTreeList.length; index++) {
const element = this.mainTreeList[index] const element = this.mainTreeList[index];
if (element.id == val) { if (element.id == val) {
this.selectsbData = element this.selectsbData = element;
} }
} }
if (this.fields.deviceCode != '') { if (this.fields.deviceCode != "") {
this.deviceTypeList = [] this.deviceTypeList = [];
this.$set(this.fields, 'deviceCode', '') this.$set(this.fields, "deviceCode", "");
} }
if (this.fields.sensorId != '') { if (this.fields.sensorId != "") {
this.sensorTypeList = [] this.sensorTypeList = [];
this.$set(this.fields, 'sensorId', '') this.$set(this.fields, "sensorId", "");
} }
if (this.fields.dataItems.length != 0) { if (this.fields.dataItems.length != 0) {
this.dataItemList = [] this.dataItemList = [];
this.$set(this.fields, 'dataItems', []) this.$set(this.fields, "dataItems", []);
} }
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.form.clearValidate(['sensorId', 'dataItems', 'deviceCode']) this.$refs.form.clearValidate(["sensorId", "dataItems", "deviceCode"]);
}) });
// //
this.getDeviceListByModelType() this.getDeviceListByModelType();
}, },
selectSensor(val) { selectSensor(val) {
console.log("wos", val);
console.log(this.sensorTypeList);
for (let index = 0; index < this.sensorTypeList.length; index++) { for (let index = 0; index < this.sensorTypeList.length; index++) {
const element = this.sensorTypeList[index] const element = this.sensorTypeList[index];
if (element.id == val) { if (element.id == val) {
this.selectcgqData = element this.selectcgqData = element;
} }
} }
if ( if (
this.modelType == 'fdjmodel_draco' && this.modelType == "fdjmodel_draco" &&
this.fields.deviceCode == 'zd' this.fields.deviceCode == "zd"
) { ) {
this.fields.dataItems = [] this.fields.dataItems = [];
this.getAllDeviceCode( this.getAllDeviceCode(
this.selectzzData.deviceCode, this.selectzzData.deviceCode,
this.selectcgqData.amplType this.selectcgqData.amplType
) );
} else { } else {
this.getAllDeviceCode(this.selectzzData.deviceCode) this.getAllDeviceCode(this.selectzzData.deviceCode);
} }
}, },
// //
selectDataItems(val) { selectDataItems(val) {
this.fields.dataItems = val this.fields.dataItems = val;
}, },
removeTag(val) { removeTag(val) {
for (let index = 0; index < this.fields.dataItems.length; index++) { for (let index = 0; index < this.fields.dataItems.length; index++) {
const element = this.fields.dataItems[index] const element = this.fields.dataItems[index];
if (element == val) { if (element == val) {
this.fields.dataItems.splice(index, 1) this.fields.dataItems.splice(index, 1);
} }
} }
}, },
submitForm() { submitForm() {
this.$refs['form'].validate((valid) => { this.$refs["form"].validate((valid) => {
console.log(valid);
if (valid) { if (valid) {
const arr = [] const arr = [];
console.log(this.fields.dataItems);
console.log(this.dataItemList);
for (let index = 0; index < this.fields.dataItems.length; index++) { for (let index = 0; index < this.fields.dataItems.length; index++) {
const element = this.fields.dataItems[index] const element = this.fields.dataItems[index];
for (let i = 0; i < this.dataItemList.length; i++) { for (let i = 0; i < this.dataItemList.length; i++) {
const item = this.dataItemList[i] const item = this.dataItemList[i];
if (element == item.itemCode) { if (element == item.itemCode) {
arr.push(item) arr.push(item);
break break;
} }
} }
} }
const data = JSON.parse(JSON.stringify(this.fields)) const data = JSON.parse(JSON.stringify(this.fields));
data.id = this.value.id ? this.value.id : '' data.id = this.value.id ? this.value.id : "";
data.modelId = this.routerParams.modelId data.modelId = this.routerParams.modelId;
data.sensorNameDetail = this.selectcgqData.sensorNameDetail data.sensorNameDetail = this.selectcgqData.sensorNameDetail;
data.dataItems = arr data.dataItems = arr;
this.$emit('on-save', data) this.$emit("on-save", data);
this.isShow = false this.isShow = false;
} else { } else {
return false return false;
} }
}) });
}, },
resetForm() { resetForm() {
this.isShow = false this.isShow = false;
} },
} },
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "../../../../assets/stylesheet/index"; @import "../../../../assets/stylesheet/index";

@ -1,32 +1,32 @@
'use strict' "use strict";
const path = require('path') const path = require("path");
const defaultSettings = require('./settings.js') const defaultSettings = require("./settings.js");
const ENV = process.env.NODE_ENV.toLowerCase() const ENV = process.env.NODE_ENV.toLowerCase();
console.log(ENV) console.log(ENV);
const API_CONFIG = defaultSettings.API[ENV] || {} const API_CONFIG = defaultSettings.API[ENV] || {};
console.log(API_CONFIG) console.log(API_CONFIG);
// https://cli.vuejs.org/guide/mode-and-env.html#using-env-variables-in-client-side-code // https://cli.vuejs.org/guide/mode-and-env.html#using-env-variables-in-client-side-code
Object.keys(API_CONFIG).forEach(key => { Object.keys(API_CONFIG).forEach((key) => {
if (!key.startsWith('VUE_APP_')) { if (!key.startsWith("VUE_APP_")) {
throw new Error(`${key} 必须以【VUE_APP_】开始;API.${ENV}.${key}`) throw new Error(`${key} 必须以【VUE_APP_】开始;API.${ENV}.${key}`);
} }
process.env[key] = API_CONFIG[key] process.env[key] = API_CONFIG[key];
}) });
function resolve(dir) { function resolve(dir) {
return path.join(__dirname, dir) return path.join(__dirname, dir);
} }
const name = defaultSettings.title || 'Huatek Frontend Template' const name = defaultSettings.title || "Huatek Frontend Template";
const port = process.env.port || process.env.npm_config_port || 9528 // 端口 const port = process.env.port || process.env.npm_config_port || 9528; // 端口
module.exports = { module.exports = {
publicPath: '/', publicPath: "/",
outputDir: 'dist', outputDir: "dist",
assetsDir: 'static', assetsDir: "static",
// lintOnSave: true, // lintOnSave: true,
lintOnSave: false, lintOnSave: false,
// lintOnSave: process.env.NODE_ENV === 'development', // lintOnSave: process.env.NODE_ENV === 'development',
@ -35,138 +35,138 @@ module.exports = {
compress: true, compress: true,
disableHostCheck: true, disableHostCheck: true,
port: port, port: port,
host: '0.0.0.0', host: "0.0.0.0",
open: true, open: true,
overlay: { overlay: {
warnings: false, warnings: false,
erors: true erors: true,
}, },
proxy: { proxy: {
[process.env.VUE_APP_BASE_API]: { [process.env.VUE_APP_BASE_API]: {
// target: `http://192.168.1.161:${port}/mock`, // target: `http://192.168.1.161:${port}/mock`,
target: `http://127.0.0.1:8084/`, target: `http://192.168.1.190:92/`,
changeOrigin: true, changeOrigin: true,
// logger: 'debug', // logger: 'debug',
pathRewrite: { pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: '' ["^" + process.env.VUE_APP_BASE_API]: "/jkpg-api",
} },
}, },
// 加载莫模型 // 加载莫模型
[process.env.VUE_APP_MODEL_API]: { [process.env.VUE_APP_MODEL_API]: {
// target: `http://127.0.0.1:8082/`, // target: `http://127.0.0.1:8082/`,
// cac token获取ip // cac token获取ip
target: `http://192.168.1.21:8022/`, target: `http://192.168.1.190:92/`,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
['^' + process.env.VUE_APP_MODEL_API]: '' ["^" + process.env.VUE_APP_MODEL_API]: "",
}, },
// logLevel: 'debug' // logLevel: 'debug'
}, },
// 一键登录升级振动 // 一键登录升级振动
'/sysLoginRemoteController/login': { "/sysLoginRemoteController/login": {
// target: `http://192.168.1.12:8081/`, // target: `http://192.168.1.12:8081/`,
// target: `http://192.168.41.24:8081/`, // target: `http://192.168.41.24:8081/`,
// target: `http://192.168.1.24:8081/`, // target: `http://192.168.1.24:8081/`,
target: `http://192.168.135.81:8081/`, target: `http://192.168.135.81:8081/`,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
'^/api': '' "^/api": "",
}, },
// logLevel: 'debug' // logLevel: 'debug'
}, },
// 一键登录CAC // 一键登录CAC
'/cacRemote/login': { "/cacRemote/login": {
// target: `http://127.0.0.1:8082/`, // target: `http://127.0.0.1:8082/`,
// cac token获取ip // cac token获取ip
target: `http://192.168.145.147:8082/`, target: `http://192.168.145.147:8082/`,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
'^/api': '' "^/api": "",
}, },
// logLevel: 'debug' // logLevel: 'debug'
}, },
}, },
after: require('./mock/mock-server.js') after: require("./mock/mock-server.js"),
}, },
configureWebpack: { configureWebpack: {
name: name, name: name,
resolve: { resolve: {
alias: { alias: {
'@': resolve('src') "@": resolve("src"),
} },
} },
}, },
chainWebpack(config) { chainWebpack(config) {
config.plugins.delete('preload') config.plugins.delete("preload");
config.plugins.delete('prefetch') config.plugins.delete("prefetch");
// set svg-sprite-loader // set svg-sprite-loader
config.module.rule("svg").exclude.add(resolve("src/assets/icons")).end();
config.module config.module
.rule('svg') .rule("icons")
.exclude.add(resolve('src/assets/icons'))
.end()
config.module
.rule('icons')
.test(/\.svg$/) .test(/\.svg$/)
.include.add(resolve('src/assets/icons')) .include.add(resolve("src/assets/icons"))
.end() .end()
.use('svg-sprite-loader') .use("svg-sprite-loader")
.loader('svg-sprite-loader') .loader("svg-sprite-loader")
.options({ .options({
symbolId: 'icon-[name]' symbolId: "icon-[name]",
}) })
.end() .end();
// set preserveWhitespace // set preserveWhitespace
config.module config.module
.rule('vue') .rule("vue")
.use('vue-loader') .use("vue-loader")
.loader('vue-loader') .loader("vue-loader")
.tap(options => { .tap((options) => {
options.compilerOptions.preserveWhitespace = true options.compilerOptions.preserveWhitespace = true;
return options return options;
}) })
.end() .end();
config config
// https://webpack.js.org/configuration/devtool/#development // https://webpack.js.org/configuration/devtool/#development
.when(process.env.NODE_ENV === 'development', config => .when(process.env.NODE_ENV === "development", (config) =>
config.devtool('cheap-module-eval-source-map') config.devtool("cheap-module-eval-source-map")
) );
config.when(process.env.NODE_ENV !== 'development', config => { config.when(process.env.NODE_ENV !== "development", (config) => {
config config
.plugin('ScriptExtHtmlWebpackPlugin') .plugin("ScriptExtHtmlWebpackPlugin")
.after('html') .after("html")
.use('script-ext-html-webpack-plugin', [{ .use("script-ext-html-webpack-plugin", [
{
// `runtime` must same as runtimeChunk name. default is `runtime` // `runtime` must same as runtimeChunk name. default is `runtime`
inline: /runtime\..*\.js$/ inline: /runtime\..*\.js$/,
}]) },
.end() ])
.end();
config.optimization.splitChunks({ config.optimization.splitChunks({
chunks: 'all', chunks: "all",
cacheGroups: { cacheGroups: {
libs: { libs: {
name: 'chunk-libs', name: "chunk-libs",
test: /[\\/]node_modules[\\/]/, test: /[\\/]node_modules[\\/]/,
priority: 10, priority: 10,
chunks: 'initial' // only package third parties that are initially dependent chunks: "initial", // only package third parties that are initially dependent
}, },
elementUI: { elementUI: {
name: 'chunk-elementUI', // split elementUI into a single package name: "chunk-elementUI", // split elementUI into a single package
priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm test: /[\\/]node_modules[\\/]_?element-ui(.*)/, // in order to adapt to cnpm
}, },
commons: { commons: {
name: 'chunk-commons', name: "chunk-commons",
test: resolve('src/components'), // can customize your rules test: resolve("src/components"), // can customize your rules
minChunks: 3, // minimum common number minChunks: 3, // minimum common number
priority: 5, priority: 5,
reuseExistingChunk: true reuseExistingChunk: true,
} },
} },
}) });
config.optimization.runtimeChunk('single') config.optimization.runtimeChunk("single");
}) });
} },
} };

Loading…
Cancel
Save