jihongshun
2025-07-09 bec1a5e6532575b221b24094471fce8c814fc7ae
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<template>
  <el-dialog
    title="模型列表"
    :visible.sync="dialogVisible"
    @close="cancel"
    width="50%">
    <el-row :gutter="20">
       <el-col :span="24" :xs="24">
        <AppTable ref="AppTable" selection  :showDeptSearch="false" :url="'tower/device/list'" :tableColumns="tableColumns"  @on-select-checkbox="handleSelectionChange"   :showSearchBtn="false">
        </AppTable>
      </el-col>
     </el-row>
    <span slot="footer" class="dialog-footer">
      <el-button @click="cancel">取 消</el-button>
      <el-button type="primary" @click="submit">确 定</el-button>
    </span>
  </el-dialog>
</template>
<script>
  export default {
    name:'chooseModelDialog',
    components: {
    },
    data() {
      return {
        dialogVisible: true,
        showMap:false,
        tableColumns: [
            {
              label: '设备名称',
              prop: 'deviceName'
            },
             {
              label: '所属线路',
              prop: 'belongingRoute'
            },
        ],
        selectArr:[]
      };
    },
    methods: {
      cancel(){
        this.showMap = false
        this.$emit('cancel')
      },
      chooseRow(row){
        this.showMap = false
        this.$emit('cancel')
        this.$emit('getRowData',row)
      },  
      submit(){
        // this.selectArr 
        this.$emit('dealChooseArr',this.selectArr)
        this.$emit('cancel')
      },
      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, // 替换成你的模型路径
              },
            });
            viewer.flyTo(entity)
          }else {
            model.orientation = orientation
          }
        },1000)
      },
      handleSelectionChange(selection) {
        console.log(selection)
        this.selectArr = selection
      },
    }
  };
</script>