<script setup>

import {ref} from "vue"
import TCheckboxBinary from "@/components/ui/TCheckboxBinary.vue";
import PriorCheckbox from "@/components/common/PriorCheckbox.vue";
import DefinitionTable from "@/components/common/DefinitionTable.vue";

const props = defineProps(["v-stat-config", "v-is-location", "v-is-group"])

const {stat} = (function () {
	let stat = props.vStatConfig
	if (stat == null) {
		stat = {
			isPrior: false,
			isOn: false
		}
	}
	return {
		stat: ref(stat)
	}
})()


</script>

<template>
	<div>
		<input type="hidden" name="statJSON" :value="JSON.stringify(stat)"/>
		<DefinitionTable>
			<PriorCheckbox :v-config="stat" v-if="vIsLocation || vIsGroup"></PriorCheckbox>
			<tbody v-show="(!vIsLocation && !vIsGroup) || stat.isPrior">
			<tr>
				<td class="title">启用统计</td>
				<td>
					<TCheckboxBinary v-model="stat.isOn"/>
				</td>
			</tr>
			</tbody>
		</DefinitionTable>
	</div>
</template>

<style scoped>
</style>
