| | |
| | | switch (code) { |
| | | case 'add': { |
| | | const selectRecords = $grid.getCheckboxRecords() |
| | | console.log(selectRecords) |
| | | |
| | | |
| | | if (selectRecords.length === 0) { |
| | | ElMessage.warning("未选中数据") |
| | | return |
| | | } |
| | | let order_id="" |
| | | const array=[]; |
| | | for (let i=0;i<selectRecords.length;i++){ |
| | | array.push(selectRecords[i].customerId) |
| | | if(i+1===selectRecords.length){ |
| | | order_id+=selectRecords[i].orderId |
| | | }else{ |
| | | order_id+=selectRecords[i].orderId+"|" |
| | | } |
| | | } |
| | | //判断所选客户是否相同 |
| | | if(!isAllEqual(array)){ |
| | | ElMessage.warning("请选择相同的客户订单") |
| | | return |
| | | } |
| | | |
| | | router.push({path: '/main/delivery/createDelivery', query: { orderId: order_id }}) |
| | |
| | | } |
| | | } |
| | | |
| | | //数组数据验重 |
| | | function isAllEqual(array){ |
| | | if(array.length>0){ |
| | | return !array.some(function(value,index){ |
| | | return value !== array[0]; |
| | | }); |
| | | }else{ |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |