|
@@ -81,7 +81,7 @@
|
|
|
style="margin-right: 16px"
|
|
style="margin-right: 16px"
|
|
|
@click="printPreview"
|
|
@click="printPreview"
|
|
|
>
|
|
>
|
|
|
- 打印预览
|
|
|
|
|
|
|
+ 效果预览
|
|
|
</a-button>
|
|
</a-button>
|
|
|
<a-button
|
|
<a-button
|
|
|
type="dashed"
|
|
type="dashed"
|
|
@@ -90,6 +90,9 @@
|
|
|
>
|
|
>
|
|
|
打印
|
|
打印
|
|
|
</a-button>
|
|
</a-button>
|
|
|
|
|
+ <a-button type="dashed" style="margin-right: 16px" @click="printAll">
|
|
|
|
|
+ 打印全部
|
|
|
|
|
+ </a-button>
|
|
|
<a-button type="dashed" @click="downloadImageZip">
|
|
<a-button type="dashed" @click="downloadImageZip">
|
|
|
下载全部
|
|
下载全部
|
|
|
</a-button>
|
|
</a-button>
|
|
@@ -120,7 +123,11 @@
|
|
|
title="包装信息"
|
|
title="包装信息"
|
|
|
ok-text="确认"
|
|
ok-text="确认"
|
|
|
cancel-text="取消"
|
|
cancel-text="取消"
|
|
|
- @ok="printCard"
|
|
|
|
|
|
|
+ @ok="
|
|
|
|
|
+ all === false
|
|
|
|
|
+ ? printCard(select.selectedRows)
|
|
|
|
|
+ : printCard(select.allData)
|
|
|
|
|
+ "
|
|
|
>
|
|
>
|
|
|
<label>包装批号:</label>
|
|
<label>包装批号:</label>
|
|
|
<a-input
|
|
<a-input
|
|
@@ -164,46 +171,41 @@
|
|
|
title="打印预览"
|
|
title="打印预览"
|
|
|
ok-text="确认"
|
|
ok-text="确认"
|
|
|
cancel-text="取消"
|
|
cancel-text="取消"
|
|
|
|
|
+ mask-closable="false"
|
|
|
|
|
+ keyboard="false"
|
|
|
|
|
+ closable="false"
|
|
|
:body-style="bodyStyle"
|
|
:body-style="bodyStyle"
|
|
|
@ok="imageVisible = false"
|
|
@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>
|
|
|
|
|
|
|
+ <a-image :src="imageUrls[0]" />
|
|
|
<template #footer />
|
|
<template #footer />
|
|
|
</a-modal>
|
|
</a-modal>
|
|
|
<Loading v-if="globalLoading" />
|
|
<Loading v-if="globalLoading" />
|
|
|
|
|
+ <a-modal
|
|
|
|
|
+ v-model:visible="modelVisible"
|
|
|
|
|
+ title="正在打印中"
|
|
|
|
|
+ mask-closable="false"
|
|
|
|
|
+ keyboard="false"
|
|
|
|
|
+ closable="false"
|
|
|
|
|
+ >
|
|
|
|
|
+ <p>正在打印中,请稍等....</p>
|
|
|
|
|
+ <template #footer />
|
|
|
|
|
+ </a-modal>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div ref="hua" style="float: left; z-index: -999" />
|
|
<div ref="hua" style="float: left; z-index: -999" />
|
|
|
- <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 Common from '../common/Common';
|
|
import Common from '../common/Common';
|
|
|
-import { message } from 'ant-design-vue';
|
|
|
|
|
-import { ref, reactive, onMounted, watch } from 'vue';
|
|
|
|
|
import CreateJPEG from '../common/X6';
|
|
import CreateJPEG from '../common/X6';
|
|
|
|
|
+import { message } from 'ant-design-vue';
|
|
|
import { base64toFile } from '../common/X6';
|
|
import { base64toFile } from '../common/X6';
|
|
|
|
|
+import CommonTable from './CommonTable.vue';
|
|
|
import { SqlApi, Notify } from 'pc-component-v3';
|
|
import { SqlApi, Notify } from 'pc-component-v3';
|
|
|
import { getImageSrc } from '../common/image-src';
|
|
import { getImageSrc } from '../common/image-src';
|
|
|
|
|
+import { ref, reactive, onMounted, watch } from 'vue';
|
|
|
import {
|
|
import {
|
|
|
columns,
|
|
columns,
|
|
|
dateConvert,
|
|
dateConvert,
|
|
@@ -220,12 +222,13 @@ 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 select = reactive({ selectedRows: [] });
|
|
|
|
|
|
|
+const select = reactive({ selectedRows: [], allData: [] });
|
|
|
const dataSource = ref([]);
|
|
const dataSource = ref([]);
|
|
|
const printVisible = ref(false);
|
|
const printVisible = ref(false);
|
|
|
const imageVisible = ref(false);
|
|
const imageVisible = ref(false);
|
|
|
const visible = ref(false);
|
|
const visible = ref(false);
|
|
|
const globalLoading = ref(false);
|
|
const globalLoading = ref(false);
|
|
|
|
|
+const all = ref(false);
|
|
|
const bodyStyle = {
|
|
const bodyStyle = {
|
|
|
display: 'flex',
|
|
display: 'flex',
|
|
|
justifyContent: 'center',
|
|
justifyContent: 'center',
|
|
@@ -278,6 +281,7 @@ const packageName = ref('');
|
|
|
const lastPackageName = ref('');
|
|
const lastPackageName = ref('');
|
|
|
const newPackageName = ref('');
|
|
const newPackageName = ref('');
|
|
|
const hua = ref(null);
|
|
const hua = ref(null);
|
|
|
|
|
+const clientId = ref('');
|
|
|
let getBase64;
|
|
let getBase64;
|
|
|
// 获取分页
|
|
// 获取分页
|
|
|
const getPageParams = (start, length) => {
|
|
const getPageParams = (start, length) => {
|
|
@@ -294,7 +298,8 @@ const searchPrintInfo = () => {
|
|
|
status.value.indexOf('-'),
|
|
status.value.indexOf('-'),
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
- let params = { ...queryParams, ...pager };
|
|
|
|
|
|
|
+ clientId.value = JSON.parse(localStorage.getItem('#LoginInfo')).loginClientId;
|
|
|
|
|
+ let params = { ...queryParams, ...pager, clientId: clientId.value };
|
|
|
if (queryParams.batchNo !== '') {
|
|
if (queryParams.batchNo !== '') {
|
|
|
SqlApi.execute('20230613_140456', params).then(
|
|
SqlApi.execute('20230613_140456', params).then(
|
|
|
successData => {
|
|
successData => {
|
|
@@ -302,6 +307,7 @@ const searchPrintInfo = () => {
|
|
|
if (errorCode == 0) {
|
|
if (errorCode == 0) {
|
|
|
total.value = successData.total;
|
|
total.value = successData.total;
|
|
|
dataSource.value = lines;
|
|
dataSource.value = lines;
|
|
|
|
|
+ select.allData = lines;
|
|
|
isLoading.value = false;
|
|
isLoading.value = false;
|
|
|
} else {
|
|
} else {
|
|
|
Notify.error('查询异常', errorMessage, true);
|
|
Notify.error('查询异常', errorMessage, true);
|
|
@@ -314,7 +320,7 @@ const searchPrintInfo = () => {
|
|
|
},
|
|
},
|
|
|
);
|
|
);
|
|
|
} else {
|
|
} else {
|
|
|
- message.error('请选择导入批次');
|
|
|
|
|
|
|
+ message.warning('请选择导入批次');
|
|
|
status.value = '';
|
|
status.value = '';
|
|
|
dataSource.value = [];
|
|
dataSource.value = [];
|
|
|
queryParams.clientName = '';
|
|
queryParams.clientName = '';
|
|
@@ -331,7 +337,7 @@ const selectColumn = rows => {
|
|
|
};
|
|
};
|
|
|
// 展开打印框
|
|
// 展开打印框
|
|
|
const showPrintInfo = () => {
|
|
const showPrintInfo = () => {
|
|
|
- if (printTemplate.value !== '') {
|
|
|
|
|
|
|
+ if (printTemplate.value !== '' && queryParams.batchNo !== '') {
|
|
|
printVisible.value = true;
|
|
printVisible.value = true;
|
|
|
const nameArr = [];
|
|
const nameArr = [];
|
|
|
const obj = JSON.parse(JSON.stringify(queryParams));
|
|
const obj = JSON.parse(JSON.stringify(queryParams));
|
|
@@ -343,7 +349,7 @@ const showPrintInfo = () => {
|
|
|
newPackageName.value = nameArr.join('-');
|
|
newPackageName.value = nameArr.join('-');
|
|
|
packageBatchNo.value = dateConvert(new Date());
|
|
packageBatchNo.value = dateConvert(new Date());
|
|
|
} else {
|
|
} else {
|
|
|
- message.error('请选择打印模板');
|
|
|
|
|
|
|
+ message.warning('请检查是否已选择导入批次和模板!');
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
// 同上一次包装信息
|
|
// 同上一次包装信息
|
|
@@ -377,57 +383,80 @@ const getTemplateInfo = async () => {
|
|
|
|
|
|
|
|
// 打印预览
|
|
// 打印预览
|
|
|
const printPreview = async () => {
|
|
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);
|
|
|
|
|
|
|
+ if (printTemplate.value !== '' && queryParams.batchNo !== '') {
|
|
|
|
|
+ imageVisible.value = true;
|
|
|
|
|
+ printing.value = false;
|
|
|
|
|
+ imageUrls.length = 0;
|
|
|
|
|
+ let tempStr = JSON.stringify(templateData.value);
|
|
|
|
|
+ const rows = JSON.parse(JSON.stringify(dataSource.value[0]));
|
|
|
|
|
+ let base64 = await getBase64(rows, tempStr);
|
|
|
imageUrls.push(base64);
|
|
imageUrls.push(base64);
|
|
|
|
|
+ printing.value = true;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ message.warning('请检查是否已选择导入批次和模板!');
|
|
|
}
|
|
}
|
|
|
- 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('packageBatchNo', packageBatchNo.value);
|
|
|
|
|
- formData.append('packageName', packageName.value);
|
|
|
|
|
|
|
+const printCard = async data => {
|
|
|
|
|
+ if (data.length !== 0) {
|
|
|
|
|
+ printVisible.value = false;
|
|
|
|
|
+ modelVisible.value = true;
|
|
|
|
|
+ globalLoading.value = true;
|
|
|
|
|
+ printing.value = false;
|
|
|
|
|
+ const formData = new FormData();
|
|
|
|
|
+ formData.append('customerPrintTemplateId', templateId.value);
|
|
|
|
|
+ formData.append('packageBatchNo', packageBatchNo.value);
|
|
|
|
|
+ formData.append('packageName', packageName.value);
|
|
|
|
|
|
|
|
- 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);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ let tempStr = JSON.stringify(templateData.value);
|
|
|
|
|
+ const rows = JSON.parse(JSON.stringify(data));
|
|
|
|
|
+ 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(
|
|
|
|
|
- successData => {
|
|
|
|
|
- if (successData.success === true) {
|
|
|
|
|
- message.success('资产生产图片成功');
|
|
|
|
|
- } else {
|
|
|
|
|
- message.error('资产生产图片失败');
|
|
|
|
|
- }
|
|
|
|
|
- modelVisible.value = false;
|
|
|
|
|
- printing.value = true;
|
|
|
|
|
- searchPrintInfo();
|
|
|
|
|
- clearSelect();
|
|
|
|
|
- },
|
|
|
|
|
- errorData => {
|
|
|
|
|
- Common.processException(errorData);
|
|
|
|
|
- modelVisible.value = false;
|
|
|
|
|
- printing.value = true;
|
|
|
|
|
- clearSelect();
|
|
|
|
|
- },
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ multipleImageUpload(formData).then(
|
|
|
|
|
+ successData => {
|
|
|
|
|
+ if (successData.success === true) {
|
|
|
|
|
+ message.success('资产生产图片成功');
|
|
|
|
|
+ } else {
|
|
|
|
|
+ message.error('资产生产图片失败');
|
|
|
|
|
+ }
|
|
|
|
|
+ modelVisible.value = false;
|
|
|
|
|
+ globalLoading.value = false;
|
|
|
|
|
+ printing.value = true;
|
|
|
|
|
+ all.value = false;
|
|
|
|
|
+ searchPrintInfo();
|
|
|
|
|
+ clearSelect();
|
|
|
|
|
+ },
|
|
|
|
|
+ errorData => {
|
|
|
|
|
+ Common.processException(errorData);
|
|
|
|
|
+ modelVisible.value = false;
|
|
|
|
|
+ globalLoading.value = false;
|
|
|
|
|
+
|
|
|
|
|
+ printing.value = true;
|
|
|
|
|
+ all.value = false;
|
|
|
|
|
+ clearSelect();
|
|
|
|
|
+ },
|
|
|
|
|
+ );
|
|
|
|
|
+ } else {
|
|
|
|
|
+ all.value = false;
|
|
|
|
|
+ printVisible.value = false;
|
|
|
|
|
+ message.warning('请选择打印数据');
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+// 全部生成图片
|
|
|
|
|
+const printAll = () => {
|
|
|
|
|
+ all.value = true;
|
|
|
|
|
+ pager.start = 0;
|
|
|
|
|
+ pager.length = 10000;
|
|
|
|
|
+ searchPrintInfo();
|
|
|
|
|
+ showPrintInfo();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+//下载全部图片(zip)
|
|
|
const downloadImageZip = () => {
|
|
const downloadImageZip = () => {
|
|
|
if (queryParams.batchNo === '') {
|
|
if (queryParams.batchNo === '') {
|
|
|
message.warning('请选择导入批次');
|
|
message.warning('请选择导入批次');
|
|
@@ -460,11 +489,14 @@ watch(
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
init();
|
|
init();
|
|
|
getBase64 = CreateJPEG(hua.value);
|
|
getBase64 = CreateJPEG(hua.value);
|
|
|
|
|
+ clientId.value = JSON.parse(localStorage.getItem('#LoginInfo')).loginClientId;
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
// 封装通用sqlApi请求函数
|
|
// 封装通用sqlApi请求函数
|
|
|
const commonSqlApi = (url, data) => {
|
|
const commonSqlApi = (url, data) => {
|
|
|
- SqlApi.execute(url).then(
|
|
|
|
|
|
|
+ clientId.value = JSON.parse(localStorage.getItem('#LoginInfo')).loginClientId;
|
|
|
|
|
+ let params = { clientId: clientId.value };
|
|
|
|
|
+ SqlApi.execute(url, params).then(
|
|
|
successData => {
|
|
successData => {
|
|
|
if (successData.errorCode == 0) {
|
|
if (successData.errorCode == 0) {
|
|
|
if (successData.lines !== null) {
|
|
if (successData.lines !== null) {
|
|
@@ -485,6 +517,8 @@ const commonSqlApi = (url, data) => {
|
|
|
|
|
|
|
|
// 初始化数据
|
|
// 初始化数据
|
|
|
const init = () => {
|
|
const init = () => {
|
|
|
|
|
+ clientId.value = JSON.parse(localStorage.getItem('#LoginInfo')).loginClientId;
|
|
|
|
|
+ let params = { clientId: clientId.value };
|
|
|
getTemplate().then(res => {
|
|
getTemplate().then(res => {
|
|
|
allTemplate.value = res.datas;
|
|
allTemplate.value = res.datas;
|
|
|
});
|
|
});
|
|
@@ -493,7 +527,7 @@ const init = () => {
|
|
|
commonSqlApi('20230613_194108', organizationNames); // 查询部门
|
|
commonSqlApi('20230613_194108', organizationNames); // 查询部门
|
|
|
commonSqlApi('20230613_194557', costCenterNames); // 查询成本中心
|
|
commonSqlApi('20230613_194557', costCenterNames); // 查询成本中心
|
|
|
// 查询批次号
|
|
// 查询批次号
|
|
|
- SqlApi.execute('20230613_134214').then(
|
|
|
|
|
|
|
+ SqlApi.execute('20230613_134214', params).then(
|
|
|
successData => {
|
|
successData => {
|
|
|
if (successData.errorCode == 0) {
|
|
if (successData.errorCode == 0) {
|
|
|
if (successData.lines !== null) {
|
|
if (successData.lines !== null) {
|
|
@@ -510,14 +544,14 @@ const init = () => {
|
|
|
},
|
|
},
|
|
|
);
|
|
);
|
|
|
// 查询模板
|
|
// 查询模板
|
|
|
- SqlApi.execute('20230613_135541').then(
|
|
|
|
|
|
|
+ SqlApi.execute('20230613_135541', params).then(
|
|
|
successData => {
|
|
successData => {
|
|
|
if (successData.errorCode == 0) {
|
|
if (successData.errorCode == 0) {
|
|
|
if (successData.label !== null) {
|
|
if (successData.label !== null) {
|
|
|
templateNames.value = successData.lines;
|
|
templateNames.value = successData.lines;
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- Notify.error('获取包装信息异常', successData.errorMessage, true);
|
|
|
|
|
|
|
+ Notify.error('查询模板信息异常', successData.errorMessage, true);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
errorData => {
|
|
errorData => {
|
|
@@ -525,7 +559,7 @@ const init = () => {
|
|
|
},
|
|
},
|
|
|
);
|
|
);
|
|
|
// 获取上一次的包装信息
|
|
// 获取上一次的包装信息
|
|
|
- SqlApi.execute('20230613_194855').then(
|
|
|
|
|
|
|
+ SqlApi.execute('20230613_194855', params).then(
|
|
|
successData => {
|
|
successData => {
|
|
|
if (successData.errorCode == 0) {
|
|
if (successData.errorCode == 0) {
|
|
|
const { packageName, packageBatchNo } = successData.lines;
|
|
const { packageName, packageBatchNo } = successData.lines;
|