This commit is contained in:
shijing 2022-03-03 14:39:18 +08:00
parent 750e751513
commit 8272368813
2 changed files with 174 additions and 127 deletions

View File

@ -330,7 +330,7 @@ export const asyncRoutes = [
path: 'sales',
name: 'sales',
component: () => import('@/views/sam/sales'),
meta: { title: '销售信息', icon: 'saleInfo', perms: ['sam_sales'] }
meta: { title: '销售发货', icon: 'saleInfo', perms: ['sam_sales'] }
}
,
{

View File

@ -2,7 +2,8 @@
<div class="dashboard-container">
<div class="dashboardTopCard">
<div class="CardTitleWrap">
<span class="verticalLine"></span><span class="dashboardCardTitle">数据统计</span>
<span class="verticalLine"></span>
<span class="dashboardCardTitle">数据统计</span>
</div>
<div style="padding: 20px;overflow: hidden;">
<div class="cardsWrap" @click="toDetail('1')">
@ -38,7 +39,6 @@
<div class="cardsWrap" @click="toDetail('3')">
<div class="svgIconWrap">
<el-icon class="el-icon-s-operation svgIcon"></el-icon>
<!--<svg-icon class="svgIcon" icon-class="productionTask" :className="'svgIcon'"/>-->
</div>
<div class="totalCountWrap">
<span class="totalCountText">本月在制任务</span>
@ -51,7 +51,6 @@
<div class="cardsWrap" @click="toDetail('4')">
<div class="svgIconWrap">
<el-icon class="el-icon-s-claim svgIcon"></el-icon>
<!--<svg-icon icon-class="product" class="svgIcon" :className="'svgIcon'"/>-->
</div>
<div class="totalCountWrap">
<span class="totalCountText">本月交付产品</span>
@ -64,7 +63,6 @@
<div class="cardsWrap" @click="toDetail('5')">
<div class="svgIconWrap">
<el-icon class="el-icon-error svgIcon"></el-icon>
<!--<svg-icon icon-class="unqualified" class="svgIcon" :className="'svgIcon'"/>-->
</div>
<div class="totalCountWrap">
<span class="totalCountText">本月不合格产品</span>
@ -91,7 +89,7 @@
></gantt>
</div>
</div>
<div style="width: 34%;position:relative;float: right" >
<div style="width: 34%;position:relative;float: right">
<div class="CardTitleWrap">
<span class="verticalLine"></span><span class="dashboardCardTitle">成品率</span>
</div>
@ -137,10 +135,11 @@
</div>
<div class="dashboardCardPadding">
<el-table
small
v-loading="listLoadingEm"
small
:data="equipmentList"
fit stripe
fit
stripe
size="mini"
:height="cardTabelHeight"
pager-count="3"
@ -179,14 +178,6 @@
</div>
</template>
</el-table-column>
<!-- <el-table-column label="下次校准日期" prop="model">
<template slot-scope="scope">
<el-tag v-if="scope.row.next_check_date" :type="setClass(scope.row.next_check_date)">
{{scope.row.next_check_date}}
</el-tag>
<div v-else></div>
</template>
</el-table-column>-->
</el-table>
</div>
</div>
@ -221,7 +212,8 @@
<el-table
v-loading="listLoadingUser"
:data="userList"
fit stripe
fit
stripe
size="mini"
:height="cardTabelHeight"
style="border-top: 1px solid #f5f5f5;"
@ -284,8 +276,8 @@
</ul>
</el-tab-pane>
<el-tab-pane label="临近交货" name="临近交货">
<ul :style="{height:cardTabelHeight-47+'px'}" class="lists" :class="{anim:animate}" @mouseenter="Stop()"
@mouseleave="Up()">
<ul :style="{height:cardTabelHeight-47+'px'}" class="lists" :class="{anim:animate}" @mouseenter="Stop()"
@mouseleave="Up()">
<li class="listItem" v-for="(item,$index) in warningList" :key="$index">
<div class="itemText">
<span>{{item.name}}({{item.number}})</span><span>{{item.delivery_date}}为交货日期</span>
@ -294,18 +286,18 @@
</ul>
</el-tab-pane>
<el-tab-pane label="过期提醒" name="过期提醒">
<ul :style="{height:cardTabelHeight-47+'px'}" class="lists" :class="{anim:animate}" @mouseenter="Stop()"
@mouseleave="Up()">
<ul :style="{height:cardTabelHeight-47+'px'}" class="lists" :class="{anim:animate}" @mouseenter="Stop()"
@mouseleave="Up()">
<li class="listItem" v-for="(item,$index) in warningList" :key="$index">
<div class="itemText">
<span>{{item.name}}({{item.number}})</span><span>{{item.delivery_date}}到期</span>
<span>{{item.name}}({{item.unit}})</span><span>{{item.expiration_date}}到期</span>
</div>
</li>
</ul>
</el-tab-pane>
<el-tab-pane label="设备检测" name="设备检测">
<ul :style="{height:cardTabelHeight-47+'px'}" class="lists" :class="{anim:animate}" @mouseenter="Stop()"
@mouseleave="Up()">
<ul :style="{height:cardTabelHeight-47+'px'}" class="lists" :class="{anim:animate}" @mouseenter="Stop()"
@mouseleave="Up()">
<li class="listItem" v-for="(item,$index) in warningList" :key="$index"
:class="{nearStatus:item.warningType===1,outStatus:item.warningType===2}">
<div class="itemText">
@ -317,12 +309,12 @@
</ul>
</el-tab-pane>
<el-tab-pane label="任务到期" name="任务到期">
<ul :style="{height:cardTabelHeight-47+'px'}" class="lists" :class="{anim:animate}" @mouseenter="Stop()"
@mouseleave="Up()">
<ul :style="{height:cardTabelHeight-47+'px'}" class="lists" :class="{anim:animate}" @mouseenter="Stop()"
@mouseleave="Up()">
<li class="listItem" v-for="(item,$index) in warningList" :key="$index"
:class="{nearStatus:item.warningType===1,outStatus:item.warningType===2}">
<div class="itemText">
<span>{{item.name}}({{item.number}})</span>
<span>{{item.name}}{{item.number}}</span>
<span v-if="item.warningType===1">接近计划日期</span>
<span v-else>已过计划日期</span>
</div>
@ -339,16 +331,15 @@
<script>
import echarts from 'echarts'
import {mapGetters} from 'vuex';
// import {getUserList} from "@/api/user";
import {getEmployee} from "@/api/hrm";
import {getMaterialList} from "@/api/mtm";
import {getProductionplanList} from "@/api/pm";
import {getmaterialbatchList} from "@/api/inm";
import gantt from "@/components/Gantt/dashGantt";
import {getpEquipmentList} from "@/api/equipment";
import {getProcessYield ,getPlanGantt} from "@/api/srm";
import {getContractList , getOrderList} from "@/api/sam";
import { getToken } from '@/utils/auth' // get token from cookie
import {getProcessYield, getPlanGantt} from "@/api/srm";
import {getContractList, getOrderList} from "@/api/sam";
import {getToken} from '@/utils/auth' // get token from cookie
export default {
components: {gantt},
name: 'Dashboard',
@ -360,6 +351,7 @@
animateUser: false,
chartColumn: null,
week: null,
nowHour: null,//当前时间的小时数
currentTime: null,
currentYear: null,
currentMonth: null,
@ -434,7 +426,7 @@
},
watch: {
'$route.path': function (newVal) {
if(newVal==='/dashboard') {
if (newVal === '/dashboard') {
this.getUserList();//用户列表
this.getEquipmentList();//设备列表
this.getGanttData();//甘特图数据
@ -444,28 +436,30 @@
}
},
methods: {
setClass:function(check_date) {
setClass: function (check_date) {
let obj = {};
if(check_date!=null){
if (check_date != null) {
let dat = new Date();
let time = dat.getTime();
let check = new Date(check_date).getTime();
let timeDiffer = (check-time)/1000/60/60/24;
if (4>timeDiffer&&timeDiffer>0) {
let timeDiffer = (check - time) / 1000 / 60 / 60 / 24;
if (4 > timeDiffer && timeDiffer > 0) {
obj = 'warning';
}else if (timeDiffer<0) {
} else if (timeDiffer < 0) {
obj = "danger";
}
}
return obj;
},
getNoticeData() {
this.ScrollUp();
},
ScrollUp() {
let that = this;
that.intNum = setInterval(() => {
if(that.warningList.length>3){
if (that.warningList.length > 3) {
that.animate = true;
setTimeout(() => {
that.warningList.push(that.warningList[0]);
@ -475,13 +469,16 @@
}
}, 3000);
},
//鼠标移上去停止
Stop() {
clearInterval(this.intNum);
},
Up() {
this.ScrollUp();
},
getStatisticsData() {
let that = this;
let dat = new Date();
@ -551,13 +548,14 @@
}
});
//获取库存警告
getMaterialList({page: 1, page_size:that.warningPageSize,tag: 'low_inm'}).then((response) => {
getMaterialList({page: 1, page_size: that.warningPageSize, tag: 'low_inm'}).then((response) => {
if (response.data) {
that.warningList = response.data.results;
that.warningTotal = response.data.count;
}
});
},
//设备列表
getEquipmentList() {
let that = this;
@ -571,6 +569,7 @@
that.listLoadingEm = false;
});
},
//设备分页跳转
handleEquipmentCurrentChange(val) {
let that = this;
@ -584,11 +583,12 @@
that.listLoadingEm = false;
});
},
//用户列表
getUserList() {
let that = this;
that.listLoadingUser = true;
that.userPage =1;
that.userPage = 1;
getEmployee({page: that.userPage, page_size: that.userPageSize}).then((response) => {
if (response.data) {
that.userList = response.data.results;
@ -598,12 +598,17 @@
that.listLoadingUser = false;
});
},
//用户分页跳转
handleUserCurrentChange(val) {
let that = this;
that.listLoadingUser = true;
that.userPage = val;
getEmployee({page: val, page_size: that.userPageSize, fields: 'id,name,dept_name,is_atwork'}).then((response) => {
getEmployee({
page: val,
page_size: that.userPageSize,
fields: 'id,name,dept_name,is_atwork'
}).then((response) => {
if (response.data) {
that.userList = response.data.results;
that.userTotal = response.data.count;
@ -612,6 +617,7 @@
that.listLoadingUser = false;
});
},
userScroll() {
let that = this;
that.intNumUser = setInterval(() => {
@ -623,13 +629,16 @@
}, 3000)
}, 3000);
},
//鼠标移上去停止
stopScroll() {
clearInterval(this.intNumUser);
},
toScroll() {
this.userScroll();
},
//去往工作流页面
gotoTicketPage() {
let path = this.$route.path;
@ -639,6 +648,7 @@
this.$router.push({name: 'ticket', params: {}})
}
},
//图标渲染
drawChart() {
let that = this;
@ -720,34 +730,6 @@
offset: 1,
color: '#409EFF'
}]),
/*color: function(params) {
let colorList = [
['#5fcdc2','#ffffff'],
['#FFA783','#ffffff'],
['#D099FF','#ffffff'],
['#83FFC0','#ffffff'],
['#FF83D8','#ffffff'],
['#FFE899','#ffffff'],
['#83FFE9','#ffffff'],
];
let colorItem = colorList[params.dataIndex];
return new echarts.graphic.LinearGradient(0,1,0,0,[
{
color: colorItem[0]
},
{
color: colorItem[1]
}
]);
},*/
/*color: function(params) {
let colorList = [
'#5fcdc2','#a378e4','#fea94c','#f27197',
'#409eff','#5fcdc2','#a378e4','#fea94c'
];
return colorList[params.dataIndex]
},*/
}
},
}]
@ -762,11 +744,12 @@
} else if (index === '3') {
this.$router.push({name: 'management', params: {page: 1, page_size: 20}})
} else if (index === '4') {
this.$router.push({name: 'product'})
this.$router.push({name: 'sales'})
} else if (index === '5') {
this.$router.push({name: 'unproduct'})
}
},
//选择月份
searchTimeChange(index) {
let that = this;
@ -796,51 +779,62 @@
});
}
},
//提示
activeNameClick() {
let that = this;
that.warningPage = 1;
that.warningList = [];
if (that.activeName === '库存警告') {
getMaterialList({page: 1, page_size:that.warningPageSize, tag: 'low_inm'}).then((response) => {
getMaterialList({page: 1, page_size: that.warningPageSize, tag: 'low_inm'}).then((response) => {
if (response.data) {
that.warningList = response.data.results;
that.warningTotal = response.data.count;
}
});
} else if (that.activeName === '临近交货') {
getOrderList({page: 1, page_size:that.warningPageSize,tag:'near_delivery'}).then((response) => {
getOrderList({page: 1, page_size: that.warningPageSize, tag: 'near_delivery'}).then((response) => {
if (response.data) {
that.warningList = response.data.results;
that.warningTotal = response.data.count;
}
});
} else if (that.activeName === '过期提醒') {
getmaterialbatchList({page: 1, page_size:that.warningPageSize, tag: 'expired'}).then((response) => {
getmaterialbatchList({page: 1, page_size: that.warningPageSize, tag: 'expired'}).then((response) => {
if (response.data) {
that.warningList = response.data.results;
let warningList = response.data.results;
let arr = [];
warningList.forEach(item => {
let obj = new Object();
obj.name = item.material_.name;
obj.unit = item.material_.unit;
obj.id = item.id;
obj.expiration_date = item.expiration_date;
arr.push(obj)
});
that.warningList = arr;
that.warningTotal = response.data.count;
}
});
}else if (that.activeName === '设备检测') {
} else if (that.activeName === '设备检测') {
that.warningPageSize = 100;
let warningList = [];
getpEquipmentList({page: 0,tag:'near_done'}).then((response) => {
getpEquipmentList({page: 0, tag: 'near_done'}).then((response) => {
if (response.data) {
let results = response.data;
if(results.length>0){
results.forEach(item=>{
if (results.length > 0) {
results.forEach(item => {
let obj = new Object();
obj = item;
obj.warningType = 1;
warningList.push(obj);
});
}
getpEquipmentList({page: 0,tag:'out_done'}).then((res) => {
getpEquipmentList({page: 0, tag: 'out_done'}).then((res) => {
if (response.data) {
let resData = res.data;
if(resData.length>0){
resData.forEach(item=>{
if (resData.length > 0) {
resData.forEach(item => {
let obj1 = new Object();
obj1 = item;
obj1.warningType = 2;
@ -853,24 +847,24 @@
});
}
});
}else if (that.activeName === '任务到期') {
} else if (that.activeName === '任务到期') {
that.warningPageSize = 100;
let warningList = [];
getProductionplanList({page: 0,tag:'near_done'}).then((response) => {
getProductionplanList({page: 0, tag: 'near_done'}).then((response) => {
if (response.data) {
let results = response.data;
if(results.length>0){
results.forEach(item=>{
if (results.length > 0) {
results.forEach(item => {
let obj = new Object();
obj = item;
obj.warningType = 1;
warningList.push(obj);
});
}
getProductionplanList({page: 0,tag:'out_done'}).then((res) => {
getProductionplanList({page: 0, tag: 'out_done'}).then((res) => {
if (response.data) {
let resData = res.data;
if(resData.length>0) {
if (resData.length > 0) {
resData.forEach(item => {
let obj1 = new Object();
obj1 = item;
@ -886,29 +880,31 @@
});
}
},
handleWarningSizeChange(val) {
this.warningPageSize = val;
this.warningPage = 1;
},
handleWarningCurrentChange(val) {
let that = this;
that.warningPage = val;
if (that.activeName === '库存警告') {
getMaterialList({page: val, page_size:that.warningPageSize, tag: 'low_inm'}).then((response) => {
getMaterialList({page: val, page_size: that.warningPageSize, tag: 'low_inm'}).then((response) => {
if (response.data) {
that.warningList = response.data.results;
that.warningTotal = response.data.count;
}
});
} else if (that.activeName === '临近交货') {
getOrderList({page: val, page_size:that.warningPageSize,tag:'near_delivery'}).then((response) => {
getOrderList({page: val, page_size: that.warningPageSize, tag: 'near_delivery'}).then((response) => {
if (response.data) {
that.warningList = response.data.results;
that.warningTotal = response.data.count;
}
});
} else if (that.activeName === '过期提醒') {
getmaterialbatchList({page: val, page_size:that.warningPageSize, tag: 'expired'}).then((response) => {
getmaterialbatchList({page: val, page_size: that.warningPageSize, tag: 'expired'}).then((response) => {
if (response.data) {
that.warningList = response.data.results;
that.warningTotal = response.data.count;
@ -916,6 +912,7 @@
});
}
},
getGanttData() {
let that = this;
getPlanGantt({}).then(res => {
@ -988,65 +985,75 @@
}
})
},
refreshBottomTabel(index){
if(index==='1') {//生产设备
refreshBottomTabel(index) {
if (index === '1') {//生产设备
this.getEquipmentList();//设备列表
}else if(index==='2'){//人员到岗
} else if (index === '2') {//人员到岗
this.getUserList();//用户列表
}else{//提醒
} else {//提醒
this.activeNameClick();
}
},
},
refreshDataFrequently(){
refreshDataFrequently() {
let that = this;
let hasToken = getToken();
this.timer = window.setInterval(() => {
setTimeout(() => {
if (hasToken) {
that.getUserList();//用户列表
that.getEquipmentList();//设备列表
that.getGanttData();//甘特图数据
that.getStatisticsData();//统计数据
that.getNoticeData();//提醒列表
}
},0)
},120000)//2分钟
if (hasToken) {
this.timer = window.setInterval(() => {
setTimeout(() => {
if (that.nowHour > 7 && that.nowHour < 10) {
that.getUserList();//用户列表
that.getEquipmentList();//设备列表
that.getGanttData();//甘特图数据
that.getStatisticsData();//统计数据
that.getNoticeData();//提醒列表
} else {
that.refreshDataSlowly();
}
}, 0)
}, 120000)//2分钟
}
},
refreshDataSlowly(){
refreshDataSlowly() {
let that = this;
let hasToken = getToken();
this.timer = window.setInterval(() => {
setTimeout(() => {
if (hasToken) {
that.getUserList();//用户列表
that.getEquipmentList();//设备列表
that.getGanttData();//甘特图数据
that.getStatisticsData();//统计数据
that.getNoticeData();//提醒列表
}
},0)
},3600000)//1小时1000*10*60
if (hasToken) {
this.timer = window.setInterval(() => {
setTimeout(() => {
if (that.nowHour > 7 && that.nowHour < 10) {
that.refreshDataFrequently();
} else {
that.getUserList();//用户列表
that.getEquipmentList();//设备列表
that.getGanttData();//甘特图数据
that.getStatisticsData();//统计数据
that.getNoticeData();//提醒列表
}
}, 0)
}, 3600000)//1小时1000*10*60
}
},
},
mounted() {
let hei = document.getElementsByClassName('app-main')[0].clientHeight;
let heig = document.getElementsByClassName('dashboardTopCard')[0].clientHeight;
let domHeight = ((hei - heig - 140) / 2);
this.cardTabelHeight = domHeight-37;
this.ganttHeight = domHeight+35;
this.cardTabelHeight = domHeight - 37;
this.ganttHeight = domHeight + 35;
document.getElementById('chartColumn').style.height = domHeight + 'px';
this.getUserList();//用户列表
this.getEquipmentList();//设备列表
this.getGanttData();//甘特图数据
this.getStatisticsData();//统计数据
this.getNoticeData();//提醒列表
// this.refreshCountData();
let nowDate = new Date();
let nowHour = nowDate.getHours();
if(nowHour>7&&nowHour<10){
this.nowHour = nowHour;
if (nowHour > 7 && nowHour < 10) {
this.refreshDataFrequently();
}else{
} else {
this.refreshDataSlowly();
}
},
@ -1060,9 +1067,11 @@
.el-card.is-always-shadow {
height: auto !important;
}
.dashboard-container {
margin: 5px 6px;
}
.dashboardTopCard, .dashboardMiddle, .dashboardBottomRow {
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
@ -1072,13 +1081,16 @@
overflow: hidden;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
}
.dashboardBottomRow {
margin-bottom: 0;
}
.dashboardCardPadding {
overflow: hidden;
padding: 5px 20px 20px 20px;
}
/**/
.cardsWrap {
display: flex;
@ -1087,70 +1099,86 @@
float: left;
font-size: 14px;
}
.svgIconWrap {
margin-right: 20px;
width: 50px;
height: 50px;
border-radius: 15px;
text-align: center;
.svgIcon {
font-size: 24px;
margin-top: 13px
}
}
.cardsWrap:nth-child(1) {
.svgIconWrap {
background: #e9f3ff;
.svgIcon {
color: #409EFF;
fill: #409EFF;
}
}
}
.cardsWrap:nth-child(2) {
.svgIconWrap {
background: #fff1de;
.svgIcon {
color: #ffb23f;
}
}
}
.cardsWrap:nth-child(3) {
.svgIconWrap {
background: #d9f6d8;
.svgIcon {
color: #54cb48;
}
}
}
.cardsWrap:nth-child(4) {
.svgIconWrap {
background: #f0e8fd;
.svgIcon {
color: #a378e4;
}
}
}
.cardsWrap:nth-child(5) {
.svgIconWrap {
background: #f7e5ea;
.svgIcon {
color: #f27197;
}
}
}
.totalCountText {
height: 20px;
line-height: 20px
}
.totalCountNum {
height: 30px;
}
.totalCount {
font-size: 25px;
font-weight: bold;
color: #626262;
}
/**/
.CardTitleWrap {
display: flex;
@ -1167,6 +1195,7 @@
margin-right: 7px;
margin-top: 8px;
}
.dashboardCardTitle {
height: 34px;
line-height: 34px;
@ -1176,6 +1205,7 @@
vertical-align: middle;
margin-right: 7px;
}
.stockMore {
font-size: 12px;
font-weight: normal;
@ -1183,14 +1213,17 @@
cursor: pointer;
}
}
/*成品率筛选条件*/
.dashboardCardHand {
display: flex;
padding-left: 1%;
justify-content: space-between;
border-bottom: 1px solid #f5f5f5;
.dashboardCardFilter {
display: flex;
.convenientWrap {
display: flex;
border: 1px solid #DCDFE6;
@ -1199,19 +1232,23 @@
line-height: 30px;
margin-left: 10px;
font-size: 12px;
.convenientBtn {
cursor: pointer;
width: 50px;
text-align: center;
border-right: 1px solid #DCDFE6;
}
.convenientBtn:last-child {
border-right: 0;
border-radius: 0 6px 6px 0;
}
.convenientBtn:first-child {
border-radius: 6px 0 0 6px;
}
.activeIndex {
color: #ffffff;
background: #409EFF;
@ -1219,16 +1256,19 @@
}
}
}
.refreshIcon{
.refreshIcon {
color: #409EFF;
font-weight: bold;
font-size: 18px;
cursor: pointer;
}
.anim {
transition: all 0.5s;
margin-top: -35px; //高度等于行高
}
.lists {
height: 100%;
line-height: 35px;
@ -1236,28 +1276,35 @@
overflow-y: scroll;
padding-right: 40px;
margin: 0 !important;
.listItem {
height: 40px;
line-height: 40px;
font-size: 12px;
.itemText {
display: flex;
justify-content: space-between;
}
}
}
.nearStatus{
.nearStatus {
color: #e6a23c;
}
.outStatus{
.outStatus {
color: #f56c6c;
}
#chartColumn > div {
height: 100% !important;
canvas {
height: 100% !important;
}
}
#dashboardMiddle .el-range-editor--medium.el-input__inner,
#dashboardMiddle .el-range-editor.el-input__inner {
height: 30px !important;