From c5afc23437b37d717e892b16b23923907825d2cd Mon Sep 17 00:00:00 2001
From: helongyang <647556386@qq.com>
Date: 星期一, 13 十月 2025 23:09:20 +0800
Subject: [PATCH] 钉钉推送完善,任务取消优化
---
代码管理/WMS/WIDESEA_WMSClient/src/extension/stock/stockView.js | 115 +++++++++++++++++++++++++++++++++++++++------------------
1 files changed, 78 insertions(+), 37 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/extension/stock/stockView.js" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/extension/stock/stockView.js"
index 35f980c..5a7c805 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/extension/stock/stockView.js"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/extension/stock/stockView.js"
@@ -1,4 +1,3 @@
-
//姝s鏂囦欢鏄敤鏉ヨ嚜瀹氫箟鎵╁睍涓氬姟浠g爜锛屽彲浠ユ墿灞曚竴浜涜嚜瀹氫箟椤甸潰鎴栬�呴噸鏂伴厤缃敓鎴愮殑浠g爜
import { el } from "element-plus/es/locales.mjs";
@@ -19,22 +18,20 @@
methods: {
//涓嬮潰杩欎簺鏂规硶鍙互淇濈暀涔熷彲浠ュ垹闄�
onInit() {
- // let InOrder = this.buttons.find(x => x.value == 'StockOutbound');
- // if (InOrder) {
- // InOrder.onClick = function () {
- // let rows = this.$refs.table.getSelected();
- // if (rows.length == 0) return this.$error("璇烽�夋嫨鏁版嵁!");
- // if (rows.length > 1) return this.$error("璇烽�夋嫨鍗曟潯鏁版嵁!");
- // var keys = rows.map(x => { return x.stockId });
- // this.http
- // .post("api/Task/Outbound?id="+keys[0], null, "鏁版嵁澶勭悊涓�")
- // .then((x) => {
- // if (!x.status) return this.$message.error(x.message);
- // this.$message.success("鎿嶄綔鎴愬姛");
- // this.refresh();
- // });
- // }
- // }
+
+ let SelectTake = this.buttons.find(x => x.value == 'SelectStockTake');
+ if (SelectTake) {
+ SelectTake.onClick = function () {
+ let stockViews = this.$refs.table.getSelected();
+ this.http
+ .post("api/Task/TakeOutbound",stockViews, "鏁版嵁澶勭悊涓�")
+ .then((x) => {
+ if (!x.status) return this.$message.error(x.message);
+ this.$message.success("鎿嶄綔鎴愬姛");
+ this.refresh();
+ });
+ }
+ }
this.columns.forEach(column => {
if (column.field == 'materielCode') {
column.formatter = (row) => {
@@ -57,26 +54,57 @@
}
}
if (column.field == 'materielInfo') {
+ const today = new Date()
+ column.formatter = (row) => {
+ if (row.details.length > 0) {
+ const today = new Date();
+ const closestDate = row.details
+ .map(x => {
+ const date = new Date(x.effectiveDate);
+ const diffInDays = Math.ceil((date - today) / (1000 * 60 * 60 * 24)); // 鏀逛负璁$畻鍓╀綑澶╂暟
+ return { date, diffInDays };
+ })
+ .reduce((closest, current) => (current.diffInDays < closest.diffInDays ? current : closest))
+ .date;
+
+ const daysRemaining = Math.ceil((closestDate - today) / (1000 * 60 * 60 * 24));
+
+ row.expiryDays = daysRemaining;
+
+ if (daysRemaining <= 0) {
+ return '<span style="color:rgb(30, 27, 27)">鏃犱繚璐ㄦ湡</span>';
+ } else {
+ return '<span style="color: #F56C6C">' + daysRemaining + "澶�" + '</span>';
+ }
+ } else {
+ row.expiryDays = null;
+ return '<span style="color:rgb(24, 18, 18)">鏃犱繚璐ㄦ湡</span>';
+ }
+ }
+ }
+
+ if (column.field == 'inventoryage') {
const today = new Date()
column.formatter = (row) => {
- if (row.details.length > 0) {
- const today = new Date();
- const closestDate = row.details
- .map(x => {
- const date = new Date(x.effectiveDate);
- const diffInDays = Math.ceil(Math.abs((today - date) / (1000 * 60 * 60 * 24)));
- return { date, diffInDays };
- })
- .reduce((closest, current) => (current.diffInDays < closest.diffInDays ? current : closest))
- .date;
+ if (row.details.length > 0) {
+ const closestDate = row.details
+ .map(x => {
+ const date = new Date(x.createDate);
+ const ageInDays = Math.ceil((today - date) / (1000 * 60 * 60 * 24));
+ return { date, ageInDays };
+ })
+ .reduce((closest, current) => (current.ageInDays < closest.ageInDays ? current : closest))
+ .date;
- const daysSinceClosest = Math.ceil(Math.abs((today - closestDate) / (1000 * 60 * 60 * 24)));
- return '<span style="color: #F56C6C">' + daysSinceClosest + "澶�" + '</span>';
- } else {
- return '<span style="color: #F56C6C">' + "鏃犱繚璐ㄦ湡" + '</span>';
- }
-
- }
+ const inventoryAge = Math.ceil((today - closestDate) / (1000 * 60 * 60 * 24));
+
+ row.inventoryAge = inventoryAge;
+
+ return `${inventoryAge} 澶ー;
+ }
+ // 濡傛灉娌℃湁鏄庣粏锛岃繑鍥炵┖鎴栨彁绀轰俊鎭�
+ return '-';
+ }
}
if (column.field == 'sumStock') {
column.formatter = (row) => {
@@ -86,14 +114,27 @@
.map(x => {
sum += (x.stockQuantity)
})
- return '<span style="color: #F56C6C">' + sum.toFixed(3) + row.details[0].unit + '</span>';
+ return '<span style="color: rgb(24, 18, 18)">' + sum.toFixed(3) + row.details[0].unit + '</span>';
} else {
- return '<span style="color: #F56C6C">' + "1涓�" + '</span>';
+ return '<span style="color: rgb(24, 18, 18)">' + "1涓�" + '</span>';
}
}
}
})
+ this.columns.forEach((column) => {
+ column.cellStyle = (row) => {
+ if (row.expirationlabel !== undefined && row.expirationlabel !== null) {
+ if (row.expirationlabel === 2) {
+ return { background: 'yellow' };
+ } else if (row.expirationlabel === 3) {
+ return { background: '#ffc0cb' };
+ }
+ }
+ return {};
+ };
+ });
+
},
onInited() {
//妗嗘灦鍒濆鍖栭厤缃悗
@@ -141,4 +182,4 @@
}
}
};
-export default extension;
+export default extension;
\ No newline at end of file
--
Gitblit v1.9.3