This commit is contained in:
shijing 2024-03-21 15:43:45 +08:00
parent 365439d05b
commit c409aed5f6
3 changed files with 188 additions and 130 deletions

View File

@ -15,10 +15,10 @@
<!-- 预制棒 -->
<sc-form-table ref="formTable" v-if="type == 'bang'" v-model="formTableData" :addTemplate="addTemplate"
placeholder="暂无数据">
<el-table-column prop="val" label="抽检编号" min-width="120">
<el-table-column prop="val" label="抽检编号" min-width="180">
<template #default="scope">
<span v-if="scope.row.id">{{ scope.row.test_numer }}</span>
<el-input v-else v-model="scope.row.test_numer" placeholder="抽检编号"></el-input>
<!-- <span v-if="scope.row.id">{{ scope.row.test_numer }}</span> -->
<el-input :disabled="!scope.row.isEdit" v-model="scope.row.test_numer" placeholder="抽检编号"></el-input>
</template>
</el-table-column>
<el-table-column label="检验记录" align="center">
@ -60,10 +60,10 @@
<!-- 预制管 -->
<sc-form-table ref="formTable" v-else-if="type == 'guan'" v-model="formTableData" :addTemplate="addTemplate"
placeholder="暂无数据">
<el-table-column prop="val" label="抽检编号">
<el-table-column prop="val" label="抽检编号" min-width="180">
<template #default="scope">
<span v-if="scope.row.id">{{ scope.row.test_numer }}</span>
<el-input v-else v-model="scope.row.test_numer" placeholder="抽检编号"></el-input>
<!-- <span v-if="scope.row.id">{{ scope.row.test_numer }}</span> -->
<el-input :disabled="!scope.row.isEdit" v-model="scope.row.test_numer" placeholder="抽检编号"></el-input>
</template>
</el-table-column>
<el-table-column label="检验记录" align="center">
@ -98,7 +98,7 @@
<template #default="scope">
<el-link type="primary" v-if="scope.row.isEdit" @click="saveCheck(scope.row)">保存</el-link>
<el-link type="primary" v-else @click="editCheck(scope.row)">编辑</el-link>
<el-link type="danger" @click="delCheck(scope.row.id)" style="margin-left: 2px;">删除</el-link>
<el-link type="danger" v-if="scope.row.id" @click="delCheck(scope.row.id)" style="margin-left: 2px;">删除</el-link>
</template>
</el-table-column>
</sc-form-table>
@ -233,17 +233,21 @@ export default {
},
saveCheck(row) {
console.log(row);
let index = this.formTableData.findIndex(item => item.id == row.id);
if (row.id && row.id !== '') {
this.$API.qm.ftest.update.req(row.id, row).then((res) => {
this.formTableData[index].isEdit = false;
this.$message.success("操作成功");
this.$refs.table.refresh();
this.$refs.formTable.refresh();
}).catch((err) => {
return err;
});
} else {
this.$API.qm.ftest.create.req(row).then((res) => {
this.formTableData[index].isEdit = false;
this.$message.success("操作成功");
this.$refs.table.refresh();
this.$refs.formTable.refresh();
}).catch((err) => {
return err;
});

View File

@ -2,7 +2,7 @@
<el-container>
<el-header>
<div class="right-panel">
<el-select v-model="queryType" clearable @change="queryTypeChange">
<el-select v-model="queryType" @change="queryTypeChange">
<el-option v-for="item in typeOptions" :key="item" :label="item" :value="item">
</el-option>
</el-select>
@ -264,9 +264,10 @@ export default {
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;
month = month < 10 ? '0' + month : month;
this.queryDate = year + '-' + month;
this.start_date = year + '-' + month + '-01';
this.end_date = year + '-' + month + '-' + new Date(year, month, 0).getDate();
this.getData();
@ -283,24 +284,46 @@ export default {
that.tableData8 = [];
let exec = that.queryType == '月' ? 'lineMonth' : 'lineYear';
let obj = {
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "8车间" },
query: {
start_date: this.start_date, end_date: this.end_date, dept_name: "8车间",
mgroup_name: "退火",group_bys_mgroup: ", mgroup.name",
select_cols_mgroup: ", mgroup.name AS 工段",
},
};
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
console.log('退火车间统计:', res);
if (res2.data2.ds0) {
let data = res.data2.ds0;
if (data.length > 0) {
that.tableData8 = data;
that.option1.series.data[0].value = data[0].合格数;
that.option1.series.data[1].value = data[0].弯曲;
that.option1.series.data[2].value = data[0].条纹;
that.option1.series.data[3].value = data[0].断裂;
that.option1.series.data[4].value = data[0].偏壁;
that.option1.series.data[5].value = data[0].大小头;
that.option1.series.data[6].value = data[0].结石;
that.option1.series.data[7].value = data[0].气线;
that.option1.series.data[8].value = data[0].箱中破;
} else {
that.tableData8 = [];
}
});
//echarts
let obj2 = {
query: {
start_date: this.start_date, end_date: this.end_date, dept_name: "8车间",
group_bys_material: "", order_bys_material: "", select_cols_material: "",
mgroup_name: "退火",group_bys_mgroup: ", mgroup.name",
select_cols_mgroup: ", mgroup.name AS 工段",
},
};
that.$API.bi.dataset.exec.req(exec, obj2).then((res2) => {
console.log('退火车间统计:', res2);
if (res2.data2.ds0) {
let data = res2.data2.ds0;
if (data.length > 0) {
that.option3.series.data[0].value = data[0].合格数;
that.option3.series.data[1].value = data[0].弯曲;
that.option3.series.data[2].value = data[0].条纹;
that.option3.series.data[3].value = data[0].断裂;
that.option3.series.data[4].value = data[0].偏壁;
that.option3.series.data[5].value = data[0].大小头;
that.option3.series.data[6].value = data[0].结石;
that.option3.series.data[7].value = data[0].气线;
that.option3.series.data[8].value = data[0].箱中破;
}
}
// debugger;
});
},
getData7() {
@ -312,9 +335,25 @@ export default {
let exec = that.queryType == '月' ? 'lineMonth' : 'lineYear';
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
console.log('7生产车间统计:', res);
if (res2.data2.ds0) {
let data = res.data2.ds0;
if (data.length > 0) {
that.tableData7 = data;
} else {
that.tableData7 = [];
}
});
//echarts
let obj2 = {
query: {
start_date: this.start_date, end_date: this.end_date, dept_name: "7车间",
group_bys_material: "",order_bys_material: "",select_cols_material: ""
},
};
that.$API.bi.dataset.exec.req(exec, obj2).then((res2) => {
console.log('7生产车间统计:', res2);
if (res2.data2.ds0) {
let data = res2.data2.ds0;
if (data.length > 0) {
that.option1.series.data[0].value = data[0].合格数;
that.option1.series.data[1].value = data[0].炸纹;
that.option1.series.data[2].value = data[0].条纹;
@ -322,6 +361,7 @@ export default {
that.option1.series.data[4].value = data[0].弯曲;
that.option1.series.data[5].value = data[0].其他;
}
}
});
},
getData10() {
@ -333,9 +373,25 @@ export default {
let exec = that.queryType == '月' ? 'lineMonth' : 'lineYear';
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
console.log('10生产车间统计:', res);
if (res2.data2.ds0) {
let data = res.data2.ds0;
if (data.length > 0) {
that.tableData10 = data;
} else {
that.tableData10 = [];
}
});
//echarts
let obj2 = {
query: {
start_date: this.start_date, end_date: this.end_date, dept_name: "10车间",
group_bys_material: "",order_bys_material: "",select_cols_material: ""
},
};
that.$API.bi.dataset.exec.req(exec, obj2).then((res2) => {
console.log('10生产车间统计:', res2);
if (res2.data2.ds0) {
let data = res2.data2.ds0;
if (data.length > 0) {
that.option2.series.data[0].value = data[0].合格数;
that.option2.series.data[1].value = data[0].断裂;
that.option2.series.data[2].value = data[0].条纹;
@ -344,6 +400,8 @@ export default {
that.option2.series.data[5].value = data[0].结石;
that.option2.series.data[6].value = data[0].气线;
}
}
});
},
handleQuery() {

View File

@ -2,7 +2,7 @@
<el-container>
<el-header>
<div class="right-panel">
<el-select v-model="queryType" clearable @change="queryTypeChange">
<el-select v-model="queryType" @change="queryTypeChange">
<el-option v-for="item in typeOptions"
:key="item"
:label="item"
@ -48,53 +48,36 @@
</el-header>
<el-row :gutter="15">
<el-col :lg="8">
<scEcharts height="300px" :option="option1"></scEcharts>
<scEcharts height="500px" :option="option1"></scEcharts>
</el-col>
<el-col :lg="16" style="position: relative;">
<el-button @click="handleExport('1')" class="tables" type="primary">导出</el-button>
<el-table :data="tableData" :height="300" id="exportDiv1">
<el-table :data="tableData" :height="500" id="exportDiv1">
<el-table-column type="index" width="50" />
<el-table-column label="日期" prop="date">
<template #default="scope">
<span>{{ scope.row. }}</span>
<span v-if="scope.row.月">-{{ scope.row.年 }}</span>
</template>
</el-table-column>
<el-table-column label="规格" prop="name">
<el-table-column label="规格" prop="规格">
</el-table-column>
<el-table-column label="型号" prop="name">
<el-table-column label="型号" prop="型号">
</el-table-column>
<el-table-column label="合格数" prop="count_ok">
<el-table-column label="合格数" prop="合格数">
</el-table-column>
</el-table>
</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" style="position: relative;">
<el-button @click="handleExport('2')" class="tables" type="primary">导出</el-button>
<el-table :data="tableData" :height="300" id="exportDiv2">
<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 label="不合格数" prop="合格数">
<el-table-column label="条纹" prop="条纹"></el-table-column>
<el-table-column label="气泡" prop="气泡"></el-table-column>
<el-table-column label="断裂" prop="断裂"></el-table-column>
<el-table-column label="气线" prop="气线"></el-table-column>
<el-table-column label="炸纹" prop="炸纹"></el-table-column>
<el-table-column label="结石" prop="结石"></el-table-column>
<el-table-column label="弯曲" prop="弯曲"></el-table-column>
<el-table-column label="偏壁" prop="偏壁"></el-table-column>
<el-table-column label="大小头" prop="大小头"></el-table-column>
<el-table-column label="其他" prop="其他"></el-table-column>
<el-table-column label="合计" prop="不合格数"></el-table-column>
</el-table-column>
</el-table>
</el-col>
@ -125,29 +108,9 @@
},
series: [
{
name: '访问来源',
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: {
tooltip: {
trigger: 'item'
},
series: [
{
name: '访问来源',
type: 'pie',
radius: ['40%', '70%'],
radius: ['40%', '60%'],
center: ['50%', '60%'],
label: false,
data: [
@ -160,9 +123,9 @@
]
},
process:'',
processName:'',
processOption:[],
product:'',
productOption:[],
tableData:[],
}
},
mounted(){
@ -170,15 +133,16 @@
let year = date.getFullYear();
let month = date.getMonth()+1;
let days = new Date(year, month, 0).getDate();
month = month<10?'0'+month:month;
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.queryDate = year + '-' + month;
// this.start_date =year+'-'+month+'-01';
// this.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate();
this.start_date ='2023-01-01';
this.end_date = '2023-12-31';
this.getProcess();
this.getProduct();
this.getData();
this.getProductData();
},
methods:{
queryTypeChange(value){
@ -188,35 +152,68 @@
getProcess(){
this.$API.mtm.process.list.req({cate:'粗加工',page:0}).then((res) => {
this.processOption = res;
this.process = res[0].id;
this.processName = res[0].name;
this.getData();
});
},
processChange(){},
getProduct(){
this.$API.wpm.wmaterial.list.req({count__gte:1,material__type:10,page:0}).then((res) => {
this.productOption = res;
});
processChange() {
this.processName = this.processOption.find(item => item.id === this.process).name;
this.getData();
},
productChange(){},
getData(){
let that = this;
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
let exec = that.queryType=='月'?'lineMonth':'lineYear';
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;
});
query: {
end_date: that.end_date,dept_name: "6车间",
is_hidden: -1,start_date: that.start_date,
mgroup_name: that.processName,group_bys_mgroup: ", mgroup.name",
group_bys_material: "",order_bys_material: "",
select_cols_mgroup: ", mgroup.name AS 工段",
select_cols_material: ""
},
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;
//echarts
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
console.log('获取echarts数据:', res);
if (res.data2.ds0) {
let data = res.data2.ds0;
let seriesData = [
{value: 0, name: '合格数'},
{value: 0, name: '条纹'},
{value: 0, name: '气泡'},
{value: 0, name: '断裂' },
{value: 0, name: '气线' },
{value: 0, name: '炸纹'},
{value: 0, name: '结石'},
{value: 0, name: '弯曲' },
{value: 0, name: '偏壁'},
{value: 0, name: '大小头'},
{value: 0, name: '其他'},
];
if (data.length > 0) {
data.forEach((item) => {
seriesData.forEach((item2) => {
item2.value += item[item2.name];
})
})
}
console.log('seriesData:', seriesData);
that.option1.series[0].data = seriesData;
}
});
let obj2 = {
query: {
start_date: that.start_date, end_date: that.end_date, dept_name: "6车间",
is_hidden: -1,mgroup_name: that.processName,group_bys_mgroup: ", mgroup.name",
select_cols_mgroup: ", mgroup.name AS 工段",
},
};
//table
that.$API.bi.dataset.exec.req(exec, obj2).then((res2) => {
console.log('获取table数据:', res2.data2.ds0);
that.tableData = res2.data2.ds0;
});
},
handleQuery(){
@ -239,7 +236,6 @@
}
}
this.getData();
this.getProductData();
},
handleExport(val) {
this.exportLoading = true;