统计分析导出
This commit is contained in:
commit
b7cb025304
|
|
@ -2296,12 +2296,22 @@ const routes = [
|
||||||
"perms": ["statistic_wpm"]
|
"perms": ["statistic_wpm"]
|
||||||
},
|
},
|
||||||
"children": [
|
"children": [
|
||||||
|
{
|
||||||
|
"name": "hunliao",
|
||||||
|
"path": "/statistic/hunliao",
|
||||||
|
"meta": {
|
||||||
|
"title": "混料统计",
|
||||||
|
"icon": "el-icon-DataAnalysis",
|
||||||
|
"perms": ["statistic_wpm"]
|
||||||
|
},
|
||||||
|
"component": "statistics/hunliao.vue"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "pass_num",
|
"name": "pass_num",
|
||||||
"path": "/statistic/pass_num",
|
"path": "/statistic/pass_num",
|
||||||
"meta": {
|
"meta": {
|
||||||
"title": "合格数统计",
|
"title": "合格数统计",
|
||||||
"icon": "el-icon-cellphone",
|
"icon": "el-icon-DataAnalysis",
|
||||||
"perms": ["statistic_wpm"]
|
"perms": ["statistic_wpm"]
|
||||||
},
|
},
|
||||||
"component": "statistics/pass_num.vue"
|
"component": "statistics/pass_num.vue"
|
||||||
|
|
@ -2311,7 +2321,7 @@ const routes = [
|
||||||
"path": "/statistic/task_rate",
|
"path": "/statistic/task_rate",
|
||||||
"meta": {
|
"meta": {
|
||||||
"title": "任务进度",
|
"title": "任务进度",
|
||||||
"icon": "el-icon-cellphone",
|
"icon": "el-icon-DataAnalysis",
|
||||||
"perms": ["statistic_wpm"]
|
"perms": ["statistic_wpm"]
|
||||||
},
|
},
|
||||||
"component": "statistics/task_rate.vue"
|
"component": "statistics/task_rate.vue"
|
||||||
|
|
@ -2321,7 +2331,7 @@ const routes = [
|
||||||
"path": "/statistic/ppass_num",
|
"path": "/statistic/ppass_num",
|
||||||
"meta": {
|
"meta": {
|
||||||
"title": "工序合格数",
|
"title": "工序合格数",
|
||||||
"icon": "el-icon-cellphone",
|
"icon": "el-icon-DataAnalysis",
|
||||||
"perms": ["statistic_wpm"]
|
"perms": ["statistic_wpm"]
|
||||||
},
|
},
|
||||||
"component": "statistics/ppass_num.vue"
|
"component": "statistics/ppass_num.vue"
|
||||||
|
|
@ -2344,7 +2354,7 @@ const routes = [
|
||||||
"path": "/statistic/product_check",
|
"path": "/statistic/product_check",
|
||||||
"meta": {
|
"meta": {
|
||||||
"title": "生产检验统计",
|
"title": "生产检验统计",
|
||||||
"icon": "el-icon-cellphone",
|
"icon": "el-icon-DataAnalysis",
|
||||||
"perms": ["statistic_qm"]
|
"perms": ["statistic_qm"]
|
||||||
},
|
},
|
||||||
"component": "statistics/product_check.vue"
|
"component": "statistics/product_check.vue"
|
||||||
|
|
@ -2354,7 +2364,7 @@ const routes = [
|
||||||
"path": "/statistic/product_check2",
|
"path": "/statistic/product_check2",
|
||||||
"meta": {
|
"meta": {
|
||||||
"title": "生产检验统计(粗加工)",
|
"title": "生产检验统计(粗加工)",
|
||||||
"icon": "el-icon-cellphone",
|
"icon": "el-icon-DataAnalysis",
|
||||||
"perms": ["statistic_qm"]
|
"perms": ["statistic_qm"]
|
||||||
},
|
},
|
||||||
"component": "statistics/product_check2.vue"
|
"component": "statistics/product_check2.vue"
|
||||||
|
|
@ -2364,7 +2374,7 @@ const routes = [
|
||||||
"path": "/statistic/inm_check",
|
"path": "/statistic/inm_check",
|
||||||
"meta": {
|
"meta": {
|
||||||
"title": "库存检验统计",
|
"title": "库存检验统计",
|
||||||
"icon": "el-icon-cellphone",
|
"icon": "el-icon-DataAnalysis",
|
||||||
"perms": ["statistic_qm"]
|
"perms": ["statistic_qm"]
|
||||||
},
|
},
|
||||||
"component": "statistics/inm_check.vue"
|
"component": "statistics/inm_check.vue"
|
||||||
|
|
@ -2374,7 +2384,7 @@ const routes = [
|
||||||
"path": "/statistic/good_check",
|
"path": "/statistic/good_check",
|
||||||
"meta": {
|
"meta": {
|
||||||
"title": "成品检验统计",
|
"title": "成品检验统计",
|
||||||
"icon": "el-icon-cellphone",
|
"icon": "el-icon-DataAnalysis",
|
||||||
"perms": ["statistic_qm"]
|
"perms": ["statistic_qm"]
|
||||||
},
|
},
|
||||||
"component": "statistics/good_check.vue"
|
"component": "statistics/good_check.vue"
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,328 @@
|
||||||
|
<template>
|
||||||
|
<el-container>
|
||||||
|
<el-header>
|
||||||
|
<div class="right-panel">
|
||||||
|
<el-select v-model="queryType" @change="queryTypeChange" style="width:100px">
|
||||||
|
<el-option v-for="item in typeOptions" :key="item" :label="item" :value="item">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
<el-date-picker v-if="queryType == '月'" v-model="queryDate" type="month" placeholder="查询月期"
|
||||||
|
value-format="YYYY-MM" style="width:200px">
|
||||||
|
</el-date-picker>
|
||||||
|
<el-date-picker v-if="queryType == '年'" v-model="queryDate" type="year" placeholder="查询年份"
|
||||||
|
value-format="YYYY" style="width:200px">
|
||||||
|
</el-date-picker>
|
||||||
|
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
|
||||||
|
</div>
|
||||||
|
</el-header>
|
||||||
|
<el-main>
|
||||||
|
<el-card shadow="never" style="margin-bottom: 8px;">
|
||||||
|
<el-row :gutter="10">
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-card shadow="never">
|
||||||
|
<div id="bachart1" style="width:100%;height:300px;"></div>
|
||||||
|
<!-- <scEcharts height="300px" :option="option"></scEcharts> -->
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-card shadow="never">
|
||||||
|
<el-table :data="tableData7">
|
||||||
|
<el-table-column type="index" width="50" />
|
||||||
|
<el-table-column label="物料名" prop="物料名">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="月份" prop="月" v-if="queryType == '年'">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="周" prop="周" v-else>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="规格" prop="规格">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="型号" prop="型号">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="桶数" prop="合格数">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="总重量" prop="总重量">
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-card>
|
||||||
|
<el-card shadow="never" style="margin-bottom: 8px;">
|
||||||
|
<el-row :gutter="10">
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-card shadow="never">
|
||||||
|
<div id="bachart2" style="width:100%;height:300px;"></div>
|
||||||
|
<!-- <scEcharts height="300px" :option="option"></scEcharts> -->
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-card shadow="never">
|
||||||
|
<el-table :data="tableData10">
|
||||||
|
<el-table-column type="index" width="50" />
|
||||||
|
<el-table-column label="物料名" prop="物料名">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="月份" prop="月" v-if="queryType == '年'">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="周" prop="周" v-else>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="规格" prop="规格">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="型号" prop="型号">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="数量" prop="数量">
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-card>
|
||||||
|
</el-main>
|
||||||
|
</el-container>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import * as echarts from "echarts";
|
||||||
|
import T from '@/components/scEcharts/echarts-theme-T.js';
|
||||||
|
echarts.registerTheme('T', T);
|
||||||
|
import scEcharts from '@/components/scEcharts';
|
||||||
|
function deepCopy(obj) {
|
||||||
|
return JSON.parse(JSON.stringify(obj));
|
||||||
|
}
|
||||||
|
export default {
|
||||||
|
name: 'chart',
|
||||||
|
components: {
|
||||||
|
scEcharts
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
queryType: '月',
|
||||||
|
queryDate: '',
|
||||||
|
start_date: '',
|
||||||
|
end_date: '',
|
||||||
|
currentYear: '',
|
||||||
|
currentMonth: '',
|
||||||
|
xAxisOrigin: [],
|
||||||
|
xAxisData: [],
|
||||||
|
typeOptions: ['月', '年'],
|
||||||
|
basicOption: {
|
||||||
|
backgroundColor: 'transparent',
|
||||||
|
title: {
|
||||||
|
text: '',
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
top: '80px'
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'axis'
|
||||||
|
},
|
||||||
|
xAxis: {
|
||||||
|
type: 'category',
|
||||||
|
data: []
|
||||||
|
},
|
||||||
|
yAxis: {
|
||||||
|
type: 'value'
|
||||||
|
},
|
||||||
|
lenged: [],
|
||||||
|
series: [{
|
||||||
|
data: [0, 0, 0, 0, 0, 0, 0],
|
||||||
|
stack: 'Ad',
|
||||||
|
type: 'bar',
|
||||||
|
barWidth: '15px',
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
tableData7: [],
|
||||||
|
tableData10: [],
|
||||||
|
firstWeekNum: 1,
|
||||||
|
endWeekNum: 4,
|
||||||
|
monthList: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
let that = this;
|
||||||
|
let date = new Date();
|
||||||
|
let year = date.getFullYear();
|
||||||
|
let month = date.getMonth() + 1;
|
||||||
|
let days = new Date(year, month, 0).getDate();
|
||||||
|
that.currentYear = year;
|
||||||
|
that.currentMonth = month;
|
||||||
|
that.start_date = year + '-' + month + '-01';
|
||||||
|
that.end_date = year + '-' + month + '-' + new Date(year, month, 0).getDate();
|
||||||
|
let month1 = month;
|
||||||
|
if (month1 < 10) { month1 = '0' + month1 }
|
||||||
|
that.queryDate = year + '-' + month1;
|
||||||
|
that.firstWeekNum = that.getWeekOfYear(new Date(that.start_date));
|
||||||
|
that.endWeekNum = that.getWeekOfYear(new Date(that.end_date));
|
||||||
|
let duration = that.endWeekNum - that.firstWeekNum + 1;
|
||||||
|
for (let i = 1; i <= duration; i++) {
|
||||||
|
that.xAxisOrigin.push('第' + i + '周');
|
||||||
|
}
|
||||||
|
that.xAxisData = that.xAxisOrigin;
|
||||||
|
that.getData7();
|
||||||
|
that.getData10();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
setChart(name, option = null) {
|
||||||
|
// 根据name 渲染数据, option需填写,否则option为模拟数据
|
||||||
|
var myChart = echarts.getInstanceByDom(document.getElementById(name));
|
||||||
|
if (myChart == undefined) {
|
||||||
|
myChart = echarts.init(document.getElementById(name), 'T');
|
||||||
|
}
|
||||||
|
if (option == null) {
|
||||||
|
option = Object.assign({}, this.basicOption)
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
try {
|
||||||
|
myChart.setOption(option);
|
||||||
|
} catch (error) { }
|
||||||
|
}, 500)
|
||||||
|
},
|
||||||
|
queryTypeChange(value) {
|
||||||
|
console.log(value)
|
||||||
|
this.queryDate = '';
|
||||||
|
},
|
||||||
|
getWeekOfYear(date) {
|
||||||
|
var target = new Date(date.getFullYear(), date.getMonth(), date.getDate()); // 创建目标日期对象
|
||||||
|
var firstDayOfYear = new Date(target.getFullYear(), 0, 1); // 创建当前年份第一天的日期对象
|
||||||
|
if (target.getTime() == firstDayOfYear.getTime()) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return Math.ceil((target - firstDayOfYear + 8 * (firstDayOfYear.getTimezoneOffset() / 480)) / 604800000);
|
||||||
|
}
|
||||||
|
// 计算两者之间相隔的周数并返回结果
|
||||||
|
},
|
||||||
|
getData7() {
|
||||||
|
let that = this;
|
||||||
|
let obj = {
|
||||||
|
query: { start_date: that.start_date, end_date: that.end_date, mgroup_name: "混料", is_count_utask: 0 },
|
||||||
|
};
|
||||||
|
let option = deepCopy(that.basicOption);
|
||||||
|
option.xAxis.data = that.xAxisData;
|
||||||
|
option.title.text = '混料统计';
|
||||||
|
let exec = that.queryType == '月' ? 'lineWeek' : 'lineMonth';
|
||||||
|
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
||||||
|
let tableData7 = res.data2.ds0 ? res.data2.ds0 : [];
|
||||||
|
that.tableData7 = tableData7;
|
||||||
|
debugger;
|
||||||
|
if (tableData7.length > 0) {
|
||||||
|
debugger;
|
||||||
|
option.series = [];
|
||||||
|
let seriesData = [], nameList = [];
|
||||||
|
tableData7.forEach(ite => {
|
||||||
|
if (nameList.indexOf(ite.物料名) > -1) { } else {
|
||||||
|
nameList.push(ite.物料名);
|
||||||
|
seriesData.push([])
|
||||||
|
}
|
||||||
|
})
|
||||||
|
tableData7.forEach(item => {
|
||||||
|
let indexX = 0, indexY = 0;
|
||||||
|
if (that.queryType == '月') {
|
||||||
|
indexX = nameList.indexOf(item.物料名);
|
||||||
|
indexY = item.周 - that.firstWeekNum;
|
||||||
|
} else {
|
||||||
|
indexX = nameList.indexOf(item.物料名);
|
||||||
|
indexY = item.月 - 1;
|
||||||
|
}
|
||||||
|
seriesData[indexX][indexY] = item.合格数;
|
||||||
|
});
|
||||||
|
for (let n = 0; n < seriesData.length; n++) {
|
||||||
|
let obj = {};
|
||||||
|
obj.name = nameList[n];
|
||||||
|
obj.stack = 'Ad';
|
||||||
|
obj.type = 'bar';
|
||||||
|
obj.barWidth = '15px';
|
||||||
|
obj.data = seriesData[n];
|
||||||
|
option.series.push(obj)
|
||||||
|
}
|
||||||
|
that.setChart("bachart1", option);
|
||||||
|
} else {
|
||||||
|
that.setChart("bachart1", option);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getData10() {
|
||||||
|
let that = this;
|
||||||
|
let option = deepCopy(that.basicOption);
|
||||||
|
option.xAxis.data = that.xAxisData;
|
||||||
|
option.title.text = '混料消耗统计';
|
||||||
|
let obj = {
|
||||||
|
query: { start_date: that.start_date, end_date: that.end_date, mio_type: "do_in", material_type: 30, material_id: "" },
|
||||||
|
};
|
||||||
|
let exec = that.queryType == '月' ? 'saleOutWeek' : 'saleOutMonth';
|
||||||
|
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
||||||
|
// console.log('10生产车间统计:',res);
|
||||||
|
let tableData10 = res.data2.ds0 ? res.data2.ds0 : [];
|
||||||
|
that.tableData10 = tableData10;
|
||||||
|
if (tableData10.length > 0) {
|
||||||
|
option.series = [];
|
||||||
|
let seriesData = [], nameList = [];
|
||||||
|
tableData10.forEach(ite => {
|
||||||
|
if (nameList.indexOf(ite.物料名) > -1) { } else {
|
||||||
|
nameList.push(ite.物料名);
|
||||||
|
seriesData.push([])
|
||||||
|
}
|
||||||
|
})
|
||||||
|
tableData10.forEach(item => {
|
||||||
|
let indexX = 0, indexY = 0;
|
||||||
|
if (that.queryType == '月') {
|
||||||
|
indexX = nameList.indexOf(item.物料名);
|
||||||
|
indexY = item.周 - that.firstWeekNum;
|
||||||
|
} else {
|
||||||
|
indexX = nameList.indexOf(item.物料名);
|
||||||
|
indexY = item.月 - 1;
|
||||||
|
}
|
||||||
|
seriesData[indexX][indexY] = item.合格数;
|
||||||
|
});
|
||||||
|
for (let n = 0; n < seriesData.length; n++) {
|
||||||
|
let obj = {};
|
||||||
|
obj.name = nameList[n];
|
||||||
|
obj.stack = 'Ad';
|
||||||
|
obj.type = 'bar';
|
||||||
|
obj.barWidth = '15px';
|
||||||
|
obj.data = seriesData[n];
|
||||||
|
option.series.push(obj)
|
||||||
|
}
|
||||||
|
that.setChart("bachart2", option);
|
||||||
|
} else {
|
||||||
|
that.setChart("bachart2", option);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleQuery() {
|
||||||
|
let that = this;
|
||||||
|
if (this.queryType == '月') {
|
||||||
|
if (this.queryDate !== '' && this.queryDate !== null) {
|
||||||
|
this.start_date = this.queryDate + '-01';
|
||||||
|
let arr = this.queryDate.split('-');
|
||||||
|
this.end_date = this.queryDate + '-' + new Date(arr[0], arr[1], 0).getDate();
|
||||||
|
this.firstWeekNum = this.getWeekOfYear(new Date(this.start_date));
|
||||||
|
this.endWeekNum = this.getWeekOfYear(new Date(this.end_date));
|
||||||
|
let duration = this.endWeekNum - this.firstWeekNum + 1;
|
||||||
|
let xAxisData = [];
|
||||||
|
for (let i = 1; i <= duration; i++) {
|
||||||
|
xAxisData.push('第' + i + '周');
|
||||||
|
}
|
||||||
|
that.xAxisData = xAxisData;
|
||||||
|
} else {
|
||||||
|
this.start_date = this.currentYear + '-' + this.currentMonth + '-01';
|
||||||
|
this.end_date = this.currentYear + '-' + this.currentMonth + '-' + new Date(this.currentYear, this.currentMonth, 0).getDate();
|
||||||
|
let date = new Date(this.start_date);
|
||||||
|
this.firstWeekNum = this.getWeekOfYear(date);
|
||||||
|
this.xAxisData = this.xAxisOrigin;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (this.queryDate !== '' && this.queryDate !== null) {
|
||||||
|
this.start_date = this.queryDate + '-01-01';
|
||||||
|
this.end_date = this.queryDate + '-12-31';
|
||||||
|
} else {
|
||||||
|
this.start_date = this.currentYear + '-01-01';
|
||||||
|
this.end_date = this.currentYear + '-12-31';
|
||||||
|
}
|
||||||
|
that.xAxisData = that.monthList;
|
||||||
|
}
|
||||||
|
this.getData7();
|
||||||
|
this.getData10();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style></style>
|
||||||
|
|
@ -38,6 +38,8 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="型号" prop="型号">
|
<el-table-column label="型号" prop="型号">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="任务数" prop="任务数">
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="生产数" prop="生产数">
|
<el-table-column label="生产数" prop="生产数">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="合格数" prop="合格数">
|
<el-table-column label="合格数" prop="合格数">
|
||||||
|
|
@ -73,6 +75,8 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="型号" prop="型号">
|
<el-table-column label="型号" prop="型号">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="任务数" prop="任务数">
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="生产数" prop="生产数">
|
<el-table-column label="生产数" prop="生产数">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="合格数" prop="合格数">
|
<el-table-column label="合格数" prop="合格数">
|
||||||
|
|
@ -108,6 +112,8 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="型号" prop="型号">
|
<el-table-column label="型号" prop="型号">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="任务数" prop="任务数">
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="生产数" prop="生产数">
|
<el-table-column label="生产数" prop="生产数">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="合格数" prop="合格数">
|
<el-table-column label="合格数" prop="合格数">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue