fix:光子统计部分更新
This commit is contained in:
parent
1a4449e766
commit
073fd4eb9d
|
|
@ -15,29 +15,47 @@
|
||||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
|
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-main>
|
<el-main id="mainDom">
|
||||||
<el-card shadow="never" style="margin-bottom: 8px;">
|
<el-card shadow="never" style="margin-bottom: 8px;">
|
||||||
<el-row :gutter="10">
|
<el-row :gutter="10">
|
||||||
<el-col :lg="12">
|
<el-col :lg="11">
|
||||||
<el-card shadow="never">
|
<el-card shadow="never">
|
||||||
<div id="bachart1" style="width:100%;height:300px;"></div>
|
<div id="bachart1" style="width:100%;height:300px;"></div>
|
||||||
<!-- <scEcharts height="300px" :option="option"></scEcharts> -->
|
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :lg="12">
|
<el-col :lg="13">
|
||||||
<el-card shadow="never" style="position: relative;">
|
<el-card shadow="never" style="position: relative;">
|
||||||
<el-button @click="handleExport('1')" class="tables" type="primary">导出</el-button>
|
<el-button @click="handleExport('1')" class="tables" type="primary">导出</el-button>
|
||||||
<el-table :data="tableData7" id="exportDiv1" :height="300">
|
<el-table :data="dataList" id="exportDiv1" :height="tableHeight" :summary-method="getSummaries" show-summary>
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50" />
|
||||||
<el-table-column label="物料名" prop="物料名">
|
<el-table-column label="物料名" prop="物料名"
|
||||||
|
:filters="nameFilters"
|
||||||
|
:filter-method="filterName"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="月份" prop="月" v-if="queryType == '年'">
|
<el-table-column
|
||||||
|
v-if="queryType == '年'"
|
||||||
|
label="月份" prop="月"
|
||||||
|
:filters="dateFilters"
|
||||||
|
:filter-method="filterMonth"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="周" prop="周" v-else>
|
<el-table-column
|
||||||
|
v-else
|
||||||
|
label="周" prop="周"
|
||||||
|
:filters="dateFilters"
|
||||||
|
:filter-method="filterWeek"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="规格" prop="规格">
|
<el-table-column label="规格" prop="规格"
|
||||||
|
:filters="specsFilters"
|
||||||
|
:filter-method="filterSpecs"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="型号" prop="型号">
|
<el-table-column label="型号" prop="型号"
|
||||||
|
:filters="modelFilters"
|
||||||
|
:filter-method="filterModel"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="桶数" prop="合格数">
|
<el-table-column label="桶数" prop="合格数">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
@ -48,37 +66,7 @@
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card shadow="never" style="margin-bottom: 8px;">
|
</el-main>
|
||||||
<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" style="position: relative;">
|
|
||||||
<el-button @click="handleExport('2')" class="tables" type="primary">导出</el-button>
|
|
||||||
<el-table :data="tableData10" id="exportDiv2" :height="300">
|
|
||||||
<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>
|
</el-container>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
|
@ -96,6 +84,7 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
tableHeight: 300,
|
||||||
queryType: '月',
|
queryType: '月',
|
||||||
queryDate: '',
|
queryDate: '',
|
||||||
start_date: '',
|
start_date: '',
|
||||||
|
|
@ -131,10 +120,15 @@ export default {
|
||||||
barWidth: '15px',
|
barWidth: '15px',
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
tableData7: [],
|
dataList: [],
|
||||||
tableData10: [],
|
tableData10: [],
|
||||||
firstWeekNum: 1,
|
firstWeekNum: 1,
|
||||||
endWeekNum: 4,
|
endWeekNum: 4,
|
||||||
|
nameFilters: [],
|
||||||
|
dateFilters:[],
|
||||||
|
specsFilters:[],
|
||||||
|
modelFilters:[],
|
||||||
|
monthFilters:[1,2,3,4,5,,6,7,8,9,10,11,12],
|
||||||
monthList: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']
|
monthList: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -146,20 +140,23 @@ export default {
|
||||||
let days = new Date(year, month, 0).getDate();
|
let days = new Date(year, month, 0).getDate();
|
||||||
that.currentYear = year;
|
that.currentYear = year;
|
||||||
that.currentMonth = month;
|
that.currentMonth = month;
|
||||||
|
that.firstWeekNum = that.getWeekOfYear(year,month,1);
|
||||||
|
that.endWeekNum = that.getWeekOfYear(year,month,days);
|
||||||
|
month = month < 10 ? '0' + month : month;
|
||||||
that.start_date = year + '-' + month + '-01';
|
that.start_date = year + '-' + month + '-01';
|
||||||
that.end_date = year + '-' + month + '-' + new Date(year, month, 0).getDate();
|
that.end_date = year + '-' + month + '-' + days;
|
||||||
let month1 = month;
|
that.queryDate = year + '-' + 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;
|
let duration = that.endWeekNum - that.firstWeekNum + 1;
|
||||||
for (let i = 1; i <= duration; i++) {
|
for (let i = 1; i <= duration; i++) {
|
||||||
that.xAxisOrigin.push('第' + i + '周');
|
that.xAxisOrigin.push('第' + i + '周');
|
||||||
}
|
}
|
||||||
that.xAxisData = that.xAxisOrigin;
|
that.xAxisData = that.xAxisOrigin;
|
||||||
that.getData7();
|
let height = document.getElementById('mainDom').clientHeight;
|
||||||
that.getData10();
|
console.log('height',height);
|
||||||
|
height= height-60;
|
||||||
|
that.tableHeight = height;
|
||||||
|
document.getElementById('bachart1').style.height = height + 'px';
|
||||||
|
that.getDataHL();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
setChart(name, option = null) {
|
setChart(name, option = null) {
|
||||||
|
|
@ -181,18 +178,21 @@ export default {
|
||||||
console.log(value)
|
console.log(value)
|
||||||
this.queryDate = '';
|
this.queryDate = '';
|
||||||
},
|
},
|
||||||
getWeekOfYear(date) {
|
getWeekOfYear(a,b,c) {
|
||||||
var target = new Date(date.getFullYear(), date.getMonth(), date.getDate()); // 创建目标日期对象
|
var date1 = new Date(a, parseInt(b) - 1, c), //当前日期
|
||||||
var firstDayOfYear = new Date(target.getFullYear(), 0, 1); // 创建当前年份第一天的日期对象
|
date2 = new Date(a, 0, 1), //当年第一天
|
||||||
if (target.getTime() == firstDayOfYear.getTime()) {
|
// d是当前日期是今年第多少天
|
||||||
return 1;
|
d = Math.round((date1.valueOf() - date2.valueOf()) / 86400000);
|
||||||
} else {
|
// d + 当前年的第一天的周差距的和在除以7就是本年第几周
|
||||||
return Math.ceil((target - firstDayOfYear + 8 * (firstDayOfYear.getTimezoneOffset() / 480)) / 604800000);
|
return Math.ceil((d + (date2.getDay() + 1 - 1)) / 7);
|
||||||
}
|
|
||||||
// 计算两者之间相隔的周数并返回结果
|
|
||||||
},
|
},
|
||||||
getData7() {
|
getDataHL() {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
let dateList = [],specsList=[],modelList=[];
|
||||||
|
that.dateFilters = [];
|
||||||
|
that.nameFilters = [];
|
||||||
|
that.modelFilters = [];
|
||||||
|
that.specsFilters = [];
|
||||||
let obj = {
|
let obj = {
|
||||||
query: { start_date: that.start_date, end_date: that.end_date, mgroup_name: "混料", is_count_utask: -1 },
|
query: { start_date: that.start_date, end_date: that.end_date, mgroup_name: "混料", is_count_utask: -1 },
|
||||||
};
|
};
|
||||||
|
|
@ -201,29 +201,53 @@ export default {
|
||||||
option.title.text = '混料统计';
|
option.title.text = '混料统计';
|
||||||
let exec = that.queryType == '月' ? 'lineWeek' : 'lineMonth';
|
let exec = that.queryType == '月' ? 'lineWeek' : 'lineMonth';
|
||||||
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
||||||
let tableData7 = res.data2.ds0 ? res.data2.ds0 : [];
|
let dataList = res.data2.ds0 ? res.data2.ds0 : [];
|
||||||
that.tableData7 = tableData7;
|
that.dataList = dataList;
|
||||||
debugger;
|
if (dataList.length > 0) {
|
||||||
if (tableData7.length > 0) {
|
|
||||||
debugger;
|
|
||||||
option.series = [];
|
option.series = [];
|
||||||
let seriesData = [], nameList = [];
|
let seriesData = [], nameList = [];
|
||||||
tableData7.forEach(ite => {
|
dataList.forEach(ite => {
|
||||||
if (nameList.indexOf(ite.物料名) > -1) { } else {
|
if (nameList.indexOf(ite.物料名) > -1) { } else {
|
||||||
nameList.push(ite.物料名);
|
nameList.push(ite.物料名);
|
||||||
seriesData.push([])
|
seriesData.push([0,0,0,0,0,0,0,0,0,0,0,0])
|
||||||
|
let obj = {};
|
||||||
|
obj.text = ite.物料名;
|
||||||
|
obj.value = ite.物料名;
|
||||||
|
that.nameFilters.push(obj);
|
||||||
|
}
|
||||||
|
if(modelList.indexOf(ite.型号)>-1){}else{
|
||||||
|
modelList.push(ite.型号);
|
||||||
|
let obj2 = {};
|
||||||
|
obj2.text = ite.型号;
|
||||||
|
obj2.value = ite.型号;
|
||||||
|
that.modelFilters.push(obj2);
|
||||||
|
}
|
||||||
|
if(specsList.indexOf(ite.规格)>-1){}else{
|
||||||
|
specsList.push(ite.规格);
|
||||||
|
let obj3 = {};
|
||||||
|
obj3.text = ite.规格;
|
||||||
|
obj3.value = ite.规格;
|
||||||
|
that.specsFilters.push(obj3);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
tableData7.forEach(item => {
|
dataList.forEach(item => {
|
||||||
let indexX = 0, indexY = 0;
|
let indexX = 0, indexY = 0;
|
||||||
if (that.queryType == '月') {
|
if (that.queryType == '月') {
|
||||||
indexX = nameList.indexOf(item.物料名);
|
indexX = nameList.indexOf(item.物料名);
|
||||||
indexY = item.周 - that.firstWeekNum;
|
indexY = item.周 - that.firstWeekNum;
|
||||||
|
if(dateList.indexOf(item.周)>-1){}else{
|
||||||
|
dateList.push(item.周);
|
||||||
|
let obj = {};
|
||||||
|
obj.text = item.周;
|
||||||
|
obj.value = item.周;
|
||||||
|
that.dateFilters.push(obj);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
that.dateFilters = [1,2,3,4,5,6,7,8,9,10,11,12];
|
||||||
indexX = nameList.indexOf(item.物料名);
|
indexX = nameList.indexOf(item.物料名);
|
||||||
indexY = item.月 - 1;
|
indexY = item.月 - 1;
|
||||||
}
|
}
|
||||||
seriesData[indexX][indexY] = item.合格数;
|
seriesData[indexX][indexY] += item.合格数;
|
||||||
});
|
});
|
||||||
for (let n = 0; n < seriesData.length; n++) {
|
for (let n = 0; n < seriesData.length; n++) {
|
||||||
let obj = {};
|
let obj = {};
|
||||||
|
|
@ -240,88 +264,84 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
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() {
|
handleQuery() {
|
||||||
let that = this;
|
let that = this;
|
||||||
if (this.queryType == '月') {
|
if (that.queryType == '月') {
|
||||||
if (this.queryDate !== '' && this.queryDate !== null) {
|
if (that.queryDate !== '' && that.queryDate !== null) {
|
||||||
this.start_date = this.queryDate + '-01';
|
let arr = that.queryDate.split('-');
|
||||||
let arr = this.queryDate.split('-');
|
let year = arr[0];
|
||||||
this.end_date = this.queryDate + '-' + new Date(arr[0], arr[1], 0).getDate();
|
let month = arr[1];
|
||||||
this.firstWeekNum = this.getWeekOfYear(new Date(this.start_date));
|
let days = new Date(year, month, 0).getDate();
|
||||||
this.endWeekNum = this.getWeekOfYear(new Date(this.end_date));
|
that.start_date = that.queryDate + '-01';
|
||||||
let duration = this.endWeekNum - this.firstWeekNum + 1;
|
that.end_date = that.queryDate + '-' + days;
|
||||||
|
that.firstWeekNum = that.getWeekOfYear(year,month,1);
|
||||||
|
that.endWeekNum = that.getWeekOfYear(year,month,days);
|
||||||
|
let duration = that.endWeekNum - that.firstWeekNum + 1;
|
||||||
let xAxisData = [];
|
let xAxisData = [];
|
||||||
for (let i = 1; i <= duration; i++) {
|
for (let i = 1; i <= duration; i++) {
|
||||||
xAxisData.push('第' + i + '周');
|
xAxisData.push('第' + i + '周');
|
||||||
}
|
}
|
||||||
that.xAxisData = xAxisData;
|
that.xAxisData = xAxisData;
|
||||||
} else {
|
} else {
|
||||||
this.start_date = this.currentYear + '-' + this.currentMonth + '-01';
|
that.start_date = that.currentYear + '-' + that.currentMonth + '-01';
|
||||||
this.end_date = this.currentYear + '-' + this.currentMonth + '-' + new Date(this.currentYear, this.currentMonth, 0).getDate();
|
that.end_date = that.currentYear + '-' + that.currentMonth + '-' + new Date(that.currentYear, that.currentMonth, 0).getDate();
|
||||||
let date = new Date(this.start_date);
|
that.firstWeekNum = that.getWeekOfYear(that.currentYear,that.currentMonth,1);
|
||||||
this.firstWeekNum = this.getWeekOfYear(date);
|
that.xAxisData = that.xAxisOrigin;
|
||||||
this.xAxisData = this.xAxisOrigin;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.queryDate !== '' && this.queryDate !== null) {
|
if (that.queryDate !== '' && that.queryDate !== null) {
|
||||||
this.start_date = this.queryDate + '-01-01';
|
that.start_date = that.queryDate + '-01-01';
|
||||||
this.end_date = this.queryDate + '-12-31';
|
that.end_date = that.queryDate + '-12-31';
|
||||||
} else {
|
} else {
|
||||||
this.start_date = this.currentYear + '-01-01';
|
that.start_date = that.currentYear + '-01-01';
|
||||||
this.end_date = this.currentYear + '-12-31';
|
that.end_date = that.currentYear + '-12-31';
|
||||||
}
|
}
|
||||||
that.xAxisData = that.monthList;
|
that.xAxisData = that.monthList;
|
||||||
}
|
}
|
||||||
this.getData7();
|
that.getDataHL();
|
||||||
this.getData10();
|
},
|
||||||
|
getSummaries({ columns, data }) {
|
||||||
|
const sums = [];
|
||||||
|
columns.forEach((column, index) => {
|
||||||
|
if (index === 0) {
|
||||||
|
sums[index] = "合计";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (index == 5||index == 6) {
|
||||||
|
const values = data.map((item) =>
|
||||||
|
Number(item[column.property])
|
||||||
|
);
|
||||||
|
if (!values.every((value) => Number.isNaN(value))) {
|
||||||
|
sums[index] = values.reduce((prev, curr) => {
|
||||||
|
const value = Number(curr); //Number转换为数值
|
||||||
|
let sum = Number(
|
||||||
|
Number(prev) + Number(curr)
|
||||||
|
).toFixed(2); //toFixed(2)数据项保留两位小数
|
||||||
|
if (!isNaN(value)) {
|
||||||
|
return sum;
|
||||||
|
} else {
|
||||||
|
return prev;
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return sums;
|
||||||
|
},
|
||||||
|
filterName(value, row) {
|
||||||
|
return row.物料名 === value;
|
||||||
|
},
|
||||||
|
filterMonth(value, row) {
|
||||||
|
return row.月 === value;
|
||||||
|
},
|
||||||
|
filterWeek(value, row) {
|
||||||
|
return row.周 === value;
|
||||||
|
},
|
||||||
|
filterSpecs(value, row) {
|
||||||
|
return row.规格 === value;
|
||||||
|
},
|
||||||
|
filterModel(value, row) {
|
||||||
|
return row.型号 === value;
|
||||||
},
|
},
|
||||||
handleExport(val) {
|
handleExport(val) {
|
||||||
this.exportLoading = true;
|
this.exportLoading = true;
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,21 @@
|
||||||
<el-header>
|
<el-header>
|
||||||
<div class="right-panel">
|
<div class="right-panel">
|
||||||
<h2>产品交付统计</h2>
|
<h2>产品交付统计</h2>
|
||||||
<el-select
|
<xtSelect
|
||||||
|
:apiObj="apiObjMaterial"
|
||||||
|
:params = "paramsMaterial"
|
||||||
|
v-model="materialSale"
|
||||||
|
v-model:label="materialName"
|
||||||
|
v-model:obj="materialItem"
|
||||||
|
@change="materialSaleChange"
|
||||||
|
>
|
||||||
|
<el-table-column type="index" width="50" />
|
||||||
|
<el-table-column label="名称" prop="name"></el-table-column>
|
||||||
|
<el-table-column label="规格" prop="specification"></el-table-column>
|
||||||
|
<el-table-column label="型号" prop="model"></el-table-column>
|
||||||
|
<el-table-column label="库存" prop="count"></el-table-column>
|
||||||
|
</xtSelect>
|
||||||
|
<!-- <el-select
|
||||||
v-model="materialSale"
|
v-model="materialSale"
|
||||||
clearable
|
clearable
|
||||||
@change="materialSaleChange"
|
@change="materialSaleChange"
|
||||||
|
|
@ -53,7 +67,7 @@
|
||||||
:value="item.id"
|
:value="item.id"
|
||||||
>
|
>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select> -->
|
||||||
</div>
|
</div>
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-row>
|
<el-row>
|
||||||
|
|
@ -81,32 +95,34 @@
|
||||||
:data="tableData1"
|
:data="tableData1"
|
||||||
id="exportDiv1"
|
id="exportDiv1"
|
||||||
:height="tableHeight"
|
:height="tableHeight"
|
||||||
|
:summary-method="getSummaries" show-summary
|
||||||
>
|
>
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50" />
|
||||||
<el-table-column
|
<el-table-column label="年份" prop="年" width="70"/>
|
||||||
label="年份"
|
<el-table-column v-if="queryType == '月'" width="60" label="周" prop="周"
|
||||||
prop="年"
|
:filters="dateFilters"
|
||||||
width="80"
|
:filter-method="filterDate"
|
||||||
/>
|
filter-placement="bottom-end"/>
|
||||||
<el-table-column
|
<el-table-column v-else width="60" label="月份" prop="月"
|
||||||
v-if="queryType == '月'"
|
:filters="dateFilters"
|
||||||
width="50"
|
:filter-method="filterDate"
|
||||||
label="周"
|
filter-placement="bottom-end"/>
|
||||||
prop="周"
|
<el-table-column label="名称" prop="物料名"
|
||||||
/>
|
:filters="nameFilters"
|
||||||
<el-table-column
|
:filter-method="filterName"
|
||||||
v-else
|
filter-placement="bottom-end">
|
||||||
width="50"
|
|
||||||
label="月份"
|
|
||||||
prop="月"
|
|
||||||
/>
|
|
||||||
<el-table-column label="名称" prop="物料名">
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="规格" prop="规格">
|
<el-table-column label="规格" prop="规格"
|
||||||
|
:filters="specsFilters"
|
||||||
|
:filter-method="filterSpecs"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="型号" prop="型号">
|
<el-table-column label="型号" prop="型号"
|
||||||
|
:filters="modelFilters"
|
||||||
|
:filter-method="filterModel"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="数量" prop="count">
|
<el-table-column label="数量" prop="数量">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
@ -134,30 +150,33 @@
|
||||||
id="exportDiv2"
|
id="exportDiv2"
|
||||||
:height="rightHeight"
|
:height="rightHeight"
|
||||||
hideDo
|
hideDo
|
||||||
|
hidePagination
|
||||||
|
:summary-method="getSummaries" show-summary
|
||||||
>
|
>
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50" />
|
||||||
<el-table-column
|
<el-table-column label="年份" prop="年" width="70"/>
|
||||||
label="年份"
|
<el-table-column v-if="queryType == '月'" width="70" label="周" prop="周"
|
||||||
prop="年"
|
:filters="dateFilters2"
|
||||||
width="80"
|
:filter-method="filterDate2"
|
||||||
/>
|
filter-placement="bottom-end"/>
|
||||||
<el-table-column
|
<el-table-column v-else width="70" label="月份" prop="月"
|
||||||
v-if="queryType == '月'"
|
:filters="dateFilters2"
|
||||||
width="50"
|
:filter-method="filterDate2"
|
||||||
label="周"
|
filter-placement="bottom-end"/>
|
||||||
prop="周"
|
<el-table-column label="名称" prop="物料名"
|
||||||
/>
|
:filters="nameFilters2"
|
||||||
<el-table-column
|
:filter-method="filterName2"
|
||||||
v-else
|
filter-placement="bottom-end">
|
||||||
width="50"
|
|
||||||
label="月份"
|
|
||||||
prop="月"
|
|
||||||
/>
|
|
||||||
<el-table-column label="名称" prop="物料名">
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="规格" prop="规格">
|
<el-table-column label="规格" prop="规格"
|
||||||
|
:filters="specsFilters2"
|
||||||
|
:filter-method="filterSpecs2"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="型号" prop="型号">
|
<el-table-column label="型号" prop="型号"
|
||||||
|
:filters="modelFilters2"
|
||||||
|
:filter-method="filterModel2"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="数量" prop="数量">
|
<el-table-column label="数量" prop="数量">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
@ -188,6 +207,7 @@ export default {
|
||||||
end_date: "",
|
end_date: "",
|
||||||
currentYear: "",
|
currentYear: "",
|
||||||
currentMonth: "",
|
currentMonth: "",
|
||||||
|
materialName: "",
|
||||||
xAxisOrigin: [],
|
xAxisOrigin: [],
|
||||||
xAxisData: [],
|
xAxisData: [],
|
||||||
typeOptions: ["月", "年"],
|
typeOptions: ["月", "年"],
|
||||||
|
|
@ -225,22 +245,20 @@ export default {
|
||||||
rightHeight: 0,
|
rightHeight: 0,
|
||||||
tableData1: [],
|
tableData1: [],
|
||||||
tableData2: [],
|
tableData2: [],
|
||||||
|
nameFilters: [],
|
||||||
|
dateFilters: [],
|
||||||
|
modelFilters: [],
|
||||||
|
specsFilters: [],
|
||||||
|
nameFilters2: [],
|
||||||
|
dateFilters2: [],
|
||||||
|
modelFilters2: [],
|
||||||
|
specsFilters2: [],
|
||||||
firstWeekNum: 1,
|
firstWeekNum: 1,
|
||||||
endWeekNum: 4,
|
endWeekNum: 4,
|
||||||
monthList: [
|
monthList: ["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],
|
||||||
"一月",
|
materialItem:{},
|
||||||
"二月",
|
paramsMaterial:{type__in : "10"},
|
||||||
"三月",
|
apiObjMaterial:this.$API.mtm.material.list,
|
||||||
"四月",
|
|
||||||
"五月",
|
|
||||||
"六月",
|
|
||||||
"七月",
|
|
||||||
"八月",
|
|
||||||
"九月",
|
|
||||||
"十月",
|
|
||||||
"十一月",
|
|
||||||
"十二月",
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
@ -251,16 +269,12 @@ export default {
|
||||||
let days = new Date(year, month, 0).getDate();
|
let days = new Date(year, month, 0).getDate();
|
||||||
that.currentYear = year;
|
that.currentYear = year;
|
||||||
that.currentMonth = month;
|
that.currentMonth = month;
|
||||||
|
that.firstWeekNum = that.getWeekOfYear(year,month,1);
|
||||||
|
that.endWeekNum = that.getWeekOfYear(year,month,days);
|
||||||
|
month = month < 10 ? "0" + month : month;
|
||||||
that.start_date = year + "-" + month + "-01";
|
that.start_date = year + "-" + month + "-01";
|
||||||
that.end_date =
|
that.end_date =year + "-" + month + "-" + days;
|
||||||
year + "-" + month + "-" + new Date(year, month, 0).getDate();
|
that.queryDate = year + "-" + month;
|
||||||
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;
|
let duration = that.endWeekNum - that.firstWeekNum + 1;
|
||||||
for (let i = 1; i <= duration; i++) {
|
for (let i = 1; i <= duration; i++) {
|
||||||
that.xAxisOrigin.push("第" + i + "周");
|
that.xAxisOrigin.push("第" + i + "周");
|
||||||
|
|
@ -272,17 +286,16 @@ export default {
|
||||||
that.rightHeight = height - 115;
|
that.rightHeight = height - 115;
|
||||||
that.getTable();
|
that.getTable();
|
||||||
that.setChart("bachart1", that.basicOption);
|
that.setChart("bachart1", that.basicOption);
|
||||||
this.getSaleOption();
|
// this.getSaleOption();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
setChart(name, option = null) {
|
setChart(name, option = null) {
|
||||||
// 根据name 渲染数据, option需填写,否则option为模拟数据
|
// 根据name 渲染数据, option需填写,否则option为模拟数据
|
||||||
var myChart = echarts.getInstanceByDom(
|
var myChart = echarts.getInstanceByDom(document.getElementById(name));
|
||||||
document.getElementById(name)
|
if (myChart != null) {
|
||||||
);
|
myChart.dispose(); // 销毁之前的实例
|
||||||
if (myChart == undefined) {
|
|
||||||
myChart = echarts.init(document.getElementById(name), "T");
|
|
||||||
}
|
}
|
||||||
|
myChart = echarts.init(document.getElementById(name), "T");
|
||||||
if (option == null) {
|
if (option == null) {
|
||||||
option = Object.assign({}, this.basicOption);
|
option = Object.assign({}, this.basicOption);
|
||||||
}
|
}
|
||||||
|
|
@ -296,24 +309,13 @@ export default {
|
||||||
console.log(value);
|
console.log(value);
|
||||||
this.queryDate = "";
|
this.queryDate = "";
|
||||||
},
|
},
|
||||||
getWeekOfYear(date) {
|
getWeekOfYear(a,b,c) {
|
||||||
var target = new Date(
|
var date1 = new Date(a, parseInt(b) - 1, c), //当前日期
|
||||||
date.getFullYear(),
|
date2 = new Date(a, 0, 1), //当年第一天
|
||||||
date.getMonth(),
|
// d是当前日期是今年第多少天
|
||||||
date.getDate()
|
d = Math.round((date1.valueOf() - date2.valueOf()) / 86400000);
|
||||||
); // 创建目标日期对象
|
// d + 当前年的第一天的周差距的和在除以7就是本年第几周
|
||||||
var firstDayOfYear = new Date(target.getFullYear(), 0, 1); // 创建当前年份第一天的日期对象
|
return Math.ceil((d + (date2.getDay() + 1 - 1)) / 7);
|
||||||
if (target.getTime() == firstDayOfYear.getTime()) {
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
return Math.ceil(
|
|
||||||
(target -
|
|
||||||
firstDayOfYear +
|
|
||||||
8 * (firstDayOfYear.getTimezoneOffset() / 480)) /
|
|
||||||
604800000
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// 计算两者之间相隔的周数并返回结果
|
|
||||||
},
|
},
|
||||||
materialSaleChange() {
|
materialSaleChange() {
|
||||||
this.getSaleData();
|
this.getSaleData();
|
||||||
|
|
@ -331,8 +333,12 @@ export default {
|
||||||
//交付物料
|
//交付物料
|
||||||
getSaleData() {
|
getSaleData() {
|
||||||
let that = this;
|
let that = this;
|
||||||
let option = deepCopy(that.basicOption);
|
that.tableData1 = [];
|
||||||
option.xAxis.data = that.xAxisData;
|
that.nameFilters = [];
|
||||||
|
that.dateFilters = [];
|
||||||
|
that.modelFilters = [];
|
||||||
|
that.specsFilters = [];
|
||||||
|
let nameList=[],dateList = [],specsList=[],modelList=[];
|
||||||
let exec = that.queryType == "月" ? "saleOutWeek" : "saleOutMonth";
|
let exec = that.queryType == "月" ? "saleOutWeek" : "saleOutMonth";
|
||||||
let obj = {
|
let obj = {
|
||||||
query: {
|
query: {
|
||||||
|
|
@ -343,30 +349,63 @@ export default {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
||||||
console.log("getSaleData", res);
|
if (res.data2.ds0&&res.data2.ds0.length>0) {
|
||||||
option.series.data = [];
|
|
||||||
if (res.data2.ds0) {
|
|
||||||
let data = res.data2.ds0;
|
let data = res.data2.ds0;
|
||||||
that.tableData1 = data;
|
that.tableData1 = data;
|
||||||
if (data.length > 0) {
|
data.forEach((ite) => {
|
||||||
let seriesData = [];
|
if (nameList.indexOf(ite.物料名) > -1) {
|
||||||
data.forEach((item) => {
|
} else {
|
||||||
if (that.queryType == "月") {
|
nameList.push(ite.物料名);
|
||||||
let index = item.周 - that.firstWeekNum;
|
let obj = {};
|
||||||
seriesData[index] = item.数量;
|
obj.text = ite.物料名;
|
||||||
} else {
|
obj.value = ite.物料名;
|
||||||
let index = item.月 - 1;
|
that.nameFilters.push(obj);
|
||||||
seriesData[index] = item.数量;
|
}
|
||||||
|
if(modelList.indexOf(ite.型号)>-1){}else{
|
||||||
|
modelList.push(ite.型号);
|
||||||
|
let obj2 = {};
|
||||||
|
obj2.text = ite.型号;
|
||||||
|
obj2.value = ite.型号;
|
||||||
|
that.modelFilters.push(obj2);
|
||||||
|
}
|
||||||
|
if(specsList.indexOf(ite.规格)>-1){}else{
|
||||||
|
specsList.push(ite.规格);
|
||||||
|
let obj3 = {};
|
||||||
|
obj3.text = ite.规格;
|
||||||
|
obj3.value = ite.规格;
|
||||||
|
that.specsFilters.push(obj3);
|
||||||
|
}
|
||||||
|
if(that.queryType == "月"){
|
||||||
|
if(dateList.indexOf(ite.周)>-1){}else{
|
||||||
|
dateList.push(ite.周);
|
||||||
|
let obj4 = {};
|
||||||
|
obj4.text = ite.周;
|
||||||
|
obj4.value = ite.周;
|
||||||
|
that.dateFilters.push(obj4);
|
||||||
}
|
}
|
||||||
});
|
}else{
|
||||||
option.series.data = seriesData;
|
that.dateFilters = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
that.setChartData(data);
|
||||||
|
}else{
|
||||||
|
let option = deepCopy(that.basicOption);
|
||||||
|
option.xAxis.data = that.xAxisData;
|
||||||
|
that.setChart("bachart1",option);
|
||||||
}
|
}
|
||||||
that.setChart("bachart1", option);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getTable() {
|
getTable() {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
that.nameFilters = [];
|
||||||
|
that.dateFilters = [];
|
||||||
|
that.modelFilters = [];
|
||||||
|
that.specsFilters = [];
|
||||||
|
that.nameFilters2 = [];
|
||||||
|
that.dateFilters2 = [];
|
||||||
|
that.modelFilters2 = [];
|
||||||
|
that.specsFilters2 = [];
|
||||||
|
let nameList=[],dateList = [],specsList=[],modelList=[];
|
||||||
let obj = {
|
let obj = {
|
||||||
query: {
|
query: {
|
||||||
start_date: that.start_date,
|
start_date: that.start_date,
|
||||||
|
|
@ -379,7 +418,50 @@ export default {
|
||||||
that.tableData2 = [];
|
that.tableData2 = [];
|
||||||
if (res.data2.ds0) {
|
if (res.data2.ds0) {
|
||||||
let data = res.data2.ds0;
|
let data = res.data2.ds0;
|
||||||
|
that.tableData1 = data;
|
||||||
that.tableData2 = data;
|
that.tableData2 = data;
|
||||||
|
if(data.length>0){
|
||||||
|
data.forEach((ite) => {
|
||||||
|
if (nameList.indexOf(ite.物料名) > -1) {
|
||||||
|
} else {
|
||||||
|
nameList.push(ite.物料名);
|
||||||
|
let obj = {};
|
||||||
|
obj.text = ite.物料名;
|
||||||
|
obj.value = ite.物料名;
|
||||||
|
that.nameFilters.push(obj);
|
||||||
|
}
|
||||||
|
if(modelList.indexOf(ite.型号)>-1){}else{
|
||||||
|
modelList.push(ite.型号);
|
||||||
|
let obj2 = {};
|
||||||
|
obj2.text = ite.型号;
|
||||||
|
obj2.value = ite.型号;
|
||||||
|
that.modelFilters.push(obj2);
|
||||||
|
}
|
||||||
|
if(specsList.indexOf(ite.规格)>-1){}else{
|
||||||
|
specsList.push(ite.规格);
|
||||||
|
let obj3 = {};
|
||||||
|
obj3.text = ite.规格;
|
||||||
|
obj3.value = ite.规格;
|
||||||
|
that.specsFilters.push(obj3);
|
||||||
|
}
|
||||||
|
if(that.queryType == "月"){
|
||||||
|
if(dateList.indexOf(ite.周)>-1){}else{
|
||||||
|
dateList.push(ite.周);
|
||||||
|
let obj4 = {};
|
||||||
|
obj4.text = ite.周;
|
||||||
|
obj4.value = ite.周;
|
||||||
|
that.dateFilters.push(obj4);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
that.dateFilters = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
|
||||||
|
}
|
||||||
|
that.nameFilters2 = that.nameFilters;
|
||||||
|
that.modelFilters2 = that.modelFilters;
|
||||||
|
that.specsFilters2 = that.specsFilters;
|
||||||
|
that.dateFilters2 = that.dateFilters;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
that.setChartData(data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -387,48 +469,33 @@ export default {
|
||||||
let that = this;
|
let that = this;
|
||||||
if (this.queryType == "月") {
|
if (this.queryType == "月") {
|
||||||
if (this.queryDate !== "" && this.queryDate !== null) {
|
if (this.queryDate !== "" && this.queryDate !== null) {
|
||||||
this.start_date = this.queryDate + "-01";
|
let arr = that.queryDate.split("-");
|
||||||
let arr = this.queryDate.split("-");
|
let year = arr[0];
|
||||||
this.end_date =
|
let month = arr[1];
|
||||||
this.queryDate +
|
let days = new Date(year, month, 0).getDate();
|
||||||
"-" +
|
that.start_date = that.queryDate + "-01";
|
||||||
new Date(arr[0], arr[1], 0).getDate();
|
that.end_date =that.queryDate +"-" +days;
|
||||||
this.firstWeekNum = this.getWeekOfYear(
|
that.firstWeekNum = that.getWeekOfYear(year,month,1);
|
||||||
new Date(this.start_date)
|
that.endWeekNum = that.getWeekOfYear(year,month,days);
|
||||||
);
|
let duration = that.endWeekNum - that.firstWeekNum + 1;
|
||||||
this.endWeekNum = this.getWeekOfYear(
|
|
||||||
new Date(this.end_date)
|
|
||||||
);
|
|
||||||
let duration = this.endWeekNum - this.firstWeekNum + 1;
|
|
||||||
let xAxisData = [];
|
let xAxisData = [];
|
||||||
for (let i = 1; i <= duration; i++) {
|
for (let i = 1; i <= duration; i++) {
|
||||||
xAxisData.push("第" + i + "周");
|
xAxisData.push("第" + i + "周");
|
||||||
}
|
}
|
||||||
that.xAxisData = xAxisData;
|
that.xAxisData = xAxisData;
|
||||||
} else {
|
} else {
|
||||||
this.start_date =
|
that.start_date =that.currentYear + "-" + that.currentMonth + "-01";
|
||||||
this.currentYear + "-" + this.currentMonth + "-01";
|
that.end_date =that.currentYear +"-" +that.currentMonth +"-" +new Date(that.currentYear,that.currentMonth,0).getDate();
|
||||||
this.end_date =
|
that.firstWeekNum = that.getWeekOfYear(that.currentYear,that.currentMonth,1);
|
||||||
this.currentYear +
|
that.xAxisData = that.xAxisOrigin;
|
||||||
"-" +
|
|
||||||
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 {
|
} else {
|
||||||
if (this.queryDate !== "" && this.queryDate !== null) {
|
if (that.queryDate !== "" && that.queryDate !== null) {
|
||||||
this.start_date = this.queryDate + "-01-01";
|
that.start_date = that.queryDate + "-01-01";
|
||||||
this.end_date = this.queryDate + "-12-31";
|
that.end_date = that.queryDate + "-12-31";
|
||||||
} else {
|
} else {
|
||||||
this.start_date = this.currentYear + "-01-01";
|
that.start_date = that.currentYear + "-01-01";
|
||||||
this.end_date = this.currentYear + "-12-31";
|
that.end_date = that.currentYear + "-12-31";
|
||||||
}
|
}
|
||||||
that.xAxisData = that.monthList;
|
that.xAxisData = that.monthList;
|
||||||
}
|
}
|
||||||
|
|
@ -437,6 +504,99 @@ export default {
|
||||||
that.getSaleData();
|
that.getSaleData();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
getSummaries({ columns, data }) {
|
||||||
|
const sums = [];
|
||||||
|
columns.forEach((column, index) => {
|
||||||
|
if (index === 0) {
|
||||||
|
sums[index] = "合计";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (index == 6) {
|
||||||
|
const values = data.map((item) =>
|
||||||
|
Number(item[column.property])
|
||||||
|
);
|
||||||
|
if (!values.every((value) => Number.isNaN(value))) {
|
||||||
|
sums[index] = values.reduce((prev, curr) => {
|
||||||
|
const value = Number(curr); //Number转换为数值
|
||||||
|
let sum = Number(
|
||||||
|
Number(prev) + Number(curr)
|
||||||
|
).toFixed(2); //toFixed(2)数据项保留两位小数
|
||||||
|
if (!isNaN(value)) {
|
||||||
|
return sum;
|
||||||
|
} else {
|
||||||
|
return prev;
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return sums;
|
||||||
|
},
|
||||||
|
setChartData(data){
|
||||||
|
let that = this;
|
||||||
|
let option = deepCopy(that.basicOption);
|
||||||
|
option.xAxis.data = that.xAxisData;
|
||||||
|
option.series=[];
|
||||||
|
let materials = [],seriesData = [];
|
||||||
|
data.forEach((item) => {
|
||||||
|
if(materials.indexOf(item.物料名) == -1){
|
||||||
|
materials.push(item.物料名);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
materials.forEach((item) => {
|
||||||
|
let obj = {};
|
||||||
|
obj.name = item;
|
||||||
|
obj.type = "bar";
|
||||||
|
obj.stack = "Ad";
|
||||||
|
obj.barWidth = "15px";
|
||||||
|
obj.data = [0,0,0,0,0,0,0,0,0,0,0,0];
|
||||||
|
seriesData.push(obj);
|
||||||
|
})
|
||||||
|
data.forEach((item) => {
|
||||||
|
let index = 0;let indexY = 0;
|
||||||
|
if (that.queryType == "月") {
|
||||||
|
index = item.周 - that.firstWeekNum;
|
||||||
|
} else {
|
||||||
|
index = item.月 - 1;
|
||||||
|
}
|
||||||
|
indexY = materials.indexOf(item.物料名);
|
||||||
|
seriesData[indexY].data[index] = item.数量;
|
||||||
|
});
|
||||||
|
option.series = seriesData;
|
||||||
|
that.setChart("bachart1", option);
|
||||||
|
},
|
||||||
|
filterName(value, row) {
|
||||||
|
return row.物料名 === value;
|
||||||
|
},
|
||||||
|
filterDate(value, row) {
|
||||||
|
if (this.queryType == "月") {
|
||||||
|
return row.周 === value;
|
||||||
|
}else{
|
||||||
|
return row.月 === value;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
filterSpecs(value, row) {
|
||||||
|
return row.规格 === value;
|
||||||
|
},
|
||||||
|
filterModel(value, row) {
|
||||||
|
return row.型号 === value;
|
||||||
|
},
|
||||||
|
filterName2(value, row) {
|
||||||
|
return row.物料名 === value;
|
||||||
|
},
|
||||||
|
filterDate2(value, row) {
|
||||||
|
if (this.queryType == "月") {
|
||||||
|
return row.周 === value;
|
||||||
|
}else{
|
||||||
|
return row.月 === value;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
filterSpecs2(value, row) {
|
||||||
|
return row.规格 === value;
|
||||||
|
},
|
||||||
|
filterModel2(value, row) {
|
||||||
|
return row.型号 === value;
|
||||||
|
},
|
||||||
handleExport(val) {
|
handleExport(val) {
|
||||||
this.exportLoading = true;
|
this.exportLoading = true;
|
||||||
let id = "#exportDiv" + val;
|
let id = "#exportDiv" + val;
|
||||||
|
|
|
||||||
|
|
@ -41,37 +41,27 @@
|
||||||
<el-header>
|
<el-header>
|
||||||
<div class="right-panel">
|
<div class="right-panel">
|
||||||
<h2>采购统计</h2>
|
<h2>采购统计</h2>
|
||||||
<el-select
|
<xtSelect
|
||||||
|
:apiObj="apiObjMaterial"
|
||||||
|
:params = "paramsMaterial"
|
||||||
v-model="materialIn"
|
v-model="materialIn"
|
||||||
clearable
|
v-model:label="materialName"
|
||||||
filterable
|
v-model:obj="materialItem"
|
||||||
@change="materialInChange"
|
@change="materialInChange"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-table-column type="index" width="50" />
|
||||||
v-for="item in inmOption"
|
<el-table-column label="名称" prop="name"></el-table-column>
|
||||||
:key="item.id"
|
<el-table-column label="规格" prop="specification"></el-table-column>
|
||||||
:label="item.full_name"
|
<el-table-column label="型号" prop="model"></el-table-column>
|
||||||
:value="item.id"
|
<el-table-column label="库存" prop="count"></el-table-column>
|
||||||
>
|
</xtSelect>
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</div>
|
</div>
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col>
|
<el-col>
|
||||||
<div
|
<div id="bachart1" style="width: 100%; height: 300px"></div>
|
||||||
id="bachart1"
|
|
||||||
style="width: 100%; height: 300px"
|
|
||||||
></div>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-card
|
<el-card shadow="never" style="width: 100%;position: relative;margin-top: 20px;">
|
||||||
shadow="never"
|
|
||||||
style="
|
|
||||||
width: 100%;
|
|
||||||
position: relative;
|
|
||||||
margin-top: 20px;
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<el-button
|
<el-button
|
||||||
@click="handleExport('1')"
|
@click="handleExport('1')"
|
||||||
class="tables"
|
class="tables"
|
||||||
|
|
@ -82,30 +72,33 @@
|
||||||
:data="tableData1"
|
:data="tableData1"
|
||||||
id="exportDiv1"
|
id="exportDiv1"
|
||||||
:height="tableHeight"
|
:height="tableHeight"
|
||||||
|
:summary-method="getSummaries"
|
||||||
|
show-summary
|
||||||
>
|
>
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50" />
|
||||||
<el-table-column
|
<el-table-column label="年份" prop="年" width="80"/>
|
||||||
label="年份"
|
<el-table-column v-if="queryType == '月'" width="60" label="周" prop="周"
|
||||||
prop="年"
|
:filters="dateFilters"
|
||||||
width="80"
|
:filter-method="filterDate"
|
||||||
/>
|
filter-placement="bottom-end"/>
|
||||||
<el-table-column
|
<el-table-column v-else width="60" label="月份" prop="月"
|
||||||
v-if="queryType == '月'"
|
:filters="dateFilters"
|
||||||
width="50"
|
:filter-method="filterDate"
|
||||||
label="周"
|
filter-placement="bottom-end"/>
|
||||||
prop="周"
|
<el-table-column label="名称" prop="物料名"
|
||||||
/>
|
:filters="nameFilters"
|
||||||
<el-table-column
|
:filter-method="filterName"
|
||||||
v-else
|
filter-placement="bottom-end">
|
||||||
width="50"
|
|
||||||
label="月份"
|
|
||||||
prop="月"
|
|
||||||
/>
|
|
||||||
<el-table-column label="名称" prop="物料名">
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="规格" prop="规格">
|
<el-table-column label="规格" prop="规格"
|
||||||
|
:filters="specsFilters"
|
||||||
|
:filter-method="filterSpecs"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="型号" prop="型号">
|
<el-table-column label="型号" prop="型号"
|
||||||
|
:filters="modelFilters"
|
||||||
|
:filter-method="filterModel"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="数量" prop="数量">
|
<el-table-column label="数量" prop="数量">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
@ -129,36 +122,39 @@
|
||||||
type="primary"
|
type="primary"
|
||||||
>导出</el-button
|
>导出</el-button
|
||||||
>
|
>
|
||||||
|
|
||||||
<scTable
|
<scTable
|
||||||
:data="tableData2"
|
:data="tableData2"
|
||||||
id="exportDiv2"
|
id="exportDiv2"
|
||||||
:height="rightHeight"
|
:height="rightHeight"
|
||||||
hideDo
|
hideDo
|
||||||
|
hidePagination
|
||||||
|
:summary-method="getSummaries"
|
||||||
|
show-summary
|
||||||
>
|
>
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50" />
|
||||||
<el-table-column
|
<el-table-column label="年份" prop="年" width="80"/>
|
||||||
label="年份"
|
<el-table-column v-if="queryType == '月'" width="70" label="周" prop="周"
|
||||||
prop="年"
|
:filters="dateFilters2"
|
||||||
width="80"
|
:filter-method="filterDate2"
|
||||||
/>
|
filter-placement="bottom-end"/>
|
||||||
<el-table-column
|
<el-table-column v-else width="70" label="月份" prop="月"
|
||||||
v-if="queryType == '月'"
|
:filters="dateFilters2"
|
||||||
width="50"
|
:filter-method="filterDate2"
|
||||||
label="周"
|
filter-placement="bottom-end"/>
|
||||||
prop="周"
|
<el-table-column label="名称" prop="物料名"
|
||||||
/>
|
:filters="nameFilters2"
|
||||||
<el-table-column
|
:filter-method="filterName2"
|
||||||
v-else
|
filter-placement="bottom-end">
|
||||||
width="50"
|
|
||||||
label="月份"
|
|
||||||
prop="月"
|
|
||||||
/>
|
|
||||||
<el-table-column label="名称" prop="物料名">
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="规格" prop="规格">
|
<el-table-column label="规格" prop="规格"
|
||||||
|
:filters="specsFilters2"
|
||||||
|
:filter-method="filterSpecs2"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="型号" prop="型号">
|
<el-table-column label="型号" prop="型号"
|
||||||
|
:filters="modelFilters2"
|
||||||
|
:filter-method="filterModel2"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="数量" prop="数量">
|
<el-table-column label="数量" prop="数量">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
@ -227,6 +223,7 @@ export default {
|
||||||
tableData1: [],
|
tableData1: [],
|
||||||
tableData2: [],
|
tableData2: [],
|
||||||
materialIn: "",
|
materialIn: "",
|
||||||
|
materialName: "",
|
||||||
firstWeekNum: 1,
|
firstWeekNum: 1,
|
||||||
endWeekNum: 1,
|
endWeekNum: 1,
|
||||||
product: "",
|
product: "",
|
||||||
|
|
@ -234,20 +231,18 @@ export default {
|
||||||
outData: [],
|
outData: [],
|
||||||
inmOption: [],
|
inmOption: [],
|
||||||
outOption: [],
|
outOption: [],
|
||||||
monthList: [
|
nameFilters: [],
|
||||||
"一月",
|
dateFilters: [],
|
||||||
"二月",
|
modelFilters: [],
|
||||||
"三月",
|
specsFilters: [],
|
||||||
"四月",
|
nameFilters2: [],
|
||||||
"五月",
|
dateFilters2: [],
|
||||||
"六月",
|
modelFilters2: [],
|
||||||
"七月",
|
specsFilters2: [],
|
||||||
"八月",
|
monthList: ["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],
|
||||||
"九月",
|
materialItem:{},
|
||||||
"十月",
|
apiObjMaterial:this.$API.mtm.material.list,
|
||||||
"十一月",
|
paramsMaterial:{type__in : "30,40,50,60,70"}
|
||||||
"十二月",
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
@ -258,18 +253,12 @@ export default {
|
||||||
let days = new Date(year, month, 0).getDate();
|
let days = new Date(year, month, 0).getDate();
|
||||||
that.currentYear = year;
|
that.currentYear = year;
|
||||||
that.currentMonth = month;
|
that.currentMonth = month;
|
||||||
|
that.firstWeekNum = that.getWeekOfYear(year,month,1);
|
||||||
|
that.endWeekNum = that.getWeekOfYear(year,month,days);
|
||||||
|
month = month < 10 ? "0" + month : month;
|
||||||
that.start_date = year + "-" + month + "-01";
|
that.start_date = year + "-" + month + "-01";
|
||||||
that.end_date =
|
that.end_date =year + "-" + month + "-" + days;
|
||||||
year + "-" + month + "-" + new Date(year, month, 0).getDate();
|
that.queryDate = year + "-" + month;
|
||||||
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));
|
|
||||||
// console.log('that.firstWeekNum',that.firstWeekNum)
|
|
||||||
// console.log('that.endWeekNum',that.endWeekNum)
|
|
||||||
let duration = that.endWeekNum - that.firstWeekNum + 1;
|
let duration = that.endWeekNum - that.firstWeekNum + 1;
|
||||||
for (let i = 1; i <= duration; i++) {
|
for (let i = 1; i <= duration; i++) {
|
||||||
that.xAxisOrigin.push("第" + i + "周");
|
that.xAxisOrigin.push("第" + i + "周");
|
||||||
|
|
@ -280,17 +269,15 @@ export default {
|
||||||
that.rightHeight = height - 115;
|
that.rightHeight = height - 115;
|
||||||
that.tableHeight = height - 140 - chartheight;
|
that.tableHeight = height - 140 - chartheight;
|
||||||
that.setChart("bachart1", that.basicOption);
|
that.setChart("bachart1", that.basicOption);
|
||||||
this.getInmOption();
|
that.getTable();
|
||||||
this.getTable();
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
setChart(name, option = null) {
|
setChart(name, option = null) {
|
||||||
var myChart = echarts.getInstanceByDom(
|
var myChart = echarts.getInstanceByDom(document.getElementById(name));
|
||||||
document.getElementById(name)
|
if (myChart != null) {
|
||||||
);
|
myChart.dispose(); // 销毁之前的实例
|
||||||
if (myChart == undefined) {
|
|
||||||
myChart = echarts.init(document.getElementById(name), "T");
|
|
||||||
}
|
}
|
||||||
|
myChart = echarts.init(document.getElementById(name), "T");
|
||||||
if (option == null) {
|
if (option == null) {
|
||||||
option = Object.assign({}, this.basicOption);
|
option = Object.assign({}, this.basicOption);
|
||||||
}
|
}
|
||||||
|
|
@ -300,29 +287,24 @@ export default {
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
}, 500);
|
}, 500);
|
||||||
},
|
},
|
||||||
getWeekOfYear(date) {
|
getWeekOfYear(a,b,c) {
|
||||||
var target = new Date(
|
var date1 = new Date(a, parseInt(b) - 1, c), //当前日期
|
||||||
date.getFullYear(),
|
date2 = new Date(a, 0, 1), //当年第一天
|
||||||
date.getMonth(),
|
// d是当前日期是今年第多少天
|
||||||
date.getDate()
|
d = Math.round((date1.valueOf() - date2.valueOf()) / 86400000);
|
||||||
); //目标日期
|
// d + 当前年的第一天的周差距的和在除以7就是本年第几周
|
||||||
var firstDayOfYear = new Date(target.getFullYear(), 0, 1); // 当前年份第一天
|
return Math.ceil((d + (date2.getDay() + 1 - 1)) / 7);
|
||||||
if (target.getTime() == firstDayOfYear.getTime()) {
|
},
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
return Math.ceil(
|
|
||||||
(target -
|
|
||||||
firstDayOfYear +
|
|
||||||
8 * (firstDayOfYear.getTimezoneOffset() / 480)) /
|
|
||||||
604800000
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
queryTypeChange(value) {
|
queryTypeChange(value) {
|
||||||
console.log(value);
|
console.log(value);
|
||||||
this.queryDate = "";
|
this.queryDate = "";
|
||||||
},
|
},
|
||||||
materialInChange() {
|
materialInChange(data) {
|
||||||
|
let that = this;
|
||||||
|
that.materialIn = that.materialItem.id;
|
||||||
|
let option = deepCopy(that.basicOption);
|
||||||
|
option.xAxis.data = that.xAxisData;
|
||||||
|
that.setChart("bachart1",option);
|
||||||
this.getInmData();
|
this.getInmData();
|
||||||
},
|
},
|
||||||
//采购物料选项
|
//采购物料选项
|
||||||
|
|
@ -333,21 +315,17 @@ export default {
|
||||||
obj.type__in = "30,40,50,60,70";
|
obj.type__in = "30,40,50,60,70";
|
||||||
that.$API.mtm.material.list.req(obj).then((res) => {
|
that.$API.mtm.material.list.req(obj).then((res) => {
|
||||||
that.inmOption = res;
|
that.inmOption = res;
|
||||||
// that.materialIn = res[1].id;
|
|
||||||
// let arr = [];
|
|
||||||
// res.forEach(item=>{
|
|
||||||
// if(item.type==30){
|
|
||||||
// arr.push(item)
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// that.getInmData();
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
//采购物料
|
//采购物料
|
||||||
getInmData() {
|
getInmData() {
|
||||||
let that = this;
|
let that = this;
|
||||||
let option = deepCopy(that.basicOption);
|
that.tableData1 = [];
|
||||||
option.xAxis.data = that.xAxisData;
|
that.nameFilters = [];
|
||||||
|
that.dateFilters = [];
|
||||||
|
that.modelFilters = [];
|
||||||
|
that.specsFilters = [];
|
||||||
|
let nameList=[],dateList = [],specsList=[],modelList=[];
|
||||||
let exec = that.queryType == "月" ? "saleOutWeek" : "saleOutMonth";
|
let exec = that.queryType == "月" ? "saleOutWeek" : "saleOutMonth";
|
||||||
let obj = {
|
let obj = {
|
||||||
query: {
|
query: {
|
||||||
|
|
@ -358,26 +336,50 @@ export default {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
||||||
console.log("getInmData", res);
|
if (res.data2.ds0&&res.data2.ds0.length>0) {
|
||||||
option.series.data = [];
|
|
||||||
if (res.data2.ds0) {
|
|
||||||
let data = res.data2.ds0;
|
let data = res.data2.ds0;
|
||||||
that.tableData1 = data;
|
that.tableData1 = data;
|
||||||
if (data.length > 0) {
|
data.forEach((ite) => {
|
||||||
let seriesData = [];
|
if (nameList.indexOf(ite.物料名) > -1) {
|
||||||
data.forEach((item) => {
|
} else {
|
||||||
if (that.queryType == "月") {
|
nameList.push(ite.物料名);
|
||||||
let index = item.周 - that.firstWeekNum;
|
let obj = {};
|
||||||
seriesData[index] = item.数量;
|
obj.text = ite.物料名;
|
||||||
} else {
|
obj.value = ite.物料名;
|
||||||
let index = item.月 - 1;
|
that.nameFilters.push(obj);
|
||||||
seriesData[index] = item.数量;
|
}
|
||||||
|
if(modelList.indexOf(ite.型号)>-1){}else{
|
||||||
|
modelList.push(ite.型号);
|
||||||
|
let obj2 = {};
|
||||||
|
obj2.text = ite.型号;
|
||||||
|
obj2.value = ite.型号;
|
||||||
|
that.modelFilters.push(obj2);
|
||||||
|
}
|
||||||
|
if(specsList.indexOf(ite.规格)>-1){}else{
|
||||||
|
specsList.push(ite.规格);
|
||||||
|
let obj3 = {};
|
||||||
|
obj3.text = ite.规格;
|
||||||
|
obj3.value = ite.规格;
|
||||||
|
that.specsFilters.push(obj3);
|
||||||
|
}
|
||||||
|
if(that.queryType == "月"){
|
||||||
|
if(dateList.indexOf(ite.周)>-1){}else{
|
||||||
|
dateList.push(ite.周);
|
||||||
|
let obj4 = {};
|
||||||
|
obj4.text = ite.周;
|
||||||
|
obj4.value = ite.周;
|
||||||
|
that.dateFilters.push(obj4);
|
||||||
}
|
}
|
||||||
});
|
}else{
|
||||||
option.series.data = seriesData;
|
that.dateFilters = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
that.setChartData(data);
|
||||||
|
}else{
|
||||||
|
let option = deepCopy(that.basicOption);
|
||||||
|
option.xAxis.data = that.xAxisData;
|
||||||
|
that.setChart("bachart1",option);
|
||||||
}
|
}
|
||||||
that.setChart("bachart1", option);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getTable() {
|
getTable() {
|
||||||
|
|
@ -389,12 +391,65 @@ export default {
|
||||||
mio_type: "pur_in",
|
mio_type: "pur_in",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
that.nameFilters = [];
|
||||||
|
that.dateFilters = [];
|
||||||
|
that.modelFilters = [];
|
||||||
|
that.specsFilters = [];
|
||||||
|
that.nameFilters2 = [];
|
||||||
|
that.dateFilters2 = [];
|
||||||
|
that.modelFilters2 = [];
|
||||||
|
that.specsFilters2 = [];
|
||||||
|
let nameList=[],dateList = [],specsList=[],modelList=[];
|
||||||
let exec = that.queryType == "月" ? "saleOutWeek" : "saleOutMonth";
|
let exec = that.queryType == "月" ? "saleOutWeek" : "saleOutMonth";
|
||||||
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
||||||
that.tableData2 = [];
|
that.tableData2 = [];
|
||||||
|
that.tableData1 = [];
|
||||||
if (res.data2.ds0) {
|
if (res.data2.ds0) {
|
||||||
let data = res.data2.ds0;
|
let data = res.data2.ds0;
|
||||||
|
that.tableData1 = data;
|
||||||
that.tableData2 = data;
|
that.tableData2 = data;
|
||||||
|
if(data.length>0){
|
||||||
|
data.forEach((ite) => {
|
||||||
|
if (nameList.indexOf(ite.物料名) > -1) {
|
||||||
|
} else {
|
||||||
|
nameList.push(ite.物料名);
|
||||||
|
let obj = {};
|
||||||
|
obj.text = ite.物料名;
|
||||||
|
obj.value = ite.物料名;
|
||||||
|
that.nameFilters.push(obj);
|
||||||
|
}
|
||||||
|
if(modelList.indexOf(ite.型号)>-1){}else{
|
||||||
|
modelList.push(ite.型号);
|
||||||
|
let obj2 = {};
|
||||||
|
obj2.text = ite.型号;
|
||||||
|
obj2.value = ite.型号;
|
||||||
|
that.modelFilters.push(obj2);
|
||||||
|
}
|
||||||
|
if(specsList.indexOf(ite.规格)>-1){}else{
|
||||||
|
specsList.push(ite.规格);
|
||||||
|
let obj3 = {};
|
||||||
|
obj3.text = ite.规格;
|
||||||
|
obj3.value = ite.规格;
|
||||||
|
that.specsFilters.push(obj3);
|
||||||
|
}
|
||||||
|
if(that.queryType == "月"){
|
||||||
|
if(dateList.indexOf(ite.周)>-1){}else{
|
||||||
|
dateList.push(ite.周);
|
||||||
|
let obj4 = {};
|
||||||
|
obj4.text = ite.周;
|
||||||
|
obj4.value = ite.周;
|
||||||
|
that.dateFilters.push(obj4);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
that.dateFilters = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
|
||||||
|
}
|
||||||
|
that.nameFilters2 = that.nameFilters;
|
||||||
|
that.modelFilters2 = that.modelFilters;
|
||||||
|
that.specsFilters2 = that.specsFilters;
|
||||||
|
that.dateFilters2 = that.dateFilters;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
that.setChartData(data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -402,18 +457,14 @@ export default {
|
||||||
let that = this;
|
let that = this;
|
||||||
if (that.queryType == "月") {
|
if (that.queryType == "月") {
|
||||||
if (that.queryDate !== "" && that.queryDate !== null) {
|
if (that.queryDate !== "" && that.queryDate !== null) {
|
||||||
that.start_date = that.queryDate + "-01";
|
|
||||||
let arr = that.queryDate.split("-");
|
let arr = that.queryDate.split("-");
|
||||||
that.end_date =
|
let year = arr[0];
|
||||||
that.queryDate +
|
let month = arr[1];
|
||||||
"-" +
|
let days = new Date(year, month, 0).getDate();
|
||||||
new Date(arr[0], arr[1], 0).getDate();
|
that.start_date = that.queryDate + "-01";
|
||||||
that.firstWeekNum = that.getWeekOfYear(
|
that.end_date =that.queryDate +"-" +days;
|
||||||
new Date(that.start_date)
|
that.firstWeekNum = that.getWeekOfYear(year,month,1);
|
||||||
);
|
that.endWeekNum = that.getWeekOfYear(year,month,days);
|
||||||
that.endWeekNum = that.getWeekOfYear(
|
|
||||||
new Date(that.end_date)
|
|
||||||
);
|
|
||||||
let duration = that.endWeekNum - that.firstWeekNum + 1;
|
let duration = that.endWeekNum - that.firstWeekNum + 1;
|
||||||
let xAxisData = [];
|
let xAxisData = [];
|
||||||
for (let i = 1; i <= duration; i++) {
|
for (let i = 1; i <= duration; i++) {
|
||||||
|
|
@ -421,20 +472,9 @@ export default {
|
||||||
}
|
}
|
||||||
that.xAxisData = xAxisData;
|
that.xAxisData = xAxisData;
|
||||||
} else {
|
} else {
|
||||||
that.start_date =
|
that.start_date =that.currentYear + "-" + that.currentMonth + "-01";
|
||||||
that.currentYear + "-" + that.currentMonth + "-01";
|
that.end_date =that.currentYear +"-" +that.currentMonth +"-" +new Date(that.currentYear,that.currentMonth,0).getDate();
|
||||||
that.end_date =
|
that.firstWeekNum = that.getWeekOfYear(that.currentYear,that.currentMonth,1);
|
||||||
that.currentYear +
|
|
||||||
"-" +
|
|
||||||
that.currentMonth +
|
|
||||||
"-" +
|
|
||||||
new Date(
|
|
||||||
that.currentYear,
|
|
||||||
that.currentMonth,
|
|
||||||
0
|
|
||||||
).getDate();
|
|
||||||
let date = new Date(that.start_date);
|
|
||||||
that.firstWeekNum = that.getWeekOfYear(date);
|
|
||||||
that.xAxisData = that.xAxisOrigin;
|
that.xAxisData = that.xAxisOrigin;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -452,6 +492,99 @@ export default {
|
||||||
that.getInmData();
|
that.getInmData();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
setChartData(data){
|
||||||
|
let that = this;
|
||||||
|
let option = deepCopy(that.basicOption);
|
||||||
|
option.xAxis.data = that.xAxisData;
|
||||||
|
option.series=[];
|
||||||
|
let materials = [],seriesData = [];
|
||||||
|
data.forEach((item) => {
|
||||||
|
if(materials.indexOf(item.物料名) == -1){
|
||||||
|
materials.push(item.物料名);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
materials.forEach((item) => {
|
||||||
|
let obj = {};
|
||||||
|
obj.name = item;
|
||||||
|
obj.type = "bar";
|
||||||
|
obj.stack = "Ad";
|
||||||
|
obj.barWidth = "15px";
|
||||||
|
obj.data = [0,0,0,0,0,0,0,0,0,0,0,0];
|
||||||
|
seriesData.push(obj);
|
||||||
|
})
|
||||||
|
data.forEach((item) => {
|
||||||
|
let index = 0;let indexY = 0;
|
||||||
|
if (that.queryType == "月") {
|
||||||
|
index = item.周 - that.firstWeekNum;
|
||||||
|
} else {
|
||||||
|
index = item.月 - 1;
|
||||||
|
}
|
||||||
|
indexY = materials.indexOf(item.物料名);
|
||||||
|
seriesData[indexY].data[index] = item.数量;
|
||||||
|
});
|
||||||
|
option.series = seriesData;
|
||||||
|
that.setChart("bachart1", option);
|
||||||
|
},
|
||||||
|
getSummaries({ columns, data }) {
|
||||||
|
const sums = [];
|
||||||
|
columns.forEach((column, index) => {
|
||||||
|
if (index === 0) {
|
||||||
|
sums[index] = "合计";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (index == 6) {
|
||||||
|
const values = data.map((item) =>
|
||||||
|
Number(item[column.property])
|
||||||
|
);
|
||||||
|
if (!values.every((value) => Number.isNaN(value))) {
|
||||||
|
sums[index] = values.reduce((prev, curr) => {
|
||||||
|
const value = Number(curr); //Number转换为数值
|
||||||
|
let sum = Number(
|
||||||
|
Number(prev) + Number(curr)
|
||||||
|
).toFixed(2); //toFixed(2)数据项保留两位小数
|
||||||
|
if (!isNaN(value)) {
|
||||||
|
return sum;
|
||||||
|
} else {
|
||||||
|
return prev;
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return sums;
|
||||||
|
},
|
||||||
|
filterName(value, row) {
|
||||||
|
return row.物料名 === value;
|
||||||
|
},
|
||||||
|
filterDate(value, row) {
|
||||||
|
if (this.queryType == "月") {
|
||||||
|
return row.周 === value;
|
||||||
|
}else{
|
||||||
|
return row.月 === value;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
filterSpecs(value, row) {
|
||||||
|
return row.规格 === value;
|
||||||
|
},
|
||||||
|
filterModel(value, row) {
|
||||||
|
return row.型号 === value;
|
||||||
|
},
|
||||||
|
filterName2(value, row) {
|
||||||
|
return row.物料名 === value;
|
||||||
|
},
|
||||||
|
filterDate2(value, row) {
|
||||||
|
if (this.queryType == "月") {
|
||||||
|
return row.周 === value;
|
||||||
|
}else{
|
||||||
|
return row.月 === value;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
filterSpecs2(value, row) {
|
||||||
|
return row.规格 === value;
|
||||||
|
},
|
||||||
|
filterModel2(value, row) {
|
||||||
|
return row.型号 === value;
|
||||||
|
},
|
||||||
handleExport(val) {
|
handleExport(val) {
|
||||||
this.exportLoading = true;
|
this.exportLoading = true;
|
||||||
let id = "#exportDiv" + val;
|
let id = "#exportDiv" + val;
|
||||||
|
|
|
||||||
|
|
@ -56,31 +56,34 @@
|
||||||
:data="tableData7"
|
:data="tableData7"
|
||||||
id="exportDiv7"
|
id="exportDiv7"
|
||||||
:height="300"
|
:height="300"
|
||||||
|
:summary-method="getSummaries"
|
||||||
|
show-summary
|
||||||
>
|
>
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50" />
|
||||||
<el-table-column
|
<el-table-column label="物料名" prop="物料名" min-width="100"
|
||||||
label="物料名"
|
:filters="nameFilters7"
|
||||||
prop="物料名"
|
:filter-method="filterName7"
|
||||||
min-width="100"
|
filter-placement="bottom-end">
|
||||||
>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column label="月份" prop="月" v-if="queryType == '年'" width="60"
|
||||||
label="月份"
|
:filters="dateFilters7"
|
||||||
prop="月"
|
:filter-method="filterDate7"
|
||||||
v-if="queryType == '年'"
|
filter-placement="bottom-end">
|
||||||
width="50"
|
|
||||||
>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column label="周" prop="周" v-else width="60"
|
||||||
label="周"
|
:filters="dateFilters7"
|
||||||
prop="周"
|
:filter-method="filterDate7"
|
||||||
v-else
|
filter-placement="bottom-end">
|
||||||
width="50"
|
|
||||||
>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="型号" prop="型号">
|
<el-table-column label="型号" prop="型号"
|
||||||
|
:filters="modelFilters7"
|
||||||
|
:filter-method="filterModel7"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="规格" prop="规格">
|
<el-table-column label="规格" prop="规格"
|
||||||
|
:filters="specsFilters7"
|
||||||
|
:filter-method="filterSpecs7"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="任务数" prop="任务数">
|
<el-table-column label="任务数" prop="任务数">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
@ -88,10 +91,7 @@
|
||||||
</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
|
<el-table-column label="不合格数" prop="不合格数">
|
||||||
label="不合格数"
|
|
||||||
prop="不合格数"
|
|
||||||
>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="合格率" prop="合格率">
|
<el-table-column label="合格率" prop="合格率">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
|
|
@ -122,25 +122,34 @@
|
||||||
:data="tableData10"
|
:data="tableData10"
|
||||||
id="exportDiv10"
|
id="exportDiv10"
|
||||||
:height="300"
|
:height="300"
|
||||||
|
:summary-method="getSummaries"
|
||||||
|
show-summary
|
||||||
>
|
>
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50" />
|
||||||
<el-table-column
|
<el-table-column label="物料名" prop="物料名" min-width="100"
|
||||||
label="物料名"
|
:filters="nameFilters"
|
||||||
prop="物料名"
|
:filter-method="filterName"
|
||||||
min-width="100"
|
filter-placement="bottom-end">
|
||||||
>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column label="月份" prop="月" v-if="queryType == '年'" width="60"
|
||||||
label="月份"
|
:filters="dateFilters"
|
||||||
prop="月"
|
:filter-method="filterDate"
|
||||||
v-if="queryType == '年'"
|
filter-placement="bottom-end">
|
||||||
>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="周" prop="周" v-else>
|
<el-table-column label="周" prop="周" v-else width="60"
|
||||||
|
:filters="dateFilters"
|
||||||
|
:filter-method="filterDate"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="型号" prop="型号">
|
<el-table-column label="型号" prop="型号"
|
||||||
|
:filters="modelFilters"
|
||||||
|
:filter-method="filterModel"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="规格" prop="规格">
|
<el-table-column label="规格" prop="规格"
|
||||||
|
:filters="specsFilters"
|
||||||
|
:filter-method="filterSpecs"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="任务数" prop="任务数">
|
<el-table-column label="任务数" prop="任务数">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
@ -148,10 +157,7 @@
|
||||||
</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
|
<el-table-column label="不合格数" prop="不合格数">
|
||||||
label="不合格数"
|
|
||||||
prop="不合格数"
|
|
||||||
>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="合格率" prop="合格率">
|
<el-table-column label="合格率" prop="合格率">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
|
|
@ -182,25 +188,39 @@
|
||||||
:data="tableData6"
|
:data="tableData6"
|
||||||
id="exportDiv6"
|
id="exportDiv6"
|
||||||
:height="300"
|
:height="300"
|
||||||
|
:summary-method="getSummaries2"
|
||||||
|
show-summary
|
||||||
>
|
>
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50" />
|
||||||
<el-table-column
|
<el-table-column label="物料名" prop="物料名" min-width="100"
|
||||||
label="物料名"
|
:filters="nameFilters6"
|
||||||
prop="物料名"
|
:filter-method="filterName6"
|
||||||
min-width="100"
|
filter-placement="bottom-end">
|
||||||
>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column label="物料系列" prop="物料系列" min-width="100"
|
||||||
label="月份"
|
:filters="xilieFilters6"
|
||||||
prop="月"
|
:filter-method="filterXilie6"
|
||||||
v-if="queryType == '年'"
|
filter-placement="bottom-end">
|
||||||
>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="周" prop="周" v-else>
|
<el-table-column label="月份" prop="月" v-if="queryType == '年'"
|
||||||
|
:filters="dateFilters6"
|
||||||
|
:filter-method="filterDate6"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="型号" prop="型号">
|
<el-table-column label="周" prop="周" v-else
|
||||||
|
:filters="dateFilters6"
|
||||||
|
:filter-method="filterDate6"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="规格" prop="规格">
|
<el-table-column label="型号" prop="型号"
|
||||||
|
:filters="modelFilters6"
|
||||||
|
:filter-method="filterModel6"
|
||||||
|
filter-placement="bottom-end">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="规格" prop="规格"
|
||||||
|
:filters="specsFilters6"
|
||||||
|
:filter-method="filterSpecs6"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="任务数" prop="任务数">
|
<el-table-column label="任务数" prop="任务数">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
@ -208,10 +228,7 @@
|
||||||
</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
|
<el-table-column label="不合格数" prop="不合格数">
|
||||||
label="不合格数"
|
|
||||||
prop="不合格数"
|
|
||||||
>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="合格率" prop="合格率">
|
<el-table-column label="合格率" prop="合格率">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
|
|
@ -223,44 +240,6 @@
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card shadow="never" style="margin-bottom: 8px">
|
|
||||||
<el-row :gutter="10">
|
|
||||||
<el-col :lg="12">
|
|
||||||
<el-card shadow="never">
|
|
||||||
<div id="bachart4"></div>
|
|
||||||
</el-card>
|
|
||||||
</el-col>
|
|
||||||
<el-col :lg="12">
|
|
||||||
<el-card shadow="never" style="position: relative">
|
|
||||||
<el-button
|
|
||||||
@click="handleExport('AVG')"
|
|
||||||
class="tables"
|
|
||||||
type="primary"
|
|
||||||
>导出</el-button
|
|
||||||
>
|
|
||||||
<el-table
|
|
||||||
:data="tableDataAVG"
|
|
||||||
id="exportDivAVG"
|
|
||||||
:height="300"
|
|
||||||
>
|
|
||||||
<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="count_ok">
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
</el-card>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</el-card>
|
|
||||||
</el-main>
|
</el-main>
|
||||||
</el-container>
|
</el-container>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -319,7 +298,19 @@ export default {
|
||||||
tableData6: [],
|
tableData6: [],
|
||||||
tableData7: [],
|
tableData7: [],
|
||||||
tableData10: [],
|
tableData10: [],
|
||||||
tableDataAVG: [],
|
nameFilters: [],
|
||||||
|
dateFilters: [],
|
||||||
|
modelFilters: [],
|
||||||
|
specsFilters: [],
|
||||||
|
nameFilters6: [],
|
||||||
|
xilieFilters6: [],
|
||||||
|
dateFilters6: [],
|
||||||
|
modelFilters6: [],
|
||||||
|
specsFilters6: [],
|
||||||
|
nameFilters7: [],
|
||||||
|
dateFilters7: [],
|
||||||
|
modelFilters7: [],
|
||||||
|
specsFilters7: [],
|
||||||
firstWeekNum: 1,
|
firstWeekNum: 1,
|
||||||
endWeekNum: 4,
|
endWeekNum: 4,
|
||||||
monthList: [
|
monthList: [
|
||||||
|
|
@ -346,16 +337,12 @@ export default {
|
||||||
let days = new Date(year, month, 0).getDate();
|
let days = new Date(year, month, 0).getDate();
|
||||||
that.currentYear = year;
|
that.currentYear = year;
|
||||||
that.currentMonth = month;
|
that.currentMonth = month;
|
||||||
|
that.firstWeekNum = that.getWeekOfYear(year,month,1);
|
||||||
|
that.endWeekNum = that.getWeekOfYear(year,month,days);
|
||||||
|
month = month < 10 ? "0" + month : month;
|
||||||
that.start_date = year + "-" + month + "-01";
|
that.start_date = year + "-" + month + "-01";
|
||||||
that.end_date =
|
that.end_date =year + "-" + month + "-" + days;
|
||||||
year + "-" + month + "-" + new Date(year, month, 0).getDate();
|
that.queryDate = year + "-" + month;
|
||||||
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;
|
let duration = that.endWeekNum - that.firstWeekNum + 1;
|
||||||
for (let i = 1; i <= duration; i++) {
|
for (let i = 1; i <= duration; i++) {
|
||||||
that.xAxisOrigin.push("第" + i + "周");
|
that.xAxisOrigin.push("第" + i + "周");
|
||||||
|
|
@ -364,7 +351,6 @@ export default {
|
||||||
that.getData6();
|
that.getData6();
|
||||||
that.getData7();
|
that.getData7();
|
||||||
that.getData10();
|
that.getData10();
|
||||||
that.getDataDAVG();
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
setChart(name, option = null) {
|
setChart(name, option = null) {
|
||||||
|
|
@ -388,27 +374,22 @@ export default {
|
||||||
console.log(value);
|
console.log(value);
|
||||||
this.queryDate = "";
|
this.queryDate = "";
|
||||||
},
|
},
|
||||||
getWeekOfYear(date) {
|
getWeekOfYear(a,b,c) {
|
||||||
var target = new Date(
|
var date1 = new Date(a, parseInt(b) - 1, c), //当前日期
|
||||||
date.getFullYear(),
|
date2 = new Date(a, 0, 1), //当年第一天
|
||||||
date.getMonth(),
|
// d是当前日期是今年第多少天
|
||||||
date.getDate()
|
d = Math.round((date1.valueOf() - date2.valueOf()) / 86400000);
|
||||||
); // 创建目标日期对象
|
// d + 当前年的第一天的周差距的和在除以7就是本年第几周
|
||||||
var firstDayOfYear = new Date(target.getFullYear(), 0, 1); // 创建当前年份第一天的日期对象
|
return Math.ceil((d + (date2.getDay() + 1 - 1)) / 7);
|
||||||
if (target.getTime() == firstDayOfYear.getTime()) {
|
},
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
return Math.ceil(
|
|
||||||
(target -
|
|
||||||
firstDayOfYear +
|
|
||||||
8 * (firstDayOfYear.getTimezoneOffset() / 480)) /
|
|
||||||
604800000
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// 计算两者之间相隔的周数并返回结果
|
|
||||||
},
|
|
||||||
getData6() {
|
getData6() {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
let dateList = [],specsList=[],modelList=[],xilieList=[];
|
||||||
|
that.nameFilters6 = [];
|
||||||
|
that.dateFilters6 = [];
|
||||||
|
that.xilieFilters6 = [];
|
||||||
|
that.modelFilters6 = [];
|
||||||
|
that.specsFilters6 = [];
|
||||||
let option = deepCopy(that.basicOption);
|
let option = deepCopy(that.basicOption);
|
||||||
option.xAxis.data = that.xAxisData;
|
option.xAxis.data = that.xAxisData;
|
||||||
option.title.text = "6车间";
|
option.title.text = "6车间";
|
||||||
|
|
@ -421,31 +402,72 @@ export default {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
||||||
// console.log('6生产车间统计:',res);
|
|
||||||
let tableData6 = res.data2.ds0 ? res.data2.ds0 : [];
|
let tableData6 = res.data2.ds0 ? res.data2.ds0 : [];
|
||||||
that.tableData6 = tableData6;
|
that.tableData6 = tableData6;
|
||||||
if (tableData6.length > 0) {
|
if (tableData6.length > 0) {
|
||||||
option.series = [];
|
option.series = [];
|
||||||
let seriesData = [],
|
let seriesData = [],nameList = [];
|
||||||
nameList = [];
|
|
||||||
tableData6.forEach((ite) => {
|
tableData6.forEach((ite) => {
|
||||||
if (nameList.indexOf(ite.物料名) > -1) {
|
if (nameList.indexOf(ite.物料名) > -1) {
|
||||||
} else {
|
}else {
|
||||||
nameList.push(ite.物料名);
|
nameList.push(ite.物料名);
|
||||||
seriesData.push([]);
|
seriesData.push([]);
|
||||||
|
let obj = {};
|
||||||
|
obj.text = ite.物料名;
|
||||||
|
obj.value = ite.物料名;
|
||||||
|
that.nameFilters6.push(obj);
|
||||||
}
|
}
|
||||||
|
if(xilieList.indexOf(ite.物料系列)>-1){}else{
|
||||||
|
xilieList.push(ite.物料系列);
|
||||||
|
let obj2 = {};
|
||||||
|
obj2.text = ite.物料系列;
|
||||||
|
obj2.value = ite.物料系列;
|
||||||
|
that.xilieFilters6.push(obj2);
|
||||||
|
}
|
||||||
|
if(specsList.indexOf(ite.规格)>-1){}else{
|
||||||
|
specsList.push(ite.规格);
|
||||||
|
let obj3 = {};
|
||||||
|
obj3.text = ite.规格;
|
||||||
|
obj3.value = ite.规格;
|
||||||
|
that.specsFilters6.push(obj3);
|
||||||
|
}
|
||||||
|
if(modelList.indexOf(ite.型号)>-1){}else{
|
||||||
|
modelList.push(ite.型号);
|
||||||
|
let obj4 = {};
|
||||||
|
obj4.text = ite.型号;
|
||||||
|
obj4.value = ite.型号;
|
||||||
|
that.modelFilters6.push(obj4);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
if (that.queryType == "月") {
|
if (that.queryType == "月") {
|
||||||
tableData6.forEach((item) => {
|
tableData6.forEach((item) => {
|
||||||
let indexX = nameList.indexOf(item.物料名);
|
let indexX = nameList.indexOf(item.物料名);
|
||||||
let indexY = item.周 - that.firstWeekNum;
|
let indexY = item.周 - that.firstWeekNum;
|
||||||
seriesData[indexX][indexY] = item.合格数;
|
if(seriesData[indexX][indexY]){
|
||||||
|
seriesData[indexX][indexY] += item.合格数;
|
||||||
|
}else{
|
||||||
|
seriesData[indexX][indexY] =0;
|
||||||
|
seriesData[indexX][indexY] += item.合格数;
|
||||||
|
}
|
||||||
|
if(dateList.indexOf(item.周)>-1){}else{
|
||||||
|
dateList.push(item.周);
|
||||||
|
let obj = {};
|
||||||
|
obj.text = item.周;
|
||||||
|
obj.value = item.周;
|
||||||
|
that.dateFilters6.push(obj);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
that.dateFilters6 = [1,2,3,4,5,6,7,8,9,10,11,12];
|
||||||
tableData6.forEach((item) => {
|
tableData6.forEach((item) => {
|
||||||
let indexX = nameList.indexOf(item.物料名);
|
let indexX = nameList.indexOf(item.物料名);
|
||||||
let indexY = item.month - 1;
|
let indexY = item.month - 1;
|
||||||
seriesData[indexX][indexY] = item.合格数;
|
if(seriesData[indexX][indexY]){
|
||||||
|
seriesData[indexX][indexY] += item.合格数;
|
||||||
|
}else{
|
||||||
|
seriesData[indexX][indexY] =0;
|
||||||
|
seriesData[indexX][indexY] += item.合格数;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
for (let n = 0; n < seriesData.length; n++) {
|
for (let n = 0; n < seriesData.length; n++) {
|
||||||
|
|
@ -465,6 +487,11 @@ export default {
|
||||||
},
|
},
|
||||||
getData7() {
|
getData7() {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
let dateList = [],specsList=[],modelList=[];
|
||||||
|
that.nameFilters7 = [];
|
||||||
|
that.dateFilters7 = [];
|
||||||
|
that.modelFilters7 = [];
|
||||||
|
that.specsFilters7 = [];
|
||||||
let obj = {
|
let obj = {
|
||||||
query: {
|
query: {
|
||||||
start_date: that.start_date,
|
start_date: that.start_date,
|
||||||
|
|
@ -480,9 +507,7 @@ export default {
|
||||||
console.log("7生产车间统计:", res);
|
console.log("7生产车间统计:", res);
|
||||||
let tableData7 = res.data2.ds0 ? res.data2.ds0 : [];
|
let tableData7 = res.data2.ds0 ? res.data2.ds0 : [];
|
||||||
that.tableData7 = tableData7;
|
that.tableData7 = tableData7;
|
||||||
debugger;
|
|
||||||
if (tableData7.length > 0) {
|
if (tableData7.length > 0) {
|
||||||
debugger;
|
|
||||||
option.series = [];
|
option.series = [];
|
||||||
let seriesData = [],
|
let seriesData = [],
|
||||||
nameList = [];
|
nameList = [];
|
||||||
|
|
@ -491,7 +516,25 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
nameList.push(ite.物料名);
|
nameList.push(ite.物料名);
|
||||||
seriesData.push([]);
|
seriesData.push([]);
|
||||||
|
let obj = {};
|
||||||
|
obj.text = ite.物料名;
|
||||||
|
obj.value = ite.物料名;
|
||||||
|
that.nameFilters7.push(obj);
|
||||||
}
|
}
|
||||||
|
if(modelList.indexOf(ite.型号)>-1){}else{
|
||||||
|
modelList.push(ite.型号);
|
||||||
|
let obj2 = {};
|
||||||
|
obj2.text = ite.型号;
|
||||||
|
obj2.value = ite.型号;
|
||||||
|
that.modelFilters7.push(obj2);
|
||||||
|
}
|
||||||
|
if(specsList.indexOf(ite.规格)>-1){}else{
|
||||||
|
specsList.push(ite.规格);
|
||||||
|
let obj3 = {};
|
||||||
|
obj3.text = ite.规格;
|
||||||
|
obj3.value = ite.规格;
|
||||||
|
that.specsFilters7.push(obj3);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
tableData7.forEach((item) => {
|
tableData7.forEach((item) => {
|
||||||
let indexX = 0,
|
let indexX = 0,
|
||||||
|
|
@ -499,11 +542,24 @@ export default {
|
||||||
if (that.queryType == "月") {
|
if (that.queryType == "月") {
|
||||||
indexX = nameList.indexOf(item.物料名);
|
indexX = nameList.indexOf(item.物料名);
|
||||||
indexY = item.周 - that.firstWeekNum;
|
indexY = item.周 - that.firstWeekNum;
|
||||||
|
if(dateList.indexOf(item.周)>-1){}else{
|
||||||
|
dateList.push(item.周);
|
||||||
|
let obj = {};
|
||||||
|
obj.text = item.周;
|
||||||
|
obj.value = item.周;
|
||||||
|
that.dateFilters7.push(obj);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
that.dateFilters7 = [1,2,3,4,5,6,7,8,9,10,11,12];
|
||||||
indexX = nameList.indexOf(item.物料名);
|
indexX = nameList.indexOf(item.物料名);
|
||||||
indexY = item.月 - 1;
|
indexY = item.月 - 1;
|
||||||
}
|
}
|
||||||
seriesData[indexX][indexY] = item.合格数;
|
if(seriesData[indexX][indexY]){
|
||||||
|
seriesData[indexX][indexY] += item.合格数;
|
||||||
|
}else{
|
||||||
|
seriesData[indexX][indexY] =0;
|
||||||
|
seriesData[indexX][indexY] += item.合格数;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
for (let n = 0; n < seriesData.length; n++) {
|
for (let n = 0; n < seriesData.length; n++) {
|
||||||
let obj = {};
|
let obj = {};
|
||||||
|
|
@ -522,6 +578,11 @@ export default {
|
||||||
},
|
},
|
||||||
getData10() {
|
getData10() {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
let dateList = [],specsList=[],modelList=[];
|
||||||
|
that.nameFilters = [];
|
||||||
|
that.dateFilters = [];
|
||||||
|
that.modelFilters = [];
|
||||||
|
that.specsFilters = [];
|
||||||
let option = deepCopy(that.basicOption);
|
let option = deepCopy(that.basicOption);
|
||||||
option.xAxis.data = that.xAxisData;
|
option.xAxis.data = that.xAxisData;
|
||||||
option.title.text = "预制管(10车间)";
|
option.title.text = "预制管(10车间)";
|
||||||
|
|
@ -534,7 +595,6 @@ export default {
|
||||||
};
|
};
|
||||||
let exec = that.queryType == "月" ? "lineWeek" : "lineMonth";
|
let exec = that.queryType == "月" ? "lineWeek" : "lineMonth";
|
||||||
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
||||||
// console.log('10生产车间统计:',res);
|
|
||||||
let tableData10 = res.data2.ds0 ? res.data2.ds0 : [];
|
let tableData10 = res.data2.ds0 ? res.data2.ds0 : [];
|
||||||
that.tableData10 = tableData10;
|
that.tableData10 = tableData10;
|
||||||
if (tableData10.length > 0) {
|
if (tableData10.length > 0) {
|
||||||
|
|
@ -546,7 +606,25 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
nameList.push(ite.物料名);
|
nameList.push(ite.物料名);
|
||||||
seriesData.push([]);
|
seriesData.push([]);
|
||||||
|
let obj = {};
|
||||||
|
obj.text = ite.物料名;
|
||||||
|
obj.value = ite.物料名;
|
||||||
|
that.nameFilters.push(obj);
|
||||||
}
|
}
|
||||||
|
if(modelList.indexOf(ite.型号)>-1){}else{
|
||||||
|
modelList.push(ite.型号);
|
||||||
|
let obj2 = {};
|
||||||
|
obj2.text = ite.型号;
|
||||||
|
obj2.value = ite.型号;
|
||||||
|
that.modelFilters.push(obj2);
|
||||||
|
}
|
||||||
|
if(specsList.indexOf(ite.规格)>-1){}else{
|
||||||
|
specsList.push(ite.规格);
|
||||||
|
let obj3 = {};
|
||||||
|
obj3.text = ite.规格;
|
||||||
|
obj3.value = ite.规格;
|
||||||
|
that.specsFilters.push(obj3);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
tableData10.forEach((item) => {
|
tableData10.forEach((item) => {
|
||||||
let indexX = 0,
|
let indexX = 0,
|
||||||
|
|
@ -554,11 +632,24 @@ export default {
|
||||||
if (that.queryType == "月") {
|
if (that.queryType == "月") {
|
||||||
indexX = nameList.indexOf(item.物料名);
|
indexX = nameList.indexOf(item.物料名);
|
||||||
indexY = item.周 - that.firstWeekNum;
|
indexY = item.周 - that.firstWeekNum;
|
||||||
|
if(dateList.indexOf(item.周)>-1){}else{
|
||||||
|
dateList.push(item.周);
|
||||||
|
let obj = {};
|
||||||
|
obj.text = item.周;
|
||||||
|
obj.value = item.周;
|
||||||
|
that.dateFilters.push(obj);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
that.dateFilters = [1,2,3,4,5,6,7,8,9,10,11,12];
|
||||||
indexX = nameList.indexOf(item.物料名);
|
indexX = nameList.indexOf(item.物料名);
|
||||||
indexY = item.月 - 1;
|
indexY = item.月 - 1;
|
||||||
}
|
}
|
||||||
seriesData[indexX][indexY] = item.合格数;
|
if(seriesData[indexX][indexY]){
|
||||||
|
seriesData[indexX][indexY] += item.合格数;
|
||||||
|
}else{
|
||||||
|
seriesData[indexX][indexY] =0;
|
||||||
|
seriesData[indexX][indexY] += item.合格数;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
for (let n = 0; n < seriesData.length; n++) {
|
for (let n = 0; n < seriesData.length; n++) {
|
||||||
let obj = {};
|
let obj = {};
|
||||||
|
|
@ -575,95 +666,155 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getDataDAVG() {
|
getSummaries({ columns, data }) {
|
||||||
let that = this;
|
const sums = [];
|
||||||
let option = deepCopy(that.basicOption);
|
columns.forEach((column, index) => {
|
||||||
option.xAxis.data = that.xAxisData;
|
if (index === 0) {
|
||||||
option.title.text = "AVG";
|
sums[index] = "合计";
|
||||||
let obj = {
|
return;
|
||||||
query: { start_date: that.start_date, end_date: that.end_date },
|
}
|
||||||
};
|
if (index == 5||index == 6||index == 7||index == 8) {
|
||||||
let exec = that.queryType == "月" ? "AVGWeek" : "AVGMonth";
|
const values = data.map((item) =>
|
||||||
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
Number(item[column.property])
|
||||||
// console.log('AVG统计:',res);
|
);
|
||||||
let tableDataAVG = res.data2.ds0 ? res.data2.ds0 : [];
|
if (!values.every((value) => Number.isNaN(value))) {
|
||||||
let seriesData = [];
|
sums[index] = values.reduce((prev, curr) => {
|
||||||
if (tableDataAVG.length > 0) {
|
const value = Number(curr); //Number转换为数值
|
||||||
tableDataAVG.forEach((item) => {
|
let sum = Number(
|
||||||
let index = 0;
|
Number(prev) + Number(curr)
|
||||||
if (that.queryType == "月") {
|
).toFixed(2); //toFixed(2)数据项保留两位小数
|
||||||
index = item.month - 1;
|
if (!isNaN(value)) {
|
||||||
} else {
|
return sum;
|
||||||
index = item.周 - that.firstWeekNum;
|
} else {
|
||||||
}
|
return prev;
|
||||||
seriesData[index] = item.合格数;
|
}
|
||||||
});
|
}, 0);
|
||||||
let obj = {};
|
}
|
||||||
obj.name = "AVG";
|
|
||||||
obj.type = "bar";
|
|
||||||
obj.barWidth = "15px";
|
|
||||||
obj.data = seriesData;
|
|
||||||
option.series.push(obj);
|
|
||||||
that.setChart("bachart4", option);
|
|
||||||
} else {
|
|
||||||
that.setChart("bachart4", option);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
return sums;
|
||||||
|
},
|
||||||
|
getSummaries2({ columns, data }) {
|
||||||
|
const sums = [];
|
||||||
|
columns.forEach((column, index) => {
|
||||||
|
if (index === 0) {
|
||||||
|
sums[index] = "合计";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (index == 6||index == 7||index == 8||index == 9) {
|
||||||
|
const values = data.map((item) =>
|
||||||
|
Number(item[column.property])
|
||||||
|
);
|
||||||
|
if (!values.every((value) => Number.isNaN(value))) {
|
||||||
|
sums[index] = values.reduce((prev, curr) => {
|
||||||
|
const value = Number(curr); //Number转换为数值
|
||||||
|
let sum = Number(
|
||||||
|
Number(prev) + Number(curr)
|
||||||
|
).toFixed(2); //toFixed(2)数据项保留两位小数
|
||||||
|
if (!isNaN(value)) {
|
||||||
|
return sum;
|
||||||
|
} else {
|
||||||
|
return prev;
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return sums;
|
||||||
},
|
},
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
let that = this;
|
let that = this;
|
||||||
if (this.queryType == "月") {
|
if (that.queryType == "月") {
|
||||||
if (this.queryDate !== "" && this.queryDate !== null) {
|
if (that.queryDate !== "" && that.queryDate !== null) {
|
||||||
this.start_date = this.queryDate + "-01";
|
let arr = that.queryDate.split("-");
|
||||||
let arr = this.queryDate.split("-");
|
let year = arr[0];
|
||||||
this.end_date =
|
let month = arr[1];
|
||||||
this.queryDate +
|
let days = new Date(year, month, 0).getDate();
|
||||||
"-" +
|
that.start_date = that.queryDate + "-01";
|
||||||
new Date(arr[0], arr[1], 0).getDate();
|
that.end_date =that.queryDate +"-" +days;
|
||||||
this.firstWeekNum = this.getWeekOfYear(
|
that.firstWeekNum = that.getWeekOfYear(year,month,1);
|
||||||
new Date(this.start_date)
|
that.endWeekNum = that.getWeekOfYear(year,month,days);
|
||||||
);
|
let duration = that.endWeekNum - that.firstWeekNum + 1;
|
||||||
this.endWeekNum = this.getWeekOfYear(
|
|
||||||
new Date(this.end_date)
|
|
||||||
);
|
|
||||||
let duration = this.endWeekNum - this.firstWeekNum + 1;
|
|
||||||
let xAxisData = [];
|
let xAxisData = [];
|
||||||
for (let i = 1; i <= duration; i++) {
|
for (let i = 1; i <= duration; i++) {
|
||||||
xAxisData.push("第" + i + "周");
|
xAxisData.push("第" + i + "周");
|
||||||
}
|
}
|
||||||
that.xAxisData = xAxisData;
|
that.xAxisData = xAxisData;
|
||||||
} else {
|
} else {
|
||||||
this.start_date =
|
that.start_date =that.currentYear + "-" + that.currentMonth + "-01";
|
||||||
this.currentYear + "-" + this.currentMonth + "-01";
|
that.end_date =that.currentYear +"-" +that.currentMonth +"-" +new Date(that.currentYear,that.currentMonth,0).getDate();
|
||||||
this.end_date =
|
that.firstWeekNum = that.getWeekOfYear(that.currentYear,that.currentMonth,1);;
|
||||||
this.currentYear +
|
that.xAxisData = that.xAxisOrigin;
|
||||||
"-" +
|
|
||||||
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 {
|
} else {
|
||||||
if (this.queryDate !== "" && this.queryDate !== null) {
|
if (that.queryDate !== "" && that.queryDate !== null) {
|
||||||
this.start_date = this.queryDate + "-01-01";
|
that.start_date = that.queryDate + "-01-01";
|
||||||
this.end_date = this.queryDate + "-12-31";
|
that.end_date = that.queryDate + "-12-31";
|
||||||
} else {
|
} else {
|
||||||
this.start_date = this.currentYear + "-01-01";
|
that.start_date = that.currentYear + "-01-01";
|
||||||
this.end_date = this.currentYear + "-12-31";
|
that.end_date = that.currentYear + "-12-31";
|
||||||
}
|
}
|
||||||
that.xAxisData = that.monthList;
|
that.xAxisData = that.monthList;
|
||||||
}
|
}
|
||||||
this.getData6();
|
that.getData6();
|
||||||
this.getData7();
|
that.getData7();
|
||||||
this.getData10();
|
that.getData10();
|
||||||
this.getDataDAVG();
|
// that.getDataDAVG();
|
||||||
},
|
},
|
||||||
|
//6
|
||||||
|
filterName6(value, row) {
|
||||||
|
return row.物料名 === value;
|
||||||
|
},
|
||||||
|
filterXilie6(value, row) {
|
||||||
|
return row.物料系列 === value;
|
||||||
|
},
|
||||||
|
filterDate6(value, row) {
|
||||||
|
if (this.queryType == "月") {
|
||||||
|
return row.周 === value;
|
||||||
|
}else{
|
||||||
|
return row.月 === value;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
filterSpecs6(value, row) {
|
||||||
|
return row.规格 === value;
|
||||||
|
},
|
||||||
|
filterModel6(value, row) {
|
||||||
|
return row.型号 === value;
|
||||||
|
},
|
||||||
|
//7
|
||||||
|
filterName7(value, row) {
|
||||||
|
return row.物料名 === value;
|
||||||
|
},
|
||||||
|
filterDate7(value, row) {
|
||||||
|
if (this.queryType == "月") {
|
||||||
|
return row.周 === value;
|
||||||
|
}else{
|
||||||
|
return row.月 === value;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
filterSpecs7(value, row) {
|
||||||
|
return row.规格 === value;
|
||||||
|
},
|
||||||
|
filterModel7(value, row) {
|
||||||
|
return row.型号 === value;
|
||||||
|
},
|
||||||
|
//10
|
||||||
|
filterName(value, row) {
|
||||||
|
return row.物料名 === value;
|
||||||
|
},
|
||||||
|
filterDate(value, row) {
|
||||||
|
if (this.queryType == "月") {
|
||||||
|
return row.周 === value;
|
||||||
|
}else{
|
||||||
|
return row.月 === value;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
filterSpecs(value, row) {
|
||||||
|
return row.规格 === value;
|
||||||
|
},
|
||||||
|
filterModel(value, row) {
|
||||||
|
return row.型号 === value;
|
||||||
|
},
|
||||||
handleExport(val) {
|
handleExport(val) {
|
||||||
this.exportLoading = true;
|
this.exportLoading = true;
|
||||||
let id = "#exportDiv" + val;
|
let id = "#exportDiv" + val;
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
<el-row :gutter="10">
|
<el-row :gutter="10">
|
||||||
<el-col :lg="12">
|
<el-col :lg="12">
|
||||||
<el-card shadow="never">
|
<el-card shadow="never">
|
||||||
<scEcharts height="300px" :option="option"></scEcharts>
|
<scEcharts id="bachart1" height="300px" :option="option"></scEcharts>
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :lg="12">
|
<el-col :lg="12">
|
||||||
|
|
@ -55,15 +55,19 @@
|
||||||
:data="tableData"
|
:data="tableData"
|
||||||
:height="tableHeight"
|
:height="tableHeight"
|
||||||
id="exportDiv"
|
id="exportDiv"
|
||||||
|
:summary-method="getSummaries"
|
||||||
|
show-summary
|
||||||
>
|
>
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50" />
|
||||||
<el-table-column label="工段" prop="工段">
|
<el-table-column label="工段" prop="工段"
|
||||||
|
:filters="mgroupFilters"
|
||||||
|
:filter-method="filterMgroup"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column label="物料名" prop="物料名" min-width="100"
|
||||||
label="物料名"
|
:filters="nameFilters"
|
||||||
prop="物料名"
|
:filter-method="filterName"
|
||||||
min-width="100"
|
filter-placement="bottom-end">
|
||||||
>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="任务数" prop="任务数">
|
<el-table-column label="任务数" prop="任务数">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
@ -75,12 +79,14 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="完成进度" prop="完成进度">
|
<el-table-column label="完成进度" prop="完成进度">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
{{ Math.round(scope.row.完成进度 * 100) }}%
|
<span v-if="scope.row.完成进度&&scope.row.完成进度>0">{{(scope.row.完成进度).toFixed(2)}}%</span>
|
||||||
|
<span v-else>{{scope.row.完成进度}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="合格率" prop="合格率">
|
<el-table-column label="合格率" prop="合格率">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
{{ Math.round(scope.row.合格率 * 100) }}%
|
<span v-if="scope.row.合格率&&scope.row.合格率>0">{{(scope.row.合格率).toFixed(2)}}%</span>
|
||||||
|
<span v-else>{{scope.row.合格率}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
@ -125,33 +131,10 @@ export default {
|
||||||
yAxis: {
|
yAxis: {
|
||||||
type: "value",
|
type: "value",
|
||||||
},
|
},
|
||||||
series: [
|
series: [],
|
||||||
{
|
|
||||||
name: "光纤预制棒",
|
|
||||||
data: [0, 0, 0, 0, 0, 0, 0, 0],
|
|
||||||
type: "bar",
|
|
||||||
label: {
|
|
||||||
show: true,
|
|
||||||
position: "top",
|
|
||||||
formatter: "{c}",
|
|
||||||
color: "rgb(64,158,255)",
|
|
||||||
},
|
|
||||||
barWidth: "15px",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "光纤预制管",
|
|
||||||
data: [0, 0, 0, 0, 0, 0, 0, 0],
|
|
||||||
type: "bar",
|
|
||||||
label: {
|
|
||||||
show: true,
|
|
||||||
position: "top",
|
|
||||||
formatter: "{c}",
|
|
||||||
color: "rgb(64,158,255)",
|
|
||||||
},
|
|
||||||
barWidth: "15px",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
|
nameFilters: [],
|
||||||
|
mgroupFilters: [],
|
||||||
processData: [],
|
processData: [],
|
||||||
xAxisData: [],
|
xAxisData: [],
|
||||||
tableData: [],
|
tableData: [],
|
||||||
|
|
@ -164,13 +147,14 @@ export default {
|
||||||
let month = date.getMonth() + 1;
|
let month = date.getMonth() + 1;
|
||||||
let days = new Date(year, month, 0).getDate();
|
let days = new Date(year, month, 0).getDate();
|
||||||
that.currentYear = year;
|
that.currentYear = year;
|
||||||
that.currentMonth = month > 9 ? month : "0" + month;
|
that.currentMonth = month;
|
||||||
|
month = month > 9 ? month : "0" + month;
|
||||||
that.start_date = year + "-" + month + "-01";
|
that.start_date = year + "-" + month + "-01";
|
||||||
that.end_date =
|
that.end_date =year + "-" + month + "-" + days;
|
||||||
year + "-" + month + "-" + new Date(year, month, 0).getDate();
|
that.queryDate = year + "-" + month;
|
||||||
let month1 = month > 9 ? month : "0" + month;
|
let height = document.getElementById("elMain").clientHeight - 40;
|
||||||
that.queryDate = year + "-" + month1;
|
that.tableHeight = height;
|
||||||
that.tableHeight = document.getElementById("elMain").clientHeight - 40;
|
document.getElementById('bachart1').style.height = height + 'px';
|
||||||
that.getData6();
|
that.getData6();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
@ -180,6 +164,8 @@ export default {
|
||||||
},
|
},
|
||||||
getData6() {
|
getData6() {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
that.nameFilters = [];
|
||||||
|
that.mgroupFilters = [];
|
||||||
let obj = {
|
let obj = {
|
||||||
query: {
|
query: {
|
||||||
start_date: this.start_date,
|
start_date: this.start_date,
|
||||||
|
|
@ -191,6 +177,7 @@ export default {
|
||||||
is_count_utask: -1,
|
is_count_utask: -1,
|
||||||
select_cols_mgroup: ", mgroup.name AS 工段",
|
select_cols_mgroup: ", mgroup.name AS 工段",
|
||||||
group_bys_mgroup: ", mgroup.name",
|
group_bys_mgroup: ", mgroup.name",
|
||||||
|
order_bys_mgroup:",工段"
|
||||||
},
|
},
|
||||||
raise_exception: true,
|
raise_exception: true,
|
||||||
};
|
};
|
||||||
|
|
@ -201,9 +188,7 @@ export default {
|
||||||
",EXTRACT ( MONTH FROM mlog.handle_date )";
|
",EXTRACT ( MONTH FROM mlog.handle_date )";
|
||||||
obj.query.order_bys_date = ", 月";
|
obj.query.order_bys_date = ", 月";
|
||||||
}
|
}
|
||||||
let xAxisData = [],
|
let xAxisData = [],nameData=[],seriesData=[];
|
||||||
data1 = [],
|
|
||||||
data0 = [];
|
|
||||||
that.$API.bi.dataset.exec.req("lineWeek", obj).then((res) => {
|
that.$API.bi.dataset.exec.req("lineWeek", obj).then((res) => {
|
||||||
let data = res.data2.ds0;
|
let data = res.data2.ds0;
|
||||||
that.tableData = data;
|
that.tableData = data;
|
||||||
|
|
@ -211,19 +196,40 @@ export default {
|
||||||
if (xAxisData.indexOf(item.工段) > -1) {
|
if (xAxisData.indexOf(item.工段) > -1) {
|
||||||
} else {
|
} else {
|
||||||
xAxisData.push(item.工段);
|
xAxisData.push(item.工段);
|
||||||
|
let obj = {};
|
||||||
|
obj.text = item.工段;
|
||||||
|
obj.value = item.工段;
|
||||||
|
that.mgroupFilters.push(obj);
|
||||||
}
|
}
|
||||||
console.log("xAxisData:", xAxisData);
|
if (nameData.indexOf(item.物料名) > -1) {
|
||||||
let index = xAxisData.indexOf(item.工段);
|
|
||||||
if (item.物料名.indexOf("棒") > -1) {
|
|
||||||
data0[index] = item.合格数;
|
|
||||||
} else {
|
} else {
|
||||||
data1[index] = item.合格数;
|
let obj0 = {};
|
||||||
|
obj0.text = item.物料名;
|
||||||
|
obj0.value = item.物料名;
|
||||||
|
that.nameFilters.push(obj0);
|
||||||
|
nameData.push(item.物料名);
|
||||||
|
let obj = {
|
||||||
|
name:'',
|
||||||
|
type: "bar",
|
||||||
|
label:{
|
||||||
|
show: true,
|
||||||
|
position: "top",
|
||||||
|
formatter: "{c}",
|
||||||
|
color: "rgb(64,158,255)",
|
||||||
|
},
|
||||||
|
barWidth: "15px",
|
||||||
|
data:[0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
|
};
|
||||||
|
obj.name=item.物料名,
|
||||||
|
seriesData.push(obj);
|
||||||
}
|
}
|
||||||
|
let index = xAxisData.indexOf(item.工段);
|
||||||
|
let indexY = nameData.indexOf(item.物料名);
|
||||||
|
seriesData[indexY].data[index] += item.合格数;
|
||||||
});
|
});
|
||||||
that.xAxisData = xAxisData;
|
that.xAxisData = xAxisData;
|
||||||
that.option.xAxis.data = that.xAxisData;
|
that.option.xAxis.data = that.xAxisData;
|
||||||
that.option.series[0].data = data0;
|
that.option.series = seriesData;
|
||||||
that.option.series[1].data = data1;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
|
|
@ -231,10 +237,7 @@ export default {
|
||||||
if (this.queryType == "月") {
|
if (this.queryType == "月") {
|
||||||
this.start_date = this.queryDate + "-01";
|
this.start_date = this.queryDate + "-01";
|
||||||
let arr = this.queryDate.split("-");
|
let arr = this.queryDate.split("-");
|
||||||
this.end_date =
|
this.end_date =this.queryDate +"-" +new Date(arr[0], arr[1], 0).getDate();
|
||||||
this.queryDate +
|
|
||||||
"-" +
|
|
||||||
new Date(arr[0], arr[1], 0).getDate();
|
|
||||||
} else {
|
} else {
|
||||||
this.start_date = this.queryDate + "-01-01";
|
this.start_date = this.queryDate + "-01-01";
|
||||||
this.end_date = this.queryDate + "-12-31";
|
this.end_date = this.queryDate + "-12-31";
|
||||||
|
|
@ -260,6 +263,40 @@ export default {
|
||||||
}
|
}
|
||||||
this.getData6();
|
this.getData6();
|
||||||
},
|
},
|
||||||
|
getSummaries({ columns, data }) {
|
||||||
|
const sums = [];
|
||||||
|
columns.forEach((column, index) => {
|
||||||
|
if (index === 0) {
|
||||||
|
sums[index] = "合计";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (index == 3||index == 4||index == 5||index == 6) {
|
||||||
|
const values = data.map((item) =>
|
||||||
|
Number(item[column.property])
|
||||||
|
);
|
||||||
|
if (!values.every((value) => Number.isNaN(value))) {
|
||||||
|
sums[index] = values.reduce((prev, curr) => {
|
||||||
|
const value = Number(curr); //Number转换为数值
|
||||||
|
let sum = Number(
|
||||||
|
Number(prev) + Number(curr)
|
||||||
|
).toFixed(2); //toFixed(2)数据项保留两位小数
|
||||||
|
if (!isNaN(value)) {
|
||||||
|
return sum;
|
||||||
|
} else {
|
||||||
|
return prev;
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return sums;
|
||||||
|
},
|
||||||
|
filterName(value, row) {
|
||||||
|
return row.物料名 === value;
|
||||||
|
},
|
||||||
|
filterMgroup(value, row) {
|
||||||
|
return row.工段 === value;
|
||||||
|
},
|
||||||
handleExport() {
|
handleExport() {
|
||||||
this.exportLoading = true;
|
this.exportLoading = true;
|
||||||
this.$XLSX("#exportDiv", "工序合格数");
|
this.$XLSX("#exportDiv", "工序合格数");
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@
|
||||||
<el-card shadow="never" style="margin-bottom: 8px">
|
<el-card shadow="never" style="margin-bottom: 8px">
|
||||||
<el-row :gutter="15">
|
<el-row :gutter="15">
|
||||||
<el-col :lg="8">
|
<el-col :lg="8">
|
||||||
<scEcharts height="300px" :option="option1"></scEcharts>
|
<scEcharts height="400px" :option="option1"></scEcharts>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :lg="16" style="position: relative">
|
<el-col :lg="16" style="position: relative">
|
||||||
<el-button
|
<el-button
|
||||||
|
|
@ -50,45 +50,39 @@
|
||||||
<el-table
|
<el-table
|
||||||
:data="tableData7"
|
:data="tableData7"
|
||||||
id="exportDiv7"
|
id="exportDiv7"
|
||||||
:height="300"
|
:height="400"
|
||||||
|
:summary-method="getSummaries"
|
||||||
|
show-summary
|
||||||
>
|
>
|
||||||
<el-table-column
|
<el-table-column label="年" prop="年" v-if="queryType == '年'" width="60">
|
||||||
label="年"
|
|
||||||
prop="年"
|
|
||||||
v-if="queryType == '年'"
|
|
||||||
width="60"
|
|
||||||
>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column label="月" prop="月" v-else width="60">
|
||||||
label="月"
|
|
||||||
prop="月"
|
|
||||||
v-else
|
|
||||||
width="60"
|
|
||||||
>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="物料名" prop="物料名">
|
<el-table-column label="物料名" prop="物料名" width="100"
|
||||||
|
:filters="nameFilters7"
|
||||||
|
:filter-method="filterName7"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="型号" prop="型号">
|
<el-table-column label="型号" prop="型号"
|
||||||
|
:filters="modelFilters7"
|
||||||
|
:filter-method="filterModel7"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="规格" prop="规格">
|
<el-table-column label="规格" prop="规格"
|
||||||
|
:filters="specsFilters7"
|
||||||
|
:filter-method="filterSpecs7"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</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 label="合格数" prop="合格数">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="合格率" prop="合格率">
|
<el-table-column label="合格率" prop="合格率">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span
|
<span>{{Math.round(scope.row.合格率)}}%</span>
|
||||||
>{{
|
|
||||||
Math.round(scope.row.合格率)
|
|
||||||
}}%</span
|
|
||||||
>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column label="不合格原因及数量" align="center">
|
||||||
label="不合格原因及数量"
|
|
||||||
align="center"
|
|
||||||
>
|
|
||||||
<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="条纹">
|
||||||
|
|
@ -109,7 +103,7 @@
|
||||||
<el-card shadow="never" style="margin-bottom: 8px">
|
<el-card shadow="never" style="margin-bottom: 8px">
|
||||||
<el-row :gutter="15">
|
<el-row :gutter="15">
|
||||||
<el-col :lg="8">
|
<el-col :lg="8">
|
||||||
<scEcharts height="300px" :option="option2"></scEcharts>
|
<scEcharts height="400px" :option="option2"></scEcharts>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :lg="16" style="position: relative">
|
<el-col :lg="16" style="position: relative">
|
||||||
<el-button
|
<el-button
|
||||||
|
|
@ -121,27 +115,28 @@
|
||||||
<el-table
|
<el-table
|
||||||
:data="tableData10"
|
:data="tableData10"
|
||||||
id="exportDiv10"
|
id="exportDiv10"
|
||||||
:height="300"
|
:height="400"
|
||||||
|
:summary-method="getSummaries"
|
||||||
|
show-summary
|
||||||
>
|
>
|
||||||
<el-table-column
|
<el-table-column label="年" prop="年" v-if="queryType == '年'" width="60">
|
||||||
label="年"
|
|
||||||
prop="年"
|
|
||||||
v-if="queryType == '年'"
|
|
||||||
width="60"
|
|
||||||
>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column label="月" prop="月" v-else width="60">
|
||||||
label="月"
|
|
||||||
prop="月"
|
|
||||||
v-else
|
|
||||||
width="60"
|
|
||||||
>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="物料名" prop="物料名">
|
<el-table-column label="物料名" prop="物料名" width="100"
|
||||||
|
:filters="nameFilters10"
|
||||||
|
:filter-method="filterName10"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="型号" prop="型号">
|
<el-table-column label="型号" prop="型号"
|
||||||
|
:filters="modelFilters10"
|
||||||
|
:filter-method="filterModel10"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="规格" prop="规格">
|
<el-table-column label="规格" prop="规格"
|
||||||
|
:filters="specsFilters10"
|
||||||
|
:filter-method="filterSpecs10"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="出料数" prop="生产数">
|
<el-table-column label="出料数" prop="生产数">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
@ -149,17 +144,10 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="合格率">
|
<el-table-column label="合格率">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span
|
<span>{{Math.round(scope.row.合格率)}}%</span>
|
||||||
>{{
|
|
||||||
Math.round(scope.row.合格率)
|
|
||||||
}}%</span
|
|
||||||
>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column label="不合格原因及数量" align="center">
|
||||||
label="不合格原因及数量"
|
|
||||||
align="center"
|
|
||||||
>
|
|
||||||
<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="条纹">
|
||||||
|
|
@ -184,7 +172,7 @@
|
||||||
<el-card shadow="never" style="margin-bottom: 8px">
|
<el-card shadow="never" style="margin-bottom: 8px">
|
||||||
<el-row :gutter="15">
|
<el-row :gutter="15">
|
||||||
<el-col :lg="8">
|
<el-col :lg="8">
|
||||||
<scEcharts height="300px" :option="option3"></scEcharts>
|
<scEcharts height="400px" :option="option3"></scEcharts>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :lg="16" style="position: relative">
|
<el-col :lg="16" style="position: relative">
|
||||||
<el-button
|
<el-button
|
||||||
|
|
@ -196,45 +184,39 @@
|
||||||
<el-table
|
<el-table
|
||||||
:data="tableData8"
|
:data="tableData8"
|
||||||
id="exportDiv8"
|
id="exportDiv8"
|
||||||
:height="300"
|
:height="400"
|
||||||
|
:summary-method="getSummaries"
|
||||||
|
show-summary
|
||||||
>
|
>
|
||||||
<el-table-column
|
<el-table-column label="年" prop="年" v-if="queryType == '年'" width="60">
|
||||||
label="年"
|
|
||||||
prop="年"
|
|
||||||
v-if="queryType == '年'"
|
|
||||||
width="60"
|
|
||||||
>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column label="月" prop="月" v-else width="60">
|
||||||
label="月"
|
|
||||||
prop="月"
|
|
||||||
v-else
|
|
||||||
width="60"
|
|
||||||
>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="物料名" prop="物料名">
|
<el-table-column label="物料名" prop="物料名" width="100"
|
||||||
|
:filters="nameFilters"
|
||||||
|
:filter-method="filterName"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="型号" prop="型号">
|
<el-table-column label="型号" prop="型号"
|
||||||
|
:filters="modelFilters"
|
||||||
|
:filter-method="filterModel"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="规格" prop="规格">
|
<el-table-column label="规格" prop="规格"
|
||||||
|
:filters="specsFilters"
|
||||||
|
:filter-method="filterSpecs"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</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 label="合格数" prop="合格数">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="合格率">
|
<el-table-column label="合格率">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span
|
<span>{{Math.round(scope.row.合格率)}}%</span>
|
||||||
>{{
|
|
||||||
Math.round(scope.row.合格率)
|
|
||||||
}}%</span
|
|
||||||
>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column label="不合格原因及数量" align="center">
|
||||||
label="不合格原因及数量"
|
|
||||||
align="center"
|
|
||||||
>
|
|
||||||
<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="条纹">
|
||||||
|
|
@ -249,7 +231,7 @@
|
||||||
</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 label="箱中破" prop="箱中破">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="合计" prop="不合格数">
|
<el-table-column label="合计" prop="不合格数">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
@ -301,8 +283,8 @@ export default {
|
||||||
series: {
|
series: {
|
||||||
name: "7车间预制棒",
|
name: "7车间预制棒",
|
||||||
type: "pie",
|
type: "pie",
|
||||||
radius: ["40%", "70%"],
|
radius: ["35%", "65%"],
|
||||||
center: ["50%", "60%"],
|
center: ["50%", "55%"],
|
||||||
label: {
|
label: {
|
||||||
show: true,
|
show: true,
|
||||||
position: "outside",
|
position: "outside",
|
||||||
|
|
@ -330,8 +312,8 @@ export default {
|
||||||
series: {
|
series: {
|
||||||
name: "10车间预制管",
|
name: "10车间预制管",
|
||||||
type: "pie",
|
type: "pie",
|
||||||
radius: ["40%", "70%"],
|
radius: ["35%", "65%"],
|
||||||
center: ["50%", "60%"],
|
center: ["50%", "55%"],
|
||||||
label: {
|
label: {
|
||||||
show: true,
|
show: true,
|
||||||
position: "outside",
|
position: "outside",
|
||||||
|
|
@ -360,8 +342,8 @@ export default {
|
||||||
series: {
|
series: {
|
||||||
name: "退火预制管",
|
name: "退火预制管",
|
||||||
type: "pie",
|
type: "pie",
|
||||||
radius: ["40%", "70%"],
|
radius: ["35%", "65%"],
|
||||||
center: ["50%", "60%"],
|
center: ["50%", "55%"],
|
||||||
label: {
|
label: {
|
||||||
show: true,
|
show: true,
|
||||||
position: "outside",
|
position: "outside",
|
||||||
|
|
@ -383,6 +365,15 @@ export default {
|
||||||
tableData7: [],
|
tableData7: [],
|
||||||
tableData10: [],
|
tableData10: [],
|
||||||
tableData8: [],
|
tableData8: [],
|
||||||
|
nameFilters: [],
|
||||||
|
specsFilters:[],
|
||||||
|
modelFilters:[],
|
||||||
|
nameFilters7: [],
|
||||||
|
specsFilters7:[],
|
||||||
|
modelFilters7:[],
|
||||||
|
nameFilters10: [],
|
||||||
|
specsFilters10:[],
|
||||||
|
modelFilters10:[],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
@ -396,7 +387,7 @@ export default {
|
||||||
this.queryDate = year + "-" + month;
|
this.queryDate = year + "-" + month;
|
||||||
this.start_date = year + "-" + month + "-01";
|
this.start_date = year + "-" + month + "-01";
|
||||||
this.end_date =
|
this.end_date =
|
||||||
year + "-" + month + "-" + new Date(year, month, 0).getDate();
|
year + "-" + month + "-" + days;
|
||||||
this.getData();
|
this.getData();
|
||||||
this.getData7();
|
this.getData7();
|
||||||
this.getData10();
|
this.getData10();
|
||||||
|
|
@ -409,6 +400,10 @@ export default {
|
||||||
getData() {
|
getData() {
|
||||||
let that = this;
|
let that = this;
|
||||||
that.tableData8 = [];
|
that.tableData8 = [];
|
||||||
|
that.nameFilters = [];
|
||||||
|
that.modelFilters = [];
|
||||||
|
that.specsFilters = [];
|
||||||
|
let nameList=[],specsList=[],modelList=[];
|
||||||
let exec = that.queryType == "月" ? "lineMonth" : "lineYear";
|
let exec = that.queryType == "月" ? "lineMonth" : "lineYear";
|
||||||
let obj = {
|
let obj = {
|
||||||
query: {
|
query: {
|
||||||
|
|
@ -419,10 +414,32 @@ export default {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
||||||
console.log("退火车间统计:", res);
|
|
||||||
if (res.data2.ds0) {
|
if (res.data2.ds0) {
|
||||||
let data = res.data2.ds0;
|
let data = res.data2.ds0;
|
||||||
that.tableData8 = data;
|
that.tableData8 = data;
|
||||||
|
data.forEach((item) => {
|
||||||
|
if(nameList.indexOf(item.物料名)>-1){}else{
|
||||||
|
nameList.push(item.物料名);
|
||||||
|
let obj = {};
|
||||||
|
obj.text = item.物料名;
|
||||||
|
obj.value = item.物料名;
|
||||||
|
that.nameFilters.push(obj);
|
||||||
|
}
|
||||||
|
if(modelList.indexOf(item.型号)>-1){}else{
|
||||||
|
modelList.push(item.型号);
|
||||||
|
let obj2 = {};
|
||||||
|
obj2.text = item.型号;
|
||||||
|
obj2.value = item.型号;
|
||||||
|
that.modelFilters.push(obj2);
|
||||||
|
}
|
||||||
|
if(specsList.indexOf(item.规格)>-1){}else{
|
||||||
|
specsList.push(item.规格);
|
||||||
|
let obj3 = {};
|
||||||
|
obj3.text = item.规格;
|
||||||
|
obj3.value = item.规格;
|
||||||
|
that.specsFilters.push(obj3);
|
||||||
|
}
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
that.tableData8 = [];
|
that.tableData8 = [];
|
||||||
}
|
}
|
||||||
|
|
@ -442,6 +459,15 @@ export default {
|
||||||
that.$API.bi.dataset.exec.req(exec, obj2).then((res2) => {
|
that.$API.bi.dataset.exec.req(exec, obj2).then((res2) => {
|
||||||
console.log("退火车间统计:", res2);
|
console.log("退火车间统计:", res2);
|
||||||
if (res2.data2.ds0) {
|
if (res2.data2.ds0) {
|
||||||
|
that.option3.series.data[0].value=0;
|
||||||
|
that.option3.series.data[1].value=0;
|
||||||
|
that.option3.series.data[2].value=0;
|
||||||
|
that.option3.series.data[3].value=0;
|
||||||
|
that.option3.series.data[4].value=0;
|
||||||
|
that.option3.series.data[5].value=0;
|
||||||
|
that.option3.series.data[6].value=0;
|
||||||
|
that.option3.series.data[7].value=0;
|
||||||
|
that.option3.series.data[8].value=0;
|
||||||
let data = res2.data2.ds0;
|
let data = res2.data2.ds0;
|
||||||
if (data.length > 0) {
|
if (data.length > 0) {
|
||||||
data.forEach((item) => {
|
data.forEach((item) => {
|
||||||
|
|
@ -462,6 +488,10 @@ export default {
|
||||||
getData7() {
|
getData7() {
|
||||||
let that = this;
|
let that = this;
|
||||||
that.tableData7 = [];
|
that.tableData7 = [];
|
||||||
|
that.nameFilters7 = [];
|
||||||
|
that.modelFilters7 = [];
|
||||||
|
that.specsFilters7 = [];
|
||||||
|
let nameList=[],specsList=[],modelList=[];
|
||||||
let obj = {
|
let obj = {
|
||||||
query: {
|
query: {
|
||||||
start_date: this.start_date,
|
start_date: this.start_date,
|
||||||
|
|
@ -471,10 +501,32 @@ export default {
|
||||||
};
|
};
|
||||||
let exec = that.queryType == "月" ? "lineMonth" : "lineYear";
|
let exec = that.queryType == "月" ? "lineMonth" : "lineYear";
|
||||||
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
||||||
console.log("7生产车间统计:", res);
|
|
||||||
if (res.data2.ds0) {
|
if (res.data2.ds0) {
|
||||||
let data = res.data2.ds0;
|
let data = res.data2.ds0;
|
||||||
that.tableData7 = data;
|
that.tableData7 = data;
|
||||||
|
data.forEach((item) => {
|
||||||
|
if(nameList.indexOf(item.物料名)>-1){}else{
|
||||||
|
nameList.push(item.物料名);
|
||||||
|
let obj = {};
|
||||||
|
obj.text = item.物料名;
|
||||||
|
obj.value = item.物料名;
|
||||||
|
that.nameFilters7.push(obj);
|
||||||
|
}
|
||||||
|
if(modelList.indexOf(item.型号)>-1){}else{
|
||||||
|
modelList.push(item.型号);
|
||||||
|
let obj2 = {};
|
||||||
|
obj2.text = item.型号;
|
||||||
|
obj2.value = item.型号;
|
||||||
|
that.modelFilters7.push(obj2);
|
||||||
|
}
|
||||||
|
if(specsList.indexOf(item.规格)>-1){}else{
|
||||||
|
specsList.push(item.规格);
|
||||||
|
let obj3 = {};
|
||||||
|
obj3.text = item.规格;
|
||||||
|
obj3.value = item.规格;
|
||||||
|
that.specsFilters7.push(obj3);
|
||||||
|
}
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
that.tableData7 = [];
|
that.tableData7 = [];
|
||||||
}
|
}
|
||||||
|
|
@ -493,6 +545,12 @@ export default {
|
||||||
that.$API.bi.dataset.exec.req(exec, obj2).then((res2) => {
|
that.$API.bi.dataset.exec.req(exec, obj2).then((res2) => {
|
||||||
console.log("7生产车间统计:", res2);
|
console.log("7生产车间统计:", res2);
|
||||||
if (res2.data2.ds0) {
|
if (res2.data2.ds0) {
|
||||||
|
that.option1.series.data[0].value=0;
|
||||||
|
that.option1.series.data[1].value=0;
|
||||||
|
that.option1.series.data[2].value=0;
|
||||||
|
that.option1.series.data[3].value=0;
|
||||||
|
that.option1.series.data[4].value=0;
|
||||||
|
that.option1.series.data[5].value=0;
|
||||||
let data = res2.data2.ds0;
|
let data = res2.data2.ds0;
|
||||||
if (data.length > 0) {
|
if (data.length > 0) {
|
||||||
data.forEach((item) => {
|
data.forEach((item) => {
|
||||||
|
|
@ -510,6 +568,10 @@ export default {
|
||||||
getData10() {
|
getData10() {
|
||||||
let that = this;
|
let that = this;
|
||||||
that.tableData10 = [];
|
that.tableData10 = [];
|
||||||
|
that.nameFilters10 = [];
|
||||||
|
that.modelFilters10 = [];
|
||||||
|
that.specsFilters10 = [];
|
||||||
|
let nameList=[],specsList=[],modelList=[];
|
||||||
let obj = {
|
let obj = {
|
||||||
query: {
|
query: {
|
||||||
start_date: this.start_date,
|
start_date: this.start_date,
|
||||||
|
|
@ -519,10 +581,32 @@ export default {
|
||||||
};
|
};
|
||||||
let exec = that.queryType == "月" ? "lineMonth" : "lineYear";
|
let exec = that.queryType == "月" ? "lineMonth" : "lineYear";
|
||||||
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
||||||
console.log("10生产车间统计:", res);
|
|
||||||
if (res.data2.ds0) {
|
if (res.data2.ds0) {
|
||||||
let data = res.data2.ds0;
|
let data = res.data2.ds0;
|
||||||
that.tableData10 = data;
|
that.tableData10 = data;
|
||||||
|
data.forEach((item) => {
|
||||||
|
if(nameList.indexOf(item.物料名)>-1){}else{
|
||||||
|
nameList.push(item.物料名);
|
||||||
|
let obj = {};
|
||||||
|
obj.text = item.物料名;
|
||||||
|
obj.value = item.物料名;
|
||||||
|
that.nameFilters10.push(obj);
|
||||||
|
}
|
||||||
|
if(modelList.indexOf(item.型号)>-1){}else{
|
||||||
|
modelList.push(item.型号);
|
||||||
|
let obj2 = {};
|
||||||
|
obj2.text = item.型号;
|
||||||
|
obj2.value = item.型号;
|
||||||
|
that.modelFilters10.push(obj2);
|
||||||
|
}
|
||||||
|
if(specsList.indexOf(item.规格)>-1){}else{
|
||||||
|
specsList.push(item.规格);
|
||||||
|
let obj3 = {};
|
||||||
|
obj3.text = item.规格;
|
||||||
|
obj3.value = item.规格;
|
||||||
|
that.specsFilters10.push(obj3);
|
||||||
|
}
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
that.tableData10 = [];
|
that.tableData10 = [];
|
||||||
}
|
}
|
||||||
|
|
@ -539,9 +623,15 @@ export default {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
that.$API.bi.dataset.exec.req(exec, obj2).then((res2) => {
|
that.$API.bi.dataset.exec.req(exec, obj2).then((res2) => {
|
||||||
console.log("10生产车间统计:", res2);
|
|
||||||
if (res2.data2.ds0) {
|
if (res2.data2.ds0) {
|
||||||
let data = res2.data2.ds0;
|
let data = res2.data2.ds0;
|
||||||
|
that.option2.series.data[0].value=0;
|
||||||
|
that.option2.series.data[1].value=0;
|
||||||
|
that.option2.series.data[2].value=0;
|
||||||
|
that.option2.series.data[3].value=0;
|
||||||
|
that.option2.series.data[4].value=0;
|
||||||
|
that.option2.series.data[5].value=0;
|
||||||
|
that.option2.series.data[6].value=0;
|
||||||
if (data.length > 0) {
|
if (data.length > 0) {
|
||||||
data.forEach((item) => {
|
data.forEach((item) => {
|
||||||
that.option2.series.data[0].value += item.合格数;
|
that.option2.series.data[0].value += item.合格数;
|
||||||
|
|
@ -593,6 +683,61 @@ export default {
|
||||||
this.getData7();
|
this.getData7();
|
||||||
this.getData10();
|
this.getData10();
|
||||||
},
|
},
|
||||||
|
getSummaries({ columns, data }) {
|
||||||
|
const sums = [];
|
||||||
|
columns.forEach((column, index) => {
|
||||||
|
if (index === 0) {
|
||||||
|
sums[index] = "合计";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (index == 4||index == 5) {
|
||||||
|
const values = data.map((item) =>
|
||||||
|
Number(item[column.property])
|
||||||
|
);
|
||||||
|
if (!values.every((value) => Number.isNaN(value))) {
|
||||||
|
sums[index] = values.reduce((prev, curr) => {
|
||||||
|
const value = Number(curr); //Number转换为数值
|
||||||
|
let sum = Number(
|
||||||
|
Number(prev) + Number(curr)
|
||||||
|
).toFixed(2); //toFixed(2)数据项保留两位小数
|
||||||
|
if (!isNaN(value)) {
|
||||||
|
return sum;
|
||||||
|
} else {
|
||||||
|
return prev;
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return sums;
|
||||||
|
},
|
||||||
|
filterName(value, row) {
|
||||||
|
return row.物料名 === value;
|
||||||
|
},
|
||||||
|
filterSpecs(value, row) {
|
||||||
|
return row.规格 === value;
|
||||||
|
},
|
||||||
|
filterModel(value, row) {
|
||||||
|
return row.型号 === value;
|
||||||
|
},
|
||||||
|
filterName7(value, row) {
|
||||||
|
return row.物料名 === value;
|
||||||
|
},
|
||||||
|
filterSpecs7(value, row) {
|
||||||
|
return row.规格 === value;
|
||||||
|
},
|
||||||
|
filterModel7(value, row) {
|
||||||
|
return row.型号 === value;
|
||||||
|
},
|
||||||
|
filterName10(value, row) {
|
||||||
|
return row.物料名 === value;
|
||||||
|
},
|
||||||
|
filterSpecs10(value, row) {
|
||||||
|
return row.规格 === value;
|
||||||
|
},
|
||||||
|
filterModel10(value, row) {
|
||||||
|
return row.型号 === value;
|
||||||
|
},
|
||||||
handleExport(val) {
|
handleExport(val) {
|
||||||
this.exportLoading = true;
|
this.exportLoading = true;
|
||||||
let id = "#exportDiv" + val;
|
let id = "#exportDiv" + val;
|
||||||
|
|
|
||||||
|
|
@ -35,9 +35,9 @@
|
||||||
<el-card shadow="never" style="margin-bottom: 8px;">
|
<el-card shadow="never" style="margin-bottom: 8px;">
|
||||||
<el-header>
|
<el-header>
|
||||||
<div class="right-panel">
|
<div class="right-panel">
|
||||||
<h2>各工序检验</h2>
|
<h2>各工段检验</h2>
|
||||||
<el-select v-model="process" clearable @change="processChange">
|
<el-select v-model="mgroup" clearable @change="mgroupChange">
|
||||||
<el-option v-for="item in processOption"
|
<el-option v-for="item in mgroupOption"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.id"
|
:value="item.id"
|
||||||
|
|
@ -52,17 +52,26 @@
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :lg="16" style="position: relative;">
|
<el-col :lg="16" style="position: relative;">
|
||||||
<el-button @click="handleExport('1')" class="tables" type="primary">导出</el-button>
|
<el-button @click="handleExport('1')" class="tables" type="primary">导出</el-button>
|
||||||
<el-table :data="tableData" :height="500" id="exportDiv1">
|
<el-table :data="tableData" :height="500" id="exportDiv1" :summary-method="getSummaries" show-summary>
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50" />
|
||||||
<el-table-column label="日期" prop="date">
|
<el-table-column label="日期" prop="date"
|
||||||
|
:filters="dateFilters"
|
||||||
|
:filter-method="filterDate"
|
||||||
|
filter-placement="bottom-end">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span>{{ scope.row.年 }}</span>
|
<span>{{ scope.row.年 }}</span>
|
||||||
<span v-if="scope.row.月">-{{ scope.row.月 }}</span>
|
<span v-if="scope.row.月">-{{ scope.row.月 }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="规格" prop="规格">
|
<el-table-column label="规格" prop="规格"
|
||||||
|
:filters="specsFilters"
|
||||||
|
:filter-method="filterSpecs"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="型号" prop="型号">
|
<el-table-column label="型号" prop="型号"
|
||||||
|
:filters="modelFilters"
|
||||||
|
:filter-method="filterModel"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="合格数" prop="合格数">
|
<el-table-column label="合格数" prop="合格数">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
@ -125,10 +134,13 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
process:'',
|
mgroup:'',
|
||||||
processName:'',
|
mgroupName:'',
|
||||||
processOption:[],
|
mgroupOption:[],
|
||||||
tableData:[],
|
tableData:[],
|
||||||
|
dateFilters:[],
|
||||||
|
specsFilters:[],
|
||||||
|
modelFilters:[],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted(){
|
mounted(){
|
||||||
|
|
@ -141,37 +153,39 @@
|
||||||
this.currentYear = year;
|
this.currentYear = year;
|
||||||
this.currentMonth = month;
|
this.currentMonth = month;
|
||||||
this.queryDate = year + '-' + month;
|
this.queryDate = year + '-' + month;
|
||||||
// this.start_date =year+'-'+month+'-01';
|
this.start_date =year+'-'+month+'-01';
|
||||||
// this.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate();
|
this.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate();
|
||||||
this.start_date ='2023-01-01';
|
this.getMgroup();
|
||||||
this.end_date = '2023-12-31';
|
|
||||||
this.getProcess();
|
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
queryTypeChange(value){
|
queryTypeChange(value){
|
||||||
console.log(value)
|
console.log(value)
|
||||||
this.queryDate = '';
|
this.queryDate = '';
|
||||||
},
|
},
|
||||||
getProcess(){
|
getMgroup(){
|
||||||
this.$API.mtm.process.list.req({cate:'粗加工',page:0}).then((res) => {
|
this.$API.mtm.mgroup.list.req({belong_dept__name:'6车间',page:0}).then((res) => {
|
||||||
this.processOption = res;
|
this.mgroupOption = res;
|
||||||
this.process = res[0].id;
|
this.mgroup = res[0].id;
|
||||||
this.processName = res[0].name;
|
this.mgroupName = res[0].name;
|
||||||
this.getData();
|
this.getData();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
processChange() {
|
mgroupChange() {
|
||||||
this.processName = this.processOption.find(item => item.id === this.process).name;
|
this.mgroupName = this.mgroupOption.find(item => item.id === this.mgroup).name;
|
||||||
this.getData();
|
this.getData();
|
||||||
},
|
},
|
||||||
getData(){
|
getData(){
|
||||||
let that = this;
|
let that = this;
|
||||||
|
that.dateFilters = [];
|
||||||
|
that.modelFilters = [];
|
||||||
|
that.specsFilters = [];
|
||||||
|
let dateList=[],specsList=[],modelList=[];
|
||||||
let exec = that.queryType=='月'?'lineMonth':'lineYear';
|
let exec = that.queryType=='月'?'lineMonth':'lineYear';
|
||||||
let obj = {
|
let obj = {
|
||||||
query: {
|
query: {
|
||||||
end_date: that.end_date,
|
end_date: that.end_date,
|
||||||
start_date: that.start_date,
|
start_date: that.start_date,
|
||||||
mgroup_name: that.processName,group_bys_mgroup: ", mgroup.name",
|
mgroup_name: that.mgroupName,group_bys_mgroup: ", mgroup.name",
|
||||||
group_bys_material: "",order_bys_material: "",
|
group_bys_material: "",order_bys_material: "",
|
||||||
select_cols_mgroup: ", mgroup.name AS 工段",
|
select_cols_mgroup: ", mgroup.name AS 工段",
|
||||||
select_cols_material: "",
|
select_cols_material: "",
|
||||||
|
|
@ -180,7 +194,6 @@
|
||||||
};
|
};
|
||||||
//获取echarts数据
|
//获取echarts数据
|
||||||
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
||||||
console.log('获取echarts数据:', res);
|
|
||||||
if (res.data2.ds0) {
|
if (res.data2.ds0) {
|
||||||
let data = res.data2.ds0;
|
let data = res.data2.ds0;
|
||||||
let seriesData = [
|
let seriesData = [
|
||||||
|
|
@ -203,22 +216,48 @@
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
console.log('seriesData:', seriesData);
|
|
||||||
that.option1.series[0].data = seriesData;
|
that.option1.series[0].data = seriesData;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
let obj2 = {
|
let obj2 = {
|
||||||
query: {
|
query: {
|
||||||
start_date: that.start_date, end_date: that.end_date,
|
start_date: that.start_date, end_date: that.end_date,
|
||||||
mgroup_name: that.processName,group_bys_mgroup: ", mgroup.name",
|
mgroup_name: that.mgroupName,group_bys_mgroup: ", mgroup.name",
|
||||||
select_cols_mgroup: ", mgroup.name AS 工段",
|
select_cols_mgroup: ", mgroup.name AS 工段",
|
||||||
is_count_utask: -1
|
is_count_utask: -1
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
//获取table数据
|
//获取table数据
|
||||||
that.$API.bi.dataset.exec.req(exec, obj2).then((res2) => {
|
that.$API.bi.dataset.exec.req(exec, obj2).then((res2) => {
|
||||||
console.log('获取table数据:', res2.data2.ds0);
|
|
||||||
that.tableData = res2.data2.ds0;
|
that.tableData = res2.data2.ds0;
|
||||||
|
let data = res2.data2.ds0;
|
||||||
|
data.forEach((item) => {
|
||||||
|
let date =item.年;
|
||||||
|
if(that.queryType=='月'){
|
||||||
|
date =item.年+'-'+item.月;
|
||||||
|
}
|
||||||
|
if(dateList.indexOf(date)>-1){}else{
|
||||||
|
dateList.push(date);
|
||||||
|
let obj = {};
|
||||||
|
obj.text = date;
|
||||||
|
obj.value = date;
|
||||||
|
that.dateFilters.push(obj);
|
||||||
|
}
|
||||||
|
if(modelList.indexOf(item.型号)>-1){}else{
|
||||||
|
modelList.push(item.型号);
|
||||||
|
let obj2 = {};
|
||||||
|
obj2.text = item.型号;
|
||||||
|
obj2.value = item.型号;
|
||||||
|
that.modelFilters.push(obj2);
|
||||||
|
}
|
||||||
|
if(specsList.indexOf(item.规格)>-1){}else{
|
||||||
|
specsList.push(item.规格);
|
||||||
|
let obj3 = {};
|
||||||
|
obj3.text = item.规格;
|
||||||
|
obj3.value = item.规格;
|
||||||
|
that.specsFilters.push(obj3);
|
||||||
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleQuery(){
|
handleQuery(){
|
||||||
|
|
@ -242,6 +281,47 @@
|
||||||
}
|
}
|
||||||
this.getData();
|
this.getData();
|
||||||
},
|
},
|
||||||
|
getSummaries({ columns, data }) {
|
||||||
|
const sums = [];
|
||||||
|
columns.forEach((column, index) => {
|
||||||
|
if (index === 0) {
|
||||||
|
sums[index] = "合计";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (index == 4) {
|
||||||
|
const values = data.map((item) =>
|
||||||
|
Number(item[column.property])
|
||||||
|
);
|
||||||
|
if (!values.every((value) => Number.isNaN(value))) {
|
||||||
|
sums[index] = values.reduce((prev, curr) => {
|
||||||
|
const value = Number(curr); //Number转换为数值
|
||||||
|
let sum = Number(
|
||||||
|
Number(prev) + Number(curr)
|
||||||
|
).toFixed(2); //toFixed(2)数据项保留两位小数
|
||||||
|
if (!isNaN(value)) {
|
||||||
|
return sum;
|
||||||
|
} else {
|
||||||
|
return prev;
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return sums;
|
||||||
|
},
|
||||||
|
filterDate(value, row) {
|
||||||
|
let date = row.年;
|
||||||
|
if(this.queryType=='月'){
|
||||||
|
date =row.年+'-'+row.月;
|
||||||
|
}
|
||||||
|
return date === value;
|
||||||
|
},
|
||||||
|
filterSpecs(value, row) {
|
||||||
|
return row.规格 === value;
|
||||||
|
},
|
||||||
|
filterModel(value, row) {
|
||||||
|
return row.型号 === value;
|
||||||
|
},
|
||||||
handleExport(val) {
|
handleExport(val) {
|
||||||
this.exportLoading = true;
|
this.exportLoading = true;
|
||||||
let id = '#exportDiv' + val;
|
let id = '#exportDiv' + val;
|
||||||
|
|
|
||||||
|
|
@ -32,56 +32,59 @@
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-main>
|
<el-main>
|
||||||
<scTable
|
<scTable
|
||||||
v-show="params.type == 10 || params.type == 20"
|
v-if="params.type == 10 || params.type == 20"
|
||||||
ref="tables1"
|
ref="tables1"
|
||||||
:data="tableData1"
|
:data="tableData1"
|
||||||
id="exportDiv1"
|
id="exportDiv1"
|
||||||
stripe
|
stripe
|
||||||
hideDo
|
hideDo
|
||||||
hidePagination
|
hidePagination
|
||||||
|
:summary-method="getSummaries" show-summary
|
||||||
>
|
>
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50"/>
|
||||||
<el-table-column label="物料名" prop="material_name" />
|
<el-table-column label="物料名" prop="material_name"
|
||||||
<el-table-column label="型号" prop="material_model" />
|
:filters="nameFilters1"
|
||||||
<el-table-column
|
:filter-method="filterName1"
|
||||||
label="规格"
|
filter-placement="bottom-end"/>
|
||||||
prop="material_specification"
|
<el-table-column label="型号" prop="material_model"
|
||||||
/>
|
:filters="modelFilters1"
|
||||||
<el-table-column prop="dept_name" label="完成车间" />
|
:filter-method="filterModel1"
|
||||||
|
filter-placement="bottom-end"/>
|
||||||
|
<el-table-column label="规格" prop="material_specification"
|
||||||
|
:filters="specsFilters1"
|
||||||
|
:filter-method="filterSpecs1"
|
||||||
|
filter-placement="bottom-end"/>
|
||||||
|
<el-table-column prop="dept_name" label="完成车间"
|
||||||
|
:filters="deptFilters1"
|
||||||
|
:filter-method="filterDept1"
|
||||||
|
filter-placement="bottom-end"/>
|
||||||
<el-table-column label="库存总数" prop="count" />
|
<el-table-column label="库存总数" prop="count" />
|
||||||
</scTable>
|
</scTable>
|
||||||
<scTable
|
<scTable
|
||||||
v-show="
|
v-else
|
||||||
params.type == 30 ||
|
ref="tables11"
|
||||||
params.type == 40 ||
|
:data="tableData11"
|
||||||
params.type == 50 ||
|
id="exportDiv11"
|
||||||
params.type == 60 ||
|
|
||||||
params.type == 70
|
|
||||||
"
|
|
||||||
ref="tables1"
|
|
||||||
:apiObj="apiObj"
|
|
||||||
:params="params"
|
|
||||||
id="exportDiv1"
|
|
||||||
stripe
|
stripe
|
||||||
hideDo
|
hideDo
|
||||||
|
:summary-method="getSummaries2"
|
||||||
|
show-summary
|
||||||
>
|
>
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50" />
|
||||||
<el-table-column
|
<el-table-column label="物料名" prop="name"
|
||||||
label="物料名"
|
:filters="nameFilters11"
|
||||||
prop="name"
|
:filter-method="filterName11"
|
||||||
></el-table-column>
|
filter-placement="bottom-end"/>
|
||||||
<el-table-column label="型号" prop="model">
|
<el-table-column label="型号" prop="model"
|
||||||
</el-table-column>
|
:filters="modelFilters11"
|
||||||
<el-table-column label="规格" prop="specification">
|
:filter-method="filterModel11"
|
||||||
</el-table-column>
|
filter-placement="bottom-end"/>
|
||||||
<el-table-column
|
<el-table-column label="规格" prop="specification"
|
||||||
label="库存总数"
|
:filters="specsFilters11"
|
||||||
prop="count_mb"
|
:filter-method="filterSpecs11"
|
||||||
></el-table-column>
|
filter-placement="bottom-end"/>
|
||||||
<el-table-column
|
<el-table-column label="库存总数" prop="count_mb"/>
|
||||||
label="周预估值"
|
<el-table-column label="周预估值" v-if="params.type == 30">
|
||||||
v-if="params.type == 30"
|
|
||||||
>
|
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="scope.row.week_esitimate_consume"
|
v-model="scope.row.week_esitimate_consume"
|
||||||
|
|
@ -89,24 +92,10 @@
|
||||||
></el-input>
|
></el-input>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column label="可用天数" v-if="params.type == 30">
|
||||||
label="可用天数"
|
|
||||||
v-if="params.type == 30"
|
|
||||||
>
|
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span
|
<span v-if="scope.row.week_esitimate_consume &&scope.row.week_esitimate_consume !==null">
|
||||||
v-if="
|
{{Math.floor(scope.row.count_mb /scope.row.week_esitimate_consume) * 7}}
|
||||||
scope.row.week_esitimate_consume &&
|
|
||||||
scope.row.week_esitimate_consume !==
|
|
||||||
null
|
|
||||||
"
|
|
||||||
>
|
|
||||||
{{
|
|
||||||
Math.floor(
|
|
||||||
scope.row.count_mb /
|
|
||||||
scope.row.week_esitimate_consume
|
|
||||||
) * 7
|
|
||||||
}}
|
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
@ -169,9 +158,7 @@
|
||||||
icon="el-icon-search"
|
icon="el-icon-search"
|
||||||
@click="handleQuery"
|
@click="handleQuery"
|
||||||
></el-button>
|
></el-button>
|
||||||
<el-button @click="handleExport('2')" type="primary"
|
<el-button @click="handleExport('2')" type="primary">导出</el-button>
|
||||||
>导出</el-button
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-main>
|
<el-main>
|
||||||
|
|
@ -182,71 +169,44 @@
|
||||||
stripe
|
stripe
|
||||||
hideDo
|
hideDo
|
||||||
hidePagination
|
hidePagination
|
||||||
|
:summary-method="getSummaries"
|
||||||
|
show-summary
|
||||||
>
|
>
|
||||||
<el-table-column
|
<el-table-column label="物料名" prop="物料名"
|
||||||
label="物料名"
|
:filters="nameFilters2"
|
||||||
prop="物料名"
|
:filter-method="filterName2"
|
||||||
|
filter-placement="bottom-end">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="型号" prop="型号"
|
||||||
|
:filters="modelFilters2"
|
||||||
|
:filter-method="filterModel2"
|
||||||
|
filter-placement="bottom-end"
|
||||||
></el-table-column>
|
></el-table-column>
|
||||||
<el-table-column
|
<el-table-column label="规格" prop="规格"
|
||||||
label="型号"
|
:filters="specsFilters2"
|
||||||
prop="型号"
|
:filter-method="filterSpecs2"
|
||||||
></el-table-column>
|
filter-placement="bottom-end"
|
||||||
<el-table-column
|
|
||||||
label="规格"
|
|
||||||
prop="规格"
|
|
||||||
></el-table-column>
|
></el-table-column>
|
||||||
<el-table-column label="出入库类型">
|
<el-table-column label="出入库类型">
|
||||||
<span>{{ mio_type_name }}</span>
|
<span>{{ mio_type_name }}</span>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<template
|
<el-table-column label="执行车间" prop="执行车间"
|
||||||
v-if="
|
:filters="deptFilters2"
|
||||||
queryType == '月' &&
|
:filter-method="filterDept2"
|
||||||
(query.mio_type == 'pur_in' ||
|
filter-placement="bottom-end">
|
||||||
query.mio_type == 'do_in' ||
|
</el-table-column>
|
||||||
query.mio_type == 'other_in')
|
<template v-if="queryType == '月' &&(query.mio_type == 'pur_in' ||query.mio_type == 'do_in' ||query.mio_type == 'other_in')">
|
||||||
"
|
<el-table-column label="月入库总数" prop="数量"></el-table-column>
|
||||||
>
|
|
||||||
<el-table-column
|
|
||||||
label="月入库总数"
|
|
||||||
prop="数量"
|
|
||||||
></el-table-column>
|
|
||||||
</template>
|
</template>
|
||||||
<template
|
<template v-if="queryType == '月' &&(query.mio_type == 'do_out' ||query.mio_type == 'sale_out' ||query.mio_type == 'other_out')">
|
||||||
v-if="
|
|
||||||
queryType == '月' &&
|
|
||||||
(query.mio_type == 'do_out' ||
|
|
||||||
query.mio_type == 'sale_out' ||
|
|
||||||
query.mio_type == 'other_out')
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<el-table-column label="月出库数量" prop="数量">
|
<el-table-column label="月出库数量" prop="数量">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</template>
|
</template>
|
||||||
<template
|
<template v-if="queryType == '年' &&(query.mio_type == 'pur_in' ||query.mio_type == 'do_in' ||query.mio_type == 'other_in')">
|
||||||
v-if="
|
<el-table-column label="年入库总数" prop="数量"></el-table-column>
|
||||||
queryType == '年' &&
|
|
||||||
(query.mio_type == 'pur_in' ||
|
|
||||||
query.mio_type == 'do_in' ||
|
|
||||||
query.mio_type == 'other_in')
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<el-table-column
|
|
||||||
label="年入库总数"
|
|
||||||
prop="数量"
|
|
||||||
></el-table-column>
|
|
||||||
</template>
|
</template>
|
||||||
<template
|
<template v-if="queryType == '年' &&(query.mio_type == 'do_out'||query.mio_type == 'sale_out'||query.mio_type == 'other_out')">
|
||||||
v-if="
|
<el-table-column label="年出库总数" prop="数量"></el-table-column>
|
||||||
queryType == '年' &&
|
|
||||||
(query.mio_type == 'do_out' ||
|
|
||||||
query.mio_type == 'sale_out' ||
|
|
||||||
query.mio_type == 'other_out')
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<el-table-column
|
|
||||||
label="年出库总数"
|
|
||||||
prop="数量"
|
|
||||||
></el-table-column>
|
|
||||||
</template>
|
</template>
|
||||||
</scTable>
|
</scTable>
|
||||||
</el-main>
|
</el-main>
|
||||||
|
|
@ -280,6 +240,18 @@ export default {
|
||||||
currentLastDay: "",
|
currentLastDay: "",
|
||||||
tableData: [],
|
tableData: [],
|
||||||
tableData1: [],
|
tableData1: [],
|
||||||
|
tableData11: [],
|
||||||
|
nameFilters1: [],
|
||||||
|
deptFilters1: [],
|
||||||
|
modelFilters1: [],
|
||||||
|
specsFilters1: [],
|
||||||
|
nameFilters11: [],
|
||||||
|
modelFilters11: [],
|
||||||
|
specsFilters11: [],
|
||||||
|
nameFilters2: [],
|
||||||
|
deptFilters2: [],
|
||||||
|
modelFilters2: [],
|
||||||
|
specsFilters2: [],
|
||||||
typeOptions: ["月", "年"],
|
typeOptions: ["月", "年"],
|
||||||
materialTypeOptions: [
|
materialTypeOptions: [
|
||||||
{ id: 10, name: "成品" },
|
{ id: 10, name: "成品" },
|
||||||
|
|
@ -301,51 +273,125 @@ export default {
|
||||||
that.currentLastDay = lastDay;
|
that.currentLastDay = lastDay;
|
||||||
that.queryDate = that.currentYear + "-" + that.currentMonth;
|
that.queryDate = that.currentYear + "-" + that.currentMonth;
|
||||||
that.start_date = that.currentYear + "-" + that.currentMonth + "-01";
|
that.start_date = that.currentYear + "-" + that.currentMonth + "-01";
|
||||||
that.end_date =
|
that.end_date = that.currentYear + "-" + that.currentMonth + "-" + lastDay;
|
||||||
that.currentYear + "-" + that.currentMonth + "-" + lastDay;
|
|
||||||
that.getTableData();
|
that.getTableData();
|
||||||
console.log(that.mio_type_name);
|
that.getTableData1();
|
||||||
this.materialTypeChange();
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
queryTypeChnge() {
|
queryTypeChnge() {
|
||||||
this.query.queryDate = "";
|
this.query.queryDate = "";
|
||||||
},
|
},
|
||||||
materialTypeChange() {
|
getTableData1() {
|
||||||
let that = this;
|
let that = this;
|
||||||
that.tableData1 = [];
|
that.tableData1 = [];
|
||||||
if (that.params.type == 10 || that.params.type == 20) {
|
that.nameFilters1 = [];
|
||||||
let obj = {
|
that.deptFilters1 = [];
|
||||||
query: {
|
that.modelFilters1 = [];
|
||||||
material_types: that.params.type,
|
that.specsFilters1 = [];
|
||||||
},
|
let nameList=[],deptList = [],specsList=[],modelList=[];
|
||||||
};
|
let obj = {
|
||||||
that.$API.bi.dataset.exec
|
query: {
|
||||||
.req("materialCount", obj)
|
material_types: that.params.type,
|
||||||
.then((res) => {
|
},
|
||||||
if (res.data2.ds0) {
|
};
|
||||||
that.tableData1 = res.data2.ds0;
|
that.$API.bi.dataset.exec.req("materialCount", obj).then((res) => {
|
||||||
|
if (res.data2.ds0) {
|
||||||
|
let data = res.data2.ds0;
|
||||||
|
that.tableData1 = data;
|
||||||
|
if(data.length>0){
|
||||||
|
data.forEach((ite) => {
|
||||||
|
if (nameList.indexOf(ite.material_name) > -1) {} else {
|
||||||
|
nameList.push(ite.material_name);
|
||||||
|
let obj = {};
|
||||||
|
obj.text = ite.material_name;
|
||||||
|
obj.value = ite.material_name;
|
||||||
|
that.nameFilters1.push(obj);
|
||||||
|
}
|
||||||
|
if(modelList.indexOf(ite.material_model)>-1){}else{
|
||||||
|
modelList.push(ite.material_model);
|
||||||
|
let obj2 = {};
|
||||||
|
obj2.text = ite.material_model;
|
||||||
|
obj2.value = ite.material_model;
|
||||||
|
that.modelFilters1.push(obj2);
|
||||||
|
}
|
||||||
|
if(specsList.indexOf(ite.material_specification)>-1){}else{
|
||||||
|
specsList.push(ite.material_specification);
|
||||||
|
let obj3 = {};
|
||||||
|
obj3.text = ite.material_specificationv;
|
||||||
|
obj3.value = ite.material_specification;
|
||||||
|
that.specsFilters1.push(obj3);
|
||||||
|
}
|
||||||
|
if(deptList.indexOf(ite.dept_name)>-1){}else{
|
||||||
|
deptList.push(ite.dept_name);
|
||||||
|
let obj4 = {};
|
||||||
|
obj4.text = ite.dept_name;
|
||||||
|
obj4.value = ite.dept_name;
|
||||||
|
that.deptFilters1.push(obj4);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getTableData11(){
|
||||||
|
let that = this;
|
||||||
|
that.tableData11 = [];
|
||||||
|
that.nameFilters11 = [];
|
||||||
|
that.modelFilters11 = [];
|
||||||
|
that.specsFilters11 = [];
|
||||||
|
let nameList=[],specsList=[],modelList=[];
|
||||||
|
this.$API.mtm.material.list.req(that.params).then((res) => {
|
||||||
|
that.tableData11 = res.results;
|
||||||
|
if(res.results.length>0){
|
||||||
|
res.results.forEach((ite) =>{
|
||||||
|
if (nameList.indexOf(ite.name) > -1) {} else {
|
||||||
|
nameList.push(ite.name);
|
||||||
|
let obj = {};
|
||||||
|
obj.text = ite.name;
|
||||||
|
obj.value = ite.name;
|
||||||
|
that.nameFilters11.push(obj);
|
||||||
|
}
|
||||||
|
if(modelList.indexOf(ite.model)>-1){}else{
|
||||||
|
modelList.push(ite.model);
|
||||||
|
let obj2 = {};
|
||||||
|
obj2.text = ite.model;
|
||||||
|
obj2.value = ite.model;
|
||||||
|
that.modelFilters11.push(obj2);
|
||||||
|
}
|
||||||
|
if(specsList.indexOf(ite.specification)>-1){}else{
|
||||||
|
specsList.push(ite.specification);
|
||||||
|
let obj3 = {};
|
||||||
|
obj3.text = ite.specification;
|
||||||
|
obj3.value = ite.specification;
|
||||||
|
that.specsFilters11.push(obj3);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
}
|
||||||
that.$refs.tables1.refresh();
|
});
|
||||||
|
},
|
||||||
|
materialTypeChange(){
|
||||||
|
let that = this;
|
||||||
|
if(that.params.type == 10 || that.params.type == 20){
|
||||||
|
that.getTableData1();
|
||||||
|
}else{
|
||||||
|
that.getTableData11();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//更改周预估用量
|
//更改周预估用量
|
||||||
weekcountChange(row) {
|
weekcountChange(row) {
|
||||||
let obj = {
|
let obj = {week_esitimate_consume: row.week_esitimate_consume};
|
||||||
week_esitimate_consume: row.week_esitimate_consume,
|
this.$API.mtm.material.setWeekConsume.req(row.id, obj).then((res) => {
|
||||||
};
|
this.$refs.tables1.refresh();
|
||||||
this.$API.mtm.material.setWeekConsume
|
});
|
||||||
.req(row.id, obj)
|
|
||||||
.then((res) => {
|
|
||||||
console.log(res);
|
|
||||||
this.$refs.tables1.refresh();
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
//获取表格数据
|
//获取表格数据
|
||||||
getTableData() {
|
getTableData() {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
that.nameFilters2 = [];
|
||||||
|
that.deptFilters2 = [];
|
||||||
|
that.modelFilters2 = [];
|
||||||
|
that.specsFilters2 = [];
|
||||||
|
let nameList=[],deptList = [],specsList=[],modelList=[];
|
||||||
let exec = that.queryType == "月" ? "saleOutMonth" : "saleOutYear";
|
let exec = that.queryType == "月" ? "saleOutMonth" : "saleOutYear";
|
||||||
let obj = {
|
let obj = {
|
||||||
query: {
|
query: {
|
||||||
|
|
@ -358,6 +404,38 @@ export default {
|
||||||
if (res.data2.ds0) {
|
if (res.data2.ds0) {
|
||||||
let data = res.data2.ds0;
|
let data = res.data2.ds0;
|
||||||
that.tableData = data;
|
that.tableData = data;
|
||||||
|
if(data.length>0){
|
||||||
|
data.forEach((ite) => {
|
||||||
|
if (nameList.indexOf(ite.物料名) > -1) {} else {
|
||||||
|
nameList.push(ite.物料名);
|
||||||
|
let obj = {};
|
||||||
|
obj.text = ite.物料名;
|
||||||
|
obj.value = ite.物料名;
|
||||||
|
that.nameFilters2.push(obj);
|
||||||
|
}
|
||||||
|
if(modelList.indexOf(ite.型号)>-1){}else{
|
||||||
|
modelList.push(ite.型号);
|
||||||
|
let obj2 = {};
|
||||||
|
obj2.text = ite.型号;
|
||||||
|
obj2.value = ite.型号;
|
||||||
|
that.modelFilters2.push(obj2);
|
||||||
|
}
|
||||||
|
if(specsList.indexOf(ite.规格)>-1){}else{
|
||||||
|
specsList.push(ite.规格);
|
||||||
|
let obj3 = {};
|
||||||
|
obj3.text = ite.规格;
|
||||||
|
obj3.value = ite.规格;
|
||||||
|
that.specsFilters2.push(obj3);
|
||||||
|
}
|
||||||
|
if(deptList.indexOf(ite.执行车间)>-1){}else{
|
||||||
|
deptList.push(ite.执行车间);
|
||||||
|
let obj4 = {};
|
||||||
|
obj4.text = ite.执行车间;
|
||||||
|
obj4.value = ite.执行车间;
|
||||||
|
that.deptFilters2.push(obj4);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -367,7 +445,6 @@ export default {
|
||||||
this.mio_type_name = this.mioTypeEnum.values[key].text;
|
this.mio_type_name = this.mioTypeEnum.values[key].text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(this.mio_type_name);
|
|
||||||
this.getTableData();
|
this.getTableData();
|
||||||
},
|
},
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
|
|
@ -401,6 +478,92 @@ export default {
|
||||||
}
|
}
|
||||||
this.getTableData();
|
this.getTableData();
|
||||||
},
|
},
|
||||||
|
getSummaries({ columns, data }) {
|
||||||
|
const sums = [];
|
||||||
|
columns.forEach((column, index) => {
|
||||||
|
if (index === 0) {
|
||||||
|
sums[index] = "合计";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (index == 5) {
|
||||||
|
const values = data.map((item) =>
|
||||||
|
Number(item[column.property])
|
||||||
|
);
|
||||||
|
if (!values.every((value) => Number.isNaN(value))) {
|
||||||
|
sums[index] = values.reduce((prev, curr) => {
|
||||||
|
const value = Number(curr);
|
||||||
|
let sum = Number(Number(prev) + Number(curr)).toFixed(2);
|
||||||
|
if (!isNaN(value)) {
|
||||||
|
return sum;
|
||||||
|
} else {
|
||||||
|
return prev;
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return sums;
|
||||||
|
},
|
||||||
|
getSummaries2({ columns, data }) {
|
||||||
|
const sums = [];
|
||||||
|
columns.forEach((column, index) => {
|
||||||
|
if (index === 0) {
|
||||||
|
sums[index] = "合计";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (index == 4) {
|
||||||
|
const values = data.map((item) =>
|
||||||
|
Number(item[column.property])
|
||||||
|
);
|
||||||
|
if (!values.every((value) => Number.isNaN(value))) {
|
||||||
|
sums[index] = values.reduce((prev, curr) => {
|
||||||
|
const value = Number(curr);
|
||||||
|
let sum = Number(Number(prev) + Number(curr)).toFixed(2);
|
||||||
|
if (!isNaN(value)) {
|
||||||
|
return sum;
|
||||||
|
} else {
|
||||||
|
return prev;
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return sums;
|
||||||
|
},
|
||||||
|
|
||||||
|
filterName1(value, row) {
|
||||||
|
return row.物料名 == value;
|
||||||
|
},
|
||||||
|
filterSpecs1(value, row) {
|
||||||
|
return row.规格 == value;
|
||||||
|
},
|
||||||
|
filterModel1(value, row) {
|
||||||
|
return row.型号 == value;
|
||||||
|
},
|
||||||
|
filterDept1(value, row) {
|
||||||
|
return row.完成车间 == value;
|
||||||
|
},
|
||||||
|
filterName11(value, row) {
|
||||||
|
return row.物料名 == value;
|
||||||
|
},
|
||||||
|
filterSpecs11(value, row) {
|
||||||
|
return row.规格 == value;
|
||||||
|
},
|
||||||
|
filterModel11(value, row) {
|
||||||
|
return row.型号 == value;
|
||||||
|
},
|
||||||
|
filterName2(value, row) {
|
||||||
|
return row.物料名 == value;
|
||||||
|
},
|
||||||
|
filterSpecs2(value, row) {
|
||||||
|
return row.规格 == value;
|
||||||
|
},
|
||||||
|
filterModel2(value, row) {
|
||||||
|
return row.型号 == value;
|
||||||
|
},
|
||||||
|
filterDept2(value, row) {
|
||||||
|
return row.执行车间 == value;
|
||||||
|
},
|
||||||
handleExport(val) {
|
handleExport(val) {
|
||||||
this.exportLoading = true;
|
this.exportLoading = true;
|
||||||
let id = "#exportDiv" + val;
|
let id = "#exportDiv" + val;
|
||||||
|
|
|
||||||
|
|
@ -55,16 +55,24 @@
|
||||||
id="exportDiv"
|
id="exportDiv"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
:height="chartHeight"
|
:height="chartHeight"
|
||||||
|
:summary-method="getSummaries"
|
||||||
|
show-summary
|
||||||
>
|
>
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50" />
|
||||||
<el-table-column label="日期" prop="date">
|
<el-table-column label="日期" prop="date" width="90">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
{{ scope.row.年 }}-{{ scope.row.月 }}
|
{{ scope.row.年 }}-{{ scope.row.月 }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作人" prop="操作人">
|
<el-table-column label="操作人" prop="操作人" width="90"
|
||||||
|
:filters="userFilters"
|
||||||
|
:filter-method="filterUser"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="工段" prop="工段">
|
<el-table-column label="工段" prop="工段" width="80"
|
||||||
|
:filters="mgroupFilters"
|
||||||
|
:filter-method="filterMgroup"
|
||||||
|
filter-placement="bottom-end">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="车间">
|
<el-table-column label="车间">
|
||||||
{{ queryBelongDept }}
|
{{ queryBelongDept }}
|
||||||
|
|
@ -105,6 +113,9 @@ export default {
|
||||||
currentMonth: "",
|
currentMonth: "",
|
||||||
deptData: [],
|
deptData: [],
|
||||||
tableData: [],
|
tableData: [],
|
||||||
|
dateFilters:[],
|
||||||
|
userFilters:[],
|
||||||
|
mgroupFilters:[],
|
||||||
option: {
|
option: {
|
||||||
title: {
|
title: {
|
||||||
text: "人员统计",
|
text: "人员统计",
|
||||||
|
|
@ -144,28 +155,30 @@ export default {
|
||||||
this.currentYear = year;
|
this.currentYear = year;
|
||||||
this.currentMonth = month;
|
this.currentMonth = month;
|
||||||
this.start_date = year + "-" + month + "-01";
|
this.start_date = year + "-" + month + "-01";
|
||||||
this.end_date =
|
this.end_date =year + "-" + month + "-" + days;
|
||||||
year + "-" + month + "-" + new Date(year, month, 0).getDate();
|
month = month < 10 ? "0" + month : month;
|
||||||
this.queryDate = year + "-" + month;
|
this.queryDate = year + "-" + month;
|
||||||
this.getData();
|
|
||||||
this.getDept();
|
this.getDept();
|
||||||
let mainHeight = document.getElementById("elMain").clientHeight;
|
let mainHeight = document.getElementById("elMain").clientHeight;
|
||||||
this.chartHeight = mainHeight - 40 + "px";
|
this.chartHeight = mainHeight - 40 + "px";
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getDept() {
|
getDept() {
|
||||||
this.$API.system.dept.list
|
let that = this;
|
||||||
.req({ page: 0, type: "dept" })
|
this.$API.system.dept.list.req({ page: 0, type: "dept" }).then((res) => {
|
||||||
.then((res) => {
|
that.deptData = res;
|
||||||
this.deptData = res;
|
that.queryBelongDept = res[0].name;
|
||||||
this.queryBelongDept = res[0].name;
|
that.getData();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
queryTypeChange(value) {
|
queryTypeChange(value) {
|
||||||
this.queryDate = "";
|
this.queryDate = "";
|
||||||
},
|
},
|
||||||
getData() {
|
getData() {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
that.userFilters = [];
|
||||||
|
that.mgroupFilters = [];
|
||||||
|
let userList=[],mgroupList=[];
|
||||||
let obj = {
|
let obj = {
|
||||||
query: {
|
query: {
|
||||||
start_date: this.start_date,
|
start_date: this.start_date,
|
||||||
|
|
@ -174,17 +187,27 @@ export default {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
that.$API.bi.dataset.exec.req("performance", obj).then((res) => {
|
that.$API.bi.dataset.exec.req("performance", obj).then((res) => {
|
||||||
console.log("绩效统计:", res);
|
|
||||||
let data = res.data2.ds0;
|
let data = res.data2.ds0;
|
||||||
let seriesData = [],
|
let seriesData = [],
|
||||||
yAxisData = [];
|
yAxisData = [];
|
||||||
data.forEach((item) => {
|
data.forEach((item) => {
|
||||||
seriesData.push(item.合格数);
|
seriesData.push(item.合格数);
|
||||||
yAxisData.push(item.操作人 + "∙" + item.工段);
|
yAxisData.push(item.操作人 + "∙" + item.工段);
|
||||||
|
if(userList.indexOf(item.操作人)>-1){}else{
|
||||||
|
userList.push(item.操作人);
|
||||||
|
let obj2 = {};
|
||||||
|
obj2.text = item.操作人;
|
||||||
|
obj2.value = item.操作人;
|
||||||
|
that.userFilters.push(obj2);
|
||||||
|
}
|
||||||
|
if(mgroupList.indexOf(item.工段)>-1){}else{
|
||||||
|
mgroupList.push(item.工段);
|
||||||
|
let obj3 = {};
|
||||||
|
obj3.text = item.工段;
|
||||||
|
obj3.value = item.工段;
|
||||||
|
that.mgroupFilters.push(obj3);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
console.log(yAxisData);
|
|
||||||
console.log(seriesData);
|
|
||||||
console.log(data);
|
|
||||||
that.tableData = data;
|
that.tableData = data;
|
||||||
that.option.yAxis.data = yAxisData;
|
that.option.yAxis.data = yAxisData;
|
||||||
that.option.series.data = seriesData;
|
that.option.series.data = seriesData;
|
||||||
|
|
@ -211,6 +234,40 @@ export default {
|
||||||
console.log("查询query", this.start_date, this.end_date);
|
console.log("查询query", this.start_date, this.end_date);
|
||||||
this.getData();
|
this.getData();
|
||||||
},
|
},
|
||||||
|
getSummaries({ columns, data }) {
|
||||||
|
const sums = [];
|
||||||
|
columns.forEach((column, index) => {
|
||||||
|
if (index === 0) {
|
||||||
|
sums[index] = "合计";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (index == 5||index == 6||index == 7) {
|
||||||
|
const values = data.map((item) =>
|
||||||
|
Number(item[column.property])
|
||||||
|
);
|
||||||
|
if (!values.every((value) => Number.isNaN(value))) {
|
||||||
|
sums[index] = values.reduce((prev, curr) => {
|
||||||
|
const value = Number(curr); //Number转换为数值
|
||||||
|
let sum = Number(
|
||||||
|
Number(prev) + Number(curr)
|
||||||
|
).toFixed(2); //toFixed(2)数据项保留两位小数
|
||||||
|
if (!isNaN(value)) {
|
||||||
|
return sum;
|
||||||
|
} else {
|
||||||
|
return prev;
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return sums;
|
||||||
|
},
|
||||||
|
filterUser(value, row) {
|
||||||
|
return row.操作人 === value;
|
||||||
|
},
|
||||||
|
filterMgroup(value, row) {
|
||||||
|
return row.工段 === value;
|
||||||
|
},
|
||||||
handleExport() {
|
handleExport() {
|
||||||
this.exportLoading = true;
|
this.exportLoading = true;
|
||||||
this.$XLSX("#exportDiv", "人员统计");
|
this.$XLSX("#exportDiv", "人员统计");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue