searchshiftandaddtwowarnings

This commit is contained in:
shijing 2022-01-26 14:00:12 +08:00
parent 573f25bce6
commit 09f1937474
4 changed files with 199 additions and 164 deletions

View File

@ -63,4 +63,7 @@ export default {
.overFlowShow .el-tabs__content{
overflow: visible;
}
#warningTabs .el-tabs__item{
padding: 0 10px!important;
}
</style>

View File

@ -19,14 +19,12 @@
@expand-change="handlerExpand"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
>
<el-table-column label="任务编号" prop="name" width="140" show-overflow-tooltip>
<el-table-column label="任务编号" prop="name" min-width="140" show-overflow-tooltip>
</el-table-column>
<el-table-column label="产品名称" prop="productName" width="120" show-overflow-tooltip>
<el-table-column label="产品名称" prop="productName" min-width="120" show-overflow-tooltip>
</el-table-column>
<el-table-column label="产品型号" prop="productNum">
</el-table-column>
<el-table-column label="生产数量" prop="per">
</el-table-column>
</el-table>
</div>
</template>

View File

@ -255,11 +255,11 @@
<span>{{ currentProjectMsg.allTime }}</span>
</div>
<div class="lineMsg" v-if="currentProjectMsg.per1">
<span class="title">当前进度</span>
<span class="title">订单计划</span>
<span>{{ currentProjectMsg.per }}</span>
</div>
<div class="lineMsg" v-if="currentProjectMsg.per1">
<span class="title">合格数量</span>
<span class="title">当前进度</span>
<span>{{ currentProjectMsg.per1 }}</span>
</div>
<div class="lineMsg">
@ -1389,8 +1389,9 @@
.searchWrap{
position: absolute;
z-index: 2000;
top: -38px;
display: flex
top: -35px;
right: 10px;
display: flex;
}
#searchWrap .el-range-editor--medium.el-input__inner{
height: 30px!important;

View File

@ -86,22 +86,11 @@
</div>
</div>
<div id="dashboardMiddle" class="dashboardMiddle">
<el-row>
<el-col :span="15">
<div class="dashboardCardPadding">
<div style="width: 65%;float: left;">
<div class="CardTitleWrap">
<span class="verticalLine"></span><span class="dashboardCardTitle">任务进度</span>
</div>
</el-col>
<el-col :span="1" style="height: 1px"></el-col>
<el-col :span="8">
<div class="CardTitleWrap">
<span class="verticalLine"></span><span class="dashboardCardTitle">成品率</span>
</div>
</el-col>
</el-row>
<el-row class="dashboardCardPadding">
<el-col :span="15">
<div style="height: 40px;line-height: 40px;"></div>
<div>
<gantt
v-if="proList.length>0"
@ -110,45 +99,37 @@
:ganttHeight="ganttHeight"
></gantt>
</div>
</el-col>
<el-col :span="1" style="height: 1px"></el-col>
<el-col :span="8">
<div class="dashboardCardHand">
<div class="dashboardCardFilter">
<el-date-picker
v-model="chartDate"
type="monthrange"
start-placeholder="开始日期"
end-placeholder="结束日期"
range-separator=""
format="yyyy 年 MM 月"
value-format="yyyy-MM"
@change="searchTimeChange('1')"
>
</el-date-picker>
<div class="convenientWrap">
<div class="convenientBtn" :class="{activeIndex:chartIndex==='1'}" @click="convenientClick('1','week')">
本周
</div>
<div class="convenientBtn" :class="{activeIndex:chartIndex==='2'}"
@click="convenientClick('1','month')">本月
</div>
<div class="convenientBtn" :class="{activeIndex:chartIndex==='3'}"
@click="convenientClick('1','quarter')">三个月
</div>
</div>
</div>
</div>
<div style="width: 34%;position:relative;float: right" >
<div class="CardTitleWrap">
<span class="verticalLine"></span><span class="dashboardCardTitle">成品率</span>
</div>
<div class="dashboardCardHand" style="position: absolute;top: 0;right: 10px;">
<el-date-picker
v-model="chartDate"
type="monthrange"
start-placeholder="开始日期"
end-placeholder="结束日期"
range-separator=""
format="yyyy 年 MM 月"
value-format="yyyy-MM"
@change="searchTimeChange('1')"
>
</el-date-picker>
</div>
<div id="chartColumn" style="width:100%;" :style="{height:ganttHeight+'px'}"></div>
</el-col>
</el-row>
</div>
</div>
</div>
<el-row :gutter="5">
<el-col :span="8">
<div class="dashboardBottomRow">
<div class="dashboardCardHand">
<div class="CardTitleWrap">
<div class="CardTitleWrap" style="border-bottom: 0">
<span class="verticalLine"></span><span class="dashboardCardTitle">生产设备</span>
<span @click="refreshBottomTabel('1')">
<el-icon class="el-icon-refresh refreshIcon"></el-icon>
</span>
</div>
<div class="block">
<el-pagination
@ -183,7 +164,7 @@
<el-table-column label="设备状态" prop="material_">
<!--type=1生产设备-->
<template slot-scope="scope">
<div v-if="scope.row.type===1">
<div v-if="scope.row.type===2">
<el-tag v-if="scope.row.state===40" type="danger">
禁用
</el-tag>
@ -207,14 +188,14 @@
</div>
</template>
</el-table-column>
<el-table-column label="下次校准日期" prop="model">
<!-- <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-column>-->
</el-table>
</div>
</div>
@ -222,8 +203,11 @@
<el-col :span="8">
<div class="dashboardBottomRow">
<div class="dashboardCardHand">
<div class="CardTitleWrap">
<div class="CardTitleWrap" style="border-bottom: 0">
<span class="verticalLine"></span><span class="dashboardCardTitle">人员到岗</span>
<span @click="refreshBottomTabel('2')">
<el-icon class="el-icon-refresh refreshIcon"></el-icon>
</span>
</div>
<div class="block">
<el-pagination
@ -274,8 +258,11 @@
<el-col :span="8">
<div class="dashboardBottomRow">
<div class="dashboardCardHand">
<div class="CardTitleWrap">
<div class="CardTitleWrap" style="border-bottom: 0">
<span class="verticalLine"></span><span class="dashboardCardTitle">提醒</span>
<span @click="refreshBottomTabel('3')" style="cursor: pointer">
<el-icon class="el-icon-refresh refreshIcon"></el-icon>
</span>
</div>
<div class="block">
<el-pagination
@ -293,13 +280,13 @@
</div>
<div class="dashboardCardPadding">
<el-tabs type="card" :style="{height:cardTabelHeight+'px'}" v-model="activeName"
@tab-click="activeNameClick">
@tab-click="activeNameClick" id="warningTabs">
<el-tab-pane label="库存警告" name="库存警告">
<ul :style="{height:cardTabelHeight-47+'px'}" class="lists" :class="{anim:animate}" @mouseenter="Stop()"
@mouseleave="Up()">
<li class="listItem" v-for="item in warningList" :key="item.id">
<li class="listItem" v-for="(item,$index) in warningList" :key="$index">
<div class="itemText">
<span>{{item.name}}({{item.unit}})</span><span>剩余{{item.count}},低于安全库存{{item.count_safe}}</span>
<span>{{item.name}}({{item.unit}})</span><span>低于安全库存</span>
</div>
</li>
</ul>
@ -307,9 +294,9 @@
<el-tab-pane label="临近交货" name="临近交货">
<ul :style="{height:cardTabelHeight-47+'px'}" class="lists" :class="{anim:animate}" @mouseenter="Stop()"
@mouseleave="Up()">
<li class="listItem" v-for="item in warningList" :key="item.id">
<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.number}})</span><span>{{item.delivery_date}}交货日期</span>
</div>
</li>
</ul>
@ -317,13 +304,39 @@
<el-tab-pane label="过期提醒" name="过期提醒">
<ul :style="{height:cardTabelHeight-47+'px'}" class="lists" :class="{anim:animate}" @mouseenter="Stop()"
@mouseleave="Up()">
<li class="listItem" v-for="item in warningList" :key="item.id">
<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>
</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()">
<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 v-if="item.warningType===1">接近校准日期</span>
<span v-else>已过校准日期</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()">
<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 v-if="item.warningType===1">接近计划日期</span>
<span v-else>已过计划日期</span>
</div>
</li>
</ul>
</el-tab-pane>
</el-tabs>
</div>
</div>
@ -331,7 +344,6 @@
</el-row>
</div>
</template>
<script>
import echarts from 'echarts'
import {mapGetters} from 'vuex';
@ -544,11 +556,9 @@
this.drawChart();
}
});
//获取库存警告
getMaterialList({page: 1, page_size:that.warningPageSize,tag: 'low_inm'}).then((response) => {
if (response.data) {
debugger;
that.warningList = response.data.results;
that.warningTotal = response.data.count;
}
@ -558,6 +568,7 @@
getEquipmentList() {
let that = this;
this.listLoadingEm = true;
that.equipmentPage = 1;
getpEquipmentList({page: that.equipmentPage, page_size: that.equipmentPageSize}).then((response) => {
if (response.data) {
that.equipmentList = response.data.results;
@ -583,6 +594,7 @@
getUserList() {
let that = this;
that.listLoadingUser = true;
that.userPage =1;
getUserList({page: that.userPage, page_size: that.userPageSize, fields: 'id,name,dept_name,is_atwork'}).then((response) => {
if (response.data) {
that.userList = response.data.results;
@ -633,40 +645,6 @@
this.$router.push({name: 'ticket', params: {}})
}
},
//任务排期列表
/*getPlanList() {
let that = this;
this.listLoadingPlan = true;
getProductionplanList({page: 0}).then((response) => {
if (response.data) {
that.planList = response.data;
}
this.listLoadingPlan = false;
});
},*/
//库存列表
/*getStockList() {
let that = this;
this.listLoadingStock = true;
getInventoryList({page: this.stockPage, page_size: this.stockPageSize}).then((response) => {
if (response.data) {
that.stockList = response.data.results;
that.stockTotal = response.data.count;
}
this.listLoadingStock = false;
});
},
//更多库存
stockMore() {
this.$router.push({name: 'warehouse', params: {}})
},
//库存pageSize改变
// @size-change="handleStockSizeChange"
handleEquipmentSizeChange(val) {
this.stockPageSize = val;
this.stockPage = 1;
},
*/
//图标渲染
drawChart() {
let that = this;
@ -794,60 +772,6 @@
this.$router.push({name: 'unproduct'})
}
},
//便捷查询按钮
convenientClick(index, type) {
let that = this;
let startTime = '', endTime = '', activeIndex = '1';
let dat = new Date();
let week = dat.getDay();//0-6
let currentTime = dat.getTime();
let currentYear = dat.getFullYear();
let currentMonth = dat.getMonth() + 1;
let currentDay = dat.getDate();
endTime = currentYear + '-' + currentMonth + '-' + currentDay;
if (type === 'week') {
activeIndex = '1';
let num = week === 0 ? 6 : week - 1;
let time = currentTime - num * 24 * 60 * 60 * 1000;
let start = new Date(time);
startTime = start.getFullYear() + '-' + (start.getMonth() + 1) + '-' + start.getDate();
} else if (type === 'month') {
activeIndex = '2';
startTime = currentYear + '-' + currentMonth + '-01';
} else if (type === 'quarter') {
activeIndex = '3';
let mon = null, yea = null;
if (currentMonth > 2) {
mon = currentMonth - 2;
yea = currentYear;
} else if (currentMonth === 2) {
mon = 12;
yea = currentYear - 1;
} else if (currentMonth === 1) {
mon = 11;
yea = currentYear - 1;
}
startTime = yea + '-' + mon + '-01';
}
if (index === '1') {
this.chartIndex = activeIndex;
getProcessYield({datetime_start: startTime, datetime_end: endTime}).then((response) => {
if (response.data) {
let list = response.data;
let xAxisData = [], seriesData = [];
list.forEach(item => {
xAxisData.push(item.name);
let rate = item.rate * 100;
seriesData.push(rate.toFixed(2))
});
that.chartData.xAxisData = xAxisData;
that.chartData.seriesData = seriesData;
this.drawChart();
}
});
}
//根据时间和类型获取数据
},
//选择月份
searchTimeChange(index) {
let that = this;
@ -878,33 +802,93 @@
}
},
//提示
activeNameClick(tab) {
debugger;
debugger;
activeNameClick() {
let that = this;
that.warningPage = 1;
that.warningList = [];
if (tab.label === '库存警告') {
if (that.activeName === '库存警告') {
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 (tab.label === '临近交货') {
} else if (that.activeName === '临近交货') {
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 (tab.label === '过期提醒') {
} else if (that.activeName === '过期提醒') {
getmaterialbatchList({page: 1, page_size:that.warningPageSize, tag: 'expired'}).then((response) => {
if (response.data) {
that.warningList = response.data.results;
that.warningTotal = response.data.count;
}
});
}else if (that.activeName === '设备检测') {
that.warningPageSize = 100;
let warningList = [];
getpEquipmentList({page: 0,tag:'near_done'}).then((response) => {
if (response.data) {
let results = response.data;
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) => {
if (response.data) {
let resData = res.data;
if(resData.length>0){
resData.forEach(item=>{
let obj1 = new Object();
obj1 = item;
obj1.warningType = 2;
warningList.push(obj1);
});
}
that.warningList = warningList;
that.warningTotal = warningList.length;
}
});
}
});
}else if (that.activeName === '任务到期') {
that.warningPageSize = 100;
let warningList = [];
getProductionplanList({page: 0,tag:'near_done'}).then((response) => {
if (response.data) {
let results = response.data;
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) => {
if (response.data) {
let resData = res.data;
if(resData.length>0) {
resData.forEach(item => {
let obj1 = new Object();
obj1 = item;
obj1.warningType = 2;
warningList.push(obj1);
});
}
that.warningList = warningList;
that.warningTotal = warningList.length;
}
});
}
});
}
},
handleWarningSizeChange(val) {
@ -912,7 +896,30 @@
this.warningPage = 1;
},
handleWarningCurrentChange(val) {
console.log(`当前页: ${val}`);
let that = this;
that.warningPage = val;
if (that.activeName === '库存警告') {
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) => {
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) => {
if (response.data) {
that.warningList = response.data.results;
that.warningTotal = response.data.count;
}
});
}
},
getGanttData() {
let that = this;
@ -986,13 +993,23 @@
}
})
},
refreshBottomTabel(index){
if(index==='1') {//生产设备
this.getEquipmentList();//设备列表
}else if(index==='2'){//人员到岗
this.getUserList();//用户列表
}else{//提醒
this.activeNameClick();
}
},
},
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-35;
this.ganttHeight = domHeight - 10;
this.cardTabelHeight = domHeight-37;
this.ganttHeight = domHeight+35;
document.getElementById('chartColumn').style.height = domHeight + 'px';
this.getUserList();//用户列表
this.getEquipmentList();//设备列表
@ -1015,12 +1032,14 @@
border-radius: 5px;
margin-bottom: 5px;
background: #ffffff;
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;
}
/**/
@ -1130,7 +1149,9 @@
/*成品率筛选条件*/
.dashboardCardHand {
display: flex;
padding-left: 1%;
justify-content: space-between;
border-bottom: 1px solid #f5f5f5;
.dashboardCardFilter {
display: flex;
.convenientWrap {
@ -1161,6 +1182,12 @@
}
}
}
.refreshIcon{
color: #409EFF;
font-weight: bold;
font-size: 18px;
cursor: pointer;
}
.anim {
transition: all 0.5s;
margin-top: -35px; //高度等于行高
@ -1175,13 +1202,19 @@
.listItem {
height: 40px;
line-height: 40px;
font-size: 16px;
font-size: 12px;
.itemText {
display: flex;
justify-content: space-between;
}
}
}
.nearStatus{
color: #e6a23c;
}
.outStatus{
color: #f56c6c;
}
#chartColumn > div {
height: 100% !important;
canvas {