<script>
import IeFormPickerSingle from "@/pagesOther/pages/ie/components/picker/ie-form-picker-single.vue";
import AIFormRuleField from "@/pagesOther/pages/ie/components/ai-form/items/templates/AIFormRuleField";
import AIFormRuleOptions from "@/pagesOther/pages/ie/components/ai-form/items/templates/AIFormRuleOptions";

export default {
  name: "ai-form-field-picker",
  extends: IeFormPickerSingle,
  mixins: [AIFormRuleField, AIFormRuleOptions],
  data() {
    return {
      item: null
    }
  },
  computed: {
    pickerValue() {
      return this.formModel[this.rule.fieldName]
    },
    pickerLabel() {
      return this.rule.label
    },
    pickerRemark() {
      return this.rule.description || this.remark
    }
  },
  methods: {
    handleConfirm({value: [item]}) {
      this.item = item
      this.formModel[this.rule.fieldName] = this.getValue(item)
      this.show = false
      this.clearValidate()
    }
  }
}
</script>

<style scoped>

</style>