PipeReportList.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <div class="report-list-container">
  3. <span
  4. v-for="item in row.reportDOList"
  5. :key="item?.id"
  6. class="report-item"
  7. >
  8. <span
  9. class="color-dot"
  10. :style="{ backgroundColor: getStatusColor(item.taskStatus) }"
  11. ></span>
  12. <span
  13. class="report-name"
  14. :style="{ color: getStatusColor(item.taskStatus) }"
  15. @click="() => handleClick(row, item)"
  16. >
  17. {{ getReportName(item) }}
  18. </span>
  19. <span
  20. v-if="item?.fee"
  21. class="report-fee"
  22. :style="{ color: getStatusColor(item.taskStatus) }"
  23. >
  24. ({{ item?.fee }})
  25. </span>
  26. </span>
  27. </div>
  28. </template>
  29. <script setup lang="ts">
  30. import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
  31. import {useRouter} from "vue-router";
  32. interface ReportItem {
  33. id: string
  34. reportName: string
  35. taskStatus: number
  36. fee?: string | number
  37. itemPartId?: string
  38. [key: string]: any
  39. }
  40. const router = useRouter()
  41. const props = defineProps<{
  42. row
  43. }>()
  44. const PartTypeList = getStrDictOptions(DICT_TYPE.PRESSURE2_BOILER_PART_TYPE)
  45. const getTypeName = (type: string) => {
  46. const item = PartTypeList.find(item => item.value === type)
  47. return item ? item.label : ''
  48. }
  49. const getReportName = (item: ReportItem) => {
  50. if (!item.itemPartId || item.itemPartId === '0') {
  51. return item.reportName
  52. }
  53. return `${item.reportName}(${getTypeName(item.itemPartId)})`
  54. }
  55. const getStatusColor = (status: number): string => {
  56. const statusMap: Record<number, string> = {
  57. 100: '#5B9BD5', // 待录入
  58. 400: '#70AD47', // 记录录入
  59. 500: '#9973C2', // 记录校核
  60. 520: '#FFC000', // 报告编制
  61. 600: '#ED7D31', // 报告审核
  62. 700: '#FF8DC7', // 报告审批
  63. 800: '#303133' // 报告办结
  64. }
  65. return statusMap[status] || '#A7D78B'
  66. }
  67. const handleClick = (row, item: ReportItem) => {
  68. if (row.isClaim === false) {
  69. return
  70. }
  71. localStorage.setItem('activePipeDetailItemId', item.id)
  72. router.push({
  73. name: 'PipeCheckerTaskDetail',
  74. query: {id: row.id,orderId:row.orderId, type: 'PipeMyTask'},
  75. })
  76. }
  77. </script>
  78. <style lang="scss" scoped>
  79. .report-list-container {
  80. display: inline;
  81. line-height: 1.8;
  82. }
  83. .report-item {
  84. display: inline-block;
  85. white-space: nowrap;
  86. margin-right: 12px;
  87. .color-dot {
  88. display: inline-block;
  89. width: 8px;
  90. height: 8px;
  91. border-radius: 50%;
  92. vertical-align: middle;
  93. margin-right: 4px;
  94. }
  95. .report-name {
  96. cursor: pointer;
  97. transition: opacity 0.2s;
  98. &:hover {
  99. opacity: 0.8;
  100. text-decoration: underline;
  101. }
  102. }
  103. .report-fee {
  104. margin-left: 2px;
  105. }
  106. }
  107. </style>