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

View File

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

View File

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

View File

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

View File

@ -1,50 +1,121 @@
<template> <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-main>
<el-card shadow="never" style="margin-bottom: 8px;">
<el-row :gutter="15"> <el-row :gutter="15">
<el-col :lg="8"> <el-col :lg="8">
<el-card shadow="never"> <el-card shadow="never">
<scEcharts height="300px" :option="option"></scEcharts> <scEcharts height="300px" :option="option1"></scEcharts>
</el-card> </el-card>
</el-col> </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-col :lg="8">
<el-card shadow="never"> <el-card shadow="never">
<scEcharts height="300px" :option="option2"></scEcharts> <scEcharts height="300px" :option="option1"></scEcharts>
</el-card> </el-card>
</el-col> </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-col :lg="8">
<el-card shadow="never"> <el-card shadow="never">
<scEcharts height="300px" :option="option3"></scEcharts> <scEcharts height="300px" :option="option3"></scEcharts>
</el-card> </el-card>
</el-col> </el-col>
<el-col :lg="8"> <el-col :lg="16">
<el-card shadow="never"> <el-card shadow="never">
<scEcharts height="300px" :option="option4"></scEcharts> <el-table :data="tableData">
</el-card> <el-table-column type="index" width="50" />
</el-col> <el-table-column label="日期" prop="date">
<el-col :lg="8"> </el-table-column>
<el-card shadow="never"> <el-table-column label="批次号" prop="name">
<scEcharts height="300px" :option="option5"></scEcharts> </el-table-column>
</el-card> <el-table-column label="总数" prop="name">
</el-col> </el-table-column>
<el-col :lg="8"> <el-table-column label="抽检署" prop="name">
<el-card shadow="never"> </el-table-column>
<scEcharts height="300px" :option="option6"></scEcharts> <el-table-column label="合格判定" prop="count_ok">
</el-table-column>
</el-table>
</el-card> </el-card>
</el-col> </el-col>
</el-row> </el-row>
</el-card>
</el-main> </el-main>
</el-container>
</template> </template>
<script> <script>
import scEcharts from '@/components/scEcharts'; import scEcharts from '@/components/scEcharts';
/**
* 引入组件 @/components/scEcharts
* 组件内部会自动加载主题 @/components/scEcharts/echarts-theme-T.js
* 支持props包括 heightwidthoption
* 组件export百度Echarts所有方法使用方式: new scEcharts[fun]
*/
export default { export default {
name: 'chart', name: 'chart',
components: { components: {
@ -52,65 +123,60 @@
}, },
data() { data() {
return { return {
option: { queryType:'月',
queryDate:'',
start_date:'',
end_date:'',
currentYear:'',
currentMonth:'',
typeOptions:['月','年'],
option1: {
title: { title: {
text: '管棒日合格率', text: '预制棒',
// subtext: '', // subtext: '',
}, },
grid: {
top: '80px'
},
tooltip: { tooltip: {
trigger: 'axis' trigger: 'item'
},
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',
}, },
series: [
{ {
data: [110, 180, 120, 120, 60, 90, 110], name: '预制棒',
type: 'bar', type: 'pie',
barWidth: '15px', radius: ['40%', '70%'],
}] center: ['50%', '60%'],
label: false,
data: [
{value: 10, name: '合格数'},
{value: 1, name: '不合格数'},
]
}
]
}, },
option2: { option2: {
title: { title: {
text: 'AVG日合格率', text: '预制管',
// subtext: '', // subtext: '',
}, },
grid: {
top: '80px'
},
tooltip: { tooltip: {
trigger: 'axis' trigger: 'item'
},
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',
}, },
series: [
{ {
data: [110, 180, 120, 120, 60, 90, 110], name: '预制管',
type: 'line', type: 'pie',
}] radius: ['40%', '70%'],
center: ['50%', '60%'],
label: false,
data: [
{value: 10, name: '合格数'},
{value: 1, name: '不合格数'},
]
}
]
}, },
option3: { option3: {
title: { title: {
text: '棒不合格统计', text: 'AVG',
// subtext: '', // subtext: '',
}, },
tooltip: { tooltip: {
@ -118,104 +184,108 @@
}, },
series: [ series: [
{ {
name: '访问来源', name: 'AVG',
type: 'pie', type: 'pie',
radius: ['40%', '70%'], radius: ['40%', '70%'],
center: ['50%', '60%'], center: ['50%', '60%'],
label: false, label: false,
data: [ data: [
{value: 1048, name: '搜索引擎'}, {value: 10, name: '合格数'},
{value: 735, name: '直接访问'}, {value: 1, 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: '视频广告'}
] ]
} }
] ]
} }
} }
},
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> </script>

View File

@ -1,32 +1,121 @@
<template> <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-main>
<el-card shadow="never" style="margin-bottom: 8px;">
<el-row :gutter="15"> <el-row :gutter="15">
<el-col :lg="8"> <el-col :lg="8">
<el-card shadow="never"> <el-card shadow="never">
<scEcharts height="300px" :option="option1"></scEcharts> <scEcharts height="300px" :option="option1"></scEcharts>
</el-card> </el-card>
</el-col> </el-col>
<el-col :lg="16">
<el-col :lg="8">
<el-card shadow="never"> <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-card>
</el-col> </el-col>
</el-row> </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-main>
</el-container>
</template> </template>
<script> <script>
import scEcharts from '@/components/scEcharts'; import scEcharts from '@/components/scEcharts';
/**
* 引入组件 @/components/scEcharts
* 组件内部会自动加载主题 @/components/scEcharts/echarts-theme-T.js
* 支持props包括 heightwidthoption
* 组件export百度Echarts所有方法使用方式: new scEcharts[fun]
*/
export default { export default {
name: 'chart', name: 'chart',
components: { components: {
@ -34,6 +123,13 @@
}, },
data() { data() {
return { return {
queryType:'月',
queryDate:'',
start_date:'',
end_date:'',
currentYear:'',
currentMonth:'',
typeOptions:['月','年'],
option1: { option1: {
title: { title: {
text: '预制棒', 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> </script>

View File

@ -1,45 +1,112 @@
<template> <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-main>
<el-row :gutter="15"> <el-row :gutter="15">
<el-col :lg="8"> <el-col :lg="12">
<el-card shadow="never"> <el-card shadow="never" style="margin-bottom: 8px;">
<scEcharts height="300px" :option="option"></scEcharts> <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-card>
</el-col> </el-col>
<el-col :lg="8"> <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> <scEcharts height="300px" :option="option2"></scEcharts>
</el-card>
</el-col> </el-col>
<el-col :lg="8"> <el-col>
<el-card shadow="never"> <el-table :data="tableData">
<scEcharts height="300px" :option="option3"></scEcharts> <el-table-column type="index" width="50" />
</el-card> <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>
<el-col :lg="12"> </el-row>
<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-card> </el-card>
</el-col> </el-col>
</el-row> </el-row>
</el-main> </el-main>
</el-container>
</template> </template>
<script> <script>
import scEcharts from '@/components/scEcharts'; import scEcharts from '@/components/scEcharts';
const xAxisData = ['第一周','第二周','第三周','第四周'];
/**
* 引入组件 @/components/scEcharts
* 组件内部会自动加载主题 @/components/scEcharts/echarts-theme-T.js
* 支持props包括 heightwidthoption
* 组件export百度Echarts所有方法使用方式: new scEcharts[fun]
*/
export default { export default {
name: 'chart', name: 'chart',
components: { components: {
@ -47,11 +114,15 @@
}, },
data() { data() {
return { return {
option: { queryType:'月',
title: { queryDate:'',
text: '主要原材料消耗', start_date:'',
// subtext: '', end_date:'',
}, currentYear:'',
currentMonth:'',
xAxisData:['第一周','第二周','第三周','第四周'],
typeOptions:['月','年'],
option1: {
grid: { grid: {
top: '80px' top: '80px'
}, },
@ -60,7 +131,7 @@
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] data:xAxisData
}, },
yAxis: { yAxis: {
type: 'value' type: 'value'
@ -77,10 +148,6 @@
}] }]
}, },
option2: { option2: {
title: {
text: '办公用品统计',
// subtext: '',
},
grid: { grid: {
top: '80px' top: '80px'
}, },
@ -89,59 +156,7 @@
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] data: xAxisData
},
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']
}, },
yAxis: { yAxis: {
type: 'value' type: 'value'
@ -150,42 +165,105 @@
data: [120, 200, 150, 80, 70, 110, 130], data: [120, 200, 150, 80, 70, 110, 130],
type: 'bar', type: 'bar',
barWidth: '15px', barWidth: '15px',
},
{
data: [110, 180, 120, 120, 60, 90, 110],
type: 'bar',
barWidth: '15px',
}] }]
}, },
option5: { tableData:[
title: { {id:1,date:'2023-12-11',name:'ZJ2-1',count:200},
text: '辅助材料统计', {id:1,date:'2023-12-11',name:'ZJ2-2',count:200},
// subtext: '', {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: { mounted(){
top: '80px' 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: { methods:{
trigger: 'axis' 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: { getData6(){
type: 'category', let that = this;
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] 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: { getData7(){
type: 'value' 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: [{ getData10(){
data: [120, 200, 150, 80, 70, 110, 130], let that = this;
type: 'line', 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(){
data: [110, 180, 120, 120, 60, 90, 110], if(this.queryDate!==''){
type: 'line', 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> </script>

View File

@ -1,22 +1,112 @@
<template> <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-main>
<el-row :gutter="15"> <el-row :gutter="15">
<el-col :lg="12"> <el-col :lg="12">
<el-card shadow="never"> <el-card shadow="never" style="margin-bottom: 8px;">
<scEcharts height="300px" :option="option1"></scEcharts> <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-card>
</el-col> </el-col>
<el-col :lg="12"> <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> <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-card>
</el-col> </el-col>
</el-row> </el-row>
</el-main> </el-main>
</el-container>
</template> </template>
<script> <script>
import scEcharts from '@/components/scEcharts'; import scEcharts from '@/components/scEcharts';
const xAxisData = ['第一周','第二周','第三周','第四周'];
export default { export default {
name: 'chart', name: 'chart',
components: { components: {
@ -24,11 +114,15 @@
}, },
data() { data() {
return { return {
queryType:'月',
queryDate:'',
start_date:'',
end_date:'',
currentYear:'',
currentMonth:'',
xAxisData:['第一周','第二周','第三周','第四周'],
typeOptions:['月','年'],
option1: { option1: {
title: {
text: '采购统计',
// subtext: '',
},
grid: { grid: {
top: '80px' top: '80px'
}, },
@ -37,7 +131,7 @@
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] data:xAxisData
}, },
yAxis: { yAxis: {
type: 'value' type: 'value'
@ -54,10 +148,6 @@
}] }]
}, },
option2: { option2: {
title: {
text: '消耗统计',
// subtext: '',
},
grid: { grid: {
top: '80px' top: '80px'
}, },
@ -66,7 +156,7 @@
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] data: xAxisData
}, },
yAxis: { yAxis: {
type: 'value' type: 'value'
@ -82,8 +172,103 @@
barWidth: '15px', 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> </script>

View File

@ -2,23 +2,62 @@
<el-container> <el-container>
<el-header> <el-header>
<div class="right-panel"> <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" <el-option v-for="item in typeOptions"
:key="item" :key="item"
:label="item" :label="item"
:value="item"> :value="item"
>
</el-option> </el-option>
</el-select> </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> <el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
</div> </div>
</el-header> </el-header>
<el-main> <el-main>
<el-card shadow="never" style="margin-bottom: 8px;">
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :lg="12"> <el-col :lg="12">
<el-card shadow="never"> <el-card shadow="never">
<scEcharts height="300px" :option="option"></scEcharts> <scEcharts height="300px" :option="option"></scEcharts>
</el-card> </el-card>
</el-col> </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-col :lg="12">
<el-card shadow="never"> <el-card shadow="never">
<scEcharts height="300px" :option="option2"></scEcharts> <scEcharts height="300px" :option="option2"></scEcharts>
@ -39,47 +78,15 @@
</el-table> </el-table>
</el-card> </el-card>
</el-col> </el-col>
<el-col :lg="12"> </el-row>
<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-card>
</el-col> <el-card shadow="never" style="margin-bottom: 8px;">
<el-row :gutter="10">
<el-col :lg="12"> <el-col :lg="12">
<el-card shadow="never"> <el-card shadow="never">
<scEcharts height="300px" :option="option3"></scEcharts> <scEcharts height="300px" :option="option3"></scEcharts>
</el-card> </el-card>
</el-col> </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-col :lg="12">
<el-card shadow="never"> <el-card shadow="never">
<el-table :data="tableData"> <el-table :data="tableData">
@ -96,13 +103,37 @@
</el-card> </el-card>
</el-col> </el-col>
</el-row> </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-main>
</el-container> </el-container>
</template> </template>
<script> <script>
import scEcharts from '@/components/scEcharts'; import scEcharts from '@/components/scEcharts';
const xAxisData = ['第一周','第二周','第三周','第四周'];
export default { export default {
name: 'chart', name: 'chart',
components: { components: {
@ -110,10 +141,14 @@
}, },
data() { data() {
return { return {
query:{type:'', queryType:'月',
search:'' queryDate:'',
}, start_date:'',
typeOptions:['周','月','年'], end_date:'',
currentYear:'',
currentMonth:'',
xAxisData:['第一周','第二周','第三周','第四周'],
typeOptions:['月','年'],
option: { option: {
title: { title: {
text: '预制棒7车间', text: '预制棒7车间',
@ -126,19 +161,33 @@
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] data: xAxisData
}, },
yAxis: { yAxis: {
type: 'value' 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: [{ series: [{
data: [120, 200, 150, 80, 70, 110, 130], data: [120, 200, 150, 80, 70, 110, 130, 200, 150, 80, 70, 110],
stack: 'Ad', stack: 'Ad',
type: 'bar', type: 'bar',
barWidth: '15px', 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', stack: 'Ad',
type: 'bar', type: 'bar',
barWidth: '15px', barWidth: '15px',
@ -156,7 +205,7 @@
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] data: xAxisData
}, },
yAxis: { yAxis: {
type: 'value' type: 'value'
@ -186,7 +235,7 @@
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] data: xAxisData
}, },
yAxis: { yAxis: {
type: 'value' type: 'value'
@ -216,7 +265,7 @@
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] data: xAxisData
}, },
yAxis: { yAxis: {
type: 'value' type: 'value'
@ -241,7 +290,95 @@
{id:1,date:'2023-12-11',name:'ZJ2-4',count_ok:200}, {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> </script>

View File

@ -2,13 +2,32 @@
<el-container> <el-container>
<el-header> <el-header>
<div class="right-panel"> <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" <el-option v-for="item in typeOptions"
:key="item" :key="item"
:label="item" :label="item"
:value="item"> :value="item"
>
</el-option> </el-option>
</el-select> </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> <el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
</div> </div>
</el-header> </el-header>
@ -32,8 +51,8 @@
</el-table-column> </el-table-column>
<el-table-column label="合格数" prop="count_ok"> <el-table-column label="合格数" prop="count_ok">
</el-table-column> </el-table-column>
<el-table-column label="产品编号" prop="number"> <!-- <el-table-column label="产品编号" prop="number">
</el-table-column> </el-table-column> -->
</el-table> </el-table>
</el-card> </el-card>
</el-col> </el-col>
@ -44,6 +63,7 @@
<script> <script>
import scEcharts from '@/components/scEcharts'; import scEcharts from '@/components/scEcharts';
const xAxisData = ['平头','粘头','粗磨','中磨','细磨','抛光','开槽','配管'];
export default { export default {
name: 'chart', name: 'chart',
components: { components: {
@ -51,11 +71,13 @@
}, },
data() { data() {
return { return {
query:{ queryType:'月',
type:'周', queryDate:'',
search:'' start_date:'',
}, end_date:'',
typeOptions:['周','月','年'], currentYear:'',
currentMonth:'',
typeOptions:['月','年'],
option: { option: {
title: { title: {
text: '本周生产数量', text: '本周生产数量',
@ -68,7 +90,7 @@
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] data:xAxisData
}, },
yAxis: { yAxis: {
type: 'value' type: 'value'
@ -85,13 +107,68 @@
}] }]
}, },
tableData:[ tableData:[
{id:1,date:'2023-12-11',name:'ZJ2-1',count_ok:200}, {id:1,process:'平头',date:'2023-12-11',name:'ZJ2-1',count_ok:200},
{id:1,date:'2023-12-11',name:'ZJ2-2',count_ok:200}, {id:1,process:'粘头',date:'2023-12-11',name:'ZJ2-2',count_ok:200},
{id:1,date:'2023-12-11',name:'ZJ2-3',count_ok:200}, {id:1,process:'粗磨',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-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> </script>

View File

@ -2,13 +2,32 @@
<el-container> <el-container>
<el-header> <el-header>
<div class="right-panel"> <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" <el-option v-for="item in typeOptions"
:key="item" :key="item"
:label="item" :label="item"
:value="item"> :value="item"
>
</el-option> </el-option>
</el-select> </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> <el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
</div> </div>
</el-header> </el-header>
@ -19,7 +38,7 @@
<scEcharts height="300px" :option="option1"></scEcharts> <scEcharts height="300px" :option="option1"></scEcharts>
</el-col> </el-col>
<el-col :lg="16"> <el-col :lg="16">
<el-table :data="tableData"> <el-table :data="tableData" show-summary>
<el-table-column label="日期" prop="date"> <el-table-column label="日期" prop="date">
</el-table-column> </el-table-column>
<el-table-column label="出料数" prop="name"> <el-table-column label="出料数" prop="name">
@ -52,7 +71,7 @@
<scEcharts height="300px" :option="option2"></scEcharts> <scEcharts height="300px" :option="option2"></scEcharts>
</el-col> </el-col>
<el-col :lg="16"> <el-col :lg="16">
<el-table :data="tableData"> <el-table :data="tableData" show-summary>
<el-table-column label="日期" prop="date"> <el-table-column label="日期" prop="date">
</el-table-column> </el-table-column>
<el-table-column label="出料数" prop="name"> <el-table-column label="出料数" prop="name">
@ -87,7 +106,7 @@
<scEcharts height="300px" :option="option3"></scEcharts> <scEcharts height="300px" :option="option3"></scEcharts>
</el-col> </el-col>
<el-col :lg="16"> <el-col :lg="16">
<el-table :data="tableData"> <el-table :data="tableData" show-summary>
<el-table-column label="日期" prop="date"> <el-table-column label="日期" prop="date">
</el-table-column> </el-table-column>
<el-table-column label="出料数" prop="name"> <el-table-column label="出料数" prop="name">
@ -129,10 +148,13 @@
}, },
data() { data() {
return { return {
query:{type:'', queryType:'月',
search:'' queryDate:'',
}, start_date:'',
typeOptions:['周','月','年'], end_date:'',
currentYear:'',
currentMonth:'',
typeOptions:['月','年'],
option1: { option1: {
title: { title: {
text: '7车间', text: '7车间',
@ -149,7 +171,7 @@
center: ['50%', '60%'], center: ['50%', '60%'],
label: false, label: false,
data: [ data: [
{value: 500, name: '合格数'}, {value: 800, name: '合格数'},
{value: 5, name: '炸纹'}, {value: 5, name: '炸纹'},
{value: 2, name: '条纹'}, {value: 2, name: '条纹'},
{value: 6, name: '气泡'}, {value: 6, name: '气泡'},
@ -175,7 +197,7 @@
center: ['50%', '60%'], center: ['50%', '60%'],
label: false, label: false,
data: [ data: [
{value: 300, name: '合格数'}, {value: 800, name: '合格数'},
{value: 2, name: '条纹'}, {value: 2, name: '条纹'},
{value: 5, name: '断裂'}, {value: 5, name: '断裂'},
{value: 6, name: '偏壁'}, {value: 6, name: '偏壁'},
@ -201,7 +223,7 @@
center: ['50%', '60%'], center: ['50%', '60%'],
label: false, label: false,
data: [ data: [
{value: 300, name: '合格数'}, {value: 800, name: '合格数'},
{value: 5, name: '椭圆/弯曲'}, {value: 5, name: '椭圆/弯曲'},
{value: 2, name: '条纹'}, {value: 2, name: '条纹'},
{value: 6, name: '断裂'}, {value: 6, name: '断裂'},
@ -213,15 +235,94 @@
} }
] ]
}, },
tableData:[ 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-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-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-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}, {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> </script>

View File

@ -1,18 +1,56 @@
<template> <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-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-row :gutter="15">
<el-col :lg="12"> <el-col :lg="8">
<el-card shadow="never"> <scEcharts height="300px" :option="option1"></scEcharts>
<scEcharts height="300px" :option="option3"></scEcharts>
</el-card>
</el-col> </el-col>
<el-col :lg="12"> <el-col :lg="16">
<el-card shadow="never">
<scEcharts height="300px" :option="option6"></scEcharts>
</el-card>
</el-col>
<el-col :lg="12">
<el-card shadow="never">
<el-table :data="tableData"> <el-table :data="tableData">
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column label="日期" prop="date"> <el-table-column label="日期" prop="date">
@ -24,37 +62,47 @@
<el-table-column label="合格数" prop="count_ok"> <el-table-column label="合格数" prop="count_ok">
</el-table-column> </el-table-column>
</el-table> </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-col>
</el-row> </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-main>
</el-container>
</template> </template>
<script> <script>
import scEcharts from '@/components/scEcharts'; import scEcharts from '@/components/scEcharts';
/**
* 引入组件 @/components/scEcharts
* 组件内部会自动加载主题 @/components/scEcharts/echarts-theme-T.js
* 支持props包括 heightwidthoption
* 组件export百度Echarts所有方法使用方式: new scEcharts[fun]
*/
export default { export default {
name: 'chart', name: 'chart',
components: { components: {
@ -62,67 +110,34 @@
}, },
data() { data() {
return { return {
option: { queryType:'月',
title: { queryDate:'',
text: '管棒日合格率', start_date:'',
// subtext: '', end_date:'',
}, currentYear:'',
grid: { currentMonth:'',
top: '80px' typeOptions:['月','年'],
}, option1: {
tooltip: { tooltip: {
trigger: 'axis' trigger: 'item'
},
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',
}, },
series: [
{ {
data: [110, 180, 120, 120, 60, 90, 110], name: '访问来源',
type: 'bar', type: 'pie',
barWidth: '15px', radius: ['40%', '70%'],
}] center: ['50%', '60%'],
label: false,
data: [
{value: 1048, name: '合格数'},
{value: 735, name: '不合格一'},
{value: 580, name: '不合格二'},
{value: 484, name: '不合格三'}
]
}
]
}, },
option2: { 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: { tooltip: {
trigger: 'item' trigger: 'item'
}, },
@ -134,98 +149,97 @@
center: ['50%', '60%'], center: ['50%', '60%'],
label: false, label: false,
data: [ data: [
{value: 1048, name: '搜索引擎'}, {value: 1048, name: '合格数'},
{value: 735, name: '直接访问'}, {value: 735, name: '不合格一'},
{value: 580, name: '邮件营销'}, {value: 580, name: '不合格二'},
{value: 484, name: '联盟广告'}, {value: 484, name: '不合格三'}
{value: 300, name: '视频广告'}
] ]
} }
] ]
}, },
option4: { process:'',
title: { processOption:[],
text: '管棒月合格率', product:'',
// subtext: '', productOption:[],
},
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: '视频广告'}
]
}
]
} }
},
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> </script>

View File

@ -2,18 +2,36 @@
<el-container> <el-container>
<el-header> <el-header>
<div class="right-panel"> <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" <el-option v-for="item in typeOptions"
:key="item" :key="item"
:label="item" :label="item"
:value="item"> :value="item"
>
</el-option> </el-option>
</el-select> </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> <el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
</div> </div>
</el-header> </el-header>
<el-main> <el-main>
<!-- <el-alert title="生产统计" type="success" style="margin-bottom:20px;"></el-alert> -->
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :lg="8"> <el-col :lg="8">
<el-card shadow="never"> <el-card shadow="never">
@ -32,7 +50,7 @@
</el-col> </el-col>
<el-col :lg="8"> <el-col :lg="8">
<el-card shadow="never"> <el-card shadow="never">
<el-table :data="tableData"> <el-table :data="tableData1">
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column label="任务编号" prop="number"> <el-table-column label="任务编号" prop="number">
</el-table-column> </el-table-column>
@ -40,14 +58,17 @@
</el-table-column> </el-table-column>
<el-table-column label="完成数" prop="count_ok"> <el-table-column label="完成数" prop="count_ok">
</el-table-column> </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-column>
</el-table> </el-table>
</el-card> </el-card>
</el-col> </el-col>
<el-col :lg="8"> <el-col :lg="8">
<el-card shadow="never"> <el-card shadow="never">
<el-table :data="tableData"> <el-table :data="tableData2">
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column label="任务编号" prop="number"> <el-table-column label="任务编号" prop="number">
</el-table-column> </el-table-column>
@ -55,14 +76,17 @@
</el-table-column> </el-table-column>
<el-table-column label="完成数" prop="count_ok"> <el-table-column label="完成数" prop="count_ok">
</el-table-column> </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-column>
</el-table> </el-table>
</el-card> </el-card>
</el-col> </el-col>
<el-col :lg="8"> <el-col :lg="8">
<el-card shadow="never"> <el-card shadow="never">
<el-table :data="tableData"> <el-table :data="tableData3">
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column label="任务编号" prop="number"> <el-table-column label="任务编号" prop="number">
</el-table-column> </el-table-column>
@ -70,7 +94,10 @@
</el-table-column> </el-table-column>
<el-table-column label="完成数" prop="count_ok"> <el-table-column label="完成数" prop="count_ok">
</el-table-column> </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-column>
</el-table> </el-table>
</el-card> </el-card>
@ -79,17 +106,8 @@
</el-main> </el-main>
</el-container> </el-container>
</template> </template>
<script> <script>
import scEcharts from '@/components/scEcharts'; import scEcharts from '@/components/scEcharts';
/**
* 引入组件 @/components/scEcharts
* 组件内部会自动加载主题 @/components/scEcharts/echarts-theme-T.js
* 支持props包括 heightwidthoption
* 组件export百度Echarts所有方法使用方式: new scEcharts[fun]
*/
export default { export default {
name: 'chart', name: 'chart',
components: { components: {
@ -97,20 +115,23 @@
}, },
data() { data() {
return { return {
query:{type:'', queryType:'月',
search:'' queryDate:'',
}, start_date:'',
typeOptions:['周','月','年'], end_date:'',
currentYear:'',
currentMonth:'',
xAxisData:['第一周','第二周','第三周','第四周'],
typeOptions:['月','年'],
option1: { option1: {
title: { title: {
text: '7车间', text: '7车间完成率',
}, },
tooltip: { tooltip: {
trigger: 'item' trigger: 'item'
}, },
color:['rgb(64,158,255)','orange'], color:['rgb(64,158,255)','orange'],
series: [ series: {
{
name: '7车间完成率', name: '7车间完成率',
type: 'pie', type: 'pie',
radius: ['40%', '70%'], radius: ['40%', '70%'],
@ -121,7 +142,6 @@
{value: 3, name: '未完成'}, {value: 3, name: '未完成'},
] ]
} }
]
}, },
option2: { option2: {
title: { title: {
@ -132,9 +152,8 @@
trigger: 'item' trigger: 'item'
}, },
color:['rgb(64,158,255)','orange'], color:['rgb(64,158,255)','orange'],
series: [ series: {
{ name: '10车间完成率',
name: '访问来源',
type: 'pie', type: 'pie',
radius: ['40%', '70%'], radius: ['40%', '70%'],
center: ['50%', '60%'], center: ['50%', '60%'],
@ -144,7 +163,6 @@
{value: 3, name: '未完成'}, {value: 3, name: '未完成'},
] ]
} }
]
}, },
option3: { option3: {
title: { title: {
@ -154,9 +172,8 @@
trigger: 'item' trigger: 'item'
}, },
color:['rgb(64,158,255)','orange'], color:['rgb(64,158,255)','orange'],
series: [ series: {
{ name: '6车间完成率',
name: '访问来源',
type: 'pie', type: 'pie',
radius: ['40%', '70%'], radius: ['40%', '70%'],
center: ['50%', '60%'], center: ['50%', '60%'],
@ -166,16 +183,132 @@
{value: 3, name: '未完成'}, {value: 3, name: '未完成'},
] ]
} }
]
}, },
tableData:[ // tableData:[
{id:1,number:'20231210',count:300,count_rate:83,count_ok:250}, // {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:'20231211',count:300,count_rate:66,count_ok:200},
{id:1,number:'20231212',count:300,count_rate:93,count_ok:280}, // {id:1,number:'20231212',count:300,count_rate:93,count_ok:280},
{id:1,number:'20231213',count:300,count_rate:0,count_ok:0}, // {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> </script>

View File

@ -1,35 +1,66 @@
<template> <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-main>
<el-row :gutter="15"> <el-row :gutter="15">
<el-col :lg="8"> <el-col :lg="12">
<el-card shadow="never"> <el-card shadow="never">
<scEcharts height="300px" :option="option"></scEcharts> <scEcharts height="300px" :option="option"></scEcharts>
</el-card> </el-card>
</el-col> </el-col>
<el-col :lg="8"> <el-col :lg="12">
<el-card shadow="never"> <el-card shadow="never">
<scEcharts height="300px" :option="option2"></scEcharts> <el-table :data="tableData">
</el-card> <el-table-column label="日期" prop="date">
</el-col> </el-table-column>
<el-col :lg="8"> <el-table-column label="人员名称" prop="name">
<el-card shadow="never"> </el-table-column>
<scEcharts height="300px" :option="option3"></scEcharts> <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-card>
</el-col> </el-col>
</el-row> </el-row>
</el-main> </el-main>
</el-container>
</template> </template>
<script> <script>
import scEcharts from '@/components/scEcharts'; import scEcharts from '@/components/scEcharts';
/**
* 引入组件 @/components/scEcharts
* 组件内部会自动加载主题 @/components/scEcharts/echarts-theme-T.js
* 支持props包括 heightwidthoption
* 组件export百度Echarts所有方法使用方式: new scEcharts[fun]
*/
export default { export default {
name: 'chart', name: 'chart',
components: { components: {
@ -37,9 +68,16 @@
}, },
data() { data() {
return { return {
queryType:'月',
queryDate:'',
start_date:'',
end_date:'',
currentYear:'',
currentMonth:'',
typeOptions:['月','年'],
option: { option: {
title: { title: {
text: '管棒日合格率', text: '人员统计',
// subtext: '', // subtext: '',
}, },
grid: { grid: {
@ -49,77 +87,112 @@
trigger: 'axis' trigger: 'axis'
}, },
xAxis: { xAxis: {
type: 'category', type: 'value',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] position:'top',
axisLine:{
show:true
}
}, },
yAxis: { 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', type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] data: ['张良', '钱勇', '赵丽丽', '王军', '孙聪', '李超', '周年宋']
}, },
yAxis: { series: {
type: 'value' data: [300, 290, 320, 350, 310, 350, 290],
}, type: 'bar',
series: [{ barWidth: '15px',
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: '视频广告'}
]
}
]
} }
},
}
},
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> </script>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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