diff --git a/src/api/board/cs2.js b/src/api/board/cs2.js index c59cc56..b6aca0f 100644 --- a/src/api/board/cs2.js +++ b/src/api/board/cs2.js @@ -5,7 +5,10 @@ export function getHourProductionList(query) { return request({ url: '/mes/reportWork/getHourProductionList', method: 'get', - params: query + params: query, + header:{ + PoolName:'ds_999' + } }); } @@ -14,6 +17,9 @@ export function getAgvData(query) { return request({ url: 'http://192.168.202.25:9001/api/scada/agvdata', method: 'get', - params: query + params: query, + header:{ + PoolName:'ds_999' + } }); } diff --git a/src/api/board/cs3.js b/src/api/board/cs3.js index 31b2eae..16a9822 100644 --- a/src/api/board/cs3.js +++ b/src/api/board/cs3.js @@ -16,7 +16,10 @@ export function getHourProductionList(query) { return request({ url: '/mes/reportWork/getHourProductionList', method: 'get', - params: query + params: query, + header:{ + PoolName:'ds_999' + } }); } @@ -24,7 +27,10 @@ export function EnergyExpend(query) { return request({ url: '/mes/h5/EnergyExpend', method: 'get', - params: query + params: query, + header:{ + PoolName:'ds_1000' + } }); } @@ -32,7 +38,10 @@ export function agvdata(query) { return request({ url: 'http://192.168.202.25:9001/api/scada/agvdata', method: 'get', - params: query + params: query, + header:{ + PoolName:'ds_999' + } }); } @@ -40,7 +49,10 @@ export function PlanAchievementRate(query) { return request({ url: '/mes/reportWork/PlanAchievementRate', method: 'get', - params: query + params: query, + header:{ + PoolName:'ds_999' + } }); } @@ -48,7 +60,10 @@ export function getHfChartDatas(query) { return request({ url: '/quality/qcProCheck/getHfChartDatas', method: 'get', - params: query + params: query, + header:{ + PoolName:'ds_999' + } }); } @@ -56,6 +71,9 @@ export function getHourProductionLists(query) { return request({ url: '/mes/reportWork/getHourProductionLists', method: 'get', - params: query + params: query, + header:{ + PoolName:'ds_999' + } }); } diff --git a/src/utils/request.js b/src/utils/request.js index c46b968..8099fad 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -24,8 +24,8 @@ const service = axios.create({ // request拦截器 service.interceptors.request.use(config => { if(localStorage.getItem('USER_POOL_NAME_CURRENT')){ - config.headers['poolName'] = localStorage.getItem('USER_POOL_NAME_CURRENT'); - console.log(localStorage.getItem('USER_POOL_NAME_CURRENT')) + config.headers['poolName'] = config.header?.PoolName || localStorage.getItem('USER_POOL_NAME_CURRENT'); + console.log(config.headers['poolName']) } // 是否需要设置 token const isToken = (config.headers || {}).isToken === false diff --git a/src/views/cs/index2.vue b/src/views/cs/index2.vue index f2b5bc9..e7e430b 100644 --- a/src/views/cs/index2.vue +++ b/src/views/cs/index2.vue @@ -110,6 +110,7 @@ import * as TWEEN from '@tweenjs/tween.js' import {getAgvData, getHourProductionList} from "../../api/board/cs2"; +import {parseTime} from "../../utils/openPlatform"; export default { data() { @@ -341,7 +342,29 @@ export default { }) }, getData() { - getHourProductionList().then(e => { + + let time = parseTime(new Date(), '{h}-{i}').split('-') + let i = parseFloat(time[0]) || 0 + let s = parseFloat(time [1]) || 0 + let createTimeStart = `${parseTime(new Date(), '{y}-{m}-{d}')} 07:30:00` + let createTimeEnd = `${parseTime(new Date(), '{y}-{m}-{d}')} 19:30:00` + if (parseFloat(`${i}.${s}`) > 7.3 && parseFloat(`${i}.${s}`) < 19.3) { + createTimeStart = `${parseTime(new Date(), '{y}-{m}-{d}')} 07:30:00` + createTimeEnd = `${parseTime(new Date(), '{y}-{m}-{d}')} 19:30:00` + } else if (parseFloat(`${i}.${s}`) < 7.3) { + createTimeStart = `${parseTime(new Date(), '{y}-{m}-')}${parseFloat(parseTime(new Date(), '${d}')) - 1} 19:30:00` + createTimeEnd = `${parseTime(new Date(), '{y}-{m}-{d}')} 07:30:00` + } else if (parseFloat(`${i}.${s}`) > 19.3) { + createTimeStart = `${parseTime(new Date(), '{y}-{m}-{d}')} 19:30:00` + createTimeEnd = `${parseTime(new Date(), '{y}-{m}-')}${parseFloat(parseTime(new Date(), '${d}')) + 1} 07:30:00` + } else { + createTimeStart = `${parseTime(new Date(), '{y}-{m}-{d}')} 07:30:00` + createTimeEnd = `${parseTime(new Date(), '{y}-{m}-{d}')} 19:30:00` + } + getHourProductionList({ + productDateStart:createTimeStart, + productDateEnd:createTimeEnd + }).then(e => { let hfArr = [] let equipmentArr = [] for (let i = 0; i < 18; i++) { @@ -360,6 +383,7 @@ export default { this.getAgvLocation() let time = 2 * 1000 setInterval(() => { + this.getData() this.updateAGVLocation(time) }, time) diff --git a/src/views/cs/index3.vue b/src/views/cs/index3.vue index a7106ba..fd32a29 100644 --- a/src/views/cs/index3.vue +++ b/src/views/cs/index3.vue @@ -97,6 +97,7 @@ import { getHourProductionList, getHourProductionLists, PlanAchievementRate } from "../../api/board/cs3"; +import {parseTime} from "../../utils/openPlatform"; export default { components: { @@ -126,9 +127,9 @@ export default { }, mounted() { this.getData() - setInterval(()=>{ + setInterval(() => { this.getData() - },5 * 1000) + }, 5 * 1000) }, methods: { getData() { @@ -150,9 +151,28 @@ export default { this.proData = e.data this.percent = e.msg }) + let time = parseTime(new Date(), '{h}-{i}').split('-') + let i = parseFloat(time[0]) || 0 + let s = parseFloat(time [1]) || 0 + let createTimeStart = `${parseTime(new Date(), '{y}-{m}-{d}')} 07:30:00` + let createTimeEnd = `${parseTime(new Date(), '{y}-{m}-{d}')} 19:30:00` + if (parseFloat(`${i}.${s}`) > 7.3 && parseFloat(`${i}.${s}`) < 19.3) { + createTimeStart = `${parseTime(new Date(), '{y}-{m}-{d}')} 07:30:00` + createTimeEnd = `${parseTime(new Date(), '{y}-{m}-{d}')} 19:30:00` + } else if (parseFloat(`${i}.${s}`) < 7.3) { + createTimeStart = `${parseTime(new Date(), '{y}-{m}-')}${parseFloat(parseTime(new Date(), '${d}')) - 1} 19:30:00` + createTimeEnd = `${parseTime(new Date(), '{y}-{m}-{d}')} 07:30:00` + } else if (parseFloat(`${i}.${s}`) > 19.3) { + createTimeStart = `${parseTime(new Date(), '{y}-{m}-{d}')} 19:30:00` + createTimeEnd = `${parseTime(new Date(), '{y}-{m}-')}${parseFloat(parseTime(new Date(), '${d}')) + 1} 07:30:00` + } else { + createTimeStart = `${parseTime(new Date(), '{y}-{m}-{d}')} 07:30:00` + createTimeEnd = `${parseTime(new Date(), '{y}-{m}-{d}')} 19:30:00` + } + getHfChartDatas({ - createTimeStart: '2024-11-02 00:00:00', - createTimeEnd: '2024-11-04 00:00:00', + createTimeStart: createTimeStart, + createTimeEnd: createTimeEnd, chartType: 'cp' }).then(e => { let option = { @@ -191,15 +211,15 @@ export default { stack: 'total', label: { show: true, - position:'insideRight', - formatter:"{c}车", - color:"#000" + position: 'insideRight', + formatter: "{c}车", + color: "#000" }, emphasis: { focus: 'series' }, itemStyle: { - color:{ + color: { type: 'linear', x: 0, y: 0, @@ -221,7 +241,7 @@ export default { stack: 'total', label: { show: true, - position:'right' + position: 'right' }, emphasis: { focus: 'series' @@ -257,7 +277,7 @@ export default { } }, xAxis: { - data: e.map(v=>v.pdate), + data: e.map(v => v.pdate), axisLine: { show: true, //隐藏X轴轴线 lineStyle: { @@ -319,7 +339,7 @@ export default { // areaStyle: { // color: "rgba(5,140,255, 0.2)", // }, - data: e.map(v=>parseFloat(v.quantity)), + data: e.map(v => parseFloat(v.quantity)), }, ] };