<template>
    <myTable :baseData="baseData" :project="project" editPath="project_follow_up"></myTable>
    <myTable :baseData="baseData1" :project="project" editPath="customer_demand"></myTable>
    <myTable :baseData="baseData2" :project="project" editPath="customer_demand_solution"></myTable>
    <myTable :baseData="baseData3" :project="project" editPath="project_estimate"></myTable>
    <myTable :baseData="baseData4" :project="project" editPath="competitor"></myTable>
</template>

<script setup>

import { ref, reactive, defineProps } from "vue"
import { apiProjectFollowUpLists } from '@/api/project_follow_up'
import { apiCustomerDemandLists } from '@/api/customer_demand'
import { apiCustomerDemandSolutionLists } from '@/api/customer_demand_solution'
import { apiProjectEstimateLists } from '@/api/project_estimate'
import { apiCompetitorLists } from '@/api/competitor'
import myTable from "./myTable.vue"

const props = defineProps({
    project: Object
})


const baseData = reactive({
    fetchFun: apiProjectFollowUpLists,
    tit: "项目跟进",
    queryParams: { project_id: props.project.id },
    columnList: [
        { label: '项目名称', prop: 'project_name' },
        { label: '客户名称', prop: 'custom_name' },
        { label: '执行人', prop: 'executor' },
        { label: '类型', prop: 'follow_type_text' },
        { label: '主题', prop: 'theme' },
        { label: '项目把握度', prop: 'project_assurance_text' },
        { label: '状态', prop: 'follow_status_text' },
        { label: '阶段', prop: 'follow_stage_text' },
        { label: '下次回访日期', prop: 'next_follow_up_date' },
    ]
})
const baseData1 = reactive({
    fetchFun: apiCustomerDemandLists,
    tit: "客户需求",
    queryParams: { project_id: props.project.id },
    columnList: [
        { label: '项目名称', prop: 'project_name' },
        { label: '客户名称', prop: 'custom_name' },
        { label: '需求主题', prop: 'theme' },
        { label: '需求提供人', prop: 'supplier' },
        { label: '提供人联系方式', prop: 'supplier_contacts' },
        { label: '重要程度', prop: 'importance_text' },
        { label: '记录时间', prop: 'recording_time' },
        { label: '需求内容', prop: 'demand_content' },
    ]
})
const baseData2 = reactive({
    fetchFun: apiCustomerDemandSolutionLists,
    tit: "解决方案",
    queryParams: { project_id: props.project.id },
    columnList: [
        { label: '项目名称', prop: 'project_name' },
        { label: '客户名称', prop: 'custom_name' },
        { label: '需求名称', prop: 'customer_demand_name' },
        { label: '解决方案主题', prop: 'theme' },
        { label: '提交时间', prop: 'submission_time' },
        { label: '方案内容', prop: 'solution_content' },
        { label: '客户反馈', prop: 'customer_feedback' },
    ]
})



const baseData3 = reactive({
    fetchFun: apiProjectEstimateLists,
    tit: "项目概算",
    queryParams: { project_id: props.project.id },
    columnList: [
        { label: '项目名称', prop: 'project_name' },
        { label: '客户名称', prop: 'custom_name' },
        { label: '需求', prop: 'customer_demand_name' },
        { label: '概算来源', prop: 'estimate_source_text' },
        { label: '制单人', prop: 'create_user' },
        { label: '报价日期', prop: 'quotation_date' },
        { label: '发票类型', prop: 'invoice_type_text' },
        { label: '技术人员', prop: 'technician_name' },
        { label: '概算金额', prop: 'estimate_amount' },
    ]
})

const baseData4 = reactive({
    fetchFun: apiCompetitorLists,
    tit: "竞争对手",
    queryParams: { project_id: props.project.id },
    columnList: [
        { label: '项目名称', prop: 'project_name' },
        { label: '客户名称', prop: 'custom_name' },
        { label: '客户需求', prop: 'customer_demand_name' },
        { label: '竞争对手名称', prop: 'competitor_name' },
        { label: '竞争对手联系人', prop: 'competitor_contacts' },
        { label: '联系人电话', prop: 'competitor_contacts_phone' },
        { label: '竞争能力', prop: 'competitive_power' },
    ]
})

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