|
|
@@ -39,7 +39,8 @@
|
|
|
v-model="searchValue.startPoint"
|
|
|
clearable
|
|
|
style="margin-right: 10px"
|
|
|
- ></el-input>
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
<div class="title">终止井号:</div>
|
|
|
<el-input
|
|
|
size="small"
|
|
|
@@ -47,28 +48,20 @@
|
|
|
v-model="searchValue.endPoint"
|
|
|
clearable
|
|
|
style="margin-right: 10px"
|
|
|
- ></el-input>
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
<div class="title">缺陷类型:</div>
|
|
|
<el-select size="small" clearable v-model="searchValue.defectType" placeholder="选择缺陷类型">
|
|
|
- <el-option v-for="item in types" :key="item" :label="item" :value="item"></el-option>
|
|
|
+ <el-option v-for="item in types" :key="item" :label="item" :value="item">
|
|
|
+ </el-option>
|
|
|
</el-select>
|
|
|
|
|
|
<div class="title">类型名称:</div>
|
|
|
<el-select size="small" clearable v-model="searchValue.defectName" placeholder="选择类型名称">
|
|
|
- <el-option
|
|
|
- v-for="item in defectTypes"
|
|
|
- :key="item.name"
|
|
|
- :label="item.name"
|
|
|
- :value="item.name"
|
|
|
- ></el-option>
|
|
|
+ <el-option v-for="(item, i) in defectTypes" :key="item.name + i" :label="item.name" :value="item.name"> </el-option>
|
|
|
</el-select>
|
|
|
- <el-button
|
|
|
- class="serch-btn"
|
|
|
- style="margin-left: 26px"
|
|
|
- type="primary"
|
|
|
- @click="searchApi"
|
|
|
- >查询</el-button>
|
|
|
- <el-button class="serch-btn" type="primary" @click="getPdf('管道缺陷评价统计', 'defecteva')">导出</el-button>
|
|
|
+ <el-button class="serch-btn" style="margin-left: 26px" type="primary" @click="searchApi"> 查询 </el-button>
|
|
|
+ <el-button class="serch-btn" type="primary" @click="getPdf('管道缺陷评价统计', 'defecteva')"> 导出 </el-button>
|
|
|
</div>
|
|
|
<div class="right-btn"></div>
|
|
|
</div>
|
|
|
@@ -86,7 +79,7 @@
|
|
|
<script>
|
|
|
// 引入发布的组件
|
|
|
import summaryForm from '../../components/summaryForm.vue'
|
|
|
-import { getPipeDefectsTypeCountMap } from '../../api/pipelineDefect'
|
|
|
+import { getPipeDefectsTypeCountMap } from '@/api/pipelineManage'
|
|
|
// 引入基本模板
|
|
|
let echarts = require('echarts/lib/echarts')
|
|
|
// 引入饼状图组件
|
|
|
@@ -194,21 +187,15 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
+ this.setTypes()
|
|
|
this.getData().then(res => {
|
|
|
if(res.code === 1) {
|
|
|
let data = res.result.filter(d => d.defectCode !== 'ZC')
|
|
|
this.setData(data)
|
|
|
- this.setTypes(data)
|
|
|
this.isNull = data.length === 0
|
|
|
} else this.$message.error('程序出错')
|
|
|
})
|
|
|
},
|
|
|
- watch: {
|
|
|
- 'searchValue.defectType': function (nv, ov) {
|
|
|
- this.searchValue.defectName = ''
|
|
|
- this.defectTypes = this.defectTypesData.filter(item => item.type && item.type.includes(nv))
|
|
|
- }
|
|
|
- },
|
|
|
computed: {
|
|
|
returnTabel() {
|
|
|
return {
|
|
|
@@ -218,25 +205,21 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ 'searchValue.defectType': function (nv, ov) {
|
|
|
+ this.searchValue.defectName = ''
|
|
|
+ this.setTypes(nv)
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
- setTypes (data = []) {
|
|
|
- let map = new Map()
|
|
|
- map.set('结构性缺陷', [])
|
|
|
- map.set('功能性缺陷', [])
|
|
|
- data.forEach(v => {
|
|
|
- let type = v.defectType
|
|
|
- if (!type) {
|
|
|
- if (this.typeArr.s.includes(v.defectCode)) { type = '结构性缺陷' }
|
|
|
- if (this.typeArr.f.includes(v.defectCode)) { type = '功能性缺陷' }
|
|
|
- }
|
|
|
- if (!map.get(type).includes(v.defectName)) {
|
|
|
- map.get(type).push(v.defectName)
|
|
|
- }
|
|
|
+ setTypes (type = '') {
|
|
|
+ let sDefectStype = this.defectQuantityStatisticsA.map(i => {
|
|
|
+ return { name: i.title.split(')')[1], type: '结构性缺陷' }
|
|
|
})
|
|
|
- map.forEach((value, key) => {
|
|
|
- value.forEach(name => this.defectTypesData.push({ type: key, name }))
|
|
|
+ let fDefectStype = this.defectQuantityStatisticsB.map(i => {
|
|
|
+ return { name: i.title.split(')')[1], type: '功能性缺陷' }
|
|
|
})
|
|
|
- this.defectTypes = [...this.defectTypesData]
|
|
|
+ this.defectTypes = [...sDefectStype, ...fDefectStype].filter(d => d.type.includes(type))
|
|
|
},
|
|
|
setData (data = []) {
|
|
|
this.defectQuantityStatisticsA.forEach(item => {
|
|
|
@@ -330,7 +313,7 @@ export default {
|
|
|
if (this.typeArr.f.includes(defect.defectCode)) { content[1].value += defect.defectNum }
|
|
|
}
|
|
|
})
|
|
|
- this.contentEchatrs = content
|
|
|
+ this.contentEchatrs = content.filter(i => i.value !== 0)
|
|
|
|
|
|
// 中
|
|
|
let echartsData = new Map()
|
|
|
@@ -345,6 +328,8 @@ export default {
|
|
|
let find = this.allArr.find(i => i.Lname.includes(key))
|
|
|
if (find) { find.value = value }
|
|
|
})
|
|
|
+ //
|
|
|
+ this.allArr = this.allArr.filter(i => i.value !== 0)
|
|
|
// 外
|
|
|
|
|
|
let echartsDataArr = data.map((v) => {
|
|
|
@@ -386,7 +371,13 @@ export default {
|
|
|
},
|
|
|
// 搜索
|
|
|
searchApi() {
|
|
|
- this.getData(this.searchValue)
|
|
|
+ this.getData(this.searchValue).then(res => {
|
|
|
+ if(res.code === 1) {
|
|
|
+ let data = res.result.filter(d => d.defectCode !== 'ZC')
|
|
|
+ this.setData(data)
|
|
|
+ this.isNull = data.length === 0
|
|
|
+ } else this.$message.error('程序出错')
|
|
|
+ })
|
|
|
},
|
|
|
getData(params) {
|
|
|
this.defectSumObj = { oneSum: 0, twoSum: 0, threeSum: 0, fourSum: 0, total: 0 }
|
|
|
@@ -409,6 +400,7 @@ export default {
|
|
|
// 基于准备好的dom,初始化echarts实例
|
|
|
let myChart = echarts.init(document.getElementById('mainE'))
|
|
|
// 绘制图表
|
|
|
+ let position = this.contentEchatrs.length === 1 ? 'center' : 'inner'
|
|
|
myChart.setOption(
|
|
|
{
|
|
|
tooltip: {
|
|
|
@@ -428,8 +420,9 @@ export default {
|
|
|
selectedMode: 'single',
|
|
|
radius: [0, '25%'],
|
|
|
label: {
|
|
|
- position: 'inner',
|
|
|
- fontSize: 12
|
|
|
+ position,
|
|
|
+ fontSize: 12,
|
|
|
+ color: '#fff'
|
|
|
},
|
|
|
labelLine: {
|
|
|
show: false
|