diff --git a/.env.dev b/.env.dev index 326077f..7ad8242 100644 --- a/.env.dev +++ b/.env.dev @@ -1,8 +1,8 @@ ### # @Author: zhp # @Date: 2024-04-28 13:42:51 - # @LastEditTime: 2024-05-22 16:29:35 - # @LastEditors: DY + # @LastEditTime: 2024-05-29 17:06:55 + # @LastEditors: zhp # @Description: ### # 开发环境配置 @@ -12,8 +12,8 @@ ENV = 'development' VUE_APP_TITLE = 芋道管理系统 # 芋道管理系统/开发环境 -# VUE_APP_BASE_API = 'http://192.168.1.70:30307' -VUE_APP_BASE_API = 'http://glass.kszny.picaiba.com' +VUE_APP_BASE_API = 'http://192.168.1.61:48080' +# VUE_APP_BASE_API = 'http://glass.kszny.picaiba.com' # 路由懒加载 VUE_CLI_BABEL_TRANSPILE_MODULES = true diff --git a/src/assets/images/homeindex/info.png b/src/assets/images/homeindex/info.png new file mode 100644 index 0000000..1845b41 Binary files /dev/null and b/src/assets/images/homeindex/info.png differ diff --git a/src/assets/images/homeindex/page-title-two.png b/src/assets/images/homeindex/page-title-two.png new file mode 100644 index 0000000..76a121e Binary files /dev/null and b/src/assets/images/homeindex/page-title-two.png differ diff --git a/src/assets/images/homeindex/page-title.png b/src/assets/images/homeindex/page-title.png new file mode 100644 index 0000000..f2e2024 Binary files /dev/null and b/src/assets/images/homeindex/page-title.png differ diff --git a/src/mixins/chart.js b/src/mixins/chart.js index b356201..0901d53 100644 --- a/src/mixins/chart.js +++ b/src/mixins/chart.js @@ -4,16 +4,16 @@ function __resizeHandler(entries) { console.log(entries) for (const entry of entries) { if (entry.contentBoxSize) { - // const contentBoxSize = Array.isArray(entry.contentBoxSize) - // ? entry.contentBoxSize[0] - // : entry.contentBoxSize; - // this.chart_mixin_chartInstance.resize({ - // width: - // contentBoxSize.inlineSize < this.MIN_WIDTH - // ? this.MIN_WIDTH - // : contentBoxSize.inlineSize, - // height: contentBoxSize.blockSize, - // }); + const contentBoxSize = Array.isArray(entry.contentBoxSize) + ? entry.contentBoxSize[0] + : entry.contentBoxSize; + this.chart_mixin_chartInstance.resize({ + width: + contentBoxSize.inlineSize < this.MIN_WIDTH + ? this.MIN_WIDTH + : contentBoxSize.inlineSize, + height: contentBoxSize.blockSize, + }); } else { // manipulate contentRect this.chart_mixin_chartInstance.resize({ diff --git a/src/store/modules/home.js b/src/store/modules/home.js index 4c278cd..d1171c0 100644 --- a/src/store/modules/home.js +++ b/src/store/modules/home.js @@ -1,4 +1,3 @@ - import axios from "@/utils/request"; import { deepClone } from "../../utils"; @@ -25,10 +24,12 @@ const state = { chipOee: { current: [], previous: [], + target:[] }, transformRate: { current: [], previous: [], + target:[] }, chipRate: { target: [], @@ -39,6 +40,7 @@ const state = { stdRate: { target: [], current: [], + previous: [], outputNumber:[] }, }, @@ -77,7 +79,7 @@ const mutations = { state.copilot.energy.elecList = payload.elecList; break; case "efficiency": - state.copilot.efficiency.chipOee = payload.chipOee; + state.copilot.efficiency.chipOeeRate = payload.chipOeeRate; state.copilot.efficiency.transformRate = payload.transformRate; state.copilot.efficiency.chipRate = payload.chipRate; state.copilot.efficiency.stdRate = payload.stdRate; @@ -97,7 +99,7 @@ const actions = { commit("SET_HOME_INFO", payload); }, /** 初始化驾驶舱数据 */ - async initCopilot({ commit }, { period, source }) { + async initCopilot({ commit }, { period,source,than}) { // if (source == "energy") return; const fetcher = { @@ -111,25 +113,27 @@ const actions = { efficiency: splitCurrentAndPreviousA, }[source] // 获取产量数据 - let { data: factoryList, type } = await fetcher(period) - let targetList = null; - if (source === "yield" || source === "efficiency") { - // 获取目标数据 - let { data } = await fetcher(period, true) - targetList = data - } - if (source == "energy") { - let factoryData = factoryList - const payload = handler(factoryData) - commit("SET_COPILOT_INFO", { type, payload }); - } else { + let { data: factoryList, type } = await fetcher(period,than) + // let targetList = null; + // if (source === "yield" || source === "efficiency") { + // // 获取目标数据 + // let { data } = await fetcher(period,than, true) + // targetList = data + // } + // if (source == "energy") { + // let factoryData = factoryList + // const payload = handler(factoryData) + // commit("SET_COPILOT_INFO", { type, payload }); + // } else { let factoryData = factoryList.prodOutputOutDO ? factoryList.prodOutputOutDO : factoryList.prodOutputRateDO + let preData = factoryList.previousProdOutputOutDO ? factoryList.previousProdOutputOutDO : factoryList.previousProdOutputRateDO + let preFtoData = factoryList.previousProdOutputFtoDO ? factoryList.previousProdOutputFtoDO : [] let prodOutputFtoDO = factoryList.prodOutputFtoDO ? factoryList.prodOutputFtoDO : [] - let targetData = targetList.prodTargetDO ? targetList.prodTargetDO : targetList.prodTargetDO - const payload = handler(factoryData, targetData,prodOutputFtoDO) + let targetData = factoryList.prodTargetOutputDO ? factoryList.prodTargetOutputDO : factoryList.prodTargetRateDO + const payload = handler(factoryData,targetData,prodOutputFtoDO,preData,preFtoData) commit("SET_COPILOT_INFO", { type, payload }); - } + // } }, }; @@ -281,11 +285,11 @@ function splitCurrentAndPreviousB(factoryListResponse) { } } -function splitCurrentAndPreviousA(factoryListResponse, targetListResponse) { - // console.log('工厂',factoryListResponse); +function splitCurrentAndPreviousA(factoryListResponse, targetListResponse, prodOutputFtoListRes,preData,preFtoData) { + console.log('工厂',targetListResponse); // 初始数据 - const { chipOee, transformRate, chipRate, stdRate } = initA(); + const { chipOeeRate, transformRate, chipRate, stdRate } = initA(); // factoryListResponse = [ // { // factory: 0, @@ -336,6 +340,23 @@ function splitCurrentAndPreviousA(factoryListResponse, targetListResponse) { // componentYieldRate: 0.73, // }, // ]; + if (preData && preData[0] != null) { + for (const factory of preData) { + const fId = getPreFactoryId(factory); + chipInvest.previous[fId] = factory.previousYearInputNumber; + // chipOeeRate.current[fId] = factory.oee; + chipOeeRate.previous[fId] = factory.previousYearOee; + // 转化效率 + transformRate.previous[fId] =factory.previousYearComponentConversionEfficiency ; + // 芯片良率 与 标准组件良率 + if (![0, 1].includes(factory.glassType)) continue; + const _t = [chipRate, stdRate][factory.glassType] + // _t.current[fId] = factory.yieldRate ; + _t.previous[fId] = factory.previousYearYieldRate ; + // } + // debugger; + } + } if (factoryListResponse) { for (const factory of factoryListResponse) { const fId = getFactoryId(factory); @@ -347,27 +368,27 @@ function splitCurrentAndPreviousA(factoryListResponse, targetListResponse) { chipOee, componentConversionEfficiency, componentYield - } = getFactoryTargetValueA(targetListResponse, fId); + } = getFactoryTargetValueA(targetListResponse, fId) stdRate.target[fId] = componentYieldRate chipRate.target[fId] = chipYieldRate + chipOeeRate.target[fId] = chipOee + transformRate.target[fId] = componentConversionEfficiency } // 芯片OEE - chipOee.current[fId] = factory.oee * 100 ; - chipOee.previous[fId] = factory.previousYearOee * 100 ; + chipOeeRate.current[fId] = factory.oee; + // chipOeeRate.previous[fId] = factory.previousYearOee; // 转化效率 - transformRate.current[fId] = - factory.componentConversionEfficiency * 100 ; - transformRate.previous[fId] = - factory.previousYearComponentConversionEfficiency * 100 ; + transformRate.current[fId] = factory.componentConversionEfficiency; + // transformRate.previous[fId] = factory.previousYearComponentConversionEfficiency ; // 芯片良率 与 标准组件良率 if (![0, 1].includes(factory.glassType)) continue; const _t = [chipRate, stdRate][factory.glassType] _t.current[fId] = factory.yieldRate ; - _t.previous[fId] = factory.previousYearYieldRate ; + // _t.previous[fId] = factory.previousYearYieldRate ; } - + // console.log('chipOeeRate',chipOeeRate); return { - chipOee, + chipOeeRate, transformRate, chipRate, stdRate, @@ -375,21 +396,57 @@ function splitCurrentAndPreviousA(factoryListResponse, targetListResponse) { } } -function splitCurrentAndPrevious(factoryListResponse, targetListResponse, prodOutputFtoListRes) { - console.log('prodOutputFtoListRes',prodOutputFtoListRes); +function splitCurrentAndPrevious(factoryListResponse, targetListResponse, prodOutputFtoListRes,preData,preFtoData) { + console.log('prodOutputFtoListRes',preData); // 初始数据 const { chipInvest, ftoInvest, chipOutput, stdOutput, bipvOutput } = init() if (prodOutputFtoListRes) { for (const factory of prodOutputFtoListRes) { console.log(factory); const fId = getFactoryId(factory); + // const preFId = getPreFactoryId(factory); + // if (fId) { ftoInvest.current[fId] = factory.chipInput; + // } + // if (preFId) { + // ftoInvest.previous[fId] = factory.previousYearChipInput; + // } + } + } + if (preFtoData) { + for (const factory of preFtoData) { + console.log(factory); + const fId = getPreFactoryId(factory); + // const preFId = getPreFactoryId(factory); + // if (fId) { ftoInvest.previous[fId] = factory.previousYearChipInput; + // } + // if (preFId) { + // ftoInvest.previous[fId] = factory.previousYearChipInput; + // } + } + } + if (preData && preData[0] != null) { + for (const factory of preData) { + const fId = getPreFactoryId(factory); + chipInvest.previous[fId] = factory.previousYearInputNumber; + if (![0, 1, 2].includes(factory.previousGlassType)) continue; + const _t = [chipOutput, stdOutput, bipvOutput][factory.previousGlassType]; + // if (fId) { + // _t.current[fId] = factory.outputNumber; + // } + // if (preFId) { + _t.previous[fId] = factory.previousYearOutputNumber + // } + // debugger; } } - if (factoryListResponse) { + // console.log('ftoInvest',ftoInvest) + if (factoryListResponse && factoryListResponse[0] != null) { for (const factory of factoryListResponse) { const fId = getFactoryId(factory); + // const preFId = getPreFactoryId(factory); + // 获取目标值 if (targetListResponse) { const { chipYield, componentYield, bipvProductOutput } = @@ -399,23 +456,14 @@ function splitCurrentAndPrevious(factoryListResponse, targetListResponse, prodOu bipvOutput.target[fId] = bipvProductOutput; } // 芯片投入 - chipInvest.current[fId] = factory.inputNumber; - chipInvest.previous[fId] = factory.previousYearInputNumber; - // FTO投入 - // if (factory.chipInput || factory.previousYearChipInput) { - // ftoInvest.current[fId] = factory.chipInput; - // ftoInvest.previous[fId] = factory.previousYearChipInput; - // } + chipInvest.current[fId] = factory.inputNumber; // 产出数据, 0 - (玻璃)芯片产出, 1 - 标准组件产出, 2 - BIPV产出 // 因为后端写的垃圾数据,所以这里要做一下判断 if (![0, 1, 2].includes(factory.glassType)) continue; const _t = [chipOutput, stdOutput, bipvOutput][factory.glassType]; - _t.current[fId] = factory.outputNumber; - _t.previous[fId] = factory.previousYearOutputNumber; - // debugger; + _t.current[fId] = factory.outputNumber; } - return { chipInvest, // ftoInvest, @@ -424,27 +472,39 @@ function splitCurrentAndPrevious(factoryListResponse, targetListResponse, prodOu stdOutput, bipvOutput, }; + }else{ + return { + chipInvest, + // ftoInvest, + ftoInvest, + chipOutput, + stdOutput, + bipvOutput, + } } } function getFactoryId(factory) { return factory.factory; } +function getPreFactoryId(factory) { + return factory.previousFactory; +} function getFactoryTargetValue(targetList, factoryId) { const target = targetList.find((item) => item.factory === factoryId); if (target) { return { // 自带模拟数据了.... random_default - chipYield: target.chipYield ?? random_default(), - componentYield: target.componentYield ?? random_default(), - bipvProductOutput: target.bipvProductOutput ?? random_default(), + chipYield: target.chipYield ?? 0, + componentYield: target.componentYield ?? 0, + bipvProductOutput: target.bipvProductOutput ?? 0, }; } return { - chipYield: random_default(), - componentYield: random_default(), - bipvProductOutput: random_default(), + chipYield: 0, + componentYield: 0, + bipvProductOutput: 0, }; } @@ -458,15 +518,18 @@ function getFactoryTargetValueA(targetList, factoryId) { const target = targetList.find((item) => item.factory === factoryId) if (target) { return { - chipYieldRate: target.chipYieldRate ?? random_default(), - componentYieldRate: target.componentYieldRate ?? random_default(), - componentYield: target.componentYield ?? random_default(), + chipYieldRate: target.chipYieldRate ?? 0, + componentYieldRate: target.componentYieldRate ?? 0, + componentYield: target.componentYield ?? 0, + // componentYield: target.componentYield ?? 0, + chipOee: target.chipOee ?? 0, }; } return { chipYieldRate:0, componentYieldRate:0, - componentYield:0 , + componentYield: 0, + chipOee:0, }; } @@ -480,18 +543,18 @@ function initA() { previous: Array(7).fill(0), }; // 芯片OEE - const chipOee = deepClone(t_); // 转化效率 - const transformRate = deepClone(t_); // 标准组件良率 const stdRate = { ...deepClone(t_), target: Array(7).fill(0), }; // 芯片良率 + const transformRate = deepClone(stdRate); const chipRate = deepClone(stdRate); + const chipOeeRate = deepClone(stdRate); return { - chipOee, + chipOeeRate, transformRate, chipRate, stdRate, @@ -544,6 +607,7 @@ async function getHomeInfo() { const { code, data } = await axios.post("ip/prod-output/cockpitData", { factorys: [], date: 4, + mode:0 }); if (code == 0) { return data; @@ -609,16 +673,16 @@ async function doFetch(copilot_module = "yield", fetch_target, params) { * @param {*} target 是否获取目标数据 * @returns */ -function getCopilotYield(period, target = false) { - return getCopilotData("yield", period, target); +function getCopilotYield(period,than,target = false) { + return getCopilotData("yield", period,than, target); } function getCopilotEnergy(period, target = false) { - return getCopilotData("energy", period, target); + return getCopilotData("energy", period,than, target); } -function getCopilotEfficiency(period, target = false) { - return getCopilotData("efficiency", period, target); +function getCopilotEfficiency(period,than, target = false) { + return getCopilotData("efficiency", period,than, target); } /** @@ -627,12 +691,13 @@ function getCopilotEfficiency(period, target = false) { * @param {*} target 是否获取目标数据:默认 否 * @returns */ -async function getCopilotData(copilot_module, period, target = false) { +async function getCopilotData(copilot_module, period,than, target = false) { if (!copilot_module) copilot_module = "yield"; // 请求参数,直接一次性获取所有工厂 let queryParams = { factorys: [], date: 4, + mode:0 }; switch (period) { @@ -652,7 +717,14 @@ async function getCopilotData(copilot_module, period, target = false) { queryParams.date = 1; break; } - + switch (than) { + case "同比": + queryParams.mode = 0; + break; + case "环比": + queryParams.mode = 1; + break; + } return { data: await doFetch(copilot_module, target ? true : false, queryParams), type: copilot_module, diff --git a/src/views/copilot/components/BarChartBase.vue b/src/views/copilot/components/BarChartBase.vue index 8be1bdc..c70d1bf 100644 --- a/src/views/copilot/components/BarChartBase.vue +++ b/src/views/copilot/components/BarChartBase.vue @@ -11,7 +11,7 @@ {{ item.label }} -
+
@@ -51,7 +51,7 @@ export default { }, data() { return { - width: '', + width: '100%', isFullscreen: false, actualOptions: null, options: { @@ -184,16 +184,7 @@ export default { /** 全屏状态切换时,对柱子粗细和字体大小进行相应调整 */ isOpen(val) { // console.log(val) - if (val === true) { - console.log('ztl') - this.width = 95 + '%' - this.canvasReset() - - console.log(this.width) - } else { - this.watch = 100 + '%' - this.canvasReset() - } + this.canvasReset() }, isFullscreen(val) { this.actualOptions.series.map((item) => { @@ -203,21 +194,14 @@ export default { this.actualOptions.yAxis.axisLabel.fontSize = val ? 18 : 12; this.actualOptions.yAxis.nameTextStyle.fontSize = val ? 18 : 12; this.initChart(this.actualOptions); - if (val === false && this.isOpen === true) { - console.log(val) - this.width = 97 + '%' - this.canvasReset() - } else if (val === false && this.isOpen === false) { - this.watch = 100 + '%' - this.canvasReset() - } // this.actualOptions.series.map((item) => { // item.barWidth = val ? 18 : 12; // }); // this.actualOptions.xAxis.axisLabel.fontSize = val ? 18 : 12; // this.actualOptions.yAxis.axisLabel.fontSize = val ? 18 : 12; // this.actualOptions.yAxis.nameTextStyle.fontSize = val ? 18 : 12; - this.initChart(this.actualOptions); + // this.initChart(this.actualOptions); + this.canvasReset() }, series(val) { if (!val) { diff --git a/src/views/copilot/components/CopilotHeader.vue b/src/views/copilot/components/CopilotHeader.vue index 659a686..7752828 100644 --- a/src/views/copilot/components/CopilotHeader.vue +++ b/src/views/copilot/components/CopilotHeader.vue @@ -8,33 +8,23 @@ @@ -52,14 +42,61 @@ export default { period: { type: String, }, + than: { + type: String, + }, }, data() { return { + times:'', isFullscreen: false, }; }, + mounted () { + this.getTimes() + this.getTimesInterval(); + }, computed: {}, methods: { + getTimes() { + setInterval(this.getTimesInterval, 60000); + }, + getTimesInterval() { + var now = new Date(); + var weekDay = now.getDay(); + var weeks = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"); + var week = weeks[weekDay] + let _this = this; + let year = new Date().getFullYear(); //获取当前时间的年份 + let month = new Date().getMonth() + 1; //获取当前时间的月份 + let day = new Date().getDate(); //获取当前时间的天数 + let hours = new Date().getHours(); //获取当前时间的小时 + let minutes = new Date().getMinutes(); //获取当前时间的分数 + // let seconds = new Date().getSeconds(); //获取当前时间的秒数 + //当小于 10 的是时候,在前面加 0 + if (hours < 10) { + hours = '0' + hours; + } + if (minutes < 10) { + minutes = '0' + minutes; + } + // if (seconds < 10) { + // seconds = '0' + seconds; + // } + //拼接格式化当前时间 + this.times = + + year + + '.' + + month + + '.' + + day + + " " + hours + + '.' + + minutes + + '.' + + week + }, toggleFullScreen() { this.isFullscreen = !this.isFullscreen; screenfull.toggle(document.querySelector(".copilot-layout")) @@ -82,10 +119,11 @@ export default { display: flex; gap: 12px; align-items: center; + justify-content: space-between; } .copilot-header > section { - width: 24vw; + width: 26vw; display: flex; align-items: center; gap: 8px; @@ -99,6 +137,17 @@ export default { cursor: pointer; } +.times-btn { + width: 240px; + height: 32px; + margin-left: 24px; + cursor: pointer; + color: white; + font-size: 20px; + line-height: 30px; + float: right; + /* margin-bottom: 20px; */ +} .export-btn { background: url(../../../assets/images/export-icon.png) 0 0 / 100% 100% no-repeat; @@ -112,15 +161,27 @@ export default { background: url(../../../assets/images/homeindex/exit-fullscreen.png) 0 0 / 100% 100% no-repeat; } - + .type-name { + /* content: ""; */ + display: inline-block; + width: 1px; + height: 59px; + border: 1px solid; + opacity: 0.9; + border-image: linear-gradient(180deg, rgba(0, 176, 243, 0), rgba(88, 194, 255, 1), rgba(0, 120, 228, 0)) 2 2; + /* position: absolute; */ + /* left: 0; */ + /* top: 10px; */ + } .page-title { - flex: 1; + width: 25vw; font-size: 54px; line-height: 70px; letter-spacing: 5px; font-family: 优设标题黑; color: #6db6ff; - text-align: right; + text-align: center; user-select: none; + background: url(../../../assets/images/homeindex/page-title.png) 0 0 / 100% 100% no-repeat; } diff --git a/src/views/copilot/components/FactoryDataHeader.vue b/src/views/copilot/components/FactoryDataHeader.vue index bab2967..4d477d9 100644 --- a/src/views/copilot/components/FactoryDataHeader.vue +++ b/src/views/copilot/components/FactoryDataHeader.vue @@ -1,39 +1,30 @@ + + diff --git a/src/views/copilot/components/gasBarChartBase.vue b/src/views/copilot/components/gasBarChartBase.vue index b9ec720..99a2771 100644 --- a/src/views/copilot/components/gasBarChartBase.vue +++ b/src/views/copilot/components/gasBarChartBase.vue @@ -1,7 +1,7 @@ @@ -191,7 +191,7 @@ export default { console.log(this.width) } else { console.log('ryf') - this.watch = 100 + '%' + this.width = 100 + '%' this.canvasReset() } }, @@ -201,7 +201,7 @@ export default { this.width = 97 + '%' this.canvasReset() } else if (val === false && this.isOpen === false) { - this.watch = 100 + '%' + this.width = 100 + '%' this.canvasReset() } // this.actualOptions.series.map((item) => { diff --git a/src/views/copilot/container.vue b/src/views/copilot/container.vue index 3a17b4a..9441df5 100644 --- a/src/views/copilot/container.vue +++ b/src/views/copilot/container.vue @@ -1,4 +1,3 @@ - -
- +
+ - - - + + +
@@ -21,24 +21,55 @@ diff --git a/src/views/copilot/efficiency/components/sub/chip/ChipRateItem.vue b/src/views/copilot/efficiency/components/sub/chip/ChipRateItem.vue index f4b1592..edbd12a 100644 --- a/src/views/copilot/efficiency/components/sub/chip/ChipRateItem.vue +++ b/src/views/copilot/efficiency/components/sub/chip/ChipRateItem.vue @@ -13,7 +13,7 @@
-
+
{{ lgd.value }} {{ lgd.label }} @@ -46,6 +46,10 @@ export default { type: String, default: "日", }, + than: { + type: String, + default: '同比', + } }, data() { return { @@ -103,21 +107,72 @@ export default { return t; }, legend() { - const year = new Date().getFullYear(); + let items = []; + var day1 = new Date(); + day1.setTime(day1.getTime() - 24 * 60 * 60 * 1000); + var yesterday = (day1.getMonth() + 1) + "月" + day1.getDate() + //今天的时间 + // var day2 = new Date(); + // day2.setTime(day2.getTime()); + // var s2 = (day2.getMonth() + 1) + "月" + day2.getDate() + '日'; + const today = new Date().getDate(); + // let yesterday = new Date().getDate() -1; const month = new Date().getMonth() + 1; - return [ - { - label: - this.period == "月" - ? `${year - 1}年${month}月良率` - : `${year - 1}年良率`, - value: isNaN((this.valueTuple[0] * 100).toFixed(0)) ? 0 + "%" : (this.valueTuple[0] * 100).toFixed(0) + "%" - }, - { - label: this.period == "月" ? `${month}月良率` : `${year}年良率`, - value: isNaN((this.valueTuple[1] * 100).toFixed(0)) ? 0 + "%" : (this.valueTuple[1] * 100).toFixed(0) + "%" - }, - ]; + const lastMonth = new Date().getMonth() + 1 === 12 ? 1 : new Date().getMonth() + 1 - 1; + const year = new Date().getFullYear(); + if (this.period === '日' && this.than === '同比') { + items = [ + { label: `${month}月${today}日良率`, value: isNaN(this.valueTuple[1]) || this.valueTuple[1] == null ? 0 + "%" : (this.valueTuple[1]) + "%" }, + { label: `去年${month}月${today}日良率`, value: isNaN(this.valueTuple[0]) || this.valueTuple[0] == null ? 0 + "%" : (this.valueTuple[0]) + "%" }, + ]; + } else if (this.period === '日' && this.than === '环比') { + items = [ + { label: `${month}月${today}日良率`, value: isNaN(this.valueTuple[1]) || this.valueTuple[1] == null ? 0 + "%" : (this.valueTuple[1]) + "%" }, + { label: `${yesterday}日良率`, value: isNaN(this.valueTuple[0]) || this.valueTuple[0] == null ? 0 + "%" : (this.valueTuple[0]) + "%" }, + ]; + } else if (this.period === '周' && this.than === '同比') { + items = [ + { label: `本周良率`, value: isNaN(this.valueTuple[1]) || this.valueTuple[1] == null ? 0 + "%" : (this.valueTuple[1]) + "%" }, + { label: `去年本周良率`, value: isNaN(this.valueTuple[0]) || this.valueTuple[0] == null ? 0 + "%" : (this.valueTuple[0]) + "%" }, + ]; + } else if (this.period === '周' && this.than === '环比') { + items = [ + { label: `本周良率`, value: isNaN(this.valueTuple[1]) || this.valueTuple[1] == null ? 0 + "%" : (this.valueTuple[1]) + "%" }, + { label: `上周良率`, value: isNaN(this.valueTuple[0]) || this.valueTuple[0] == null ? 0 + "%" : (this.valueTuple[0]) + "%" }, + ]; + } else if (this.period === '月' && this.than === '同比') { + items = [ + { label: `${month}月良率`, value: isNaN(this.valueTuple[1]) || this.valueTuple[1] == null ? 0 + "%" : (this.valueTuple[1]) + "%" }, + { label: `去年${month}月良率`, value: isNaN(this.valueTuple[0]) || this.valueTuple[0] == null ? 0 + "%" : (this.valueTuple[0]) + "%" }, + { label: `${month}月目标良率`, value: isNaN(this.valueTuple[2]) || this.valueTuple[2] == null ? 0 + "%" : (this.valueTuple[2]) + "%" }, + ]; + } else if (this.period === '月' && this.than === '环比') { + items = [ + { label: `${month}月良率`, value: isNaN(this.valueTuple[1]) || this.valueTuple[1] == null ? 0 + "%" : (this.valueTuple[1]) + "%" }, + { label: `${lastMonth}月良率`, value: isNaN(this.valueTuple[0]) || this.valueTuple[0] == null ? 0 + "%" : (this.valueTuple[0]) + "%" }, + { label: `${month}月目标良率`, value: isNaN(this.valueTuple[2]) || this.valueTuple[2] == null ? 0 + "%" : (this.valueTuple[2]) + "%" }, + ]; + } else { + items = [ + { label: `${year}年良率`, value: isNaN(this.valueTuple[1]) || this.valueTuple[1] == null ? 0 + "%" : (this.valueTuple[1]) + "%" }, + { label: `${year - 1}年良率`, value: isNaN(this.valueTuple[0]) || this.valueTuple[0] == null ? 0 + "%" : (this.valueTuple[0]) + "%" }, + { label: `${year}年目标良率`, value: isNaN(this.valueTuple[2]) || this.valueTuple[2] == null ? 0 + "%" : (this.valueTuple[2]) + "%" }, + ]; + } + return items + // [ + // { + // label: + // this.period == "月" + // ? `${year - 1}年${month}月良率` + // : `${year - 1}年良率`, + // value: isNaN((this.valueTuple[0] * 100).toFixed(0)) ? 0 + "%" : (this.valueTuple[0] * 100).toFixed(0) + "%" + // }, + // { + // label: this.period == "月" ? `${month}月良率` : `${year}年良率`, + // value: isNaN((this.valueTuple[1] * 100).toFixed(0)) ? 0 + "%" : (this.valueTuple[1] * 100).toFixed(0) + "%" + // }, + // ]; }, }, mounted() { @@ -163,7 +218,9 @@ export default { // width: 290px; align-self: stretch; // flex: 1 1 auto; - // padding: 0 10%; + // align-items: center; + // margin:0 auto; + // padding: 0 10%;; /* margin: 10%; */ /* min-width: 300px; */ height: 200px; diff --git a/src/views/copilot/efficiency/components/sub/std/ProgressBar.vue b/src/views/copilot/efficiency/components/sub/std/ProgressBar.vue index 6586f16..8692f01 100644 --- a/src/views/copilot/efficiency/components/sub/std/ProgressBar.vue +++ b/src/views/copilot/efficiency/components/sub/std/ProgressBar.vue @@ -6,7 +6,7 @@ --> @@ -20,52 +20,25 @@ export default { type: Number, default: 0, }, - target: { - type: Number, - default: 0, - }, - goodNumber: { - type: Number, - default:0 - }, - componentYield: { - type: Number, - default:0 - }, - period: { - type: String, - default:'日', - }, + // total: { + // type: Number, + // default: 0, + // }, title: { type: String, default: "", }, - city: { - type: String, - default:"" - } }, data() { - return { - number: 0, - titleYear:'', - }; + return {}; }, computed: { dataRate() { - if ((this.period === '年' || this.period === '月') && this.target != 0) { - // console.log(this.componentYield) - this.titleYear = this.title + ' ' + `${(this.target * 100).toFixed(0)}%` - } else { - this.titleYear = this.title - } - this.number = this.value == 0 - ? "-" - : `${(this.value * 100).toFixed(0)}%` - // console.log(this.period) return this.value == 0 ? "-" - : this.value >1 ? 100 + '%' :`${(this.value * 100).toFixed(0)}%` + : this.value > 1 + ? 100 + '%' + : `${(parseFloat(this.value)).toFixed(0)}%`; }, }, methods: {}, @@ -95,7 +68,7 @@ export default { color: #fff; position: absolute; bottom: -200%; - right: 10px; + right: 0; font-size: 12px; } @@ -104,6 +77,7 @@ export default { color: #11eae3; } } + &:nth-child(2) { &:after { color: #0e65fd; @@ -116,17 +90,20 @@ export default { height: 100%; width: 0; border-radius: 4px; + background: linear-gradient(to right, + #004c5e11 10%, + #004c5e, + #0ac0c0, + #11eae3); } &:first-child { .progress-bar__rate { - background: linear-gradient( - to right, - #004c5e11 10%, - #004c5e, - #0ac0c0, - #11eae3 - ); + background: linear-gradient(to right, + #004c5e11 10%, + #004c5e, + #0ac0c0, + #11eae3); } } diff --git a/src/views/copilot/efficiency/components/sub/std/StdRateItem.vue b/src/views/copilot/efficiency/components/sub/std/StdRateItem.vue index 83e07be..4f9f3ba 100644 --- a/src/views/copilot/efficiency/components/sub/std/StdRateItem.vue +++ b/src/views/copilot/efficiency/components/sub/std/StdRateItem.vue @@ -1,7 +1,7 @@ @@ -11,28 +11,30 @@
- +
- +
- - + + +
- - + + +
@@ -52,7 +54,11 @@ export default { period: { type: String, default: "日", - } + }, + than: { + type: String, + default: "同比", + }, }, data() { return { @@ -60,44 +66,65 @@ export default { }; }, computed: { - title() { - switch (this.period) { - case "日": - return "今日" - case "周": - return "本周" - case "月": - const year = new Date().getFullYear(); - const month = new Date().getMonth() + 1; - return `${year - 1}年${month}月累计` - case "年": { - const year = new Date().getFullYear(); - // return [ - return `${year - 1}年累计` - // ]; - } - default: - return "今日" + titlePre() { + console.log(this.city); + var day1 = new Date(); + day1.setTime(day1.getTime() - 24 * 60 * 60 * 1000); + var yesterday = (day1.getMonth() + 1) + "月" + day1.getDate() + const today = new Date().getDate(); + const month = new Date().getMonth() + 1; + const lastMonth = new Date().getMonth() + 1 === 12 ? 1 : new Date().getMonth() + 1 - 1; + const year = new Date().getFullYear(); + if (this.period === '日' && this.than === '同比') { + return `去年${month}月${today}日` + } else if (this.period === '日' && this.than === '环比') { + return `${yesterday}日` + } else if (this.period === '周' && this.than === '同比') { + return `去年本周` + } else if (this.period === '周' && this.than === '环比') { + return `上周` + } else if (this.period === '月' && this.than === '同比') { + return `去年${month}月` + } else if (this.period === '月' && this.than === '环比') { + return `${lastMonth}月` + } else { + return `${year - 1}年` } }, - titleEnd() { - switch (this.period) { - // case "日": - // return "今日" - // case "周": - // return "本周" - case "月": - const year = new Date().getFullYear(); - const month = new Date().getMonth() + 1; - return `${year}年${month}月目标` - case "年": { - const year = new Date().getFullYear(); - // return [ - return `${year}年目标` - // ]; - } + title() { + var day1 = new Date(); + day1.setTime(day1.getTime() - 24 * 60 * 60 * 1000); + const today = new Date().getDate(); + const month = new Date().getMonth() + 1; + const year = new Date().getFullYear(); + if (this.period === '日' && this.than === '同比') { + return `${month}月${today}日` + } else if (this.period === '日' && this.than === '环比') { + return `${month}月${today}日` + } else if (this.period === '周' && this.than === '同比') { + return `本周` + } else if (this.period === '周' && this.than === '环比') { + return `本周` + } else if (this.period === '月' && this.than === '同比') { + return `${month}月` + } else if (this.period === '月' && this.than === '环比') { + return `${month}月` + } else { + return `${year}年` } - } + }, + titleTarget() { + var day1 = new Date(); + day1.setTime(day1.getTime() - 24 * 60 * 60 * 1000); + const today = new Date().getDate(); + const month = new Date().getMonth() + 1; + const year = new Date().getFullYear(); + if (this.period === '月') { + return `${month}月目标` + } else if (this.period === '年') { + return `${year}年目标` + } + }, }, }; diff --git a/src/views/copilot/efficiency/index.vue b/src/views/copilot/efficiency/index.vue index badefb1..371b71b 100644 --- a/src/views/copilot/efficiency/index.vue +++ b/src/views/copilot/efficiency/index.vue @@ -1,7 +1,7 @@ @@ -9,16 +9,16 @@ @@ -44,25 +44,45 @@ export default { type: String, default: "日", }, + than: { + type: String, + default: "同比", + }, }, data() { - return {}; + return { + chipOeeRate: {}, + transformRate:{} + }; }, watch: { period: { handler(val) { - val && this.fetchData(val); + val && this.fetchData(val,this.than); + }, + immediate: true, + }, + than: { + handler(val) { + console.log(val) + val && this.fetchData(this.period, val); }, immediate: true, }, }, methods: { - fetchData(period = "日") { + fetchData(period = "日",than) { console.log(`效率驾驶舱,获取${period}数据`); this.$store.dispatch("copilot/initCopilot", { period, source: "efficiency", - }); + than + }).then(() => { + this.$nextTick(() => { + this.chipOeeRate = this.$store.getters.copilot.efficiency.chipOeeRate + this.transformRate = this.$store.getters.copilot.efficiency.transformRate + }) + }) }, }, }; diff --git a/src/views/copilot/efficiency/options/double-ring-chart-options.js b/src/views/copilot/efficiency/options/double-ring-chart-options.js index 743f820..bbd6d65 100644 --- a/src/views/copilot/efficiency/options/double-ring-chart-options.js +++ b/src/views/copilot/efficiency/options/double-ring-chart-options.js @@ -6,7 +6,7 @@ export default ({ targetSum, }) => ({ grid: { - left: 0, + left: '50%', right: 0, bottom: 0, top: 0, diff --git a/src/views/copilot/efficiencyContainer.vue b/src/views/copilot/efficiencyContainer.vue new file mode 100644 index 0000000..e004cec --- /dev/null +++ b/src/views/copilot/efficiencyContainer.vue @@ -0,0 +1,131 @@ + + + + + diff --git a/src/views/copilot/factoryData/bbIndex.vue b/src/views/copilot/factoryData/bbIndex.vue new file mode 100644 index 0000000..e746fdd --- /dev/null +++ b/src/views/copilot/factoryData/bbIndex.vue @@ -0,0 +1,216 @@ + + + diff --git a/src/views/copilot/factoryData/cdIndex.vue b/src/views/copilot/factoryData/cdIndex.vue new file mode 100644 index 0000000..7ae82bb --- /dev/null +++ b/src/views/copilot/factoryData/cdIndex.vue @@ -0,0 +1,216 @@ + + + diff --git a/src/views/copilot/factoryData/components/BarChartBase.vue b/src/views/copilot/factoryData/components/BarChartBase.vue new file mode 100644 index 0000000..5d62d34 --- /dev/null +++ b/src/views/copilot/factoryData/components/BarChartBase.vue @@ -0,0 +1,417 @@ + + + diff --git a/src/views/copilot/factoryData/components/BarChartChipOEE.vue b/src/views/copilot/factoryData/components/BarChartChipOEE.vue new file mode 100644 index 0000000..fb6bb44 --- /dev/null +++ b/src/views/copilot/factoryData/components/BarChartChipOEE.vue @@ -0,0 +1,343 @@ + + + + + + diff --git a/src/views/copilot/factoryData/components/ChartContainer.vue b/src/views/copilot/factoryData/components/ChartContainer.vue new file mode 100644 index 0000000..a36ffb6 --- /dev/null +++ b/src/views/copilot/factoryData/components/ChartContainer.vue @@ -0,0 +1,69 @@ + + + + + + + diff --git a/src/views/copilot/factoryData/components/ChipOee.vue b/src/views/copilot/factoryData/components/ChipOee.vue new file mode 100644 index 0000000..b872b9f --- /dev/null +++ b/src/views/copilot/factoryData/components/ChipOee.vue @@ -0,0 +1,278 @@ + + + + + + + diff --git a/src/views/copilot/factoryData/components/Order.vue b/src/views/copilot/factoryData/components/Order.vue index 8cec3dc..fa4d22c 100644 --- a/src/views/copilot/factoryData/components/Order.vue +++ b/src/views/copilot/factoryData/components/Order.vue @@ -1,27 +1,38 @@ + diff --git a/src/views/copilot/factoryData/components/ProdMonitor.vue b/src/views/copilot/factoryData/components/ProdMonitor.vue index a0e7619..2c8002b 100644 --- a/src/views/copilot/factoryData/components/ProdMonitor.vue +++ b/src/views/copilot/factoryData/components/ProdMonitor.vue @@ -1,146 +1,143 @@ + diff --git a/src/views/copilot/factoryData/hdIndex.vue b/src/views/copilot/factoryData/hdIndex.vue new file mode 100644 index 0000000..70fcbf0 --- /dev/null +++ b/src/views/copilot/factoryData/hdIndex.vue @@ -0,0 +1,216 @@ + + + diff --git a/src/views/copilot/factoryData/index.vue b/src/views/copilot/factoryData/index.vue index 190e464..d55657b 100644 --- a/src/views/copilot/factoryData/index.vue +++ b/src/views/copilot/factoryData/index.vue @@ -1,29 +1,25 @@