Commit c5baf05e by T

首页、报表bug修复

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