fix(inventory): 移除不合格库存相关字段并修复日期时间处理
- 移除了不合格库存数量和不合格冻结数量表格列
- 移除了库存管理中的不合格相关字段显示
- 添加了toDateTimeString工具函数处理LocalDateTime字段
- 修复了设备巡检和维护模块中的日期时间序列化问题
- 新增危险作业审批类型和对应警告图标
- 修复了校准记录中确认人姓名显示逻辑
- 解决了安全隐患上报时间格式和审计时间字段处理问题
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * 补全时分秒,输出 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}
|
| | |
| | | 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'; |
| | |
| | | { 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' }, |
| | | ]; |
| | | |
| | | // 审批类型名称映射 |
| | |
| | | 5: '采购审批', |
| | | 6: '报价审批', |
| | | 7: '发货审批', |
| | | 8: '危险作业审批', |
| | | }; |
| | | |
| | | // 审批类型图标映射 |
| | |
| | | 5: 'ShoppingCart', |
| | | 6: 'DocumentChecked', |
| | | 7: 'Van', |
| | | 8: 'Warning', |
| | | }; |
| | | |
| | | // 审批类型颜色映射 |
| | |
| | | 5: '#909399', |
| | | 6: '#9B59B6', |
| | | 7: '#1ABC9C', |
| | | 8: '#FF7D00', |
| | | }; |
| | | |
| | | // 头像颜色池 |
| | |
| | | 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: { |
| | |
| | | }, |
| | | { |
| | | label: "确认人", |
| | | prop: "confirmerName", |
| | | prop: "confirmerId", |
| | | width: 120, |
| | | formatData: (cell) => getUserName(cell), |
| | | }, |
| | | { |
| | | label: "录入人", |
| | |
| | | proxy.$modal.msg("已取消"); |
| | | }); |
| | | }; |
| | | onMounted(() => { |
| | | onMounted(async () => { |
| | | const { data } = await userListNoPageByTenantId(); |
| | | userList.value = data || []; |
| | | getList(); |
| | | }); |
| | | </script> |
| | |
| | | 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() |
| | |
| | | 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 |
| | |
| | | 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() |
| | |
| | | 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' // 默认状态,可按实际枚举调整 |
| | |
| | | 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 |
| | |
| | | <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" |
| | |
| | | hiddenDesc: "", // 隐患描述 |
| | | createUser: "", // 上报人 |
| | | createUserName: "", |
| | | createTime: dayjs().format("YYYY-MM-DD HH:mm:ss"), // 上报时间 |
| | | createTime: dayjs().format("YYYY-MM-DD"), // 上报时间 |
| | | rectifyUserId: "", // 整改责任人 |
| | | rectifyUserName: "", |
| | | rectifyTime: "", // 整改完成期限 |
| | |
| | | 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: "", // 整改完成期限 |
| | |
| | | } |
| | | }; |
| | | |
| | | // 后端 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); |
| | |
| | | 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(); |
| | |
| | | } 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(); |
| | |
| | | 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(); |
| | |
| | | } 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(); |