月底工时核算

This commit is contained in:
Vergil
2020-02-25 09:30:11 +08:00
parent ba5cbadf7b
commit 903f8d6062
5 changed files with 64 additions and 53 deletions

View File

@@ -2,7 +2,7 @@ import request from '@/utils/request'
import state from '@/store'
import router from '@/router'
export function searchTable(time, time1) {
export function searchTable(time, time1, order, orderName, pageCurrent, pageSize) {
return request({
url: '',
method: 'post',
@@ -11,7 +11,8 @@ export function searchTable(time, time1) {
ModularID: router.currentRoute.path,
type: '1',
name: '工艺月底工时核算_查询数据',
param: '开始时间=' + time + '&结束时间=' + time1
param: '开始时间=' + time + '&结束时间=' + time1 + '&排序名称=' + order + '&排序方式=' + orderName,
Pagination: pageCurrent + '&' + pageSize
}
})
}

View File

@@ -1,7 +1,6 @@
<template>
<div class="app-container">
<el-card>
<span>项目名称</span>
<el-select v-model="projectValue" filterable clearable size="small" style="margin-right:10px;width: 150px" placeholder="项目名称" @change="typeChange">
<el-option
v-for="item in project"
@@ -9,7 +8,6 @@
:label="item.label"
:value="item.value"/>
</el-select>
<span>机床名称</span>
<el-select v-model="machineValue" clearable filterable size="small" style="margin-right:10px;width: 150px" placeholder="机床名称">
<el-option
v-for="item in machine"
@@ -17,20 +15,6 @@
:label="item.label"
:value="item.value"/>
</el-select>
<!-- <span>分组</span>-->
<!-- <el-select v-model="partValue" clearable filterable size="small" style="margin-right:10px;width: 80px" placeholder="分组">-->
<!-- <el-option-->
<!-- v-for="item in part"-->
<!-- :key="item.value"-->
<!-- :label="item.label"-->
<!-- :value="item.value"/>-->
<!-- </el-select>-->
<!-- <span>规格及型号</span>-->
<!-- <el-input v-model="specificationValue" clearable size="small" style="margin-right:10px;width: 150px" placeholder="规格型号"/>-->
<!--<span>加工总工时小时:</span>-->
<!--<el-input v-model="totalProcessingHours" clearable size="small" style="margin-right:10px;width: 100px"/>-->
<!--<span>计划总工时小时:</span>-->
<!--<el-input v-model="totalPlannedHours" clearable size="small" style="margin-right:10px;width: 100px"/>-->
<el-button size="small" type="primary" icon="el-icon-search" style="margin: 0 0 0 10px" plain @click="searchTable()">查询</el-button>
<el-button size="small" type="primary" icon="el-icon-download" style="margin: 0 0 0 10px" plain @click="exportExcel()">导出</el-button>
</el-card>

View File

@@ -1,6 +1,6 @@
<template>
<div class="app-container">
<el-card style="width: 685px;">
<el-card style="width: 720px;">
<el-date-picker
v-model="startTime"
value-format="yyyy-MM-dd"
@@ -21,8 +21,8 @@
<el-button type="primary" size="small" plain icon="el-icon-download" @click="exportTable()">导出</el-button>
</el-tooltip>
</el-card>
<el-card style="width: 685px">
<el-table v-loading="loading" :data="tableData" size="mini" stripe style="width: 685px" height="650px" border element-loading-text="拼命加载中">
<el-card style="width: 720px">
<el-table v-loading="loading" :data="tableData" size="mini" stripe height="650px" border element-loading-text="拼命加载中">
<el-table-column label="操作者" align="center" width="110px">
<template slot-scope="scope">
{{ scope.row.姓名 }}

View File

@@ -12,12 +12,12 @@
style="width:250px;margin-left: 5px;margin-top: 10px;margin-bottom: 10px"
start-placeholder="开始日期"
end-placeholder="结束日期"/>
<el-button size="small" type="primary" icon="el-icon-search" style="margin-left: 5px" plain @click="searchTable">查询</el-button>
<el-button size="small" type="primary" icon="el-icon-search" style="margin-left: 5px" plain @click="searchTable()">查询</el-button>
<el-button size="small" type="primary" 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>
<el-table-column align="center" label="姓名" width="70px">
<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="80px" sortable="custom" prop="姓名">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
@@ -77,16 +77,16 @@
{{ 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="100px">
<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="110px">
<template slot-scope="scope">
{{ scope.row.准结定额工时 }}
@@ -128,6 +128,17 @@
</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>
@@ -136,49 +147,64 @@ import { searchTable } from '@/api/ManufacturingCenter/MonthEndHourAccounting'
export default {
data() {
return {
tableData: [],
orderName: 0,
order: 0,
startTime: '',
loading: false
tableData: [],
loading: false,
total: 0, // 总条数
pageSize: 50, // 每页显示条数
pageCurrent: 1 // 后台获取页
}
},
methods: {
formatJson(filterVal, jsonData) {
return jsonData.map(v => filterVal.map(j => {
return v[j]
}))
},
exportExcel() {
if (this.tableData.length === 0) {
this.$message.warning('请查询出要导出的数据')
return
}
import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['日期', '姓名', '图号', '跟单号', '工序', '工序名', '录入准结(分)', '实际工时(分)', '扫码工时(分)', '辅助工时(分)', '工时比值', '合格件数', '废品件数', '备注', '计划准结(分)', '计划定额(分)', '计划工时(分)', '项目名称', '机床图号', '组号', '设计', '材料']
const filterVal = ['操作时间', '姓名', '零件图号_零件工艺计划', '跟单号', '工序顺序', '工艺名称', '修补准结工时', '设备工时', '扫码工时', '辅助工时', '工时比值', '合格数量', '不合格数量', '备注', '准结定额工时', '单件定额工时', '计划工时', '项目名称', '机床图号', '组号', '设计者', '材料']
const list = this.tableData
const data = this.formatJson(filterVal, list)
excel.export_json_to_excel({
header: tHeader,
data,
filename: '月工时核算表',
autoWidth: true,
bookType: 'xlsx'
})
})
var param = []
param[0] = ['项目流水号', this.projectValue]
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]) {
this.loading = true
searchTable(this.startTime[0], this.startTime[1]).then(response => {
response.data.map(v => {
searchTable(this.startTime[0], this.startTime[1], this.orderName, this.order, this.pageCurrent, this.pageSize).then(response => {
response.data.rows.map(v => {
this.$set(v, '工时比值', v.计划工时 === 0 ? 0 : Math.round(v.扫码工时 / v.计划工时 * 100) / 100.00)
})
this.tableData = response.data
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()
}
}
}

View File

@@ -100,7 +100,7 @@ export default {
exportExcel() {
var param = []
param[0] = ['项目流水号', this.projectValue]
var Data = this.CreateData('12', '车间采购管理_项目总价_明细_查询数据_导出', param)
var Data = this.CreateData('2001', '车间采购管理_项目总价_明细_查询数据_导出', param)
this.exportExcel_NPOI(Data)
},
searchTable1() {