Files
JY1.0/src/views/ManufacturingCenter/ScheduleCompletionDetails/index.vue
2019-11-02 12:37:37 +08:00

224 lines
8.1 KiB
Vue

<template>
<div class="app-container">
<el-card>
<el-date-picker
v-model="startTime"
value-format="yyyy-MM-dd"
size="small"
style="width: 170px;margin:0px 10px"
type="date"
placeholder="选择开始加工日期"/>
<span class="demonstration">~</span>
<el-date-picker
v-model="endTime"
value-format="yyyy-MM-dd"
size="small"
style="width: 170px;margin:0px 10px"
type="date"
placeholder="选择加工完成日期"/>
<el-button type="success" class="el-icon-search" size="small" style="margin:0px 10px" @click="pageCurrent=1;total = 0;searchTable();">查询</el-button>
<!-- <el-tooltip :open-delay="1000" content="导出人员工时统计表" placement="right">-->
<!-- <el-button type="primary" size="small" icon="el-icon-download" style="margin:0px 10px" @click="exportUninquirySheet1()">导出</el-button>-->
<!-- </el-tooltip>-->
</el-card>
<el-row>
<el-col style="width: 400px">
<el-card>
<el-table
v-loading="loading"
:data="tableData"
highlight-current-row
size="mini"
stripe
style="width: 100%;"
height="700px"
border
element-loading-text="拼命加载中"
@row-click="searchTable2">
<el-table-column label="操作者" align="center" width="110px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column label="计划工时" align="center">
<template slot-scope="scope">
{{ scope.row.理论加工时间段 }}
</template>
</el-table-column>
<el-table-column label="加工工时" align="center">
<template slot-scope="scope">
{{ scope.row.实际加工时间段 }}
</template>
</el-table-column>
<el-table-column label="完成数量" align="center">
<template slot-scope="scope">
{{ scope.row.完成数量 }}
</template>
</el-table-column>
</el-table>
<div>
<el-pagination
v-if="!loading"
:current-page="pageCurrent"
:page-size="pageSize"
:total="total"
layout="total"/>
</div>
</el-card>
</el-col>
<el-col style="margin-left: 0px;width: 810px">
<el-card>
<el-table v-loading="loading2" :data="tableData2" size="mini" stripe highlight-current-row style="width: 100%;" height="700px" border element-loading-text="拼命加载中">
<el-table-column label="零件图号" align="center" width="170px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column label="零件名称" align="center" width="90px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<el-table-column label="工艺名称" align="center" width="70px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.工艺名称 }}
</template>
</el-table-column>
<el-table-column label="完成数量" align="center" width="70px">
<template slot-scope="scope">
{{ scope.row.完成数量 }}
</template>
</el-table-column>
<el-table-column label="序间质检" align="center" width="70px">
<template slot-scope="scope">
{{ scope.row.质检结果 }}
</template>
</el-table-column>
<el-table-column label="不合格数" align="center" width="70px">
<template slot-scope="scope">
{{ scope.row.不合格数量 }}
</template>
</el-table-column>
<el-table-column label="计划工时" align="center" width="70px">
<template slot-scope="scope">
{{ scope.row.理论加工时间段 }}
</template>
</el-table-column>
<el-table-column label="加工工时" align="center" width="70px">
<template slot-scope="scope">
{{ scope.row.实际加工时间段 }}
</template>
</el-table-column>
<el-table-column label="完成时间" align="center" width="100px">
<template slot-scope="scope">
{{ scope.row.加工完成时间 }}
</template>
</el-table-column>
</el-table>
<div>
<el-pagination
v-if="!loading2"
:current-page="pageCurrent2"
:page-size="pageSize2"
:total="total2"
layout="total"
@size-change="handleSizeChange2"
@current-change="handleCurrentChange2"/>
</div>
</el-card>
</el-col>
</el-row>
</div>
</template>
<script>
import { searchtable, searchtable2 } from '@/api/ManufacturingCenter/ScheduleCompletionDetails'
import { getNowTime, getNowTime1 } from '@/utils/tool'
export default {
data() {
return {
startTime: getNowTime1(), // 开始时间
endTime: getNowTime(), // 结束时间
tableData: [], // 操作者工时统计
loading: '',
tableData2: [], // 工序统计表
loading2: '',
pageCurrent: 1,
pageSize: 10000,
total: '',
pageCurrent2: 1,
pageSize2: 10000,
total2: '',
timeCheck: '',
operater: ''
}
},
created() {
this.searchTable()
},
methods: {
// 查询表格数据
searchTable() {
this.loading = true
this.tableData = []
this.tableData2 = []
this.total2 = 0
if (this.startTime !== '' && this.startTime !== null && this.endTime !== null && this.endTime !== null) {
this.timeCheck = 1
} else {
// this.startTime = ''
// this.endTime = ''
this.timeCheck = 0
}
searchtable(this.operater, this.timeCheck, this.startTime, this.endTime, this.pageCurrent, this.pageSize).then(response => {
if (response.data.total === 0) {
this.loading = false
} else {
this.total = response.data.total
this.tableData = response.data.rows
}
}).then(() => {
this.loading = false
})
}, // 获取工序表
searchTable2(row) {
this.loading2 = true
this.tableData2 = []
this.pageCurrent2 = 1
searchtable2(row.人员编号, this.timeCheck, this.startTime, this.endTime, this.pageCurrent2, this.pageSize2).then(response => {
if (response.data.rows.length !== 0) {
for (let i = 0; i < response.data.rows.length; i++) {
this.tableData2.push({
零件图号: response.data.rows[i].零件图号,
零件名称: response.data.rows[i].零件名称,
工艺名称: response.data.rows[i].工艺名称,
完成数量: response.data.rows[i].完成数量,
质检结果: response.data.rows[i].质检结果,
不合格数量: response.data.rows[i].不合格数量,
理论加工时间段: response.data.rows[i].理论加工时间段,
实际加工时间段: response.data.rows[i].实际加工时间段,
加工完成时间: response.data.rows[i].加工完成时间 ? response.data.rows[i].加工完成时间.split(' ')[0] : ''
})
}
}
this.loading2 = false
this.total2 = response.data.total
})
},
handleSizeChange2(val) {
this.pageCurrent2 = 1
this.pageSize2 = val
this.searchTable2()
},
handleCurrentChange2(val) {
this.pageCurrent2 = val
this.searchTable2()
}
}
}
</script>
<style scoped>
</style>