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/api/ManufacturingCenter/MonthEndHourAccounting.js b/src/api/ManufacturingCenter/MonthEndHourAccounting.js index 6d45f4dc..630819a4 100644 --- a/src/api/ManufacturingCenter/MonthEndHourAccounting.js +++ b/src/api/ManufacturingCenter/MonthEndHourAccounting.js @@ -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 } }) } diff --git a/src/api/ManufacturingCenter/PartWorkCraftSelect_rdlc.js b/src/api/ManufacturingCenter/PartWorkCraftSelect_rdlc.js index dc8b0c80..02349744 100644 --- a/src/api/ManufacturingCenter/PartWorkCraftSelect_rdlc.js +++ b/src/api/ManufacturingCenter/PartWorkCraftSelect_rdlc.js @@ -44,7 +44,7 @@ export function initPerson() { }) } // 查询 -export function search(pageCurrent, pageSize, check1, val1, check2, val2, check3, val3, check4, val4) { +export function search(pageCurrent, pageSize, check1, val1, check2, val2, check3, val3, check4, val4, check5, val5, val6) { return request({ url: '', method: 'post', @@ -53,7 +53,7 @@ export function search(pageCurrent, pageSize, check1, val1, check2, val2, check3 ModularID: router.currentRoute.path, type: '1', name: '车间生产管理工艺_零件工序_查询数据_已编制工序的全部零件及工序_按机床分组图号人员查', - param: `机床流水号_check=${check1}&机床流水号=${val1}&组件流水号_check=${check2}&组件流水号=${val2}&零件图号_check=${check3}&零件图号=${val3}&人员编号_check=${check4}&人员编号=${val4}`, + param: `机床流水号_check=${check1}&机床流水号=${val1}&组件流水号_check=${check2}&组件流水号=${val2}&零件图号_check=${check3}&零件图号=${val3}&人员编号_check=${check4}&人员编号=${val4}&编制时间_check=${val5}&编制开始时间=${val5}&编制结束时间=${val6}`, Pagination: pageCurrent + '&' + pageSize } }) diff --git a/src/components/AmountInputBox/AmountInputBox.js b/src/components/AmountInputBox/AmountInputBox.js new file mode 100644 index 00000000..3332bd83 --- /dev/null +++ b/src/components/AmountInputBox/AmountInputBox.js @@ -0,0 +1,80 @@ +/** + * @desc 验证整数类型数字方法 + * @param {Object} e + * @param {regular} reg 正则 + * @param {Number} charcode 键盘code + * */ +const checkNumber = (e, reg, charcode) => { + if (!reg.test(String.fromCharCode(charcode)) && charcode > 9 && !e.ctrlKey) { + if (e.preventDefault) { + e.preventDefault() + } else { + e.returnValue = false + } + } +} + +/** + * @desc 验证浮点类型小数方法(建议用text类型的表单) + * @param {Object} e + * @param {regular} reg 正则 + * @param {Number} charcode 键盘code + * @param {Object} el dom对象 + * */ +const checkFloat = (e, reg, charcode, el) => { + if (charcode === 46) { + if (el.children[0].value.includes('.')) { + e.preventDefault() + } + return + } else if ( + !reg.test(String.fromCharCode(charcode)) && + charcode > 9 && + !e.ctrlKey + ) { + if (e.preventDefault) { + e.preventDefault() + } else { + e.returnValue = false + } + } +} + +/** + * @author LeeYunxiang + * @description 限制数字输入格式 int => 正整数 , num => 自然数(正整数包括0) , float => 正数包括小数(建议用text类型的input表单) + * */ +export default { + key: 'positive', + func: { + inserted(el, bind) { + el.addEventListener('keypress', e => { + e = e || window.event + const charcode = typeof e.charCode === 'number' ? e.charCode : e.keyCode + let reg = null + switch (bind.value) { + case 'num': + reg = /\d/ + checkNumber(e, reg, charcode) + break + case 'int': + if (el.children[0].value.length === 0) { + reg = /^[1-9]$/ + } else { + reg = /\d/ + } + checkNumber(e, reg, charcode) + break + case 'float': + reg = /\d/ + checkFloat(e, reg, charcode, el) + break + case 'notZero': + reg = (/^[1-9][0-9]*$/) + checkFloat(e, reg, charcode, el) + break + } + }) + } + } +} diff --git a/src/components/AmountInputBox/index.js b/src/components/AmountInputBox/index.js new file mode 100644 index 00000000..75190d55 --- /dev/null +++ b/src/components/AmountInputBox/index.js @@ -0,0 +1,11 @@ +import AmountInputBox from './AmountInputBox.js' +const directives = [AmountInputBox] +export default { + install: Vue => { + if (directives.length && directives.length > 0) { + directives.map(item => { + Vue.directive(item.key, item.func) + }) + } + } +} diff --git a/src/main.js b/src/main.js index 729e3d4d..42e86a8b 100644 --- a/src/main.js +++ b/src/main.js @@ -22,6 +22,10 @@ import 'viewerjs/dist/viewer.css' import VueBarcode from '@xkeshi/vue-barcode' import Direction from 'vue-direction-key' import elDragDialog from '@/directive/el-dragDialog' +// 全局数字、金额输入框组件 +import directive from './components/AmountInputBox/index.js' +Vue.use(directive) + Vue.use(elDragDialog) Vue.component('barcode', VueBarcode) Vue.use(Direction) diff --git a/src/views/BasicData/WorkshopProcessMaintenance/index.vue b/src/views/BasicData/WorkshopProcessMaintenance/index.vue index 051f23e5..d9d50248 100644 --- a/src/views/BasicData/WorkshopProcessMaintenance/index.vue +++ b/src/views/BasicData/WorkshopProcessMaintenance/index.vue @@ -1,128 +1,85 @@ @@ -136,49 +147,67 @@ 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.startTime[0]] + param[1] = ['结束时间', this.startTime[1]] + param[2] = ['排序名称', this.orderName] + param[3] = ['排序方式', this.order] + 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() } } } diff --git a/src/views/ManufacturingCenter/PartWorkCraftSelect_rdlc/index.vue b/src/views/ManufacturingCenter/PartWorkCraftSelect_rdlc/index.vue index 1cb6a61a..ad51a8d0 100644 --- a/src/views/ManufacturingCenter/PartWorkCraftSelect_rdlc/index.vue +++ b/src/views/ManufacturingCenter/PartWorkCraftSelect_rdlc/index.vue @@ -28,63 +28,66 @@ :label="item.label" :value="item.value"/> + 查询 - 零件工艺调整 + 打回重新编制 - + - - - + + + - + - + - + - + - + + + + -
+
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -