huangxw 1 тиждень тому
батько
коміт
0db05dfda5

+ 32 - 30
src/plant/packaging/create/index.vue

@@ -14,10 +14,7 @@
                         </up-button>
                         <view v-else class="bg-#FBFDFB card-info-block p-rtv border-#A9D7B4 b-radius">
                             <ObjectCardStorage :item="form.stroeObject"></ObjectCardStorage>
-                               <view
-                                class="close-icon pd-16"
-                                @click="deleteStorage"
-                            >
+                            <view class="close-icon pd-16" @click="deleteStorage">
                                 <up-icon color="#F81242" name="close" size="32rpx"></up-icon>
                             </view>
                         </view>
@@ -221,32 +218,38 @@ const rules = reactive<Record<string, any>>({
     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;
-    }
+const submit = () => {
+    uni.$u.debounce(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 });
-        const payload: any = { ...(form.value as any), planCount: packResult.value.packNum };
-        delete payload.stroeObject;
-        const res = await useClientRequest.post('/plt-api/app/packTask/save', payload);
-        uni.hideLoading();
-        if (res && res.code === 200) {
-            uni.showToast({ title: '操作成功', icon: 'success' });
-            uni.$emit('refreshPackTaskList');
-            setTimeout(() => uni.navigateBack({
-                delta: 1,
-            }), 300);
+        try {
+            await uni.showLoading({ title: '分包中...', mask: true });
+            const payload: any = { ...(form.value as any), planCount: packResult.value.packNum };
+            delete payload.stroeObject;
+            const res = await useClientRequest.post('/plt-api/app/packTask/save', payload);
+            uni.hideLoading();
+            if (res && res.code === 200) {
+                uni.showToast({ title: '操作成功', icon: 'success' });
+                uni.$emit('refreshPackTaskList');
+                setTimeout(
+                    () =>
+                        uni.navigateBack({
+                            delta: 1,
+                        }),
+                    300,
+                );
+            }
+        } catch (e) {
+            uni.hideLoading();
+            console.error('保存往来单位失败:', e);
         }
-    } catch (e) {
-        uni.hideLoading();
-        console.error('保存往来单位失败:', e);
-    }
+    }, 500, true);
 };
 // 点击随机生成服务端生成唯一的批号
 const generateBatchCode = async () => {
@@ -276,7 +279,7 @@ const selectStorage = () => {
         form.value.storageUseAmount = '';
         form.value.capacity = '';
         form.value.stroeObject = data;
-        form.value.batchSn = data?.batchCode
+        form.value.batchSn = data?.batchCode;
         uni.$off('selectStorageObject');
     });
     uni.$u.route({
@@ -307,7 +310,6 @@ const packResult = computed(() => {
         spec1: '',
         // 零包规格
         spec2: '',
-
     };
     if (form.value.storageUseAmount && form.value.capacity) {
         const useAmount = Number(form.value.storageUseAmount);

+ 37 - 26
src/plant/print/models/print-wrapper.vue

@@ -1,7 +1,6 @@
 <template>
     <view class="pd-24">
-        <up-form class="p-rtv bg-#fff" labelPosition="top" :model="form" :rules="rules" labelWidth="auto"
-            ref="upFormRef">
+        <up-form class="p-rtv bg-#fff" labelPosition="top" :model="form" :rules="rules" labelWidth="auto" ref="upFormRef">
             <view class="d-flex j-c a-c">
                 <image v-if="!form.printSpec" class="w-670 h-590" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/print-codes/img_no_spac.png" mode="widthFix" />
                 <image v-if="form.printSpec == '30x30'" class="w-670 h-590" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/print-codes/img_30x30.png" mode="widthFix" />
@@ -21,39 +20,39 @@
     </view>
 </template>
 <script lang="ts" setup>
-const emit = defineEmits(['test',  'prev', 'print']);
+const emit = defineEmits(['test', 'prev', 'print']);
 const props = defineProps({
     info: {
         type: Object,
-        required: true
+        required: true,
     },
     nextStepValue: {
         type: String,
-        default: 'print'
+        default: 'print',
     },
     prevStepValue: {
         type: String,
-        default: 'connect'
+        default: 'connect',
     },
     printCount: {
         type: Number,
-        default: 1
-    }
+        default: 1,
+    },
 });
 const specs = reactive([
     {
         label: '60 X 60',
-        value: '60x60'
+        value: '60x60',
     },
     {
         label: '60 X 40',
-        value: '60x40'
+        value: '60x40',
     },
     {
         label: '30 X 30',
-        value: '30x30'
-    }
-])
+        value: '30x30',
+    },
+]);
 const form = ref<any>({
     printSpec: '',
 });
@@ -62,20 +61,32 @@ const rules = reactive({
 });
 // 点击打印测试
 const clickPrintTest = () => {
-    if (!form.value.printSpec) {
-        return uni.showToast({ icon: 'none', title: '请选择打印规格' });
-    }
-    emit('test', form.value)
-}
+    uni.$u.debounce(
+        () => {
+            if (!form.value.printSpec) {
+                return uni.showToast({ icon: 'none', title: '请选择打印规格' });
+            }
+            emit('test', form.value);
+        },
+        500,
+        true,
+    );
+};
 const printClick = () => {
-    if (!form.value.printSpec) {
-        return uni.showToast({ icon: 'none', title: '请选择打印规格' });
-    }
-    emit('print', form.value)
+    uni.$u.debounce(
+        () => {
+            if (!form.value.printSpec) {
+                return uni.showToast({ icon: 'none', title: '请选择打印规格' });
+            }
+            emit('print', form.value);
+        },
+        500,
+        true,
+    );
 };
 const prevSteps = () => {
-   emit('prev', {
-      prevStepValue: props.prevStepValue || 'confirm',
-   });
+    emit('prev', {
+        prevStepValue: props.prevStepValue || 'confirm',
+    });
 };
-</script>
+</script>

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

@@ -1,6 +1,5 @@
 <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="'新增农资入库'" :fixed="false" border></ut-navbar>
         </template>
@@ -17,13 +16,11 @@
                             <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]?.materialName
-                                            }}</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>
@@ -33,17 +30,13 @@
                                 </view>
                                 <view class="d-flex">
                                     <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>
+                                            <span class="c-#333 f-w-500">{{ uidMapData[item]?.capacity }}{{ uidMapData[item]?.unit }}</span>
                                         </view>
-                                        <view v-if="!['kg', 'L'].includes(uidMapData[item]?.unit)"
-                                            class="flex1 f-s-28 pr-10 pd2-4-0">
+                                        <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>
+                                            <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')">
@@ -69,17 +62,14 @@
             <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="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="#37A954" name="arrow-down-fill"></up-icon>
                         </template>
@@ -89,24 +79,21 @@
                 <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="storageType" required>
-                    <view v-if="form.storageType" class="f-s-30 c-999 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">
                     <select-warehouse-input v-model="form.warehouses" title="添加农资存放库房" :params="{ type: '1' }"></select-warehouse-input>
                 </up-form-item>
                 <!-- 入库人 -->
                 <up-form-item borderBottom label="入库人" required prop="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="remark">
@@ -132,9 +119,7 @@ import { useInfoStore } from '@/store';
 const infoStore = useInfoStore();
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 // 仅使用到的字典:入库类型、库房类型、显示农资卡片中的种类和来源
-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'),
-);
+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);
@@ -151,7 +136,6 @@ const form = ref<AgroProductInstoreAddTypeEnum>({
     },
 });
 const rules = reactive({
-    
     instoreType: [{ required: true, message: '请选择入库类型' }],
     'instoreBizInfo.instoreDate': [{ required: true, message: '请选择入库日期' }],
     batchCode: [{ required: true, message: '请输入入库批号' }],
@@ -183,9 +167,9 @@ const submitForm = async () => {
                     instoreBizInfo: {
                         ...form.value.instoreBizInfo,
                         ...uidMapData.value[uid]?.instoreBizInfo,
-                    }
+                    },
                 };
-            })
+            });
             try {
                 const res = await useClientRequest.post('/plt-api/app/material/batchInstore', params);
                 if (!res || res.code !== 200) return;
@@ -196,11 +180,10 @@ const submitForm = async () => {
                 });
                 uni.$emit('refreshStorageRoomList');
                 // 返回上一页
-                setTimeout(() => {
-                    uni.navigateBack({
-                        delta: 1,
-                    });
-                }, 1500);
+                await new Promise((resolve) => setTimeout(resolve, 1000));
+                uni.navigateBack({
+                    delta: 1,
+                });
             } catch (error) {
                 // uni.hideLoading();
             }
@@ -244,9 +227,9 @@ const navigateToAddAgroProduct = (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) => {
@@ -254,9 +237,7 @@ const deleteRow = (index: number, uid: string) => {
     delete uidMapData.value[uid];
 };
 // 编辑时加载详情
-onLoad((optins: any) => {
-
-});
+onLoad((optins: any) => {});
 </script>
 <style lang="scss" scoped>
 .card-info-block {

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

@@ -172,11 +172,10 @@ const submitForm = async () => {
                 });
                 uni.$emit('refreshStorageRoomList');
                 // 返回上一页
-                setTimeout(() => {
-                    uni.navigateBack({
-                        delta: 1,
-                    });
-                }, 1500);
+                await new Promise((resolve) => setTimeout(resolve, 1000));
+                uni.navigateBack({
+                    delta: 1,
+                });
             } catch (error) {
                 // uni.hideLoading();
             }

+ 0 - 2
src/plant/storage/seed-source/add/index.vue

@@ -152,8 +152,6 @@ const rules = reactive({
 });
 
 const submitForm = async () => {
-    console.log(form.value);
-
     uni.$u.debounce(
         async () => {
             try {