|
|
@@ -2,7 +2,7 @@
|
|
|
<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>
|
|
|
+ <slot name="fileType"></slot>
|
|
|
<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>
|
|
|
@@ -12,47 +12,76 @@
|
|
|
</template>
|
|
|
</up-form-item>
|
|
|
</ut-action-sheet>
|
|
|
- <!-- 导出格式 -->
|
|
|
- <view class="h-1" id="fileFormatpppp"></view>
|
|
|
+ <template v-if="form.extraInfo.fileType == '2'">
|
|
|
+ <slot name="logos"></slot>
|
|
|
+ <up-form-item borderBottom prop="extraInfo.logos">
|
|
|
+ <view class="flex1">
|
|
|
+ <view class="p-rtv mb-20">
|
|
|
+ <span class="form-item-label_required">*</span>
|
|
|
+ <span class="f-s-30 c-#333">打印logo</span>
|
|
|
+ <span class="f-s-24 c-#999">(最多2种)</span>
|
|
|
+ </view>
|
|
|
+ <codeCheckedLogos v-model="form.extraInfo.logos"></codeCheckedLogos>
|
|
|
+ </view>
|
|
|
+ </up-form-item>
|
|
|
+ <slot name="fields"></slot>
|
|
|
+ <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' }" disabled label="溯源码码值" name="code"></up-checkbox>
|
|
|
+ <up-checkbox :customStyle="{ width: '33%', marginBottom: '8px' }" disabled label="溯源码图" name="qrcode"></up-checkbox>
|
|
|
+ <up-checkbox v-if="+info?.gapFlag" :customStyle="{ marginBottom: '8px' }" label="是否符合GAP要求" name="gapFlag"></up-checkbox>
|
|
|
+ </up-checkbox-group>
|
|
|
+ </view>
|
|
|
+ </up-form-item>
|
|
|
+
|
|
|
+ <slot name="layoutType"></slot>
|
|
|
+ <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" :logos="form.extraInfo.logos" :info="infoData" :layoutType="form.extraInfo.layoutType"></codeStyleTem>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </up-form-item>
|
|
|
+ <!-- 导出数量 -->
|
|
|
+
|
|
|
+ <slot name="printCount"></slot>
|
|
|
+ <up-form-item :label="`导出数量`" prop="printCount" required borderBottom>
|
|
|
+ <up-input v-model="form.printCount" placeholder="请输入导出数量" border="none" clearable></up-input>
|
|
|
+ <template #right>
|
|
|
+ <span class="f-s-30 f-w-5 c-#333">{{ opts?.unit || form?.unit || 'kg' }}</span>
|
|
|
+ </template>
|
|
|
+ </up-form-item>
|
|
|
+ <!-- 邮箱 -->
|
|
|
+ <slot name="email"></slot>
|
|
|
+ <up-form-item borderBottom required label="邮箱" prop="extraInfo.email">
|
|
|
+ <up-input v-model="form.extraInfo.email" placeholder="请输入邮箱" border="none" clearable></up-input>
|
|
|
+ </up-form-item>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <slot name="fileFormat"></slot>
|
|
|
<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>
|
|
|
@@ -60,12 +89,14 @@
|
|
|
</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>
|
|
|
+ <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';
|
|
|
+import codeCheckedLogos from './code-checked-logos.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();
|
|
|
@@ -95,41 +126,114 @@ const props = defineProps({
|
|
|
type: Object,
|
|
|
default: () => null,
|
|
|
},
|
|
|
+ paging: {
|
|
|
+ type: Object,
|
|
|
+ default: () => null,
|
|
|
+ },
|
|
|
});
|
|
|
const upFormUpRef = ref();
|
|
|
const emit = defineEmits(['next', 'prev', 'formdata']);
|
|
|
-const form = ref({
|
|
|
+const form = ref<any>({
|
|
|
+ printCount: props.opts?.printedCount,
|
|
|
extraInfo: {
|
|
|
- fileType: '1',
|
|
|
+ fileType: '2',
|
|
|
fileFormat: '1',
|
|
|
logos: [], // 导出logo
|
|
|
// 只有禁用的默认有值,
|
|
|
- fields: ['proName', 'batchSn', 'proSpecn', 'proAdcodeDesc', 'specn', 'cpyName', 'qrcode'], // 导出字段
|
|
|
+ fields: ['proName', 'batchSn', 'proSpecn', 'proAdcodeDesc', 'specn', 'cpyName', 'code', 'qrcode'], // 导出字段
|
|
|
layoutType: '2', // 排版类型
|
|
|
+ email: '',
|
|
|
},
|
|
|
printPerson: infoStore.userInfo?.name, // 导出人
|
|
|
});
|
|
|
-const rules = reactive({});
|
|
|
+const rules = reactive({
|
|
|
+ 'extraInfo.fileType': [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请选择导出类型',
|
|
|
+ trigger: 'change',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ 'extraInfo.logos': [
|
|
|
+ {
|
|
|
+ type: 'array',
|
|
|
+ required: true,
|
|
|
+ message: '请选择导出logo',
|
|
|
+ trigger: 'change',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'array',
|
|
|
+ max: 2,
|
|
|
+ message: '最多选择2个logo',
|
|
|
+ trigger: 'change',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ 'extraInfo.layoutType': [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请选择排版类型',
|
|
|
+ trigger: 'change',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ printCount: [
|
|
|
+ { required: true, message: '请输入导出数量' },
|
|
|
+ // 只能输入大于0的正整数
|
|
|
+ { pattern: /^[1-9]\d*$/, message: '请输入大于0的正整数' },
|
|
|
+ // 打印数量不能大于剩余可打印数量
|
|
|
+ {
|
|
|
+ asyncValidator: (rule: any, value: any) => {
|
|
|
+ if (value === undefined || value === null || value === '') return Promise.resolve();
|
|
|
+ const num = Number(value);
|
|
|
+ if (Number.isNaN(num)) return Promise.reject('导出数量请输入数字');
|
|
|
+ if (num <= 0) return Promise.reject('导出数量需大于0');
|
|
|
+ // 打印数量不能大于剩余可打印数量
|
|
|
+ if (+props?.opts?.printedCount < +num) {
|
|
|
+ return Promise.reject(`导出数量不能超过待打印数量`);
|
|
|
+ }
|
|
|
+ return Promise.resolve();
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ 'extraInfo.email': [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请输入邮箱',
|
|
|
+ trigger: 'blur',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ asyncValidator: (rule: any, value: any) => {
|
|
|
+ // 邮箱校验
|
|
|
+ const reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
|
|
|
+ if (reg.test(value)) {
|
|
|
+ return Promise.resolve();
|
|
|
+ } else {
|
|
|
+ return Promise.reject('请输入正确的邮箱');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ 'extraInfo.fileFormat': [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请选择导出格式',
|
|
|
+ trigger: 'change',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+});
|
|
|
const changeExtraFileType = (val: any) => {
|
|
|
- console.log(val);
|
|
|
form.value.extraInfo.fileFormat = val;
|
|
|
};
|
|
|
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;
|
|
|
}
|
|
|
- emit('formdata', {
|
|
|
- ...form.value,
|
|
|
- });
|
|
|
- emit('next', {
|
|
|
- info: {
|
|
|
- ...props.info,
|
|
|
- status: 'completed',
|
|
|
- },
|
|
|
- nextStepValue: props.nextStepValue || 'print',
|
|
|
- });
|
|
|
};
|
|
|
const prevSteps = () => {
|
|
|
emit('prev', {
|