feat: 新增带默认BOM的产品和原材料接口并优化界面
refactor(HomeModules): 重构统计面板组件并添加骨架屏 feat(coil): 添加物料类型和更新时间查询条件 style(ProductInfo/RawMaterialInfo): 阻止事件冒泡 chore: 添加钢卷图标资源
This commit is contained in:
0
klp-ui/src/components/HomeModules/DetailTable.vue
Normal file
0
klp-ui/src/components/HomeModules/DetailTable.vue
Normal file
291
klp-ui/src/components/HomeModules/StatisticGroup.vue
Normal file
291
klp-ui/src/components/HomeModules/StatisticGroup.vue
Normal file
@@ -0,0 +1,291 @@
|
||||
<template>
|
||||
<el-row :gutter="10" class="panel-group">
|
||||
<el-col
|
||||
v-if="!loading"
|
||||
:xs="12"
|
||||
:sm="12"
|
||||
:md="8"
|
||||
:lg="4"
|
||||
:xl="4"
|
||||
class="card-panel-col"
|
||||
v-for="(item, index) in statsData"
|
||||
:key="index"
|
||||
>
|
||||
<div class="card-panel" @click="handleSetLineChartData(item.type)">
|
||||
<div class="card-panel-icon-wrapper" :class="item.iconClass">
|
||||
<svg-icon :icon-class="item.icon" class-name="card-panel-icon" />
|
||||
</div>
|
||||
<div class="card-panel-description">
|
||||
<div class="card-panel-text">
|
||||
{{ item.title }}
|
||||
</div>
|
||||
<count-to
|
||||
:start-val="0"
|
||||
:end-val="item.value"
|
||||
:duration="item.duration"
|
||||
class="card-panel-num"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
|
||||
<div v-else>
|
||||
<!-- 骨架屏 -->
|
||||
<el-skeleton
|
||||
:rows="1"
|
||||
:loading="loading"
|
||||
/>
|
||||
</div>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CountTo from 'vue-count-to'
|
||||
import { listProduct } from '@/api/wms/product'
|
||||
import { listRawMaterial } from '@/api/wms/rawMaterial'
|
||||
import { listMaterialCoil } from '@/api/wms/coil'
|
||||
import { listEquipmentManagement } from '@/api/mes/eqp/equipmentManagement'
|
||||
import { listOrder } from '@/api/wms/order'
|
||||
import { listCustomer } from '@/api/wms/customer'
|
||||
import { listSupplier } from '@/api/wms/supplier'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
CountTo
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
statsData: [
|
||||
{
|
||||
type: 'materialCount',
|
||||
title: '物料类型',
|
||||
icon: 'international',
|
||||
iconClass: 'icon-material',
|
||||
value: 0,
|
||||
duration: 2600
|
||||
},
|
||||
{
|
||||
type: 'steelCoilCount',
|
||||
title: '钢卷数量',
|
||||
icon: 'coil',
|
||||
iconClass: 'icon-steel',
|
||||
value: 0,
|
||||
duration: 3000
|
||||
},
|
||||
{
|
||||
type: 'orderCount',
|
||||
title: '订单数量',
|
||||
icon: 'log',
|
||||
iconClass: 'icon-order',
|
||||
value: 0,
|
||||
duration: 3200
|
||||
},
|
||||
{
|
||||
type: 'customerSupplierCount',
|
||||
title: '客户和供应商',
|
||||
icon: 'people',
|
||||
iconClass: 'icon-customer',
|
||||
value: 0,
|
||||
duration: 3600
|
||||
},
|
||||
{
|
||||
type: 'equipmentCount',
|
||||
title: '设备数量',
|
||||
icon: 'redis',
|
||||
iconClass: 'icon-equipment',
|
||||
value: 0,
|
||||
duration: 2800
|
||||
}
|
||||
],
|
||||
loading: false,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.loadCount()
|
||||
},
|
||||
methods: {
|
||||
handleSetLineChartData(type) {
|
||||
this.$emit('handleSetLineChartData', type)
|
||||
},
|
||||
loadCount() {
|
||||
this.loading = true
|
||||
Promise.all([
|
||||
listProduct({ pageSise: 1, pageNum: 1 }),
|
||||
listRawMaterial({ pageSise: 1, pageNum: 1 }),
|
||||
listMaterialCoil({ pageSise: 1, pageNum: 1 }),
|
||||
listEquipmentManagement({ pageSise: 1, pageNum: 1 }),
|
||||
listOrder({ pageSise: 1, pageNum: 1 }),
|
||||
listCustomer({ pageSise: 1, pageNum: 1 }),
|
||||
listSupplier({ pageSise: 1, pageNum: 1 })
|
||||
]).then(([
|
||||
productRes,
|
||||
rawMaterialRes,
|
||||
materialCoilRes,
|
||||
equipmentRes,
|
||||
orderRes,
|
||||
customerRes,
|
||||
supplierRes
|
||||
]) => {
|
||||
this.loading = false
|
||||
this.statsData.forEach(item => {
|
||||
if (item.type === 'materialCount') {
|
||||
item.value = productRes.total + rawMaterialRes.total
|
||||
} else if (item.type === 'steelCoilCount') {
|
||||
item.value = materialCoilRes.total
|
||||
} else if (item.type === 'orderCount') {
|
||||
item.value = orderRes.total
|
||||
} else if (item.type === 'customerSupplierCount') {
|
||||
item.value = customerRes.total + supplierRes.total
|
||||
} else if (item.type === 'equipmentCount') {
|
||||
item.value = equipmentRes.total
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.panel-group {
|
||||
margin-top: 18px;
|
||||
|
||||
.card-panel-col {
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
.card-panel {
|
||||
height: 108px;
|
||||
cursor: pointer;
|
||||
font-size: 12px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
color: #666;
|
||||
background: #fff;
|
||||
box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
|
||||
border-color: rgba(0, 0, 0, .05);
|
||||
|
||||
&:hover {
|
||||
.card-panel-icon-wrapper {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.icon-material {
|
||||
background: #40c9c6;
|
||||
}
|
||||
|
||||
.icon-steel {
|
||||
background: #36a3f7;
|
||||
}
|
||||
|
||||
.icon-order {
|
||||
background: #f4516c;
|
||||
}
|
||||
|
||||
.icon-customer {
|
||||
background: #34bfa3;
|
||||
}
|
||||
|
||||
.icon-equipment {
|
||||
background: #722ed1;
|
||||
}
|
||||
}
|
||||
|
||||
.icon-material {
|
||||
color: #40c9c6;
|
||||
}
|
||||
|
||||
.icon-steel {
|
||||
color: #36a3f7;
|
||||
}
|
||||
|
||||
.icon-order {
|
||||
color: #f4516c;
|
||||
}
|
||||
|
||||
.icon-customer {
|
||||
color: #34bfa3;
|
||||
}
|
||||
|
||||
.icon-equipment {
|
||||
color: #722ed1;
|
||||
}
|
||||
|
||||
.card-panel-icon-wrapper {
|
||||
float: left;
|
||||
margin: 14px 0 0 14px;
|
||||
padding: 16px;
|
||||
transition: all 0.38s ease-out;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.card-panel-icon {
|
||||
float: left;
|
||||
font-size: 48px;
|
||||
}
|
||||
|
||||
.card-panel-description {
|
||||
float: right;
|
||||
font-weight: bold;
|
||||
margin: 26px;
|
||||
margin-left: 0px;
|
||||
|
||||
.card-panel-text {
|
||||
line-height: 18px;
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
font-size: 16px;
|
||||
margin-bottom: 12px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.card-panel-num {
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 992px) {
|
||||
.card-panel-description .card-panel-text {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.card-panel-num {
|
||||
font-size: 18px !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.card-panel-description {
|
||||
margin: 16px;
|
||||
}
|
||||
|
||||
.card-panel-icon-wrapper {
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.card-panel-icon {
|
||||
font-size: 40px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 550px) {
|
||||
.card-panel-description {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.card-panel-icon-wrapper {
|
||||
float: none !important;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0 !important;
|
||||
|
||||
.svg-icon {
|
||||
display: block;
|
||||
margin: 14px auto !important;
|
||||
float: none !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user