This commit is contained in:
shijing 2023-12-15 15:13:43 +08:00
parent b924fb5af6
commit c07fd76ed5
20 changed files with 2113 additions and 939 deletions

View File

@ -2392,12 +2392,12 @@ const routes = [
},
"component": "statistics/user_statistics.vue"
},
//主库存统计
//销售统计
{
"path": "/inm_statistics",
"name": "inm_statistics",
"meta": {
"title": "主库存统计",
"title": "销售统计",
"icon": "el-icon-trend-charts",
"perms": ["bigScreenP"],
},
@ -2455,7 +2455,6 @@ const routes = [
"title": "报表",
"icon": "el-icon-trend-charts",
"type": "menu",
"perms": ["bi"]
},
"children": [
{
@ -2464,7 +2463,6 @@ const routes = [
"meta": {
"title": "数据集",
"icon": "el-icon-grid",
"perms": ["dataset"]
},
"component": "bi/dataset"
},

View File

@ -81,18 +81,16 @@ export default {
typeDict: {
'sale_out': '销售发货',
'do_in': '生产入库',
'other_in': '其他出库',
},
cateOptions: [
{ id: 'sale_out', name: '销售发货' },
{ id: 'do_in', name: '生产入库' },
{ id: 'other_out', name: '其他出库' },
],
dialog: {
save: false,
},
query: {
type: 'sale_out'
type__in: 'sale_out,do_in'
},
form: {

View File

@ -51,11 +51,11 @@
查看
</el-button>
<el-button link type="primary" @click="table_submit(scope.row)" v-auth="'mio.submit'"
v-if="scope.row.state == 10">
v-if="scope.row.state == 10&&(scope.row.type=='other_in'||scope.row.type=='other_out')">
提交
</el-button>
<el-button link type="danger" @click="table_del(scope.row)" v-auth="'mio.delete'"
v-if="scope.row.state == 10">
v-if="scope.row.state == 10&&(scope.row.type=='other_in'||scope.row.type=='other_out')">
删除
</el-button>
</template>
@ -93,10 +93,10 @@ export default {
'other_out': '其他出库',
},
cateOptions: [
// { id: 'do_out', name: '' },
// { id: 'sale_out', name: '' },
// { id: 'pur_in', name: '' },
// { id: 'do_in', name: '' },
{ id: 'do_out', name: '生产领料' },
{ id: 'sale_out', name: '销售发货' },
{ id: 'pur_in', name: '采购入库' },
{ id: 'do_in', name: '生产入库' },
{ id: 'other_in', name: '其他入库' },
{ id: 'other_out', name: '其他出库' },
],

View File

@ -38,6 +38,8 @@
</el-table-column>
<el-table-column label="数量" prop="count">
</el-table-column>
<el-table-column label="不合格数量" prop="count_notok">
</el-table-column>
<el-table-column label="创建时间" prop="create_time" show-overflow-tooltip>
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="100px">

View File

@ -1,50 +1,121 @@
<template>
<el-container>
<el-header>
<div class="right-panel">
<el-select v-model="queryType" clearable @change="queryTypeChange">
<el-option v-for="item in typeOptions"
:key="item"
:label="item"
:value="item"
>
</el-option>
</el-select>
<el-date-picker
v-if="queryType=='月'"
v-model="queryDate"
type="month"
placeholder="查询月期"
value-format="YYYY-MM"
style="width:100%"
>
</el-date-picker>
<el-date-picker
v-if="queryType=='年'"
v-model="queryDate"
type="year"
placeholder="查询年份"
value-format="YYYY"
style="width:100%"
>
</el-date-picker>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
</div>
</el-header>
<el-main>
<el-card shadow="never" style="margin-bottom: 8px;">
<el-row :gutter="15">
<el-col :lg="8">
<el-card shadow="never">
<scEcharts height="300px" :option="option"></scEcharts>
<scEcharts height="300px" :option="option1"></scEcharts>
</el-card>
</el-col>
<el-col :lg="16">
<el-card shadow="never">
<el-table :data="tableData">
<el-table-column type="index" width="50" />
<el-table-column label="日期" prop="date">
</el-table-column>
<el-table-column label="批次号" prop="name">
</el-table-column>
<el-table-column label="总数" prop="name">
</el-table-column>
<el-table-column label="抽检署" prop="name">
</el-table-column>
<el-table-column label="合格判定" prop="count_ok">
</el-table-column>
</el-table>
</el-card>
</el-col>
</el-row>
</el-card>
<el-card shadow="never" style="margin-bottom: 8px;">
<el-row :gutter="15">
<el-col :lg="8">
<el-card shadow="never">
<scEcharts height="300px" :option="option2"></scEcharts>
<scEcharts height="300px" :option="option1"></scEcharts>
</el-card>
</el-col>
<el-col :lg="16">
<el-card shadow="never">
<el-table :data="tableData">
<el-table-column type="index" width="50" />
<el-table-column label="日期" prop="date">
</el-table-column>
<el-table-column label="批次号" prop="name">
</el-table-column>
<el-table-column label="总数" prop="name">
</el-table-column>
<el-table-column label="抽检署" prop="name">
</el-table-column>
<el-table-column label="合格判定" prop="count_ok">
</el-table-column>
</el-table>
</el-card>
</el-col>
</el-row>
</el-card>
<el-card shadow="never" style="margin-bottom: 8px;">
<el-row :gutter="15">
<el-col :lg="8">
<el-card shadow="never">
<scEcharts height="300px" :option="option3"></scEcharts>
</el-card>
</el-col>
<el-col :lg="8">
<el-col :lg="16">
<el-card shadow="never">
<scEcharts height="300px" :option="option4"></scEcharts>
</el-card>
</el-col>
<el-col :lg="8">
<el-card shadow="never">
<scEcharts height="300px" :option="option5"></scEcharts>
</el-card>
</el-col>
<el-col :lg="8">
<el-card shadow="never">
<scEcharts height="300px" :option="option6"></scEcharts>
<el-table :data="tableData">
<el-table-column type="index" width="50" />
<el-table-column label="日期" prop="date">
</el-table-column>
<el-table-column label="批次号" prop="name">
</el-table-column>
<el-table-column label="总数" prop="name">
</el-table-column>
<el-table-column label="抽检署" prop="name">
</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-container>
</template>
<script>
import scEcharts from '@/components/scEcharts';
/**
* 引入组件 @/components/scEcharts
* 组件内部会自动加载主题 @/components/scEcharts/echarts-theme-T.js
* 支持props包括 heightwidthoption
* 组件export百度Echarts所有方法使用方式: new scEcharts[fun]
*/
export default {
name: 'chart',
components: {
@ -52,65 +123,60 @@
},
data() {
return {
option: {
queryType:'月',
queryDate:'',
start_date:'',
end_date:'',
currentYear:'',
currentMonth:'',
typeOptions:['月','年'],
option1: {
title: {
text: '管棒日合格率',
text: '预制棒',
// subtext: '',
},
grid: {
top: '80px'
},
tooltip: {
trigger: 'axis'
},
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [{
data: [120, 200, 150, 80, 70, 110, 130],
type: 'bar',
barWidth: '15px',
trigger: 'item'
},
series: [
{
data: [110, 180, 120, 120, 60, 90, 110],
type: 'bar',
barWidth: '15px',
}]
name: '预制棒',
type: 'pie',
radius: ['40%', '70%'],
center: ['50%', '60%'],
label: false,
data: [
{value: 10, name: '合格数'},
{value: 1, name: '不合格数'},
]
}
]
},
option2: {
title: {
text: 'AVG日合格率',
text: '预制管',
// subtext: '',
},
grid: {
top: '80px'
},
tooltip: {
trigger: 'axis'
},
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [{
data: [120, 200, 150, 80, 70, 110, 130],
type: 'line',
trigger: 'item'
},
series: [
{
data: [110, 180, 120, 120, 60, 90, 110],
type: 'line',
}]
name: '预制管',
type: 'pie',
radius: ['40%', '70%'],
center: ['50%', '60%'],
label: false,
data: [
{value: 10, name: '合格数'},
{value: 1, name: '不合格数'},
]
}
]
},
option3: {
title: {
text: '棒不合格统计',
text: 'AVG',
// subtext: '',
},
tooltip: {
@ -118,104 +184,108 @@
},
series: [
{
name: '访问来源',
name: 'AVG',
type: 'pie',
radius: ['40%', '70%'],
center: ['50%', '60%'],
label: false,
data: [
{value: 1048, name: '搜索引擎'},
{value: 735, name: '直接访问'},
{value: 580, name: '邮件营销'},
{value: 484, name: '联盟广告'},
{value: 300, name: '视频广告'}
]
}
]
},
option4: {
title: {
text: '管棒月合格率',
// subtext: '',
},
grid: {
top: '80px'
},
tooltip: {
trigger: 'axis'
},
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [{
data: [120, 200, 150, 80, 70, 110, 130],
type: 'bar',
barWidth: '15px',
},
{
data: [110, 180, 120, 120, 60, 90, 110],
type: 'bar',
barWidth: '15px',
}]
},
option5: {
title: {
text: 'AVG月合格率',
// subtext: '',
},
grid: {
top: '80px'
},
tooltip: {
trigger: 'axis'
},
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [{
data: [120, 200, 150, 80, 70, 110, 130],
type: 'line',
},
{
data: [110, 180, 120, 120, 60, 90, 110],
type: 'line',
}]
},
option6: {
title: {
text: '管不合格统计',
// subtext: '',
},
tooltip: {
trigger: 'item'
},
series: [
{
name: '访问来源',
type: 'pie',
radius: ['40%', '70%'],
center: ['50%', '60%'],
label: false,
data: [
{value: 1048, name: '搜索引擎'},
{value: 735, name: '直接访问'},
{value: 580, name: '邮件营销'},
{value: 484, name: '联盟广告'},
{value: 300, name: '视频广告'}
{value: 10, name: '合格数'},
{value: 1, name: '不合格数'},
]
}
]
}
}
},
mounted(){
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth()+1;
let days = new Date(year, month, 0).getDate();
this.currentYear = year;
this.currentMonth = month;
this.start_date =year+'-'+month+'-01';
this.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate();
this.queryDate = year+'-'+month;
this.getData6();
this.getData7();
this.getData10();
},
methods:{
queryTypeChange(value){
console.log(value)
this.queryDate = '';
if(value=='月'){
this.xAxisData = ['第一周','第二周','第三周','第四周'];
}else{
this.xAxisData = ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月']
}
this.option.xAxis.data = this.xAxisData;
this.option2.xAxis.data = this.xAxisData;
this.option3.xAxis.data = this.xAxisData;
this.option4.xAxis.data = this.xAxisData;
},
getData6(){
let that = this;
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
let obj = {
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "6车间" },
};
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
console.log('6生产车间统计:',doInRes);
debugger;
});
},
getData7(){
let that = this;
let obj = {
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "7车间" },
};
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
console.log('7生产车间统计:',doInRes);
debugger;
});
},
getData10(){
let that = this;
let obj = {
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "10·车间" },
};
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
console.log('10生产车间统计:',doInRes);
debugger;
});
},
handleQuery(){
if(this.queryDate!==''){
if(this.queryType=='月'){
this.start_date =this.queryDate+'-01';
let arr = this.queryDate.split('-');
this.end_date = this.queryDate+'-'+new Date(arr[0], arr[1], 0).getDate();
}else{
this.start_date = this.queryDate+'-01-01';
this.end_date = this.queryDate+'-12-31';
}
}else{
if(this.queryType=='月'){
this.start_date =this.currentYear+'-'+this.currentMonth+'-01';
this.end_date = this.currentYear+'-'+this.currentMonth+'-'+new Date(this.currentYear, this.currentMonth, 0).getDate();
}else{
this.start_date = this.currentYear+'-01-01';
this.end_date = this.currentYear+'-12-31';
}
}
debugger;
console.log(this.query)
this.getData6();
this.getData7();
this.getData10();
},
},
}
</script>

View File

@ -1,32 +1,121 @@
<template>
<el-container>
<el-header>
<div class="right-panel">
<el-select v-model="queryType" clearable @change="queryTypeChange">
<el-option v-for="item in typeOptions"
:key="item"
:label="item"
:value="item"
>
</el-option>
</el-select>
<el-date-picker
v-if="queryType=='月'"
v-model="queryDate"
type="month"
placeholder="查询月期"
value-format="YYYY-MM"
style="width:100%"
>
</el-date-picker>
<el-date-picker
v-if="queryType=='年'"
v-model="queryDate"
type="year"
placeholder="查询年份"
value-format="YYYY"
style="width:100%"
>
</el-date-picker>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
</div>
</el-header>
<el-main>
<el-card shadow="never" style="margin-bottom: 8px;">
<el-row :gutter="15">
<el-col :lg="8">
<el-card shadow="never">
<scEcharts height="300px" :option="option1"></scEcharts>
</el-card>
</el-col>
<el-col :lg="8">
<el-col :lg="16">
<el-card shadow="never">
<scEcharts height="300px" :option="option2"></scEcharts>
<el-table :data="tableData">
<el-table-column type="index" width="50" />
<el-table-column label="批次号" prop="date">
</el-table-column>
<el-table-column label="规格" prop="name">
</el-table-column>
<el-table-column label="型号" prop="name">
</el-table-column>
<el-table-column label="合格数" prop="count_ok">
</el-table-column>
<el-table-column label="不合格原因及数量" align="center">
<el-table-column label="炸纹" prop="count_n_zw">
</el-table-column>
<el-table-column label="条纹" prop="count_n_tw">
</el-table-column>
<el-table-column label="气泡" prop="count_n_qp">
</el-table-column>
<el-table-column label="弯曲" prop="count_n_wq">
</el-table-column>
<el-table-column label="其他" prop="count_n_qt">
</el-table-column>
<el-table-column label="合计" prop="count_n_qt">
</el-table-column>
</el-table-column>
</el-table>
</el-card>
</el-col>
</el-row>
</el-card>
<el-card shadow="never" style="margin-bottom: 8px;">
<el-row :gutter="15">
<el-col :lg="8">
<el-card shadow="never">
<scEcharts height="300px" :option="option1"></scEcharts>
</el-card>
</el-col>
<el-col :lg="16">
<el-card shadow="never">
<el-table :data="tableData">
<el-table-column type="index" width="50" />
<el-table-column label="日期" prop="date">
</el-table-column>
<el-table-column label="规格" prop="name">
</el-table-column>
<el-table-column label="型号" prop="name">
</el-table-column>
<el-table-column label="合格数" prop="count_ok">
</el-table-column>
<el-table-column label="不合格原因及数量" align="center">
<el-table-column label="椭圆/弯曲" prop="count_n_wq">
</el-table-column>
<el-table-column label="条纹" prop="count_n_tw">
</el-table-column>
<el-table-column label="断裂" prop="count_n_dl">
</el-table-column>
<el-table-column label="偏壁" prop="count_n_pb">
</el-table-column>
<el-table-column label="大小头" prop="count_n_dxt">
</el-table-column>
<el-table-column label="结石气绒" prop="count_n_jsqx">
</el-table-column>
<el-table-column label="合计" prop="count_n_qt">
</el-table-column>
</el-table-column>
</el-table>
</el-card>
</el-col>
</el-row>
</el-card>
</el-main>
</el-container>
</template>
<script>
import scEcharts from '@/components/scEcharts';
/**
* 引入组件 @/components/scEcharts
* 组件内部会自动加载主题 @/components/scEcharts/echarts-theme-T.js
* 支持props包括 heightwidthoption
* 组件export百度Echarts所有方法使用方式: new scEcharts[fun]
*/
export default {
name: 'chart',
components: {
@ -34,6 +123,13 @@
},
data() {
return {
queryType:'月',
queryDate:'',
start_date:'',
end_date:'',
currentYear:'',
currentMonth:'',
typeOptions:['月','年'],
option1: {
title: {
text: '预制棒',
@ -85,7 +181,95 @@
]
}
}
},
mounted(){
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth()+1;
let days = new Date(year, month, 0).getDate();
this.currentYear = year;
this.currentMonth = month;
this.start_date =year+'-'+month+'-01';
this.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate();
this.queryDate = year+'-'+month;
this.getData6();
this.getData7();
this.getData10();
},
methods:{
queryTypeChange(value){
console.log(value)
this.queryDate = '';
if(value=='月'){
this.xAxisData = ['第一周','第二周','第三周','第四周'];
}else{
this.xAxisData = ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月']
}
this.option.xAxis.data = this.xAxisData;
this.option2.xAxis.data = this.xAxisData;
this.option3.xAxis.data = this.xAxisData;
this.option4.xAxis.data = this.xAxisData;
},
getData6(){
let that = this;
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
let obj = {
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "6车间" },
};
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
console.log('6生产车间统计:',doInRes);
debugger;
});
},
getData7(){
let that = this;
let obj = {
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "7车间" },
};
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
console.log('7生产车间统计:',doInRes);
debugger;
});
},
getData10(){
let that = this;
let obj = {
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "10·车间" },
};
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
console.log('10生产车间统计:',doInRes);
debugger;
});
},
handleQuery(){
if(this.queryDate!==''){
if(this.queryType=='月'){
this.start_date =this.queryDate+'-01';
let arr = this.queryDate.split('-');
this.end_date = this.queryDate+'-'+new Date(arr[0], arr[1], 0).getDate();
}else{
this.start_date = this.queryDate+'-01-01';
this.end_date = this.queryDate+'-12-31';
}
}else{
if(this.queryType=='月'){
this.start_date =this.currentYear+'-'+this.currentMonth+'-01';
this.end_date = this.currentYear+'-'+this.currentMonth+'-'+new Date(this.currentYear, this.currentMonth, 0).getDate();
}else{
this.start_date = this.currentYear+'-01-01';
this.end_date = this.currentYear+'-12-31';
}
}
debugger;
console.log(this.query)
this.getData6();
this.getData7();
this.getData10();
},
},
}
</script>

View File

@ -1,45 +1,112 @@
<template>
<el-container>
<el-header>
<div class="right-panel">
<el-select v-model="queryType" clearable @change="queryTypeChange">
<el-option v-for="item in typeOptions"
:key="item"
:label="item"
:value="item"
>
</el-option>
</el-select>
<el-date-picker
v-if="queryType=='月'"
v-model="queryDate"
type="month"
placeholder="查询月期"
value-format="YYYY-MM"
style="width:100%"
>
</el-date-picker>
<el-date-picker
v-if="queryType=='年'"
v-model="queryDate"
type="year"
placeholder="查询年份"
value-format="YYYY"
style="width:100%"
>
</el-date-picker>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
</div>
</el-header>
<el-main>
<el-row :gutter="15">
<el-col :lg="8">
<el-card shadow="never">
<scEcharts height="300px" :option="option"></scEcharts>
<el-col :lg="12">
<el-card shadow="never" style="margin-bottom: 8px;">
<el-header>
<div class="right-panel">
<h2>棒管交付数</h2>
<el-select v-model="product" clearable @change="productChange">
<el-option v-for="item in inmData"
:key="item.id"
:label="item.material_.name"
:value="item.id"
>
</el-option>
</el-select>
</div>
</el-header>
<el-row>
<el-col>
<scEcharts height="300px" :option="option1"></scEcharts>
</el-col>
<el-col>
<el-table :data="tableData">
<el-table-column type="index" width="50" />
<el-table-column label="日期" prop="date">
</el-table-column>
<el-table-column label="批次" prop="name">
</el-table-column>
<el-table-column label="数量" prop="count">
</el-table-column>
</el-table>
</el-col>
</el-row>
</el-card>
</el-col>
<el-col :lg="8">
<el-card shadow="never">
<el-col :lg="12">
<el-card shadow="never" style="margin-bottom: 8px;">
<el-header>
<div class="right-panel">
<h2>棒交付数</h2>
<el-select v-model="product" clearable @change="productChange">
<el-option v-for="item in outData"
:key="item.id"
:label="item.material_.name"
:value="item.id"
>
</el-option>
</el-select>
</div>
</el-header>
<el-row>
<el-col>
<scEcharts height="300px" :option="option2"></scEcharts>
</el-card>
</el-col>
<el-col :lg="8">
<el-card shadow="never">
<scEcharts height="300px" :option="option3"></scEcharts>
</el-card>
<el-col>
<el-table :data="tableData">
<el-table-column type="index" width="50" />
<el-table-column label="日期" prop="date">
</el-table-column>
<el-table-column label="批次" prop="name">
</el-table-column>
<el-table-column label="数量" prop="count">
</el-table-column>
</el-table>
</el-col>
<el-col :lg="12">
<el-card shadow="never">
<scEcharts height="300px" :option="option4"></scEcharts>
</el-card>
</el-col>
<el-col :lg="12">
<el-card shadow="never">
<scEcharts height="300px" :option="option5"></scEcharts>
</el-row>
</el-card>
</el-col>
</el-row>
</el-main>
</el-container>
</template>
<script>
import scEcharts from '@/components/scEcharts';
/**
* 引入组件 @/components/scEcharts
* 组件内部会自动加载主题 @/components/scEcharts/echarts-theme-T.js
* 支持props包括 heightwidthoption
* 组件export百度Echarts所有方法使用方式: new scEcharts[fun]
*/
const xAxisData = ['第一周','第二周','第三周','第四周'];
export default {
name: 'chart',
components: {
@ -47,11 +114,15 @@
},
data() {
return {
option: {
title: {
text: '主要原材料消耗',
// subtext: '',
},
queryType:'月',
queryDate:'',
start_date:'',
end_date:'',
currentYear:'',
currentMonth:'',
xAxisData:['第一周','第二周','第三周','第四周'],
typeOptions:['月','年'],
option1: {
grid: {
top: '80px'
},
@ -60,7 +131,7 @@
},
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
data:xAxisData
},
yAxis: {
type: 'value'
@ -77,10 +148,6 @@
}]
},
option2: {
title: {
text: '办公用品统计',
// subtext: '',
},
grid: {
top: '80px'
},
@ -89,59 +156,7 @@
},
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [{
data: [120, 200, 150, 80, 70, 110, 130],
type: 'line',
},
{
data: [110, 180, 120, 120, 60, 90, 110],
type: 'line',
}]
},
option3: {
title: {
text: '成品统计',
// subtext: '',
},
tooltip: {
trigger: 'item'
},
series: [
{
name: '访问来源',
type: 'pie',
radius: ['40%', '70%'],
center: ['50%', '60%'],
label: false,
data: [
{value: 1048, name: '搜索引擎'},
{value: 735, name: '直接访问'},
{value: 580, name: '邮件营销'},
{value: 484, name: '联盟广告'},
{value: 300, name: '视频广告'}
]
}
]
},
option4: {
title: {
text: '入库统计',
// subtext: '',
},
grid: {
top: '80px'
},
tooltip: {
trigger: 'axis'
},
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
data: xAxisData
},
yAxis: {
type: 'value'
@ -150,42 +165,105 @@
data: [120, 200, 150, 80, 70, 110, 130],
type: 'bar',
barWidth: '15px',
},
{
data: [110, 180, 120, 120, 60, 90, 110],
type: 'bar',
barWidth: '15px',
}]
},
option5: {
title: {
text: '辅助材料统计',
// subtext: '',
tableData:[
{id:1,date:'2023-12-11',name:'ZJ2-1',count:200},
{id:1,date:'2023-12-11',name:'ZJ2-2',count:200},
{id:1,date:'2023-12-11',name:'ZJ2-3',count:200},
{id:1,date:'2023-12-11',name:'ZJ2-4',count:200},
],
inmData:[],
outData:[],
}
},
grid: {
top: '80px'
mounted(){
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth()+1;
let days = new Date(year, month, 0).getDate();
this.currentYear = year;
this.currentMonth = month;
this.start_date =year+'-'+month+'-01';
this.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate();
this.queryDate = year+'-'+month;
this.getInmData();
this.getOutData();
},
tooltip: {
trigger: 'axis'
methods:{
getInmData(){},
getOutData(){},
queryTypeChange(value){
console.log(value)
this.queryDate = '';
if(value=='月'){
this.xAxisData = ['第一周','第二周','第三周','第四周'];
}else{
this.xAxisData = ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月']
}
this.option1.xAxis.data = this.xAxisData;
this.option2.xAxis.data = this.xAxisData;
},
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
getData6(){
let that = this;
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
let obj = {
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "6车间" },
};
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
console.log('6生产车间统计:',doInRes);
debugger;
});
},
yAxis: {
type: 'value'
getData7(){
let that = this;
let obj = {
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "7车间" },
};
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
console.log('7生产车间统计:',doInRes);
debugger;
});
},
series: [{
data: [120, 200, 150, 80, 70, 110, 130],
type: 'line',
getData10(){
let that = this;
let obj = {
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "10·车间" },
};
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
console.log('10生产车间统计:',doInRes);
debugger;
});
},
{
data: [110, 180, 120, 120, 60, 90, 110],
type: 'line',
}]
}
handleQuery(){
if(this.queryDate!==''){
if(this.queryType=='月'){
this.start_date =this.queryDate+'-01';
let arr = this.queryDate.split('-');
this.end_date = this.queryDate+'-'+new Date(arr[0], arr[1], 0).getDate();
}else{
this.start_date = this.queryDate+'-01-01';
this.end_date = this.queryDate+'-12-31';
}
}else{
if(this.queryType=='月'){
this.start_date =this.currentYear+'-'+this.currentMonth+'-01';
this.end_date = this.currentYear+'-'+this.currentMonth+'-'+new Date(this.currentYear, this.currentMonth, 0).getDate();
}else{
this.start_date = this.currentYear+'-01-01';
this.end_date = this.currentYear+'-12-31';
}
}
debugger;
console.log(this.query)
this.getData6();
this.getData7();
this.getData10();
},
},
}
</script>

View File

@ -1,22 +1,112 @@
<template>
<el-container>
<el-header>
<div class="right-panel">
<el-select v-model="queryType" clearable @change="queryTypeChange">
<el-option v-for="item in typeOptions"
:key="item"
:label="item"
:value="item"
>
</el-option>
</el-select>
<el-date-picker
v-if="queryType=='月'"
v-model="queryDate"
type="month"
placeholder="查询月期"
value-format="YYYY-MM"
style="width:100%"
>
</el-date-picker>
<el-date-picker
v-if="queryType=='年'"
v-model="queryDate"
type="year"
placeholder="查询年份"
value-format="YYYY"
style="width:100%"
>
</el-date-picker>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
</div>
</el-header>
<el-main>
<el-row :gutter="15">
<el-col :lg="12">
<el-card shadow="never">
<scEcharts height="300px" :option="option1"></scEcharts>
<el-card shadow="never" style="margin-bottom: 8px;">
<el-header>
<div class="right-panel">
<h2>采购统计</h2>
<el-select v-model="product" clearable @change="productChange">
<el-option v-for="item in inmData"
:key="item.id"
:label="item.material_.name"
:value="item.id"
>
</el-option>
</el-select>
</div>
</el-header>
<el-row>
<el-col>
<scEcharts height="300px" :option="option2"></scEcharts>
</el-col>
<el-col>
<el-table :data="tableData">
<el-table-column type="index" width="50" />
<el-table-column label="日期" prop="date">
</el-table-column>
<el-table-column label="名称" prop="name">
</el-table-column>
<el-table-column label="数量" prop="count">
</el-table-column>
</el-table>
</el-col>
</el-row>
</el-card>
</el-col>
<el-col :lg="12">
<el-card shadow="never">
<el-card shadow="never" style="margin-bottom: 8px;">
<el-header>
<div class="right-panel">
<h2>消耗统计</h2>
<el-select v-model="product" clearable @change="productChange">
<el-option v-for="item in outData"
:key="item.id"
:label="item.material_.name"
:value="item.id"
>
</el-option>
</el-select>
</div>
</el-header>
<el-row>
<el-col>
<scEcharts height="300px" :option="option2"></scEcharts>
</el-col>
<el-col>
<el-table :data="tableData">
<el-table-column type="index" width="50" />
<el-table-column label="日期" prop="date">
</el-table-column>
<el-table-column label="名称" prop="name">
</el-table-column>
<el-table-column label="数量" prop="count">
</el-table-column>
</el-table>
</el-col>
</el-row>
</el-card>
</el-col>
</el-row>
</el-main>
</el-container>
</template>
<script>
import scEcharts from '@/components/scEcharts';
const xAxisData = ['第一周','第二周','第三周','第四周'];
export default {
name: 'chart',
components: {
@ -24,11 +114,15 @@
},
data() {
return {
queryType:'月',
queryDate:'',
start_date:'',
end_date:'',
currentYear:'',
currentMonth:'',
xAxisData:['第一周','第二周','第三周','第四周'],
typeOptions:['月','年'],
option1: {
title: {
text: '采购统计',
// subtext: '',
},
grid: {
top: '80px'
},
@ -37,7 +131,7 @@
},
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
data:xAxisData
},
yAxis: {
type: 'value'
@ -54,10 +148,6 @@
}]
},
option2: {
title: {
text: '消耗统计',
// subtext: '',
},
grid: {
top: '80px'
},
@ -66,7 +156,7 @@
},
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
data: xAxisData
},
yAxis: {
type: 'value'
@ -82,8 +172,103 @@
barWidth: '15px',
}]
},
tableData:[
{id:1,date:'2023-12-11',name:'ZJ2-1',count:200},
{id:1,date:'2023-12-11',name:'ZJ2-2',count:200},
{id:1,date:'2023-12-11',name:'ZJ2-3',count:200},
{id:1,date:'2023-12-11',name:'ZJ2-4',count:200},
],
inmData:[],
outData:[],
}
},
mounted(){
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth()+1;
let days = new Date(year, month, 0).getDate();
this.currentYear = year;
this.currentMonth = month;
this.start_date =year+'-'+month+'-01';
this.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate();
this.queryDate = year+'-'+month;
this.getInmData();
this.getOutData();
},
methods:{
getInmData(){},
getOutData(){},
queryTypeChange(value){
console.log(value)
this.queryDate = '';
if(value=='月'){
this.xAxisData = ['第一周','第二周','第三周','第四周'];
}else{
this.xAxisData = ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月']
}
this.option1.xAxis.data = this.xAxisData;
this.option2.xAxis.data = this.xAxisData;
},
getData6(){
let that = this;
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
let obj = {
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "6车间" },
};
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
console.log('6生产车间统计:',doInRes);
debugger;
});
},
getData7(){
let that = this;
let obj = {
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "7车间" },
};
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
console.log('7生产车间统计:',doInRes);
debugger;
});
},
getData10(){
let that = this;
let obj = {
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "10·车间" },
};
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
console.log('10生产车间统计:',doInRes);
debugger;
});
},
handleQuery(){
if(this.queryDate!==''){
if(this.queryType=='月'){
this.start_date =this.queryDate+'-01';
let arr = this.queryDate.split('-');
this.end_date = this.queryDate+'-'+new Date(arr[0], arr[1], 0).getDate();
}else{
this.start_date = this.queryDate+'-01-01';
this.end_date = this.queryDate+'-12-31';
}
}else{
if(this.queryType=='月'){
this.start_date =this.currentYear+'-'+this.currentMonth+'-01';
this.end_date = this.currentYear+'-'+this.currentMonth+'-'+new Date(this.currentYear, this.currentMonth, 0).getDate();
}else{
this.start_date = this.currentYear+'-01-01';
this.end_date = this.currentYear+'-12-31';
}
}
debugger;
console.log(this.query)
this.getData6();
this.getData7();
this.getData10();
},
},
}
</script>

View File

@ -2,23 +2,62 @@
<el-container>
<el-header>
<div class="right-panel">
<el-select v-model="query.type" clearable>
<el-select v-model="queryType" clearable @change="queryTypeChange">
<el-option v-for="item in typeOptions"
:key="item"
:label="item"
:value="item">
:value="item"
>
</el-option>
</el-select>
<el-date-picker
v-if="queryType=='月'"
v-model="queryDate"
type="month"
placeholder="查询月期"
value-format="YYYY-MM"
style="width:100%"
>
</el-date-picker>
<el-date-picker
v-if="queryType=='年'"
v-model="queryDate"
type="year"
placeholder="查询年份"
value-format="YYYY"
style="width:100%"
>
</el-date-picker>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
</div>
</el-header>
<el-main>
<el-card shadow="never" style="margin-bottom: 8px;">
<el-row :gutter="10">
<el-col :lg="12">
<el-card shadow="never">
<scEcharts height="300px" :option="option"></scEcharts>
</el-card>
</el-col>
<el-col :lg="12">
<el-card shadow="never">
<el-table :data="tableData">
<el-table-column type="index" width="50" />
<el-table-column label="日期" prop="date">
</el-table-column>
<el-table-column label="规格" prop="name">
</el-table-column>
<el-table-column label="型号" prop="name">
</el-table-column>
<el-table-column label="合格数" prop="count_ok">
</el-table-column>
</el-table>
</el-card>
</el-col>
</el-row>
</el-card>
<el-card shadow="never" style="margin-bottom: 8px;">
<el-row :gutter="10">
<el-col :lg="12">
<el-card shadow="never">
<scEcharts height="300px" :option="option2"></scEcharts>
@ -39,47 +78,15 @@
</el-table>
</el-card>
</el-col>
<el-col :lg="12">
<el-card shadow="never">
<el-table :data="tableData">
<el-table-column type="index" width="50" />
<el-table-column label="日期" prop="date">
</el-table-column>
<el-table-column label="规格" prop="name">
</el-table-column>
<el-table-column label="型号" prop="name">
</el-table-column>
<el-table-column label="合格数" prop="count_ok">
</el-table-column>
</el-table>
</el-row>
</el-card>
</el-col>
<el-card shadow="never" style="margin-bottom: 8px;">
<el-row :gutter="10">
<el-col :lg="12">
<el-card shadow="never">
<scEcharts height="300px" :option="option3"></scEcharts>
</el-card>
</el-col>
<el-col :lg="12">
<el-card shadow="never">
<scEcharts height="300px" :option="option4"></scEcharts>
</el-card>
</el-col>
<el-col :lg="12">
<el-card shadow="never">
<el-table :data="tableData">
<el-table-column type="index" width="50" />
<el-table-column label="日期" prop="date">
</el-table-column>
<el-table-column label="规格" prop="name">
</el-table-column>
<el-table-column label="型号" prop="name">
</el-table-column>
<el-table-column label="合格数" prop="count_ok">
</el-table-column>
</el-table>
</el-card>
</el-col>
<el-col :lg="12">
<el-card shadow="never">
<el-table :data="tableData">
@ -96,13 +103,37 @@
</el-card>
</el-col>
</el-row>
</el-card>
<el-card shadow="never" style="margin-bottom: 8px;">
<el-row :gutter="10">
<el-col :lg="12">
<el-card shadow="never">
<scEcharts height="300px" :option="option4"></scEcharts>
</el-card>
</el-col>
<el-col :lg="12">
<el-card shadow="never">
<el-table :data="tableData">
<el-table-column type="index" width="50" />
<el-table-column label="日期" prop="date">
</el-table-column>
<el-table-column label="规格" prop="name">
</el-table-column>
<el-table-column label="型号" prop="name">
</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-container>
</template>
<script>
import scEcharts from '@/components/scEcharts';
const xAxisData = ['第一周','第二周','第三周','第四周'];
export default {
name: 'chart',
components: {
@ -110,10 +141,14 @@
},
data() {
return {
query:{type:'',
search:''
},
typeOptions:['周','月','年'],
queryType:'月',
queryDate:'',
start_date:'',
end_date:'',
currentYear:'',
currentMonth:'',
xAxisData:['第一周','第二周','第三周','第四周'],
typeOptions:['月','年'],
option: {
title: {
text: '预制棒7车间',
@ -126,19 +161,33 @@
},
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
data: xAxisData
},
yAxis: {
type: 'value'
},
lenged:[],
// toolbox: {
// show: true,
// orient: 'vertical',
// left: 'right',
// top: 'center',
// feature: {
// mark: { show: true },
// dataView: { show: true, readOnly: false },
// magicType: { show: true, type: ['line', 'bar', 'stack'] },
// restore: { show: true },
// saveAsImage: { show: true }
// }
// },
series: [{
data: [120, 200, 150, 80, 70, 110, 130],
data: [120, 200, 150, 80, 70, 110, 130, 200, 150, 80, 70, 110],
stack: 'Ad',
type: 'bar',
barWidth: '15px',
},
{
data: [110, 180, 120, 120, 60, 90, 110],
data: [110, 180, 120, 120, 60, 90, 110, 120, 120, 60, 90, 110],
stack: 'Ad',
type: 'bar',
barWidth: '15px',
@ -156,7 +205,7 @@
},
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
data: xAxisData
},
yAxis: {
type: 'value'
@ -186,7 +235,7 @@
},
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
data: xAxisData
},
yAxis: {
type: 'value'
@ -216,7 +265,7 @@
},
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
data: xAxisData
},
yAxis: {
type: 'value'
@ -241,7 +290,95 @@
{id:1,date:'2023-12-11',name:'ZJ2-4',count_ok:200},
],
}
},
mounted(){
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth()+1;
let days = new Date(year, month, 0).getDate();
this.currentYear = year;
this.currentMonth = month;
this.start_date =year+'-'+month+'-01';
this.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate();
this.queryDate = year+'-'+month;
this.getData6();
this.getData7();
this.getData10();
},
methods:{
queryTypeChange(value){
console.log(value)
this.queryDate = '';
if(value=='月'){
this.xAxisData = ['第一周','第二周','第三周','第四周'];
}else{
this.xAxisData = ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月']
}
this.option.xAxis.data = this.xAxisData;
this.option2.xAxis.data = this.xAxisData;
this.option3.xAxis.data = this.xAxisData;
this.option4.xAxis.data = this.xAxisData;
},
getData6(){
let that = this;
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
let obj = {
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "6车间" },
};
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
console.log('6生产车间统计:',doInRes);
debugger;
});
},
getData7(){
let that = this;
let obj = {
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "7车间" },
};
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
console.log('7生产车间统计:',doInRes);
debugger;
});
},
getData10(){
let that = this;
let obj = {
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "10·车间" },
};
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
console.log('10生产车间统计:',doInRes);
debugger;
});
},
handleQuery(){
if(this.queryDate!==''){
if(this.queryType=='月'){
this.start_date =this.queryDate+'-01';
let arr = this.queryDate.split('-');
this.end_date = this.queryDate+'-'+new Date(arr[0], arr[1], 0).getDate();
}else{
this.start_date = this.queryDate+'-01-01';
this.end_date = this.queryDate+'-12-31';
}
}else{
if(this.queryType=='月'){
this.start_date =this.currentYear+'-'+this.currentMonth+'-01';
this.end_date = this.currentYear+'-'+this.currentMonth+'-'+new Date(this.currentYear, this.currentMonth, 0).getDate();
}else{
this.start_date = this.currentYear+'-01-01';
this.end_date = this.currentYear+'-12-31';
}
}
debugger;
console.log(this.query)
this.getData6();
this.getData7();
this.getData10();
},
},
}
</script>

View File

@ -2,13 +2,32 @@
<el-container>
<el-header>
<div class="right-panel">
<el-select v-model="query.type" clearable>
<el-select v-model="queryType" clearable @change="queryTypeChange">
<el-option v-for="item in typeOptions"
:key="item"
:label="item"
:value="item">
:value="item"
>
</el-option>
</el-select>
<el-date-picker
v-if="queryType=='月'"
v-model="queryDate"
type="month"
placeholder="查询月期"
value-format="YYYY-MM"
style="width:100%"
>
</el-date-picker>
<el-date-picker
v-if="queryType=='年'"
v-model="queryDate"
type="year"
placeholder="查询年份"
value-format="YYYY"
style="width:100%"
>
</el-date-picker>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
</div>
</el-header>
@ -32,8 +51,8 @@
</el-table-column>
<el-table-column label="合格数" prop="count_ok">
</el-table-column>
<el-table-column label="产品编号" prop="number">
</el-table-column>
<!-- <el-table-column label="产品编号" prop="number">
</el-table-column> -->
</el-table>
</el-card>
</el-col>
@ -44,6 +63,7 @@
<script>
import scEcharts from '@/components/scEcharts';
const xAxisData = ['平头','粘头','粗磨','中磨','细磨','抛光','开槽','配管'];
export default {
name: 'chart',
components: {
@ -51,11 +71,13 @@
},
data() {
return {
query:{
type:'周',
search:''
},
typeOptions:['周','月','年'],
queryType:'月',
queryDate:'',
start_date:'',
end_date:'',
currentYear:'',
currentMonth:'',
typeOptions:['月','年'],
option: {
title: {
text: '本周生产数量',
@ -68,7 +90,7 @@
},
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
data:xAxisData
},
yAxis: {
type: 'value'
@ -85,13 +107,68 @@
}]
},
tableData:[
{id:1,date:'2023-12-11',name:'ZJ2-1',count_ok:200},
{id:1,date:'2023-12-11',name:'ZJ2-2',count_ok:200},
{id:1,date:'2023-12-11',name:'ZJ2-3',count_ok:200},
{id:1,date:'2023-12-11',name:'ZJ2-4',count_ok:200},
{id:1,process:'平头',date:'2023-12-11',name:'ZJ2-1',count_ok:200},
{id:1,process:'粘头',date:'2023-12-11',name:'ZJ2-2',count_ok:200},
{id:1,process:'粗磨',date:'2023-12-11',name:'ZJ2-3',count_ok:200},
{id:1,process:'中磨',date:'2023-12-11',name:'ZJ2-4',count_ok:200},
{id:1,process:'细磨',date:'2023-12-11',name:'ZJ2-1',count_ok:200},
{id:1,process:'抛光',date:'2023-12-11',name:'ZJ2-2',count_ok:200},
{id:1,process:'开槽',date:'2023-12-11',name:'ZJ2-3',count_ok:200},
{id:1,process:'配管',date:'2023-12-11',name:'ZJ2-4',count_ok:200},
],
}
},
mounted(){
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth()+1;
let days = new Date(year, month, 0).getDate();
this.currentYear = year;
this.currentMonth = month;
this.start_date =year+'-'+month+'-01';
this.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate();
this.queryDate = year+'-'+month;
this.getData6();
},
methods:{
queryTypeChange(value){
console.log(value)
this.queryDate = '';
},
getData6(){
let that = this;
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
let obj = {
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "6车间" },
};
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
console.log('6生产车间统计:',doInRes);
debugger;
});
},
handleQuery(){
if(this.queryDate!==''){
if(this.queryType=='月'){
this.start_date =this.queryDate+'-01';
let arr = this.queryDate.split('-');
this.end_date = this.queryDate+'-'+new Date(arr[0], arr[1], 0).getDate();
}else{
this.start_date = this.queryDate+'-01-01';
this.end_date = this.queryDate+'-12-31';
}
}else{
if(this.queryType=='月'){
this.start_date =this.currentYear+'-'+this.currentMonth+'-01';
this.end_date = this.currentYear+'-'+this.currentMonth+'-'+new Date(this.currentYear, this.currentMonth, 0).getDate();
}else{
this.start_date = this.currentYear+'-01-01';
this.end_date = this.currentYear+'-12-31';
}
}
this.getData6();
},
},
}
</script>

View File

@ -2,13 +2,32 @@
<el-container>
<el-header>
<div class="right-panel">
<el-select v-model="query.type" clearable>
<el-select v-model="queryType" clearable @change="queryTypeChange">
<el-option v-for="item in typeOptions"
:key="item"
:label="item"
:value="item">
:value="item"
>
</el-option>
</el-select>
<el-date-picker
v-if="queryType=='月'"
v-model="queryDate"
type="month"
placeholder="查询月期"
value-format="YYYY-MM"
style="width:100%"
>
</el-date-picker>
<el-date-picker
v-if="queryType=='年'"
v-model="queryDate"
type="year"
placeholder="查询年份"
value-format="YYYY"
style="width:100%"
>
</el-date-picker>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
</div>
</el-header>
@ -19,7 +38,7 @@
<scEcharts height="300px" :option="option1"></scEcharts>
</el-col>
<el-col :lg="16">
<el-table :data="tableData">
<el-table :data="tableData" show-summary>
<el-table-column label="日期" prop="date">
</el-table-column>
<el-table-column label="出料数" prop="name">
@ -52,7 +71,7 @@
<scEcharts height="300px" :option="option2"></scEcharts>
</el-col>
<el-col :lg="16">
<el-table :data="tableData">
<el-table :data="tableData" show-summary>
<el-table-column label="日期" prop="date">
</el-table-column>
<el-table-column label="出料数" prop="name">
@ -87,7 +106,7 @@
<scEcharts height="300px" :option="option3"></scEcharts>
</el-col>
<el-col :lg="16">
<el-table :data="tableData">
<el-table :data="tableData" show-summary>
<el-table-column label="日期" prop="date">
</el-table-column>
<el-table-column label="出料数" prop="name">
@ -129,10 +148,13 @@
},
data() {
return {
query:{type:'',
search:''
},
typeOptions:['周','月','年'],
queryType:'月',
queryDate:'',
start_date:'',
end_date:'',
currentYear:'',
currentMonth:'',
typeOptions:['月','年'],
option1: {
title: {
text: '7车间',
@ -149,7 +171,7 @@
center: ['50%', '60%'],
label: false,
data: [
{value: 500, name: '合格数'},
{value: 800, name: '合格数'},
{value: 5, name: '炸纹'},
{value: 2, name: '条纹'},
{value: 6, name: '气泡'},
@ -175,7 +197,7 @@
center: ['50%', '60%'],
label: false,
data: [
{value: 300, name: '合格数'},
{value: 800, name: '合格数'},
{value: 2, name: '条纹'},
{value: 5, name: '断裂'},
{value: 6, name: '偏壁'},
@ -201,7 +223,7 @@
center: ['50%', '60%'],
label: false,
data: [
{value: 300, name: '合格数'},
{value: 800, name: '合格数'},
{value: 5, name: '椭圆/弯曲'},
{value: 2, name: '条纹'},
{value: 6, name: '断裂'},
@ -213,15 +235,94 @@
}
]
},
tableData:[
{id:1,date:'2023-12-11',name:'ZJ2-1',count:300,count_ok:200,count_rate:66},
{id:1,date:'2023-12-11',name:'ZJ2-2',count:300,count_ok:200,count_rate:66},
{id:1,date:'2023-12-11',name:'ZJ2-3',countk:300,count_ok:200,count_rate:66},
{id:1,date:'2023-12-11',name:'ZJ2-4',count:300,count_ok:200,count_rate:66},
],
tableData1:[],
tableData2:[],
tableData3:[],
}
},
mounted(){
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth()+1;
let days = new Date(year, month, 0).getDate();
console.log(year,month,days)
this.currentYear = year;
this.currentMonth = month;
this.start_date =year+'-'+month+'-01';
this.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate();
this.getData();
this.getData7();
this.getData10();
},
methods:{
queryTypeChange(value){
console.log(value)
this.queryDate = '';
},
getData(){
let that = this;
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
let obj = {
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "6车间" },
};
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
console.log('退火车间统计:',doInRes);
debugger;
});
},
getData7(){
let that = this;
let obj = {
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "7车间" },
};
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
console.log('7生产车间统计:',doInRes);
debugger;
});
},
getData10(){
let that = this;
let obj = {
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "10·车间" },
};
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
console.log('10生产车间统计:',doInRes);
debugger;
});
},
handleQuery(){
if(this.queryDate!==''){
if(this.queryType=='月'){
this.start_date =this.queryDate+'-01';
let arr = this.queryDate.split('-');
this.end_date = this.queryDate+'-'+new Date(arr[0], arr[1], 0).getDate();
}else{
this.start_date = this.queryDate+'-01-01';
this.end_date = this.queryDate+'-12-31';
}
}else{
if(this.queryType=='月'){
this.start_date =this.currentYear+'-'+this.currentMonth+'-01';
this.end_date = this.currentYear+'-'+this.currentMonth+'-'+new Date(this.currentYear, this.currentMonth, 0).getDate();
}else{
this.start_date = this.currentYear+'-01-01';
this.end_date = this.currentYear+'-12-31';
}
}
this.getData();
this.getData7();
this.getData10();
},
},
}
</script>

View File

@ -1,18 +1,56 @@
<template>
<el-container>
<el-header>
<div class="right-panel">
<el-select v-model="queryType" clearable @change="queryTypeChange">
<el-option v-for="item in typeOptions"
:key="item"
:label="item"
:value="item"
>
</el-option>
</el-select>
<el-date-picker
v-if="queryType=='月'"
v-model="queryDate"
type="month"
placeholder="查询月期"
value-format="YYYY-MM"
style="width:100%"
>
</el-date-picker>
<el-date-picker
v-if="queryType=='年'"
v-model="queryDate"
type="year"
placeholder="查询年份"
value-format="YYYY"
style="width:100%"
>
</el-date-picker>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
</div>
</el-header>
<el-main>
<el-card shadow="never" style="margin-bottom: 8px;">
<el-header>
<div class="right-panel">
<h2>各工序检验</h2>
<el-select v-model="process" clearable @change="processChange">
<el-option v-for="item in processOption"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</div>
</el-header>
<el-row :gutter="15">
<el-col :lg="12">
<el-card shadow="never">
<scEcharts height="300px" :option="option3"></scEcharts>
</el-card>
<el-col :lg="8">
<scEcharts height="300px" :option="option1"></scEcharts>
</el-col>
<el-col :lg="12">
<el-card shadow="never">
<scEcharts height="300px" :option="option6"></scEcharts>
</el-card>
</el-col>
<el-col :lg="12">
<el-card shadow="never">
<el-col :lg="16">
<el-table :data="tableData">
<el-table-column type="index" width="50" />
<el-table-column label="日期" prop="date">
@ -24,37 +62,47 @@
<el-table-column label="合格数" prop="count_ok">
</el-table-column>
</el-table>
</el-card>
</el-col>
<el-col :lg="12">
<el-card shadow="never">
<el-table :data="tableData">
<el-table-column type="index" width="50" />
<el-table-column label="日期" prop="date">
</el-table-column>
<el-table-column label="规格" prop="name">
</el-table-column>
<el-table-column label="型号" prop="name">
</el-table-column>
<el-table-column label="合格数" prop="count_ok">
</el-table-column>
</el-table>
</el-card>
</el-col>
</el-row>
</el-card>
<el-card shadow="never" style="margin-bottom: 8px;">
<el-header>
<div class="right-panel">
<h2>成品检验</h2>
<el-select v-model="product" clearable @change="productChange">
<el-option v-for="item in productOption"
:key="item.id"
:label="item.material_.name"
:value="item.id"
>
</el-option>
</el-select>
</div>
</el-header>
<el-row :gutter="15">
<el-col :lg="8">
<scEcharts height="300px" :option="option2"></scEcharts>
</el-col>
<el-col :lg="16">
<el-table :data="tableData">
<el-table-column type="index" width="50" />
<el-table-column label="日期" prop="date">
</el-table-column>
<el-table-column label="规格" prop="name">
</el-table-column>
<el-table-column label="型号" prop="name">
</el-table-column>
<el-table-column label="合格数" prop="count_ok">
</el-table-column>
</el-table>
</el-col>
</el-row>
</el-card>
</el-main>
</el-container>
</template>
<script>
import scEcharts from '@/components/scEcharts';
/**
* 引入组件 @/components/scEcharts
* 组件内部会自动加载主题 @/components/scEcharts/echarts-theme-T.js
* 支持props包括 heightwidthoption
* 组件export百度Echarts所有方法使用方式: new scEcharts[fun]
*/
export default {
name: 'chart',
components: {
@ -62,67 +110,34 @@
},
data() {
return {
option: {
title: {
text: '管棒日合格率',
// subtext: '',
},
grid: {
top: '80px'
},
queryType:'月',
queryDate:'',
start_date:'',
end_date:'',
currentYear:'',
currentMonth:'',
typeOptions:['月','年'],
option1: {
tooltip: {
trigger: 'axis'
},
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [{
data: [120, 200, 150, 80, 70, 110, 130],
type: 'bar',
barWidth: '15px',
trigger: 'item'
},
series: [
{
data: [110, 180, 120, 120, 60, 90, 110],
type: 'bar',
barWidth: '15px',
}]
name: '访问来源',
type: 'pie',
radius: ['40%', '70%'],
center: ['50%', '60%'],
label: false,
data: [
{value: 1048, name: '合格数'},
{value: 735, name: '不合格一'},
{value: 580, name: '不合格二'},
{value: 484, name: '不合格三'}
]
}
]
},
option2: {
title: {
text: 'AVG日合格率',
// subtext: '',
},
grid: {
top: '80px'
},
tooltip: {
trigger: 'axis'
},
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [{
data: [120, 200, 150, 80, 70, 110, 130],
type: 'line',
},
{
data: [110, 180, 120, 120, 60, 90, 110],
type: 'line',
}]
},
option3: {
title: {
text: '棒不合格统计',
// subtext: '',
},
tooltip: {
trigger: 'item'
},
@ -134,98 +149,97 @@
center: ['50%', '60%'],
label: false,
data: [
{value: 1048, name: '搜索引擎'},
{value: 735, name: '直接访问'},
{value: 580, name: '邮件营销'},
{value: 484, name: '联盟广告'},
{value: 300, name: '视频广告'}
{value: 1048, name: '合格数'},
{value: 735, name: '不合格一'},
{value: 580, name: '不合格二'},
{value: 484, name: '不合格三'}
]
}
]
},
option4: {
title: {
text: '管棒月合格率',
// subtext: '',
},
grid: {
top: '80px'
},
tooltip: {
trigger: 'axis'
},
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [{
data: [120, 200, 150, 80, 70, 110, 130],
type: 'bar',
barWidth: '15px',
},
{
data: [110, 180, 120, 120, 60, 90, 110],
type: 'bar',
barWidth: '15px',
}]
},
option5: {
title: {
text: 'AVG月合格率',
// subtext: '',
},
grid: {
top: '80px'
},
tooltip: {
trigger: 'axis'
},
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [{
data: [120, 200, 150, 80, 70, 110, 130],
type: 'line',
},
{
data: [110, 180, 120, 120, 60, 90, 110],
type: 'line',
}]
},
option6: {
title: {
text: '管不合格统计',
// subtext: '',
},
tooltip: {
trigger: 'item'
},
series: [
{
name: '访问来源',
type: 'pie',
radius: ['40%', '70%'],
center: ['50%', '60%'],
label: false,
data: [
{value: 1048, name: '搜索引擎'},
{value: 735, name: '直接访问'},
{value: 580, name: '邮件营销'},
{value: 484, name: '联盟广告'},
{value: 300, name: '视频广告'}
]
}
]
process:'',
processOption:[],
product:'',
productOption:[],
}
},
mounted(){
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth()+1;
let days = new Date(year, month, 0).getDate();
console.log(year,month,days)
this.currentYear = year;
this.currentMonth = month;
this.start_date =year+'-'+month+'-01';
this.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate();
this.getProcess();
this.getProduct();
this.getData();
this.getProductData();
},
methods:{
queryTypeChange(value){
console.log(value)
this.queryDate = '';
},
getProcess(){
this.$API.mtm.process.list.req({cate:'粗加工',page:0}).then((res) => {
this.processOption = res;
});
},
processChange(){},
getProduct(){
this.$API.wpm.wmaterial.list.req({count__gte:1,material__type:10,page:0}).then((res) => {
this.productOption = res;
});
},
productChange(){},
getData(){
let that = this;
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
let obj = {
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "6车间" },
};
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
console.log('退火车间统计:',doInRes);
debugger;
});
},
getProductData(){
let that = this;
let obj = {
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "7车间" },
};
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
console.log('7生产车间统计:',doInRes);
debugger;
});
},
handleQuery(){
if(this.queryDate!==''){
if(this.queryType=='月'){
this.start_date =this.queryDate+'-01';
let arr = this.queryDate.split('-');
this.end_date = this.queryDate+'-'+new Date(arr[0], arr[1], 0).getDate();
}else{
this.start_date = this.queryDate+'-01-01';
this.end_date = this.queryDate+'-12-31';
}
}else{
if(this.queryType=='月'){
this.start_date =this.currentYear+'-'+this.currentMonth+'-01';
this.end_date = this.currentYear+'-'+this.currentMonth+'-'+new Date(this.currentYear, this.currentMonth, 0).getDate();
}else{
this.start_date = this.currentYear+'-01-01';
this.end_date = this.currentYear+'-12-31';
}
}
this.getData();
this.getProductData();
},
},
}
</script>

View File

@ -2,18 +2,36 @@
<el-container>
<el-header>
<div class="right-panel">
<el-select v-model="query.type" clearable>
<el-select v-model="queryType" clearable @change="queryTypeChange">
<el-option v-for="item in typeOptions"
:key="item"
:label="item"
:value="item">
:value="item"
>
</el-option>
</el-select>
<el-date-picker
v-if="queryType=='月'"
v-model="queryDate"
type="month"
placeholder="查询月期"
value-format="YYYY-MM"
style="width:100%"
>
</el-date-picker>
<el-date-picker
v-if="queryType=='年'"
v-model="queryDate"
type="year"
placeholder="查询年份"
value-format="YYYY"
style="width:100%"
>
</el-date-picker>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
</div>
</el-header>
<el-main>
<!-- <el-alert title="生产统计" type="success" style="margin-bottom:20px;"></el-alert> -->
<el-row :gutter="10">
<el-col :lg="8">
<el-card shadow="never">
@ -32,7 +50,7 @@
</el-col>
<el-col :lg="8">
<el-card shadow="never">
<el-table :data="tableData">
<el-table :data="tableData1">
<el-table-column type="index" width="50" />
<el-table-column label="任务编号" prop="number">
</el-table-column>
@ -40,14 +58,17 @@
</el-table-column>
<el-table-column label="完成数" prop="count_ok">
</el-table-column>
<el-table-column label="完成率" prop="count_rate">
<el-table-column label="完成率">
<template #default="scope">
{{ scope.row.count_ok/scope.row.count*100}}%
</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
<el-col :lg="8">
<el-card shadow="never">
<el-table :data="tableData">
<el-table :data="tableData2">
<el-table-column type="index" width="50" />
<el-table-column label="任务编号" prop="number">
</el-table-column>
@ -55,14 +76,17 @@
</el-table-column>
<el-table-column label="完成数" prop="count_ok">
</el-table-column>
<el-table-column label="完成率" prop="count_rate">
<el-table-column label="完成率">
<template #default="scope">
{{ scope.row.count_ok/scope.row.count*100}}%
</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
<el-col :lg="8">
<el-card shadow="never">
<el-table :data="tableData">
<el-table :data="tableData3">
<el-table-column type="index" width="50" />
<el-table-column label="任务编号" prop="number">
</el-table-column>
@ -70,7 +94,10 @@
</el-table-column>
<el-table-column label="完成数" prop="count_ok">
</el-table-column>
<el-table-column label="完成率" prop="count_rate">
<el-table-column label="完成率">
<template #default="scope">
{{ scope.row.count_ok/scope.row.count*100}}%
</template>
</el-table-column>
</el-table>
</el-card>
@ -79,17 +106,8 @@
</el-main>
</el-container>
</template>
<script>
import scEcharts from '@/components/scEcharts';
/**
* 引入组件 @/components/scEcharts
* 组件内部会自动加载主题 @/components/scEcharts/echarts-theme-T.js
* 支持props包括 heightwidthoption
* 组件export百度Echarts所有方法使用方式: new scEcharts[fun]
*/
export default {
name: 'chart',
components: {
@ -97,20 +115,23 @@
},
data() {
return {
query:{type:'',
search:''
},
typeOptions:['周','月','年'],
queryType:'月',
queryDate:'',
start_date:'',
end_date:'',
currentYear:'',
currentMonth:'',
xAxisData:['第一周','第二周','第三周','第四周'],
typeOptions:['月','年'],
option1: {
title: {
text: '7车间',
text: '7车间完成率',
},
tooltip: {
trigger: 'item'
},
color:['rgb(64,158,255)','orange'],
series: [
{
series: {
name: '7车间完成率',
type: 'pie',
radius: ['40%', '70%'],
@ -121,7 +142,6 @@
{value: 3, name: '未完成'},
]
}
]
},
option2: {
title: {
@ -132,9 +152,8 @@
trigger: 'item'
},
color:['rgb(64,158,255)','orange'],
series: [
{
name: '访问来源',
series: {
name: '10车间完成率',
type: 'pie',
radius: ['40%', '70%'],
center: ['50%', '60%'],
@ -144,7 +163,6 @@
{value: 3, name: '未完成'},
]
}
]
},
option3: {
title: {
@ -154,9 +172,8 @@
trigger: 'item'
},
color:['rgb(64,158,255)','orange'],
series: [
{
name: '访问来源',
series: {
name: '6车间完成率',
type: 'pie',
radius: ['40%', '70%'],
center: ['50%', '60%'],
@ -166,16 +183,132 @@
{value: 3, name: '未完成'},
]
}
]
},
tableData:[
{id:1,number:'20231210',count:300,count_rate:83,count_ok:250},
{id:1,number:'20231211',count:300,count_rate:66,count_ok:200},
{id:1,number:'20231212',count:300,count_rate:93,count_ok:280},
{id:1,number:'20231213',count:300,count_rate:0,count_ok:0},
],
// tableData:[
// {id:1,number:'20231210',count:300,count_rate:83,count_ok:250},
// {id:1,number:'20231211',count:300,count_rate:66,count_ok:200},
// {id:1,number:'20231212',count:300,count_rate:93,count_ok:280},
// {id:1,number:'20231213',count:300,count_rate:0,count_ok:0},
// ],
tableData1:[],
tableData2:[],
tableData3:[],
}
},
mounted(){
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth()+1;
let days = new Date(year, month, 0).getDate();
this.currentYear = year;
this.currentMonth = month;
this.start_date =year+'-'+month+'-01';
this.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate();
this.queryDate = year+'-'+month;
this.getData6();
this.getData7();
this.getData10();
},
methods:{
queryTypeChange(){
this.queryDate = '';
},
getData6(){
let that = this;
let obj={};
obj.belong_dept__name = '6车间';
obj.start_date__gte = this.start_date;
obj.end_date__lte = this.end_date;
that.$API.pm.utask.list.req( obj).then((res) => {
console.log('utask:',res);
this.tableData1 = res.results;
let count_ok1 = 0;
let count_notok1 = 0;
res.results.forEach(item => {
if(item.count_ok>=item.count){
count_ok1++;
}else{
count_notok1++;
}
});
this.option1.series.data[0].value = count_ok1;
this.option1.series.data[1].value = count_notok1;
});
},
getData7(){
let that = this;
let obj={};
obj.belong_dept__name = '7车间';
obj.start_date__gte = this.start_date;
obj.end_date__lte = this.end_date;
that.$API.pm.utask.list.req( obj).then((res) => {
console.log('utask:',res);
this.tableData2 = res.results;
let count_ok2 = 0;
let count_notok2 = 0;
res.results.forEach(item => {
if(item.count_ok>=item.count){
count_ok2++;
}else{
count_notok2++;
}
});
this.option2.series.data[0].value = count_ok2;
this.option2.series.data[1].value = count_notok2;
});
},
getData10(){
let that = this;
let obj={};
obj.belong_dept__name = '10车间';
obj.start_date__gte = this.start_date;
obj.end_date__lte = this.end_date;
that.$API.pm.utask.list.req( obj).then((res) => {
console.log('utask:',res);
this.tableData3 = res.results;
let count_ok3 = 0;
let count_notok3 = 0;
res.results.forEach(item => {
if(item.count_ok>=item.count){
count_ok3++;
}else{
count_notok3++;
}
});
this.option3.series.data[0].value = count_ok3;
this.option3.series.data[1].value = count_notok3;
});
},
handleQuery(){
if(this.queryDate!==''){
if(this.queryType=='月'){
this.xAxisData = ['第一周','第二周','第三周','第四周'];
this.start_date =this.queryDate+'-01';
let arr = this.queryDate.split('-');
this.end_date = this.queryDate+'-'+new Date(arr[0], arr[1], 0).getDate();
}else{
this.start_date = this.queryDate+'-01-01';
this.end_date = this.queryDate+'-12-31';
this.xAxisData = ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月']
}
}else{
if(this.queryType=='月'){
this.xAxisData = ['第一周','第二周','第三周','第四周'];
this.start_date =this.currentYear+'-'+this.currentMonth+'-01';
this.end_date = this.currentYear+'-'+this.currentMonth+'-'+new Date(this.currentYear, this.currentMonth, 0).getDate();
}else{
this.start_date = this.currentYear+'-01-01';
this.end_date = this.currentYear+'-12-31';
this.xAxisData = ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月']
}
}
debugger;
console.log(this.query)
this.getData6();
this.getData7();
this.getData10();
},
},
}
</script>

View File

@ -1,35 +1,66 @@
<template>
<el-container>
<el-header>
<div class="right-panel">
<el-select v-model="queryType" clearable @change="queryTypeChange">
<el-option v-for="item in typeOptions"
:key="item"
:label="item"
:value="item"
>
</el-option>
</el-select>
<el-date-picker
v-if="queryType=='月'"
v-model="queryDate"
type="month"
placeholder="查询月期"
value-format="YYYY-MM"
style="width:100%"
>
</el-date-picker>
<el-date-picker
v-if="queryType=='年'"
v-model="queryDate"
type="year"
placeholder="查询年份"
value-format="YYYY"
style="width:100%"
>
</el-date-picker>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
</div>
</el-header>
<el-main>
<el-row :gutter="15">
<el-col :lg="8">
<el-col :lg="12">
<el-card shadow="never">
<scEcharts height="300px" :option="option"></scEcharts>
</el-card>
</el-col>
<el-col :lg="8">
<el-col :lg="12">
<el-card shadow="never">
<scEcharts height="300px" :option="option2"></scEcharts>
</el-card>
</el-col>
<el-col :lg="8">
<el-card shadow="never">
<scEcharts height="300px" :option="option3"></scEcharts>
<el-table :data="tableData">
<el-table-column label="日期" prop="date">
</el-table-column>
<el-table-column label="人员名称" prop="name">
</el-table-column>
<el-table-column label="工序" prop="name">
</el-table-column>
<el-table-column label="车间" prop="count_ok">
</el-table-column>
<el-table-column label="合格数" prop="count_ok">
</el-table-column>
</el-table>
</el-card>
</el-col>
</el-row>
</el-main>
</el-container>
</template>
<script>
import scEcharts from '@/components/scEcharts';
/**
* 引入组件 @/components/scEcharts
* 组件内部会自动加载主题 @/components/scEcharts/echarts-theme-T.js
* 支持props包括 heightwidthoption
* 组件export百度Echarts所有方法使用方式: new scEcharts[fun]
*/
export default {
name: 'chart',
components: {
@ -37,9 +68,16 @@
},
data() {
return {
queryType:'月',
queryDate:'',
start_date:'',
end_date:'',
currentYear:'',
currentMonth:'',
typeOptions:['月','年'],
option: {
title: {
text: '管棒日合格率',
text: '人员统计',
// subtext: '',
},
grid: {
@ -49,77 +87,112 @@
trigger: 'axis'
},
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
type: 'value',
position:'top',
axisLine:{
show:true
}
},
yAxis: {
type: 'value'
},
series: [{
data: [120, 200, 150, 80, 70, 110, 130],
type: 'bar',
barWidth: '15px',
},
{
data: [110, 180, 120, 120, 60, 90, 110],
type: 'bar',
barWidth: '15px',
}]
},
option2: {
title: {
text: 'AVG日合格率',
// subtext: '',
},
grid: {
top: '80px'
},
tooltip: {
trigger: 'axis'
},
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
data: ['张良', '钱勇', '赵丽丽', '王军', '孙聪', '李超', '周年宋']
},
yAxis: {
type: 'value'
},
series: [{
data: [120, 200, 150, 80, 70, 110, 130],
type: 'line',
},
{
data: [110, 180, 120, 120, 60, 90, 110],
type: 'line',
}]
},
option3: {
title: {
text: '棒不合格统计',
// subtext: '',
},
tooltip: {
trigger: 'item'
},
series: [
{
name: '访问来源',
type: 'pie',
radius: ['40%', '70%'],
center: ['50%', '60%'],
label: false,
data: [
{value: 1048, name: '搜索引擎'},
{value: 735, name: '直接访问'},
{value: 580, name: '邮件营销'},
{value: 484, name: '联盟广告'},
{value: 300, name: '视频广告'}
]
}
]
series: {
data: [300, 290, 320, 350, 310, 350, 290],
type: 'bar',
barWidth: '15px',
}
},
}
},
mounted(){
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth()+1;
let days = new Date(year, month, 0).getDate();
this.currentYear = year;
this.currentMonth = month;
this.start_date =year+'-'+month+'-01';
this.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate();
this.queryDate = year+'-'+month;
this.getData6();
this.getData7();
this.getData10();
},
methods:{
queryTypeChange(value){
console.log(value)
this.queryDate = '';
if(value=='月'){
this.xAxisData = ['第一周','第二周','第三周','第四周'];
}else{
this.xAxisData = ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月']
}
this.option.xAxis.data = this.xAxisData;
this.option2.xAxis.data = this.xAxisData;
this.option3.xAxis.data = this.xAxisData;
this.option4.xAxis.data = this.xAxisData;
},
getData6(){
let that = this;
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
let obj = {
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "6车间" },
};
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
console.log('6生产车间统计:',doInRes);
debugger;
});
},
getData7(){
let that = this;
let obj = {
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "7车间" },
};
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
console.log('7生产车间统计:',doInRes);
debugger;
});
},
getData10(){
let that = this;
let obj = {
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "10·车间" },
};
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
console.log('10生产车间统计:',doInRes);
debugger;
});
},
handleQuery(){
if(this.queryDate!==''){
if(this.queryType=='月'){
this.start_date =this.queryDate+'-01';
let arr = this.queryDate.split('-');
this.end_date = this.queryDate+'-'+new Date(arr[0], arr[1], 0).getDate();
}else{
this.start_date = this.queryDate+'-01-01';
this.end_date = this.queryDate+'-12-31';
}
}else{
if(this.queryType=='月'){
this.start_date =this.currentYear+'-'+this.currentMonth+'-01';
this.end_date = this.currentYear+'-'+this.currentMonth+'-'+new Date(this.currentYear, this.currentMonth, 0).getDate();
}else{
this.start_date = this.currentYear+'-01-01';
this.end_date = this.currentYear+'-12-31';
}
}
debugger;
console.log(this.query)
this.getData6();
this.getData7();
this.getData10();
},
},
}
</script>

View File

@ -133,10 +133,13 @@
<el-link type="primary" @click="table_edit(scope.row)"
v-auth="'mlog.update'" v-if="scope.row.submit_time == null">编辑
</el-link>
<el-divider direction="vertical"></el-divider>
<el-link type="primary" @click="table_del(scope.row)" v-auth="'mlog.delete'"
<!-- <el-divider direction="vertical"></el-divider> -->
<el-link type="danger" @click="table_del(scope.row)" v-auth="'mlog.delete'"
v-if="scope.row.submit_time == null">删除
</el-link>
<el-button link type="success" @click="table_show(scope.row)">
日志记录
</el-button>
</template>
</el-table-column>
</scTable>
@ -201,7 +204,7 @@
</div>
<div class="right-panel">
<el-button type="primary" @click="tomio" v-auth="'mio.do'">领料</el-button>
<el-button type="primary" @click="tomio" v-auth="'mio.do'">入库</el-button>
<el-button type="primary" @click="tomioin" v-auth="'mio.do'">入库</el-button>
</div>
</el-header>
<el-main>
@ -242,13 +245,19 @@
@success="handleSaveSuccess"
@closed="dialogSave = false"
></save-dialog>
<showDrawer ref="showDrawer"
v-if="visibleDrawer"
:mlogId="mlogId"
@closed="visibleDrawer = false">
</showDrawer>
</el-container>
</template>
<script>
import saveDialog from "./worktask_form.vue";
import showDrawer from "./mlog_drawer.vue";
export default {
components: {
saveDialog,
saveDialog,showDrawer
},
data() {
return {
@ -266,13 +275,16 @@ export default {
40: "已提交",
},
brothersList:[],
brothersListorigin:[],
apiObjHandover: null,
apiObjWm: null,
visibleDrawer:false,
dialogSave:false,
paramsHandover: {},
paramsWm: {},
mtask:'',
mgroup:'',
mlogId:'',
material_out:''
}
},
@ -281,7 +293,10 @@ export default {
},
methods: {
tomio() {
this.$router.push({ name: "mio" });
this.$router.push({ name: "mainso_mio" });
},
tomioin(){
this.$router.push({ name: "halfgood_mio" });
},
initDept() {
this.$API.system.dept.list.req({ page: 0, name: '10车间' }).then(res => {
@ -311,24 +326,32 @@ export default {
})
},
getMlogs(mtaskId) {
this.$API.wpm.mlog.list.req({ mtask: mtaskId, page: 0 }).then(res => {
getMlogs() {
this.$API.wpm.mlog.list.req({ mtask: this.mtask, page: 0 }).then(res => {
this.mlogs = res
})
},
mtaskClick(row) {
this.currentMtask = row;
this.mtask = row.id;
this.brothersList = row.material_out_.brothers;
this.getMlogs(row.id)
this.brothersListorigin=[];
this.brothersListorigin = this.currentMtask.material_out_.brothers;
this.getMlogs()
},
addMlog(){
let that = this;
console.log(that.currentMtask);
debugger;
if (that.currentMtask && that.currentMtask.id) {
that.mgroup = that.currentMtask.mgroup;
that.material_out = that.currentMtask.material_out;
let arr = [];
this.brothersList =[];
this.brothersListorigin.forEach(item=>{
let obj = {};
obj.count_ok = null;
obj.material_out = item;
arr.push(obj)
})
this.brothersList = arr;
that.dialogSave = true;
that.$nextTick(() => {
that.$refs.saveDialog.open("add");
@ -347,7 +370,52 @@ export default {
}).catch(err => {
})
},
table_show(row) {
this.mlogId = row.id;
this.visibleDrawer = true;
this.$nextTick(() => {
this.$refs.showDrawer.open();
});
},
table_edit(row){
let arr = [];
let mlogb = row.mlogb;
this.brothersListorigin.forEach(item=>{
let obj = {};
obj.count_ok = null;
obj.material_out = item;
for(let i=0;i<mlogb.length;i++){
if(mlogb[i].material_out==item){
obj.count_ok = mlogb[i].count_ok;
}
}
arr.push(obj)
})
this.brothersList = arr;
this.dialogSave = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("edit").setData(row);
});
},
//
table_del(row) {
let that = this;
this.$confirm(`确定删除吗?`, "提示", {
type: "warning",
}).then(() => {
that.$API.wpm.mlog.delete.req(row.id).then((res) => {
that.$message.success("删除成功");
that.getMlogs();
return res;
}).catch((err) => {
return err;
});
}).catch(() => { });
},
handleSaveSuccess(){
this.getMlogs();
},
}
}
</script>

View File

@ -156,7 +156,7 @@ export default {
},
methods: {
tomio() {
this.$router.push({ name: "mio" });
this.$router.push({ name: "halfgood_mio" });
},
//
rowClick(row) {

View File

@ -60,6 +60,9 @@
<el-button link type="primary" @click="table_edit(scope.row)">
编辑
</el-button>
<el-link type="danger" @click="table_del(scope.row)" v-auth="'mlog.delete'"
v-if="scope.row.submit_time == null">删除
</el-link>
<el-button link type="success" @click="table_show(scope.row)">
日志记录
</el-button>
@ -81,6 +84,7 @@
></save-dialog>
<showDrawer ref="showDrawer"
v-if="visibleDrawer"
:mlogId="mlogId"
@closed="visibleDrawer = false">
</showDrawer>
</el-container>
@ -109,6 +113,7 @@ export default {
params:{
mtask:''
},
mlogId:'',
handledate:'',
dialogSave:false,
visibleDrawer:false,
@ -136,6 +141,7 @@ export default {
},
table_show(row) {
this.visibleDrawer = true;
this.mlogId = row.id;
this.$nextTick(() => {
this.$refs.showDrawer.open();
});
@ -162,11 +168,11 @@ export default {
});
},
//
async table_del(row) {
table_del(row) {
this.$confirm(`确定删除吗?`, "提示", {
type: "warning",
}).then(() => {
this.$API.pm.mtask.delete.req(row.id).then((res) => {
this.$API.wpm.mlog.delete.req(row.id).then((res) => {
this.$message.success("删除成功");
return res;
}).catch((err) => {

View File

@ -139,10 +139,13 @@
<el-link type="primary" @click="table_edit(scope.row)"
v-auth="'mlog.update'" v-if="scope.row.submit_time == null">编辑
</el-link>
<el-divider direction="vertical"></el-divider>
<el-link type="primary" @click="table_del(scope.row)" v-auth="'mlog.delete'"
<!-- <el-divider direction="vertical"></el-divider> -->
<el-link type="danger" @click="table_del(scope.row)" v-auth="'mlog.delete'"
v-if="scope.row.submit_time == null">删除
</el-link>
<el-button link type="success" @click="table_show(scope.row)">
日志记录
</el-button>
</template>
</el-table-column>
</scTable>
@ -209,7 +212,7 @@
</div>
<div class="right-panel">
<el-button type="primary" @click="tomio" v-auth="'mio.do'">领料</el-button>
<el-button type="primary" @click="tomio" v-auth="'mio.do'">入库</el-button>
<el-button type="primary" @click="tomioin" v-auth="'mio.do'">入库</el-button>
</div>
</el-header>
<el-main>
@ -249,13 +252,19 @@
@success="handleSaveSuccess"
@closed="dialogSave = false"
></save-dialog>
<showDrawer ref="showDrawer"
v-if="visibleDrawer"
:mlogId="mlogId"
@closed="visibleDrawer = false">
</showDrawer>
</el-container>
</template>
<script>
import saveDialog from "./worktask_form.vue";
import showDrawer from "./mlog_drawer.vue";
export default {
components: {
saveDialog,
saveDialog,showDrawer
},
data() {
return {
@ -272,11 +281,13 @@ export default {
40: "已提交",
},
dialogSave:false,
visibleDrawer:false,
apiObjHandover: null,
paramsHandover: {},
apiObjWm: null,
paramsWm: {},
mlogs:[],
mlogId:'',
mtask:'',
mgroup:'',
material_out:''
@ -287,7 +298,10 @@ export default {
},
methods: {
tomio() {
this.$router.push({ name: "mio" });
this.$router.push({ name: "mainso_mio" });
},
tomioin(){
this.$router.push({ name: "halfgood_mio" });
},
//
addMlog() {
@ -305,6 +319,27 @@ export default {
that.$message.warning("请选择任务");
}
},
table_edit(row){
this.dialogSave = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("edit").setData(row);
});
},
//
table_del(row) {
let that = this;
this.$confirm(`确定删除吗?`, "提示", {
type: "warning",
}).then(() => {
that.$API.wpm.mlog.delete.req(row.id).then((res) => {
that.$message.success("删除成功");
that.getMlogs();
return res;
}).catch((err) => {
return err;
});
}).catch(() => { });
},
initDept() {
this.$API.system.dept.list.req({ page: 0, name: '7车间' }).then(res => {
if (res.length == 1) {
@ -333,15 +368,15 @@ export default {
})
},
getMlogs(mtaskId) {
this.$API.wpm.mlog.list.req({ mtask: mtaskId, page: 0 }).then(res => {
getMlogs() {
this.$API.wpm.mlog.list.req({ mtask: this.mtask, page: 0 }).then(res => {
this.mlogs = res
})
},
mtaskClick(row) {
this.currentMtask = row;
this.mtask = row.id;
this.getMlogs(row.id)
this.getMlogs()
},
table_submit(row) {
this.$API.pm.mtask.submit.req(row.id).then(res => {
@ -354,7 +389,16 @@ export default {
})
},
handleSaveSuccess(){},
handleSaveSuccess(){
this.getMlogs();
},
table_show(row) {
this.mlogId = row.id;
this.visibleDrawer = true;
this.$nextTick(() => {
this.$refs.showDrawer.open();
});
},
}
}
</script>

View File

@ -3,12 +3,20 @@
<el-container>
<el-main>
<scTable ref="drawer_table" :apiObj="apiObj" row-key="id" stripe :params="paramsObj">
<el-table-column type="index" fixed="left" width="40" />
<!-- <el-table-column type="index" fixed="left" width="40" /> -->
<el-table-column label="变更时间" fixed="left">
<template #default="scope">
<span>{{scope.row.change_time.slice(0, -3)}}</span>
</template>
</el-table-column>
<el-table-column label="变更类型" fixed="left">
<template #default="scope">
<span v-if="scope.row.action=='create'">新建</span>
<span v-if="scope.row.action=='update'">更改</span>
</template>
</el-table-column>
<el-table-column label="变更人" fixed="left" prop="change_user_name">
</el-table-column>
<el-table-column label="工序">
<template #default="scope">
<span v-if="scope.row.val_new">{{scope.row.val_new.mgroup_name}}</span>
@ -86,11 +94,6 @@
</template>
</el-table-column>
</el-table-column>
<el-table-column label="操作人">
<template #default="scope">
<span v-if="scope.row.val_new">{{scope.row.val_new.handle_user_name}}</span>
</template>
</el-table-column>
</scTable>
</el-main>
</el-container>
@ -100,12 +103,16 @@
export default {
emits: ["closed"],
props: {
mlogId:{ type: String, default:''}
},
data() {
return {
visible: false,
apiObj: this.$API.ops.logs.audit,
paramsObj: {},
apiObj: null,
paramsObj: {
model_name:'wpm.mlog',
instance_id:''
},
state_: {
10: "创建中",
14: "已分解",
@ -116,6 +123,10 @@ export default {
}
},
mounted() {
debugger;
console.log(this.mlogId)
this.paramsObj.instance_id = this.mlogId;
this.apiObj = this.$API.ops.logs.audit;
},
methods: {
handleMtaskQuery() {

View File

@ -1057,11 +1057,9 @@ export default {
};
},
mounted() {
//
// let materialObj = this.$TOOL.data.get('MATERIAL_OBJECT');
// this.materialObj = materialObj;
// this.form.material_out = materialObj.id;
this.getMaterial(0);
console.log('brothersList')
console.log(this.brothersList)
this.getMaterial();
this.getMgroupList();
this.getUserList();
this.getEquipment();
@ -1075,18 +1073,19 @@ export default {
this.form.mgroup = this.mgroup;
this.form.handle_date = year + "-" + month + "-" + day;
if (this.activeType == "10车间") {
if (this.mode == "add") {
let mlogb = [];
if (this.brothersList && this.brothersList.length > 0) {
this.brothersList.forEach((item) => {
let obj = {};
obj.material_out = item;
obj.count_ok = null;
obj.material_out = item.material_out;
obj.count_ok = item.count_ok;
mlogb.push(obj);
});
}
this.mlogb = mlogb;
}
if(this.activeType == "10车间"){
this.getMaterial(0);
}else{
this.getMaterial(this.mgroup);
}
},
methods: {
@ -1144,9 +1143,6 @@ export default {
this.$API.mtm.mgroup.list
.req({ page: 0, belong_dept__name: activeDeptName })
.then((res) => {
// let data = res.filter(item => {
// return item.process_cate == ''
// })
that.mgroupOptions = res;
});
},
@ -1326,7 +1322,6 @@ export default {
//
setData(data) {
Object.assign(this.form, data);
this.getMaterial(this.form.mgroup);
this.getRouteOptions();
if (this.activeType == "8车间") {
if (this.form.handle_user.indexOf(",") > -1) {