huangxw 1 vecka sedan
förälder
incheckning
3ef68d7664

+ 2 - 1
src/plant/export-print/export/index.vue

@@ -34,7 +34,7 @@ import CheckInfoPack from '@/plant/print/models/check-info-pack.vue';
 import { useClientRequest } from '@/utils/request';
 import ExportPrintConfirm from '@/plant/export-print/models/export-print-confirm.vue';
 const paging = ref<any>(null);
-const currentStep = ref('export');
+const currentStep = ref('check');
 const stepsObject = reactive<any>({
     check: {
         title: '核对信息',
@@ -57,6 +57,7 @@ const info =ref<any>(null);
 const getDetailInfo = (data: any) => {
    info.value = data;
 };
+// 根据id获取详情form信息
 // 如果是 30x30
 const nextSteps = (data: any) => {
     if (!data.info || !data?.info?.value) return;

+ 1 - 1
src/plant/export-print/models/code-style-tem.vue

@@ -28,7 +28,7 @@
             </view>
             <view class="table-td flex1">{{ info?.batchSn || '-' }}</view>
         </view>
-        <view v-if="(fields as string[])?.includes('proSpecn')" class="table-tr">
+        <view v-if="(fields as string[])?.includes('proLevel')" class="table-tr">
             <view class="table-td w-160">
                 <view class="table-label flex1">规格等级</view>
             </view>

+ 43 - 6
src/plant/export-print/models/export-print-confirm.vue

@@ -36,7 +36,7 @@
                             <up-checkbox :customStyle="{ width: '33%', marginBottom: '8px' }" disabled label="品名" name="proName"></up-checkbox>
                             <up-checkbox :customStyle="{ width: '33%', marginBottom: '8px' }" label="基原" name="genusName"></up-checkbox>
                             <up-checkbox :customStyle="{ width: '33%', marginBottom: '8px' }" disabled label="批号" name="batchSn"></up-checkbox>
-                            <up-checkbox :customStyle="{ width: '33%', marginBottom: '8px' }" disabled label="规格等级" name="proSpecn"></up-checkbox>
+                            <up-checkbox :customStyle="{ width: '33%', marginBottom: '8px' }" disabled label="规格等级" name="proLevel"></up-checkbox>
                             <up-checkbox :customStyle="{ width: '33%', marginBottom: '8px' }" disabled label="产地" name="proAdcodeDesc"></up-checkbox>
                             <up-checkbox :customStyle="{ width: '33%', marginBottom: '8px' }" disabled label="数量(重量)" name="specn"></up-checkbox>
                             <up-checkbox :customStyle="{ width: '33%', marginBottom: '8px' }" label="采收日期" name="harvestDate"></up-checkbox>
@@ -96,7 +96,7 @@
 import { useInfoStore } from '@/store';
 import codeStyleTem from './code-style-tem.vue';
 import codeCheckedLogos from './code-checked-logos.vue';
-
+import { useClientRequest } from '@/utils/request';
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 const { pt_code_export_type, pt_code_export_format, pt_code_export_layout_type } = toRefs<any>(proxy?.useDict('pt_code_export_type', 'pt_code_export_format', 'pt_code_export_layout_type'));
 const infoStore = useInfoStore();
@@ -140,7 +140,7 @@ const form = ref<any>({
         fileFormat: '1',
         logos: [], // 导出logo
         // 只有禁用的默认有值,
-        fields: ['proName', 'batchSn', 'proSpecn', 'proAdcodeDesc', 'specn', 'cpyName', 'code', 'qrcode'], // 导出字段
+        fields: ['proName', 'batchSn', 'proLevel', 'proAdcodeDesc', 'specn', 'cpyName', 'code', 'qrcode'], // 导出字段
         layoutType: '2', // 排版类型
         email: '',
     },
@@ -222,23 +222,60 @@ const rules = reactive({
 });
 const changeExtraFileType = (val: any) => {
     form.value.extraInfo.fileFormat = val;
+    form.value.printCount = props.opts?.printedCount;
 };
 const submitForm = async () => {
     try {
         await upFormUpRef.value?.validate();
     } catch (error: any) {
         // 滚动到第一个错误字段
-        console.log(error);
-
         const firstErrorField = error && error[0].field + 'pppp';
         props.paging?.scrollIntoViewById(firstErrorField, 30, true);
         return;
     }
+    uni.showLoading({
+        title: '正在导出...',
+    });
+    const  payload = {
+        ...props.opts,
+        ...form.value,
+        printType: '2',
+        printCount: form.value.extraInfo.fileType == '1' ? props.opts.printedCount : form.value.printCount,
+    }
+    const res = await useClientRequest.post('/plt-api/app/printLog/printNext', payload)
+    if (!res || res.code !== 200) return;
+    uni.$emit('refreshPackTaskList');
+    uni.$emit('refreshPackTaskDetail');
+    await useClientRequest.get(`/plt-api/app/printLog/export/${res.data?.id}`)
+
+    uni.hideLoading();
+    uni.showToast({
+        title: '导出成功',
+        icon: 'success',
+    });
+    setTimeout(() => {
+        uni.navigateBack({
+            delta: 1,
+        });
+    }, 800);
 };
 const prevSteps = () => {
     emit('prev', {
         prevStepValue: props.prevStepValue || 'confirm',
     });
 };
-onMounted(() => {});
+// getFormInfo
+const getFormInfo = async () => {
+   if (!props.opts.id) return
+   const res = await useClientRequest.get(`/plt-api/app/printLog/${props.opts.id}`);
+    if (res && res.code === 200) {
+        form.value = {
+            ...form.value,
+            ...res.data,
+        }
+    }
+};
+onMounted(() => {
+   getFormInfo();
+});
 </script>

+ 3 - 2
src/plant/packaging/detail/index.vue

@@ -3,7 +3,7 @@
         <PackTestInfo v-if="form" :packId="did" :form="form" :dict="{ pt_pack_ref_type }" @changeTebs="changeTebs"></PackTestInfo>
     </template>
     <template v-if="viewMode == 'print'">
-        <PrintInfoPage v-if="form" :packId="did" :form="form" :dict="{ pt_pack_ref_type }" @changeTebs="changeTebs"></PrintInfoPage>
+        <PrintInfoPage v-if="form" :packId="did" :form="form" :dict="{ pt_pack_ref_type, pt_code_export_type }" @changeTebs="changeTebs"></PrintInfoPage>
     </template>
 </template>
 <script setup lang="ts">
@@ -13,7 +13,7 @@ import PackTestInfo from './models/pack-test-info.vue';
 import PrintInfoPage from './models/print-info-page.vue';
 const viewMode = ref('print'); // print relate
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
-const { pt_pack_ref_type } = toRefs<any>(proxy?.useDict('pt_pack_ref_type'));
+const { pt_pack_ref_type, pt_code_export_type, pt_code_export_format, pt_code_export_layout_type } = toRefs<any>(proxy?.useDict('pt_pack_ref_type', 'pt_code_export_type', 'pt_code_export_format', 'pt_code_export_layout_type'));
 const form = ref<any>(null);
 const did = ref('');
 // 获取详情(GAP获评信息)
@@ -36,5 +36,6 @@ onMounted(() => {
         getDetailById(did.value)
     })
 });
+
 </script>
 <style lang="scss" scoped></style>

+ 48 - 6
src/plant/packaging/detail/models/print-info-page.vue

@@ -13,15 +13,15 @@
                     <view class="pd-20"></view>
                 </pack-card>
                 <view class="btn-card-wrapper d-flex a-c j-sb">
-                    <view class="btn-bottom-bt ls-style" @click.stop="$u.route({ url: '/plant/print/print-self/index', params: { packId: form?.id, autoRelationId: form?.autoRelationId, unit: form?.unit, printedCount: form?.actualCount - form?.printCount } })">
+                    <view class="btn-bottom-bt ls-style" @click.stop="goPrint({ packId: form?.id, autoRelationId: form?.autoRelationId, unit: form?.unit, printedCount: form?.actualCount - form?.printCount }, '/plant/print/print-self/index')">
                         <image class="w-32 h-32 mr-8" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/print-codes/btn_zxdy_icon.png" mode="widthFix" />
                         <span>自行打印</span>
                     </view>
-                    <view class="btn-bottom-bt ss-style" @click="$u.route({ url: '/plant/export-print/export/index', params: { packId: form?.id, autoRelationId: form?.autoRelationId, unit: form?.unit, printedCount: form?.actualCount - form?.printCount} })">
+                    <view class="btn-bottom-bt ss-style" @click="goPrint({ packId: form?.id, autoRelationId: form?.autoRelationId, unit: form?.unit, printedCount: form?.actualCount - form?.printCount }, '/plant/export-print/export/index')">
                         <image class="w-32 h-32 mr-8" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/print-codes/dczsm_icon.png" mode="widthFix" />
                         <span>导出追溯码</span>
                     </view>
-                    <view class="btn-bottom-bt fs-style">
+                    <view class="btn-bottom-bt fs-style" @click="showFeatureUnavailable()">
                         <image class="w-32 h-32 mr-8" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/print-codes/btn_zrdd_icon.png" mode="widthFix" />
                         <span>找人代打</span>
                     </view>
@@ -62,7 +62,32 @@
                             </view>
                         </view>
                     </template>
-                    <template></template>
+                    <template v-if="item?.printType == '2'">
+                        <view class="mb-20 pd-20 bg-#F7F7F7 b-radius">
+                            <view class="f-s-24 c-#333 f-w-5">{{ selectDictLabel(pt_code_export_type, item?.extraInfo?.fileType) }}</view>
+                            <view class="f-s-28 pd2-4-0">
+                                <span class="c-#666">导出数量:</span>
+                                <span class="c-#333 f-w-5">{{ item?.printCount }}</span>
+                            </view>
+                            <view class="f-s-28 pd2-4-0 d-flex">
+                                <span class="c-#666">导出码值:</span>
+                                <view class="flex1 ov-hd c-#333 f-w-5">
+                                    <view>{{ item?.traceCodeStart }} 至</view>
+                                    <view>{{ item?.traceCodeEnd }}</view>
+                                </view>
+                            </view>
+                            <view class="d-flex f-s-24 c-#666">
+                                <view class="flex1 ov-hd">导出人:{{ item?.createByName || '-' }}</view>
+                                <view class="pr-100">导出时间:{{ item?.createTime || '-' }}</view>
+                            </view>
+                            <view class="pt-20 d-flex">
+                                <view class="flex1"></view>
+                                <view class="d-flex a-c">
+                                    <up-button @click="$u.route({ url: '/plant/export-print/export/index', params: item })" :customStyle="formItemBtnListStyle" color="#18BECA">重新导出</up-button>
+                                </view>
+                            </view>
+                        </view>
+                    </template>
                     <template></template>
                 </template>
             </view>
@@ -73,6 +98,7 @@
 import { useClientRequest } from '@/utils/request';
 import PackCard from '@/plant/models/pack-card.vue';
 import { formItemBtnListStyle } from '@/assets/styles/uview-plus';
+import { showFeatureUnavailable } from '@/utils/common';
 
 const paging = ref<any>(null);
 const props = defineProps({
@@ -90,7 +116,7 @@ const props = defineProps({
     },
 });
 const printType = ref('1');
-const { pt_pack_ref_type } = toRefs(props?.dict);
+const { pt_pack_ref_type, pt_code_export_type } = toRefs(props?.dict);
 const emit = defineEmits(['changeTebs']);
 const tabs = reactive([
     { label: '打印记录', value: '1' },
@@ -132,7 +158,23 @@ const clickAllPrint = async (item: any) => {
             uni.$u.route({ type: 'navigateTo', url: '/plant/print/print-all/index', params: item });
         }
     } catch (error) {
-        console.error('', error);
+        console.error('全部打印失败:', error);
+    }
+};
+const goPrint = async (params: any, url: string) => {
+    if (!params?.printedCount) {
+        uni.showModal({
+            title: '提示',
+            content: '没有可打印的追溯码了哦~',
+            showCancel: false,
+            confirmColor: '#37A954',
+        });
+        return;
+    }
+    try {
+        uni.$u.route({ type: 'navigateTo', url: url || '/plant/print/print-self/index', params });
+    } catch (error) {
+        console.error('跳转打印页面失败:', error);
     }
 };
 onMounted(() => {

+ 7 - 0
src/utils/common.ts

@@ -405,4 +405,11 @@ export const getDateRangeFrt = (startDate: string, endDate: string): string => {
     }
     return `${startDate}至${endDate}`;
 };
+// 功能暂未开放提示
+export const showFeatureUnavailable = (): void => {
+    uni.showToast({
+        title: '功能暂未开放,敬请期待',
+        icon: 'none',
+    });
+}