机床工时统计

This commit is contained in:
Vergil
2020-02-25 10:48:20 +08:00
parent 12c9a60eeb
commit 8031c7b9af
2 changed files with 61 additions and 43 deletions

View File

@@ -32,7 +32,7 @@ export function initMachine(projectNum) {
} }
// 查询项目详情 // 查询项目详情
export function searchatabledata(projectNum, machineValue) { export function searchatabledata(projectNum, machineValue, pageCurrent, pageSize) {
return request({ return request({
url: '', url: '',
method: 'post', method: 'post',
@@ -41,7 +41,7 @@ export function searchatabledata(projectNum, machineValue) {
ModularID: router.currentRoute.path, ModularID: router.currentRoute.path,
type: '1', type: '1',
name: '项目工时统计_合同详情查询_工时综合查询', name: '项目工时统计_合同详情查询_工时综合查询',
param: `项目流水号=${projectNum}&机床流水号=${machineValue}` param: `项目流水号=${projectNum}&机床流水号=${machineValue}&PageCurrent=${pageCurrent}&PageSize=${pageSize}&PageCount=1111=int=output&ItemCount=1111=int=output`
} }
}) })
} }

View File

@@ -106,6 +106,17 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </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> </el-card>
</div> </div>
</template> </template>
@@ -125,7 +136,10 @@ export default {
specificationValue: '', // 规格型号 specificationValue: '', // 规格型号
totalProcessingHours: '', // 加工总工时 totalProcessingHours: '', // 加工总工时
totalPlannedHours: '', // 计划总工时 totalPlannedHours: '', // 计划总工时
tableData: [] // 详情表 tableData: [], // 详情表
total: 0, // 总条数
pageSize: 50, // 每页显示条数
pageCurrent: 1 // 后台获取页
} }
}, },
created() { created() {
@@ -135,6 +149,7 @@ export default {
fetchData() { fetchData() {
this.getSelect(initProject, ['项目名称', '项目流水号'], 'project') this.getSelect(initProject, ['项目名称', '项目流水号'], 'project')
}, },
// 查询按钮
typeChange() { typeChange() {
this.machineValue = '' this.machineValue = ''
this.machine = [] this.machine = []
@@ -146,64 +161,67 @@ export default {
}) })
} }
}) })
}, // 查询按钮 },
// 分页查询
searchTable() { searchTable() {
this.tableData = [] this.tableData = []
if (this.machineValue) { if (this.machineValue) {
this.loading = true this.loading = true
searchatabledata(this.projectValue, this.machineValue).then(response => { searchatabledata(this.projectValue, this.machineValue, this.pageCurrent, this.pageSize).then(response => {
if (response.data.length !== 0) { this.loading = false
for (let i = 0; i < response.data.length; i++) { if (response.data.result.length !== 0) {
for (let i = 0; i < response.data.result.length; i++) {
this.tableData.push({ this.tableData.push({
跟单号: response.data[i].跟单号, 跟单号: response.data.result[i].跟单号,
序号: response.data[i].工序顺序, 序号: response.data.result[i].工序顺序,
工序名: response.data[i].工艺名称, 工序名: response.data.result[i].工艺名称,
计划数量: response.data[i].批次数量, 计划数量: response.data.result[i].批次数量,
计划准备工时: response.data[i].准结定额工时, 计划准备工时: response.data.result[i].准结定额工时,
单件计划工时: response.data[i].单件定额工时, 单件计划工时: response.data.result[i].单件定额工时,
计划工时: response.data[i].计划工时, 计划工时: response.data.result[i].计划工时,
计划加工日期: response.data[i].计划日期.split(' ')[0], 计划加工日期: response.data.result[i].计划日期.split(' ')[0],
加工数量: response.data[i].完成数量, 加工数量: response.data.result[i].完成数量,
加工准备工时: response.data[i].修补准结工时, 加工准备工时: response.data.result[i].修补准结工时,
加工工时: response.data[i].设备工时, 加工工时: response.data.result[i].设备工时,
扫码工时: response.data[i].扫码工时, 扫码工时: response.data.result[i].扫码工时,
辅助工时: response.data[i].辅助工时, 辅助工时: response.data.result[i].辅助工时,
工时比值: Number(response.data[i].计划工时) === 0 ? 0 : Math.round(response.data[i].扫码工时 / Number(response.data[i].计划工时) * 100) / 100.00, 工时比值: Number(response.data.result[i].计划工时) === 0 ? 0 : Math.round(response.data.result[i].扫码工时 / Number(response.data.result[i].计划工时) * 100) / 100.00,
加工日期: response.data[i].操作时间, 加工日期: response.data.result[i].操作时间,
图号及规格: response.data[i].零件图号_零件工艺计划, 图号及规格: response.data.result[i].零件图号_零件工艺计划,
制品名称: response.data[i].零件名称 制品名称: response.data.result[i].零件名称
}) })
} }
this.loading = false
} }
this.total = parseInt(response.data.output[0].ItemCount)
}) })
} else { } else {
this.$message.warning('请选择要查询的机床') this.$message.warning('请选择要查询的机床')
} }
}, },
formatJson(filterVal, jsonData) {
return jsonData.map(v => filterVal.map(j => {
return v[j]
}))
},
exportExcel() { exportExcel() {
if (this.tableData.length === 0) { if (this.tableData.length === 0) {
this.$message.warning('请查询出要导出的数据') this.$message.warning('请查询出要导出的数据')
return return
} }
import('@/vendor/Export2Excel').then(excel => { var param = []
const tHeader = ['跟单号', '工序', '工序名', '计划件数', '计划准结(分)', '计划定额(分)', '计划工时(分)', '计划加工日期', '加工件数', '录入准结(分)', '加工工时(分)', '扫码工时(分)', '辅助工时(分)', '工时比值', '加工日期', '图号及规格', '制品名称'] param[0] = ['项目流水号', this.projectValue]
const filterVal = ['跟单号', '序号', '工序名', '计划数量', '计划准备工时', '单件计划工时', '计划工时', '计划加工日期', '加工数量', '加工准备工时', '加工工时', '扫码工时', '辅助工时', '工时比值', '加工日期', '图号及规格', '制品名称'] param[1] = ['机床流水号', this.machineValue]
const list = this.tableData param[2] = ['PageCurrent', 1]
const data = this.formatJson(filterVal, list) param[3] = ['PageSize', 999999]
excel.export_json_to_excel({ param[4] = ['PageCount', '1111', 'int', '1']
header: tHeader, param[5] = ['ItemCount', '1111', 'int', '1']
data, var Data = this.CreateData('2001', '报表_机床工时统计_查询', param)
filename: '机床工时表', this.exportExcel_NPOI(Data)
autoWidth: true, },
bookType: 'xlsx' // 分页
}) handleSizeChange(val) {
}) this.pageCurrent = 1
this.pageSize = val
this.searchTable()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.searchTable()
} }
} }
} }