ProjectClosing.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <view class="module-container">
  3. <uv-empty v-if="projectStore.fetchConclusionLoading" mode="list" text="加载中..."></uv-empty>
  4. <view v-else-if="!projectStore.conclusionList || projectStore.conclusionList.length === 0" class="empty-wrap">
  5. <uv-empty mode="data" text="暂无结题信息"></uv-empty>
  6. </view>
  7. <view v-else class="list-wrapper">
  8. <CommonListCard
  9. v-for="(item, index) in projectStore.conclusionList"
  10. :key="index"
  11. :title="(index + 1) + '. ' + (item.batchName || '未知批次')"
  12. :statusLabel="getStatusLabel(item.approvalStatus)"
  13. :statusType="getStatusType(item.approvalStatus)"
  14. >
  15. <CommonInfoRow label="开始日期" :value="item.projectStartDate ? formatDate(item.projectStartDate) : '--'" />
  16. <CommonInfoRow label="结束日期" :value="item.projectEndDate ? formatDate(item.projectEndDate) : '--'" noBorder />
  17. <CommonInfoRow label="项目中检日期" :value="item.projectEndDate ? formatDate(item.projectEndDate) : '--'" />
  18. </CommonListCard>
  19. </view>
  20. </view>
  21. </template>
  22. <script setup lang="ts">
  23. import { watch } from 'vue';
  24. import { useProjectStore } from '@/store/modules/project';
  25. import { formatDate } from '@/utils/date';
  26. import CommonListCard from '@/components/ui/CommonListCard.vue';
  27. import CommonInfoRow from '@/components/ui/CommonInfoRow.vue';
  28. const props = defineProps<{
  29. projectId: number;
  30. projectType: string;
  31. }>();
  32. const projectStore = useProjectStore();
  33. watch(() => props.projectId, (id) => {
  34. if (id) {
  35. projectStore.fetchConclusion(id, props.projectType);
  36. }
  37. }, { immediate: true });
  38. const getStatusLabel = (status: number | string) => {
  39. if (status == 10) return '待提交';
  40. if (status == 20) return '审批中';
  41. if (status == 30) return '审批通过';
  42. if (status == 40) return '审批退回';
  43. return '未知';
  44. };
  45. const getStatusType = (status: number | string) => {
  46. if (status == 10) return 'info';
  47. if (status == 20) return 'primary';
  48. if (status == 30) return 'success';
  49. if (status == 40) return 'error';
  50. return 'info';
  51. };
  52. </script>
  53. <style lang="scss" scoped>
  54. .module-container {
  55. min-height: 400rpx;
  56. position: relative;
  57. }
  58. .empty-wrap {
  59. min-height: 300rpx;
  60. display: flex;
  61. justify-content: center;
  62. align-items: center;
  63. }
  64. .list-wrapper {
  65. display: flex;
  66. flex-direction: column;
  67. gap: 20rpx;
  68. }
  69. </style>