Commit dd97e8d1 by qiaoyanqi

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

parent 90563ee3
...@@ -149,47 +149,73 @@ export default { ...@@ -149,47 +149,73 @@ export default {
}) })
}, },
getBillStateDisable(val, btnItem) { getBillStateDisable(val, btnItem) {
if (!val) return false console.log(this.define.btnGroupAction[btnItem], val, btnItem);
let approveState = null 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 {
if (!val) return false;
let approveState = null;
if (this.workflowState === 0) { if (this.workflowState === 0) {
approveState = this.context.bill.getMasterData().getValue('billState') approveState = this.context.bill
.getMasterData()
.getValue("billState");
} else { } else {
approveState = this.workflowState approveState = this.workflowState;
} }
let disableState = val.split(';') let disableState = val.split(";");
// 配置工作流已提交未审批90, billReadOnly状态下可用 // 配置工作流已提交未审批90, billReadOnly状态下可用
// 主要用于保存在审批状态下可用,审批还能修改·· // 主要用于保存在审批状态下可用,审批还能修改··
if (this.define.btnGroupAction && this.define.btnGroupAction[btnItem] && this.define.btnGroupAction[btnItem].isApprove) { if (
disableState = disableState.filter(item => { this.define.btnGroupAction &&
if (item === '90') { this.define.btnGroupAction[btnItem] &&
return false this.define.btnGroupAction[btnItem].isApprove
) {
disableState = disableState.filter((item) => {
if (item === "90") {
return false;
} else { } else {
return true return true;
} }
}) });
} }
const getBillState = () => { const getBillState = () => {
if (this.tmpBill.state === '') { if (this.tmpBill.state === "") {
return disableState.includes('billEdit') return disableState.includes("billEdit");
} else if (this.tmpBill.state === 'readOnly') { } else if (this.tmpBill.state === "readOnly") {
return disableState.includes('billReadOnly') return disableState.includes("billReadOnly");
} else { } else {
return false return false;
}
} }
};
switch (approveState) { switch (approveState) {
case 90: // 待审批 case 90: // 待审批
return disableState.includes('90') return disableState.includes("90");
case 91: // 被驳回 case 91: // 被驳回
return disableState.includes('91') || getBillState() return disableState.includes("91") || getBillState();
case 92: // 审批完成 case 92: // 审批完成
return disableState.includes('92') return disableState.includes("92");
case 1: // 已暂存 case 1: // 已暂存
return disableState.includes('1') || getBillState() return disableState.includes("1") || getBillState();
case 2: // 已保存 case 2: // 已保存
return disableState.includes('2') || getBillState() return disableState.includes("2") || getBillState();
default: default:
return getBillState() 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