<!-- wyf 2022-5-12 -->
<template>
  <z-form-item
    :label-col="{ style: { width: '120px', paddingRight: '6px' } }"
    :required="formForm?.required === '1'"
    :label="formForm?.headText ? formForm?.headText : basicForm?.titleName || '评分'"
    class="z-form-item"
  >
    <z-rate
      v-model:value="model[basicForm.field]"
      :value="formForm.value"
      :disabled="formForm?.disabled === '1'"
      :allow-half="formForm?.allowHalf === '1'"
      :count="formForm.totalScore"
    />
  </z-form-item>
</template>
<script>
import { defineComponent, toRef, toRefs } from 'vue'
export default defineComponent({
  name: 'RateItem',
  props: {
    formProperty: {
      type: Array,
      default: undefined
    },
    basicProperty: {
      type: Array,
      default: undefined
    },
    formModel: {
      type: Object,
      default: undefined
    }
  },
  setup(props) {
    const basicForm = toRef(props, 'basicProperty')
    const formForm = toRef(props, 'formProperty')
    const model = props.formModel ? toRefs(props.formModel) : {}
    return {
      basicForm,
      formForm,
      model
    }
  }
})

</script>
<style lang="less" scoped>
.z-form-item{
  flex: 1;
}
</style>
