<template>
    <myTable :baseData="baseData" :project="project" editPath="project_cost_budget"></myTable>
    <myTable :baseData="baseData1" :project="project" editPath="project_material_budget"></myTable>
    <myTable :baseData="baseData2" :project="project" editPath="project_subpackage_budget"></myTable>
    <myTable :baseData="baseData3" :project="project" editPath="project_equipment_budget"></myTable>
    <myTable :baseData="baseData4" :project="project" editPath="project_labor_budget"></myTable>
</template>

<script setup>

import { ref, reactive, defineProps } from "vue"
import myTable from "./myTable.vue"
import { apiProjectCostBudgetLists } from '@/api/project_cost_budget'
import { MaterialbudgetDetailLists } from '@/api/project_material_budget_detail.ts'
import { subpackagdetailLists } from '@/api/project_subpackage_budget_detail.ts'
import { apiProjectEquipmentBudgetDetailLists } from '@/api/project_equipment_budget_detail.ts'
import { apiProjectLaborBudgetDetailLists } from '@/api/project_labor_budget_detail.ts'

const props = defineProps({
    project: Object
})

const baseData = reactive({
    fetchFun: apiProjectCostBudgetLists,
    tit: "费用预算",
    queryParams: { project_id: props.project.id },
    columnList: [
        { label: '项目名称', prop: 'project_name' },
        { label: '费用预算单号', prop: 'cost_budget_code' },
        { label: '金额', prop: 'total_amount' },
        { label: '备注', prop: 'remark' },

    ]
})


const baseData1 = reactive({
    fetchFun: MaterialbudgetDetailLists,
    tit: "材料预算",
    queryParams: { project_id: props.project.id },
    columnList: [
        { label: '材料名称', prop: 'material_name' },
        { label: '材料编码', prop: 'material_code' },
        { label: '规格单号', prop: 'material_budget_code' },
        { label: '品牌', prop: 'material_brand' },
        { label: '参数说明', prop: 'material_parameter_description' },
        { label: '单位', prop: 'material_unit' },
        { label: '预算数量', prop: 'num' },
        { label: '单价', prop: 'price' },
        { label: '金额', prop: 'amount' },
        { label: '已申购量', prop: 'apply_num' },
        { label: '剩余数量', prop: 'residual_num' },
    ]
})


const baseData2 = reactive({
    fetchFun: subpackagdetailLists,
    tit: "分包预算",
    queryParams: { project_id: props.project.id },
    columnList: [
        { label: '工作类型', prop: 'work_type' },
        { label: '工作内容', prop: 'work_content' },
        { label: '项目特征', prop: 'project_features' },
        { label: '单位', prop: 'unit' },
        { label: '首次预算量', prop: 'num' },
        { label: '预算调正量', prop: 'price' },
        { label: '预算工作量', prop: 'amount' },
        { label: '单价', prop: 'price' },
        { label: '金额', prop: 'amount' },
        { label: '已分包量', prop: 'has_subcontract_num' },
        { label: '剩余工作量', prop: 'residue_num' },
    ]
})

const baseData3 = reactive({
    fetchFun: apiProjectEquipmentBudgetDetailLists,
    tit: "机具预算",
    queryParams: { project_id: props.project.id },
    columnList: [
        { label: '机具类别', prop: 'type' },
        { label: '机具名称', prop: 'name' },
        { label: '规格型号', prop: 'spec' },
        { label: '单位', prop: 'unit' },
        { label: '首次预算量', prop: '' },
        { label: '预算调整量', prop: '' },
        { label: '预算总量', prop: '' },
        { label: '单价', prop: 'price' },
        { label: '金额', prop: 'amount' },
        { label: '备注', prop: 'remark' },
    ]
})

const baseData4 = reactive({
    fetchFun: apiProjectLaborBudgetDetailLists,
    tit: "人工预算",
    queryParams: { project_id: props.project.id },
    columnList: [
        { label: '人工预算单号', prop: 'labor_budget_code' },
        { label: '项目名称', prop: 'project_name' },
        { label: '项目编码', prop: 'project_code' },
        { label: '数量', prop: 'total_num' },
        { label: '金额', prop: 'total_amount' },
        { label: '备注', prop: 'remark' },
    ]
})


</script>