<script setup lang="ts">
import RFMRuleItem from './RFMRuleItem.vue'
import { useRfmStatistics } from '@/composables/useRFMData'

const props = defineProps<{ tagId?: string }>()
const form = defineModel<any>({
  default: {
    R: {},
    F: {},
    M: {}
  }
})
const { rfmStatistics } = useRfmStatistics(props.tagId || '')
</script>

<template>
  <RFMRuleItem label="R" v-model="form.R">
    <template #header-aside="{ data }">
      <template v-if="data.rule === '101' && rfmStatistics.is_complete">R值计算结果为：{{ rfmStatistics.rfm_tag_res.r }} </template>
    </template>
  </RFMRuleItem>
  <RFMRuleItem label="F" v-model="form.F" style="margin-top: 20px">
    <template #header-aside="{ data }">
      <template v-if="data.rule === '101' && rfmStatistics.is_complete">F值计算结果为：{{ rfmStatistics.rfm_tag_res.f }} </template>
    </template>
  </RFMRuleItem>
  <RFMRuleItem label="M" v-model="form.M" style="margin-top: 20px">
    <template #header-aside="{ data }">
      <template v-if="data.rule === '101' && rfmStatistics.is_complete">M值计算结果为：{{ rfmStatistics.rfm_tag_res.m }} </template>
    </template>
  </RFMRuleItem>
</template>
