1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015 |
- var vm = new Vue({
- el: '#app',
- data: {
- lineName:"",
- date: "",
- moduleType: "",
- moduleTypes: [],
- lineModuleType: "",
- isLine: false,
- lineOverViews: [],
- lineData: {},
- lineKeyFaults: [],
- selectId: "",
- lines: [],
- lineFault: [],
- lineMorningAccumulatedFault: [],
- lineNightAccumulatedFault: [],
- MorningCapacity: 0,
- NightCapacity: 0,
- TotalCapacity: 0,
- dom: Object,
- myChart: Object,
- option: Object,
- dom1: Object,
- myChart1: Object,
- option1: Object,
- dom2: Object,
- myChart2: Object,
- option2: Object,
- monthTitle: "",
- dates: [],
- newDates: [],
- planCapacities: [],
- capacities: [],
- differences: [],
- accumulatedDifferences: [],
- accumulatedDifference: 0
- },
- created() {
- this.getLines()
- },
- mounted() {
- this.init()
- this.initDatepicker()
- this.initCapacityEcharts()
- this.initData()
- this.initMonthDataEcharts()
- },
- watch: {
- moduleTypes: function () {
- this.$nextTick(function () {
- $("input[name='optionsRadios'][value=" + this.lineModuleType + "]").prop("checked", true)
- });
- }
- },
- methods: {
- init() {
- let width = document.body.clientWidth - 120;
- let homeTable1 = document.querySelector("#homeTable1");
- let homeTable2 = document.querySelector("#homeTable2");
- homeTable1.style.width = width + 'px';
- homeTable2.style.width = width + 'px';
- },
- onClickOptionsRadios() {
- let moduleType = $("input[name='optionsRadios']:checked").val()
- if (moduleType === "" || moduleType === undefined) {
- moduleType = "ALL"
- }
- this.lineModuleType = moduleType
- document.cookie = 'lineModuleType=' + moduleType
- this.getLineMonthData()
- },
- initMonthDataEcharts() {
- this.dom2 = document.getElementById('container3');
- this.myChart2 = echarts.init(this.dom2, 'dark');
- this.option2 = {
- backgroundColor: '#001529',
- legend: {
- show: false,
- left: 'right'
- },
- tooltip: {
- },
- xAxis: {
- /* type: 'value',*/
- show: false,
- axisLabel: {
- fontSize: 16
- }
- },
- textStyle: {
- "fontSize": 14
- },
- yAxis: {
- /*type: 'category',*/
- inverse: false,
- show: false,
- axisLabel: {
- fontSize: 16
- },
- max: 3
- },
- grid: {
- top: "15px",
- left: "25px",
- right: "25px",
- bottom: '25px',
- }
- };
- if (this.option2 && typeof option2 === 'object') {
- this.myChart2.setOption(this.option2);
- }
- window.addEventListener('resize', this.myChart2.resize);
- this.dom1 = document.getElementById('container2');
- this.myChart1 = echarts.init(this.dom1, 'dark');
- this.option1 = {
- backgroundColor: '#001529',
- legend: {
- show: true,
- left: 'right',
- padding: [0, 20, 15, 10],
- selected: {
- '产能': true,
- '目标产能': true,
- '差异': true,
- '累计差异': false
- }
- },
- tooltip: {},
- xAxis: {
- axisLabel: {
- fontSize: 16
- }
- },
- textStyle: {
- "fontSize": 16
- },
- yAxis: {
- show: false,
- axisLabel: {
- fontSize: 16
- }
- },
- grid: {
- left: "25px",
- right: "25px",
- bottom: '40px',
- }
- };
- this.myChart1.on('click', (params) => this.onClickMonthData(params));
- if (this.option1 && typeof option1 === 'object') {
- this.myChart1.setOption(this.option1);
- }
- window.addEventListener('resize', this.myChart1.resize);
-
- },
- addMonthData(dates, planCapacities, capacities, differences, accumulatedDifferences) {
- this.option1.series = [];
- this.option1.xAxis.data = dates;
- var serie2 = {
- name: '产能',
- type: 'bar',
- stack: 'Total',
- label: {
- show: true
- },
- itemStyle: {
- normal: {
- color: '#4472c4'
- }
- },
- tooltip: {
- formatter: (params) => this.getMonthDayData(params),
- textStyle: {
- "fontSize": 18
- }
- },
- data: capacities
- }
- this.option1.series.push(serie2);
- var serie1 = {
- name: '目标产能',
- type: 'line',
- step: 'middle',
- showSymbol: true,
- itemStyle: {
- normal: {
- color: '#fddd60',
- lineStyle: {
- width: 2
- }
- }
- },
- tooltip: {
- formatter: (params) => this.getMonthDayData(params),
- textStyle: {
- "fontSize": 18
- }
- },
- label: {
- show: true
- },
- data: planCapacities
- }
- this.option1.series.push(serie1);
- var serie3 = {
- name: '差异',
- type: 'bar',
- stack: 'Total',
- itemStyle: {
- normal: {
- color: '#ff6e76'
- }
- },
- tooltip: {
- formatter: (params) => this.getMonthDayData(params),
- textStyle: {
- "fontSize": 18
- }
- },
- label: {
- show: true,
- color: '#fff'
- },
- data: differences
- }
- this.option1.series.push(serie3);
- //var serie4 = {
- // name: '累计差异',
- // type: 'line',
- // itemStyle: {
- // normal: {
- // color: '#ed7d31'
- // }
- // },
- // label: {
- // show: true
- // },
- // tooltip: {
- // formatter: (params) => this.getMonthDayData(params),
- // textStyle: {
- // "fontSize": 18
- // }
- // },
- // data: accumulatedDifferences
- //}
- //this.option1.series.push(serie4);
- this.myChart1.setOption(this.option1, true);
- this.myChart1.resize();
- },
- addMonthDataPlan(datas, series) {
- this.option2.series = [];
- this.option2.xAxis.data = datas;
- for (var i = 0; i < series.length; i++) {
- var x = 0;
- var ds = [];
- var y = i % 3;
- for (var j = 0; j < series[i].values.length; j++) {
- if (series[i].values[j] === "") {
- ds[j] = ""
- } else {
- ds[j] = parseInt(series[i].values[j]) + y
- }
- x = series[i].start;
- }
- if (x === 0) {
- x += 0.5
- } else if (x === series[i].values.length - 1) {
- } else {
- x += 0.5
- }
- var serie = {
- name: series[i].name,
- type: 'line',
- step: 'middle',
- showSymbol: false,
- itemStyle: {
- normal: {
- color: 'rgba(74,125,215,0.6)',
- lineStyle: {
- width: 35
- }
- }
- },
- markPoint: {
- data: [{
- coord: [x, y + 1],
- symbol: 'rect',
- symbolSize: [30, 0],
- animation: true,
- label: {
- show: true,
- formatter: series[i].name
- },
- tooltip: {
- formatter: series[i].name + ' Plan: ' + series[i].planCapacities + ' pcs',
- textStyle: {
- "fontSize": 18
- }
- }
- }]
- },
- data: ds
- }
- this.option2.series.push(serie);
- }
- this.myChart2.setOption(this.option2, true);
- this.myChart2.resize();
- },
- getMonthDayData(params) {
- var rev = ''
- rev += '<div class="show">'
- rev += '日期: ' + this.newDates[params.dataIndex] + ' <br/>'
- rev += '目标产能: ' + this.planCapacities[params.dataIndex] + ' pcs<br/>'
- rev += '实际产能: ' + this.capacities[params.dataIndex] + ' pcs<br/>'
- if (this.differences[params.dataIndex] === "") {
- rev += '差异产能: ' + 0 + ' pcs<br/>'
- } else {
- rev += '差异产能: ' + this.differences[params.dataIndex] + ' pcs<br/>'
- }
- rev += '累计差异: ' + this.accumulatedDifferences[params.dataIndex] + ' pcs<br/>'
- rev += '</div>'
- return rev
- },
- onClickMonthData(params) {
- var d = new Date(this.dates[params.dataIndex])
- $("#date").val(d).datepicker('setDate', d)
- this.getData()
- },
- initData() {
- let cookieValue = document.cookie.replace(/(?:(?:^|.*;\s*)lineId\s*\=\s*([^;]*).*$)|^.*$/, "$1");
- let cookieValueLineName = document.cookie.replace(/(?:(?:^|.*;\s*)lineName\s*\=\s*([^;]*).*$)|^.*$/, "$1");
- let cookieLineModuleType = document.cookie.replace(/(?:(?:^|.*;\s*)lineModuleType\s*\=\s*([^;]*).*$)|^.*$/, "$1");
- if (cookieValue != "") {
- this.selectId = cookieValue
- this.lineName = cookieValueLineName
- this.lineModuleType = cookieLineModuleType
- } else {
- this.selectId = "00000000-0000-0000-0000-000000000000"
- this.lineName = "总览"
- }
- this.getData()
- },
- getLineOverview() {
- let _this = this
- axios
- .get(
- '/Line/GetLineOverviewV1',
- {
- params: {
- date: $("#date").val()
- }
- }
- )
- .then(function (response) {
- _this.lineOverViews = response.data
- })
- .catch(function (error) {
- console.log(error)
- });
- },
- initDatepicker() {
- $("#date").datepicker({
- format: 'yyyy-mm-dd',
- language: "zh-CN",
- autoclose: true,
- todayBtn: "linked"
- }).on('changeDate',
- () => this.selectDatepicker()
- ).on('keydown', function (e) {
- return false;
- })
- },
- onClickCell(id, moduleType) {
- this.selectId = id
- $("#Line").val(id)
- this.lineName = $('#Line option:selected').text();
- document.cookie = 'lineId=' + id
- document.cookie = 'lineName=' + this.lineName
- document.cookie = 'action='
- //document.cookie = 'lineModuleType=' + moduleType
- //this.lineModuleType = moduleType;
- document.cookie = 'lineModuleType=' + 'ALL'
- this.lineModuleType = 'ALL';
- this.getData()
- this.getLineMonthData()
- },
- returnOverview() {
- let cookieValue = document.cookie.replace(/(?:(?:^|.*;\s*)lineId\s*\=\s*([^;]*).*$)|^.*$/, "$1");
- let cookieValueLineName = document.cookie.replace(/(?:(?:^|.*;\s*)lineName\s*\=\s*([^;]*).*$)|^.*$/, "$1");
- let action = document.cookie.replace(/(?:(?:^|.*;\s*)action\s*\=\s*([^;]*).*$)|^.*$/, "$1");
- if (action === 'Home') {
- window.location.href = "/Home";
- } else {
- this.selectId = '00000000-0000-0000-0000-000000000000'
- $("#Line").val(this.selectId)
- this.lineName = $('#Line option:selected').text();
- document.cookie = 'lineId=' + this.selectId
- document.cookie = 'lineName=' + this.lineName
- document.cookie = 'action='
- document.cookie = 'lineModuleType='
- this.getData()
- }
- },
- selectDatepicker(e) {
- this.getData()
- },
- initCapacityEcharts() {
- this.dom = document.getElementById('container1');
- this.myChart = echarts.init(this.dom, 'dark');
- this.option = {
- backgroundColor: '#001529',
- legend: {
- left: 'right',
- data: ["早班", "夜班", "目标产能", "差异"]
- },
- tooltip: {},
- xAxis: {
- data: [
- "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19",
- "20", "21", "22", "23", "00", "01", "02", "03", "04", "05", "06", "07"],
- axisLabel: {
- fontSize: 16
- }
- },
- textStyle: {
- "fontSize": 16
- },
- yAxis: {
- show: false,
- axisLabel: {
- fontSize: 16
- }
- },
- grid: {
- left: "25px",
- right: "25px"
- }
- };
- if (this.option && typeof option === 'object') {
- this.myChart.setOption(this.option);
- }
- window.addEventListener('resize', this.myChart.resize);
- },
- addHourCapacityAndCapa(data, tData) {
- this.MorningCapacity = this.sum(data.slice(0, 12))
- this.NightCapacity = this.sum(data.slice(12, 24))
- this.TotalCapacity = this.MorningCapacity + this.NightCapacity
- this.option.series = [];
- var serie1 = {
- name: '早班',
- type: 'bar',
- stack: 'Total',
- tooltip: {
- formatter: (params) => this.getHourData(params, ""),
- textStyle: {
- "fontSize": 18
- }
- },
- label: {
- show: true
- },
- data: data.slice(0, 12)
- }
- this.option.series.push(serie1);
- data1 = ['-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-']
- for (var i = 12; i < 24; i++) {
- data1.push(data[i])
- }
- var serie2 = {
- name: '夜班',
- type: 'bar',
- stack: 'Total',
- tooltip: {
- formatter: (params) => this.getHourData(params, ""),
- textStyle: {
- "fontSize": 18
- }
- },
- label: {
- show: true
- },
- data: data1
- }
- this.option.series.push(serie2);
- var serie3 = {
- name: '目标产能',
- type: 'line',
- tooltip: {
- valueFormatter: function (value) {
- return value + " pcs";
- }
- },
- label: {
- show: true
- },
- itemStyle: {
- normal: {
- lineStyle: {
- width: 3
- }
- }
- },
- data: tData
- }
- this.option.series.push(serie3);
- data2 = [];
- for (var i = 0; i < tData.length; i++) {
- var temp = tData[i] - data[i]
- if (temp > 0) {
- data2.push(temp)
- } else {
- data2.push('-')
- }
- }
- var serie4 = {
- name: '差异',
- type: 'bar',
- stack: 'Total',
- tooltip: {
- formatter: (params) => this.getHourData(params, "差异"),
- textStyle: {
- "fontSize": 18
- }
- },
- label: {
- show: true
- },
- data: data2
- }
- this.option.series.push(serie4);
- this.myChart.setOption(this.option, true);
- this.myChart.resize();
- },
- getHourData(params, serieName) {
- var rev = ''
- rev += '<div class="show">'
- rev += serieName + '产能: ' + params.value + ' pcs<br/>'
- rev += '<br/>'
- var idelTime = 0;
- if (this.lineData.hourKeyInInfos !== undefined) {
- for (var i = 0; i < this.lineData.hourKeyInInfos.length; i++) {
- var h = this.lineData.hourKeyInInfos[i].startTime.substring(11, 13)
- if (h == params.name) {
- idelTime += this.lineData.hourKeyInInfos[i].affectTime
- }
- }
- }
- rev += '<strong>Idel - ' + idelTime.toFixed(0) + 'min</strong><br/>'
- if (this.lineData.hourKeyInInfos !== undefined) {
- for (var i = 0; i < this.lineData.hourKeyInInfos.length; i++) {
- var h = this.lineData.hourKeyInInfos[i].startTime.substring(11, 13)
- if (h == params.name) {
- rev += this.lineData.hourKeyInInfos[i].keyInTypeName + ', '
- + this.lineData.hourKeyInInfos[i].description + ', '
- + this.lineData.hourKeyInInfos[i].affectTime.toFixed(0)
- + 'min<br/>'
- }
- }
- }
- rev += '<br/>'
- var downTime = 0;
- if (this.lineFault !== undefined) {
- for (var i = 0; i < this.lineFault.length; i++) {
- var h = this.lineFault[i].startTime.substring(11, 13)
- if (h == params.name) {
- downTime += this.lineFault[i].duration
- }
- }
- }
- rev += '<strong>Down - ' + downTime.toFixed(0) + ' min</strong><br/>'
- if (this.lineFault !== undefined) {
- for (var i = 0; i < this.lineFault.length; i++) {
- var h = this.lineFault[i].startTime.substring(11, 13)
- if (h == params.name) {
- if (this.lineFault[i].duration.toFixed(0) !== '0') {
- rev += this.lineFault[i].machineType + ', '
- + this.lineFault[i].faultInfo + ', '
- + this.lineFault[i].duration.toFixed(0)
- + 'min, '
- if (this.lineFault[i].dataSource === 0) {
- rev += "自动上抛<br/>"
- } else {
- rev += "人工录入<br/>"
- }
- }
- }
- }
- }
- rev += '</div>'
- return rev
- },
- sum(arr) {
- var sum = 0
- for (var i = 0; i < arr.length; i++) {
- sum += arr[i]
- }
- return sum
- },
- getData() {
- if (this.selectId === '00000000-0000-0000-0000-000000000000') {
- $("#overview").attr("class", "tab-pane active")
- $("#line").attr("class", "tab-pane")
- this.getLineOverview()
- this.date = $("#date").val()
- this.isLine = false
- } else {
- $("#overview").attr("class", "tab-pane")
- $("#line").attr("class", "tab-pane active")
- this.getLineData()
- this.getLineFault()
- this.getLineMorningAccumulatedFault()
- this.getLineNightAccumulatedFault()
- this.getLineMonthData()
- this.date = $("#date").val()
- this.isLine = true
- }
- },
- getLineData() {
- this.lineData = {}
- /* this.initCapacityEcharts()*/
- let _this = this
- axios
- .get(
- '/Line/GetLineData',
- {
- params: {
- lineId: _this.selectId,
- date: $("#date").val()
- }
- }
- )
- .then(function (response) {
- if (response.data !== null) {
- _this.lineData = response.data
- _this.moduleType = ""
- for (var i = 0; i < _this.lineData.statistics.length; i++) {
- _this.moduleType += _this.lineData.statistics[i].moduleType + " "
- }
- var data = []
- var tData = []
- for (var i = 0; i < _this.lineData.newOutPutPerHours.length; i++) {
- data.push(_this.lineData.newOutPutPerHours[i].outPut)
- }
- for (var i = 0; i < _this.lineData.newOutPutPerHours.length; i++) {
- if (_this.lineData.newOutPutPerHours[i].moduleType === "") {
- tData.push("")
- } else {
- var b = false
- for (var j = 0; j < _this.lineData.productionPlans.length; j++) {
- if (_this.lineData.newOutPutPerHours[i].moduleType.substr(0, 8)
- === _this.lineData.productionPlans[j].moduleType.substr(0, 8)) {
- tData.push((_this.lineData.productionPlans[j].capa / 24).toFixed(0))
- b = true
- break;
- }
- }
- if (b == false) {
- tData.push("")
- }
- }
- }
- _this.addHourCapacityAndCapa(data, tData)
- }
- })
- .catch(function (error) {
- console.log(error)
- });
- },
- getLines() {
- let _this = this
- axios
- .get('/ProductionLine/GetProductionLines')
- .then(function (response) {
- if (response.data !== null) {
- _this.lines = response.data.data
- _this.$nextTick(() => {
- $("#Line").prepend("<option value='00000000-0000-0000-0000-000000000000'>总览</option>");
- $("#Line").val(_this.selectId)
- })
- }
- })
- .catch(function (error) {
- console.log(error)
- });
- },
- select(event) {
- this.selectId = event.target.value
- this.lineName = $('#Line option:selected').text();
- document.cookie = 'lineId=' + this.selectId
- document.cookie = 'lineName=' + this.lineName
- document.cookie = 'lineModuleType=' + 'ALL';
- this.lineModuleType = "ALL";
- this.getData()
- },
- getLineKeyFaults() {
- this.lineKeyFaults = []
- let _this = this
- axios
- .get(
- '/Line/GetKeyFaults',
- {
- params: {
- id: _this.selectId,
- date: $("#date").val()
- }
- }
- )
- .then(function (response) {
- if (response.data !== null) {
- _this.lineKeyFaults = response.data
- }
- })
- .catch(function (error) {
- console.log(error)
- });
- },
- getLineFault() {
- this.lineFault = []
- let _this = this
- axios
- .get(
- '/Line/GetLineFault',
- {
- params: {
- lineId: _this.selectId,
- date: $("#date").val(),
- durationThreshold: 3
- }
- }
- )
- .then(function (response) {
- if (response.data !== null) {
- _this.lineFault = response.data
- }
- })
- .catch(function (error) {
- console.log(error)
- });
- },
- getLineMorningAccumulatedFault() {
- this.LineMorningAccumulatedFault = []
- let _this = this
- axios
- .get(
- '/Line/GetLineAccumulatedFaultByMorning',
- {
- params: {
- lineId: _this.selectId,
- date: $("#date").val()
- }
- }
- )
- .then(function (response) {
- if (response.data !== null) {
- _this.lineMorningAccumulatedFault = response.data
- }
- })
- .catch(function (error) {
- console.log(error)
- });
- },
- getLineNightAccumulatedFault() {
- this.lineNightAccumulatedFault = []
- let _this = this
- axios
- .get(
- '/Line/GetLineAccumulatedFaultByNight',
- {
- params: {
- lineId: _this.selectId,
- date: $("#date").val()
- }
- }
- )
- .then(function (response) {
- if (response.data !== null) {
- _this.lineNightAccumulatedFault = response.data
- }
- })
- .catch(function (error) {
- console.log(error)
- });
- },
- getFloorOverview(floor) {
- var data = []
- for (var i = 0; i < this.lineOverViews.length; i++) {
- if (this.lineOverViews[i].floor == floor) {
- data.push(this.lineOverViews[i])
- }
- }
- return data
- },
- nextDay() {
- var date = new Date($("#date").val())
- var d = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + (date.getDate() + 1)
- $("#date").val(d).datepicker('setDate', d)
- },
- lastDay() {
- var date = new Date($("#date").val())
- var d = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + (date.getDate() - 1)
- $("#date").val(d).datepicker('setDate', d)
- },
- getLineMonthData() {
- if (this.selectId !== '00000000-0000-0000-0000-000000000000') {
- let _this = this
- axios
- .get(
- '/Line/GetMonthData',
- {
- params: {
- lineId: _this.selectId,
- date: $("#date").val(),
- moduleType: _this.lineModuleType
- }
- }
- )
- .then(function (response) {
- _this.monthTitle = response.data.monthTitle;
- _this.dates = response.data.dates;
- _this.newDates = response.data.newDates;
- _this.planCapacities = response.data.planCapacities;
- _this.capacities = response.data.capacities;
- _this.differences = response.data.differences;
- _this.accumulatedDifferences = response.data.accumulatedDifferences;
- _this.accumulatedDifference = response.data.accumulatedDifference;
- _this.moduleTypes = response.data.moduleTypes;
- _this.addMonthData(response.data.newDates, response.data.planCapacities,
- response.data.capacities, response.data.differences,
- response.data.accumulatedDifferences)
- _this.addMonthDataPlan(response.data.newDates, response.data.series)
- })
- .catch(function (error) {
- console.log(error)
- });
- }
- },
- sort() {
- var iconName = $("#sortSpan").attr("class");
- switch (iconName) {
- case "glyphicon glyphicon-sort-by-alphabet":
- this.lineOverViews.sort(function (a, b) {
- return b.achievementRate - a.achievementRate;
- });
- $("#sortSpan").attr("class", "glyphicon glyphicon-sort-by-attributes-alt")
- break;
- case "glyphicon glyphicon-sort-by-attributes-alt":
- this.lineOverViews.sort(function (a, b) {
- return a.achievementRate - b.achievementRate;
- });
- $("#sortSpan").attr("class", "glyphicon glyphicon-sort-by-attributes");
- break;
- case "glyphicon glyphicon-sort-by-attributes":
- this.lineOverViews.sort(function (a, b) {
- return a.line - b.line;
- });
- this.lineOverViews.sort(function (a, b) {
- return b.floor - a.floor;
- });
- $("#sortSpan").attr("class", "glyphicon glyphicon-sort-by-alphabet");
- break;
- }
- },
- jumpEyz() {
- this.selectId = '00000000-0000-0000-0000-000000000000'
- $("#Line").val(this.selectId)
- this.lineName = $('#Line option:selected').text();
- document.cookie = 'lineId=' + this.selectId
- document.cookie = 'lineName=' + this.lineName
- document.cookie = 'action='
- document.cookie = 'lineModuleType='
- window.location.href = "http://eyz2rp3.toc.eink.com/ERS/#/Home/IndexPage";
- },
- ExportineAccumulatedFaultByMorning() {
- let _this = this
- window.open("/Line/ExportineAccumulatedFaultByMorning?lineId="
- + _this.selectId + "&date=" + $("#date").val());
- },
- ExportineAccumulatedFaultByNight() {
- let _this = this
- window.open("/Line/ExportineAccumulatedFaultByNight?lineId="
- + _this.selectId + "&date=" + $("#date").val());
- },
- jumpNextMonth() {
- let currentDate = new Date();
- let nextMonth = currentDate.getMonth() + 1;
- let nextMonthDay = currentDate.getDate();
- if (nextMonth === 13) {
- nextMonth = 0;
- }
- currentDate.setMonth(nextMonth);
- currentDate.setDate(nextMonthDay);
- $("#date").val(currentDate).datepicker('setDate', currentDate);
- },
- jumpTheSameDay() {
- let currentDate = new Date();
- $("#date").val(currentDate).datepicker('setDate', currentDate);
- }
- },
- filters: {
- dataTimeFormat: function (value) {
- return value.substr(11, 5)
- },
- dataTimeFormatV1: function (value) {
- return value.substr(0, 19)
- },
- dataTimeFormatV2: function (value) {
- return value.substr(5, 2) + "/" + value.substr(8, 2) + ' ' + value.substr(11, 5)
- }
- },
- computed: {
- getKeyInInfoAffectTime() {
- var keyInInfoAffectTime = 0
- if (this.lineData.keyInInfos !== undefined) {
- for (var i = 0; i < this.lineData.keyInInfos.length; i++) {
- keyInInfoAffectTime += this.lineData.keyInInfos[i].affectTime
- }
- }
- return keyInInfoAffectTime
- },
- getKeyInInfoAffectTime_8() {
- var keyInInfoAffectTime = 0
- if (this.lineData.keyInInfos !== undefined) {
- for (var i = 0; i < this.lineData.keyInInfos.length; i++) {
- if (this.lineData.keyInInfos[i].keyInType == 8) {
- keyInInfoAffectTime += this.lineData.keyInInfos[i].affectTime
- }
- }
- }
- return keyInInfoAffectTime
- },
- getKeyInInfoAffectTime_8_morning() {
- var keyInInfoAffectTime = 0
- if (this.lineData.morningReplaceConsumables !== undefined) {
- for (var i = 0; i < this.lineData.morningReplaceConsumables.length; i++) {
- keyInInfoAffectTime += this.lineData.morningReplaceConsumables[i].accumulativeTime
- }
- }
- return keyInInfoAffectTime
- },
- getKeyInInfoAffectTime_8_night() {
- var keyInInfoAffectTime = 0
- if (this.lineData.nightReplaceConsumables !== undefined) {
- for (var i = 0; i < this.lineData.nightReplaceConsumables.length; i++) {
- keyInInfoAffectTime += this.lineData.nightReplaceConsumables[i].accumulativeTime
- }
- }
- return keyInInfoAffectTime
- },
- getKeyInInfoAffectTime_9() {
- var keyInInfoAffectTime = 0
- if (this.lineData.keyInInfos !== undefined) {
- for (var i = 0; i < this.lineData.keyInInfos.length; i++) {
- if (this.lineData.keyInInfos[i].keyInType == 9) {
- keyInInfoAffectTime += this.lineData.keyInInfos[i].affectTime
- }
- }
- }
- return keyInInfoAffectTime
- },
- getKeyInInfoDown() {
- var keyInInfoAffectTime = 0
- if (this.lineData.faultStatistics !== undefined) {
- for (var i = 0; i < this.lineData.faultStatistics.length; i++) {
- keyInInfoAffectTime += this.lineData.faultStatistics[i].downTime
- }
- }
- return keyInInfoAffectTime
- }
- }
- })
|