<template>
    <hc-new-dialog v-model="isShow" is-table widths="1200px" title="引用系统支付项" @save="modalSave">
        <hc-table
            :column="tableColumn" :datas="tableData" :loading="tableLoading"
            is-new :check-style="{ width: 29 }" :index-style="{ width: 60 }"
            is-check @selection-change="tableCheckChange"
        />
    </hc-new-dialog>
</template>

<script setup>
import { ref, watch } from 'vue'

const props = defineProps({
    ids: {
        type: [String, Number],
        default: '',
    },
})

//事件
const emit = defineEmits(['finish', 'close'])

//双向绑定
// eslint-disable-next-line no-undef
const isShow = defineModel('modelValue', {
    default: false,
})

//监听
watch(() => [
    props.ids,
], ([ids]) => {
    console.log('ids', ids)
}, { immediate: true })

//监听
watch(isShow, (val) => {
    if (val) {
        console.log('处理数据')
    }
})
//表格数据
const tableLoading = ref(false)
const tableColumn = [
    { key: 'key1', name: '支付项编号' },
    { key: 'key2', name: '支付项名称' },
    { key: 'key3', name: '支付项类型' },
    { key: 'key4', name: '是否为扣款项' },
    { key: 'key5', name: '是否合计项' },
    { key: 'key5', name: '适用类型' },
]
const tableData = ref([
    { key1: '1111' },
])

//表格选择
const tableCheckChange = (checks) => {
    console.log(checks)
}
const modalSave = () => {
    emit('finish')
}
</script>
