From 66a610d07c3c021cad0a6798cc7ccd32c5d34844 Mon Sep 17 00:00:00 2001
From: wu <731351411@qq.com>
Date: 星期四, 11 十二月 2025 12:04:47 +0800
Subject: [PATCH] 增加磨边队列按照磨边后扫码异常提示
---
UI-Project/src/views/StockBasicData/stockBasicData.vue | 184 +++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 172 insertions(+), 12 deletions(-)
diff --git a/UI-Project/src/views/StockBasicData/stockBasicData.vue b/UI-Project/src/views/StockBasicData/stockBasicData.vue
index b43c2da..6c17a1a 100644
--- a/UI-Project/src/views/StockBasicData/stockBasicData.vue
+++ b/UI-Project/src/views/StockBasicData/stockBasicData.vue
@@ -110,6 +110,70 @@
});
tableData.value = formattedTasks
};
+// 妯℃嫙鏁版嵁
+// const generateMockData = () => {
+// const mockList = [
+// {
+// glassId: 'GL251209001',
+// width: 520,
+// height: 310,
+// thickness: 10,
+// filmsid: '閽㈠寲鐜荤拑',
+// line: 1,
+// state: 2, // 鏈(杈�
+// createTime: Date.now() - 3600 * 1000 * 2, // 2灏忔椂鍓嶇殑鏃堕棿鎴�
+// formattedCreateTime: formatTimestamp(Date.now() - 3600 * 1000 * 2)
+// },
+// {
+// glassId: 'GL251209002',
+// width: 600,
+// height: 380,
+// thickness: 12,
+// filmsid: '娴硶鐜荤拑',
+// line: 2,
+// state: 1, // 纾ㄨ竟涓�
+// createTime: Date.now() - 3600 * 1000 * 1, // 1灏忔椂鍓嶇殑鏃堕棿鎴�
+// formattedCreateTime: formatTimestamp(Date.now() - 3600 * 1000 * 1)
+// },
+// {
+// glassId: 'GL251209003',
+// width: 480,
+// height: 290,
+// thickness: 8,
+// filmsid: '澶硅兌鐜荤拑',
+// line: 1,
+// state: 1, // 宸茬(杈�
+// createTime: Date.now() - 3600 * 1000 * 6, // 6灏忔椂鍓嶇殑鏃堕棿鎴�
+// formattedCreateTime: formatTimestamp(Date.now() - 3600 * 1000 * 6)
+// },
+// {
+// glassId: 'GL251209004',
+// width: 550,
+// height: 330,
+// thickness: 9,
+// filmsid: '涓┖鐜荤拑',
+// line: 2,
+// state: 0,
+// createTime: Date.now() - 3600 * 1000 * 3,
+// formattedCreateTime: formatTimestamp(Date.now() - 3600 * 1000 * 3)
+// },
+// {
+// glassId: 'GL251209005',
+// width: 580,
+// height: 350,
+// thickness: 11,
+// filmsid: '闃插脊鐜荤拑',
+// line: '1',
+// state: 0,
+// createTime: Date.now() - 3600 * 1000 * 4,
+// formattedCreateTime: formatTimestamp(Date.now() - 3600 * 1000 * 4)
+// }
+
+// ];
+// return mockList;
+// };
+// tableData.value = generateMockData();
+// ElMessage.success('妯℃嫙鏁版嵁鍔犺浇鎴愬姛锛�');
// 鍘嗗彶浠诲姟
const iframeUrl = ref('');
const handlehistorical = (row) => {
@@ -124,16 +188,94 @@
closeWebSocket(socket);
}
});
- function getStatusTypeb(state) {
- switch (state) {
- case 0:
- return 'info';
- case 1:
- return 'success';
- case 1:
- return 'danger';
+// function getStatusTypeb(state) {
+// switch (state) {
+// case 0:
+// return 'info';
+// case 1:
+// return 'success';
+// case 1:
+// return 'danger';
+// }
+// }
+// 1. 杈呭姪锛氳幏鍙栬鐪熷疄绱㈠紩
+function getRowRealIndex(row) {
+ return tableData.value.findIndex(item => item.glassId === row.glassId);
+}
+
+// 2. 杈呭姪锛氳幏鍙栨寚瀹氱嚎璺渶鏂拌鐘舵��
+function getLineLatestState(line) {
+ const targetLine = String(line || '').trim();
+ if (!targetLine) return -1;
+ for (const row of tableData.value) {
+ const rowLine = String(row.line || '').trim();
+ if (rowLine === targetLine) {
+ return Number(row.state);
+ }
+ }
+ return -1;
+}
+
+// 3. 鏍稿績鍒ゆ柇锛氭槸鍚﹂渶瑕侀珮浜�/鏍囩孩
+function isNeedHighlight(row) {
+ const currentState = Number(row.state);
+ const currentLine = String(row.line || '').trim();
+ if (!currentLine) return false;
+
+ // 鍘熸湁閫昏緫锛氭湭纾ㄨ竟 + 鍓嶅簭鏈夌(杈逛腑/宸茬(杈�
+ if (currentState === 0) {
+ const currentIndex = getRowRealIndex(row);
+ if (currentIndex === -1) return false;
+ for (let i = 0; i < currentIndex; i++) {
+ const compareRow = tableData.value[i];
+ const compareLine = String(compareRow?.line || '').trim();
+ const compareState = Number(compareRow?.state);
+ if (compareLine === currentLine && [1, 2].includes(compareState)) {
+ return true;
+ }
+ }
+ }
+
+ // 鏂板閫昏緫锛氱(杈逛腑 + 鍚岀嚎璺渶鏂版槸宸茬(杈�
+ if (currentState === 1) {
+ const latestState = getLineLatestState(currentLine);
+ if (latestState === 2) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+// 4. 鍘熷棰滆壊鏄犲皠
+function getOriginalColor(state) {
+ const stateNum = Number(state);
+ switch (stateNum) {
+ case 0: return 'info';
+ case 1: return 'success';
+ case 2: return 'primary';
+ default: return 'info';
}
}
+
+// 5. 鏍囩绫诲瀷鍑芥暟锛堣皟鐢╥sNeedHighlight锛�
+function getStatusTypeb(row) {
+ const currentState = Number(row.state);
+ if ([0, 1].includes(currentState) && isNeedHighlight(row)) {
+ return 'danger';
+ }
+ return getOriginalColor(row.state);
+}
+
+// 6. 琛屾牱寮忓嚱鏁帮紙璋冪敤isNeedHighlight锛�
+function getTableRowClass({ row }) {
+ const currentState = Number(row.state);
+ if ([0, 1].includes(currentState) && isNeedHighlight(row)) {
+ return 'leak-edge-highlight';
+ }
+ return '';
+}
+
function getStatusTextb(state) {
switch (state) {
case 0:
@@ -189,7 +331,9 @@
<div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;">
<el-table height="750" ref="table"
@selection-change="handleSelectionChange"
- :data="tableData" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
+ :data="tableData" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}"
+ :row-class-name="getTableRowClass"
+ >
<el-table-column prop="glassId" align="center" :label="$t('workOrder.glassID')" min-width="180" />
<el-table-column prop="width" align="center" :label="$t('workOrder.width')" min-width="120" />
<el-table-column prop="height" align="center" :label="$t('workOrder.height')" min-width="80" />
@@ -201,10 +345,13 @@
<!-- <template #default="scope">
{{ scope.row.status==0?"鏈(杈�":scope.row.status==1?"纾ㄨ竟涓�":"宸茬(杈�" }}
</template> -->
- <template #default="scope">
- <el-tag :type="getStatusTypeb(scope.row.state)">
+ <template #default="scope">
+ <el-tag :type="getStatusTypeb(scope.row || {}, scope.index)">
{{ getStatusTextb(scope.row.state) }}
- </el-tag>
+ </el-tag>
+ <!-- <el-tag :type="getStatusTypeb(scope.row.state)">
+ {{ getStatusTextb(scope.row.state) }}
+ </el-tag> -->
</template>
</el-table-column>
<el-table-column fixed="right" :label="$t('workOrder.operate')" align="center" width="200">
@@ -256,4 +403,17 @@
height: 460px;
/* margin-top: -60px; */
}
+/* 婕忕(杈硅鏁磋楂樹寒鏍峰紡锛堢┛閫弒coped锛� */
+:deep(.leak-edge-highlight) {
+ background-color: #fff1f0 !important; /* 娴呯孩鑳屾櫙锛堝拰danger鏍囩鍛煎簲锛� */
+}
+/* 琛屽唴鍗曞厓鏍兼枃瀛楁爣绾� */
+:deep(.leak-edge-highlight > td) {
+ color: #f5222d !important; /* 绾㈣壊鏂囧瓧 */
+ font-weight: 500 !important; /* 鍙�夛細鏂囧瓧鍔犵矖锛屾洿閱掔洰 */
+}
+/* 榧犳爣鎮诞鏃朵繚鎸侀珮浜紙鍙�夛級 */
+:deep(.el-table__row.leak-edge-highlight:hover > td) {
+ background-color: #fee2e2 !important;
+}
</style>
\ No newline at end of file
--
Gitblit v1.8.0