index.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <script lang="ts" setup>
  2. /**
  3. * @Name: index.vue
  4. * @Description: 公司信息页面
  5. * @Author: Cheney
  6. */
  7. import { useResponse } from '/@/utils/useResponse';
  8. import * as api from './api';
  9. import InfoCard from './components/InfoCard.vue';
  10. import { Plus } from '@element-plus/icons-vue';
  11. import CompanyCreate from '/@/views/company-information/components/CompanyCreate.vue';
  12. const cardData = ref();
  13. provide('cardData', cardData);
  14. const loading = ref(false);
  15. const isOpen = ref();
  16. onBeforeMount(() => {
  17. initData();
  18. });
  19. async function initData() {
  20. const res = await useResponse({}, api.getCardData, loading);
  21. cardData.value = res.data;
  22. }
  23. async function addCompany() {
  24. isOpen.value = true;
  25. }
  26. function handleRefresh() {
  27. initData();
  28. }
  29. </script>
  30. <template>
  31. <div class="flex flex-col p-5">
  32. <el-card class="mb-5" style="border: none;">
  33. <div class="flex justify-between items-baseline">
  34. <div>
  35. <span class="font-bold text-xl">公司信息概览</span>
  36. <el-divider class=" text-3xl" direction="vertical"/>
  37. </div>
  38. <span>
  39. <el-button :icon="Plus" type="primary" @click="addCompany">添 加</el-button>
  40. </span>
  41. </div>
  42. </el-card>
  43. <el-card v-loading="loading" class="flex-grow" style="border: none;">
  44. <InfoCard></InfoCard>
  45. </el-card>
  46. <CompanyCreate v-model="isOpen" @refresh="handleRefresh"/>
  47. </div>
  48. </template>
  49. <style scoped>
  50. :deep(.el-divider__text.is-left) {
  51. background-color: #F5F5F5;
  52. }
  53. </style>