223 lines
8.1 KiB
Vue
223 lines
8.1 KiB
Vue
<template>
|
|
<el-container>
|
|
<el-header>
|
|
<div class="left-panel"></div>
|
|
<div class="right-panel">
|
|
<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="handleQuery2"
|
|
></el-button>
|
|
</div>
|
|
</el-header>
|
|
<el-main class="nopadding">
|
|
<el-tabs type="border-card" v-model="query.mgroup_name" @tab-click="handleClick" style="height: 100%;" lazy>
|
|
<el-tab-pane
|
|
v-for="tab in tabs"
|
|
:key="tab"
|
|
:name="tab"
|
|
:label="tab"
|
|
style="height: 100%;"
|
|
>
|
|
<el-container v-if="query.mgroup_name === tab">
|
|
<el-main>
|
|
<scTable
|
|
v-if="showTable"
|
|
ref="table1"
|
|
:data="tableData"
|
|
row-key="id"
|
|
hidePagination
|
|
hideDo
|
|
stripe
|
|
>
|
|
<el-table-column type="index" width="50" fixed="left"/>
|
|
<el-table-column label="员工" prop="员工"/>
|
|
<el-table-column label="物料名" prop="物料名" :filters="nameFilters" :filter-method="filterName" filter-placement="bottom-end"/>
|
|
<el-table-column label="总数">
|
|
<template #default="scope">
|
|
<span v-if="scope.row.总切片数">{{ scope.row.总切片数 }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="剪切">
|
|
<template #default="scope">
|
|
<span v-if="scope.row.剪切合格">{{ ((scope.row.剪切合格 / scope.row.总切片数) * 100).toFixed(2) }}%</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="剪切加工率">
|
|
<template #default="scope">
|
|
<span v-if="scope.row['剪切¢18.3mm不合格']">{{ (((scope.row.总切片数 - scope.row['剪切¢18.3mm不合格'].含) / scope.row.总切片数) * 100).toFixed(2) }}%</span>
|
|
<span v-else>100%</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="暗点">
|
|
<template #default="scope">
|
|
<span v-if="scope.row.暗点合格">{{ ((scope.row.暗点合格.含 / scope.row.总切片数) * 100).toFixed(2) }}%</span>
|
|
<span v-else>0%</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="长点率">
|
|
<template #default="scope">
|
|
<span>{{ ((scope.row.长点数 / scope.row.总切片数) * 100).toFixed(2) }}%</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="加工率">
|
|
<template #default="scope">
|
|
<span>{{ ((scope.row.加工率数 / scope.row.总切片数) * 100).toFixed(2) }}%</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="合格率" prop="合格率">
|
|
<template #default="scope">
|
|
<span>{{ ((scope.row.合格率数 / scope.row.总切片数) * 100).toFixed(2) }}%</span>
|
|
</template>
|
|
</el-table-column>
|
|
</scTable>
|
|
</el-main>
|
|
</el-container>
|
|
</el-tab-pane>
|
|
</el-tabs>
|
|
</el-main>
|
|
<el-drawer v-model="visible" :title="userName+'板段列表'" size="50%" direction="rtl" append-to-body destroy-on-close>
|
|
<el-card shadow="never">
|
|
<div v-for="(item,index) in detailRow" :key="item" style="height:22px;border-bottom: 1px solid #efefef;">
|
|
<span style="margin-right:10px;width: 18px;display: inline-block;">{{ index+1 }} </span>
|
|
{{ item }}
|
|
</div>
|
|
</el-card>
|
|
</el-drawer>
|
|
</el-container>
|
|
</template>
|
|
<script>
|
|
export default {
|
|
name: "workHoursRY",
|
|
data() {
|
|
return {
|
|
visible: false,
|
|
showTable: false,
|
|
userName: '',
|
|
tabs: ['拉单丝' , '一次复丝', '排一次棒', '二次复丝', '排二次棒'],
|
|
query: {
|
|
end_date: '',
|
|
start_date: '',
|
|
mgroup_name: "拉单丝",
|
|
},
|
|
end_date: '',
|
|
start_date: '',
|
|
mgruops: [],
|
|
tableData: [],
|
|
detailRow: [],
|
|
nameFilters: []
|
|
};
|
|
},
|
|
mounted() {
|
|
let that = this;
|
|
let date = new Date();
|
|
that.end_date = that.query.end_date = that.$TOOL.dateFormat2(date);
|
|
that.start_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;
|
|
let params = {}, biStr = '', nameList = [], names = [];
|
|
let query = that.query;
|
|
if (that.query.start_date == '' || that.query.start_date == null) {
|
|
that.query.start_date = query.start_date = that.start_date;
|
|
} else {
|
|
query.start_date = that.query.start_date;
|
|
}
|
|
if (that.query.end_date == '' || that.query.end_date == null) {
|
|
that.query.end_date = query.end_date = that.end_date;
|
|
} else {
|
|
query.end_date = that.query.end_date;
|
|
}
|
|
params.query = query;
|
|
console.log('params', params);
|
|
if (that.query.mgroup_name == '拉单丝') {
|
|
biStr = 'product_defect_lds';
|
|
} else if (that.query.mgroup_name == '一次复丝' || that.query.mgroup_name == '排一次棒' || that.query.mgroup_name == '二次复丝' || that.query.mgroup_name == '排二次棒') {
|
|
biStr = 'product_defect_jjcj';
|
|
}
|
|
that.$API.bi.dataset.exec.req(biStr, params).then((res) => {
|
|
let data = res.data2.ds0;
|
|
data.forEach(item => {
|
|
if (names.indexOf(item.物料名) > -1) {} else {
|
|
names.push(item.物料名);
|
|
nameList.push({ text: item.物料名, value: item.物料名 });
|
|
}
|
|
if (item.缺陷分布 !== null) {
|
|
let defect = JSON.parse(item.缺陷分布);
|
|
for (let key in defect) {
|
|
item[key] = defect[key];
|
|
}
|
|
}
|
|
item.长点数 = item.暗点不合格 ? item.暗点重 ? item.暗点不合格.含 + item.暗点重.含 : item.暗点不合格.含 : item.暗点重 ? item.暗点重.含 : 0;
|
|
item.剪切合格 = item['剪切¢18.3mm不合格'] ? item['剪切¢18.3mm可加工'] ? item.总切片数 - item['剪切¢18.3mm可加工'].含 - item['剪切¢18.3mm不合格'].含 : item.总切片数 - item['剪切¢18.3mm不合格'].含 : item['剪切¢18.3mm可加工'] ? item.总切片数 - item['剪切¢18.3mm可加工'].含 : item.总切片数;
|
|
let count_hgls = item.暗点合格 ? item.暗点合格.含 : 0;
|
|
let count1 = item['剪切¢18.3mm不合格'] ? item.总切片数 - item.长点数 - item['剪切¢18.3mm不合格'].含 : item.总切片数 - item.长点数;
|
|
if (item['剪切¢18.3mm不合格'] && item['剪切¢18.3mm不合格'].组 !== null) {
|
|
if (item['剪切¢18.3mm不合格'].组['剪切¢18.3mm不合格+暗点不合格']) {
|
|
count1 = count1 + item['剪切¢18.3mm不合格+暗点不合格'];
|
|
}
|
|
if (item['剪切¢18.3mm不合格'].组['剪切¢18.3mm不合格+暗点重']) {
|
|
count1 = count1 + item['剪切¢18.3mm不合格+暗点重'];
|
|
}
|
|
if (item['剪切¢18.3mm可加工'].组['剪切¢18.3mm可加工+暗点合格']) {
|
|
count_hgls = count_hgls - item['剪切¢18.3mm可加工'].组['剪切¢18.3mm可加工+暗点合格'];
|
|
}
|
|
if (item['剪切¢18.3mm可加工'].组['剪切¢18.3mm不合格+暗点合格']) {
|
|
count_hgls = count_hgls - item['剪切¢18.3mm不合格+暗点合格'];
|
|
}
|
|
}
|
|
item.加工率数 = count1;
|
|
item.合格率数 = count_hgls;
|
|
});
|
|
that.$nextTick(() => {
|
|
console.log('data', data);
|
|
that.nameFilters = nameList;
|
|
that.tableData = data;
|
|
that.showTable = true;
|
|
});
|
|
});
|
|
},
|
|
handleQuery2() {
|
|
this.getData();
|
|
},
|
|
filterName(value, row) {
|
|
return row.物料名 == value;
|
|
},
|
|
handleClick(e) {
|
|
let that = this;
|
|
that.query.end_date = that.end_date;
|
|
that.query.start_date = that.start_date;
|
|
that.query.mgroup_name = e.props.name;
|
|
that.showTable = false;
|
|
that.getData();
|
|
},
|
|
numberClick(row) {
|
|
let that = this;
|
|
that.detailRow = [];
|
|
that.userName = row.员工;
|
|
that.banduanNum = row.切片后缀;
|
|
that.detailRow = row.切片编号列表;
|
|
that.visible = true;
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
<style scoped>
|
|
</style>
|