<template>
    <hc-new-dialog is-table widths="1200px" :show="isShow" title="修改结算支付证书" @save="addModalSave" @close="addModalClose">
        <el-scrollbar>
            <!-- 基础表单 -->
            <hc-card-item>
                <el-form ref="formRef" :model="formModel" :rules="formRules" label-position="left" label-width="auto">
                    <el-row :gutter="20">
                        <el-col :span="12">
                            <el-form-item label="证书编号：">
                                <el-input v-model="formModel.key2" />
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="打印日期：">
                                <el-date-picker v-model="formModel.key5" class="block" format="YYYY-MM-DD" type="date" value-format="YYYY-MM-DD" disabled />
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-form>
            </hc-card-item>

            <!-- 表格数据 -->
            <hc-card-item class="mt-3">
                <hc-table :is-index="false" :column="tableColumn" :datas="tableData" is-new>
                    <template #key8="{ row }">
                        <hc-table-input v-model="row.key8" disabled />
                    </template>
                </hc-table>
            </hc-card-item>
        </el-scrollbar>
    </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 formRef = ref(null)
const formModel = ref({})
const formRules = {}

//表格数据
const tableColumn = ref([
    { key: 'key1', name: '支付章号' },
    { key: 'key2', name: '支付项名称' },
    { key: 'key3', name: '合同金额(元)' },
    { key: 'key4', name: '变更金额(元)' },
    { key: 'key5', name: '变更后的金额(元)' },
    { key: 'key6', name: '本期未累计完成(元)' },
    { key: 'key7', name: '上期未累计完成(元)' },
    { key: 'key8', name: '本期完成(元)' },
])
const tableData = ref([
    { key1: '1111' },
])


const addModalSave = () => {
    emit('finish')
    addModalClose()
}

//关闭弹窗
const addModalClose = () => {
    isShow.value = false
    emit('close')
}
</script>

<style scoped lang="scss">

</style>
