viewModel.on("customInit", function (data) { // 关闭或取消关原因详情--页面初始化 viewModel.on("afterLoadData", function (event) { if ( viewModel.originalParams["SetData"] && viewModel.originalParams["SetData"] == "取消关闭" ) { viewModel.get("canCloseRea").setVisible("true"); //取消关闭显示 viewModel.get("reasonClose").setVisible("false"); //关闭隐藏 } else if ( viewModel.originalParams["SetData"] && viewModel.originalParams["SetData"] == "关闭" ) { viewModel.get("canCloseRea").setVisible("false"); //取消关闭隐藏 viewModel.get("reasonClose").setVisible("true"); //关闭显示 } }); });
//【关闭】功能 viewModel.get("button135ja").on("click", function (args) { let state = viewModel.get("state").getValue(); let reasonClose = viewModel.get("reasonClose").getValue(); if (state !== "1") { cb.utils.alert("状态为待认证才可关闭", "error"); return false; } if ( reasonClose == null || reasonClose == undefined || reasonClose == "" ) { let params = { mode: "add", setData: "关闭", }; let data = { billtype: "Voucher", billno: "f8724c3c", params: params, }; cb.loader.runCommandLine("bill", data, viewModel); } }); //【取消关闭】功能 viewModel.get("button175re").on("click", function (args) { let closeState = viewModel.get("closeState").getValue(); let canCloseRea = viewModel.get("canCloseRea").getValue(); if (closeState !== "1") { cb.utils.alert("关闭状态为已关闭才可取消关闭", "error"); return false; } if ( canCloseRea == null || canCloseRea == undefined || canCloseRea == "" ) { let params = { mode: "add", setData: "取消关闭", }; let data = { billtype: "Voucher", billno: "f8724c3c", params: params, }; cb.loader.runCommandLine("bill", data, viewModel); } });
有bug的写法 viewModel.communication({//弹出模态框 type: 'modal', payload: { mode: 'inner', groupCode: 'modal16tc', viewModel: viewModel, readOnly: false } })
有bug的样式
标签:get,viewModel,弹框,let,关闭,canCloseRea,reasonClose,隐藏,BIP From: https://www.cnblogs.com/LFxanla/p/17162774.html