田源
2024-08-30 9900d07ca84f9a1718f8b8781c567ecae9f232b6
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
<!--通用的分类的参照,只是显示分类树-->
<template>
    <vciWebReferTree
        :key="typeKey"
        :data-key="typeKey"
        :disabled="disabled"
        :referConfig="rConfig"
        :text="textD"
        :title="titleD"
        :value="valueD"
        :width="width"
        :height="height"
        :reloadFormKey="reloadFormKey"
        @setReferValue="setValue">
    </vciWebReferTree>
</template>
 
<script>
import vciWebReferTree from "./vciWebReferTree.vue";
import {verifyNull} from "@/util/validate";
 
export default {
  name: "basicClassifyRefer",
  props: {
    referConfig: {
      type: Object,
    }, value: {
      type: String,
      default: ''
    }, text: {
      type: String,
      default: ''
    }, disabled: {
      type: Boolean,
      default: false,
    }, url: {
      type: String,
      default: ''
    }, typeKey: {
      type: String,
      default: ''
    }, referType: {
      type: String,
      default:''
    }, width: {
      type: String,
      default:'70%'
    }, height: {
      type: String,
      default:(document.body.clientHeight-400)+'px'
    },
    reloadFormKey: {
      type: String,
      default: '',
    }
  },
  components: {vciWebReferTree },
  data() {
    return {
      emitData: {},
    };
  },
  computed: {
    rConfig() {
      let rConfig = this.referConfig;
      if (!rConfig.options) {
        rConfig.options = {};
      }
      rConfig.options.isMuti = rConfig.options.muti || rConfig.options.isMuti || false;
      rConfig.options.url=this.referConfig.options.url;
      return rConfig;
    },
    titleD(){
      let title = this.referConfig.title || "";
      title = title.replace(":", "");
      title = title
          ? "为【" + title + "】选取值"
          : "为【" + this.referConfig.showProp + "】选取值";
      return title;
    },
    textD(){
      return verifyNull(this.text) ? (this.referConfig.options.defalutText || '') : this.text;
    },
    valueD(){
      return verifyNull(this.value) ? (this.referConfig.options.defalutValue || '') :this.value;
    }
  },
  created() {
  },
  methods: {
    setValue(value) {
      this.emitData = value;
    }
  },
  watch: {
    // 修改反馈到父组件
    emitData: {
      deep: true,
      handler(newV) {
        this.$emit("setReferValue", newV);
      }
    }
  }
};
</script>
 
<style scoped>
 
</style>