diff --git a/.env.development b/.env.development index db2b5d18..71f23063 100644 --- a/.env.development +++ b/.env.development @@ -11,16 +11,15 @@ VUE_APP_TITLE = '中建材光子科技有限公司' #VUE_APP_WS_API = 'ws://localhost:8000' # VUE_APP_API_BASEURL = http://222.222.144.147:6013/api #VUE_APP_API_BASEURL = http://10.99.5.79:20309/api -# VUE_APP_API_BASEURL = http://49.232.14.174:2226/api -# VUE_APP_BASEURL = http://49.232.14.174:2226 # VUE_APP_API_BASEURL = http://127.0.0.1:2226/api +#测试环境 +VUE_APP_API_BASEURL = http://49.232.14.174:2226/api +VUE_APP_BASEURL = http://49.232.14.174:2226 - -#光子 -VUE_APP_API_BASEURL = http://49.232.14.174:2250/api -VUE_APP_BASEURL = http://49.232.14.174:2250 - +# #光子 +# VUE_APP_API_BASEURL = http://49.232.14.174:2250/api +# VUE_APP_BASEURL = http://49.232.14.174:2250 # 本地端口 VUE_APP_PORT = 2800 diff --git a/dist.rar b/dist.rar deleted file mode 100644 index 919a2ef6..00000000 Binary files a/dist.rar and /dev/null differ diff --git a/src/views/home/widgets/index_photon.vue b/src/views/home/widgets/index_photon.vue index 325cc622..e6ee7962 100644 --- a/src/views/home/widgets/index_photon.vue +++ b/src/views/home/widgets/index_photon.vue @@ -19,27 +19,27 @@
预制棒合格数
-

6700

+

{{dayPassNum7}}

同比前天 8.63%▲

预制管合格数
-

6700

+

{{dayPassNum10}}

同比前天 8.63%▲

AVG合格数
-

6700

+

{{dayAVGcountOk}}

同比前天 8.63%▼

预制棒管交付数
-

6700

+

{{ dayPayNum6 }}

同比前天 8.63%▲

AVG交付数
-

6700

+

{{dayAVGcountDelivered}}

同比前天 8.63%▲

@@ -53,11 +53,11 @@
预制棒管
-

6700

+

{{ monthPayNum6 }}

AVG
-

6700

+

{{ monthPayNumAVG }}

@@ -65,23 +65,23 @@
预制棒合格率
-

80%

+

{{monthPassRate7}}%

预制管合格率
-

80%

-

同比上周 8.63%

+

{{monthPassRate10}}%

+
AVG合格率
-

80%

-

同比上周 8.63%

+

{{monthRateAVG}}%

+
@@ -94,7 +94,12 @@
本月生产合格趋势
-
... +
+ + 6车间 + 7车间 + 10车间 +
@@ -117,12 +122,12 @@
- - - - - - + + + + + +
@@ -180,7 +185,11 @@ @@ -219,17 +228,16 @@ export default { time: '', day: '', year_s: '', + day_s: '', month_s: '', + deptName:'7车间', + yesterday:'', yearData: [], monthData: [], warningNum: 0, warningNum2: 0, - tableData: [ - { index: 1, name: 'GZKJ-01', specification: '500*30', unit: '个', count: 100 }, - { index: 2, name: 'GZKJ-02', specification: '500*30', unit: '个', count: 100 }, - { index: 3, name: 'GZKJ-03', specification: '500*30', unit: '个', count: 100 }, - { index: 4, name: 'GZKJ-04', specification: '500*30', unit: '个', count: 100 }, - ], + chartData:[], + tableData: [], equipList: [], calendarValue: '', eqState_: { @@ -238,6 +246,48 @@ export default { 30: '在修', 40: '禁用', }, + dayPassNum7:0, + dayPassNum10:0, + dayPayNum6:0,//交付数 + + monthPayNum6:0, + monthPassRate7:0, + monthPassRate10:0, + + monthRateAVG:0, + dayAVGcountOk:0, + dayAVGcountDelivered:0, + monthPayNumAVG:0, + option:{ + grid: { // 图表距离边框的距离,可用百分比和数字(px)配置 + top: '5%', + left: '1%', + right: '1%', + bottom: '5%', + containLabel: true + }, + xAxis: { + type: 'category', + axisLabel: { + // show: false, // X 轴标签文字旋转角度 + }, + data: [] + }, + yAxis: { + type: 'value', + axisLabel: { + show: false, // X 轴标签文字旋转角度 + }, + }, + series:{ + data: [], + type: 'bar', + barMaxWidth: 50, + itemStyle: { + normal: { color: 'rgb(20, 141, 255)' } + } + } + } } }, mounted() { @@ -246,11 +296,21 @@ export default { var myDate = new Date(); let year = myDate.getFullYear(); let month = myDate.getMonth() + 1; + let day = myDate.getDate(); that.year_s = year; that.month_s = month; - that.initChart(); + that.day_s = day; + + let yesterday = new Date(myDate.getTime()-24*60*60*1000); + this.yesterday = yesterday.getFullYear()+"-" + (yesterday.getMonth()+1) + "-" + yesterday.getDate(); + that.getdayData(); + that.getMonthData(); + this.getAVGDayData(); + // that.initChart(); this.calendarValue = new Date(); - this.getEquipList() + this.getEquipList(); + this.getMaterialList(); + this.getProductStatistic(); }, methods: { getEquipList() { @@ -258,6 +318,14 @@ export default { this.equipList = res }) }, + getMaterialList() { + this.$API.mtm.material.list.req({ page: 0, type: 10 }).then(res => { + this.tableData = res.filter(item=>{ + return item.count>0; + }); + console.log('getMaterialList',res) + }) + }, // 动态绑定Class bindClass(type) { let classInfo = { @@ -289,47 +357,232 @@ export default { interEquipment() { this.$router.replace({ path: '/em/equipmentc' }) }, - initChart() { - //柱状图 - var dom = document.getElementById("barCharts"); - var myChart = echarts.init(dom); - let option = { - grid: { // 图表距离边框的距离,可用百分比和数字(px)配置 - top: '5%', - left: '1%', - right: '1%', - bottom: '5%', - containLabel: true - }, - xAxis: { - type: 'category', - axisLabel: { - // show: false, // X 轴标签文字旋转角度 - }, - data: ['1号', '2号', '3号', '4号', '5号', '6号', '7号', '8号', '9号', '10号'] - }, - yAxis: { - type: 'value', - axisLabel: { - show: false, // X 轴标签文字旋转角度 - }, - }, - series: [{ - data: [10, 9, 8, 11, 12, 10, 9, 10, 8, 9, 10], - type: 'bar', - barMaxWidth: 50, - itemStyle: { - normal: { color: 'rgb(20, 141, 255)' } - } - }] - }; - myChart.setOption(option, true); + // initChart() { + // //柱状图 + // var dom = document.getElementById("barCharts"); + // var myChart = echarts.init(dom); + // let option = { + // grid: { // 图表距离边框的距离,可用百分比和数字(px)配置 + // top: '5%', + // left: '1%', + // right: '1%', + // bottom: '5%', + // containLabel: true + // }, + // xAxis: { + // type: 'category', + // axisLabel: { + // // show: false, // X 轴标签文字旋转角度 + // }, + // data: ['1号', '2号', '3号', '4号', '5号', '6号', '7号', '8号', '9号', '10号'] + // }, + // yAxis: { + // type: 'value', + // axisLabel: { + // show: false, // X 轴标签文字旋转角度 + // }, + // }, + // series: [{ + // data: [10, 9, 8, 11, 12, 10, 9, 10, 8, 9, 10], + // type: 'bar', + // barMaxWidth: 50, + // itemStyle: { + // normal: { color: 'rgb(20, 141, 255)' } + // } + // }] + // }; + // myChart.setOption(option, true); + // }, + //昨日合格数&昨日交付统计 + getdayData(){ + let that = this; + let date = that.yesterday; + let obj6 ={ + query: {start_date:date,end_date:date}, + }; + let obj7 ={ + query: {start_date:date,end_date:date,dept_name: "7车间"}, + }; + let obj10 ={ + query: {start_date:date,end_date:date,dept_name: "10车间"}, + }; + //7车间昨日合格数 + that.$API.bi.dataset.exec.req('lineDay', obj7).then((res7) => { + // console.log('7车间按日统计:',res7); + let list7 = res7.data2.ds0; + let sum = 0; + if(list7.length>0){ + list7.forEach(item => { + sum = sum+item.合格数; + }); + } + this.dayPassNum7 = sum; + // console.log('10车间昨日合格数:',this.dayPassNum7); + // debugger; + }); + //10车间昨日合格数 + that.$API.bi.dataset.exec.req('lineDay', obj10).then((res10) => { + console.log('10车间昨日合格数:',res10); + let list10 = res10.data2.ds0; + let sum = 0; + if(list10.length>0){ + list10.forEach(item => { + sum = sum+item.合格数; + }); + } + this.dayPassNum10 = sum; + // console.log('10车间昨日合格数:',this.dayPassNum10); + // debugger; + }); + //6车昨日交付数 + that.$API.bi.dataset.exec.req('saleOutDay', obj6).then((res6) => { + // console.log('6车间按日交付统计:',res6); + let list6 = res6.data2.ds0; + let sum = 0; + if(list6.length>0){ + list6.forEach(item => { + sum = sum+item.交付数; + }); + } + this.dayPayNum6 = sum; + // console.log('6车间本月交付数:',this.dayPayNum6); + // debugger; + }); + }, + //本月合格数&本月交付统计 + getMonthData(){ + let that = this; + let start_date = that.year_s+'-'+that.month_s+'-01'; + let end_date = that.year_s+'-'+that.month_s+'-'+that.day_s; + let obj6 ={ + query: {start_date:start_date,end_date:end_date}, + }; + let obj7 ={ + query: {start_date:start_date,end_date:end_date,dept_name: "7车间"}, + }; + let obj10 ={ + query: {start_date:start_date,end_date:end_date,dept_name: "10车间"}, + }; + //7车间本月合格率 + that.$API.bi.dataset.exec.req('lineMonth', obj7).then((res7) => { + // console.log('7车间本月合格率:',res7); + let list7 = res7.data2.ds0; + let sum = 0,rate=0; + if(list7.length>0){ + list7.forEach(item => { + sum = sum+item.合格率; + }); + rate = sum/list7.length; + } + this.monthPassRate7 = rate; + // console.log('7车间本月合格率:',this.monthPassRate7); + // debugger; + }); + //10车间本月合格率 + that.$API.bi.dataset.exec.req('lineMonth', obj10).then((res10) => { + // console.log('10车间本月合格率:',res10); + this.monthPassRate10 = 0; + let list10 = res10.data2.ds0; + let sum = 0,rate=0; + if(list10.length>0){ + list10.forEach(item => { + sum = sum+item.合格率; + }); + rate = sum/list10.length; + } + this.monthPassRate10 = rate; + // console.log('10车间本月合格率:',this.monthPassRate10); + // debugger; + }); + //6车间本月交付数 + that.$API.bi.dataset.exec.req('saleOutMonth', obj6).then((res6) => { + // console.log('6车间本月交付数:',res6); + let list6 = res6.data2.ds0; + let sum = 0; + list6.forEach(item => { + sum = sum+item.交付数; + }); + this.monthPayNum6 = sum; + // console.log('6车间本月交付数:',this.monthPayNum6); + // debugger; + }); + //本月合格率 + }, + //获取昨日AVG的生产记录 + getAVGDayData(){ + let that = this; + let date = that.yesterday; + this.$API.wpm.otherlog.list.req({product:'AVG',page:0,handle_date__gte:date,handle_date__lte:date}).then(res=>{ + let list = res; + let count_ok = 0,count_delivered = 0; + if(list.length>0){ + list.forEach(item=>{ + count_ok=count_ok+item.count_ok; + count_delivered = count_delivered+item.count_delivered; + }) + that.dayAVGcountOk = count_ok; + that.dayAVGcountDelivered = count_delivered; + } + }) + }, + getAVGMonthData(){ + let that = this; + let start_date = that.year_s+'-'+that.month_s+'-01'; + let end_date = that.year_s+'-'+that.month_s+'-'+that.day_s; + let obj ={ + query: {start_date:start_date,end_date:end_date}, + }; + that.$API.bi.dataset.exec.req('AVGMonth', obj).then((res) => { + let list = res.data2.ds0; + let sum = 0,count_real=0,count_ok=0; + list.forEach(item => { + sum = sum+item.交付数; + count_ok = count_ok+item.count_ok; + count_real = count_real+item.count_real; + }); + this.monthPayNumAVG = sum; + if(count_real!=0){ + this.monthRateAVG = Math.floor((count_ok/count_real)*100) + }else{ + this.monthRateAVG = 0; + } + + }); + }, + getProductStatistic(){ + let that = this; + let start_date = that.year_s+'-'+that.month_s+'-01'; + let end_date = that.year_s+'-'+that.month_s+'-'+that.day_s; + let obj ={ + query: {start_date:start_date,end_date:end_date,dept_name:this.deptName}, + }; + that.$API.bi.dataset.exec.req('productStatistic', obj).then((res) => { + console.log('productStatistic:',res); + let list = res.data2.ds0; + let chartData = [],xAxisData=[]; + for(let i=0;i -