From 8031c7b9af5d97cc6806484c305210298bb6103c Mon Sep 17 00:00:00 2001 From: Vergil <974548713@qq.com> Date: Tue, 25 Feb 2020 10:48:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=BA=E5=BA=8A=E5=B7=A5=E6=97=B6=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ContractDetailsInquiry.js | 4 +- .../ContractDetailsInquiry/index.vue | 100 +++++++++++------- 2 files changed, 61 insertions(+), 43 deletions(-) diff --git a/src/api/ManufacturingCenter/ContractDetailsInquiry.js b/src/api/ManufacturingCenter/ContractDetailsInquiry.js index c36b006f..5bd24d55 100644 --- a/src/api/ManufacturingCenter/ContractDetailsInquiry.js +++ b/src/api/ManufacturingCenter/ContractDetailsInquiry.js @@ -32,7 +32,7 @@ export function initMachine(projectNum) { } // 查询项目详情 -export function searchatabledata(projectNum, machineValue) { +export function searchatabledata(projectNum, machineValue, pageCurrent, pageSize) { return request({ url: '', method: 'post', @@ -41,7 +41,7 @@ export function searchatabledata(projectNum, machineValue) { ModularID: router.currentRoute.path, type: '1', name: '项目工时统计_合同详情查询_工时综合查询', - param: `项目流水号=${projectNum}&机床流水号=${machineValue}` + param: `项目流水号=${projectNum}&机床流水号=${machineValue}&PageCurrent=${pageCurrent}&PageSize=${pageSize}&PageCount=1111=int=output&ItemCount=1111=int=output` } }) } diff --git a/src/views/ManufacturingCenter/ContractDetailsInquiry/index.vue b/src/views/ManufacturingCenter/ContractDetailsInquiry/index.vue index 1cf3b9ce..c57bf203 100644 --- a/src/views/ManufacturingCenter/ContractDetailsInquiry/index.vue +++ b/src/views/ManufacturingCenter/ContractDetailsInquiry/index.vue @@ -106,6 +106,17 @@ +
+ +
@@ -125,7 +136,10 @@ export default { specificationValue: '', // 规格型号 totalProcessingHours: '', // 加工总工时 totalPlannedHours: '', // 计划总工时 - tableData: [] // 详情表 + tableData: [], // 详情表 + total: 0, // 总条数 + pageSize: 50, // 每页显示条数 + pageCurrent: 1 // 后台获取页 } }, created() { @@ -135,6 +149,7 @@ export default { fetchData() { this.getSelect(initProject, ['项目名称', '项目流水号'], 'project') }, + // 查询按钮 typeChange() { this.machineValue = '' this.machine = [] @@ -146,64 +161,67 @@ export default { }) } }) - }, // 查询按钮 + }, + // 分页查询 searchTable() { this.tableData = [] if (this.machineValue) { this.loading = true - searchatabledata(this.projectValue, this.machineValue).then(response => { - if (response.data.length !== 0) { - for (let i = 0; i < response.data.length; i++) { + searchatabledata(this.projectValue, this.machineValue, this.pageCurrent, this.pageSize).then(response => { + this.loading = false + if (response.data.result.length !== 0) { + for (let i = 0; i < response.data.result.length; i++) { this.tableData.push({ - 跟单号: response.data[i].跟单号, - 序号: response.data[i].工序顺序, - 工序名: response.data[i].工艺名称, - 计划数量: response.data[i].批次数量, - 计划准备工时: response.data[i].准结定额工时, - 单件计划工时: response.data[i].单件定额工时, - 计划工时: response.data[i].计划工时, - 计划加工日期: response.data[i].计划日期.split(' ')[0], - 加工数量: response.data[i].完成数量, - 加工准备工时: response.data[i].修补准结工时, - 加工工时: response.data[i].设备工时, - 扫码工时: response.data[i].扫码工时, - 辅助工时: response.data[i].辅助工时, - 工时比值: Number(response.data[i].计划工时) === 0 ? 0 : Math.round(response.data[i].扫码工时 / Number(response.data[i].计划工时) * 100) / 100.00, - 加工日期: response.data[i].操作时间, - 图号及规格: response.data[i].零件图号_零件工艺计划, - 制品名称: response.data[i].零件名称 + 跟单号: response.data.result[i].跟单号, + 序号: response.data.result[i].工序顺序, + 工序名: response.data.result[i].工艺名称, + 计划数量: response.data.result[i].批次数量, + 计划准备工时: response.data.result[i].准结定额工时, + 单件计划工时: response.data.result[i].单件定额工时, + 计划工时: response.data.result[i].计划工时, + 计划加工日期: response.data.result[i].计划日期.split(' ')[0], + 加工数量: response.data.result[i].完成数量, + 加工准备工时: response.data.result[i].修补准结工时, + 加工工时: response.data.result[i].设备工时, + 扫码工时: response.data.result[i].扫码工时, + 辅助工时: response.data.result[i].辅助工时, + 工时比值: Number(response.data.result[i].计划工时) === 0 ? 0 : Math.round(response.data.result[i].扫码工时 / Number(response.data.result[i].计划工时) * 100) / 100.00, + 加工日期: response.data.result[i].操作时间, + 图号及规格: response.data.result[i].零件图号_零件工艺计划, + 制品名称: response.data.result[i].零件名称 }) } - this.loading = false } + this.total = parseInt(response.data.output[0].ItemCount) }) } else { this.$message.warning('请选择要查询的机床') } }, - 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] + param[1] = ['机床流水号', this.machineValue] + param[2] = ['PageCurrent', 1] + param[3] = ['PageSize', 999999] + param[4] = ['PageCount', '1111', 'int', '1'] + param[5] = ['ItemCount', '1111', 'int', '1'] + var Data = this.CreateData('2001', '报表_机床工时统计_查询', param) + this.exportExcel_NPOI(Data) + }, + // 分页 + handleSizeChange(val) { + this.pageCurrent = 1 + this.pageSize = val + this.searchTable() + }, + handleCurrentChange(val) { + this.pageCurrent = val + this.searchTable() } } }