fix:玻纤中检一批次统计调整,添加开台人员查询
This commit is contained in:
parent
c8fe283ff5
commit
badafb2d8e
|
|
@ -21,11 +21,27 @@
|
|||
clearable
|
||||
style="width: 200px;"
|
||||
></el-input>
|
||||
<el-input v-model="query.batch__contains"
|
||||
placeholder="批次号"
|
||||
clearable
|
||||
<el-input v-model="query.batch__contains"
|
||||
placeholder="批次号"
|
||||
clearable
|
||||
style="width: 200px;"
|
||||
></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
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
|
|
@ -325,44 +341,52 @@ export default {
|
|||
batch__contains:'',
|
||||
last_time__gte:'',
|
||||
last_time__lte:'',
|
||||
operator:'',
|
||||
},
|
||||
apiObj: this.$API.wpm.batchstquery,
|
||||
options:[],
|
||||
tableData:[],
|
||||
operators:[],
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getOperators();
|
||||
},
|
||||
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(){
|
||||
let that = this;
|
||||
let querys = [[{field:"data__has_key",compare:"",value:"中检一_日期"}]];
|
||||
let obj = {},obj1 = {},obj2 = {},obj3 = {};
|
||||
obj.field = 'data__中检一_批次号';
|
||||
obj.value = that.query.batch__contains;
|
||||
obj.compare = '';
|
||||
let baseConditions = [{field:"data__has_key",compare:"",value:"中检一_日期"}];
|
||||
|
||||
obj1.field = 'data__中检一_日期';
|
||||
obj1.value = that.query.last_time__gte;
|
||||
obj1.compare = 'gte';
|
||||
let pushIf = (field, value, compare) => {
|
||||
if (value !== '' && value !== null) {
|
||||
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__中检一_日期';
|
||||
obj2.value = that.query.last_time__lte;
|
||||
obj2.compare = 'lte';
|
||||
|
||||
obj3.field = 'material_start__name';
|
||||
obj3.value = that.query.name__contains;
|
||||
obj3.compare = 'contains';
|
||||
|
||||
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);
|
||||
let querys;
|
||||
if (that.query.operator !== '' && that.query.operator !== null) {
|
||||
querys = [
|
||||
[...baseConditions, { field: 'data__喷码_一体刀_操作人', value: that.query.operator, compare: '' }],
|
||||
[...baseConditions, { field: 'data__喷码_磨床开台_操作人', value: that.query.operator, compare: '' }],
|
||||
];
|
||||
} else {
|
||||
querys = [baseConditions];
|
||||
}
|
||||
that.params.querys = querys;
|
||||
this.$refs.table.queryData(that.params);
|
||||
|
|
|
|||
Loading…
Reference in New Issue