142 lines
3.6 KiB
Vue
142 lines
3.6 KiB
Vue
<template>
|
|
<el-container>
|
|
<el-header>
|
|
<div class="left-panel"></div>
|
|
<div class="right-panel">
|
|
<xtSelect
|
|
:apiObj="apiObj"
|
|
v-model="query.user_name"
|
|
:valueField="'name'"
|
|
:labelField="'name'"
|
|
v-model:label="query.user_name"
|
|
style="width:150px; margin-right: 5px;"
|
|
>
|
|
<el-table-column label="姓名" prop="name"></el-table-column>
|
|
</xtSelect>
|
|
<el-date-picker
|
|
v-model="query.start_date"
|
|
type="date"
|
|
value-format="YYYY-MM-DD"
|
|
placeholder="开始时间"
|
|
style="width: 150px"
|
|
/>
|
|
<el-date-picker
|
|
v-model="query.end_date"
|
|
type="date"
|
|
value-format="YYYY-MM-DD"
|
|
placeholder="结束时间"
|
|
style="margin-left: 2px; width: 150px"
|
|
/>
|
|
<el-button
|
|
type="primary"
|
|
icon="el-icon-search"
|
|
@click="handleQuery"
|
|
></el-button>
|
|
</div>
|
|
</el-header>
|
|
<el-main class="nopadding">
|
|
<scTable
|
|
ref="table"
|
|
:data="tableData"
|
|
id="exportDiv"
|
|
row-key="id"
|
|
hidePagination
|
|
hideDo
|
|
stripe
|
|
>
|
|
<el-table-column label="日期" prop="日期" width="100" fixed="left">
|
|
</el-table-column>
|
|
<el-table-column label="操作人" prop="操作人" width="100" fixed="left">
|
|
</el-table-column>
|
|
<el-table-column v-for="item in lists" :key="item" :label="item.text" align="center">
|
|
<el-table-column v-for="item1 in item.value" :key="item1" :label="item1">
|
|
<template #default="scope">
|
|
<el-input v-if="scope.row.indexs==0&&scope.row" v-model="scope.row[item.text+'_'+item1]"></el-input>
|
|
<span v-if="scope.row.indexs!==0&&scope.row">{{ scope.row[item.text+'_'+item1] }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</scTable>
|
|
</el-main>
|
|
</el-container>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: "workerTimes",
|
|
data() {
|
|
return {
|
|
query:{
|
|
end_date:'',
|
|
user_name:'',
|
|
start_date:'',
|
|
},
|
|
lists:[],
|
|
mgruops:[],
|
|
tableData:[],
|
|
apiObj: this.$API.system.user.list,
|
|
};
|
|
},
|
|
mounted() {
|
|
let that = this;
|
|
let date = new Date();
|
|
that.query.end_date = that.$TOOL.dateFormat2(date);
|
|
that.query.start_date = that.query.end_date.split('-')[0] + '-' + that.query.end_date.split('-')[1] + '-01';
|
|
that.getData();
|
|
},
|
|
methods: {
|
|
getData(){
|
|
let that = this;
|
|
that.mgruops = [];
|
|
that.tableData = [];
|
|
let params = {};
|
|
params.query = that.query;
|
|
that.$API.bi.dataset.exec.req('lineDay_p', params).then((res) => {
|
|
let data = res.data2.ds0;
|
|
that.lists = [];
|
|
let coefficient = [];
|
|
data.forEach(item=>{
|
|
let obj = item.工序物料生产数?JSON.parse(item.工序物料生产数):{};
|
|
for(let key in obj){
|
|
if(coefficient.indexOf(key)<0){
|
|
coefficient.push(key);
|
|
}
|
|
let mgroup = key.split('_')[0];
|
|
let pname = key.split('_')[1];
|
|
if(that.mgruops.indexOf(mgroup)<0){
|
|
that.mgruops.push(mgroup);
|
|
that.lists.push({text:mgroup,value:[pname]});
|
|
}else{
|
|
var index = that.mgruops.indexOf(mgroup);
|
|
if(that.lists[index].value.indexOf(pname)<0){
|
|
that.lists[index].value.push(pname);
|
|
}
|
|
}
|
|
item[key]= obj[key];
|
|
item[pname]= obj[key];
|
|
}
|
|
})
|
|
let item0 = {日期:'系数',操作人:'',indexs:0};
|
|
coefficient.forEach(cof=>{
|
|
item0[cof]= 1;
|
|
})
|
|
if(data.length>0){
|
|
data.unshift(item0);
|
|
}
|
|
that.tableData = data;
|
|
});
|
|
},
|
|
deptChange(){
|
|
this.getData();
|
|
},
|
|
handleQuery(){
|
|
let that = this;
|
|
that.getData();
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style scoped>
|
|
</style>
|