|
|
@@ -35,34 +35,39 @@ |
|
|
|
<el-tabs v-model="activeName" @tab-click="toggleTab"> |
|
|
|
<el-tab-pane label="数据列表" name="dataList"> |
|
|
|
<!-- 列表 --> |
|
|
|
<base-table |
|
|
|
:page="queryParams.pageNo" |
|
|
|
:limit="queryParams.pageSize" |
|
|
|
:table-props="tableProps" |
|
|
|
:table-data="tableData" |
|
|
|
:max-height="tableH" |
|
|
|
> |
|
|
|
<method-btn |
|
|
|
v-if="tableBtn.length" |
|
|
|
slot="handleBtn" |
|
|
|
:width="150" |
|
|
|
label="操作" |
|
|
|
:method-list="tableBtn" |
|
|
|
@clickBtn="viewDetDetail" |
|
|
|
<div v-if="activeName === 'dataList'"> |
|
|
|
<base-table |
|
|
|
:page="queryParams.pageNo" |
|
|
|
:limit="queryParams.pageSize" |
|
|
|
:table-props="tableProps" |
|
|
|
:table-data="tableData" |
|
|
|
:max-height="tableH" |
|
|
|
> |
|
|
|
<method-btn |
|
|
|
v-if="tableBtn.length" |
|
|
|
slot="handleBtn" |
|
|
|
:width="150" |
|
|
|
label="操作" |
|
|
|
:method-list="tableBtn" |
|
|
|
@clickBtn="viewDetDetail" |
|
|
|
/> |
|
|
|
</base-table> |
|
|
|
<pagination |
|
|
|
:page.sync="queryParams.pageNo" |
|
|
|
:limit.sync="queryParams.pageSize" |
|
|
|
:total="total" |
|
|
|
@pagination="getList" |
|
|
|
/> |
|
|
|
</base-table> |
|
|
|
<pagination |
|
|
|
:page.sync="queryParams.pageNo" |
|
|
|
:limit.sync="queryParams.pageSize" |
|
|
|
:total="total" |
|
|
|
@pagination="getList" |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</el-tab-pane> |
|
|
|
<el-tab-pane label="环形图" name="barChart"> |
|
|
|
<div |
|
|
|
id="logDetPieBar" |
|
|
|
style="width: 182px; height: 180px;" |
|
|
|
></div> |
|
|
|
<div v-if="activeName === 'barChart'"> |
|
|
|
<div |
|
|
|
id="logDetPieBar" |
|
|
|
style="width: 100%" |
|
|
|
:style="{ height: chartHeight + 'px' }" |
|
|
|
></div> |
|
|
|
</div> |
|
|
|
</el-tab-pane> |
|
|
|
</el-tabs> |
|
|
|
</div> |
|
|
@@ -110,6 +115,8 @@ |
|
|
|
<script> |
|
|
|
import { deliveryLogPage, deliveryLogDetPage } from '@/api/base/delivery' |
|
|
|
import { parseTime } from '@/utils/ruoyi' |
|
|
|
import * as echarts from 'echarts' |
|
|
|
import resize from '@/utils/chartMixins/resize' |
|
|
|
const tableProps = [ |
|
|
|
{ |
|
|
|
prop: 'deliveryTime', |
|
|
@@ -182,6 +189,7 @@ const tableProps2 = [ |
|
|
|
] |
|
|
|
export default { |
|
|
|
name: 'DeliveryLogDetDetail', |
|
|
|
mixins: [resize], |
|
|
|
data() { |
|
|
|
return { |
|
|
|
centervisible: false, |
|
|
@@ -195,6 +203,7 @@ export default { |
|
|
|
orderMsg: {}, |
|
|
|
tableProps, |
|
|
|
tableData: [], |
|
|
|
total: 0, |
|
|
|
tableH: this.tableHeight(350), |
|
|
|
tableBtn: [ |
|
|
|
this.$auth.hasPermi('base:group-team:update') |
|
|
@@ -215,9 +224,18 @@ export default { |
|
|
|
tableData2: [], |
|
|
|
tableH2: this.tableHeight(275), |
|
|
|
total2: 0, |
|
|
|
logCode: '' |
|
|
|
logCode: '', |
|
|
|
// 图 |
|
|
|
chartDom: '', |
|
|
|
chart: '', |
|
|
|
chartHeight: this.tableHeight(300) |
|
|
|
} |
|
|
|
}, |
|
|
|
// watch: { |
|
|
|
// chartData: function () { |
|
|
|
// this.getChart() |
|
|
|
// } |
|
|
|
// }, |
|
|
|
mounted() { |
|
|
|
window.addEventListener('resize', () => { |
|
|
|
this.tableH = this.tableHeight(350) |
|
|
@@ -225,6 +243,9 @@ export default { |
|
|
|
window.addEventListener('resize', () => { |
|
|
|
this.tableH2 = this.tableHeight(275) |
|
|
|
}) |
|
|
|
window.addEventListener('resize', () => { |
|
|
|
this.chartHeight = this.tableHeight(300) |
|
|
|
}) |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
init(params) { |
|
|
@@ -236,13 +257,87 @@ export default { |
|
|
|
getList() { |
|
|
|
deliveryLogPage({...this.queryParams}).then(res => { |
|
|
|
this.tableData = res.data.list || [] |
|
|
|
this.taotal = res.data.total || 0 |
|
|
|
}) |
|
|
|
}, |
|
|
|
toggleTab() { |
|
|
|
|
|
|
|
if (this.activeName === 'barChart') { |
|
|
|
this.$nextTick(() => { |
|
|
|
this.getBar() |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
getBar() { |
|
|
|
|
|
|
|
if ( |
|
|
|
this.chart !== null && |
|
|
|
this.chart !== '' && |
|
|
|
this.chart !== undefined |
|
|
|
) { |
|
|
|
this.chart.dispose() // 页面多次刷新会出现警告,Dom已经初始化了一个实例,这是销毁实例 |
|
|
|
} |
|
|
|
this.chartDom = document.getElementById('logDetPieBar') |
|
|
|
this.chart = echarts.init(this.chartDom) |
|
|
|
let seriesData = [] |
|
|
|
let sumData = 0 |
|
|
|
this.tableData && this.tableData.map(item =>{ |
|
|
|
let obj = {} |
|
|
|
obj.value = item.rate |
|
|
|
obj.name = item.name |
|
|
|
seriesData.push(obj) |
|
|
|
sumData+=item.rate |
|
|
|
}) |
|
|
|
if (sumData < 100) { |
|
|
|
let obj = {} |
|
|
|
obj.value = 100 - sumData |
|
|
|
obj.name = "未发货" |
|
|
|
seriesData.push(obj) |
|
|
|
} |
|
|
|
var option = { |
|
|
|
color: ['#B0EB42', '#FF9747', '#FF6860', '#7164FF', '#288AFF', '#63BDFF', '#73DE93', '#FFCE6A'], |
|
|
|
tooltip: { |
|
|
|
trigger: 'item', |
|
|
|
formatter: function(params) { |
|
|
|
let str = `<span style="display:inline-block;width:8px;height:8px;margin: 0 8px 0 -3px;border-radius:2px;background-color:${params.color};"></span>` |
|
|
|
return `<span> |
|
|
|
<span style="color:rgba(0,0,0,0.85);">${str}${params.name}</span> |
|
|
|
<span style="display:inline-block;margin-left:10px;color:rgba(0,0,0,0.45);">${params.percent}</span> |
|
|
|
</span>` |
|
|
|
} |
|
|
|
}, |
|
|
|
legend: { |
|
|
|
bottom: '5%', |
|
|
|
left: 'center', |
|
|
|
icon: 'rect', |
|
|
|
itemHeight: 8, |
|
|
|
itemWidth: 8 |
|
|
|
}, |
|
|
|
series: [ |
|
|
|
{ |
|
|
|
type: 'pie', |
|
|
|
radius: ['60%', '80%'], |
|
|
|
avoidLabelOverlap: false, |
|
|
|
label: { |
|
|
|
show: false, |
|
|
|
position: 'center' |
|
|
|
}, |
|
|
|
emphasis: { |
|
|
|
label: { |
|
|
|
show: true, |
|
|
|
fontSize: 40, |
|
|
|
fontWeight: 'bold' |
|
|
|
}, |
|
|
|
scale: true , |
|
|
|
scaleSize: 20 , |
|
|
|
}, |
|
|
|
labelLine: { |
|
|
|
show: false |
|
|
|
}, |
|
|
|
data: seriesData |
|
|
|
} |
|
|
|
] |
|
|
|
}; |
|
|
|
|
|
|
|
option && this.chart.setOption(option); |
|
|
|
}, |
|
|
|
viewDetDetail(val) { |
|
|
|
this.logCode = val.data.code |
|
|
|