| | |
| | | this.resetForm("form"); |
| | | |
| | | if (ids) { |
| | | this.getModel() |
| | | // 编辑 |
| | | this.$api.detail('/tower/device', ids).then(res => { |
| | | console.log(res) |
| | | this.form = res.data |
| | | this.open = true |
| | | this.$nextTick(() => { |
| | | console.log(this.form) |
| | | this.$refs.cesiumMapSelctPoint.showPickPoint({ |
| | | longitude: +this.form.longitude, |
| | | latitude: +this.form.latitude, |
| | | altitude: +this.form.altitude, |
| | | height: +this.form.height, |
| | | }) |
| | | console.log(this.modelListData) |
| | | let url = this.modelListData.filter(item=>item.id == this.form.modelId)[0].modelRoute |
| | | console.log(url) |
| | | this.modelUrl = url |
| | | const position = Cesium.Cartesian3.fromDegrees(this.form.longitude, this.form.latitude, this.form.altitude); |
| | | const position = Cesium.Cartesian3.fromDegrees(this.form.longitude, this.form.latitude, this.form.height); |
| | | console.log(position) |
| | | // 设置模型方向(可选) |
| | | let model = viewer.entities.getById("MyModel"); |
| | | const heading = Cesium.Math.toRadians(this.form.face); // 朝东南方向 |
| | |
| | | } |
| | | }, |
| | | handleSelectAddress(data) { |
| | | console.log(data) |
| | | this.$set(this.form, 'longitude', data.longitude) |
| | | this.$set(this.form, 'latitude', data.latitude) |
| | | this.$set(this.form, 'altitude', data.altitude) |
| | | this.$set(this.form, 'height', data.altitude) |
| | | this.$refs.form.validateField('longitude') |
| | | this.$refs.form.validateField('latitude') |
| | | this.$refs.form.validateField('altitude') |
| | | this.$refs.form.validateField('height') |
| | | }, |
| | | submitForm() { |
| | | this.$refs["form"].validate(valid => { |
| | | console.log(this.form) |
| | | this.form.longitude = Number(this.form.longitude) |
| | | this.form.latitude = Number(this.form.latitude) |
| | | this.form.altitude = Number(this.form.altitude) |
| | | this.form.height = Number(this.form.height) |
| | | this.form.face = Number(this.form.face) |
| | | if (valid) { |
| | | this.$api.save('tower/device/', 'id', Object.assign({}, this.form)).then(res => { |
| | |
| | | this.$message.error("请输入纬度"); |
| | | return; |
| | | } |
| | | if (!this.form.altitude) { |
| | | if (!this.form.height) { |
| | | this.$message.error("请输入高度"); |
| | | return; |
| | | } |
| | | //动态经纬度朝向 加载模型位置预览 |
| | | // const position = Cesium.Cartesian3.fromDegrees(0, 0, 0); |
| | | const position = Cesium.Cartesian3.fromDegrees(this.form.longitude, this.form.latitude, this.form.altitude); |
| | | const position = Cesium.Cartesian3.fromDegrees(this.form.longitude, this.form.latitude, this.form.height); |
| | | // 设置模型方向(可选) |
| | | // const heading = Cesium.Math.toRadians(135); // 朝东南方向 |
| | | let model = viewer.entities.getById("MyModel"); |