Commit 31157b2c by T

首页右下角统计bug修复、警员编号限制9位

parent 624bbb09
......@@ -54,7 +54,8 @@ router.beforeEach((to, from, next) => {
export const loadMenus = (next, to) => {
buildMenus().then(res => {
const asyncRouter = filterAsyncRouter(res)
const asyncRouter = filterAsyncRouter(res)
//console.log(asyncRouter)
asyncRouter.push({ path: '*', redirect: '/', hidden: true })
store.dispatch('GenerateRoutes', asyncRouter).then(() => { // 存储路由
router.addRoutes(asyncRouter) // 动态添加可访问路由表
......
......@@ -34,6 +34,7 @@ export const filterAsyncRouter = (routers) => { // 遍历后台传来的路由
}
return true
})
//console.log(accessedRouters)
return accessedRouters
}
......
......@@ -10,7 +10,7 @@
<el-input v-model.trim="form.name" style="width: 370px;" placeholder="请输入姓名"/>
</el-form-item>
<el-form-item label="警员编号" prop="policeCode">
<el-input v-model="form.policeCode" style="width: 370px;" placeholder="请输入警员编号"/>
<el-input v-model="form.policeCode" style="width: 370px;" maxlength="9" show-word-limit placeholder="请输入警员编号,不能超过9位"/>
</el-form-item>
<el-form-item label="性别">
<el-radio v-model="form.sex" label="男" border></el-radio>
......
<template>
<el-card style="height:350px">
<div slot="header" class="clearfix">
<span>{{radio}}</span>
<el-radio-group v-model="radio" size="small" @change="radioChange" style="float: right;margin-top:-7px;margin-bottom:-10px;">
<el-radio-button label="使用次数"></el-radio-button>
<el-radio-button label="维修次数"></el-radio-button>
<el-radio-button label="报废数"></el-radio-button>
</el-radio-group>
</div>
<v-chart :forceFit="true" :height="300" :data="chartData" style="margin-left: -50px">
<v-tooltip />
<v-axis data-key='维修次数' :line="line" :label="label" />
<v-axis data-key='报废次数' :line="line" :label="label" />
<v-legend />
<v-line :position="position" color="parentName" />
<!-- <v-point :position="position" color="parentName" :size="4" :v-style="style" :shape="'circle'" /> -->
</v-chart>
</el-card>
</template>
<script>
import { getSyPOrg } from '@/api/view'
import { getWxPOrg } from '@/api/view'
import { getBfPOrg } from '@/api/view'
import DataSet from '@antv/data-set'
export default {
data() {
const label = {
offset: -620,
textStyle: {
textAlign: 'left',
}
}
const line = {
textAlign: 'left'
}
return {
orgId: this.$store.state.user.user.baseJpOrganization.id,
radio: '使用次数',
dataSource: [],
adjust: [{
type: 'dodge',
marginRatio: 1 / 32,
}],
style: { stroke: '#fff', lineWidth: 1 },
chartData: [],
line,
label,
position: '装备类型*使用量'
}
},
computed: {
// chartData() {
// let dv = new DataSet.View().source(this.dataSource)
// dv.transform({
// type: 'fold',
// fields: ['近七天使用次数', '近三十天使用次数'],
// key: '装备类型',
// value: '使用量',
// });
// return dv.rows
// },
},
mounted() {
this.init()
},
methods: {
init(orgId) {
this.orgId = orgId || this.$store.state.user.user.baseJpOrganization.id
getSyPOrg({orgId: this.orgId}).then(res => {
if (res.code == "10000") {
this.dataSource = res.data
//this.dataSource =[{parentName: "反恐救援装备", 近七天使用次数: 10, 近三十天使用次数: 10}, {parentName: "武器警械", 近七天使用次数: 10, 近三十天使用次数: 20}]
let dv = new DataSet.View().source(this.dataSource)
dv.transform({
type: 'fold',
fields: ['近七天使用次数', '近三十天使用次数'],
key: '装备类型',
value: '使用量',
});
this.chartData = dv.rows
this.position = '装备类型*使用量'
} else {
this.$message.error(res.msg)
}
})
},
radioChange(value) {
if (value == '使用次数') {
getSyPOrg({orgId: this.orgId}).then(res => {
if (res.code == "10000") {
this.dataSource = res.data
let dv = new DataSet.View().source(this.dataSource)
dv.transform({
type: 'fold',
fields: ['近七天使用次数', '近三十天使用次数'],
key: '装备类型',
value: '使用量',
});
this.chartData = dv.rows
this.position = '装备类型*使用量'
} else {
this.$message.error(res.msg)
}
})
} else if (value == '维修次数') {
getWxPOrg({orgId: this.orgId}).then(res => {
if (res.code == "10000") {
this.dataSource = res.data
let dv = new DataSet.View().source(this.dataSource)
dv.transform({
type: 'fold',
fields: ['近三个月维修次数', '近半年维修次数'],
key: '装备类型',
value: '维修次数',
});
this.chartData = dv.rows
this.position = '装备类型*维修次数'
} else {
this.$message.error(res.msg)
}
})
}
else if (value == '报废数') {
getBfPOrg({orgId: this.orgId}).then(res => {
if (res.code == "10000") {
this.dataSource = res.data
let dv = new DataSet.View().source(this.dataSource)
dv.transform({
type: 'fold',
fields: ['近三个月报废数', '近半年使报废数'],
key: '装备类型',
value: '报废次数',
});
this.chartData = dv.rows
this.position = '装备类型*报废次数'
} else {
this.$message.error(res.msg)
}
})
}
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
/deep/.el-card .el-card__header{
background:#ffffff;
color:#000000;
font-size: 16px;
}
</style>
\ No newline at end of file
......@@ -97,11 +97,16 @@ export default {
if (res.code == "10000") {
this.pieList = res.data
//对请求返回的数据进行处理,若为宁波市局则返回的数组中第三个字段item的内容应为销毁数,否则不做处理
if(this.$store.state.user.user.baseJpOrganization.code == '330200000000'){
this.item=res.data.tjList[2].item='销毁数'
// console.log('---宁波市局----已做处理为:'+this.item)
}
this.dataSource = res.data.tjList
// if(this.$store.state.user.user.baseJpOrganization.code == '330200000000'){
// this.item=res.data.tjList[2].item='销毁数'
// // console.log('---宁波市局----已做处理为:'+this.item)
// }
//法1splice:截掉报废部分,取原来的数组
//this.newDataSource = res.data.tjList.splice(2,1);
// this.dataSource = this.pieList
// 法2slice:截取需要的部分,取当前的数组
this.newDataSource = res.data.tjList.slice(0,2);
this.dataSource = this.newDataSource
this.guideOpts.content = '装备总数'
this.guideOpts1.content = this.dataSource.map(item => item.count).reduce((total, num) => total + num)
}
......@@ -109,12 +114,14 @@ export default {
},
radioChange(value) {
if (value == '库存状态') {
this.dataSource = this.pieList.tjList
this.dataSource = this.pieList.tjList.slice(0,2);
this.guideOpts.content = '装备总数'
}
if (value == '装备库存') {
this.dataSource = this.pieList.typeList
this.guideOpts.content = '在库数量'
}
this.guideOpts.content = '装备总数'
//this.guideOpts.content = '装备总数'
this.guideOpts1.content = this.dataSource.map(item => item.count).reduce((total, num) => total + num)
},
itemTplLegend: function itemTpl(value, color, checked, index) {
......
<template>
<el-card style="height:360px">
<div slot="header" class="clearfix">
<span>{{ radio }}</span>
<el-radio-group v-model="radio" size="small" @change="radioChange" style="float: right;margin-top:-7px;margin-bottom:-10px;">
<el-radio-button label="库存状态"></el-radio-button>
<el-radio-button label="装备库存"></el-radio-button>
</el-radio-group>
</div>
<v-chart :forceFit="true" :height="height" :data="dataSource" >
<v-tooltip />
<v-axis />
<v-bar position="item*数量" />
</v-chart>
</el-card>
</template>
<script>
import { getGroupByCountOrg } from '@/api/view'
export default {
data() {
return {
orgId: this.$store.state.user.user.baseJpOrganization.id,
code: this.$store.state.user.user.baseJpOrganization.code,
radio: '库存状态',
dataSource: [],
pieList: [],
scale: [],
count:0,
height: 330,
}
},
mounted() {
this.getPieInfo()
},
methods: {
getPieInfo(orgId) {
this.orgId = orgId || this.$store.state.user.user.baseJpOrganization.id
getGroupByCountOrg({orgId:this.orgId}).then(res => {
if(res.code=='10000'){
//对请求返回的数据进行处理,若为宁波市局则返回的数组中第三个字段item的内容应为销毁数,否则不做处理
if(this.$store.state.user.user.baseJpOrganization.code == '330200000000'){
this.item=res.data.tjList[2].item='销毁数'
console.log('---宁波市局----已做处理为:'+this.count)
}
// // 数据处理,将请求返回值的'count'字段属性处理为'数量'
let newDataSource=res.data.tjList.map(obj=>{
return { item: obj.item, 数量: obj.count };
})
this.dataSource= newDataSource
}
})
},
radioChange(value) {
if (value == '库存状态') {
this.orgId = this.$store.state.user.user.baseJpOrganization.id
getGroupByCountOrg({orgId:this.orgId}).then(res => {
if(res.code=='10000'){
//对请求返回的数据进行处理,若为宁波市局则返回的数组中第三个字段item的内容应为销毁数,否则不做处理
if(this.$store.state.user.user.baseJpOrganization.code == '330200000000'){
this.item=res.data.tjList[2].item='销毁数'
// console.log('---宁波市局----已做处理为:'+this.item)
}
// 数据处理,将请求返回值的'count'字段属性处理为'数量'
let newDataSource=res.data.tjList.map(obj=>{
return { item: obj.item, 数量: obj.count };
})
this.dataSource= newDataSource
}
})
}
else if (value == '装备库存') {
this.orgId = this.$store.state.user.user.baseJpOrganization.id
getGroupByCountOrg({orgId:this.orgId}).then(res => {
if(res.code=='10000'){
// 数据处理,将请求返回值的'count'字段属性处理为'数量'
let newDataSource=res.data.typeList.map(obj=>{
return { item: obj.item, 数量: obj.count };
})
this.dataSource= newDataSource
}
})
}
},
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
/deep/.el-card .el-card__header{
background:#ffffff;
color:#000000;
font-size: 16px;
}
</style>
\ No newline at end of file
......@@ -10,7 +10,7 @@
<el-input v-model.trim="form.name" style="width: 370px;" placeholder="请输入姓名"/>
</el-form-item>
<el-form-item label="警员编号" prop="policeCode">
<el-input v-model="form.policeCode" style="width: 370px;" placeholder="请输入警员编号"/>
<el-input v-model="form.policeCode" style="width: 370px;" maxlength="9" show-word-limit placeholder="请输入警员编号,不能超过9位"/>
</el-form-item>
<el-form-item label="性别">
<el-radio v-model="form.sex" label="男" border></el-radio>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论