diff --git a/src/views/modules/sampleTracking/projectProofTracking.vue b/src/views/modules/sampleTracking/projectProofTracking.vue index 04b7894..2633988 100644 --- a/src/views/modules/sampleTracking/projectProofTracking.vue +++ b/src/views/modules/sampleTracking/projectProofTracking.vue @@ -1,172 +1,37 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { return Promise.all([ this.queryProcessColumns(), @@ -1865,8 +1893,23 @@ export default { }) }, deactivated () { + this.unbindTrackingTableResize() this.destroyDefaultProcessConfigSortable() }, + beforeDestroy () { + this.unbindTrackingTableResize() + }, + watch: { + searchExpanded () { + this.scheduleTrackingTableHeightUpdate() + }, + 'searchData.buNo' () { + // RFID 分类筛选的显隐会改变展开后的搜索区高度。 + if (this.searchExpanded) { + this.scheduleTrackingTableHeightUpdate() + } + } + }, computed: { visibleTrackingColumns () { // 列表只渲染“当前生效列”:有用户动态列时用用户配置,否则用代码默认列。 @@ -3633,6 +3676,58 @@ export default { } }) }, + bindTrackingTableResize () { + if (this._onTrackingTableResize) { + return + } + this._onTrackingTableResize = () => { + this.scheduleTrackingTableHeightUpdate() + } + window.addEventListener('resize', this._onTrackingTableResize) + }, + unbindTrackingTableResize () { + if (this._onTrackingTableResize) { + window.removeEventListener('resize', this._onTrackingTableResize) + this._onTrackingTableResize = null + } + this.trackingTableHeightUpdateToken += 1 + }, + toggleSearchExpand () { + this.searchExpanded = !this.searchExpanded + }, + scheduleTrackingTableHeightUpdate () { + const token = ++this.trackingTableHeightUpdateToken + this.$nextTick(() => { + if (token !== this.trackingTableHeightUpdateToken) { + return + } + this.updateTrackingTableHeight() + }) + }, + updateTrackingTableHeight () { + const tableRef = this.$refs.trackingTable + const tableEl = tableRef && tableRef.$el ? tableRef.$el : null + if (!tableEl || typeof tableEl.getBoundingClientRect !== 'function') { + return + } + const tableRect = tableEl.getBoundingClientRect() + // keep-alive 页签隐藏时不使用零尺寸覆盖正常布局。 + if (!tableRect.width) { + return + } + const tableTop = tableRect.top + const paginationRef = this.$refs.trackingPagination + const paginationEl = paginationRef && paginationRef.$el ? paginationRef.$el : null + const paginationHeight = paginationEl ? paginationEl.offsetHeight : 32 + const paginationMargin = 12 + // 卡片 padding 5px + 页签内容区 padding 5px,再留 6px,一次算准高度,避免二次收缩触发表格重排。 + const bottomReserve = 16 + const nextHeight = Math.max(240, Math.floor(window.innerHeight - tableTop - paginationHeight - paginationMargin - bottomReserve)) + if (this.trackingTableHeight === nextHeight) { + return + } + this.trackingTableHeight = nextHeight + }, handleBuProcessCodesChange (row) { if (!row) { return @@ -6368,6 +6463,10 @@ export default { return '' } const packageDate = this.getTrackingPackageDate(row) + // 尚未生成打样单且 Delivery&Package 有值时,才显示准备阶段。 + if (this.isBlankValue(row.proofingNo) && packageDate) { + return 'trialPrepare' + } const baseline = this.formatDate(row.baseline) // 缺少 package 或 baseline 时无法判定延期,保持空状态由文案函数显示 '-'。 if (!packageDate || !baseline) { @@ -6393,10 +6492,13 @@ export default { return this.isProofingFinishedForTrackingStatus(row) }, getTrackingStatusText (row) { + const statusType = this.getTrackingStatusType(row) + if (statusType === 'trialPrepare') { + return 'Trial prepare' + } if (this.isProofingFinishedForTrackingStatus(row)) { return 'Complete' } - const statusType = this.getTrackingStatusType(row) if (!statusType) { return '-' } @@ -6404,10 +6506,13 @@ export default { return `${statusPrefix}-${this.getFirstPendingProcessLabel(row)}` }, getTrackingStatusClass (row) { + const statusType = this.getTrackingStatusType(row) + if (statusType === 'trialPrepare') { + return 'tracking-status tracking-status--delay' + } if (this.isProofingFinishedForTrackingStatus(row)) { return 'tracking-status tracking-status--complete' } - const statusType = this.getTrackingStatusType(row) if (statusType === 'onSchedule') { return 'tracking-status tracking-status--on-schedule' } @@ -6456,6 +6561,27 @@ export default {