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

View File

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

View File

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