| | |
| | | import companyInfo from "@/stores/sd/companyInfo"; |
| | | import {multiply} from "@/utils/decimal"; |
| | | import MaterialAddition from "@/views/mm/ingredientStock/MaterialAddition.vue"; |
| | | import {copyTableCellValue} from "@/hook/copyTableCellValue"; |
| | | |
| | | //语言获取 |
| | | const { t } = useI18n() |
| | |
| | | }) |
| | | xGrid.value.reloadData(orderDetails) |
| | | xGrid.value.loadData(produceList) |
| | | |
| | | if(userStore.user.permissions.indexOf('createDelivery.add') > -1&&userStore.user.permissions.indexOf('createDelivery.review') > -1){ |
| | | gridOptions.toolbarConfig.buttons[0].visible = false |
| | | }else{ |
| | | gridOptions.toolbarConfig.buttons[1].visible = false |
| | | } |
| | | //禁用按钮 |
| | | gridOptions.toolbarConfig.buttons[1].disabled = true |
| | | gridOptions.toolbarConfig.buttons[2].disabled = true |
| | | gridOptions.toolbarConfig.buttons[2].disabled = true |
| | | gridOptions.toolbarConfig.buttons[3].disabled = true |
| | | //显示复选框 |
| | | xGrid.value.showColumn("select") |
| | | gridOptions.loading=false |
| | |
| | | titleUploadData.value=deepClone(res.data.delivery) |
| | | titleUploadData.value.deliveryId=str |
| | | |
| | | if(userStore.user.permissions.indexOf('createDelivery.add') > -1&&userStore.user.permissions.indexOf('createDelivery.review') > -1){ |
| | | gridOptions.toolbarConfig.buttons[0].visible = false |
| | | }else{ |
| | | gridOptions.toolbarConfig.buttons[1].visible = false |
| | | } |
| | | //判断是否发货出库 |
| | | if(!company.deliveryOutbound){ |
| | | if(titleUploadData.value.stockState!==0){ |
| | | gridOptions.toolbarConfig.buttons[2].disabled = true |
| | | gridOptions.toolbarConfig.buttons[3].disabled = true |
| | | } |
| | | } |
| | | //根据审核状态显示审核按钮或者是反审按钮 |
| | | if(titleUploadData.value.deliveryState!==0){ |
| | | gridOptions.toolbarConfig.buttons[2].disabled = true |
| | | gridOptions.toolbarConfig.buttons[1].disabled = true |
| | | gridOptions.toolbarConfig.buttons[0].disabled = true |
| | | } |
| | | if(titleUploadData.value.deliveryState===0){ |
| | | gridOptions.toolbarConfig.buttons[2].disabled = true |
| | | gridOptions.toolbarConfig.buttons[3].disabled = true |
| | | } |
| | | |
| | | pageNum=1 |
| | |
| | | toolbarConfig: { |
| | | buttons: [ |
| | | {'code': 'add', 'name': t('basicData.save'),status: 'primary',icon: 'vxe-icon-save'}, |
| | | {'code': 'addToExamine', 'name': t('reportingWorks.saveAndReview'),status: 'primary',icon: 'vxe-icon-save'}, |
| | | {'code': 'toExamine', 'name': t('basicData.review'),status: 'primary'}, |
| | | {'code': 'CounterExamination', 'name': t('basicData.cancelReview'),status: 'primary'}, |
| | | //{'code': 'glassShelf', 'name': t('finishedGlassShelf.finishedGlassShelfEmit'),status: 'primary'} |
| | |
| | | titleUploadData.value.freightQuantity=0 |
| | | } |
| | | |
| | | if($grid.getCheckedFilters().length!==0){ |
| | | ElMessage.error(t('order.msg.pleaseCancelTheFilteringFirst')) |
| | | return |
| | | } |
| | | |
| | | let flowData = ref({ |
| | | delivery: selectRecords, |
| | | title: titleUploadData.value, |
| | | deliveryId: route.query.deliveryID, |
| | | otherMoney:otherMoney.value, |
| | | deliveryIdType:company.deliveryIdType |
| | | deliveryIdType:company.deliveryIdType, |
| | | deliveryOutbound:company.deliveryOutbound, |
| | | type:2 |
| | | |
| | | }) |
| | | gridOptions.toolbarConfig.buttons[0].disabled = true |
| | |
| | | |
| | | break |
| | | } |
| | | case 'addToExamine': { |
| | | const selectRecords = $grid.getCheckboxRecords() |
| | | |
| | | if (selectRecords.length === 0) { |
| | | ElMessage.warning(t('productStock.unselectedData')) |
| | | return |
| | | } |
| | | const errMap = await $grid.validate(selectRecords) |
| | | if (errMap) { |
| | | ElMessage.warning(t('productStock.dataVerificationFailed')) |
| | | return |
| | | } |
| | | //表头数据校验 |
| | | const paymentTerms = titleUploadData.value.paymentTerms |
| | | if(paymentTerms === null || paymentTerms === undefined || paymentTerms === ''){ |
| | | ElMessage.error(t('delivery.pleaseSelectPaymentTerms')) |
| | | return |
| | | } |
| | | const payMethod = titleUploadData.value.payMethod |
| | | if(payMethod === null || payMethod === undefined || payMethod === ''){ |
| | | ElMessage.error(t('delivery.pleaseEnterThePaymentMethod')) |
| | | return |
| | | } |
| | | const freightPrice = titleUploadData.value.freightPrice |
| | | if(freightPrice=== null || freightPrice === undefined || freightPrice === ''){ |
| | | titleUploadData.value.freightPrice=0 |
| | | } |
| | | const freightQuantity = titleUploadData.value.freightQuantity |
| | | if(freightQuantity=== null || freightQuantity === undefined || freightQuantity === ''){ |
| | | titleUploadData.value.freightQuantity=0 |
| | | } |
| | | |
| | | if($grid.getCheckedFilters().length!==0){ |
| | | ElMessage.error(t('order.msg.pleaseCancelTheFilteringFirst')) |
| | | return |
| | | } |
| | | |
| | | |
| | | let flowData = ref({ |
| | | delivery: selectRecords, |
| | | title: titleUploadData.value, |
| | | deliveryId: route.query.deliveryID, |
| | | otherMoney:otherMoney.value, |
| | | deliveryIdType:company.deliveryIdType, |
| | | deliveryOutbound:company.deliveryOutbound, |
| | | type:2 |
| | | |
| | | }) |
| | | gridOptions.toolbarConfig.buttons[1].disabled = true |
| | | request.post("/delivery/insertDelivery", flowData.value).then((res) => { |
| | | if(res.code==200 && res.data==="true"){ |
| | | ElMessage.success(t('delivery.deliveryNoteSubmittedSuccessfully')) |
| | | //router.push({path: '/main/delivery/selectDelivery', query:{random:Math.random()}}) |
| | | if(titleUploadData.value.deliveryId.trim()===""){ |
| | | router.push({path: '/main/delivery/selectDelivery', query:{random:Math.random()}}) |
| | | }else{ |
| | | router.push({path:'/main/delivery/createDelivery',query:{ |
| | | deliveryID:titleUploadData.value.deliveryId, |
| | | random:Math.random()}}) |
| | | } |
| | | }else if(res.data==="false1"){ |
| | | ElMessage.warning(t('delivery.pleaseMsg1')) |
| | | }else if(res.data==="false2"){ |
| | | ElMessage.warning(t('basicData.msg.quantityError')) |
| | | }else if(res.data==="false3"){ |
| | | ElMessage.warning(t('basicData.msg.dataDoesNotExist')) |
| | | }else{ |
| | | ElMessage.warning(t('basicData.msg.saveFail')) |
| | | } |
| | | }).catch((err)=>{ |
| | | ElMessage.error(t('basicData.msg.ServerConnectionError')) |
| | | router.push("/login") |
| | | }).finally(()=>{ |
| | | gridOptions.toolbarConfig.buttons[1].disabled = false |
| | | }) |
| | | break |
| | | } |
| | | } |
| | | } |
| | | }, |
| | |
| | | |
| | | } |
| | | } |
| | | }, |
| | | cellDblclick ({row,column}) { |
| | | copyTableCellValue(row,column) |
| | | } |
| | | } |
| | | |