processing-output-item.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <view class="relative b-radius pd-24 d-flex a-c bg-#fff select-item" :class="{ actives: selected && selectable }"
  3. @click="handleClick">
  4. <!-- 序号标签 -->
  5. <view v-if="showIndex" class="absolute top-0 left-0 w-60 h-60 c-#fff f-s-20 f-w-5 pd-4 pt-4 pb-4 z-index-10"
  6. style="border-radius: 16rpx 0 0rpx 0; background: linear-gradient(135deg, #22c55e 50%, transparent 50%)">
  7. <span class="w-30 h-30 f-s-24 f-w-5" style="transform: rotate(-45deg); display: block">{{ String(index +
  8. 1).padStart(2, '0') }}</span>
  9. </view>
  10. <!-- 图片 -->
  11. <view class="w-100 h-100 radius-8 ov-hd mr-24" style="flex-shrink: 0">
  12. <up-image :src="item?.imgs?.split(',')?.[0]" mode="aspectFill" width="100%" height="100%"></up-image>
  13. </view>
  14. <!-- 信息区域 -->
  15. <view class="flex-1 flex a-c j-sb">
  16. <!-- 左侧:品名和规格 -->
  17. <view class="flex flex-cln">
  18. <view class="f-s-34 f-w-5 c-#333 mb-4">{{ item?.specnLevel }}</view>
  19. <view class="f-s-24 c-#999">{{ item?.finalSpecn }}{{ item?.finalUnit }}{{
  20. selectDictLabel(pt_final_form_type, item?.finalFormType) }}</view>
  21. </view>
  22. <!-- 中间:重量和检验状态 -->
  23. <view class="flex flex-cln a-c">
  24. <view class="f-s-34 f-w-5 c-#333">{{ item?.capacity }}{{ item?.unit }}</view>
  25. <view v-if="item?.examinReport?.length > 0" class="f-s-24 mt-8 c-#37a954">已检验</view>
  26. <view v-else class="f-s-24 mt-8 c-#f74c30">未检验</view>
  27. </view>
  28. <!-- 右侧:入库状态 -->
  29. <view class="flex a-c">
  30. <view v-if="+item?.status !== 0" class="f-s-24 c-#37a954" style="text-decoration: underline">已入种源库
  31. </view>
  32. <view v-else class="f-s-24 c-#999">未入库</view>
  33. </view>
  34. </view>
  35. <!-- 选中对勾图标 -->
  36. <image v-if="selected && selectable" class="w-40 h-40 checked-icon"
  37. src="https://yujin-szyy.oss-cn-chengdu.aliyuncs.com/szyy/images-plt/common/btn_checked_icon.png"
  38. mode="widthFix" />
  39. </view>
  40. <view class="h-16"></view>
  41. </template>
  42. <script setup lang="ts">
  43. const { proxy } = getCurrentInstance() as ComponentInternalInstance;
  44. const { pt_final_form_type } = toRefs<any>(proxy?.useDict('pt_final_form_type'));
  45. const props = defineProps({
  46. // 单个产出项数据
  47. item: {
  48. type: Object,
  49. default: () => ({}),
  50. },
  51. // 序号(用于显示)
  52. index: {
  53. type: Number,
  54. default: 0,
  55. },
  56. // 是否支持点击选中
  57. selectable: {
  58. type: Boolean,
  59. default: false,
  60. },
  61. // 是否已选中
  62. selected: {
  63. type: Boolean,
  64. default: false,
  65. },
  66. // 是否显示序号标签
  67. showIndex: {
  68. type: Boolean,
  69. default: true,
  70. },
  71. });
  72. const emit = defineEmits<{
  73. click: [item: any];
  74. 'update:selected': [value: boolean];
  75. }>();
  76. // 处理点击事件
  77. const handleClick = () => {
  78. if (props.selectable) {
  79. emit('update:selected', !props.selected);
  80. }
  81. emit('click', props.item);
  82. };
  83. </script>
  84. <style scoped lang="scss">
  85. .select-item {
  86. border: 1rpx solid transparent;
  87. .checked-icon {
  88. position: absolute;
  89. right: 0rpx;
  90. bottom: 0rpx;
  91. }
  92. }
  93. .actives {
  94. background-color: #ebf6ee;
  95. border: 1rpx solid #37a954;
  96. }
  97. </style>