| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- <script setup lang="ts">
- import { type LocationQueryValue, useRoute } from 'vue-router'
- import { get1, get2, get3, get4 } from '@/api/home'
- import { provide, ref } from 'vue'
- import CompanyDetailSmallBox from '@/components/CompanyDetailSmallBox.vue'
- const route = useRoute()
- const k:any = route.query.n
- const currentShowList = ref<any>([]);
- function removeDuplicatesById(arr:any, key:any) {
- return arr.reduce((accumulator:any, current:any) => {
- if (!accumulator.some((item:any) => item[key] === current[key])) {
- accumulator.push(current);
- }
- return accumulator;
- }, []);
- }
- const getData =async ()=>{
- if(k == 1){
- console.log(1)
- const res1 = await get1({pageNum:1,pageSize:1000});
- const bo = removeDuplicatesById(res1.records, 'administrativePartyName')
- const result = bo.map((item:any)=>{
- return ({
- name: item.administrativePartyName,
- time: item.licenseDecisionDate?.split('T')[0],
- unifiedSocialCreditCode:item.unifiedSocialCreditCode
- })
- })
- currentShowList.value = result;
- }else if(k == 2){
- const res2 = await get2({pageNum:1,pageSize:1000});
- const bo = removeDuplicatesById(res2.records, 'administrativePartyName')
- const result = bo.map((item:any)=>{
- return ({
- name: item.administrativePartyName,
- time: item.penaltyDecisionDate?.split('T')[0],
- unifiedSocialCreditCode:item.unifiedSocialCreditCode
- })
- })
- currentShowList.value = result;
- }else if(k == 3){
- const res3 = await get3({pageNum:1,pageSize:1000});
- const bo = removeDuplicatesById(res3.records, 'subjectName')
- const result = bo.map((item:any)=>{
- return ({
- name: item.subjectName,
- time: item.statisticsTime?.split('T')[0],
- unifiedSocialCreditCode:item.unifiedSocialCreditCode
- })
- })
- currentShowList.value = result;
- }else if(k == 4){
- const res4:any = await get4({pageNum:1,pageSize:1000});
- const bo = removeDuplicatesById(res4.records, 'enterpriseName')
- console.log(bo)
- const result = bo.map((item:any)=>{
- return ({
- name: item.enterpriseName,
- time:item.filingTime?.split('T')[0],
- unifiedSocialCreditCode:item.unifiedSocialCreditCode
- })
- })
- currentShowList.value = result;
- }
- }
- const init = () => {
- getData();
- }
- const showConpanyDetail = (item:any)=>{
- if(k == 1){
- toCompanyDetailItemMethod.value = get1;
- dialogName.value = '行政许可'
- }else if(k == 2){
- toCompanyDetailItemMethod.value = get2;
- dialogName.value = '行政处罚'
- }else if(k == 3){
- toCompanyDetailItemMethod.value = get3;
- dialogName.value = '守信红名单'
- }else if(k == 4){
- toCompanyDetailItemMethod.value = get4;
- dialogName.value = '失信企业'
- }
- toCompanyDetailItem.value = item;
- companyDetailIsShow.value = true
- }
- const companyDetailIsShow = ref(false);
- const toCompanyDetailItem = ref();
- const toCompanyDetailItemMethod = ref();
- const closeDialog = ()=>{
- toCompanyDetailItem.value = null;
- }
- const dialogName = ref('')
- provide('isShow',companyDetailIsShow)
- provide('name',dialogName)
- init();
- </script>
- <template>
- <div class="conpanyListContainer pt-20px pb-40px">
- <div class="w-912px bg-white mr-a ml-a pt-20px border-solid border-1px border-color-#e6e6e6 rounded-10px">
- <div v-for="(item,index) in currentShowList" :key="index" @click="showConpanyDetail(item)" class="cursor-pointer">
- <div class="text-20px p-20px flex justify-between">
- <div>{{item.name}}</div>
- <div class="text-gray text-20px">{{item.time}}</div>
- </div>
- <div class="h-1px bg-gray"></div>
- </div>
- </div>
- <company-detail-small-box @closeDialog="closeDialog" :item="toCompanyDetailItem" :getItemDetailMethod="toCompanyDetailItemMethod" />
- </div>
- </template>
- <style scoped>
- .conpanyListContainer{
- background-color: #ecf0f9;
- }
- </style>
|