
<template>
    <div class="detail-popup">
        <popup ref="popupRef" title="分部分项划分详情" :async="true" width="80%" @confirm="handleSubmit" @close="handleClose">
            <el-form ref="formRef" :model="formData" label-width="120px">
                <el-card class="mb-2">
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="分部工程">
                                {{ formData.division_engineering }}
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="子分部工程">
                                {{ formData.sub_division_engineering }}
                            </el-form-item>
                        </el-col>

                        <el-col :span="12">
                            <el-form-item label="分项工程">
                                {{ formData.subentry_engineering }}
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="分项工程编码">
                                {{ formData.subentry_engineering_code }}
                            </el-form-item>
                        </el-col>

                    </el-row>
                    <div style="margin:10px 0">施工工序</div>
                    <div>
                        <el-table :data="gxList">
                            <el-table-column label="序号" type="index" width="55" />
                            <el-table-column label="工序步骤号" prop="process_step_no" show-overflow-tooltip />
                            <el-table-column label="工序步骤" prop="process_step" show-overflow-tooltip />
                            <el-table-column label="质量控制点" prop="quality_control_points" show-overflow-tooltip />
                            <el-table-column label="图例说明" prop="file" show-overflow-tooltip>
                                <template #default="{ row }">
                                    <div v-if="row.file && row.file.length > 0"> <material-picker v-model="row.file" /></div>
                                    <div v-else>暂无文件</div>
                                </template>
                            </el-table-column>

                        </el-table>
                    </div>
                </el-card>
            </el-form>
        </popup>
    </div>
</template>

<script lang="ts" setup name="customdetail">

import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { listToDivision } from '@/api/build/build_process_settings'
import { timeFormat } from '@/utils/util'
import type { PropType } from 'vue'
defineProps({
    dictData: {
        type: Object as PropType<Record<string, any[]>>,
        default: () => ({})
    }
})
const emit = defineEmits(['success', 'close'])
const formRef = shallowRef<FormInstance>()
const popupRef = shallowRef<InstanceType<typeof Popup>>()
const gxList = ref([])
const datas = reactive({
    provinceOptions: [],
    cityOptions: [],
    areaOptions: [],
});


// 表单数据
const formData = reactive({

})



// 获取详情
const setFormData = async (data: Record<any, any>) => {
    Object.assign(formData, data)

    gxlist(data.id)

}

//获取工序
const gxlist = async (id) => {
    let res = await listToDivision({ division_id: id, page_no: 1, page_size: 888 })
    gxList.value = res.lists

}


// 提交按钮
const handleSubmit = async () => {
    popupRef.value?.close()

}

//打开弹窗
const open = () => {
    console.log('1111111')
    popupRef.value?.open()

}

// 关闭回调
const handleClose = () => {
    emit('close')
}








defineExpose({
    open,
    setFormData

})
</script>
<style lang="scss">
.tit {
    font-size: 1.2em;
    margin-bottom: 10px;
}
</style>
