<template>
	<el-switch
		@change="changeStatus"
		size="small"
		v-model="list.enabled"
		:active-value="1"
		:inactive-value="0"></el-switch>
</template>

<script>
import { updateGroup } from '@/api/group/groupSetting';
export default {
	props: {
		injectData: {
			type: Object,
			default: () => ({}),
		},
	},
	data() {
		return {
			list: this.injectData,
		};
	},
	created() {},
	methods: {
		changeStatus(val) {
			const data = { ...this.injectData, enabled: val };
			updateGroup(data).then((res) => {
				this.$modal.msgSuccess('修改成功');
					this.$emit('emitData');
			});
		},
	},
};
</script>
