| | |
| | | request.post(`/processCard/selectNoCard/${orderId}/${productionId}`, filterData.value).then((res) => { |
| | | |
| | | if (res.code == 200) { |
| | | console.log(res.data.data) |
| | | //console.log(res.data) |
| | | pageTotal.value = res.data.total |
| | | produceList = produceList.value.concat(deepClone(res.data.data)) |
| | | xGrid.value.reloadData(produceList) |
| | |
| | | },//表头参数 |
| | | columns:[ |
| | | {type: 'checkbox', fixed: "left", title: '选择'}, |
| | | {field: 'orderDetail.orderNumber', title: '订序',filters:[{ data: '' }],slots: { filter: 'num1_filter' } }, |
| | | {field: 'orderDetail.shape', title: '形状', showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, |
| | | {field: 'orderDetail.width', title: '宽', filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, |
| | | {field: 'orderDetail.height', title: '高',filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, |
| | | {field: 'orderDetail.quantity', title: '数量', showOverflow:"ellipsis"}, |
| | | {field: 'orderDetail.computeGrossArea', title: '面积'}, |
| | | {field: 'product.totalThickness', title: '总厚度'}, |
| | | {field: 'product.thickness', title: '玻璃厚度'}, |
| | | {field: 'orderDetail.weight', title: '重量'} |
| | | {field: 'orderNumber', title: '订序',filters:[{ data: '' }],slots: { filter: 'num1_filter' } }, |
| | | {field: 'shape', title: '形状', showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, |
| | | {field: 'width', title: '宽', filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, |
| | | {field: 'height', title: '高',filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, |
| | | {field: 'baiscQuantity', title: '数量', showOverflow:"ellipsis"}, |
| | | {field: 'computeGrossArea', title: '面积'}, |
| | | {field: 'totalThickness', title: '总厚度'}, |
| | | {field: 'thickness', title: '玻璃厚度'}, |
| | | {field: 'weight', title: '重量'} |
| | | ],//表头按钮 |
| | | |
| | | toolbarConfig: { |
| | | // buttons: [{ |
| | | // |
| | | // }], |
| | | import: false, |
| | | export: true, |
| | | print: true, |
| | | // import: false, |
| | | // export: true, |
| | | // print: true, |
| | | zoom: true, |
| | | custom: true |
| | | }, |
| | |
| | | },//表头参数 |
| | | columns:[ |
| | | {type: 'checkbox', fixed: "left", title: '选择'}, |
| | | {field: 'orderDetail.orderNumber', title: '流程卡号',filters:[{ data: '' }],slots: { filter: 'num1_filter' },width:130 }, |
| | | {field: 'orderDetail.shape', title: '订序', showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, |
| | | {field: 'orderDetail.width', title: '落架顺序', filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, |
| | | {field: 'orderDetail.height', title: '形状',filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, |
| | | {field: 'orderDetail.quantity', title: '长边', showOverflow:"ellipsis"}, |
| | | {field: 'orderDetail.computeGrossArea', title: '短边'}, |
| | | {field: 'product.totalThickness', title: '总数量'}, |
| | | {field: 'product.totalThickness', title: '总厚度'}, |
| | | {field: 'processId', title: '流程卡号',filters:[{ data: '' }],slots: { filter: 'num1_filter' },width:130 }, |
| | | {field: 'orderNumber', title: '订序', showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, |
| | | {field: 'landingSequence', title: '落架顺序', filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, |
| | | {field: 'shape', title: '形状',filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, |
| | | {field: 'width', title: '宽', showOverflow:"ellipsis"}, |
| | | {field: 'height', title: '高'}, |
| | | {field: 'quantity', title: '总数量'}, |
| | | {field: 'totalThickness', title: '总厚度'}, |
| | | ],//表头按钮 |
| | | |
| | | toolbarConfig: { |
| | |
| | | } |
| | | |
| | | }) |
| | | //创建流程卡 |
| | | const createProcessCard = () => { |
| | | const $grid = xGrid.value |
| | | const checkedList = $grid.getCheckboxRecords() |
| | | if(checkedList.length===0){ |
| | | ElMessage.warning("请先选择右侧数据") |
| | | return |
| | | } |
| | | //productionId |
| | | const $gridLeft = xGridLeft.value |
| | | const leftData = $gridLeft.getTableData().fullData |
| | | let index = 1 |
| | | if(leftData.length!==0){ |
| | | index = leftData[0].landingSequence + 1 |
| | | //index = index.toString().padStart(2, '0') |
| | | } |
| | | const processId = productionId + index.toString().padStart(2, '0') |
| | | checkedList.forEach((item) => { |
| | | item.processId = processId |
| | | item.landingSequence = index |
| | | }) |
| | | $gridLeft.insertAt(checkedList) |
| | | $grid.remove(checkedList) |
| | | } |
| | | |
| | | let checkedNum = ref('') |
| | | |
| | | //向右边表格添加数据 |
| | | const addRight = () => { |
| | | try{ |
| | | //左边表格定义 |
| | | const $gridLeft = xGridLeft.value |
| | | //右边表格定义 |
| | | const $grid = xGrid.value |
| | | //获取左边表格checkbox选中的数据 |
| | | const checkedList = $gridLeft.getCheckboxRecords() |
| | | //判断左边表格是否有选中的数据 |
| | | if(checkedList.length===0){ |
| | | ElMessage.warning("请先选择左侧数据") |
| | | return |
| | | } |
| | | const regex = /^(\d+|)$/; |
| | | if(!regex.test(checkedNum.value)){ |
| | | ElMessage.warning("请输入正整数") |
| | | return |
| | | } |
| | | //判断正整数 |
| | | if(/^[1-9]\d*$/.test(checkedNum.value)){ |
| | | //对选中的左边表格数据进行循环 |
| | | checkedList.forEach((item)=> { |
| | | //判断可用数量是否大于等于输入的数量,不满足则抛出异常 |
| | | if(item.quantity <checkedNum.value) throw new Error("请输入小于等于可用数量的数字"); |
| | | //左边表格可用数量减去输入的数量 |
| | | item.quantity = item.quantity-checkedNum.value |
| | | //右边表格数据 |
| | | let rightData = $grid.getTableData().fullData |
| | | //右边表格数据中查找当前数据下标 |
| | | let filterIndex = rightData.findIndex(item1 => item1.orderNumber === item.orderNumber) |
| | | //如果右边表格数据中存在当前数据则数量相加 |
| | | if (filterIndex>=0){ |
| | | rightData[filterIndex].baiscQuantity =rightData[filterIndex].baiscQuantity*1+ checkedNum.value*1 |
| | | //如果左边数量为0时删除此条数据 |
| | | if(item.quantity=== 0){ |
| | | $gridLeft.remove(item) |
| | | } |
| | | }else { |
| | | //右边表格没有此条数据则往右边表格插入数据 |
| | | item.baiscQuantity = checkedNum.value |
| | | $grid.insert(item) |
| | | } |
| | | }) |
| | | }else if(checkedNum.value===''){//判断数量输入框有无输入数字 |
| | | |
| | | checkedList.forEach((item)=> { |
| | | let rightData = $grid.getTableData().fullData |
| | | let filterIndex = rightData.findIndex(item1 => item1.orderNumber === item.orderNumber) |
| | | //无输入并且如果右边表格数据中存在当前数据则数量相加 |
| | | if(filterIndex>-1){ |
| | | rightData[filterIndex].baiscQuantity =rightData[filterIndex].baiscQuantity*1+ item.quantity*1 |
| | | }else{ |
| | | $grid.insert(item) |
| | | } |
| | | |
| | | $gridLeft.remove(item) |
| | | }) |
| | | } |
| | | |
| | | } |
| | | catch (e){ |
| | | ElMessage.warning(e.message) |
| | | } |
| | | } |
| | | //向左边表格添加数据 |
| | | const addLeft = () => { |
| | | |
| | | } |
| | | |
| | | |
| | | </script> |
| | |
| | | <el-main width="12%" style=""> |
| | | <span>未分数量:45</span><br> |
| | | <span>未分重量:333</span><br> |
| | | <span>选中数量:<el-input></el-input></span><br> |
| | | <el-button type="primary"> → </el-button> |
| | | <span>选中数量:<el-input type="number" v-model="checkedNum"></el-input></span><br> |
| | | <el-button type="primary" @click="addRight"> → </el-button> |
| | | <br> |
| | | <br> |
| | | <el-button type="primary"> ← </el-button> |
| | | <el-button type="primary" @click="addLeft"> ← </el-button> |
| | | <br> |
| | | <br> |
| | | <el-button type="primary">建立流程卡</el-button> |
| | | <el-button @click="createProcessCard" type="primary">建立流程卡</el-button> |
| | | </el-main> |
| | | |
| | | <el-aside width="44%" style=""> |