| | |
| | | } |
| | | |
| | | }) |
| | | //定义输入数量 |
| | | let checkedNum = ref('') |
| | | //创建流程卡 |
| | | const createProcessCard = () => { |
| | | const $grid = xGrid.value |
| | |
| | | //index = index.toString().padStart(2, '0') |
| | | } |
| | | const processId = productionId + index.toString().padStart(2, '0') |
| | | checkedList.forEach((item) => { |
| | | item.processId = processId |
| | | item.landingSequence = index |
| | | item.quantity = item.baiscQuantity |
| | | }) |
| | | checkedList.forEach((item) => { |
| | | delete item._X_ROW_KEY |
| | | }) |
| | | $gridLeft.insertAt(checkedList) |
| | | $grid.remove(checkedList) |
| | | if ($gridLeft || $grid) { |
| | | const regex = /^(\d+|)$/; |
| | | if (!regex.test(checkedNum.value)) { |
| | | ElMessage.warning("请输入正整数") |
| | | return |
| | | } |
| | | //判断正整数 |
| | | if (/^[1-9]\d*$/.test(checkedNum.value)) { |
| | | checkedList.forEach((item) => { |
| | | //定义key值保持 |
| | | |
| | | //判断可用数量是否大于等于输入的数量,不满足则抛出异常 |
| | | if (item.baiscQuantity * 1 < checkedNum.value * 1) throw new Error("请输入小于等于可用数量的数字"); |
| | | item.quantity = checkedNum.value |
| | | item.processId = processId |
| | | item.landingSequence = index |
| | | item.baiscQuantity=item.baiscQuantity - checkedNum.value |
| | | }) |
| | | //删除key |
| | | checkedList.forEach((item) => { |
| | | let key = item._X_ROW_KEY |
| | | delete item._X_ROW_KEY |
| | | if (item.baiscQuantity===0){ |
| | | $grid.remove(checkedList) |
| | | } |
| | | $gridLeft.insertAt(checkedList) |
| | | item._X_ROW_KEY = key |
| | | }) |
| | | |
| | | //清除两边复选框 |
| | | $gridLeft.clearCheckboxRow() |
| | | $grid.clearCheckboxRow() |
| | | } |
| | | else if (checkedNum.value === '') {//判断数量输入框无输入数字 |
| | | |
| | | checkedList.forEach((item) => { |
| | | item.processId = processId |
| | | item.landingSequence = index |
| | | item.quantity = item.baiscQuantity |
| | | }) |
| | | //删除key |
| | | checkedList.forEach((item) => { |
| | | delete item._X_ROW_KEY |
| | | }) |
| | | $gridLeft.insertAt(checkedList) |
| | | $grid.remove(checkedList) |
| | | //清除两边复选框 |
| | | $gridLeft.clearCheckboxRow() |
| | | $grid.clearCheckboxRow() |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | let checkedNum = ref('') |
| | | |
| | | |
| | | //向右边表格添加数据 |
| | | const addRight = () => { |
| | |
| | | $grid.insert(item) |
| | | } |
| | | }) |
| | | } else if (checkedNum.value === '') {//判断数量输入框有无输入数字 |
| | | } else if (checkedNum.value === '') {//判断数量输入框无输入数字 |
| | | |
| | | checkedList.forEach((item) => { |
| | | let rightData = $grid.getTableData().fullData |
| | |
| | | |
| | | |
| | | } |
| | | //清除两边复选框 |
| | | $gridLeft.clearCheckboxRow() |
| | | $grid.clearCheckboxRow() |
| | | } catch (e) { |
| | |
| | | } |
| | | } else { |
| | | |
| | | // if (){ |
| | | // |
| | | // } |
| | | //如果勾选两个值不同则插入同流程卡 |
| | | item.quantity = checkedNum.value |
| | | item.processId = checkedListLeft[0].processId |
| | |
| | | break |
| | | } |
| | | } |
| | | // leftData.forEach((items) => { |
| | | // console.log(items.processId, item.processId,"——————",items.orderNumber, item.orderNumber) |
| | | // if (items.orderNumber === item.orderNumber && items.processId===item.processId) { |
| | | // console.log("测试333") |
| | | // |
| | | // } |
| | | // else{ |
| | | // |
| | | // } |
| | | // |
| | | // }) |
| | | |
| | | } |
| | | |
| | | }) |
| | |
| | | $gridLeft.insertAt(checkedList) |
| | | $grid.remove(checkedList) |
| | | } |
| | | //清除两边复选框 |
| | | if ($gridLeft || $grid) { |
| | | $gridLeft.clearCheckboxRow() |
| | | $grid.clearCheckboxRow() |
| | |
| | | const $tableRight = xGrid.value |
| | | if ($table) { |
| | | const selectRecords = $table.getCheckboxRecords() |
| | | const selectRight = $tableRight.getCheckboxRecords() |
| | | // const selectRight = $tableRight.getCheckboxRecords() |
| | | let leftData = $tableRight.getTableData().fullData |
| | | if (selectRecords.length === 0) { |
| | | ElMessage.warning("请先选择保存的数据") |
| | | return |
| | | } |
| | | if (selectRight.length > 0) { |
| | | |
| | | if (leftData.length > 0) { |
| | | ElMessage.warning("请先将右侧数据全部建立流程卡后保存") |
| | | return; |
| | | } |