<template>
    <div class="tit">项目跟进</div>
    <div>
        <el-table :data="tableData1" stripe style="width: 100%">
            <el-table-column label="主题" prop='theme' width="180" />
            <el-table-column label="日期" prop='follow_date' width="180" />
            <el-table-column label="方案内容" prop='solution_content' />
            <el-table-column label="类型" prop='follow_type_text' />
            <el-table-column label="执行人" prop='executor' />
            <el-table-column label="阶段" prop='follow_stage_text' />
            <el-table-column label="状态" prop='follow_status_text' />
            <el-table-column label="项目把握度" prop='project_assurance_text' />
        </el-table>
    </div>
    <!-- <div style="margin: 20px 0;">
        <el-pagination v-model:current-page="pager1.page_no" v-model:page-size="pager1.page_size"
            :page-sizes="[10, 20, 30, 40]" layout="total, sizes, prev, pager, next, jumper" :total="total"
            @size-change="handleSizeChange1" @current-change="handleCurrentChange1" />
    </div>

    <div class="tit">客户需求</div>
    <div>
        <el-table :data="tableData2" stripe style="width: 100%">
            <el-table-column label="需求主题" prop='theme' width="180" />
            <el-table-column label="重要程度" prop='importance_text' width="180" />
            <el-table-column label="记录时间" prop='recording_time' />
            <el-table-column label="需求内容" prop='demand_content' />
            <el-table-column label="附件" prop="annex" show-overflow-tooltip>
                <template #default="{ row }">
                    <div v-if="row.annex && row.annex.length > 0">
                        <div v-for="(item, i) in row.annex " :key='i'>
                            <el-link :href="item" target="_blank">文件{{ i + 1 }}查看</el-link>
                        </div>
                    </div>
                    <div v-else>
                        暂无文件
                    </div>
                </template>
            </el-table-column>
        </el-table>
    </div>
    <div style="margin: 20px 0;">
        <el-pagination v-model:current-page="pager2.page_no" v-model:page-size="pager2.page_size"
            :page-sizes="[10, 20, 30, 40]" layout="total, sizes, prev, pager, next, jumper" :total="total1"
            @size-change="handleSizeChange2" @current-change="handleCurrentChange2" />
    </div>

    <div class="tit">解决方案</div> -->
    <!-- <div>
        <el-table :data="tableData3" stripe style="width: 100%">
            <el-table-column label="解决方案主题" prop='customer_demand_name' width="180" />
            <el-table-column label="提交时间" prop='submission_time' width="180" />
            <el-table-column label="方案内容" prop='solution_content' />
            <el-table-column label="客户反馈" prop='customer_feedback' />
            <el-table-column label="附件" prop="annex" show-overflow-tooltip>
                <template #default="{ row }">
                    <div v-if="row.annex && row.annex.length > 0">
                        <div v-for="(item, i) in row.annex " :key='i'>
                            <el-link :href="item" target="_blank">文件{{ i + 1 }}查看</el-link>
                        </div>
                    </div>
                    <div v-else>
                        暂无文件
                    </div>
                </template>
            </el-table-column>
        </el-table>
    </div> -->
    <!-- <div style="margin: 20px 0;">
        <el-pagination v-model:current-page="pager3.page_no" v-model:page-size="pager3.page_size"
            :page-sizes="[10, 20, 30, 40]" layout="total, sizes, prev, pager, next, jumper" :total="total2"
            @size-change="handleSizeChange3" @current-change="handleCurrentChange3" />
    </div>

    <div class="tit">项目概算</div>
    <div>
        <el-table :data="tableData4" stripe style="width: 100%">
            <el-table-column label="概算来源" prop='estimate_source_text' width="180" />
            <el-table-column label="制单人" prop='create_user' width="180" />
            <el-table-column label="报价日期" prop='quotation_date' />
            <el-table-column label="技术人员" prop='technician_name' width="180" />
            <el-table-column label="概算金额(万元)" prop='estimate_amount' width="180" />
            <el-table-column label="要求" prop='ask' />
            <el-table-column label="附件" prop="annex" show-overflow-tooltip>
                <template #default="{ row }">
                    <div v-if="row.annex && row.annex.length > 0">
                        <div v-for="(item, i) in row.annex " :key='i'>
                            <el-link :href="item" target="_blank">文件{{ i + 1 }}查看</el-link>
                        </div>
                    </div>
                    <div v-else>
                        暂无文件
                    </div>
                </template>
            </el-table-column>
        </el-table>
    </div>
    <div style="margin: 20px 0;">
        <el-pagination v-model:current-page="pager4.page_no" v-model:page-size="pager4.page_size"
            :page-sizes="[10, 20, 30, 40]" layout="total, sizes, prev, pager, next, jumper" :total="total3"
            @size-change="handleSizeChange4" @current-change="handleCurrentChange4" />
    </div>

    <div class="tit">竞争对手</div>
    <div>
        <el-table :data="tableData5" stripe style="width: 100%">
            <el-table-column label="竞争对手名称" prop='competitor_name' width="180" />
            <el-table-column label="竞争对手联系人" prop='competitor_contacts' width="180" />
            <el-table-column label="联系人电话" prop='competitor_contacts_phone' />
            <el-table-column label="竞争能力" prop='competitive_power' />
            <el-table-column label="竞争对手优势" prop='competitor_advantages' />
            <el-table-column label="竞争对手劣势" prop='competitor_disadvantages' />
            <el-table-column label="备注" prop='remark' />
            <el-table-column label="附件" prop="annex" show-overflow-tooltip>
                <template #default="{ row }">
                    <div v-if="row.annex && row.annex.length > 0">
                        <div v-for="(item, i) in row.annex " :key='i'>
                            <el-link :href="item" target="_blank">文件{{ i + 1 }}查看</el-link>
                        </div>
                    </div>
                    <div v-else>
                        暂无文件
                    </div>
                </template>
            </el-table-column>
        </el-table>
    </div>
    <div style="margin: 20px 0;">
        <el-pagination v-model:current-page="pager5.page_no" v-model:page-size="pager5.page_size"
            :page-sizes="[10, 20, 30, 40]" layout="total, sizes, prev, pager, next, jumper" :total="total4"
            @size-change="handleSizeChange5" @current-change="handleCurrentChange5" />
    </div> -->
</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'


const tableData1 = ref([])
const tableData2 = ref([])
const tableData3 = ref([])
const tableData4 = ref([])
const tableData5 = ref([])


const pager1 = reactive({
    page_size: 10,
    page_no: 1,
    project_id: ""
})
// const pager2 = reactive({
//     page_size: 10,
//     page_no: 1,
//     project_id: ""
// })
// const pager3 = reactive({
//     page_size: 10,
//     page_no: 1,
//     project_id: ""
// })
// const pager4 = reactive({
//     page_size: 10,
//     page_no: 1,
//     project_id: ""
// })
const pager5 = reactive({
    page_size: 10,
    page_no: 1,
    project_id: ""
})


// //获取客户跟进进路
const followUpLists = () => {
    apiProjectFollowUpLists(pager5).then((res) => {
        tableData1.value = res.lists
        total.value = res.count

    })
}
//获取客户需求列表
const demandList = () => {
    apiCustomerDemandLists(pager5).then((res) => {
        tableData2.value = res.lists
        total1.value = res.count

    })
}


// 解决方案列表
// const solutionLists = () => {
//     apiCustomerDemandSolutionLists(pager5).then((res) => {
//         tableData3.value = res.lists
//         total2.value = res.count

//     })
// }

// 获取项目概算列表
// const estimateLists = () => {
//     apiProjectEstimateLists(pager4).then((res) => {
//         tableData4.value = res.lists
//         total3.value = res.count
//     })
// }

// 获取竞争对手列表
// const competitorLists = () => {
//     apiCompetitorLists(pager5).then((res) => {
//         tableData5.value = res.lists
//         total4.value = res.count
//     })
// }

// const handleSizeChange1 = (val: number) => {
//     pager1.page_size = val
//     followUpLists()
// }
// const handleSizeChange2 = (val: number) => {
//     pager2.page_size = val
//     demandList()
// }
// const handleSizeChange3 = (val: number) => {
//     pager3.page_size = val
//     solutionLists()
// }
// const handleSizeChange4 = (val: number) => {
//     pager4.page_size = val
//     estimateLists()
// }
// const handleSizeChange5 = (val: number) => {
//     pager5.page_size = val
//     competitorLists()
// }


// //获取客户需求列表
// const demandList = () => {
//     apiCustomerDemandLists(pager5).then((res) => {
//         tableData1.value = res.lists
//         total1.value = res.count

//     })
// }
followUpLists()
// demandList()
// competitorLists()
// solutionLists()
// estimateLists()
</script>