This commit is contained in:
shijing 2021-12-30 17:13:32 +08:00
parent e2ee06e21b
commit 319b228508
4 changed files with 238 additions and 23 deletions

View File

@ -23,6 +23,7 @@
"d3": "^5.14.2", "d3": "^5.14.2",
"dagre-d3": "^0.6.4", "dagre-d3": "^0.6.4",
"dhtmlx-gantt": "^6.2.1", "dhtmlx-gantt": "^6.2.1",
"echarts": "^4.2.0-rc.2",
"element-ui": "^2.15.5", "element-ui": "^2.15.5",
"file-saver": "^2.0.2", "file-saver": "^2.0.2",
"fuse.js": "^6.4.6", "fuse.js": "^6.4.6",

View File

@ -282,14 +282,14 @@
that.formData.push(obj) that.formData.push(obj)
}); });
that.formData=[...that.formData]; that.formData=[...that.formData];
debugger; // debugger;
console.log(that.formData) console.log(that.formData);
//当前表的数据存储 //当前表的数据存储
for(let i=0;i<this.results.length;i++){ for(let i=0;i<this.results.length;i++){
let key = this.results[i].field_key; let key = this.results[i].field_key;
//checkForm接收表单数据的对象 //checkForm接收表单数据的对象
that.checkForm[key]=''; that.checkForm[key]=this.results[i].field_value;
that.$set(that.checkForm,key,'') that.$set(that.checkForm,key,this.results[i].field_value)
} }
//判定项 //判定项
let listJudge = this.formData.filter(item => { let listJudge = this.formData.filter(item => {
@ -310,15 +310,15 @@
let imag= this.formData.filter(item => { let imag= this.formData.filter(item => {
return item.field_type === 'draw'; return item.field_type === 'draw';
}); });
that.img = 'http://47.95.0.242:2222'+imag[0].draw_template; // that.img = 'http://47.95.0.242:2222'+imag[0].draw_template;
/*let originImag= this.origins.filter(item => { /*let originImag= this.origins.filter(item => {
return item.field_type === 'draw'; return item.field_type === 'draw';
});*/ });*/
that.originImg = new Image(); /*that.originImg = new Image();
that.originImg.crossOrigin = ''; that.originImg.crossOrigin = '';
that.originImg = imag[0].origin_value; that.originImg = imag[0].origin_value;
*/
listJudge.forEach(item => { listJudge.forEach(item => {
let obj = new Object(); let obj = new Object();
obj = item; obj = item;
@ -786,14 +786,16 @@
fieldData(isSubmit){ fieldData(isSubmit){
let that = this; let that = this;
that.field = []; //检查项目 that.field = []; //检查项目
debugger; // debugger;
let submit = isSubmit=='1'?false:true; let submit = isSubmit=='1'?false:true;
that.formData.forEach((item) => { that.formData.forEach((item) => {
let field_value = 0; let field_value = null;
if(item.field_type==='int'){ if(item.field_type==='int'){
field_value = parseInt(that.checkForm[item.field_key]) field_value = parseInt(that.checkForm[item.field_key])
}else if(item.field_type==='float'){ }else if(item.field_type==='float'){
field_value = parseFloat(that.checkForm[item.field_key]) field_value = parseFloat(that.checkForm[item.field_key])
}else{
field_value = that.checkForm[item.field_key];
} }
that.field.push({ that.field.push({
id: item.id, id: item.id,
@ -805,7 +807,7 @@
that.testrecord.record_data = that.field;//检查项列表 that.testrecord.record_data = that.field;//检查项列表
that.testrecord.is_testok = that.is_testok;//检查表检查结果 that.testrecord.is_testok = that.is_testok;//检查表检查结果
that.testrecord.id = that.recordId; that.testrecord.id = that.recordId;
debugger; // debugger;
if(submit){//提交 if(submit){//提交
this.$emit('recordSubmit',that.testrecord); this.$emit('recordSubmit',that.testrecord);
}else {//保存 }else {//保存

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="dashboard-container"> <div class="dashboard-container">
<el-card> <el-card style="margin-bottom: 5px">
<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,22 +27,158 @@
<div>累计不合格产品数</div> <div>累计不合格产品数</div>
</div> </div>
</el-card> </el-card>
<el-card> <el-row :gutter="5" style="margin-bottom: 5px">
<el-badge :value="count.total_count" class="item" @click.native="gotoTicketPage"> <el-col :span="12">
<el-icon class="el-icon-s-management" style="font-size: 70px;color: #d29898"></el-icon> <el-card>
</el-badge> <div style="display: flex">
<div></div> <div style="height: 35px; line-height:35px;font-size: 24px;font-weight: bold;vertical-align: middle">任务排期</div>
<div class="dashboard-text">name: {{ name }}</div> <el-date-picker
<div class="dashboard-text">perms: <span v-for="perm in perms" :key="perm">{{ perm }}</span></div> v-model="date"
</el-card> type="month"
placeholder="查询日期"
range-separator=""
format="yyyy 年 MM 月"
value-format="yyyy-MM"
>
</el-date-picker>
<div style="display: flex;border: 1px solid #aaaaaa;border-radius: 6px;height: 35px; line-height:35px;">
<div style=" cursor: pointer;width: 60px;text-align:center;border-right: 1px solid #aaaaaa;"></div>
<div style="width: 60px;text-align:center;border-right: 1px solid #aaaaaa;"></div>
<div style="width: 60px;text-align:center;">三个月</div>
</div>
</div>
<el-table
v-loading="listLoading"
:data="list"
border fit stripe
height="300"
>
<el-table-column type="index" width="50" />
<el-table-column label="任务编号">
<template slot-scope="scope">{{ scope.row.id }}</template>
</el-table-column>
<el-table-column label="产品名称">
<template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column>
<el-table-column label="产品型号">
<template slot-scope="scope">{{ scope.row.card }}</template>
</el-table-column>
<el-table-column label="生产数量">
<template slot-scope="scope">{{ scope.row.sco }}</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
<el-col :span="12">
<el-card>
<div style="display: flex">
<div style="height: 35px; line-height:35px;font-size: 24px;font-weight: bold;vertical-align: middle">成品率</div>
<el-date-picker
v-model="date"
type="month"
placeholder="查询日期"
range-separator=""
format="yyyy 年 MM 月"
value-format="yyyy-MM"
>
</el-date-picker>
<div style="display: flex;border: 1px solid #aaaaaa;border-radius: 6px;height: 35px; line-height:35px;">
<div style=" cursor: pointer;width: 60px;text-align:center;border-right: 1px solid #aaaaaa;"></div>
<div style="width: 60px;text-align:center;border-right: 1px solid #aaaaaa;"></div>
<div style="width: 60px;text-align:center;">三个月</div>
</div>
</div>
<div id="chartColumn" style="width:100%; height:300px;"></div>
</el-card>
</el-col>
</el-row>
<el-row :gutter="5" style="margin-bottom: 5px">
<el-col :span="12">
<el-card>
<div style="display: flex">
<div style="height: 35px; line-height:35px;font-size: 24px;font-weight: bold;vertical-align: middle">库存列表</div>
<div class="block">
<el-pagination
:current-page.sync="currentPage"
:page-size="100"
layout="prev, pager, next, jumper"
:total="1000">
</el-pagination>
</div>
</div>
<el-table
v-loading="listLoading"
:data="list"
border fit stripe
height="300"
>
<el-table-column label="物料编号">
<template slot-scope="scope">{{ scope.row.id }}</template>
</el-table-column>
<el-table-column label="物料名称">
<template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column>
<el-table-column label="规格型号">
<template slot-scope="scope">{{ scope.row.card }}</template>
</el-table-column>
<el-table-column label="物料类型">
<template slot-scope="scope">{{ scope.row.sco }}</template>
</el-table-column>
<el-table-column label="单位">
<template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column>
<el-table-column label="库存">
<template slot-scope="scope">{{ scope.row.card }}</template>
</el-table-column>
<el-table-column label="仓库">
<template slot-scope="scope">{{ scope.row.sco }}</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
<el-col :span="12">
<el-card style="height: 350px">
<div style="display: flex">
<div style="height: 35px; line-height:35px;font-size: 24px;font-weight: bold;vertical-align: middle">提醒</div>
<div class="block">
<el-pagination
:current-page.sync="currentPage"
:page-size="100"
layout="prev, pager, next, jumper"
:total="1000">
</el-pagination>
</div>
</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-badge>
<div></div>
<div class="dashboard-text">name: {{ name }}</div>
<div class="dashboard-text">perms: <span v-for="perm in perms" :key="perm">{{ perm }}</span></div>
</el-card>
</el-col>
</el-row>
</div> </div>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex' import echarts from 'echarts'
import { mapGetters } from 'vuex';
export default { export default {
name: 'Dashboard', name: 'Dashboard',
data() {
return {
chartColumn: null,
currentPage:1,
total_count:1,
date:'2021-12',
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'}
],
}
},
computed: { computed: {
...mapGetters([ ...mapGetters([
'name', 'name',
@ -59,6 +195,80 @@ export default {
this.$router.push({name:'ticket',params:{}}) this.$router.push({name:'ticket',params:{}})
} }
}, },
drawChart() {
this.chartColumn = echarts.init(document.getElementById('chartColumn'));
this.chartColumn.setOption({
// title: { text: '成品率' },
/*tooltip: {
trigger:'axis',
aXisPointer:{
type:'cross'
},
formatter(params){
for(let x in params){
return params[x].name +":"+params[x].data+"%";
}
},
},*/
grid: {
top: '3%',
left: '3%',
right: '4%',
bottom: '1%',
containLabel: true
},
tooltip: {
trigger: 'item',
formatter: function (params) {
var color = params.color;//图例颜色
// var color = "red";//图例颜色
var htmlStr ='<div>';
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 += params.seriesName + ''+params.value + '%';
htmlStr += '</div>';
return htmlStr;
}
},
xAxis: {
data: ["冷加工", "热弯", "钢化", "镀膜", "夹层", "包边", "装框", "成品"]
},
yAxis: {},
series: [{
name: '成品率',
type: 'bar',
barWidth: 40,
data: [80,60,60, 70, 76, 80, 90, 70],
label: {
show: true, //开启显示
position: 'top', //在上方显示
formatter: '{c}%',//显示百分号
textStyle: { //数值样式
color: 'black',//字体颜色
fontSize: 10//字体大小
}
},
itemStyle: {
normal: {
color: function(params) {
var colorList = [
'#5e7e54','#e44f2f','#81b6b2','#eba422',
'#1bcde4','#b61b08','#84eb84','#d8d417'
];
return colorList[params.dataIndex]
},
}
},
}]
});
},
},
mounted () {
this.drawChart()
},
updated () {
this.drawChart()
} }
} }
</script> </script>

View File

@ -979,6 +979,7 @@
//点击记录里的检验 //点击记录里的检验
handleInspectionRecord(scope){ handleInspectionRecord(scope){
let that =this; let that =this;
that.fieldList = [];
that.recordVisible = false; that.recordVisible = false;
that.recordId = scope.row.id; that.recordId = scope.row.id;
that.recordform = scope.row.form; that.recordform = scope.row.form;
@ -1033,7 +1034,6 @@
obj.is_testok = null; obj.is_testok = null;
for (let j = 0; j < originList.length; j++) { for (let j = 0; j < originList.length; j++) {
if (fieldList[i].field_key === originList[j].field_key) { if (fieldList[i].field_key === originList[j].field_key) {
obj.id = originList[j].id;
obj.is_testok = originList[j].is_testok; obj.is_testok = originList[j].is_testok;
obj.field_value = originList[j].field_value; obj.field_value = originList[j].field_value;
obj.origin_value = originList[j].field_value; obj.origin_value = originList[j].field_value;
@ -1056,6 +1056,7 @@
//点击记录里的查看 //点击记录里的查看
handleRecordDetail(scope){ handleRecordDetail(scope){
let that = this; let that = this;
that.fieldList = [];
that.recordVisible = false; that.recordVisible = false;
that.recordId = scope.row.id; that.recordId = scope.row.id;
that.recordform = scope.row.form; that.recordform = scope.row.form;
@ -1098,6 +1099,7 @@
//半产品复检 //半产品复检
handleReview() { handleReview() {
let that = this; let that = this;
that.fieldList = [];
testInit({ wproduct: this.wproduct,form: that.recordform}).then((response) => { testInit({ wproduct: this.wproduct,form: that.recordform}).then((response) => {
if (response.data) { if (response.data) {
that.hasPicture = false; that.hasPicture = false;
@ -1111,7 +1113,6 @@
obj.is_testok = null; obj.is_testok = null;
for (let j = 0; j < originList.length; j++) { for (let j = 0; j < originList.length; j++) {
if (fieldList[i].field_key === originList[j].field_key) { if (fieldList[i].field_key === originList[j].field_key) {
obj.id = originList[j].id;
obj.is_testok = originList[j].is_testok; obj.is_testok = originList[j].is_testok;
obj.field_value = originList[j].field_value; obj.field_value = originList[j].field_value;
obj.origin_value = originList[j].field_value; obj.origin_value = originList[j].field_value;
@ -1136,6 +1137,7 @@
submitrecordform(index) { submitrecordform(index) {
let that = this; let that = this;
this.outerVisible = false; this.outerVisible = false;
that.fieldList = [];
if (that.recordform != "") { if (that.recordform != "") {
if(index==='1'){//非复检 if(index==='1'){//非复检
testInit({ wproduct: that.wproduct,form: that.recordform}).then((response) => { testInit({ wproduct: that.wproduct,form: that.recordform}).then((response) => {