|
@@ -92,9 +92,9 @@
|
|
|
class="item-content flex-col align-center justify-between"
|
|
class="item-content flex-col align-center justify-between"
|
|
|
:class="{ 'bottom-bold': item.nonSumList.length > 0 }"
|
|
:class="{ 'bottom-bold': item.nonSumList.length > 0 }"
|
|
|
v-for="nosum in item.nonSumList.filter(
|
|
v-for="nosum in item.nonSumList.filter(
|
|
|
- nosum =>
|
|
|
|
|
|
|
+ (nosum) =>
|
|
|
!keys.includes(nosum.description) &&
|
|
!keys.includes(nosum.description) &&
|
|
|
- (companyName === 'ry'
|
|
|
|
|
|
|
+ (deptName === 'ry'
|
|
|
? attrItem.description !== 'productionStatus'
|
|
? attrItem.description !== 'productionStatus'
|
|
|
: true)
|
|
: true)
|
|
|
)">
|
|
)">
|
|
@@ -197,7 +197,7 @@
|
|
|
:clearable="false"
|
|
:clearable="false"
|
|
|
:disabled="!isView"
|
|
:disabled="!isView"
|
|
|
v-model.number="nosum.fillContent"
|
|
v-model.number="nosum.fillContent"
|
|
|
- @input="val => onInputChange(val, nosum)" />
|
|
|
|
|
|
|
+ @input="(val) => onInputChange(val, nosum)" />
|
|
|
<uni-easyinput
|
|
<uni-easyinput
|
|
|
v-else
|
|
v-else
|
|
|
type="textarea"
|
|
type="textarea"
|
|
@@ -281,7 +281,7 @@
|
|
|
v-bind="defaultProps"
|
|
v-bind="defaultProps"
|
|
|
:disabled="!isView"
|
|
:disabled="!isView"
|
|
|
v-model.number="detail.currentDepth"
|
|
v-model.number="detail.currentDepth"
|
|
|
- @input="val => inputCurrentDepth(item.nonSumList)" />
|
|
|
|
|
|
|
+ @input="(val) => inputCurrentDepth(item.nonSumList)" />
|
|
|
</uni-forms-item>
|
|
</uni-forms-item>
|
|
|
<uni-forms-item
|
|
<uni-forms-item
|
|
|
label="详情"
|
|
label="详情"
|
|
@@ -385,7 +385,7 @@ const handleClickTimeRangeItem = (index, list) => {
|
|
|
reportDetailsTimeRangeRef.value.open();
|
|
reportDetailsTimeRangeRef.value.open();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-const calculateDuration = row => {
|
|
|
|
|
|
|
+const calculateDuration = (row) => {
|
|
|
if (!row.startTime || !row.endTime) {
|
|
if (!row.startTime || !row.endTime) {
|
|
|
row.duration = 0;
|
|
row.duration = 0;
|
|
|
return;
|
|
return;
|
|
@@ -404,7 +404,7 @@ const calculateDuration = row => {
|
|
|
row.duration = Number((diffMinutes / 60).toFixed(2));
|
|
row.duration = Number((diffMinutes / 60).toFixed(2));
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-const reportDetailsTimeRange = data => {
|
|
|
|
|
|
|
+const reportDetailsTimeRange = (data) => {
|
|
|
reportDetails.value[reportDetailIndex.value].startTime = data[0];
|
|
reportDetails.value[reportDetailIndex.value].startTime = data[0];
|
|
|
reportDetails.value[reportDetailIndex.value].endTime = data[1];
|
|
reportDetails.value[reportDetailIndex.value].endTime = data[1];
|
|
|
|
|
|
|
@@ -431,7 +431,7 @@ const addProductionStatusRow = () => {
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-const removeReportDetailRow = index => {
|
|
|
|
|
|
|
+const removeReportDetailRow = (index) => {
|
|
|
if (index === 0) {
|
|
if (index === 0) {
|
|
|
uni.showToast({ title: "至少填写一条生产动态", icon: "none" });
|
|
uni.showToast({ title: "至少填写一条生产动态", icon: "none" });
|
|
|
return;
|
|
return;
|
|
@@ -462,14 +462,14 @@ const inputCurrentDepth = useDebounceFn(function inputCurrentDepth(list) {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
const currentDepth = list.find(
|
|
const currentDepth = list.find(
|
|
|
- item => item?.description === "currentDepth"
|
|
|
|
|
|
|
+ (item) => item?.description === "currentDepth"
|
|
|
);
|
|
);
|
|
|
if (currentDepth) currentDepth.fillContent = latestDetail.currentDepth;
|
|
if (currentDepth) currentDepth.fillContent = latestDetail.currentDepth;
|
|
|
}
|
|
}
|
|
|
}, 300);
|
|
}, 300);
|
|
|
|
|
|
|
|
-const showDepth = computed(() => list => {
|
|
|
|
|
- return list.some(item => item.description === "currentDepth");
|
|
|
|
|
|
|
+const showDepth = computed(() => (list) => {
|
|
|
|
|
+ return list.some((item) => item.description === "currentDepth");
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
const NON_KEYS = [
|
|
const NON_KEYS = [
|
|
@@ -508,12 +508,12 @@ const keys = [
|
|
|
"otherNptReason",
|
|
"otherNptReason",
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
-const sumNonProdTimes = index => {
|
|
|
|
|
|
|
+const sumNonProdTimes = (index) => {
|
|
|
let sum = 0;
|
|
let sum = 0;
|
|
|
const { nonSumList } = dataList.value[index];
|
|
const { nonSumList } = dataList.value[index];
|
|
|
- NON_KEYS.forEach(field => {
|
|
|
|
|
|
|
+ NON_KEYS.forEach((field) => {
|
|
|
sum += Number(
|
|
sum += Number(
|
|
|
- (nonSumList || []).find(item => item.description === field)
|
|
|
|
|
|
|
+ (nonSumList || []).find((item) => item.description === field)
|
|
|
?.fillContent || 0
|
|
?.fillContent || 0
|
|
|
);
|
|
);
|
|
|
});
|
|
});
|
|
@@ -532,17 +532,19 @@ const handleInputRaw = (val, item) => {
|
|
|
const onInputChange = debounce(handleInputRaw, 500);
|
|
const onInputChange = debounce(handleInputRaw, 500);
|
|
|
|
|
|
|
|
// 校验函数:总时间必须为 24
|
|
// 校验函数:总时间必须为 24
|
|
|
-const ryValidateTotalTime = index => (rule, value, data, callback) => {
|
|
|
|
|
|
|
+const ryValidateTotalTime = (index) => (rule, value, data, callback) => {
|
|
|
const { nonSumList } = dataList.value[index];
|
|
const { nonSumList } = dataList.value[index];
|
|
|
|
|
|
|
|
const drillingTime = Number(
|
|
const drillingTime = Number(
|
|
|
- (nonSumList || []).find(item => item.description === "drillingWorkingTime")
|
|
|
|
|
- ?.fillContent || 0
|
|
|
|
|
|
|
+ (nonSumList || []).find(
|
|
|
|
|
+ (item) => item.description === "drillingWorkingTime"
|
|
|
|
|
+ )?.fillContent || 0
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
const otherTime = Number(
|
|
const otherTime = Number(
|
|
|
- (nonSumList || []).find(item => item.description === "otherProductionTime")
|
|
|
|
|
- ?.fillContent || 0
|
|
|
|
|
|
|
+ (nonSumList || []).find(
|
|
|
|
|
+ (item) => item.description === "otherProductionTime"
|
|
|
|
|
+ )?.fillContent || 0
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
const nonProdSum = sumNonProdTimes(index);
|
|
const nonProdSum = sumNonProdTimes(index);
|
|
@@ -559,11 +561,11 @@ const ryValidateTotalTime = index => (rule, value, data, callback) => {
|
|
|
return true;
|
|
return true;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-const rhValidateTotalTime = index => (rule, value, data, callback) => {
|
|
|
|
|
|
|
+const rhValidateTotalTime = (index) => (rule, value, data, callback) => {
|
|
|
const { nonSumList } = dataList.value[index];
|
|
const { nonSumList } = dataList.value[index];
|
|
|
|
|
|
|
|
const gasTime = Number(
|
|
const gasTime = Number(
|
|
|
- (nonSumList || []).find(item => item.description === "dailyInjectGasTime")
|
|
|
|
|
|
|
+ (nonSumList || []).find((item) => item.description === "dailyInjectGasTime")
|
|
|
?.fillContent || 0
|
|
?.fillContent || 0
|
|
|
);
|
|
);
|
|
|
|
|
|
|
@@ -584,11 +586,11 @@ const rhValidateTotalTime = index => (rule, value, data, callback) => {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const rules = reactive({
|
|
const rules = reactive({
|
|
|
- drillingWorkingTime: index => [
|
|
|
|
|
|
|
+ drillingWorkingTime: (index) => [
|
|
|
{ required: true, errorMessage: "请输入进尺工作时间" },
|
|
{ required: true, errorMessage: "请输入进尺工作时间" },
|
|
|
{ validateFunction: ryValidateTotalTime(index) },
|
|
{ validateFunction: ryValidateTotalTime(index) },
|
|
|
],
|
|
],
|
|
|
- dailyInjectGasTime: index => [
|
|
|
|
|
|
|
+ dailyInjectGasTime: (index) => [
|
|
|
{ required: true, errorMessage: "请输入当日运转时间" },
|
|
{ required: true, errorMessage: "请输入当日运转时间" },
|
|
|
{ validateFunction: rhValidateTotalTime(index) },
|
|
{ validateFunction: rhValidateTotalTime(index) },
|
|
|
],
|
|
],
|
|
@@ -612,7 +614,7 @@ onReady(() => {
|
|
|
console.log("onReady");
|
|
console.log("onReady");
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
-onLoad(async option => {
|
|
|
|
|
|
|
+onLoad(async (option) => {
|
|
|
console.log("onLoad", option);
|
|
console.log("onLoad", option);
|
|
|
await reloginByUserId(option.reloginUserId);
|
|
await reloginByUserId(option.reloginUserId);
|
|
|
isFromMsg.value = !!option.reloginUserId;
|
|
isFromMsg.value = !!option.reloginUserId;
|
|
@@ -630,7 +632,7 @@ onLoad(async option => {
|
|
|
wellNamePair: {},
|
|
wellNamePair: {},
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- taskOptions.value = Object.keys(daily.wellNamePair ?? {}).map(key => ({
|
|
|
|
|
|
|
+ taskOptions.value = Object.keys(daily.wellNamePair ?? {}).map((key) => ({
|
|
|
text: daily.wellNamePair[key],
|
|
text: daily.wellNamePair[key],
|
|
|
value: Number(key),
|
|
value: Number(key),
|
|
|
}));
|
|
}));
|
|
@@ -669,7 +671,7 @@ const totalNum = ref(0);
|
|
|
// 监听dataList变化,初始化时计算一次总和
|
|
// 监听dataList变化,初始化时计算一次总和
|
|
|
watch(
|
|
watch(
|
|
|
dataList,
|
|
dataList,
|
|
|
- newVal => {
|
|
|
|
|
|
|
+ (newVal) => {
|
|
|
// calculateTotalRunTime();
|
|
// calculateTotalRunTime();
|
|
|
},
|
|
},
|
|
|
{ deep: true }
|
|
{ deep: true }
|
|
@@ -725,9 +727,9 @@ const debouncedApplyAccumulatedToReport = debounce(
|
|
|
*/
|
|
*/
|
|
|
const updateAccumulatedValue = (fieldName, deviceType) => {
|
|
const updateAccumulatedValue = (fieldName, deviceType) => {
|
|
|
let total = 0;
|
|
let total = 0;
|
|
|
- dataList.value.forEach(item => {
|
|
|
|
|
|
|
+ dataList.value.forEach((item) => {
|
|
|
if (item.deviceName.includes(deviceType) && item.nonSumList) {
|
|
if (item.deviceName.includes(deviceType) && item.nonSumList) {
|
|
|
- item.nonSumList.forEach(nonSum => {
|
|
|
|
|
|
|
+ item.nonSumList.forEach((nonSum) => {
|
|
|
if (
|
|
if (
|
|
|
nonSum.type === "double" &&
|
|
nonSum.type === "double" &&
|
|
|
nonSum.name === fieldName &&
|
|
nonSum.name === fieldName &&
|
|
@@ -767,7 +769,7 @@ function applyAccumulatedToReport() {
|
|
|
recalculateAllAccumulatedValues();
|
|
recalculateAllAccumulatedValues();
|
|
|
|
|
|
|
|
const reportItem = dataList.value.find(
|
|
const reportItem = dataList.value.find(
|
|
|
- item => item.deviceName === "生产日报"
|
|
|
|
|
|
|
+ (item) => item.deviceName === "生产日报"
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
if (!reportItem) {
|
|
if (!reportItem) {
|
|
@@ -775,9 +777,9 @@ function applyAccumulatedToReport() {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- Object.keys(accumulatedValues).forEach(fieldName => {
|
|
|
|
|
|
|
+ Object.keys(accumulatedValues).forEach((fieldName) => {
|
|
|
const targetItem = reportItem.nonSumList.find(
|
|
const targetItem = reportItem.nonSumList.find(
|
|
|
- item => item.name === fieldName
|
|
|
|
|
|
|
+ (item) => item.name === fieldName
|
|
|
);
|
|
);
|
|
|
if (targetItem) {
|
|
if (targetItem) {
|
|
|
console.log(
|
|
console.log(
|
|
@@ -850,7 +852,7 @@ function calculateTotalRunTime(
|
|
|
targetFieldName
|
|
targetFieldName
|
|
|
) {
|
|
) {
|
|
|
const reportItem = dataList.value.find(
|
|
const reportItem = dataList.value.find(
|
|
|
- item => item.deviceName === "生产日报"
|
|
|
|
|
|
|
+ (item) => item.deviceName === "生产日报"
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
if (!reportItem) {
|
|
if (!reportItem) {
|
|
@@ -859,7 +861,7 @@ function calculateTotalRunTime(
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const targetItem = reportItem.nonSumList.find(
|
|
const targetItem = reportItem.nonSumList.find(
|
|
|
- item => item.name === targetFieldName
|
|
|
|
|
|
|
+ (item) => item.name === targetFieldName
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
if (!targetItem) {
|
|
if (!targetItem) {
|
|
@@ -869,9 +871,9 @@ function calculateTotalRunTime(
|
|
|
|
|
|
|
|
let total = 0;
|
|
let total = 0;
|
|
|
|
|
|
|
|
- dataList.value.forEach(item => {
|
|
|
|
|
|
|
+ dataList.value.forEach((item) => {
|
|
|
if (item.deviceName.includes(deviceNameToMatch) && item.nonSumList) {
|
|
if (item.deviceName.includes(deviceNameToMatch) && item.nonSumList) {
|
|
|
- item.nonSumList.forEach(nonSum => {
|
|
|
|
|
|
|
+ item.nonSumList.forEach((nonSum) => {
|
|
|
if (
|
|
if (
|
|
|
nonSum.type === "double" &&
|
|
nonSum.type === "double" &&
|
|
|
nonSum.name === sourceFieldName &&
|
|
nonSum.name === sourceFieldName &&
|
|
@@ -889,7 +891,7 @@ function calculateTotalRunTime(
|
|
|
targetItem.fillContent = toFixed(total);
|
|
targetItem.fillContent = toFixed(total);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const formatT = arr =>
|
|
|
|
|
|
|
+const formatT = (arr) =>
|
|
|
`${arr[0].toString().padStart(2, "0")}:${arr[1].toString().padStart(2, "0")}`;
|
|
`${arr[0].toString().padStart(2, "0")}:${arr[1].toString().padStart(2, "0")}`;
|
|
|
|
|
|
|
|
// @query所绑定的方法不要自己调用!!需要刷新列表数据时,只需要调用paging.value.reload()即可
|
|
// @query所绑定的方法不要自己调用!!需要刷新列表数据时,只需要调用paging.value.reload()即可
|
|
@@ -907,14 +909,14 @@ const queryList = (pageNo, pageSize) => {
|
|
|
orderId: params.value.orderId,
|
|
orderId: params.value.orderId,
|
|
|
// deviceCategoryId: 1,
|
|
// deviceCategoryId: 1,
|
|
|
})
|
|
})
|
|
|
- .then(async res => {
|
|
|
|
|
|
|
+ .then(async (res) => {
|
|
|
console.log("🚀 ~ res:", res);
|
|
console.log("🚀 ~ res:", res);
|
|
|
const { data } = res;
|
|
const { data } = res;
|
|
|
const resList = [].concat(data.list);
|
|
const resList = [].concat(data.list);
|
|
|
// 列表总数
|
|
// 列表总数
|
|
|
totalNum.value = data.total;
|
|
totalNum.value = data.total;
|
|
|
// 遍历列表,处理attrsDetail
|
|
// 遍历列表,处理attrsDetail
|
|
|
- resList.map(async item => {
|
|
|
|
|
|
|
+ resList.map(async (item) => {
|
|
|
const attrParams = {
|
|
const attrParams = {
|
|
|
deviceCode: item.deviceCode,
|
|
deviceCode: item.deviceCode,
|
|
|
deviceName: item.deviceName,
|
|
deviceName: item.deviceName,
|
|
@@ -938,14 +940,14 @@ const queryList = (pageNo, pageSize) => {
|
|
|
attrParams.id = attrParams.orderId;
|
|
attrParams.id = attrParams.orderId;
|
|
|
delete attrParams.orderId;
|
|
delete attrParams.orderId;
|
|
|
delete attrParams.deviceName;
|
|
delete attrParams.deviceName;
|
|
|
- resAttrs.map(rtem => {
|
|
|
|
|
|
|
+ resAttrs.map((rtem) => {
|
|
|
// 将rtem中sumList和nonSumList两个数组中的
|
|
// 将rtem中sumList和nonSumList两个数组中的
|
|
|
// fillContent字段判断是否为null, 如果为null,则赋值为0 不为null则保留两位小数
|
|
// fillContent字段判断是否为null, 如果为null,则赋值为0 不为null则保留两位小数
|
|
|
// 将attrParams合并到两个数组的每个对象中
|
|
// 将attrParams合并到两个数组的每个对象中
|
|
|
// 然后将sumList和nonSumList分别赋值给item的sumList和nonSumList
|
|
// 然后将sumList和nonSumList分别赋值给item的sumList和nonSumList
|
|
|
|
|
|
|
|
if (rtem.sumList) {
|
|
if (rtem.sumList) {
|
|
|
- rtem.sumList.map(sumItem => {
|
|
|
|
|
|
|
+ rtem.sumList.map((sumItem) => {
|
|
|
if (sumItem.fillContent == null || sumItem.fillContent == "") {
|
|
if (sumItem.fillContent == null || sumItem.fillContent == "") {
|
|
|
// console.log("🚀 ~ rtem.sumList.map ~ sumItem:", sumItem);
|
|
// console.log("🚀 ~ rtem.sumList.map ~ sumItem:", sumItem);
|
|
|
// sumItem.fillContent = 0;
|
|
// sumItem.fillContent = 0;
|
|
@@ -965,7 +967,7 @@ const queryList = (pageNo, pageSize) => {
|
|
|
}
|
|
}
|
|
|
if (rtem.nonSumList) {
|
|
if (rtem.nonSumList) {
|
|
|
//
|
|
//
|
|
|
- rtem.nonSumList.map(nonSumItem => {
|
|
|
|
|
|
|
+ rtem.nonSumList.map((nonSumItem) => {
|
|
|
if (
|
|
if (
|
|
|
nonSumItem.fillContent == null ||
|
|
nonSumItem.fillContent == null ||
|
|
|
nonSumItem.fillContent == ""
|
|
nonSumItem.fillContent == ""
|
|
@@ -994,7 +996,7 @@ const queryList = (pageNo, pageSize) => {
|
|
|
? getIntDictOptions(nonSumItem.description)
|
|
? getIntDictOptions(nonSumItem.description)
|
|
|
: getStrDictOptions(nonSumItem.description);
|
|
: getStrDictOptions(nonSumItem.description);
|
|
|
|
|
|
|
|
- nonSumItem.enumList = dictOptions.map(dict => {
|
|
|
|
|
|
|
+ nonSumItem.enumList = dictOptions.map((dict) => {
|
|
|
return {
|
|
return {
|
|
|
...dict,
|
|
...dict,
|
|
|
text: dict.label,
|
|
text: dict.label,
|
|
@@ -1018,11 +1020,11 @@ const queryList = (pageNo, pageSize) => {
|
|
|
}
|
|
}
|
|
|
item.sumList = rtem.sumList;
|
|
item.sumList = rtem.sumList;
|
|
|
|
|
|
|
|
- const timeKeys = keys.filter(k => k !== "otherNptReason");
|
|
|
|
|
|
|
+ const timeKeys = keys.filter((k) => k !== "otherNptReason");
|
|
|
|
|
|
|
|
item.nonSumList = rtem.nonSumList
|
|
item.nonSumList = rtem.nonSumList
|
|
|
.sort((a, b) => a.modelId - b.modelId)
|
|
.sort((a, b) => a.modelId - b.modelId)
|
|
|
- .map(item => {
|
|
|
|
|
|
|
+ .map((item) => {
|
|
|
if (timeKeys.includes(item.description)) {
|
|
if (timeKeys.includes(item.description)) {
|
|
|
item.fillContent = Number(item.fillContent || 0);
|
|
item.fillContent = Number(item.fillContent || 0);
|
|
|
}
|
|
}
|
|
@@ -1043,13 +1045,13 @@ const queryList = (pageNo, pageSize) => {
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
// 如果加载的数据中包含生产日报,应用累加值
|
|
// 如果加载的数据中包含生产日报,应用累加值
|
|
|
- const hasReport = resList.some(item => item.deviceName === "生产日报");
|
|
|
|
|
|
|
+ const hasReport = resList.some((item) => item.deviceName === "生产日报");
|
|
|
|
|
|
|
|
if (hasReport) {
|
|
if (hasReport) {
|
|
|
applyAccumulatedToReport();
|
|
applyAccumulatedToReport();
|
|
|
|
|
|
|
|
- reportDetailsGet(params.value.orderId).then(res => {
|
|
|
|
|
- reportDetails.value = (res.data ?? []).map(item => ({
|
|
|
|
|
|
|
+ reportDetailsGet(params.value.orderId).then((res) => {
|
|
|
|
|
+ reportDetails.value = (res.data ?? []).map((item) => ({
|
|
|
reportDate: item.reportDate ?? dayjs(params.createTime).valueOf(),
|
|
reportDate: item.reportDate ?? dayjs(params.createTime).valueOf(),
|
|
|
startTime: formatT(item.startTime),
|
|
startTime: formatT(item.startTime),
|
|
|
endTime: formatT(item.endTime),
|
|
endTime: formatT(item.endTime),
|
|
@@ -1067,7 +1069,7 @@ const queryList = (pageNo, pageSize) => {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
- .catch(res => {
|
|
|
|
|
|
|
+ .catch((res) => {
|
|
|
// 如果请求失败写paging.value.complete(false);
|
|
// 如果请求失败写paging.value.complete(false);
|
|
|
// 注意,每次都需要在catch中写这句话很麻烦,z-paging提供了方案可以全局统一处理
|
|
// 注意,每次都需要在catch中写这句话很麻烦,z-paging提供了方案可以全局统一处理
|
|
|
// 在底层的网络请求抛出异常时,写uni.$emit('z-paging-error-emit');即可
|
|
// 在底层的网络请求抛出异常时,写uni.$emit('z-paging-error-emit');即可
|
|
@@ -1112,7 +1114,7 @@ const checkRdThreshold = (item, totalValue, maxIncrement, itemName) => {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// 判断是否小于阈值 (<0)
|
|
// 判断是否小于阈值 (<0)
|
|
|
-const checkLessThreshold = item => {
|
|
|
|
|
|
|
+const checkLessThreshold = (item) => {
|
|
|
if (item.fillContent < 0) {
|
|
if (item.fillContent < 0) {
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
|
title:
|
|
title:
|
|
@@ -1126,7 +1128,7 @@ const checkLessThreshold = item => {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
// 判断是否大于阈值
|
|
// 判断是否大于阈值
|
|
|
-const checkThreshold = item => {
|
|
|
|
|
|
|
+const checkThreshold = (item) => {
|
|
|
checkLessThreshold(item);
|
|
checkLessThreshold(item);
|
|
|
// 如果threshold > 0,则判断fillContent是否大于threshold,如果大于则提示用户填写小于等于threshold的值
|
|
// 如果threshold > 0,则判断fillContent是否大于threshold,如果大于则提示用户填写小于等于threshold的值
|
|
|
if (item.fillContent > item.threshold) {
|
|
if (item.fillContent > item.threshold) {
|
|
@@ -1143,7 +1145,7 @@ const checkThreshold = item => {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// 保留两位小数
|
|
// 保留两位小数
|
|
|
-const toFixed = num => {
|
|
|
|
|
|
|
+const toFixed = (num) => {
|
|
|
if (num) {
|
|
if (num) {
|
|
|
num = Number(num);
|
|
num = Number(num);
|
|
|
num = num.toFixed(2);
|
|
num = num.toFixed(2);
|
|
@@ -1437,13 +1439,26 @@ const onSubmit = async () => {
|
|
|
|
|
|
|
|
// 查找当日运转时间H项目
|
|
// 查找当日运转时间H项目
|
|
|
|
|
|
|
|
- const otherNptTime = nonSumList.find(i => i.name === "其他非生产时间H");
|
|
|
|
|
- const runtimeItem = nonSumList.find(i => i.name === "当日运转时间H");
|
|
|
|
|
|
|
+ const otherNptTime = nonSumList.find((i) => i.name === "其他非生产时间H");
|
|
|
|
|
+ const runtimeItem = nonSumList.find((i) => i.name === "当日运转时间H");
|
|
|
const isRuntime24 =
|
|
const isRuntime24 =
|
|
|
runtimeItem &&
|
|
runtimeItem &&
|
|
|
(runtimeItem.fillContent == 24 || runtimeItem.fillContent == "24");
|
|
(runtimeItem.fillContent == 24 || runtimeItem.fillContent == "24");
|
|
|
for (const nonSumItem of nonSumList) {
|
|
for (const nonSumItem of nonSumList) {
|
|
|
// 增加判断条件:如果当日运转时间H等于24,则非生产原因和非生产时间H为非必填,否则为必填
|
|
// 增加判断条件:如果当日运转时间H等于24,则非生产原因和非生产时间H为非必填,否则为必填
|
|
|
|
|
+ if (
|
|
|
|
|
+ nonSumItem.description === "dailyGasInjection" &&
|
|
|
|
|
+ deptName.value === "rh"
|
|
|
|
|
+ ) {
|
|
|
|
|
+ if (runtimeItem.fillContent > 0 && nonSumItem.fillContent > 0) {
|
|
|
|
|
+ } else {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: "当日运转时间大于0,注气量也需要大于0",
|
|
|
|
|
+ icon: "none",
|
|
|
|
|
+ });
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
if (
|
|
if (
|
|
|
nonSumItem.name === "其他非生产时间原因" &&
|
|
nonSumItem.name === "其他非生产时间原因" &&
|
|
@@ -1515,7 +1530,7 @@ const onSubmit = async () => {
|
|
|
// 新增:针对rd公司的特殊阈值检查
|
|
// 新增:针对rd公司的特殊阈值检查
|
|
|
// 检查包含"累计公里数填报"的字段不能超过对应"累计公里数"字段 + 3000
|
|
// 检查包含"累计公里数填报"的字段不能超过对应"累计公里数"字段 + 3000
|
|
|
if (nonSumItem.name.includes("累计公里数填报")) {
|
|
if (nonSumItem.name.includes("累计公里数填报")) {
|
|
|
- const correspondingSumItem = item.sumList.find(sumItem =>
|
|
|
|
|
|
|
+ const correspondingSumItem = item.sumList.find((sumItem) =>
|
|
|
sumItem.name.includes("累计公里数")
|
|
sumItem.name.includes("累计公里数")
|
|
|
);
|
|
);
|
|
|
if (correspondingSumItem) {
|
|
if (correspondingSumItem) {
|
|
@@ -1525,7 +1540,7 @@ const onSubmit = async () => {
|
|
|
}
|
|
}
|
|
|
// 检查包含"累计运转时长填报"的字段不能超过对应"累计运转时长"字段 + 100
|
|
// 检查包含"累计运转时长填报"的字段不能超过对应"累计运转时长"字段 + 100
|
|
|
else if (nonSumItem.name.includes("累计运转时长填报")) {
|
|
else if (nonSumItem.name.includes("累计运转时长填报")) {
|
|
|
- const correspondingSumItem = item.sumList.find(sumItem =>
|
|
|
|
|
|
|
+ const correspondingSumItem = item.sumList.find((sumItem) =>
|
|
|
sumItem.name.includes("累计运转时长")
|
|
sumItem.name.includes("累计运转时长")
|
|
|
);
|
|
);
|
|
|
if (correspondingSumItem) {
|
|
if (correspondingSumItem) {
|
|
@@ -1553,7 +1568,7 @@ const onSubmit = async () => {
|
|
|
showCancel: true,
|
|
showCancel: true,
|
|
|
cancelText: "取消",
|
|
cancelText: "取消",
|
|
|
confirmText: "继续",
|
|
confirmText: "继续",
|
|
|
- success: res => {
|
|
|
|
|
|
|
+ success: (res) => {
|
|
|
if (res.confirm) {
|
|
if (res.confirm) {
|
|
|
// 用户选择继续,执行保存操作,此时才设置按钮禁用
|
|
// 用户选择继续,执行保存操作,此时才设置按钮禁用
|
|
|
submitDataWithDisable();
|
|
submitDataWithDisable();
|
|
@@ -1610,7 +1625,7 @@ const submitDataWithDisable = async () => {
|
|
|
// 新增:针对rd公司的特殊阈值检查
|
|
// 新增:针对rd公司的特殊阈值检查
|
|
|
// 检查包含"累计公里数填报"的字段不能超过对应"累计公里数"字段 + 3000
|
|
// 检查包含"累计公里数填报"的字段不能超过对应"累计公里数"字段 + 3000
|
|
|
if (nonSumItem.name.includes("累计公里数填报")) {
|
|
if (nonSumItem.name.includes("累计公里数填报")) {
|
|
|
- const correspondingSumItem = item.sumList.find(sumItem =>
|
|
|
|
|
|
|
+ const correspondingSumItem = item.sumList.find((sumItem) =>
|
|
|
sumItem.name.includes("累计公里数")
|
|
sumItem.name.includes("累计公里数")
|
|
|
);
|
|
);
|
|
|
if (correspondingSumItem) {
|
|
if (correspondingSumItem) {
|
|
@@ -1621,7 +1636,7 @@ const submitDataWithDisable = async () => {
|
|
|
}
|
|
}
|
|
|
// 检查包含"累计运转时长填报"的字段不能超过对应"累计运转时长"字段 + 100
|
|
// 检查包含"累计运转时长填报"的字段不能超过对应"累计运转时长"字段 + 100
|
|
|
else if (nonSumItem.name.includes("累计运转时长填报")) {
|
|
else if (nonSumItem.name.includes("累计运转时长填报")) {
|
|
|
- const correspondingSumItem = item.sumList.find(sumItem =>
|
|
|
|
|
|
|
+ const correspondingSumItem = item.sumList.find((sumItem) =>
|
|
|
sumItem.name.includes("累计运转时长")
|
|
sumItem.name.includes("累计运转时长")
|
|
|
);
|
|
);
|
|
|
if (correspondingSumItem) {
|
|
if (correspondingSumItem) {
|
|
@@ -1666,14 +1681,14 @@ const submitData = async () => {
|
|
|
|
|
|
|
|
console.log("处理提交用的副本数据:subDataList", subDataList);
|
|
console.log("处理提交用的副本数据:subDataList", subDataList);
|
|
|
// 2. 处理提交数据:将nonSumList和sumList合并为新数组并赋值给deviceInfoList对象,将所有的deviceInfoList合并为submitList
|
|
// 2. 处理提交数据:将nonSumList和sumList合并为新数组并赋值给deviceInfoList对象,将所有的deviceInfoList合并为submitList
|
|
|
- const submitList = subDataList.map(item => ({
|
|
|
|
|
|
|
+ const submitList = subDataList.map((item) => ({
|
|
|
deviceInfoList: [].concat(item.sumList).concat(item.nonSumList),
|
|
deviceInfoList: [].concat(item.sumList).concat(item.nonSumList),
|
|
|
}));
|
|
}));
|
|
|
console.log("提交用的数据:submitList", submitList);
|
|
console.log("提交用的数据:submitList", submitList);
|
|
|
// 3. 提交所有填写记录
|
|
// 3. 提交所有填写记录
|
|
|
const reqData = {
|
|
const reqData = {
|
|
|
createReqVO: submitList,
|
|
createReqVO: submitList,
|
|
|
- reportDetails: reportDetails.value.map(item => ({
|
|
|
|
|
|
|
+ reportDetails: reportDetails.value.map((item) => ({
|
|
|
...item,
|
|
...item,
|
|
|
taskId: taskId.value,
|
|
taskId: taskId.value,
|
|
|
})),
|
|
})),
|