<template>
    <hc-new-card>
        <template #header>
            <div class="w-40">
                <el-select v-model="searchForm.key1" filterable block placeholder="选择单项工程">
                    <el-option label="一工区" value="1" />
                    <el-option label="二工区" value="2" />
                </el-select>
            </div>
        </template>
        <template #extra>
            <el-button hc-btn type="primary" @click="addModalClick">
                <HcIcon name="add" />
                <span>新增</span>
            </el-button>
        </template>
        <hc-table :column="tableColumn" :datas="tableData" :loading="tableLoading" is-new :index-style="{ width: 60 }">
            <template #action="{ row }">
                <el-link type="primary">查看报表</el-link>
                <el-link type="success">修改</el-link>
                <el-link type="danger">删除</el-link>
                <el-link>重新计算</el-link>
                <el-link type="warning">锁定</el-link>
            </template>
        </hc-table>
        <template #action>
            <hc-pages :pages="searchForm" @change="pageChange" />
        </template>
        <!-- 新增中期支付证书 -->
        <hc-new-dialog widths="30rem" :show="addModalShow" title="新增中期支付证书" @save="addModalSave" @close="addModalClose">
            <el-form ref="formRef" class="p-2" label-position="top" :model="formModel" :rules="formRules" size="large">
                <el-form-item label="计量期：" prop="key1">
                    <el-select v-model="formModel.key1" block>
                        <el-option label="第一期" :value="1" />
                    </el-select>
                </el-form-item>
                <el-form-item label="证书编号：" prop="key2">
                    <el-input v-model="formModel.key2" />
                </el-form-item>
                <el-form-item label="打印日期：">
                    <div class="form-item-div" />
                </el-form-item>
            </el-form>
        </hc-new-dialog>
    </hc-new-card>
</template>

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

defineOptions({
    name: 'PeriodsAdminCertificate',
})

//渲染完成
onMounted(() => {

})

//搜索表单
const searchForm = ref({
    key1: null, current: 1, size: 10, total: 0,
})

//分页
const pageChange = ({ current, size }) => {
    searchForm.value.current = current
    searchForm.value.size = size
}

//表格数据
const tableLoading = ref(false)
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: 'action', name: '操作', width: 260 },
])
const tableData = ref([
    { key1: '1111' },
])

//新增
const addModalShow = ref(false)
const addModalClick = () => {
    addModalShow.value = true
}

//表单数据
const formRef = ref(null)
const formModel = ref({})
const formRules = {}


const addModalSave = () => {
    addModalClose()
}

//关闭弹窗
const addModalClose = () => {
    addModalShow.value = false
}
</script>

<style scoped lang="scss">

</style>
