gongchunyi
2026-09-21 b13a739a890be68bdb597fb4602fd009c88503bb
fix: 销售订单未下发/发货则可以进行编辑
已修改1个文件
37 ■■■■■ 文件已修改
src/views/salesManagement/salesLedger/index.vue 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/salesLedger/index.vue
@@ -270,11 +270,17 @@
                       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)">附件
@@ -1557,6 +1563,18 @@
  };
  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 "*****";
@@ -1733,9 +1751,12 @@
  };
  // 打开弹框
  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 = {};