|
@@ -1,197 +1,224 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <Navbar title="卡片打印" :is-go-back="true" />
|
|
|
|
|
- <div class="printDiv">
|
|
|
|
|
- <div>
|
|
|
|
|
- <span style="color: red"> * </span>
|
|
|
|
|
- <label>导入批次:</label>
|
|
|
|
|
- <a-select
|
|
|
|
|
- v-model:value="queryParams.batchNo"
|
|
|
|
|
- show-search
|
|
|
|
|
- class="commonStyle"
|
|
|
|
|
- :options="batchNos.map((item) => ({ value: item.label }))"
|
|
|
|
|
- @change="searchPrintInfo"
|
|
|
|
|
- />
|
|
|
|
|
- <label>保管人员:</label>
|
|
|
|
|
- <a-select
|
|
|
|
|
- v-model:value="queryParams.depositoryUser"
|
|
|
|
|
- show-search
|
|
|
|
|
- class="commonStyle"
|
|
|
|
|
- :options="depositoryUsers.map((item) => ({ value: item.label }))"
|
|
|
|
|
- @change="searchPrintInfo"
|
|
|
|
|
- />
|
|
|
|
|
- <label>打印状态:</label>
|
|
|
|
|
- <a-select
|
|
|
|
|
- v-model:value="status"
|
|
|
|
|
- show-search
|
|
|
|
|
- class="commonStyle"
|
|
|
|
|
- :options="
|
|
|
|
|
- statusOptions.map((item) => ({
|
|
|
|
|
- value: `${item.value}-${item.label}`,
|
|
|
|
|
- label: item.label,
|
|
|
|
|
- }))
|
|
|
|
|
- "
|
|
|
|
|
- @change="searchPrintInfo"
|
|
|
|
|
- />
|
|
|
|
|
- </div>
|
|
|
|
|
- <div style="margin: 8px 0 0 9px">
|
|
|
|
|
- <label>公司名称:</label>
|
|
|
|
|
- <a-select
|
|
|
|
|
- v-model:value="queryParams.clientName"
|
|
|
|
|
- show-search
|
|
|
|
|
- class="commonStyle"
|
|
|
|
|
- :options="clientNames.map((item) => ({ value: item.label }))"
|
|
|
|
|
- @change="searchPrintInfo"
|
|
|
|
|
- />
|
|
|
|
|
- <label>所属部门:</label>
|
|
|
|
|
- <a-select
|
|
|
|
|
- v-model:value="queryParams.organizationName"
|
|
|
|
|
- show-search
|
|
|
|
|
- class="commonStyle"
|
|
|
|
|
- :options="organizationNames.map((item) => ({ value: item.label }))"
|
|
|
|
|
- @change="searchPrintInfo"
|
|
|
|
|
- />
|
|
|
|
|
- <label>成本中心:</label>
|
|
|
|
|
- <a-select
|
|
|
|
|
- v-model:value="queryParams.costCenterName"
|
|
|
|
|
- show-search
|
|
|
|
|
- class="commonStyle"
|
|
|
|
|
- :options="costCenterNames.map((item) => ({ value: item.label }))"
|
|
|
|
|
- @change="searchPrintInfo"
|
|
|
|
|
- />
|
|
|
|
|
- <a-button type="primary" @click="searchPrintInfo">查询</a-button>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div style="margin: 8px 0 0 9px">
|
|
|
|
|
- <label>打印模板:</label>
|
|
|
|
|
- <a-select
|
|
|
|
|
- v-model:value="printTemplate"
|
|
|
|
|
- show-search
|
|
|
|
|
- class="commonStyle"
|
|
|
|
|
- :options="
|
|
|
|
|
- templateNames.map((item) => ({
|
|
|
|
|
- value: `${item.id}-${item.name}`,
|
|
|
|
|
- label: item.name,
|
|
|
|
|
- }))
|
|
|
|
|
- "
|
|
|
|
|
- />
|
|
|
|
|
- <a-button
|
|
|
|
|
- type="dashed"
|
|
|
|
|
- style="margin-right: 16px"
|
|
|
|
|
- @click="imageVisible = true"
|
|
|
|
|
- >
|
|
|
|
|
- 打印预览
|
|
|
|
|
- </a-button>
|
|
|
|
|
- <a-button type="dashed" style="margin-right: 16px" @click="showPrintInfo">
|
|
|
|
|
- 打印
|
|
|
|
|
- </a-button>
|
|
|
|
|
- </div>
|
|
|
|
|
- <a-divider />
|
|
|
|
|
- <CommonTable
|
|
|
|
|
- :total="total"
|
|
|
|
|
- :columns="columns"
|
|
|
|
|
- :is-loading="isLoading"
|
|
|
|
|
- :is-select="isSelect"
|
|
|
|
|
- :data-source="dataSource"
|
|
|
|
|
- @select-column="selectColumn"
|
|
|
|
|
- @page-params="getPageParams"
|
|
|
|
|
- >
|
|
|
|
|
- <template #bodyCell="{ column, record }">
|
|
|
|
|
- <template v-if="column.key === 'imageUrl'">
|
|
|
|
|
- <a-image :width="100" :height="50" :src="record.imageUrl" />
|
|
|
|
|
- </template>
|
|
|
|
|
- </template>
|
|
|
|
|
- </CommonTable>
|
|
|
|
|
- <a-modal
|
|
|
|
|
- v-model:visible="printVisible"
|
|
|
|
|
- title="包装信息"
|
|
|
|
|
- ok-text="确认"
|
|
|
|
|
- cancel-text="取消"
|
|
|
|
|
- @ok="printCard"
|
|
|
|
|
- >
|
|
|
|
|
- <label>包装批号:</label>
|
|
|
|
|
- <a-input
|
|
|
|
|
- id="displayName"
|
|
|
|
|
- v-model:value="packageBatchNo"
|
|
|
|
|
- :disabled="true"
|
|
|
|
|
- />
|
|
|
|
|
- <label>上次的批号:</label>
|
|
|
|
|
- <a-input
|
|
|
|
|
- id="displayName"
|
|
|
|
|
- v-model:value="lastPackageBatchNo"
|
|
|
|
|
- :disabled="true"
|
|
|
|
|
- />
|
|
|
|
|
- <label>包装名称:</label>
|
|
|
|
|
- <a-input id="displayName" v-model:value="packageName" :disabled="true" />
|
|
|
|
|
- <label>上次的名称:</label>
|
|
|
|
|
- <a-input
|
|
|
|
|
- id="displayName"
|
|
|
|
|
- v-model:value="lastPackageName"
|
|
|
|
|
- :disabled="true"
|
|
|
|
|
- />
|
|
|
|
|
- <div class="operationBtn">
|
|
|
|
|
- <a-button type="dashed" style="width: 240px" @click="lastTime">
|
|
|
|
|
- 同上一次
|
|
|
|
|
- </a-button>
|
|
|
|
|
- <a-button
|
|
|
|
|
- type="dashed"
|
|
|
|
|
- style="width: 240px; margin-left: 4px"
|
|
|
|
|
- @click="createNew"
|
|
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <div v-show="printing">
|
|
|
|
|
+ <Navbar title="卡片打印" :is-go-back="true" />
|
|
|
|
|
+ <div class="printDiv">
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <span style="color: red"> * </span>
|
|
|
|
|
+ <label>导入批次:</label>
|
|
|
|
|
+ <a-select
|
|
|
|
|
+ v-model:value="queryParams.batchNo"
|
|
|
|
|
+ show-search
|
|
|
|
|
+ class="commonStyle"
|
|
|
|
|
+ :options="batchNos.map((item) => ({ value: item.label }))"
|
|
|
|
|
+ @change="searchPrintInfo"
|
|
|
|
|
+ />
|
|
|
|
|
+ <label>保管人员:</label>
|
|
|
|
|
+ <a-select
|
|
|
|
|
+ v-model:value="queryParams.depositoryUser"
|
|
|
|
|
+ show-search
|
|
|
|
|
+ class="commonStyle"
|
|
|
|
|
+ :options="depositoryUsers.map((item) => ({ value: item.label }))"
|
|
|
|
|
+ @change="searchPrintInfo"
|
|
|
|
|
+ />
|
|
|
|
|
+ <label>打印状态:</label>
|
|
|
|
|
+ <a-select
|
|
|
|
|
+ v-model:value="status"
|
|
|
|
|
+ show-search
|
|
|
|
|
+ class="commonStyle"
|
|
|
|
|
+ :options="
|
|
|
|
|
+ statusOptions.map((item) => ({
|
|
|
|
|
+ value: `${item.value}-${item.label}`,
|
|
|
|
|
+ label: item.label,
|
|
|
|
|
+ }))
|
|
|
|
|
+ "
|
|
|
|
|
+ @change="searchPrintInfo"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div style="margin: 8px 0 0 9px">
|
|
|
|
|
+ <label>公司名称:</label>
|
|
|
|
|
+ <a-select
|
|
|
|
|
+ v-model:value="queryParams.clientName"
|
|
|
|
|
+ show-search
|
|
|
|
|
+ class="commonStyle"
|
|
|
|
|
+ :options="clientNames.map((item) => ({ value: item.label }))"
|
|
|
|
|
+ @change="searchPrintInfo"
|
|
|
|
|
+ />
|
|
|
|
|
+ <label>所属部门:</label>
|
|
|
|
|
+ <a-select
|
|
|
|
|
+ v-model:value="queryParams.organizationName"
|
|
|
|
|
+ show-search
|
|
|
|
|
+ class="commonStyle"
|
|
|
|
|
+ :options="organizationNames.map((item) => ({ value: item.label }))"
|
|
|
|
|
+ @change="searchPrintInfo"
|
|
|
|
|
+ />
|
|
|
|
|
+ <label>成本中心:</label>
|
|
|
|
|
+ <a-select
|
|
|
|
|
+ v-model:value="queryParams.costCenterName"
|
|
|
|
|
+ show-search
|
|
|
|
|
+ class="commonStyle"
|
|
|
|
|
+ :options="costCenterNames.map((item) => ({ value: item.label }))"
|
|
|
|
|
+ @change="searchPrintInfo"
|
|
|
|
|
+ />
|
|
|
|
|
+ <a-button type="primary" @click="searchPrintInfo">查询</a-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div style="margin: 8px 0 0 9px">
|
|
|
|
|
+ <label>打印模板:</label>
|
|
|
|
|
+ <a-select
|
|
|
|
|
+ v-model:value="printTemplate"
|
|
|
|
|
+ show-search
|
|
|
|
|
+ class="commonStyle"
|
|
|
|
|
+ :options="
|
|
|
|
|
+ templateNames.map((item) => ({
|
|
|
|
|
+ value: `${item.id}-${item.name}`,
|
|
|
|
|
+ label: item.name,
|
|
|
|
|
+ }))
|
|
|
|
|
+ "
|
|
|
|
|
+ @change="getTemplateInfo"
|
|
|
|
|
+ />
|
|
|
|
|
+ <a-button
|
|
|
|
|
+ type="dashed"
|
|
|
|
|
+ style="margin-right: 16px"
|
|
|
|
|
+ @click="printPreview"
|
|
|
|
|
+ >
|
|
|
|
|
+ 打印预览
|
|
|
|
|
+ </a-button>
|
|
|
|
|
+ <a-button
|
|
|
|
|
+ type="dashed"
|
|
|
|
|
+ style="margin-right: 16px"
|
|
|
|
|
+ @click="showPrintInfo"
|
|
|
|
|
+ >
|
|
|
|
|
+ 打印
|
|
|
|
|
+ </a-button>
|
|
|
|
|
+ <a-button type="dashed" @click="downloadImage"> 下载全部 </a-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <a-divider />
|
|
|
|
|
+ <CommonTable
|
|
|
|
|
+ ref="tables"
|
|
|
|
|
+ :total="total"
|
|
|
|
|
+ :columns="columns"
|
|
|
|
|
+ :is-loading="isLoading"
|
|
|
|
|
+ :is-select="isSelect"
|
|
|
|
|
+ :data-source="dataSource"
|
|
|
|
|
+ @select-column="selectColumn"
|
|
|
|
|
+ @page-params="getPageParams"
|
|
|
>
|
|
>
|
|
|
- 生成新的
|
|
|
|
|
- </a-button>
|
|
|
|
|
- </div>
|
|
|
|
|
- </a-modal>
|
|
|
|
|
- <a-modal
|
|
|
|
|
- v-model:visible="imageVisible"
|
|
|
|
|
- title="打印预览"
|
|
|
|
|
- ok-text="确认"
|
|
|
|
|
- cancel-text="取消"
|
|
|
|
|
- :body-style="bodyStyle"
|
|
|
|
|
- @ok="imageVisible = false"
|
|
|
|
|
- >
|
|
|
|
|
- <a-image
|
|
|
|
|
- :preview="{ visible: false }"
|
|
|
|
|
- :width="200"
|
|
|
|
|
- class="image"
|
|
|
|
|
- :src="imageUrls[0]"
|
|
|
|
|
- @click="visible = true"
|
|
|
|
|
- />
|
|
|
|
|
- <div style="display: none">
|
|
|
|
|
- <a-image-preview-group
|
|
|
|
|
- :preview="{ visible, onVisibleChange: (vis) => (visible = vis) }"
|
|
|
|
|
|
|
+ <template #bodyCell="{ column, record }">
|
|
|
|
|
+ <template v-if="column.key === 'imageUrl'">
|
|
|
|
|
+ <a-image
|
|
|
|
|
+ :width="100"
|
|
|
|
|
+ :height="50"
|
|
|
|
|
+ :src="getImageSrc(className, record.imageUrl)"
|
|
|
|
|
+ />
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </CommonTable>
|
|
|
|
|
+ <a-modal
|
|
|
|
|
+ v-model:visible="printVisible"
|
|
|
|
|
+ title="包装信息"
|
|
|
|
|
+ ok-text="确认"
|
|
|
|
|
+ cancel-text="取消"
|
|
|
|
|
+ @ok="printCard"
|
|
|
>
|
|
>
|
|
|
- <a-image v-for="item in imageUrls" :key="item" :src="item" />
|
|
|
|
|
- </a-image-preview-group>
|
|
|
|
|
|
|
+ <label>包装批号:</label>
|
|
|
|
|
+ <a-input
|
|
|
|
|
+ id="displayName"
|
|
|
|
|
+ v-model:value="packageBatchNo"
|
|
|
|
|
+ :disabled="true"
|
|
|
|
|
+ />
|
|
|
|
|
+ <label>上次的批号:</label>
|
|
|
|
|
+ <a-input
|
|
|
|
|
+ id="displayName"
|
|
|
|
|
+ v-model:value="lastPackageBatchNo"
|
|
|
|
|
+ :disabled="true"
|
|
|
|
|
+ />
|
|
|
|
|
+ <label>包装名称:</label>
|
|
|
|
|
+ <a-input
|
|
|
|
|
+ id="displayName"
|
|
|
|
|
+ v-model:value="packageName"
|
|
|
|
|
+ :disabled="true"
|
|
|
|
|
+ />
|
|
|
|
|
+ <label>上次的名称:</label>
|
|
|
|
|
+ <a-input
|
|
|
|
|
+ id="displayName"
|
|
|
|
|
+ v-model:value="lastPackageName"
|
|
|
|
|
+ :disabled="true"
|
|
|
|
|
+ />
|
|
|
|
|
+ <div class="operationBtn">
|
|
|
|
|
+ <a-button type="dashed" style="width: 240px" @click="lastTime">
|
|
|
|
|
+ 同上一次
|
|
|
|
|
+ </a-button>
|
|
|
|
|
+ <a-button
|
|
|
|
|
+ type="dashed"
|
|
|
|
|
+ style="width: 240px; margin-left: 4px"
|
|
|
|
|
+ @click="createNew"
|
|
|
|
|
+ >
|
|
|
|
|
+ 生成新的
|
|
|
|
|
+ </a-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </a-modal>
|
|
|
|
|
+ <a-modal
|
|
|
|
|
+ v-model:visible="imageVisible"
|
|
|
|
|
+ title="打印预览"
|
|
|
|
|
+ ok-text="确认"
|
|
|
|
|
+ cancel-text="取消"
|
|
|
|
|
+ :body-style="bodyStyle"
|
|
|
|
|
+ @ok="imageVisible = false"
|
|
|
|
|
+ >
|
|
|
|
|
+ <a-image
|
|
|
|
|
+ :preview="{ visible: false }"
|
|
|
|
|
+ :width="200"
|
|
|
|
|
+ class="image"
|
|
|
|
|
+ :src="imageUrls[0]"
|
|
|
|
|
+ @click="visible = true"
|
|
|
|
|
+ />
|
|
|
|
|
+ <div style="display: none">
|
|
|
|
|
+ <a-image-preview-group
|
|
|
|
|
+ :preview="{ visible, onVisibleChange: (vis) => (visible = vis) }"
|
|
|
|
|
+ >
|
|
|
|
|
+ <a-image v-for="item in imageUrls" :key="item" :src="item" />
|
|
|
|
|
+ </a-image-preview-group>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <template #footer />
|
|
|
|
|
+ </a-modal>
|
|
|
|
|
+ <Loading v-if="globalLoading" />
|
|
|
</div>
|
|
</div>
|
|
|
- </a-modal>
|
|
|
|
|
|
|
+ </div>
|
|
|
<div ref="hua" style="float: left; z-index: -999" />
|
|
<div ref="hua" style="float: left; z-index: -999" />
|
|
|
- <Loading v-if="globalLoading" />
|
|
|
|
|
|
|
+ <a-modal v-model:visible="modelVisible" title="正在打印中">
|
|
|
|
|
+ <p>正在打印中,请稍等....</p>
|
|
|
|
|
+ <template #footer />
|
|
|
|
|
+ </a-modal>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
|
|
+import AuthImage from '../widget/AuthImage.vue';
|
|
|
import CommonTable from './CommonTable.vue';
|
|
import CommonTable from './CommonTable.vue';
|
|
|
import Common from '../common/Common';
|
|
import Common from '../common/Common';
|
|
|
import { message } from 'ant-design-vue';
|
|
import { message } from 'ant-design-vue';
|
|
|
-import { ref, reactive, onMounted } from 'vue';
|
|
|
|
|
|
|
+import { ref, reactive, onMounted, watch } from 'vue';
|
|
|
|
|
+import CreateJPEG from '../common/X6';
|
|
|
|
|
+import { base64toFile, downloadImages } from '../common/X6';
|
|
|
|
|
+import { SqlApi, Notify } from 'pc-component-v3';
|
|
|
|
|
+import { getImageSrc } from '../common/image-src';
|
|
|
|
|
+import Download from '../resource/file/DownloadService';
|
|
|
import {
|
|
import {
|
|
|
columns,
|
|
columns,
|
|
|
dateConvert,
|
|
dateConvert,
|
|
|
multipleImageUpload,
|
|
multipleImageUpload,
|
|
|
getTemplate,
|
|
getTemplate,
|
|
|
} from './config';
|
|
} from './config';
|
|
|
-import CreateJPEG from '../common/X6';
|
|
|
|
|
-import { SqlApi, Notify } from 'pc-component-v3';
|
|
|
|
|
-import { getImageSrc } from '../common/image-src';
|
|
|
|
|
|
|
|
|
|
-const imageUrls = reactive([
|
|
|
|
|
- 'https://gw.alipayobjects.com/zos/antfincdn/LlvErxo8H9/photo-1503185912284-5271ff81b9a8.webp',
|
|
|
|
|
- 'https://gw.alipayobjects.com/zos/antfincdn/cV16ZqzMjW/photo-1473091540282-9b846e7965e3.webp',
|
|
|
|
|
- 'https://gw.alipayobjects.com/zos/antfincdn/x43I27A55%26/photo-1438109491414-7198515b166b.webp',
|
|
|
|
|
-]);
|
|
|
|
|
|
|
+const className = ref('com.leanwo.prodog.print.model.LabelPrintLine');
|
|
|
|
|
+const tables = ref(null);
|
|
|
|
|
+const imageUrls = reactive([]);
|
|
|
|
|
+const modelVisible = ref(false);
|
|
|
|
|
+const printing = ref(true);
|
|
|
const total = ref(0);
|
|
const total = ref(0);
|
|
|
const isSelect = ref(true);
|
|
const isSelect = ref(true);
|
|
|
const isLoading = ref(false);
|
|
const isLoading = ref(false);
|
|
|
-const selectedRows = ref([]);
|
|
|
|
|
|
|
+const select = reactive({ selectedRows: [] });
|
|
|
const dataSource = ref([]);
|
|
const dataSource = ref([]);
|
|
|
const printVisible = ref(false);
|
|
const printVisible = ref(false);
|
|
|
const imageVisible = ref(false);
|
|
const imageVisible = ref(false);
|
|
@@ -239,7 +266,7 @@ const pager = reactive({
|
|
|
});
|
|
});
|
|
|
const templateId = ref('');
|
|
const templateId = ref('');
|
|
|
const allTemplate = ref([]);
|
|
const allTemplate = ref([]);
|
|
|
-const templateData = ref([]);
|
|
|
|
|
|
|
+const templateData = ref(null);
|
|
|
const lastBatchNo = ref('');
|
|
const lastBatchNo = ref('');
|
|
|
const printTemplate = ref('');
|
|
const printTemplate = ref('');
|
|
|
const templateNames = ref([]);
|
|
const templateNames = ref([]);
|
|
@@ -249,7 +276,7 @@ const packageName = ref('');
|
|
|
const lastPackageName = ref('');
|
|
const lastPackageName = ref('');
|
|
|
const newPackageName = ref('');
|
|
const newPackageName = ref('');
|
|
|
const hua = ref(null);
|
|
const hua = ref(null);
|
|
|
-let getImageData;
|
|
|
|
|
|
|
+let getBase64;
|
|
|
// 获取分页
|
|
// 获取分页
|
|
|
const getPageParams = (start, length) => {
|
|
const getPageParams = (start, length) => {
|
|
|
pager.start = (start - 1) * length;
|
|
pager.start = (start - 1) * length;
|
|
@@ -272,9 +299,6 @@ const searchPrintInfo = () => {
|
|
|
const { lines, errorMessage, errorCode } = successData;
|
|
const { lines, errorMessage, errorCode } = successData;
|
|
|
if (errorCode == 0) {
|
|
if (errorCode == 0) {
|
|
|
total.value = successData.total;
|
|
total.value = successData.total;
|
|
|
- lines.forEach(item => {
|
|
|
|
|
- item.key = item.id;
|
|
|
|
|
- });
|
|
|
|
|
dataSource.value = lines;
|
|
dataSource.value = lines;
|
|
|
isLoading.value = false;
|
|
isLoading.value = false;
|
|
|
} else {
|
|
} else {
|
|
@@ -300,8 +324,8 @@ const searchPrintInfo = () => {
|
|
|
};
|
|
};
|
|
|
// 获取所选项的数据
|
|
// 获取所选项的数据
|
|
|
const selectColumn = rows => {
|
|
const selectColumn = rows => {
|
|
|
- selectedRows.value = rows;
|
|
|
|
|
- console.log('onSelectChange', selectedRows.value);
|
|
|
|
|
|
|
+ select.selectedRows = rows;
|
|
|
|
|
+ console.log('onSelectChange', select.selectedRows);
|
|
|
};
|
|
};
|
|
|
// 展开打印框
|
|
// 展开打印框
|
|
|
const showPrintInfo = () => {
|
|
const showPrintInfo = () => {
|
|
@@ -330,57 +354,56 @@ const lastTime = () => {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-// const base64toFile = (url, imageName) => {
|
|
|
|
|
-// const arr = url.split(',');
|
|
|
|
|
-// const mime = arr[0].match(/.*?:(.*?);/)[1];
|
|
|
|
|
-// const suffix = mime.split('/')[1];
|
|
|
|
|
-// const bstr = window.atob(arr[1]);
|
|
|
|
|
-// let n = bstr.length;
|
|
|
|
|
-// const u8arr = new Uint8Array(n);
|
|
|
|
|
-// while (n--) {
|
|
|
|
|
-// u8arr[n] = bstr.charCodeAt(n);
|
|
|
|
|
-// }
|
|
|
|
|
-// return new File([u8arr], `${imageName}.${suffix}`, {
|
|
|
|
|
-// type: 'multipart/form-data',
|
|
|
|
|
-// });
|
|
|
|
|
-// };
|
|
|
|
|
-
|
|
|
|
|
// 生产新的包装信息
|
|
// 生产新的包装信息
|
|
|
const createNew = () => {
|
|
const createNew = () => {
|
|
|
packageBatchNo.value = dateConvert(new Date());
|
|
packageBatchNo.value = dateConvert(new Date());
|
|
|
packageName.value = newPackageName.value;
|
|
packageName.value = newPackageName.value;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-// 确认打印
|
|
|
|
|
-const printCard = () => {
|
|
|
|
|
- globalLoading.value = true;
|
|
|
|
|
- const formData = new FormData();
|
|
|
|
|
|
|
+// 获取模板数据及 ID
|
|
|
|
|
+const getTemplateInfo = async () => {
|
|
|
templateId.value = printTemplate.value.slice(
|
|
templateId.value = printTemplate.value.slice(
|
|
|
0,
|
|
0,
|
|
|
printTemplate.value.indexOf('-'),
|
|
printTemplate.value.indexOf('-'),
|
|
|
);
|
|
);
|
|
|
allTemplate.value.forEach(item => {
|
|
allTemplate.value.forEach(item => {
|
|
|
if (item.id == templateId.value) {
|
|
if (item.id == templateId.value) {
|
|
|
- templateData.value = JSON.stringify(item.contentX6);
|
|
|
|
|
|
|
+ templateData.value = item.contentX6;
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
+};
|
|
|
|
|
|
|
|
- selectedRows.value.forEach(async item => {
|
|
|
|
|
- item.number = item.assetNo;
|
|
|
|
|
- item.name = item.assetName;
|
|
|
|
|
- item.unit = item.depositoryUser;
|
|
|
|
|
- item.keeper = item.organizationName;
|
|
|
|
|
- item.EPC = item.depositoryUser;
|
|
|
|
|
- item.BarCode =
|
|
|
|
|
- 'https://rfid.fa.sjtu.edu.cn/c/5C5CFA24F72542B8910F247BA014DDBB';
|
|
|
|
|
- let base64 = await getImageData(item, templateData.value);
|
|
|
|
|
- console.log('图片base64:',base64);
|
|
|
|
|
- });
|
|
|
|
|
|
|
+// 打印预览
|
|
|
|
|
+const printPreview = async () => {
|
|
|
|
|
+ imageVisible.value = true;
|
|
|
|
|
+ printing.value = false;
|
|
|
|
|
+ imageUrls.length = 0;
|
|
|
|
|
+ let tempStr = JSON.stringify(templateData.value);
|
|
|
|
|
+ const rows = JSON.parse(JSON.stringify(select.selectedRows));
|
|
|
|
|
+ for (let key in rows) {
|
|
|
|
|
+ let base64 = await getBase64(rows[key], tempStr);
|
|
|
|
|
+ imageUrls.push(base64);
|
|
|
|
|
+ }
|
|
|
|
|
+ printing.value = true;
|
|
|
|
|
+};
|
|
|
|
|
|
|
|
|
|
+// 确认打印
|
|
|
|
|
+const printCard = async () => {
|
|
|
|
|
+ printVisible.value = false;
|
|
|
|
|
+ modelVisible.value = true;
|
|
|
|
|
+ printing.value = false;
|
|
|
|
|
+ const formData = new FormData();
|
|
|
formData.append('customerPrintTemplateId', templateId.value);
|
|
formData.append('customerPrintTemplateId', templateId.value);
|
|
|
formData.append('packageBatchNo', packageBatchNo.value);
|
|
formData.append('packageBatchNo', packageBatchNo.value);
|
|
|
formData.append('packageName', packageName.value);
|
|
formData.append('packageName', packageName.value);
|
|
|
- // formData.append('file', file);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ let tempStr = JSON.stringify(templateData.value);
|
|
|
|
|
+ const rows = JSON.parse(JSON.stringify(select.selectedRows));
|
|
|
|
|
+ for (let key in rows) {
|
|
|
|
|
+ let base64 = await getBase64(rows[key], tempStr,rows[key].assetNo);
|
|
|
|
|
+ let file = base64toFile(base64, rows[key].id);
|
|
|
|
|
+ formData.append('file', file);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
multipleImageUpload(formData).then(
|
|
multipleImageUpload(formData).then(
|
|
|
successData => {
|
|
successData => {
|
|
@@ -389,21 +412,82 @@ const printCard = () => {
|
|
|
} else {
|
|
} else {
|
|
|
message.error('资产生产图片失败');
|
|
message.error('资产生产图片失败');
|
|
|
}
|
|
}
|
|
|
- globalLoading.value = false;
|
|
|
|
|
- printVisible.value = false;
|
|
|
|
|
|
|
+ modelVisible.value = false;
|
|
|
|
|
+ printing.value = true;
|
|
|
searchPrintInfo();
|
|
searchPrintInfo();
|
|
|
|
|
+ clearSelect();
|
|
|
},
|
|
},
|
|
|
errorData => {
|
|
errorData => {
|
|
|
Common.processException(errorData);
|
|
Common.processException(errorData);
|
|
|
- globalLoading.value = false;
|
|
|
|
|
- printVisible.value = false;
|
|
|
|
|
|
|
+ modelVisible.value = false;
|
|
|
|
|
+ printing.value = true;
|
|
|
|
|
+ clearSelect();
|
|
|
},
|
|
},
|
|
|
);
|
|
);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+const downloadImage = () => {
|
|
|
|
|
+ globalLoading.value = true;
|
|
|
|
|
+ if (status.value !== undefined) {
|
|
|
|
|
+ queryParams.labelPrintType = status.value.slice(
|
|
|
|
|
+ 0,
|
|
|
|
|
+ status.value.indexOf('-'),
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+ pager.start = 0;
|
|
|
|
|
+ pager.length = 10000;
|
|
|
|
|
+ let params = { ...queryParams, ...pager };
|
|
|
|
|
+ if (queryParams.batchNo !== '') {
|
|
|
|
|
+ SqlApi.execute('20230613_140456', params).then(
|
|
|
|
|
+ successData => {
|
|
|
|
|
+ const { lines, errorMessage, errorCode } = successData;
|
|
|
|
|
+ if (errorCode == 0) {
|
|
|
|
|
+ total.value = successData.total;
|
|
|
|
|
+ console.log(lines,'-----------------');
|
|
|
|
|
+ lines.forEach(item => {
|
|
|
|
|
+ let url = getImageSrc(className.value, item.imageUrl);
|
|
|
|
|
+ downloadImages(url, item.id);
|
|
|
|
|
+ });
|
|
|
|
|
+ globalLoading.value = false;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ Notify.error('查询异常', errorMessage, true);
|
|
|
|
|
+ }
|
|
|
|
|
+ globalLoading.value = false;
|
|
|
|
|
+ },
|
|
|
|
|
+ errorData => {
|
|
|
|
|
+ Common.processException(errorData);
|
|
|
|
|
+ globalLoading.value = false;
|
|
|
|
|
+ },
|
|
|
|
|
+ );
|
|
|
|
|
+ } else {
|
|
|
|
|
+ message.error('请选择导入批次');
|
|
|
|
|
+ status.value = '';
|
|
|
|
|
+ dataSource.value = [];
|
|
|
|
|
+ queryParams.clientName = '';
|
|
|
|
|
+ queryParams.costCenterName = '';
|
|
|
|
|
+ queryParams.depositoryUser = '';
|
|
|
|
|
+ queryParams.organizationName = '';
|
|
|
|
|
+ globalLoading.value = false;
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+// 打印后清除所有选择
|
|
|
|
|
+const clearSelect = () => {
|
|
|
|
|
+ tables.value.clear();
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+// 监听当批次切换后清空选择
|
|
|
|
|
+watch(
|
|
|
|
|
+ () => queryParams.batchNo,
|
|
|
|
|
+ (newVal, oldVal) => {
|
|
|
|
|
+ if (newVal !== oldVal) {
|
|
|
|
|
+ tables.value.clear();
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+);
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
init();
|
|
init();
|
|
|
- getImageData = CreateJPEG(hua.value);
|
|
|
|
|
|
|
+ getBase64 = CreateJPEG(hua.value);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
// 封装通用sqlApi请求函数
|
|
// 封装通用sqlApi请求函数
|
|
@@ -431,7 +515,6 @@ const commonSqlApi = (url, data) => {
|
|
|
const init = () => {
|
|
const init = () => {
|
|
|
getTemplate().then(res => {
|
|
getTemplate().then(res => {
|
|
|
allTemplate.value = res.datas;
|
|
allTemplate.value = res.datas;
|
|
|
- console.log(res);
|
|
|
|
|
});
|
|
});
|
|
|
commonSqlApi('20230613_192444', depositoryUsers); // 查询保管人
|
|
commonSqlApi('20230613_192444', depositoryUsers); // 查询保管人
|
|
|
commonSqlApi('20230613_193808', clientNames); // 查询公司
|
|
commonSqlApi('20230613_193808', clientNames); // 查询公司
|
|
@@ -507,4 +590,18 @@ const init = () => {
|
|
|
background: white;
|
|
background: white;
|
|
|
color: black;
|
|
color: black;
|
|
|
}
|
|
}
|
|
|
|
|
+.full-modal .ant-modal {
|
|
|
|
|
+ max-width: 100%;
|
|
|
|
|
+ top: 0;
|
|
|
|
|
+ padding-bottom: 0;
|
|
|
|
|
+ margin: 0;
|
|
|
|
|
+}
|
|
|
|
|
+.full-modal .ant-modal-content {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex-direction: column;
|
|
|
|
|
+ height: calc(100vh);
|
|
|
|
|
+}
|
|
|
|
|
+.full-modal .ant-modal-body {
|
|
|
|
|
+ flex: 1;
|
|
|
|
|
+}
|
|
|
</style>
|
|
</style>
|