3 changed files with 218 additions and 3 deletions
-
13src/api/haianWarehouse/cacheTransport.js
-
202src/views/modules/haianWarehouse/automatedWarehouse/cacheTransportTask54.vue
-
6src/views/modules/haianWarehouse/noOrderIssue/newNoOrderIssueNotify54.vue
@ -0,0 +1,13 @@ |
|||||
|
import { createAPI } from '@/utils/httpRequest.js' |
||||
|
|
||||
|
// 海安齐套运输:getCacheTransportAreas,POST实体必须显式传site,业务错误由页面展示。- rqrq
|
||||
|
export const getCacheTransportAreas = data => createAPI('/haiAnCacheTransport/getCacheTransportAreas', 'post', data) |
||||
|
|
||||
|
// 海安齐套运输:saveCacheTransportAreas,POST实体必须显式传site,业务错误由页面展示。- rqrq
|
||||
|
export const saveCacheTransportAreas = data => createAPI('/haiAnCacheTransport/saveCacheTransportAreas', 'post', data) |
||||
|
|
||||
|
// 海安齐套运输:getCacheTransportTaskPage,POST实体必须显式传site,业务错误由页面展示。- rqrq
|
||||
|
export const getCacheTransportTaskPage = data => createAPI('/haiAnCacheTransport/getCacheTransportTaskPage', 'post', data) |
||||
|
|
||||
|
// 海安齐套运输:getCacheTransportTaskDetails,POST实体必须显式传site,业务错误由页面展示。- rqrq
|
||||
|
export const getCacheTransportTaskDetails = data => createAPI('/haiAnCacheTransport/getCacheTransportTaskDetails', 'post', data) |
||||
@ -0,0 +1,202 @@ |
|||||
|
<template> |
||||
|
<div class="cache-transport"> |
||||
|
<!-- 纯主从查询:上表展示主单记录,点击一行后下表展示该任务的托盘明细。- rqrq --> |
||||
|
<el-form ref="queryForm" :inline="true" label-position="top" @submit.native.prevent> |
||||
|
<el-form-item label="工厂"><el-input :value="query.site" disabled style="width:80px" /></el-form-item> |
||||
|
<el-form-item v-for="field in searchFields" :key="field.key" :label="field.label"> |
||||
|
<el-input v-model="query[field.key]" clearable style="width:150px" @keyup.enter.native="search" /> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="调度状态"> |
||||
|
<el-select v-model="query.status" clearable style="width:120px"> |
||||
|
<el-option v-for="s in statuses" :key="s" :label="s" :value="s" /> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="下单日期从"><el-date-picker v-model="query.startDate" type="date" value-format="yyyy-MM-dd" style="width:145px" /></el-form-item> |
||||
|
<el-form-item label="至"><el-date-picker v-model="query.endDate" type="date" value-format="yyyy-MM-dd" style="width:145px" /></el-form-item> |
||||
|
<el-form-item label=" "> |
||||
|
<el-button type="primary" :loading="queryLoading" :disabled="queryLoading" @click="search">查询</el-button> |
||||
|
<el-button :disabled="queryLoading" @click="reset">重置</el-button> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
<el-table ref="taskTable" v-loading="queryLoading" :data="rows" border highlight-current-row :height="tableHeight" row-key="id" @current-change="openDetails"> |
||||
|
<el-table-column prop="id" label="任务ID" width="85" /> |
||||
|
<el-table-column prop="subSite" label="子工厂" width="90" /> |
||||
|
<el-table-column prop="notifyNo" label="领料单号" width="150" show-overflow-tooltip /> |
||||
|
<el-table-column prop="soorderNo" label="订单号" width="140" show-overflow-tooltip /> |
||||
|
<el-table-column prop="orderPartNo" label="订单物料" width="150" show-overflow-tooltip /> |
||||
|
<el-table-column prop="sourceAreaId" label="源缓存区" width="115" show-overflow-tooltip /> |
||||
|
<!-- 优先显示同工厂目标区域名称,未维护名称时回退编码,避免历史任务显示空白。- rqrq --> |
||||
|
<el-table-column prop="targetAreaName" label="目标区域" width="150" show-overflow-tooltip> |
||||
|
<template slot-scope="s">{{ s.row.targetAreaName || s.row.targetAreaId }}</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column prop="status" label="调度状态" width="100" /> |
||||
|
<el-table-column label="托盘数量" width="95" align="right"> |
||||
|
<template slot-scope="s">{{ Number(s.row.palletCount) || 0 }}</template> |
||||
|
</el-table-column> |
||||
|
<!-- <el-table-column prop="createdName" label="下单人" width="115" show-overflow-tooltip />--> |
||||
|
<el-table-column prop="createdBy" label="下单账号" width="125" show-overflow-tooltip /> |
||||
|
<el-table-column prop="createdTime" label="下单时间" width="165" /> |
||||
|
<el-table-column prop="completedTime" label="调度完成时间" width="165" /> |
||||
|
</el-table> |
||||
|
<el-pagination ref="pagination" :current-page="query.page" :page-size="query.limit" :total="total" :disabled="queryLoading" :page-sizes="[20, 50, 100]" layout="total, sizes, prev, pager, next" @current-change="changePage" @size-change="changeSize" /> |
||||
|
|
||||
|
<!-- 下表直接显示本任务的托盘记录,不弹窗、不展开标签、不查询实时托盘位置。- rqrq --> |
||||
|
<div ref="detailTitle" class="detail-title">托盘明细<span v-if="selected.id"> </span></div> |
||||
|
<el-table ref="detailTable" v-loading="detailLoading" :data="details" border :height="detailTableHeight" row-key="id" :empty-text="selected.id ? '暂无托盘明细' : '请先选择上表任务'"> |
||||
|
<el-table-column prop="palletId" label="托盘号" width="120" fixed /> |
||||
|
<el-table-column prop="status" label="调度状态" width="100" /> |
||||
|
<el-table-column label="完成原因" width="145"><template slot-scope="s">{{ finishText(s.row.finishReason) }}</template></el-table-column> |
||||
|
<el-table-column label="运输状态" width="110"><template slot-scope="s">{{ s.row.executionStatus || '未下发' }}</template></el-table-column> |
||||
|
<el-table-column v-for="field in detailFields" :key="field.key" :prop="field.key" :label="field.label" :width="field.width || 160" :show-overflow-tooltip="!!field.tooltip" /> |
||||
|
</el-table> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { getCacheTransportTaskPage, getCacheTransportTaskDetails } from '@/api/haianWarehouse/cacheTransport' |
||||
|
|
||||
|
// PC仅使用两个查询接口;主表和托盘明细原样展示,不参与建单、配置及调度。- rqrq |
||||
|
export default { |
||||
|
data () { |
||||
|
return { |
||||
|
query: { site: '', page: 1, limit: 20, orderNo: '', notifyNo: '', soorderNo: '', createdBy: '', status: '', startDate: '', endDate: '' }, |
||||
|
rows: [], |
||||
|
total: 0, |
||||
|
queryLoading: false, |
||||
|
detailLoading: false, |
||||
|
selected: {}, |
||||
|
details: [], |
||||
|
// 首次渲染先使用紧凑高度,挂载后按窗口真实可用空间分配上下表。- rqrq |
||||
|
tableHeight: 100, |
||||
|
detailTableHeight: 100, |
||||
|
// 明细请求序号隔离快速切换行和翻页,旧响应不得覆盖当前选中任务。- rqrq |
||||
|
detailRequestId: 0, |
||||
|
statuses: ['待调度', '处理中', '待核实', '已完成'], |
||||
|
searchFields: [{ key: 'orderNo', label: '运输单号' }, { key: 'notifyNo', label: '领料单号' }, { key: 'soorderNo', label: '订单号' }, { key: 'createdBy', label: '下单账号' }], |
||||
|
detailFields: [ |
||||
|
{ key: 'sourceAreaId', label: '下单缓存区', width: 110 }, { key: 'sourceStation', label: '下单站点' }, |
||||
|
{ key: 'actualSourceArea', label: '实际起始区', width: 110 }, { key: 'actualSourceStation', label: '实际起始站点' }, |
||||
|
{ key: 'targetStation', label: '目标站点' }, { key: 'taskNo', label: 'WOT任务号', tooltip: true }, { key: 'actualTaskNo', label: '实际运输任务号', tooltip: true }, |
||||
|
{ key: 'dispatchedTime', label: '下发时间', width: 170 }, { key: 'completedTime', label: '调度完成时间', width: 170 }, |
||||
|
{ key: 'pickedTime', label: '取货时间', width: 170 }, { key: 'arrivedTime', label: '放货时间', width: 170 }, |
||||
|
{ key: 'actualTargetArea', label: '实际送达区域', width: 115 }, |
||||
|
{ key: 'errorMsg', label: '调度说明', width: 260, tooltip: true }, { key: 'executionError', label: '运输异常', width: 200, tooltip: true } |
||||
|
] |
||||
|
} |
||||
|
}, |
||||
|
created () { |
||||
|
// 初始化先设置业务site,防止首个请求漏传。- rqrq |
||||
|
this.query.site = this.$store.state.user.site |
||||
|
this.load() |
||||
|
}, |
||||
|
mounted () { |
||||
|
// 观察查询区和分页的尺寸变化,兼容侧栏折叠、条件换行;不观察表格以免循环重算。- rqrq |
||||
|
window.addEventListener('resize', this.updateTableHeights) |
||||
|
if (window.ResizeObserver) { |
||||
|
this.queryResizeObserver = new window.ResizeObserver(this.updateTableHeights) |
||||
|
this.queryResizeObserver.observe(this.$refs.queryForm.$el) |
||||
|
this.queryResizeObserver.observe(this.$refs.pagination.$el) |
||||
|
} |
||||
|
this.updateTableHeights() |
||||
|
}, |
||||
|
activated () { |
||||
|
// keep-alive页签重新显示后按当前窗口重算,不重复触发业务查询。- rqrq |
||||
|
this.updateTableHeights() |
||||
|
}, |
||||
|
beforeDestroy () { |
||||
|
// 关闭页面释放监听,防止访问已销毁的表格实例。- rqrq |
||||
|
window.removeEventListener('resize', this.updateTableHeights) |
||||
|
if (this.queryResizeObserver) this.queryResizeObserver.disconnect() |
||||
|
}, |
||||
|
methods: { |
||||
|
// 主表顶部已包含导航和查询区高度;再扣分页、明细标题及底部留白,剩余空间各分一半。- rqrq |
||||
|
updateTableHeights () { |
||||
|
this.$nextTick(() => { |
||||
|
if (this._isDestroyed || !this.$el.offsetWidth || !this.$refs.taskTable) return |
||||
|
const outerHeight = element => { |
||||
|
const style = window.getComputedStyle(element) |
||||
|
return element.offsetHeight + (parseFloat(style.marginTop) || 0) + (parseFloat(style.marginBottom) || 0) |
||||
|
} |
||||
|
const availableHeight = window.innerHeight - this.$refs.taskTable.$el.getBoundingClientRect().top - |
||||
|
outerHeight(this.$refs.pagination.$el) - outerHeight(this.$refs.detailTitle) - 20 |
||||
|
// 极小窗口保留表头和一行可操作区域,正常窗口只在表格内部滚动。- rqrq |
||||
|
const totalHeight = Math.max(200, Math.floor(availableHeight)) |
||||
|
this.tableHeight = Math.floor(totalHeight / 2) |
||||
|
this.detailTableHeight = totalHeight - this.tableHeight |
||||
|
this.$nextTick(() => { |
||||
|
if (this._isDestroyed) return |
||||
|
if (this.$refs.taskTable) this.$refs.taskTable.doLayout() |
||||
|
if (this.$refs.detailTable) this.$refs.detailTable.doLayout() |
||||
|
}) |
||||
|
}) |
||||
|
}, |
||||
|
finishText (reason) { return reason === 'DISPATCHED' ? 'WCS已受理' : reason === 'LEFT_CACHE' ? '已离开缓存区' : '—' }, |
||||
|
search () { if (!this.queryLoading) { this.query.page = 1; this.load() } }, |
||||
|
reset () { |
||||
|
if (this.queryLoading) return |
||||
|
this.searchFields.forEach(f => { this.query[f.key] = '' }) |
||||
|
this.query.status = ''; this.query.startDate = ''; this.query.endDate = '' |
||||
|
this.search() |
||||
|
}, |
||||
|
changePage (page) { if (!this.queryLoading) { this.query.page = page; this.load() } }, |
||||
|
changeSize (limit) { if (!this.queryLoading) { this.query.limit = limit; this.search() } }, |
||||
|
// 查询失败清空旧列表,所有出口finally复位;每次显式取当前选中site。- rqrq |
||||
|
async load () { |
||||
|
if (this.queryLoading) return |
||||
|
this.query.site = this.$store.state.user.site |
||||
|
this.queryLoading = true |
||||
|
// 重查或翻页立即清空旧主从选择,废弃尚未返回的上一笔明细。- rqrq |
||||
|
this.detailRequestId += 1 |
||||
|
this.selected = {}; this.details = []; this.detailLoading = false |
||||
|
this.rows = []; this.total = 0 |
||||
|
const site = this.query.site |
||||
|
try { |
||||
|
const { data } = await getCacheTransportTaskPage(Object.assign({}, this.query)) |
||||
|
if (site !== this.$store.state.user.site) return |
||||
|
if (data && data.code === 0) { |
||||
|
this.rows = (data.page && data.page.list) || [] |
||||
|
this.total = (data.page && data.page.totalCount) || 0 |
||||
|
} else { |
||||
|
this.$alert((data && data.msg) || '查询齐套运输任务失败', '提示') |
||||
|
return |
||||
|
} |
||||
|
// 等主表渲染完成后清除旧选中行,同一任务刷新也必须重新触发明细加载。- rqrq |
||||
|
await this.$nextTick() |
||||
|
if (this.$refs.taskTable) this.$refs.taskTable.setCurrentRow(null) |
||||
|
} catch (e) { |
||||
|
this.rows = []; this.total = 0 |
||||
|
this.$message.error('查询齐套运输任务网络异常') |
||||
|
return |
||||
|
} finally { |
||||
|
this.queryLoading = false |
||||
|
} |
||||
|
// 解除查询锁后选中第一行,由current-change统一加载一次托盘明细;空结果保持清空。- rqrq |
||||
|
if (site === this.$store.state.user.site && this.rows.length && this.$refs.taskTable) { |
||||
|
this.$refs.taskTable.setCurrentRow(this.rows[0]) |
||||
|
} |
||||
|
}, |
||||
|
// 选中主单后以显式site+主单ID查询下表;只应用最新请求,防快速切换出现串单显示。- rqrq |
||||
|
openDetails (row) { |
||||
|
const requestId = ++this.detailRequestId |
||||
|
this.selected = {}; this.details = []; this.detailLoading = false |
||||
|
if (!row || this.queryLoading) return |
||||
|
const site = this.$store.state.user.site |
||||
|
if (row.site !== site) { this.$alert('工厂已变化,请重新查询主表', '提示'); return } |
||||
|
this.selected = row; this.detailLoading = true |
||||
|
getCacheTransportTaskDetails({ site, id: row.id }).then(({ data }) => { |
||||
|
if (requestId !== this.detailRequestId || site !== this.$store.state.user.site) return |
||||
|
if (data && data.code === 0) this.details = data.rows || [] |
||||
|
else this.$alert((data && data.msg) || '查询托盘明细失败', '提示') |
||||
|
}).catch(() => { |
||||
|
if (requestId === this.detailRequestId && site === this.$store.state.user.site) this.$message.error('查询托盘明细网络异常') |
||||
|
}).finally(() => { if (requestId === this.detailRequestId) this.detailLoading = false }) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped> |
||||
|
/* 表格高度随当前窗口分配,分页和标题间距参与可用高度计算。- rqrq */ |
||||
|
.cache-transport .el-pagination { margin-top: 14px; text-align: right; } |
||||
|
.cache-transport .detail-title { margin: 16px 0 10px; font-size: 14px; font-weight: bold; } |
||||
|
</style> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue