From 21f2362f827eb21d38fde570db577865de235d38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E8=99=B9=E7=9D=BF?= <297504645@qq.com> Date: Sun, 23 Apr 2023 14:27:47 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E6=B5=81=E7=A8=8B=E6=8C=89?= =?UTF-8?q?=E9=92=AEname=E5=80=BC=E5=85=A8=E5=B1=80=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E5=B0=81=E8=A3=85=EF=BC=8C=E6=9C=89=E5=85=B3=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E6=9B=BF=E6=8D=A2=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fe/PC/src/mixins/drawerMixins.js | 15 ++--- fe/PC/src/utils/processButtonData.js | 61 +++++++++++-------- .../manualMaterialRequest/IssueRequest.vue | 3 +- 3 files changed, 47 insertions(+), 32 deletions(-) diff --git a/fe/PC/src/mixins/drawerMixins.js b/fe/PC/src/mixins/drawerMixins.js index 490e906d8..be903feb1 100644 --- a/fe/PC/src/mixins/drawerMixins.js +++ b/fe/PC/src/mixins/drawerMixins.js @@ -5,6 +5,7 @@ import { postExportForDetail, fileStorage } from '@/api/wms-api' +import requestDataNames from "@/utils/processButtonData" import { accept, close, @@ -55,7 +56,7 @@ export const drawerMixins = { } // 申请业务 流程按钮实现 // 【提交】操作 - if (val == 'submitRequest') { + if (val == requestDataNames.submit) { that.Loading.appMainLoading = true processRequest(that.propsData.id, that.URL + '/submit/').then(res => { that.$successMsg('已提交') @@ -70,7 +71,7 @@ export const drawerMixins = { }) } // 【审批】操作 - else if (val == 'agreeRequest') { + else if (val == requestDataNames.agree) { that.Loading.appMainLoading = true processRequest(that.propsData.id, that.URL + '/agree/').then(res => { that.$successMsg('已同意') @@ -85,7 +86,7 @@ export const drawerMixins = { }) } // 【处理】操作 - else if (val == 'handleRequest') { + else if (val == requestDataNames.handle) { that.Loading.appMainLoading = true processRequest(that.propsData.id, that.URL + '/handle/').then(res => { that.$successMsg('处理完成') @@ -100,7 +101,7 @@ export const drawerMixins = { }) } // 【执行】操作 - else if (val == 'againHandleRequest') { // 针对部分完成情况下,再次执行任务操作 + else if (val == requestDataNames.againHandle) { // 针对部分完成情况下,再次执行任务操作 that.Loading.appMainLoading = true processRequest(that.propsData.id, that.URL + '/handle/').then(res => { that.$successMsg('执行成功') @@ -115,7 +116,7 @@ export const drawerMixins = { }) } // 【中止】操作 - else if (val == 'abortRequest') { + else if (val == requestDataNames.abort) { that.Loading.appMainLoading = true processRequest(that.propsData.id, that.URL + '/abort/').then(res => { that.$successMsg('已中止') @@ -145,7 +146,7 @@ export const drawerMixins = { }) } // 【取消】操作 - else if (val == 'cancelRequest') { + else if (val == requestDataNames.cancel) { that.Loading.appMainLoading = true processRequest(that.propsData.id, that.URL + '/cancel/').then(res => { that.$successMsg('已取消') @@ -160,7 +161,7 @@ export const drawerMixins = { }) } // 【驳回】操作 - else if (val == 'refuseRequest') { + else if (val == requestDataNames.refuse) { that.Loading.appMainLoading = true processRequest(that.propsData.id, that.URL + '/refuse/').then(res => { that.$successMsg('已驳回') diff --git a/fe/PC/src/utils/processButtonData.js b/fe/PC/src/utils/processButtonData.js index a50c346db..5430f35c7 100644 --- a/fe/PC/src/utils/processButtonData.js +++ b/fe/PC/src/utils/processButtonData.js @@ -1,9 +1,20 @@ +const requestDataNames = { + submit:'submitRequest',//提交 + agree:'agreeRequest',//审批 + handle:'handleRequest',//处理 + againHandle:"againHandleRequest",//执行 + abort:'abortRequest',//中止 + refuse:'refuseRequest',//驳回 + cancel:'cancelRequest',//取消 +} +export default requestDataNames; + //申请流程按钮 /** * @param {*} that 主页this - * @param {*} label 特殊label名称更改 示例:{submitRequest:'确认提交'} - * @param {*} initHide 自定义返回是否隐藏函数 {submitRequest:() => {return false)} - * @param {*} noShow 不显示的按钮 示例:['submitRequest'] + * @param {*} label 特殊label名称更改 示例:{againHandleRequest:'确认提交'} + * @param {*} initHide 自定义返回是否隐藏函数 {againHandleRequest:() => {return false)} + * @param {*} noShow 不显示的按钮 示例:['againHandleRequest'] * initHide优先级大于noShow 如果initHide和noShow中都有对应数据,则noShow无效 * vue调用文件参考示例: * 1、使用 label 更改按钮名称 @@ -28,63 +39,63 @@ type: 'primary', icon: 'el-icon-circle-check', // label: label==undefined?'提交':label, - label: changeLabelText(label,'submitRequest')?changeLabelText(label,'submitRequest'):'提交', - name: "submitRequest", - hide: () => { return hideButtonRequest(that, [1], initHide, noShow , 'submitRequest') }, + label: changeLabelText(label,requestDataNames.submit)?changeLabelText(label,requestDataNames.submit):'提交', + name: requestDataNames.submit, + hide: () => { return hideButtonRequest(that, [1], initHide, noShow , requestDataNames.submit) }, size: 'mini' }, { type: 'primary', icon: 'el-icon-circle-check', // label: label==undefined?'审批':label, - label: changeLabelText(label,'agreeRequest')?changeLabelText(label,'agreeRequest'):'审批', - name: "agreeRequest", - hide: () => { return hideButtonRequest(that, [2], initHide, noShow , 'agreeRequest') }, + label: changeLabelText(label,requestDataNames.agree)?changeLabelText(label,requestDataNames.agree):'审批', + name: requestDataNames.agree, + hide: () => { return hideButtonRequest(that, [2], initHide, noShow , requestDataNames.agree) }, size: 'mini' }, { type: 'primary', icon: 'el-icon-circle-check', // label: label==undefined?'处理':label, - label: changeLabelText(label,'handleRequest')?changeLabelText(label,'handleRequest'):'处理', - name: "handleRequest", - hide: () => { return hideButtonRequest(that, [4], initHide, noShow , 'handleRequest') }, + label: changeLabelText(label,requestDataNames.handle)?changeLabelText(label,requestDataNames.handle):'处理', + name: requestDataNames.handle, + hide: () => { return hideButtonRequest(that, [4], initHide, noShow , requestDataNames.handle) }, size: 'mini' }, { type: 'primary', icon: 'el-icon-circle-check', // label: '执行', - label: changeLabelText(label,'againHandleRequest')?changeLabelText(label,'againHandleRequest'):'执行', - name: "againHandleRequest", - hide: () => { return hideButtonRequest(that, [9], initHide, noShow , 'againHandleRequest') }, + label: changeLabelText(label,requestDataNames.againHandle)?changeLabelText(label,requestDataNames.againHandle):'执行', + name: requestDataNames.againHandle, + hide: () => { return hideButtonRequest(that, [9], initHide, noShow , requestDataNames.againHandle) }, size: 'mini' }, { type: 'danger', icon: 'el-icon-delete-solid', // label: '中止', - label: changeLabelText(label,'abortRequest')?changeLabelText(label,'abortRequest'):'中止', - name: "abortRequest", - hide: () => { return hideButtonRequest(that, [5], initHide, noShow , 'abortRequest') }, + label: changeLabelText(label,requestDataNames.abort)?changeLabelText(label,requestDataNames.abort):'中止', + name: requestDataNames.abort, + hide: () => { return hideButtonRequest(that, [5], initHide, noShow , requestDataNames.abort) }, size: 'mini' }, { type: 'danger', icon: 'el-icon-circle-check', // label: '驳回', - label: changeLabelText(label,'refuseRequest')?changeLabelText(label,'refuseRequest'):'驳回', - name: "refuseRequest", - hide: () => { return hideButtonRequest(that, [2], initHide, noShow , 'refuseRequest') }, + label: changeLabelText(label,requestDataNames.refuse)?changeLabelText(label,requestDataNames.refuse):'驳回', + name: requestDataNames.refuse, + hide: () => { return hideButtonRequest(that, [2], initHide, noShow , requestDataNames.refuse) }, size: 'mini' }, { type: 'danger', icon: 'el-icon-delete-solid', // label: '取消', - label: changeLabelText(label,'cancelRequest')?changeLabelText(label,'cancelRequest'):'取消', - name: "cancelRequest", - hide: () => { return hideButtonRequest(that, [1,2,4], initHide, noShow , 'cancelRequest') }, + label: changeLabelText(label,requestDataNames.cancel)?changeLabelText(label,requestDataNames.cancel):'取消', + name: requestDataNames.cancel, + hide: () => { return hideButtonRequest(that, [1,2,4], initHide, noShow , requestDataNames.cancel) }, size: 'mini' }, // { @@ -156,6 +167,8 @@ ] } + + function hideButtonRequest(that, val, initHide, noShow, name) { let data = true // 走自定义是否隐藏事件 diff --git a/fe/PC/src/views/rawMaterialManage/manualMaterialRequest/IssueRequest.vue b/fe/PC/src/views/rawMaterialManage/manualMaterialRequest/IssueRequest.vue index c5b852f75..38d90b82d 100644 --- a/fe/PC/src/views/rawMaterialManage/manualMaterialRequest/IssueRequest.vue +++ b/fe/PC/src/views/rawMaterialManage/manualMaterialRequest/IssueRequest.vue @@ -66,6 +66,7 @@ import { drawerMixins } from "@/mixins/drawerMixins" import { TableHeaderMixins } from "@/mixins/TableHeaderMixins" import { mixins } from "@/mixins/mixins" import { requestData } from "@/utils/processButtonData" +import requestDataNames from "@/utils/processButtonData" export default { name: "IssueRequest", mixins: [ @@ -115,7 +116,7 @@ export default { hide: () => { return this.againHandleRequestInit([9])}, size: 'mini' }, - ...requestData(this,false,false,['againHandleRequest']), + ...requestData(this,false,false,[requestDataNames.againHandle]), ], }; },