修改转发配置

main
fanluyan 6 months ago
parent e0240c3f1d
commit 01f5f22e17

@ -1,6 +1,8 @@
# base api
# 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_BASE_API = '/dev-api'
VUE_APP_MODEL_API = '/api/modelFile'
# VUE_APP_BASE_API = '/dev-api'
#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

@ -2,8 +2,8 @@ module.exports = {
/**
* @description 系统标题,icon
*/
title: '欣影大数据',
logo: 'http://www.huatek.com/imgs/home_logo.png',
title: "欣影大数据",
logo: "http://www.huatek.com/imgs/home_logo.png",
/**
* @type {boolean} true | false
* @description 是否固定导航栏到顶部
@ -20,11 +20,10 @@ module.exports = {
* 是否使用阿里云OSS文件存储
*/
OSSConfig: {
accessKeyId: 'LTAILVNVeJZkF4PV',
accessKeySecret: 'YKBrFuyEQQJBXRklt4kIVS3vwS5q4U',
region: 'huatek-oss.oss-cn-beijing.aliyuncs.com',
bucket: 'huatek-oss'
accessKeyId: "LTAILVNVeJZkF4PV",
accessKeySecret: "YKBrFuyEQQJBXRklt4kIVS3vwS5q4U",
region: "huatek-oss.oss-cn-beijing.aliyuncs.com",
bucket: "huatek-oss",
},
InfraredPic: "http://192.168.135.81:88",
@ -36,7 +35,7 @@ module.exports = {
development: {
// 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://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://222.90.232.142:8171/prod-api',
// 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'
},
production: { //h后台代码的访问接口
production: {
//h后台代码的访问接口
// 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://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',
@ -78,12 +79,11 @@ module.exports = {
//洪屏
// 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: {
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>
<script>
import * as THREE from 'three'
import C3S3D from '@/utils/c3s-3d-1.0.1-e'
import { TWEEN } from 'three/examples/jsm/libs/tween.module.min.js'
import * as THREE from "three";
import C3S3D from "@/utils/c3s-3d-1.0.1-e";
import { TWEEN } from "three/examples/jsm/libs/tween.module.min.js";
//
import {
CAMERA_MOVE_DATA,
getTenToSixteenColor,
getPointData
} from '@/utils/modelData.js'
getPointData,
} from "@/utils/modelData.js";
export default {
name: 'HelloWorld',
name: "HelloWorld",
components: {},
props: {
modelType: {
type: String,
default: () => 'byq'
}
default: () => "byq",
},
},
data() {
return {
@ -55,7 +55,7 @@ export default {
cz: 6000,
tx: 0,
ty: 0,
tz: 1200
tz: 1200,
}, //
{
time: 1200,
@ -64,8 +64,8 @@ export default {
cz: 1500,
tx: 0,
ty: 0,
tz: 0
}
tz: 0,
},
],
gisMoveData: [
{
@ -75,7 +75,7 @@ export default {
cz: 6000,
tx: 0,
ty: 800,
tz: 1000
tz: 1000,
}, //
{
time: 1200,
@ -84,74 +84,74 @@ export default {
cz: 1000,
tx: 0,
ty: 0,
tz: 0
}
tz: 0,
},
],
geometry: null,
modelDataObj: null,
filePath: null,
modelSiteId: {}
}
modelSiteId: {},
};
},
watch: {
modelType: function(val) {
this.clearModel()
C3S3D.destory(this.ThreeObjs)
modelType: function (val) {
this.clearModel();
C3S3D.destory(this.ThreeObjs);
// this.modelCurrent(val);
// this.createdInit();
this.mountedGetData()
}
this.mountedGetData();
},
},
created() {
const modelParameter = JSON.parse(localStorage.getItem('getModelList'))
const modelParameter = JSON.parse(localStorage.getItem("getModelList"));
for (let index = 0; index < modelParameter.length; index++) {
const element = modelParameter[index]
if (element.modelType == '211') {
this.modelDataObj = JSON.parse(element.modelParams)
this.modelSiteId = element
this.filePath = element.filePath
break
const element = modelParameter[index];
if (element.modelType == "211") {
this.modelDataObj = JSON.parse(element.modelParams);
this.modelSiteId = element;
this.filePath = element.filePath;
break;
}
}
},
mounted() {
this.mountedGetData()
this.mountedGetData();
},
beforeDestroy() {
C3S3D.destory(this.ThreeObjs)
C3S3D.destory(this.ThreeObjs);
},
methods: {
mountedGetData() {
this.$store.dispatch('getModelData').then(() => {
const type = this.modelType == 'byq' ? '111' : '211'
const modelParameter = JSON.parse(localStorage.getItem('getModelList'))
console.log('-5-95-5-5-5', modelParameter, type)
this.$store.dispatch("getModelData").then(() => {
const type = this.modelType == "byq" ? "111" : "211";
const modelParameter = JSON.parse(localStorage.getItem("getModelList"));
console.log("-5-95-5-5-5", modelParameter, type);
for (let index = 0; index < modelParameter.length; index++) {
const element = modelParameter[index]
const element = modelParameter[index];
if (element.modelType == type) {
this.modelDataObj = JSON.parse(element.modelParams)
this.filePath = element.filePath
break
this.modelDataObj = JSON.parse(element.modelParams);
this.filePath = element.filePath;
break;
}
}
console.log(!this.modelDataObj, 'wqeqweqewqe')
console.log(!this.modelDataObj, "wqeqweqewqe");
if (!this.modelDataObj) {
this.$bus.$emit('animateState', true)
return
this.$bus.$emit("animateState", true);
return;
}
this.$nextTick(() => {
this.createdInit()
})
})
this.createdInit();
});
});
},
createdInit() {
this.modelDataInit()
this.init()
this.modelDataInit();
this.init();
},
modelDataInit() {
const data = this.modelDataObj
const data = this.modelDataObj;
this.modelData = {
modelName: '111', //
modelName: "111", //
modelZoom: data.modelZoom, //
modelDraco: true, // Draco
modelRotateAct: data.modelRotateAct, //
@ -161,41 +161,41 @@ export default {
rotationVal: data.rotation,
Point: {
color: data.pointLight.color,
intensity: data.pointLight.intensity
intensity: data.pointLight.intensity,
},
Ambient: {
color: data.ambientLight.color,
intensity: data.ambientLight.intensity
intensity: data.ambientLight.intensity,
},
pointIntensity: 0.3
}
pointIntensity: 0.3,
};
},
//
init: function() {
const data = this.modelData
this.modelState = true
init: function () {
const data = this.modelData;
this.modelState = true;
const lightList = [
//
{
type: 'Ambient',
type: "Ambient",
color: getTenToSixteenColor(data.Ambient.color),
intensity: data.Ambient.intensity
}
]
intensity: data.Ambient.intensity,
},
];
//
const pointData = getPointData(
data.Point.intensity,
getTenToSixteenColor(data.Point.color)
)
);
if (pointData) {
for (let index = 0; index < pointData.length; index++) {
const element = pointData[index]
const element = pointData[index];
lightList.push({
type: 'Point',
type: "Point",
color: element.color,
intensity: element.intensity,
position: element.position
})
position: element.position,
});
}
}
this.ThreeObjs = C3S3D.init({
@ -207,21 +207,21 @@ export default {
position: [
data.cameraPosition.x,
data.cameraPosition.y,
data.cameraPosition.z
]
data.cameraPosition.z,
],
},
controls: {
noRotate: false,
autoRotate: true,
autoRotateSpeed: 2
autoRotateSpeed: 2,
},
renderer: {
alpha: 0
alpha: 0,
},
// css3dRenderer: {},
light: lightList,
update: (dt) => {
this.update(dt)
this.update(dt);
},
//
clickCallback: (e) => {
@ -231,14 +231,14 @@ export default {
dblclickCallback: () => {},
//
mousemoveCallback: (e) => {
this.onMouseMove(e)
this.onMouseMove(e);
},
//
mousedownCallback: () => {}
})
mousedownCallback: () => {},
});
this.loadGltf()
this.initOutline()
this.loadGltf();
this.initOutline();
},
update() {
// C3S3D.update(this.ThreeObjs);
@ -252,30 +252,30 @@ export default {
pulsePeriod: 5,
visibleEdgeColor: 0x00ff00,
hiddenEdgeColor: 0x00ff00,
downSampleRatio: 1
})
downSampleRatio: 1,
});
},
//
clearModel() {
//
if (this.ThreeObjs.scene !== null) {
// divcanvascanvas
const domDiv = document.getElementById('modelContainers')
const domDiv = document.getElementById("modelContainers");
if (domDiv !== null) {
domDiv.removeChild(domDiv.firstChild)
domDiv.removeChild(domDiv.firstChild);
}
// 3D
window.cancelAnimationFrame(stop) //
this.ThreeObjs.scene = null
this.ThreeObjs.camera = null
this.ThreeObjs.renderer = null
this.ThreeObjs.orbitControls = null
window.cancelAnimationFrame(stop); //
this.ThreeObjs.scene = null;
this.ThreeObjs.camera = null;
this.ThreeObjs.renderer = null;
this.ThreeObjs.orbitControls = null;
}
},
loadGltf() {
const group = new THREE.Object3D()
this.ThreeObjs.scene.add(group)
const group = new THREE.Object3D();
this.ThreeObjs.scene.add(group);
C3S3D.loadGltf({
// url:
// process.env.VUE_APP_MODEL_API +
@ -288,37 +288,37 @@ export default {
rotation: {
x: C3S3D.toRadian(this.modelData.rotationVal.x),
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,
onProgress: (percentage, val) => {
if (percentage >= 100) {
this.loading = false
this.loading = false;
}
},
onLoad: (geometry) => {
this.geometry = geometry
this.modelState = false
if (this.modelType == 'byq') {
this.startAutoPatrol(this.geometry, this.byqMoveData)
this.geometry = geometry;
this.modelState = false;
if (this.modelType == "byq") {
this.startAutoPatrol(this.geometry, this.byqMoveData);
} else {
this.startAutoPatrol(this.geometry, this.gisMoveData)
this.startAutoPatrol(this.geometry, this.gisMoveData);
}
}
})
},
});
},
onMouseClick(event) {
const selectObject = C3S3D.getIntersectsFirstMesh(
event,
this.ThreeObjs,
this.ThreeObjs.scene.children
)
);
if (selectObject) {
//
C3S3D.outlineLight(this.ThreeObjs, [selectObject])
C3S3D.outlineLight(this.ThreeObjs, [selectObject]);
// C3S3D.spreadLeftAndRight(this.geometry, 1, 100, 0, 1000);
} else {
C3S3D.outlineLight(this.ThreeObjs, [])
C3S3D.outlineLight(this.ThreeObjs, []);
}
},
//
@ -327,24 +327,24 @@ export default {
event,
this.ThreeObjs,
this.ThreeObjs.scene.children
)
);
if (this.modelData.modelRotateAct) {
if (selectObject) {
this.ThreeObjs.orbitControls.autoRotate = false
this.ThreeObjs.orbitControls.autoRotate = false;
} else {
this.ThreeObjs.orbitControls.autoRotate = true
this.ThreeObjs.orbitControls.autoRotate = true;
}
}
},
startAutoPatrol(val, data) {
this.patrolPoints = data
this.patrolIndex = 0
this.doPatrol(this.patrolPoints[this.patrolIndex])
this.patrolPoints = data;
this.patrolIndex = 0;
this.doPatrol(this.patrolPoints[this.patrolIndex]);
},
//
doPatrol(point) {
const cameraPos = this.ThreeObjs.camera.position.clone()
const targetPos = this.ThreeObjs.orbitControls.target.clone()
const cameraPos = this.ThreeObjs.camera.position.clone();
const targetPos = this.ThreeObjs.orbitControls.target.clone();
this.patrolTween = C3S3D.createTween({
start: {
cx: cameraPos.x,
@ -352,7 +352,7 @@ export default {
cz: cameraPos.z,
tx: targetPos.x,
ty: targetPos.y,
tz: targetPos.z
tz: targetPos.z,
},
to: {
cx: point.cx,
@ -360,36 +360,36 @@ export default {
cz: point.cz,
tx: point.tx,
ty: point.ty,
tz: point.tz
tz: point.tz,
},
duration: point.time,
delayTime: 1,
onUpdate: (obj) => {
this.ThreeObjs.camera.position.set(obj.cx, obj.cy, obj.cz)
this.ThreeObjs.orbitControls.target.set(obj.tx, obj.ty, obj.tz)
this.ThreeObjs.camera.position.set(obj.cx, obj.cy, obj.cz);
this.ThreeObjs.orbitControls.target.set(obj.tx, obj.ty, obj.tz);
},
onComplete: () => {
this.patrolTween = null
this.patrolIndex++
this.patrolTween = null;
this.patrolIndex++;
if (this.patrolIndex >= this.patrolPoints.length) {
//
return
return;
}
},
easing: TWEEN.Easing.Linear.None
})
easing: TWEEN.Easing.Linear.None,
});
},
//
startAutoPatrol(val, data) {
this.patrolPoints = data
this.patrolIndex = 0
this.doPatrol(this.patrolPoints[this.patrolIndex])
this.patrolPoints = data;
this.patrolIndex = 0;
this.doPatrol(this.patrolPoints[this.patrolIndex]);
},
//
doPatrol(point) {
const cameraPos = this.ThreeObjs.camera.position.clone()
const targetPos = this.ThreeObjs.orbitControls.target.clone()
const cameraPos = this.ThreeObjs.camera.position.clone();
const targetPos = this.ThreeObjs.orbitControls.target.clone();
this.patrolTween = C3S3D.createTween({
start: {
cx: cameraPos.x,
@ -397,7 +397,7 @@ export default {
cz: cameraPos.z,
tx: targetPos.x,
ty: targetPos.y,
tz: targetPos.z
tz: targetPos.z,
},
to: {
cx: point.cx,
@ -405,29 +405,29 @@ export default {
cz: point.cz,
tx: point.tx,
ty: point.ty,
tz: point.tz
tz: point.tz,
},
duration: point.time,
delayTime: 1,
onUpdate: (obj) => {
this.ThreeObjs.camera.position.set(obj.cx, obj.cy, obj.cz)
this.ThreeObjs.orbitControls.target.set(obj.tx, obj.ty, obj.tz)
this.ThreeObjs.camera.position.set(obj.cx, obj.cy, obj.cz);
this.ThreeObjs.orbitControls.target.set(obj.tx, obj.ty, obj.tz);
},
onComplete: () => {
this.patrolTween = null
this.patrolIndex++
this.patrolTween = null;
this.patrolIndex++;
if (this.patrolIndex >= this.patrolPoints.length) {
this.moveSatate = true
this.$bus.$emit('animateState', true)
return
this.moveSatate = true;
this.$bus.$emit("animateState", true);
return;
}
this.doPatrol(this.patrolPoints[this.patrolIndex])
this.doPatrol(this.patrolPoints[this.patrolIndex]);
},
easing: TWEEN.Easing.Linear.None
})
}
}
}
easing: TWEEN.Easing.Linear.None,
});
},
},
};
</script>
<style lang="scss">

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

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

Loading…
Cancel
Save