唐耀东
2022-05-12 2546d2a6251176b0214c2d23ac93ccde5dd008f5
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
<template>
  <div>
    <el-input placeholder="请选择" :value="name" disabled>
      <el-button slot="append" icon="el-icon-thumb" @click="handleClick"></el-button>
    </el-input>
    <el-dialog title="NVR" :visible.sync="open" width="800px" :append-to-body="true" :destroy-on-close="true">
      <nvr-list v-if="open" ref="nvrRef" :schoolId="schoolId"></nvr-list>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="open = false">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
 
<script>
import nvrList from "./list";
import {getNvr} from "@/api/oa/nvr";
 
/**
 * 高校NVR
 */
export default {
  name: "manufacturerInput",
  components: {
    nvrList
  },
  model: {
    prop: 'value',
    event: 'change'
  },
  props: {
    value: {
      type: [Number],
      default: undefined
    },
    schoolId: {
      type: Number,
      default: undefined
    }
  },
  data() {
    return {
      open: false,
      name: ''
    }
  },
  watch: {
    'value': function (v) {
      if (v) {
        getNvr(v).then(response => {
          this.name = response.data.deploymentName;
        });
      }else {
        this.name = '';
      }
    }
  },
  created() {
    if (this.value) {
      getNvr(this.value).then(response => {
        this.name = response.data.deploymentName;
      });
    }
  },
  methods: {
    handleClick() {
      this.open = true;
    },
    submitForm() {
      const row = this.$refs.nvrRef.currentRow;
      if (!row) {
        this.$message.warning("请选择一条数据")
        this.buttonLoading = false;
        return;
      }
      this.name = row.deploymentName;
      this.open = false;
      this.$emit("change", row.id);
    }
  }
}
</script>
 
<style scoped>
 
</style>