This commit is contained in:
shijing 2026-06-23 13:45:04 +08:00
commit d5a782ac73
21 changed files with 2663 additions and 938 deletions

View File

@ -101,6 +101,14 @@ export default {
`${config.API_URL}/cm/labeltemplate/${id}/send_to_coder/`, `${config.API_URL}/cm/labeltemplate/${id}/send_to_coder/`,
data); data);
} }
},
sendToHanslaser:{
name: "下发到激光",
req: async function(id, data){
return await http.post(
`${config.API_URL}/cm/labeltemplate/${id}/send_to_hanslaser/`,
data);
}
} }
} }
} }

View File

@ -126,6 +126,14 @@ export default {
data); data);
} }
}, },
get_svs_char: {
name: "获取数据识别",
req: async function(data){
return await http.get(
`${config.API_URL}/em/equipment/get_svs_char/`,
data);
}
}
}, },
//巡检记录 //巡检记录
einspect: { einspect: {

View File

@ -3528,6 +3528,7 @@ const routes = [
path: "/statistic/task_rate", path: "/statistic/task_rate",
meta: { meta: {
title: "任务进度", title: "任务进度",
hidden: true,
// icon: "el-icon-DataAnalysis", // icon: "el-icon-DataAnalysis",
perms: ["statistic_wpm"], perms: ["statistic_wpm"],
}, },
@ -3595,6 +3596,7 @@ const routes = [
name: "user_statistics", name: "user_statistics",
meta: { meta: {
title: "绩效统计", title: "绩效统计",
hidden: true,
icon: "el-icon-trend-charts", icon: "el-icon-trend-charts",
perms: ["statistic_kpi"], perms: ["statistic_kpi"],
}, },

View File

@ -1,15 +1,36 @@
<template> <template>
<div class="user-bar"> <div class="user-bar">
<div class="screen panel-item" @click="printerSetting"> <el-dropdown
class="screen panel-item"
trigger="click"
@command="handleSettingCommand"
>
<div class="setting-trigger" title="设置">
<el-icon> <el-icon>
<el-icon-printer :size="26"/> <el-icon-setting color="#fff" :size="26"/>
</el-icon>
</div>
<div class="screen panel-item" @click="coderSetting" title="喷码设置">
<el-icon>
<el-icon-postcard :size="26"/>
</el-icon> </el-icon>
</div> </div>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="printer">
<el-icon><el-icon-printer/></el-icon>
<span style="margin-left:6px">打印设置</span>
</el-dropdown-item>
<el-dropdown-item command="coder">
<el-icon><el-icon-postcard/></el-icon>
<span style="margin-left:6px">喷码设置</span>
</el-dropdown-item>
<el-dropdown-item command="ocr">
<el-icon><el-icon-view/></el-icon>
<span style="margin-left:6px">数字识别设置</span>
</el-dropdown-item>
<el-dropdown-item command="marker">
<el-icon><el-icon-edit-pen/></el-icon>
<span style="margin-left:6px">打码设置</span>
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
<div class="screen panel-item" @click="openAddCoder" title="补喷码"> <div class="screen panel-item" @click="openAddCoder" title="补喷码">
<el-icon> <el-icon>
<el-icon-brush :size="26"/> <el-icon-brush :size="26"/>
@ -139,6 +160,38 @@
<el-button type="primary" @click="saveCoder">保存</el-button> <el-button type="primary" @click="saveCoder">保存</el-button>
</el-footer> </el-footer>
</el-dialog> </el-dialog>
<el-dialog title="数字识别设置" v-model="setOcrVisible" width="600px">
<el-form label-width="140px">
<el-form-item label="IP">
<el-input v-model="ocr_ip" placeholder="IP"></el-input>
</el-form-item>
<el-form-item label="Port">
<el-input v-model="ocr_port" placeholder="端口号"></el-input>
</el-form-item>
<el-form-item label="unit">
<el-input v-model="ocr_unit" placeholder="位号"></el-input>
</el-form-item>
</el-form>
<el-footer>
<el-button type="primary" @click="saveOcr">保存</el-button>
</el-footer>
</el-dialog>
<el-dialog title="打码设置" v-model="setMarkerVisible" width="600px">
<el-form label-width="140px">
<el-form-item label="打码IP">
<el-input v-model="marker_ip" placeholder="打码机器分配的IP地址"></el-input>
</el-form-item>
<el-form-item label="打码端口">
<el-input v-model="marker_port" placeholder="打码机器分配的端口号"></el-input>
</el-form-item>
<el-form-item label="数字码模板名">
<el-input v-model="marker_jobname" placeholder="打码机信息模板名, 如 Barcode"></el-input>
</el-form-item>
</el-form>
<el-footer>
<el-button type="primary" @click="saveMarker">保存</el-button>
</el-footer>
</el-dialog>
<el-dialog <el-dialog
v-model="searchVisible" v-model="searchVisible"
:width="700" :width="700"
@ -202,6 +255,8 @@ export default {
visible:false, visible:false,
setNameVisible:false, setNameVisible:false,
setCoderVisible:false, setCoderVisible:false,
setOcrVisible:false,
setMarkerVisible:false,
searchVisible: false, searchVisible: false,
msg: false, msg: false,
msgList: {}, msgList: {},
@ -221,6 +276,12 @@ export default {
coder_field2:'', coder_field2:'',
coder_jobname:'', coder_jobname:'',
coder_jobname2:'', coder_jobname2:'',
ocr_ip:'192.168.1.231',
ocr_port:'80',
ocr_unit:'',
marker_ip:'',
marker_port:'',
marker_jobname:'',
scanVisible:false, scanVisible:false,
addCoderVisible: false, addCoderVisible: false,
addCoderSearch: '', addCoderSearch: '',
@ -252,6 +313,12 @@ export default {
this.coder_field2 = localStorage.getItem("coder_field2") || ""; this.coder_field2 = localStorage.getItem("coder_field2") || "";
this.coder_jobname = localStorage.getItem("coder_jobname") || ""; this.coder_jobname = localStorage.getItem("coder_jobname") || "";
this.coder_jobname2 = localStorage.getItem("coder_jobname2") || ""; this.coder_jobname2 = localStorage.getItem("coder_jobname2") || "";
this.ocr_ip = localStorage.getItem("ocr_ip") || "";
this.ocr_port = localStorage.getItem("ocr_port") || "";
this.ocr_unit = localStorage.getItem("ocr_unit") || "";
this.marker_ip = localStorage.getItem("marker_ip") || "";
this.marker_port = localStorage.getItem("marker_port") || "";
this.marker_jobname = localStorage.getItem("marker_jobname") || "";
}, },
methods: { methods: {
openBook() { openBook() {
@ -341,6 +408,12 @@ export default {
var element = document.documentElement; var element = document.documentElement;
this.$TOOL.screen(element); this.$TOOL.screen(element);
}, },
handleSettingCommand(command){
if(command === 'printer') this.printerSetting();
else if(command === 'coder') this.coderSetting();
else if(command === 'ocr') this.ocrSetting();
else if(command === 'marker') this.markerSetting();
},
printerSetting(){ printerSetting(){
this.setNameVisible=true; this.setNameVisible=true;
}, },
@ -365,6 +438,28 @@ export default {
}); });
this.setCoderVisible=false; this.setCoderVisible=false;
}, },
ocrSetting(){
this.setOcrVisible=true;
},
saveOcr(){
this.$TOOL.setOcr({
"ocr_ip":this.ocr_ip,
"ocr_port":this.ocr_port,
"ocr_unit":this.ocr_unit
});
this.setOcrVisible=false;
},
markerSetting(){
this.setMarkerVisible=true;
},
saveMarker(){
this.$TOOL.setMarker({
"marker_ip":this.marker_ip,
"marker_port":this.marker_port,
"marker_jobname":this.marker_jobname
});
this.setMarkerVisible=false;
},
// //
showMsg() { showMsg() {
this.msg = true; this.msg = true;

View File

@ -155,6 +155,16 @@ tool.setCoder = function (val) {
localStorage.setItem('coder_jobname', val.coder_jobname || '') localStorage.setItem('coder_jobname', val.coder_jobname || '')
localStorage.setItem('coder_jobname2', val.coder_jobname2 || '') localStorage.setItem('coder_jobname2', val.coder_jobname2 || '')
} }
tool.setOcr = function (val) {
localStorage.setItem('ocr_ip', val.ocr_ip || '')
localStorage.setItem('ocr_port', val.ocr_port || '')
localStorage.setItem('ocr_unit', val.ocr_unit || '')
}
tool.setMarker = function (val) {
localStorage.setItem('marker_ip', val.marker_ip || '')
localStorage.setItem('marker_port', val.marker_port || '')
localStorage.setItem('marker_jobname', val.marker_jobname || '')
}
/* 复制对象 */ /* 复制对象 */
tool.objCopy = function (obj) { tool.objCopy = function (obj) {
return JSON.parse(JSON.stringify(obj)); return JSON.parse(JSON.stringify(obj));

View File

@ -0,0 +1,969 @@
<template>
<el-container class="dashboard">
<!-- Header -->
<el-header class="dash-header">
<div class="dash-header-side dash-header-left">
<span class="header-tag">PHOTON · {{ mgroupName }}</span>
<span class="header-status"><i class="led-dot"></i>实时数据</span>
</div>
<div class="dash-header-center">
<div class="dash-title">{{ mgroupName }}工段生产数据看板</div>
<div class="dash-title-deco"><span></span><i></i><span></span></div>
</div>
<div class="dash-header-side dash-header-right">
<div class="dash-day">{{ currentDay }}</div>
<div class="dash-time">{{ currentTime }}</div>
</div>
</el-header>
<el-main class="dash-main">
<!-- KPI Cards -->
<div class="kpi-row">
<div class="kpi-card kpi-c2">
<div class="kpi-meta">
<div class="kpi-label">昨日流转量</div>
<div class="kpi-sub">PROCESSED</div>
</div>
<div class="kpi-value">{{ sctj.rjgs }}</div>
<div class="kpi-bar"></div>
</div>
<div class="kpi-card kpi-c3">
<div class="kpi-meta">
<div class="kpi-label">昨日加工前不良</div>
<div class="kpi-sub">PRE-DEFECT</div>
</div>
<div class="kpi-value">{{ sctj.rjgqbls }}</div>
<div class="kpi-bar"></div>
</div>
<div class="kpi-card kpi-c4">
<div class="kpi-meta">
<div class="kpi-label">昨日合格数</div>
<div class="kpi-sub">QUALIFIED</div>
</div>
<div class="kpi-value">{{ sctj.rhgs }}</div>
<div class="kpi-bar"></div>
</div>
<div class="kpi-card kpi-c5">
<div class="kpi-meta">
<div class="kpi-label">昨日不合格数</div>
<div class="kpi-sub">REJECTED</div>
</div>
<div class="kpi-value">{{ sctj.rbhgs }}</div>
<div class="kpi-bar"></div>
</div>
<div class="kpi-card kpi-c1">
<div class="kpi-meta">
<div class="kpi-label">昨日合格率</div>
<div class="kpi-sub">DAILY QUALITY RATE</div>
</div>
<div class="kpi-value">{{ sctj.rhgl }}</div>
<div class="kpi-bar"></div>
</div>
<div class="kpi-card kpi-c1">
<div class="kpi-meta">
<div class="kpi-label">昨日生产直通率</div>
<div class="kpi-sub">DAILY QUALITY RATE</div>
</div>
<div class="kpi-value">{{ sctj.rztls }}</div>
<div class="kpi-bar"></div>
</div>
</div>
<!-- Top row: 2 panels -->
<el-row :gutter="12" type="flex" class="row-top">
<el-col :span="12" class="col-full">
<div class="panel">
<div class="panel-head">
<span class="panel-title">设备状态</span>
<div class="panel-states">
<span class="state-chip s-run"><i></i>运行<em>{{ hh.yx }}</em></span>
<span class="state-chip s-idle"><i></i>未运行<em>{{ hh.wyx }}</em></span>
<span class="state-chip s-err"><i></i>故障<em>{{ hh.gz }}</em></span>
</div>
</div>
<div class="panel-body" id="scrollContainer">
<dv-scroll-board :config="configDataEq" class="board" />
</div>
<i class="corner tl"></i><i class="corner tr"></i>
<i class="corner bl"></i><i class="corner br"></i>
</div>
</el-col>
<el-col :span="4" class="col-full">
<div class="panel">
<div class="panel-head">
<span class="panel-title">工序余料</span>
</div>
<div class="panel-body" ref="processBox">
<dv-scroll-board :config="configDataProcess" class="board" />
</div>
<i class="corner tl"></i><i class="corner tr"></i>
<i class="corner bl"></i><i class="corner br"></i>
</div>
</el-col>
<el-col :span="8" class="col-full">
<div class="panel">
<div class="panel-head">
<span class="panel-title">昨日损耗分析</span>
</div>
<div class="panel-body chart-body" id="chart2"></div>
<i class="corner tl"></i><i class="corner tr"></i>
<i class="corner bl"></i><i class="corner br"></i>
</div>
</el-col>
</el-row>
<!-- Bottom row: 2 panels -->
<el-row :gutter="12" type="flex" class="row-bottom">
<el-col :span="12" class="col-full">
<div class="panel">
<div class="panel-head">
<span class="panel-title">生产统计</span>
</div>
<div class="panel-body">
<dv-scroll-board :config="configDatas" class="board" />
</div>
<i class="corner tl"></i><i class="corner tr"></i>
<i class="corner bl"></i><i class="corner br"></i>
</div>
</el-col>
<el-col :span="12" class="col-full">
<div class="panel">
<div class="panel-head">
<span class="panel-title">车间库存</span>
</div>
<div class="panel-body">
<dv-scroll-board :config="configDataInm" class="board" />
</div>
<i class="corner tl"></i><i class="corner tr"></i>
<i class="corner bl"></i><i class="corner br"></i>
</div>
</el-col>
</el-row>
</el-main>
</el-container>
</template>
<script>
import * as echarts from "echarts";
import scScrollTavle from "@/components/scScrollTable.vue";
function deepCopy(obj) {
return JSON.parse(JSON.stringify(obj));
}
export default {
components: { scScrollTavle },
data() {
return {
pieOption: {
backgroundColor: "",
tooltip: { trigger: 'item' },
legend: {
icon: "stack",
right: 10,
orient: 'vertical',
itemWidth: 10,
itemHeight: 10,
textStyle: { color: '#c8f2ff', fontSize: 11 },
},
series: {
name: '不合格占比',
type: 'pie',
radius: ['35%', '65%'],
center: ['38%', '52%'],
itemStyle: {
borderColor: 'rgba(3, 22, 26, 0.8)',
borderWidth: 2,
},
label: { show: false },
labelLine: { show: false },
data: []
}
},
tableHeight: 100,
speed: 2000,
time: null,
hh: {
yx: 0,
wyx: 0,
gz: 0,
},
sctj: {
rjgs: 0,
rjgqbls: 0,
rhgs: 0,
rbhgs: 0,
rhgl: 0,
rztls: 0,
rlzls: 0,
},
dayInterval: null,
chartInterval2: null,
//
configDataInm: {
header: ['物料名称', '批次号', '数量', '生产中'],
headerBGC: 'rgba(0, 229, 255, 0.16)',
oddRowBGC: 'rgba(0, 229, 255, 0.04)',
evenRowBGC: 'rgba(0, 229, 255, 0.10)',
headerHeight: 38,
rowNum: 8,
align: 'center',
data: [],
waitTime: 1500,
},
configDataProcess: {
headerBGC: 'rgba(0, 229, 255, 0.16)',
oddRowBGC: 'rgba(0, 229, 255, 0.04)',
evenRowBGC: 'rgba(0, 229, 255, 0.10)',
header: ['物料名', '数量(个)'],
headerHeight: 38,
rowNum: 8,
align: 'center',
columnWidth: [],
data: []
},
//
configDataEq: {
headerBGC: 'rgba(0, 229, 255, 0.16)',
oddRowBGC: 'rgba(0, 229, 255, 0.04)',
evenRowBGC: 'rgba(0, 229, 255, 0.10)',
header: ['设备名称', '设备编号', '设备状态', '日加工量', '累计加工量'],
headerHeight: 38,
rowNum: 8,
align: 'center',
data: []
},
//
configDatas: {
headerBGC: 'rgba(0, 229, 255, 0.16)',
oddRowBGC: 'rgba(0, 229, 255, 0.04)',
evenRowBGC: 'rgba(0, 229, 255, 0.10)',
header: ['日期', '物料名', '接收数', '合格数', '不合格数', '交送数'],
headerHeight: 38,
rowNum: 7,
align: 'center',
data: []
},
page: 1,
currentTime: "",
currentDay: "",
mgroupName: "",
mgroupId: "",
today: "",
end_time: '',
start_time: '',
daysList: [],
};
},
mounted() {
let that = this;
let arr = this.$route.path.split("/");
that.mgroup_code = arr[2];
that.page = 1;
that.getMgroups(this.mgroup_code);
that.configDataInm.data = [];
//table
this.tableHeight = document.getElementById("scrollContainer").clientHeight;
this.$nextTick(() => {
const box = this.$refs.processBox;
if (box) {
const w = box.clientWidth - 16;
this.configDataProcess.columnWidth = [Math.max(50, w - 100), 100];
}
});
this.showTime();
this.dayInterval = setInterval(() => {
this.showTime();
}, 1000);
//
let daysArr = this.getMondayOfCurrentWeek();
this.daysArr = daysArr;
let xAxisData = [];
daysArr.forEach((item) => {
let dates = item.split('-');
let obj = dates[1] + '-' + dates[2];
xAxisData.push(obj);
let dayitem = Number(dates[2]);
that.daysList.push(dayitem);
})
that.today = new Date().toISOString().split('T')[0];
that.yesterday =that.$TOOL.dateFormat2(new Date().getTime() - 24 * 60 * 60 * 1000);;
this.xAxisData = xAxisData;
let startDate = new Date(daysArr[0]).getTime() - (1000 * 60 * 60 * 24);
let endDate = new Date(daysArr[6]).getTime() + (1000 * 60 * 60 * 24);
let start_time = this.$TOOL.dateFormat(new Date(startDate), "yyyy-MM-dd");
let end_time = this.$TOOL.dateFormat(new Date(endDate), "yyyy-MM-dd");
this.start_time = start_time;
this.end_time = end_time;
},
beforeDestroy() {
if (this.dayInterval) clearInterval(this.dayInterval);
if (this.chartInterval2) clearInterval(this.chartInterval2);
},
methods: {
getMgroups(code){
let that = this;
that.$API.mtm.mgroup.list.req({page:0,code}).then((res) => {
that.mgroupName = res[0].name;
that.mgroupId = res[0].id;
this.$nextTick(() => {
that.getEqState(that.mgroupId);
this.getMaterials(that.page);
this.getProductLine();
this.getCountnotok();
this.getProcessLeft();
})
});
},
getMondayOfCurrentWeek() {
let today = new Date();
let days = [];
for (let i = 6; i >= 0; i--) {
let date = new Date(today);
date.setDate(today.getDate() - i);
days.push(date.toISOString().split('T')[0]);
}
return days;
},
//
showTime() {
this.currentTime = this.$TOOL.dateFormat(new Date(), "hh:mm:ss");
this.currentDay = this.$TOOL.dateFormat(
new Date(),
"yyyy年MM月dd日"
);
},
setChart(name, option = null) {
let dom = document.getElementById(name);
if (!dom) return null;
var myChart = echarts.getInstanceByDom(dom);
if (myChart == undefined) {
myChart = echarts.init(dom, "dark", {
renderer: "svg",
});
}
if (option == null) {
option = Object.assign({}, this.barOption);
}
setTimeout(() => {
try {
myChart.setOption(option);
} catch (error) { }
}, 500);
return myChart;
},
getProcessLeft() {
let that = this;
let obj = {
query: { mgroup_name: that.mgroupName },
};
that.$API.bi.dataset.exec.req("mgroup_yuliao", obj).then((res) => {
let list = res.data2.ds0;
if (list.length > 0) {
list.forEach((item) => {
if(item.状态=='合格'&&(item.物料名.indexOf('QS')>-1||item.物料名.indexOf('32.2')>-1||item.物料名.indexOf('3D')>-1||item.物料名.indexOf('2.5D')>-1)){
let arr = [];
arr[0] = item.物料名+'('+item.状态+')';
arr[1] = item.数量;
that.configDataProcess.data.push(arr);
}
})
}
})
},
//
getProductLine() {
let that = this;
let obj = {
query: { start_date: that.start_time, end_date: that.end_time, mgroup_name: that.mgroupName },
};
that.$API.bi.dataset.exec.req("lineDay", obj).then((res) => {
let list = res.data2.ds0;
if (list.length > 0) {
list.forEach((item) => {
let dateYes = that.yesterday.split('-')[2];
if (item. == dateYes) {
that.sctj.rjgs += item.生产数;
that.sctj.rjgqbls += item.加工前不良;
that.sctj.rhgs += item.合格数;
that.sctj.rbhgs += item.不合格数;
}
let arr = [];
arr[0] = item. + '-' + item. + '-' + item.;
arr[1] = item.物料名;
arr[2] = item.接收数;
arr[3] = item.生产数;
arr[4] = item.合格数;
arr[5] = item.交送数;
that.configDatas.data.push(arr);
});
that.sctj.rhgl = Number((that.sctj.rhgs / that.sctj.rjgs * 100).toFixed(2));
let total = that.sctj.rjgs+that.sctj.rjgqbls;
that.sctj.rztls = Number((that.sctj.rhgs / total * 100).toFixed(2));
}
});
},
//
getCountnotok() {
let that = this;
let obj = {
query: { start_date: that.yesterday, end_date: that.yesterday,mgroup_name:that.mgroupName }
};
that.$API.bi.dataset.exec.req('notok_dis', obj).then((res) => {
let seriesData = [];
if (res.data2.ds0) {
res.data2.ds0.forEach((item) => {
let obj = {};
obj.name = item.不合格项;
obj.value = item.数量;
seriesData.push(obj);
})
}
that.pieOption.series.data = seriesData;
let index2 = 0;
let chart2 = this.setChart("chart2", that.pieOption);
if (!chart2) return;
this.chartInterval2 = setInterval(function () {
if (index2 < seriesData.length) {
chart2.dispatchAction({ type: "downplay", seriesIndex: 0 });
chart2.dispatchAction({ type: "highlight", seriesIndex: 0, dataIndex: index2 });
chart2.dispatchAction({ type: "showTip", seriesIndex: 0, dataIndex: index2 });
index2++;
} else {
index2 = 0;
}
}, 3000);
})
},
//
getEqState() {
let that = this;
let obj = {
query: { query_date: that.today, mgroup_name: that.mgroupName },
};
that.$API.wpm.ana.equipLastMlog.req({ mgroup: that.mgroupId }).then((res) => {
that.hh.yx = res.运行;
that.hh.wyx = res.未运行;
that.hh.gz = res.故障;
});
that.$API.bi.dataset.exec.req("equit_static", obj).then((res) => {
let list = res.data2.ds0;
if (list.length > 0) {
list.forEach((item) => {
let arr = [];
arr[0] = item.设备名称;
arr[1] = item.设备编号;
if (item.运行状态 == '运行') {
arr[2] = '<span style="color:#00e5ff">● 运行</span>';
} else if (item.运行状态 == '待机') {
arr[2] = '<span style="color:#45b076">● 待机</span>';
} else if (item.运行状态 == '停机') {
arr[2] = '<span style="color:#de3c36">● 停机</span>';
}else if (item.运行状态 == '故障') {
arr[2] = '<span style="color:#de3c36">● 故障</span>';
}else if (item.运行状态 == '离线') {
arr[2] = '<span style="color:#de3c36">● 离线</span>';
}
arr[3] = item.当日加工量 ? item.当日加工量 : 0;
arr[4] = item.累计总加工量 ? item.累计总加工量 : 0;
that.configDataEq.data.push(arr);
});
}
})
},
//
getMaterials(page) {
let that = this;
let query = '{ material_name, batch, count, count_working }';
that.$API.wpm.wmaterial.list.req({ page: page, page_size: 100, mgroup: that.mgroupId, query: query }).then((res) => {
if (res.results.length > 0) {
res.results.forEach((item) => {
let arr = [];
arr[0] = item.material_name;
arr[1] = item.batch;
arr[2] = item.count;
arr[3] = item.count_working;
that.configDataInm.data.push(arr);
})
if(that.configDataInm.data.length<res.count){
that.getMaterials(page+1);
}
}
})
},
},
};
</script>
<style scoped>
@font-face {
font-family: "myfont";
src: url("../../../utils/youShe.ttf");
}
.dashboard,
.dashboard * {
box-sizing: border-box;
}
.dashboard {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
overflow: hidden;
background: #00181c url("/public/img/photon_bg.png") center / cover no-repeat;
color: #fff;
font-family: "Microsoft Yahei" !important;
}
.dashboard::before {
content: "";
position: absolute;
inset: 0;
background:
radial-gradient(ellipse at 20% 0%, rgba(0, 229, 255, 0.10), transparent 55%),
radial-gradient(ellipse at 80% 100%, rgba(0, 122, 153, 0.18), transparent 55%);
pointer-events: none;
z-index: 0;
}
/* ============= Header ============= */
.dash-header {
position: relative;
z-index: 1;
flex: 0 0 72px !important;
height: 72px !important;
padding: 0 24px !important;
display: flex;
align-items: center;
justify-content: space-between;
background: url("/public/img/photon_header.png") center / 100% 100% no-repeat;
}
.dash-header-side {
flex: 0 0 280px;
display: flex;
align-items: center;
gap: 14px;
}
.dash-header-right {
justify-content: flex-end;
}
.dash-header-center {
flex: 1;
text-align: center;
}
.dash-title {
font-family: "myfont", "Microsoft Yahei";
font-size: 30px;
font-weight: bold;
letter-spacing: 8px;
background: linear-gradient(180deg, #ffffff 0%, #b9fbff 55%, #00d4ff 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
text-shadow: 0 0 22px rgba(0, 212, 255, 0.45);
line-height: 1;
}
.dash-title-deco {
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
margin-top: 6px;
}
.dash-title-deco span {
display: inline-block;
width: 90px;
height: 1px;
background: linear-gradient(90deg, transparent, rgba(0, 229, 255, 0.7), transparent);
}
.dash-title-deco i {
display: inline-block;
width: 6px;
height: 6px;
background: #00e5ff;
transform: rotate(45deg);
box-shadow: 0 0 8px #00e5ff;
}
.header-tag {
font-size: 12px;
letter-spacing: 2px;
padding: 4px 10px;
border: 1px solid rgba(0, 229, 255, 0.45);
color: #95ffff;
background: rgba(0, 229, 255, 0.06);
font-weight: bold;
}
.header-status {
font-size: 13px;
color: #95ffff;
display: flex;
align-items: center;
gap: 6px;
}
.led-dot {
width: 8px;
height: 8px;
border-radius: 50%;
background: #18f1a4;
box-shadow: 0 0 8px #18f1a4;
animation: led-pulse 1.4s ease-in-out infinite;
}
@keyframes led-pulse {
0%,
100% {
opacity: 1;
}
50% {
opacity: 0.35;
}
}
.dash-day {
font-size: 14px;
color: #c8f2ff;
letter-spacing: 1px;
}
.dash-time {
font-family: "myfont", "Microsoft Yahei";
font-size: 22px;
color: #fff;
letter-spacing: 3px;
text-shadow: 0 0 12px rgba(0, 229, 255, 0.55);
}
/* ============= Main ============= */
.dash-main {
position: relative;
z-index: 1;
flex: 1 1 0 !important;
min-height: 0;
padding: 10px !important;
display: flex;
flex-direction: column;
gap: 10px;
overflow: hidden;
}
/* ============= KPI Strip ============= */
.kpi-row {
display: grid;
grid-template-columns: repeat(6, 1fr);
gap: 10px;
flex: 0 0 92px;
min-height: 0;
}
.kpi-card {
position: relative;
padding: 10px 16px;
background: linear-gradient(135deg, rgba(0, 60, 80, 0.55) 0%, rgba(3, 22, 26, 0.7) 100%);
border: 1px solid rgba(0, 229, 255, 0.22);
display: flex;
align-items: center;
justify-content: space-between;
overflow: hidden;
}
.kpi-card::before {
content: "";
position: absolute;
inset: 0;
background: radial-gradient(circle at 100% 0%, rgba(0, 229, 255, 0.16), transparent 60%);
pointer-events: none;
}
.kpi-card::after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 3px;
height: 100%;
background: #00e5ff;
box-shadow: 0 0 10px #00e5ff;
}
.kpi-meta {
z-index: 1;
}
.kpi-label {
font-size: 15px;
letter-spacing: 2px;
color: #d8f6ff;
font-weight: 500;
}
.kpi-sub {
font-size: 10px;
letter-spacing: 2px;
color: rgba(149, 255, 255, 0.45);
margin-top: 4px;
}
.kpi-value {
font-family: "myfont", "Microsoft Yahei";
font-size: 34px;
font-weight: bold;
letter-spacing: 1px;
z-index: 1;
line-height: 1;
}
.kpi-bar {
position: absolute;
left: 0;
bottom: 0;
height: 2px;
width: 100%;
}
.kpi-c1 .kpi-value {
color: #95ffff;
text-shadow: 0 0 14px rgba(0, 229, 255, 0.55);
}
.kpi-c1::after {
background: #00e5ff;
box-shadow: 0 0 10px #00e5ff;
}
.kpi-c1 .kpi-bar {
background: linear-gradient(90deg, #00e5ff, transparent);
}
.kpi-c2 .kpi-value {
color: #c5ff7a;
text-shadow: 0 0 14px rgba(170, 255, 102, 0.55);
}
.kpi-c2::after {
background: #aaff66;
box-shadow: 0 0 10px #aaff66;
}
.kpi-c2 .kpi-bar {
background: linear-gradient(90deg, #aaff66, transparent);
}
.kpi-c3 .kpi-value {
color: #ffd87a;
text-shadow: 0 0 14px rgba(255, 200, 80, 0.55);
}
.kpi-c3::after {
background: #ffb74d;
box-shadow: 0 0 10px #ffb74d;
}
.kpi-c3 .kpi-bar {
background: linear-gradient(90deg, #ffb74d, transparent);
}
.kpi-c4 .kpi-value {
color: #7af0a8;
text-shadow: 0 0 14px rgba(45, 210, 140, 0.55);
}
.kpi-c4::after {
background: #2dd28c;
box-shadow: 0 0 10px #2dd28c;
}
.kpi-c4 .kpi-bar {
background: linear-gradient(90deg, #2dd28c, transparent);
}
.kpi-c5 .kpi-value {
color: #ff8a8a;
text-shadow: 0 0 14px rgba(255, 107, 107, 0.55);
}
.kpi-c5::after {
background: #ff6b6b;
box-shadow: 0 0 10px #ff6b6b;
}
.kpi-c5 .kpi-bar {
background: linear-gradient(90deg, #ff6b6b, transparent);
}
/* ============= Content Rows ============= */
.row-top,
.row-bottom {
display: flex;
min-height: 0;
margin: 0 !important;
}
.row-top {
flex: 1.15 1 0;
}
.row-bottom {
flex: 1 1 0;
}
.col-full {
height: 100%;
display: flex;
flex-direction: column;
}
/* ============= Panel ============= */
.panel {
position: relative;
height: 100%;
background: linear-gradient(180deg, rgba(10, 63, 68, 0.45) 0%, rgba(3, 22, 26, 0.65) 100%);
border: 1px solid rgba(0, 229, 255, 0.18);
display: flex;
flex-direction: column;
overflow: hidden;
}
.panel-head {
position: relative;
height: 36px;
flex: 0 0 36px;
padding: 0 12px;
display: flex;
align-items: center;
gap: 12px;
background: linear-gradient(90deg, rgba(0, 229, 255, 0.16) 0%, rgba(0, 229, 255, 0.02) 60%, rgba(0, 229, 255, 0.08) 100%);
border-bottom: 1px solid rgba(0, 229, 255, 0.18);
}
.panel-head::before {
content: "";
width: 4px;
height: 16px;
background: linear-gradient(180deg, #00e5ff, #007a99);
box-shadow: 0 0 6px rgba(0, 229, 255, 0.6);
}
.panel-title {
font-size: 16px;
font-weight: 600;
color: #fff;
letter-spacing: 2px;
}
.panel-sub {
font-size: 11px;
letter-spacing: 2px;
color: rgba(149, 255, 255, 0.5);
font-weight: 300;
}
.panel-states {
margin-left: auto;
display: flex;
gap: 6px;
}
.state-chip {
font-size: 12px;
padding: 2px 8px;
display: flex;
align-items: center;
gap: 5px;
background: rgba(255, 255, 255, 0.04);
border: 1px solid rgba(255, 255, 255, 0.08);
color: #d8f6ff;
}
.state-chip i {
width: 7px;
height: 7px;
border-radius: 50%;
display: inline-block;
}
.state-chip em {
font-style: normal;
font-weight: bold;
color: #fff;
margin-left: 3px;
}
.s-run i {
background: #00a3f5;
box-shadow: 0 0 6px #00a3f5;
}
.s-idle i {
background: #45b076;
box-shadow: 0 0 6px #45b076;
}
.s-err i {
background: #de3c36;
box-shadow: 0 0 6px #de3c36;
}
.panel-body {
flex: 1 1 0;
min-height: 0;
padding: 8px;
position: relative;
overflow: hidden;
}
.chart-body {
padding: 4px;
}
.board {
width: 100%;
height: 100%;
}
/* ============= Corner brackets ============= */
.corner {
position: absolute;
width: 12px;
height: 12px;
border-color: #00e5ff;
border-style: solid;
pointer-events: none;
z-index: 2;
}
.corner.tl {
top: -1px;
left: -1px;
border-width: 2px 0 0 2px;
}
.corner.tr {
top: -1px;
right: -1px;
border-width: 2px 2px 0 0;
}
.corner.bl {
bottom: -1px;
left: -1px;
border-width: 0 0 2px 2px;
}
.corner.br {
bottom: -1px;
right: -1px;
border-width: 0 2px 2px 0;
}
</style>

View File

@ -463,10 +463,21 @@ export default {
percentage: 100, percentage: 100,
count_guan: 0, count_guan: 0,
}, },
isUnmounted: false,
pieChart: null,
line1Chart: null,
line2Chart: null,
line3Chart: null,
bar1Chart: null,
onResize: null,
onCanvasMouseMove: null,
onCanvasClick: null,
canvasEl: null,
}; };
}, },
mounted() { mounted() {
loadBabylon().then(() => { loadBabylon().then(() => {
if (this.isUnmounted) return;
this.initView(); this.initView();
}) })
}, },
@ -536,27 +547,22 @@ export default {
that.showTime(); that.showTime();
}, 1000); }, 1000);
that.notokTimer = setInterval(() => { that.notokTimer = setInterval(() => {
if (that.isUnmounted) return;
let pieDom = document.getElementById("pie"); let pieDom = document.getElementById("pie");
if (pieDom) { if (!pieDom) return;
if (that.deptName == "10车间") { if (that.deptName == "10车间") {
that.deptName = "7车间"; that.deptName = "7车间";
} else { } else {
that.deptName = "10车间"; that.deptName = "10车间";
} }
let deptData = []; let deptData =
if (that.deptName == "7车间") { that.deptName == "7车间" ? that.dept7Data : that.dept10Data;
deptData = that.dept7Data;
} else {
deptData = that.dept10Data;
}
that.pieoption.series.data = deptData; that.pieoption.series.data = deptData;
let pieoption = that.pieoption; if (!that.pieChart || that.pieChart.isDisposed()) {
that.pieChart = echarts.init(pieDom);
let pieChart = echarts.init(pieDom);
pieChart.clear();
pieChart.setOption(pieoption, true);
} }
}, 5000); that.pieChart.setOption(that.pieoption, true);
}, 60000);
that.timerData = setInterval(() => { that.timerData = setInterval(() => {
that.getDeptDetail(); that.getDeptDetail();
}, 60000); }, 60000);
@ -592,8 +598,12 @@ export default {
that.getCountDept7(); that.getCountDept7();
//1--- //1---
let chartDom = document.getElementById("line1"); let chartDom = document.getElementById("line1");
if (!chartDom) return;
chartDom.style.height = this.blockHeight; chartDom.style.height = this.blockHeight;
let myChart = echarts.init(chartDom); if (!that.line1Chart || that.line1Chart.isDisposed()) {
that.line1Chart = echarts.init(chartDom);
}
let myChart = that.line1Chart;
let option = { let option = {
tooltip: { tooltip: {
trigger: "axis", trigger: "axis",
@ -862,8 +872,12 @@ export default {
} }
//线 //线
let line3Dom = document.getElementById("line3"); let line3Dom = document.getElementById("line3");
if (!line3Dom) return;
line3Dom.style.height = this.blockHeight; line3Dom.style.height = this.blockHeight;
let line3Chart = echarts.init(line3Dom); if (!that.line3Chart || that.line3Chart.isDisposed()) {
that.line3Chart = echarts.init(line3Dom);
}
let line3Chart = that.line3Chart;
let line3option = { let line3option = {
tooltip: { tooltip: {
trigger: "axis", trigger: "axis",
@ -1217,7 +1231,7 @@ export default {
// //
const hl1 = new BABYLON.HighlightLayer("hl1", scene); const hl1 = new BABYLON.HighlightLayer("hl1", scene);
const hl1Click = new BABYLON.HighlightLayer("hl1Click", scene); const hl1Click = new BABYLON.HighlightLayer("hl1Click", scene);
canvas.addEventListener("mousemove", (event) => { that.onCanvasMouseMove = (event) => {
// 使 scene.pick // 使 scene.pick
const pickResult = scene.pick( const pickResult = scene.pick(
scene.pointerX, scene.pointerX,
@ -1292,8 +1306,9 @@ export default {
} else { } else {
that.infoVisibel = false; that.infoVisibel = false;
} }
}); };
canvas.addEventListener("click", (event) => { canvas.addEventListener("mousemove", that.onCanvasMouseMove);
that.onCanvasClick = (event) => {
// 使 scene.pick // 使 scene.pick
const pickResult = scene.pick( const pickResult = scene.pick(
scene.pointerX, scene.pointerX,
@ -1364,7 +1379,8 @@ export default {
} }
} }
} }
}); };
canvas.addEventListener("click", that.onCanvasClick);
return scene; return scene;
}; };
const scene = createScene(); //Call the createScene function const scene = createScene(); //Call the createScene function
@ -1374,9 +1390,9 @@ export default {
}); });
this.engine = engine; this.engine = engine;
this.scene = scene; this.scene = scene;
window.addEventListener("resize", function () { this.canvasEl = canvas;
engine.resize(); this.onResize = () => engine.resize();
}); window.addEventListener("resize", this.onResize);
}, },
getDeptData(name) { getDeptData(name) {
this.infoVisibel = true; this.infoVisibel = true;
@ -1505,8 +1521,12 @@ export default {
let that = this; let that = this;
//2 //2
let bar1 = document.getElementById("bar1"); let bar1 = document.getElementById("bar1");
if (!bar1) return;
bar1.style.height = this.blockHeight; bar1.style.height = this.blockHeight;
let bar1Chart = echarts.init(bar1); if (!that.bar1Chart || that.bar1Chart.isDisposed()) {
that.bar1Chart = echarts.init(bar1);
}
let bar1Chart = that.bar1Chart;
let bar1option = { let bar1option = {
tooltip: { tooltip: {
trigger: "axis", trigger: "axis",
@ -1655,8 +1675,12 @@ export default {
bar1Chart.setOption(bar1option); bar1Chart.setOption(bar1option);
//3 //3
let line2Dom = document.getElementById("line2"); let line2Dom = document.getElementById("line2");
if (!line2Dom) return;
line2Dom.style.height = this.blockHeight; line2Dom.style.height = this.blockHeight;
let line2Chart = echarts.init(line2Dom); if (!that.line2Chart || that.line2Chart.isDisposed()) {
that.line2Chart = echarts.init(line2Dom);
}
let line2Chart = that.line2Chart;
let line2option = { let line2option = {
tooltip: { tooltip: {
trigger: "axis", trigger: "axis",
@ -1845,8 +1869,12 @@ export default {
line2Chart.setOption(line2option); line2Chart.setOption(line2option);
// //
let pieDom = document.getElementById("pie"); let pieDom = document.getElementById("pie");
if (!pieDom) return;
pieDom.style.height = this.blockHeight; pieDom.style.height = this.blockHeight;
let pieChart = echarts.init(pieDom); if (!that.pieChart || that.pieChart.isDisposed()) {
that.pieChart = echarts.init(pieDom);
}
let pieChart = that.pieChart;
let pieoption = { let pieoption = {
color: [ color: [
"rgb(237,224,45)", "rgb(237,224,45)",
@ -1914,22 +1942,53 @@ export default {
}, },
}, },
beforeUnmount() { beforeUnmount() {
let that = this; this.isUnmounted = true;
clearInterval(that.timerTime); //
clearInterval(that.timerData); clearInterval(this.timerTime);
clearInterval(that.notokTimer); clearInterval(this.timerData);
that.timerTime = null; clearInterval(this.notokTimer);
that.timerData = null; clearInterval(this.heightTimer);
that.notokTimer = null; this.timerTime = null;
}, this.timerData = null;
beforeDestoryed() { this.notokTimer = null;
let that = this; this.heightTimer = null;
clearInterval(that.timerTime); // echarts
clearInterval(that.timerData); [
clearInterval(that.notokTimer); this.pieChart,
that.timerTime = null; this.line1Chart,
that.timerData = null; this.line2Chart,
that.notokTimer = null; this.line3Chart,
this.bar1Chart,
].forEach((c) => {
if (c && !c.isDisposed()) c.dispose();
});
this.pieChart = this.line1Chart = this.line2Chart = this.line3Chart = this.bar1Chart = null;
//
if (this.onResize) {
window.removeEventListener("resize", this.onResize);
this.onResize = null;
}
if (this.canvasEl) {
if (this.onCanvasMouseMove) {
this.canvasEl.removeEventListener("mousemove", this.onCanvasMouseMove);
}
if (this.onCanvasClick) {
this.canvasEl.removeEventListener("click", this.onCanvasClick);
}
this.canvasEl = null;
}
this.onCanvasMouseMove = null;
this.onCanvasClick = null;
// babylon
if (this.scene) {
try { this.scene.dispose(); } catch (e) {}
this.scene = null;
}
if (this.engine) {
try { this.engine.stopRenderLoop(); } catch (e) {}
try { this.engine.dispose(); } catch (e) {}
this.engine = null;
}
}, },
}; };
</script> </script>

View File

@ -90,6 +90,7 @@
v-model="selectBatch" v-model="selectBatch"
value-key="id" value-key="id"
clearable clearable
:multiple="project_code=='gz'&&form.type == 'sale_out'"
filterable filterable
remote = "true" remote = "true"
:style="divStyle" :style="divStyle"
@ -581,6 +582,13 @@ export default {
that.form.count = Number(that.selectObj.count_canmio); that.form.count = Number(that.selectObj.count_canmio);
that.mTracking = that.selectObj.material_.tracking; that.mTracking = that.selectObj.material_.tracking;
that.selectBatchChange(that.selectObj) that.selectBatchChange(that.selectObj)
}else if(that.type == "sale_out"&&that.project_code=='gz'){
that.form.material = that.selectObj.id;
that.form.unit = that.selectObj.unit;
that.form.unit_price = that.selectObj.unit_price;
that.mTracking = that.selectObj.tracking;
that.selectBatch = [];
that.getBatchOptions();
}else{ }else{
var type = this.form.type; var type = this.form.type;
that.form.material = that.selectObj.id; that.form.material = that.selectObj.id;
@ -616,6 +624,26 @@ export default {
let that = this; let that = this;
that.wprList = []; that.wprList = [];
that.mioitems = []; that.mioitems = [];
// gz
if(that.form.type == 'sale_out' && that.project_code == 'gz' && Array.isArray(items)){
if(items.length === 0){
that.form.batch = "";
that.form.mb = "";
that.form.count = 0;
that.batchcount = 0;
that.form.warehouse = "";
that.inputBatchDisable = false;
return;
}
let totalCount = items.reduce((sum, it) => sum + Number(it.count_canmio || 0), 0);
that.form.batch = items.map(it => it.batch).join(',');
that.form.mb = items.map(it => it.id).join(',');
that.form.count = totalCount;
that.batchcount = totalCount;
that.form.warehouse = items[0].warehouse;
that.inputBatchDisable = true;
return;
}
if(items){ if(items){
if(that.form.type == 'sale_out'&&that.project_code=='bxerp'){ if(that.form.type == 'sale_out'&&that.project_code=='bxerp'){
let count = 0; let count = 0;
@ -876,7 +904,21 @@ export default {
try { try {
let res; let res;
if (that.mode == "add") { if (that.mode == "add") {
if(that.form.type == 'sale_out' && that.project_code == 'gz' && Array.isArray(that.selectBatch) && that.selectBatch.length > 0){
let payload = that.selectBatch.map(b => ({
mio: that.mioId,
material: that.form.material,
batch: b.batch,
mb: b.id,
count: Number(b.count_canmio),
warehouse: b.warehouse,
unit_price: that.form.unit_price,
note: that.form.note || ''
}));
res = await that.$API.inm.mioitem.create.req(payload);
} else {
res = await that.$API.inm.mioitem.create.req(that.form); res = await that.$API.inm.mioitem.create.req(that.form);
}
} else if (that.mode == "edit") { } else if (that.mode == "edit") {
res = await that.$API.inm.mioitem.update.req(that.form.id,that.form); res = await that.$API.inm.mioitem.update.req(that.form.id,that.form);
} }

View File

@ -31,6 +31,11 @@
clearable clearable
style="width: 200px;" style="width: 200px;"
></el-input> ></el-input>
<el-input v-model="query.handler"
placeholder="操作人"
clearable
style="width: 200px;"
></el-input>
<el-button <el-button
type="primary" type="primary"
icon="el-icon-search" icon="el-icon-search"
@ -110,13 +115,18 @@
<span>{{scope.row.data.分检_缺陷项_扭转角不合格?scope.row.data.分检_缺陷项_扭转角不合格:0}}</span> <span>{{scope.row.data.分检_缺陷项_扭转角不合格?scope.row.data.分检_缺陷项_扭转角不合格:0}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="开台人" align="center" class-name="colorheader7"> <el-table-column label="工装" align="center" class-name="colorheader7">
<template #default="scope">
<span>{{toolList[scope.row.pre_info.tooling]}}</span>
</template>
</el-table-column>
<el-table-column label="开台人" align="center" class-name="colorheader1">
<template #default="scope"> <template #default="scope">
<span v-if="scope.row.data.喷码_一体刀_操作人">{{scope.row.data.喷码_一体刀_操作人}}</span> <span v-if="scope.row.data.喷码_一体刀_操作人">{{scope.row.data.喷码_一体刀_操作人}}</span>
<span v-if="scope.row.data.喷码_磨床开台_操作人">{{scope.row.data.喷码_磨床开台_操作人}}</span> <span v-if="scope.row.data.喷码_磨床开台_操作人">{{scope.row.data.喷码_磨床开台_操作人}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" class-name="colorheader1"> <el-table-column label="备注" align="center" class-name="colorheader2">
<template #default="scope"> <template #default="scope">
<span>{{ scope.row.data.分检_缺陷项_备注 }}</span> <span>{{ scope.row.data.分检_缺陷项_备注 }}</span>
</template> </template>
@ -141,17 +151,30 @@ export default {
batch__contains:'', batch__contains:'',
last_time__gte:'', last_time__gte:'',
last_time__lte:'', last_time__lte:'',
handler:''
}, },
apiObj: this.$API.wpm.wpr.query, apiObj: this.$API.wpm.wpr.query,
options:[], options:[],
tableData:[], tableData:[],
toolList:{},
}; };
}, },
mounted() {
this.getToolings();
},
methods: { methods: {
getToolings(){
let that = this;
that.$API.em.equipment.list.req({ page: 0,type:10,cate__code:'7'}).then((res) => {
res.forEach((item) => {
that.toolList[item.id] = item.number;
});
});
},
handleQuery(){ handleQuery(){
let that = this; let that = this;
let querys = [[{field:"wm",value:false,compare:"isnull"},{field:"data__分检_日期",compare:"isnull",value:false},{field:"data__has_key",compare:"",value:"分检_批次号"}]]; let querys = [[{field:"wm",value:false,compare:"isnull"},{field:"data__分检_日期",compare:"isnull",value:false},{field:"data__has_key",compare:"",value:"分检_批次号"}]];
let obj = {},obj1 = {},obj2 = {},obj3 = {},obj4 = {}; let obj = {},obj1 = {},obj2 = {},obj3 = {},obj4 = {},obj5 = {};
obj.field = 'data__分检_批次号'; obj.field = 'data__分检_批次号';
obj.value = that.query.batch__contains; obj.value = that.query.batch__contains;
obj.compare = ''; obj.compare = '';
@ -172,6 +195,10 @@ export default {
obj4.value = that.query.number__contains; obj4.value = that.query.number__contains;
obj4.compare = 'contains'; obj4.compare = 'contains';
obj5.field = 'data__分检_操作人';
obj5.value = that.query.handler;
obj5.compare = '';
if(that.query.batch__contains!==''&&that.query.batch__contains!==null){ if(that.query.batch__contains!==''&&that.query.batch__contains!==null){
querys[0].push(obj); querys[0].push(obj);
} }
@ -187,6 +214,9 @@ export default {
if(that.query.number__contains!==''&&that.query.number__contains!==null){ if(that.query.number__contains!==''&&that.query.number__contains!==null){
querys[0].push(obj4); querys[0].push(obj4);
} }
if(that.query.handler!==''&&that.query.handler!==null){
querys[0].push(obj5);
}
that.params.querys = querys; that.params.querys = querys;
this.$refs.table.queryData(that.params); this.$refs.table.queryData(that.params);
}, },

View File

@ -17,6 +17,16 @@
placeholder="结束时间" placeholder="结束时间"
style="margin-left: 2px; width: 150px" style="margin-left: 2px; width: 150px"
/> />
<el-input v-model="query.material_name"
placeholder="产品名称"
clearable
style="width: 200px;"
></el-input>
<el-input v-model="query.batch"
placeholder="批次号"
clearable
style="width: 200px;"
></el-input>
<el-button <el-button
type="primary" type="primary"
icon="el-icon-search" icon="el-icon-search"
@ -226,6 +236,8 @@ export default {
select_cols: "", select_cols: "",
mgroup_name: "扭转", mgroup_name: "扭转",
testmgroup_name: "扭后检测", testmgroup_name: "扭后检测",
material_name: "",
batch: "",
}, },
end_date:'', end_date:'',
start_date:'', start_date:'',
@ -257,6 +269,16 @@ export default {
}else{ }else{
query.end_date = that.query.end_date; query.end_date = that.query.end_date;
} }
if(that.query.material_name==''||that.query.material_name==null){
delete query.material_name;
}else{
query.material_name = that.query.material_name;
}
if(that.query.batch==''||that.query.batch==null){
delete query.batch;
}else{
query.batch = that.query.batch;
}
params.query = query; params.query = query;
if(that.activeName=='product'){ if(that.activeName=='product'){
biStr = 'product_defect_pb_m'; biStr = 'product_defect_pb_m';

View File

@ -20,7 +20,9 @@
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :lg="11"> <el-col :lg="11">
<el-card shadow="never"> <el-card shadow="never">
<div class="chart-scroll" ref="chartScroll">
<div id="bachart1" style="width:100%;height:300px;"></div> <div id="bachart1" style="width:100%;height:300px;"></div>
</div>
</el-card> </el-card>
</el-col> </el-col>
<el-col :lg="13"> <el-col :lg="13">
@ -100,11 +102,15 @@ export default {
text: '', text: '',
}, },
grid: { grid: {
top: '80px' top: '150px'
}, },
tooltip: { tooltip: {
trigger: 'axis' trigger: 'axis'
}, },
legend: {
top: 30,
left: 10,
},
xAxis: { xAxis: {
type: 'category', type: 'category',
data: [] data: []
@ -112,7 +118,6 @@ export default {
yAxis: { yAxis: {
type: 'value' type: 'value'
}, },
lenged: [],
series: [{ series: [{
data: [0, 0, 0, 0, 0, 0, 0], data: [0, 0, 0, 0, 0, 0, 0],
stack: 'Ad', stack: 'Ad',
@ -146,13 +151,11 @@ export default {
that.start_date = year + '-' + month + '-01'; that.start_date = year + '-' + month + '-01';
that.end_date = year + '-' + month + '-' + days; that.end_date = year + '-' + month + '-' + days;
that.queryDate = year + '-' + month; that.queryDate = year + '-' + month;
let duration = that.endWeekNum - that.firstWeekNum + 1; for (let i = that.firstWeekNum; i <= that.endWeekNum; i++) {
for (let i = 1; i <= duration; i++) {
that.xAxisOrigin.push('第' + i + '周'); that.xAxisOrigin.push('第' + i + '周');
} }
that.xAxisData = that.xAxisOrigin; that.xAxisData = that.xAxisOrigin;
let height = document.getElementById('mainDom').clientHeight; let height = document.getElementById('mainDom').clientHeight;
console.log('height',height);
height= height-60; height= height-60;
that.tableHeight = height; that.tableHeight = height;
document.getElementById('bachart1').style.height = height + 'px'; document.getElementById('bachart1').style.height = height + 'px';
@ -170,12 +173,12 @@ export default {
} }
setTimeout(() => { setTimeout(() => {
try { try {
myChart.setOption(option); myChart.clear();
myChart.setOption(option, true);
} catch (error) { } } catch (error) { }
}, 500) }, 500)
}, },
queryTypeChange(value) { queryTypeChange(value) {
console.log(value)
this.queryDate = ''; this.queryDate = '';
}, },
getWeekOfYear(a,b,c) { getWeekOfYear(a,b,c) {
@ -197,19 +200,18 @@ export default {
query: { start_date: that.start_date, end_date: that.end_date, mgroup_name: "混料", is_count_utask: -1 }, query: { start_date: that.start_date, end_date: that.end_date, mgroup_name: "混料", is_count_utask: -1 },
}; };
let option = deepCopy(that.basicOption); let option = deepCopy(that.basicOption);
option.xAxis.data = that.xAxisData;
option.title.text = '混料统计'; option.title.text = '混料统计';
let dateLabels = that.xAxisData;
let exec = that.queryType == '月' ? 'lineWeek' : 'lineMonth'; let exec = that.queryType == '月' ? 'lineWeek' : 'lineMonth';
that.$API.bi.dataset.exec.req(exec, obj).then((res) => { that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
let dataList = res.data2.ds0 ? res.data2.ds0 : []; let dataList = res.data2.ds0 ? res.data2.ds0 : [];
that.dataList = dataList; that.dataList = dataList;
if (dataList.length > 0) { if (dataList.length > 0) {
option.series = []; option.series = [];
let seriesData = [], nameList = []; let nameList = [];
dataList.forEach(ite => { dataList.forEach(ite => {
if (nameList.indexOf(ite.物料名) > -1) { } else { if (nameList.indexOf(ite.物料名) > -1) { } else {
nameList.push(ite.物料名); nameList.push(ite.物料名);
seriesData.push([0,0,0,0,0,0,0,0,0,0,0,0])
let obj = {}; let obj = {};
obj.text = ite.物料名; obj.text = ite.物料名;
obj.value = ite.物料名; obj.value = ite.物料名;
@ -230,11 +232,15 @@ export default {
that.specsFilters.push(obj3); that.specsFilters.push(obj3);
} }
}) })
let seriesData = [];
for (let i = 0; i < dateLabels.length; i++) {
seriesData.push(new Array(modelList.length).fill(0));
}
dataList.forEach(item => { dataList.forEach(item => {
let indexX = 0, indexY = 0; let indexX = 0, indexY = 0;
if (that.queryType == '月') { if (that.queryType == '月') {
indexX = nameList.indexOf(item.物料名); indexX = item. - that.firstWeekNum;
indexY = item. - that.firstWeekNum; indexY = modelList.indexOf(item.型号);
if(dateList.indexOf(item.)>-1){}else{ if(dateList.indexOf(item.)>-1){}else{
dateList.push(item.); dateList.push(item.);
let obj = {}; let obj = {};
@ -244,22 +250,33 @@ export default {
} }
} else { } else {
that.dateFilters = [1,2,3,4,5,6,7,8,9,10,11,12]; that.dateFilters = [1,2,3,4,5,6,7,8,9,10,11,12];
indexX = nameList.indexOf(item.物料名); indexX = item. - 1;
indexY = item. - 1; indexY = modelList.indexOf(item.型号);
} }
if (indexX >= 0 && indexX < seriesData.length && indexY >= 0) {
seriesData[indexX][indexY] += item.合格数; seriesData[indexX][indexY] += item.合格数;
}
}); });
option.xAxis.data = modelList;
for (let n = 0; n < seriesData.length; n++) { for (let n = 0; n < seriesData.length; n++) {
let obj = {}; let obj = {};
obj.name = nameList[n]; obj.name = dateLabels[n];
obj.stack = 'Ad';
obj.type = 'bar'; obj.type = 'bar';
obj.barWidth = '15px'; obj.barWidth = '10px';
obj.data = seriesData[n]; obj.data = seriesData[n];
option.series.push(obj) option.series.push(obj)
} }
let chartDom = document.getElementById('bachart1');
if (chartDom) {
let parentWidth = that.$refs.chartScroll ? that.$refs.chartScroll.clientWidth : chartDom.parentElement.clientWidth;
let needWidth = modelList.length * dateLabels.length * 15;
chartDom.style.width = Math.max(parentWidth, needWidth) + 'px';
let inst = echarts.getInstanceByDom(chartDom);
if (inst) inst.resize();
}
that.setChart("bachart1", option); that.setChart("bachart1", option);
} else { } else {
option.xAxis.data = [];
that.setChart("bachart1", option); that.setChart("bachart1", option);
} }
}); });
@ -361,4 +378,8 @@ export default {
right: 8px; right: 8px;
z-index: 10; z-index: 10;
} }
.chart-scroll {
width: 100%;
overflow-x: auto;
}
</style> </style>

View File

@ -2,7 +2,7 @@
<el-container> <el-container>
<el-header> <el-header>
<div class="right-panel"> <div class="right-panel">
<el-select v-model="queryType" @change="queryTypeChange"> <el-select v-model="queryType" @change="queryTypeChange" style="width: 150px">
<el-option <el-option
v-for="item in typeOptions" v-for="item in typeOptions"
:key="item" :key="item"
@ -17,7 +17,7 @@
type="month" type="month"
placeholder="查询月期" placeholder="查询月期"
value-format="YYYY-MM" value-format="YYYY-MM"
style="width: 100%" style="width: 150px"
> >
</el-date-picker> </el-date-picker>
<el-date-picker <el-date-picker
@ -26,7 +26,7 @@
type="year" type="year"
placeholder="查询年份" placeholder="查询年份"
value-format="YYYY" value-format="YYYY"
style="width: 100%" style="width: 150px"
> >
</el-date-picker> </el-date-picker>
<el-button <el-button
@ -41,7 +41,9 @@
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :lg="12"> <el-col :lg="12">
<el-card shadow="never"> <el-card shadow="never">
<div class="chart-scroll">
<div id="bachart1"></div> <div id="bachart1"></div>
</div>
</el-card> </el-card>
</el-col> </el-col>
<el-col :lg="12"> <el-col :lg="12">
@ -55,7 +57,7 @@
<el-table <el-table
:data="tableData7" :data="tableData7"
id="exportDiv7" id="exportDiv7"
:height="300" :height="500"
:summary-method="getSummaries" :summary-method="getSummaries"
show-summary show-summary
> >
@ -107,7 +109,9 @@
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :lg="12"> <el-col :lg="12">
<el-card shadow="never"> <el-card shadow="never">
<div class="chart-scroll">
<div id="bachart2"></div> <div id="bachart2"></div>
</div>
</el-card> </el-card>
</el-col> </el-col>
<el-col :lg="12"> <el-col :lg="12">
@ -121,7 +125,7 @@
<el-table <el-table
:data="tableData10" :data="tableData10"
id="exportDiv10" id="exportDiv10"
:height="300" :height="500"
:summary-method="getSummaries" :summary-method="getSummaries"
show-summary show-summary
> >
@ -173,7 +177,9 @@
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :lg="12"> <el-col :lg="12">
<el-card shadow="never"> <el-card shadow="never">
<div class="chart-scroll">
<div id="bachart3"></div> <div id="bachart3"></div>
</div>
</el-card> </el-card>
</el-col> </el-col>
<el-col :lg="12"> <el-col :lg="12">
@ -187,7 +193,7 @@
<el-table <el-table
:data="tableData6" :data="tableData6"
id="exportDiv6" id="exportDiv6"
:height="300" :height="500"
:summary-method="getSummaries2" :summary-method="getSummaries2"
show-summary show-summary
> >
@ -278,6 +284,9 @@ export default {
tooltip: { tooltip: {
trigger: "axis", trigger: "axis",
}, },
legend: {
top: 30,
},
xAxis: { xAxis: {
type: "category", type: "category",
data: [], data: [],
@ -285,13 +294,10 @@ export default {
yAxis: { yAxis: {
type: "value", type: "value",
}, },
lenged: [],
series: [ series: [
{ {
data: [0, 0, 0, 0, 0, 0, 0], data: [0, 0, 0, 0, 0, 0, 0],
stack: "Ad",
type: "bar", type: "bar",
barWidth: "15px",
}, },
], ],
}, },
@ -343,8 +349,7 @@ export default {
that.start_date = year + "-" + month + "-01"; that.start_date = year + "-" + month + "-01";
that.end_date =year + "-" + month + "-" + days; that.end_date =year + "-" + month + "-" + days;
that.queryDate = year + "-" + month; that.queryDate = year + "-" + month;
let duration = that.endWeekNum - that.firstWeekNum + 1; for (let i = that.firstWeekNum; i <= that.endWeekNum; i++) {
for (let i = 1; i <= duration; i++) {
that.xAxisOrigin.push("第" + i + "周"); that.xAxisOrigin.push("第" + i + "周");
} }
that.xAxisData = that.xAxisOrigin; that.xAxisData = that.xAxisOrigin;
@ -366,6 +371,7 @@ export default {
} }
setTimeout(() => { setTimeout(() => {
try { try {
myChart.resize();
myChart.setOption(option); myChart.setOption(option);
} catch (error) {} } catch (error) {}
}, 500); }, 500);
@ -391,8 +397,8 @@ export default {
that.modelFilters6 = []; that.modelFilters6 = [];
that.specsFilters6 = []; that.specsFilters6 = [];
let option = deepCopy(that.basicOption); let option = deepCopy(that.basicOption);
option.xAxis.data = that.xAxisData;
option.title.text = "6车间"; option.title.text = "6车间";
let dateLabels = that.xAxisData;
let exec = that.queryType == "月" ? "lineWeek" : "lineMonth"; let exec = that.queryType == "月" ? "lineWeek" : "lineMonth";
let obj = { let obj = {
query: { query: {
@ -406,12 +412,11 @@ export default {
that.tableData6 = tableData6; that.tableData6 = tableData6;
if (tableData6.length > 0) { if (tableData6.length > 0) {
option.series = []; option.series = [];
let seriesData = [],nameList = []; let nameList = [];
tableData6.forEach((ite) => { tableData6.forEach((ite) => {
if (nameList.indexOf(ite.物料名) > -1) { if (nameList.indexOf(ite.物料名) > -1) {
}else { }else {
nameList.push(ite.物料名); nameList.push(ite.物料名);
seriesData.push([]);
let obj = {}; let obj = {};
obj.text = ite.物料名; obj.text = ite.物料名;
obj.value = ite.物料名; obj.value = ite.物料名;
@ -439,15 +444,19 @@ export default {
that.modelFilters6.push(obj4); that.modelFilters6.push(obj4);
} }
}); });
let seriesData = [];
let prodData = [];
for (let i = 0; i < dateLabels.length; i++) {
seriesData.push(new Array(nameList.length).fill(0));
prodData.push(new Array(nameList.length).fill(0));
}
if (that.queryType == "月") { if (that.queryType == "月") {
tableData6.forEach((item) => { tableData6.forEach((item) => {
let indexX = nameList.indexOf(item.物料名); let indexX = item. - that.firstWeekNum;
let indexY = item. - that.firstWeekNum; let indexY = nameList.indexOf(item.物料名);
if(seriesData[indexX][indexY]){ if (indexX >= 0 && indexX < seriesData.length && indexY >= 0) {
seriesData[indexX][indexY] += item.合格数;
}else{
seriesData[indexX][indexY] =0;
seriesData[indexX][indexY] += item.合格数; seriesData[indexX][indexY] += item.合格数;
prodData[indexX][indexY] += Number(item.生产数) || 0;
} }
if(dateList.indexOf(item.)>-1){}else{ if(dateList.indexOf(item.)>-1){}else{
dateList.push(item.); dateList.push(item.);
@ -460,27 +469,105 @@ export default {
} else { } else {
that.dateFilters6 = [1,2,3,4,5,6,7,8,9,10,11,12]; that.dateFilters6 = [1,2,3,4,5,6,7,8,9,10,11,12];
tableData6.forEach((item) => { tableData6.forEach((item) => {
let indexX = nameList.indexOf(item.物料名); let indexX = item. - 1;
let indexY = item.month - 1; let indexY = nameList.indexOf(item.物料名);
if(seriesData[indexX][indexY]){ if (indexX >= 0 && indexX < seriesData.length && indexY >= 0) {
seriesData[indexX][indexY] += item.合格数;
}else{
seriesData[indexX][indexY] =0;
seriesData[indexX][indexY] += item.合格数; seriesData[indexX][indexY] += item.合格数;
prodData[indexX][indexY] += Number(item.生产数) || 0;
} }
}); });
} }
option.xAxis = { type: "category", data: nameList };
option.yAxis = [
{ type: "value" },
{ type: "value", min: -233.33, max: 100, show: false }
];
option.legend = { top: 30, data: dateLabels };
let barWidth = 10;
let barGap = 0;
let chartDom = document.getElementById("bachart3");
if (chartDom) {
chartDom.style.width = (nameList.length * dateLabels.length * 15) + "px";
}
for (let n = 0; n < seriesData.length; n++) { for (let n = 0; n < seriesData.length; n++) {
let obj = {}; let obj = {};
obj.name = nameList[n]; obj.name = dateLabels[n];
obj.stack = "Ad";
obj.type = "bar"; obj.type = "bar";
obj.barWidth = "15px"; obj.barWidth = barWidth;
obj.barGap = "0%";
obj.data = seriesData[n]; obj.data = seriesData[n];
option.series.push(obj); option.series.push(obj);
} }
let totalSeries = seriesData.length;
let curveData = [];
let ratesByMat = [];
for (let mat = 0; mat < nameList.length; mat++) {
let rates = [];
for (let s = 0; s < totalSeries; s++) {
let pass = seriesData[s][mat];
let prod = prodData[s][mat];
rates.push(prod > 0 ? Math.round((pass / prod) * 100) : null);
}
curveData.push({ value: [mat].concat(rates) });
ratesByMat.push(rates);
}
option.tooltip = {
trigger: "axis",
formatter: function (params) {
if (!params || params.length === 0) return "";
let cat = params[0].axisValueLabel;
let matIdx = params[0].dataIndex;
let rates = ratesByMat[matIdx] || [];
let html = '<div style="font-weight:bold">' + cat + '</div>';
let barIdx = 0;
params.forEach(function (p) {
if (p.seriesType !== "bar") return;
let rate = rates[barIdx];
let rateStr = (rate !== null && rate !== undefined) ? rate + "%" : "-";
html += '<div>' +
'<span style="display:inline-block;width:10px;height:10px;background:' + p.color + ';border-radius:50%;margin-right:5px;vertical-align:middle"></span>' +
p.seriesName + ': ' + p.value + ' &nbsp;&nbsp; 合格率 ' + rateStr +
'</div>';
barIdx++;
});
return html;
}
};
option.series.push({
name: "合格率",
type: "custom",
xAxisIndex: 0,
yAxisIndex: 1,
silent: true,
z: 5,
data: curveData,
renderItem: function (params, api) {
let materialIdx = api.value(0);
let centerX = api.coord([materialIdx, 0])[0];
let groupWidth = totalSeries * barWidth + (totalSeries - 1) * barGap;
let halfGroup = groupWidth / 2;
let slotWidth = barWidth + barGap;
let pts = [];
for (let s = 0; s < totalSeries; s++) {
let rate = api.value(s + 1);
if (rate === null || rate === undefined) continue;
let xPx = centerX - halfGroup + barWidth / 2 + s * slotWidth;
let yPx = api.coord([0, rate])[1];
pts.push([xPx, yPx]);
}
if (pts.length < 2) return null;
return {
type: "polyline",
shape: { points: pts, smooth: 0.3 },
style: { stroke: "#333", lineWidth: 1.5, fill: "none" }
};
}
});
that.setChart("bachart3", option); that.setChart("bachart3", option);
} else { } else {
option.xAxis.data = [];
let chartDom = document.getElementById("bachart3");
if (chartDom) chartDom.style.width = "100%";
that.setChart("bachart3", option); that.setChart("bachart3", option);
} }
}); });
@ -500,8 +587,8 @@ export default {
}, },
}; };
let option = deepCopy(that.basicOption); let option = deepCopy(that.basicOption);
option.xAxis.data = that.xAxisData;
option.title.text = "预制棒7车间"; option.title.text = "预制棒7车间";
let dateLabels = that.xAxisData;
let exec = that.queryType == "月" ? "lineWeek" : "lineMonth"; let exec = that.queryType == "月" ? "lineWeek" : "lineMonth";
that.$API.bi.dataset.exec.req(exec, obj).then((res) => { that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
console.log("7生产车间统计:", res); console.log("7生产车间统计:", res);
@ -509,13 +596,11 @@ export default {
that.tableData7 = tableData7; that.tableData7 = tableData7;
if (tableData7.length > 0) { if (tableData7.length > 0) {
option.series = []; option.series = [];
let seriesData = [], let nameList = [];
nameList = [];
tableData7.forEach((ite) => { tableData7.forEach((ite) => {
if (nameList.indexOf(ite.物料名) > -1) { if (nameList.indexOf(ite.物料名) > -1) {
} else { } else {
nameList.push(ite.物料名); nameList.push(ite.物料名);
seriesData.push([]);
let obj = {}; let obj = {};
obj.text = ite.物料名; obj.text = ite.物料名;
obj.value = ite.物料名; obj.value = ite.物料名;
@ -536,12 +621,18 @@ export default {
that.specsFilters7.push(obj3); that.specsFilters7.push(obj3);
} }
}); });
let seriesData = [];
let prodData = [];
for (let i = 0; i < dateLabels.length; i++) {
seriesData.push(new Array(nameList.length).fill(0));
prodData.push(new Array(nameList.length).fill(0));
}
tableData7.forEach((item) => { tableData7.forEach((item) => {
let indexX = 0, let indexX = 0,
indexY = 0; indexY = 0;
if (that.queryType == "月") { if (that.queryType == "月") {
indexX = nameList.indexOf(item.物料名); indexX = item. - that.firstWeekNum;
indexY = item. - that.firstWeekNum; indexY = nameList.indexOf(item.物料名);
if(dateList.indexOf(item.)>-1){}else{ if(dateList.indexOf(item.)>-1){}else{
dateList.push(item.); dateList.push(item.);
let obj = {}; let obj = {};
@ -551,27 +642,105 @@ export default {
} }
} else { } else {
that.dateFilters7 = [1,2,3,4,5,6,7,8,9,10,11,12]; that.dateFilters7 = [1,2,3,4,5,6,7,8,9,10,11,12];
indexX = nameList.indexOf(item.物料名); indexX = item. - 1;
indexY = item. - 1; indexY = nameList.indexOf(item.物料名);
} }
if(seriesData[indexX][indexY]){ if (indexX >= 0 && indexX < seriesData.length && indexY >= 0) {
seriesData[indexX][indexY] += item.合格数;
}else{
seriesData[indexX][indexY] =0;
seriesData[indexX][indexY] += item.合格数; seriesData[indexX][indexY] += item.合格数;
prodData[indexX][indexY] += Number(item.生产数) || 0;
} }
}); });
option.xAxis = { type: "category", data: nameList };
option.yAxis = [
{ type: "value" },
{ type: "value", min: -233.33, max: 100, show: false }
];
option.legend = { top: 30, data: dateLabels };
let barWidth = 10;
let barGap = 0;
let chartDom = document.getElementById("bachart1");
if (chartDom) {
chartDom.style.width = (nameList.length * dateLabels.length * 15) + "px";
}
for (let n = 0; n < seriesData.length; n++) { for (let n = 0; n < seriesData.length; n++) {
let obj = {}; let obj = {};
obj.name = nameList[n]; obj.name = dateLabels[n];
obj.stack = "Ad";
obj.type = "bar"; obj.type = "bar";
obj.barWidth = "15px"; obj.barWidth = barWidth;
obj.barGap = "0%";
obj.data = seriesData[n]; obj.data = seriesData[n];
option.series.push(obj); option.series.push(obj);
} }
let totalSeries = seriesData.length;
let curveData = [];
let ratesByMat = [];
for (let mat = 0; mat < nameList.length; mat++) {
let rates = [];
for (let s = 0; s < totalSeries; s++) {
let pass = seriesData[s][mat];
let prod = prodData[s][mat];
rates.push(prod > 0 ? Math.round((pass / prod) * 100) : null);
}
curveData.push({ value: [mat].concat(rates) });
ratesByMat.push(rates);
}
option.tooltip = {
trigger: "axis",
formatter: function (params) {
if (!params || params.length === 0) return "";
let cat = params[0].axisValueLabel;
let matIdx = params[0].dataIndex;
let rates = ratesByMat[matIdx] || [];
let html = '<div style="font-weight:bold">' + cat + '</div>';
let barIdx = 0;
params.forEach(function (p) {
if (p.seriesType !== "bar") return;
let rate = rates[barIdx];
let rateStr = (rate !== null && rate !== undefined) ? rate + "%" : "-";
html += '<div>' +
'<span style="display:inline-block;width:10px;height:10px;background:' + p.color + ';border-radius:50%;margin-right:5px;vertical-align:middle"></span>' +
p.seriesName + ': ' + p.value + ' &nbsp;&nbsp; 合格率 ' + rateStr +
'</div>';
barIdx++;
});
return html;
}
};
option.series.push({
name: "合格率",
type: "custom",
xAxisIndex: 0,
yAxisIndex: 1,
silent: true,
z: 5,
data: curveData,
renderItem: function (params, api) {
let materialIdx = api.value(0);
let centerX = api.coord([materialIdx, 0])[0];
let groupWidth = totalSeries * barWidth + (totalSeries - 1) * barGap;
let halfGroup = groupWidth / 2;
let slotWidth = barWidth + barGap;
let pts = [];
for (let s = 0; s < totalSeries; s++) {
let rate = api.value(s + 1);
if (rate === null || rate === undefined) continue;
let xPx = centerX - halfGroup + barWidth / 2 + s * slotWidth;
let yPx = api.coord([0, rate])[1];
pts.push([xPx, yPx]);
}
if (pts.length < 2) return null;
return {
type: "polyline",
shape: { points: pts, smooth: 0.3 },
style: { stroke: "#333", lineWidth: 1.5, fill: "none" }
};
}
});
that.setChart("bachart1", option); that.setChart("bachart1", option);
} else { } else {
option.xAxis.data = [];
let chartDom = document.getElementById("bachart1");
if (chartDom) chartDom.style.width = "100%";
that.setChart("bachart1", option); that.setChart("bachart1", option);
} }
}); });
@ -584,8 +753,8 @@ export default {
that.modelFilters = []; that.modelFilters = [];
that.specsFilters = []; that.specsFilters = [];
let option = deepCopy(that.basicOption); let option = deepCopy(that.basicOption);
option.xAxis.data = that.xAxisData;
option.title.text = "预制管10车间"; option.title.text = "预制管10车间";
let dateLabels = that.xAxisData;
let obj = { let obj = {
query: { query: {
start_date: that.start_date, start_date: that.start_date,
@ -599,13 +768,11 @@ export default {
that.tableData10 = tableData10; that.tableData10 = tableData10;
if (tableData10.length > 0) { if (tableData10.length > 0) {
option.series = []; option.series = [];
let seriesData = [], let nameList = [];
nameList = [];
tableData10.forEach((ite) => { tableData10.forEach((ite) => {
if (nameList.indexOf(ite.物料名) > -1) { if (nameList.indexOf(ite.物料名) > -1) {
} else { } else {
nameList.push(ite.物料名); nameList.push(ite.物料名);
seriesData.push([]);
let obj = {}; let obj = {};
obj.text = ite.物料名; obj.text = ite.物料名;
obj.value = ite.物料名; obj.value = ite.物料名;
@ -626,12 +793,18 @@ export default {
that.specsFilters.push(obj3); that.specsFilters.push(obj3);
} }
}); });
let seriesData = [];
let prodData = [];
for (let i = 0; i < dateLabels.length; i++) {
seriesData.push(new Array(nameList.length).fill(0));
prodData.push(new Array(nameList.length).fill(0));
}
tableData10.forEach((item) => { tableData10.forEach((item) => {
let indexX = 0, let indexX = 0,
indexY = 0; indexY = 0;
if (that.queryType == "月") { if (that.queryType == "月") {
indexX = nameList.indexOf(item.物料名); indexX = item. - that.firstWeekNum;
indexY = item. - that.firstWeekNum; indexY = nameList.indexOf(item.物料名);
if(dateList.indexOf(item.)>-1){}else{ if(dateList.indexOf(item.)>-1){}else{
dateList.push(item.); dateList.push(item.);
let obj = {}; let obj = {};
@ -641,27 +814,105 @@ export default {
} }
} else { } else {
that.dateFilters = [1,2,3,4,5,6,7,8,9,10,11,12]; that.dateFilters = [1,2,3,4,5,6,7,8,9,10,11,12];
indexX = nameList.indexOf(item.物料名); indexX = item. - 1;
indexY = item. - 1; indexY = nameList.indexOf(item.物料名);
} }
if(seriesData[indexX][indexY]){ if (indexX >= 0 && indexX < seriesData.length && indexY >= 0) {
seriesData[indexX][indexY] += item.合格数;
}else{
seriesData[indexX][indexY] =0;
seriesData[indexX][indexY] += item.合格数; seriesData[indexX][indexY] += item.合格数;
prodData[indexX][indexY] += Number(item.生产数) || 0;
} }
}); });
option.xAxis = { type: "category", data: nameList };
option.yAxis = [
{ type: "value" },
{ type: "value", min: -233.33, max: 100, show: false }
];
option.legend = { top: 30, data: dateLabels };
let barWidth = 10;
let barGap = 0;
let chartDom = document.getElementById("bachart2");
if (chartDom) {
chartDom.style.width = (nameList.length * dateLabels.length * 15) + "px";
}
for (let n = 0; n < seriesData.length; n++) { for (let n = 0; n < seriesData.length; n++) {
let obj = {}; let obj = {};
obj.name = nameList[n]; obj.name = dateLabels[n];
obj.stack = "Ad";
obj.type = "bar"; obj.type = "bar";
obj.barWidth = "15px"; obj.barWidth = barWidth;
obj.barGap = "0%";
obj.data = seriesData[n]; obj.data = seriesData[n];
option.series.push(obj); option.series.push(obj);
} }
let totalSeries = seriesData.length;
let curveData = [];
let ratesByMat = [];
for (let mat = 0; mat < nameList.length; mat++) {
let rates = [];
for (let s = 0; s < totalSeries; s++) {
let pass = seriesData[s][mat];
let prod = prodData[s][mat];
rates.push(prod > 0 ? Math.round((pass / prod) * 100) : null);
}
curveData.push({ value: [mat].concat(rates) });
ratesByMat.push(rates);
}
option.tooltip = {
trigger: "axis",
formatter: function (params) {
if (!params || params.length === 0) return "";
let cat = params[0].axisValueLabel;
let matIdx = params[0].dataIndex;
let rates = ratesByMat[matIdx] || [];
let html = '<div style="font-weight:bold">' + cat + '</div>';
let barIdx = 0;
params.forEach(function (p) {
if (p.seriesType !== "bar") return;
let rate = rates[barIdx];
let rateStr = (rate !== null && rate !== undefined) ? rate + "%" : "-";
html += '<div>' +
'<span style="display:inline-block;width:10px;height:10px;background:' + p.color + ';border-radius:50%;margin-right:5px;vertical-align:middle"></span>' +
p.seriesName + ': ' + p.value + ' &nbsp;&nbsp; 合格率 ' + rateStr +
'</div>';
barIdx++;
});
return html;
}
};
option.series.push({
name: "合格率",
type: "custom",
xAxisIndex: 0,
yAxisIndex: 1,
silent: true,
z: 5,
data: curveData,
renderItem: function (params, api) {
let materialIdx = api.value(0);
let centerX = api.coord([materialIdx, 0])[0];
let groupWidth = totalSeries * barWidth + (totalSeries - 1) * barGap;
let halfGroup = groupWidth / 2;
let slotWidth = barWidth + barGap;
let pts = [];
for (let s = 0; s < totalSeries; s++) {
let rate = api.value(s + 1);
if (rate === null || rate === undefined) continue;
let xPx = centerX - halfGroup + barWidth / 2 + s * slotWidth;
let yPx = api.coord([0, rate])[1];
pts.push([xPx, yPx]);
}
if (pts.length < 2) return null;
return {
type: "polyline",
shape: { points: pts, smooth: 0.3 },
style: { stroke: "#333", lineWidth: 1.5, fill: "none" }
};
}
});
that.setChart("bachart2", option); that.setChart("bachart2", option);
} else { } else {
option.xAxis.data = [];
let chartDom = document.getElementById("bachart2");
if (chartDom) chartDom.style.width = "100%";
that.setChart("bachart2", option); that.setChart("bachart2", option);
} }
}); });
@ -734,9 +985,8 @@ export default {
that.end_date =that.queryDate +"-" +days; that.end_date =that.queryDate +"-" +days;
that.firstWeekNum = that.getWeekOfYear(year,month,1); that.firstWeekNum = that.getWeekOfYear(year,month,1);
that.endWeekNum = that.getWeekOfYear(year,month,days); that.endWeekNum = that.getWeekOfYear(year,month,days);
let duration = that.endWeekNum - that.firstWeekNum + 1;
let xAxisData = []; let xAxisData = [];
for (let i = 1; i <= duration; i++) { for (let i = that.firstWeekNum; i <= that.endWeekNum; i++) {
xAxisData.push("第" + i + "周"); xAxisData.push("第" + i + "周");
} }
that.xAxisData = xAxisData; that.xAxisData = xAxisData;
@ -828,12 +1078,17 @@ export default {
</script> </script>
<style scoped> <style scoped>
.chart-scroll {
width: 100%;
overflow-x: auto;
}
#bachart1, #bachart1,
#bachart2, #bachart2,
#bachart3, #bachart3,
#bachart4 { #bachart4 {
width: 100%; width: 100%;
height: 300px; min-width: 100%;
height: 500px;
} }
.tables { .tables {
position: absolute; position: absolute;

View File

@ -40,7 +40,9 @@
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :lg="12"> <el-col :lg="12">
<el-card shadow="never"> <el-card shadow="never">
<scEcharts id="bachart1" height="300px" :option="option"></scEcharts> <div class="echarts-scroll">
<scEcharts ref="echarts1" id="bachart1" height="300px" :option="option"></scEcharts>
</div>
</el-card> </el-card>
</el-col> </el-col>
<el-col :lg="12"> <el-col :lg="12">
@ -128,9 +130,21 @@ export default {
type: "category", type: "category",
data: [], data: [],
}, },
yAxis: { yAxis: [
{
type: "value", type: "value",
name: "数量",
}, },
{
type: "value",
name: "合格率",
min: 0,
max: 100,
axisLabel: {
formatter: "{value}%",
},
},
],
series: [], series: [],
}, },
nameFilters: [], nameFilters: [],
@ -189,48 +203,92 @@ export default {
obj.query.order_bys_date = ", 月"; obj.query.order_bys_date = ", 月";
} }
let xAxisData = [],nameData=[],seriesData=[]; let xAxisData = [],nameData=[],seriesData=[];
let colorPalette = ['#5470c6', '#91cc75', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc'];
that.$API.bi.dataset.exec.req("lineWeek", obj).then((res) => { that.$API.bi.dataset.exec.req("lineWeek", obj).then((res) => {
let data = res.data2.ds0; let data = res.data2.ds0;
that.tableData = data; that.tableData = data;
data.forEach((item) => { data.forEach((item) => {
if (xAxisData.indexOf(item.工段) > -1) { if (xAxisData.indexOf(item.工段) === -1) {
} else {
xAxisData.push(item.工段); xAxisData.push(item.工段);
let obj = {}; that.mgroupFilters.push({ text: item.工段, value: item.工段 });
obj.text = item.工段;
obj.value = item.工段;
that.mgroupFilters.push(obj);
} }
if (nameData.indexOf(item.物料名) > -1) { if (nameData.indexOf(item.物料名) === -1) {
} else {
let obj0 = {};
obj0.text = item.物料名;
obj0.value = item.物料名;
that.nameFilters.push(obj0);
nameData.push(item.物料名); nameData.push(item.物料名);
let obj = { that.nameFilters.push({ text: item.物料名, value: item.物料名 });
name:'', }
});
nameData.forEach((materialName, idx) => {
let color = colorPalette[idx % colorPalette.length];
let barData = xAxisData.map((mgroup) => {
let qualified = 0;
data.forEach((item) => {
if (item.工段 === mgroup && item.物料名 === materialName) {
qualified += Number(item.合格数) || 0;
}
});
return qualified;
});
let passRateData = xAxisData.map((mgroup) => {
let qualified = 0;
let produced = 0;
data.forEach((item) => {
if (item.工段 === mgroup && item.物料名 === materialName) {
qualified += Number(item.合格数) || 0;
produced += Number(item.生产数) || 0;
}
});
return produced > 0
? Number(((qualified / produced) * 100).toFixed(2))
: null;
});
seriesData.push({
name: materialName,
type: "bar", type: "bar",
label:{ yAxisIndex: 0,
itemStyle: { color },
label: {
show: true, show: true,
position: "top", position: "top",
formatter: "{c}", formatter: "{c}",
color: "rgb(64,158,255)", color: color,
}, },
barWidth: "15px", barWidth: "15px",
data:[0, 0, 0, 0, 0, 0, 0, 0], data: barData,
}; });
obj.name=item.物料名, seriesData.push({
seriesData.push(obj); name: materialName + " 合格率",
} type: "line",
let index = xAxisData.indexOf(item.工段); yAxisIndex: 1,
let indexY = nameData.indexOf(item.物料名); smooth: true,
seriesData[indexY].data[index] += item.合格数; data: passRateData,
label: {
show: true,
position: "top",
formatter: "{c}%",
color: color,
},
lineStyle: { color },
itemStyle: { color },
});
}); });
that.xAxisData = xAxisData; that.xAxisData = xAxisData;
that.option.xAxis.data = that.xAxisData; that.option.xAxis.data = that.xAxisData;
that.option.series = seriesData; that.option.series = seriesData;
that.$nextTick(() => {
that.resizeChart(xAxisData.length, nameData.length);
}); });
});
},
resizeChart(xCount, materialCount) {
let chartDiv = document.getElementById("bachart1");
if (!chartDiv) return;
let wrapper = chartDiv.parentElement;
let parentWidth = wrapper.clientWidth;
let groupWidth = Math.max(60, materialCount * 25 + 30);
let neededWidth = xCount * groupWidth + 80;
chartDiv.style.width = Math.max(parentWidth, neededWidth) + "px";
let inst = this.$refs.echarts1 && this.$refs.echarts1.myChart;
if (inst) inst.resize();
}, },
handleQuery() { handleQuery() {
if (this.queryDate !== "" && this.queryDate !== null) { if (this.queryDate !== "" && this.queryDate !== null) {
@ -313,4 +371,12 @@ export default {
left: 4px; left: 4px;
z-index: 10; z-index: 10;
} }
.echarts-scroll {
width: 100%;
overflow-x: auto;
overflow-y: hidden;
}
.echarts-scroll > :deep(#bachart1) {
min-width: 100%;
}
</style> </style>

View File

@ -28,7 +28,7 @@
:filter-method="filterModel1" filter-placement="bottom-end" /> :filter-method="filterModel1" filter-placement="bottom-end" />
<el-table-column label="规格" prop="material_specification" :filters="specsFilters1" <el-table-column label="规格" prop="material_specification" :filters="specsFilters1"
:filter-method="filterSpecs1" filter-placement="bottom-end" /> :filter-method="filterSpecs1" filter-placement="bottom-end" />
<el-table-column prop="dept_name" label="完成车间" :filters="deptFilters1" <el-table-column prop="dept_name" label="所在车间/仓库" :filters="deptFilters1"
:filter-method="filterDept1" filter-placement="bottom-end" /> :filter-method="filterDept1" filter-placement="bottom-end" />
<el-table-column label="库存合格品数" prop="count" /> <el-table-column label="库存合格品数" prop="count" />
</scTable> </scTable>

View File

@ -392,7 +392,7 @@
style="width: 100%;height: 500px;" style="width: 100%;height: 500px;"
></check-table> ></check-table>
</el-card> </el-card>
<div style="height: 200px;"></div> <div style="height: 100px;"></div>
<save-dialog <save-dialog
v-if="dialog.save" v-if="dialog.save"
ref="saveDialog" ref="saveDialog"

View File

@ -620,6 +620,13 @@ export default {
that.testitems.push(obj) that.testitems.push(obj)
} }
}) })
res.qct_defects.forEach((item) => {
that.addTemplate[item.defect_name] = false;
let obj = Object.assign({}, item);
obj.canEdit = that.processType=='20'?false:true;
that.qct_defects.push(obj);
})
that.qct_defects_origin = that.qct_defects;
that.getList(); that.getList();
}); });
}, },

View File

@ -22,6 +22,7 @@
<el-button type="primary" v-if="!isSubmit&&processType=='20'" @click="check_start">检验</el-button> <el-button type="primary" v-if="!isSubmit&&processType=='20'" @click="check_start">检验</el-button>
<el-button type="primary" v-if="multipleSet" @click="check_set" style="position: absolute;left: 210px;">批量操作</el-button> <el-button type="primary" v-if="multipleSet" @click="check_set" style="position: absolute;left: 210px;">批量操作</el-button>
<el-input v-if="multipleSet" v-model="wprInputText" @change="wprinputChange" style="width:200px;position: absolute;left: 308px;"></el-input> <el-input v-if="multipleSet" v-model="wprInputText" @change="wprinputChange" style="width:200px;position: absolute;left: 308px;"></el-input>
<el-button v-if="!isSubmit" type="success" @click="digital ">数字识别</el-button>
<div style="width:fit-content;position: absolute;right: 0;display: inline-block;"> <div style="width:fit-content;position: absolute;right: 0;display: inline-block;">
<div style="display: flex;align-items: center;gap: 8px;"> <div style="display: flex;align-items: center;gap: 8px;">
<el-link v-if="test_file!==''" :href="test_file" target="_blank">{{ test_file_name }}</el-linK> <el-link v-if="test_file!==''" :href="test_file" target="_blank">{{ test_file_name }}</el-linK>
@ -51,13 +52,16 @@
<input type="checkbox" class="checkboxInput" v-model="selectedAll" :value="selectedAll" @change="selectAllChange"> <input type="checkbox" class="checkboxInput" v-model="selectedAll" :value="selectedAll" @change="selectAllChange">
</th> </th>
<th class="w_50 sticky-cell sticky-left-index">序号</th> <th class="w_50 sticky-cell sticky-left-index">序号</th>
<th class="w_140 sticky-cell sticky-left-batch" v-show="isColVisible('batch')">物料批次</th> <th class="w_140 sticky-cell sticky-left-batch">物料批次</th>
<th class="w_140 sticky-cell sticky-left-number" v-show="isColVisible('number')">物料编号</th> <th class="w_140 sticky-cell sticky-left-number">物料编号</th>
<th class="w_150" v-if="route_code=='niuzhuan'" v-show="isColVisible('equip')">生产设备</th> <th class="w_150" v-if="route_code=='niuzhuan'" v-show="isColVisible('equip')">生产设备</th>
<th class="w_180" v-if="route_code=='niuzhuan'" v-show="isColVisible('time')">扭转日期</th> <th class="w_180" v-if="route_code=='niuzhuan'" v-show="isColVisible('time')">扭转日期</th>
<th class="w_150" v-if="mgroupName=='喷码'" v-show="isColVisible('tooling')">工装</th> <th class="w_150" v-if="mgroupName=='喷码'" v-show="isColVisible('tooling')">工装</th>
<th class="w_80" v-for="item in qct_testitems" :key="item.id" v-show="isColVisible('testitem_'+item.id)">{{ item.testitem_name }}</th> <th class="w_80" v-for="item in qct_testitems" :key="item.id" v-show="isColVisible('testitem_'+item.id)">{{ item.testitem_name }}</th>
<th class="w_80" v-for="item in qct_defects" :key="item.id" v-show="isColVisible('defect_'+item.id)">{{ item.defect_name }}</th> <th class="w_80" v-for="item in qct_defects" :key="item.id" v-show="isColVisible('defect_'+item.id)">
{{ item.defect_name }}
<span style="color:#f56c6c;">{{ getDefectCount(item.defect_name) }}</span>
</th>
<th class="w_80" v-show="isColVisible('note')">备注</th> <th class="w_80" v-show="isColVisible('note')">备注</th>
<th class="w_150 sticky-cell sticky-right-action" v-if="!isSubmit">操作</th> <th class="w_150 sticky-cell sticky-right-action" v-if="!isSubmit">操作</th>
</tr> </tr>
@ -70,11 +74,11 @@
<td class="w_50 padding_4 sticky-cell sticky-left-index"> <td class="w_50 padding_4 sticky-cell sticky-left-index">
{{ index + 1 }} {{ index + 1 }}
</td> </td>
<td class="w_140 sticky-cell sticky-left-batch" v-show="isColVisible('batch')"> <td class="w_140 sticky-cell sticky-left-batch">
<input v-if="row.isEdit" v-model="row.mlogb__batch" placeholder="物料批次"> <input v-if="row.isEdit" v-model="row.mlogb__batch" placeholder="物料批次">
<span v-else>{{ row.mlogb__batch }}</span> <span v-else>{{ row.mlogb__batch }}</span>
</td> </td>
<td class="w_140 sticky-cell sticky-left-number" v-show="isColVisible('number')"> <td class="w_140 sticky-cell sticky-left-number">
<input v-if="row.isEdit" v-model="row.number" placeholder="物料编号"> <input v-if="row.isEdit" v-model="row.number" placeholder="物料编号">
<span v-else>{{ row.number }}</span> <span v-else>{{ row.number }}</span>
<span v-if="row.wpr_number_out !== null && row.wpr_number_out !== undefined">{{ row.wpr_number_out }}</span> <span v-if="row.wpr_number_out !== null && row.wpr_number_out !== undefined">{{ row.wpr_number_out }}</span>
@ -411,6 +415,9 @@ export default {
wprInputText:"", wprInputText:"",
project_code:"", project_code:"",
test_file_name:"", test_file_name:"",
ocr_ip:"",
ocr_port:"",
ocr_unit:"",
canMultiple:false, canMultiple:false,
selectedAll:false, selectedAll:false,
checkAll: false, checkAll: false,
@ -467,10 +474,7 @@ export default {
watch: {}, watch: {},
computed: { computed: {
allColumnOptions() { allColumnOptions() {
const cols = [ const cols = [];
{ key: 'batch', label: '物料批次' },
{ key: 'number', label: '物料编号' },
];
if (this.route_code === 'niuzhuan') { if (this.route_code === 'niuzhuan') {
cols.push({ key: 'equip', label: '生产设备' }); cols.push({ key: 'equip', label: '生产设备' });
cols.push({ key: 'time', label: '扭转日期' }); cols.push({ key: 'time', label: '扭转日期' });
@ -540,6 +544,9 @@ export default {
},500) },500)
that.actionMenuClickHandler = (event) => that.handleDocumentClick(event); that.actionMenuClickHandler = (event) => that.handleDocumentClick(event);
document.addEventListener("click", that.actionMenuClickHandler, true); document.addEventListener("click", that.actionMenuClickHandler, true);
that.ocr_ip = localStorage.getItem("ocr_ip") || "";
that.ocr_port = localStorage.getItem("ocr_port") || "";
that.ocr_unit = localStorage.getItem("ocr_unit") || "";
}, },
beforeUnmount() { beforeUnmount() {
@ -697,7 +704,6 @@ export default {
}, },
timeChange(row){ timeChange(row){
let that = this; let that = this;
console.log('row',row)
let index = that.mlogbwlist.indexOf(row); let index = that.mlogbwlist.indexOf(row);
if(row.work_start_time!==''&&row.work_start_time!==null&&row.work_start_time!==undefined){ if(row.work_start_time!==''&&row.work_start_time!==null&&row.work_start_time!==undefined){
let waveNum = 1; let waveNum = 1;
@ -1118,6 +1124,93 @@ that.$API.wpm.prints.req(printer_ip, obj).then((response) => {
that.wprNumber = ""; that.wprNumber = "";
that.setVisible=true; that.setVisible=true;
}, },
//numbernumber
digital(){
let that = this;
//number
if(!that.ocr_ip || !that.ocr_port || !that.ocr_unit){
that.$message.warning('请先在右上角"数字识别设置"配置IP、端口号和位号');
return;
}
that.$API.em.equipment.get_svs_char.req({
host: that.ocr_ip,
port: that.ocr_port,
flow_unit: that.ocr_unit
}).then((res) => {
if(res.char){
that.mlogbwlist.forEach((item,index) => {
if(item.number==res.char){
let obj = Object.assign({},item);S
obj.isEdit = true;
that.mlogbwlist.splice(index,1);
that.wprInputText = "";
that.mlogbwlist.unshift(obj);
that.$nextTick(() => {
that.selectedindexes.push(obj.id);
that.selectWprList.push(item);
})
//
//
if(that.qct_testitems.length>0 && !!that.setForm.cd_req_addr){
that.$API.em.cd.req({method:that.setForm.cd_req_addr}).then((res) => {
that.qct_testitems.forEach(item0 => {
if(item0.testitem_cd_expr!=null){
that.mlogbwlist[0][item0.testitem_name]= eval(item0.testitem_cd_expr);
item0.cd_expr = true;
that.qct_defects.forEach(item => {
if(item.rule_expression!==''&&item.rule_expression!==undefined&&item.rule_expression!==null){
let str = item.rule_expression.replace(/`/g, '');
str = str.replace(/\${(.*?)}/g, 'row.\$1');
let judge = false;
try {
judge = eval(str);
that.mlogbwlist[0][item.defect_name] = judge;
}catch (error) {
console.error(error);
}
}else{
that.mlogbwlist[0][item.defect_name] = false;
}
});
}
})
let arrs= that.qct_testitems.filter(item => item.testitem_cd_expr!=null)
if(arrs.length>0){
that.seveAuto(0);
}
}).catch((err) => {
this.$notify.error({
title: '获取数据失败',
message: err.data
})
return err;
});
}
}
})
}
}).catch((err) => {
that.$notify.error({
title: '数字识别获取失败',
message: err.data
})
return err;
});
},
seveAuto(index){
let that= this;
let arr2 = that.mlogbwlist.filter(item => item.cd_expr==true);
if(arr2.length>0){
that.formTableSave(that.mlogbwlist[index],index);
}else{
setTimeout(() => {
that.seveAuto(index);
}, 500);
}
},
// //
wprinputChange(){ wprinputChange(){
let that = this; let that = this;
@ -1155,6 +1248,7 @@ that.$API.wpm.prints.req(printer_ip, obj).then((response) => {
that.qct_testitems.forEach(item0 => { that.qct_testitems.forEach(item0 => {
if(item0.testitem_cd_expr!=null){ if(item0.testitem_cd_expr!=null){
that.mlogbwlist[index][item0.testitem_name]= eval(item0.testitem_cd_expr); that.mlogbwlist[index][item0.testitem_name]= eval(item0.testitem_cd_expr);
that.mlogbwlist[index].cd_expr = true;
that.qct_defects.forEach(item => { that.qct_defects.forEach(item => {
if(item.rule_expression!==''&&item.rule_expression!==undefined&&item.rule_expression!==null){ if(item.rule_expression!==''&&item.rule_expression!==undefined&&item.rule_expression!==null){
let str = item.rule_expression.replace(/`/g, ''); let str = item.rule_expression.replace(/`/g, '');
@ -1172,6 +1266,10 @@ that.$API.wpm.prints.req(printer_ip, obj).then((response) => {
}); });
} }
}) })
let arrs= that.qct_testitems.filter(item => {return item.testitem_cd_expr!=null;})
if(arrs.length>0){
that.seveAuto(index);
}
}).catch((err) => { }).catch((err) => {
this.$notify.error({ this.$notify.error({
title: '获取数据失败', title: '获取数据失败',
@ -1254,7 +1352,6 @@ that.$API.wpm.prints.req(printer_ip, obj).then((response) => {
fullscreen: true, fullscreen: true,
text: "解析中...请稍等", text: "解析中...请稍等",
}); });
console.log(res);
this.$API.wpm.mlog.change.req(that.mlogId,{ test_file: res.path }).then((res) => { this.$API.wpm.mlog.change.req(that.mlogId,{ test_file: res.path }).then((res) => {
loading.close(); loading.close();
this.$message.success("导入成功"); this.$message.success("导入成功");
@ -1264,6 +1361,15 @@ that.$API.wpm.prints.req(printer_ip, obj).then((response) => {
this.$message.error("导入失败,请重新尝试"); this.$message.error("导入失败,请重新尝试");
}); });
}, },
getDefectCount(defectName){
let count = 0;
this.mlogbwlist.forEach(row => {
if(row[defectName]){
count++;
}
});
return count;
},
hasNull(){ hasNull(){
let that = this; let that = this;
let canSubmit = true; let canSubmit = true;

View File

@ -95,6 +95,7 @@
> >
<template #default="scope"> <template #default="scope">
<el-button v-if="mode=='ins'&&mgroupName=='毛坯检测后打码'" @click="QRCode(scope.row)" type="success">二维码</el-button> <el-button v-if="mode=='ins'&&mgroupName=='毛坯检测后打码'" @click="QRCode(scope.row)" type="success">二维码</el-button>
<el-button v-if="mode=='ins'&&mgroupName=='毛坯检测'" @click="sendToMarker(scope.row)" type="success" :loading="!!markerLoadingIds[scope.row.id]" :disabled="!!markerLoadingIds[scope.row.id]">打码</el-button>
<span v-if="mode=='ins'&&mgroupName=='喷码'"></span> <span v-if="mode=='ins'&&mgroupName=='喷码'"></span>
<el-button v-else @click="printMaterial(scope.row)" type="primary">打签</el-button> <el-button v-else @click="printMaterial(scope.row)" type="primary">打签</el-button>
<el-button @click="sendToCoder(scope.row,'coder_jobname','coder_field')" type="success" v-if="mode=='ins'&&mgroupName=='喷码'" :loading="!!coderLoadingIds[scope.row.id]" :disabled="!!coderLoadingIds[scope.row.id]">喷数字码</el-button> <el-button @click="sendToCoder(scope.row,'coder_jobname','coder_field')" type="success" v-if="mode=='ins'&&mgroupName=='喷码'" :loading="!!coderLoadingIds[scope.row.id]" :disabled="!!coderLoadingIds[scope.row.id]">喷数字码</el-button>
@ -182,6 +183,7 @@ export default {
printer_name:localStorage.getItem("printer_name"), printer_name:localStorage.getItem("printer_name"),
apiObjPrint:this.$API.cm.labelmat.fromWm, apiObjPrint:this.$API.cm.labelmat.fromWm,
coderLoadingIds:{}, coderLoadingIds:{},
markerLoadingIds:{},
}; };
}, },
mounted() { mounted() {
@ -480,6 +482,41 @@ export default {
return that.$API.cm.labeltemplate.sendToCoder.req(template.id, body); return that.$API.cm.labeltemplate.sendToCoder.req(template.id, body);
}); });
}, },
//: 1
sendToMarker(row){
let that = this;
if (that.markerLoadingIds[row.id]) return;
let marker_ip = localStorage.getItem('marker_ip') || '';
if (!marker_ip) {
that.$message.error('请先在右上角"打码设置"配置打码IP');
return;
}
let release = () => {
let map = { ...that.markerLoadingIds };
delete map[row.id];
that.markerLoadingIds = map;
};
that.markerLoadingIds = { ...that.markerLoadingIds, [row.id]: true };
let templateName = '打码模板';
that.$API.cm.labeltemplate.list.req({name: templateName, page: 0}).then((res) => {
let list = Array.isArray(res) ? res : (res && res.results) || [];
let template = list.find(t => t.name === templateName);
if (!template) {
that.$message.error(`未找到标签模板: ${templateName}`);
return Promise.reject(new Error('no template'));
}
let body = { tdata_list: [{number: row.number}], coder_ip: marker_ip,coder_port:null };
let marker_port = localStorage.getItem('marker_port') || '';
let marker_jobname = localStorage.getItem('marker_jobname') || '';
if (marker_port) body.coder_port = Number(marker_port);
if (marker_jobname) body.coder_jobname = marker_jobname;
return that.$API.cm.labeltemplate.sendToHanslaser.req(template.id, body);
}).then(() => {
that.$message.success('打码下发成功');
}).catch(e => {
if (e && e.message !== 'no template') that.$message.error('打码下发失败');
}).finally(release);
},
openSplit() { openSplit() {
let that = this; let that = this;
let data = { let data = {

View File

@ -6,8 +6,6 @@
style="width: 90%;" style="width: 90%;"
@closed="$emit('closed')" @closed="$emit('closed')"
> >
<el-container v-loading="loading">
<el-main style="padding: 0">
<el-form <el-form
ref="dialogForm" ref="dialogForm"
:model="form" :model="form"
@ -328,14 +326,12 @@
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
</el-main>
<el-footer> <el-footer>
<el-button type="primary" :loading="isSaveing" @click="submit" <el-button type="primary" :loading="isSaveing" @click="submit"
>保存</el-button >保存</el-button
> >
<el-button @click="visible = false">取消</el-button> <el-button @click="visible = false">取消</el-button>
</el-footer> </el-footer>
</el-container>
</el-dialog> </el-dialog>
</template> </template>

View File

@ -6,8 +6,6 @@
style="width: 80%;" style="width: 80%;"
@closed="$emit('closed')" @closed="$emit('closed')"
> >
<el-container v-loading="loading">
<el-main style="padding: 0 20px 20px 20px">
<el-form <el-form
ref="dialogForm" ref="dialogForm"
:model="form" :model="form"
@ -259,12 +257,10 @@
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
</el-main>
<el-footer> <el-footer>
<el-button type="primary" :loading="isSaveing" @click="submit">保存</el-button> <el-button type="primary" :loading="isSaveing" @click="submit">保存</el-button>
<el-button @click="visible = false">取消</el-button> <el-button @click="visible = false">取消</el-button>
</el-footer> </el-footer>
</el-container>
</el-dialog> </el-dialog>
</template> </template>

View File

@ -6,8 +6,6 @@
destroy-on-close destroy-on-close
@closed="$emit('closed')" @closed="$emit('closed')"
> >
<el-container v-loading="loading">
<el-main style="padding: 0 0 20px 0">
<el-form <el-form
ref="dialogForm" ref="dialogForm"
:model="form" :model="form"
@ -179,12 +177,10 @@
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
</el-main>
<el-footer> <el-footer>
<el-button type="primary" :loading="isSaveing" @click="submit">保存</el-button> <el-button type="primary" :loading="isSaveing" @click="submit">保存</el-button>
<el-button @click="visible = false">取消</el-button> <el-button @click="visible = false">取消</el-button>
</el-footer> </el-footer>
</el-container>
</el-dialog> </el-dialog>
</template> </template>