index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <z-paging ref="paging" v-model="list" bgColor="#f7f7f7" @query="query">
  3. <template #top>
  4. <ut-navbar title="包装赋码任务" :fixed="false" :breadcrumb="false"></ut-navbar>
  5. </template>
  6. <view class="pd3-24-24-0">
  7. <view class="d-flex a-c">
  8. <view class="min-w-230 flex1">
  9. <ut-action-sheet v-model="form.refType" :tabs="[{ label: '全部', value: '', elTagClass: '15' }, ...pt_pack_ref_type]" mode="custom" @change="onRefresh" title="选择入库类型">
  10. <view class="d-flex search-select-item a-c">
  11. <view class="flex1 ov-hd f-s-28 c-333 text-center f-w-5 up-line-1">{{ selectDictLabel(pt_pack_ref_type, form.refType) || '全部' }} </view>
  12. <up-icon size="24rpx" color="#333" name="arrow-down-fill" class="mr-5"></up-icon>
  13. </view>
  14. </ut-action-sheet>
  15. </view>
  16. <view class="h-86 pl-20 w-100%">
  17. <ut-search ref="searchRef" v-model="form.keyword" @search="changeSeach" margin="0" :border="false" placeholder="搜品种名称、批号" bgColor="#fff" height="86rpx" borderRadius="10rpx"></ut-search>
  18. </view>
  19. </view>
  20. </view>
  21. <view class="pd-24 bg-#f7f7f7">
  22. <up-swipe-action>
  23. <up-swipe-action-item v-for="(item, index) in list" :key="index" :name="item?.id" :options="optionsActionTemp" @click="clickTempSwipe" class="mb-20 b-radius">
  24. <view class="b-radius bg-#fff pd-20 p-rtv" @click.stop="$u.route({ url: '/plant/storage/fresh-goods/detail/index', params: { id: item.id } })">
  25. </view>
  26. </up-swipe-action-item>
  27. </up-swipe-action>
  28. </view>
  29. <template #empty>
  30. <view class="d-flex flex-cln a-c" style="margin-top: -200rpx">
  31. <ut-empty class="mg-at" color="#ccc" size="28rpx">暂无包装赋码任务,点击下方+号新增吧</ut-empty>
  32. </view>
  33. </template>
  34. </z-paging>
  35. <ut-suspension @click="$u.route({ url: '/plant/packaging/create/index' })"></ut-suspension>
  36. </template>
  37. <script setup lang="ts">
  38. import { useClientRequest } from '@/utils/request';
  39. import { selectDictListClass } from '@/utils/ruoyi';
  40. import { getStorageRoomNames } from '@/utils/common';
  41. import FreshGoodsBottom from './model/fresh-goods-bottom.vue';
  42. const { proxy } = getCurrentInstance() as ComponentInternalInstance;
  43. const { pt_pack_ref_type } = toRefs<any>(proxy?.useDict('pt_pack_ref_type'));
  44. const list = ref<any[]>();
  45. const form = ref({ keyword: '', refType: '' });
  46. const paging = ref();
  47. const showAddDialog = ref(false);
  48. const tabs = ref([
  49. { label: '有库存', value: '1' },
  50. { label: '无库存', value: '0' },
  51. ]);
  52. const changeSeach = () => {
  53. paging.value.reload();
  54. };
  55. const query = async (pageNum: number, pageSize: number) => {
  56. const params = {
  57. pageNum,
  58. pageSize,
  59. ...form.value,
  60. };
  61. const res = await useClientRequest.get('/plt-api/app/packTask/list', params);
  62. if (res) {
  63. const { rows } = res;
  64. paging.value.complete(rows);
  65. }
  66. };
  67. // 暂存项左滑删除配置
  68. const optionsActionTemp = reactive([
  69. {
  70. text: '删除',
  71. style: {
  72. backgroundColor: '#F74C30',
  73. },
  74. },
  75. ]);
  76. // 暂存项删除点击(本地移除)
  77. const clickTempSwipe = async (event: object) => {
  78. const { name, index } = event as any;
  79. if (index === 0) {
  80. try {
  81. const res = await uni.showModal({
  82. title: '删除提示',
  83. content: '确定删除鲜货信息吗?',
  84. confirmColor: '#F74C30',
  85. });
  86. if (!res.confirm) return;
  87. await uni.showLoading({
  88. title: '删除中...',
  89. mask: true,
  90. });
  91. await useClientRequest.get(`/plt-api/app/storage/removeById/${name}`);
  92. uni.hideLoading();
  93. uni.showToast({
  94. title: '删除成功',
  95. icon: 'success',
  96. });
  97. paging.value?.reload();
  98. } catch (error) {
  99. console.error('删除暂存鲜货信息失败:', error);
  100. }
  101. }
  102. };
  103. const onRefresh = () => {
  104. paging.value.reload();
  105. };
  106. onMounted(() => {
  107. uni.$on('refreshPackTaskList', () => {
  108. onRefresh();
  109. });
  110. });
  111. </script>
  112. <style lang="scss" scoped>
  113. .search-select-item {
  114. height: 86rpx;
  115. background-color: #fff;
  116. border-radius: 10rpx;
  117. box-sizing: border-box;
  118. padding: 12rpx;
  119. }
  120. .tag-span {
  121. padding: 4rpx 12rpx;
  122. font-size: 20rpx;
  123. border-radius: 18rpx;
  124. }
  125. .li-item-head {
  126. margin-left: -24rpx;
  127. margin-top: -24rpx;
  128. }
  129. .li-left-tag {
  130. padding: 6rpx 16rpx;
  131. color: #fff;
  132. border-radius: 16rpx 0 16rpx 0;
  133. font-size: 20rpx;
  134. font-weight: 500;
  135. }
  136. </style>