<template>
    <hc-new-card>
        <template #header>
            <div class="w-40">
                <el-select v-model="searchForm.key1" filterable block placeholder="选择计量期" @change="searchKey1Click">
                    <el-option v-for="item in key1Data" :key="item.id" :label="item.name" :value="item.id" />
                </el-select>
            </div>
        </template>
        <template #extra>
            <el-button hc-btn type="primary" @click="addModalClick">
                <HcIcon name="add" />
                <span>新增</span>
            </el-button>
            <el-button hc-btn type="primary" @click="reportClick">
                <HcIcon name="send-plane-2" />
                <span>上报</span>
            </el-button>
        </template>
        <div class="relative h-full flex">
            <div class="flex-1">
                <hc-card-item>
                    <hc-table
                        :column="tableColumn" :datas="tableData" :loading="tableLoading"
                        is-new :index-style="{ width: 60 }" is-check :check-style="{ width: 29 }"
                        @selection-change="tableCheckChange"
                    >
                        <template #action="{ row }">
                            <el-link type="success" @click="rowEditClick(row)">修改</el-link>
                            <el-link type="danger">删除</el-link>
                        </template>
                    </hc-table>
                    <template #action>
                        <hc-pages :pages="searchForm" @change="pageChange" />
                    </template>
                </hc-card-item>
            </div>
            <div class="ml-3 w-[600px]">
                <hc-card-item title="详情信息" scrollbar>
                    <hc-info-table>
                        <tr>
                            <hc-info-table-td center is-title>合同材料：</hc-info-table-td>
                            <hc-info-table-td width="120px">水泥</hc-info-table-td>
                            <hc-info-table-td center is-title>材料到场编号：</hc-info-table-td>
                            <hc-info-table-td width="120px">1</hc-info-table-td>
                        </tr>
                        <tr>
                            <hc-info-table-td center is-title>计量期：</hc-info-table-td>
                            <hc-info-table-td width="120px">第1期</hc-info-table-td>
                            <hc-info-table-td center is-title>业务日期：</hc-info-table-td>
                            <hc-info-table-td width="120px">2020-09-10</hc-info-table-td>
                        </tr>
                        <tr>
                            <hc-info-table-td center is-title>单价：</hc-info-table-td>
                            <hc-info-table-td width="120px">5000</hc-info-table-td>
                            <hc-info-table-td center is-title>计量数量：</hc-info-table-td>
                            <hc-info-table-td width="120px">555</hc-info-table-td>
                        </tr>
                        <tr>
                            <hc-info-table-td center is-title>计量金额：</hc-info-table-td>
                            <hc-info-table-td width="120px">2775000</hc-info-table-td>
                            <hc-info-table-td center is-title>备料堆放地点：</hc-info-table-td>
                            <hc-info-table-td width="120px">-</hc-info-table-td>
                        </tr>
                        <tr>
                            <hc-info-table-td center is-title>存储情况：</hc-info-table-td>
                            <hc-info-table-td width="120px">-</hc-info-table-td>
                            <hc-info-table-td center is-title>材料来源：</hc-info-table-td>
                            <hc-info-table-td width="120px">-</hc-info-table-td>
                        </tr>
                        <tr>
                            <hc-info-table-td center is-title>材料是否符合要求：</hc-info-table-td>
                            <hc-info-table-td width="120px">否</hc-info-table-td>
                            <hc-info-table-td center is-title>存储方法是否符合要求：</hc-info-table-td>
                            <hc-info-table-td width="120px">否</hc-info-table-td>
                        </tr>
                        <tr>
                            <hc-info-table-td center is-title>合格证号：</hc-info-table-td>
                            <hc-info-table-td width="auto" colspan="3">-</hc-info-table-td>
                        </tr>
                        <tr>
                            <hc-info-table-td center is-title>备注：</hc-info-table-td>
                            <hc-info-table-td width="auto" colspan="3">-</hc-info-table-td>
                        </tr>
                    </hc-info-table>
                    <div class="mt-5">附件列表</div>
                    <div class="mt-3">
                        <el-check-tag checked class="mr-2">文件名称1.jpg</el-check-tag>
                        <el-check-tag checked class="mr-2">文件名称2.jpg</el-check-tag>
                        <el-check-tag checked class="mr-2">文件名称3.jpg</el-check-tag>
                        <el-check-tag checked class="mr-2">文件名称4.jpg</el-check-tag>
                    </div>
                </hc-card-item>
            </div>
        </div>
        <!-- 新增/修改 -->
        <HcDataModal v-model="isDataModal" />

        <!-- 上报弹窗 -->
        <hc-report-dialog v-model="isReport" />
    </hc-new-card>
</template>

<script setup>
import { onMounted, ref } from 'vue'
import HcDataModal from './components/order/dataModal.vue'

defineOptions({
    name: 'PeriodsMaterialOrder',
})

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

})

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

//计量期
const key1Data = ref([
    { id: 1, name: '计量期1' },
    { id: 2, name: '计量期2' },
])
const searchKey1Click = () => {

}

//分页
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: 'action', name: '操作', width: 94 },
])
const tableData = ref([
    { key1: '1111' },
])

//表格选择
const tableCheckChange = () => {

}

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

//修改
const rowEditClick = (row) => {
    isDataModal.value = true
}

//是否上报
const isReport = ref(false)
const reportClick = () => {
    isReport.value = true
}
</script>

<style scoped lang="scss">

</style>
