Ver código fonte

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

lisy 1 semana atrás
pai
commit
ca877ae3e6

+ 8 - 0
src/assets/styles/uview-plus.scss

@@ -61,4 +61,12 @@ uni-button::after{
     >.u-form-item__body {
         padding-bottom: 0rpx;
     }
+}
+.form-item-label_required {
+    position: absolute;
+    left: -9px;
+    color: #f56c6c;
+    line-height: 20px;
+    font-size: 20px;
+    top: 3px;
 }

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

@@ -1,5 +1,5 @@
 <template>
-    <view class="d-flex gap-20">
+    <view class="d-flex gap-20 flex-wrap">
         <view v-for="option in options" :key="option.value" :class="{ 'active': modelValue == option.value }" class="pd-20 f-s-26 min-180 text-center radius-10 ut-radio-item" @click="onSelect(option.value)">
             {{ option.label }}
         </view>

+ 30 - 6
src/pages.json

@@ -471,12 +471,6 @@
         {
             "root": "plant/print",
             "pages": [
-                {
-                    "path": "print-steps/index",
-                    "style": {
-                        "navigationBarTitleText": "打印步骤"
-                    }
-                },
                 // 自行打印
                 {
                     "path": "print-self/index",
@@ -490,6 +484,36 @@
                     "style": {
                         "navigationBarTitleText": "区间打印"
                     }
+                },
+                // 全部打印
+                {
+                    "path": "print-all/index",
+                    "style": {
+                        "navigationBarTitleText": "全部打印"
+                    }
+                }
+            ]
+        },
+        // 导出和代打追溯码
+        {
+            "root": "plant/export-print",
+            "pages": [
+                // 导出追溯码
+                {
+                    "path": "export/index",
+                    "style": {
+                        "navigationBarTitleText": "导出追溯码",
+                        "componentPlaceholder": {
+                            "check-info-pack": "view"
+                        }
+                    }
+                },
+                // 找人代打追溯码
+                {
+                    "path": "print-for-other/index",
+                    "style": {
+                        "navigationBarTitleText": "找人代打追溯码"
+                    }
                 }
             ]
         },

+ 63 - 0
src/plant/export-print/export/index.vue

@@ -0,0 +1,63 @@
+<template>
+    <z-paging ref="paging" bgColor="#f7f7f7" safe-area-inset-bottom scroll-with-animation>
+        <template #top>
+            <ut-navbar :title="stepsObject[currentStep].title" :fixed="false" border :breadcrumb="false"></ut-navbar>
+            <view class="pd-24 bg-fff">
+                <ut-steps-title :stepsObject="stepsObject"></ut-steps-title>
+            </view>
+            <view class="pd-5"></view>
+        </template>
+        <view>
+            <view v-show="currentStep === 'check'">
+                <!-- 业务组件核对信息 -->
+                <check-info-pack v-if="opts" prevStepValue="check" @info="getDetailInfo" :opts="opts" :info="stepsObject[currentStep]" @next="nextSteps" nextStepValue="export"></check-info-pack>
+            </view>
+            <view v-show="currentStep === 'export'">
+                <!-- 业务组件确认数量 -->
+                <export-print-confirm v-if="opts" :opts="opts" :infoData="info" :info="stepsObject[currentStep]"></export-print-confirm>
+            </view>
+            
+        </view>
+    </z-paging>
+</template>
+
+<script setup lang="ts">
+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 currentStep = ref('export');
+const stepsObject = reactive<any>({
+    check: {
+        title: '核对信息',
+        value: 'check',
+        status: 'in-progress', // 为开始、进行中、已完成 三种状态分别值为 'not-started'、'in-progress'、'completed'
+        sort: 0,
+    },
+    export: {
+        title: '导出追溯码',
+        value: 'export',
+        status: 'not-started', // 为开始、进行中、已完成 三种状态分别值为 'not-started'、'in-progress'、'completed'
+        sort: 1,
+    }
+});
+const opts = ref<any>(null);
+onLoad((options: any) => {
+    opts.value = options;
+});
+const info =ref<any>(null);
+const getDetailInfo = (data: any) => {
+   info.value = data;
+};
+// 如果是 30x30
+const nextSteps = (data: any) => {
+    console.log(data);
+    
+    if (!data.info || !data?.info?.value) return;
+    stepsObject[data?.info?.value] = {
+        ...data.info,
+    };
+    stepsObject[data?.nextStepValue].status = 'in-progress';
+    currentStep.value = data?.nextStepValue;
+};
+</script>
+<style lang="scss" scoped></style>

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

@@ -0,0 +1,125 @@
+<template>
+   <view v-if="layoutType == '2'" class="w-640 tem-wrapper-table">
+        <view class="table-tr">
+            <view class="table-td flex1"></view>
+        </view>
+        <view class="table-tr">
+            <view class="table-td w-160">
+                <view class="table-label flex1">品名</view>
+            </view>
+            <view class="table-td flex1">{{ info?.proName || '-' }}</view>
+        </view>
+        <view class="table-tr">
+            <view class="table-td w-160">
+                <view class="table-label flex1">基原</view>
+            </view>
+            <view class="table-td flex1">三七</view>
+        </view>
+        <view class="table-tr">
+            <view class="table-td w-160">
+                <view class="table-label flex1">批号</view>
+            </view>
+            <view class="table-td flex1">{{ info?.batchSn || '-' }}</view>
+        </view>
+        <view class="table-tr">
+            <view class="table-td w-160">
+                <view class="table-label flex1">规格等级</view>
+            </view>
+            <view class="table-td flex1">{{ info?.proLevel || '-' }}</view>
+        </view>
+        <view class="table-tr">
+            <view class="table-td w-160">
+                <view class="table-label flex1">产地</view>
+            </view>
+            <view class="table-td flex1">{{ info?.proAdcodeDesc || '-' }}</view>
+        </view>
+        <view class="table-tr">
+            <view class="table-td w-160">
+                <view class="table-label flex1">数量/重量</view>
+            </view>
+            <view class="table-td flex1">{{ info?.specn }}</view>
+        </view>
+        <view class="table-tr">
+            <view class="table-td w-160">
+                <view class="table-label flex1">采收日期</view>
+            </view>
+            <view class="table-td flex1">{{ getDateRangeFrt(info?.harvestDate, info?.harvestDateEnd) }}</view>
+        </view>
+        <view class="table-tr">
+            <view class="table-td w-160">
+                <view class="table-label flex1">包装日期</view>
+            </view>
+            <view class="table-td flex1">{{ getDateRangeFrt(info?.packagingDateStart, info?.packagingDateStart) }}</view>
+        </view>
+        <view class="table-tr">
+            <view class="table-td w-160">
+                <view class="table-label flex1">保质期</view>
+            </view>
+            <view class="table-td flex1">{{ info?.expireDate }}{{ info?.expireDateUnit }}</view>
+        </view>
+        <view class="table-tr">
+            <view class="table-td w-160">
+                <view class="table-label flex1">企业名称</view>
+            </view>
+            <view class="table-td flex1">{{ info?.cpyName }}</view>
+        </view>
+        <view class="table-tr">
+            <view class="table-td w-160">
+                <view class="table-label flex1">追溯码</view>
+            </view>
+            <view class="table-td flex1">三七</view>
+        </view>
+   </view>
+</template>
+
+<script lang="ts" setup>
+const props = defineProps({
+   fields: {
+       type: Array,
+       default: () => []
+   },
+   layoutType: {
+       type: String,
+       default: ''
+   },
+   hasBorder: { // 新增属性:控制是否显示边框
+       type: Boolean,
+       default: false
+   },
+   info: {
+       type: Object,
+       default: () => null
+   },
+})
+
+</script>
+
+<style lang="scss" scoped>
+.table-tr {
+    display: flex;
+}
+.table-td {
+    margin-left: -1px;
+    margin-top: -1px;
+    padding: 10rpx 20rpx;
+    font-size: 30rpx;
+    color: #000;
+    font-weight: 500;
+    border: 1px solid #000;
+    min-height: 90rpx;
+    display: flex;
+    align-items: center;
+    // 文字随意换行
+    word-break: break-all;
+}
+// 文字一排第一个字和最后一个字在两端对齐列
+// 品    名
+// 基    原
+// 采收日期
+.table-label {
+    text-align: justify;
+    text-align-last: justify;
+    /*兼容ie*/
+    text-justify: distribute-all-lines;
+}
+</style>

+ 140 - 0
src/plant/export-print/models/export-print-confirm.vue

@@ -0,0 +1,140 @@
+<template>
+    <view class="pd-24 bg-fff">
+        <up-form class="p-rtv bg-#fff" labelPosition="top" :model="form" errorType="toast" :rules="rules" labelWidth="auto" ref="upFormUpRef">
+            <view class="f-s-24 c-#999">导出追溯码仅支持导出追溯码地址用于喷印或排版好追溯码PDF文件直接打印。如有疑问,请。如有疑问,请<span class="c-primary">点击此处联系客服</span>。</view>
+            <view class="h-1" id="fileTypepppp"></view>
+            <ut-action-sheet v-model="form.extraInfo.fileType" :tabs="pt_code_export_type" @change="changeExtraFileType" mode="custom" title="请选择导出类型">
+                <up-form-item borderBottom label="导出类型" required prop="extraInfo.fileType">
+                    <view v-if="form.extraInfo?.fileType" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_code_export_type, form.extraInfo.fileType) }}</view>
+                    <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择导出类型</view>
+                    <template #right>
+                        <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
+                    </template>
+                </up-form-item>
+            </ut-action-sheet>
+            <!-- 导出格式 -->
+            <view class="h-1" id="fileFormatpppp"></view>
+            <up-form-item borderBottom label="导出格式" required prop="extraInfo.fileFormat">
+                <view v-if="form.extraInfo?.fileFormat" class="f-s-30 c-333 f-w-5 flex1">
+                    {{ selectDictLabel(pt_code_export_format, form.extraInfo?.fileFormat) }}
+                </view>
+                <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择导出格式</view>
+            </up-form-item>
+            <view class="h-1" id="fieldspppp"></view>
+            <up-form-item prop="extraInfo.fields" borderBottom>
+                <view class="flex1">
+                    <view class="p-rtv mb-20">
+                        <span class="form-item-label_required">*</span>
+                        <span class="f-s-30 c-#333">导出信息</span>
+                        <span class="f-s-24 c-#999">(已默认勾选必打字段,如需其他字段可自行选择)</span>
+                    </view>
+                    <up-checkbox-group v-model="form.extraInfo.fields">
+                        <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="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>
+                        <up-checkbox :customStyle="{ width: '33%', marginBottom: '8px' }" label="包装日期" name="packagingDate"></up-checkbox>
+                        <up-checkbox :customStyle="{ width: '33%', marginBottom: '8px' }" label="保质期" name="expireDate"></up-checkbox>
+                        <up-checkbox :customStyle="{ width: '33%', marginBottom: '8px' }" disabled label="企业名称" name="cpyName"></up-checkbox>
+                        <up-checkbox :customStyle="{ width: '33%', marginBottom: '8px' }" label="溯源码码值" name="code"></up-checkbox>
+                        <up-checkbox :customStyle="{ width: '33%', marginBottom: '8px' }" disabled label="溯源码图" name="qrcode"></up-checkbox>
+                        <up-checkbox :customStyle="{ marginBottom: '8px' }" label="是否符合GAP要求" name="gapFlag"></up-checkbox>
+                    </up-checkbox-group>
+                </view>
+            </up-form-item>
+            <up-form-item props="extraInfo.layoutType" label="排版类型" required borderBottom>
+                <view class="flex1">
+                    <ut-radio v-model="form.extraInfo.layoutType" :options="pt_code_export_layout_type"></ut-radio>
+                    <view class="d-flex j-c a-c pd-24">
+                        <codeStyleTem :fields="form.extraInfo.fields" :info="infoData" :layoutType="form.extraInfo.layoutType"></codeStyleTem>
+                    </view>
+                </view>
+            </up-form-item>
+            <up-form-item :label="`导出人`" required borderBottom>
+                <up-input v-model="form.printPerson" placeholder="请输入导出人" readonly border="none" clearable></up-input>
+            </up-form-item>
+        </up-form>
+    </view>
+    <view class="pd3-40-24-30 d-flex">
+        <up-button class="mr-30" type="primary" plain @click="prevSteps">上一步</up-button>
+        <up-button type="primary" @click="submitForm">下一步</up-button>
+    </view>
+</template>
+<script setup lang="ts">
+import { useInfoStore } from '@/store';
+import codeStyleTem from './code-style-tem.vue';
+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();
+
+const props = defineProps({
+    infoData: {
+        type: Object,
+        default: () => null,
+    },
+    info: {
+        type: Object,
+        default: () => null,
+    },
+    nextStepValue: {
+        type: String,
+        default: '',
+    },
+    prevStepValue: {
+        type: String,
+        default: '',
+    },
+    item: {
+        type: Object,
+        default: () => null,
+    },
+    opts: {
+        type: Object,
+        default: () => null,
+    },
+});
+const upFormUpRef = ref();
+const emit = defineEmits(['next', 'prev', 'formdata']);
+const form = ref({
+    extraInfo: {
+        fileType: '1',
+        fileFormat: '1',
+        logos: [], // 导出logo
+        // 只有禁用的默认有值,
+        fields: ['proName', 'batchSn', 'proSpecn', 'proAdcodeDesc', 'specn', 'cpyName', 'qrcode'], // 导出字段
+        layoutType: '2', // 排版类型
+    },
+    printPerson: infoStore.userInfo?.name, // 导出人
+});
+const rules = reactive({});
+const changeExtraFileType = (val: any) => {
+    console.log(val);
+    form.value.extraInfo.fileFormat = val;
+};
+const submitForm = async () => {
+    try {
+        await upFormUpRef.value?.validate();
+    } catch (error: any) {
+        return;
+    }
+    emit('formdata', {
+        ...form.value,
+    });
+    emit('next', {
+        info: {
+            ...props.info,
+            status: 'completed',
+        },
+        nextStepValue: props.nextStepValue || 'print',
+    });
+};
+const prevSteps = () => {
+    emit('prev', {
+        prevStepValue: props.prevStepValue || 'confirm',
+    });
+};
+onMounted(() => {});
+</script>

+ 3 - 0
src/plant/export-print/print-for-other/index.vue

@@ -0,0 +1,3 @@
+<template>
+    <view></view>
+</template>

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

@@ -269,6 +269,7 @@ const selectStorage = () => {
         form.value.storageUseAmount = '';
         form.value.capacity = '';
         form.value.stroeObject = data;
+        form.value.batchSn = data?.batchCode
         uni.$off('selectStorageObject');
     });
     uni.$u.route({

+ 6 - 0
src/plant/packaging/detail/index.vue

@@ -30,5 +30,11 @@ onLoad((options: any) => {
 const changeTebs = (view: string) => {
     viewMode.value = view;
 }
+onMounted(() => {
+    // 获取详情(GAP获评信息)
+    uni.$on('refreshPackTaskDetail', () => {
+        getDetailById(did.value)
+    })
+});
 </script>
 <style lang="scss" scoped></style>

+ 92 - 42
src/plant/packaging/detail/models/print-info-page.vue

@@ -1,34 +1,33 @@
 <template>
-    <z-paging
-        ref="paging"
-        bgcolor="#F7F7F7"
-        v-model="list"
-        @query="query"
-        safe-area-inset-bottom
-        scroll-with-animation
-    >
+    <z-paging ref="paging" bgcolor="#F7F7F7" v-model="list" @query="query" safe-area-inset-bottom scroll-with-animation>
         <template #top>
             <ut-navbar title="包装任务详情" :fixed="false" border></ut-navbar>
         </template>
         <view class="d-flex a-c pd3-30-24-0 f-s-30 f-w-5">
-            <view
-                class="pd2-20-36 card-item-box mr-10 active"
-            >{{ form?.refType == '2' ? '打印详情' : '关联详情' }}</view>
+            <view class="pd2-20-36 card-item-box mr-10 active">{{ form?.refType == '2' ? '打印详情' : '关联详情' }}</view>
             <view @click="changeTebs" class="pd2-20-36 card-item-box">包装任务信息</view>
         </view>
         <view class="bg-fff pd-24">
-            <view class="detail-info-card ov-hd p-rtv mb-40">
-                <pack-card :item="form" :dict="dict"></pack-card>
-                <view>
-                    <view class></view>
-                    <view></view>
-                    <view></view>
+            <view class="detail-info-card p-rtv mb-40">
+                <pack-card :item="form" :dict="dict">
+                    <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 } })">
+                        <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, printedCount: form?.actualCount - form?.printCount} })">
+                        <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">
+                        <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>
                 </view>
             </view>
-            <view
-                class="d-flex a-c pd2-10-0 j-ed"
-                @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: '赋码方式区别' } })"
-            >
+            <view class="d-flex a-c pd2-10-0 j-ed" @click="$u.route({ url: '/tools/view-html/index', params: { url: 'https://ta.zycpzs.cn/oss-file/smart-trace/szyy/template/pack_print_type.html', title: '打印方式的区别' } })">
                 <up-icon size="28rpx" name="question-circle" color="#999"></up-icon>
                 <span class="c-#999 f-s-24">三种打印方式的区别?怎么选择?</span>
             </view>
@@ -54,10 +53,10 @@
                                 <view class="flex1 ov-hd">打印人:{{ item?.createByName || '-' }}</view>
                                 <view class="pr-100">打印时间:{{ item?.createTime || '-' }}</view>
                             </view>
-                             <view class="pt-20 d-flex">
+                            <view class="pt-20 d-flex">
                                 <view class="flex1"></view>
                                 <view class="d-flex a-c">
-                                    <up-button :customStyle="formItemBtnListStyle" class="ml-20" color="#18BECA">全部打印</up-button>
+                                    <up-button @click="clickAllPrint(item)" :customStyle="formItemBtnListStyle" class="ml-20" color="#18BECA">全部打印</up-button>
                                     <up-button @click="$u.route({ url: '/plant/print/print-range/index', params: item })" :customStyle="formItemBtnListStyle" class="ml-20" color="#37A954">区间打印</up-button>
                                 </view>
                             </view>
@@ -71,35 +70,35 @@
     </z-paging>
 </template>
 <script setup lang="ts">
-import { useClientRequest } from "@/utils/request";
-import PackCard from "@/plant/models/pack-card.vue";
-import { formItemBtnListStyle } from "@/assets/styles/uview-plus";
+import { useClientRequest } from '@/utils/request';
+import PackCard from '@/plant/models/pack-card.vue';
+import { formItemBtnListStyle } from '@/assets/styles/uview-plus';
 
 const paging = ref(null);
 const props = defineProps({
     packId: {
         type: String,
-        default: ""
+        default: '',
     },
     form: {
         type: Object,
-        default: () => null
+        default: () => null,
     },
     dict: {
         type: Object,
-        default: () => null
-    }
+        default: () => null,
+    },
 });
-const printType = ref("1");
+const printType = ref('1');
 const { pt_pack_ref_type } = toRefs(props?.dict);
-const emit = defineEmits(["changeTebs"]);
+const emit = defineEmits(['changeTebs']);
 const tabs = reactive([
-    { label: "打印记录", value: "1" },
-    { label: "导出记录", value: "2" },
-    { label: "找人代打记录", value: "3" }
+    { label: '打印记录', value: '1' },
+    { label: '导出记录', value: '2' },
+    { label: '找人代打记录', value: '3' },
 ]);
 const changeTebs = () => {
-    emit("changeTebs", "pack");
+    emit('changeTebs', 'pack');
 };
 const list = ref([]);
 const query = async (pageNum: number, pageSize: number) => {
@@ -107,12 +106,9 @@ const query = async (pageNum: number, pageSize: number) => {
         pageNum,
         pageSize,
         packId: props.packId,
-        printType: printType.value
+        printType: printType.value,
     };
-    const res = await useClientRequest.get(
-        "/plt-api/app/printLog/list",
-        params
-    );
+    const res = await useClientRequest.get('/plt-api/app/printLog/list', params);
     if (res && res?.rows) {
         const { rows } = res;
         paging.value.complete(rows);
@@ -122,9 +118,28 @@ const onRefresh = () => {
     try {
         paging.value?.reload();
     } catch (error) {
-        console.error("刷新列表失败:", error);
+        console.error('刷新列表失败:', error);
+    }
+};
+const clickAllPrint = async (item) => {
+    try {
+        const res = await uni.showModal({
+            title: '全部打印提示',
+            content: '您确认需要再次打印该条记录的全部追溯码吗?',
+            confirmColor: '#37A954',
+        });
+        if (res.confirm) {
+            uni.$u.route({ url: '/plant/print/print-all/index', params: item });
+        }
+    } catch (error) {
+        console.error('', error);
     }
 };
+onMounted(() => {
+    uni.$on('refreshPackTaskDetail', () => {
+        onRefresh();
+    });
+});
 </script>
 <style lang="scss" scoped>
 .card-item-box {
@@ -140,4 +155,39 @@ const onRefresh = () => {
     border-radius: 16rpx;
     border: 1rpx solid #9dd5ab;
 }
+.btn-bottom-bt {
+    width: 208rpx;
+    height: 74rpx;
+    border-radius: 8rpx;
+    border: 1px solid #000;
+    font-size: 26rpx;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+}
+.btn-card-wrapper {
+    position: absolute;
+    left: 20rpx;
+    bottom: -37rpx;
+    right: 20rpx;
+    z-index: 10;
+}
+.ls-style {
+    background-color: #e3fbea;
+    box-shadow: inset 0 0 10px #d2f3da;
+    border-color: #9bd4a9;
+    color: #37a954;
+}
+.ss-style {
+    background-color: #e5fdff;
+    box-shadow: inset 0 0 10px #c7f5f8;
+    border-color: #93e8ee;
+    color: #18beca;
+}
+.fs-style {
+    background-color: #fffaf3;
+    box-shadow: inset 0 0 10px #ffeed7;
+    border-color: #ffd499;
+    color: #fc8834;
+}
 </style>

+ 1 - 0
src/plant/packaging/list/index.vue

@@ -36,6 +36,7 @@
                                             showBatchInfo = true;
                                         "
                                         color="#18BECA"
+                                        :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>

+ 1 - 1
src/plant/print/models/connect-printer.vue

@@ -16,7 +16,7 @@
                 {{ isSearching ? '搜索中...' : '开始搜索' }}
             </up-button>
             <view class="d-flex a-c j-c">
-                <up-button @click="prevSteps" class="mr-30" plain type="primary">上一步</up-button>
+                <up-button v-if="prevStepValue" @click="prevSteps" class="mr-30" plain type="primary">上一步</up-button>
                 <up-button @click="nextSteps" type="primary">下一步</up-button>
             </view>
         </view>

+ 6 - 0
src/plant/print/models/print-wrapper.vue

@@ -2,6 +2,12 @@
     <view class="pd-24">
         <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" />
+                <image v-if="form.printSpec == '60x40'" class="w-670 h-590" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/print-codes/img_60x40.png" mode="widthFix" />
+                <image v-if="form.printSpec == '60x60'" class="w-670 h-590" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/print-codes/img_60x60.png" mode="widthFix" />
+            </view>
             <up-form-item label="打印规格" prop="printSpec" required>
                 <ut-radio :options="specs" v-model="form.printSpec"></ut-radio>
             </up-form-item>

+ 80 - 47
src/plant/print/print-steps/index.vue → src/plant/print/print-all/index.vue

@@ -1,21 +1,19 @@
 <template>
-    <z-paging ref="paging" bgColor="#fff" safe-area-inset-bottom scroll-with-animation>
+    <z-paging ref="paging" bgColor="#f7f7f7" safe-area-inset-bottom scroll-with-animation>
         <template #top>
             <ut-navbar :title="stepsObject[currentStep].title" :fixed="false" border :breadcrumb="false"></ut-navbar>
-            <view class="pd-24">
-                <ut-steps-title :stepsObject="stepsObject"></ut-steps-title>
-            </view>
-            <view class="pd-5 bg-#f7f7f7"></view>
+            <view class="pd-5"></view>
         </template>
         <view>
-            <view v-show="currentStep === 'connect'">
+    
+            <view v-show="currentStep === 'connect'" class="bg-fff">
                 <!-- 业务组件链接打印机 -->
-                <connect-printer :info="stepsObject[currentStep]" @next="nextSteps" @prev="prevSteps" prevStepValue="confirm" nextStepValue="print"></connect-printer>
+                <connect-printer :info="stepsObject[currentStep]" @next="nextSteps" nextStepValue="print"></connect-printer>
             </view>
-            <view v-show="currentStep === 'print'">
+            <view v-show="currentStep === 'print'" class="bg-fff">
                 <!-- 业务组件打印 -->
                 <!-- 打印写入打印机 -->
-                <print-wrapper :info="stepsObject[currentStep]" @test="printTest" @prev="prevSteps" prevStepValue="connect"></print-wrapper>
+                <print-wrapper :info="stepsObject[currentStep]" :printCount="+opts?.endSn - opts?.startSn + 1" @test="printTest" @prev="prevSteps" @print="printCodes" prevStepValue="connect"></print-wrapper>
             </view>
         </view>
     </z-paging>
@@ -27,19 +25,39 @@ import { tem30x30, tem60x40, tem60x60 } from '../models/print-tem';
 import PrintWrapper from '../models/print-wrapper.vue';
 import { writeBLECharacteristicSend } from '@/utils/blue-device-services';
 import jpPrinter from '../models/tspl';
+import { useClientRequest } from '@/utils/request';
+import RangePrint from '../models/range-print.vue';
+const printSpec = ref('30x30');
+const printCodes = async (data: any) => {
+    printSpec.value = data.printSpec;
+    // 检查是否正在打印
+    if (isPrinting.value) {
+        uni.showToast({ icon: 'none', title: '当前打印任务未完成,请稍后' });
+        return;
+    }
+    isPrinting.value = true;
+
+    getPrintCodeList();
+};
+
+// 打印列表
+const getPrintCodeList = async () => {
+    const res = await useClientRequest
+        .get(`/plt-api/app/printLog/getPrintCodeList/${opts.value?.id}`, {
+            start: opts.value?.startSn,
+            end: opts.value?.endSn,
+        })
+        .catch((err) => {
+            isPrinting.value = false;
+        });
+    if (!res || res.code !== 200) {
+        isPrinting.value = false;
+        return;
+    }
+    prepareSend(res?.data, printSpec.value)
+};
 const stepsObject = reactive<any>({
-    check: {
-        title: '核对信息',
-        value: 'check',
-        status: 'completed', // 为开始、进行中、已完成 三种状态分别值为 'not-started'、'in-progress'、'completed'
-        sort: 0,
-    },
-    confirm: {
-        title: '确认数量',
-        value: 'confirm',
-        status: 'completed', // 为开始、进行中、已完成 三种状态分别值为 'not-started'、'in-progress'、'completed'
-        sort: 1,
-    },
+
     connect: {
         title: '连接打印机',
         value: 'connect',
@@ -53,12 +71,14 @@ const stepsObject = reactive<any>({
         sort: 3,
     },
 });
-// 打印模式
-const mode = ref('self'); // 自行打印, 区间打印 值分别为 self, range
 const currentStep = ref('connect');
-const paging = ref(null);
 const isPrinting = ref(false);
-onLoad((options: any) => {});
+const opts = ref<any>(null);
+onLoad((options: any) => {
+    console.log(options);
+    opts.value = options;
+    getBatchInfo()
+});
 const nextSteps = (data: any) => {
     if (!data.info || !data?.info?.value) return;
     stepsObject[data?.info?.value] = {
@@ -67,42 +87,52 @@ const nextSteps = (data: any) => {
     stepsObject[data?.nextStepValue].status = 'in-progress';
     currentStep.value = data?.nextStepValue;
 };
+const info = ref<any>(null);
+const form = ref<any>(null);
+const getFormData = (data: any) => {
+    console.log(data);
+    
+    form.value = data;
+};
 const prevSteps = (data: any) => {
     currentStep.value = data?.prevStepValue;
 };
 const testList = reactive([
     {
-        pm: '三七',
-        zl: '20g',
-        scrq: '2012.09.18',
-        zzph: 87391273912,
-        cj: '云南省文山市县中药材有限公司',
-        zsm: 'QX0000005600000318',
-        qr: 'https://t.zycpzs.cn/?c=QCCS412507030000101ND'
+        padSn: '0000002',
+        prefix: 'PCC1W1260311',
+        sn: 2,
+        traceCode: 'PCC1W12603110000002AV',
+        url: 'https://t.yujin.shuziyunyao.com/pt?c=PCC1W12603110000002AV',
     },
 ]);
 const printTest = (data: any) => {
+    const device = stepsObject['connect']?.device;
+    if (!device) {
+        uni.showToast({ icon: 'none', title: '未连接设备' });
+        return;
+    }
     // 检查是否正在打印
     if (isPrinting.value) {
         uni.showToast({ icon: 'none', title: '当前打印任务未完成,请稍后' });
         return;
     }
+    isPrinting.value = true;
     // 测试数据
     prepareSend(testList, data.printSpec);
 };
 // 打印写入
 const prepareSend = (list: any[], spec: string = '30x30') => {
     if (spec == '30x30') {
-        // 判断idx是否是奇数
         writeSend30x30(list);
     }
     if (spec == '60x40') {
         // 40x40
-        writeSendCommand(list, '60x40', 0)
+        writeSendCommand(list, '60x40', 0);
     }
     if (spec == '60x60') {
         // 30x30
-        writeSendCommand(list, '60x60', 0)
+        writeSendCommand(list, '60x60', 0);
     }
 };
 const writeSend30x30 = (list: any[]) => {
@@ -115,14 +145,11 @@ const writeSend30x30 = (list: any[]) => {
         }
         return acc;
     }, []);
-    writeSendCommand(arr, '30x30', 0)
+    writeSendCommand(arr, '30x30', 0);
 };
 // writeSend
 const writeSendCommand = async (list: any[], spec: string = '30x30', idx = 0) => {
     // 首次调用时设置打印状态为进行中
-    if (idx === 0) {
-        isPrinting.value = true;
-    }
     let command = new jpPrinter();
     if (spec == '30x30') {
         // 判断idx是否是奇数
@@ -130,7 +157,7 @@ const writeSendCommand = async (list: any[], spec: string = '30x30', idx = 0) =>
         command.setGap(10);
         command.setCls();
         command.setDirection(1);
-        command = tem30x30(command, list[idx]);
+        command = tem30x30(command, list[idx], info.value);
     }
     if (spec == '60x40') {
         // 判断idx是否是奇数
@@ -138,7 +165,7 @@ const writeSendCommand = async (list: any[], spec: string = '30x30', idx = 0) =>
         command.setGap(10);
         command.setCls();
         command.setDirection(1);
-        command = tem60x40(command, list[idx]);
+        command = tem60x40(command, list[idx], info.value);
     }
     if (spec == '60x60') {
         // 判断idx是否是奇数
@@ -146,16 +173,16 @@ const writeSendCommand = async (list: any[], spec: string = '30x30', idx = 0) =>
         command.setGap(10);
         command.setCls();
         command.setDirection(1);
-        command = tem60x60(command, list[idx]);
+        command = tem60x60(command, list[idx], info.value);
     }
-    command.setPagePrint()
+    command.setPagePrint();
     const device = stepsObject['connect']?.device;
     if (!device) {
         uni.showToast({ icon: 'none', title: '未连接设备' });
         return;
     }
     console.log(command.getData());
-    
+
     await writeBLECharacteristicSend({
         deviceId: device.deviceId,
         serviceId: device.serviceId,
@@ -163,16 +190,22 @@ const writeSendCommand = async (list: any[], spec: string = '30x30', idx = 0) =>
         uint8Array: command.getData(),
     });
     if (list.length - 1 > idx) {
-        writeSendCommand(list, spec, idx + 1)
+        writeSendCommand(list, spec, idx + 1);
     } else {
         // 打印完成,重置状态
         isPrinting.value = false;
         uni.showToast({
             icon: 'none',
-            title: '打印完成'
-        })
+            title: '打印完成',
+        });
     }
 };
+// 获取批次信息接口
+const getBatchInfo = async () => {
+    const res = await useClientRequest.get(`/plt-api/app/packTask/getPackTraceSimpleInfo/${opts.value?.packId}`);
+    if (!res?.data) return
+    info.value = res?.data;
+}
 // 如果是 30x30
 </script>
 <style lang="scss" scoped></style>

+ 2 - 3
src/plant/print/print-range/index.vue

@@ -15,7 +15,7 @@
             <view v-show="currentStep === 'print'" class="bg-fff">
                 <!-- 业务组件打印 -->
                 <!-- 打印写入打印机 -->
-                <print-wrapper :info="stepsObject[currentStep]" :printCount="form?.printCount" @test="printTest" @prev="prevSteps" @print="printCodes" prevStepValue="connect"></print-wrapper>
+                <print-wrapper :info="stepsObject[currentStep]" :printCount="+form?.end - +form?.start + 1" @test="printTest" @prev="prevSteps" @print="printCodes" prevStepValue="connect"></print-wrapper>
             </view>
         </view>
     </z-paging>
@@ -78,8 +78,7 @@ const stepsObject = reactive<any>({
         sort: 3,
     },
 });
-
-const currentStep = ref('connect');
+const currentStep = ref('range');
 const isPrinting = ref(false);
 const opts = ref<any>(null);
 onLoad((options: any) => {

+ 1 - 0
src/plant/print/print-self/index.vue

@@ -61,6 +61,7 @@ const printCodes = async (data: any) => {
         return;
     }
     uni.$emit('refreshPackTaskList');
+    uni.$emit('refreshPackTaskDetail');
     getPrintCodeList(res.data);
 };