Browse Source

申请流程按钮name值全局定义封装,有关使用位置替换开发

dev_web_online
安虹睿 2 years ago
parent
commit
21f2362f82
  1. 15
      fe/PC/src/mixins/drawerMixins.js
  2. 61
      fe/PC/src/utils/processButtonData.js
  3. 3
      fe/PC/src/views/rawMaterialManage/manualMaterialRequest/IssueRequest.vue

15
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('已驳回')

61
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
// 走自定义是否隐藏事件

3
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]),
],
};
},

Loading…
Cancel
Save