Commit dd97e8d1 by qiaoyanqi

按钮组扩展按钮自定义配置禁用

parent 90563ee3
......@@ -149,48 +149,74 @@ export default {
})
},
getBillStateDisable(val, btnItem) {
if (!val) return false
let approveState = null
if (this.workflowState === 0) {
approveState = this.context.bill.getMasterData().getValue('billState')
console.log(this.define.btnGroupAction[btnItem], val, btnItem);
if (//不走工作流的情况下,执行自定义的按钮禁用状态
this.define.btnGroupAction &&
this.define.btnGroupAction[btnItem] &&
this.define.btnGroupAction[btnItem].disArr &&
this.define.btnGroupAction[btnItem].disArr.length > 0
) {
let arr = this.define.btnGroupAction[btnItem].disArr;
let flag = false;//不禁用
for(let i=0;i<arr.length;i++){
let valueArr = arr[i].value.split(";");
let billField = this.context.bill.getMasterData().getValue(arr[i].key.split('.')[1]);
if(valueArr.includes(billField)){
flag = true;//禁用
break;
}
}
return flag;
} else {
approveState = this.workflowState
}
let disableState = val.split(';')
// 配置工作流已提交未审批90, billReadOnly状态下可用
// 主要用于保存在审批状态下可用,审批还能修改··
if (this.define.btnGroupAction && this.define.btnGroupAction[btnItem] && this.define.btnGroupAction[btnItem].isApprove) {
disableState = disableState.filter(item => {
if (item === '90') {
return false
if (!val) return false;
let approveState = null;
if (this.workflowState === 0) {
approveState = this.context.bill
.getMasterData()
.getValue("billState");
} else {
approveState = this.workflowState;
}
let disableState = val.split(";");
// 配置工作流已提交未审批90, billReadOnly状态下可用
// 主要用于保存在审批状态下可用,审批还能修改··
if (
this.define.btnGroupAction &&
this.define.btnGroupAction[btnItem] &&
this.define.btnGroupAction[btnItem].isApprove
) {
disableState = disableState.filter((item) => {
if (item === "90") {
return false;
} else {
return true;
}
});
}
const getBillState = () => {
if (this.tmpBill.state === "") {
return disableState.includes("billEdit");
} else if (this.tmpBill.state === "readOnly") {
return disableState.includes("billReadOnly");
} else {
return true
return false;
}
})
}
const getBillState = () => {
if (this.tmpBill.state === '') {
return disableState.includes('billEdit')
} else if (this.tmpBill.state === 'readOnly') {
return disableState.includes('billReadOnly')
} else {
return false
};
switch (approveState) {
case 90: // 待审批
return disableState.includes("90");
case 91: // 被驳回
return disableState.includes("91") || getBillState();
case 92: // 审批完成
return disableState.includes("92");
case 1: // 已暂存
return disableState.includes("1") || getBillState();
case 2: // 已保存
return disableState.includes("2") || getBillState();
default:
return getBillState();
}
}
switch (approveState) {
case 90: // 待审批
return disableState.includes('90')
case 91: // 被驳回
return disableState.includes('91') || getBillState()
case 92: // 审批完成
return disableState.includes('92')
case 1: // 已暂存
return disableState.includes('1') || getBillState()
case 2: // 已保存
return disableState.includes('2') || getBillState()
default:
return getBillState()
}
},
},
}
......
......@@ -17,7 +17,7 @@ export default {
"layout":[]
},
"value": "Achievements",
"path": "单据/通用"
"path": "报销/通用"
},
{
"title": "Tab切换容器",
......@@ -91,7 +91,7 @@ export default {
}]
},
"value": "linkShowDetail",
"path": "单据/通用"
"path": "报销/通用"
},
{
"title": "按钮组扩展",
......@@ -107,7 +107,7 @@ export default {
]
},
"value": "buttonGroupControl",
"path": "单据/通用"
"path": "报销/通用"
},
{
"title": "用户选择",
......@@ -1793,7 +1793,7 @@ export default {
"value": "copyBillAction"
}, {
"discard": false,
"path": "单据/缓存单据数据",
"path": "报销/通用",
"extends": {
"param": [{
"clearable": true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment