fix:光子统计导出页面

This commit is contained in:
shijing 2025-05-14 15:09:02 +08:00
parent 84a6f8c41b
commit 304add9061
12 changed files with 2914 additions and 129 deletions

View File

@ -3674,7 +3674,7 @@ const routes = [
meta: { meta: {
title: "统计导出", title: "统计导出",
icon: "el-icon-DataAnalysis", icon: "el-icon-DataAnalysis",
perms: ["statistic_total"], perms: ["total_export"],
}, },
component: "statistics/all.vue", component: "statistics/all.vue",
}, },

View File

@ -7,75 +7,134 @@
value-format="YYYY-MM" style="width:200px"> value-format="YYYY-MM" style="width:200px">
</el-date-picker> </el-date-picker>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button> <el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
<el-button type="primary" @click="downloadPDF">导出</el-button>
</div> </div>
</el-header> </el-header>
<el-main id="elMain" class="nopadding" style="width: 1024px;"> <el-main id="elMain" class="nopadding">
<div id="bachart1" style="width:100%;height:300px;"></div> <div id="content">
<el-table :data="dataList" id="exportDiv1"> <!-- 混料统计 -->
<el-table-column type="index" width="50" /> <hunliao
<el-table-column label="物料名" prop="物料名"> class="contentItem"
</el-table-column> :firstWeekNum="firstWeekNum"
<el-table-column label="月份" prop="月" v-if="queryType == '年'"> :endWeekNum="endWeekNum"
</el-table-column> :start_date="start_date"
<el-table-column label="周" prop="周" v-else> :end_date="end_date"
</el-table-column> :queryDate="queryDate"
<el-table-column label="规格" prop="规格"> :queryType="queryType"
</el-table-column> :xAxisData="xAxisData"
<el-table-column label="型号" prop="型号"> ></hunliao>
</el-table-column> <!-- 合格数统计 -->
<el-table-column label="桶数" prop="合格数"> <pass_num
</el-table-column> class="contentItem"
<el-table-column label="总重量" prop="总重量"> :firstWeekNum="firstWeekNum"
</el-table-column> :endWeekNum="endWeekNum"
</el-table> :start_date="start_date"
:end_date="end_date"
:queryDate="queryDate"
:queryType="queryType"
:xAxisData="xAxisData"
></pass_num>
<!-- 任务进度 -->
<task_rate
class="contentItem"
:start_date="start_date"
:end_date="end_date"
:queryDate="queryDate"
:queryType="queryType"
></task_rate>
<!-- 工序合格数 -->
<ppass_num
class="contentItem"
:start_date="start_date"
:end_date="end_date"
:queryDate="queryDate"
:queryType="queryType"
></ppass_num>
<product_check
class="contentItem"
:start_date="start_date"
:end_date="end_date"
:queryDate="queryDate"
:queryType="queryType"
></product_check>
<product_check2
class="contentItem"
:start_date="start_date"
:end_date="end_date"
:queryDate="queryDate"
:queryType="queryType"
></product_check2>
<material_statistics
class="contentItem"
:start_date="start_date"
:end_date="end_date"
:queryDate="queryDate"
:queryType="queryType"
></material_statistics>
<user_statistics
class="contentItem"
:start_date="start_date"
:end_date="end_date"
:queryDate="queryDate"
:queryType="queryType"
></user_statistics>
<inm_statistics
class="contentItem"
:start_date="start_date"
:end_date="end_date"
:queryDate="queryDate"
:queryType="queryType"
></inm_statistics>
<stock_statistics
class="contentItem"
:start_date="start_date"
:end_date="end_date"
:queryDate="queryDate"
:queryType="queryType"
></stock_statistics>
</div>
</el-main> </el-main>
</el-container> </el-container>
</template> </template>
<script> <script>
import * as echarts from "echarts"; import getPdf from "@/utils/htmlToPdf";
import T from '@/components/scEcharts/echarts-theme-T.js'; import PdfLoader from '@/utils/html2pdf';
echarts.registerTheme('T', T); import hunliao from "./all_sc_hl.vue";//-
function deepCopy(obj) { import pass_num from "./all_sc_hg.vue";//-
return JSON.parse(JSON.stringify(obj)); import task_rate from "./all_sc_rw.vue";//-
} import ppass_num from "./all_sc_gx.vue";//-
import product_check from "./all_jy_sc.vue";//-
import product_check2 from "./all_jy_cjg.vue";//-()
import material_statistics from "./all_cg.vue";//
import user_statistics from "./all_jx.vue";//
import inm_statistics from "./all_xs.vue";//
import stock_statistics from "./all_kc.vue";//
export default { export default {
name: "bx", name: "all",
components: {
hunliao,
pass_num,
task_rate,
ppass_num,
product_check,
product_check2,
material_statistics,
user_statistics,
inm_statistics,
stock_statistics},
data() { data() {
return { return {
queryType:'月',
queryDate: '', queryDate: '',
mgroups:[], start_date: '',
dataList: [], end_date: '',
xAxisData:[], xAxisData:[],
xAxisOrigin:[], xAxisOrigin:[],
firstWeekNum: 1, firstWeekNum: 1,
endWeekNum: 4, endWeekNum: 4,
basicOption: { currentfirstWeekNum: 1,
backgroundColor: 'transparent', currentendWeekNum: 4,
title: { pdfDownLoader:null
text: '',
},
grid: {
top: '80px'
},
tooltip: {
trigger: 'axis'
},
xAxis: {
type: 'category',
data: []
},
yAxis: {
type: 'value'
},
lenged: [],
series: [{
data: [0, 0, 0, 0, 0, 0, 0],
stack: 'Ad',
type: 'bar',
barWidth: '15px',
}]
},
}; };
}, },
mounted() { mounted() {
@ -86,8 +145,8 @@ 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.firstWeekNum = that.currentfirstWeekNum = that.getWeekOfYear(year,month,1);
that.endWeekNum = that.getWeekOfYear(year,month,days); that.endWeekNum = that.currentendWeekNum = that.getWeekOfYear(year,month,days);
month = month < 10 ? '0' + month : month; month = month < 10 ? '0' + month : month;
that.start_date = year + '-' + month + '-01'; that.start_date = year + '-' + month + '-01';
that.end_date = year + '-' + month + '-' + days; that.end_date = year + '-' + month + '-' + days;
@ -97,7 +156,8 @@ export default {
that.xAxisOrigin.push('第' + i + '周'); that.xAxisOrigin.push('第' + i + '周');
} }
that.xAxisData = that.xAxisOrigin; that.xAxisData = that.xAxisOrigin;
that.getDataHL();// const content = document.getElementById('content')
this.pdfDownLoader = new PdfLoader(content, '光子科技生产管理系统月度报告') // exportTables -->class
}, },
methods: { methods: {
getWeekOfYear(a,b,c) { getWeekOfYear(a,b,c) {
@ -108,94 +168,74 @@ export default {
// d + 7   // d + 7  
return Math.ceil((d + (date2.getDay() + 1 - 1)) / 7); return Math.ceil((d + (date2.getDay() + 1 - 1)) / 7);
}, },
setChart(name, option = null) { downloadPDF() {
// name , optionoption this.$PRINT('#content');
var myChart = echarts.getInstanceByDom(document.getElementById(name)); this.pdfDownLoader.outPutPdfFn('光子科技生产管理系统月度报告')
if (myChart == undefined) {
myChart = echarts.init(document.getElementById(name), 'T');
}
if (option == null) {
option = Object.assign({}, this.basicOption)
}
setTimeout(() => {
try {
myChart.setOption(option);
} catch (error) { }
}, 500)
}, },
handleQuery() { handleQuery() {
if (that.queryDate !== '' && that.queryDate !== null) { let that = this;
let arr = that.queryDate.split('-'); if (that.queryDate !== "" && that.queryDate !== null) {
let arr = that.queryDate.split("-");
let year = arr[0]; let year = arr[0];
let month = arr[1]; let month = arr[1];
let days = new Date(year, month, 0).getDate(); let days = new Date(year, month, 0).getDate();
that.start_date = that.queryDate + '-01'; that.start_date = that.queryDate + "-01";
that.end_date = that.queryDate + '-' + days; that.end_date =that.queryDate +"-" +days;
that.firstWeekNum = that.getWeekOfYear(year,month,1); that.firstWeekNum = that.getWeekOfYear(year,month,1);
that.endWeekNum = that.getWeekOfYear(year,month,days); that.endWeekNum = that.getWeekOfYear(year,month,days);
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++) {
xAxisData.push('第' + i + '周'); xAxisData.push("第" + i + "周");
} }
that.xAxisData = xAxisData; that.xAxisData = xAxisData;
} else { } else {
that.start_date = that.currentYear + '-' + that.currentMonth + '-01'; that.start_date =that.currentYear + "-" + that.currentMonth + "-01";
that.end_date = that.currentYear + '-' + that.currentMonth + '-' + new Date(that.currentYear, that.currentMonth, 0).getDate(); that.end_date =that.currentYear +"-" +that.currentMonth +"-" +new Date(that.currentYear,that.currentMonth,0).getDate();
that.firstWeekNum = that.getWeekOfYear(that.currentYear,that.currentMonth,1); that.firstWeekNum = that.getWeekOfYear(that.currentYear,that.currentMonth,1);
that.xAxisData = that.xAxisOrigin; that.xAxisData = that.xAxisOrigin;
} }
// if (that.queryType == "") {
// if (that.queryDate !== "" && that.queryDate !== null) {
// let arr = that.queryDate.split("-");
// let year = arr[0];
// let month = arr[1];
// let days = new Date(year, month, 0).getDate();
// that.start_date = that.queryDate + "-01";
// 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 = [];
// for (let i = 1; i <= duration; i++) {
// xAxisData.push("" + i + "");
// }
// that.xAxisData = xAxisData;
// } else {
// that.start_date =that.currentYear + "-" + that.currentMonth + "-01";
// that.end_date =that.currentYear +"-" +that.currentMonth +"-" +new Date(that.currentYear,that.currentMonth,0).getDate();
// that.firstWeekNum = that.getWeekOfYear(that.currentYear,that.currentMonth,1);;
// that.xAxisData = that.xAxisOrigin;
// }
// } else {
// if (that.queryDate !== "" && that.queryDate !== null) {
// that.start_date = that.queryDate + "-01-01";
// that.end_date = that.queryDate + "-12-31";
// } else {
// that.start_date = that.currentYear + "-01-01";
// that.end_date = that.currentYear + "-12-31";
// }
// that.xAxisData = that.monthList;
// }
}, },
getMgroups(code){
let that = this;
that.$API.mtm.mgroup.list.req({page:0,code}).then((res) => {
that.mgroups = res;
that.componentsShow = true;
});
},
getDataHL() {
let that = this;
let obj = {
query: { start_date: that.start_date, end_date: that.end_date, mgroup_name: "混料", is_count_utask: -1 },
};
let option = deepCopy(that.basicOption);
option.xAxis.data = that.xAxisData;
option.title.text = '混料统计';
that.$API.bi.dataset.exec.req('lineWeek', obj).then((res) => {
let dataList = res.data2.ds0 ? res.data2.ds0 : [];
that.dataList = dataList;
if (dataList.length > 0) {
option.series = [];
let seriesData = [], nameList = [];
dataList.forEach(ite => {
if (nameList.indexOf(ite.物料名) > -1) { } else {
nameList.push(ite.物料名);
seriesData.push([0,0,0,0,0,0,0,0,0,0,0,0])
}
})
dataList.forEach(item => {
let indexX = 0, indexY = 0;
indexX = nameList.indexOf(item.物料名);
indexY = item. - that.firstWeekNum;
seriesData[indexX][indexY] += item.合格数;
});
for (let n = 0; n < seriesData.length; n++) {
let obj = {};
obj.name = nameList[n];
obj.stack = 'Ad';
obj.type = 'bar';
obj.barWidth = '15px';
obj.data = seriesData[n];
option.series.push(obj)
}
that.setChart("bachart1", option);
} else {
that.setChart("bachart1", option);
}
});
},
}, },
}; };
</script> </script>
<style scoped> <style scoped>
#content{
width: 1190px;
}
.contentItem{
margin-top: 20px;
}
</style> </style>

View File

@ -0,0 +1,100 @@
<template>
<div>
<p style="font-size: 18px;font-weight: 600;text-align: center;margin: 10px;">{{queryDate}}采购统计</p>
<scTable :data="tableData2" hideDo hidePagination class="exportTables">
<el-table-column type="index" width="50" />
<el-table-column
label="年份"
prop="年"
width="80"
/>
<el-table-column
v-if="queryType == '月'"
width="50"
label="周"
prop="周"
/>
<el-table-column
v-else
width="50"
label="月份"
prop="月"
/>
<el-table-column label="名称" prop="物料名">
</el-table-column>
<el-table-column label="规格" prop="规格">
</el-table-column>
<el-table-column label="型号" prop="型号">
</el-table-column>
<el-table-column label="数量" prop="数量">
</el-table-column>
</scTable>
</div>
</template>
<script>
export default {
name: "all_cg",
props: {
queryType:{
type: String,
default: "月"
},
queryDate:{
type: String,
default: ""
},
start_date:{
type: String,
default: ""
},
end_date:{
type: String,
default: ""
},
},
data() {
return {
currentYear: "",
currentMonth: "",
typeOptions: ["月", "年"],
tableData2: [],
materialItem:{},
};
},
mounted() {
this.$nextTick(() => {
this.getTable();
})
},
methods: {
getTable() {
let that = this;
let obj = {
query: {
start_date: that.start_date,
end_date: that.end_date,
mio_type: "pur_in",
},
};
let exec = that.queryType == "月" ? "saleOutWeek" : "saleOutMonth";
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
that.tableData2 = [];
if (res.data2.ds0) {
let data = res.data2.ds0;
that.tableData2 = data;
}
});
},
},
};
</script>
<style scoped>
.tables {
position: absolute;
top: 4px;
right: 6px;
z-index: 10;
}
</style>

View File

@ -0,0 +1,289 @@
<template>
<div>
<scEcharts height="600px" :option="option6" style="margin-top: 10px;"></scEcharts>
<el-table :data="tableData6" class="exportTables">
<el-table-column type="index" width="50" />
<el-table-column label="日期" prop="date">
<template #default="scope">
{{ scope.row. }}-{{ scope.row. }}
</template>
</el-table-column>
<el-table-column label="操作人" prop="操作人">
</el-table-column>
<el-table-column label="工段" prop="工段">
</el-table-column>
<el-table-column label="车间" prop="dept_name">
</el-table-column>
<el-table-column label="生产数" prop="生产数">
</el-table-column>
<el-table-column label="合格数" prop="合格数">
</el-table-column>
<el-table-column label="不合格数" prop="不合格数">
</el-table-column>
<el-table-column label="合格率" prop="合格率">
<template #default="scope">
{{ Math.round(scope.row.合格率) }}%
</template>
</el-table-column>
</el-table>
<scEcharts height="500px" :option="option7" style="margin-top: 10px;"></scEcharts>
<el-table :data="tableData7" class="exportTables">
<el-table-column type="index" width="50" />
<el-table-column label="日期" prop="date">
<template #default="scope">
{{ scope.row. }}-{{ scope.row. }}
</template>
</el-table-column>
<el-table-column label="操作人" prop="操作人">
</el-table-column>
<el-table-column label="工段" prop="工段">
</el-table-column>
<el-table-column label="车间" prop="dept_name">
</el-table-column>
<el-table-column label="生产数" prop="生产数">
</el-table-column>
<el-table-column label="合格数" prop="合格数">
</el-table-column>
<el-table-column label="不合格数" prop="不合格数">
</el-table-column>
<el-table-column label="合格率" prop="合格率">
<template #default="scope">
{{ Math.round(scope.row.合格率) }}%
</template>
</el-table-column>
</el-table>
<scEcharts height="300px" :option="option10" style="margin-top: 10px;"></scEcharts>
<el-table :data="tableData10" class="exportTables">
<el-table-column type="index" width="50" />
<el-table-column label="日期" prop="date">
<template #default="scope">
{{ scope.row. }}-{{ scope.row. }}
</template>
</el-table-column>
<el-table-column label="操作人" prop="操作人">
</el-table-column>
<el-table-column label="工段" prop="工段">
</el-table-column>
<el-table-column label="车间" prop="dept_name">
</el-table-column>
<el-table-column label="生产数" prop="生产数">
</el-table-column>
<el-table-column label="合格数" prop="合格数">
</el-table-column>
<el-table-column label="不合格数" prop="不合格数">
</el-table-column>
<el-table-column label="合格率" prop="合格率">
<template #default="scope">
{{ Math.round(scope.row.合格率) }}%
</template>
</el-table-column>
</el-table>
</div>
</template>
<script>
import scEcharts from "@/components/scEcharts";
export default {
name: "all_jx",
components: {
scEcharts,
},
props: {
queryType:{
type: String,
default: "月"
},
queryDate:{
type: String,
default: ""
},
start_date:{
type: String,
default: ""
},
end_date:{
type: String,
default: ""
},
},
data() {
return {
queryBelongDept: "",
currentYear: "",
currentMonth: "",
deptData: [],
tableData: [],
option6:{
title: {
text: "6车间人员绩效统计",
left: "center",
},
grid: {
top: "80px",
},
tooltip: {
trigger: "axis",
},
xAxis: {
type: "value",
position: "top",
axisLine: {
show: true,
},
},
yAxis: {
type: "category",
data: [],
},
series: {
data: [],
type: "bar",
barWidth: "15px",
},
},
option7:{
title: {
text: "7车间人员绩效统计",
left: "center",
},
grid: {
top: "80px",
},
tooltip: {
trigger: "axis",
},
xAxis: {
type: "value",
position: "top",
axisLine: {
show: true,
},
},
yAxis: {
type: "category",
data: [],
},
series: {
data: [],
type: "bar",
barWidth: "15px",
},
},
option10:{
title: {
text: "10车间人员绩效统计",
left: "center",
},
grid: {
top: "80px",
},
tooltip: {
trigger: "axis",
},
xAxis: {
type: "value",
position: "top",
axisLine: {
show: true,
},
},
yAxis: {
type: "category",
data: [],
},
series: {
data: [],
type: "bar",
barWidth: "15px",
},
},
tableData6: [],
tableData7: [],
tableData10: [],
chartHeight: 0,
};
},
mounted() {
this.$nextTick(() => {
this.getData();
})
},
methods: {
deepCopy(obj) {
return JSON.parse(JSON.stringify(obj));
},
getData() {
let that = this;
let obj6 = {
query: {
start_date: this.start_date,
end_date: this.end_date,
dept_name: '6车间',
},
};
that.$API.bi.dataset.exec.req("performance", obj6).then((res) => {
console.log("绩效统计6:", res);
let data = res.data2.ds0;
let seriesData = [],yAxisData = [];
data.forEach((item) => {
item.dept_name = "6车间";
seriesData.push(item.合格数);
yAxisData.push(item.操作人 + "∙" + item.工段);
});
that.tableData6 = data;
that.option6.yAxis.data = yAxisData;
that.option6.series.data = seriesData;
});
let obj7 = {
query: {
start_date: this.start_date,
end_date: this.end_date,
dept_name: '7车间',
},
};
that.$API.bi.dataset.exec.req("performance", obj7).then((res) => {
console.log("绩效统计7:", res);
let data = res.data2.ds0;
let seriesData = [],yAxisData = [];
data.forEach((item) => {
item.dept_name = "7车间";
seriesData.push(item.合格数);
yAxisData.push(item.操作人 + "∙" + item.工段);
});
that.tableData7 = data;
that.option7.yAxis.data = yAxisData;
that.option7.series.data = seriesData;
});
let obj10 = {
query: {
start_date: this.start_date,
end_date: this.end_date,
dept_name: '10车间',
},
};
that.$API.bi.dataset.exec.req("performance", obj10).then((res) => {
console.log("绩效统计10:", res);
let data = res.data2.ds0;
let seriesData = [],yAxisData = [];
data.forEach((item) => {
item.dept_name = "10车间";
seriesData.push(item.合格数);
yAxisData.push(item.操作人 + "∙" + item.工段);
});
that.tableData10 = data;
that.option10.yAxis.data = yAxisData;
that.option10.series.data = seriesData;
});
},
},
};
</script>
<style scoped>
.tables {
position: absolute;
top: 4px;
left: 4px;
z-index: 10;
}
</style>

View File

@ -0,0 +1,213 @@
<template>
<div>
<div v-for="(item, $index) in mgroup" :key="item.id">
<scEcharts height="500px" :option="'option'+$index"></scEcharts>
<el-table :data="'tableData'+$index" class="exportTables">
<el-table-column type="index" width="50" />
<el-table-column label="日期" prop="date">
<template #default="scope">
<span>{{ scope.row. }}</span>
<span v-if="scope.row.月">-{{ scope.row.月 }}</span>
</template>
</el-table-column>
<el-table-column label="规格" prop="规格">
</el-table-column>
<el-table-column label="型号" prop="型号">
</el-table-column>
<el-table-column label="合格数" prop="合格数">
</el-table-column>
<el-table-column label="不合格数" prop="合格数">
<el-table-column label="条纹" prop="条纹"></el-table-column>
<el-table-column label="气泡" prop="气泡"></el-table-column>
<el-table-column label="断裂" prop="断裂"></el-table-column>
<el-table-column label="气线" prop="气线"></el-table-column>
<el-table-column label="炸纹" prop="炸纹"></el-table-column>
<el-table-column label="结石" prop="结石"></el-table-column>
<el-table-column label="弯曲" prop="弯曲"></el-table-column>
<el-table-column label="偏壁" prop="偏壁"></el-table-column>
<el-table-column label="大小头" prop="大小头"></el-table-column>
<el-table-column label="其他" prop="其他"></el-table-column>
<el-table-column label="合计" prop="不合格数"></el-table-column>
</el-table-column>
</el-table>
</div>
</div>
</template>
<script>
import scEcharts from '@/components/scEcharts';
const baseOption ={
title: {
text: '工序检验统计',
left: 'center'
},
tooltip: {
trigger: 'item'
},
series: [
{
name: '工序检验',
type: 'pie',
radius: ['40%', '60%'],
center: ['50%', '60%'],
label: {
show: true,
formatter: '{b} : {c}',
},
data: []
}
]
};
export default {
name: 'all_jy_cjg',
props: {
queryType:{
type: String,
default: "月"
},
queryDate:{
type: String,
default: ""
},
start_date:{
type: String,
default: ""
},
end_date:{
type: String,
default: ""
},
},
components: {
scEcharts
},
data() {
return {
currentYear:'',
currentMonth:'',
typeOptions:['月','年'],
mgroupOption:[],
tableData0:[],
tableData1:[],
tableData2:[],
tableData3:[],
tableData4:[],
tableData5:[],
tableData6:[],
tableData7:[],
tableData8:[],
tableData9:[],
tableData10:[],
tableData11:[],
tableData12:[],
tableData13:[],
tableData14:[],
option0:{},
option1:{},
option2:{},
option3:{},
option4:{},
option5:{},
option6:{},
option7:{},
option8:{},
option9:{},
option10:{},
option11:{},
option12:{},
option13:{},
option14:{},
}
},
mounted(){
this.$nextTick(() => {
this.getMgroup();
})
},
methods:{
deepCopy(obj) {
return JSON.parse(JSON.stringify(obj));
},
getMgroup(){
let that = this;
this.$API.mtm.mgroup.list.req({belong_dept__name:'6车间',page:0}).then((res) => {
for(let i=0;i<res.length;i++){
that.mgroupsData = res;
this.getData(res[i].name,i);
}
});
},
getData(name,index){
let that = this;
let exec = that.queryType=='月'?'lineMonth':'lineYear';
let obj = {
query: {
end_date: that.end_date,
start_date: that.start_date,
mgroup_name: name,
group_bys_material: "",
order_bys_material: "",
select_cols_material: "",
group_bys_mgroup: ", mgroup.name",
select_cols_mgroup: ", mgroup.name AS 工段",
is_count_utask: -1
},
};
let optionKey = 'option'+index;
let tableKey = 'tableData'+index;
that[optionKey] = that.deepCopy(baseOption);
that[optionKey].title.text= name;
//echarts
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
if (res.data2.ds0) {
let data = res.data2.ds0;
let seriesData = [
{value: 0, name: '合格数'},
{value: 0, name: '条纹'},
{value: 0, name: '气泡'},
{value: 0, name: '断裂' },
{value: 0, name: '气线' },
{value: 0, name: '炸纹'},
{value: 0, name: '结石'},
{value: 0, name: '弯曲' },
{value: 0, name: '偏壁'},
{value: 0, name: '大小头'},
{value: 0, name: '其他'},
];
if (data.length > 0) {
data.forEach((item) => {
seriesData.forEach((item2) => {
item2.value += item[item2.name];
})
})
}
that[optionKey].series[0].data = seriesData;
}
});
let obj2 = {
query: {
start_date: that.start_date, end_date: that.end_date,
mgroup_name: name,
group_bys_mgroup: ", mgroup.name",
select_cols_mgroup: ", mgroup.name AS 工段",
is_count_utask: -1
},
};
//table
that.$API.bi.dataset.exec.req(exec, obj2).then((res2) => {
console.log('获取table数据:', res2.data2.ds0);
that[tableKey] = res2.data2.ds0;
});
},
},
}
</script>
<style scoped>
.tables {
position: absolute;
top: 4px;
right: 6px;
z-index: 10;
}
</style>

View File

@ -0,0 +1,506 @@
<template>
<div>
<scEcharts height="300px" :option="option1" style="margin-top: 10px;"></scEcharts>
<el-table :data="tableData7" class="exportTables">
<el-table-column
label="年"
prop="年"
v-if="queryType == '年'"
width="60"
>
</el-table-column>
<el-table-column
label="月"
prop="月"
v-else
width="60"
>
</el-table-column>
<el-table-column label="物料名" prop="物料名">
</el-table-column>
<el-table-column label="型号" prop="型号">
</el-table-column>
<el-table-column label="规格" prop="规格">
</el-table-column>
<el-table-column label="出料数" prop="生产数">
</el-table-column>
<el-table-column label="合格数" prop="合格数">
</el-table-column>
<el-table-column label="合格率" prop="合格率">
<template #default="scope">
<span>{{Math.round(scope.row.合格率)}}%</span>
</template>
</el-table-column>
<el-table-column
label="不合格原因及数量"
align="center"
>
<el-table-column label="炸纹" prop="炸纹">
</el-table-column>
<el-table-column label="条纹" prop="条纹">
</el-table-column>
<el-table-column label="气泡" prop="气泡">
</el-table-column>
<el-table-column label="弯曲" prop="弯曲">
</el-table-column>
<el-table-column label="其他" prop="其他">
</el-table-column>
<el-table-column label="合计" prop="不合格数">
</el-table-column>
</el-table-column>
</el-table>
<scEcharts height="300px" :option="option2" style="margin-top: 10px;"></scEcharts>
<el-table :data="tableData10" class="exportTables">
<el-table-column
label="年"
prop="年"
v-if="queryType == '年'"
width="60"
>
</el-table-column>
<el-table-column
label="月"
prop="月"
v-else
width="60"
>
</el-table-column>
<el-table-column label="物料名" prop="物料名">
</el-table-column>
<el-table-column label="型号" prop="型号">
</el-table-column>
<el-table-column label="规格" prop="规格">
</el-table-column>
<el-table-column label="出料数" prop="生产数">
</el-table-column>
<el-table-column label="合格数" prop="合格数">
</el-table-column>
<el-table-column label="合格率">
<template #default="scope">
<span>{{Math.round(scope.row.合格率)}}%</span>
</template>
</el-table-column>
<el-table-column
label="不合格原因及数量"
align="center"
>
<el-table-column label="椭圆/弯曲" prop="弯曲">
</el-table-column>
<el-table-column label="条纹" prop="条纹">
</el-table-column>
<el-table-column label="断裂" prop="断裂">
</el-table-column>
<el-table-column label="偏壁" prop="偏壁">
</el-table-column>
<el-table-column label="大小头" prop="大小头">
</el-table-column>
<el-table-column label="结石" prop="结石">
</el-table-column>
<el-table-column label="气线" prop="气线">
</el-table-column>
<el-table-column label="合计" prop="不合格数">
</el-table-column>
</el-table-column>
</el-table>
<scEcharts height="300px" :option="option3" style="margin-top: 10px;"></scEcharts>
<el-table :data="tableData8" class="exportTables">
<el-table-column
label="年"
prop="年"
v-if="queryType == '年'"
width="60"
>
</el-table-column>
<el-table-column
label="月"
prop="月"
v-else
width="60"
>
</el-table-column>
<el-table-column label="物料名" prop="物料名">
</el-table-column>
<el-table-column label="型号" prop="型号">
</el-table-column>
<el-table-column label="规格" prop="规格">
</el-table-column>
<el-table-column label="出料数" prop="生产数">
</el-table-column>
<el-table-column label="合格数" prop="合格数">
</el-table-column>
<el-table-column label="合格率">
<template #default="scope">
<span>{{Math.round(scope.row.合格率)}}%</span>
</template>
</el-table-column>
<el-table-column
label="不合格原因及数量"
align="center"
>
<el-table-column label="椭圆/弯曲" prop="弯曲">
</el-table-column>
<el-table-column label="条纹" prop="条纹">
</el-table-column>
<el-table-column label="断裂" prop="断裂">
</el-table-column>
<el-table-column label="偏壁" prop="偏壁">
</el-table-column>
<el-table-column label="大小头" prop="大小头">
</el-table-column>
<el-table-column label="结石" prop="结石">
</el-table-column>
<el-table-column label="气线" prop="气线">
</el-table-column>
<el-table-column label="箱中破" prop="箱中破">
</el-table-column>
<el-table-column label="合计" prop="不合格数">
</el-table-column>
</el-table-column>
</el-table>
</div>
</template>
<script>
const colors = [
"rgb(64,158,255)",
"#FAFAD2",
"#EEE9BF",
"#EEDC82",
"#EED5B7",
"#EEC591",
"#EEAD0E",
"#EE9A00",
"#EE9572",
"#F08080",
];
import scEcharts from "@/components/scEcharts";
export default {
name: "all_jy_sc",
components: {
scEcharts,
},
props: {
queryType:{
type: String,
default: "月"
},
queryDate:{
type: String,
default: ""
},
start_date:{
type: String,
default: ""
},
end_date:{
type: String,
default: ""
},
},
data() {
return {
currentYear: "",
currentMonth: "",
typeOptions: ["月", "年"],
option1: {
color: colors,
title: {
text: "7车间不合格原因及数量",
left: "center",
},
tooltip: {
trigger: "item",
},
legend: {
top: "10%",
right:'5%',
orient: 'vertical',
},
series: {
name: "7车间预制棒",
type: "pie",
radius: ["35%", "65%"],
center: ["45%", "50%"],
label: {
show: true,
position: "outside",
formatter: "{b} : {c} ({d}%)",
},
data: [
{ value: 0, name: "合格数" },
{ value: 0, name: "炸纹" },
{ value: 0, name: "条纹" },
{ value: 0, name: "气泡" },
{ value: 0, name: "弯曲" },
{ value: 0, name: "其他" },
],
},
},
option2: {
color: colors,
title: {
text: "10车间不合格原因及数量",
left: "center",
},
tooltip: {
trigger: "item",
},
legend: {
top: "10%",
right:'5%',
orient: 'vertical',
},
series: {
name: "10车间预制管检验统计",
type: "pie",
radius: ["35%", "65%"],
center: ["45%", "50%"],
label: {
show: true,
position: "outside",
formatter: "{b} : {c} ({d}%)",
},
data: [
{ value: 0, name: "合格数" },
{ value: 0, name: "条纹" },
{ value: 0, name: "断裂" },
{ value: 0, name: "偏壁" },
{ value: 0, name: "大小头" },
{ value: 0, name: "结石" },
{ value: 0, name: "气线" },
],
},
},
option3: {
color: colors,
title: {
text: "退火不合格原因及数量",
left: "center",
// subtext: '',
},
tooltip: {
trigger: "item",
},
legend: {
top: "10%",
right:'5%',
orient: 'vertical',
},
series: {
name: "退火预制管",
type: "pie",
radius: ["35%", "65%"],
center: ["45%", "50%"],
label: {
show: true,
position: "outside",
formatter: "{b} : {c} ({d}%)",
},
data: [
{ value: 0, name: "合格数" },
{ value: 0, name: "椭圆/弯曲" },
{ value: 0, name: "条纹" },
{ value: 0, name: "断裂" },
{ value: 0, name: "偏壁" },
{ value: 0, name: "大小头" },
{ value: 0, name: "结石" },
{ value: 0, name: "气线" },
{ value: 0, name: "箱中破" },
],
},
},
tableData7: [],
tableData10: [],
tableData8: [],
};
},
mounted() {
this.$nextTick(() => {
this.getData();
this.getData7();
this.getData10();
})
},
methods: {
getData() {
let that = this;
that.tableData8 = [];
let exec = that.queryType == "月" ? "lineMonth" : "lineYear";
let obj = {
query: {
start_date: this.start_date,
end_date: this.end_date,
mgroup_name: "管料退火",
is_count_utask: -1,
},
};
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
console.log("退火车间统计:", res);
if (res.data2.ds0) {
let data = res.data2.ds0;
that.tableData8 = data;
} else {
that.tableData8 = [];
}
});
//echarts
let obj2 = {
query: {
start_date: this.start_date,
end_date: this.end_date,
mgroup_name: "管料退火",
group_bys_material: "",
order_bys_material: "",
select_cols_material: "",
is_count_utask: -1,
},
};
that.$API.bi.dataset.exec.req(exec, obj2).then((res2) => {
console.log("退火车间统计:", res2);
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;
if (data.length > 0) {
data.forEach((item) => {
that.option3.series.data[0].value += item.合格数;
that.option3.series.data[1].value += item.弯曲;
that.option3.series.data[2].value += item.条纹;
that.option3.series.data[3].value += item.断裂;
that.option3.series.data[4].value += item.偏壁;
that.option3.series.data[5].value += item.大小头;
that.option3.series.data[6].value += item.结石;
that.option3.series.data[7].value += item.气线;
that.option3.series.data[8].value += item.箱中破;
});
}
}
});
},
getData7() {
let that = this;
that.tableData7 = [];
let obj = {
query: {
start_date: this.start_date,
end_date: this.end_date,
dept_name: "7车间",
},
};
let exec = that.queryType == "月" ? "lineMonth" : "lineYear";
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
console.log("7生产车间统计:", res);
if (res.data2.ds0) {
let data = res.data2.ds0;
that.tableData7 = data;
} else {
that.tableData7 = [];
}
});
//echarts
let obj2 = {
query: {
start_date: this.start_date,
end_date: this.end_date,
dept_name: "7车间",
group_bys_material: "",
order_bys_material: "",
select_cols_material: "",
},
};
that.$API.bi.dataset.exec.req(exec, obj2).then((res2) => {
console.log("7生产车间统计:", res2);
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;
if (data.length > 0) {
data.forEach((item) => {
that.option1.series.data[0].value += item.合格数;
that.option1.series.data[1].value += item.炸纹;
that.option1.series.data[2].value += item.条纹;
that.option1.series.data[3].value += item.气泡;
that.option1.series.data[4].value += item.弯曲;
that.option1.series.data[5].value += item.其他;
});
}
}
});
},
getData10() {
let that = this;
that.tableData10 = [];
let obj = {
query: {
start_date: this.start_date,
end_date: this.end_date,
dept_name: "10车间",
},
};
let exec = that.queryType == "月" ? "lineMonth" : "lineYear";
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
console.log("10生产车间统计:", res);
if (res.data2.ds0) {
let data = res.data2.ds0;
that.tableData10 = data;
} else {
that.tableData10 = [];
}
});
//echarts
let obj2 = {
query: {
start_date: this.start_date,
end_date: this.end_date,
dept_name: "10车间",
group_bys_material: "",
order_bys_material: "",
select_cols_material: "",
},
};
that.$API.bi.dataset.exec.req(exec, obj2).then((res2) => {
console.log("10生产车间统计:", res2);
if (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) {
data.forEach((item) => {
that.option2.series.data[0].value += item.合格数;
that.option2.series.data[1].value += item.断裂;
that.option2.series.data[2].value += item.条纹;
that.option2.series.data[3].value += item.偏壁;
that.option2.series.data[4].value += item.大小头;
that.option2.series.data[5].value += item.结石;
that.option2.series.data[6].value += item.气线;
});
}
}
});
},
},
};
</script>
<style scoped>
.tables {
position: absolute;
top: 4px;
right: 14px;
z-index: 10;
}
</style>

View File

@ -0,0 +1,425 @@
<template>
<div>
<!-- 10 成品-->
<p class="titleText">当前成品库存</p>
<scTable :data="tableData10" class="exportTables" stripe hideDo hidePagination>
<el-table-column type="index" width="50" />
<el-table-column label="物料名" prop="material_name" />
<el-table-column label="型号" prop="material_model" />
<el-table-column label="规格" prop="material_specification" />
<el-table-column label="完成车间" prop="dept_name" />
<el-table-column label="库存总数" prop="count" />
</scTable>
<!-- 20 半成品 -->
<p class="titleText">当前半成品库存</p>
<scTable :data="tableData20" class="exportTables" stripe hideDo hidePagination>
<el-table-column type="index" width="50" />
<el-table-column label="物料名" prop="material_name" />
<el-table-column label="型号" prop="material_model" />
<el-table-column label="规格" prop="material_specification"/>
<el-table-column label="完成车间" prop="dept_name" />
<el-table-column label="库存总数" prop="count" />
</scTable>
<!-- 30原料 -->
<p class="titleText">当前原料库存</p>
<scTable class="exportTables" :apiObj="apiObj" :params="params30" stripe hideDo hidePagination>
<el-table-column type="index" width="50" />
<el-table-column label="物料名" prop="name">
</el-table-column>
<el-table-column label="型号" prop="model">
</el-table-column>
<el-table-column label="规格" prop="specification">
</el-table-column>
<el-table-column label="库存总数" prop="count_mb">
</el-table-column>
<el-table-column label="周预估值" prop="week_esitimate_consume">
</el-table-column>
<el-table-column label="可用天数">
<template #default="scope">
<span v-if="scope.row.week_esitimate_consume &&scope.row.week_esitimate_consume !==null">
{{Math.floor(scope.row.count_mb /scope.row.week_esitimate_consume) * 7}}
</span>
</template>
</el-table-column>
</scTable>
<!-- 40辅料 -->
<p class="titleText">当前辅料库存</p>
<scTable class="exportTables" :apiObj="apiObj" :params="params40" stripe hideDo hidePagination>
<el-table-column type="index" width="50" />
<el-table-column label="物料名" prop="name">
</el-table-column>
<el-table-column label="型号" prop="model">
</el-table-column>
<el-table-column label="规格" prop="specification">
</el-table-column>
<el-table-column label="库存总数" prop="count_mb">
</el-table-column>
</scTable>
<!-- 采购入库 -->
<p class="titleText">采购入库统计</p>
<scTable class="exportTables"
v-if="tableDatapur_in.length > 0"
:data="tableDatapur_in"
stripe
hideDo
hidePagination
>
<el-table-column label="物料名" prop="物料名">
</el-table-column>
<el-table-column label="型号" prop="型号">
</el-table-column>
<el-table-column label="规格" prop="规格">
</el-table-column>
<el-table-column label="出入库类型">采购入库
</el-table-column>
<el-table-column label="执行车间" prop="执行车间">
</el-table-column>
<template v-if="queryType == '月'">
<el-table-column label="月入库总数" prop="数量">
</el-table-column>
</template>
<template v-if=" queryType == '年'">
<el-table-column label="年入库总数" prop="数量">
</el-table-column>
</template>
</scTable>
<!-- 销售发货 -->
<p class="titleText">销售发货统计</p>
<scTable class="exportTables"
v-if="tableDatasale_out.length > 0"
:data="tableDatasale_out"
stripe
hideDo
hidePagination
>
<el-table-column label="物料名" prop="物料名">
</el-table-column>
<el-table-column label="型号" prop="型号">
</el-table-column>
<el-table-column label="规格" prop="规格">
</el-table-column>
<el-table-column label="出入库类型">销售发货
</el-table-column>
<el-table-column label="执行车间" prop="执行车间">
</el-table-column>
<template v-if="queryType == '月'">
<el-table-column label="月出库数量" prop="数量">
</el-table-column>
</template>
<template v-if="queryType == '年'">
<el-table-column label="年出库总数" prop="数量">
</el-table-column>
</template>
</scTable>
<!-- 生产入库 -->
<p class="titleText">生产入库统计</p>
<scTable class="exportTables"
v-if="tableDatado_in.length > 0"
:data="tableDatado_in"
stripe
hideDo
hidePagination
>
<el-table-column label="物料名" prop="物料名">
</el-table-column>
<el-table-column label="型号" prop="型号">
</el-table-column>
<el-table-column label="规格" prop="规格">
</el-table-column>
<el-table-column label="出入库类型">生产入库
</el-table-column>
<el-table-column label="执行车间" prop="执行车间">
</el-table-column>
<template v-if="queryType == '月'">
<el-table-column label="月入库总数" prop="数量">
</el-table-column>
</template>
<template v-if="queryType == '年'">
<el-table-column label="年入库总数" prop="数量">
</el-table-column>
</template>
</scTable>
<!-- 生产领料 -->
<p class="titleText">生产领料统计</p>
<scTable class="exportTables"
v-if="tableDatado_out.length > 0"
:data="tableDatado_out"
stripe
hideDo
hidePagination
>
<el-table-column label="物料名" prop="物料名">
</el-table-column>
<el-table-column label="型号" prop="型号">
</el-table-column>
<el-table-column label="规格" prop="规格">
</el-table-column>
<el-table-column label="出入库类型">生产领料
</el-table-column>
<el-table-column label="执行车间" prop="执行车间">
</el-table-column>
<template v-if="queryType == '月'">
<el-table-column label="月出库数量" prop="数量">
</el-table-column>
</template>
<template v-if="queryType == '年'">
<el-table-column label="年出库总数" prop="数量">
</el-table-column>
</template>
</scTable>
<!-- 其他入库 -->
<p class="titleText">其他入库统计</p>
<scTable class="exportTables"
v-if="tableDataother_in.length > 0"
:data="tableDataother_in"
stripe
hideDo
hidePagination
>
<el-table-column label="物料名" prop="物料名">
</el-table-column>
<el-table-column label="型号" prop="型号">
</el-table-column>
<el-table-column label="规格" prop="规格">
</el-table-column>
<el-table-column label="出入库类型">其他入库
</el-table-column>
<el-table-column label="执行车间" prop="执行车间">
</el-table-column>
<template v-if="queryType == '月'">
<el-table-column label="月入库总数" prop="数量">
</el-table-column>
</template>
<template
v-if="queryType == '年'">
<el-table-column label="年入库总数" prop="数量">
</el-table-column>
</template>
</scTable>
<!-- 其他出库 -->
<p class="titleText">其他出库统计</p>
<scTable class="exportTables"
v-if="tableDataother_out.length > 0"
:data="tableDataother_out"
stripe
hideDo
hidePagination
>
<el-table-column label="物料名" prop="物料名">
</el-table-column>
<el-table-column label="型号" prop="型号">
</el-table-column>
<el-table-column label="规格" prop="规格">
</el-table-column>
<el-table-column label="出入库类型">其他出库
</el-table-column>
<el-table-column label="执行车间" prop="执行车间">
</el-table-column>
<template v-if="queryType == '月'">
<el-table-column label="月出库数量" prop="数量">
</el-table-column>
</template>
<template v-if=" queryType == '年'">
<el-table-column label="年出库总数" prop="数量">
</el-table-column>
</template>
</scTable>
</div>
</template>
<script>
export default {
name: "all_kc",
props: {
queryType:{
type: String,
default: "月"
},
queryDate:{
type: String,
default: ""
},
start_date:{
type: String,
default: ""
},
end_date:{
type: String,
default: ""
},
},
data() {
return {
apiObj: this.$API.mtm.material.list,
params10: { is_hidden: false, type: 10, count__gte: 1 },
params20: { is_hidden: false, type: 20, count__gte: 1 },
params30: { is_hidden: false, type: 30, count__gte: 1 },
params40: { is_hidden: false, type: 40, count__gte: 1 },
currentYear: "",
currentMonth: "",
currentLastDay: "",
tableData10: [],
tableData20: [],
tableDatapur_in: [],
tableDatasale_out: [],
tableDatado_in: [],
tableDatado_out: [],
tableDataother_in: [],
tableDataother_out: [],
typeOptions: ["月", "年"],
};
},
mounted() {
let that = this;
that.$nextTick(() => {
that.getTableData10();
that.getTableData20();
that.getTableDataPurin();
that.getTableDataSaleout();
that.getTableDataDoout();
that.getTableDataDoin();
that.getTableDataOtherin();
that.getTableDataOtherout();
})
},
methods: {
getTableData10(){
let that = this;
let obj = {
query: {material_types: 10},
};
that.$API.bi.dataset.exec.req("materialCount", obj).then((res) => {
if (res.data2.ds0) {
that.tableData10 = res.data2.ds0;
}
});
},
getTableData20(){
let that = this;
let obj = {
query: {material_types: 20},
};
that.$API.bi.dataset.exec.req("materialCount", obj).then((res) => {
if (res.data2.ds0) {
that.tableData20 = res.data2.ds0;
}
});
},
//
getTableDataPurin() {
let that = this;
let exec = that.queryType == "月" ? "saleOutMonth" : "saleOutYear";
let obj = {
query: {
start_date: that.start_date,
end_date: that.end_date,
mio_type: 'pur_in',
},
};
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
if (res.data2.ds0) {
let data = res.data2.ds0;
that.tableDatapur_in = data;
}
});
},
//
getTableDataSaleout() {
let that = this;
let exec = that.queryType == "月" ? "saleOutMonth" : "saleOutYear";
let obj = {
query: {
start_date: that.start_date,
end_date: that.end_date,
mio_type: 'sale_out',
},
};
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
if (res.data2.ds0) {
let data = res.data2.ds0;
that.tableDatasale_out = data;
}
});
},
//
getTableDataDoout() {
let that = this;
let exec = that.queryType == "月" ? "saleOutMonth" : "saleOutYear";
let obj = {
query: {
start_date: that.start_date,
end_date: that.end_date,
mio_type: 'do_out',
},
};
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
if (res.data2.ds0) {
let data = res.data2.ds0;
that.tableDatado_out = data;
}
});
},
//
getTableDataDoin() {
let that = this;
let exec = that.queryType == "月" ? "saleOutMonth" : "saleOutYear";
let obj = {
query: {
start_date: that.start_date,
end_date: that.end_date,
mio_type: 'do_in',
},
};
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
if (res.data2.ds0) {
let data = res.data2.ds0;
that.tableDatado_in = data;
}
});
},
//
getTableDataOtherin() {
let that = this;
let exec = that.queryType == "月" ? "saleOutMonth" : "saleOutYear";
let obj = {
query: {
start_date: that.start_date,
end_date: that.end_date,
mio_type: 'other_in',
},
};
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
if (res.data2.ds0) {
let data = res.data2.ds0;
that.tableDataother_in = data;
}
});
},
//
getTableDataOtherout() {
let that = this;
let exec = that.queryType == "月" ? "saleOutMonth" : "saleOutYear";
let obj = {
query: {
start_date: that.start_date,
end_date: that.end_date,
mio_type: 'other_out',
},
};
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
if (res.data2.ds0) {
let data = res.data2.ds0;
that.tableDataother_out = data;
}
});
},
},
};
</script>
<style lang="scss">
.titleText{
font-size: 18px;
font-weight: 600;
text-align: center;
margin: 10px;
}
</style>

View File

@ -0,0 +1,167 @@
<template>
<div>
<scEcharts height="300px" :option="option" style="margin-top: 10px;"></scEcharts>
<el-table :data="tableData" class="exportTables">
<el-table-column type="index" width="50" />
<el-table-column label="工段" prop="工段">
</el-table-column>
<el-table-column
label="物料名"
prop="物料名"
min-width="100"
>
</el-table-column>
<el-table-column label="任务数" prop="任务数">
</el-table-column>
<el-table-column label="生产数" prop="生产数">
</el-table-column>
<el-table-column label="合格数" prop="合格数">
</el-table-column>
<el-table-column label="不合格数" prop="不合格数">
</el-table-column>
<el-table-column label="完成进度" prop="完成进度">
<template #default="scope">
<span v-if="scope.row.完成进度&&scope.row.完成进度>0">{{(scope.row.完成进度).toFixed(2)}}%</span>
<span v-else>{{scope.row.完成进度}}</span>
</template>
</el-table-column>
<el-table-column label="合格率" prop="合格率">
<template #default="scope">
<span v-if="scope.row.合格率&&scope.row.合格率>0">{{(scope.row.合格率).toFixed(2)}}%</span>
<span v-else>{{scope.row.合格率}}</span>
</template>
</el-table-column>
</el-table>
</div>
</template>
<script>
import scEcharts from "@/components/scEcharts";
export default {
name: "all_sc_gx",
components: {
scEcharts,
},
props: {
queryType:{
type: String,
default: "月"
},
queryDate:{
type: String,
default: ""
},
start_date:{
type: String,
default: ""
},
end_date:{
type: String,
default: ""
},
},
data() {
return {
currentYear: "",
currentMonth: "",
typeOptions: ["月", "年"],
option: {
title: {
text: "6车间工序合格数统计",
left: "center",
},
grid: {
top: "80px",
},
tooltip: {
trigger: "axis",
},
legend: {
top: "10%",
icon: "stack",
right:'10%',
},
xAxis: {
type: "category",
data: [],
},
yAxis: {
type: "value",
},
series: [],
},
processData: [],
xAxisData: [],
tableData: [],
};
},
mounted() {
let that = this;
that.$nextTick(() => {
that.getData6();
})
},
methods: {
getData6() {
let that = this;
let obj = {
query: {
start_date: that.start_date,
end_date: that.end_date,
dept_name: "6车间",
select_cols_material: "",
group_bys_material: "",
order_bys_material: "",
is_count_utask: -1,
select_cols_mgroup: ", mgroup.name AS 工段",
group_bys_mgroup: ", mgroup.name",
order_bys_mgroup:",工段"
},
raise_exception: true,
};
if (that.queryType == "月") {
obj.query.select_cols_date =
",EXTRACT ( MONTH FROM mlog.handle_date ) AS 月";
obj.query.group_bys_date =
",EXTRACT ( MONTH FROM mlog.handle_date )";
obj.query.order_bys_date = ", 月";
}
let xAxisData = [],nameData=[],seriesData=[];
that.$API.bi.dataset.exec.req("lineWeek", obj).then((res) => {
let data = res.data2.ds0;
that.tableData = data;
data.forEach((item) => {
if (xAxisData.indexOf(item.工段) > -1) {
} else {
xAxisData.push(item.工段);
}
if (nameData.indexOf(item.物料名) > -1) {
} else {
nameData.push(item.物料名);
let obj = {
name:'',
type: "bar",
label:{
show: true,
position: "top",
formatter: "{c}"
},
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.option.xAxis.data = that.xAxisData;
that.option.series = seriesData;
});
},
},
};
</script>

View File

@ -0,0 +1,478 @@
<template>
<div>
<div id="bachart1"></div>
<el-table :data="tableData7" class="exportTables">
<el-table-column type="index" width="50" />
<el-table-column
label="物料名"
prop="物料名"
min-width="100"
>
</el-table-column>
<el-table-column
label="月份"
prop="月"
v-if="queryType == '年'"
width="50"
>
</el-table-column>
<el-table-column
label="周"
prop="周"
v-else
width="50"
>
</el-table-column>
<el-table-column label="型号" prop="型号">
</el-table-column>
<el-table-column label="规格" prop="规格">
</el-table-column>
<el-table-column label="任务数" prop="任务数">
</el-table-column>
<el-table-column label="生产数" prop="生产数">
</el-table-column>
<el-table-column label="合格数" prop="合格数">
</el-table-column>
<el-table-column
label="不合格数"
prop="不合格数"
>
</el-table-column>
<el-table-column label="合格率" prop="合格率">
<template #default="scope">
{{ Math.round(scope.row.合格率) }}%
</template>
</el-table-column>
</el-table>
<div id="bachart2"></div>
<el-table :data="tableData10" class="exportTables">
<el-table-column type="index" width="50" />
<el-table-column
label="物料名"
prop="物料名"
min-width="100"
>
</el-table-column>
<el-table-column
label="月份"
prop="月"
v-if="queryType == '年'"
>
</el-table-column>
<el-table-column label="周" prop="周" v-else>
</el-table-column>
<el-table-column label="型号" prop="型号">
</el-table-column>
<el-table-column label="规格" prop="规格">
</el-table-column>
<el-table-column label="任务数" prop="任务数">
</el-table-column>
<el-table-column label="生产数" prop="生产数">
</el-table-column>
<el-table-column label="合格数" prop="合格数">
</el-table-column>
<el-table-column
label="不合格数"
prop="不合格数"
>
</el-table-column>
<el-table-column label="合格率" prop="合格率">
<template #default="scope">
{{ Math.round(scope.row.合格率) }}%
</template>
</el-table-column>
</el-table>
<div id="bachart3"></div>
<el-table :data="tableData6" class="exportTables">
<el-table-column type="index" width="50" />
<el-table-column
label="物料名"
prop="物料名"
min-width="100"
>
</el-table-column>
<el-table-column
label="物料系列"
prop="物料系列"
>
</el-table-column>
<el-table-column
label="月份"
prop="月"
v-if="queryType == '年'"
>
</el-table-column>
<el-table-column label="周" prop="周" v-else>
</el-table-column>
<el-table-column label="型号" prop="型号">
</el-table-column>
<el-table-column label="规格" prop="规格">
</el-table-column>
<el-table-column label="任务数" prop="任务数">
</el-table-column>
<el-table-column label="生产数" prop="生产数">
</el-table-column>
<el-table-column label="合格数" prop="合格数">
</el-table-column>
<el-table-column
label="不合格数"
prop="不合格数"
>
</el-table-column>
<el-table-column label="合格率" prop="合格率">
<template #default="scope">
{{ Math.round(scope.row.合格率) }}%
</template>
</el-table-column>
</el-table>
</div>
</template>
<script>
import * as echarts from "echarts";
import T from "@/components/scEcharts/echarts-theme-T.js";
echarts.registerTheme("T", T);
import scEcharts from "@/components/scEcharts";
function deepCopy(obj) {
return JSON.parse(JSON.stringify(obj));
}
export default {
name: "all_sc_hg",
props: {
queryType:{
type: String,
default: "月"
},
queryDate:{
type: String,
default: ""
},
start_date:{
type: String,
default: ""
},
end_date:{
type: String,
default: ""
},
firstWeekNum:{
type: String,
default: ""
},
endWeekNum:{
type: String,
default: ""
},
xAxisData:{
type: String,
default: ""
},
},
components: {
scEcharts,
},
data() {
return {
typeOptions: ["月", "年"],
basicOption: {
backgroundColor: "transparent",
title: {
text: "",
left: 'center',
},
grid: {
top: "80px",
},
tooltip: {
trigger: "axis",
show: true,
},
xAxis: {
type: "category",
data: [],
},
yAxis: {
type: "value",
},
legend: {
top: "10%",
icon: "stack",
right:'10%',
},
series: [
{
data: [0, 0, 0, 0, 0, 0, 0],
stack: "Ad",
type: "bar",
barWidth: "15px",
},
],
},
tableData6: [],
tableData7: [],
tableData10: [],
monthList: [
"一月",
"二月",
"三月",
"四月",
"五月",
"六月",
"七月",
"八月",
"九月",
"十月",
"十一月",
"十二月",
],
};
},
mounted() {
this.$nextTick(() => {
this.getData6();
this.getData7();
this.getData10();
})
},
methods: {
setChart(name, option = null) {
// name , optionoption
var myChart = echarts.getInstanceByDom(
document.getElementById(name)
);
if (myChart == undefined) {
myChart = echarts.init(document.getElementById(name), "T");
}
if (option == null) {
option = Object.assign({}, this.basicOption);
}
setTimeout(() => {
try {
myChart.setOption(option);
} catch (error) {}
}, 500);
},
queryTypeChange(value) {
console.log(value);
},
getData6() {
let that = this;
let option = deepCopy(that.basicOption);
option.xAxis.data = that.xAxisData;
option.title.text = "6车间生产合格数统计";
let exec = that.queryType == "月" ? "lineWeek" : "lineMonth";
let obj = {
query: {
start_date: that.start_date,
end_date: that.end_date,
dept_name: "6车间",
},
};
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
let tableData6 = res.data2.ds0 ? res.data2.ds0 : [];
that.tableData6 = tableData6;
if (tableData6.length > 0) {
option.series = [];
let seriesData = [],
nameList = [];
tableData6.forEach((ite) => {
if (nameList.indexOf(ite.物料名) > -1) {
} else {
nameList.push(ite.物料名);
seriesData.push([]);
}
});
if (that.queryType == "月") {
tableData6.forEach((item) => {
let indexX = nameList.indexOf(item.物料名);
let indexY = item. - that.firstWeekNum;
if(seriesData[indexX][indexY]){
seriesData[indexX][indexY] += item.合格数;
}else{
seriesData[indexX][indexY] =0;
seriesData[indexX][indexY] += item.合格数;
}
});
} else {
tableData6.forEach((item) => {
let indexX = nameList.indexOf(item.物料名);
let indexY = item.month - 1;
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++) {
let obj = {};
obj.name = nameList[n];
obj.stack = "Ad";
obj.type = "bar";
obj.barWidth = "15px";
obj.data = seriesData[n];
obj.label={
show: true,
position: "right",
formatter: "{c}",
};
option.series.push(obj);
}
that.setChart("bachart3", option);
} else {
that.setChart("bachart3", option);
}
});
},
getData7() {
let that = this;
let obj = {
query: {
start_date: that.start_date,
end_date: that.end_date,
dept_name: "7车间",
},
};
let option = deepCopy(that.basicOption);
option.xAxis.data = that.xAxisData;
option.title.text = "预制棒生产合格数统计7车间";
let exec = that.queryType == "月" ? "lineWeek" : "lineMonth";
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
console.log("7生产车间统计:", res);
let tableData7 = res.data2.ds0 ? res.data2.ds0 : [];
that.tableData7 = tableData7;
debugger;
if (tableData7.length > 0) {
debugger;
option.series = [];
let seriesData = [],
nameList = [];
tableData7.forEach((ite) => {
if (nameList.indexOf(ite.物料名) > -1) {
} else {
nameList.push(ite.物料名);
seriesData.push([]);
}
});
tableData7.forEach((item) => {
let indexX = 0,
indexY = 0;
if (that.queryType == "月") {
indexX = nameList.indexOf(item.物料名);
indexY = item. - that.firstWeekNum;
} else {
indexX = nameList.indexOf(item.物料名);
indexY = item. - 1;
}
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++) {
let obj = {};
obj.name = nameList[n];
obj.stack = "Ad";
obj.type = "bar";
obj.barWidth = "15px";
obj.data = seriesData[n];
obj.label={
show: true,
position: "right",
formatter: "{c}",
};
option.series.push(obj);
}
that.setChart("bachart1", option);
} else {
that.setChart("bachart1", option);
}
});
},
getData10() {
let that = this;
let option = deepCopy(that.basicOption);
option.xAxis.data = that.xAxisData;
option.title.text = "预制管生产合格数统计10车间";
let obj = {
query: {
start_date: that.start_date,
end_date: that.end_date,
dept_name: "10车间",
},
};
let exec = that.queryType == "月" ? "lineWeek" : "lineMonth";
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;
}
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++) {
let obj = {};
obj.name = nameList[n];
obj.stack = "Ad";
obj.type = "bar";
obj.barWidth = "15px";
obj.data = seriesData[n];
option.series.push(obj);
obj.label={
show: true,
position: "right",
formatter: "{c}",
};
}
that.setChart("bachart2", option);
} else {
that.setChart("bachart2", option);
}
});
},
},
};
</script>
<style scoped>
#bachart1,
#bachart2,
#bachart3,
#bachart4 {
width: 100%;
height: 300px;
margin-top: 10px;
}
.tables {
position: absolute;
top: 6px;
left: 4px;
z-index: 10;
}
</style>

View File

@ -0,0 +1,185 @@
<!-- 混料统计 -->
<template>
<div>
<div id="bachartHL" style="width:100%;height:300px;margin-top: 10px;"></div>
<el-table :data="dataList" class="exportTables">
<el-table-column type="index" width="50"/>
<el-table-column label="物料名" prop="物料名">
</el-table-column>
<el-table-column label="月份" prop="月" v-if="queryType == '年'">
</el-table-column>
<el-table-column label="周" prop="周" v-else>
</el-table-column>
<el-table-column label="规格" prop="规格">
</el-table-column>
<el-table-column label="型号" prop="型号">
</el-table-column>
<el-table-column label="桶数" prop="合格数">
</el-table-column>
<el-table-column label="总重量" prop="总重量">
</el-table-column>
</el-table>
</div>
</template>
<script>
import * as echarts from "echarts";
import T from '@/components/scEcharts/echarts-theme-T.js';
echarts.registerTheme('T', T);
function deepCopy(obj) {
return JSON.parse(JSON.stringify(obj));
}
export default {
name: "all_sc_hl",
props: {
queryType:{
type: String,
default: "月"
},
queryDate:{
type: String,
default: ""
},
start_date:{
type: String,
default: ""
},
end_date:{
type: String,
default: ""
},
firstWeekNum:{
type: String,
default: ""
},
endWeekNum:{
type: String,
default: ""
},
xAxisData:{
type: String,
default: ""
},
},
data() {
return {
typeOptions: ["月", "年"],
dataList: [],
xAxisOrigin:[],
basicOption: {
backgroundColor: 'transparent',
title: {
text: '混料生产桶数及重量统计',
left: 'center',
},
grid: {
top: '80px'
},
tooltip: {
trigger: 'axis'
},
legend: {
top: "10%",
icon: "stack",
right:'10%',
},
xAxis: {
type: 'category',
data: []
},
yAxis: {
type: 'value'
},
series: [{
data: [0, 0, 0, 0, 0, 0, 0],
stack: 'Ad',
type: 'bar',
barWidth: '15px',
}]
},
monthList: [
"一月",
"二月",
"三月",
"四月",
"五月",
"六月",
"七月",
"八月",
"九月",
"十月",
"十一月",
"十二月",
],
};
},
mounted() {
this.$nextTick(() => {
this.getDataHL();//
})
},
methods: {
setChart(name, option = null) {
// name , optionoption
var myChart = echarts.getInstanceByDom(document.getElementById(name));
if (myChart == undefined) {
myChart = echarts.init(document.getElementById(name), 'T');
}
if (option == null) {
option = Object.assign({}, this.basicOption)
}
setTimeout(() => {
try {
myChart.setOption(option);
} catch (error) { }
}, 500)
},
getDataHL() {
let that = this;
let obj = {
query: { start_date: that.start_date, end_date: that.end_date, mgroup_name: "混料", is_count_utask: -1 },
};
let option = deepCopy(that.basicOption);
option.xAxis.data = that.xAxisData;
that.$API.bi.dataset.exec.req('lineWeek', obj).then((res) => {
let dataList = res.data2.ds0 ? res.data2.ds0 : [];
that.dataList = dataList;
if (dataList.length > 0) {
option.series = [];
let seriesData = [], nameList = [];
dataList.forEach(ite => {
if (nameList.indexOf(ite.物料名) > -1) { } else {
nameList.push(ite.物料名);
seriesData.push([0,0,0,0,0,0,0,0,0,0,0,0])
}
})
dataList.forEach(item => {
let indexX = 0, indexY = 0;
indexX = nameList.indexOf(item.物料名);
indexY = item. - that.firstWeekNum;
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];
obj.label={
show: true,
position: "right",
formatter: "{c}",
};
option.series.push(obj)
}
that.setChart("bachartHL", option);
} else {
that.setChart("bachartHL", option);
}
});
},
},
};
</script>
<style scoped>
</style>

View File

@ -0,0 +1,299 @@
<template>
<div>
<scEcharts height="300px" :option="option1" style="margin-top: 10px;"></scEcharts>
<el-table :data="tableData1" class="exportTables">
<el-table-column type="index" width="50" />
<el-table-column
label="任务编号"
prop="number"
min-width="100px"
>
</el-table-column>
<el-table-column label="计划数" prop="count">
</el-table-column>
<el-table-column label="完成数" prop="count_ok">
</el-table-column>
<el-table-column label="完成率" prop="rate">
</el-table-column>
</el-table>
<scEcharts height="300px" :option="option2" style="margin-top: 10px;"></scEcharts>
<el-table :data="tableData2" class="exportTables">
<el-table-column type="index" width="50" />
<el-table-column
label="任务编号"
prop="number"
min-width="100px"
>
</el-table-column>
<el-table-column label="计划数" prop="count">
</el-table-column>
<el-table-column label="完成数" prop="count_ok">
</el-table-column>
<el-table-column label="完成率" prop="rate">
</el-table-column>
</el-table>
<scEcharts height="300px" :option="option3" style="margin-top: 10px;"></scEcharts>
<el-table :data="tableData3" class="exportTables">
<el-table-column type="index" width="50" />
<el-table-column
label="任务编号"
prop="number"
min-width="100px"
>
</el-table-column>
<el-table-column label="计划数" prop="count">
</el-table-column>
<el-table-column label="完成数" prop="count_ok">
</el-table-column>
<el-table-column label="完成率" prop="rate">
</el-table-column>
</el-table>
</div>
</template>
<script>
import scEcharts from "@/components/scEcharts";
export default {
name: "chart",
components: {
scEcharts,
},
props: {
queryType:{
type: String,
default: "月"
},
queryDate:{
type: String,
default: ""
},
start_date:{
type: String,
default: ""
},
end_date:{
type: String,
default: ""
},
},
data() {
return {
tableHeight: 0,
currentYear: "",
currentMonth: "",
typeOptions: ["月", "年"],
option1: {
title: {
text: "7车间任务完成进度",
left: 'center',
},
tooltip: {
trigger: "item",
},
legend: {
top: "3",
right: "3%",
},
color: ["rgb(64,158,255)", "orange"],
series: {
name: "7车间完成进度",
type: "pie",
radius: ["40%", "70%"],
center: ["50%", "60%"],
label: {
show: true,
position: "outside",
formatter: "{b} : {c} ({d}%)",
},
data: [
{ value: 0, name: "已完成" },
{ value: 0, name: "未完成" },
],
},
},
option2: {
title: {
text: "10车间任务完成进度",
left: 'center',
},
tooltip: {
trigger: "item",
},
legend: {
top: "3",
right: "3%",
},
color: ["rgb(64,158,255)", "orange"],
series: {
name: "10车间完成进度",
type: "pie",
radius: ["40%", "70%"],
center: ["50%", "60%"],
label: {
show: true,
position: "outside",
formatter: "{b} : {c} ({d}%)",
},
data: [
{ value: 0, name: "已完成" },
{ value: 0, name: "未完成" },
],
},
},
option3: {
title: {
text: "6车间任务完成进度",
left: 'center',
},
tooltip: {
trigger: "item",
},
legend: {
top: "3",
right: "3%",
},
color: ["rgb(64,158,255)", "orange"],
series: {
name: "6车间完成进度",
type: "pie",
radius: ["40%", "70%"],
center: ["50%", "60%"],
label: {
show: true,
position: "outside",
formatter: "{b} : {c} ({d}%)",
},
data: [
{ value: 0, name: "已完成" },
{ value: 0, name: "未完成" },
],
},
},
tableData1: [],
tableData2: [],
tableData3: [],
};
},
mounted() {
this.$nextTick(() => {
this.getData6();
this.getData7();
this.getData10();
})
},
methods: {
getData7() {
let that = this;
that.tableData1 = [];
that.option1.series.data[0].value = 0;
that.option1.series.data[1].value = 0;
let obj = {};
obj.page = 0;
obj.mgroup__belong_dept__name = "7车间";
obj.start_date__gte = that.start_date;
obj.end_date__lte = that.end_date;
that.$API.pm.utask.list.req(obj).then((res) => {
console.log("utask:", res);
let data = [];
let count_ok1 = 0;
let count_notok1 = 0;
if (res.length > 0) {
res.forEach((item) => {
let obj = item;
obj.rate =
Math.round((item.count_ok / item.count) * 100) +
"%";
if (item.count_ok >= item.count) {
count_ok1++;
} else {
count_notok1++;
}
data.push(obj);
});
that.tableData1 = data;
that.option1.series.data[0].value = count_ok1;
}
this.option1.series.data[0].value = count_ok1;
this.option1.series.data[1].value = count_notok1;
});
},
async getData10() {
let that = this;
that.tableData2 = [];
that.option2.series.data[0].value = 0;
that.option2.series.data[1].value = 0;
let obj = {};
obj.page = 0;
obj.mgroup__belong_dept__name = "10车间";
obj.start_date__gte = that.start_date;
obj.end_date__lte = that.end_date;
await that.$API.pm.utask.list.req(obj).then((res) => {
console.log("utask:", res);
let data = [];
let count_ok2 = 0;
let count_notok2 = 0;
if (res.length > 0) {
res.forEach((item) => {
let obj = item;
obj.rate =
Math.round((item.count_ok / item.count) * 100) +
"%";
if (item.count_ok >= item.count) {
count_ok2++;
} else {
count_notok2++;
}
data.push(obj);
});
that.tableData2 = data;
that.option2.series.data[0].value = count_ok2;
that.option2.series.data[1].value = count_notok2;
}
});
},
async getData6() {
let that = this;
that.tableData3 = [];
that.option3.series.data[0].value = 0;
that.option3.series.data[1].value = 0;
let obj = {};
obj.page = 0;
obj.mtask_utask__mgroup__belong_dept__name = "6车间";
obj.start_date__gte = that.start_date;
obj.end_date__lte = that.end_date;
await that.$API.pm.utask.list.req(obj).then((res) => {
console.log("utask:", res);
let data = [];
let count_ok3 = 0;
let count_notok3 = 0;
if (res.length > 0) {
res.forEach((item) => {
let obj = item;
obj.rate =
Math.round((item.count_ok / item.count) * 100) +
"%";
if (item.count_ok >= item.count) {
count_ok3++;
} else {
count_notok3++;
}
data.push(obj);
});
that.tableData3 = data;
that.option3.series.data[0].value = count_ok3;
that.option3.series.data[1].value = count_notok3;
}
});
},
},
};
</script>
<style scoped>
.tables {
position: absolute;
top: 6px;
left: 4px;
z-index: 10;
}
</style>

View File

@ -0,0 +1,83 @@
<template>
<div>
<p style="font-size: 18px;font-weight: 600;text-align: center;margin: 10px;">销售统计</p>
<scTable class="exportTables" :data="tableData2" hideDo hidePagination>
<el-table-column type="index" width="50" />
<el-table-column label="年份" prop="年" width="80"/>
<el-table-column v-if="queryType == ''" width="50" label="周" prop="周"/>
<el-table-column v-else width="50" label="月份" prop="月"/>
<el-table-column label="名称" prop="物料名">
</el-table-column>
<el-table-column label="规格" prop="规格">
</el-table-column>
<el-table-column label="型号" prop="型号">
</el-table-column>
<el-table-column label="数量" prop="数量">
</el-table-column>
</scTable>
</div>
</template>
<script>
export default {
name: "all_xs",
props: {
queryType:{
type: String,
default: "月"
},
queryDate:{
type: String,
default: ""
},
start_date:{
type: String,
default: ""
},
end_date:{
type: String,
default: ""
},
},
data() {
return {
typeOptions: ["月", "年"],
tableData2: [],
};
},
mounted() {
this.$nextTick(() => {
this.getTable();
})
},
methods: {
getTable() {
let that = this;
let obj = {
query: {
start_date: that.start_date,
end_date: that.end_date,
mio_type: "sale_out",
},
};
let exec = that.queryType == "月" ? "saleOutWeek" : "saleOutMonth";
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
that.tableData2 = [];
if (res.data2.ds0) {
let data = res.data2.ds0;
that.tableData2 = data;
}
});
},
},
};
</script>
<style scoped>
.tables {
position: absolute;
top: 4px;
right: 6px;
z-index: 10;
}
</style>