{{ current.planNo }}
@@ -61,6 +61,7 @@
刷新到货
+
下载模板
-
-
+
+ 采购要求
+
-
-
-
+
+
+
+
无采购要求
-
-
+ 到货明细({{ deliveryList.length }})
@@ -121,6 +123,32 @@
暂无到货记录,点右上角「上传到货表格」
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ contractStatusText(s.row.status) }}
+
+
+
+
+
+
+
+
+ 无关联合同
+
+
@@ -136,6 +164,7 @@ import {
refreshArrival
} from '@/api/erp/purchasePlan'
import { getToken } from '@/utils/auth'
+import * as XLSX from 'xlsx'
export default {
name: 'ErpPurchaseDelivery',
@@ -146,10 +175,11 @@ export default {
planList: [],
queryParams: { pageNum: 1, pageSize: 20, keyword: undefined },
current: {},
- activeTab: 'items',
+ activeTab: 'all',
deliveryList: [],
deliveryLoading: false,
refreshing: false,
+ detailLoading: false,
upload: { headers: { Authorization: 'Bearer ' + getToken() } },
progressColor: '#5b8db8'
}
@@ -180,10 +210,12 @@ export default {
this.getList()
},
selectPlan(p) {
- this.activeTab = 'items'
+ this.activeTab = 'all'
this.current = { ...p }
this.deliveryList = []
- // 打开即静默按钢卷表复核一次到货状态
+ // 立即加载详情,不等待 WMS 刷新
+ this.refreshDetail()
+ // 后台静默按钢卷表复核一次到货状态
const planId = p.planId
refreshArrival(planId).catch(() => {}).finally(() => {
if (this.current.planId === planId) this.refreshDetail()
@@ -192,7 +224,8 @@ export default {
refreshDetail() {
const planId = this.current.planId
if (!planId) return
- getPurchasePlan(planId).then(res => { this.current = { ...this.current, ...(res.data || {}) } })
+ this.detailLoading = true
+ getPurchasePlan(planId).then(res => { this.current = { ...this.current, ...(res.data || {}) } }).finally(() => { this.detailLoading = false })
this.deliveryLoading = true
listDelivery(planId).then(res => { this.deliveryList = res.data || [] }).finally(() => { this.deliveryLoading = false })
},
@@ -212,13 +245,11 @@ export default {
},
statusText(row) {
if (row.arrived === 1) return '已到货'
- if (row.inTransit === 1) return '在途'
- return '未到'
+ return '在途'
},
statusClass(row) {
if (row.arrived === 1) return 'yes'
- if (row.inTransit === 1) return 'transit'
- return 'no'
+ return 'transit'
},
handleUploadSuccess(res) {
if (res.code === 200) {
@@ -228,7 +259,7 @@ export default {
} else {
this.$modal.msgSuccess(res.msg || '导入成功')
}
- this.activeTab = 'delivery'
+ this.activeTab = 'all'
this.refreshDetail()
this.getList(true)
} else {
@@ -240,6 +271,18 @@ export default {
},
fmt(v) {
return Number(v || 0).toLocaleString('zh-CN', { minimumFractionDigits: 0, maximumFractionDigits: 3 })
+ },
+ contractStatusText(v) {
+ return { 0: '草稿', 1: '生效', 2: '作废', 3: '已完成' }[v] || '—'
+ },
+ downloadTemplate() {
+ const headers = ['日期', '牌号', '规格', '卷号', '单卷重量', '车号', '数量', '件数', '销售', '钢厂到站']
+ const sampleRow = ['2026-01-01', 'Q235B', '1.0*1250*C', 'COIL0001', '20.50', '辽A12345', '60.8', '3', 'XS001', '沈阳站']
+ const wb = XLSX.utils.book_new()
+ const ws = XLSX.utils.aoa_to_sheet([headers, sampleRow])
+ ws['!cols'] = headers.map(h => ({ wch: h.length > 4 ? 14 : 10 }))
+ XLSX.utils.book_append_sheet(wb, ws, '到货模板')
+ XLSX.writeFile(wb, '到货导入模板.xlsx')
}
}
}
@@ -292,6 +335,10 @@ $sub: #909399;
&.wide { grid-column: span 2; }
}
.pd-tabs { padding: 0 18px 18px; }
+.pd-sec-title {
+ font-size: 13px; font-weight: 600; color: $ink;
+ border-left: 3px solid $accent; padding-left: 8px; margin-bottom: 10px;
+}
.pd-mtag {
font-size: 11px; line-height: 16px; padding: 0 6px; border-radius: 2px; border: 1px solid #dcdfe6; color: $sub;
&.yes { color: #3a8a4d; border-color: #b7d9bf; background: #f0f9f1; }
diff --git a/klp-ui/src/views/erp/purchasePlan/index.vue b/klp-ui/src/views/erp/purchasePlan/index.vue
index b4840219c..48d9fa6db 100644
--- a/klp-ui/src/views/erp/purchasePlan/index.vue
+++ b/klp-ui/src/views/erp/purchasePlan/index.vue
@@ -124,10 +124,13 @@