Merge branch 'develop' of https://e.coding.net/ctcdevteam/hberp/hberp into develop

This commit is contained in:
shilixia 2022-01-04 09:44:45 +08:00
commit 1bc22240b7
4 changed files with 267 additions and 98 deletions

View File

@ -2,8 +2,8 @@
ENV = 'development' ENV = 'development'
# base api # base api
#VUE_APP_BASE_API = 'http://127.0.0.1:8000/api' VUE_APP_BASE_API = 'http://127.0.0.1:8000/api'
VUE_APP_BASE_API = 'http://47.95.0.242:2222/api' #VUE_APP_BASE_API = 'http://47.95.0.242:2222/api'
# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable, # vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="dashboard-container"> <div class="dashboard-container">
<el-card style="margin-bottom: 5px"> <el-card class="dashboardTopCard">
<div class="cards"> <div class="cards">
<div class="cardFirstText">本月2</div> <div class="cardFirstText">本月2</div>
<div class="cardSecondText">20</div> <div class="cardSecondText">20</div>
@ -27,24 +27,27 @@
<div>累计不合格产品数</div> <div>累计不合格产品数</div>
</div> </div>
</el-card> </el-card>
<el-row :gutter="5" style="margin-bottom: 5px"> <el-row class="dashboardSubRow" :gutter="5">
<el-col :span="12"> <el-col :span="12">
<el-card> <el-card>
<div style="display: flex"> <div class="dashboardCardHand">
<div style="height: 35px; line-height:35px;font-size: 24px;font-weight: bold;vertical-align: middle">任务排期</div> <div class="dashboardCardTitle">任务排期</div>
<div class="dashboardCardFilter">
<el-date-picker <el-date-picker
v-model="date" v-model="tableDate"
type="month" type="month"
placeholder="查询日期" placeholder="查询日期"
range-separator="" range-separator=""
format="yyyy 年 MM 月" format="yyyy 年 MM 月"
value-format="yyyy-MM" value-format="yyyy-MM"
@change="searchTimeChange('1')"
> >
</el-date-picker> </el-date-picker>
<div style="display: flex;border: 1px solid #aaaaaa;border-radius: 6px;height: 35px; line-height:35px;"> <div class="convenientWrap">
<div style=" cursor: pointer;width: 60px;text-align:center;border-right: 1px solid #aaaaaa;"></div> <div class="convenientBtn" :class="{activeIndex:tableIndex==='1'}" @click="convenientClick('1','week')">本周</div>
<div style="width: 60px;text-align:center;border-right: 1px solid #aaaaaa;"></div> <div class="convenientBtn" :class="{activeIndex:tableIndex==='2'}" @click="convenientClick('1','month')">本月</div>
<div style="width: 60px;text-align:center;">三个月</div> <div class="convenientBtn" :class="{activeIndex:tableIndex==='3'}" @click="convenientClick('1','quarter')">三个月</div>
</div>
</div> </div>
</div> </div>
<el-table <el-table
@ -71,38 +74,46 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-card> <el-card>
<div style="display: flex"> <div class="dashboardCardHand">
<div style="height: 35px; line-height:35px;font-size: 24px;font-weight: bold;vertical-align: middle">成品率</div> <div class="dashboardCardTitle">成品率</div>
<div class="dashboardCardFilter">
<el-date-picker <el-date-picker
v-model="date" v-model="chartDate"
type="month" type="month"
placeholder="查询日期" placeholder="查询日期"
range-separator="" range-separator=""
format="yyyy 年 MM 月" format="yyyy 年 MM 月"
value-format="yyyy-MM" value-format="yyyy-MM"
@change="searchTimeChange('2')"
> >
</el-date-picker> </el-date-picker>
<div style="display: flex;border: 1px solid #aaaaaa;border-radius: 6px;height: 35px; line-height:35px;"> <div class="convenientWrap">
<div style=" cursor: pointer;width: 60px;text-align:center;border-right: 1px solid #aaaaaa;"></div> <div class="convenientBtn" :class="{activeIndex:chartIndex==='1'}" @click="convenientClick('2','week')">本周</div>
<div style="width: 60px;text-align:center;border-right: 1px solid #aaaaaa;"></div> <div class="convenientBtn" :class="{activeIndex:chartIndex==='2'}" @click="convenientClick('2','month')">本月</div>
<div style="width: 60px;text-align:center;">三个月</div> <div class="convenientBtn" :class="{activeIndex:chartIndex==='3'}" @click="convenientClick('2','quarter')">三个月</div>
</div>
</div> </div>
</div> </div>
<div id="chartColumn" style="width:100%; height:300px;"></div> <div id="chartColumn" style="width:100%; height:300px;"></div>
</el-card> </el-card>
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="5" style="margin-bottom: 5px"> <el-row class="dashboardSubRow" :gutter="5">
<el-col :span="12"> <el-col :span="12">
<el-card> <el-card>
<div style="display: flex"> <div class="dashboardCardHand">
<div style="height: 35px; line-height:35px;font-size: 24px;font-weight: bold;vertical-align: middle">库存列表</div> <div class="dashboardCardTitle">库存列表</div>
<div class="block"> <div class="block">
<el-pagination <el-pagination
:current-page.sync="currentPage" :current-page.sync="stockPage"
:page-size="100" :page-size="stockPageSize"
layout="prev, pager, next, jumper" layout="prev, pager, next, jumper"
:total="1000"> :total="stockTotal"
pager-count="3"
:page-sizes="[10, 20, 30, 40]"
@size-change="handleStockSizeChange"
@current-change="handleStockCurrentChange"
>
</el-pagination> </el-pagination>
</div> </div>
</div> </div>
@ -138,23 +149,52 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-card style="height: 350px"> <el-card style="height: 350px">
<div style="display: flex"> <div class="dashboardCardHand">
<div style="height: 35px; line-height:35px;font-size: 24px;font-weight: bold;vertical-align: middle">提醒</div> <div class="dashboardCardTitle">提醒</div>
<div class="block"> <div class="block">
<el-pagination <el-pagination
:current-page.sync="currentPage" :current-page.sync="remindPage"
:page-size="100" :page-size="remindPageSize"
layout="prev, pager, next, jumper" layout="prev, pager, next, jumper"
:total="1000"> :total="remindTotal"
@size-change="handleRemindSizeChange"
@current-change="handleRemindCurrentChange"
>
</el-pagination> </el-pagination>
</div> </div>
</div> </div>
<el-badge :value="count.total_count" class="item" @click.native="gotoTicketPage"> <div class="lists">
<ul style="padding-right: 40px">
<li style="height: 50px;line-height: 50px;font-size: 20px">
<div style="display: flex;justify-content: space-between">
<span>玻璃低于安全库存</span><span>2021-12-30</span>
</div>
</li>
<li style="height: 50px;line-height: 50px;font-size: 20px">
<div style="display: flex;justify-content: space-between">
<span>某某批货临近交货日期</span><span>2021-12-20</span>
</div>
</li>
<li style="height: 50px;line-height: 50px;font-size: 20px">
<div style="display: flex;justify-content: space-between">
<span>玻璃低于安全库存</span><span>2021-11-30</span>
</div>
</li>
<li style="height: 50px;line-height: 50px;font-size: 20px">
<div style="display: flex;justify-content: space-between">
<span>某某批货临近交货日期</span><span>2021-11-20</span>
</div>
</li>
</ul>
</div>
<!--<el-badge :value="count.total_count" class="item" @click.native="gotoTicketPage">
<el-icon class="el-icon-s-management" style="font-size: 70px;color: #d29898"></el-icon> <el-icon class="el-icon-s-management" style="font-size: 70px;color: #d29898"></el-icon>
</el-badge> </el-badge>
<div></div> <div></div>
<div class="dashboard-text">name: {{ name }}</div> <div class="dashboard-text">name: {{ name }}</div>
<div class="dashboard-text">perms: <span v-for="perm in perms" :key="perm">{{ perm }}</span></div> <div class="dashboard-text">perms:
<span v-for="perm in perms" :key="perm">{{ perm }}</span>
</div>-->
</el-card> </el-card>
</el-col> </el-col>
</el-row> </el-row>
@ -169,14 +209,23 @@ export default {
data() { data() {
return { return {
chartColumn: null, chartColumn: null,
currentPage:1, stockPage:1,
total_count:1, stockPageSize:10,
date:'2021-12', stockTotal:100,
remindPage:2,
remindPageSize:20,
remindTotal:100,
tableIndex:null,
chartIndex:null,
tableDate:'2021-12',
chartDate:'2021-12',
list:[ list:[
{id:1,name:'HIehd9',card:'3337',sco:'REF-32'}, {id:1,name:'HIehd9',card:'3337',sco:'REF-32'},
{id:1,name:'HIehd9',card:'3337',sco:'REF-32'}, {id:1,name:'HIehd9',card:'3337',sco:'REF-32'},
{id:1,name:'HIehd9',card:'3337',sco:'REF-32'} {id:1,name:'HIehd9',card:'3337',sco:'REF-32'}
], ],
seriesData:[80,60,60, 70, 76, 80, 90, 70],
} }
}, },
computed: { computed: {
@ -195,34 +244,28 @@ export default {
this.$router.push({name:'ticket',params:{}}) this.$router.push({name:'ticket',params:{}})
} }
}, },
//图标渲染
drawChart() { drawChart() {
this.chartColumn = echarts.init(document.getElementById('chartColumn')); this.chartColumn = echarts.init(document.getElementById('chartColumn'));
this.chartColumn.setOption({ this.chartColumn.setOption({
// title: { text: '成品率' }, // title: { text: '成品率' },
/*tooltip: {
trigger:'axis',
aXisPointer:{
type:'cross'
},
formatter(params){
for(let x in params){
return params[x].name +":"+params[x].data+"%";
}
},
},*/
grid: { grid: {
top: '3%', top: '10%',
left: '3%', left: '3%',
right: '4%', right: '5%',
bottom: '1%', bottom: '1%',
containLabel: true containLabel: true
}, },
tooltip: { tooltip: {
trigger: 'item', trigger: 'item',
/* formatter(params){
for(let x in params){
return params[x].name +":"+params[x].data+"%";
}
}*/
formatter: function (params) { formatter: function (params) {
var color = params.color;//图例颜色 let color = params.color;//图例颜色
// var color = "red";//图例颜色 let htmlStr ='<div>';
var htmlStr ='<div>';
htmlStr += params.name + '<br/>'; htmlStr += params.name + '<br/>';
htmlStr += '<span style="height:10px;width:10px;font-size:12px;border-radius:5px;margin-right:5px;font-family:Consolas;display:inline-block;background:'+color+';"></span>'; htmlStr += '<span style="height:10px;width:10px;font-size:12px;border-radius:5px;margin-right:5px;font-family:Consolas;display:inline-block;background:'+color+';"></span>';
htmlStr += params.seriesName + ''+params.value + '%'; htmlStr += params.seriesName + ''+params.value + '%';
@ -231,14 +274,37 @@ export default {
} }
}, },
xAxis: { xAxis: {
name:'工序',
axisTick: {
show: false
},
splitLine: {
show: false, //去掉X轴分割线
},
data: ["冷加工", "热弯", "钢化", "镀膜", "夹层", "包边", "装框", "成品"] data: ["冷加工", "热弯", "钢化", "镀膜", "夹层", "包边", "装框", "成品"]
}, },
yAxis: {}, yAxis: {
axisLine:{
show:true,//y轴线
},
axisTick: {
show: false//Y轴刻度线
},
axisLabel:{
color:'#333333'//Y轴文本颜色
},
splitLine: {
show: true, //Y轴分割线
lineStyle:{
color:'#dddddd'//Y轴分割线颜色
}
},
},
series: [{ series: [{
name: '成品率', name: '成品率',
type: 'bar', type: 'bar',
barWidth: 40, barWidth: 40,
data: [80,60,60, 70, 76, 80, 90, 70], data: this.seriesData,
label: { label: {
show: true, //开启显示 show: true, //开启显示
position: 'top', //在上方显示 position: 'top', //在上方显示
@ -251,19 +317,77 @@ export default {
itemStyle: { itemStyle: {
normal: { normal: {
color: function(params) { color: function(params) {
var colorList = [ let colorList = [
'#5e7e54','#e44f2f','#81b6b2','#eba422', '#5e7e54','#e44f2f','#81b6b2','#eba422',
'#1bcde4','#b61b08','#84eb84','#d8d417' '#1bcde4','#b61b08','#84eb84','#d8d417'
]; ];
return colorList[params.dataIndex] return colorList[params.dataIndex]
}, },
} }
}, },
}] }]
}); });
}, },
//便捷查询按钮
convenientClick(index,type){
let startTime = '',endTime = '',url='',activeIndex = '1',obj = new Object();
let dat = new Date();
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 time = currentTime-6*24*60*60*1000;
let start = new Date(time);
startTime = start.getFullYear()+'-'+(start.getMonth()+1)+'-'+start.getDate();
}else if(type==='month'){
activeIndex = '2';
let time = currentTime-30*24*60*60*1000;
let start = new Date(time);
startTime = start.getFullYear()+'-'+(start.getMonth()+1)+'-'+start.getDate();
}else if(type==='quarter'){
activeIndex = '3';
let time = currentTime-120*24*60*60*1000;
let start = new Date(time);
startTime = start.getFullYear()+'-'+(start.getMonth()+1)+'-'+start.getDate();
}
obj.startTime = startTime;
obj.endTime = endTime;
if(index==='1'){
this.tableDate = null;
this.tableIndex = activeIndex;
}else{
this.chartDate = null;
this.chartIndex = activeIndex;
}
//根据时间和类型获取数据
}, },
//选择月份
searchTimeChange(index){
if(index==='1'){
this.tableIndex = null;
}else{
this.chartIndex = null;
}
},
handleStockSizeChange(val){
this.stockPageSize = val;
this.stockPage = 1;
},
handleStockCurrentChange(val){
console.log(`当前页: ${val}`);
},
handleRemindSizeChange(val){
this.remindPageSize = val;
this.remindPage = 1;
},
handleRemindCurrentChange(val){
console.log(`当前页: ${val}`);
},
},
mounted () { mounted () {
this.drawChart() this.drawChart()
}, },
@ -274,16 +398,16 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.dashboard { .dashboard-container {
&-container {
margin: 5px 6px; margin: 5px 6px;
} }
&-text { .dashboard-text {
font-size: 30px; font-size: 30px;
line-height: 46px; line-height: 46px;
}
} }
.cards{ .dashboardTopCard{
margin-bottom: 5px;
.cards{
width: 240px; width: 240px;
color: #ffffff; color: #ffffff;
background: #abccec; background: #abccec;
@ -300,8 +424,53 @@ export default {
.cardSecondText{ .cardSecondText{
font-size: 30px; font-size: 30px;
} }
}
} }
.cards:hover{ .cards:hover{
box-shadow: 0 2px 12px 0 rgba(0,0,0,.1); box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
} }
.dashboardSubRow{
margin-bottom: 5px;
.dashboardCardHand{
display: flex;
justify-content: space-between;
.dashboardCardTitle{
height: 35px;
line-height:35px;
font-size: 24px;
font-weight: bold;
vertical-align: middle;
}
.dashboardCardFilter{
display: flex;
.convenientWrap{
display: flex;
border: 1px solid #DCDFE6;
border-radius: 6px;
height: 35px;
line-height:35px;
margin-left: 10px;
.convenientBtn{
cursor: pointer;
width: 60px;
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;
}
}
}
}
}
</style> </style>

View File

@ -9,7 +9,7 @@ class TechDocFilterset(filters.FilterSet):
# operation = filters.CharFilter(field_name="subproduction__subplan_subprod__ow_subplan__operation") # operation = filters.CharFilter(field_name="subproduction__subplan_subprod__ow_subplan__operation")
class Meta: class Meta:
model = TechDoc model = TechDoc
fields = ['subproduction', 'operation'] fields = ['subproduction', 'operation', 'enabled']
def filter_operation(self, queryset, name, value): def filter_operation(self, queryset, name, value):
return queryset.filter(subproduction__subplan_subprod__ow_subplan__operation=value).distinct() return queryset.filter(subproduction__subplan_subprod__ow_subplan__operation=value).distinct()

View File

@ -46,10 +46,10 @@ def handleTicket(sender, instance, created, **kwargs):
wp = wt.wproduct wp = wt.wproduct
decision = WProduct.NG_BACK_WORK decision = WProduct.NG_BACK_WORK
if 'decision_1' in ticket_data and ticket_data['decision_1']: if 'decision_2' in ticket_data and ticket_data['decision_2']:
decision = ticket_data['decision_1']
elif 'decision_2' in ticket_data and ticket_data['decision_2']:
decision = ticket_data['decision_2'] decision = ticket_data['decision_2']
elif 'decision_1' in ticket_data and ticket_data['decision_1']:
decision = ticket_data['decision_1']
wp.ng_sign = decision wp.ng_sign = decision