index.vue 5.0 KB

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