派生自 wuyushui/SewerAndRainNetwork

陈泽平
2021-05-25 1b90ab69c77b1e4717bc9be45ea1acb36b2f6873
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
<template>
    <div class="side-box map-background" v-show="location">
        <el-tabs v-model="activeName" @tab-click="handleClick">
            <el-tab-pane label="点击定位" name="first">
                <div class="click-location">
                    <el-input v-model="clickLocation"></el-input>
                    <el-button type="primary" @click="confirm">确认</el-button>
                </div>
            </el-tab-pane>
            <el-tab-pane label="管线定位" name="second">
                <div class="line-pos">
                        <el-form :model="linePos" label-width="90px">
                            <el-form-item label="管线名称:">
                                <el-input v-model="linePos.lineName"></el-input>
                            </el-form-item>
                            <el-form-item label="附属设施:">
                                <el-input v-model="linePos.affFac"></el-input>
                            </el-form-item>
                        </el-form>
                        <el-button type="primary" size="mini">搜索</el-button>
                    <el-button type="primary" @click="confirm">确认</el-button>
                </div>
            </el-tab-pane>
            <el-tab-pane label="经纬度定位" name="third">
                <div class="latlng-location">
                    <div class="latlng-location-chose">
                        <el-form :model="LongLatPos" label-width="90px">
                            <el-form-item label="经度:">
                                <el-input v-model="LongLatPos.longPos"></el-input>
                            </el-form-item>
                            <el-form-item label="纬度:">
                                <el-input v-model="LongLatPos.latPos"></el-input>
                            </el-form-item>
                        </el-form>
                        <el-button type="primary" size="mini">定位</el-button>
                    </div>
                    <el-button type="primary" @click="confirm">确认</el-button>
                </div>
            </el-tab-pane>
        </el-tabs>
    </div>
</template>
 
<script>
import eventBus from '../../../eventBus'
 
export default {
  name: 'PositionChange',
  props: ['location'],
  data () {
    return {
      pipelineFile: false,
      activeName: 'first',
      clickLocation: '',
      // 经纬度定位
      LongLatPos: {
        longPos: '',
        latPos: ''
      },
      // 管段定位
      linePos: {
        lineName: '',
        affFac: ''
      },
      tabLabel: ''
    }
  },
  mounted () {
    // 接收规定 每次重新选择定位 都指定 选择第一个开始
    eventBus.$on('tab-change', (obj) => {
      this.activeName = obj
    })
  },
  methods: {
    // tab 切换用于判断
    handleClick (tab) {
      // 控制第三层页面 管线名称/管段代码选择页面
      if (tab.label === '管线定位') {
        // 如果 是管线定位 显示三级附属框 进行选择文件操作
        eventBus.$emit('pipelineFile-choose', true)
      } else {
        // eles 不进行显示
        eventBus.$emit('pipelineFile-choose', false)
      }
    },
    // 点击确认按钮事件
    confirm () {
      // 子组件通过事件 传递数据 控制自身显示隐藏
      this.$emit('localCation', false)
      // 通过bus 控制三级附属弹框的隐藏
      eventBus.$emit('pipelineFile-choose', false)
    }
  }
}
</script>
 
<style lang="less" scoped>
 
    .side-box {
        min-width: 1.94532rem;
        max-height: 1.343213rem;
    }
    .click-location {
        margin: 0 auto;
        text-align: center;
 
        .el-input {
            width: 90%;
            margin: 15px auto;
        }
 
        .el-button {
            margin: 15px auto;
        }
    }
 
    .line-pos {
        text-align: center;
        .el-input {
            width: 85%;
        }
    }
 
    .latlng-location {
        text-align: center;
 
        .latlng-location-chose {
            display: flex;
            align-content: center;
            justify-content: space-around;
 
        }
 
        .el-input {
            width: 85%;
        }
    }
</style>