index.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <template>
  2. <z-paging ref="paging" v-model="list" bgColor="#f7f7f7" @query="query" safe-area-inset-bottom empty-view-text="该任务暂无采收入库记录">
  3. <template #top>
  4. <ut-navbar title="采收管理" :fixed="false"> </ut-navbar>
  5. </template>
  6. <view class="pd-24">
  7. <Task_card :data="taskDate" />
  8. <view class="d-flex a-c j-sb pt-20 pb-20">
  9. <view class="startline-title mb-16">采收入库记录</view>
  10. <view class="d-flex a-c gap-10">
  11. <view class="bg-#37A954 radius-10 pd4-10-20-10-20 d-flex a-c" style="width: max-content" @click="addManagementRecord()">
  12. <up-icon name="plus" color="#fff" size="24rpx"></up-icon>
  13. <view class="c-#fff f-s-22">添加采收入库</view>
  14. </view>
  15. </view>
  16. </view>
  17. <up-swipe-action>
  18. <up-swipe-action-item v-for="(item, index) in list" :key="index" :name="item?.id" :options="options2" class="mb-20" @click="clickTempSwipe">
  19. <view class="bg-#fff b-radius pd-24" @click="gotoDetail(item)">
  20. <view class="d-flex a-c j-sb">
  21. <view class="d-flex a-c">
  22. <view class="f-s-34 f-w-5 pb-10 mr-10">采收{{ selectDictLabel(pt_seed_type, item?.seedType) || '药材' }}</view>
  23. </view>
  24. <view class="d-flex a-c">
  25. <view class="f-s-22 c-#666">{{ item?.updateTime || item?.createTime }}</view>
  26. </view>
  27. </view>
  28. <view class="d-flex pd4-8-0-8-0">
  29. <view class="c-#666 f-s-28 w-s-no">采收批号:</view>
  30. <view class="c-#333 f-s-28 f-w-5 w-s-no tx-ov ov-hd">{{ item?.harvestCode }}</view>
  31. </view>
  32. <view class="d-flex pd4-8-0-8-0">
  33. <view class="c-#666 f-s-28 w-s-no">采收量:</view>
  34. <view class="c-#333 f-s-28 f-w-5 w-s-no tx-ov ov-hd">{{ item?.quantity }}{{ item?.unit }}</view>
  35. </view>
  36. <view v-if="+item?.mgMethod !== 2" class="d-flex pd4-8-0-8-0">
  37. <view class="c-#666 f-s-28 w-s-no">操作{{ +taskDate?.baseType == 1 ? '地块' : +taskDate?.baseType == 2 ? '圈舍' : '培养架' }}:</view>
  38. <view class="c-#333 f-s-28 f-w-5" v-if="+item?.landFlag">全部{{ +taskDate?.baseType == 1 ? '地块' : +taskDate?.baseType == 2 ? '圈舍' : '培养架' }}</view>
  39. <view class="c-#333 f-s-28 f-w-5 d-flex a-c w-s-no tx-ov ov-hd" v-else>
  40. <template v-if="item?.lands?.length == 0">
  41. <text>{{ '-' }}</text>
  42. </template>
  43. <view v-else v-for="(data, indexs) in item?.lands">
  44. <text v-if="indexs !== 0">、</text>
  45. <text>{{ data?.landName }}</text>
  46. </view>
  47. </view>
  48. </view>
  49. <view v-else class="d-flex pd4-8-0-8-0">
  50. <view class="c-#666 f-s-28 w-s-no">操作个体:</view>
  51. <template v-if="item?.animalIds?.length == 0">
  52. <text>{{ '-' }}</text>
  53. </template>
  54. <view v-else v-for="(data, indexs) in item?.animalIds">
  55. <text v-if="indexs !== 0">、</text>
  56. <text class="c-#333 f-s-28 f-w-5">{{ data }}</text>
  57. </view>
  58. </view>
  59. <view v-if="item?.outputType == 1" class="d-flex pd4-8-0-8-0">
  60. <view class="c-#666 f-s-28 w-s-no">种源处理工艺:</view>
  61. <view class="c-#333 f-s-28 f-w-5 w-s-no tx-ov ov-hd">{{ item?.ptech?.split(',').join('、') || '-' }}</view>
  62. </view>
  63. <view class="d-flex gap-16">
  64. <view class="pd2-4-0 f-s-28 w-50%">
  65. <span class="c-#666">采收方式:</span>
  66. <span class="c-#333 f-w-5">{{ selectDictLabel(pt_harvest_type, item?.harvestType) || '-' }}</span>
  67. </view>
  68. <view class="pd2-4-0 f-s-28 w-50%">
  69. <span class="c-#666">采收负责人:</span>
  70. <span class="c-#333 f-w-5">{{ item?.mgrName }}</span>
  71. </view>
  72. </view>
  73. </view>
  74. </up-swipe-action-item>
  75. </up-swipe-action>
  76. </view>
  77. </z-paging>
  78. </template>
  79. <script setup lang="ts">
  80. import { useClientRequest } from '@/utils/request';
  81. import Task_card from './models/task_card.vue';
  82. const { proxy } = getCurrentInstance() as ComponentInternalInstance;
  83. const { pt_seed_type, pt_harvest_type, pt_raise_op_method } = toRefs<any>(proxy?.useDict('pt_seed_type', 'pt_harvest_type', 'pt_raise_op_method'));
  84. const paging = ref();
  85. const list = ref<any>([]);
  86. const taskId = ref('');
  87. const taskDate = ref<any>();
  88. const from = ref({
  89. keyword: '',
  90. });
  91. const query = async (pageNo: number, pageSize: number) => {
  92. const res = await useClientRequest.get(`/plt-api/app/harvestRecord/list`, {
  93. pageNo,
  94. pageSize,
  95. ...from.value,
  96. taskId: taskId.value,
  97. });
  98. if (res) {
  99. const { rows } = res;
  100. paging.value.complete(rows);
  101. }
  102. };
  103. // 添加种源信息
  104. const addManagementRecord = () => {
  105. uni.$u.route({
  106. type: 'navigateTo',
  107. url: '/plant/port/port-harvest-create/index',
  108. params: { taskId: taskId.value, ...taskDate.value },
  109. });
  110. };
  111. const options2 = reactive([
  112. {
  113. text: '撤回采收入库',
  114. style: {
  115. backgroundColor: '#F74C30',
  116. width: '100rpx',
  117. fontSize: '28rpx',
  118. },
  119. },
  120. ]);
  121. const clickTempSwipe = async (event: object) => {
  122. const { name, index } = event as any;
  123. try {
  124. const res = await uni.showModal({
  125. title: '撤回提示',
  126. content: '撤回采收,将同步撤回删除入库存放信息,不能恢复,请谨慎操作!',
  127. confirmColor: '#f56c6c',
  128. });
  129. if (!res.confirm) return;
  130. await uni.showLoading({
  131. title: '撤回中...',
  132. mask: true,
  133. });
  134. await useClientRequest.get(`/plt-api/app/harvestRecord/delete/${name}`);
  135. uni.hideLoading();
  136. uni.showToast({
  137. title: '删除成功',
  138. icon: 'success',
  139. });
  140. paging.value?.reload();
  141. } catch (error) {
  142. console.error('删除任务失败:', error);
  143. }
  144. };
  145. const gotoDetail = async (item: any) => {
  146. uni.$u.route({
  147. type: 'navigateTo',
  148. url: `plant/port/port-harvest-detail/index`,
  149. params: {
  150. id: item?.id,
  151. },
  152. });
  153. };
  154. onMounted(async () => {
  155. const res = await useClientRequest.get(`/plt-api/app/plantationTask/getInfo/${taskId.value}`, {
  156. pageNo: 1,
  157. pageSize: 10,
  158. });
  159. taskDate.value = res.data;
  160. });
  161. onLoad((options: any) => {
  162. taskId.value = options?.id;
  163. //接收 uni.$emit('updateharvestlist');
  164. uni.$on('updateharvestlist', () => {
  165. paging.value?.reload();
  166. });
  167. });
  168. </script>
  169. <style lang="scss" scoped>
  170. :deep(.u-swipe-action-item__right__button__wrapper__text) {
  171. white-space: normal;
  172. }
  173. </style>