huangxw преди 1 седмица
родител
ревизия
3a80e58935

+ 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>

+ 19 - 4
src/plant/export-print/export/index.vue

@@ -10,11 +10,11 @@
         <view>
             <view v-show="currentStep === 'check'">
                 <!-- 业务组件核对信息 -->
-                <check-info-pack v-if="opts" :opts="opts" :info="stepsObject[currentStep]"></check-info-pack>
+                <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>
@@ -24,7 +24,8 @@
 <script setup lang="ts">
 import CheckInfoPack from '@/plant/print/models/check-info-pack.vue';
 import { useClientRequest } from '@/utils/request';
-const currentStep = ref('check');
+import ExportPrintConfirm from '@/plant/export-print/models/export-print-confirm.vue';
+const currentStep = ref('export');
 const stepsObject = reactive<any>({
     check: {
         title: '核对信息',
@@ -32,7 +33,7 @@ const stepsObject = reactive<any>({
         status: 'in-progress', // 为开始、进行中、已完成 三种状态分别值为 'not-started'、'in-progress'、'completed'
         sort: 0,
     },
-    confirm: {
+    export: {
         title: '导出追溯码',
         value: 'export',
         status: 'not-started', // 为开始、进行中、已完成 三种状态分别值为 'not-started'、'in-progress'、'completed'
@@ -43,6 +44,20 @@ 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>

+ 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({