Files
JY1.0/src/views/ManufacturingCenter/MonthEndHourAccounting/index.vue
liushuai e314062d42 更新
2020-03-21 17:10:21 +08:00

236 lines
9.0 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div class="app-container">
<el-card>
<el-date-picker
v-model="startTime"
size="small"
type="daterange"
align="center"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
range-separator=""
style="width:250px;margin-left: 5px;margin-top: 10px;margin-bottom: 10px"
start-placeholder="开始日期"
end-placeholder="结束日期"/>
<el-input v-model="name" size="small" placeholder="操作工" style="width: 150px" clearable/>
<el-input v-model="partNumber" size="small" placeholder="零件图号" style="width: 150px" clearable/>
<el-tooltip :open-delay="600" effect="dark" content="筛选掉备料、热及外协工序" placement="top">
<el-checkbox v-model="check" class="remeberPassword">筛选</el-checkbox>
</el-tooltip>
<el-button size="small" type="primary" icon="el-icon-search" style="margin-left: 5px" plain @click="pageCurrent=1;pageSize=50;searchTable()">查询</el-button>
<el-button size="small" type="success" icon="el-icon-download" plain @click="exportExcel">导出</el-button>
</el-card>
<el-card>
<el-table v-loading="loading" :data="tableData" size="mini" style="max-height: 720px" height="720px" border @sort-change="sortChange">
<el-table-column align="center" label="跟单号" width="120px">
<template slot-scope="scope">
{{ scope.row.跟单号 }}
</template>
</el-table-column>
<el-table-column align="center" label="加工日期" width="110px" sortable="custom" prop="操作时间">
<template slot-scope="scope">
{{ scope.row.完成日期 }}
</template>
</el-table-column>
<el-table-column align="center" label="姓名" width="80px" sortable="custom" prop="姓名">
<template slot-scope="scope">
{{ scope.row.操作工 }}
</template>
</el-table-column>
<el-table-column align="center" label="图号" width="150px">
<template slot-scope="scope">
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column align="center" label="工序" width="50px">
<template slot-scope="scope">
{{ scope.row.工序顺序 }}
</template>
</el-table-column>
<el-table-column align="center" label="工序名称" width="80px">
<template slot-scope="scope">
{{ scope.row.工艺名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="完成数量" width="80px">
<template slot-scope="scope">
{{ scope.row.完成数量 }}
</template>
</el-table-column>
<el-table-column align="center" label="单件工时(分)" width="110px">
<template slot-scope="scope">
{{ scope.row.修补单件工时 }}
</template>
</el-table-column>
<el-table-column align="center" label="完成工时(分)" width="110px">
<template slot-scope="scope">
{{ scope.row.完成工时 }}
</template>
</el-table-column>
<el-table-column align="center" label="准结(分)" width="110px">
<template slot-scope="scope">
{{ scope.row.修补工时 }}
</template>
</el-table-column>
<el-table-column align="center" label="备注" width="200px" show-overflow-tooltip="">
<template slot-scope="scope">
{{ scope.row.备注 }}
</template>
</el-table-column>
<el-table-column align="center" label="扫码工时(分)" width="110px">
<template slot-scope="scope">
{{ scope.row.扫码工时 }}
</template>
</el-table-column>
<el-table-column align="center" label="工时比值" width="100px">
<template slot-scope="scope">
{{ scope.row.工时比值 }}
</template>
</el-table-column>
<!--<el-table-column align="center" label="废品件数" width="80px">-->
<!--<template slot-scope="scope">-->
<!--{{ scope.row.不合格数量 }}-->
<!--</template>-->
<!--</el-table-column>-->
<el-table-column align="center" label="计划准结(分)" width="110px">
<template slot-scope="scope">
{{ scope.row.准结定额工时 }}
</template>
</el-table-column>
<el-table-column align="center" label="计划定额(分)" width="110px">
<template slot-scope="scope">
{{ scope.row.单件定额工时 }}
</template>
</el-table-column>
<el-table-column align="center" label="计划工时(分)" width="110px">
<template slot-scope="scope">
{{ scope.row.计划工时 }}
</template>
</el-table-column>
<el-table-column align="center" label="项目名称" width="130px">
<template slot-scope="scope">
{{ scope.row.项目名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="机床图号" width="100px">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column align="center" label="组号" width="70px">
<template slot-scope="scope">
{{ scope.row.组号 }}
</template>
</el-table-column>
<el-table-column align="center" label="设计者" width="70px">
<template slot-scope="scope">
{{ scope.row.设计者 }}
</template>
</el-table-column>
<el-table-column align="center" label="材料" width="150px">
<template slot-scope="scope">
{{ scope.row.材料 }}
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
v-if="!loading"
:current-page="pageCurrent"
:page-sizes="[50, 100, 200, 300]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
</div>
</template>
<script>
import { searchTable } from '@/api/ManufacturingCenter/MonthEndHourAccounting'
export default {
data() {
return {
check: 0,
orderName: 0,
order: 0,
startTime: '',
name: '',
partNumber: '',
tableData: [],
loading: false,
total: 0, // 总条数
pageSize: 50, // 每页显示条数
pageCurrent: 1 // 后台获取页
}
},
methods: {
exportExcel() {
if (this.tableData.length === 0) {
this.$message.warning('请查询出要导出的数据')
return
}
let check, check1, check2
this.name ? check = 1 : check = 0
this.partNumber ? check1 = 1 : check1 = 0
this.check ? check2 = 1 : check2 = 0
var param = []
param[0] = ['开始时间', this.startTime[0]]
param[1] = ['结束时间', this.startTime[1]]
param[2] = ['排序名称', this.orderName]
param[3] = ['排序方式', this.order]
param[4] = ['筛选', check2]
param[5] = ['操作工_check', check]
param[6] = ['操作工', this.name]
param[7] = ['零件图号_check', check1]
param[8] = ['零件图号', this.partNumber]
var Data = this.CreateData('2001', '报表_工艺月底工时核算_查询数据', param)
this.exportExcel_NPOI(Data)
},
sortChange(column, prop, order) {
if (column.prop === '姓名') {
this.orderName = 1
} else if (column.prop === '操作时间') { this.orderName = 2 } else {
this.orderName = 2
}
if (column.order === 'ascending') {
this.order = 1
} else if (column.order === 'descending') { this.order = 2 } else {
this.order = 0
}
this.searchTable()
},
searchTable() {
if (this.startTime[0] && this.startTime[1]) {
let check, check1, check2
this.name ? check = 1 : check = 0
this.partNumber ? check1 = 1 : check1 = 0
this.loading = true
this.check ? check2 = 1 : check2 = 0
searchTable(check2, this.startTime[0], this.startTime[1], this.orderName, this.order, check, this.name, check1, this.partNumber, this.pageCurrent, this.pageSize).then(response => {
response.data.rows.map(v => {
this.$set(v, '工时比值', parseInt(v.计划工时) === 0 ? 0 : (Math.round(parseInt(v.完成工时) / parseInt(v.计划工时) * 100) / 100.00))
})
this.tableData = response.data.rows
this.total = response.data.total
this.loading = false
})
} else {
this.$message.warning('请选择时间段')
}
},
// 分页
handleSizeChange(val) {
this.pageCurrent = 1
this.pageSize = val
this.searchTable()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.searchTable()
}
}
}
</script>