<template>
|
<div>
|
<div class="mod-baseReliability-paramDataBasic fa-card-a" style="margin-left: 5px;">
|
<zt-table-wraper :defaultNotQuery='true' ref="tableObj"
|
v-slot="{ table }" :paging='false'>
|
<el-form :inline="true" :model="dataForm" ref="dataForm" :disabled="dataForm.disabled" label-width="80px">
|
<zt-form-item label="产品节点" prop="productId">
|
<zt-select v-model="dataForm.productId" :datas="productList" @change="onProductSelected"/>
|
</zt-form-item>
|
<zt-form-item label="总体任务" prop="taskModelId">
|
<zt-select v-model="dataForm.taskId" :datas="taskList" @change="onTaskSelected"/>
|
</zt-form-item>
|
<zt-form-item label="评定数据" prop="itemId">
|
<zt-select v-model="dataForm.itemId" :datas="assessDataList" @change="onAssessDataSelected"/>
|
</zt-form-item>
|
<zt-form-item label="置信度" prop="confidence">
|
<el-input v-model="dataForm.confidence" placeholder="置信度" clearable></el-input>
|
</zt-form-item>
|
<el-button type="primary" @click="assess()">评定</el-button>
|
<el-button type="primary" @click="assessData()">评定数据管理</el-button>
|
<el-button type="primary" @click="handleExpand()">{{expandText}}</el-button>
|
<el-dropdown style="margin-left: 10px" @command="download">
|
<el-button type="primary">
|
下载xml<i class="el-icon-arrow-down el-icon--right"></i>
|
</el-button>
|
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-item command="1">输入xml</el-dropdown-item>
|
<el-dropdown-item command="2">输出xml</el-dropdown-item>
|
</el-dropdown-menu>
|
</el-dropdown>
|
</el-form>
|
<el-table ref="multipleTable" v-loading="table.dataLoading" :data="dataList" height="100px" v-adaptive="{bottomOffset:70}"
|
row-key="id"
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
:header-cell-style="{'text-align':'center'}"
|
:expand-row-keys="defultKey"
|
border @selection-change="table.selectionChangeHandle">
|
<el-table-column prop="name" label="名称"/>
|
<el-table-column prop="runNum" label="试验次数(成败型)" align="right">
|
</el-table-column>
|
<el-table-column prop="runTimes" label="试验时长(非成败型)" align="right">
|
</el-table-column>
|
<el-table-column prop="failNum" label="失败次数" align="right">
|
</el-table-column>
|
<el-table-column prop="assessResult" label="评定结果" align="right">
|
</el-table-column>
|
</el-table>
|
<assess-manage @refreshDataList="refreshData" ref="AssessManage"/>
|
</zt-table-wraper>
|
<el-dialog v-dialogDrag :close-on-click-modal="false" top="8vh" :visible.sync="dialogVisible" title="模型检查"
|
width="60%" @close="dialogVisible = false">
|
<el-tag type="danger" style="margin-bottom: 10px">模型定义/参数配置/评定数据里存在以下问题:</el-tag>
|
<el-table :data="modelCheckResult" height="350"
|
:header-cell-style="{'text-align':'center'}">
|
<el-table-column prop="category" label="检查结果" align="center" width="150"/>
|
<el-table-column prop="taskName" label="任务名称" align="center"/>
|
<el-table-column prop="taskPhaseName" label="任务阶段名称" align="center"/>
|
<el-table-column prop="gkName" label="工况名称" align="center"/>
|
<el-table-column prop="nodeName" label="节点名称" align="center"/>
|
<el-table-column prop="modelName" label="模型名称" align="center"/>
|
<el-table-column prop="deviceName" label="设备名称" align="center"/>
|
<el-table-column prop="paramName" label="参数名称" align="center"/>
|
</el-table>
|
<div slot="footer" class="dialog-footer">
|
<el-button type="primary" @click="dialogVisible = false">关 闭</el-button>
|
</div>
|
</el-dialog>
|
</div>
|
</div>
|
</template>
|
<script>
|
import qs from "qs";
|
import Cookies from "js-cookie";
|
import AssessManage from "./RelisbilityAssess-Manage";
|
|
export default {
|
data() {
|
return {
|
dataForm: {
|
productId: '',
|
shipName: '',
|
taskId: '',
|
itemId: '',
|
name: '',
|
runTimes: '',
|
failNum: '',
|
runNum: '',
|
assessResult: '',
|
confidence: '',
|
},
|
productList: [],
|
taskList: [],
|
assessDataList: [],
|
dataList: [],
|
flag1: false,
|
flag2: false,
|
defultKey: [],
|
isExpand:false,
|
expandText:"一键展开",
|
dialogVisible: false,
|
modelCheckResult: [],
|
}
|
},
|
components: {
|
AssessManage,
|
},
|
mounted() {
|
this.getProductList()
|
},
|
methods: {
|
async page() {
|
let res = await this.$http.post('/taskReliability/ReliabilityAssess/page', this.dataForm)
|
console.log(res.data)
|
this.dataList = res.data
|
},
|
// 获取信息
|
async onProductSelected(data) {
|
this.defultKey = []
|
console.log(data, ' onProductSelected(data)')
|
this.dataForm.productId = data.id
|
this.dataForm.shipName = data.name
|
this.setDefultKey()
|
await this.zhixin().then(() => {
|
if (this.dataForm.taskId&& this.dataForm.itemId) {
|
this.page()
|
}else{
|
this.dataList = []
|
}
|
})
|
},
|
refreshData(){
|
this.getAssessDataList()
|
},
|
async zhixin() {
|
await this.getTaskList()
|
await this.getAssessDataList()
|
},
|
setDefultKey() {
|
this.defultKey.push(this.dataForm.productId + "")
|
console.log(this.defultKey,"this.defultKey")
|
},
|
onTaskSelected(data) {
|
console.log(data, ' onProductSelected(data)')
|
this.dataForm.taskId = data.id
|
if (this.dataForm.taskId&& this.dataForm.itemId) {
|
this.page()
|
}
|
},
|
onAssessDataSelected(data) {
|
this.dataForm.itemId = data.id
|
if (this.dataForm.taskId&& this.dataForm.itemId) {
|
this.page()
|
}
|
},
|
async getAssessDataList() {
|
let params = {
|
productId: this.dataForm.productId
|
}
|
let res = await this.$http.get('/taskReliability/ReliabilityAssess/getAssessDataList', {params: params})
|
this.assessDataList = res.data
|
if (this.assessDataList.length > 0) {
|
this.dataForm.itemId = this.assessDataList[0].id
|
} else {
|
this.dataForm.itemId = ''
|
}
|
this.flag2 = true
|
},
|
assessData(){
|
this.$refs.AssessManage.$refs.dialog.init(null, {
|
productId: this.dataForm.productId,
|
shipName: this.dataForm.shipName
|
})
|
},
|
async assess() {
|
this.dialogVisible = false
|
this.modelCheckResult = []
|
if (!this.dataForm.productId || !this.dataForm.taskId || !this.dataForm.itemId || !this.dataForm.confidence) {
|
this.$tip.alert("有未填写的数据")
|
return
|
}
|
let res = await this.$http.post('/taskReliability/ReliabilityAssess/assessCheck', this.dataForm)
|
if (res.success) {
|
if (res.data && res.data.length > 0) {
|
this.modelCheckResult = res.data
|
this.dialogVisible = true
|
} else {
|
let res = await this.$http.post('/taskReliability/ReliabilityAssess/assess', this.dataForm)
|
if (res.success) {
|
console.log(res.data)
|
this.dataList = res.data
|
this.$alert('评定成功', '提示', {
|
confirmButtonText: '确定'
|
})
|
}
|
}
|
}
|
},
|
async getProductList() {
|
let res = await this.$http.get('/basicInfo/XhProductModel/getTaskProductList')
|
this.productList = res.data
|
await this.onProductSelected(this.productList[0])
|
},
|
async getTaskList() {
|
let params = {
|
productId: this.dataForm.productId
|
}
|
let res = await this.$http.get('/taskReliability/Task/getTaskList', {params: params})
|
console.log(res.data)
|
this.taskList = res.data
|
if (this.taskList.length > 0) {
|
this.dataForm.taskId = this.taskList[0].id
|
} else {
|
this.dataForm.taskId = ''
|
}
|
this.flag1 = true
|
},
|
handleExpand() {
|
this.isExpand = !this.isExpand
|
this.$nextTick(() => {
|
this.forArr(this.dataList, this.isExpand)
|
})
|
if (this.isExpand === true) {
|
this.expandText = '一键折叠'
|
}
|
if (this.isExpand === false) {
|
this.expandText = '一键展开'
|
}
|
},
|
// 遍历
|
forArr(arr, isExpand) {
|
arr.forEach(i => {
|
this.$refs.multipleTable.toggleRowExpansion(i, isExpand)
|
if (i.children) {
|
this.forArr(i.children, isExpand)
|
}
|
})
|
},
|
async download(selsect) {
|
if (!this.dataForm.productId || !this.dataForm.taskId || !this.dataForm.itemId ) {
|
this.$tip.alert("有未填写的数据")
|
return
|
}
|
let param = qs.stringify({
|
'token': Cookies.get('token'),
|
productId: this.dataForm.productId,
|
taskId: this.dataForm.taskId,
|
itemId: this.dataForm.itemId,
|
xml:selsect
|
})
|
let apiURL = `/taskReliability/ReliabilityAssess/downloadXml`
|
window.location.href = `${window.SITE_CONFIG['apiURL']}${apiURL}?${param}`
|
}
|
},
|
}
|
</script>
|