唐耀东
2022-05-10 3a02d6a0f7c5d2dfb2df2e1635315304b85695eb
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
<template>
  <div>
    <el-input placeholder="请选择适用地点" :value="buildingName" disabled>
      <el-button slot="append" icon="el-icon-thumb" @click="handleBuilding"></el-button>
    </el-input>
    <el-dialog title="建筑单元" :visible.sync="open" width="800px" :append-to-body="true" :destroy-on-close="true">
      <building-form @choice="choice"></building-form>
    </el-dialog>
  </div>
</template>
 
<script>
import buildingForm from './form'
 
export default {
  name: "BuildInput",
  components: {
    buildingForm
  },
  model: {
    prop: 'value',
    event: 'change'
  },
  props: {
    value: {
      type: [Number],
      default: undefined
    },
  },
  data() {
    return {
      message: undefined,
      open: false,
      buildingName: ''
    }
  },
  methods: {
    // 选择建筑单元
    handleBuilding() {
      this.open = true;
    },
    // 选中建筑单元
    choice(r) {
      this.buildingName = r.name;
      this.open = false;
      this.$emit("change", r.id);
    }
  }
}
</script>
 
<style scoped>
 
</style>