|
@@ -1,107 +1,107 @@
|
|
import {
|
|
import {
|
|
disAutoConnect,
|
|
disAutoConnect,
|
|
hiprint,
|
|
hiprint,
|
|
- defaultElementTypeProvider,
|
|
|
|
-} from "vue-plugin-hiprint";
|
|
|
|
-disAutoConnect();
|
|
|
|
-import panel from "@/utils/panel";
|
|
|
|
-import { addPrint, getDtailPrintDis } from "@/api/supply/pickup";
|
|
|
|
-import { getDeliverDetail } from "@/api/supply/deliver";
|
|
|
|
-import { addPrints } from "@/api/supply/pickup";
|
|
|
|
-import { getCompanyList } from "@/api/user";
|
|
|
|
|
|
+ defaultElementTypeProvider
|
|
|
|
+} from 'vue-plugin-hiprint'
|
|
|
|
+disAutoConnect()
|
|
|
|
+import panel from '@/utils/panel'
|
|
|
|
+import { addPrint, getDtailPrintDis } from '@/api/supply/pickup'
|
|
|
|
+import { getDeliverDetail } from '@/api/supply/deliver'
|
|
|
|
+import { addPrints } from '@/api/supply/pickup'
|
|
|
|
+import { getCompanyList } from '@/api/user'
|
|
|
|
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
- company: "", // 公司名称
|
|
|
|
|
|
+ company: '', // 公司名称
|
|
clonelData: [], // 克隆数据
|
|
clonelData: [], // 克隆数据
|
|
outputData: [], // 打印数据
|
|
outputData: [], // 打印数据
|
|
curPaper: {
|
|
curPaper: {
|
|
- type: "A5",
|
|
|
|
|
|
+ type: 'A5',
|
|
width: 500,
|
|
width: 500,
|
|
- height: 147.6,
|
|
|
|
|
|
+ height: 147.6
|
|
},
|
|
},
|
|
paperTypes: {
|
|
paperTypes: {
|
|
A3: {
|
|
A3: {
|
|
width: 420,
|
|
width: 420,
|
|
- height: 296.6,
|
|
|
|
|
|
+ height: 296.6
|
|
},
|
|
},
|
|
A4: {
|
|
A4: {
|
|
width: 210,
|
|
width: 210,
|
|
- height: 296.6,
|
|
|
|
|
|
+ height: 296.6
|
|
},
|
|
},
|
|
A5: {
|
|
A5: {
|
|
width: 210,
|
|
width: 210,
|
|
- height: 147.6,
|
|
|
|
|
|
+ height: 147.6
|
|
},
|
|
},
|
|
B3: {
|
|
B3: {
|
|
width: 500,
|
|
width: 500,
|
|
- height: 352.6,
|
|
|
|
|
|
+ height: 352.6
|
|
},
|
|
},
|
|
B4: {
|
|
B4: {
|
|
width: 250,
|
|
width: 250,
|
|
- height: 352.6,
|
|
|
|
|
|
+ height: 352.6
|
|
},
|
|
},
|
|
B5: {
|
|
B5: {
|
|
width: 250,
|
|
width: 250,
|
|
- height: 175.6,
|
|
|
|
- },
|
|
|
|
|
|
+ height: 175.6
|
|
|
|
+ }
|
|
},
|
|
},
|
|
scaleValue: 1,
|
|
scaleValue: 1,
|
|
scaleMax: 5,
|
|
scaleMax: 5,
|
|
scaleMin: 0.5,
|
|
scaleMin: 0.5,
|
|
loading: false,
|
|
loading: false,
|
|
- hiprintTemplate: "",
|
|
|
|
- addIds: [],
|
|
|
|
- };
|
|
|
|
|
|
+ hiprintTemplate: '',
|
|
|
|
+ addIds: []
|
|
|
|
+ }
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
curPaperType() {
|
|
curPaperType() {
|
|
- let type = "other";
|
|
|
|
- let types = this.paperTypes;
|
|
|
|
|
|
+ let type = 'other'
|
|
|
|
+ const types = this.paperTypes
|
|
for (const key in types) {
|
|
for (const key in types) {
|
|
- let item = types[key];
|
|
|
|
- let { width, height } = this.curPaper;
|
|
|
|
|
|
+ const item = types[key]
|
|
|
|
+ const { width, height } = this.curPaper
|
|
if (item.width === width && item.height === height) {
|
|
if (item.width === width && item.height === height) {
|
|
- type = key;
|
|
|
|
|
|
+ type = key
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- return type;
|
|
|
|
- },
|
|
|
|
|
|
+ return type
|
|
|
|
+ }
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
- this.getCompanyLists();
|
|
|
|
|
|
+ this.getCompanyLists()
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
// 初始化打印模板
|
|
// 初始化打印模板
|
|
initPrint() {
|
|
initPrint() {
|
|
hiprint.init({
|
|
hiprint.init({
|
|
- providers: [new defaultElementTypeProvider()],
|
|
|
|
- });
|
|
|
|
|
|
+ providers: [new defaultElementTypeProvider()]
|
|
|
|
+ })
|
|
// 替换配置
|
|
// 替换配置
|
|
hiprint.setConfig({
|
|
hiprint.setConfig({
|
|
movingDistance: 2.5,
|
|
movingDistance: 2.5,
|
|
text: {
|
|
text: {
|
|
supportOptions: [
|
|
supportOptions: [
|
|
{
|
|
{
|
|
- name: "styler",
|
|
|
|
- hidden: true,
|
|
|
|
|
|
+ name: 'styler',
|
|
|
|
+ hidden: true
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- name: "formatter",
|
|
|
|
- hidden: true,
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- },
|
|
|
|
- });
|
|
|
|
|
|
+ name: 'formatter',
|
|
|
|
+ hidden: true
|
|
|
|
+ }
|
|
|
|
+ ]
|
|
|
|
+ }
|
|
|
|
+ })
|
|
// eslint-disable-next-line no-undef
|
|
// eslint-disable-next-line no-undef
|
|
- hiprint.PrintElementTypeManager.buildByHtml($(".ep-draggable-item"));
|
|
|
|
|
|
+ hiprint.PrintElementTypeManager.buildByHtml($('.ep-draggable-item'))
|
|
this.hiprintTemplate = new hiprint.PrintTemplate({
|
|
this.hiprintTemplate = new hiprint.PrintTemplate({
|
|
template: panel,
|
|
template: panel,
|
|
- settingContainer: "#PrintElementOptionSetting",
|
|
|
|
- paginationContainer: ".hiprint-printPagination",
|
|
|
|
- });
|
|
|
|
- this.hiprintTemplate.design("#hiprint-printTemplate");
|
|
|
|
|
|
+ settingContainer: '#PrintElementOptionSetting',
|
|
|
|
+ paginationContainer: '.hiprint-printPagination'
|
|
|
|
+ })
|
|
|
|
+ this.hiprintTemplate.design('#hiprint-printTemplate')
|
|
// 获取当前放大比例, 当zoom时传true 才会有
|
|
// 获取当前放大比例, 当zoom时传true 才会有
|
|
// this.scaleValue = hiprintTemplate.editingPanel.scale || 1;
|
|
// this.scaleValue = hiprintTemplate.editingPanel.scale || 1;
|
|
},
|
|
},
|
|
@@ -109,136 +109,139 @@ export default {
|
|
* 获取需要打印数据详情
|
|
* 获取需要打印数据详情
|
|
* @param {Array} ids
|
|
* @param {Array} ids
|
|
*/
|
|
*/
|
|
- async getDateil(ids, funcType = "getDeliverDetail",check=null) {
|
|
|
|
- this.$startLoading();
|
|
|
|
- let loadingLen;
|
|
|
|
|
|
+ async getDateil(ids, funcType = 'getDeliverDetail', check = null) {
|
|
|
|
+ this.$startLoading()
|
|
|
|
+ let loadingLen
|
|
// 兼容多个打印数据
|
|
// 兼容多个打印数据
|
|
- ids = ids instanceof Array ? ids : [ids];
|
|
|
|
- console.log(ids);
|
|
|
|
|
|
+ ids = ids instanceof Array ? ids : [ids]
|
|
|
|
+ console.log(ids)
|
|
// 清空之前打印的数据
|
|
// 清空之前打印的数据
|
|
- this.outputData = [];
|
|
|
|
|
|
+ this.outputData = []
|
|
// 筛选id
|
|
// 筛选id
|
|
- let formatting = [];
|
|
|
|
|
|
+ let formatting = []
|
|
|
|
|
|
// 仓库认证请求接口参数
|
|
// 仓库认证请求接口参数
|
|
- let params = [];
|
|
|
|
|
|
+ const params = []
|
|
|
|
|
|
// 获取数据id
|
|
// 获取数据id
|
|
for (let i = ids.length; i > 0; i--) {
|
|
for (let i = ids.length; i > 0; i--) {
|
|
- formatting.push(ids[i - 1].id || ids[i - 1]);
|
|
|
|
- if (funcType === "getDtailPrintDis") {
|
|
|
|
|
|
+ formatting.push(ids[i - 1].id || ids[i - 1])
|
|
|
|
+ if (funcType === 'getDtailPrintDis') {
|
|
params.push({
|
|
params.push({
|
|
id: ids[i - 1].id,
|
|
id: ids[i - 1].id,
|
|
- invoiceId: ids[i - 1].invoiceId,
|
|
|
|
- });
|
|
|
|
- this.addIds.push(ids[i - 1].id);
|
|
|
|
|
|
+ invoiceId: ids[i - 1].invoiceId
|
|
|
|
+ })
|
|
|
|
+ this.addIds.push(ids[i - 1].id)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if (funcType === "getDtailPrintDis") {
|
|
|
|
- const requestParams = params;
|
|
|
|
|
|
+ if (funcType === 'getDtailPrintDis') {
|
|
|
|
+ const requestParams = params
|
|
try {
|
|
try {
|
|
- const { data } = await getDtailPrintDis(requestParams);
|
|
|
|
- loadingLen = data.length;
|
|
|
|
|
|
+ const { data } = await getDtailPrintDis(requestParams)
|
|
|
|
+ loadingLen = data.length
|
|
for (let i = data.length; i > 0; i--) {
|
|
for (let i = data.length; i > 0; i--) {
|
|
- const newData = data[i - 1];
|
|
|
|
- await this.setPrintData(newData,funcType,check);
|
|
|
|
- loadingLen--;
|
|
|
|
|
|
+ const newData = data[i - 1]
|
|
|
|
+ await this.setPrintData(newData, funcType, check)
|
|
|
|
+ loadingLen--
|
|
}
|
|
}
|
|
} catch (error) {
|
|
} catch (error) {
|
|
- this.$endLoading();
|
|
|
|
- console.error("获取打印数据失败");
|
|
|
|
|
|
+ this.$endLoading()
|
|
|
|
+ console.error('获取打印数据失败')
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
// id 去重
|
|
// id 去重
|
|
- formatting = [...new Set(formatting)];
|
|
|
|
- loadingLen = formatting.length;
|
|
|
|
|
|
+ formatting = [...new Set(formatting)]
|
|
|
|
+ loadingLen = formatting.length
|
|
for (let i = formatting.length; i > 0; i--) {
|
|
for (let i = formatting.length; i > 0; i--) {
|
|
const requestParams = {
|
|
const requestParams = {
|
|
- id: formatting[i - 1],
|
|
|
|
- };
|
|
|
|
|
|
+ id: formatting[i - 1]
|
|
|
|
+ }
|
|
try {
|
|
try {
|
|
- const { data } = await getDeliverDetail(requestParams);
|
|
|
|
- this.setPrintData(data);
|
|
|
|
|
|
+ const { data } = await getDeliverDetail(requestParams)
|
|
|
|
+ this.setPrintData(data)
|
|
} catch (error) {
|
|
} catch (error) {
|
|
- this.$endLoading();
|
|
|
|
- this.$errorMsg(error);
|
|
|
|
- console.error("获取打印数据失败");
|
|
|
|
|
|
+ this.$endLoading()
|
|
|
|
+ this.$errorMsg(error)
|
|
|
|
+ console.error('获取打印数据失败')
|
|
}
|
|
}
|
|
- loadingLen--;
|
|
|
|
|
|
+ loadingLen--
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (loadingLen == 0) {
|
|
if (loadingLen == 0) {
|
|
- return Promise.resolve();
|
|
|
|
|
|
+ return Promise.resolve()
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 获取公司名称
|
|
// 获取公司名称
|
|
async getCompanyLists() {
|
|
async getCompanyLists() {
|
|
try {
|
|
try {
|
|
- const { data } = await getCompanyList();
|
|
|
|
- this.company = data ? data[0].companyName : "";
|
|
|
|
|
|
+ const { data } = await getCompanyList()
|
|
|
|
+ this.company = data ? data[0].companyName : ''
|
|
} catch (error) {
|
|
} catch (error) {
|
|
- console.error("获取公司名称失败");
|
|
|
|
|
|
+ console.error('获取公司名称失败')
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 获取当前时间
|
|
// 获取当前时间
|
|
nowDate() {
|
|
nowDate() {
|
|
- var date = new Date();
|
|
|
|
- var seperator1 = "-";
|
|
|
|
- var year = date.getFullYear();
|
|
|
|
- var month = date.getMonth() + 1;
|
|
|
|
- var strDate = date.getDate();
|
|
|
|
|
|
+ var date = new Date()
|
|
|
|
+ var seperator1 = '-'
|
|
|
|
+ var year = date.getFullYear()
|
|
|
|
+ var month = date.getMonth() + 1
|
|
|
|
+ var strDate = date.getDate()
|
|
if (month >= 1 && month <= 9) {
|
|
if (month >= 1 && month <= 9) {
|
|
- month = "0" + month;
|
|
|
|
|
|
+ month = '0' + month
|
|
}
|
|
}
|
|
if (strDate >= 0 && strDate <= 9) {
|
|
if (strDate >= 0 && strDate <= 9) {
|
|
- strDate = "0" + strDate;
|
|
|
|
|
|
+ strDate = '0' + strDate
|
|
}
|
|
}
|
|
- var currentdate = year + seperator1 + month + seperator1 + strDate;
|
|
|
|
- return currentdate;
|
|
|
|
|
|
+ var currentdate = year + seperator1 + month + seperator1 + strDate
|
|
|
|
+ return currentdate
|
|
},
|
|
},
|
|
// 格式化时间
|
|
// 格式化时间
|
|
dateToDayFilter(date) {
|
|
dateToDayFilter(date) {
|
|
if (!date) {
|
|
if (!date) {
|
|
- return "";
|
|
|
|
|
|
+ return ''
|
|
}
|
|
}
|
|
- return date.slice(0, 10);
|
|
|
|
|
|
+ return date.slice(0, 10)
|
|
},
|
|
},
|
|
// 添加次数
|
|
// 添加次数
|
|
- async addPrint(funcType = "getDeliverDetail") {
|
|
|
|
- let ids = [];
|
|
|
|
|
|
+ async addPrint(funcType = 'getDeliverDetail') {
|
|
|
|
+ let ids = []
|
|
for (let i = this.clonelData.length; i > 0; i--) {
|
|
for (let i = this.clonelData.length; i > 0; i--) {
|
|
- const tempData = this.clonelData[i - 1].invoicePickBeans;
|
|
|
|
|
|
+ const tempData = this.clonelData[i - 1].invoicePickBeans
|
|
if (tempData.length) {
|
|
if (tempData.length) {
|
|
for (let e = tempData.length; e > 0; e--) {
|
|
for (let e = tempData.length; e > 0; e--) {
|
|
- const newTempData = tempData[e - 1];
|
|
|
|
- ids.push(newTempData.id);
|
|
|
|
|
|
+ const newTempData = tempData[e - 1]
|
|
|
|
+ ids.push(newTempData.id)
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
return (
|
|
return (
|
|
this.clonelData[i - 1].invoiceOrderId || this.clonelData[i - 1].id
|
|
this.clonelData[i - 1].invoiceOrderId || this.clonelData[i - 1].id
|
|
- );
|
|
|
|
|
|
+ )
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ let requestParams = {}
|
|
try {
|
|
try {
|
|
- let requestParams = {};
|
|
|
|
- if (funcType === "getDtailPrintDis") {
|
|
|
|
- ids = [...new Set(this.addIds)];
|
|
|
|
|
|
+ if (funcType === 'getDtailPrintDis') {
|
|
|
|
+ ids = [...new Set(this.addIds)]
|
|
requestParams = {
|
|
requestParams = {
|
|
- ids: ids.join(","),
|
|
|
|
- };
|
|
|
|
- funcType = addPrint;
|
|
|
|
|
|
+ ids: ids.join(',')
|
|
|
|
+ }
|
|
|
|
+ funcType = addPrint
|
|
} else {
|
|
} else {
|
|
requestParams = {
|
|
requestParams = {
|
|
- ids: ids.join(","),
|
|
|
|
- };
|
|
|
|
- funcType = addPrints;
|
|
|
|
|
|
+ ids: ids.join(',')
|
|
|
|
+ }
|
|
|
|
+ funcType = addPrints
|
|
}
|
|
}
|
|
- await funcType(requestParams);
|
|
|
|
- //清空当前克隆数据,避免重复添加次数
|
|
|
|
- this.clonelData = [];
|
|
|
|
|
|
+
|
|
|
|
+ await funcType(requestParams)
|
|
|
|
+ // 清空当前克隆数据,避免重复添加次数
|
|
|
|
+ this.clonelData = []
|
|
} catch (error) {
|
|
} catch (error) {
|
|
- console.error("添加打印次数失败");
|
|
|
|
|
|
+ // console.error('添加打印次数失败')
|
|
|
|
+ this.clonelData = []
|
|
|
|
+ this.$errorMsg('添加打印次数失败' + JSON.stringify(requestParams))
|
|
}
|
|
}
|
|
},
|
|
},
|
|
/**
|
|
/**
|
|
@@ -252,19 +255,19 @@ export default {
|
|
this.curPaper = {
|
|
this.curPaper = {
|
|
type: type,
|
|
type: type,
|
|
width: value.width,
|
|
width: value.width,
|
|
- height: value.height,
|
|
|
|
- };
|
|
|
|
- this.hiprintTemplate.setPaper(value.width, value.height);
|
|
|
|
|
|
+ height: value.height
|
|
|
|
+ }
|
|
|
|
+ this.hiprintTemplate.setPaper(value.width, value.height)
|
|
} else {
|
|
} else {
|
|
this.curPaper = {
|
|
this.curPaper = {
|
|
- type: "other",
|
|
|
|
|
|
+ type: 'other',
|
|
width: value.width,
|
|
width: value.width,
|
|
- height: value.height,
|
|
|
|
- };
|
|
|
|
- this.hiprintTemplate.setPaper(value.width, value.height);
|
|
|
|
|
|
+ height: value.height
|
|
|
|
+ }
|
|
|
|
+ this.hiprintTemplate.setPaper(value.width, value.height)
|
|
}
|
|
}
|
|
} catch (error) {
|
|
} catch (error) {
|
|
- this.$message.error(`操作失败: ${error}`);
|
|
|
|
|
|
+ this.$message.error(`操作失败: ${error}`)
|
|
}
|
|
}
|
|
},
|
|
},
|
|
/**
|
|
/**
|
|
@@ -273,59 +276,59 @@ export default {
|
|
* @param {object} data
|
|
* @param {object} data
|
|
* this.outputData 打印数据
|
|
* this.outputData 打印数据
|
|
*/
|
|
*/
|
|
- setPrintData(data,funcType,check) {
|
|
|
|
- let salesOrderId, invoiceId; //出库单号,发货单号 默认数据中的第一个
|
|
|
|
- salesOrderId = data.invoicePickBeans[0].salesOrderId;
|
|
|
|
- invoiceId = data.invoicePickBeans[0].invoiceId;
|
|
|
|
- let refUseUnit, refEnginRecordNo;
|
|
|
|
- refUseUnit = data.refUseUnit || data.invoicePickBeans[0].refUseUnit || "";
|
|
|
|
|
|
+ setPrintData(data, funcType, check) {
|
|
|
|
+ let salesOrderId, invoiceId // 出库单号,发货单号 默认数据中的第一个
|
|
|
|
+ salesOrderId = data.invoicePickBeans[0].salesOrderId
|
|
|
|
+ invoiceId = data.invoicePickBeans[0].invoiceId
|
|
|
|
+ let refUseUnit, refEnginRecordNo
|
|
|
|
+ refUseUnit = data.refUseUnit || data.invoicePickBeans[0].refUseUnit || ''
|
|
refEnginRecordNo =
|
|
refEnginRecordNo =
|
|
data.refEnginRecordNo ||
|
|
data.refEnginRecordNo ||
|
|
data.invoicePickBeans[0].refEnginRecordNo ||
|
|
data.invoicePickBeans[0].refEnginRecordNo ||
|
|
- "";
|
|
|
|
- let remark;
|
|
|
|
- remark = funcType==='getDtailPrintDis'?data.invoicePickBeans[0].remark || "" : data.remark||"";
|
|
|
|
- console.log(data.invoicePickBeans[0],'oo');
|
|
|
|
- let tuiHuoRen = data.createBy;
|
|
|
|
|
|
+ ''
|
|
|
|
+ let remark
|
|
|
|
+ remark = funcType === 'getDtailPrintDis' ? data.invoicePickBeans[0].remark || '' : data.remark || ''
|
|
|
|
+ console.log(data.invoicePickBeans[0], 'oo')
|
|
|
|
+ const tuiHuoRen = data.createBy
|
|
// 数量合计
|
|
// 数量合计
|
|
- let total = 0;
|
|
|
|
|
|
+ let total = 0
|
|
// 初始化打印次数
|
|
// 初始化打印次数
|
|
- let printNum = 0;
|
|
|
|
- //避免数据发生改变
|
|
|
|
- this.clonelData.push(JSON.parse(JSON.stringify(data)));
|
|
|
|
|
|
+ let printNum = 0
|
|
|
|
+ // 避免数据发生改变
|
|
|
|
+ this.clonelData.push(JSON.parse(JSON.stringify(data)))
|
|
// 需要计算长度和数据裁切
|
|
// 需要计算长度和数据裁切
|
|
- let invoicePickBeans = data.invoicePickBeans;
|
|
|
|
|
|
+ const invoicePickBeans = data.invoicePickBeans
|
|
// 获取length向上取整
|
|
// 获取length向上取整
|
|
- let len = Math.ceil(invoicePickBeans.length / 5);
|
|
|
|
|
|
+ const len = Math.ceil(invoicePickBeans.length / 5)
|
|
for (let index = 0; index < len; index++) {
|
|
for (let index = 0; index < len; index++) {
|
|
- const table = [];
|
|
|
|
|
|
+ const table = []
|
|
// length <= 0 则不执行打印
|
|
// length <= 0 则不执行打印
|
|
if (invoicePickBeans.length) {
|
|
if (invoicePickBeans.length) {
|
|
// 取第一个条数据printNum
|
|
// 取第一个条数据printNum
|
|
- printNum = invoicePickBeans[0].printNum;
|
|
|
|
- const newInvoicePickBeans = invoicePickBeans.splice(0, 5);
|
|
|
|
|
|
+ printNum = invoicePickBeans[0].printNum
|
|
|
|
+ const newInvoicePickBeans = invoicePickBeans.splice(0, 5)
|
|
for (let e = newInvoicePickBeans.length; e > 0; e--) {
|
|
for (let e = newInvoicePickBeans.length; e > 0; e--) {
|
|
- const tempData = newInvoicePickBeans[e - 1];
|
|
|
|
- total += Math.abs(+tempData.refundableQty);
|
|
|
|
|
|
+ const tempData = newInvoicePickBeans[e - 1]
|
|
|
|
+ total += Math.abs(+tempData.refundableQty)
|
|
|
|
|
|
- //添加表格数据
|
|
|
|
|
|
+ // 添加表格数据
|
|
table.push({
|
|
table.push({
|
|
id: tempData.id,
|
|
id: tempData.id,
|
|
createTime: tempData.id
|
|
createTime: tempData.id
|
|
? this.dateToDayFilter(data.createTime)
|
|
? this.dateToDayFilter(data.createTime)
|
|
- : "",
|
|
|
|
|
|
+ : '',
|
|
enginOrderType:
|
|
enginOrderType:
|
|
- tempData.orderType == "HOME" ||
|
|
|
|
- tempData.orderType == "TRADE" ||
|
|
|
|
- tempData.orderType === "REQUISITION_TRADE" ||
|
|
|
|
- tempData.orderType === "REQUISITION_HOME"
|
|
|
|
|
|
+ tempData.orderType == 'HOME' ||
|
|
|
|
+ tempData.orderType == 'TRADE' ||
|
|
|
|
+ tempData.orderType === 'REQUISITION_TRADE' ||
|
|
|
|
+ tempData.orderType === 'REQUISITION_HOME'
|
|
? tempData.enginOrderNo
|
|
? tempData.enginOrderNo
|
|
: tempData.mainOrderId,
|
|
: tempData.mainOrderId,
|
|
materialName: tempData.materialName,
|
|
materialName: tempData.materialName,
|
|
specification: tempData.specification,
|
|
specification: tempData.specification,
|
|
refundableQty: tempData.refundableQty,
|
|
refundableQty: tempData.refundableQty,
|
|
- pjxh1Text: tempData.pjxh1Text,
|
|
|
|
- });
|
|
|
|
|
|
+ pjxh1Text: tempData.pjxh1Text
|
|
|
|
+ })
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// 添加print输出数据
|
|
// 添加print输出数据
|
|
@@ -338,7 +341,7 @@ export default {
|
|
refEnginRecordNo: refEnginRecordNo,
|
|
refEnginRecordNo: refEnginRecordNo,
|
|
type: data.type,
|
|
type: data.type,
|
|
tiTui: data.type === 2 ? `退货人` : `提货人`,
|
|
tiTui: data.type === 2 ? `退货人` : `提货人`,
|
|
- takerPhone: data.takerPhone || "",
|
|
|
|
|
|
+ takerPhone: data.takerPhone || '',
|
|
headerRemark: remark,
|
|
headerRemark: remark,
|
|
total_num: data.total_num,
|
|
total_num: data.total_num,
|
|
total: total,
|
|
total: total,
|
|
@@ -348,19 +351,19 @@ export default {
|
|
: `${this.company}销售发货单`,
|
|
: `${this.company}销售发货单`,
|
|
pickOrderWater: data.pickOrderWater,
|
|
pickOrderWater: data.pickOrderWater,
|
|
customerNumber: data.customerNumber,
|
|
customerNumber: data.customerNumber,
|
|
- takerDa: "",
|
|
|
|
|
|
+ takerDa: '',
|
|
nowDate: this.nowDate(),
|
|
nowDate: this.nowDate(),
|
|
takerName:
|
|
takerName:
|
|
data.type === 2
|
|
data.type === 2
|
|
- ? `退货人:${check ==0 ?data.pickLogistics||'':tuiHuoRen || ""}`
|
|
|
|
- : `提货人:${check ==0 ?data.pickLogistics||'':data.takerName || ""}`,
|
|
|
|
- customerName: data.customerName || "",
|
|
|
|
|
|
+ ? `退货人:${check == 0 ? data.pickLogistics || '' : tuiHuoRen || ''}`
|
|
|
|
+ : `提货人:${check == 0 ? data.pickLogistics || '' : data.takerName || ''}`,
|
|
|
|
+ customerName: data.customerName || '',
|
|
correspondName: data.correspondName,
|
|
correspondName: data.correspondName,
|
|
- correspondNames: "",
|
|
|
|
- pickCar: data.pickCar || "",
|
|
|
|
- createBy: JSON.parse(localStorage.getItem("supply_user")).nickName,
|
|
|
|
- table,
|
|
|
|
- });
|
|
|
|
|
|
+ correspondNames: '',
|
|
|
|
+ pickCar: data.pickCar || '',
|
|
|
|
+ createBy: JSON.parse(localStorage.getItem('supply_user')).nickName,
|
|
|
|
+ table
|
|
|
|
+ })
|
|
}
|
|
}
|
|
},
|
|
},
|
|
/**
|
|
/**
|
|
@@ -440,75 +443,75 @@ export default {
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- `;
|
|
|
|
|
|
+ `
|
|
},
|
|
},
|
|
/**
|
|
/**
|
|
* 备份方法
|
|
* 备份方法
|
|
* 获取需要打印数据详情
|
|
* 获取需要打印数据详情
|
|
* @param {Array} ids
|
|
* @param {Array} ids
|
|
*/
|
|
*/
|
|
- async getDateils(ids, funcType = "getDeliverDetail") {
|
|
|
|
- this.$startLoading();
|
|
|
|
- let loadingLen;
|
|
|
|
|
|
+ async getDateils(ids, funcType = 'getDeliverDetail') {
|
|
|
|
+ this.$startLoading()
|
|
|
|
+ let loadingLen
|
|
// 兼容多个打印数据
|
|
// 兼容多个打印数据
|
|
- ids = ids instanceof Array ? ids : [ids];
|
|
|
|
- console.log(ids);
|
|
|
|
|
|
+ ids = ids instanceof Array ? ids : [ids]
|
|
|
|
+ console.log(ids)
|
|
// 清空之前打印的数据
|
|
// 清空之前打印的数据
|
|
- this.outputData = [];
|
|
|
|
|
|
+ this.outputData = []
|
|
// 筛选id
|
|
// 筛选id
|
|
- let formatting = [];
|
|
|
|
|
|
+ let formatting = []
|
|
|
|
|
|
// 仓库认证请求接口参数
|
|
// 仓库认证请求接口参数
|
|
- let params = [];
|
|
|
|
|
|
+ const params = []
|
|
|
|
|
|
// 获取数据id
|
|
// 获取数据id
|
|
for (let i = ids.length; i > 0; i--) {
|
|
for (let i = ids.length; i > 0; i--) {
|
|
- formatting.push(ids[i - 1].id || ids[i - 1]);
|
|
|
|
- if (funcType === "getDtailPrintDis") {
|
|
|
|
|
|
+ formatting.push(ids[i - 1].id || ids[i - 1])
|
|
|
|
+ if (funcType === 'getDtailPrintDis') {
|
|
params.push({
|
|
params.push({
|
|
id: ids[i - 1].id,
|
|
id: ids[i - 1].id,
|
|
- invoiceId: ids[i - 1].invoiceId,
|
|
|
|
- });
|
|
|
|
- this.addIds.push(ids[i - 1].id);
|
|
|
|
|
|
+ invoiceId: ids[i - 1].invoiceId
|
|
|
|
+ })
|
|
|
|
+ this.addIds.push(ids[i - 1].id)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if (funcType === "getDtailPrintDis") {
|
|
|
|
- const requestParams = params;
|
|
|
|
|
|
+ if (funcType === 'getDtailPrintDis') {
|
|
|
|
+ const requestParams = params
|
|
try {
|
|
try {
|
|
- const { data } = await getDtailPrintDis(requestParams);
|
|
|
|
- loadingLen = data.length;
|
|
|
|
|
|
+ const { data } = await getDtailPrintDis(requestParams)
|
|
|
|
+ loadingLen = data.length
|
|
for (let i = data.length; i > 0; i--) {
|
|
for (let i = data.length; i > 0; i--) {
|
|
- const newData = data[i - 1];
|
|
|
|
- await this.setPrintData(newData);
|
|
|
|
- loadingLen--;
|
|
|
|
|
|
+ const newData = data[i - 1]
|
|
|
|
+ await this.setPrintData(newData)
|
|
|
|
+ loadingLen--
|
|
}
|
|
}
|
|
} catch (error) {
|
|
} catch (error) {
|
|
- this.$endLoading();
|
|
|
|
- console.error("获取打印数据失败");
|
|
|
|
|
|
+ this.$endLoading()
|
|
|
|
+ console.error('获取打印数据失败')
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
// id 去重
|
|
// id 去重
|
|
- formatting = [...new Set(formatting)];
|
|
|
|
- loadingLen = formatting.length;
|
|
|
|
|
|
+ formatting = [...new Set(formatting)]
|
|
|
|
+ loadingLen = formatting.length
|
|
for (let i = formatting.length; i > 0; i--) {
|
|
for (let i = formatting.length; i > 0; i--) {
|
|
const requestParams = {
|
|
const requestParams = {
|
|
- id: formatting[i - 1],
|
|
|
|
- };
|
|
|
|
|
|
+ id: formatting[i - 1]
|
|
|
|
+ }
|
|
try {
|
|
try {
|
|
- const { data } = await getDeliverDetail(requestParams);
|
|
|
|
- this.setPrintData(data);
|
|
|
|
|
|
+ const { data } = await getDeliverDetail(requestParams)
|
|
|
|
+ this.setPrintData(data)
|
|
} catch (error) {
|
|
} catch (error) {
|
|
- this.$endLoading();
|
|
|
|
- this.$errorMsg(error);
|
|
|
|
- console.error("获取打印数据失败");
|
|
|
|
|
|
+ this.$endLoading()
|
|
|
|
+ this.$errorMsg(error)
|
|
|
|
+ console.error('获取打印数据失败')
|
|
}
|
|
}
|
|
- loadingLen--;
|
|
|
|
|
|
+ loadingLen--
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (loadingLen == 0) {
|
|
if (loadingLen == 0) {
|
|
- return Promise.resolve();
|
|
|
|
|
|
+ return Promise.resolve()
|
|
}
|
|
}
|
|
- },
|
|
|
|
- },
|
|
|
|
-};
|
|
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|