diff --git a/src/api/wms/demandforecastingMain/index.ts b/src/api/wms/demandforecastingMain/index.ts index 38b2e1f9e..68b471769 100644 --- a/src/api/wms/demandforecastingMain/index.ts +++ b/src/api/wms/demandforecastingMain/index.ts @@ -48,6 +48,24 @@ export const deleteDemandforecastingMain = async (id: number) => { return await request.delete({ url: `/wms/demandforecasting-main/delete?id=` + id }) } + +// 关闭要货预测 +export const closePurchaseMain = async (id: number) => { + return await request.post({ url: `/wms/demandforecasting-main/close?id=` + id }) +} +// 打开要货预测 +export const openPurchaseMain = async (id: number) => { + return await request.post({ url: `/wms/demandforecasting-main/open?id=` + id }) +} +// 发布要货预测 +export const publishPurchaseMain = async (id: number) => { + return await request.post({ url: `/wms/demandforecasting-main/publish?id=` + id }) +} +// 下架要货预测 +export const witPurchaseMain = async (id: number) => { + return await request.post({ url: `/wms/demandforecasting-main/wit?id=` + id }) +} + // 导出要货预测主 Excel export const exportDemandforecastingMain = async (params) => { if (params.isSearch) { diff --git a/src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingMain/index.vue b/src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingMain/index.vue index 22761ad42..ebdb3590f 100644 --- a/src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingMain/index.vue +++ b/src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingMain/index.vue @@ -195,13 +195,11 @@ const butttondata = (row,$index) => { return [] } return [ - defaultButtons.mainListCloseBtn({hide:isShowMainButton(row,['1','2','3','4','6'])}), // 关闭 - defaultButtons.mainListReAddBtn({hide:isShowMainButton(row,['4','5'])}), // 重新添加 - defaultButtons.mainListSubmitBtn({hide:isShowMainButton(row,['1'])}), // 提交审批 - defaultButtons.mainListTurnDownBtn({hide:isShowMainButton(row,['2'])}), // 驳回 - defaultButtons.mainListApproveBtn({hide:isShowMainButton(row,['2'])}), // 审批通过 - defaultButtons.mainListEditBtn({hasPermi:'wms:demandforecasting-main:update'}), // 编辑 - defaultButtons.mainListDeleteBtn({hasPermi:'wms:demandforecasting-main:delete'}), // 删除 + defaultButtons.mainListOrderCloBtn({ hide: isShowMainButton(row, ['1']) }), // 关闭 + defaultButtons.mainListOrderOpeBtn({ hide: isShowMainButton(row, ['3']) }), // 打开 + defaultButtons.mainListOrderPubBtn({ hide: isShowMainButton(row, ['1']) }), // 发布 + defaultButtons.mainListOrderWitBtn({ hide: isShowMainButton(row, ['2']) }), // 下架 + defaultButtons.mainListEditBtn({ hasPermi: 'wms:demandforecasting-main:update', hide: isShowMainButton(row, ['1']) }), // 编辑 ] } @@ -209,16 +207,14 @@ const butttondata = (row,$index) => { // 列表-操作按钮事件 const buttonTableClick = async (val, row) => { - if (val == 'mainClose') { // 关闭 - console.log('列表-操作按钮事件-关闭') - } else if (val == 'mainReAdd') { // 重新添加 - console.log('列表-操作按钮事件-重新添加') - } else if (val == 'mainSubmit') { // 提交审批 - console.log('列表-操作按钮事件-提交审批') - } else if (val == 'mainTurnDown') { // 驳回 - console.log('列表-操作按钮事件-驳回') - } else if (val == 'mainApprove') { // 审批通过 - console.log('列表-操作按钮事件-审批通过') + if (val == 'mainOrderClo') { // 关闭 + handleClose(row.masterId) + } else if (val == 'mainOrderOpe') { // 打开 + handleOpen(row.masterId) + } else if (val == 'mainOrderPub') { // 发布 + handlePublish(row.masterId) + } else if (val == 'mainOrderWit') { // 下架 + handleWit(row.masterId) } else if (val == 'edit') { // 编辑 openForm('update', row) } else if (val == 'delete') { // 删除 @@ -233,6 +229,75 @@ const openForm =async (type: string, row?: number) => { formRef.value.open(type, row) } + +/** 关闭按钮操作 */ +const handleClose = async (id : number) => { + try { + // 关闭的二次确认 + await message.confirm('是否关闭所选中数据?') + tableObject.loading = true + // 发起关闭 + await DemandforecastingMainApi.closePurchaseMain(id) + message.success(t('关闭成功!')) + tableObject.loading = false + // 刷新列表 + await getList() + } catch { }finally{ + tableObject.loading = false + } + } + + /** 打开按钮操作 */ + const handleOpen = async (id : number) => { + try { + // 打开的二次确认 + await message.confirm('是否打开所选中数据?') + tableObject.loading = true + // 发起打开 + await DemandforecastingMainApi.openPurchaseMain(id) + message.success(t('打开成功!')) + tableObject.loading = false + // 刷新列表 + await getList() + } catch { }finally{ + tableObject.loading = false + } + } + + /** 发布按钮操作 */ + const handlePublish = async (id : number) => { + try { + // 发布的二次确认 + await message.confirm('是否发布所选中数据?') + tableObject.loading = true + // 发起发布 + await DemandforecastingMainApi.publishPurchaseMain(id) + message.success(t('发布成功!')) + tableObject.loading = false + // 刷新列表 + await getList() + } catch { }finally{ + tableObject.loading = false + } + } + + /** 下架按钮操作 */ + const handleWit = async (id : number) => { + try { + // 下架的二次确认 + await message.confirm('是否下架所选中数据?') + tableObject.loading = true + // 发起下架 + await DemandforecastingMainApi.witPurchaseMain(id) + message.success(t('下架成功!')) + tableObject.loading = false + // 刷新列表 + await getList() + } catch { }finally{ + tableObject.loading = false + } + } + /** 详情操作 */ const detailRef = ref() const openDetail = (row: any, titleName: any, titleValue: any) => {