Browse Source

修改默认时间

zq940222 4 weeks ago
parent
commit
0e0c01d2ae
2 changed files with 39 additions and 17 deletions
  1. 34 7
      src/views/adweb/data/components/CompanyList.vue
  2. 5 10
      src/views/adweb/data/customsData.vue

+ 34 - 7
src/views/adweb/data/components/CompanyList.vue

@@ -3,7 +3,6 @@
     <div v-for="company in companies" :key="company.name" class="company-card">
       <div class="company-header">
         <h3 class="company-name">{{ company.name }}</h3>
-        <a-button type="primary" size="small" @click="handleCompareClick(company)"> 对比 </a-button>
       </div>
 
       <div class="company-stats">
@@ -38,20 +37,48 @@
 </template>
 
 <script lang="ts" setup>
-  import { defineProps, defineEmits } from 'vue';
+  import { ref, onMounted } from 'vue'
+  import { getSupplierReport } from '../customsData.api'
+
+  interface Company {
+    name: string
+    // ... other company fields
+  }
+
+  const companies = ref<Company[]>([])
+  const currentPage = ref(1)
+  const pageSize = ref(10)
+  const total = ref(0)
+  const loading = ref(false)
+
+  const fetchCompanies = async () => {
+    try {
+      loading.value = true
+      const response = await getSupplierReport({
+        page: currentPage.value,
+        pageSize: pageSize.value
+      })
+      companies.value = response.data.list
+      total.value = response.data.total
+    } catch (error) {
+      console.error('Failed to fetch companies:', error)
+    } finally {
+      loading.value = false
+    }
+  }
+
+  onMounted(() => {
+    fetchCompanies()
+  })
 
   const props = defineProps({
-    companies: {
+    queryParam: {
       type: Array,
       required: true,
       default: () => [],
     },
   });
 
-  const emit = defineEmits(['compare']);
-  const handleCompareClick = (company) => {
-    emit('compare', company);
-  };
 </script>
 
 <style lang="less" scoped>

+ 5 - 10
src/views/adweb/data/customsData.vue

@@ -316,9 +316,9 @@
         </div>
       </a-tab-pane>
 
-      <a-tab-pane key="companies" tab="企业列表">
-        <company-list :companies="companiesData" @compare="handleCompareClick" />
-      </a-tab-pane>
+      <!-- <a-tab-pane key="companies" tab="企业列表">
+        <company-list :queryParam="queryParam" />
+      </a-tab-pane> -->
 
       <a-tab-pane key="tradeAnalysis" tab="贸易类分析报告">
         <div class="analysis-content">
@@ -648,8 +648,8 @@ const queryParam = reactive<any>({});
 const form = ref({
   product: '',
   hsCode: '',
-  startDate: dayjs('20230101'),//后面更换
-  endDate: dayjs('20230630'),//后面更换
+  startDate: dayjs().subtract(1, 'year'), // Set start date to one year ago
+  endDate: dayjs(), // Set end date to today
   supplier: '',
   supplierReg: '',
   supplierAddress: '',
@@ -825,11 +825,6 @@ const handleCompaniesData = (companies) => {
   }));
 };
 
-// 处理对比点击
-const handleCompareClick = (company) => {
-  console.log('Compare clicked for company:', company.name);
-};
-
 // Consolidate handleTabChange function
 const handleTabChange = async (key: string) => {
   activeTabKey.value = key;