修改界面

master
夜笙歌 4 years ago
parent bae21ea3e4
commit 86d35e84b8

@ -8,16 +8,16 @@ $(() => {
const INTERVAL = 30000
const request = () => {
const request = async () => {
// 目标
$.post(url + "/selectProductInTarget", {}, data => {
await $.post(url + "/selectProductInTarget", {}, data => {
data = JSON.parse(data)
target.topTips = data.find(val => val.name == "进度目标").qty
Tips('#Tips')
if (isFirst){
isFirst = false
request()
}
targetTop.tips = data.find(val => val.name == "目标").qty
})
// 终检一次不合格率目标
await $.post(url + "/selectOneBadRateMb", {}, data => {
data = JSON.parse(data)
targetBottom.tips = data.rate
})
// LOSS(分类)
$.post(url + "/selectLossInfo", {}, data => {
@ -33,61 +33,52 @@ $(() => {
data = JSON.parse(data)
jp(data.qty)
})
// 终检一次不合格率目标
$.post(url + "/selectOneBadRateMb", {}, data => {
data = JSON.parse(data)
target.bottomTips = data.rate
for (let i = 0; i < 12; i++) {
target.bottom.push(data.rate)
}
})
// 产量
$.post(url + `/selectProductInByTeam/${yieldType}`, {}, data => {
data = JSON.parse(data)
console.log(data)
target.topReality = data.map(val => val.qty).reduce((val1, val2) => val1 + val2, 0)
target.topGap = target.topProgress - target.topReality
if (target.topProgress != 0){
target.topRate = ((target.topReality / target.topProgress).toFixed(4) * 100 + '').substring(0, 5)
}else{
target.topRate = 0
}
Tips('#Tips')
// 实际
targetTop.reality = data.map(val => val.qty).reduce((val1, val2) => val1 + val2, 0)
// 起始时间
let oneTime = parseFloat(data[0].name.split(':')[0])
// 横坐标
let xName = []
if (yieldType == 0) {
let arr = []
for (let i = 0; i < 12; i++) {
arr.push(Math.ceil(target.topTips / 11))
arr.push(Math.ceil(targetTop.tips / 11))
}
arr[3] = Math.ceil(target.topTips / 22)
arr[8] = Math.ceil(target.topTips / 22)
arr[0] = arr[0] - (arr.reduce((val1, val2) => val1 + val2, 0) - target.topTips)
target.top = arr
target.topProgress = arr.slice(0,data.length).reduce((val1, val2) => val1 + val2, 0)
target.topProgress = 399
arr[3] = Math.ceil(targetTop.tips / 22)
arr[8] = Math.ceil(targetTop.tips / 22)
arr[0] = arr[0] - (arr.reduce((val1, val2) => val1 + val2, 0) - targetTop.tips)
targetTop.targetArr = arr
targetTop.progress = arr.slice(0, data.length).reduce((val1, val2) => val1 + val2, 0)
for (let i = 0; i < 12; i++) {
xName.push(`${(oneTime + i) % 24}:30`)
}
} else {
let arr = []
for (let i = 0; i < 24; i++) {
arr.push(Math.ceil(target.topTips / 23))
arr.push(Math.ceil(targetTop.tips / 23))
}
arr[8] = Math.ceil(target.topTips / 46)
arr[13] = Math.ceil(target.topTips / 46)
arr[0] = arr[0] - (arr.reduce((val1, val2) => val1 + val2, 0) - target.topTips)
target.top = arr
target.topProgress = arr.slice(0,data.length).reduce((val1, val2) => val1 + val2, 0)
// target.topProgress = 399
xName = ['0:00','1:00','2:00','3:00','4:00','5:00','6:00','7:00','8:00','9:00','10:00','11:00','12:00','13:00','14:00','15:00','16:00','17:00','18:00','19:00','20:00','21:00','22:00','23:00']
arr[8] = Math.ceil(targetTop.tips / 46)
arr[13] = Math.ceil(targetTop.tips / 46)
arr[0] = arr[0] - (arr.reduce((val1, val2) => val1 + val2, 0) - targetTop.tips)
targetTop.targetArr = arr
targetTop.progress = arr.slice(0, data.length).reduce((val1, val2) => val1 + val2, 0)
xName = ['0:00', '1:00', '2:00', '3:00', '4:00', '5:00', '6:00', '7:00', '8:00', '9:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00', '23:00']
}
// 达成率
if (targetTop.progress != 0) {
targetTop.rate = ((targetTop.reality / targetTop.progress).toFixed(4) * 100 + '').substring(0, 5)
} else {
targetTop.rate = 0
}
targetTop.gap = targetTop.progress - targetTop.reality
barChartAndLineChartThree({
xName: xName,
yDataOne: data.map(val => val.qty),
yDataOneName: "实际产量",
yDataTwo: target.top,
yDataTwo: targetTop.targetArr,
yDataTwoName: "目标产量",
}, document.getElementById("yield"));
})
@ -98,22 +89,29 @@ $(() => {
let oneTime = parseFloat(data[0].name.split(':')[0])
let xName = []
if (yieldType == 0) {
let arr = []
for (let i = 0; i < 12; i++) {
arr.push(targetBottom.tips)
xName.push(`${(oneTime + i) % 24}:30`)
}
targetBottom.targetArr = arr
} else {
xName = ['0:00','1:00','2:00','3:00','4:00','5:00','6:00','7:00','8:00','9:00','10:00','11:00','12:00','13:00','14:00','15:00','16:00','17:00','18:00','19:00','20:00','21:00','22:00','23:00']
let arr = []
for (let i = 0; i < 24; i++) {
arr.push(targetBottom.tips)
}
targetBottom.targetArr = arr
xName = ['0:00', '1:00', '2:00', '3:00', '4:00', '5:00', '6:00', '7:00', '8:00', '9:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00', '23:00']
}
target.bottomReality = (data.map(val => val.rate).reduce((val1, val2) => val1 + val2, 0) / data.map(val => val.rate).length).toFixed(2)
target.bottomTotal = data.map(val => val.qty).reduce((val1, val2) => val1 + val2, 0)
Tips('#Tips')
targetBottom.reality = (data.map(val => val.rate).reduce((val1, val2) => val1 + val2, 0) / data.map(val => val.rate).length).toFixed(4)
targetBottom.total = data.map(val => val.qty).reduce((val1, val2) => val1 + val2, 0)
barChartAndLineChartFour({
xName: xName,
yDataOne: data.map(val => val.qty),
yDataOneName: "不良数",
yDataTwo: data.map(val => val.rate),
yDataTwoName: "一次不合格率",
yDataThree: target.bottom,
yDataThree: targetBottom.targetArr,
yDataThreeName: "目标",
}, document.getElementById("fractionDefective"));
})
@ -121,7 +119,7 @@ $(() => {
//追踪事件轮询
$.post(url + "/selectInStoreOrderInfo", {}, data => {
data = JSON.parse(data)
total('#total',data.map(val => val.actual_number).reduce((val1,val2) => val1 + val2 ,0))
total('#total', data.map(val => val.actual_number).reduce((val1, val2) => val1 + val2, 0))
$('#trackEvents').remove()
$('.trackEventsScrollTable').html('<div class="trackEvents" id="trackEvents"></div>')
dynamicTable({
@ -129,7 +127,7 @@ $(() => {
rowNum: 5,
timeout: 0,
header: ["订单编号", '产品型号', "计划数量", "完成数量", "执行进度", "时间"],
data: data.map(value => [value.plan_code.slice(4, value.plan_code.length), value.name.split('-')[1], value.plan_number, value.actual_number, ((value.actual_number /value.plan_number).toFixed(4) * 100 + '').slice(0,5) + '%', value.day]),
data: data.map(value => [value.plan_code.slice(4, value.plan_code.length), value.name.split('-')[1], value.plan_number, value.actual_number, ((value.actual_number / value.plan_number).toFixed(4) * 100 + '').slice(0, 5) + '%', value.day]),
index: false,
fontColor: '#B4B7BF ',
indexBGC: '#86F3FF',
@ -156,19 +154,40 @@ $(() => {
})
let yieldType = '0'
let isFirst = true
let target = {
top: [],
bottom: [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],
topTips: 0,
bottomTips: 3.05,
topProgress: 0,
topReality: 0,
topGap: 0,
topRate: 0,
bottomReality:0,
bottomTotal:0,
let targetTopRaw = {
targetArr: [],
tips: 0,
progress: 0,
reality: 0,
gap: 0,
rate: 0,
}
let targetBottomRaw = {
targetArr: [],
tips: 0,
reality: 0,
total: 0,
}
const targetTopProxy = {
get: function (target, key) {
return target[key];
},
set: function (target, key, value) {
target[key] = value;
TipsTop('#TipsTop')
}
}
const targetBottomProxy = {
get: function (target, key) {
return target[key];
},
set: function (target, key, value) {
target[key] = value;
TipsBottom('#TipsBottom')
}
}
const targetTop = new Proxy(targetTopRaw, targetTopProxy)
const targetBottom = new Proxy(targetBottomRaw, targetBottomProxy)
const LOSS = (val = 0) => {
const html = `
<span style="position: absolute;top: 15.7%;left: 61.8%;color: #CFD2D0;font-size: 2vw;transform: translateX(-50%)">${val}</span>
@ -195,21 +214,20 @@ const moduleTitle = () => {
$('body').append(html)
}
// 目标
const Tips = (el, top = {
target: target.topTips,
progress: target.topProgress,
reality: target.topReality,
gap: target.topGap,
rate: target.topRate,
}, bottom = {target: target.bottomTips, reality: target.bottomReality, total: target.bottomTotal}) => {
const TipsTop = (el) => {
const html = `
<span style="position: absolute;top: 10%;left: 19%;color: #fff;font-size: 1vw;">目标${top.target}&nbsp;&nbsp;进度目标${top.progress}&nbsp;&nbsp;实际${top.reality}&nbsp;&nbsp;差异${top.gap}&nbsp;&nbsp;达成率${top.rate}% </span>
<span style="position: absolute;top: 54.3%;left: 19%;color: #fff;font-size: 1vw">目标${bottom.target}% &nbsp;&nbsp;&nbsp;实际${bottom.reality}% &nbsp;&nbsp;&nbsp;累计不良数${bottom.total}</span>
<span style="position: absolute;top: 10%;left: 19%;color: #fff;font-size: 1vw;">目标${targetTop.tips}&nbsp;&nbsp;进度目标${targetTop.progress}&nbsp;&nbsp;实际${targetTop.reality}&nbsp;&nbsp;差异${targetTop.gap}&nbsp;&nbsp;达成率${targetTop.rate}% </span>
`
$(el).html(html)
}
const TipsBottom = (el) => {
const html = `
<span style="position: absolute;top: 54.3%;left: 19%;color: #fff;font-size: 1vw">目标${targetBottom.tips}% &nbsp;&nbsp;&nbsp;实际${targetBottom.reality}% &nbsp;&nbsp;&nbsp;累计不良数${targetBottom.total}</span>
`
$(el).html(html)
}
// 入库执行订单合计
const total = (el,val=0) => {
const total = (el, val = 0) => {
const html = `
<span style="position: absolute;top: 54.3%;left: 66.7%;color: #CFD2D0;font-size: 1.0vw">合计${val}</span>
`

@ -53,7 +53,8 @@
</div>
<div id="Tips"></div>
<div id="TipsTop"></div>
<div id="TipsBottom"></div>
<div class="total" id="total"></div>
</body>

Loading…
Cancel
Save