需要根据某个条件判断改变表格显示时,根据isZHAdmin进行判断。
getTableColsByUser() { let cols = [ { name: "工单名称", index: "wo_name", slot: "wo_name", edit: true, width: 150 }, { name: "执行时间", index: "execute_time", edit: true, width: 200 }, { name: "结束时间", index: "execute_end_time", width: 200 }, { name: "来源", index: "source_cn", width: 130 }, { name: "创建人", index: "realname", width: 130, edit: true }, { name: "审核人", index: "verify_user_real_name", width: 110, edit: true }, { name: "创建时间", index: "create_time", width: 200 } ]; if (this.isZHAdmin()) { cols.splice(0, 0, { name: "工单号", index: "boss_id", slot: "boss_id", edit: true, width: 150 }); } else { cols.splice(0, 0, { name: "总行工单号", index: "boss_id", slot: "boss_id", edit: true, width: 150 }); cols.splice(0, 0, { name: "BHC工单号", index: "bf_id", slot: "bf_id", edit: true, width: 150 }); cols.splice(0, 0, { name: "工单号", index: "wo_id", slot: "wo_id", width: 150 }); } return cols; }, isZHAdmin() { return this.loginUser.roleName == "总行用户"; },
原文:https://www.cnblogs.com/qcq0703/p/11722319.html