瀏覽代碼

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

lisy 1 周之前
父節點
當前提交
a38df9c57b

+ 7 - 0
src/pages.json

@@ -472,6 +472,13 @@
                         "navigationBarTitleText": "创建包装任务"
                     }
                 },
+                // 修改包装任务
+                {
+                    "path": "edit/index",
+                    "style": {
+                        "navigationBarTitleText": "修改包装任务"
+                    }
+                },
                 // 包装任务详情
                 {
                     "path": "detail/index",

+ 2 - 2
src/pages/plant/processing/index.vue

@@ -1,7 +1,7 @@
 <template>
     <z-paging ref="paging" bgColor="#F7F7F7">
         <template #top v-if="!showHeader">
-            <ut-navbar title="产地加工及包装赋码任务" :fixed="false" :breadcrumb="false">
+            <ut-navbar title="产地加工及包装赋码" :fixed="false" :breadcrumb="false">
                 <template #left>
                     <view class=""></view>
                 </template>
@@ -13,7 +13,7 @@
                 <up-navbar :fixed="true" :bgColor="navBarBgColor">
                     <template #left>
                         <view class="d-flex a-c pb-5" id="topup-navbar" :style="{ width: `${bubble.left - 30}px` }">
-                            <text class="f-s-40 c-333 f-w-5 w-s-no">产地加工及包装赋码任务</text>
+                            <text class="f-s-40 c-333 f-w-5 w-s-no">产地加工及包装赋码</text>
                             <view class="flex1"></view>
                         </view>
                     </template>

+ 16 - 1
src/plant/models/pack-card.vue

@@ -7,7 +7,7 @@
                 <span>包装</span>
             </view>
         </view>
-        <view class="pd-20">
+        <view class="pd-20 p-rtv">
             <view class="d-flex a-c">
                 <view class="flex1 ov-hd">
                     <span class="f-s-34 c-#333 f-w-5 mr-10">{{ item?.proName || '-' }}</span>
@@ -47,9 +47,11 @@
                     <span class="c-#333 f-w-5">{{ item?.actualCount - item?.printCount }}{{ item?.unit }}</span>
                 </view>
             </view>
+          
             <slot></slot>
         </view>
     </view>
+    <view v-if="+item?.bgStatus" class="fmz-status">赋码中...</view>
 </template>
 <script lang="ts" setup>
 const props = defineProps({
@@ -81,4 +83,17 @@ const emit = defineEmits(['click']);
 .bg-pack-2 {
     background-color: #37A954;
 }
+.fmz-status {
+    position: absolute;
+    top: 0;
+    right: 0;
+    bottom: 0;
+    left: 0;
+    font-size: 26rpx;
+    color: #F74C30;
+    padding: 120rpx 24rpx 0;
+    z-index: 10;
+    opacity: 0.8;
+    text-align: right;
+}
 </style>

+ 5 - 1
src/plant/models/warehouseCard/fresh-goods-card.vue

@@ -45,7 +45,7 @@
             <span class="c-#666">入库量:</span>
             <span class="c-#333 f-w-500">{{ item?.capacity }}{{ item?.unit }}</span>
         </view>
-        <view class="d-flex">
+        <view v-if="showInOutAmount" class="d-flex">
             <view v-if="item?.inputAmount" class="pd2-4-0 f-s-28 flex1">
                 <span class="c-#666">出库量:</span>
                 <span class="c-#333 f-w-500">{{ item?.inputAmount || '0' }}{{ item?.unit }}</span>
@@ -75,6 +75,10 @@ const props = defineProps({
         type: Boolean,
         default: true,
     },
+    showInOutAmount: {
+        type: Boolean,
+        default: true,
+    },
 });
 const { pt_fresh_instore_type } = toRefs<any>(props.dict);
 </script>

+ 5 - 1
src/plant/models/warehouseCard/medicine-card.vue

@@ -34,7 +34,7 @@
             <span class="c-#666">入库量:</span>
             <span class="c-#333 f-w-500">{{ item?.capacity }}{{ item?.unit }}</span>
         </view>
-        <view class="d-flex">
+        <view v-if="showInOutAmount" class="d-flex">
             <view v-if="item?.inputAmount" class="pd2-4-0 f-s-28 flex1">
                 <span class="c-#666">出库量:</span>
                 <span class="c-#333 f-w-500">{{ item?.inputAmount || '0' }}{{ item?.unit }}</span>
@@ -62,6 +62,10 @@ const props = defineProps({
         type: Boolean,
         default: true,
     },
+    showInOutAmount: {
+        type: Boolean,
+        default: true,
+    },
 });
 const { st_medicine_process_type } = toRefs<any>(props.dict);
 </script>

+ 7 - 3
src/plant/models/warehouseCard/object-card-storage.vue

@@ -1,12 +1,12 @@
 <template>
     <template v-if="item.storageType === '2'">
-        <seed-source-card :item="item" :dict="{ pt_seed_instore_type, pt_seed_type, pt_fungus_code_type }" :isInstoreDate="isInstoreDate"></seed-source-card>
+        <seed-source-card :item="item" :dict="{ pt_seed_instore_type, pt_seed_type, pt_fungus_code_type }" :isInstoreDate="isInstoreDate" :showInOutAmount="showInOutAmount"></seed-source-card>
     </template>
     <template v-if="item.storageType === '4'">
-        <fresh-goods-card :item="item" :dict="{ pt_fresh_instore_type }" :isInstoreDate="isInstoreDate"></fresh-goods-card>
+        <fresh-goods-card :item="item" :dict="{ pt_fresh_instore_type }" :isInstoreDate="isInstoreDate" :showInOutAmount="showInOutAmount"></fresh-goods-card>
     </template>
     <template v-if="item.storageType === '5'">
-        <medicine-card :item="item" :dict="{ st_medicine_process_type }" :isInstoreDate="isInstoreDate"></medicine-card>
+        <medicine-card :item="item" :dict="{ st_medicine_process_type }" :isInstoreDate="isInstoreDate" :showInOutAmount="showInOutAmount"></medicine-card>
     </template>
 </template>
 <script lang="ts" setup>
@@ -24,6 +24,10 @@ const props = defineProps({
         type: Boolean,
         default: false,
     },
+    showInOutAmount: {
+        type: Boolean,
+        default: true,
+    },
 });
 
 </script>

+ 5 - 1
src/plant/models/warehouseCard/seed-source-card.vue

@@ -74,7 +74,7 @@
             <span class="c-#666">入库量:</span>
             <span class="c-#333 f-w-500">{{ item?.capacity }}{{ item?.unit }}</span>
         </view>
-        <view class="d-flex">
+        <view v-if="showInOutAmount" class="d-flex">
             <view v-if="item?.inputAmount" class="pd2-4-0 f-s-28 flex1">
                 <span class="c-#666">出库量:</span>
                 <span class="c-#333 f-w-500">{{ item?.inputAmount || '0' }}{{ item?.unit }}</span>
@@ -104,6 +104,10 @@ const props = defineProps({
         type: Boolean,
         default: true,
     },
+    showInOutAmount: {
+        type: Boolean,
+        default: true,
+    },
 });
 const { pt_seed_instore_type, pt_seed_type, pt_fungus_code_type } = toRefs<any>(props.dict);
 </script>

+ 1 - 3
src/plant/packaging/create/index.vue

@@ -100,7 +100,7 @@
                 <!-- 保质期 12月,数字加单位单位两个字段, expireDate,expireDateUnit -->
                 <view class="h-1" id="expireDatepppp"></view>
                 <view class="h-1" id="expireDateUnitpppp"></view>
-                <up-form-item label="保质期" required class="form-item-bottom-padding-0">
+                <up-form-item label="保质期" class="form-item-bottom-padding-0">
                     <div class="flex1 d-flex a-c">
                         <div class="flex1 ov-hd">
                             <up-form-item prop="expireDate" border-bottom class="form-item-top-padding-0">
@@ -218,8 +218,6 @@ const rules = reactive<Record<string, any>>({
     packagingDateEnd: [{ required: true, message: '请选择结束日期' }],
     packSn: [{ required: true, message: '请输入包装批号' }],
     batchSn: [{ required: true, message: '请输入成品批号' }],
-    expireDate: [{ required: true, message: '请输入保质期' }],
-    expireDateUnit: [{ required: true, message: '请选择保质期单位' }],
     refType: [{ required: true, message: '请选择赋码方式' }],
 });
 

+ 349 - 0
src/plant/packaging/edit/index.vue

@@ -0,0 +1,349 @@
+<template>
+    <z-paging ref="paging" bgColor="#f7f7f7" safe-area-inset-bottom scroll-with-animation>
+        <template #top>
+            <ut-navbar :title="'修改包装任务'" :fixed="false" border></ut-navbar>
+        </template>
+        <up-form class="p-rtv bg-#fff" labelPosition="top" :model="form" :rules="rules" labelWidth="auto" ref="upFormRef">
+            <view class="pd-24 bg-#fff mb-10">
+                <view class="h-1" id="inputStorageIdpppp"></view>
+                <up-form-item borderBottom label="选择包装对象" prop="inputStorageId" required>
+                    <view class="flex1">
+                        <view  class="bg-#FBFDFB card-info-block p-rtv border-#A9D7B4 b-radius">
+                            <ObjectCardStorage :item="form.stroeObject" :showInOutAmount="false"></ObjectCardStorage>
+                        </view>
+                    </view>
+                </up-form-item>
+                <view class="h-1" id="storageUseAmountpppp"></view>
+                <up-form-item borderBottom label="本次包装用量" prop="storageUseAmount" required>
+                    <up-input v-model="form.storageUseAmount" color="#999" readonly placeholder="请输入本次包装用量" border="none" clearable></up-input>
+                    <template #right>
+                        <span class="f-s-30 f-w-5 c-#333">{{ form?.storageUseUnit || 'kg' }}</span>
+                    </template>
+                </up-form-item>
+                <view class="h-1" id="capacitypppp"></view>
+                <view class="h-1" id="unitpppp"></view>
+                <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="capacity" border-bottom class="form-item-top-padding-0">
+                                <up-input v-model="form.capacity" color="#999" readonly placeholder="请输入包装规格" border="none" clearable></up-input>
+                            </up-form-item>
+                        </div>
+                        <div class="pd-5"></div>
+                        <div class="w-200">
+                            <up-form-item prop="storageUseUnit" border-bottom class="form-item-top-padding-0">
+                                <up-input v-model="form.storageUseUnit" color="#999" inputAlign="center" readonly placeholder="单位" border="none" clearable></up-input>
+                            </up-form-item>
+                        </div>
+                        <div class="pd2-0-10 c-#ccc d-flex a-c j-c">/</div>
+                        <div class="w-200">
+                            <ut-action-sheet v-model="form.unit" :tabs="pt_pack_spec_unit" mode="custom" title="选择单位">
+                                <up-form-item prop="unit" border-bottom class="form-item-top-padding-0">
+                                    <up-input v-model="form.unit" inputAlign="center" readonly placeholder="单位" border="none" clearable></up-input>
+                                    <template #right>
+                                        <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
+                                    </template>
+                                </up-form-item>
+                            </ut-action-sheet>
+                        </div>
+                    </div>
+                </up-form-item>
+                <view class="h-1" id="packagingDateStartpppp"></view>
+                <view class="h-1" id="packagingDateEndpppp"></view>
+                <up-form-item required label="包装日期" class="form-item-bottom-padding-0">
+                    <view class="flex1 d-flex">
+                        <view class="flex1">
+                            <ut-datetime-picker v-model="form.packagingDateStart" :maxDate="form.packagingDateEnd" mode="date">
+                                <up-form-item borderBottom prop="packagingDateStart" class="form-item-top-padding-0">
+                                    <up-input v-model="form.packagingDateStart" readonly placeholder="包装开始日期" border="none" clearable></up-input>
+                                    <template #right>
+                                        <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
+                                    </template>
+                                </up-form-item>
+                            </ut-datetime-picker>
+                        </view>
+                        <view class="pd2-0-20"></view>
+                        <view class="flex1">
+                            <ut-datetime-picker v-model="form.packagingDateEnd" :minDate="form.packagingDateStart" mode="date">
+                                <up-form-item borderBottom prop="packagingDateEnd" class="form-item-top-padding-0">
+                                    <up-input v-model="form.packagingDateEnd" readonly placeholder="包装结束日期" border="none" clearable></up-input>
+                                    <template #right>
+                                        <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
+                                    </template>
+                                </up-form-item>
+                            </ut-datetime-picker>
+                        </view>
+                    </view>
+                </up-form-item>
+                <!-- 包装批号 -->
+                <view class="h-1" id="packSnpppp"></view>
+                <up-form-item borderBottom label="包装批号" prop="packSn" required>
+                    <up-input v-model="form.packSn" placeholder="请输入包装批号" border="none" clearable></up-input>
+                    <template #right>
+                        <up-button @click="generateBatchCode" type="primary" :customStyle="formItemBtnStyle">随机生成</up-button>
+                    </template>
+                </up-form-item>
+                <view class="h-1" id="batchSnpppp"></view>
+                <up-form-item borderBottom label="成品批号" prop="batchSn" required>
+                    <up-input v-model="form.batchSn" placeholder="请输入成品批号" border="none" clearable></up-input>
+                </up-form-item>
+                <!-- 保质期 12月,数字加单位单位两个字段, expireDate,expireDateUnit -->
+                <view class="h-1" id="expireDatepppp"></view>
+                <view class="h-1" id="expireDateUnitpppp"></view>
+                <up-form-item label="保质期" class="form-item-bottom-padding-0">
+                    <div class="flex1 d-flex a-c">
+                        <div class="flex1 ov-hd">
+                            <up-form-item prop="expireDate" border-bottom class="form-item-top-padding-0">
+                                <up-input v-model="form.expireDate" placeholder="请输入保质期" border="none" clearable></up-input>
+                            </up-form-item>
+                        </div>
+                        <div class="pd-5"></div>
+                        <div class="w-200">
+                            <ut-action-sheet v-model="form.expireDateUnit" :tabs="pt_expire_date_unit" mode="custom" title="选择单位">
+                                <up-form-item prop="expireDateUnit" border-bottom class="form-item-top-padding-0">
+                                    <up-input v-model="form.expireDateUnit" inputAlign="center" readonly placeholder="单位" border="none" clearable></up-input>
+                                    <template #right>
+                                        <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
+                                    </template>
+                                </up-form-item>
+                            </ut-action-sheet>
+                        </div>
+                    </div>
+                </up-form-item>
+                <!-- 请选择赋码方式 -->
+                <view class="h-1" id="refTypepppp"></view>
+                <up-form-item borderBottom label="赋码方式" required prop="refType">
+                    <view v-if="form.refType" class="f-s-30 c-999 f-w-5 flex1">{{ selectDictLabel(pt_pack_ref_type, form.refType) }}</view>
+                    <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择赋码方式</view>
+                </up-form-item>
+                <view class="d-flex a-c pd2-10-0" @click="$u.route({ url: '/tools/view-html/index', params: { url: 'https://ta.zycpzs.cn/oss-file/smart-trace/szyy/template/pack_code_type.html', title: '赋码方式区别' } })">
+                    <up-icon size="28rpx" name="question-circle" color="#37A954"></up-icon>
+                    <span class="c-primary f-s-24">两种赋码方式的区别?怎么选择?</span>
+                </view>
+            </view>
+        </up-form>
+        <view class="d-flex flex-cln a-c pd3-40-24-24">
+            <view class="f-s-30 c-#333 f-w-5 mb-16">
+                <span>预计分包数:</span>
+                <span class="f-s-46 c-primary f-w-7">{{ packResult.packNum || '-' }}</span>
+                <span>包</span>
+            </view>
+            <view class="d-flex a-c mb-30">
+                <view class="f-s-28 c-#333">包装规格:</view>
+                <view class="d-flex a-c gap-24">
+                    <view class="bg-#E3EFE6 pd2-12-28 c-primary radius-8 f-s-26">{{ packResult.spec1 || '-' }}</view>
+                    <view v-if="packResult.spec2" class="bg-#E3EFE6 pd2-12-28 c-primary radius-8 f-s-26">{{ packResult.spec2 || '-' }}</view>
+                </view>
+            </view>
+            <up-button type="primary" @click="submit">确认修改</up-button>
+        </view>
+    </z-paging>
+</template>
+<script setup lang="ts">
+import { useClientRequest } from '@/utils/request';
+import { formItemBtnStyle } from '@/assets/styles/uview-plus';
+import { getUrlParams, recursiveDecodeURIComponent } from '@/utils/ruoyi';
+import type { PackTaskForm } from './types';
+import NP from 'number-precision';
+import ObjectCardStorage from '@/plant/models/warehouseCard/object-card-storage.vue';
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;
+const { pt_pack_ref_type, pt_pack_spec_unit, pt_expire_date_unit } = toRefs<any>(proxy?.useDict('pt_pack_ref_type', 'pt_pack_spec_unit', 'pt_expire_date_unit'));
+const upFormRef = ref();
+const paging = ref();
+const did = ref('');
+const form = ref<PackTaskForm>({
+    storageUseAmount: '',
+    storageUseUnit: 'kg',
+    capacity: '',
+    unit: '',
+    packagingDateStart: '',
+    packagingDateEnd: '',
+    packSn: '',
+    batchSn: '',
+    expireDate: '',
+    expireDateUnit: '',
+    refType: '',
+    packCodeType: '3',
+});
+
+const rules = reactive<Record<string, any>>({
+    storageUseUnit: [{ required: true, message: '请选择包装单位' }],
+    unit: [{ required: true, message: '请选择单位' }],
+    packagingDateStart: [{ required: true, message: '请选择开始日期' }],
+    packagingDateEnd: [{ required: true, message: '请选择结束日期' }],
+    packSn: [{ required: true, message: '请输入包装批号' }],
+    batchSn: [{ required: true, message: '请输入成品批号' }],
+    refType: [{ required: true, message: '请选择赋码方式' }],
+});
+
+const submit = async () => {
+    try {
+        await upFormRef.value?.validate();
+    } catch (error: any) {
+        const firstErrorField = error && error[0].field + 'pppp';
+        paging.value?.scrollIntoViewById(firstErrorField, 30, true);
+        return;
+    }
+    try {
+        await uni.showLoading({ title: '修改中...', mask: true });
+        //      d
+        // integer <int64>
+        // 包装任务ID
+        // 必需
+        // packagingDateStart
+        // string <date>
+        // 包装开始日期
+        // 可选
+        // packagingDateEnd
+        // string <date>
+        // 包装结束日期
+        // 可选
+        // unit
+        // string
+        // 包装单位
+        // 必需
+        // batchSn
+        // string
+        // 产品批号
+        // 可选
+        // packSn
+        // string
+        // 包装批号
+        // 可选
+        // expireDate
+        // integer <int32>
+        // 有效期
+        // 可选
+        // expireDateUnit
+        // string
+        // 有效期单位;
+
+        const payload: any = {
+            id: did.value,
+            packagingDateStart: form.value.packagingDateStart,
+            packagingDateEnd: form.value.packagingDateEnd,
+            unit: form.value.unit,
+            batchSn: form.value.batchSn,
+            packSn: form.value.packSn,
+            expireDate: form.value.expireDate,
+            expireDateUnit: form.value.expireDateUnit,
+        };
+        delete payload.stroeObject;
+        const res = await useClientRequest.post('/plt-api/app/packTask/update', payload);
+        uni.hideLoading();
+        if (res && res.code === 200) {
+            uni.$emit('refreshPackTaskList');
+            await uni.showModal({
+                title: '修改成功',
+                content: '若已印刷,请查看已印刷包装上的信息是否正确!以免造成扫码信息与包装信息不一致。',
+                showCancel: false,
+                confirmText: '知道了',
+            });
+            uni.navigateBack({
+                delta: 1,
+            });
+        }
+    } catch (e) {
+        uni.hideLoading();
+        console.error('保存包装任务失败:', e);
+    }
+};
+// 点击随机生成服务端生成唯一的批号
+const generateBatchCode = async () => {
+    uni.showLoading({
+        title: '生成中...',
+    });
+    const res = await useClientRequest.post('/plt-api/app/plantationTask/getBatchCode', {
+        plType: 'Z',
+        linkType: 'I',
+    });
+    if (res && res.code === 200) {
+        uni.hideLoading();
+        form.value.packSn = res.data;
+        uni.showToast({
+            title: '批号生成成功',
+            icon: 'success',
+        });
+    }
+};
+const getStorageInfoById = async (id: string, storageType?: string | number) => {
+    const type = String(storageType || form.value.packTaskType || '');
+    let url = `/plt-api/app/storage/getInfo/${id}`;
+    if (type === '1') {
+        url = `/plt-api/app/material/getInfo/${id}`;
+    } else if (type === '2') {
+        url = `/plt-api/app/storageSeed/getById/${id}`;
+    }
+    const res = await useClientRequest.get(url);
+    if (!res || res.code !== 200) return null;
+    return {
+        ...(res.data || {}),
+        storageType: String((res.data || {})?.storageType || type || ''),
+    };
+};
+
+const getDetailById = async (id: string) => {
+    const res = await useClientRequest.get(`/plt-api/app/packTask/${id}`);
+    if (!res || res.code !== 200) return;
+    const detail = res.data || {};
+    form.value = {
+        ...form.value,
+        ...detail,
+    };
+    if (!form.value.packTaskType && detail?.storageType) {
+        form.value.packTaskType = String(detail.storageType);
+    }
+
+    if (!form.value.inputStorageId) return;
+    const storageInfo = await getStorageInfoById(form.value.inputStorageId, detail?.packTaskType || detail?.storageType || form.value.packTaskType);
+    if (storageInfo) {
+        form.value.stroeObject = storageInfo;
+        if (!form.value.storageUseUnit) {
+            form.value.storageUseUnit = storageInfo?.unit || 'kg';
+        }
+    } else {
+        form.value.stroeObject = detail;
+    }
+};
+// 计算属性分包结果
+const packResult = computed(() => {
+    // 预计分包数 = 本次包装用量 / 包装规格,向上取整
+    // 分包数,包装规格,整除的情况,直接除;不整除的情况,向上取整
+    // 包装规格,整除的时候包装规格只有一个,不整除包装规格有两个,第二个是剩余量
+    const result: any = {
+        packNum: 0,
+        spec1: '',
+        // 零包规格
+        spec2: '',
+    };
+    if (form.value.storageUseAmount && form.value.capacity) {
+        const useAmount = Number(form.value.storageUseAmount);
+        const capacity = Number(form.value.capacity);
+        if (capacity > 0) {
+            result.packNum = Math.ceil(useAmount / capacity);
+            result.spec1 = `${capacity}${form.value.storageUseUnit}/${form.value.unit}`;
+            if (useAmount % capacity !== 0) {
+                const lastAmount = NP.round(useAmount - capacity * Math.floor(useAmount / capacity), 2);
+                result.spec2 = `${lastAmount}${form.value.storageUseUnit}/${form.value.unit}`; // 零包规格
+            } else {
+                result.spec2 = ''; // 没有零包规格
+            }
+        }
+    }
+    return result;
+});
+onLoad((options: any) => {
+    did.value = options?.id || getUrlParams(recursiveDecodeURIComponent(options?.q))?.id || '';
+    if (did.value) {
+        getDetailById(did.value);
+    }
+});
+</script>
+<style lang="scss" scoped>
+.close-icon {
+    position: absolute;
+    top: 0;
+    right: 0;
+    z-index: 1;
+}
+</style>

+ 29 - 0
src/plant/packaging/edit/types.ts

@@ -0,0 +1,29 @@
+export interface PackTaskForm {
+  /** 主键(编辑时使用) */
+  id?: string;
+  /** 本次包装用量 */
+  storageUseAmount?: number | string;
+  /** 包装规格:每包重量(例如 5、10) */
+  capacity?: number | string;
+  /** 包装规格单位(例如 kg、g) */
+  stroeUnit?: string;
+  /** 包装规格单位(选择) */
+  unit?: string;
+  /** 包装开始日期 */
+  packagingDateStart?: string | Date;
+  /** 包装结束日期 */
+  packagingDateEnd?: string | Date;
+  /** 包装批号 */
+  packSn?: string;
+  /** 成品批号 */
+  batchSn?: string;
+  /** 保质期数值 */
+  expireDate?: number | string;
+  /** 保质期单位 */
+  expireDateUnit?: string;
+  /** 赋码方式 */
+  packCodeType?: string;
+  /** 区域名称(如果有) */
+  adcdCodeName?: string;
+  [key: string]: any;
+}

+ 21 - 11
src/plant/packaging/list/index.vue

@@ -23,9 +23,9 @@
         </view>
         <view class="pd-24 bg-#f7f7f7">
             <up-swipe-action>
-                <up-swipe-action-item v-for="(item, index) in list" :key="index" :name="item?.id" :options="optionsActionTemp" @click="clickTempSwipe" class="mb-20 b-radius">
-                    <view @click="$u.route({ url: '/plant/packaging/detail/index', params: { id: item?.id } })" class="b-radius bg-#fff p-rtv">
-                        <pack-card :item="item" :dict="{ pt_pack_ref_type }" isArrow>
+                <up-swipe-action-item v-for="(item, index) in list" :key="index" :name="item?.id" :disabled="+item?.bgStatus" :options="optionsActionTemp" @click="clickTempSwipe($event, item)" class="mb-20 b-radius">
+                    <view  class="b-radius bg-#fff p-rtv">
+                        <pack-card :item="item" :dict="{ pt_pack_ref_type }" isArrow @click="$u.route({ url: '/plant/packaging/detail/index', params: { id: item?.id } })">
                             <view class="h-1 bg-#F7F7F7 mg2-10-0"></view>
                             <view class="pt-10 d-flex">
                                 <view class="flex1"></view>
@@ -39,12 +39,12 @@
                                         :customStyle="formItemBtnListStyle"
                                         >查看批次信息</up-button>
                                     <template v-if="item.refType == '2'">
-                                        <up-button :customStyle="formItemBtnListStyle" v-if="+item?.actualCount - item?.printCount" @click.stop="$u.route({ url: '/plant/print/print-self/index', params: { packId: item?.id, autoRelationId: item?.autoRelationId, unit: item?.unit, printedCount: item?.actualCount - item?.printCount } })" class="ml-10" color="#37A954">立即打印</up-button>
-                                        <up-button :customStyle="formItemBtnListStyle" v-if="+item?.printCount" @click="$u.route({ url: '/plant/packaging/detail/index', params: { id: item?.id, viewMode: 'print' } })" class="ml-10" color="#37A954">查看打印记录</up-button>
+                                        <up-button :customStyle="formItemBtnListStyle" :disabled="+item?.bgStatus" v-if="+item?.actualCount - item?.printCount" @click.stop="$u.route({ url: '/plant/print/print-self/index', params: { packId: item?.id, autoRelationId: item?.autoRelationId, unit: item?.unit, printedCount: item?.actualCount - item?.printCount } })" class="ml-10" color="#37A954">立即打印</up-button>
+                                        <up-button :customStyle="formItemBtnListStyle" :disabled="+item?.bgStatus" v-if="+item?.printCount" @click="$u.route({ url: '/plant/packaging/detail/index', params: { id: item?.id, viewMode: 'print' } })" class="ml-10" color="#37A954">查看打印记录</up-button>
                                     </template>
                                     <template v-if="item.refType == '1'">
-                                        <up-button :customStyle="formItemBtnListStyle" @click="$u.route({ url: '/plant/packaging/batch-link/index', params: { packId: item?.id } })" v-if="(+item?.planCount > +item?.actualCount)" class="ml-10" color="#91C747">批量关联</up-button>
-                                        <up-button :customStyle="formItemBtnListStyle" v-if="+item?.actualCount" class="ml-10" color="#91C747">查看关联记录</up-button>
+                                        <up-button :customStyle="formItemBtnListStyle" :disabled="+item?.bgStatus" @click="$u.route({ url: '/plant/packaging/batch-link/index', params: { packId: item?.id } })" v-if="(+item?.planCount > +item?.actualCount)" class="ml-10" color="#91C747">批量关联</up-button>
+                                        <up-button :customStyle="formItemBtnListStyle" :disabled="+item?.bgStatus" v-if="+item?.actualCount" class="ml-10" color="#91C747">查看关联记录</up-button>
                                     </template>
                                 </view>
                             </view>
@@ -94,6 +94,12 @@ const query = async (pageNum: number, pageSize: number) => {
 };
 // 暂存项左滑删除配置
 const optionsActionTemp = reactive([
+    {
+        text: '编辑',
+        style: {
+            backgroundColor: '#37A954',
+        },
+    },
     {
         text: '删除',
         style: {
@@ -102,13 +108,17 @@ const optionsActionTemp = reactive([
     },
 ]);
 // 暂存项删除点击(本地移除)
-const clickTempSwipe = async (event: object) => {
+const clickTempSwipe = async (event: object, item: any) => {
     const { name, index } = event as any;
     if (index === 0) {
+        // 编辑
+        uni.$u.route({ type: 'navigateTo', url: '/plant/packaging/edit/index', params: { id: name } });
+    }
+    if (index === 1) {
         try {
             const res = await uni.showModal({
                 title: '删除提示',
-                content: '确定删除鲜货信息吗?',
+                content: '删除后,分包重量将退回相应的库存,是否确认删除?',
                 confirmColor: '#F74C30',
             });
             if (!res.confirm) return;
@@ -116,7 +126,7 @@ const clickTempSwipe = async (event: object) => {
                 title: '删除中...',
                 mask: true,
             });
-            await useClientRequest.get(`/plt-api/app/storage/removeById/${name}`);
+            await useClientRequest.get(`/plt-api/app/packTask/delete/${name}`);
             uni.hideLoading();
             uni.showToast({
                 title: '删除成功',
@@ -124,7 +134,7 @@ const clickTempSwipe = async (event: object) => {
             });
             paging.value?.reload();
         } catch (error) {
-            console.error('删除暂存鲜货信息失败:', error);
+            console.error('删除暂存包装任务失败:', error);
         }
     }
 };

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

@@ -95,7 +95,7 @@
                 </up-form-item>
                 <!-- 库房类型 -->
                 <up-form-item borderBottom label="库房类型" prop="storageType" required>
-                    <view v-if="form.storageType" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_warehouse_type,
+                    <view v-if="form.storageType" class="f-s-30 c-999 f-w-5 flex1">{{ selectDictLabel(pt_warehouse_type,
                         form.storageType) }}</view>
                     <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择库房类型</view>
                 </up-form-item>

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

@@ -187,7 +187,7 @@
                 </up-form-item>
                 <!-- 库房类型 -->
                 <up-form-item borderBottom label="库房类型" prop="storageType" required>
-                    <view v-if="form.storageType" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_warehouse_type, form.storageType) }}</view>
+                    <view v-if="form.storageType" class="f-s-30 c-999 f-w-5 flex1">{{ selectDictLabel(pt_warehouse_type, form.storageType) }}</view>
                     <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择库房类型</view>
                 </up-form-item>
                 <!-- 存放库房(具体库房/货架信息稍后补充为选择器) -->

+ 1 - 1
src/plant/storage/fresh-goods/add/index.vue

@@ -80,7 +80,7 @@
                 </up-form-item>
                 <!-- 库房类型 -->
                 <up-form-item borderBottom label="库房类型" prop="storageType" required>
-                    <view v-if="form.storageType" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_warehouse_type, form.storageType) }}</view>
+                    <view v-if="form.storageType" class="f-s-30 c-999 f-w-5 flex1">{{ selectDictLabel(pt_warehouse_type, form.storageType) }}</view>
                     <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择库房类型</view>
                 </up-form-item>
                 <up-form-item borderBottom label="存放库房" prop="warehouses">

+ 8 - 8
src/plant/storage/fresh-goods/info-update/index.vue

@@ -64,7 +64,7 @@
                     <view class="h-1" id="capacitypppp"></view>
                     <view class="h-1" id="unitpppp"></view>
                     <up-form-item label="入库量" prop="capacity" required class="form-item-bottom-padding-0">
-                        <view class="f-s-30 c-333 f-w-5 flex1">{{ form?.capacity }}{{ form?.unit }}</view>
+                        <view class="f-s-30 c-999 f-w-5 flex1">{{ form?.capacity }}{{ form?.unit }}</view>
                     </up-form-item>
 
                     <template v-if="['2'].includes(form.sourceType as string)">
@@ -142,7 +142,7 @@
                     </up-form-item>
                     <!-- 入库类型 -->
                     <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_fresh_instore_type, form.instoreType) }}</view>
+                        <view v-if="form.instoreType" class="f-s-30 c-999 f-w-5 flex1">{{ selectDictLabel(pt_fresh_instore_type, form.instoreType) }}</view>
                         <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择入库类型</view>
                     </up-form-item>
                     <!-- 入库日期 -->
@@ -157,11 +157,11 @@
                     </ut-datetime-picker>
                     <!-- 入库批号 -->
                     <up-form-item borderBottom label="入库批号" required prop="batchCode">
-                        <view class="f-s-30 c-333 f-w-5 flex1">{{ form.batchCode }}</view>
+                        <view class="f-s-30 c-999 f-w-5 flex1">{{ form.batchCode }}</view>
                     </up-form-item>
                     <!-- 库房类型 -->
                     <up-form-item borderBottom label="库房类型" prop="storageType" required>
-                        <view v-if="form.storageType" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_warehouse_type, form.storageType) }}</view>
+                        <view v-if="form.storageType" class="f-s-30 c-999 f-w-5 flex1">{{ selectDictLabel(pt_warehouse_type, form.storageType) }}</view>
                         <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择库房类型</view>
                     </up-form-item>
                     <!-- 存放库房(具体库房/货架信息稍后补充为选择器) -->
@@ -213,14 +213,14 @@
 
                     <view class="h-1" id="sourceTypepppp"></view>
                     <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_medicine_source_tag, form.sourceType) }}</view>
+                        <view v-if="form.sourceType" class="f-s-30 c-999 f-w-5 flex1">{{ selectDictLabel(pt_medicine_source_tag, form.sourceType) }}</view>
                         <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择鲜货来源</view>
                     </up-form-item>
                     <!-- 入库数量与单位 -->
                     <view class="h-1" id="capacitypppp"></view>
                     <view class="h-1" id="unitpppp"></view>
                     <up-form-item label="采收量" prop="capacity" required class="form-item-bottom-padding-0">
-                        <view class="f-s-30 c-333 f-w-5 flex1">{{ form?.capacity }}{{ form?.unit }}</view>
+                        <view class="f-s-30 c-999 f-w-5 flex1">{{ form?.capacity }}{{ form?.unit }}</view>
                     </up-form-item>
 
                     <!-- 检验报告与供应商信息 -->
@@ -283,12 +283,12 @@
                     </up-form-item>
                     <!-- 入库类型 -->
                     <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_fresh_instore_type, form.instoreType) }}</view>
+                        <view v-if="form.instoreType" class="f-s-30 c-999 f-w-5 flex1">{{ selectDictLabel(pt_fresh_instore_type, form.instoreType) }}</view>
                         <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择入库类型</view>
                     </up-form-item>
                     <!-- 库房类型 -->
                     <up-form-item borderBottom label="库房类型" prop="storageType" required>
-                        <view v-if="form.storageType" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_warehouse_type, form.storageType) }}</view>
+                        <view v-if="form.storageType" class="f-s-30 c-999 f-w-5 flex1">{{ selectDictLabel(pt_warehouse_type, form.storageType) }}</view>
                         <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择库房类型</view>
                     </up-form-item>
                     <!-- 存放库房(具体库房/货架信息稍后补充为选择器) -->

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

@@ -207,7 +207,7 @@
                     <view class="h-1" id="capacitypppp"></view>
                     <view class="h-1" id="unitpppp"></view>
                     <up-form-item label="入库量" prop="capacity" required class="form-item-bottom-padding-0">
-                        <view class="f-s-30 c-333 f-w-5 flex1">{{ form?.capacity }}{{ form?.unit }}</view>
+                        <view class="f-s-30 c-999 f-w-5 flex1">{{ form?.capacity }}{{ form?.unit }}</view>
                     </up-form-item>
                     <!-- 检验报告与供应商信息 -->
                     <up-form-item borderBottom label="检验报告" prop="examinReport">
@@ -330,7 +330,7 @@
                     </up-form-item>
                     <!-- 入库类型 -->
                     <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-999 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>
                     <!-- 入库日期 -->
@@ -345,11 +345,11 @@
                     </ut-datetime-picker>
                     <!-- 入库批号 -->
                     <up-form-item borderBottom label="入库批号" required prop="batchCode">
-                        <view class="f-s-30 c-333 f-w-5 flex1">{{ form.batchCode }}</view>
+                        <view class="f-s-30 c-999 f-w-5 flex1">{{ form.batchCode }}</view>
                     </up-form-item>
                     <!-- 库房类型 -->
                     <up-form-item borderBottom label="库房类型" prop="storageType" required>
-                        <view v-if="form.storageType" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_warehouse_type, form.storageType) }}</view>
+                        <view v-if="form.storageType" class="f-s-30 c-999 f-w-5 flex1">{{ selectDictLabel(pt_warehouse_type, form.storageType) }}</view>
                         <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择库房类型</view>
                     </up-form-item>
                     <!-- 存放库房(具体库房/货架信息稍后补充为选择器) -->
@@ -374,7 +374,7 @@
                     <!-- 基本信息 -->
                     <view class="h-1" id="seedTypepppp"></view>
                     <up-form-item borderBottom label="种源类型" required prop="seedType">
-                        <view v-if="form.seedType" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_seed_type, form.seedType) }}</view>
+                        <view v-if="form.seedType" class="f-s-30 c-999 f-w-5 flex1">{{ selectDictLabel(pt_seed_type, form.seedType) }}</view>
                         <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择种源类型</view>
                     </up-form-item>
                     <view class="h-1" id="varietyIdpppp"></view>
@@ -402,14 +402,14 @@
                     </up-form-item>
                     <view class="h-1" id="seedSourcepppp"></view>
                     <up-form-item borderBottom label="种源来源" required prop="seedSource">
-                        <view v-if="form.seedSource" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_seed_source, form.seedSource) }}</view>
+                        <view v-if="form.seedSource" class="f-s-30 c-999 f-w-5 flex1">{{ selectDictLabel(pt_seed_source, form.seedSource) }}</view>
                         <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择种源来源</view>
                     </up-form-item>
                     <!-- 入库数量与单位 -->
                     <view class="h-1" id="capacitypppp"></view>
                     <view class="h-1" id="unitpppp"></view>
                     <up-form-item label="入库量" prop="capacity" required class="form-item-bottom-padding-0">
-                        <view class="f-s-30 c-333 f-w-5 flex1">{{ form?.capacity }}{{ form?.unit }}</view>
+                        <view class="f-s-30 c-999 f-w-5 flex1">{{ form?.capacity }}{{ form?.unit }}</view>
                     </up-form-item>
                     <!-- 检验报告与供应商信息 -->
                     <up-form-item borderBottom label="检验报告" prop="examinReport">
@@ -418,7 +418,7 @@
 
                     <!-- 菌种编码信息 -->
                     <up-form-item required v-if="['A4', 'A8'].includes(form.seedType as string)" :label="`${selectDictLabel(pt_seed_type, form.seedType as string)}编号`" class="form-item-bottom-padding-0">
-                        <view class="f-s-30 c-333 f-w-5 flex1"> {{ selectDictLabel(pt_fungus_code_type, form?.fungusCodeType) }}/{{ form?.fungusCode }} </view>
+                        <view class="f-s-30 c-999 f-w-5 flex1"> {{ selectDictLabel(pt_fungus_code_type, form?.fungusCodeType) }}/{{ form?.fungusCode }} </view>
                     </up-form-item>
                     <!-- 个体标识:此处仅占位,后续可改为多选列表 -->
                     <view class="h-1" id="instoreBizInfo.idFlagpppp"></view>
@@ -493,7 +493,7 @@
                     </up-form-item>
                     <!-- 入库类型 -->
                     <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-999 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>
                     <!-- 入库日期 -->
@@ -508,11 +508,11 @@
                     </ut-datetime-picker>
                     <!-- 入库批号 -->
                     <up-form-item borderBottom label="入库批号" required prop="batchCode">
-                        <view class="f-s-30 c-333 f-w-5 flex1">{{ form.batchCode }}</view>
+                        <view class="f-s-30 c-999 f-w-5 flex1">{{ form.batchCode }}</view>
                     </up-form-item>
                     <!-- 库房类型 -->
                     <up-form-item borderBottom label="库房类型" prop="storageType" required>
-                        <view v-if="form.storageType" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_warehouse_type, form.storageType) }}</view>
+                        <view v-if="form.storageType" class="f-s-30 c-999 f-w-5 flex1">{{ selectDictLabel(pt_warehouse_type, form.storageType) }}</view>
                         <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择库房类型</view>
                     </up-form-item>
                     <!-- 存放库房(具体库房/货架信息稍后补充为选择器) -->