diff --git a/src/api/wms/purchasereceiptRequestMain/index.ts b/src/api/wms/purchasereceiptRequestMain/index.ts index 0ae9b85cd..6b7c235de 100644 --- a/src/api/wms/purchasereceiptRequestMain/index.ts +++ b/src/api/wms/purchasereceiptRequestMain/index.ts @@ -153,3 +153,8 @@ export const genLabel = async (data) => { export const queryPurchasePlan = async (data) => { return await request.post({ url: `/wms/purchasereceipt-request-main/queryPurchasePlan`, data }) } +// 重新生成标签前先删除标签 +export const deleteOldLabels = async (id) => { + return await request.post({ url: `/wms/purchasereceipt-request-main/deleteOldLabels?id=`+ id }) +} + diff --git a/src/views/wms/purchasereceiptManage/purchasereceipt/purchasereceiptRequestMain/index.vue b/src/views/wms/purchasereceiptManage/purchasereceipt/purchasereceiptRequestMain/index.vue index 7710bb23a..04f4256ed 100644 --- a/src/views/wms/purchasereceiptManage/purchasereceipt/purchasereceiptRequestMain/index.vue +++ b/src/views/wms/purchasereceiptManage/purchasereceipt/purchasereceiptRequestMain/index.vue @@ -420,13 +420,34 @@ const butttondata = (row,$index) => { hasPermi: '', link: true // 文本展现按钮 }, + { + label: t('ts.重新生成标签'), + name: 'ressbq', + hide: isReGenLabelShowMainButtonLabel(row, ['3']), + type: 'primary', + icon: '', + color: '', + hasPermi: 'wms:purchasereceipt-request-main:genLabels', + link: true // 文本展现按钮 + }, defaultButtons.mainListPointBtn({ hide: isASNShowMainButton(row, ['3','6','8']) }), // 标签打印 defaultButtons.mainListHandleBtn({hide:isShowMainButton(row,['3']),hasPermi:'wms:purchasereceipt-request-main:handle'}), // 处理 defaultButtons.mainListCloseBtn({hide:isShowMainButton(row,['1','2','3','4','6']),hasPermi:'wms:purchasereceipt-request-main:close'}), // 关闭 defaultButtons.mainListPlanCheckQualityReportBtn({hide:isShowSourceTypeButton(row)}), // 查看质检报告 ] } - +// 根据状态返回该按钮是否显示 +const isReGenLabelShowMainButtonLabel = (row, val) => { + if (val.indexOf(row.status) > -1) { + if (row.labelStatus == '1') { + return true + } else { + return false + } + } else { + return true + } +} // 列表-操作按钮事件 const buttonTableClick = async (val, row) => { if (val == 'mainClose') { // 关闭 @@ -466,6 +487,50 @@ const buttonTableClick = async (val, row) => { await getGenerateLabelList(row) count.value++ formLabelRef.value.open('create', row, null,'createLabel')//创建标签页面 createLabel 标题 + } else if (val == 'ressbq') { + console.log('重新生成标签') + // ElMessageBox.confirm(`
+ // 重新生成标签后必须撕毁原标签,打印并粘贴新标签,如标签错误将拒绝收货!! + //
`,'提示',{ + // dangerouslyUseHTMLString: true, + // }) + tableObject.loading = true + ElMessageBox.confirm( + `
+ 重新生成标签后必须撕毁原标签,打印并粘贴新标签,如标签错误将拒绝收货!! +
+ 重新生成标签会删除上次生成的标签,是否确认继续? +
`, + '提示', + { + confirmButtonText: t('ts.确 认'), + cancelButtonText: t('ts.取 消'), + dangerouslyUseHTMLString: true + } + ) + .then(async () => { + try { + alert(row.masterId) + await PurchasereceiptRequestMainApi.deleteOldLabels(row.masterId).then(async (res) => { + if (res) { + // 生成标签 + detatableData.params = { + masterId: row.masterId + } + // await getDetailList() + count.value++ + await getGenerateLabelList(row) + formLabelRef.value.open('create', row, null, 'createLabel') //创建标签页面 createLabel 标题 + } + }) + } finally { + tableObject.loading = false + } + }) + .catch(() => { + console.info('操作取消') + tableObject.loading = false + }) }else if (val == 'point') { // 标签打印 labelPrint(row)