湖里大屏(质量管理):新增频发问题,天数 Switch 组件

This commit is contained in:
Jack 2022-08-23 12:01:28 +08:00
parent 0ff56f032a
commit 77233ed495

View File

@ -2,65 +2,56 @@
<!-- 问题占比 --> <!-- 问题占比 -->
<div class="frequentProblems"> <div class="frequentProblems">
<div class="title">{{ title }}</div> <div class="title">{{ title }}</div>
<DaysSwitch class="days-switch" @change="handleSwitch" />
<div class="content"> <div class="content">
<JBarChart :xData="xData" :yData="yData" :title="{ text: '频发问题类别排名前十' }" /> <JBarChart :xData="xData" :yData="yData" :color="['#FE6C7F']" />
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import JBarChart from "../jChart/bar/JBarChart.vue"; import JBarChart from '../jChart/bar/JBarChart.vue'
import { selectDangerTypeQualityCountApi } from "@/assets/js/api/dataBoard"; import DaysSwitch from './components/DaysSwitch.vue'
import { selectDangerTypeQualityCountApi } from '@/assets/js/api/dataBoard'
export default { export default {
components: { JBarChart }, components: { JBarChart, DaysSwitch },
props: { props: {
title: { title: {
type: String, type: String,
default: "default title" default: ''
} }
}, },
data() { data() {
return { return {
xData: [ xData: [],
"地理老师",
"地理老师",
"地理老师",
"地理老师",
"地理老师",
"地理老师",
"地理老师",
"地理老师",
"地理老师",
"地理老师"
],
yData: [100, 235, 232, 532, 112, 532, 449, 269, 998, 33] yData: [100, 235, 232, 532, 112, 532, 449, 269, 998, 33]
}; }
}, },
mounted() { mounted() {
this.getData(2); this.getData(2)
}, },
methods: { methods: {
getData(opType) { getData(opType) {
let data = { let data = {
projectSn: this.$store.state.projectSn, projectSn: this.$store.state.projectSn,
opType: opType opType: opType
}; }
selectDangerTypeQualityCountApi(data).then(res => { selectDangerTypeQualityCountApi(data).then(res => {
var arr = res.result.list; var arr = res.result.list
if (arr != null) { if (arr != null) {
var xdata = []; var xdata = []
var ydata = []; var ydata = []
arr.forEach(item => { arr.forEach(item => {
xdata.push(item.dangerName); xdata.push(item.dangerName)
ydata.push(item.num); ydata.push(item.num)
}); })
this.xData = xdata; this.xData = xdata
this.yData = ydata; this.yData = ydata
}
})
} }
});
} }
} }
};
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@ -75,8 +66,13 @@ export default {
font-size: 18px; font-size: 18px;
color: #6ee4f0; color: #6ee4f0;
} }
.days-switch {
margin-top: 10px;
margin-right: 20px;
margin-left: auto;
}
.content { .content {
height: calc(100% - 30px); height: calc(100% - 64px);
} }
} }
</style> </style>