baseinfo.vue 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <view class="border-#AFDDBB pd-26 pb-8 bg-#FBFDFB p-rtv">
  3. <!-- 关闭按钮 -->
  4. <view class="c-#F81242 f-s-30 ab2-10-20" @click="handleClose"> × </view>
  5. <view class="c-#333 f-s-34 f-w-5 pt-8 pb-8 pr-16">{{ modeValue?.baseName }}</view>
  6. <!-- 标签显示:GAP和三无一全 -->
  7. <view v-if="modeValue?.gapFlag || modeValue?.swyqRes" class="pt-8 pb-8 d-flex" style="position: absolute; left: 0; top: 0">
  8. <view v-if="modeValue?.gapFlag && Number(modeValue.gapFlag) === 1" class="label mr-10">GAP</view>
  9. <view v-if="modeValue?.swyqRes && Number(modeValue.swyqRes) === 1" class="label">三无一全</view>
  10. </view>
  11. <view class="pt-8 pb-8">
  12. <text class="c-#666 f-s-28">基地面积:</text>
  13. <text class="c-#333 f-s-28 f-w-5">{{ modeValue?.area }}{{ modeValue?.areaUnit }}</text>
  14. </view>
  15. <view class="pt-8 pb-8">
  16. <text class="c-#666 f-s-28">基地地址:</text>
  17. <text class="c-#333 f-s-28 f-w-5">{{ modeValue?.adcodeName }}{{ modeValue?.address }}</text>
  18. </view>
  19. <view style="margin-left: -26rpx; margin-right: -26rpx; border-bottom: 1rpx solid #d4ecda"></view>
  20. <view class="pt-16 pb-8">
  21. <text v-if="+baseType == 1" class="c-#666 f-s-28">地块信息:</text>
  22. <text v-if="+baseType == 2" class="c-#666 f-s-28">圈舍信息:</text>
  23. <text v-if="+baseType == 3" class="c-#666 f-s-28">组培架信息:</text>
  24. <text v-if="!modeValue?.aloneChecked" class="c-#333 f-s-28 f-w-5">{{ modeValue?.data?.length }}个</text>
  25. <text v-if="modeValue?.aloneChecked" class="c-#333 f-s-28 f-w-5">该基地所有{{ baseType == '1' ? '地块' : baseType == '2' ? '圈舍' : '组培架' }}</text>
  26. </view>
  27. <view v-if="!modeValue?.aloneChecked" class="pt-8 pb-8" v-for="(item, index) in modeValue?.data" :key="index">
  28. <text class="c-#666 f-s-28">{{ item?.landName }}:</text>
  29. <text class="c-#333 f-s-28 f-w-5">{{ item?.area }}{{ item?.areaUnit }}</text>
  30. </view>
  31. </view>
  32. </template>
  33. <script setup lang="ts">
  34. // 定义props接口
  35. interface ModeValue {
  36. baseName?: string;
  37. area?: string | number;
  38. areaUnit?: string;
  39. address?: string;
  40. adcodeName?: string;
  41. gapFlag?: number | string;
  42. swyqRes?: number | string;
  43. aloneChecked?: boolean;
  44. data?: any[];
  45. // 保留原有字段以保持向后兼容
  46. checkBox?: any[];
  47. }
  48. // 接收modeValue对象
  49. const props = defineProps<{
  50. modeValue?: ModeValue;
  51. baseType: string;
  52. }>();
  53. // 定义emit事件
  54. const emit = defineEmits<{
  55. (e: 'update:modeValue', value: ModeValue | null): void;
  56. (e: 'close'): void;
  57. }>();
  58. // 处理关闭
  59. const handleClose = () => {
  60. // 触发事件清空modeValue
  61. console.log('?');
  62. emit('update:modeValue', null);
  63. emit('close');
  64. };
  65. </script>
  66. <style scoped lang="scss">
  67. .label {
  68. font-size: 24rpx;
  69. color: #37a954;
  70. border-radius: 100rpx;
  71. background-color: #e3efe6;
  72. width: max-content;
  73. padding-left: 14rpx;
  74. padding-right: 14rpx;
  75. padding-top: 6rpx;
  76. padding-bottom: 6rpx;
  77. }
  78. </style>