|
@@ -1413,9 +1413,38 @@ const isSubmitting = ref(false); // 添加提交状态
|
|
|
// submitDataWithDisable();
|
|
// submitDataWithDisable();
|
|
|
// };
|
|
// };
|
|
|
|
|
|
|
|
-const formRef = ref(null);
|
|
|
|
|
-
|
|
|
|
|
-const onSubmit = async () => {
|
|
|
|
|
|
|
+const formRef = ref(null);
|
|
|
|
|
+
|
|
|
|
|
+const isBlankValue = (value) =>
|
|
|
|
|
+ value === null || value === undefined || value === "";
|
|
|
|
|
+
|
|
|
|
|
+const validateReportMalfunction = (item) => {
|
|
|
|
|
+ if (
|
|
|
|
|
+ !["ry", "rh"].includes(deptName.value) ||
|
|
|
|
|
+ item.deviceName !== "生产日报"
|
|
|
|
|
+ ) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const nonSumList = Array.isArray(item.nonSumList) ? item.nonSumList : [];
|
|
|
|
|
+ const accidentTime = nonSumList.find((nosum) => nosum.name === "工程质量H");
|
|
|
|
|
+ const malfunction = nonSumList.find((nosum) => nosum.name === "故障情况");
|
|
|
|
|
+
|
|
|
|
|
+ if (
|
|
|
|
|
+ Number(accidentTime?.fillContent || 0) > 0 &&
|
|
|
|
|
+ isBlankValue(malfunction?.fillContent)
|
|
|
|
|
+ ) {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: "工程质量H大于0时,故障情况必填",
|
|
|
|
|
+ icon: "none",
|
|
|
|
|
+ });
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return true;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+const onSubmit = async () => {
|
|
|
try {
|
|
try {
|
|
|
if (formRef.value) {
|
|
if (formRef.value) {
|
|
|
for (const item of formRef.value) {
|
|
for (const item of formRef.value) {
|
|
@@ -1438,10 +1467,14 @@ const onSubmit = async () => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 1. 校验所有必填项 - 在这里进行所有基础校验
|
|
// 1. 校验所有必填项 - 在这里进行所有基础校验
|
|
|
- for (const item of dataList.value) {
|
|
|
|
|
- const nonSumList = Array.isArray(item.nonSumList) ? item.nonSumList : [];
|
|
|
|
|
-
|
|
|
|
|
- // 查找当日运转时间H项目
|
|
|
|
|
|
|
+ for (const item of dataList.value) {
|
|
|
|
|
+ const nonSumList = Array.isArray(item.nonSumList) ? item.nonSumList : [];
|
|
|
|
|
+
|
|
|
|
|
+ if (!validateReportMalfunction(item)) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 查找当日运转时间H项目
|
|
|
|
|
|
|
|
const otherNptTime = nonSumList.find((i) => i.name === "其他非生产时间H");
|
|
const otherNptTime = nonSumList.find((i) => i.name === "其他非生产时间H");
|
|
|
const runtimeItem = nonSumList.find((i) => i.name === "当日运转时间H");
|
|
const runtimeItem = nonSumList.find((i) => i.name === "当日运转时间H");
|