| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- <template>
- <z-paging ref="paging" v-model="list" bgColor="#f7f7f7" @query="query">
- <template #top>
- <ut-navbar title="种源库" :fixed="false" :breadcrumb="false"></ut-navbar>
- </template>
- <view class="pd3-24-24-0">
- <view class="mb-20">
- <ut-tabs mode="subsection" v-model="form.restFlag" :tabs="tabs" @change="onRefresh"></ut-tabs>
- </view>
- <view class="d-flex a-c">
- <view class="min-w-230 flex1">
- <ut-action-sheet v-model="form.instoreType" :tabs="[{ label: '全部', value: '' }, ...pt_seed_instore_type]" mode="custom" @change="onRefresh" title="选择入库类型">
- <view class="d-flex search-select-item a-c">
- <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>
- <up-icon size="24rpx" color="#333" name="arrow-down-fill" class="mr-5"></up-icon>
- </view>
- </ut-action-sheet>
- </view>
- <view class="h-86 pl-20 w-100%">
- <ut-search ref="searchRef" v-model="form.keyword" @search="changeSeach" margin="0" :border="false" placeholder="搜名称、批号、库房、供应商" bgColor="#fff" height="86rpx" borderRadius="10rpx"></ut-search>
- </view>
- </view>
- <view></view>
- </view>
- <view class="pd-24 bg-#f7f7f7">
- <up-swipe-action>
- <up-swipe-action-item v-for="(item, index) in list" :key="index" :name="item?.id" :options="optionsActionTemp" @click="clickTempSwipe($event, item)" class="mb-20 b-radius">
- <view class="b-radius bg-#fff p-rtv" @click.stop="$u.route({ url: '/plant/storage/seed-source/detail/index', params: { id: item.id } })">
- <SeedSourceCard :item="item" :dict="{ pt_seed_instore_type, pt_seed_type, pt_fungus_code_type }"></SeedSourceCard>
- </view>
- </up-swipe-action-item>
- </up-swipe-action>
- </view>
- <template #empty>
- <view class="d-flex flex-cln a-c" style="margin-top: -200rpx">
- <ut-empty class="mg-at" color="#ccc" size="28rpx">暂无种源信息,点击下方+号新增吧</ut-empty>
- </view>
- </template>
- <template #bottom>
- <source-bottom></source-bottom>
- </template>
- </z-paging>
- </template>
- <script setup lang="ts">
- import { useClientRequest } from '@/utils/request';
- import SourceBottom from './model/source-bottom.vue';
- import SeedSourceCard from '@/plant/models/warehouseCard/seed-source-card.vue';
- const { proxy } = getCurrentInstance() as ComponentInternalInstance;
- const { pt_seed_instore_type, pt_seed_type, pt_fungus_code_type } = toRefs<any>(proxy?.useDict('pt_seed_instore_type', 'pt_seed_type', 'pt_fungus_code_type'));
- const list = ref<any[]>();
- const form = ref({ keyword: '', restFlag: '1', instoreType: '' });
- const paging = ref();
- const tabs = ref([
- { label: '有库存', value: '1' },
- { label: '无库存', value: '0' },
- ]);
- const changeSeach = () => {
- paging.value.reload();
- };
- const query = async (pageNum: number, pageSize: number) => {
- const params = {
- pageNum,
- pageSize,
- ...form.value,
- };
- const res = await useClientRequest.get('/plt-api/app/storageSeed/page', params);
- if (res) {
- const { rows } = res;
- paging.value.complete(rows);
- }
- };
- // 暂存项左滑删除配置
- const optionsActionTemp = reactive([
- {
- text: '删除',
- style: {
- backgroundColor: '#F74C30',
- },
- },
- ]);
- // 暂存项删除点击(本地移除)
- const clickTempSwipe = async (event: object, item: any) => {
- const { name, index } = event as any;
-
- if (index === 0) {
- if (item.instoreType == '3') {
- return uni.showModal({
- title: '提示',
- content: '该批次为采收入库的鲜货,请前往种养殖-采收管理里删除采收记录,入库记录将同步删除。',
- showCancel: false,
- confirmText: '知道了',
- confirmColor: '#41c06d',
- });
- }
- try {
- const res = await uni.showModal({
- title: '删除提示',
- content: '确定删除种源信息吗?',
- confirmColor: '#F74C30',
- });
- if (!res.confirm) return;
- await uni.showLoading({
- title: '删除中...',
- mask: true,
- });
- await useClientRequest.get(`/plt-api/app/storageSeed/removeById/${name}`);
- uni.hideLoading();
- uni.showToast({
- title: '删除成功',
- icon: 'success',
- });
- paging.value?.reload();
- } catch (error) {
- console.error('删除暂存种源信息失败:', error);
- }
- }
- };
- const onRefresh = () => {
- paging.value.reload();
- };
- onMounted(() => {
- uni.$on('refreshStorageRoomList', () => {
- onRefresh();
- });
- });
- </script>
- <style lang="scss" scoped>
- .search-select-item {
- height: 86rpx;
- background-color: #fff;
- border-radius: 10rpx;
- box-sizing: border-box;
- padding: 12rpx;
- }
- </style>
|