paraView.vue 1.27 KB
<template>
  <div style=" width:auto; display:inline-block !important; display:inline;">
    <a-checkbox-group v-model="checked" name="checkboxgroup" :options="options" @change="onChange" disabled/>
  </div>
</template>
<script>


export default {
  name: "paraView",
  data () {
    return {
      options: [],
      checked: [],
    };
  },
  props: {
    value: {
      type: String,
      default () {
        return null
      }
    },
    typeId: {
      type: Number,
      default () {
        return null
      }
    },
    code: {
      type: String,
      default () {
        return null
      }
    },
  },
  created () {
    this.loadCheck()
  },
  methods: {
    loadCheck () {
      let pars = { id: this.value, typeId: this.typeId, systemCode: this.code }
      this.$api.parameter.getParameterList(pars).then(({ data = { data } }) => {
        if (data) {
          this.options = []
          data.data.forEach(e => {
            this.options.push({ label: e.title, value: e.key })
          })
          if (!!this.value)
            this.checked = [this.value]
        }
      }).catch(() => { })
    },
    onChange (value) {

    }
  },
  watch: {
    value: {
      handler (value) {
        if (!!value)
          this.checked = [this.value]
      },
    },
  }
};
</script>