fix:玻纤中检一批次统计调整,添加开台人员查询
This commit is contained in:
parent
c8fe283ff5
commit
badafb2d8e
|
|
@ -21,11 +21,27 @@
|
||||||
clearable
|
clearable
|
||||||
style="width: 200px;"
|
style="width: 200px;"
|
||||||
></el-input>
|
></el-input>
|
||||||
<el-input v-model="query.batch__contains"
|
<el-input v-model="query.batch__contains"
|
||||||
placeholder="批次号"
|
placeholder="批次号"
|
||||||
clearable
|
clearable
|
||||||
style="width: 200px;"
|
style="width: 200px;"
|
||||||
></el-input>
|
></el-input>
|
||||||
|
<el-select
|
||||||
|
v-model="query.operator"
|
||||||
|
placeholder="开台人"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
style="width: 150px;"
|
||||||
|
@change="handleQuery"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in operators"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.name"
|
||||||
|
>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
icon="el-icon-search"
|
icon="el-icon-search"
|
||||||
|
|
@ -325,44 +341,52 @@ export default {
|
||||||
batch__contains:'',
|
batch__contains:'',
|
||||||
last_time__gte:'',
|
last_time__gte:'',
|
||||||
last_time__lte:'',
|
last_time__lte:'',
|
||||||
|
operator:'',
|
||||||
},
|
},
|
||||||
apiObj: this.$API.wpm.batchstquery,
|
apiObj: this.$API.wpm.batchstquery,
|
||||||
options:[],
|
options:[],
|
||||||
tableData:[],
|
tableData:[],
|
||||||
|
operators:[],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
this.getOperators();
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
async getOperators() {
|
||||||
|
try {
|
||||||
|
let users1 = [], users2 = [];
|
||||||
|
users1 = await this.$API.system.user.list.req({ posts__name__contains: '一体刀加工操作员', page: 0 });
|
||||||
|
users2 = await this.$API.system.user.list.req({ posts__name__contains: '磨床开台操作员', page: 0 });
|
||||||
|
const map = new Map();
|
||||||
|
users1.concat(users2).forEach(u => map.set(u.id, u));
|
||||||
|
this.operators = [...map.values()];
|
||||||
|
} catch (e) {
|
||||||
|
console.error('获取操作员失败', e);
|
||||||
|
}
|
||||||
|
},
|
||||||
handleQuery(){
|
handleQuery(){
|
||||||
let that = this;
|
let that = this;
|
||||||
let querys = [[{field:"data__has_key",compare:"",value:"中检一_日期"}]];
|
let baseConditions = [{field:"data__has_key",compare:"",value:"中检一_日期"}];
|
||||||
let obj = {},obj1 = {},obj2 = {},obj3 = {};
|
|
||||||
obj.field = 'data__中检一_批次号';
|
|
||||||
obj.value = that.query.batch__contains;
|
|
||||||
obj.compare = '';
|
|
||||||
|
|
||||||
obj1.field = 'data__中检一_日期';
|
let pushIf = (field, value, compare) => {
|
||||||
obj1.value = that.query.last_time__gte;
|
if (value !== '' && value !== null) {
|
||||||
obj1.compare = 'gte';
|
baseConditions.push({ field, value, compare });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
pushIf('data__中检一_批次号', that.query.batch__contains, '');
|
||||||
|
pushIf('data__中检一_日期', that.query.last_time__gte, 'gte');
|
||||||
|
pushIf('data__中检一_日期', that.query.last_time__lte, 'lte');
|
||||||
|
pushIf('material_start__name', that.query.name__contains, 'contains');
|
||||||
|
|
||||||
obj2.field = 'data__中检一_日期';
|
let querys;
|
||||||
obj2.value = that.query.last_time__lte;
|
if (that.query.operator !== '' && that.query.operator !== null) {
|
||||||
obj2.compare = 'lte';
|
querys = [
|
||||||
|
[...baseConditions, { field: 'data__喷码_一体刀_操作人', value: that.query.operator, compare: '' }],
|
||||||
obj3.field = 'material_start__name';
|
[...baseConditions, { field: 'data__喷码_磨床开台_操作人', value: that.query.operator, compare: '' }],
|
||||||
obj3.value = that.query.name__contains;
|
];
|
||||||
obj3.compare = 'contains';
|
} else {
|
||||||
|
querys = [baseConditions];
|
||||||
if(that.query.batch__contains!==''&&that.query.batch__contains!==null){
|
|
||||||
querys[0].push(obj);
|
|
||||||
}
|
|
||||||
if(that.query.last_time__gte!==''&&that.query.last_time__gte!==null){
|
|
||||||
querys[0].push(obj1);
|
|
||||||
}
|
|
||||||
if(that.query.last_time__lte!==''&&that.query.last_time__lte!==null){
|
|
||||||
querys[0].push(obj2);
|
|
||||||
}
|
|
||||||
if(that.query.name__contains!==''&&that.query.name__contains!==null){
|
|
||||||
querys[0].push(obj3);
|
|
||||||
}
|
}
|
||||||
that.params.querys = querys;
|
that.params.querys = querys;
|
||||||
this.$refs.table.queryData(that.params);
|
this.$refs.table.queryData(that.params);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue