diff --git a/src/views/andonManagement/AndonAlarmLevel/index.vue b/src/views/andonManagement/AndonAlarmLevel/index.vue
index 124aa32..daabd0b 100644
--- a/src/views/andonManagement/AndonAlarmLevel/index.vue
+++ b/src/views/andonManagement/AndonAlarmLevel/index.vue
@@ -79,7 +79,11 @@
-
+
+
+
+
+
@@ -184,6 +188,11 @@
{ index: 7, key: 'updatedBy', label: `更新人`, checked: true },
{ index: 8, key: 'updatedTime', label: `更新时间`, checked: true },
],
+ lightColorOptions:[
+ { value: '红色', label: '红色' },
+ { value: '黄色', label: '黄色' },
+ { value: '绿色', label: '绿色' },
+ ],
// 数据列表
dataList: [],
// 总记录数
diff --git a/src/views/productManagement/workorder2.vue b/src/views/productManagement/workorder2.vue
index 9d38a3f..b05caf8 100644
--- a/src/views/productManagement/workorder2.vue
+++ b/src/views/productManagement/workorder2.vue
@@ -110,8 +110,8 @@
-
+
@@ -183,8 +183,8 @@
v-model="workorderItem.remark2" placeholder="备注2">
-
+
@@ -295,7 +295,9 @@ export default {
{ state: 5, color: '#ffffd5', text: '物料不包含此描述' },
],
tableAllData: [],
- debounceTimers: {},
+ // 修改防抖机制
+ updateQueue: new Map(), // 存储待更新的行
+ updateTimer: null, // 统一的更新定时器
isEditing: false
}
},
@@ -355,8 +357,7 @@ export default {
this.getList()
},
getList() {
- if (this.isEditing) return;
-
+ // 移除 isEditing 检查,避免阻塞更新
const query = { ...this.search, ...this.pagination }
query.week = query.week ?? -1;
query.year = query.year ?? -1;
@@ -370,8 +371,8 @@ export default {
this.workorder_table_data = pageRes.data.item1.map(item => {
return {
...item,
- pQualifiedNum: item.pQualifiedNum !== null && item.pQualifiedNum !== undefined
- ? Number(item.pQualifiedNum)
+ pQualifiedNum: item.pQualifiedNum !== null && item.pQualifiedNum !== undefined
+ ? Number(item.pQualifiedNum)
: 0,
pQualifiedRate: item.pQualifiedRate !== null && item.pQualifiedRate !== undefined
? parseFloat(item.pQualifiedRate).toFixed(2)
@@ -404,12 +405,14 @@ export default {
const previousNum = parseFloat(row.previousNumber) || 0;
if (previousNum > 0 && !isNaN(qualifiedNum)) {
- const rate = (qualifiedNum / previousNum)
+ const rate = (qualifiedNum / previousNum) * 100;
this.$set(row, 'pQualifiedRate', rate.toFixed(2));
} else {
this.$set(row, 'pQualifiedRate', '0.00');
}
- this.autoUpdateWorkorder(row);
+
+ // 添加到更新队列
+ this.addToUpdateQueue(row);
},
formatQualifiedNum(row) {
@@ -424,41 +427,62 @@ export default {
const rate = parseFloat(row.pQualifiedRate);
this.$set(row, 'pQualifiedRate', isNaN(rate) ? '0.00' : rate.toFixed(2));
this.isEditing = false;
- this.autoUpdateWorkorder(row);
+
+ // 添加到更新队列
+ this.addToUpdateQueue(row);
},
- autoUpdateWorkorder(row) {
- if (this.debounceTimers[row.id]) {
- clearTimeout(this.debounceTimers[row.id]);
+ // 新增方法:添加到更新队列
+ addToUpdateQueue(row) {
+ // 将行数据添加到更新队列中
+ this.updateQueue.set(row.id, {...row});
+
+ // 清除之前的定时器
+ if (this.updateTimer) {
+ clearTimeout(this.updateTimer);
}
-
- this.debounceTimers[row.id] = setTimeout(() => {
- const updateData = { ...row };
- updateData.pQualifiedNum = Number(updateData.pQualifiedNum) || 0;
- let rate = Number(updateData.pQualifiedRate);
- updateData.pQualifiedRate = isNaN(rate) ? '0.00' : rate.toFixed(2);
-
- updateData.vehicleNumber = Number(updateData.vehicleNumber) || 0;
- updateData.hangNumber = Number(updateData.hangNumber) || 0;
- updateData.previousNumber = Number(updateData.previousNumber) || 0;
-
- updateworkorder(updateData).then(res => {
- if (res.code === 200) {
- this.$notify.success('更新成功');
- setTimeout(() => {
- this.getList();
- }, 300);
- } else {
- this.$notify.error(res.msg || '更新失败');
- }
- }).catch(error => {
- console.error('更新失败:', error);
- this.$notify.error('网络异常,更新失败');
- }).finally(() => {
- delete this.debounceTimers[row.id];
- });
+
+ // 设置新的定时器
+ this.updateTimer = setTimeout(() => {
+ this.processUpdateQueue();
}, 1500);
},
+
+ // 新增方法:处理更新队列
+ async processUpdateQueue() {
+ // 获取所有待更新的行
+ const rowsToUpdate = Array.from(this.updateQueue.values());
+
+ // 清空队列
+ this.updateQueue.clear();
+
+ try {
+ // 逐个更新每行数据
+ for (const row of rowsToUpdate) {
+ const updateData = { ...row };
+ updateData.pQualifiedNum = Number(updateData.pQualifiedNum) || 0;
+ let rate = Number(updateData.pQualifiedRate);
+ updateData.pQualifiedRate = isNaN(rate) ? '0.00' : rate.toFixed(2);
+
+ updateData.vehicleNumber = Number(updateData.vehicleNumber) || 0;
+ updateData.hangNumber = Number(updateData.hangNumber) || 0;
+ updateData.previousNumber = Number(updateData.previousNumber) || 0;
+
+ const res = await updateworkorder(updateData);
+ if (res.code !== 200) {
+ this.$notify.error(res.msg || '更新失败');
+ }
+ }
+
+ // 所有更新完成后刷新列表
+ this.$notify.success('更新成功');
+ this.getList();
+ } catch (error) {
+ console.error('更新失败:', error);
+ this.$notify.error('网络异常,更新失败');
+ }
+ },
+
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true
},
diff --git a/src/views/productManagement/workorder_online.vue b/src/views/productManagement/workorder_online.vue
index af7f4bb..db51c9c 100644
--- a/src/views/productManagement/workorder_online.vue
+++ b/src/views/productManagement/workorder_online.vue
@@ -39,18 +39,14 @@
-
+
-
+
@@ -133,8 +129,8 @@ export default {
this.workorder_table_data = res.data.item1.map(item => {
return {
...item,
- pQualifiedRate: item.pQualifiedRate !== null && item.pQualifiedRate !== undefined
- ? parseFloat(item.pQualifiedRate).toFixed(2)
+ pQualifiedRate: item.pQualifiedRate !== null && item.pQualifiedRate !== undefined
+ ? parseFloat(item.pQualifiedRate).toFixed(2)
: '0.00'
}
})
@@ -153,9 +149,9 @@ export default {
const pQualifiedNum = parseFloat(row.pQualifiedNum);
if (!isNaN(previousNumber) && previousNumber !== 0 && !isNaN(pQualifiedNum)) {
- const rate = (pQualifiedNum / previousNumber);
+ const rate = (pQualifiedNum / previousNumber) * 100;
row.pQualifiedRate = rate.toFixed(2);
- console.log(row.pQualifiedRate,'显示的合格率');
+ console.log(row.pQualifiedRate, '显示的合格率');
} else {
row.pQualifiedRate = '0.00';
}
@@ -170,7 +166,7 @@ export default {
this.calculateQualifiedRate(row);
}
},
-
+
// 格式化预计合格率为两位小数
formatQualifiedRate(row) {
if (row.pQualifiedRate !== '' && !isNaN(row.pQualifiedRate)) {