gaoluyang
23 小时以前 5e094c32ab1733d303f74d0b59edeb3b4047505d
中兴实强
1.报工列表展示报工人,非本订单报工人不可报工
其他
已修改1个文件
39 ■■■■■ 文件已修改
src/views/productionManagement/workOrder/index.vue 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/workOrder/index.vue
@@ -237,6 +237,21 @@
  import { getCurrentInstance, reactive, toRefs } from "vue";
  import FilesDia from "./components/filesDia.vue";
  const { proxy } = getCurrentInstance();
  const currentLoginUserId = ref("");
  const normalizeId = value => String(value ?? "").trim();
  const parseReportUserIds = reportUserIds =>
    String(reportUserIds ?? "")
      .split(",")
      .map(item => item.trim())
      .filter(Boolean);
  const canCurrentUserReport = row => {
    const currentUserId = normalizeId(currentLoginUserId.value);
    if (!currentUserId) return false;
    return parseReportUserIds(row?.reportUserIds).includes(currentUserId);
  };
  const tableColumn = ref([
    {
@@ -270,6 +285,11 @@
    {
      label: "工序名称",
      prop: "processName",
    },
    {
      label: "报工人",
      prop: "reportUserNames",
      width: "140",
    },
    {
      label: "需求数量",
@@ -338,7 +358,7 @@
          clickFun: row => {
            showReportDialog(row);
          },
          disabled: row => row.planQuantity <= 0,
          disabled: row => row.planQuantity <= 0 || !canCurrentUserReport(row),
        },
      ],
    },
@@ -595,6 +615,10 @@
  };
  const showReportDialog = row => {
    if (!canCurrentUserReport(row)) {
      proxy.$modal.msgWarning("当前登录用户没有该工单的报工权限");
      return;
    }
    currentReportRowData.value = row;
    reportForm.planQuantity = row.planQuantity;
    reportForm.quantity =
@@ -718,6 +742,18 @@
  };
  // 用户选择变化时更新 userName
  const getCurrentLoginUser = () => {
    getUserProfile()
      .then(res => {
        if (res.code === 200) {
          currentLoginUserId.value = normalizeId(res.data?.userId);
        }
      })
      .catch(err => {
        console.error("获取当前登录用户失败", err);
      });
  };
  const handleUserChange = userId => {
    if (userId) {
      const selectedUser = userOptions.value.find(user => user.userId === userId);
@@ -730,6 +766,7 @@
  };
  onMounted(() => {
    getCurrentLoginUser();
    getList();
    getUserList();
  });