index.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <z-paging ref="paging" v-model="list" bgColor="#f7f7f7" @query="query">
  3. <template #top>
  4. <ut-navbar title="种源库" :fixed="false"></ut-navbar>
  5. </template>
  6. <view class="pd3-24-24-0">
  7. <view class="mb-20">
  8. <ut-tabs mode="subsection" v-model="form.restFlag" :tabs="tabs" @change="onRefresh"></ut-tabs>
  9. </view>
  10. <view class="d-flex a-c">
  11. <view class="min-w-230 flex1">
  12. <ut-action-sheet v-model="form.instoreType" :tabs="[{ label: '全部', value: '' }, ...pt_seed_instore_type]" mode="custom" @change="onRefresh" title="选择入库类型">
  13. <view class="d-flex search-select-item a-c">
  14. <view class="flex1 ov-hd f-s-28 c-333 text-center f-w-5 w-s-no">{{ selectDictLabel(pt_seed_instore_type, form.instoreType) || '全部' }} </view>
  15. <up-icon size="24rpx" color="#333" name="arrow-down-fill" class="mr-5"></up-icon>
  16. </view>
  17. </ut-action-sheet>
  18. </view>
  19. <view class="h-86 pl-20 w-100%">
  20. <ut-search ref="searchRef" v-model="form.keyword" @search="changeSeach" margin="0" :border="false" placeholder="搜名称、批号、库房、供应商" bgColor="#fff" height="86rpx" borderRadius="10rpx"></ut-search>
  21. </view>
  22. </view>
  23. <view></view>
  24. </view>
  25. <view class="pd-24 bg-#f7f7f7">
  26. <up-swipe-action>
  27. <up-swipe-action-item v-for="(item, index) in list" :key="index" :name="item?.id" :options="optionsActionTemp" @click="clickTempSwipe" class="mb-20 b-radius">
  28. <view class="b-radius bg-#fff pd-20 p-rtv" @click.stop="$u.route({ url: '/plant/storage/seed-source/detail/index', params: { id: item.id } })">
  29. <view class="d-flex j-sb a-c li-item-head mb-16">
  30. <view class="li-left-tag" :class="{ [`bg-${selectDictListClass(pt_seed_instore_type, item?.instoreType)}`]: true }">{{ selectDictLabel(pt_seed_instore_type, item?.instoreType) }}</view>
  31. <view class="f-s-22 c-#666">{{ item?.instoreBizInfo?.instoreDate }}</view>
  32. </view>
  33. <view class="d-flex flex1 mb-10">
  34. <view class="flex1">
  35. <span class="f-s-34 c-#333 f-w-500 mr-10">{{ item?.variety }}</span>
  36. <span class="f-s-24 c-#666">{{ selectDictLabel(pt_seed_type, item?.seedType) }}</span>
  37. </view>
  38. <view>
  39. <view v-if="item?.examinReport?.length" class="tag-span c-primary bg-#EBF6EE">已检验</view>
  40. <view v-else class="tag-span c-danger bg-#F9ECEA">未检验</view>
  41. </view>
  42. </view>
  43. <view class="pd2-4-0 f-s-28">
  44. <span class="c-#666">入库批号:</span>
  45. <span class="c-#333 f-w-500">{{ item?.batchCode }}</span>
  46. </view>
  47. <!-- <view class="pd2-4-0 f-s-28">
  48. <span class="c-#666">溯源批号:</span>
  49. <span class="c-#333 f-w-500">暂无</span>
  50. </view> -->
  51. <view v-if="['A3', 'A4'].includes(item?.fungusCodeType)" class="pd2-4-0 f-s-28">
  52. <span class="c-#666">菌种/菌株编号:</span>
  53. <span class="c-#333 f-w-500">{{ selectDictLabel(pt_fungus_code_type, item?.fungusCodeType) }}/{{ item?.fungusCode }}</span>
  54. </view>
  55. <view class="pd2-4-0 f-s-28">
  56. <span class="c-#666">供应商:</span>
  57. <span class="c-#333 f-w-500">{{ item?.supplierInfo?.cusName || '-' }}</span>
  58. </view>
  59. <view class="pd2-4-0 f-s-28">
  60. <span class="c-#666">入库量:</span>
  61. <span class="c-#333 f-w-500">{{ item?.capacity }}{{ item?.unit }}</span>
  62. </view>
  63. <view class="d-flex">
  64. <view v-if="item?.restAmount" class="pd2-4-0 f-s-28 flex1">
  65. <span class="c-#666">出库量:</span>
  66. <span class="c-#333 f-w-500">{{ item?.inputAmount || '0' }}{{ item?.unit }}</span>
  67. </view>
  68. <view v-if="item?.restAmount" class="pd2-4-0 f-s-28 flex1">
  69. <span class="c-danger">剩余量:</span>
  70. <span class="c-danger f-w-500">{{ item?.restAmount || '0' }}{{ item?.unit }}</span>
  71. </view>
  72. </view>
  73. </view>
  74. </up-swipe-action-item>
  75. </up-swipe-action>
  76. </view>
  77. <template #empty>
  78. <view class="d-flex flex-cln a-c" style="margin-top: -200rpx">
  79. <ut-empty class="mg-at" color="#ccc" size="28rpx">暂无种源信息,点击下方+号新增吧</ut-empty>
  80. </view>
  81. </template>
  82. <template #bottom>
  83. <source-bottom></source-bottom>
  84. </template>
  85. </z-paging>
  86. </template>
  87. <script setup lang="ts">
  88. import { useClientRequest } from '@/utils/request';
  89. import SourceBottom from './model/source-bottom.vue';
  90. import { selectDictListClass } from '@/utils/ruoyi';
  91. const { proxy } = getCurrentInstance() as ComponentInternalInstance;
  92. const { pt_seed_instore_type, pt_warehouse_type, pt_seed_type, pt_seed_source, pt_materail_unit, pt_mother_father_flag, pt_op_method, pt_seed_unit, pt_fungus_code_type, pt_breeding_materials, yes_no, pt_cus_type, pt_cpy_type, pt_gen_unit } = toRefs<any>(proxy?.useDict('pt_seed_instore_type', 'pt_warehouse_type', 'pt_seed_type', 'pt_seed_source', 'pt_materail_unit', 'pt_mother_father_flag', 'pt_op_method', 'pt_seed_unit', 'pt_fungus_code_type', 'pt_breeding_materials', 'yes_no', 'pt_cus_type', 'pt_cpy_type', 'pt_gen_unit'));
  93. const list = ref<any[]>();
  94. const form = ref({ keyword: '', restFlag: '1', instoreType: '' });
  95. const paging = ref();
  96. const tabs = ref([
  97. { label: '有库存', value: '1' },
  98. { label: '无库存', value: '0' },
  99. ]);
  100. const changeSeach = () => {
  101. paging.value.reload();
  102. };
  103. const query = async (pageNum: number, pageSize: number) => {
  104. const params = {
  105. pageNum,
  106. pageSize,
  107. ...form.value,
  108. };
  109. const res = await useClientRequest.get('/plt-api/app/storageSeed/page', params);
  110. if (res) {
  111. const { rows } = res;
  112. paging.value.complete(rows);
  113. }
  114. };
  115. // 暂存项左滑删除配置
  116. const optionsActionTemp = reactive([
  117. {
  118. text: '删除',
  119. style: {
  120. backgroundColor: '#F74C30',
  121. },
  122. },
  123. ]);
  124. // 暂存项删除点击(本地移除)
  125. const clickTempSwipe = async (event: object) => {
  126. const { name, index } = event as any;
  127. if (index === 0) {
  128. try {
  129. const res = await uni.showModal({
  130. title: '删除提示',
  131. content: '确定删除种源信息吗?',
  132. confirmColor: '#F74C30',
  133. });
  134. if (!res.confirm) return;
  135. await uni.showLoading({
  136. title: '删除中...',
  137. mask: true,
  138. });
  139. await useClientRequest.get(`/plt-api/app/storageSeed/removeById/${name}`);
  140. uni.hideLoading();
  141. uni.showToast({
  142. title: '删除成功',
  143. icon: 'success',
  144. });
  145. paging.value?.reload();
  146. } catch (error) {
  147. console.error('删除暂存种源信息失败:', error);
  148. }
  149. }
  150. };
  151. const onRefresh = () => {
  152. paging.value.reload();
  153. };
  154. onMounted(() => {
  155. uni.$on('refreshStorageRoomList', () => {
  156. onRefresh();
  157. });
  158. });
  159. </script>
  160. <style lang="scss" scoped>
  161. .search-select-item {
  162. height: 86rpx;
  163. background-color: #fff;
  164. border-radius: 10rpx;
  165. box-sizing: border-box;
  166. padding: 12rpx;
  167. }
  168. .tag-span {
  169. padding: 4rpx 12rpx;
  170. font-size: 20rpx;
  171. border-radius: 18rpx;
  172. }
  173. .li-item-head {
  174. margin-left: -24rpx;
  175. margin-top: -24rpx;
  176. }
  177. .li-left-tag {
  178. padding: 6rpx 16rpx;
  179. color: #fff;
  180. border-radius: 16rpx 0 16rpx 0;
  181. font-size: 20rpx;
  182. font-weight: 500;
  183. }
  184. </style>