From ecc89fd2f61441ea03a264f6111a6089ce4ed2aa Mon Sep 17 00:00:00 2001
From: jihongshun <1151753686@qq.com>
Date: 星期一, 28 七月 2025 10:58:53 +0800
Subject: [PATCH] 视锥体保存更新

---
 src/views/system/project/components/chooseModelDialog.vue |  110 ++++++++++++++++++++++++++----------------------------
 1 files changed, 53 insertions(+), 57 deletions(-)

diff --git a/src/views/system/project/components/chooseModelDialog.vue b/src/views/system/project/components/chooseModelDialog.vue
index a56d779..ec172e3 100644
--- a/src/views/system/project/components/chooseModelDialog.vue
+++ b/src/views/system/project/components/chooseModelDialog.vue
@@ -1,32 +1,43 @@
 <template>
   <el-dialog
-    title="閫夋嫨妯℃澘"
+    title="閫夋嫨椋炶妯℃澘"
     :visible.sync="dialogVisible"
     @close="cancel"
-    width="50%">
-    <el-form ref="form" :model="form" label-width="80px">
-      <el-form-item label="娲诲姩鍖哄煙">
-        <el-select v-model="form.region" placeholder="璇烽�夋嫨娲诲姩鍖哄煙">
-          <el-option label="鍖哄煙涓�" value="shanghai"></el-option>
-          <el-option label="鍖哄煙浜�" value="beijing"></el-option>
+    width="20%">
+    <el-form ref="form" :model="form" label-width="80px" :rules="rules">
+      <el-form-item label="椋炶妯℃澘">
+        <el-select v-model="form.modelObj" placeholder="璇烽�夋嫨椋炶妯℃澘" @change="handleChange">
+          <el-option
+              v-for="item in templateArr"
+              :key="item.id"
+              :label="item.templateName"
+              :value="item.id">
+            </el-option>
         </el-select>
       </el-form-item>
-       <span slot="footer" class="dialog-footer">
-        <el-button @click="cancel">鍙� 娑�</el-button>
+      <el-form-item>
         <el-button type="primary" @click="submit">纭� 瀹�</el-button>
-      </span>
+        <el-button @click="cancel">鍙� 娑�</el-button>
+      </el-form-item>
     </el-form>
   </el-dialog>
 </template>
+
 <script>
+import { flyDataInfo} from "@/api/system/template"
   export default {
     name:'chooseModelDialog',
     components: {
     },
+    props: {
+      deviceId: {
+        type: String,
+        defaule: null
+      }
+    },
     data() {
       return {
         dialogVisible: true,
-        showMap:false,
         tableColumns: [
             {
               label: '璁惧鍚嶇О',
@@ -37,59 +48,44 @@
               prop: 'belongingRoute'
             },
         ],
-        selectArr:[]
+        selectArr:[],
+        form:{
+        },
+        templateArr:[],
+        rules:{
+          modelObj: [
+            { required: true, message: '璇烽�夋嫨妯℃澘', trigger: 'change' }
+          ]
+        }
       };
     },
+    mounted() {
+      console.log(this.deviceId)
+      if(this.deviceId){
+        flyDataInfo(this.deviceId).then(res=>{
+          console.log(res)
+          if(res.code == 200 ) {
+            this.templateArr = res.rows
+          }
+        })
+        //鐐瑰嚮妯℃澘鏌ヨ璁惧涓嬬殑鍏宠仈妯″瀷鐨勬墍鏈夋ā鏉� 
+      }
+    },  
     methods: {
       cancel(){
-        this.showMap = false
-        this.$emit('cancel')
+        this.$emit('cancelModel')
+      }, 
+      handleChange(value){
+         this.form.deviceId = this.deviceId
+        this.form.modelObj =this.templateArr.find(item => item.id === value)
       },
-      chooseRow(row){
-        this.showMap = false
-        this.$emit('cancel')
-        this.$emit('getRowData',row)
-      },  
       submit(){
         // this.selectArr 
-        this.$emit('dealChooseArr',this.selectArr)
-      },
-      clickRow(row){
-        console.log(row)
-        this.showMap =true
-        setTimeout(()=>{
-          const position = Cesium.Cartesian3.fromDegrees(0, 0, 0);
-          // 璁剧疆妯″瀷鏂瑰悜锛堝彲閫夛級
-          // const heading = Cesium.Math.toRadians(135); // 鏈濅笢鍗楁柟鍚�
-          let model = viewer.entities.getById("modelList");
-          const heading = Cesium.Math.toRadians(120); // 鏈濅笢鍗楁柟鍚�
-          const pitch = 0;
-          const roll = 0;
-          const orientation = Cesium.Transforms.headingPitchRollQuaternion(
-            position,
-            new Cesium.HeadingPitchRoll(heading, pitch, roll)
-          );
-          if(!model) {
-            // 鍔犺浇 glTF 妯″瀷
-            const entity = viewer.entities.add({
-              id: "modelList",
-              name: "modelList",
-              position: position,
-              orientation: orientation,
-              model: {
-                uri: row.modelRoute, // 鏇挎崲鎴愪綘鐨勬ā鍨嬭矾寰�
-                scale: 1000,
-              },
-            });
-            viewer.flyTo(entity)
-          }else {
-            model.orientation = orientation
-          }
-        },1000)
-      },
-      handleSelectionChange(selection) {
-        console.log(selection)
-        this.selectArr = selection
+        // //鍙嶆樉鍙傛暟浼犻�抩ption瀵硅薄  
+        // this.form.deviceId = this.deviceId
+        // console.log(this.form)
+        this.$emit('receiveModel',this.form)
+        this.$emit('cancelModel')
       },
     }
   };

--
Gitblit v1.9.3