| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
- <script lang="ts" setup>
- // @ts-ignore
- import { computed, ref } from 'vue';
- import { ElCard, ElDescriptions, ElDescriptionsItem } from 'element-plus';
- // @ts-ignore
- import { useVbenVxeGrid } from '#/adapter/vxe-table';
- // 定义组件的Props接口
- interface SalesSurveyProps {
- taskList: any;
- }
- // 接收父组件传递的任务详情数据
- const props = defineProps<SalesSurveyProps>();
- // 计算属性,获取销售调研数据
- const salesSurveyData = computed(() => {
- return props.taskList || [];
- });
- // 格式化日期时间
- // 格式化数值,保留两位小数
- const formatNumber = (value: number | string) => {
- if (value === undefined || value === null || value === '') return '-';
- const num = Number(value);
- if (isNaN(num)) return '-';
- return num.toFixed(2);
- };
- // 表格列配置
- const tableColumns: any = [
- {
- field: 'competitorName',
- title: '油站',
- // width: 100,
- fixed: 'left',
- formatter: ({ row }) => {
- return row.competitorName || row.stationName || '-';
- },
- },
- {
- field: 'gasCar',
- title: '汽油车',
- width: 180,
- children: [
- {
- field: 'gasRoadFlow',
- title: '路面车流',
- width: 90,
- },
- {
- field: 'gasInFlow',
- title: '进站车流',
- width: 90,
- },
- ],
- },
- {
- field: 'dieselCar',
- title: '柴油车',
- width: 180,
- children: [
- {
- field: 'dieselRoadFlow',
- title: '路面车流',
- width: 90,
- },
- {
- field: 'dieselInFlow',
- title: '进站车流',
- width: 90,
- },
- ],
- },
- {
- field: 'motorcycle',
- title: '摩托车',
- width: 180,
- children: [
- {
- field: 'motorcycleRoadFlow',
- title: '路面车流',
- width: 90,
- },
- {
- field: 'motorcycleInFlow',
- title: '进站车流',
- width: 90,
- },
- ],
- },
- ];
- // 初始化表格配置
- const gridOptions: any = {
- size: 'medium',
- toolbarConfig: {
- custom: false,
- refresh: false,
- zoom: false,
- },
- pagerConfig: {
- enabled: false,
- },
- proxyConfig: {
- ajax: {
- query: async () => {
- return {
- items: props.taskList || [],
- };
- },
- },
- },
- columns: tableColumns,
- };
- // 表格数据
- const tableDatas = ref<any>([]);
- // 使用BasicTable组件
- const [BasicTable, basicTableApi] = useVbenVxeGrid({
- gridOptions,
- });
- </script>
- <template>
- <ElCard>
- <template #header>
- <div class="flex items-center gap-4">
- <div style="width: 4px; height: 12px; background-color: #215acd"></div>
- <span
- class="text-lg font-bold text-gray-800"
- style="font-size: 14px; font-weight: 600"
- >
- 拐入率调研详情
- </span>
- </div>
- </template>
- <div class="task-info">
- <!-- 基本信息 -->
- <div class="section-title">
- <div class="section-bar"></div>
- <span class="section-text">基本信息</span>
- </div>
- <ElDescriptions :column="4" class="mb-6">
- <ElDescriptionsItem label="调查开始时间:">
- {{ taskList[0].surveyStartTime || '-' }}
- </ElDescriptionsItem>
- <ElDescriptionsItem label="调查结束时间:">
- {{ taskList[0].surveyEndTime || '-' }}
- </ElDescriptionsItem>
- </ElDescriptions>
- <!-- 销量调查表格 -->
- <div class="section-title">
- <div class="section-bar"></div>
- <span class="section-text">销量调查数据</span>
- </div>
- <div class="mb-6">
- <BasicTable table-title="" class="w-full" />
- </div>
- </div>
- </ElCard>
- </template>
- <style scoped lang="scss">
- .task-info {
- .section-title {
- display: flex;
- align-items: center;
- gap: 8px;
- margin: 20px 0 12px 0;
- .section-bar {
- width: 4px;
- height: 12px;
- background-color: #215acd;
- }
- .section-text {
- font-size: 14px;
- font-weight: 600;
- color: var(--text-color-primary);
- }
- }
- :deep(.el-descriptions) {
- margin-bottom: 0 !important;
- }
- :deep(.el-descriptions__label) {
- font-size: 14px;
- font-weight: 400;
- color: var(--text-color-secondary);
- }
- :deep(.el-descriptions__content) {
- font-size: 14px;
- font-weight: 500;
- color: var(--text-color-primary);
- }
- :deep(.el-descriptions__table) {
- background: transparent !important;
- }
- }
- </style>
|