fix:禅道223
This commit is contained in:
parent
882c6fa6a8
commit
d2162924f8
|
|
@ -51,11 +51,26 @@
|
|||
<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>
|
||||
<el-input v-if="scope.row.indexs==0&&scope.row" v-model="scope.row[item.text+'_'+item1]" @change="xishuChange"></el-input>
|
||||
<span v-if="scope.row.indexs!==0&&scope.row">{{ scope.row[item.text+'_'+item1] }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column label="其它工时" prop="其它工时">
|
||||
<template #default="scope">
|
||||
<el-input v-if="scope.row.indexs!==0&&scope.row" v-model="scope.row.time_other" @change="xishuChange"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="总工时" prop="总工时">
|
||||
<template #default="scope">
|
||||
<el-input v-if="scope.row.indexs!==0&&scope.row" v-model="scope.row.time_all"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" prop="备注">
|
||||
<template #default="scope">
|
||||
<el-input v-if="scope.row.indexs!==0&&scope.row" v-model="scope.row.note"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</scTable>
|
||||
</el-main>
|
||||
</el-container>
|
||||
|
|
@ -87,45 +102,83 @@ export default {
|
|||
methods: {
|
||||
getData(){
|
||||
let that = this;
|
||||
that.lists = [];
|
||||
that.mgruops = [];
|
||||
that.tableData = [];
|
||||
that.titleList = [];
|
||||
that.coefficient = [];
|
||||
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);
|
||||
let data = res.data2.ds0;
|
||||
let coefficient = [];
|
||||
if(data.length>0){
|
||||
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];
|
||||
}
|
||||
item[key]= obj[key];
|
||||
item[pname]= obj[key];
|
||||
}
|
||||
})
|
||||
let item0 = {日期:'系数',操作人:'',indexs:0};
|
||||
coefficient.forEach(cof=>{
|
||||
item0[cof]= 1;
|
||||
})
|
||||
if(data.length>0){
|
||||
})
|
||||
that.coefficient = coefficient;
|
||||
let item0 = {日期:'系数',操作人:'',indexs:0};
|
||||
coefficient.forEach(cof=>{
|
||||
item0[cof]= 1;
|
||||
})
|
||||
data.unshift(item0);
|
||||
}
|
||||
that.tableData = data;
|
||||
data.forEach(item1 => {
|
||||
item1.time_other=0;
|
||||
let all = 0;
|
||||
coefficient.forEach(item2 => {
|
||||
if(item1[item2]){
|
||||
all = all+ Number(item1[item2])
|
||||
}
|
||||
})
|
||||
item1.time_all = all;
|
||||
})
|
||||
}
|
||||
that.tableData = data;
|
||||
});
|
||||
},
|
||||
xishuChange(){
|
||||
let that = this;
|
||||
that.tableData.forEach((item1,index1) => {
|
||||
if(index1>0){
|
||||
let all = 0;
|
||||
that.coefficient.forEach(item2 => {
|
||||
if(item1[item2]){
|
||||
all = all+ Number(item1[item2])*Number(that.tableData[0][item2])
|
||||
}
|
||||
})
|
||||
item1.time_all = all+Number(item1.time_other);
|
||||
}
|
||||
})
|
||||
},
|
||||
otherChange(index){
|
||||
let that = this;
|
||||
let all = 0;
|
||||
console.log('index',index)
|
||||
that.coefficient.forEach(item2 => {
|
||||
if(that.tableData[index][item2]){
|
||||
all = all+ Number(that.tableData[index][item2])*Number(that.tableData[0][item2])
|
||||
}
|
||||
that.tableData[index].time_all = all+Number(that.tableData[index].time_other);
|
||||
})
|
||||
},
|
||||
deptChange(){
|
||||
this.getData();
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue