| | |
| | | <template> |
| | | <div> |
| | | <div class="mod-baseReliability-paramDataBasic fa-card-a" style="margin-left: 5px;"> |
| | | <zt-table-wraper :defaultNotQuery='true' ref="tableObj" query-url="/taskReliability/ReliabilityAssess/page" |
| | | <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.taskModelId" :datas="taskList" @change="onTaskSelected"/> |
| | | <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 label="置信度" prop="confidence"> |
| | | <el-input v-model="dataForm.confidence" placeholder="置信度" clearable></el-input> |
| | | </zt-form-item> |
| | | <el-button type="primary" @click="">评定</el-button> |
| | | <el-button type="primary" @click="assess()">评定</el-button> |
| | | <el-button type="primary" @click="add()">新增评定数据</el-button> |
| | | <el-button type="primary" @click="handleExpand()">{{expandText}}</el-button> |
| | | </el-form> |
| | | <el-table v-loading="table.dataLoading" :data="table.dataList" height="100px" v-adaptive="{bottomOffset:70}" |
| | | <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"> |
| | |
| | | dataForm: { |
| | | productId: '', |
| | | shipName: '', |
| | | taskModelId: '', |
| | | taskId: '', |
| | | itemId: '', |
| | | name: '', |
| | | runTimes: '', |
| | |
| | | productList: [], |
| | | taskList: [], |
| | | assessDataList: [], |
| | | dataList: [], |
| | | flag1: false, |
| | | flag2: false, |
| | | defultKey: [], |
| | | isExpand:false, |
| | | expandText:"一键展开" |
| | | } |
| | | }, |
| | | components: { |
| | |
| | | this.getProductList() |
| | | }, |
| | | methods: { |
| | | async page() { |
| | | let res = await this.$http.post('/taskReliability/ReliabilityAssess/page', this.dataForm) |
| | | console.log(res.data) |
| | | this.dataList = res.data |
| | | }, |
| | | // 获取信息 |
| | | onProductSelected(data) { |
| | | async onProductSelected(data) { |
| | | this.defultKey = [] |
| | | console.log(data, ' onProductSelected(data)') |
| | | this.dataForm.productId = data.id |
| | | this.dataForm.shipName = data.name |
| | | this.getTaskList() |
| | | this.getAssessDataList(); |
| | | this.setDefultKey() |
| | | await this.zhixin().then(() => { |
| | | if (this.dataForm.taskId&& this.dataForm.itemId) { |
| | | this.page() |
| | | }else{ |
| | | this.dataList = [] |
| | | } |
| | | }) |
| | | }, |
| | | 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.taskModelId = data.id |
| | | 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() |
| | | } |
| | | }, |
| | | refreshData() { |
| | | this.getAssessDataList(); |
| | |
| | | } else { |
| | | this.dataForm.itemId = '' |
| | | } |
| | | this.flag2 = true |
| | | }, |
| | | add() { |
| | | this.$refs.AddOrUpdate.$refs.dialog.init(null, { |
| | |
| | | shipName: this.dataForm.shipName |
| | | }) |
| | | }, |
| | | async assess() { |
| | | if (!this.dataForm.productId || !this.dataForm.taskId || !this.dataForm.itemId || !this.dataForm.confidence) { |
| | | this.$tip.alert("有未填写的数据") |
| | | } |
| | | let res = await this.$http.post('/taskReliability/ReliabilityAssess/assess', this.dataForm) |
| | | console.log(res.data) |
| | | this.dataList = res.data |
| | | }, |
| | | async getProductList() { |
| | | let res = await this.$http.get('/basicInfo/XhProductModel/getTaskProductList') |
| | | this.productList = res.data |
| | | this.onProductSelected(this.productList[0]) |
| | | await this.onProductSelected(this.productList[0]) |
| | | }, |
| | | async getTaskList() { |
| | | let params = { |
| | |
| | | console.log(res.data) |
| | | this.taskList = res.data |
| | | if (this.taskList.length > 0) { |
| | | this.dataForm.taskModelId = this.taskList[0].id |
| | | this.dataForm.taskId = this.taskList[0].id |
| | | } else { |
| | | this.dataForm.taskModelId = '' |
| | | 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) |
| | | } |
| | | }) |
| | | }, |
| | | } |
| | | } |