Commit dd97e8d1 by qiaoyanqi

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

parent 90563ee3
...@@ -149,48 +149,74 @@ export default { ...@@ -149,48 +149,74 @@ export default {
}) })
}, },
getBillStateDisable(val, btnItem) { getBillStateDisable(val, btnItem) {
if (!val) return false console.log(this.define.btnGroupAction[btnItem], val, btnItem);
let approveState = null if (//不走工作流的情况下,执行自定义的按钮禁用状态
if (this.workflowState === 0) { this.define.btnGroupAction &&
approveState = this.context.bill.getMasterData().getValue('billState') 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 { } else {
approveState = this.workflowState if (!val) return false;
} let approveState = null;
let disableState = val.split(';') if (this.workflowState === 0) {
// 配置工作流已提交未审批90, billReadOnly状态下可用 approveState = this.context.bill
// 主要用于保存在审批状态下可用,审批还能修改·· .getMasterData()
if (this.define.btnGroupAction && this.define.btnGroupAction[btnItem] && this.define.btnGroupAction[btnItem].isApprove) { .getValue("billState");
disableState = disableState.filter(item => { } else {
if (item === '90') { approveState = this.workflowState;
return false }
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 { } else {
return true return false;
} }
}) };
} switch (approveState) {
const getBillState = () => { case 90: // 待审批
if (this.tmpBill.state === '') { return disableState.includes("90");
return disableState.includes('billEdit') case 91: // 被驳回
} else if (this.tmpBill.state === 'readOnly') { return disableState.includes("91") || getBillState();
return disableState.includes('billReadOnly') case 92: // 审批完成
} else { return disableState.includes("92");
return false 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 { ...@@ -17,7 +17,7 @@ export default {
"layout":[] "layout":[]
}, },
"value": "Achievements", "value": "Achievements",
"path": "单据/通用" "path": "报销/通用"
}, },
{ {
"title": "Tab切换容器", "title": "Tab切换容器",
...@@ -91,7 +91,7 @@ export default { ...@@ -91,7 +91,7 @@ export default {
}] }]
}, },
"value": "linkShowDetail", "value": "linkShowDetail",
"path": "单据/通用" "path": "报销/通用"
}, },
{ {
"title": "按钮组扩展", "title": "按钮组扩展",
...@@ -107,7 +107,7 @@ export default { ...@@ -107,7 +107,7 @@ export default {
] ]
}, },
"value": "buttonGroupControl", "value": "buttonGroupControl",
"path": "单据/通用" "path": "报销/通用"
}, },
{ {
"title": "用户选择", "title": "用户选择",
...@@ -1793,7 +1793,7 @@ export default { ...@@ -1793,7 +1793,7 @@ export default {
"value": "copyBillAction" "value": "copyBillAction"
}, { }, {
"discard": false, "discard": false,
"path": "单据/缓存单据数据", "path": "报销/通用",
"extends": { "extends": {
"param": [{ "param": [{
"clearable": true, "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