<template>
    <super-dialog
        v-model="dialogVisible"
        :title="title"
        custom-class="notification-dialog"
        top="10%"
        width="30%"
        @closed="closePage"
    >
        <div
            v-loading="detailLoading"
            class="table-container"
            element-loading-background="rgba(10 ,38 ,61, 0.9)"
        >
            <el-radio-group v-model="moveType" class="move-type-list">
                <el-radio :label="item.value" v-for="item in moveTypeList" :key="item.value">{{
                    item.label
                }}</el-radio>
            </el-radio-group>
        </div>
        <div slot="footer" style="display: flex; justify-content: center; width: 100%">
            <el-button type="primary" @click="submitObject">确定</el-button>
            <el-button @click="closePage">取消</el-button>
        </div>
    </super-dialog>
</template>

<script lang="ts" setup>
import SuperDialog from '@/components/Dialog/index.vue'

// 1. 定义 props
const props = defineProps({
    isShowAdd: {
        type: Boolean,
        default: false
    },
    title: {
        type: String,
        default: ''
    },
    info: {
        type: Object,
        default: () => ({})
    }
})

onMounted(() => {})

const detailLoading = ref<Boolean>(false)

function submitObject() {
    emit('submit', moveType.value)
}

// 2. 定义 emit
const emit = defineEmits(['update:isShowAdd', 'submit'])

const openPage = () => {
    // loadData()
}

const closePage = () => {
    dialogVisible.value = false
}

const moveTypeList = ref<any[]>([
    {
        value: 3,
        label: '基础信息变更'
    },
    {
        value: 6,
        label: '资质变更'
    },
    {
        value: 9,
        label: '等级变更'
    }
])
const moveType = ref<number>(3)

defineExpose({
    openPage
})

// 3. 使用 computed 定义双向绑定
const dialogVisible = computed({
    get() {
        return props.isShowAdd
    },
    set(val) {
        emit('update:isShowAdd', false)
    }
})
</script>

<style lang="scss" scoped>
.move-type-list {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    margin: 0 0 20px 10px;
}
</style>
