Kaynağa Gözat

Merge branch 'master' of http://git.yujin.shuziyunyao.com/yujin/forestry-wx

lisy 1 ay önce
ebeveyn
işleme
6e966590a3

+ 1 - 1
src/components/ut-tabs/ut-tabs.vue

@@ -163,7 +163,7 @@ const scrollToTab = (idx: number) => {
     display: inline-flex;
     align-items: center;
     justify-content: center;
-    height: 78rpx;
+    height: 70rpx;
     font-weight: 500;
     color: #666;
     cursor: pointer;

+ 4 - 18
src/pages.json

@@ -263,20 +263,6 @@
                         "navigationBarTitleText": "修改种源信息"
                     }
                 },
-                // 种源出入库清单
-                {
-                    "path": "seed-source/stock-list/index",
-                    "style": {
-                        "navigationBarTitleText": "种源出入库清单"
-                    }
-                },
-                // 库存耗损登记
-                {
-                    "path": "seed-source/loss-register/index",
-                    "style": {
-                        "navigationBarTitleText": "库存损耗登记"
-                    }
-                },
                 // 农资库
                 {
                     "path": "agro-product/list/index",
@@ -312,16 +298,16 @@
                         "navigationBarTitleText": "修改农资信息"
                     }
                 },
-                // 农资出入库清单
+                // 出入库清单
                 {
-                    "path": "agro-product/stock-list/index",
+                    "path": "stock-list/index",
                     "style": {
                         "navigationBarTitleText": "农资出入库清单"
                     }
                 },
-                // 农资库存耗损登记
+                // 库存耗损登记
                 {
-                    "path": "agro-product/loss-register/index",
+                    "path": "loss-register/index",
                     "style": {
                         "navigationBarTitleText": "农资库存损耗登记"
                     }

+ 43 - 13
src/plant/storage/agro-product/detail/index.vue

@@ -10,14 +10,15 @@
                     <view class="startline-title">库存信息</view>
                 </view>
                 <view>
-                    <up-button type="primary" :customStyle="formItemBtnStyle">
+                    <up-button @click="navigateToInOutRecords" type="primary" :customStyle="formItemBtnStyle">
+                        <image class="w-30 h-30 mr-10" src="@/static/images/plant/storage/ckcrkjl_icon.png" mode="widthFix" />
                         <span>查看出入库记录</span>
                     </up-button>
                 </view>
             </view>
-            <view class="bg-#fff pd-24">
+            <view class="bg-#fff pd3-10-24-24">
                 <view class="d-flex j-ed a-c mb-16">
-                    <view class="f-s-22 c-#666">{{ form?.updateTime || form?.createTime }}</view>
+                    <view class="f-s-22 c-#666">{{ form?.instoreBizInfo?.instoreDate }}</view>
                 </view>
                 <view class="d-flex flex1 mb-10">
                     <view class="flex1">
@@ -33,15 +34,14 @@
                     <span class="c-#666">入库批号:</span>
                     <span class="c-#333 f-w-500">{{ form?.batchCode }}</span>
                 </view>
-                <!-- <view class="pd2-4-0 f-s-28">
-                            <span class="c-#666">溯源批号:</span>
-                            <span class="c-#333 f-w-500">暂无</span>
-                        </view> -->
-
-                <view class="pd2-4-0 f-s-28">
+                <view v-if="form?.supplier" class="pd2-4-0 f-s-28">
                     <span class="c-#666">供应商:</span>
                     <span class="c-#333 f-w-500">{{ form?.supplier }}</span>
                 </view>
+                <view v-if="form?.warehouses?.length" class="pd2-4-0 f-s-28">
+                    <span class="c-#666">存放库房:</span>
+                    <span class="c-#333 f-w-500">{{ getStorageRoomNames(form?.warehouses) || '-' }}</span>
+                </view>
                 <view class="pd2-4-0 f-s-28">
                     <span class="c-#666">入库量:</span>
                     <span class="c-#333 f-w-500">{{ form?.capacity }}{{ form?.unit }}</span>
@@ -52,10 +52,13 @@
                         <span class="c-#333 f-w-500">{{ form?.inputAmount || '0' }}{{ form?.unit }}</span>
                     </view>
                     <view v-if="form?.restAmount" class="pd2-4-0 f-s-28 flex1">
-                        <span class="c-danger">剩余量:</span>
-                        <span class="c-danger f-w-500">{{ form?.restAmount || '0' }}{{ form?.unit }}</span>
+                        <span class="c-primary">剩余量:</span>
+                        <span class="c-primary f-w-500">{{ form?.restAmount || '0' }}{{ form?.unit }}</span>
                     </view>
                 </view>
+                <view v-if="+form?.restAmount" class="pd3-20-40-0">
+                    <up-button @click="navigateToInventoryLoss" type="warning" plain :customStyle="{ background: '#FFF9EF', borderColor: '#F9D9A3' }">库存有消耗?库存损耗登记{{ '>' }}</up-button>
+                </view>
             </view>
             <view class="pd-24">
                 <view class="startline-title">农资信息</view>
@@ -147,9 +150,9 @@
                     <span class="c-#666">库房类型:</span>
                     <span class="c-#333 f-w-600">农资库</span>
                 </view>
-                <view class="f-s-30 pd2-16-0 info-border-bottom">
+                <view v-if="form?.warehouses?.length" class="pd2-4-0 f-s-28">
                     <span class="c-#666">存放库房:</span>
-                    <span class="c-#333 f-w-600">{{ selectDictLabel(pt_warehouse_type, form?.warehouseType) || '-' }}</span>
+                    <span class="c-#333 f-w-500">{{ getStorageRoomNames(form?.warehouses) || '-' }}</span>
                 </view>
                 <view class="f-s-30 pd2-16-0 info-border-bottom">
                     <span class="c-#666">入库人:</span>
@@ -179,6 +182,7 @@
 
 <script setup lang="ts">
 import { formItemBtnStyle } from '@/assets/styles/uview-plus';
+import { getStorageRoomNames } from '@/utils/common';
 import { useClientRequest } from '@/utils/request';
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 // 使用到的字典:入库类型、库房类型、农资类别、来源、单位、规格单位、是否
@@ -213,6 +217,32 @@ const clickEdit = () => {
         },
     });
 };
+const navigateToInOutRecords = () => {
+    uni.$u.route({
+        type: 'navigateTo',
+        url: '/plant/storage/stock-list/index',
+        params: {
+            id: did.value,
+            stockType: '1'
+        },
+    });
+};
+const navigateToInventoryLoss = () => {
+    uni.$on('storage-registered', () => {
+        getDetailById(did.value);
+        uni.$emit('refreshStorageRoomList');
+        uni.$off('storage-registered');
+    });
+    uni.navigateTo({
+        url: '/plant/storage/loss-register/index',
+        success: (res)=> {
+            res.eventChannel.emit('storage-data', {
+                stockType: '1',
+                ...form.value
+            });
+        },
+    });
+};
 // 页面入参解析并加载
 onLoad((options: any) => {
     did.value = options?.id || '';

+ 7 - 8
src/plant/storage/agro-product/list/index.vue

@@ -15,9 +15,9 @@
         <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" class="mb-20 b-radius">
-                    <view class="b-radius bg-#fff pd-20 p-rtv" @click.stop="$u.route({ url: '/plant/storage/agro-product/detail/index', params: { id: item.id } })">
+                    <view class="b-radius bg-#fff pd3-10-24-24 p-rtv" @click.stop="$u.route({ url: '/plant/storage/agro-product/detail/index', params: { id: item.id } })">
                         <view class="d-flex j-ed a-c mb-16">
-                            <view class="f-s-22 c-#666">{{ item?.updateTime || item?.createTime }}</view>
+                            <view class="f-s-22 c-#666">{{ item?.instoreBizInfo?.instoreDate }}</view>
                         </view>
                         <view class="d-flex flex1 mb-10">
                             <view class="flex1">
@@ -33,11 +33,10 @@
                             <span class="c-#666">入库批号:</span>
                             <span class="c-#333 f-w-500">{{ item?.batchCode }}</span>
                         </view>
-                        <!-- <view class="pd2-4-0 f-s-28">
-                            <span class="c-#666">溯源批号:</span>
-                            <span class="c-#333 f-w-500">暂无</span>
-                        </view> -->
-                      
+                        <view v-if="item?.warehouses?.length" class="pd2-4-0 f-s-28">
+                            <span class="c-#666">存放库房:</span>
+                            <span class="c-#333 f-w-500">{{ getStorageRoomNames(item?.warehouses) || '-' }}</span>
+                        </view>
                         <view class="pd2-4-0 f-s-28">
                             <span class="c-#666">供应商:</span>
                             <span class="c-#333 f-w-500">{{ item?.supplier }}</span>
@@ -74,6 +73,7 @@
 <script setup lang="ts">
 import { useClientRequest } from '@/utils/request';
 import AgroBottom from './model/agro-bottom.vue';
+import { getStorageRoomNames } from '@/utils/common';
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 const { pt_material_type } = toRefs<any>(proxy?.useDict('pt_material_type'));
 const list = ref<any[]>();
@@ -140,7 +140,6 @@ const onRefresh = () => {
     paging.value.reload();
 };
 onMounted(() => {
-
     uni.$on('refreshStorageRoomList', () => {
         onRefresh();
     });

+ 0 - 3
src/plant/storage/agro-product/loss-register/index.vue

@@ -1,3 +0,0 @@
-<template>
-    <view>损耗登记</view>
-</template>

+ 0 - 3
src/plant/storage/agro-product/stock-list/index.vue

@@ -1,3 +0,0 @@
-<template>
-    <view>出入库清单</view>
-</template>

+ 223 - 0
src/plant/storage/loss-register/index.vue

@@ -0,0 +1,223 @@
+<template>
+    <z-paging ref="paging" bgColor="#F7F7F7" safe-area-inset-bottom paging-class="paging-btm-shadow" scroll-with-animation>
+        <template #top>
+            <ut-navbar title="库存损耗登记" :fixed="false" border></ut-navbar>
+        </template>
+        <up-form class="p-rtv pd-24" labelPosition="top" :model="form" :rules="rules" labelWidth="auto" ref="upFormRef">
+            <view class="bg-fff b-radius-16">
+                <view class="pd3-10-24-24 up-border-bottom">
+                    <template v-if="info?.stockType === '1'">
+                        <view class="d-flex j-ed a-c mb-16">
+                            <view class="f-s-22 c-#666">{{ info?.instoreBizInfo?.instoreDate }}</view>
+                        </view>
+                        <view class="d-flex flex1 mb-10">
+                            <view class="flex1">
+                                <span class="f-s-34 c-#333 f-w-500 mr-10">{{ info?.materialName }}</span>
+                                <span class="f-s-24 c-#666">{{ selectDictLabel(pt_material_type, info?.materialType) }}</span>
+                            </view>
+                            <view>
+                                <view v-if="info?.examinReport?.length" class="tag-span c-primary bg-#EBF6EE">已检验</view>
+                                <view v-else class="tag-span c-danger bg-#F9ECEA">未检验</view>
+                            </view>
+                        </view>
+                        <view class="pd2-4-0 f-s-28">
+                            <span class="c-#666">入库批号:</span>
+                            <span class="c-#333 f-w-500">{{ info?.batchCode }}</span>
+                        </view>
+                        <view v-if="info?.supplier" class="pd2-4-0 f-s-28">
+                            <span class="c-#666">供应商:</span>
+                            <span class="c-#333 f-w-500">{{ info?.supplier }}</span>
+                        </view>
+                        <view class="pd2-4-0 f-s-28">
+                            <span class="c-#666">入库量:</span>
+                            <span class="c-#333 f-w-500">{{ info?.capacity }}{{ info?.unit }}</span>
+                        </view>
+                        <view class="d-flex">
+                            <view v-if="info?.restAmount" class="pd2-4-0 f-s-28 flex1">
+                                <span class="c-#666">出库量:</span>
+                                <span class="c-#333 f-w-500">{{ info?.inputAmount || '0' }}{{ info?.unit }}</span>
+                            </view>
+                            <view v-if="info?.restAmount" class="pd2-4-0 f-s-28 flex1">
+                                <span class="c-primary">剩余量:</span>
+                                <span class="c-primary f-w-500">{{ info?.restAmount || '0' }}{{ info?.unit }}</span>
+                            </view>
+                        </view>
+                    </template>
+                    <template v-if="info?.stockType === '2'">
+                        <view class="d-flex j-sb a-c li-item-head mb-16">
+                            <view class="li-left-tag" :class="{ [`bg-${selectDictListClass(pt_seed_instore_type, info?.instoreType)}`]: true }">{{ selectDictLabel(pt_seed_instore_type, info?.instoreType) }}</view>
+                            <view class="f-s-22 c-#666">{{ info?.updateTime || info?.createTime }}</view>
+                        </view>
+                        <view class="mb-10">
+                            <span class="f-s-34 c-#333 f-w-500 mr-10">{{ info?.variety }}</span>
+                            <span class="f-s-24 c-#666">{{ selectDictLabel(pt_seed_type, info?.seedType) }}</span>
+                        </view>
+                        <view class="pd2-4-0 f-s-28">
+                            <span class="c-#666">入库批号:</span>
+                            <span class="c-#333 f-w-500">{{ info?.batchCode }}</span>
+                        </view>
+                        <view v-if="['A3', 'A4'].includes(info?.fungusCodeType)" class="pd2-4-0 f-s-28">
+                            <span class="c-#666">菌种/菌株编号:</span>
+                            <span class="c-#333 f-w-500">{{ selectDictLabel(pt_fungus_code_type, info?.fungusCodeType) }}/{{ info?.fungusCode }}</span>
+                        </view>
+                        <view class="pd2-4-0 f-s-28">
+                            <span class="c-#666">供应商:</span>
+                            <span class="c-#333 f-w-500">{{ info?.supplier }}</span>
+                        </view>
+                        <view class="pd2-4-0 f-s-28">
+                            <span class="c-#666">入库量:</span>
+                            <span class="c-#333 f-w-500">{{ info?.capacity }}{{ info?.unit }}</span>
+                        </view>
+                        <view class="d-flex">
+                            <view v-if="info?.restAmount" class="pd2-4-0 f-s-28 flex1">
+                                <span class="c-#666">出库量:</span>
+                                <span class="c-#333 f-w-500">{{ info?.inputAmount || '0' }}{{ info?.unit }}</span>
+                            </view>
+                            <view v-if="info?.restAmount" class="pd2-4-0 f-s-28 flex1">
+                                <span class="c-primary">剩余量:</span>
+                                <span class="c-primary f-w-500">{{ info?.restAmount || '0' }}{{ info?.unit }}</span>
+                            </view>
+                        </view>
+                    </template>
+                </view>
+                <view class="pd3-10-24-24">
+                    <!-- 损耗登记日期 -->
+                    <!-- 损耗数量 -->
+                    <!-- 备注 -->
+                    <view class="h-1" id="scrapDatepppp"></view>
+                    <ut-datetime-picker v-model="form.scrapDate" :maxDate="new Date()" mode="date">
+                        <up-form-item borderBottom label="损耗登记日期" required prop="scrapDate">
+                            <up-input v-model="form.scrapDate" readonly placeholder="请选择损耗登记日期" border="none" clearable></up-input>
+                            <template #right>
+                                <up-icon size="22rpx" color="#2A6D52" name="arrow-down-fill"></up-icon>
+                            </template>
+                        </up-form-item>
+                    </ut-datetime-picker>
+                    <view class="h-1" id="scrapAmountpppp"></view>
+                    <up-form-item borderBottom label="损耗数量" required prop="scrapAmount">
+                        <up-input v-model="form.scrapAmount" type="number" placeholder="请输入损耗数量" border="none" clearable></up-input>
+                        <template #right>
+                            <view class="c-#333 f-s-28">{{ info?.unit }}</view>
+                        </template>
+                    </up-form-item>
+                    <view class="h-1" id="remarkpppp"></view>
+                    <up-form-item borderBottom label="备注" prop="remark">
+                        <up-textarea v-model="form.remark" placeholder="损耗原因等" autoHeight></up-textarea>
+                    </up-form-item>
+                </view>
+                <!-- <view class="h-1" id="contactTelpppp"></view>
+                <up-form-item borderBottom label="联系电话" prop="contactTel">
+                    <up-input v-model="form.contactTel" placeholder="请输入联系电话" border="none" clearable></up-input>
+                </up-form-item> -->
+            </view>
+        </up-form>
+        <template #bottom>
+            <view class="pd-20 d-flex">
+                <up-button @click="navigateBackOrHome()" class="mr-30" style="color: #333;" color="#F2F2F2">取消</up-button>
+                <up-button @click="submit" type="primary">确认登记</up-button>
+            </view>
+        </template>
+    </z-paging>
+</template>
+<script setup lang="ts">
+import { useClientRequest } from '@/utils/request';
+import { parseTime, selectDictListClass } from '@/utils/ruoyi';
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;
+const { pt_material_type, pt_seed_instore_type, pt_seed_type, pt_fungus_code_type } = toRefs<any>(proxy?.useDict('pt_material_type', 'pt_seed_instore_type', 'pt_seed_type', 'pt_fungus_code_type'));
+const upFormRef = ref();
+const paging = ref();
+
+const form = ref({
+    scrapDate: parseTime(new Date(), '{y}-{m}-{d}'),
+    scrapAmount: '',
+    remark: '',
+});
+const info = ref<any>(null);
+
+const rules = reactive({
+    scrapDate: [{ required: true, message: '请选择损耗登记日期' }],
+    scrapAmount: [
+        { required: true, message: '请输入损耗数量' },
+        {
+            validator: (rule: any, value: any) => {
+                if (value === undefined || value === null || value === '') return true;
+                const amount = Number(value);
+                if (Number.isNaN(amount)) return false;
+                return amount > 0;
+            },
+            message: '损耗数量需为大于0的数字',
+            trigger: ['blur', 'change'],
+        },
+        {
+            validator: (rule: any, value: any) => {
+                if (value === undefined || value === null || value === '') return true;
+                const amount = Number(value);
+                if (Number.isNaN(amount)) return true;
+                const max = Number(info.value?.restAmount ?? 0);
+                if (!max) return true;
+                return amount <= max;
+            },
+            message: '损耗数量不能超过剩余量',
+            trigger: ['blur', 'change'],
+        },
+    ],
+});
+
+const submit = async () => {
+    try {
+        await upFormRef.value?.validate();
+    } catch (error: any) {
+        const firstErrorField = error && error[0].prop + 'pppp';
+        paging.value?.scrollIntoViewById(firstErrorField, 30, true);
+        return;
+    }
+    try {
+        await uni.showLoading({ title: '保存中...', mask: true });
+        const payload: any = { ...form.value, storageType: info.value?.stockType, targetId: info.value?.id, scrapUnit: info.value?.unit };
+        const res = await useClientRequest.post('/plt-api/app/storage/scrap', payload);
+        uni.hideLoading();
+        if (res && res.code === 200) {
+            uni.showToast({ title: '登记成功', icon: 'success' });
+            uni.$emit('storage-registered')
+            setTimeout(() => uni.navigateBack(), 300);
+        }
+    } catch (e) {
+        uni.hideLoading();
+    }
+};
+onLoad((options: any) => {
+    const instance: any = getCurrentInstance()?.proxy;
+    const eventChannel = instance?.getOpenerEventChannel();
+    eventChannel.on('storage-data', (data: any) => {
+        console.log(data);
+        info.value = data;
+    });
+});
+</script>
+<style lang="scss" scoped>
+.startline-title {
+    font-size: 32rpx;
+    font-weight: 600;
+    color: #333;
+}
+
+.base-bottom-wrap {
+    background-color: #fff;
+}
+.tag-span {
+    padding: 4rpx 12rpx;
+    font-size: 20rpx;
+    border-radius: 18rpx;
+}
+.li-item-head {
+    margin-left: -24rpx;
+    margin-top: -24rpx;
+}
+.li-left-tag {
+    padding: 6rpx 16rpx;
+    color: #fff;
+    border-radius: 0 0 16rpx 0;
+    font-size: 20rpx;
+    font-weight: 500;
+}
+</style>

+ 39 - 9
src/plant/storage/seed-source/detail/index.vue

@@ -10,7 +10,8 @@
                     <view class="startline-title">库存信息</view>
                 </view>
                 <view>
-                    <up-button type="primary" :customStyle="formItemBtnStyle">
+                    <up-button @click="navigateToInOutRecords" type="primary" :customStyle="formItemBtnStyle">
+                        <image class="w-30 h-30 mr-10" src="@/static/images/plant/storage/ckcrkjl_icon.png" mode="widthFix" />
                         <span>查看出入库记录</span>
                     </up-button>
                 </view>
@@ -18,7 +19,7 @@
             <view class="bg-#fff pd-24">
                 <view class="d-flex j-sb a-c li-item-head mb-16">
                     <view class="li-left-tag" :class="{ [`bg-${selectDictListClass(pt_seed_instore_type, form?.instoreType)}`]: true }">{{ selectDictLabel(pt_seed_instore_type, form?.instoreType) }}</view>
-                    <view class="f-s-22 c-#666">{{ form?.updateTime || form?.createTime }}</view>
+                    <view class="f-s-22 c-#666">{{ form?.instoreBizInfo?.instoreDate }}</view>
                 </view>
                 <view class="mb-10">
                     <span class="f-s-34 c-#333 f-w-500 mr-10">{{ form?.variety }}</span>
@@ -28,10 +29,6 @@
                     <span class="c-#666">入库批号:</span>
                     <span class="c-#333 f-w-500">{{ form?.batchCode }}</span>
                 </view>
-                <!-- <view class="pd2-4-0 f-s-28">
-                            <span class="c-#666">溯源批号:</span>
-                            <span class="c-#333 f-w-500">暂无</span>
-                        </view> -->
                 <view v-if="['A3', 'A4'].includes(form?.fungusCodeType)" class="pd2-4-0 f-s-28">
                     <span class="c-#666">菌种/菌株编号:</span>
                     <span class="c-#333 f-w-500">{{ selectDictLabel(pt_fungus_code_type, form?.fungusCodeType) }}/{{ form?.fungusCode }}</span>
@@ -40,6 +37,10 @@
                     <span class="c-#666">供应商:</span>
                     <span class="c-#333 f-w-500">{{ form?.supplier }}</span>
                 </view>
+                <view v-if="form?.warehouses?.length" class="pd2-4-0 f-s-28">
+                    <span class="c-#666">存放库房:</span>
+                    <span class="c-#333 f-w-500">{{ getStorageRoomNames(form?.warehouses) || '-' }}</span>
+                </view>
                 <view class="pd2-4-0 f-s-28">
                     <span class="c-#666">入库量:</span>
                     <span class="c-#333 f-w-500">{{ form?.capacity }}{{ form?.unit }}</span>
@@ -54,6 +55,9 @@
                         <span class="c-primary f-w-500">{{ form?.restAmount || '0' }}{{ form?.unit }}</span>
                     </view>
                 </view>
+                <view v-if="+form?.restAmount" class="pd3-20-40-0">
+                    <up-button @click="navigateToInventoryLoss" type="warning" plain :customStyle="{ background: '#FFF9EF', borderColor: '#F9D9A3' }">库存有消耗?库存损耗登记{{ '>' }}</up-button>
+                </view>
             </view>
             <view class="pd-24">
                 <view class="startline-title">种源信息</view>
@@ -236,9 +240,9 @@
                     <span class="c-#666">库房类型:</span>
                     <span class="c-#333 f-w-600">种源库</span>
                 </view>
-                <view class="f-s-30 pd2-16-0 info-border-bottom">
+                <view v-if="form?.warehouses?.length" class="pd2-4-0 f-s-28">
                     <span class="c-#666">存放库房:</span>
-                    <span class="c-#333 f-w-600">{{ selectDictLabel(pt_warehouse_type, form?.warehouseType) || '-' }}</span>
+                    <span class="c-#333 f-w-500">{{ getStorageRoomNames(form?.warehouses) || '-' }}</span>
                 </view>
                 <view class="f-s-30 pd2-16-0 info-border-bottom">
                     <span class="c-#666">入库人:</span>
@@ -268,6 +272,7 @@
 
 <script setup lang="ts">
 import { formItemBtnStyle } from '@/assets/styles/uview-plus';
+import { getStorageRoomNames } from '@/utils/common';
 import { useClientRequest } from '@/utils/request';
 import { selectDictListClass } from '@/utils/ruoyi';
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@@ -291,7 +296,32 @@ const getDetailById = async (id: string) => {
         form.value = res.data || {};
     }
 };
-
+const navigateToInOutRecords = () => {
+    uni.$u.route({
+        type: 'navigateTo',
+        url: '/plant/storage/stock-list/index',
+        params: {
+            id: did.value,
+            stockType: '2',
+        },
+    });
+};
+const navigateToInventoryLoss = () => {
+    uni.$on('storage-registered', () => {
+        getDetailById(did.value);
+        uni.$emit('refreshStorageRoomList');
+        uni.$off('storage-registered');
+    });
+    uni.navigateTo({
+        url: '/plant/storage/loss-register/index',
+        success: (res) => {
+            res.eventChannel.emit('storage-data', {
+                stockType: '2',
+                ...form.value,
+            });
+        },
+    });
+};
 const onRefresh = () => {
     getDetailById(did.value);
     paging.value?.complete();

+ 6 - 1
src/plant/storage/seed-source/list/index.vue

@@ -29,7 +29,7 @@
                     <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 } })">
                         <view class="d-flex j-sb a-c li-item-head mb-16">
                             <view class="li-left-tag" :class="{ [`bg-${selectDictListClass(pt_seed_instore_type, item?.instoreType)}`]: true }">{{ selectDictLabel(pt_seed_instore_type, item?.instoreType) }}</view>
-                            <view class="f-s-22 c-#666">{{ item?.updateTime || item?.createTime }}</view>
+                            <view class="f-s-22 c-#666">{{ item?.instoreBizInfo?.instoreDate }}</view>
                         </view>
                         <view class="d-flex flex1 mb-10">
                             <view class="flex1">
@@ -57,6 +57,10 @@
                             <span class="c-#666">供应商:</span>
                             <span class="c-#333 f-w-500">{{ item?.supplierInfo?.cusName || '-' }}</span>
                         </view>
+                        <view v-if="item?.warehouses?.length" class="pd2-4-0 f-s-28">
+                            <span class="c-#666">存放库房:</span>
+                            <span class="c-#333 f-w-500">{{ getStorageRoomNames(item?.warehouses) || '-' }}</span>
+                        </view>
                         <view class="pd2-4-0 f-s-28">
                             <span class="c-#666">入库量:</span>
                             <span class="c-#333 f-w-500">{{ item?.capacity }}{{ item?.unit }}</span>
@@ -90,6 +94,7 @@
 import { useClientRequest } from '@/utils/request';
 import SourceBottom from './model/source-bottom.vue';
 import { selectDictListClass } from '@/utils/ruoyi';
+import { getStorageRoomNames } from '@/utils/common';
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 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'));
 const list = ref<any[]>();

+ 0 - 3
src/plant/storage/seed-source/loss-register/index.vue

@@ -1,3 +0,0 @@
-<template>
-    <view>损耗登记</view>
-</template>

+ 0 - 3
src/plant/storage/seed-source/stock-list/index.vue

@@ -1,3 +0,0 @@
-<template>
-    <view>出入库清单</view>
-</template>

+ 115 - 0
src/plant/storage/stock-list/index.vue

@@ -0,0 +1,115 @@
+<template>
+    <z-paging ref="paging" v-model="list" bgColor="#f7f7f7" @query="query" safe-area-inset-bottom>
+        <template #top>
+            <ut-navbar title="出入库记录" :fixed="false" border></ut-navbar>
+            <view class="pd2-12-24">
+                <ut-tabs v-model="form.operationType" :tabs="tabs" @change="onRefresh"></ut-tabs>
+                <view class="pd-10"></view>
+                <ut-search ref="searchRef" v-model="form.keyword" @search="onRefresh" margin="0" :border="false" :placeholder="placeholder" bgColor="#fff" height="86rpx" borderRadius="10rpx"></ut-search>
+            </view>
+        </template>
+        <template>
+            <view class="pd2-12-24">
+                <template v-for="item in list" :name="item?.id" :key="item?.id">
+                    <view class="b-radius bg-#fff pd-20 p-rtv mb-20">
+                        <view class="d-flex">
+                            <view class="flex1 ov-hd mr-20 f-s-34 c-#333 f-w-500">{{ selectDictLabel(pt_operation_type, item?.operationType) }}</view>
+                            <view class="f-s-24 c-#666">{{ item?.relationBizInfo?.storageDate }}</view>
+                        </view>
+                        <view class="f-s-28 pd2-5-0">
+                            <span class="c-#666">出入库批号:</span>
+                            <span class="c-#333 f-w-600">{{ item?.batchCode }}</span>
+                        </view>
+                        <view class="f-s-28 pd2-5-0">
+                            <span class="c-#666">记录批号:</span>
+                            <span class="c-#333 f-w-600">{{ item?.recordNumber || '-' }}</span>
+                        </view>
+                        <view class="f-s-28 pd2-5-0">
+                            <span class="c-#666">出入库量:</span>
+                            <span class="c-#333 f-w-600">{{ item?.operationType == '1' ? '+' : '-' }}{{ item?.quantity || '-' }}{{ item?.unit }}</span>
+                        </view>
+                        <view class="f-s-28 pd2-5-0">
+                            <span class="c-#666">用途/来源:</span>
+                            <span class="c-#333 f-w-600">{{ item?.relationBizInfo?.purpose || '-' }}</span>
+                            <span v-if="item?.relationBizInfo?.batchTypeStr && item?.relationBizInfo?.batchCode" class="c-#333 f-w-600 f-s-22">({{ item?.relationBizInfo?.batchTypeStr || '-' }}:{{ item?.relationBizInfo?.batchCode || '-' }})</span>
+                        </view>
+                        <view class="f-s-28 pd2-5-0">
+                            <span class="c-#666">备注:</span>
+                            <span class="c-#333 f-w-600">{{ item?.remark || '-' }}</span>
+                        </view>
+                        <view class="d-flex">
+                            <view class="flex1 f-s-24 pd2-5-0">
+                                <span class="c-#666">操作人:</span>
+                                <span class="c-#666">{{ item?.createByName || '-' }}</span>
+                            </view>
+                            <view class="f-s-24 pd2-5-0">
+                                <span class="c-#666">操作时间:</span>
+                                <span class="c-#666">{{ item?.createTime || '-' }}</span>
+                            </view>
+                        </view>
+                    </view>
+                </template>
+            </view>
+        </template>
+        <!-- 空数据处理 -->
+
+        <template #empty>
+            <ut-empty class="mg-at" size="28rpx" color="#999" padding="10rpx">暂未设置库房,点击+号新增库房吧</ut-empty>
+        </template>
+    </z-paging>
+</template>
+<script setup lang="ts">
+import { useClientRequest } from '@/utils/request';
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;
+const { pt_warehouse_type, pt_operation_type } = toRefs<any>(proxy?.useDict('pt_warehouse_type', 'pt_operation_type'));
+const paging = ref();
+const list = ref<any[]>([]);
+const placeholder = ref('搜出入库批号、用途、来源');
+
+const form = ref({
+    keyword: '',
+    operationType: ''
+});
+const tabs = reactive([
+    { label: '全部', value: '' },
+    { label: '入库记录', value: '1' },
+    { label: '出库记录', value: '2' },
+])
+const query = async (pageNum: number, pageSize: number) => {
+    const params = {
+        pageNum,
+        pageSize,
+        ...form.value,
+        storageId: paramOptions.value.id,
+        stockType: paramOptions.value.stockType,
+    };
+    const res = await useClientRequest.get<any>('/plt-api/app/storageRecord/list', params);
+    if (!res || res.code !== 200) return;
+    const { rows } = res;
+    paging.value.complete(rows);
+};
+const onRefresh = () => {
+    try {
+        paging.value?.reload();
+    } catch (e) {
+        console.error(e);
+    }
+};
+const paramOptions = ref<Record<string, any>>({});
+onLoad((options) => {
+    paramOptions.value = options || {};
+});
+</script>
+<style lang="scss" scoped>
+
+.search-select-item {
+    height: 86rpx;
+    background-color: #fff;
+    border-radius: 10rpx;
+    box-sizing: border-box;
+    padding-left: 16rpx;
+    padding-right: 16rpx;
+    padding-top: 14rpx;
+    padding-bottom: 14rpx;
+}
+</style>

+ 1 - 1
src/plant/storage/storage-room/list/index.vue

@@ -18,7 +18,7 @@
         </template>
 
         <template>
-            <view class="pl-25 pr-25">
+            <view class="pl-24 pr-24">
                 <up-swipe-action>
                     <up-swipe-action-item v-for="item in list" :name="item?.id" :key="item?.id" :disabled="item?.storeCount" :options="optionsAction" @click="clickSwipe" class="mb-20 b-radius">
                         <view @click.stop="clickItem(item)" class="b-radius bg-#fff pd-20 p-rtv">

+ 0 - 0
src/static/images/plant/storage/查看出入库记录.png → src/static/images/plant/storage/ckcrkjl_icon.png


+ 10 - 2
src/utils/common.ts

@@ -154,7 +154,7 @@ export function navigateBackOrHome(): void {
     const pages = getCurrentPages();
     if (pages.length === 1) {
         uni.switchTab({
-            url: '/pages/index/index'
+            url: '/pages/plant/base/index'
         });
     } else {
         uni.navigateBack();
@@ -417,4 +417,12 @@ export const getRect = (selector: string, all: boolean = false): Promise<UniApp.
             }).exec();
         }
     });
-};
+};
+
+// 根据传入存放库房数组返回文字
+export const getStorageRoomNames = (rooms: Array<{ warehouseName?: string, shelvesName?: string, shelfId?: string, warehouseId?: string }>): string => {
+    if (!rooms || rooms.length === 0) {
+        return '';
+    }
+    return rooms.map(room => (room.warehouseName || '') +  (room.shelvesName ? '-' : '') + (room.shelvesName || '')).join(',');
+}