Commit 3238334f by ningjihai

echart 单位

parent 9a596b05
...@@ -28,6 +28,10 @@ export default { ...@@ -28,6 +28,10 @@ export default {
chartList: { chartList: {
type: Array, type: Array,
default: () => [] default: () => []
},
unit: {
type: String,
default: ''
} }
}, },
data() { data() {
...@@ -78,7 +82,7 @@ export default { ...@@ -78,7 +82,7 @@ export default {
this.chart.setOption({ this.chart.setOption({
tooltip: { tooltip: {
trigger: 'item', trigger: 'item',
formatter: "{b}: {c}" formatter: "{b}: {c}" + this.unit
}, },
legend: { legend: {
orient: 'horizontal', orient: 'horizontal',
...@@ -166,7 +170,7 @@ export default { ...@@ -166,7 +170,7 @@ export default {
], ],
label: { label: {
normal: { normal: {
formatter: '{b}:{c}' formatter: '{b}:{c}' + this.unit
}, },
}, },
......
...@@ -32,6 +32,10 @@ export default { ...@@ -32,6 +32,10 @@ export default {
chartList: { chartList: {
type: Array, type: Array,
default: () => [] default: () => []
},
unit: {
type: String,
default: ''
} }
}, },
data() { data() {
...@@ -108,9 +112,13 @@ export default { ...@@ -108,9 +112,13 @@ export default {
}, },
type: 'value', type: 'value',
show: true, show: true,
minInterval: 1,
axisTick: { axisTick: {
show: true show: true
}, },
axisLabel: {
formatter: '{value} '+ this.unit
}
}], }],
yAxis: [{ yAxis: [{
splitLine: { splitLine: {
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</el-radio-group> </el-radio-group>
</div> </div>
<div class="flex1"> <div class="flex1">
<kucunchart :chartList="kucunList"/> <kucunchart :chartList="kucunList" :unit="kucunUnit"/>
</div> </div>
</div> </div>
</div> </div>
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
</el-radio-group> </el-radio-group>
</div> </div>
<div class="flex1"> <div class="flex1">
<rukuRankChart :chartList="rukuList"/> <rukuRankChart :chartList="rukuList" :unit="rukuUnit"/>
</div> </div>
</div> </div>
<div class="card-container-flex chart-container shadow flex1 two"> <div class="card-container-flex chart-container shadow flex1 two">
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
</el-radio-group> </el-radio-group>
</div> </div>
<div class="flex1"> <div class="flex1">
<rukuRankChart barColor="rgba(255, 125, 0, 1)" :chartList="cukuList"/> <rukuRankChart barColor="rgba(255, 125, 0, 1)" :chartList="cukuList" :unit="cukuUnit"/>
</div> </div>
</div> </div>
</div> </div>
...@@ -142,7 +142,10 @@ export default { ...@@ -142,7 +142,10 @@ export default {
cukuRankType: 'count', cukuRankType: 'count',
kucunList:[], kucunList:[],
cukuList:[], cukuList:[],
rukuList:[] rukuList:[],
rukuUnit:'件',
cukuUnit:'件',
kucunUnit:'件'
} }
}, },
mounted() { mounted() {
...@@ -187,6 +190,7 @@ export default { ...@@ -187,6 +190,7 @@ export default {
value:item.totalQuantity, value:item.totalQuantity,
name:item.materialName name:item.materialName
})).reverse().splice(0,5).reverse() })).reverse().splice(0,5).reverse()
this.rukuUnit = '件'
}) })
} }
if(this.rukuRankType === 'money'){ if(this.rukuRankType === 'money'){
...@@ -197,7 +201,9 @@ export default { ...@@ -197,7 +201,9 @@ export default {
value:item.totalMoney, value:item.totalMoney,
name:item.materialName name:item.materialName
})).reverse().splice(0,5).reverse() })).reverse().splice(0,5).reverse()
this.rukuUnit = '元'
}) })
} }
}, },
queryKucun(){ queryKucun(){
...@@ -205,9 +211,8 @@ export default { ...@@ -205,9 +211,8 @@ export default {
inventoryTopTenByQuantity().then(res=>{ inventoryTopTenByQuantity().then(res=>{
let data = res.rows let data = res.rows
if(!data) return if(!data) return
console.log('123123',data)
this.kucunList = data.splice(0,5) this.kucunList = data.splice(0,5)
this.kucunUnit = '件'
}) })
} }
if(this.kucunQueryType === 'money'){ if(this.kucunQueryType === 'money'){
...@@ -215,6 +220,7 @@ export default { ...@@ -215,6 +220,7 @@ export default {
let data = res.rows let data = res.rows
if(!data) return if(!data) return
this.kucunList = data.splice(0,5) this.kucunList = data.splice(0,5)
this.kucunUnit = '元'
}) })
} }
}, },
...@@ -235,6 +241,7 @@ export default { ...@@ -235,6 +241,7 @@ export default {
let data = res.rows let data = res.rows
if(!data) return if(!data) return
this.cukuList = data.splice(0,5).reverse() this.cukuList = data.splice(0,5).reverse()
this.cukuUnit = '件'
}) })
} }
if(this.cukuRankType === 'money'){ if(this.cukuRankType === 'money'){
...@@ -242,6 +249,7 @@ export default { ...@@ -242,6 +249,7 @@ export default {
let data = res.rows let data = res.rows
if(!data) return if(!data) return
this.cukuList = data.splice(0,5).reverse() this.cukuList = data.splice(0,5).reverse()
this.cukuUnit = '元'
}) })
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论