|
@@ -4,9 +4,11 @@
|
|
|
<s-title titleText="可靠性预测"></s-title>
|
|
|
</div>
|
|
|
<div class="content emptyDs" v-if="showEmpty">
|
|
|
- <empty message="暂无可靠性预测结果,您可通过以下途径进行可靠性预测:<br>
|
|
|
+ <empty
|
|
|
+ message="暂无可靠性预测结果,您可通过以下途径进行可靠性预测:<br>
|
|
|
1、在健康状态分析页面点击【记录评估结果】后,重进该页面<br>
|
|
|
-2、在数据文件管理页面,上传文件后,点击可靠性预测`"></empty>
|
|
|
+2、在数据文件管理页面,上传文件后,点击可靠性预测`"
|
|
|
+ ></empty>
|
|
|
</div>
|
|
|
<div class="content" v-else>
|
|
|
<div class="left-panel">
|
|
@@ -34,7 +36,10 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="section-title">
|
|
|
- <s-title :type="3" :titleText="!!fileName ? '模拟可靠性预测':'可靠性预测'"></s-title>
|
|
|
+ <s-title
|
|
|
+ :type="3"
|
|
|
+ :titleText="!!fileName ? '模拟可靠性预测' : '可靠性预测'"
|
|
|
+ ></s-title>
|
|
|
</div>
|
|
|
<div class="info-type">
|
|
|
<div
|
|
@@ -59,25 +64,37 @@
|
|
|
</div>
|
|
|
<div class="info-item" v-if="!!!fileName">
|
|
|
预计发生故障:
|
|
|
- <span class="info-value"> {{ formattedText(currentBtn.expected_failure) }}</span>
|
|
|
+ <span class="info-value">
|
|
|
+ {{ formattedText(currentBtn.expected_failure) }}</span
|
|
|
+ >
|
|
|
</div>
|
|
|
<div class="info-item">
|
|
|
近期故障概率:
|
|
|
<span class="info-value">
|
|
|
- {{ formattedText(currentBtn.short_term_failure_probability,'5%') }}</span
|
|
|
+ {{
|
|
|
+ formattedText(currentBtn.short_term_failure_probability, "5%")
|
|
|
+ }}</span
|
|
|
>
|
|
|
</div>
|
|
|
<div class="info-item">
|
|
|
故障发生时间:
|
|
|
- <span class="info-value"> {{ formattedText(currentBtn.failure_time) }}</span>
|
|
|
+ <span class="info-value">
|
|
|
+ {{ formattedText(currentBtn.failure_time) }}</span
|
|
|
+ >
|
|
|
</div>
|
|
|
<div class="info-item">
|
|
|
影响因素分析:
|
|
|
- <span class="info-value"> {{ formattedText(currentBtn.impact_factors) }}</span>
|
|
|
+ <span class="info-value">
|
|
|
+ {{ formattedText(currentBtn.impact_factors) }}</span
|
|
|
+ >
|
|
|
</div>
|
|
|
<div class="info-item">
|
|
|
剩余可靠时间:
|
|
|
- <span class="info-value"> {{ formattedText(currentBtn.remaining_lifetime,'半年以上') }}</span>
|
|
|
+ <span class="info-value">
|
|
|
+ {{
|
|
|
+ formattedText(currentBtn.remaining_lifetime, "半年以上")
|
|
|
+ }}</span
|
|
|
+ >
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -88,7 +105,7 @@
|
|
|
<div class="chart">
|
|
|
<!-- 图表组件 -->
|
|
|
<LineChart
|
|
|
- ref="lineChartRef"
|
|
|
+ ref="lineChartRef"
|
|
|
:xAxisData="xAxisData"
|
|
|
:seriesData="seriesData"
|
|
|
:showLegend="showLegend"
|
|
@@ -110,19 +127,18 @@
|
|
|
<div class="suggestion-item">
|
|
|
<div class="suggestion-title">维修方法</div>
|
|
|
<span class="suggestion-value">{{
|
|
|
- formattedText( currentBtn.maintenance_method)
|
|
|
+ formattedText(currentBtn.maintenance_method)
|
|
|
}}</span>
|
|
|
</div>
|
|
|
<div class="suggestion-item">
|
|
|
<div class="suggestion-title">所需维修资源</div>
|
|
|
<span class="suggestion-value">{{
|
|
|
- formattedText( currentBtn.required_resources)
|
|
|
+ formattedText(currentBtn.required_resources)
|
|
|
}}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="buttons">
|
|
|
<button
|
|
|
-
|
|
|
class="btn btn-big"
|
|
|
@click="goAdvice(currentBtn.name, currentBtn.name)"
|
|
|
>
|
|
@@ -159,17 +175,20 @@ const router = useRouter();
|
|
|
const route = useRoute(); // 获取当前路由对象
|
|
|
// 可靠性预测导出
|
|
|
const lineChartRef = ref(null);
|
|
|
-let serviceDataRef=ref(null)
|
|
|
+let serviceDataRef = ref(null);
|
|
|
const getAllDomElements = async () => {
|
|
|
// this.$nextTick(() => {
|
|
|
- let imgBase64= await lineChartRef.value.saveChartAndSend();
|
|
|
- console.log(imgBase64);
|
|
|
-
|
|
|
- serviceDataRef.value={
|
|
|
+ let imgBase64 = await lineChartRef.value.saveChartAndSend();
|
|
|
+ console.log(imgBase64);
|
|
|
+
|
|
|
+ serviceDataRef.value = {
|
|
|
...serviceDataRef.value,
|
|
|
- image:imgBase64.split(',')[1]
|
|
|
- }
|
|
|
- downloadFile(downloadStrategy(), "预测结果.docx", { fileName:fileName.value,...serviceDataRef.value });
|
|
|
+ image: imgBase64.split(",")[1],
|
|
|
+ };
|
|
|
+ downloadFile(downloadStrategy(), "预测结果.docx", {
|
|
|
+ fileName: fileName.value,
|
|
|
+ ...serviceDataRef.value,
|
|
|
+ });
|
|
|
|
|
|
// downloadStrategy({...serviceDataRef.value}).then((res:any)=>{
|
|
|
// debugger
|
|
@@ -214,35 +233,41 @@ const btnTab = (index: number, item: any) => {
|
|
|
};
|
|
|
const formatPercentage = (value: string) => {
|
|
|
// 去掉百分号
|
|
|
- const numericValue = parseFloat(value.replace('%', ''));
|
|
|
+ const numericValue = parseFloat(value.replace("%", ""));
|
|
|
// 检查是否为数字
|
|
|
if (isNaN(numericValue)) {
|
|
|
return value; // 如果不是数字,返回原始值
|
|
|
}
|
|
|
// 取小数点后两位并加上百分号
|
|
|
- return numericValue.toFixed(2) + '%';
|
|
|
+ return numericValue.toFixed(2) + "%";
|
|
|
};
|
|
|
|
|
|
// 计算属性来格式化 short_term_failure_probability
|
|
|
const formattedShortTermFailureProbability = computed(() => {
|
|
|
const value = currentBtn.value.short_term_failure_probability;
|
|
|
- return typeof value === 'string' ? formatPercentage(value) : '暂无';
|
|
|
+ return typeof value === "string" ? formatPercentage(value) : "暂无";
|
|
|
});
|
|
|
-const formattedText = (value,deValue)=>{
|
|
|
+const formattedText = (value, deValue) => {
|
|
|
if (!!deValue) {
|
|
|
- return !!value?value:deValue
|
|
|
+ return !!value ? value : deValue;
|
|
|
}
|
|
|
- return !!value?value:'暂无'
|
|
|
-}
|
|
|
-const showEmpty=ref(false)
|
|
|
+ return !!value ? value : "暂无";
|
|
|
+};
|
|
|
+const showEmpty = ref(false);
|
|
|
onMounted(() => {
|
|
|
let source = 1;
|
|
|
const pageId = route.query.id;
|
|
|
const name = route.query.name;
|
|
|
fileName.value = name;
|
|
|
+
|
|
|
if (pageId) {
|
|
|
source = 2;
|
|
|
}
|
|
|
+ const sourceCp = route.query.source;
|
|
|
+
|
|
|
+ if (!!sourceCp) {
|
|
|
+ source = sourceCp;
|
|
|
+ }
|
|
|
// evaluateHealthStatus({ source, fileId: pageId }).then((res: any) => {
|
|
|
// const result: any = res.data;
|
|
|
// xAxisData.value = result.chart.x;
|
|
@@ -259,35 +284,38 @@ onMounted(() => {
|
|
|
// data: result.chart.y,
|
|
|
// },
|
|
|
// ];
|
|
|
-
|
|
|
- evaluateHealthStatus({ source, fileId: pageId })
|
|
|
+let timeObj={};
|
|
|
+if (!!route.query.start_time) {
|
|
|
+ timeObj.start_time=route.query.start_time.replaceAll('+',' ')
|
|
|
+}
|
|
|
+if (!!route.query.end_time) {
|
|
|
+ timeObj.end_time=route.query.end_time.replaceAll('+',' ')
|
|
|
+}
|
|
|
+ evaluateHealthStatus({ source, [source == 2 ? "fileId" : "id"]: pageId,...timeObj })
|
|
|
.then((res: any) => {
|
|
|
proxy.$loading.stop();
|
|
|
|
|
|
const result: any = res.data;
|
|
|
- if (result==false) {
|
|
|
- showEmpty.value=true
|
|
|
- return false
|
|
|
+ if (result == false) {
|
|
|
+ showEmpty.value = true;
|
|
|
+ return false;
|
|
|
}
|
|
|
- showEmpty.value=false
|
|
|
- serviceDataRef.value=result;
|
|
|
+ showEmpty.value = false;
|
|
|
+ serviceDataRef.value = result;
|
|
|
xAxisData.value = result.chart.x;
|
|
|
forecast_result.value = result.forecast_result;
|
|
|
devicesArr.value = result.devices;
|
|
|
-
|
|
|
-
|
|
|
- if (result.devices.length==0) {
|
|
|
- currentBtn.value={
|
|
|
- health_status:'健康'
|
|
|
- }
|
|
|
-
|
|
|
- }else{
|
|
|
- currentBtn.value = {
|
|
|
- ...result.devices[0],
|
|
|
- ...result.devices[0].maintenance_suggestion,
|
|
|
- ...result.devices[0].reliability_forecast,
|
|
|
|
|
|
- };
|
|
|
+ if (result.devices.length == 0) {
|
|
|
+ currentBtn.value = {
|
|
|
+ health_status: "健康",
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ currentBtn.value = {
|
|
|
+ ...result.devices[0],
|
|
|
+ ...result.devices[0].maintenance_suggestion,
|
|
|
+ ...result.devices[0].reliability_forecast,
|
|
|
+ };
|
|
|
}
|
|
|
seriesData.value = [
|
|
|
{
|
|
@@ -311,8 +339,8 @@ onMounted(() => {
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
|
-.emptyDs{
|
|
|
- height: calc( 100% - 300px);
|
|
|
+.emptyDs {
|
|
|
+ height: calc(100% - 300px);
|
|
|
}
|
|
|
.container {
|
|
|
display: flex;
|