<template>
    <div style="height: 100%" class="d-flex flex1 ov-hd flex-cln pd-16">
        <vxe-table :loading="loading" border :data="orderHistoryItem" min-height="0" max-height="100%">
            <vxe-column title="序号" align="center" type="seq" width="50" />
            <vxe-column title="发起方" field="starter" :formatter="colNoData" />
            <vxe-column title="事项名称" field="title" :formatter="colNoData" />
            <vxe-column title="时间">
                <template #default="{ row }">
                    <span>{{ row.startTime }} 至 {{ row.endTime }}</span>
                </template>
            </vxe-column>
            <vxe-column title="参与方式" width="80">
                <template #default="{ row }">
                    <DictTag :options="dm_join_type" :value="row?.joinType"></DictTag>
                </template>
            </vxe-column>
            <vxe-column title="联系人" width="80" field="contact" :formatter="colNoData" />
            <vxe-column title="联系电话" width="110" field="tel" :formatter="colNoData" />
            <vxe-column title="事项状态" width="100">
                <template #default="{ row }">
                    <DictTag :options="dm_expert_item_list" :value="row?.res"></DictTag>
                </template>
            </vxe-column>
            <vxe-column title="操作" width="100" align="center" fixed="right">
                <template #default="{ row }">
                    <el-button @click="editRow(row)" text>详情</el-button>
                </template>
            </vxe-column>
        </vxe-table>
    </div>
</template>
<script setup name="ExtractedRecord" lang="ts">
import { colNoData } from '@/utils/noData';
import {ref,onMounted} from 'vue'
import {expertChooseHistory } from '@/api/authority/index';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const dict = proxy?.useDict('dm_join_type', 'yes_no', 'sys_sex_type', 'dm_position_status','dm_educational_type',"dm_expert_item_list");
const {  dm_join_type, yes_no, sys_sex_type,dm_position_status,dm_educational_type,dm_expert_item_list } = toRefs<any>(dict);
const { query }:any = useRoute()
const props = defineProps({
  info: {
    type: String, // 指定类型
    required: true, // 是否必传
    default: () => ({}) // 默认值
  }
})
const router = useRouter();
const loading = ref(true);
const orderHistoryItem =ref<any>(null);
const getchoose = async () => {
    loading.value = true;
    const res = await expertChooseHistory({personId:query?.id});
    if (!res || res.code !== 200) return;
    orderHistoryItem.value = res.rows;
    loading.value = false;
};
const editRow = (row) => {
    router.push({ path: 'choose-detail', query: { id: row.expertChooseId } });
};
onMounted(()=>{
getchoose()
})
</script>
