|
|
|
@ -185,6 +185,23 @@
|
|
|
|
destroy-on-close
|
|
|
|
destroy-on-close
|
|
|
|
@close="closeChart"
|
|
|
|
@close="closeChart"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
|
|
|
|
<div v-if="wmsDataLoading" v-loading="true" style="height: 200px; margin-bottom: 20px;"></div>
|
|
|
|
|
|
|
|
<el-table
|
|
|
|
|
|
|
|
v-else-if="wmsData.length > 0"
|
|
|
|
|
|
|
|
:data="wmsData"
|
|
|
|
|
|
|
|
border
|
|
|
|
|
|
|
|
style="width: 100%; margin-bottom: 20px;"
|
|
|
|
|
|
|
|
:header-cell-style="{ backgroundColor: '#f5f7fa', color: '#606266' }"
|
|
|
|
|
|
|
|
max-height="300"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<el-table-column prop="model" label="型号" width="120" />
|
|
|
|
|
|
|
|
<el-table-column prop="specification" label="规格" width="120" />
|
|
|
|
|
|
|
|
<el-table-column prop="wire_disc" label="线盘" width="120" />
|
|
|
|
|
|
|
|
<el-table-column prop="date" label="日期" width="120" />
|
|
|
|
|
|
|
|
<el-table-column prop="total_number" label="总箱数" width="100" />
|
|
|
|
|
|
|
|
<el-table-column prop="total_net_weight" label="总净重(kg)" width="120" />
|
|
|
|
|
|
|
|
<el-table-column prop="total_gross_weight" label="总毛重(kg)" width="120" />
|
|
|
|
|
|
|
|
</el-table>
|
|
|
|
<div class="chart-controls">
|
|
|
|
<div class="chart-controls">
|
|
|
|
<span class="filter-label">时间范围:</span>
|
|
|
|
<span class="filter-label">时间范围:</span>
|
|
|
|
<el-select v-model="selectedTimeRange" @change="onChartTimeRangeChange" style="width: 120px">
|
|
|
|
<el-select v-model="selectedTimeRange" @change="onChartTimeRangeChange" style="width: 120px">
|
|
|
|
@ -261,6 +278,8 @@ const selectedCompletionLevel = ref('all') // 默认显示全部
|
|
|
|
|
|
|
|
|
|
|
|
const salesChartLoading = ref(false)
|
|
|
|
const salesChartLoading = ref(false)
|
|
|
|
const historyChartLoading = ref(false)
|
|
|
|
const historyChartLoading = ref(false)
|
|
|
|
|
|
|
|
const wmsData = ref([])
|
|
|
|
|
|
|
|
const wmsDataLoading = ref(false)
|
|
|
|
const salesData = ref([])
|
|
|
|
const salesData = ref([])
|
|
|
|
const historyData = ref([])
|
|
|
|
const historyData = ref([])
|
|
|
|
const hasSalesData = ref(false)
|
|
|
|
const hasSalesData = ref(false)
|
|
|
|
@ -521,11 +540,13 @@ const showSalesHistory = (row) => {
|
|
|
|
|
|
|
|
|
|
|
|
salesData.value = [];
|
|
|
|
salesData.value = [];
|
|
|
|
historyData.value = [];
|
|
|
|
historyData.value = [];
|
|
|
|
|
|
|
|
wmsData.value = [];
|
|
|
|
hasSalesData.value = false;
|
|
|
|
hasSalesData.value = false;
|
|
|
|
hasHistoryData.value = false;
|
|
|
|
hasHistoryData.value = false;
|
|
|
|
|
|
|
|
|
|
|
|
fetchSalesData(row.model, row.specification);
|
|
|
|
fetchSalesData(row.model, row.specification);
|
|
|
|
fetchHistoryData(row.model, row.specification, row.wire_disc);
|
|
|
|
fetchHistoryData(row.model, row.specification, row.wire_disc);
|
|
|
|
|
|
|
|
fetchWmsData(row.model, row.specification);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 方法:关闭图表
|
|
|
|
// 方法:关闭图表
|
|
|
|
@ -635,6 +656,34 @@ const fetchHistoryData = (model, specification, wireDisc) => {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取WMS数据
|
|
|
|
|
|
|
|
const fetchWmsData = (model, specification) => {
|
|
|
|
|
|
|
|
wmsDataLoading.value = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const apiUrl = `${API_CONFIG.BASE_URL}/api/wms/records/model-spec?model=${model}&specification=${specification}`;
|
|
|
|
|
|
|
|
console.log('WMS API URL:', apiUrl);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fetch(apiUrl)
|
|
|
|
|
|
|
|
.then(response => response.json())
|
|
|
|
|
|
|
|
.then(data => {
|
|
|
|
|
|
|
|
console.log('WMS API Response:', data);
|
|
|
|
|
|
|
|
if (data.code === 200 && data.data && data.data.records) {
|
|
|
|
|
|
|
|
wmsData.value = data.data.records;
|
|
|
|
|
|
|
|
console.log('WMS Data:', wmsData.value);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
wmsData.value = [];
|
|
|
|
|
|
|
|
console.log('WMS data is empty or error');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.catch(error => {
|
|
|
|
|
|
|
|
console.error('WMS数据API调用失败:', error);
|
|
|
|
|
|
|
|
wmsData.value = [];
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.finally(() => {
|
|
|
|
|
|
|
|
wmsDataLoading.value = false;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 初始化销售图表
|
|
|
|
// 初始化销售图表
|
|
|
|
const initSalesChart = (retryCount = 0) => {
|
|
|
|
const initSalesChart = (retryCount = 0) => {
|
|
|
|
if (!hasSalesData.value && !hasHistoryData.value) {
|
|
|
|
if (!hasSalesData.value && !hasHistoryData.value) {
|
|
|
|
|