<template>
  <div>
    <el-select multiple collapse-tags value-key="id" style="width: 100%" v-model="value" @change="change">
      <el-option v-for="item in tags" :value="item.mingcheng" :label="item.mingcheng"></el-option>
    </el-select>
  </div>
</template>

<script>
import { index } from "@/api/system/baseForm"
export default {
  props: {
    fieldInfo: Object,
    form: Object
  },
  data() {
    return {
      value: '',
      tags: [],
    }
  },
  methods: {
    async getTags () {
      const res = await index({
        page: 1,
        page_size: 9999,
        table_name: 'tags',
      })
      this.tags = res.data
    },
    change (e) {
      this.$emit('update', this.value.toString())
    }
  },
  computed: {},
  watch: {
    'form.biaoqian' (newVal) {
      this.value = newVal.split(',')
    }
  },
  created() {
    this.getTags()
  }
}
</script>

<style scoped lang="scss">
</style>
