index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <template>
  2. <z-paging ref="paging" v-model="list" bgColor="#f7f7f7" safe-area-inset-bottom>
  3. <template #top>
  4. <ut-navbar title="选择操作地块" :fixed="false"></ut-navbar>
  5. </template>
  6. <view class="startline-title pl-24 ml-24 mb-16">基地信息</view>
  7. <view class="pd-26 bg-#fff mb-20">
  8. <view class="border-#AFDDBB pd-26 pb-10 pt-10 bg-#FBFDFB p-rtv">
  9. <!-- 标签显示:GAP和三无一全 -->
  10. <view v-if="+modeValue?.gapFlag || +modeValue?.swyqRes" class="pt-8 pb-8 d-flex pr-20 pl-20" style="width: max-content; margin-top: -10rpx; margin-left: -26rpx; background: linear-gradient(90deg, #5eba75, #c6e391); border-bottom-right-radius: 88rpx">
  11. <view v-if="+modeValue?.gapFlag && !+modeValue?.swyqRes" class="c-#fff f-s-24 f-w-6">获评{{ modeValue?.medicineName }}GAP基地</view>
  12. <view v-if="+modeValue?.swyqRes && !+modeValue?.gapFlag" class="c-#fff f-s-24 f-w-6">获评{{ modeValue?.swyqMedicineName }}三无一全基地</view>
  13. <view v-if="+modeValue?.gapFlag && +modeValue?.swyqRes" class="c-#fff f-s-24 f-w-6">获评{{ modeValue?.medicineName }}GAP基地和{{ modeValue?.swyqMedicineName }}三无一全基地</view>
  14. </view>
  15. <view class="c-#333 f-s-34 f-w-5 pt-8 pb-8 pr-16">{{ modeValue?.baseName }}</view>
  16. <view class="pt-8 pb-8">
  17. <text class="c-#666 f-s-28">基地面积:</text>
  18. <text class="c-#333 f-s-28 f-w-5">{{ modeValue?.gapInfo?.area }}{{ modeValue?.gapInfo?.areaUnit }}</text>
  19. </view>
  20. <view class="pt-8 pb-8">
  21. <text class="c-#666 f-s-28">基地地址:</text>
  22. <text class="c-#333 f-s-28 f-w-5">{{ modeValue?.gapInfo?.adcodeName }}{{ modeValue?.gapInfo?.address }}</text>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="startline-title pl-24 ml-24 mb-16">请选择所操作的地块</view>
  27. <view class="pd-24">
  28. <ut-search ref="searchRef" v-model="keyword" @search="changeSeach" margin="0" :border="false" placeholder="搜索地块名称" bgColor="#fff" height="86rpx" borderRadius="10rpx"></ut-search>
  29. <view class="pd-20"></view>
  30. <!-- 全选行 -->
  31. <view class="b-radius bg-#fff mb-20 pd-24 d-flex a-c j-sb">
  32. <view class="c-#333 f-s-34 f-w-5">全选</view>
  33. <up-checkbox usedAlone activeColor="#37A954" :checked="isAllSelected" @change="handleSelectAll"></up-checkbox>
  34. </view>
  35. <view class="b-radius bg-#fff mb-20 pd-24" v-for="(item, index) in lands" :key="index">
  36. <up-checkbox-group v-model="checkboxValue">
  37. <view class="d-flex w-100% j-sb">
  38. <view class="flex1 ov-hd">
  39. <view class="mb-20 ov-hd tx-ov d-flex a-c">
  40. <view class="c-primary f-s-24 f-w-5 mr-5 bg-#EBF6EE pd4-6-10-6-10 b-radius" style="font-style: italic">{{ Number(index) + 1 < 10 ? '0' + (Number(index) + 1) : Number(index) + 1 }}</view>
  41. <view class="c-#333 f-w-5 f-s-34 tx-ov ov-hd">{{ item?.landName }}</view>
  42. </view>
  43. <view class="d-flex a-c">
  44. <view class="w-50%">
  45. <text class="c-#333 f-s-28 f-w-5 mr-5">{{ item?.area }}</text>
  46. <text class="c-#666 f-s-24 tx-ov ov-hd">{{ item?.areaUnit }}</text>
  47. </view>
  48. <view class="w-50%">
  49. <text class="c-#333 f-s-28 f-w-5 mr-5">负责人:</text>
  50. <text class="c-#666 f-s-24 tx-ov ov-hd">{{ item?.contactName }}</text>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="d-flex j-c a-c">
  55. <view @click.stop class="">
  56. <up-checkbox activeColor="#37A954" label="" :name="item?.id"> </up-checkbox>
  57. </view>
  58. </view>
  59. </view>
  60. </up-checkbox-group>
  61. </view>
  62. </view>
  63. </z-paging>
  64. </template>
  65. <script lang="ts" setup>
  66. import { ref, computed } from 'vue';
  67. import { useClientRequest } from '@/utils/request';
  68. const paging = ref();
  69. const list = ref([]);
  70. //基地信息
  71. const modeValue = ref();
  72. const keyword = ref('');
  73. //地块信息
  74. const lands = ref<any>([]);
  75. const changeSeach = async () => {
  76. const res = await useClientRequest.get('/plt-api/app/baseLandInfo/pageList', { baseId: modeValue.value?.id, keyword: keyword.value });
  77. lands.value = res?.rows;
  78. // 搜索时清空选中状态
  79. checkboxValue.value = [];
  80. };
  81. const checkboxValue = ref<string[]>([]);
  82. const handleSelectAll = () => {
  83. if (isAllSelected.value) {
  84. checkboxValue.value = []; // 全选状态下点击 → 清空
  85. } else {
  86. checkboxValue.value = lands.value.map((item: any) => item.id); // 非全选状态下点击 → 全选
  87. }
  88. };
  89. const isAllSelected = computed(() => {
  90. console.log(checkboxValue.value.length === lands.value.length);
  91. return lands.value.length > 0 && checkboxValue.value.length === lands.value.length;
  92. });
  93. onLoad(async (options: any) => {
  94. const res = await useClientRequest.get(`/plt-api/app/base/getInfoAllById/${options?.baseId}`);
  95. modeValue.value = res?.data?.baseInfo;
  96. lands.value = res?.data?.landInfoList;
  97. // 初始选中状态为空
  98. checkboxValue.value = [];
  99. });
  100. </script>