| | |
| | | type="primary" |
| | | @click="openForm('view', scope.row)">详情 |
| | | </el-button> |
| | | <el-button link |
| | | type="primary" |
| | | @click="openForm('edit', scope.row)" |
| | | :disabled="!scope.row.isEdit || scope.row.hasProductionRecord || !canEditLedger(scope.row)">编辑 |
| | | </el-button> |
| | | <el-tooltip :content="editDisabledReason(scope.row)" |
| | | :disabled="!editDisabledReason(scope.row)" |
| | | placement="top"> |
| | | <span> |
| | | <el-button link |
| | | type="primary" |
| | | @click="openForm('edit', scope.row)" |
| | | :disabled="isLedgerEditDisabled(scope.row)">编辑 |
| | | </el-button> |
| | | </span> |
| | | </el-tooltip> |
| | | <el-button link |
| | | type="primary" |
| | | @click="openFileDialog(scope.row)">附件 |
| | |
| | | }; |
| | | const canEditLedger = row => isCurrentUserMaintainer(row); |
| | | const canDeleteLedger = row => isCurrentUserMaintainer(row); |
| | | /** |
| | | * 需要生产的订单:生产计划已下发(含部分下发)后不可编辑; |
| | | * 走库存的订单:已发货后不可编辑,否则可以编辑。 |
| | | */ |
| | | const editDisabledReason = row => { |
| | | if (!row) return ""; |
| | | if (!canEditLedger(row)) return "当前系统登录人不是维护人,不能编辑数据"; |
| | | if (row.hasProductionRecord) return "生产计划已下发,不能编辑"; |
| | | if (!row.isEdit) return "订单已发货,不能编辑"; |
| | | return ""; |
| | | }; |
| | | const isLedgerEditDisabled = row => !!editDisabledReason(row); |
| | | const sensitiveAmountFormatter = (row, column, cellValue) => { |
| | | if (!isCurrentUserMaintainer(row)) { |
| | | return "*****"; |
| | |
| | | }; |
| | | // 打开弹框 |
| | | const openForm = async (type, row) => { |
| | | if (type === "edit" && row && !canEditLedger(row)) { |
| | | proxy.$modal.msgWarning("当前系统登录人不是维护人,不能编辑数据"); |
| | | return; |
| | | if (type === "edit" && row) { |
| | | const disabledReason = editDisabledReason(row); |
| | | if (disabledReason) { |
| | | proxy.$modal.msgWarning(disabledReason); |
| | | return; |
| | | } |
| | | } |
| | | operationType.value = type; |
| | | form.value = {}; |