index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <script setup lang="ts">
  2. import { type LocationQueryValue, useRoute } from 'vue-router'
  3. import { get1, get2, get3, get4 } from '@/api/home'
  4. import { provide, ref } from 'vue'
  5. import CompanyDetailSmallBox from '@/components/CompanyDetailSmallBox.vue'
  6. const route = useRoute()
  7. const k:any = route.query.n
  8. const currentShowList = ref<any>([]);
  9. function removeDuplicatesById(arr:any, key:any) {
  10. return arr.reduce((accumulator:any, current:any) => {
  11. if (!accumulator.some((item:any) => item[key] === current[key])) {
  12. accumulator.push(current);
  13. }
  14. return accumulator;
  15. }, []);
  16. }
  17. const getData =async ()=>{
  18. if(k == 1){
  19. console.log(1)
  20. const res1 = await get1({pageNum:1,pageSize:1000});
  21. const bo = removeDuplicatesById(res1.records, 'administrativePartyName')
  22. const result = bo.map((item:any)=>{
  23. return ({
  24. name: item.administrativePartyName,
  25. time: item.licenseDecisionDate?.split('T')[0],
  26. unifiedSocialCreditCode:item.unifiedSocialCreditCode
  27. })
  28. })
  29. currentShowList.value = result;
  30. }else if(k == 2){
  31. const res2 = await get2({pageNum:1,pageSize:1000});
  32. const bo = removeDuplicatesById(res2.records, 'administrativePartyName')
  33. const result = bo.map((item:any)=>{
  34. return ({
  35. name: item.administrativePartyName,
  36. time: item.penaltyDecisionDate?.split('T')[0],
  37. unifiedSocialCreditCode:item.unifiedSocialCreditCode
  38. })
  39. })
  40. currentShowList.value = result;
  41. }else if(k == 3){
  42. const res3 = await get3({pageNum:1,pageSize:1000});
  43. const bo = removeDuplicatesById(res3.records, 'subjectName')
  44. const result = bo.map((item:any)=>{
  45. return ({
  46. name: item.subjectName,
  47. time: item.statisticsTime?.split('T')[0],
  48. unifiedSocialCreditCode:item.unifiedSocialCreditCode
  49. })
  50. })
  51. currentShowList.value = result;
  52. }else if(k == 4){
  53. const res4:any = await get4({pageNum:1,pageSize:1000});
  54. const bo = removeDuplicatesById(res4.records, 'enterpriseName')
  55. console.log(bo)
  56. const result = bo.map((item:any)=>{
  57. return ({
  58. name: item.enterpriseName,
  59. time:item.filingTime?.split('T')[0],
  60. unifiedSocialCreditCode:item.unifiedSocialCreditCode
  61. })
  62. })
  63. currentShowList.value = result;
  64. }
  65. }
  66. const init = () => {
  67. getData();
  68. }
  69. const showConpanyDetail = (item:any)=>{
  70. if(k == 1){
  71. toCompanyDetailItemMethod.value = get1;
  72. dialogName.value = '行政许可'
  73. }else if(k == 2){
  74. toCompanyDetailItemMethod.value = get2;
  75. dialogName.value = '行政处罚'
  76. }else if(k == 3){
  77. toCompanyDetailItemMethod.value = get3;
  78. dialogName.value = '守信红名单'
  79. }else if(k == 4){
  80. toCompanyDetailItemMethod.value = get4;
  81. dialogName.value = '失信企业'
  82. }
  83. toCompanyDetailItem.value = item;
  84. companyDetailIsShow.value = true
  85. }
  86. const companyDetailIsShow = ref(false);
  87. const toCompanyDetailItem = ref();
  88. const toCompanyDetailItemMethod = ref();
  89. const closeDialog = ()=>{
  90. toCompanyDetailItem.value = null;
  91. }
  92. const dialogName = ref('')
  93. provide('isShow',companyDetailIsShow)
  94. provide('name',dialogName)
  95. init();
  96. </script>
  97. <template>
  98. <div class="conpanyListContainer pt-20px pb-40px">
  99. <div class="w-912px bg-white mr-a ml-a pt-20px border-solid border-1px border-color-#e6e6e6 rounded-10px">
  100. <div v-for="(item,index) in currentShowList" :key="index" @click="showConpanyDetail(item)" class="cursor-pointer">
  101. <div class="text-20px p-20px flex justify-between">
  102. <div>{{item.name}}</div>
  103. <div class="text-gray text-20px">{{item.time}}</div>
  104. </div>
  105. <div class="h-1px bg-gray"></div>
  106. </div>
  107. </div>
  108. <company-detail-small-box @closeDialog="closeDialog" :item="toCompanyDetailItem" :getItemDetailMethod="toCompanyDetailItemMethod" />
  109. </div>
  110. </template>
  111. <style scoped>
  112. .conpanyListContainer{
  113. background-color: #ecf0f9;
  114. }
  115. </style>