From 3de9f01d6238913737dc67cfd8f2d57cc17b1e44 Mon Sep 17 00:00:00 2001 From: zhaoxuebing <1291173720@qq.com> Date: Wed, 29 May 2024 11:32:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wms/processproductionRequestMain/index.ts | 30 ++++ .../processproductionRequest/index.vue | 132 +++++++++++++++--- 2 files changed, 146 insertions(+), 16 deletions(-) diff --git a/src/api/wms/processproductionRequestMain/index.ts b/src/api/wms/processproductionRequestMain/index.ts index 66a626e93..4075041cb 100644 --- a/src/api/wms/processproductionRequestMain/index.ts +++ b/src/api/wms/processproductionRequestMain/index.ts @@ -54,4 +54,34 @@ export const exportProcessproductionRequestMain = async (params) => { // 下载用户导入模板 export const importTemplate = () => { return request.download({ url: '/wms/processproduction-request-main/get-import-template' }) +} + +// 关闭 +export const closeProcessproductionRequestMain = async (id) => { + return await request.put({ url: `/wms/processproduction-request-main/close?id=` + id }) +} + +// 重新添加 +export const reAddProcessproductionRequestMain = async (id) => { + return await request.put({ url: `/wms/processproduction-request-main/reAdd?id=` + id }) +} + +// 提交审批 +export const submitProcessproductionRequestMain = async (id) => { + return await request.put({ url: `/wms/processproduction-request-main/submit?id=` + id }) +} + +// 审批驳回 +export const refusedProcessproductionRequestMain = async (id) => { + return await request.put({ url: `/wms/processproduction-request-main/refused?id=` + id }) +} + +// 审批通过 +export const agreeProcessproductionRequestMain = async (id) => { + return await request.put({ url: `/wms/processproduction-request-main/agree?id=` + id }) +} + +// 处理 +export const handleProcessproductionRequestMain = async (id) => { + return await request.put({ url: `/wms/processproduction-request-main/handle?id=` + id }) } \ No newline at end of file diff --git a/src/views/wms/productionManage/processproduction/processproductionRequest/index.vue b/src/views/wms/productionManage/processproduction/processproductionRequest/index.vue index e5b6d824d..12c0c74b5 100644 --- a/src/views/wms/productionManage/processproduction/processproductionRequest/index.vue +++ b/src/views/wms/productionManage/processproduction/processproductionRequest/index.vue @@ -166,6 +166,16 @@ const buttonBaseClick = (val, item) => { } } + +// 根据状态返回该按钮是否显示 +const isShowMainButton = (row,val) => { + if (val.indexOf(row.status) > -1) { + return false + } else { + return true + } +} + // 列表-操作按钮 const butttondata = (row,$index) => { const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1 @@ -173,8 +183,14 @@ const butttondata = (row,$index) => { return [] } return [ - defaultButtons.mainListEditBtn({hasPermi:'wms:processproduction-request-main:update'}), // 编辑 - defaultButtons.mainListDeleteBtn({hasPermi:'wms:processproduction-request-main:delete'}), // 删除 + defaultButtons.mainListCloseBtn({hide:isShowMainButton(row,['1','2','3','4']),hasPermi:'wms:processproduction-request-main:close'}), // 关闭 + defaultButtons.mainListReAddBtn({hide:isShowMainButton(row,['4','5']),hasPermi:'wms:transferreceipt-request-main:reAdd'}), // 重新添加 + defaultButtons.mainListSubmitBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:transferreceipt-request-main:submit'}), // 提交审批 + defaultButtons.mainListTurnDownBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:transferreceipt-request-main:refused'}), // 驳回 + defaultButtons.mainListApproveBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:transferreceipt-request-main:agree'}), // 审批通过 + defaultButtons.mainListHandleBtn({hide:isShowMainButton(row,['3']),hasPermi:'wms:transferreceipt-request-main:handle'}), // 处理 + defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:processproduction-request-main:update'}), // 编辑 + defaultButtons.mainListDeleteBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:processproduction-request-main:delete'}), // 删除 ] } @@ -182,19 +198,116 @@ const buttondataTable = ref() // 列表-操作按钮事件 const buttonTableClick = async (val, row) => { - if (val == 'edit') { // 编辑 + if (val == 'mainClose') { // 关闭 + handleClose(row.masterId) + } else if(val == 'mainReAdd'){// 重新添加 + handleReAdd(row.masterId) + } else if(val == ''){ // 提交审批 + handleSubmit(row.masterId) + } else if (val == 'mainTurnDown') { // 驳回 + handleRefused(row.masterId) + } else if (val == 'mainApprove') { // 审批通过 + handleAgree(row.masterId) + } else if (val == 'mainHandle') { // 处理 + handleHandle(row.masterId) + } else if (val == 'edit') { // 编辑 openForm('update', row) } else if (val == 'delete') { // 删除 handleDelete(row.id) } } +/** 关闭按钮操作 */ +const handleClose = async (id: number) => { + try { + await message.confirm(t('common.confirmColse')) + tableObject.loading = true + await ProcessproductionRequestMainApi.closeProcessproductionRequestMain(id) + message.success(t('common.closeSuccess')) + tableObject.loading = false + await getList() + } catch {} +} + +/** 重新添加按钮操作 */ +const handleReAdd = async (id: number) => { + try { + await message.confirm(t('common.confirmReAdd')) + tableObject.loading = true + await ProcessproductionRequestMainApi.reAddProcessproductionRequestMain(id) + message.success(t('common.reAddSuccess')) + tableObject.loading = false + await getList() + } catch {} +} + +/** 提交按钮操作 */ +const handleSubmit = async (id: number) => { + try { + await message.confirm(t('common.confirmSubmit')) + tableObject.loading = true + await ProcessproductionRequestMainApi.submitProcessproductionRequestMain(id) + message.success(t('common.submitSuccess')) + tableObject.loading = false + await getList() + } catch {} +} + +/** 审批驳回按钮操作 */ +const handleRefused = async (id: number) => { + try { + await message.confirm(t('common.confirmRefused')) + tableObject.loading = true + await ProcessproductionRequestMainApi.refusedProcessproductionRequestMain(id) + message.success(t('common.refusedSuccess')) + tableObject.loading = false + await getList() + } catch {} +} + +/** 审批通过按钮操作 */ +const handleAgree = async (id: number) => { + try { + await message.confirm(t('common.confirmAgree')) + tableObject.loading = true + await ProcessproductionRequestMainApi.agreeProcessproductionRequestMain(id) + message.success(t('common.agreeSuccess')) + tableObject.loading = false + await getList() + } catch {} +} + +/** 处理按钮操作 */ +const handleHandle = async (id: number) => { + try { + await message.confirm(t('common.confirmHandle')) + tableObject.loading = true + await ProcessproductionRequestMainApi.handleProcessproductionRequestMain(id) + message.success(t('common.handleSuccess')) + tableObject.loading = false + await getList() + } catch {} +} + /** 添加/修改操作 */ const basicFormRef = ref() const openForm = (type: string, row?: any) => { basicFormRef.value.open(type, row) } +/** 删除按钮操作 */ +const handleDelete = async (id: number) => { + try { + // 删除的二次确认 + await message.delConfirm() + // 发起删除 + await ProcessproductionRequestMainApi.deleteProcessproductionRequestMain(id) + message.success(t('common.delSuccess')) + // 刷新列表 + await getList() + } catch {} +} + // 主子数据 提交 const submitForm = async (formType, data) => { @@ -241,19 +354,6 @@ const openDetail = (row: any, titleName: any, titleValue: any) => { detailRef.value.openDetail(row, titleName, titleValue, 'basicProcessproductionRequestMain') } -/** 删除按钮操作 */ -const handleDelete = async (id: number) => { - try { - // 删除的二次确认 - await message.delConfirm() - // 发起删除 - await ProcessproductionRequestMainApi.deleteProcessproductionRequestMain(id) - message.success(t('common.delSuccess')) - // 刷新列表 - await getList() - } catch {} -} - /** 导出按钮操作 */ const exportLoading = ref(false) // 导出的加载中 const handleExport = async () => {