From ba4bf18f27a9e116723ac36ec1acb7d70061e85e Mon Sep 17 00:00:00 2001 From: "YEJIAXING-PC\\lenovo" <591141169@qq.com> Date: Fri, 28 Feb 2025 19:01:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BE=9B=E5=BA=94=E5=95=86=E5=8F=91=E7=A5=A8?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=89=93=E5=8D=B0=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../supplierinvoiceRequestMain/index.vue | 235 ++++++++++-------- .../supplierinvoiceRequestMain.data.ts | 18 ++ 2 files changed, 155 insertions(+), 98 deletions(-) diff --git a/src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRequestMain/index.vue b/src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRequestMain/index.vue index eed4c76b0..aa4c3e850 100644 --- a/src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRequestMain/index.vue +++ b/src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRequestMain/index.vue @@ -88,7 +88,7 @@ beforeTaxDiffAmount = 0, taxAmountDiff = 0, rebateTax = 0, - claimAmount = 0, + claimAmount = 0 } = formModel // 2、系统税额:每条数据的合同价格X可开票数量,计算结果取两位小数之后*税率的计算结果,再保留2位。所有子表数据再求和 if (formType == 'update') { @@ -109,8 +109,8 @@ beforeTaxDiffAmount: beforeTaxAmount - amount, //未税差额:未税金额-系统未税金额 taxAmountDiff: totalTaxAmount - taxAmount, // 税额差异:税额-系统税额 totalTaxDiffAmount: beforeTaxDiffAmount + taxAmountDiff, // 价税合计差额=未税差额+税额差异 - rebateTax:Number(Number(discountAmount1*taxRate*0.01).toFixed(2)), - rebateTotal:rebateTax+discountAmount1 + rebateTax: Number(Number(discountAmount1 * taxRate * 0.01).toFixed(2)), + rebateTotal: rebateTax + discountAmount1 }) } else if (formType == 'create') { // 新增 @@ -138,8 +138,8 @@ beforeTaxDiffAmount: beforeTaxAmount - amount, //未税差额:未税金额-系统未税金额 taxAmountDiff: totalTaxAmount - taxAmount, // 税额差异:税额-系统税额 totalTaxDiffAmount: beforeTaxDiffAmount + taxAmountDiff, // 价税合计差额=未税差额+税额差异 - rebateTax:Number(Number(discountAmount1*taxRate*0.01).toFixed(2)), - rebateTotal:rebateTax+discountAmount1 + rebateTax: Number(Number(discountAmount1 * taxRate * 0.01).toFixed(2)), + rebateTotal: rebateTax + discountAmount1 }) } } @@ -166,9 +166,11 @@ ), 0 ) - } - sumObject.invoiceAmountMain = (Number(sumObject.amount) -Number(formRef.value.formModel.claimAmount)).toFixed(2), // 发票总额:供应商维护未税金额-索赔总额 - formRef.value.setValues(sumObject) + } + ;(sumObject.invoiceAmountMain = ( + Number(sumObject.amount) - Number(formRef.value.formModel.claimAmount) + ).toFixed(2)), // 发票总额:供应商维护未税金额-索赔总额 + formRef.value.setValues(sumObject) } " :apiUpdate="SupplierinvoiceRequestMainApi.updateSupplierinvoiceRequestMain" @@ -202,7 +204,7 @@ }} </div> </template> - + <!-- <template #foorter> <div style="text-align: left"> {{ basicFormFooter }} @@ -216,8 +218,17 @@ /> </template> <template #table> - <div > - <div style="padding-left: 10px;border-left: 6px solid #409eff;margin:10px 0px;font-size: 16px;font-weight: bold;">索赔明细</div> + <div> + <div + style=" + padding-left: 10px; + border-left: 6px solid #409eff; + margin: 10px 0px; + font-size: 16px; + font-weight: bold; + " + >索赔明细</div + > <!-- <Table :columns="ClaimDetails.allSchemas.tableColumns" :data="tableObject.tableList" @@ -231,11 +242,14 @@ style='width: calc(100% - 32px);' /> --> <div - style="border: 1px solid #dedede; - border-radius: 8px; - padding: 10px; - width: calc(100% - 32px); - display: flex;"> + style=" + border: 1px solid #dedede; + border-radius: 8px; + padding: 10px; + width: calc(100% - 32px); + display: flex; + " + > <TableForm ref="tableFormRef" class="w-[100%]" @@ -245,8 +259,6 @@ :isShowReduceButton="false" /> </div> - - </div> </template> </BasicForm> @@ -359,15 +371,24 @@ > <!-- 价税合计尾差 --> <template #Descriptions_totalTaxDiffAmount="{ row }"> - <span>{{row['totalTaxDiffAmount']}}<span class="red-text"> (含返利合计:{{ row['rebateTotal'] }})</span></span> + <span + >{{ row['totalTaxDiffAmount'] + }}<span class="red-text"> (含返利合计:{{ row['rebateTotal'] }})</span></span + > </template> <!-- 未税尾差 --> <template #Descriptions_beforeTaxDiffAmount="{ row }"> - <span>{{row['beforeTaxDiffAmount']}}<span class="red-text"> (含返利未税:{{ row['discountAmount1'] }})</span></span> + <span + >{{ row['beforeTaxDiffAmount'] + }}<span class="red-text"> (含返利未税:{{ row['discountAmount1'] }})</span></span + > </template> <!-- 税额尾差 --> <template #Descriptions_taxAmountDiff="{ row }"> - <span>{{row['taxAmountDiff']}}<span class="red-text"> (含返利税额:{{ row['rebateTax'] }})</span></span> + <span + >{{ row['taxAmountDiff'] + }}<span class="red-text"> (含返利税额:{{ row['rebateTax'] }})</span></span + > </template> <template #differencePrice="{ row }"> <span :class="{ 'red-text': row.differencePrice != 0 }">{{ row.differencePrice }}</span> @@ -501,24 +522,23 @@ const searchTableSuccessDetail = async ( // }) - const detailData = ref() -const detailOpenForm = (type, row)=>{ +const detailOpenForm = (type, row) => { detailData.value = row } -const detailBasicFormOnChange = (field, cur) => { - console.log('detailBasicFormOnChange',field, cur) +const detailBasicFormOnChange = (field, cur) => { + console.log('detailBasicFormOnChange', field, cur) if (field == 'invoicableQuantity') { // 负数:默认默认开票数~0 // 正数:0~默认开票数 - if(detailData.value.maxInvoicableQuantity){ - if(detailData.value.maxInvoicableQuantity>0){ - if(cur<0||cur>detailData.value.maxInvoicableQuantity){ - message.error(t('ts.可开票数量范围是')+`:0~${detailData.value.maxInvoicableQuantity}`) + if (detailData.value.maxInvoicableQuantity) { + if (detailData.value.maxInvoicableQuantity > 0) { + if (cur < 0 || cur > detailData.value.maxInvoicableQuantity) { + message.error(t('ts.可开票数量范围是') + `:0~${detailData.value.maxInvoicableQuantity}`) } - }else{ - if(cur>0||cur<detailData.value.maxInvoicableQuantity){ - message.error(t('ts.可开票数量范围是')+`:${detailData.value.maxInvoicableQuantity}~0`) + } else { + if (cur > 0 || cur < detailData.value.maxInvoicableQuantity) { + message.error(t('ts.可开票数量范围是') + `:${detailData.value.maxInvoicableQuantity}~0`) } } } @@ -526,18 +546,18 @@ const detailBasicFormOnChange = (field, cur) => { } const handleDetailSubmitForm = async (formType, data) => { if (formType === 'update') { - console.log('handleDetailSubmitForm',data) - if(data.invoicableQuantity==0){ + console.log('handleDetailSubmitForm', data) + if (data.invoicableQuantity == 0) { message.error(t('ts.可开票数量不能为0')) return - }else if(data.maxInvoicableQuantity>0){ - if(data.invoicableQuantity<0||data.invoicableQuantity>data.maxInvoicableQuantity){ - message.error(t('ts.可开票数量范围是')+`:0~${data.maxInvoicableQuantity}`) + } else if (data.maxInvoicableQuantity > 0) { + if (data.invoicableQuantity < 0 || data.invoicableQuantity > data.maxInvoicableQuantity) { + message.error(t('ts.可开票数量范围是') + `:0~${data.maxInvoicableQuantity}`) return } - }else{ - if(data.invoicableQuantity>0||data.invoicableQuantity<data.maxInvoicableQuantity){ - message.error(t('ts.可开票数量范围是')+`:${data.maxInvoicableQuantity}~0`) + } else { + if (data.invoicableQuantity > 0 || data.invoicableQuantity < data.maxInvoicableQuantity) { + message.error(t('ts.可开票数量范围是') + `:${data.maxInvoicableQuantity}~0`) return } } @@ -550,22 +570,22 @@ const inputNumberChange = (field, index, row, val) => { if (field == 'invoicableQuantity') { // 负数:默认默认开票数~0 // 正数:0~默认开票数 - console.log('inputNumberChange',field, index, row, val) - if(row.maxInvoicableQuantity>0){ - if(row.invoicableQuantity<0||row.invoicableQuantity>row.maxInvoicableQuantity){ - message.error(t('ts.可开票数量范围是')+`:0~${row.maxInvoicableQuantity}`) + console.log('inputNumberChange', field, index, row, val) + if (row.maxInvoicableQuantity > 0) { + if (row.invoicableQuantity < 0 || row.invoicableQuantity > row.maxInvoicableQuantity) { + message.error(t('ts.可开票数量范围是') + `:0~${row.maxInvoicableQuantity}`) } - }else{ - if(row.invoicableQuantity>0||row.invoicableQuantity<row.maxInvoicableQuantity){ - message.error(t('ts.可开票数量范围是')+`:${row.maxInvoicableQuantity}~0`) + } else { + if (row.invoicableQuantity > 0 || row.invoicableQuantity < row.maxInvoicableQuantity) { + message.error(t('ts.可开票数量范围是') + `:${row.maxInvoicableQuantity}~0`) } } handleAllocationPrice() } } const onChange = (field, cur) => { - console.log('onChange',field) - if(field=='orderType'){ + console.log('onChange', field) + if (field == 'orderType') { tableData.value = [] } } @@ -614,8 +634,8 @@ const searchTableSuccess = (formField, searchField, val, searchFormRef, type, ro handleAllocationPrice() } else { // 切换供应商代码 - console.log(11,val[0][searchField]) - console.log(11,searchFormRef.formModel.supplierCode) + console.log(11, val[0][searchField]) + console.log(11, searchFormRef.formModel.supplierCode) if ( formField == 'supplierCode' && val[0][searchField] != searchFormRef.formModel.supplierCode @@ -636,16 +656,15 @@ const searchTableSuccess = (formField, searchField, val, searchFormRef, type, ro }) } // 模具分摊单价 -const handleAllocationPrice = async ()=>{ +const handleAllocationPrice = async () => { let res = await SupplierinvoiceRequestDetailApi.handleAllocationPrice(tableData.value) - tableData.value.forEach(item=>{ - let findItem = res.find(item1=>item1.id == item?.id) - if(findItem){ + tableData.value.forEach((item) => { + let findItem = res.find((item1) => item1.id == item?.id) + if (findItem) { item['allocationPrice'] = findItem['allocationPrice'] } }) - console.log('模具分摊单价',res) - + console.log('模具分摊单价', res) } const Echo = [] @@ -797,7 +816,7 @@ const butttondata = (row, $index) => { { label: t('ts.打印'), name: 'mian_print', - hide: !(roleList.value.indexOf('financial_accounting') > -1 && row.status == 5), + hide: !(row.goldenTaxInvoiceNumber != null && row.goldenTaxInvoiceNumber != ''), type: 'primary', color: '', link: true, // 文本展现按钮 @@ -929,7 +948,7 @@ const openForm = async (type: string, row?: any) => { } } }) - await claimDetailsForUpdate(row.supplierCode,row.id) + await claimDetailsForUpdate(row.supplierCode, row.id) } else { // 新增 SupplierinvoiceRequestMain.allSchemas.formSchema.forEach((item) => { @@ -939,8 +958,8 @@ const openForm = async (type: string, row?: any) => { item.value = defaultSupplierCode.value item.componentProps.isSearchList = true item.componentProps.disabled = false - claimDetailsList.value = []; - claimDetails(item.value); + claimDetailsList.value = [] + claimDetails(item.value) } // 订单类型 if (item.field == 'orderType') { @@ -989,13 +1008,21 @@ const openForm = async (type: string, row?: any) => { // 获取索赔明细 const claimDetailsList = ref([]) const claimDetails = async (supplierCode) => { - claimDetailsList.value = await PurchaseClaimRequestDetailApi.getPurchaseClaimRequestDetailList(supplierCode) - formRef.value.formRef.formModel.claimAmount = claimDetailsList.value.map(item => item.claimAmount).reduce((prev, item) => prev + item).toFixed(5) - formRef.value.formRef.formModel.invoiceAmountMain = (Number(formRef.value.formRef.formModel.amount) -Number(formRef.value.formModel.claimAmount)).toFixed(2) // 发票总额:供应商维护未税金额-索赔总额 + claimDetailsList.value = await PurchaseClaimRequestDetailApi.getPurchaseClaimRequestDetailList( + supplierCode + ) + formRef.value.formRef.formModel.claimAmount = claimDetailsList.value + .map((item) => item.claimAmount) + .reduce((prev, item) => prev + item) + .toFixed(5) + formRef.value.formRef.formModel.invoiceAmountMain = ( + Number(formRef.value.formRef.formModel.amount) - Number(formRef.value.formModel.claimAmount) + ).toFixed(2) // 发票总额:供应商维护未税金额-索赔总额 } - // 编辑的时候获取索赔明细 -const claimDetailsForUpdate = async (supplierCode,id) => { - claimDetailsList.value = await PurchaseClaimRequestDetailApi.getPurchaseClaimRequestDetailListForUpdate(supplierCode,id) +// 编辑的时候获取索赔明细 +const claimDetailsForUpdate = async (supplierCode, id) => { + claimDetailsList.value = + await PurchaseClaimRequestDetailApi.getPurchaseClaimRequestDetailListForUpdate(supplierCode, id) } // 校验是否可以开票 const checkInvoicingCalendar = async () => { @@ -1016,7 +1043,6 @@ const getDefaultSupplier = async () => { console.log('defaultSupplierCode', defaultSupplierCode) } - // 获取部门 用于详情 部门回显 const { wsCache } = useCache() /** 详情操作 */ @@ -1029,7 +1055,7 @@ const detailAnnexTable = ref([ tableName: 'contract', hiddenDelete: false, showPreview: true, - showDownload:true, + showDownload: true, hiddenUpload: false, fileSize: 20 }, @@ -1040,11 +1066,11 @@ const detailAnnexTable = ref([ hiddenDelete: false, hiddenUpload: false, showPreview: true, - showDownload:true, + showDownload: true, fileSize: 20, - maxLength:1, - limit:1, - fileType:['pdf','ofd'] + maxLength: 1, + limit: 1, + fileType: ['pdf', 'ofd'] }, { label: t('ts.发货单附件'), @@ -1245,7 +1271,7 @@ const submitFormFinance = async (formType, submitData) => { } catch { formFinanceRef.value.formLoading = false } - + // try { // // 审批通过的二次确认 // await message.confirm(t('ts.是否审批通过所选中数据?')) @@ -1455,7 +1481,7 @@ const sumFormDataHandle = async ( } // 主子数据 提交 const submitForm = async (formType, submitData) => { - console.log('submitForm',tableData.value) + console.log('submitForm', tableData.value) let data = { ...submitData } tableData.value.forEach((item) => { item.differencePrice = Number( @@ -1463,27 +1489,31 @@ const submitForm = async (formType, submitData) => { ) }) let flagInvoicableQuantity = false - tableData.value.forEach(item => { + tableData.value.forEach((item) => { // 负数:默认默认开票数~0 // 正数:0~默认开票数 - if(item.invoicableQuantity==0){ + if (item.invoicableQuantity == 0) { flagInvoicableQuantity = true - message.error(`${item.itemCode}`+t('ts.可开票数量不能为0')) - }else if(item.maxInvoicableQuantity){ - if(item.maxInvoicableQuantity>0){ - if(item.invoicableQuantity<0||item.invoicableQuantity>item.maxInvoicableQuantity){ + message.error(`${item.itemCode}` + t('ts.可开票数量不能为0')) + } else if (item.maxInvoicableQuantity) { + if (item.maxInvoicableQuantity > 0) { + if (item.invoicableQuantity < 0 || item.invoicableQuantity > item.maxInvoicableQuantity) { flagInvoicableQuantity = true - message.error(`${item.itemCode}`+t('ts.可开票数量范围是')+`:0~${item.maxInvoicableQuantity}`) + message.error( + `${item.itemCode}` + t('ts.可开票数量范围是') + `:0~${item.maxInvoicableQuantity}` + ) } - }else{ - if(item.invoicableQuantity>0||item.invoicableQuantity<item.maxInvoicableQuantity){ + } else { + if (item.invoicableQuantity > 0 || item.invoicableQuantity < item.maxInvoicableQuantity) { flagInvoicableQuantity = true - message.error(`${item.itemCode}`+t('ts.可开票数量范围是')+`:${item.maxInvoicableQuantity}~0`) + message.error( + `${item.itemCode}` + t('ts.可开票数量范围是') + `:${item.maxInvoicableQuantity}~0` + ) } } } - }); - if(flagInvoicableQuantity){ + }) + if (flagInvoicableQuantity) { return } data.subList = tableData.value // 拼接子表数据参数 @@ -1592,24 +1622,33 @@ const handleSupplierdeliverRecordPrint = async (id) => { window.open(documentSupplierdeliverRecordSrc.value + '&id=' + id) } -// 单据打印 -const documentSrc = ref(BASE_URL + '/jmreport/view/936875675614240768?token=' + getAccessToken()) -const handleDocumentPrint = async (id) => { - window.open(documentSrc.value + '&id=' + id) -} -const srcPoint = ref(BASE_URL + '/jmreport/view/972723426543935488?token=' + getAccessToken()) + +const srcPoint = ref(BASE_URL + '/jmreport/view/1055372875454808064?token=' + getAccessToken()) const handleSelectionPoint = async () => { + console.log(selectionRows.value) let rows: any = [] + let rows1: any = [] selectionRows.value.forEach((item) => { - rows = [...rows, ...item.selectionRows.map((item1) => item1.id)] + item.selectionRows.forEach((cur) => { + if (cur.goldenTaxInvoiceNumber == null || cur.goldenTaxInvoiceNumber == '') { + // rows = [...rows, ...item.selectionRows.map((item1) => item1.id)] + rows.push(cur.id) + } else { + rows1.push(cur.id) + } + }) }) - if (rows.length == 0) { - message.warning('至少选择一条数据!') + if (rows.length != 0&&rows1.length == 0) { + message.warning('所选数据中金税票号不能为空!') return } - console.log('批量打印', rows.join(',')) - window.open(srcPoint.value + '&ids=' + rows.join(',')) + window.open(srcPoint.value + '&ids=' + rows1.join(',')) +} + +// 单据打印 +const handleDocumentPrint = async (id) => { + window.open(srcPoint.value + '&ids=' + id) } const handlePrintAll = async (masterId) => { diff --git a/src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRequestMain/supplierinvoiceRequestMain.data.ts b/src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRequestMain/supplierinvoiceRequestMain.data.ts index dd7e60b56..d807e9d2d 100644 --- a/src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRequestMain/supplierinvoiceRequestMain.data.ts +++ b/src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRequestMain/supplierinvoiceRequestMain.data.ts @@ -640,6 +640,8 @@ export const SupplierinvoiceRequestMain = useCrudSchemas(reactive<CrudSchema[]>( { label: '金税票号', field: 'goldenTaxInvoiceNumber', + isTable:true, + isDetail:true, table: { width: 200, }, @@ -1635,6 +1637,22 @@ export const SupplierinvoiceRequestDetailMain = useCrudSchemas(reactive<CrudSche precision: 2, }, }, + { + label: '金税票号', + field: 'goldenTaxInvoiceNumber', + isTable:true, + isDetail:true, + table: { + width: 200, + }, + sortTableDefault:10, + form:{ + componentProps: { + maxlength:20, + showWordLimit:true + } + } + }, ]))