Quellcode durchsuchen

添加存放库房

huangxw vor 1 Monat
Ursprung
Commit
e1c2b6508e

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

@@ -45,7 +45,7 @@ const props = withDefaults(
         title: '',
         border: true,
         fixed: true,
-        homeUrl: '/pages/index/index',
+        homeUrl: '/pages/plant/base/index',
         leftText: '',
         breadcrumb: true,
         isLeftBack: true,

+ 17 - 19
src/models/select-contact-unit/select-contact-unit.vue

@@ -16,24 +16,22 @@
                 </template>
                 <template>
                     <view class="pd-24">
-                        <up-swipe-action>
-                            <template v-for="item in list" :key="item?.id">
-                                <view @click="clickRow(item)" class="b-radius bg-#fff pd-24 p-rtv select-item mb-20" :class="{ 'active': item?.id === checkedId }">
-                                    <view class="d-flex j-sb a-c li-item-head mb-16">
-                                        <view class="li-left-tag">{{ selectDictLabel(pt_cus_type, item?.cusType) }}</view>
-                                        <view class="f-s-22 c-#666">{{ item?.updateTime || item?.createTime }}</view>
-                                    </view>
-                                    <view class="f-s-34 c-#333 f-w-500">{{ item?.cusName }}</view>
-                                    <view class="f-s-24 c-#666">{{ item?.cusCode }}</view>
-                                    <view class="pd-5"></view>
-                                    <view class="f-s-28 pd2-5-0">
-                                        <span class="c-#666">联系电话:</span>
-                                        <span class="c-#333 f-w-600">{{ item?.contactTel }}</span>
-                                    </view>
-                                    <image v-if="item.id === checkedId" class="w-40 h-40 checked-icon" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-lm/price/checked1.png" mode="widthFix" />
+                        <template v-for="item in list" :key="item?.id">
+                            <view @click="clickRow(item)" class="b-radius bg-#fff pd-24 p-rtv select-item mb-20" :class="{ active: item?.id === checkedId }">
+                                <view class="d-flex j-sb a-c li-item-head mb-16">
+                                    <view class="li-left-tag">{{ selectDictLabel(pt_cus_type, item?.cusType) }}</view>
+                                    <view class="f-s-22 c-#666">{{ item?.updateTime || item?.createTime }}</view>
                                 </view>
-                            </template>
-                        </up-swipe-action>
+                                <view class="f-s-34 c-#333 f-w-500">{{ item?.cusName }}</view>
+                                <view class="f-s-24 c-#666">{{ item?.cusCode }}</view>
+                                <view class="pd-5"></view>
+                                <view class="f-s-28 pd2-5-0">
+                                    <span class="c-#666">联系电话:</span>
+                                    <span class="c-#333 f-w-600">{{ item?.contactTel }}</span>
+                                </view>
+                                <image v-if="item.id === checkedId" class="w-40 h-40 checked-icon" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-lm/price/checked1.png" mode="widthFix" />
+                            </view>
+                        </template>
                     </view>
                 </template>
                 <!-- 空数据处理 -->
@@ -43,7 +41,7 @@
                 </template>
                 <template #bottom>
                     <view class="pd-24 bg-#fff d-flex">
-                        <up-button @click="close" class="mr-30" color="#F2F2F2" style="color: #333;">取消</up-button>
+                        <up-button @click="close" class="mr-30" color="#F2F2F2" style="color: #333">取消</up-button>
                         <up-button @click="confirmSelection" type="primary">确认选择</up-button>
                     </view>
                 </template>
@@ -54,7 +52,7 @@
 <script setup lang="ts">
 import { useClientRequest } from '@/utils/request';
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
-const {  pt_cus_type, pt_cpy_type } = toRefs<any>(proxy?.useDict('pt_cus_type', 'pt_cpy_type'));
+const { pt_cus_type, pt_cpy_type } = toRefs<any>(proxy?.useDict('pt_cus_type', 'pt_cpy_type'));
 const paging = ref();
 const props = defineProps({
     params: {

+ 56 - 0
src/models/select-shelves-input/select-shelves-input.vue

@@ -0,0 +1,56 @@
+<template>
+    <view v-if="list.length">
+        <slot :list="list"></slot>
+    </view>
+    <view v-else class="pd2-40-24 d-flex flex-cln j-c a-c f-s-24 c-999">
+        <view>该库房暂未设置货位,仅可直接选到库房;</view>
+        <view>如由需要,可前往<span class="c-primary">仓储-库房管理</span>里进行设置 </view>
+    </view>
+</template>
+<script setup lang="ts">
+import { useClientRequest } from '@/utils/request';
+const props = defineProps({
+    warehouseId: {
+        type: String,
+        default: ''
+    },
+    expandeds: {
+        type: Object,
+        default: () => ({})
+    },
+    warehouseName: {
+        type: String,
+        default: ''
+    }
+});
+const emit = defineEmits(['changeIdNameMap']);
+// 获取货位列表
+const idNameMap: { [key: string]: { shelvesName: string, warehouseName: string, warehouseId?: string, shelfId?: string } } = {};
+const list = ref<any[]>([]);
+const queryWarehouseShelves = async () => {
+    const params = {
+        warehouseId: props.warehouseId
+    };
+    const res = await useClientRequest.get<any>('/plt-api/app/shelves/page', params);
+    if (!res || res.code !== 200) return;
+    list.value = res.rows || [];
+    // 构建id名称映射
+    list.value.forEach((item: any) => {
+        idNameMap[props.warehouseId + '-' + item.id] = {
+            shelvesName: item.shelvesName,
+            warehouseName: props.warehouseName,
+            warehouseId: props.warehouseId,
+            shelfId: item.id
+        };
+    });
+    emit('changeIdNameMap', idNameMap);
+};
+// 判断是不是第一次展开
+let firstExpand = true;
+watch(() => props.expandeds[props.warehouseId], (val) => {
+    if (val && firstExpand) {
+        queryWarehouseShelves();
+        firstExpand = false;
+    }
+}, { immediate: true });
+</script>

+ 157 - 0
src/models/select-warehouse-dialog/select-warehouse-dialog.vue

@@ -0,0 +1,157 @@
+<template>
+    <up-popup :show="show" mode="right" @close="close">
+        <view class="w-680 p-rtv" style="height: 100vh">
+            <z-paging ref="paging" v-model="list" bgColor="#fff" :fixed="false" @query="query" safe-area-inset-bottom>
+                <template #top>
+                    <up-navbar :fixed="false" border>
+                        <template #left>
+                            <view class="f-s-34 c-#333 f-w-500">{{ title }}</view>
+                        </template>
+                    </up-navbar>
+                </template>
+                <template>
+                    <view>
+                        <template v-for="item in list" :key="item?.id">
+                            <view @click="expandeds[item?.id] = !expandeds[item?.id]" class="pd-24 d-flex bg-#f7f7f7 btn-row-box a-c">
+                                <view>
+                                    <up-checkbox :label="item?.warehouseName" iconSize="36rpx" v-model:checked="aloneCheckeds[item.id]" labelSize="28rpx" name="agree" usedAlone> </up-checkbox>
+                                </view>
+                                <view class="flex1 ov-hd j-ed d-flex">
+                                    <up-icon size="30rpx" color="#333" name="arrow-down"></up-icon>
+                                </view>
+                            </view>
+                            <view v-show="expandeds[item?.id]" class="pd4-12-24-12-60">
+                                <SelectShelvesInput :warehouseId="item.id" :warehouseName="item.warehouseName" :expandeds="expandeds" @changeIdNameMap="changeIdNameMap">
+                                    <template #default="{ list }">
+                                        <template v-for="(sitem, index) in list" :key="sitem?.id">
+                                            <view class="pd2-6-12">
+                                                <up-checkbox :label="sitem?.shelvesName" iconSize="36rpx" v-model:checked="aloneCheckeds[item.id + '-' + sitem.id]" labelSize="28rpx" name="agree" usedAlone></up-checkbox>
+                                            </view>
+                                        </template>
+                                    </template>
+                                </SelectShelvesInput>
+                            </view>
+                        </template>
+                    </view>
+                </template>
+                <!-- 空数据处理 -->
+                <template #empty>
+                    <ut-empty class="mg-at" size="28rpx" color="#999" padding="10rpx">
+                        <view>暂未设置细分库房,如由需要, </view>
+                        <view>可前往<span class="c-primary">仓储-库房管理</span>里进行设置 </view>
+                    </ut-empty>
+                </template>
+                <template #bottom>
+                    <view class="pd-24 bg-#fff d-flex">
+                        <up-button @click="close" class="mr-30" color="#F2F2F2" style="color: #333">取消</up-button>
+                        <up-button @click="confirmSelection" type="primary">确认选择</up-button>
+                    </view>
+                </template>
+            </z-paging>
+        </view>
+    </up-popup>
+</template>
+<script setup lang="ts">
+import { useClientRequest } from '@/utils/request';
+import SelectShelvesInput from '../select-shelves-input/select-shelves-input.vue';
+
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;
+const { pt_cus_type, pt_cpy_type } = toRefs<any>(proxy?.useDict('pt_cus_type', 'pt_cpy_type'));
+const paging = ref();
+const props = defineProps({
+    params: {
+        type: Object,
+        default: () => ({}),
+    },
+    show: {
+        type: Boolean,
+        default: false,
+    },
+    modelValue: {
+        type: Array,
+        default: () => [],
+    },
+    title: {
+        type: String,
+        default: '选择存放库房',
+    },
+});
+const aloneCheckeds = reactive<{ [key: string]: boolean }>({});
+// 展开收起对象
+const expandeds = reactive<{ [key: string]: boolean }>({});
+const form = ref({});
+const emit = defineEmits(['update:show', 'confirm', 'update:modelValue']);
+const list = ref<any[]>([]);
+const query = async (pageNum: number, pageSize: number) => {
+    const params = {
+        pageNum,
+        pageSize,
+        ...props.params,
+        ...form.value,
+    };
+    const res = await useClientRequest.get<any>('/plt-api/app/warehouse/pageList', params);
+    if (!res || res.code !== 200) return;
+    const { rows } = res;
+    // 构建id名称映射
+    rows.forEach((item: any) => {
+        idNameMap[item.id] = {
+            warehouseName: item.warehouseName,
+            warehouseId: item.id,
+        };
+    });
+    paging.value?.complete(rows);
+};
+// 根据id获取名称的对象
+const idNameMap = reactive<{ [key: string]: { warehouseName?: string, shelvesName?: string, warehouseId?: string, shelfId?: string } }>({});
+const confirmSelection = () => {
+    console.log(aloneCheckeds);
+    console.log(idNameMap);
+    const values: any[] = [];
+    Object.keys(aloneCheckeds).forEach((key) => {
+        if (aloneCheckeds[key]) {
+            const names = idNameMap[key];
+            if (names) {
+                values.push({
+                    id: key,
+                    warehouseName: names.warehouseName,
+                    shelvesName: names.shelvesName,
+                    warehouseId: names.warehouseId,
+                    shelfId: names.shelfId,
+                });
+            }
+        }
+    });
+    emit('update:modelValue', values);
+    emit('confirm', values);
+    close();
+};
+const changeIdNameMap = (map: { [key: string]: { shelvesName: string, warehouseName: string } }) => {
+    Object.assign(idNameMap, map);
+};
+const close = () => {
+    emit('update:show', false);
+};
+watch(() => props.modelValue, (val) => {
+    // 初始化选中状态
+    Object.keys(aloneCheckeds).forEach((key) => {
+        delete aloneCheckeds[key];
+    });
+    val.forEach((item: any) => {
+        // warehouseId-shelfId warehouseName or warehouseId shelvesName
+        expandeds[item.warehouseId] = true;
+        aloneCheckeds[item.warehouseId + (item.shelfId ? '-' + item.shelfId : '')] = true;
+        idNameMap[item.warehouseId + (item.shelfId ? '-' + item.shelfId : '')] = {
+            warehouseName: item.warehouseName,
+            shelvesName: item.shelvesName,
+            warehouseId: item.warehouseId,
+            shelfId: item.shelfId,
+        };
+    });
+}, { immediate: true });
+</script>
+<style scoped lang="scss">
+.btn-row-box {
+    margin-top: -1rpx;
+    border: 1rpx solid #e6e6e6;
+}
+</style>

+ 73 - 0
src/models/select-warehouse-input/select-warehouse-input.vue

@@ -0,0 +1,73 @@
+<template>
+    <view class="flex1">
+        <slot>
+            <template v-for="(item, index) in values" :key="index">
+                <view class="pd-24 mb-12 warehouse-item p-rtv f-s-32 c-#333 f-w-500">
+                    {{ item.warehouseName }}{{ item.shelvesName ? '-' : '' }}{{ item.shelvesName || '' }}
+                    <view class="close-icon pd-16" @click="deleteItem(index)">
+                        <up-icon color="#F81242" name="close" size="32rpx"></up-icon>
+                    </view>
+                </view>
+            </template>
+            <up-button @click="clickSlot" type="primary" plain>
+                <image class="w-36 h-36 mr-10" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/common/select_push_icon.png" mode="widthFix" />
+                <span>请{{ title }}</span>
+            </up-button>
+        </slot>
+    </view>
+    <SelectWarehouseDialog v-model="values" v-if="showWarehouse" v-model:show="showWarehouse" :title="title" :params="params" @confirm="confirmSelection"></SelectWarehouseDialog>
+</template>
+<script setup lang="ts">
+import SelectWarehouseDialog from '../select-warehouse-dialog/select-warehouse-dialog.vue';
+const props = defineProps({
+    modelValue: {
+        type: Array,
+        default: () => [],
+    },
+    title: {
+        type: String,
+        default: '请选择存放库房',
+    },
+    params: {
+        type: Object,
+        default: () => ({}),
+    },
+});
+const emit = defineEmits(['update:modelValue']);
+const values = ref<any[]>(props.modelValue);
+const showWarehouse = ref(false);
+const clickSlot = () => {
+    showWarehouse.value = true;
+};
+const confirmSelection = (selectedValues: any[]) => {
+    values.value = selectedValues;
+    emit('update:modelValue', selectedValues);
+};
+const deleteItem = (index: number) => {
+    values.value.splice(index, 1);
+    emit('update:modelValue', values.value);
+};
+</script>
+<script lang="ts">
+export default {
+    options: {
+        // 微信小程序中 options 选项
+        multipleSlots: true, //  在组件定义时的选项中启动多slot支持,默认启用
+        styleIsolation: 'shared', //  启动样式隔离。当使用页面自定义组件,希望父组件影响子组件样式时可能需要配置。具体配置选项参见:微信小程序自定义组件的样式
+        addGlobalClass: true, //  表示页面样式将影响到自定义组件,但自定义组件中指定的样式不会影响页面。这个选项等价于设置 styleIsolation: apply-shared
+        virtualHost: true, //  将自定义节点设置成虚拟的,更加接近Vue组件的表现。我们不希望自定义组件的这个节点本身可以设置样式、响应 flex 布局等,而是希望自定义组件内部的第一层节点能够响应 flex 布局或者样式由自定义组件本身完全决定
+    },
+};
+</script>
+<style lang="scss" scoped>
+.warehouse-item {
+    background-color: #fbfdfb;
+    border: 1px solid #afddbb;
+    border-radius: 10px;
+}
+.close-icon {
+    position: absolute;
+    top: 0rpx;
+    right: 0rpx;
+}
+</style>

+ 60 - 62
src/plant/storage/agro-product/add/index.vue

@@ -1,7 +1,8 @@
 <template>
-    <z-paging class="" ref="paging" bgColor="#f7f7f7" paging-class="paging-btm-shadow" safe-area-inset-bottom scroll-with-animation>
+    <z-paging class="" ref="paging" bgColor="#f7f7f7" paging-class="paging-btm-shadow" safe-area-inset-bottom
+        scroll-with-animation>
         <template #top>
-            <ut-navbar :title="did ? '编辑农资入库' : '新增农资入库'" :fixed="false" border></ut-navbar>
+            <ut-navbar :title="'新增农资入库'" :fixed="false" border></ut-navbar>
         </template>
         <up-form class="p-rtv" labelPosition="top" :model="form" :rules="rules" labelWidth="auto" ref="upFormRef">
             <!-- 农资信息 -->
@@ -9,40 +10,40 @@
                 <view class="startline-title">农资信息</view>
             </view>
             <view class="pd-24 bg-#fff">
-                <!-- TODO: 后续按 seedInfoList 设计农资信息明细,此处先留空结构避免表单错误 -->
-                <up-form-item borderBottom label="添加农资信息" required prop="seedInfoList">
+                <!-- TODO: 后续按 agroProductInfoList 设计农资信息明细,此处先留空结构避免表单错误 -->
+                <up-form-item borderBottom label="添加农资信息" required prop="agroProductInfoList">
                     <view class="flex1">
-                        <template v-for="(item, index) in form.seedInfoList" :key="index">
+                        <template v-for="(item, index) in form.agroProductInfoList" :key="index">
                             <view class="bg-#FBFDFB card-info-block pd-24 p-rtv mb-12">
                                 <view class="d-flex flex1 mb-10">
                                     <view class="flex1">
-                                        <span class="f-s-34 c-#333 f-w-500 mr-10">{{ uidMapData[item]?.varietyInfo?.varietyName }}</span>
-                                        <span class="f-s-24 c-#666">{{ selectDictLabel(pt_seed_type, uidMapData[item]?.seedType) }}</span>
+                                        <span class="f-s-34 c-#333 f-w-500 mr-10">{{ uidMapData[item]?.materialName
+                                            }}</span>
+                                        <span class="f-s-24 c-#666">{{ selectDictLabel(pt_material_type, uidMapData[item]?.materialType) }}</span>
                                     </view>
                                     <view class="pr-60">
-                                        <view v-if="uidMapData[item]?.examinReport?.length" class="tag-span c-primary bg-#EBF6EE">已检</view>
+                                        <view v-if="uidMapData[item]?.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="d-flex">
-                                    <view class="flex1 f-s-28 pr-10 pd2-4-0">
-                                        <span class="c-#666">来源:</span>
-                                        <span class="c-#333 f-w-500">{{ selectDictLabel(pt_seed_source, uidMapData[item]?.seedSource) }}</span>
-                                    </view>
-                                    <view class="flex1 f-s-28 pd2-4-0">
-                                        <span class="c-#666">入库量:</span>
-                                        <span class="c-#333 f-w-500">{{ uidMapData[item]?.capacity }}{{ uidMapData[item]?.unit }}</span>
-                                    </view>
+                                <view v-if="uidMapData[item]?.supplierId && ['1'].includes(uidMapData[item]?.sourceType as string)" class="f-s-28 pr-10 pd2-4-0">
+                                    <span class="c-#666">供应商:</span>
+                                    <span class="c-#333 f-w-500">{{ uidMapData[item]?.supplierInfo?.cusName }}</span>
                                 </view>
                                 <view class="d-flex">
-                                    <view class="flex1 ov-hd">
-                                        <view class="f-s-28 pr-10 pd2-4-0">
-                                            <span class="c-#666">供应商:</span>
-                                            <span class="c-#333 f-w-500">{{ uidMapData[item]?.supplierInfo?.cusName }}</span>
+                                    <view class="d-flex flex1 ov-hd mr-10">
+
+                                        <view class="flex1 f-s-28 pd2-4-0">
+                                            <span class="c-#666">入库量:</span>
+                                            <span class="c-#333 f-w-500">{{ uidMapData[item]?.capacity }}{{
+                                                uidMapData[item]?.unit }}</span>
                                         </view>
-                                        <view class="f-s-28 pr-10 pd2-4-0">
-                                            <span class="c-#666">受托单位:</span>
-                                            <span class="c-#333 f-w-500">{{ uidMapData[item]?.entrustInfo?.cusName }}</span>
+                                        <view v-if="!['kg', 'L'].includes(uidMapData[item]?.unit)"
+                                            class="flex1 f-s-28 pr-10 pd2-4-0">
+                                            <span class="c-#666">规格:</span>
+                                            <span class="c-#333 f-w-500">{{ uidMapData[item]?.spec }} {{
+                                                uidMapData[item]?.specUnit }}/{{ uidMapData[item]?.unit }}</span>
                                         </view>
                                     </view>
                                     <view class="d-flex a-ed" @click="navigateToAddAgroProduct(item, 'edit')">
@@ -68,14 +69,17 @@
             <view class="pd-24 bg-#fff">
                 <!-- 入库类型 -->
                 <up-form-item borderBottom label="入库类型" required prop="instoreType">
-                    <view v-if="form.instoreType" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_seed_instore_type, form.instoreType) }}</view>
+                    <view v-if="form.instoreType" class="f-s-30 c-333 f-w-5 flex1">{{
+                        selectDictLabel(pt_seed_instore_type,
+                        form.instoreType) }}</view>
                     <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择入库类型</view>
                 </up-form-item>
                 <!-- 入库日期 -->
                 <view class="h-1" id="instoreDatepppp"></view>
                 <ut-datetime-picker v-model="form.instoreBizInfo.instoreDate" :maxDate="new Date()" mode="date">
                     <up-form-item borderBottom label="入库日期" required prop="instoreBizInfo.instoreDate">
-                        <up-input v-model="form.instoreBizInfo.instoreDate" readonly placeholder="请选择入库日期" border="none" clearable></up-input>
+                        <up-input v-model="form.instoreBizInfo.instoreDate" readonly placeholder="请选择入库日期" border="none"
+                            clearable></up-input>
                         <template #right>
                             <up-icon size="22rpx" color="#2A6D52" name="arrow-down-fill"></up-icon>
                         </template>
@@ -85,21 +89,24 @@
                 <up-form-item borderBottom label="入库批号" required prop="batchCode">
                     <up-input v-model="form.batchCode" placeholder="请输入入库批号" border="none" clearable></up-input>
                     <template #right>
-                        <up-button @click="generateBatchCode" type="primary" :customStyle="formItemBtnStyle">随机生成</up-button>
+                        <up-button @click="generateBatchCode" type="primary"
+                            :customStyle="formItemBtnStyle">随机生成</up-button>
                     </template>
                 </up-form-item>
                 <!-- 库房类型 -->
                 <up-form-item borderBottom label="库房类型" prop="storeType" required>
-                    <view v-if="form.storeType" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_warehouse_type, form.storeType) }}</view>
+                    <view v-if="form.storeType" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_warehouse_type,
+                        form.storeType) }}</view>
                     <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择库房类型</view>
                 </up-form-item>
-                <!-- 存放库房(具体库房/货架信息稍后补充为选择器) -->
-                <up-form-item borderBottom label="存放库房" prop="storeCode">
-                    <up-input v-model="form.storeCode" placeholder="请输入存放库房或编码" border="none" clearable></up-input>
+                     <!-- 存放库房(具体库房/货架信息稍后补充为选择器) -->
+                <up-form-item borderBottom label="存放库房" prop="warehouses">
+                    <select-warehouse-input v-model="form.warehouses" title="添加农资存放库房" :params="{ type: '1' }"></select-warehouse-input>
                 </up-form-item>
                 <!-- 入库人 -->
                 <up-form-item borderBottom label="入库人" required prop="instoreBizInfo.instoreMg">
-                    <up-input v-model="form.instoreBizInfo.instoreMg" placeholder="请输入入库人" border="none" clearable></up-input>
+                    <up-input v-model="form.instoreBizInfo.instoreMg" placeholder="请输入入库人" border="none"
+                        clearable></up-input>
                 </up-form-item>
                 <!-- 入库备注 -->
                 <up-form-item borderBottom label="入库备注" prop="instoreBizInfo.remark">
@@ -116,39 +123,43 @@
 </template>
 <script setup lang="ts">
 import { useClientRequest } from '@/utils/request';
-import { SeedSourceAddTypeEnum } from '../models/type';
+import { AgroProductInstoreAddTypeEnum } from '../models/type';
 import { formItemBtnStyle } from '@/assets/styles/uview-plus';
 import { generateUniqueId } from '@/utils/public';
 import { parseTime } from '@/utils/ruoyi';
 
 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 { pt_seed_instore_type, pt_warehouse_type, pt_material_type, pt_source_type } = toRefs<any>(
+    proxy?.useDict('pt_seed_instore_type', 'pt_warehouse_type', 'pt_material_type', 'pt_source_type'),
+);
 // 表单与分页等基础状态(参考 base-edit 风格)
 const paging = ref<any>(null);
 const upFormRef = ref<any>(null);
-const showArea = ref(false);
-const form = ref<SeedSourceAddTypeEnum>({
+// 农资入库汇总表单
+const form = ref<AgroProductInstoreAddTypeEnum>({
     instoreType: '2',
     storeType: '1',
-    seedInfoList: [],
+    agroProductInfoList: [],
     warehouses: [],
     instoreBizInfo: {
-       instoreDate: parseTime(new Date(), '{y}-{m}-{d}'),
-       instoreMg: '',
-       remark: '',
+        instoreDate: parseTime(new Date(), '{y}-{m}-{d}'),
+        instoreMg: '',
+        remark: '',
     },
 });
 const rules = reactive({
-    seedInfoList: [{ required: true, message: '请添加农资信息', type: 'array', min: 1 }],
+    agroProductInfoList: [{ required: true, message: '请添加农资信息', type: 'array', min: 1 }],
     instoreType: [{ required: true, message: '请选择入库类型' }],
     'instoreBizInfo.instoreDate': [{ required: true, message: '请选择入库日期' }],
     batchCode: [{ required: true, message: '请输入入库批号' }],
+    storeType: [{ required: true, message: '请选择库房类型' }],
     'instoreBizInfo.instoreMg': [{ required: true, message: '请输入入库人' }],
 });
 
 const submitForm = async () => {
     console.log(form.value);
-    
+
     uni.$u.debounce(
         async () => {
             try {
@@ -163,7 +174,7 @@ const submitForm = async () => {
             uni.showLoading({
                 title: '提交中...',
             });
-            const params = form.value.seedInfoList.map((uid) => {
+            const params = form.value.agroProductInfoList.map((uid) => {
                 return {
                     ...uidMapData.value[uid],
                     ...form.value,
@@ -174,7 +185,7 @@ const submitForm = async () => {
                 };
             })
             try {
-                const res = await useClientRequest.post('/plt-api/app/storageSeed/batchInstore', params);
+                const res = await useClientRequest.post('/plt-api/app/material/batchInstore', params);
                 uni.hideLoading();
                 if (!res || res !== 200) return;
                 uni.hideLoading();
@@ -215,23 +226,14 @@ const generateBatchCode = async () => {
         });
     }
 };
-const did = ref('');
-const getDetailById = async (id: string) => {
-    if (!id) return;
-    const res = await useClientRequest.get(`/plt-api/app/gapCertificationInfo/getInfoById/${id}`);
-    if (res && res.code === 200) {
-        form.value = {
-            ...res.data,
-        };
-    }
-};
+
 const uidMapData = ref({} as any);
 // 添加农资入库跳转
 const navigateToAddAgroProduct = (uid = '', mode = 'add') => {
     uni.$on('submitForm', (data: any) => {
         uidMapData.value[data.uid] = data.form;
         if (data?.mode == 'add') {
-            form.value.seedInfoList.push(data.uid);
+            form.value.agroProductInfoList.push(data.uid);
         }
         uni.$off('submitForm');
     });
@@ -247,17 +249,12 @@ const navigateToAddAgroProduct = (uid = '', mode = 'add') => {
     });
 };
 const deleteRow = (index: number, uid: string) => {
-    form.value.seedInfoList.splice(index, 1);
+    form.value.agroProductInfoList.splice(index, 1);
     delete uidMapData.value[uid];
 };
 // 编辑时加载详情
 onLoad((optins: any) => {
-    if (optins.id) {
-        // 编辑加载详
-        did.value = optins.id;
-        getDetailById(optins.id);
-    } else {
-    }
+
 });
 </script>
 <style lang="scss" scoped>
@@ -271,6 +268,7 @@ onLoad((optins: any) => {
     font-size: 20rpx;
     border-radius: 18rpx;
 }
+
 .close-icon {
     position: absolute;
     top: 0;

+ 63 - 165
src/plant/storage/agro-product/detail/index.vue

@@ -1,7 +1,7 @@
 <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>
+            <ut-navbar title="农资详情" :fixed="false" border></ut-navbar>
         </template>
 
         <template>
@@ -16,13 +16,18 @@
                 </view>
             </view>
             <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="d-flex j-ed a-c mb-16">
                     <view class="f-s-22 c-#666">{{ form?.updateTime || form?.createTime }}</view>
                 </view>
-                <view class="mb-10">
-                    <span class="f-s-34 c-#333 f-w-500 mr-10">{{ form?.variety }}</span>
-                    <span class="f-s-24 c-#666">{{ selectDictLabel(pt_seed_type, form?.seedType) }}</span>
+                <view class="d-flex flex1 mb-10">
+                    <view class="flex1">
+                        <span class="f-s-34 c-#333 f-w-500 mr-10">{{ form?.materialName }}</span>
+                        <span class="f-s-24 c-#666">{{ selectDictLabel(pt_material_type, form?.materialType) }}</span>
+                    </view>
+                    <view>
+                        <view v-if="form?.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>
@@ -32,10 +37,7 @@
                             <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>
-                </view>
+
                 <view class="pd2-4-0 f-s-28">
                     <span class="c-#666">供应商:</span>
                     <span class="c-#333 f-w-500">{{ form?.supplier }}</span>
@@ -50,179 +52,88 @@
                         <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-primary">剩余量:</span>
-                        <span class="c-primary f-w-500">{{ form?.restAmount || '0' }}{{ form?.unit }}</span>
+                        <span class="c-danger">剩余量:</span>
+                        <span class="c-danger f-w-500">{{ form?.restAmount || '0' }}{{ form?.unit }}</span>
                     </view>
                 </view>
             </view>
             <view class="pd-24">
-                <view class="startline-title">种源信息</view>
+                <view class="startline-title">农资信息</view>
             </view>
             <view class="bg-#fff pd-24">
-                <!-- 种源信息详情 -->
-                <view class="f-s-30 pd2-16-0 info-border-bottom">
-                    <span class="c-#666">种源类型:</span>
-                    <span class="c-#333 f-w-600">{{ selectDictLabel(pt_seed_type, form?.seedType) || '-' }}</span>
-                </view>
+                <!-- 农资信息详情,对应 info-edit 表单字段顺序 -->
                 <view class="f-s-30 pd2-16-0 info-border-bottom">
-                    <view class="c-#666 mb-10">物种基原:</view>
-                    <view class="bg-#FBFDFB card-info-block pd-24 p-rtv">
-                        <view class="mb-10">
-                            <span class="f-s-34 c-#333 f-w-5 mr-16">{{ form?.varietyInfo?.varietyName }}</span>
-                            <span class="f-s-24 c-#666">{{ form?.varietyInfo?.latinName }}</span>
-                        </view>
-                        <view>
-                            <span class="f-s-28 c-#333 f-w-5 mr-16">{{ form?.varietyInfo?.genusName }}</span>
-                            <span class="f-s-24 c-#666">{{ form?.varietyInfo?.genusLatinName }}</span>
-                        </view>
-                    </view>
+                    <span class="c-#666">产品名称:</span>
+                    <span class="c-#333 f-w-600">{{ form?.materialName || '-' }}</span>
                 </view>
                 <view class="f-s-30 pd2-16-0 info-border-bottom">
-                    <span class="c-#666">具体品种/品系名称:</span>
-                    <span class="c-#333 f-w-600">{{ form?.seedName || '-' }}</span>
+                    <span class="c-#666">农资类别:</span>
+                    <span class="c-#333 f-w-600">{{ selectDictLabel(pt_material_type, form?.materialType) || '-' }}</span>
                 </view>
                 <view class="f-s-30 pd2-16-0 info-border-bottom">
-                    <span class="c-#666">种源来源:</span>
-                    <span class="c-#333 f-w-600">{{ selectDictLabel(pt_seed_source, form?.seedSource) || '-' }}</span>
-                </view>
-                <view class="f-s-30 pd2-16-0 info-border-bottom" v-if="form?.instoreBizInfo?.motherFatherFlag">
-                    <span class="c-#666">父母本情况:</span>
-                    <span class="c-#333 f-w-600">{{ selectDictLabel(pt_mother_father_flag, form?.instoreBizInfo?.motherFatherFlag) || '-' }}</span>
-                </view>
-                <view v-if="form?.instoreBizInfo?.motherFatherFlag == '2' && form?.instoreBizInfo?.fatherVarietyInfo" class="f-s-30 pd2-16-0 info-border-bottom">
-                    <view class="c-#666 mb-10">父本品种:</view>
-                    <view class="bg-#FBFDFB card-info-block pd-24 p-rtv">
-                        <view class="mb-10">
-                            <span class="f-s-34 c-#333 f-w-5 mr-16">{{ form?.instoreBizInfo?.fatherVarietyInfo?.varietyName }}</span>
-                            <span class="f-s-24 c-#666">{{ form?.instoreBizInfo?.fatherVarietyInfo?.latinName }}</span>
-                        </view>
-                        <view>
-                            <span class="f-s-28 c-#333 f-w-5 mr-16">{{ form?.instoreBizInfo?.fatherVarietyInfo?.genusName }}</span>
-                            <span class="f-s-24 c-#666">{{ form?.instoreBizInfo?.fatherVarietyInfo?.genusLatinName }}</span>
-                        </view>
-                    </view>
-                </view>
-                <view v-if="form?.instoreBizInfo?.motherVarietyInfo" class="f-s-30 pd2-16-0 info-border-bottom">
-                    <view class="c-#666 mb-10">母本品种:</view>
-                    <view class="bg-#FBFDFB card-info-block pd-24 p-rtv">
-                        <view class="mb-10">
-                            <span class="f-s-34 c-#333 f-w-5 mr-16">{{ form?.instoreBizInfo?.motherVarietyInfo?.varietyName }}</span>
-                            <span class="f-s-24 c-#666">{{ form?.instoreBizInfo?.motherVarietyInfo?.latinName }}</span>
-                        </view>
-                        <view>
-                            <span class="f-s-28 c-#333 f-w-5 mr-16">{{ form?.instoreBizInfo?.motherVarietyInfo?.genusName }}</span>
-                            <span class="f-s-24 c-#666">{{ form?.instoreBizInfo?.motherVarietyInfo?.genusLatinName }}</span>
-                        </view>
-                    </view>
+                    <span class="c-#666">入库量:</span>
+                    <span class="c-#333 f-w-600">{{ form?.capacity }}{{ form?.unit }}</span>
                 </view>
-                <template v-if="['A3', 'A4'].includes(form?.seedType as string)">
-                    <view class="f-s-30 pd2-16-0 info-border-bottom">
-                        <span class="c-#666">{{ genCountMap[form?.seedType as 'A3' | 'A4'] }}:</span>
-                        <span class="c-#333 f-w-600">
-                            {{ form?.instoreBizInfo?.genCount || '-' }}
-                            <text v-if="form?.instoreBizInfo?.genUnit">{{ selectDictLabel(pt_gen_unit, form?.instoreBizInfo?.genUnit) }}</text>
-                        </span>
-                    </view>
-                </template>
-                <template v-else>
-                    <view class="f-s-30 pd2-16-0 info-border-bottom">
-                        <span class="c-#666">繁衍世代:</span>
-                        <span class="c-#333 f-w-600">
-                            {{ form?.instoreBizInfo?.genCount || '-' }}
-                            <text v-if="form?.instoreBizInfo?.genUnit">{{ selectDictLabel(pt_gen_unit, form?.instoreBizInfo?.genUnit) }}</text>
-                        </span>
-                    </view>
-                </template>
-                <view v-if="form?.entrustId" class="f-s-30 pd2-16-0 info-border-bottom">
-                    <view class="c-#666 mb-10">受托单位:</view>
-                    <view class="bg-#FBFDFB card-info-block pd-24 p-rtv">
-                        <view class="f-s-34 c-#333 f-w-500">{{ form?.entrustInfo?.cusName }}</view>
-                        <view class="f-s-24 c-#666">{{ form?.entrustInfo?.cusCode }}</view>
-                    </view>
+                <view class="f-s-30 pd2-16-0 info-border-bottom" v-if="form?.spec">
+                    <span class="c-#666">规格:</span>
+                    <span class="c-#333 f-w-600">
+                        {{ form?.spec }}
+                        <text v-if="form?.specUnit">{{ selectDictLabel(pt_materail_spec_unit, form?.specUnit) }}</text>
+                        <text v-if="form?.unit">/{{ selectDictLabel(pt_materail_unit, form?.unit) }}</text>
+                    </span>
                 </view>
-                <view v-if="form?.examinReport && form?.examinReport.length" class="f-s-30 pd2-16-0 info-border-bottom">
-                    <view class="c-#666 mb-10">检验报告:</view>
-                    <ut-album :urls="form?.examinReport"></ut-album>
+                <view class="f-s-30 pd2-16-0 info-border-bottom">
+                    <span class="c-#666">农资来源:</span>
+                    <span class="c-#333 f-w-600">{{ selectDictLabel(pt_source_type, form?.sourceType) || '-' }}</span>
                 </view>
-                <view v-if="['2', '3'].includes(form?.seedSource as string)" class="f-s-30 pd2-16-0 info-border-bottom">
-                    <view class="c-#666 mb-10">供应商:</view>
-                    <view class="bg-#FBFDFB card-info-block pd-24 p-rtv">
-                        <view class="f-s-34 c-#333 f-w-500">{{ form?.supplierInfo?.cusName }}</view>
-                        <view class="f-s-24 c-#666">{{ form?.supplierInfo?.cusCode }}</view>
-                    </view>
+                <view v-if="form?.supplier" class="f-s-30 pd2-16-0 info-border-bottom">
+                    <span class="c-#666">供应商:</span>
+                    <span class="c-#333 f-w-600">{{ form?.supplier || form?.supplierInfo?.cusName || '-' }}</span>
                 </view>
-                <view v-if="['2', '3'].includes(form?.seedSource as string)" class="f-s-30 pd2-16-0 info-border-bottom">
+                <view v-if="form?.sourceType === '1'" class="f-s-30 pd2-16-0 info-border-bottom">
                     <span class="c-#666">供应商是否是生产商:</span>
                     <span class="c-#333 f-w-600">{{ selectDictLabel(yes_no, form?.supplierProducerFlag) || '-' }}</span>
                 </view>
-                <view v-if="['2', '3'].includes(form?.seedSource as string)" class="f-s-30 pd2-16-0 info-border-bottom">
+                <view v-if="form?.sourceType === '1'" class="f-s-30 pd2-16-0 info-border-bottom">
                     <span class="c-#666">生产商:</span>
                     <span class="c-#333 f-w-600">{{ form?.producer || '-' }}</span>
                 </view>
-                <view v-if="['A4', 'A8'].includes(form?.seedType as string)" class="f-s-30 pd2-16-0 info-border-bottom">
-                    <span class="c-#666">{{ selectDictLabel(pt_seed_type, form?.seedType as string) }}编号:</span>
-                    <span class="c-#333 f-w-600">{{ selectDictLabel(pt_fungus_code_type, form?.fungusCodeType) }}/{{ form?.fungusCode }}</span>
+                <view v-if="form?.productCode" class="f-s-30 pd2-16-0 info-border-bottom">
+                    <span class="c-#666">生产批号:</span>
+                    <span class="c-#333 f-w-600">{{ form?.productCode }}</span>
                 </view>
-                <view class="f-s-30 pd2-16-0 info-border-bottom" v-if="form?.instoreBizInfo?.idFlag">
-                    <span class="c-#666">是否有个体标识:</span>
-                    <span class="c-#333 f-w-600">{{ selectDictLabel(yes_no, form?.instoreBizInfo?.idFlag) || '-' }}</span>
+                <view v-if="form?.productDate" class="f-s-30 pd2-16-0 info-border-bottom">
+                    <span class="c-#666">生产日期:</span>
+                    <span class="c-#333 f-w-600">{{ form?.productDate }}</span>
                 </view>
-                <view v-if="form?.instoreBizInfo?.animals && form?.instoreBizInfo?.animals.length" class="f-s-30 pd2-16-0 info-border-bottom">
-                    <view class="c-#666 mb-10">个体标识号:</view>
-                    <template v-for="(animal, index) in form?.instoreBizInfo?.animals" :key="index">
-                        <view class="bg-#FBFDFB card-info-block pd-24 p-rtv mb-10 f-s-28 c-#333 f-w-500">
-                            {{ animal.animalId }}
-                        </view>
-                    </template>
+                <view v-if="form?.brand" class="f-s-30 pd2-16-0 info-border-bottom">
+                    <span class="c-#666">品牌:</span>
+                    <span class="c-#333 f-w-600">{{ form?.brand }}</span>
                 </view>
-                <view v-if="form?.instoreBizInfo?.storageMethod" class="f-s-30 pd2-16-0 info-border-bottom">
-                    <span class="c-#666">保藏方法:</span>
-                    <span class="c-#333 f-w-600">{{ form?.instoreBizInfo?.storageMethod || '-' }}</span>
+                <view v-if="['1', '2'].includes(form?.materialType as string)" class="f-s-30 pd2-16-0 info-border-bottom">
+                    <span class="c-#666">登记证号:</span>
+                    <span class="c-#333 f-w-600">{{ form?.materialCode || '-' }}</span>
                 </view>
                 <view v-if="form?.imgs" class="f-s-30 pd2-16-0 info-border-bottom">
-                    <view class="c-#666 mb-10">种源图片:</view>
+                    <view class="c-#666 mb-10">农资图片:</view>
                     <ut-album :urls="form?.imgs"></ut-album>
                 </view>
                 <view v-if="form?.vedios" class="f-s-30 pd2-16-0 info-border-bottom">
-                    <view class="c-#666 mb-10">种源视频:</view>
+                    <view class="c-#666 mb-10">农资视频:</view>
                     <ut-album :urls="form?.vedios"></ut-album>
                 </view>
-                <view class="f-s-30 pd2-16-0 info-border-bottom">
-                    <span class="c-#666">种源产地:</span>
-                    <span class="c-#333 f-w-600">{{ form?.adcodeName || '-' }}</span>
-                </view>
-                <view class="f-s-30 pd2-16-0 info-border-bottom">
-                    <span class="c-#666">繁殖材料:</span>
-                    <span class="c-#333 f-w-600">{{ form?.generationMaterial ? selectDictLabels(pt_breeding_materials, form?.generationMaterial, ',') : '-' }}</span>
-                </view>
-                <view class="f-s-30 pd2-16-0 info-border-bottom">
-                    <span class="c-#666">繁殖地点/采集地点:</span>
-                    <span class="c-#333 f-w-600">{{ form?.generationAdcodeName || '-' }}</span>
-                </view>
-                <view v-if="form?.spCert && form?.spCert.length" class="f-s-30 pd2-16-0 info-border-bottom">
-                    <view class="c-#666 mb-10">物种鉴定证书:</view>
-                    <ut-album :urls="form?.spCert"></ut-album>
-                </view>
-                <view class="f-s-30 pd2-16-0 info-border-bottom">
-                    <span class="c-#666">种源检疫证号:</span>
-                    <span class="c-#333 f-w-600">{{ form?.seedCheckSn || '-' }}</span>
-                </view>
-                <view v-if="form?.seedCheckCert && form?.seedCheckCert.length" class="f-s-30 pd2-16-0 info-border-bottom">
-                    <view class="c-#666 mb-10">种源检疫证书:</view>
-                    <ut-album :urls="form?.seedCheckCert"></ut-album>
+                <view v-if="form?.examinReport && form?.examinReport.length" class="f-s-30 pd2-16-0 info-border-bottom">
+                    <view class="c-#666 mb-10">检验报告:</view>
+                    <ut-album :urls="form?.examinReport"></ut-album>
                 </view>
             </view>
             <view class="pd-24">
                 <view class="startline-title">入库信息</view>
             </view>
             <view class="bg-#fff pd-24">
-                <view class="f-s-30 pd2-16-0 info-border-bottom">
-                    <span class="c-#666">种源级别:</span>
-                    <span class="c-#333 f-w-600">{{ form?.seedLevel || '-' }}</span>
-                </view>
                 <view class="f-s-30 pd2-16-0 info-border-bottom">
                     <span class="c-#666">入库类型:</span>
-                    <span class="c-#333 f-w-600">{{ selectDictLabel(pt_seed_instore_type, form?.instoreType) || '-' }}</span>
+                    <span class="c-#333 f-w-600">{{ selectDictLabel(pt_seed_instore_type, form?.instoreType) || '非溯源入库' }}</span>
                 </view>
                 <view class="f-s-30 pd2-16-0 info-border-bottom">
                     <span class="c-#666">入库日期:</span>
@@ -234,7 +145,7 @@
                 </view>
                 <view class="f-s-30 pd2-16-0 info-border-bottom">
                     <span class="c-#666">库房类型:</span>
-                    <span class="c-#333 f-w-600">种源库</span>
+                    <span class="c-#333 f-w-600">农资库</span>
                 </view>
                 <view class="f-s-30 pd2-16-0 info-border-bottom">
                     <span class="c-#666">存放库房:</span>
@@ -269,24 +180,17 @@
 <script setup lang="ts">
 import { formItemBtnStyle } from '@/assets/styles/uview-plus';
 import { useClientRequest } from '@/utils/request';
-import { selectDictListClass } from '@/utils/ruoyi';
 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 { pt_seed_instore_type, pt_warehouse_type, pt_material_type, pt_source_type, pt_materail_unit, pt_materail_spec_unit, yes_no } = toRefs<any>(proxy?.useDict('pt_seed_instore_type', 'pt_warehouse_type', 'pt_material_type', 'pt_source_type', 'pt_materail_unit', 'pt_materail_spec_unit', 'yes_no'));
 const paging = ref<any>(null);
 const form = ref<any>({});
 const did = ref('');
 
-// 繁衍世代显示文案
-const genCountMap = reactive({
-    A4: '累计扩繁代数',
-    A3: '继代培养次数',
-});
-
 // 获取详情(仓库信息)
 const getDetailById = async (id: string) => {
     if (!id) return;
-    const res = await useClientRequest.get(`/plt-api/app/storageSeed/getById/${id}`);
+    const res = await useClientRequest.get(`/plt-api/app/material/getInfo/${id}`);
     if (res && res.code === 200) {
         form.value = res.data || {};
     }
@@ -303,7 +207,7 @@ const clickEdit = () => {
     });
     uni.$u.route({
         type: 'navigateTo',
-        url: '/plant/storage/seed-source/info-update/index',
+        url: '/plant/storage/agro-product/info-update/index',
         params: {
             id: did.value,
         },
@@ -321,15 +225,9 @@ onLoad((options: any) => {
     border: 1rpx solid #afddbb;
     border-radius: 10rpx;
 }
-.li-item-head {
-    margin-left: -24rpx;
-    margin-top: -24rpx;
-}
-.li-left-tag {
-    padding: 6rpx 16rpx;
-    color: #fff;
-    border-radius: 0 0 16rpx 0;
+.tag-span {
+    padding: 4rpx 12rpx;
     font-size: 20rpx;
-    font-weight: 500;
+    border-radius: 18rpx;
 }
 </style>

+ 108 - 114
src/plant/storage/agro-product/info-edit/index.vue

@@ -1,7 +1,9 @@
 <template>
-    <z-paging class="" ref="paging" bgColor="#fff" paging-class="paging-btm-shadow" safe-area-inset-bottom scroll-with-animation>
+    <z-paging class="" ref="paging" bgColor="#fff" paging-class="paging-btm-shadow" safe-area-inset-bottom
+        scroll-with-animation>
         <template #top>
-            <ut-navbar :title="optionsParam?.mode == 'edit' ? '编辑农资入库信息' : '添加农资入库信息'" :fixed="false" border></ut-navbar>
+            <ut-navbar :title="optionsParam?.mode == 'edit' ? '编辑农资入库信息' : '添加农资入库信息'" :fixed="false"
+                border></ut-navbar>
         </template>
         <view class="pd-24">
             <up-form class="p-rtv" labelPosition="top" :model="form" :rules="rules" labelWidth="auto" ref="upFormRef">
@@ -13,7 +15,9 @@
                 <view class="h-1" id="materialTypepppp"></view>
                 <ut-action-sheet :tabs="pt_material_type" mode="custom" title="农资类别" v-model="form.materialType">
                     <up-form-item borderBottom label="农资类别" required prop="materialType">
-                        <view v-if="form.materialType" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_material_type, form.materialType) }}</view>
+                        <view v-if="form.materialType" class="f-s-30 c-333 f-w-5 flex1">{{
+                            selectDictLabel(pt_material_type,
+                            form.materialType) }}</view>
                         <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择农资类别</view>
                         <template #right>
                             <up-icon size="22rpx" color="#2A6D52" name="arrow-down-fill"></up-icon>
@@ -28,7 +32,8 @@
                     <div class="flex1 d-flex">
                         <div class="flex1 ov-hd">
                             <up-form-item prop="capacity" border-bottom class="form-item-top-padding-0">
-                                <up-input v-model="form.capacity" placeholder="请输入入库量" border="none" clearable></up-input>
+                                <up-input v-model="form.capacity" placeholder="请输入入库量" border="none"
+                                    clearable></up-input>
                             </up-form-item>
                         </div>
                         <div class="pd-5"></div>
@@ -36,7 +41,8 @@
                             <ut-action-sheet v-model="form.unit" :tabs="pt_materail_unit" mode="custom" title="选择单位">
                                 <up-form-item prop="unit" border-bottom class="form-item-top-padding-0">
                                     <view class="flex1" style="line-height: 24px">
-                                        <view v-if="form.unit" class="f-s-30 c-333 f-w-5 text-center">{{ selectDictLabel(pt_materail_unit, form.unit) }}</view>
+                                        <view v-if="form.unit" class="f-s-30 c-333 f-w-5 text-center">{{
+                                            selectDictLabel(pt_materail_unit, form.unit) }}</view>
                                         <view v-else class="f-s-30 c-ccc f-w-4 text-center">单位</view>
                                     </view>
                                     <template #right>
@@ -47,35 +53,57 @@
                         </div>
                     </div>
                 </up-form-item>
-                <view class="h-1" id="capacitypppp"></view>
-                <up-form-item label="入库量" prop="capacity" required class="form-item-bottom-padding-0">
-                    <div class="flex1 d-flex">
-                        <div class="flex1 ov-hd">
-                            <up-form-item prop="capacity" border-bottom class="form-item-top-padding-0">
-                                <up-input v-model="form.capacity" placeholder="请输入入库量" border="none" clearable></up-input>
-                            </up-form-item>
-                        </div>
-                        <div class="pd-5"></div>
-                        <div class="min-w-200">
-                            <ut-action-sheet v-model="form.unit" :tabs="pt_materail_unit" mode="custom" title="选择单位">
+                <view class="h-1" id="specpppp"></view>
+                <view class="h-1" id="specUnitpppp"></view>
+                <template v-if="!['kg', 'L'].includes(form?.unit as string)">
+                    <up-form-item label="规格" prop="spec" required class="form-item-bottom-padding-0">
+                        <div class="flex1 d-flex">
+                            <div class="flex1 ov-hd">
+                                <up-form-item prop="spec" border-bottom class="form-item-top-padding-0">
+                                    <up-input v-model="form.spec" placeholder="请输入规格" border="none"
+                                        clearable></up-input>
+                                </up-form-item>
+                            </div>
+                            <div class="pd-5"></div>
+                            <div class="min-w-200">
+                                <ut-action-sheet v-model="form.specUnit" :tabs="pt_materail_spec_unit" mode="custom"
+                                    title="选择单位">
+                                    <up-form-item prop="specUnit" border-bottom class="form-item-top-padding-0">
+                                        <view class="flex1" style="line-height: 24px">
+                                            <view v-if="form.specUnit" class="f-s-30 c-333 f-w-5 text-center">{{
+                                                selectDictLabel(pt_materail_spec_unit, form.specUnit) }}</view>
+                                            <view v-else class="f-s-30 c-ccc f-w-4 text-center">单位</view>
+                                        </view>
+                                        <template #right>
+                                            <up-icon class="mr-10" size="22rpx" color="#2A6D52"
+                                                name="arrow-down-fill"></up-icon>
+                                        </template>
+                                    </up-form-item>
+                                </ut-action-sheet>
+                            </div>
+                            <div class="pd2-0-10 c-#ccc">/</div>
+                            <div class="min-w-200">
                                 <up-form-item prop="unit" border-bottom class="form-item-top-padding-0">
                                     <view class="flex1" style="line-height: 24px">
-                                        <view v-if="form.unit" class="f-s-30 c-333 f-w-5 text-center">{{ selectDictLabel(pt_materail_unit, form.unit) }}</view>
+                                        <view v-if="form.unit" class="f-s-30 c-333 f-w-5 text-center">{{
+                                            selectDictLabel(pt_materail_unit,
+                                            form.unit) }}</view>
                                         <view v-else class="f-s-30 c-ccc f-w-4 text-center">单位</view>
                                     </view>
                                     <template #right>
-                                        <up-icon size="22rpx" color="#2A6D52" name="arrow-down-fill"></up-icon>
+                                        <up-icon size="22rpx" color="#fff" name="arrow-down-fill"></up-icon>
                                     </template>
                                 </up-form-item>
-                            </ut-action-sheet>
+                            </div>
                         </div>
-                    </div>
-                </up-form-item>
+                    </up-form-item>
+                </template>
 
                 <view class="h-1" id="sourceTypepppp"></view>
                 <ut-action-sheet :tabs="pt_source_type" mode="custom" title="农资来源" v-model="form.sourceType">
                     <up-form-item borderBottom label="农资来源" required prop="sourceType">
-                        <view v-if="form.sourceType" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_source_type, form.sourceType) }}</view>
+                        <view v-if="form.sourceType" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_source_type,
+                            form.sourceType) }}</view>
                         <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择农资来源</view>
                         <template #right>
                             <up-icon size="22rpx" color="#2A6D52" name="arrow-down-fill"></up-icon>
@@ -85,12 +113,14 @@
                 <template v-if="['1'].includes(form.sourceType as string)">
                     <up-form-item borderBottom label="供应商" prop="supplierId" required>
                         <view class="flex1">
-                            <ContactUnitInput v-model="form.supplierId" v-model:info="form.supplierInfo" :params="{ cpyType: '4' }" title="选择供应商" placeholder="请选择供应商信息"></ContactUnitInput>
+                            <ContactUnitInput v-model="form.supplierId" v-model:info="form.supplierInfo"
+                                :params="{ cpyType: '4' }" title="选择供应商" placeholder="请选择供应商信息"></ContactUnitInput>
                         </view>
                     </up-form-item>
                     <up-form-item borderBottom label="供应商是否是生产商" prop="supplierProducerFlag">
                         <up-radio-group v-model="form.supplierProducerFlag">
-                            <up-radio :customStyle="{ marginRight: '60rpx' }" v-for="(item, index) in yes_no" :key="index" :label="item.label" :name="item.value"></up-radio>
+                            <up-radio :customStyle="{ marginRight: '60rpx' }" v-for="(item, index) in yes_no"
+                                :key="index" :label="item.label" :name="item.value"></up-radio>
                         </up-radio-group>
                     </up-form-item>
                     <up-form-item borderBottom label="生产商" prop="producer">
@@ -102,7 +132,8 @@
                 </up-form-item>
                 <ut-datetime-picker v-model="form.productDate" :maxDate="new Date()" mode="date">
                     <up-form-item borderBottom label="生产日期" prop="productDate">
-                        <up-input v-model="form.productDate" readonly placeholder="请选择生产日期" border="none" clearable></up-input>
+                        <up-input v-model="form.productDate" readonly placeholder="请选择生产日期" border="none"
+                            clearable></up-input>
                         <template #right>
                             <up-icon size="22rpx" color="#2A6D52" name="arrow-down-fill"></up-icon>
                         </template>
@@ -126,7 +157,8 @@
                 </up-form-item>
                 <!-- 检验报告 -->
                 <up-form-item borderBottom label="检验报告" prop="examinReport">
-                    <ut-upload v-model="form.examinReport" :max-count="50" valueType="array" accept="image,file"></ut-upload>
+                    <ut-upload v-model="form.examinReport" :max-count="50" valueType="array"
+                        accept="image,file"></ut-upload>
                 </up-form-item>
             </up-form>
         </view>
@@ -138,75 +170,75 @@
     </z-paging>
 </template>
 <script setup lang="ts">
-import { useClientRequest } from '@/utils/request';
-import { seedInfoListType } from '../models/type';
-import AnimalsInput from '../models/animals-input.vue';
+import { AgroProductInstoreType } from '../models/type';
 import ContactUnitInput from '@/models/contact-unit-input/contact-unit-input.vue';
-import PickerAreaInput from '@/models/picker-area-input/picker-area-input.vue';
 
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
-const { pt_material_type, pt_source_type, pt_materail_unit, pt_mother_father_flag, pt_fungus_code_type, pt_breeding_materials, yes_no, pt_cus_type, pt_cpy_type, pt_gen_unit } = toRefs<any>(proxy?.useDict('pt_material_type', 'pt_source_type', 'pt_mother_father_flag', 'pt_op_method', 'pt_materail_unit', 'pt_fungus_code_type', 'pt_breeding_materials', 'yes_no', 'pt_cus_type', 'pt_cpy_type', 'pt_gen_unit'));
+const { pt_material_type, pt_source_type, pt_materail_unit, pt_materail_spec_unit, yes_no } = toRefs<any>(
+    proxy?.useDict('pt_material_type', 'pt_source_type', 'pt_materail_unit', 'pt_materail_spec_unit', 'yes_no'),
+);
 const paging = ref<any>(null);
-const selectContactUnitShow = ref(false);
 const upFormRef = ref<any>(null);
-const form = ref<seedInfoListType>({
+// 农资入库单明细表单
+const form = ref<AgroProductInstoreType>({
+    materialName: '',
+    materialType: '',
+    capacity: '',
+    unit: '',
+    spec: '',
+    specUnit: '',
+    sourceType: '',
+    supplierId: undefined,
+    supplierInfo: undefined,
+    supplierProducerFlag: '',
+    producer: '',
+    productCode: '',
+    productDate: '',
+    brand: '',
+    materialCode: '',
     imgs: undefined,
     vedios: undefined,
-    spCert: [],
-    newSpCert: [],
-    importCert: [],
-    seedCheckCert: [],
-    unit: '',
-    adcode: '',
-    instoreBizInfo: {
-        motherFatherFlag: '',
-        idFlag: '1',
-        genUnit: '',
-    },
-    generationMaterial: '',
+    examinReport: [],
 });
+// 表单校验规则:以 template 中 required 与业务条件为准
 const rules = reactive({
-    seedType: [{ required: true, message: '请选择农资类型' }],
-    varietyId: [{ required: true, message: '请选择物种基原' }],
-    seedSource: [{ required: true, message: '请选择农资来源' }],
-    'instoreBizInfo.motherFatherFlag': [{ required: true, message: '请选择父母本情况' }],
-    'instoreBizInfo.genCount': [
+    materialName: [{ required: true, message: '请输入产品名称' }],
+    materialType: [{ required: true, message: '请选择农资类别' }],
+    capacity: [{ required: true, message: '请输入入库量' }],
+    unit: [{ required: true, message: '请选择单位' }],
+    sourceType: [{ required: true, message: '请选择农资来源' }],
+    // 规格与规格单位仅在单位为 kg/L 时必填
+    spec: [
         {
             asyncValidator: (rule: any, value: any) => {
-                if (['A3', 'A4'].includes(form.value.seedType as string)) {
-                    if (!value) {
-                        return Promise.reject('请输入' + genCountMap[form.value.seedType as 'A3' | 'A4']);
-                    }
+                if (!['kg', 'L'].includes(form.value.unit as string) && !value) {
+                    return Promise.reject('请输入规格');
                 }
                 return Promise.resolve();
             },
         },
     ],
-    'instoreBizInfo.genUnit': [
+    specUnit: [
         {
             asyncValidator: (rule: any, value: any) => {
-                if (['A3', 'A4'].includes(form.value.seedType as string)) {
-                    if (!value) {
-                        return Promise.reject('请选择单位');
-                    }
+                if (!['kg', 'L'].includes(form.value.unit as string) && !value) {
+                    return Promise.reject('请选择规格单位');
+                }
+                return Promise.resolve();
+            },
+        },
+    ],
+    // 供应商仅在来源为“采购”等特定来源时必选(目前为来源=1)
+    supplierId: [
+        {
+            asyncValidator: (rule: any, value: any) => {
+                if (['1'].includes(form.value.sourceType as string) && !value) {
+                    return Promise.reject('请选择供应商');
                 }
                 return Promise.resolve();
             },
         },
     ],
-    entrustId: [{ required: true, message: '请选择受托单位' }],
-    capacity: [{ required: true, message: '请输入入库量' }],
-    unit: [{ required: true, message: '请选择单位' }],
-    supplierId: [{ required: true, message: '请选择供应商' }],
-    fungusCodeType: [{ required: true, message: '请选择编号类型' }],
-    fungusCode: [{ required: true, message: '请输入编号' }],
-    'instoreBizInfo.idFlag': [{ required: true, message: '请选择是否有个体标识' }],
-    'instoreBizInfo.animals': [{ type: 'array', required: true, message: '请输入个体标识号' }],
-});
-// 繁衍世代对象
-const genCountMap = reactive({
-    A4: '累计扩繁代数',
-    A3: '继代培养次数',
 });
 const submitForm = async () => {
     console.log(form.value);
@@ -237,46 +269,6 @@ const submitForm = async () => {
         true,
     );
 };
-// 去选择物种基原
-const selectVarietyId = () => {
-    uni.$once('updateBiologicalname', function (data) {
-        form.value.varietyId = data.msg.id;
-        form.value.varietyInfo = data.msg;
-    });
-    uni.$u.route({
-        type: 'navigateTo',
-        url: '/tools/por-torganism/index',
-        params: {
-            title: '选择物种基原',
-        },
-    });
-};
-const selectFatherVarietyId = () => {
-    uni.$once('updateBiologicalname', function (data) {
-        form.value.instoreBizInfo.fatherVarietyId = data.msg.id;
-        form.value.instoreBizInfo.fatherVarietyInfo = data.msg;
-    });
-    uni.$u.route({
-        type: 'navigateTo',
-        url: '/tools/por-torganism/index',
-        params: {
-            title: '选择父本品种',
-        },
-    });
-};
-const selectMotherVarietyId = () => {
-    uni.$once('updateBiologicalname', function (data) {
-        form.value.instoreBizInfo.motherVarietyId = data.msg.id;
-        form.value.instoreBizInfo.motherVarietyInfo = data.msg;
-    });
-    uni.$u.route({
-        type: 'navigateTo',
-        url: '/tools/por-torganism/index',
-        params: {
-            title: '选择母本品种',
-        },
-    });
-};
 const optionsParam = ref({} as any);
 onLoad((options: any) => {
     const instance: any = getCurrentInstance()?.proxy;
@@ -305,13 +297,15 @@ onLoad((options: any) => {
     top: 0rpx;
     right: 0rpx;
 }
+
 :deep(.form-item-top-padding-0) {
-    > .u-form-item__body {
+    >.u-form-item__body {
         padding-top: 0rpx;
     }
 }
+
 :deep(.form-item-bottom-padding-0) {
-    > .u-form-item__body {
+    >.u-form-item__body {
         padding-bottom: 0rpx;
     }
 }

+ 5 - 5
src/plant/storage/agro-product/info-update/index.vue

@@ -374,9 +374,8 @@
                     <view v-if="form.storeType" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_warehouse_type, form.storeType) }}</view>
                     <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择库房类型</view>
                 </up-form-item>
-                <!-- 存放库房(具体库房/货架信息稍后补充为选择器) -->
-                <up-form-item borderBottom label="存放库房" prop="storeCode">
-                    <up-input v-model="form.storeCode" placeholder="请输入存放库房或编码" border="none" clearable></up-input>
+                <up-form-item borderBottom label="存放库房" prop="warehouses">
+                    <select-warehouse-input v-model="form.warehouses" title="添加农资存放库房" :params="{ type: '1' }"></select-warehouse-input>
                 </up-form-item>
                 <!-- 入库人 -->
                 <up-form-item borderBottom label="入库人" required prop="instoreBizInfo.instoreMg">
@@ -398,10 +397,11 @@
 <script setup lang="ts">
 import { useClientRequest } from '@/utils/request';
 import { formItemBtnStyle } from '@/assets/styles/uview-plus';
-import { seedInfoListType } from '../models/type';
+import { AgroProductInstoreAddTypeEnum } from '../models/type';
 import AnimalsInput from '../models/animals-input.vue';
 import ContactUnitInput from '@/models/contact-unit-input/contact-unit-input.vue';
 import PickerAreaInput from '@/models/picker-area-input/picker-area-input.vue';
+import SelectWarehouseInput from '@/models/select-warehouse-input/select-warehouse-input.vue';
 
 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>(
@@ -410,7 +410,7 @@ const { pt_seed_instore_type, pt_warehouse_type, pt_seed_type, pt_seed_source, p
 const paging = ref<any>(null);
 const upFormRef = ref<any>(null);
 // 单条种源信息 + 入库信息的合并表单
-const form = ref<seedInfoListType | any>({
+const form = ref<AgroProductInstoreAddTypeEnum | any>({
     imgs: undefined,
     vedios: undefined,
     spCert: [],

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

@@ -15,15 +15,14 @@
         <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/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="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="d-flex j-ed a-c mb-16">
                             <view class="f-s-22 c-#666">{{ item?.updateTime || item?.createTime }}</view>
                         </view>
                         <view class="d-flex flex1 mb-10">
                             <view class="flex1">
-                                <span class="f-s-34 c-#333 f-w-500 mr-10">{{ item?.variety }}</span>
-                                <span class="f-s-24 c-#666">{{ selectDictLabel(pt_seed_type, item?.seedType) }}</span>
+                                <span class="f-s-34 c-#333 f-w-500 mr-10">{{ item?.materialName }}</span>
+                                <span class="f-s-24 c-#666">{{ selectDictLabel(pt_material_type, item?.materialType) }}</span>
                             </view>
                             <view>
                                 <view v-if="item?.examinReport?.length" class="tag-span c-primary bg-#EBF6EE">已检验</view>
@@ -38,10 +37,7 @@
                             <span class="c-#666">溯源批号:</span>
                             <span class="c-#333 f-w-500">暂无</span>
                         </view> -->
-                        <view v-if="['A3', 'A4'].includes(item?.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, item?.fungusCodeType) }}/{{ item?.fungusCode }}</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>
@@ -78,9 +74,8 @@
 <script setup lang="ts">
 import { useClientRequest } from '@/utils/request';
 import AgroBottom from './model/agro-bottom.vue';
-import { selectDictListClass } from '@/utils/ruoyi';
 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 { pt_material_type } = toRefs<any>(proxy?.useDict('pt_material_type'));
 const list = ref<any[]>();
 const form = ref({ keyword: '', restFlag: '1', instoreType: '' });
 const paging = ref();
@@ -128,7 +123,7 @@ const clickTempSwipe = async (event: object) => {
                 title: '删除中...',
                 mask: true,
             });
-            await useClientRequest.get(`/plt-api/app/storageSeed/removeById/${name}`);
+            await useClientRequest.get(`/plt-api/app/material/removeById/${name}`);
             uni.hideLoading();
             uni.showToast({
                 title: '删除成功',
@@ -164,15 +159,5 @@ onMounted(() => {
     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: 16rpx 0 16rpx 0;
-    font-size: 20rpx;
-    font-weight: 500;
-}
+
 </style>

+ 2 - 2
src/plant/storage/agro-product/list/model/agro-bottom.vue

@@ -12,7 +12,7 @@
         </view>
         <view class="bg-#fff" :style="{ height: safeAreaBottom + 'px' }"></view>
         <view class="bottom-circle-line" :class="{ 'bottom-circle-line-active': btnStyle == 'close' }" :style="{ bottom: safeAreaBottom + 'px' }">
-            <view class="bottom-circle d-flex" :style="{ backgroundImage: 'url(https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/plant/storage/send_btm_bg_c.png)' }">
+            <view class="bottom-circle d-flex" :style="{ backgroundImage: 'url(/static/images/plant/storage/agro_btm_bg.png)' }">
                 <view class="flex1 d-flex flex-cln a-c pt-100 pl-30">
                     <view>
                         <image class="w-68 h-68" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/plant/storage/xzhwk_icon_sd.png" mode="widthFix" />
@@ -25,7 +25,7 @@
                 </view>
                 <view class="flex1 d-flex flex-cln a-c pt-100 pr-30" @click="clickBtnBall();$u.route({ url: '/plant/storage/agro-product/add/index' })">
                      <view>
-                        <image class="w-68 h-68" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/plant/storage/xzfsyrk_icon_sd.png" mode="widthFix" />
+                        <image class="w-68 h-68" src="@/static/images/plant/storage/xznzrkxx_icon_sd.png" mode="widthFix" />
                     </view>
                     <view class="f-s-28 c-#333">新增农资入库</view>
                     <view class="f-s-22 c-#999">适合无法溯源的农资</view>

+ 38 - 43
src/plant/storage/agro-product/models/type.ts

@@ -1,10 +1,10 @@
 /**
- * 入库信息类
+ * 农资入库信息类(新增/编辑农资入库用)
  */
-export interface SeedSourceAddTypeEnum {
+export interface AgroProductInstoreAddTypeEnum {
     // 种信息数组
-    seedInfoList: string[];
-    /** 种源级别 */
+    agroProductInfoList: string[];
+    /** 级别(预留字段,可选) */
     seedLevel?: string;
     /** 入库类型 */
     instoreType: string;
@@ -22,55 +22,49 @@ export interface SeedSourceAddTypeEnum {
     instoreBizInfo: instoreBizInfoType1;
      [property: string]: any;
 }
-// 种源信息返回体
-export interface seedInfoListType {
-    /** 种源类型 */
-    seedType?: string;
-    /** 物种基原 */
-    varietyId?: string;
-    /** 具体品种/品系名称 */
-    seedName?: string;
-    /** 种源来源 */
-    seedSource?: string;
-    /** 受托单位 */
-    entrustId?: string;
+// 入库单明细信息(用于农资入库信息编辑等场景)
+export interface AgroProductInstoreType {
+    /** 产品名称 */
+    materialName?: string;
+    /** 农资类别 */
+    materialType?: string;
     /** 入库量 */
-    capacity?: number;
+    capacity?: number | string;
     /** 计量单位 */
     unit?: string;
-    /** 检验报告 */
-    examinReport?: AccesseryDTO;
-    /** 供应商 */
+    /** 规格 */
+    spec?: string;
+    /** 规格单位(如袋/瓶等) */
+    specUnit?: string;
+    /** 农资来源 */
+    sourceType?: string;
+    /** 供应商 ID */
     supplierId?: string;
     /** 供应商名称 */
     supplier?: string;
+    /** 供应商详情 */
+    supplierInfo?: any;
+    /** 供应商是否是生产商 */
+    supplierProducerFlag?: string | number;
     /** 生产商名称 */
     producer?: string;
-    /** 菌种/菌株编号 */
-    fungusCode?: string;
-    /** 菌种编码类型 */
-    fungusCodeType?: string;
-    /** 是否有个体标识 */
-    animalIds?: string[];
-    /** 种源图片 */
-    imgs?: string;
-    /** 种源视频 */
-    vedios?: string;
-    /** 种源产地 */
-    adcode?: string;
-    /** 繁殖材料 */
-    generationMaterial?: string;
-    /** 繁殖地点/采集地点 */
-    generationAdcode?: string;
-    /** 物种鉴定证书 */
-    spCert?: AccesseryDTO[];
-    /** 种源检疫证号 */
-    seedCheckSn?: string;
-     /** 种源检疫证书 */
-    seedCheckCert?: AccesseryDTO[];
+    /** 生产批号 */
+    productCode?: string;
+    /** 生产日期 */
+    productDate?: string;
+    /** 品牌 */
+    brand?: string;
+    /** 登记证号(肥料/农药) */
+    materialCode?: string;
+    /** 农资图片 */
+    imgs?: string | string[];
+    /** 农资视频 */
+    vedios?: string | string[];
+    /** 检验报告附件 */
+    examinReport?: AccesseryDTO[] | any[];
+    /** 通用唯一标识 */
     uid?: string;
     [property: string]: any;
-    instoreBizInfo: instoreBizInfoType;
 }
 export interface AccesseryDTO {
     /**
@@ -93,6 +87,7 @@ export interface warehousesType {
     warehouseId?: string;
     /** 货架id */
     shelfId?: string;
+    [property: string]: any;
 }
 /**
  * 入库业务传输对象

+ 14 - 30
src/plant/storage/seed-source/add/index.vue

@@ -1,7 +1,7 @@
 <template>
     <z-paging class="" ref="paging" bgColor="#f7f7f7" paging-class="paging-btm-shadow" safe-area-inset-bottom scroll-with-animation>
         <template #top>
-            <ut-navbar :title="did ? '编辑种源入库' : '新增种源入库'" :fixed="false" border></ut-navbar>
+            <ut-navbar :title="'新增种源入库'" :fixed="false" border></ut-navbar>
         </template>
         <up-form class="p-rtv" labelPosition="top" :model="form" :rules="rules" labelWidth="auto" ref="upFormRef">
             <!-- 种源信息 -->
@@ -97,9 +97,8 @@
                     <view v-if="form.storeType" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_warehouse_type, form.storeType) }}</view>
                     <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择库房类型</view>
                 </up-form-item>
-                <!-- 存放库房(具体库房/货架信息稍后补充为选择器) -->
-                <up-form-item borderBottom label="存放库房" prop="storeCode">
-                    <up-input v-model="form.storeCode" placeholder="请输入存放库房或编码" border="none" clearable></up-input>
+                <up-form-item borderBottom label="存放库房" prop="warehouses">
+                    <select-warehouse-input v-model="form.warehouses" title="添加种源存放库房" :params="{ type: '2' }"></select-warehouse-input>
                 </up-form-item>
                 <!-- 入库人 -->
                 <up-form-item borderBottom label="入库人" required prop="instoreBizInfo.instoreMg">
@@ -124,6 +123,7 @@ import { SeedSourceAddTypeEnum } from '../models/type';
 import { formItemBtnStyle } from '@/assets/styles/uview-plus';
 import { generateUniqueId } from '@/utils/public';
 import { parseTime } from '@/utils/ruoyi';
+import SelectWarehouseInput from '@/models/select-warehouse-input/select-warehouse-input.vue';
 
 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'));
@@ -137,9 +137,9 @@ const form = ref<SeedSourceAddTypeEnum>({
     seedInfoList: [],
     warehouses: [],
     instoreBizInfo: {
-       instoreDate: parseTime(new Date(), '{y}-{m}-{d}'),
-       instoreMg: '',
-       remark: '',
+        instoreDate: parseTime(new Date(), '{y}-{m}-{d}'),
+        instoreMg: '',
+        remark: '',
     },
 });
 const rules = reactive({
@@ -152,7 +152,7 @@ const rules = reactive({
 
 const submitForm = async () => {
     console.log(form.value);
-    
+
     uni.$u.debounce(
         async () => {
             try {
@@ -174,9 +174,9 @@ const submitForm = async () => {
                     instoreBizInfo: {
                         ...form.value.instoreBizInfo,
                         ...uidMapData.value[uid]?.instoreBizInfo,
-                    }
+                    },
                 };
-            })
+            });
             try {
                 const res = await useClientRequest.post('/plt-api/app/storageSeed/batchInstore', params);
                 uni.hideLoading();
@@ -219,16 +219,7 @@ const generateBatchCode = async () => {
         });
     }
 };
-const did = ref('');
-const getDetailById = async (id: string) => {
-    if (!id) return;
-    const res = await useClientRequest.get(`/plt-api/app/gapCertificationInfo/getInfoById/${id}`);
-    if (res && res.code === 200) {
-        form.value = {
-            ...res.data,
-        };
-    }
-};
+
 const uidMapData = ref({} as any);
 // 添加种源入库跳转
 const navigateToAddSeedSource = (uid = '', mode = 'add') => {
@@ -245,9 +236,9 @@ const navigateToAddSeedSource = (uid = '', mode = 'add') => {
             res.eventChannel.emit('optionsParam', {
                 uid: uid || generateUniqueId(),
                 mode: mode,
-                form: uid ? uidMapData.value[uid] : {}
+                form: uid ? uidMapData.value[uid] : {},
             });
-        }
+        },
     });
 };
 const deleteRow = (index: number, uid: string) => {
@@ -255,14 +246,7 @@ const deleteRow = (index: number, uid: string) => {
     delete uidMapData.value[uid];
 };
 // 编辑时加载详情
-onLoad((optins: any) => {
-    if (optins.id) {
-        // 编辑加载详
-        did.value = optins.id;
-        getDetailById(optins.id);
-    } else {
-    }
-});
+onLoad((optins: any) => {});
 </script>
 <style lang="scss" scoped>
 .card-info-block {

+ 1 - 0
src/plant/storage/seed-source/info-edit/index.vue

@@ -369,6 +369,7 @@ const form = ref<seedInfoListType>({
         idFlag: '1',
         genUnit: '',
     },
+    supplierId: undefined,
     generationMaterial: '',
 });
 const rules = reactive({

+ 3 - 3
src/plant/storage/seed-source/info-update/index.vue

@@ -376,8 +376,8 @@
                     <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择库房类型</view>
                 </up-form-item>
                 <!-- 存放库房(具体库房/货架信息稍后补充为选择器) -->
-                <up-form-item borderBottom label="存放库房" prop="storeCode">
-                    <up-input v-model="form.storeCode" placeholder="请输入存放库房或编码" border="none" clearable></up-input>
+                <up-form-item borderBottom label="存放库房" prop="warehouses">
+                    <select-warehouse-input v-model="form.warehouses" title="添加种源存放库房" :params="{ type: '2' }"></select-warehouse-input>
                 </up-form-item>
                 <!-- 入库人 -->
                 <up-form-item borderBottom label="入库人" required prop="instoreBizInfo.instoreMg">
@@ -403,7 +403,7 @@ import { seedInfoListType } from '../models/type';
 import AnimalsInput from '../models/animals-input.vue';
 import ContactUnitInput from '@/models/contact-unit-input/contact-unit-input.vue';
 import PickerAreaInput from '@/models/picker-area-input/picker-area-input.vue';
-
+import SelectWarehouseInput from '@/models/select-warehouse-input/select-warehouse-input.vue';
 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'),

+ 1 - 0
src/plant/storage/seed-source/models/type.ts

@@ -93,6 +93,7 @@ export interface warehousesType {
     warehouseId?: string;
     /** 货架id */
     shelfId?: string;
+    [property: string]: any;
 }
 /**
  * 入库业务传输对象

+ 4 - 1
src/plant/storage/storage-room/detail/index.vue

@@ -128,5 +128,8 @@ onLoad((options: any) => {
 </script>
 
 <style lang="scss" scoped>
-
+.plot-item {
+    border: 1rpx solid rgba($u-primary, 0.4);
+    border-radius: 10rpx;
+}
 </style>

+ 2 - 1
src/plant/storage/storage-room/edit/index.vue

@@ -159,10 +159,11 @@ const loadDetail = async (id: string) => {
             warehouseName: data.warehouseName || '',
             sn: data.sn || '',
             type: data.type || '',
+            contact: data.contact || '',
             contactName: data.contactName || '',
             tel: data.tel || '',
             address: data.address || '',
-            area: data.area,
+            area: data.area || '',
             storageCondition: data.storageCondition || '',
             extraInfo: data.extraInfo || '',
             remark: data.remark || '',

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

@@ -89,7 +89,11 @@ const query = async (pageNum: number, pageSize: number) => {
     paging.value.complete(rows);
 };
 const onRefresh = () => {
-    paging.value.reload();
+    try {
+        paging.value?.reload();
+    } catch (e) {
+        console.error(e);
+    }
 };
 const optionsAction = reactive([
     {

BIN
src/static/images/plant/storage/agro_btm_bg.png


BIN
src/static/images/plant/storage/xznzrkxx_icon_sd.png


BIN
src/static/images/plant/storage/查看出入库记录.png


+ 9 - 1
src/utils/common.ts

@@ -314,20 +314,28 @@ export const isOpenSetting = async (scope?: string): Promise<boolean> => {
         const hasAuth = await new Promise<boolean>((resolve) => {
             uni.getSetting({
                 success: (res) => {
+                    console.log(res, 'getSetting res');
                     resolve(!!(res.authSetting && (res.authSetting as any)[scope as string]));
                 },
                 fail: () => resolve(false)
             });
         });
+        console.log(hasAuth, 'hasAuth');
         if (hasAuth) return true;
 
         const authorized = await new Promise<boolean>((resolve) => {
             uni.authorize({
                 scope,
                 success: () => resolve(true),
-                fail: () => resolve(false)
+                fail: (res) => {
+                    console.log(res);
+                    
+                    resolve(false)
+                }
             });
         });
+        console.log(authorized, 'authorized');
+        
         if (authorized) return true;
 
         const goSetting = await new Promise<boolean>((resolve) => {