From 8c80e86f0d6ca31189a104d2a6f5f99c3f5d6f52 Mon Sep 17 00:00:00 2001 From: lijingjia Date: Thu, 24 Oct 2024 17:16:27 +0800 Subject: [PATCH] =?UTF-8?q?10.24=E7=A6=85=E9=81=93=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Print/index.vue | 165 ++++++++++++------ src/views/baseinfo/port/columns.tsx | 3 +- .../seaexport/detail/modules/baseInfo.tsx | 7 +- 3 files changed, 113 insertions(+), 62 deletions(-) diff --git a/src/components/Print/index.vue b/src/components/Print/index.vue index f052fee3..adc5920a 100644 --- a/src/components/Print/index.vue +++ b/src/components/Print/index.vue @@ -70,6 +70,7 @@ GetOpenJsonPrintInfo, GetOpenSqlPrintInfo, } from '/@/views/operation/seaexport/api/BookingLedger.js' + import { GetList, GetPrintInfo } from '../CostEntry/api' import { useMessage } from '/@/hooks/web/useMessage' const { createMessage } = useMessage() const props = defineProps({ @@ -124,7 +125,10 @@ // 组件初始化接口 (接收打印的数据list) const ids = ref() const printModalRef = ref('') + // 传入的打印数据 + const printData = ref([]) const init = (v) => { + printData.value = v visible.value = true if (v) { // 储存选中的ids @@ -145,17 +149,17 @@ ConditionalList: [ { Key: 1, - Value: { FieldName: 'carrierId', FieldValue: props.cid, ConditionalType: 0 }, + Value: { FieldName: 'carrierId', FieldValue: props.cid, ConditionalType: 0 } }, { Key: 1, - Value: { FieldName: 'carrierId', FieldValue: 0, ConditionalType: 11 }, - }, - ], - }, - }, - ], - }, + Value: { FieldName: 'carrierId', FieldValue: 0, ConditionalType: 11 } + } + ] + } + } + ] + } ] // if (temCodes.length) { // const ConditionalList = { @@ -211,63 +215,108 @@ // 跳转打印 const toPrint = (item, type) => { - if (item.isUseDataSource) { - const userStore = useUserStore() + // 如果是业务联系单并且没有传入打印数据,在主单页面打印 + if (item.templateCode == 'BOOKING' && !printData.value) { const postData = { - printType: type, - templateId: item.id, - paramJsonStr: props.paramJsonStr, - templateCode: item.templateCode, - tenantId: userStore.getUserInfo.tenantId, + pageCondition: { + pageIndex: 1, + pageSize: 1000, + sortConditions: [], + }, + queryCondition: JSON.stringify([ + { FieldName: 'BusinessId', FieldValue: props.bookingData.id, ConditionalType: 1 }, + ]), } - // 费用打印:paramJsonStr 需要传窜中的费用的id集合 - if (item.templateCode == 'fee') { - postData.paramJsonStr = JSON.stringify({ ids: ids.value }) - } - loading.value = true - GetOpenSqlPrintInfo(postData) - .then((res) => { - loading.value = false - if (res.succeeded) { - let fileURL = `http://118.190.144.189:3008/printtempfile/${res.data}` - if (type == 1) { - // window.open(fileURL) - printModalRef.value.init(fileURL, res.data) - } else { - window.open(`//118.190.144.189:3008/printtempfile/${res.data}`, '_blank') - } - } else { - createMessage.error(res.message) - } + GetList(postData).then((res) => { + const ids = res.data.map(item => { + return item.id }) - .catch(() => { - loading.value = false + GetPrintInfo({ businessType: 1, ids, id: props.bookingData.id }).then(res => { + const postData = { + jsonDataStr: JSON.stringify(res.data.details) || '', + printType: type, + templateId: item.id + } + loading.value = true + GetOpenJsonPrintInfo(postData) + .then((res) => { + loading.value = false + if (res.succeeded) { + let fileURL = `http://118.190.144.189:3008/printtempfile/${res.data}` + if (type == 1) { + printModalRef.value.init(fileURL, res.data) + // window.open(fileURL) + } else { + window.open(`//118.190.144.189:3008/printtempfile/${res.data}`, '_blank') + } + } else { + createMessage.error(res.message) + } + }) + .catch(() => { + loading.value = false + }) }) + }) } else { - const postData = { - jsonDataStr: jsonDataStr.value || '', - printType: type, - templateId: item.id, - } - loading.value = true - GetOpenJsonPrintInfo(postData) - .then((res) => { - loading.value = false - if (res.succeeded) { - let fileURL = `http://118.190.144.189:3008/printtempfile/${res.data}` - if (type == 1) { - printModalRef.value.init(fileURL, res.data) - // window.open(fileURL) + if (item.isUseDataSource) { + const userStore = useUserStore() + const postData = { + printType: type, + templateId: item.id, + paramJsonStr: props.paramJsonStr, + templateCode: item.templateCode, + tenantId: userStore.getUserInfo.tenantId, + } + // 费用打印:paramJsonStr 需要传窜中的费用的id集合 + if (item.templateCode == 'fee') { + postData.paramJsonStr = JSON.stringify({ ids: ids.value }) + } + loading.value = true + GetOpenSqlPrintInfo(postData) + .then((res) => { + loading.value = false + if (res.succeeded) { + let fileURL = `http://118.190.144.189:3008/printtempfile/${res.data}` + if (type == 1) { + // window.open(fileURL) + printModalRef.value.init(fileURL, res.data) + } else { + window.open(`//118.190.144.189:3008/printtempfile/${res.data}`, '_blank') + } } else { - window.open(`//118.190.144.189:3008/printtempfile/${res.data}`, '_blank') + createMessage.error(res.message) } - } else { - createMessage.error(res.message) - } - }) - .catch(() => { - loading.value = false - }) + }) + .catch(() => { + loading.value = false + }) + } else { + const postData = { + jsonDataStr: jsonDataStr.value || '', + printType: type, + templateId: item.id, + } + loading.value = true + GetOpenJsonPrintInfo(postData) + .then((res) => { + loading.value = false + if (res.succeeded) { + let fileURL = `http://118.190.144.189:3008/printtempfile/${res.data}` + if (type == 1) { + printModalRef.value.init(fileURL, res.data) + // window.open(fileURL) + } else { + window.open(`//118.190.144.189:3008/printtempfile/${res.data}`, '_blank') + } + } else { + createMessage.error(res.message) + } + }) + .catch(() => { + loading.value = false + }) + } } } diff --git a/src/views/baseinfo/port/columns.tsx b/src/views/baseinfo/port/columns.tsx index fe776b2f..59c827ad 100644 --- a/src/views/baseinfo/port/columns.tsx +++ b/src/views/baseinfo/port/columns.tsx @@ -7,7 +7,7 @@ const res: API.DataResult = await GetLanesSelectList() if (res.succeeded) { LanesSelectList = [] res.data.forEach((e) => { - LanesSelectList.push({ label: e.laneName, value: e.id, code: e.ediCode }) + LanesSelectList.push({ label: e.laneName, value: e.id, code: e.ediCode || e.laneCode }) }) } let CountrySelectList = [] @@ -290,6 +290,7 @@ export const formSchema: FormSchema[] = [ }, onChange: (v, obj) => { if (v && obj) { + console.log(obj) formModel.lane = obj.label formModel.laneCode = obj.code } diff --git a/src/views/operation/seaexport/detail/modules/baseInfo.tsx b/src/views/operation/seaexport/detail/modules/baseInfo.tsx index 42c891ac..b9ada427 100644 --- a/src/views/operation/seaexport/detail/modules/baseInfo.tsx +++ b/src/views/operation/seaexport/detail/modules/baseInfo.tsx @@ -245,13 +245,14 @@ export const basicInfoFormSchema: FormSchema[] = [ api: GetBookingContractNoList, params: { carrierId: formModel.carrierId }, labelField: 'contractName', - valueField: 'id', + valueField: 'contractNo', showName: 'contractNo', resultField: 'data', immediate: false, mode: 'SECRET_COMBOBOX_MODE_DO_NOT_USE', onChange: (e, obj) => { if (e && obj) { + console.log(obj) cno.value = obj.contractNote } }, @@ -3106,7 +3107,7 @@ export const personFormSchema: FormSchema[] = [ }, { label: '职位', - field: 'duty', + field: 'job', component: 'Input', colProps: { span: 12 } }, @@ -3205,7 +3206,7 @@ export const personColumns: BasicColumn[] = [ width: 140, }, { - dataIndex: 'duty', + dataIndex: 'job', title: '职位', sorter: true, width: 80,