fix:质检统计添加三个时间的搜索条件

This commit is contained in:
shijing 2025-05-26 16:58:13 +08:00
parent 3aaf978a05
commit ba2f9dfc69
3 changed files with 362 additions and 279 deletions

View File

@ -552,6 +552,12 @@ export default {
return await http.get(`${config.API_URL}/wpm/batchst/`, data);
},
},
batchstquery: {
name: "批次统计数据",
req: async function (data) {
return await http.post(`${config.API_URL}/wpm/batchst/cquery/`, data);
},
},
wpr:{
list: {
name: "动态产品",

View File

@ -157,43 +157,30 @@
</template>
</el-table-column>
<el-table-column label="数量" prop="count" min-width="80"></el-table-column>
<el-table-column label="交接类型" prop="type" min-width="80">
<template #default="scope" v-if="mgroup_name=='size'||mgroup_name=='facade'">
<el-text v-if="scope.row.send_dept == deptId" type="primary">交送</el-text>
<el-text v-if="scope.row.recive_dept == deptId" type="success">接收</el-text>
</template>
<template #default="scope" v-else>
<el-text v-if="scope.row.send_mgroup == mgroupId" type="primary">交送</el-text>
<el-text v-if="scope.row.recive_mgroup == mgroupId" type="success">接收</el-text>
</template>
</el-table-column>
<el-table-column label="交接工段" min-width="80">
<template #default="scope">
<el-text v-if="scope.row.send_mgroup == mgroupId">{{scope.row.send_mgroup_name}}</el-text>
<el-text v-if="scope.row.recive_mgroup == mgroupId">{{scope.row.recive_mgroup_name}}</el-text>
</template>
</el-table-column>
<el-table-column label="交接类别" prop="type" width="80">
<template #default="scope">
<el-tag v-if="scope.row.type == 10" type="success"
>正常</el-tag
>
<el-tag v-if="scope.row.type == 20" type="warning"
>返工</el-tag
>
<el-tag v-if="scope.row.type == 30" type="primary"
>检验</el-tag
>
<el-tag v-if="scope.row.type == 40" type="danger"
>报废</el-tag
>
<el-tag v-if="scope.row.type == 10" type="primary">正常</el-tag>
<el-tag v-if="scope.row.type == 20" type="warning">返工</el-tag>
<el-tag v-if="scope.row.type == 40" type="danger" >报废</el-tag>
<el-tag v-if="scope.row.type == 50" type="success" >改版</el-tag>
</template>
</el-table-column>
<el-table-column label="交接类型" prop="mtype" min-width="80">
<template #default="scope">
<el-text v-if="scope.row.mtype == 10" type="primary">正常</el-text>
<el-text v-if="scope.row.mtype == 20" type="success">分批</el-text>
<el-text v-if="scope.row.mtype == 30" type="success">合批</el-text>
</template>
</el-table-column>
<el-table-column label="交送工段" prop="send_mgroup_name" min-width="80">
</el-table-column>
<el-table-column
label="交送人"
prop="send_user_name"
width="80"
></el-table-column>
<el-table-column label="接收工段" prop="recive_mgroup_name" min-width="80">
</el-table-column>
<el-table-column
label="接收人"
prop="recive_user_name"

View File

@ -2,29 +2,59 @@
<el-container>
<el-header>
<div class="right-panel">
<el-input v-model="query.batch__contains"
<el-input v-model="query.batch"
placeholder="批次号"
clearable
style="width: 200px;"
></el-input>
<el-date-picker
v-model="query.last_time__gte"
type="datetime"
placeholder="变动时间起"
value-format="YYYY-MM-DD HH:mm:ss"
v-model="query.cc_data_start"
type="date"
placeholder="尺寸检验开始日期"
value-format="YYYY-MM-DD"
clearable
style="width: 200px; margin: 5px"
>
</el-date-picker>
style="width: 160px; margin: 5px"
></el-date-picker>
<el-date-picker
v-model="query.last_time__lte"
type="datetime"
placeholder="变动时间止"
value-format="YYYY-MM-DD HH:mm:ss"
v-model="query.cc_data_end"
type="date"
placeholder="尺寸检验结束日期"
value-format="YYYY-MM-DD"
clearable
style="width: 200px; margin:0"
>
</el-date-picker>
style="width: 160px; margin:0"
></el-date-picker>
<el-date-picker
v-model="query.wg_data_start"
type="date"
placeholder="外观检验开始日期"
value-format="YYYY-MM-DD"
clearable
style="width: 160px; margin: 5px"
></el-date-picker>
<el-date-picker
v-model="query.wg_data_end"
type="date"
placeholder="外观检验结束日期"
value-format="YYYY-MM-DD"
clearable
style="width: 160px; margin:0"
></el-date-picker>
<el-date-picker
v-model="query.fx_data_start"
type="date"
placeholder="返修开始日期"
value-format="YYYY-MM-DD"
clearable
style="width: 160px; margin: 5px"
></el-date-picker>
<el-date-picker
v-model="query.fx_data_end"
type="date"
placeholder="返修结束日期"
value-format="YYYY-MM-DD"
clearable
style="width: 160px; margin:0"
></el-date-picker>
<el-button
type="primary"
icon="el-icon-search"
@ -34,24 +64,22 @@
@click="handleExport"
class="tables"
type="primary"
>导出</el-button
>
>导出</el-button>
</div>
</el-header>
<el-main class="nopadding">
<scTable
<el-table
ref="table"
:apiObj="apiObj"
:params="params"
:query="query"
:data="tableData"
id="exportDiv"
stripe
style="height: 100%;"
>
<el-table-column label="批次号" class-name="colorheader1" prop="batch" min-width="150" fixed="left">
<el-table-column label="批次号" class-name="colorheader1" prop="batch" min-width="240" fixed="left">
<template #default="scope"><span>{{ scope.row.data.批次号 }}</span></template>
</el-table-column>
<el-table-column label="尺寸检验" align="center" class-name="colorheader1">
<el-table-column label="日期" class-name="colorheader1">
<el-table-column label="日期" class-name="colorheader1" width="90">
<template #default="scope"><span>{{ scope.row.data.尺寸检验_日期 }}</span></template>
</el-table-column>
<el-table-column label="检验人" class-name="colorheader1">
@ -119,7 +147,7 @@
</el-table-column>
</el-table-column>
<el-table-column label="外观检验" align="center" class-name="colorheader2">
<el-table-column label="日期" class-name="colorheader2">
<el-table-column label="日期" class-name="colorheader2" width="90">
<template #default="scope"><span>{{ scope.row.data.外观检验_日期 }}</span></template>
</el-table-column>
<el-table-column label="检验人" class-name="colorheader2">
@ -196,7 +224,7 @@
</el-table-column>
</el-table-column>
<el-table-column label="返修" align="center" class-name="colorheader3">
<el-table-column label="日期" class-name="colorheader3">
<el-table-column label="日期" class-name="colorheader3" width="90">
<template #default="scope"><span>{{ scope.row.data.返修_日期 }}</span></template>
</el-table-column>
<el-table-column label="检验人" class-name="colorheader3">
@ -263,47 +291,109 @@
<el-table-column label="直通良率" class-name="colorheader4">
<template #default="scope"><span>{{ scope.row.data.外观检验_完全直通合格率 }}</span></template>
</el-table-column>
</scTable>
</el-table>
</el-main>
<el-footer>
<el-pagination
background
:small="true"
:total="dataTotal"
layout="total, sizes, prev, pager, next, jumper"
:page-size="params.page_size"
:page-sizes="[20, 50, 100, 200]"
:current-page="params.page"
@current-change="getList"
@update:page-size="getList2"
></el-pagination>
</el-footer>
</el-container>
</template>
<script>
function deepCopy(obj) {
return JSON.parse(JSON.stringify(obj));
}
export default {
name: "chart",
data() {
return {
params: {
ordering:'-last_time',
data__has_key:"尺寸检验_日期",
},
query:{
batch__contains:'',
last_time__gte:'',
last_time__lte:'',
batch:'',
cc_data_start:'',
cc_data_end:'',
wg_data_start:'',
wg_data_end:'',
fx_data_start:'',
fx_data_end:'',
},
params: {
page:1,
page_size:20,
ordering:"-last_time",
querys:[[{field:"data__has_key",compare:"",value:"尺寸检验_日期"}]],
},
apiObj: this.$API.wpm.batchst,
dataTotal:0,
options:[],
tableData:[],
};
},
mounted() {
let that = this;
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
month = month < 10 ? "0" + month : month;
day = day < 10 ? "0" + day : day;
let queryDate = year + "-" + month + "-" + day;
that.query.start_date = that.query.end_date = that.currentDate = queryDate;
that.getList();
},
methods: {
getList(val){
let that = this;
that.params.page = val?val:1;
that.$API.wpm.batchstquery.req(that.params).then((res) => {
if (res.count > 0) {
that.tableData = res.results;
that.dataTotal = res.count;
}else{
that.tableData = [];
that.dataTotal = 0;
}
});
},
getList2(val){
let that = this;
that.params.page = 1;
that.params.page_size = val;
that.params.querys=[[{field:"data__has_key",compare:"",value:"尺寸检验_日期"}]];
that.getList(1);
},
handleQuery(){
this.$refs.table.queryData(this.query);
let that = this;
that.params.page = 1;
that.params.querys=[[{field:"data__has_key",compare:"",value:"尺寸检验_日期"}]];
for(let key in that.query){
if(that.query[key] != ""){
let obj = {};
obj.value = that.query[key];
if(key=='cc_data_start'){
obj.compare = "gte";
obj.field = "data__尺寸检验_日期";
}else if(key=='cc_data_end'){
obj.compare = "lte";
obj.field = "data__尺寸检验_日期";
}else if(key=='wg_data_start'){
obj.compare = "gte";
obj.field = "data__外观检验_日期";
}else if(key=='wg_data_end'){
obj.compare = "lte";
obj.field = "data__外观检验_日期";
}else if(key=='fx_data_start'){
obj.compare = "gte";
obj.field = "data__返修_日期";
}else if(key=='fx_data_end'){
obj.compare = "lte";
obj.field = "data__返修_日期";
}else{
obj.field = "batch";
obj.compare = "contains";
}
that.params.querys[0].push(obj);
}
}
this.getList();
},
handleExport() {
this.exportLoading = true;