云
2026-09-29 682124f3e573a24523dd643f23d16bb7d3c7e08d
fix(inventory): 移除不合格库存相关字段并修复日期时间处理

- 移除了不合格库存数量和不合格冻结数量表格列
- 移除了库存管理中的不合格相关字段显示
- 添加了toDateTimeString工具函数处理LocalDateTime字段
- 修复了设备巡检和维护模块中的日期时间序列化问题
- 新增危险作业审批类型和对应警告图标
- 修复了校准记录中确认人姓名显示逻辑
- 解决了安全隐患上报时间格式和审计时间字段处理问题
已修改8个文件
109 ■■■■■ 文件已修改
src/utils/index.js 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/collaborativeApproval/approvalManagement/index.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/equipmentManagement/calibration/index.vue 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/equipmentManagement/inspectionManagement/components/formDia.vue 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/equipmentManagement/upkeep/Form/formDia.vue 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/inventoryManagement/stockManagement/BatchNoQtyDetail.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/inventoryManagement/stockManagement/Record.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/safeProduction/dangerInvestigation/index.vue 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/index.js
@@ -41,6 +41,32 @@
}
/**
 * 补全时分秒,输出 YYYY-MM-DD HH:mm:ss,用于后端 LocalDateTime 字段。
 * 兼容 Date 对象、"YYYY-MM-DD"、"YYYY-MM-DD HH:mm"、"YYYY-MM-DDTHH:mm:ss" 等输入;
 * 空值原样返回。
 */
export function toDateTimeString(value) {
  if (value == null || value === "") return value;
  if (value instanceof Date) {
    if (Number.isNaN(value.getTime())) return "";
    const pad = (num) => String(num).padStart(2, "0");
    return `${value.getFullYear()}-${pad(value.getMonth() + 1)}-${pad(
      value.getDate()
    )} ${pad(value.getHours())}:${pad(value.getMinutes())}:${pad(
      value.getSeconds()
    )}`;
  }
  const [datePart, timePart = ""] = String(value)
    .trim()
    .replace("T", " ")
    .split(/\s+/);
  const timeUnits = timePart.split(":").filter((unit) => unit !== "");
  while (timeUnits.length < 3) timeUnits.push("00");
  const time = timeUnits.map((unit) => unit.padStart(2, "0")).join(":");
  return `${datePart} ${time}`;
}
/**
 * @param {number} time
 * @param {string} option
 * @returns {string}
src/views/collaborativeApproval/approvalManagement/index.vue
@@ -186,7 +186,7 @@
import {
  Plus, ArrowLeft, Delete, Check, RefreshLeft, Setting,
  Suitcase, Calendar, Location, Money, ShoppingCart, DocumentChecked,
  Van, ArrowRight, User, InfoFilled
  Van, ArrowRight, User, InfoFilled, Warning
} from '@element-plus/icons-vue';
import { getApproveProcessConfigNodeList, addApproveProcessConfigNode } from '@/api/collaborativeApproval/approvalManagement';
import { userListNoPage } from '@/api/system/user';
@@ -203,6 +203,7 @@
  { value: '5', label: '采购审批', icon: 'ShoppingCart', color: '#909399' },
  { value: '6', label: '报价审批', icon: 'DocumentChecked', color: '#9B59B6' },
  { value: '7', label: '发货审批', icon: 'Van', color: '#1ABC9C' },
  { value: '8', label: '危险作业审批', icon: 'Warning', color: '#FF7D00' },
];
// 审批类型名称映射
@@ -214,6 +215,7 @@
  5: '采购审批',
  6: '报价审批',
  7: '发货审批',
  8: '危险作业审批',
};
// 审批类型图标映射
@@ -225,6 +227,7 @@
  5: 'ShoppingCart',
  6: 'DocumentChecked',
  7: 'Van',
  8: 'Warning',
};
// 审批类型颜色映射
@@ -236,6 +239,7 @@
  5: '#909399',
  6: '#9B59B6',
  7: '#1ABC9C',
  8: '#FF7D00',
};
// 头像颜色池
src/views/equipmentManagement/calibration/index.vue
@@ -69,8 +69,16 @@
import useUserStore from "@/store/modules/user.js";
import CalibrationDia from "@/views/equipmentManagement/measurementEquipment/components/calibrationDia.vue";
import {ledgerRecordListPage, ledgerRecordDelete} from "@/api/equipmentManagement/calibration.js";
import {userListNoPageByTenantId} from "@/api/system/user.js";
const { proxy } = getCurrentInstance();
const userStore = useUserStore()
const userList = ref([]);
const getUserName = (userId) => {
    if (!userId) return "--";
    const user = userList.value.find(u => String(u.userId) === String(userId));
    return user ? user.nickName : userId;
};
const data = reactive({
    searchForm: {
@@ -164,8 +172,9 @@
    },
    {
        label: "确认人",
        prop: "confirmerName",
        prop: "confirmerId",
        width: 120,
        formatData: (cell) => getUserName(cell),
    },
    {
        label: "录入人",
@@ -305,7 +314,9 @@
            proxy.$modal.msg("已取消");
        });
};
onMounted(() => {
onMounted(async () => {
    const { data } = await userListNoPageByTenantId();
    userList.value = data || [];
    getList();
});
</script>
src/views/equipmentManagement/inspectionManagement/components/formDia.vue
@@ -120,6 +120,7 @@
import {addOrEditTimingTask} from "@/api/inspectionManagement/index.js";
import {userListNoPageByTenantId} from "@/api/system/user.js";
import { getDeviceLedger } from "@/api/equipmentManagement/ledger";
import { toDateTimeString } from "@/utils/index.js";
const { proxy } = getCurrentInstance()
const emit = defineEmits()
@@ -279,7 +280,12 @@
      try {
        form.value.inspectorIds = form.value.inspector.join(',')
        delete form.value.inspector
        // 后端 LocalDateTime 字段序列化后只返回年月日,回传时需补全时分秒
        ['createTime', 'updateTime', 'nextExecutionTime', 'lastExecutionTime'].forEach(key => {
          if (form.value[key]) form.value[key] = toDateTimeString(form.value[key])
        })
        if (form.value.frequencyType === 'WEEKLY') {
          let frequencyDetail = ''
          frequencyDetail = form.value.week + ',' + form.value.time
src/views/equipmentManagement/upkeep/Form/formDia.vue
@@ -188,7 +188,7 @@
import {userListNoPageByTenantId} from "@/api/system/user.js";
import { getDeviceLedger } from "@/api/equipmentManagement/ledger";
import { deviceMaintenanceTaskAdd, deviceMaintenanceTaskEdit } from "@/api/equipmentManagement/upkeep";
import { getCurrentDate } from "@/utils/index.js";
import { getCurrentDate, toDateTimeString } from "@/utils/index.js";
import useUserStore from "@/store/modules/user.js";
const { proxy } = getCurrentInstance()
@@ -334,7 +334,10 @@
                    payload.frequencyDetail = frequencyDetail
                }
                
                // 录入日期:直接使用表单里的 registrationDate 字段
                // 后端 LocalDateTime 字段序列化后只返回年月日,回传时需补全时分秒
                ['createTime', 'updateTime', 'nextExecutionTime', 'lastExecutionTime'].forEach(key => {
                    if (payload[key]) payload[key] = toDateTimeString(payload[key])
                })
                // 一些默认状态字段
                if (payload.status === undefined || payload.status === null || payload.status === '') {
                    payload.status = '0' // 默认状态,可按实际枚举调整
src/views/inventoryManagement/stockManagement/BatchNoQtyDetail.vue
@@ -30,18 +30,8 @@
            show-overflow-tooltip
          />
          <el-table-column
            label="不合格库存数量"
            prop="unQualifiedQuantity"
            show-overflow-tooltip
          />
          <el-table-column
            label="合格冻结数量"
            prop="qualifiedLockedQuantity"
            show-overflow-tooltip
          />
          <el-table-column
            label="不合格冻结数量"
            prop="unQualifiedLockedQuantity"
            show-overflow-tooltip
          />
          <el-table-column
src/views/inventoryManagement/stockManagement/Record.vue
@@ -90,14 +90,8 @@
        <el-table-column label="合格库存数量"
                         prop="qualifiedQuantity"
                         show-overflow-tooltip />
        <el-table-column label="不合格库存数量"
                         prop="unQualifiedQuantity"
                         show-overflow-tooltip />
        <el-table-column label="合格冻结数量"
                         prop="qualifiedLockedQuantity"
                         show-overflow-tooltip />
        <el-table-column label="不合格冻结数量"
                         prop="unQualifiedLockedQuantity"
                         show-overflow-tooltip />
        <el-table-column label="库存预警数量"
                         prop="warnNum"
src/views/safeProduction/dangerInvestigation/index.vue
@@ -486,7 +486,7 @@
      hiddenDesc: "", // 隐患描述
      createUser: "", // 上报人
      createUserName: "",
      createTime: dayjs().format("YYYY-MM-DD HH:mm:ss"), // 上报时间
      createTime: dayjs().format("YYYY-MM-DD"), // 上报时间
      rectifyUserId: "", // 整改责任人
      rectifyUserName: "",
      rectifyTime: "", // 整改完成期限
@@ -703,7 +703,7 @@
        hiddenDesc: "", // 隐患描述
        createUser: Number(currentUserId.value), // 上报人
        createUserName: currentUserName.value,
        createTime: dayjs().format("YYYY-MM-DD HH:mm:ss"), // 上报时间
        createTime: dayjs().format("YYYY-MM-DD"), // 上报时间
        rectifyUserId: "", // 整改责任人
        rectifyUserName: "",
        rectifyTime: "", // 整改完成期限
@@ -803,6 +803,13 @@
    }
  };
  // 后端 createTime/updateTime 为 LocalDateTime 且标注 @JsonFormat("yyyy-MM-dd"),
  // 该格式解析不了任何时间字符串(纯日期同样报错),只能不回传,由后端自动填充/保留原值
  const withoutAuditTime = obj => {
    const { createTime, updateTime, ...rest } = obj;
    return rest;
  };
  // 提交表单
  const submitForm = () => {
    console.log("operationType.value", operationType.value);
@@ -810,7 +817,7 @@
    if (operationType.value == "add") {
      proxy.$refs["formRef"].validate(valid => {
        if (valid) {
          safeHiddenAdd(form.value).then(res => {
          safeHiddenAdd(withoutAuditTime(form.value)).then(res => {
            proxy.$modal.msgSuccess("提交成功");
            closeDia();
            getList();
@@ -820,7 +827,7 @@
    } else if (operationType.value == "edit") {
      proxy.$refs["formRef"].validate(valid => {
        if (valid) {
          safeHiddenUpdate(form.value).then(res => {
          safeHiddenUpdate(withoutAuditTime(form.value)).then(res => {
            proxy.$modal.msgSuccess("提交成功");
            closeDia();
            getList();
@@ -831,7 +838,9 @@
      console.log("form2.value", form2.value);
      proxy.$refs["formRef2"].validate(valid => {
        if (valid) {
          safeHiddenUpdate({ ...form2.value, ...form.value }).then(res => {
          safeHiddenUpdate(
            withoutAuditTime({ ...form2.value, ...form.value })
          ).then(res => {
            proxy.$modal.msgSuccess("提交成功");
            closeDia();
            getList();
@@ -841,11 +850,13 @@
    } else if (operationType.value == "edit3") {
      proxy.$refs["formRef3"].validate(valid => {
        if (valid) {
          safeHiddenUpdate({
            ...form3.value,
            ...form2.value,
            ...form.value,
          }).then(res => {
          safeHiddenUpdate(
            withoutAuditTime({
              ...form3.value,
              ...form2.value,
              ...form.value,
            })
          ).then(res => {
            proxy.$modal.msgSuccess("提交成功");
            closeDia();
            getList();