Commit c5baf05e by T

首页、报表bug修复

parent 1a0c4946
......@@ -8,9 +8,15 @@
<el-radio-button label="报废数"></el-radio-button>
</el-radio-group>
</div>
<v-chart :forceFit="true" :height="300" :data="chartData" style="margin-left: -20px">
<!-- <v-chart :forceFit="true" :height="height" :data="chartData" :scale="scale">
<v-tooltip />
<v-axis />
<v-bar position="year*sales" />
</v-chart> -->
<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-bar :position="position" color="parentName" :adjust="adjust" />
</v-chart>
......@@ -24,6 +30,16 @@ 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: '使用次数',
......@@ -33,6 +49,8 @@ export default {
marginRatio: 1 / 32,
}],
chartData: [],
line,
label,
position: '装备类型*使用量'
}
},
......@@ -64,7 +82,7 @@ export default {
key: '装备类型',
value: '使用量',
});
this.chartData = dv
this.chartData = dv.rows
this.position = '装备类型*使用量'
} else {
this.$message.error(res.msg)
......@@ -83,7 +101,7 @@ export default {
key: '装备类型',
value: '使用量',
});
this.chartData = dv
this.chartData = dv.rows
this.position = '装备类型*使用量'
} else {
this.$message.error(res.msg)
......@@ -98,15 +116,16 @@ export default {
type: 'fold',
fields: ['近三个月维修次数', '近半年维修次数'],
key: '装备类型',
value: '维修数',
value: '维修数',
});
this.chartData = dv
this.position = '装备类型*维修数'
this.chartData = dv.rows
this.position = '装备类型*维修数'
} else {
this.$message.error(res.msg)
}
})
} else if (value == '报废数') {
}
else if (value == '报废数') {
getBfPOrg({orgId: this.orgId}).then(res => {
if (res.code == "10000") {
this.dataSource = res.data
......@@ -115,10 +134,10 @@ export default {
type: 'fold',
fields: ['近三个月报废数', '近半年使报废数'],
key: '装备类型',
value: '报废数',
value: '报废数',
});
this.chartData = dv
this.position = '装备类型*报废数'
this.chartData = dv.rows
this.position = '装备类型*报废数'
} else {
this.$message.error(res.msg)
}
......
......@@ -23,10 +23,12 @@
<script>
import { getGroupByCountOrg } from '@/api/view'
import DataSet from '@antv/data-set'
import { clone } from 'lodash'
export default {
data() {
return {
orgId: this.$store.state.user.user.baseJpOrganization.id,
code: this.$store.state.user.user.baseJpOrganization.code,
radio: '库存状态',
dataSource: [],
pieList: [],
......@@ -64,9 +66,10 @@ export default {
stroke: '#fff',
lineWidth: 2
},
//左边统计图参数渲染
labelConfig: ['percent', {
formatter: (val, item) => {
return item.point.item + ': ' + item.point.count + ' '
return item.point.item + ': ' + item.point.count + ' '
}
}],
}
......@@ -93,7 +96,12 @@ export default {
getGroupByCountOrg({orgId:this.orgId}).then(res => {
if (res.code == "10000") {
this.pieList = res.data
this.dataSource = res.data.tjList
//对请求返回的数据进行处理,若为宁波市局则返回的数组中第三个字段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
this.guideOpts.content = '装备总数'
this.guideOpts1.content = this.dataSource.map(item => item.count).reduce((total, num) => total + num)
}
......@@ -111,8 +119,8 @@ export default {
},
itemTplLegend: function itemTpl(value, color, checked, index) {
const obj = this.chartData[index];
var percent = '0%';
var objCount = 0;
var percent = '0%';
var objCount = 0;
if(obj){
percent=(obj.percent * 100).toFixed(2) +'%';
objCount=obj.count;
......
......@@ -13,7 +13,7 @@
placeholder="请选择仓库"
style="width: 250px;margin-left: 0px"
class="filter-item"
@change="changeWarehouse">
@change="toPostQuery">
<el-option
v-for="item in warehouseList"
:key="item.name"
......@@ -21,34 +21,34 @@
:value="item.id">
</el-option>
</el-select>
<!-- <el-select v-model="equName"
class="filter-item"
clearable
:filterable="true"
:filter-method="dataFilter"
placeholder="请选择装备"
@change="changeWarehouse"
style="width: 300px;" >
<el-option
v-for="item in equNameList"
:key="item.equName"
:label="item.equName"
:value="item.equName">
</el-option>
</el-select>
<el-select v-model="sizeId"
class="filter-item"
clearable filterable
placeholder="请选择装备型号名称"
@change="toPostQuery"
style="width: 300px;">
<el-option
<el-select v-model="equipmentId"
class="filter-item"
clearable
:filterable="true"
:filter-method="dataFilter"
placeholder="请选择装备"
@change="getListEquipmentSize"
style="width: 300px;" >
<el-option
v-for="item in equipmentList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
<el-select v-model="equipmentSizeId"
class="filter-item"
clearable filterable
placeholder="请选择装备型号名称"
@change="toPostQuery"
style="width: 300px;">
<el-option
v-for="item in equipmentSizeList"
:key="item.id"
:label="item.sizeName"
:value="item.id">
</el-option>
</el-select> -->
</el-option>
</el-select>
</div>
......@@ -124,6 +124,8 @@ import { quickAddFixed } from '@/api/fixReceiveApply'
import { initPdata } from '@/api/data'
import { transform } from '@/utils/index'
import { getListOrgWarehouse } from '@/api/warehouse'
import { getListEquipmentDetail } from '@/api/equipmentDetail'
import { getListEquipmentSize } from '@/api/equipmentSize'
export default {
mixins: [initData],
props: {
......@@ -148,11 +150,13 @@ export default {
equipmentCode: '',
equipmentSizecode: '',
equNameList: [],
equipmentList:[],
equipmentSizeList: [],
equId: null,
equipmentId: null,
equName:'',
equipmentSizeList: [],
sizeId: null,
equipmentSizeId: null,
form: {
id: '',
action: 1,
......@@ -169,8 +173,7 @@ export default {
components: { equInfoDetail },
created() {
this.getListOrgWarehouse()
// this.getEquipmentList()
// this.getListEquipmentSize()
this.getEquipmentList()
this.initOrgList()
this.$nextTick(() => {
this.initPost()
......@@ -189,47 +192,38 @@ export default {
if (isFastAdd && this.warehouseList.length > 0) {
this.warehouseId = this.warehouseList[0].id
this.equName = this.equName
console.log(this.equName)
this.changeWarehouse()
this.toPostQuery()
}
})
},
// //获取装备
// getEquipmentList() {
// this.warehouseId = this.warehouseList[0].id
// this.equipmentList = []
// this.equId = null
// this.changeWarehouse()
// },
// //选择装备,根据装备获取装备型号名称
// getListEquipmentSize() {
// this.equipmentSizeList = []
// this.sizeId = null
// this.changeWarehouse()
// },
changeWarehouse() {
//获取装备
getEquipmentList() {
getListEquipmentDetail({}).then(res => {
this.equipmentList = res.data
//保留数据源
this.copy = Object.assign(this.equipmentList)
})
},
//选择装备,根据装备获取装备型号名称
getListEquipmentSize(data) {
this.equipmentSizeList = []
this.equipmentSizeId = null
getListEquipmentSize({detailId : this.equipmentId}).then(res => {
this.equipmentSizeList = res.data
this.toPostQuery()
this.url = window._CONFIG['serviceURL'] + '/api/Notice/GetTreeScrapMsg'
this.params = { page: this.page, size: this.size, orgId : this.orgId || this.$store.state.user.user.baseJpOrganization.id }
const warehouseId = this.warehouseId
const equId = this.equId
const equName = this.equName
const sizeId = this.sizeId
const days = this.days
const scrap = this.scrap
if (warehouseId) { this.params['warehouseId'] = warehouseId }
if (equId) { this.params['equId'] = equId }
if (equName) { this.params['equName'] = equName }
if (sizeId) { this.params['sizeId'] = sizeId }
if (days) { this.params['days'] = days }
if (scrap != null && scrap != undefined) { this.params['scrap'] = scrap }
return true
})
},
beforeInit() {
this.url = window._CONFIG['serviceURL'] + '/api/Notice/GetTreeScrapMsg'
this.params = { page: this.page, size: this.size, orgId : this.orgId || this.$store.state.user.user.baseJpOrganization.id }
const warehouseId = this.warehouseId
const equId = this.equipmentId
const sizeId = this.equipmentSizeId
const days = this.days
const scrap = this.scrap
if (warehouseId) { this.params['warehouseId'] = warehouseId }
if (equId) { this.params['equId'] = equId }
if (sizeId) { this.params['sizeId'] = sizeId }
if (days) { this.params['days'] = days }
if (scrap != null && scrap != undefined) { this.params['scrap'] = scrap }
return true
......@@ -288,17 +282,10 @@ export default {
table.toggleRowExpansion(row)
},
getListEquipmentSize() {
if (this.equipmentCode) {
getListEquipmentSize({detailId : this.equipmentCode}).then(res => {
this.equipmentSizeList = res.data
})
}
},
dataFilter(v) {
//对绑定数据赋值
this.equipmentList = this.copy.filter((item) => {
console.log(item)
//console.log(item)
//如果直接包含输入值直接返回true
if (item.name.indexOf(v) !== -1) return true;
//将label拆散成小写拼音数组
......@@ -349,7 +336,7 @@ export default {
},
handleSelectionChange(val) {
this.detailList = val
// console.log(val)
console.log(val)
},
// selectionChange(val){
// this.detailList = val
......@@ -358,6 +345,7 @@ export default {
quickScrap(row){
// console.log(row)
this.form.warehouseId = this.warehouseId
console.log(this.form.warehouseId)
this.form.flowType = 'scrap'
this.form.detailList = []
this.detailList.forEach(element => {
......
......@@ -62,7 +62,7 @@
</div>
<!--表格渲染-->
<el-table ref="table" v-loading="loading" row-key="rowNumber" :data="data"
<el-table ref="table" v-loading="loading" show-summary :summary-method="getSummaries" row-key="rowNumber" :data="data"
:expand-row-keys="expandRowKeys" style="width: 100%;" stripe border max-height="620" :header-cell-style="{'text-align':'center'}">
<el-table-column prop="rowNumber" label="编号" align="left" width="200"/>
<el-table-column prop="name" label="品种名称" align="center"/>
......@@ -248,6 +248,32 @@ export default {
return lengths.indexOf(spell.indexOf(v)) !== -1;
})
},
getSummaries(param) {
const { columns, data } = param;
const sums = [];
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '本页合计';
return;
}
const values = data.map(item => Number(item[column.property]));
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index] += '';
} else {
sums[index] = '';
}
});
return sums;
},
download() {
this.downloadLoading = true
var params = { orgId: this.orgId || this.$store.state.user.user.baseJpOrganization.id, page: 0, size: 999 }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论