From 9d1e141167b27fd7476b8e7d63a94928acec9789 Mon Sep 17 00:00:00 2001 From: "han\\hanst" Date: Thu, 9 Jul 2026 16:52:33 +0800 Subject: [PATCH] actualNotifyDate --- src/views/modules/ecss/codelnotify.vue | 142 +++++++++++++++- src/views/modules/ecss/codelnotifyConfirm.vue | 159 ++++++++++++++++-- 2 files changed, 282 insertions(+), 19 deletions(-) diff --git a/src/views/modules/ecss/codelnotify.vue b/src/views/modules/ecss/codelnotify.vue index 0e0e3cc..6135e64 100644 --- a/src/views/modules/ecss/codelnotify.vue +++ b/src/views/modules/ecss/codelnotify.vue @@ -117,7 +117,13 @@ :min-width="item.columnWidth" :label="item.columnLabel"> @@ -307,11 +313,10 @@ - + item.columnProp === 'actualNotifyDate'); + if (hasActualNotifyDate) { + return sourceColumns; + } + + const referenceColumn = sourceColumns.find(item => item && item.tableId) || {}; + const actualNotifyDateColumn = { + userId: this.$store.state.user.name, + functionId: this.$route.meta.menuId, + serialNumber: this.$route.meta.menuId + 'Table1ActualNotifyDate', + tableId: referenceColumn.tableId || (this.$route.meta.menuId + 'Table1'), + tableName: "关务系统发货通知单", + columnProp: "actualNotifyDate", + headerAlign: "center", + align: "center", + columnLabel: "实际发货日期", + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 120 + }; + + const targetColumns = sourceColumns.slice(); + const notifyDateIndex = targetColumns.findIndex(item => item.columnProp === 'notifyDate'); + if (notifyDateIndex > -1) { + targetColumns.splice(notifyDateIndex + 1, 0, actualNotifyDateColumn); + } else { + targetColumns.push(actualNotifyDateColumn); + } + return targetColumns; + }, + + parseDateValue(dateValue) { + if (!dateValue) { + return null; + } + if (dateValue instanceof Date) { + if (isNaN(dateValue.getTime())) { + return null; + } + const date = new Date(dateValue.getTime()); + date.setHours(0, 0, 0, 0); + return date; + } + if (typeof dateValue === 'string') { + const value = dateValue.trim(); + if (!value) { + return null; + } + const datePart = value.split(' ')[0]; + const parts = datePart.split('-'); + if (parts.length === 3) { + const year = Number(parts[0]); + const month = Number(parts[1]); + const day = Number(parts[2]); + if (!Number.isNaN(year) && !Number.isNaN(month) && !Number.isNaN(day)) { + const date = new Date(year, month - 1, day); + date.setHours(0, 0, 0, 0); + return date; + } + } + const date = new Date(value); + if (!isNaN(date.getTime())) { + date.setHours(0, 0, 0, 0); + return date; + } + } + return null; + }, + + isActualNotifyDateEmpty(actualNotifyDate) { + return actualNotifyDate === null || actualNotifyDate === undefined || actualNotifyDate === ''; + }, + + isDelayWarningRow(row) { + if (!row || !this.isActualNotifyDateEmpty(row.actualNotifyDate)) { + return false; + } + const notifyDate = this.parseDateValue(row.notifyDate); + if (!notifyDate) { + return false; + } + const deadline = new Date(notifyDate.getTime()); + deadline.setDate(deadline.getDate() + 3); + + const today = new Date(); + today.setHours(0, 0, 0, 0); + return today.getTime() > deadline.getTime(); + }, + + showDelayWarningTooltip(row, columnProp) { + return this.isDelayWarningRow(row) && (columnProp === 'cmcInvoice' || columnProp === 'notifyDate'); + }, + + getDelayWarningTooltip(row) { + const notifyDate = row && row.notifyDate ? row.notifyDate : '预计发货日期'; + return `预计发货日期${notifyDate}已超3天,且实际发货日期未维护,请及时补充。`; + }, + isPnDataIncomplete(row) { const hsCodeDesc = row.hsCodeDesc !== null && row.hsCodeDesc !== undefined && row.hsCodeDesc !== ''&& row.hsCodeDesc !== '*'; return !hsCodeDesc; @@ -2099,7 +2226,7 @@ //this.columnList1 = [] switch (columnId) { case 1: - this.columnList1 = data.rows + this.columnList1 = this.ensureActualNotifyDateColumn(data.rows) break; // case 2: // this.columnDetailList = data.rows @@ -2127,7 +2254,7 @@ if (!data.rows.length == 0) { switch (columnId) { case 1: - this.columnList1 = data.rows + this.columnList1 = this.ensureActualNotifyDateColumn(data.rows) break; // case 2: // this.columnDetailList = data.rows @@ -2489,6 +2616,9 @@ } }, cellStyle({row, column }) { + if (this.isDelayWarningRow(row) && (column.property === 'notifyDate' || column.property === 'cmcInvoice')) { + return { color: '#fa0303', fontWeight: '700' }; + } // 改单列显示橙色:只要modifyFlag为true就显示橙色 if (column.property === 'modifyLabel' && row.modifyFlag===true) { return { color: '#ff5d03' }; diff --git a/src/views/modules/ecss/codelnotifyConfirm.vue b/src/views/modules/ecss/codelnotifyConfirm.vue index 1f8d7be..4ea2887 100644 --- a/src/views/modules/ecss/codelnotifyConfirm.vue +++ b/src/views/modules/ecss/codelnotifyConfirm.vue @@ -104,7 +104,13 @@ :min-width="item.columnWidth" :label="item.columnLabel"> @@ -243,10 +249,10 @@ - + - + item.columnProp === 'actualNotifyDate'); + if (hasActualNotifyDate) { + return sourceColumns; + } + + const referenceColumn = sourceColumns.find(item => item && item.tableId) || {}; + const actualNotifyDateColumn = { + userId: this.$store.state.user.name, + functionId: this.$route.meta.menuId, + serialNumber: this.$route.meta.menuId + 'Table1ActualNotifyDate', + tableId: referenceColumn.tableId || (this.$route.meta.menuId + 'Table1'), + tableName: "关务系统发货通知单", + columnProp: "actualNotifyDate", + headerAlign: "center", + align: "center", + columnLabel: "实际发货日期", + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 120 + }; + + const targetColumns = sourceColumns.slice(); + const notifyDateIndex = targetColumns.findIndex(item => item.columnProp === 'notifyDate'); + if (notifyDateIndex > -1) { + targetColumns.splice(notifyDateIndex + 1, 0, actualNotifyDateColumn); + } else { + targetColumns.push(actualNotifyDateColumn); + } + + return targetColumns; + }, + + parseDateValue(dateValue) { + if (!dateValue) { + return null; + } + if (dateValue instanceof Date) { + if (isNaN(dateValue.getTime())) { + return null; + } + const date = new Date(dateValue.getTime()); + date.setHours(0, 0, 0, 0); + return date; + } + if (typeof dateValue === 'string') { + const value = dateValue.trim(); + if (!value) { + return null; + } + const datePart = value.split(' ')[0]; + const parts = datePart.split('-'); + if (parts.length === 3) { + const year = Number(parts[0]); + const month = Number(parts[1]); + const day = Number(parts[2]); + if (!Number.isNaN(year) && !Number.isNaN(month) && !Number.isNaN(day)) { + const date = new Date(year, month - 1, day); + date.setHours(0, 0, 0, 0); + return date; + } + } + const date = new Date(value); + if (!isNaN(date.getTime())) { + date.setHours(0, 0, 0, 0); + return date; + } + } + return null; + }, + + isActualNotifyDateEmpty(actualNotifyDate) { + return actualNotifyDate === null || actualNotifyDate === undefined || actualNotifyDate === ''; + }, + + isDelayWarningRow(row) { + if (!row || !this.isActualNotifyDateEmpty(row.actualNotifyDate)) { + return false; + } + const notifyDate = this.parseDateValue(row.notifyDate); + if (!notifyDate) { + return false; + } + const deadline = new Date(notifyDate.getTime()); + deadline.setDate(deadline.getDate() + 3); + + const today = new Date(); + today.setHours(0, 0, 0, 0); + return today.getTime() > deadline.getTime(); + }, + + showDelayWarningTooltip(row, columnProp) { + return this.isDelayWarningRow(row) && (columnProp === 'cmcInvoice' || columnProp === 'notifyDate'); + }, + + getDelayWarningTooltip(row) { + const notifyDate = row && row.notifyDate ? row.notifyDate : '预计发货日期'; + return `预计发货日期${notifyDate}已超3天,且实际发货日期未维护,请及时补充。`; + }, + // 动态列开始 获取 用户保存的 格式列 async getTableUserColumn (tableId, columnId) { let queryTableUser = { @@ -2207,7 +2337,7 @@ //this.columnList1 = [] switch (columnId) { case 1: - this.columnList1 = data.rows + this.columnList1 = this.ensureActualNotifyDateColumn(data.rows) break; // case 2: // this.columnDetailList = data.rows @@ -2235,7 +2365,7 @@ if (!data.rows.length == 0) { switch (columnId) { case 1: - this.columnList1 = data.rows + this.columnList1 = this.ensureActualNotifyDateColumn(data.rows) break; // case 2: // this.columnDetailList = data.rows @@ -2363,7 +2493,7 @@ if(this.dataList.length>0){ this.dataList.forEach(o => { if (o.notifyStatus==='仓库已确认'&&!o.notifyDate) { - o.notifyDate='发货日期不确定' + o.notifyDate='预计发货日期不确定' } // 显示改单次数,如:改单(1)、改单(2) o.modifyLabel = !!o.modifyFlag ? (o.modifyCount ? '改单(' + o.modifyCount + ')' : '改单(1)') : ''; @@ -2409,7 +2539,10 @@ } }, cellStyle({row, column }) { - if (column.property === 'notifyDate' && row.notifyDate==='发货日期不确定') { // 根据列属性判断 + if (this.isDelayWarningRow(row) && (column.property === 'notifyDate' || column.property === 'cmcInvoice')) { + return { color: '#fa0303', fontWeight: '700' }; + } + if (column.property === 'notifyDate' && row.notifyDate==='预计发货日期不确定') { // 根据列属性判断 return { color: '#ff5d03' }; } // 改单列显示橙色:只要modifyFlag为true就显示橙色 @@ -2444,7 +2577,7 @@ }, changeData(row){ this.currentRow = JSON.parse(JSON.stringify(row)); - if (this.currentRow&&this.currentRow.notifyDate==='发货日期不确定') { + if (this.currentRow&&this.currentRow.notifyDate==='预计发货日期不确定') { this.currentRow.notifyDate='' } this.headerData=row; @@ -2520,7 +2653,7 @@ }, cancerConfirm(row){ let indata=JSON.parse(JSON.stringify(row)); - if (row.notifyDate==='发货日期不确定') { + if (row.notifyDate==='预计发货日期不确定') { indata.notifyDate='' } this.$confirm('取消确认这条发货通知单?', '提示').then(() => { @@ -2566,7 +2699,7 @@ }, updateModelOpen(row){ this.confirmModel=JSON.parse(JSON.stringify(row)); - if (this.confirmModel.notifyDate==='发货日期不确定') { + if (this.confirmModel.notifyDate==='预计发货日期不确定') { this.confirmModel.notifyDate='' } this.updateModelFlag=true