|
|
|
@ -31,7 +31,7 @@
|
|
|
|
<el-button
|
|
|
|
<el-button
|
|
|
|
type="primary"
|
|
|
|
type="primary"
|
|
|
|
plain
|
|
|
|
plain
|
|
|
|
@click="handleMinus"
|
|
|
|
@click="handlePareto"
|
|
|
|
v-hasPermi="['warehouse:WmsImportResult:add']"
|
|
|
|
v-hasPermi="['warehouse:WmsImportResult:add']"
|
|
|
|
>帕累托分析</el-button>
|
|
|
|
>帕累托分析</el-button>
|
|
|
|
</el-col>
|
|
|
|
</el-col>
|
|
|
|
@ -69,70 +69,20 @@
|
|
|
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
|
</el-row>
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 质检数据显示区域 -->
|
|
|
|
<!-- 动态内容显示区域 -->
|
|
|
|
<el-row v-if="paretoData.length > 0" class="mb8">
|
|
|
|
<el-row class="mb8">
|
|
|
|
<el-col :span="24">
|
|
|
|
<el-col :span="24">
|
|
|
|
|
|
|
|
<!-- 根据currentComponent动态切换组件 -->
|
|
|
|
|
|
|
|
<component
|
|
|
|
<el-table :data="paretoData" border style="width: 100%" stripe>
|
|
|
|
:is="currentComponent"
|
|
|
|
<el-table-column prop="item_name" label="检测项" width="180" />
|
|
|
|
v-if="currentComponent"
|
|
|
|
<el-table-column prop="defect_count" label="缺陷数" width="100" />
|
|
|
|
:selected-time-range="queryForm.selectedTimeRange"
|
|
|
|
<el-table-column prop="defect_percentage" label="缺陷百分比" width="120">
|
|
|
|
:pareto-data="paretoData"
|
|
|
|
<template #default="scope">
|
|
|
|
:date-range="dateRange"
|
|
|
|
{{ scope.row.defect_percentage }}%
|
|
|
|
@ai-analysis-complete="handleAIAnalysisComplete"
|
|
|
|
</template>
|
|
|
|
/>
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
<el-table-column prop="cumulative_percentage" label="累计百分比" width="120">
|
|
|
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
|
|
|
{{ scope.row.cumulative_percentage }}%
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
<el-table-column label="缺陷占比">
|
|
|
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
|
|
|
<el-progress
|
|
|
|
|
|
|
|
:percentage="scope.row.defect_percentage"
|
|
|
|
|
|
|
|
:show-text="false"
|
|
|
|
|
|
|
|
:color="getProgressColor(scope.row.defect_percentage)"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
<div class="statistics-info">
|
|
|
|
|
|
|
|
<p>数据范围: {{ dateRange.start_date }} 至 {{ dateRange.end_date }}</p>
|
|
|
|
|
|
|
|
<p>总计检测项: {{ paretoData.length }}</p>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div style="margin-bottom: 10px;">
|
|
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
|
|
type="success"
|
|
|
|
|
|
|
|
icon="ChatDotRound"
|
|
|
|
|
|
|
|
@click="handleAIAnalysis"
|
|
|
|
|
|
|
|
:loading="aiAnalysisLoading"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
AI分析
|
|
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</el-col>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- AI分析结果对话框 -->
|
|
|
|
|
|
|
|
<el-dialog
|
|
|
|
|
|
|
|
v-model="aiDialogVisible"
|
|
|
|
|
|
|
|
title="AI分析结果"
|
|
|
|
|
|
|
|
width="60%"
|
|
|
|
|
|
|
|
:close-on-click-modal="false"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<div class="ai-analysis-content">
|
|
|
|
|
|
|
|
<el-input
|
|
|
|
|
|
|
|
v-model="aiAnalysisResult"
|
|
|
|
|
|
|
|
type="textarea"
|
|
|
|
|
|
|
|
:rows="15"
|
|
|
|
|
|
|
|
placeholder="AI分析结果将显示在这里"
|
|
|
|
|
|
|
|
readonly
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 消息显示文本框 -->
|
|
|
|
<!-- 消息显示文本框 -->
|
|
|
|
<el-row>
|
|
|
|
<el-row>
|
|
|
|
@ -152,8 +102,10 @@
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup name="WmsImportResult">
|
|
|
|
<script setup name="WmsImportResult">
|
|
|
|
import { ref, reactive, toRefs, getCurrentInstance } from 'vue'
|
|
|
|
import { ref, reactive, toRefs, getCurrentInstance, shallowRef } from 'vue'
|
|
|
|
import { listWmsImportResult, getWmsImportResult, delWmsImportResult, addWmsImportResult, updateWmsImportResult } from "@/api/warehouse/WmsImportResult"
|
|
|
|
import { listWmsImportResult, getWmsImportResult, delWmsImportResult, addWmsImportResult, updateWmsImportResult } from "@/api/warehouse/WmsImportResult"
|
|
|
|
|
|
|
|
import ParetoAnalysis from './ParetoAnalysis.vue'
|
|
|
|
|
|
|
|
import EmptyContent from './EmptyContent.vue'
|
|
|
|
|
|
|
|
|
|
|
|
const { proxy } = getCurrentInstance()
|
|
|
|
const { proxy } = getCurrentInstance()
|
|
|
|
|
|
|
|
|
|
|
|
@ -185,6 +137,9 @@ const aiDialogVisible = ref(false)
|
|
|
|
const aiAnalysisResult = ref("")
|
|
|
|
const aiAnalysisResult = ref("")
|
|
|
|
const aiAnalysisLoading = ref(false)
|
|
|
|
const aiAnalysisLoading = ref(false)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 当前显示的组件
|
|
|
|
|
|
|
|
const currentComponent = shallowRef(EmptyContent)
|
|
|
|
|
|
|
|
|
|
|
|
const data = reactive({
|
|
|
|
const data = reactive({
|
|
|
|
form: {},
|
|
|
|
form: {},
|
|
|
|
queryParams: {
|
|
|
|
queryParams: {
|
|
|
|
@ -206,7 +161,7 @@ const data = reactive({
|
|
|
|
const { queryParams, form, rules } = toRefs(data)
|
|
|
|
const { queryParams, form, rules } = toRefs(data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function handleMinus() {
|
|
|
|
function handlePareto() {
|
|
|
|
// 根据选择的时间范围计算开始和结束日期
|
|
|
|
// 根据选择的时间范围计算开始和结束日期
|
|
|
|
const endDate = new Date();
|
|
|
|
const endDate = new Date();
|
|
|
|
const startDate = new Date();
|
|
|
|
const startDate = new Date();
|
|
|
|
@ -243,6 +198,8 @@ function handleMinus() {
|
|
|
|
start_date: data.start_date,
|
|
|
|
start_date: data.start_date,
|
|
|
|
end_date: data.end_date
|
|
|
|
end_date: data.end_date
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
// 切换到帕累托分析组件
|
|
|
|
|
|
|
|
currentComponent.value = ParetoAnalysis;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
.catch(error => {
|
|
|
|
@ -251,7 +208,10 @@ function handleMinus() {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 处理AI分析完成事件
|
|
|
|
|
|
|
|
function handleAIAnalysisComplete(result) {
|
|
|
|
|
|
|
|
message.value = result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// getList()
|
|
|
|
// getList()
|
|
|
|
// 根据缺陷百分比设置进度条颜色
|
|
|
|
// 根据缺陷百分比设置进度条颜色
|
|
|
|
|