<template>
    <myTable :baseData="baseData" :project="project" editPath="project_cost_budget_detail"></myTable>
    <myTable :baseData="baseData1" :project="project" editPath="project_material_budget_detail"></myTable>
    <myTable :baseData="baseData2" :project="project" editPath="project_subpackage_budget_detail"></myTable>
    <myTable :baseData="baseData3" :project="project" editPath="project_equipment_budget_detail"></myTable>
    <myTable :baseData="baseData4" :project="project" editPath="project_labor_budget_detail"></myTable>
</template>

<script setup>

import { ref, reactive, defineProps } from "vue"
import myTable from "./myTable.vue"
import { apiProjectCostBudgetDetailLists, apiProjectCostBudgetDetailDelete, apiProjectCostBudgetDetailDetail } from '@/api/project_cost_budget_detail'
import { MaterialbudgetDetailLists, MaterialbudgetDetailDelete, MaterialbudgetDetailDetail } from '@/api/project_material_budget_detail.ts'
import { subpackagdetailLists, subpackagdetailDelete, subpackagdetailDetail } from '@/api/project_subpackage_budget_detail.ts'
import { apiProjectEquipmentBudgetDetailLists, apiProjectEquipmentBudgetDetailDelete, apiProjectEquipmentBudgetDetailDetail } from '@/api/project_equipment_budget_detail.ts'
import { apiProjectLaborBudgetDetailLists, apiProjectLaborBudgetDetailDelete, apiProjectLaborBudgetDetailDetail } from '@/api/project_labor_budget_detail.ts'

const props = defineProps({
    project: Object
})

const baseData = reactive({
    fetchFun: apiProjectCostBudgetDetailLists,
    editApi: apiProjectCostBudgetDetailDetail,
    delApi: apiProjectCostBudgetDetailDelete,
    tit: "费用预算",
    queryParams: { project_id: props.project.id },
    columnList: [
        { label: '项目名称', prop: 'project_name' },
        { label: '费用预算单号', prop: 'cost_budget_code' },
        { label: '一级科目', prop: 'first_level_subject' },
        { label: '二级科目', prop: 'second_level_subject' },
        { label: '三级科目', prop: 'third_level_subject' },
        { label: '是否差旅科目', prop: 'is_travel_text' },
        { label: '预算金额', prop: 'amount' },
        { label: '编制标准', prop: 'standard' },
    ]
})


const baseData1 = reactive({
    fetchFun: MaterialbudgetDetailLists,
    editApi: MaterialbudgetDetailDetail,
    delApi: MaterialbudgetDetailDelete,
    tit: "材料预算",
    queryParams: { project_id: props.project.id },
    columnList: [
        { label: '预算单号', prop: 'material_budget_code' },
        { label: '项目名称', prop: 'project_name' },
        { label: '项目编码', prop: 'project_code' },
        { label: '类型', prop: 'budget_type' },
        { label: '材料大类', prop: 'material_first_level' },
        { label: '材料中类', prop: 'material_second_level' },
        { label: '材料小类', prop: 'material_three_level' },
        { label: '材料名称', prop: 'material_name' },
        { label: '材料编码', prop: 'material_code' },
        { label: '规格型号', prop: 'material_specs' },
        { label: '品牌', prop: 'material_brand' },
        { label: '参数说明', prop: 'material_parameter_description' },
        { label: '单位', prop: 'material_unit' },
        { label: '申请数量', prop: 'apply_num' },
        { label: '预算数量', prop: 'num' },
        { label: '剩余预算数量', prop: 'residual_num' },
        { label: '单价', prop: 'price' },
        { label: '金额', prop: 'amount' },
        { label: '备注', prop: 'remark' },
    ]
})


const baseData2 = reactive({
    fetchFun: subpackagdetailLists,
    editApi: subpackagdetailDetail,
    delApi: subpackagdetailDelete,
    tit: "分包预算",
    queryParams: { project_id: props.project.id },
    columnList: [
        { label: '预算单号', prop: 'subpackage_budget_code' },
        { label: '项目名称', prop: 'project_name' },
        { label: '项目编码', prop: 'project_code' },
        { label: '工作类型', prop: 'work_type' },
        { label: '工作内容', prop: 'work_content' },
        { label: '项目特征', prop: 'project_features' },
        { label: '单位', prop: 'unit' },
        { label: '预算总工作量', prop: 'num' },
        { label: '单价', prop: 'amount' },
        { label: '备注', prop: 'remark' },
        { label: '已分包工作量', prop: 'has_subcontract_num' },
        { label: '剩余预算工作量', prop: 'residue_num' },

    ]
})

const baseData3 = reactive({
    fetchFun: apiProjectEquipmentBudgetDetailLists,
    editApi: apiProjectEquipmentBudgetDetailDetail,
    delApi: apiProjectEquipmentBudgetDetailDelete,
    tit: "机具预算",
    queryParams: { project_id: props.project.id },
    columnList: [
        { label: '项目名称', prop: 'project_name' },
        { label: '机具预算单号', prop: 'equipment_budget_code' },
        { label: '机具类别', prop: 'type' },
        { label: '机具名称', prop: 'name' },
        { label: '规格型号', prop: 'spec' },
        { label: '单位', prop: 'unit' },
        { label: '数量', prop: 'num' },
        { label: '单价', prop: 'price' },
        { label: '金额', prop: 'amount' },
        { label: '备注', prop: 'remark' },
    ]
})

const baseData4 = reactive({
    fetchFun: apiProjectLaborBudgetDetailLists,
    editApi: apiProjectLaborBudgetDetailDetail,
    delApi: apiProjectLaborBudgetDetailDelete,
    tit: "人工预算",
    queryParams: { project_id: props.project.id },
    columnList: [
        { label: '工种名称', prop: 'job_type_name' },
        { label: '人工说明', prop: 'desc' },
        { label: '单位', prop: 'unit' },
        { label: '数量', prop: 'num' },
        { label: '单价', prop: 'price' },
        { label: '金额', prop: 'amount' },
        { label: '备注', prop: 'remark' },
    ]
})


</script>