| | |
| | | :disabled="isOperationDisabled(o, scope.row)" |
| | | :style="{ |
| | | color: getOperationColor(o, scope.row), |
| | | fontWeight: 'bold', |
| | | }" |
| | | >{{ o.name }}</el-button |
| | | > |
| | |
| | | return format(val); |
| | | } else return val; |
| | | }; |
| | | const validTagTypes = ["primary", "success", "info", "warning", "danger"]; |
| | | |
| | | const formatType = (val, format) => { |
| | | if (typeof format === "function") { |
| | | return format(val); |
| | | } else return ""; |
| | | const type = typeof format === "function" ? format(val) : undefined; |
| | | return validTagTypes.includes(type) ? type : undefined; |
| | | }; |
| | | |
| | | const isOperationDisabled = (operation, row) => { |
| | |
| | | const baseColor = |
| | | operation?.name === "删除" || operation?.name === "delete" |
| | | ? "#D93025" |
| | | : operation?.name === "详情" |
| | | ? "#67C23A" |
| | | : operation?.color || "var(--el-color-primary)"; |
| | | |
| | | if (isOperationDisabled(operation, row)) { |