Surpriseplus
2022-11-04 d3208016fbb567fb55186e0275fdd1b421ee3e0d
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
<template>
  <div class="menuPop">
    <div class="leftBox">
      <ul>
        <li
          v-for="(item, index) in option"
          @click="setTableChange(item)"
          class="leftBoxLi"
        >
          {{ item.tabDesc }}
        </li>
      </ul>
    </div>
    <div class="rightBox">
      <div class="rightTitle">
        <span>管道</span>
        <el-link :underline="false" class="boxClose"
          ><i class="el-icon-close"></i>
        </el-link>
      </div>
      <el-table :data="tableData" height="220">
        <el-table-column align="center" type="index" label="序号" width="50" />
        <el-table-column label="定位" width="100" align="center">
          <template slot-scope="scope">
            <el-button
              icon="el-icon-map-location"
              size="mini"
              @click="spaceLocation(scope.$index, scope.row)"
            ></el-button>
          </template>
        </el-table-column>
        <el-table-column
          v-for="(item, index) in attributeData"
          :key="index"
          :label="item.alias"
          :prop="item.field"
          show-overflow-tooltip
          align="center"
        ></el-table-column>
      </el-table>
      <div class="rightPage">
        <!-- <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="listPage.pageIndex"
          :page-sizes="[10, 20, 30, 40]"
          :page-size="listPage.pageSize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="listPage.pageCount"
        >
        </el-pagination> -->
      </div>
    </div>
  </div>
</template>
 
<script>
import {
  dataQuerySelectByPage,
  inquiry_selectDomains,
  inquiry_selectFields,
  dataQuerySelectWktById,
  decr,
} from '../../api/api.js';
export default {
  data() {
    return {
      listPage: {
        pageSize: 10,
        pageIndex: 1,
        pageCount: 0,
      },
      attributeData: [],
      option: [],
      tableData: [],
      listdata: {
        pageIndex: 1,
        pageSize: 10,
        name: null,
        srid: 4326,
        wkt: null,
        filter: null,
      },
      querylayer: null,
      queryTable: [],
      domainsLayer: [],
      optionx: [],
      imagePoint: null,
    };
  },
  methods: {
    startTableMssage() {
      this.listdata.pageIndex = 1;
      this.listdata.pageSize = 10;
      this.listdata.name = null;
      this.option = [];
    },
    setTableAll() {
      this.startTableMssage();
      this.listdata.wkt = this.$store.state.mapMenuShpFile;
      this.querylayer = this.$store.state.mapSpaceQueryLayer;
      this.option = this.$store.state.mapSpaceQueryLayer;
      this.listdata.name = this.option[0].entity;
 
      this.getTableDateHidder();
    },
    async getTableDateHidder() {
      const data = await inquiry_selectFields({ name: this.listdata.name });
      if (data.code != 200) {
        this.$message.error('列表调用失败');
      }
      const data1 = await inquiry_selectDomains({ name: this.listdata.name });
      if (data1.code != 200) {
        this.$message.error('列表调用失败');
      }
      this.optionx = [];
      this.attributeData = [];
      var valadata = data.result;
      var laydomain = data1.result;
 
      for (var i in valadata) {
        if (valadata[i].showtype == 1) {
          if (
            valadata[i].domainNa != null &&
            valadata[i].domainNa != undefined
          ) {
            for (var j in laydomain) {
              if (laydomain[j].domName == valadata[i].domainNa) {
                valadata[i].domainNa = laydomain[j].codeDesc;
              }
            }
          }
          this.optionx.push(valadata[i]);
          this.attributeData.push(valadata[i]);
        }
      }
      this.getTableData();
    },
    async spaceLocation(index, row) {
      var param = {
        gid: row.gid,
        name: this.listdata.name,
      };
      const data = await dataQuerySelectWktById(param);
      if (data.code != 200) {
        this.$message.error('列表调用失败');
      }
 
      var val1 = decr(data.result);
      if (val1) {
        if (this.imagePoint != null) {
          sgworld.Creator.DeleteObject(this.imagePoint);
          this.imagePoint = null;
        }
        var wkt = this.$wkt.parse(val1);
        this.setMapLoaction(wkt);
      }
    },
    setMapLoaction(res) {
      var coord = res.coordinates;
      if (res.type == 'Point') {
        this.imagePoint = sgworld.Creator.CreateLabel(
          { X: coord[0], Y: coord[1], Altitude: 2000 },
          '',
          SmartEarthRootUrl + 'Workers/image/mark.png',
          {
            disableDepthTestDistance: Infinity,
            scale: 0.8,
          },
          0,
          '巡检点'
        );
        sgworld.Navigate.flyToObj(this.imagePoint.item);
      }
    },
    setTableChange(res) {
      this.listdata.pageIndex = 1;
      this.listdata.pageSize = 10;
      this.listdata.name = res.entity;
      this.getTableDateHidder();
    },
    async getTableData() {
      this.tableData = [];
 
      const data = await dataQuerySelectByPage(this.listdata);
      if (data.code != 200) {
        this.$message.error('列表调用失败');
      }
      debugger;
      var val_Data = data.result;
      for (var i in val_Data) {
        var valste = val_Data[i];
        for (var j in this.optionx) {
          if (
            this.optionx[j].domainNa != null &&
            this.optionx[j].domainNa != undefined
          ) {
            valste[this.optionx[j].field] = this.optionx[j].domainNa;
          }
        }
      }
      this.tableData = data.result;
    },
  },
  created() {
    this.setTableAll();
  },
  mounted() {
    this.$bus.$on('changeMapMenuTop', (res) => {
      if (res == 'true') {
        this.setTableAll();
      }
    });
  },
};
</script>
 
<style scoped lang="less">
.menuPop {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid gray;
  float: left;
  .leftBox {
    width: 20%;
    height: 100%;
    overflow: auto;
    float: left;
    border-right: 1px solid gray;
    li {
      color: white;
      line-height: 20px;
      border-bottom: 1px solid gray;
      padding: 5px;
      background: rgba(255, 255, 255, 0.2);
    }
    li:hover {
      color: #409eff;
      background: rgba(128, 128, 128, 0.2);
    }
  }
 
  .rightBox {
    width: calc(80% - 1px);
    height: 100%;
    float: left;
    .rightTitle {
      padding: 5px;
      color: white;
      width: 100%;
    }
    .rightPage {
      position: absolute;
      bottom: 10px;
      margin-left: 50px;
      /*不可点击的*/
    }
    .boxClose {
      float: right;
      margin-right: 20px;
      color: white;
    }
  }
}
</style>
<style lang="less">
/deep/ .el-table,
.el-table__expanded-cell {
  background-color: transparent !important;
}
 
/* 表格内背景颜色 */
/deep/ .el-table th,
.el-table tr,
.el-table td {
  background-color: transparent !important;
  color: white;
}
/*最外层透明*/
/deep/ .el-table,
/deep/ .el-table__expanded-cell {
  background-color: transparent;
}
/* 表格内背景颜色 */
/deep/ .el-table th,
/deep/ .el-table tr,
/deep/ .el-table td {
  background-color: transparent;
}
</style>
<style scoped lang="less"></style>