No Description

entrance.vue 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <script lang="ts" setup>
  2. // @ts-ignore
  3. import { computed, ref } from 'vue';
  4. import { ElCard, ElDescriptions, ElDescriptionsItem } from 'element-plus';
  5. // @ts-ignore
  6. import { useVbenVxeGrid } from '#/adapter/vxe-table';
  7. // 定义组件的Props接口
  8. interface SalesSurveyProps {
  9. taskList: any;
  10. }
  11. // 接收父组件传递的任务详情数据
  12. const props = defineProps<SalesSurveyProps>();
  13. // 计算属性,获取销售调研数据
  14. const salesSurveyData = computed(() => {
  15. return props.taskList || [];
  16. });
  17. // 格式化日期时间
  18. // 格式化数值,保留两位小数
  19. const formatNumber = (value: number | string) => {
  20. if (value === undefined || value === null || value === '') return '-';
  21. const num = Number(value);
  22. if (isNaN(num)) return '-';
  23. return num.toFixed(2);
  24. };
  25. // 表格列配置
  26. const tableColumns: any = [
  27. {
  28. field: 'competitorName',
  29. title: '油站',
  30. // width: 100,
  31. fixed: 'left',
  32. formatter: ({ row }) => {
  33. return row.competitorName || row.stationName || '-';
  34. },
  35. },
  36. {
  37. field: 'gasCar',
  38. title: '汽油车',
  39. width: 180,
  40. children: [
  41. {
  42. field: 'gasRoadFlow',
  43. title: '路面车流',
  44. width: 90,
  45. },
  46. {
  47. field: 'gasInFlow',
  48. title: '进站车流',
  49. width: 90,
  50. },
  51. ],
  52. },
  53. {
  54. field: 'dieselCar',
  55. title: '柴油车',
  56. width: 180,
  57. children: [
  58. {
  59. field: 'dieselRoadFlow',
  60. title: '路面车流',
  61. width: 90,
  62. },
  63. {
  64. field: 'dieselInFlow',
  65. title: '进站车流',
  66. width: 90,
  67. },
  68. ],
  69. },
  70. {
  71. field: 'motorcycle',
  72. title: '摩托车',
  73. width: 180,
  74. children: [
  75. {
  76. field: 'motorcycleRoadFlow',
  77. title: '路面车流',
  78. width: 90,
  79. },
  80. {
  81. field: 'motorcycleInFlow',
  82. title: '进站车流',
  83. width: 90,
  84. },
  85. ],
  86. },
  87. ];
  88. // 初始化表格配置
  89. const gridOptions: any = {
  90. size: 'medium',
  91. toolbarConfig: {
  92. custom: false,
  93. refresh: false,
  94. zoom: false,
  95. },
  96. pagerConfig: {
  97. enabled: false,
  98. },
  99. proxyConfig: {
  100. ajax: {
  101. query: async () => {
  102. return {
  103. items: props.taskList || [],
  104. };
  105. },
  106. },
  107. },
  108. columns: tableColumns,
  109. };
  110. // 表格数据
  111. const tableDatas = ref<any>([]);
  112. // 使用BasicTable组件
  113. const [BasicTable, basicTableApi] = useVbenVxeGrid({
  114. gridOptions,
  115. });
  116. </script>
  117. <template>
  118. <ElCard>
  119. <template #header>
  120. <div class="flex items-center gap-4">
  121. <div style="width: 4px; height: 12px; background-color: #215acd"></div>
  122. <span
  123. class="text-lg font-bold text-gray-800"
  124. style="font-size: 14px; font-weight: 600"
  125. >
  126. 拐入率调研详情
  127. </span>
  128. </div>
  129. </template>
  130. <div class="task-info">
  131. <!-- 基本信息 -->
  132. <div class="section-title">
  133. <div class="section-bar"></div>
  134. <span class="section-text">基本信息</span>
  135. </div>
  136. <ElDescriptions :column="4" class="mb-6">
  137. <ElDescriptionsItem label="调查开始时间:">
  138. {{ taskList[0].surveyStartTime || '-' }}
  139. </ElDescriptionsItem>
  140. <ElDescriptionsItem label="调查结束时间:">
  141. {{ taskList[0].surveyEndTime || '-' }}
  142. </ElDescriptionsItem>
  143. </ElDescriptions>
  144. <!-- 销量调查表格 -->
  145. <div class="section-title">
  146. <div class="section-bar"></div>
  147. <span class="section-text">销量调查数据</span>
  148. </div>
  149. <div class="mb-6">
  150. <BasicTable table-title="" class="w-full" />
  151. </div>
  152. </div>
  153. </ElCard>
  154. </template>
  155. <style scoped lang="scss">
  156. .task-info {
  157. .section-title {
  158. display: flex;
  159. align-items: center;
  160. gap: 8px;
  161. margin: 20px 0 12px 0;
  162. .section-bar {
  163. width: 4px;
  164. height: 12px;
  165. background-color: #215acd;
  166. }
  167. .section-text {
  168. font-size: 14px;
  169. font-weight: 600;
  170. color: var(--text-color-primary);
  171. }
  172. }
  173. :deep(.el-descriptions) {
  174. margin-bottom: 0 !important;
  175. }
  176. :deep(.el-descriptions__label) {
  177. font-size: 14px;
  178. font-weight: 400;
  179. color: var(--text-color-secondary);
  180. }
  181. :deep(.el-descriptions__content) {
  182. font-size: 14px;
  183. font-weight: 500;
  184. color: var(--text-color-primary);
  185. }
  186. :deep(.el-descriptions__table) {
  187. background: transparent !important;
  188. }
  189. }
  190. </style>