|
|
|
@ -3,9 +3,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
<el-row :gutter="10" class="mb8">
|
|
|
|
<el-row :gutter="10" class="mb8">
|
|
|
|
|
|
|
|
|
|
|
|
<el-col :span="2.5">
|
|
|
|
<el-col :span="3">
|
|
|
|
<el-form :model="queryForm" label-width="80px">
|
|
|
|
<el-form :model="queryForm" label-width="80px">
|
|
|
|
<el-form-item label="数据范围">
|
|
|
|
<el-form-item label="时间范围">
|
|
|
|
<el-select v-model="queryForm.selectedTimeRange" placeholder="选择时间范围" style="width: 100%">
|
|
|
|
<el-select v-model="queryForm.selectedTimeRange" placeholder="选择时间范围" style="width: 100%">
|
|
|
|
<el-option
|
|
|
|
<el-option
|
|
|
|
v-for="item in timeRangeOptions"
|
|
|
|
v-for="item in timeRangeOptions"
|
|
|
|
@ -18,16 +18,7 @@
|
|
|
|
</el-form>
|
|
|
|
</el-form>
|
|
|
|
</el-col>
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-col :span="3">
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
|
|
plain
|
|
|
|
|
|
|
|
@click="handlePareto"
|
|
|
|
|
|
|
|
v-hasPermi="['warehouse:WmsImportResult:add']"
|
|
|
|
|
|
|
|
>帕累托分析</el-button>
|
|
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
<el-col :span="3.5">
|
|
|
|
|
|
|
|
<el-form :model="queryForm" label-width="80px">
|
|
|
|
<el-form :model="queryForm" label-width="80px">
|
|
|
|
<el-form-item label="机台机型">
|
|
|
|
<el-form-item label="机台机型">
|
|
|
|
<el-select v-model="queryForm.selectedEquipmentType" placeholder="选择设备类型" style="width: 100%">
|
|
|
|
<el-select v-model="queryForm.selectedEquipmentType" placeholder="选择设备类型" style="width: 100%">
|
|
|
|
@ -42,6 +33,15 @@
|
|
|
|
</el-form>
|
|
|
|
</el-form>
|
|
|
|
</el-col>
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
|
|
plain
|
|
|
|
|
|
|
|
@click="handlePareto"
|
|
|
|
|
|
|
|
v-hasPermi="['warehouse:WmsImportResult:add']"
|
|
|
|
|
|
|
|
>帕累托分析</el-button>
|
|
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
<el-col :span="1.5">
|
|
|
|
<el-button
|
|
|
|
<el-button
|
|
|
|
type="info"
|
|
|
|
type="info"
|
|
|
|
@ -117,7 +117,7 @@
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup name="WmsImportResult">
|
|
|
|
<script setup name="WmsImportResult">
|
|
|
|
import { ref, reactive, shallowRef } from 'vue'
|
|
|
|
import { ref, reactive, shallowRef, watch } from 'vue'
|
|
|
|
import { API_CONFIG } from "@/config/api"
|
|
|
|
import { API_CONFIG } from "@/config/api"
|
|
|
|
import ParetoAnalysis from './ParetoAnalysis.vue'
|
|
|
|
import ParetoAnalysis from './ParetoAnalysis.vue'
|
|
|
|
import ItemAnalysis from './ItemAnalysis.vue'
|
|
|
|
import ItemAnalysis from './ItemAnalysis.vue'
|
|
|
|
@ -152,6 +152,37 @@ const dateRange = ref({
|
|
|
|
// 当前显示的组件
|
|
|
|
// 当前显示的组件
|
|
|
|
const currentComponent = shallowRef(EmptyContent)
|
|
|
|
const currentComponent = shallowRef(EmptyContent)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 监听时间范围变化,更新dateRange
|
|
|
|
|
|
|
|
watch(() => queryForm.value.selectedTimeRange, (newTimeRange) => {
|
|
|
|
|
|
|
|
// 如果当前是维修汇总组件,则更新dateRange并刷新数据
|
|
|
|
|
|
|
|
if (currentComponent.value === RepairSummary) {
|
|
|
|
|
|
|
|
// 根据选择的时间范围计算开始和结束日期
|
|
|
|
|
|
|
|
const endDate = new Date();
|
|
|
|
|
|
|
|
const startDate = new Date();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (newTimeRange === '近1年') {
|
|
|
|
|
|
|
|
startDate.setFullYear(endDate.getFullYear() - 1);
|
|
|
|
|
|
|
|
} else if (newTimeRange === '近2年') {
|
|
|
|
|
|
|
|
startDate.setFullYear(endDate.getFullYear() - 2);
|
|
|
|
|
|
|
|
} else if (newTimeRange === '近3年') {
|
|
|
|
|
|
|
|
startDate.setFullYear(endDate.getFullYear() - 3);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 格式化日期为 YYYY-MM-DD
|
|
|
|
|
|
|
|
const formatDate = (date) => {
|
|
|
|
|
|
|
|
const year = date.getFullYear();
|
|
|
|
|
|
|
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
|
|
|
|
|
|
const day = String(date.getDate()).padStart(2, '0');
|
|
|
|
|
|
|
|
return `${year}-${month}-${day}`;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dateRange.value = {
|
|
|
|
|
|
|
|
start_date: formatDate(startDate),
|
|
|
|
|
|
|
|
end_date: formatDate(endDate)
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const data = reactive({
|
|
|
|
const data = reactive({
|
|
|
|
form: {},
|
|
|
|
form: {},
|
|
|
|
queryParams: {
|
|
|
|
queryParams: {
|
|
|
|
@ -233,6 +264,36 @@ function handleItemAnalysis() {
|
|
|
|
function handleRepairSummary() {
|
|
|
|
function handleRepairSummary() {
|
|
|
|
// 打印调试信息
|
|
|
|
// 打印调试信息
|
|
|
|
console.log('切换到维修汇总组件,设备类型:', queryForm.value.selectedEquipmentType);
|
|
|
|
console.log('切换到维修汇总组件,设备类型:', queryForm.value.selectedEquipmentType);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 根据选择的时间范围计算开始和结束日期
|
|
|
|
|
|
|
|
const endDate = new Date();
|
|
|
|
|
|
|
|
const startDate = new Date();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (queryForm.value.selectedTimeRange === '近1年') {
|
|
|
|
|
|
|
|
startDate.setFullYear(endDate.getFullYear() - 1);
|
|
|
|
|
|
|
|
} else if (queryForm.value.selectedTimeRange === '近2年') {
|
|
|
|
|
|
|
|
startDate.setFullYear(endDate.getFullYear() - 2);
|
|
|
|
|
|
|
|
} else if (queryForm.value.selectedTimeRange === '近3年') {
|
|
|
|
|
|
|
|
startDate.setFullYear(endDate.getFullYear() - 3);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 格式化日期为 YYYY-MM-DD
|
|
|
|
|
|
|
|
const formatDate = (date) => {
|
|
|
|
|
|
|
|
const year = date.getFullYear();
|
|
|
|
|
|
|
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
|
|
|
|
|
|
const day = String(date.getDate()).padStart(2, '0');
|
|
|
|
|
|
|
|
return `${year}-${month}-${day}`;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const startDateStr = formatDate(startDate);
|
|
|
|
|
|
|
|
const endDateStr = formatDate(endDate);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 更新dateRange
|
|
|
|
|
|
|
|
dateRange.value = {
|
|
|
|
|
|
|
|
start_date: startDateStr,
|
|
|
|
|
|
|
|
end_date: endDateStr
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 切换到维修汇总组件
|
|
|
|
// 切换到维修汇总组件
|
|
|
|
currentComponent.value = RepairSummary;
|
|
|
|
currentComponent.value = RepairSummary;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|