| | |
| | | import {addListener,toolbarButtonClickEvent} from "@/hook/mouseMove"; |
| | | import { useI18n } from 'vue-i18n' |
| | | import OrderOtherMoney from "@/components/sd/order/OrderOtherMoney.vue"; |
| | | import FinishedGlassShelfInformation from "@/views/mm/finishedGlassShelf/FinishedGlassShelfInformation.vue"; |
| | | import CreateFinishedGlassShelfEmit from "@/views/mm/finishedGlassShelf/CreateFinishedGlassShelfEmit.vue"; |
| | | import footSum from "@/hook/footSum"; |
| | | import {changeFilterEvent,filterChanged} from "@/hook" |
| | | import companyInfo from "@/stores/sd/companyInfo"; |
| | | import {multiply} from "@/utils/decimal"; |
| | | import MaterialAddition from "@/views/mm/ingredientStock/MaterialAddition.vue"; |
| | | import {copyTableCellValue} from "@/hook/copyTableCellValue"; |
| | | import SelectOrderList from "@/views/sd/delivery/SelectOrderList.vue"; |
| | | import { ElDialog } from "element-plus"; |
| | | |
| | | //语言获取 |
| | | const { t } = useI18n() |
| | |
| | | const username = userStore.user.userName |
| | | const userid = userStore.user.userId |
| | | const company = companyInfo() |
| | | let dialogTableVisible = ref(false) |
| | | let dialogTableVisible2 = ref(false) |
| | | let produceList = ref([]) |
| | | let cellArea = ref() |
| | | let otherMoneyVisible = ref(false) |
| | | let otherMoney = ref(null) |
| | | |
| | | const dialogSelectOrderVisible = ref(false); // 控制弹窗显示 |
| | | const currentOrderIds = ref([]); // 已有的订单ID,用于排除 |
| | | |
| | | |
| | | // 初始化已选订单ID(在onMounted中调用) |
| | | const initCurrentOrderIds = () => { |
| | | if (produceList && produceList.length > 0) { |
| | | const orderIds = produceList.map(item => item.orderId); |
| | | currentOrderIds.value = [...new Set(orderIds)]; |
| | | }else { |
| | | currentOrderIds.value = []; |
| | | } |
| | | }; |
| | | |
| | | const hasDecimal=(value)=>{ |
| | | const regex=/\./ // 定义正则表达式,查找小数点 |
| | |
| | | |
| | | // 定义表头上传数据 |
| | | let titleUploadData = ref({ |
| | | deliveryId:'', |
| | | deliveryState:'', |
| | | stockState:'', |
| | | paymentTerms:'', |
| | |
| | | }, |
| | | |
| | | }) |
| | | const initOrder = async ()=> { |
| | | //页面第一次加载 |
| | | request.get(`/basicData/BasicDataByType/delivery`).then((res) => { |
| | | await request.get(`/basicData/BasicDataByType/delivery`).then((res) => { |
| | | |
| | | if(res.code==200){ |
| | | titleSelectJson.value=deepClone(res.data) |
| | | //其他金额 |
| | | otherMoney.value = titleSelectJson.value.deliveryOtherMoney[0] |
| | | //let columns = [] |
| | | otherMoney.value.forEach(item => { |
| | | let column = {field: `otherColumns.${item.column}`,width:50, title: item.alias,editRender: { name: 'input'}} |
| | | //columns.push(column) |
| | | gridOptions.columns.push(column) |
| | | }) |
| | | const today = new Date |
| | | today.setTime(today.getTime() + (15 * 24 * 60 * 60 * 1000)) |
| | | titleUploadData.value.deliveryDate = today.getFullYear() + |
| | | '-' + ("0" + (today.getMonth() + 1)).slice(-2) |
| | | + '-' + ("0" + today.getDate()).slice(-2) |
| | | }else{ |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | if (res.code == 200) { |
| | | titleSelectJson.value = deepClone(res.data) |
| | | //其他金额 |
| | | otherMoney.value = titleSelectJson.value.deliveryOtherMoney[0] |
| | | //let columns = [] |
| | | otherMoney.value.forEach(item => { |
| | | let column = {field: `otherColumns.${item.column}`, width: 50, title: item.alias, editRender: {name: 'input'}} |
| | | //columns.push(column) |
| | | gridOptions.columns.push(column) |
| | | }) |
| | | const today = new Date |
| | | today.setTime(today.getTime() + (15 * 24 * 60 * 60 * 1000)) |
| | | titleUploadData.value.deliveryDate = today.getFullYear() + |
| | | '-' + ("0" + (today.getMonth() + 1)).slice(-2) |
| | | + '-' + ("0" + today.getDate()).slice(-2) |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | |
| | | } |
| | | |
| | | const xGrid = ref(); |
| | | const number = ref(); |
| | | |
| | | onMounted(()=>{ |
| | | onMounted( async()=>{ |
| | | await initOrder() |
| | | //启用表格拖动选中 |
| | | addListener(xGrid.value,gridOptions,cellArea.value) |
| | | //发货新增 |
| | |
| | | filterData.value.orderId=orderId |
| | | number.value=orderId |
| | | //第一次调用 |
| | | request.post("/Delivery/getSelectShippingOrderDetails/1/100",filterData.value).then((res) => { |
| | | request.post("/delivery/getSelectShippingOrderDetails/1/100",filterData.value).then((res) => { |
| | | |
| | | if(res.code==200){ |
| | | pageTotal.value=res.data.total |
| | |
| | | titleUploadData.value=deepClone(res.data.title) |
| | | titleUploadData.value.paymentTerms = titleSelectJson.value.paymentTerms[0].basicName |
| | | titleUploadData.value.payMethod = titleSelectJson.value.payMethod[0].basicName |
| | | titleUploadData.value.deliveryId="" |
| | | const today = new Date |
| | | today.setTime(today.getTime() ) |
| | | titleUploadData.value.deliveryDate=today.getFullYear() + |
| | |
| | | |
| | | pageNum=1 |
| | | produceList = deepClone(res.data.data) |
| | | |
| | | |
| | | const orderDetails = res.data.data |
| | | orderDetails.forEach(item => { |
| | | item.otherColumns = JSON.parse(item.otherColumns) |
| | | }) |
| | | 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 |
| | | //gridOptions.toolbarConfig.buttons[4].disabled = false |
| | | //显示复选框 |
| | | xGrid.value.showColumn("select") |
| | | gridOptions.loading=false |
| | |
| | | if (typeof str != 'undefined' && str != null && str !== '' && str !== '\n' && str !== '\r'){ |
| | | filterData.value.deliveryDetail.deliveryId=str |
| | | //第一次调用 |
| | | request.post("/Delivery/getSelectShippingOrderDetail/1/100",filterData.value).then((res) => { |
| | | request.post("/delivery/getSelectShippingOrderDetail/1/100",filterData.value).then((res) => { |
| | | |
| | | if(res.code==200){ |
| | | pageTotal.value=res.data.total |
| | | 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[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 |
| | | //gridOptions.toolbarConfig.buttons[4].disabled = true |
| | | } |
| | | if(titleUploadData.value.deliveryState===0){ |
| | | gridOptions.toolbarConfig.buttons[2].disabled = true |
| | | gridOptions.toolbarConfig.buttons[3].disabled = true |
| | | } |
| | | if(titleUploadData.value.stockState!==0){ |
| | | gridOptions.toolbarConfig.buttons[2].disabled = true |
| | | } |
| | | |
| | | pageNum=1 |
| | | produceList = deepClone(res.data.data) |
| | | |
| | | const orderDetails = res.data.data |
| | | orderDetails.forEach(item => { |
| | | item.otherColumns = JSON.parse(item.otherColumns) |
| | | }) |
| | | otherMoney.value =res.data.orderOtherMoneyList |
| | | |
| | | titleUploadData.value.creator=userStore.user.userName |
| | | titleUploadData.value.creatorId=userStore.user.userId |
| | | |
| | | xGrid.value.reloadData(orderDetails) |
| | | xGrid.value.loadData(produceList) |
| | |
| | | options: [ |
| | | [ |
| | | { code: 'copyChecked', name: t('basicData.selectSame'), prefixIcon: 'vxe-icon-copy', visible: true, disabled: false }, |
| | | //{ code: 'otherMoney', name: t('basicData.otherAmounts'), prefixIcon: 'vxe-icon-chart-bar-x', visible: true, disabled: false } |
| | | { code: 'copyAll', name: t('basicData.sameAfterwards'), prefixIcon: 'vxe-icon-feedback', visible: true, disabled: false }, |
| | | ] |
| | | ] |
| | | } |
| | |
| | | resizable: true, |
| | | useKey: true |
| | | }, |
| | | sortConfig: { |
| | | multiple: true, |
| | | }, |
| | | filterConfig: { //筛选配置项 |
| | | //remote: true |
| | | }, |
| | | customConfig: { |
| | | storage: true |
| | | }, |
| | | checkboxConfig:{checkAll:true}, |
| | | mouseConfig:{selected: true},//鼠标选中 |
| | | keyboardConfig:{isArrow: true, isDel: true, isEnter: true, isTab: true, isEdit: true, isChecked: true}, |
| | | editConfig: { |
| | |
| | | {field: 'select',type:'checkbox',title: t('basicData.check'), width: 80,fixed:"left"}, |
| | | {type: 'seq', title: t('basicData.Number'), width: 80 ,fixed:"left"}, |
| | | {field: 'orderId',width:120, title: t('order.orderId'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'orderNumber',width:120, title: t('order.OrderNum'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'finishedGoodsInventory.boxNo',width:120, title: t('productStock.boxNumber'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'productName',width:120, title: t('order.product'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'width',width:120, title: t('order.width'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'height',width:120, title: t('order.height'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'deliveryDetail.quantity',width:120, title: t('delivery.deliveryQuantity'),editRender: { name: 'input' },filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged}, |
| | | {field: 'finishedGoodsInventory.quantityAvailable',width:120, title: t('delivery.availableStock'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'order.quantity',width:120, title: t('delivery.unpaidQuantity'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'order.quantity',width:160, title: t('delivery.unpaidQuantity'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'quantity',width:120, title: t('order.quantity'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | //{field: 'buildingNumber',width:120, title: '楼号',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'productId',width:120, title: t('order.productId'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'price',width:120, title: t('order.price'),editRender: { name: 'input' },filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'finishedGoodsInventory.storageRegion',width:120, title: t('productStock.inventoryArea'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'deliveryDetail.money',width:120, title: t('order.grossAmount'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'width',width:120, title: t('order.width'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'height',width:120, title: t('order.height'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'order.batch',width:120, title: t('order.batch'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'shape',width:120, title: t('order.shape'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'finishedGoodsInventory.actualSignalArea',width:120, title: t('productStock.singlePieceArea'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'area',width:120, title: t('productStock.singlePieceArea'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'grossArea',width:120, title: t('productStock.totalArea'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'computeArea',width:120, title: t('order.computeArea'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'computeGrossArea',width:120, title: t('order.computeGrossArea'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | |
| | | 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': 'CounterExamination', 'name': t('basicData.cancelReview'),status: 'primary'}, |
| | | //{'code': 'addOtherOrders','name': t('delivery.orderAdd'),'status': 'primary'} |
| | | //{'code': 'glassShelf', 'name': t('finishedGlassShelf.finishedGlassShelfEmit'),status: 'primary'} |
| | | ], |
| | | /*import: false, |
| | | export: true, |
| | |
| | | return |
| | | } |
| | | //表头数据校验 |
| | | const project = titleUploadData.value.project |
| | | if(project === null || project === undefined || project === ''){ |
| | | ElMessage.error(t('delivery.pleaseEnterTheAmountOfFunds')) |
| | | return |
| | | } |
| | | const paymentTerms = titleUploadData.value.paymentTerms |
| | | if(paymentTerms === null || paymentTerms === undefined || paymentTerms === ''){ |
| | | ElMessage.error(t('delivery.pleaseSelectPaymentTerms')) |
| | |
| | | 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:1 |
| | | |
| | | }) |
| | | request.post("/Delivery/insertDelivery", flowData.value).then((res) => { |
| | | if(res.code==200 && res.data===true){ |
| | | gridOptions.toolbarConfig.buttons[0].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()}}) |
| | | }else if(res.data===false){ |
| | | //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[0].disabled = false |
| | | }) |
| | | break |
| | | } |
| | | case 'toExamine': { |
| | | let flowData = ref({ |
| | | deliveryId: route.query.deliveryID, |
| | | type: 2 |
| | | type: 2, |
| | | userName:userStore.user.userName, |
| | | userId:userStore.user.userId, |
| | | deliveryOutbound:company.deliveryOutbound |
| | | |
| | | }) |
| | | request.post("/Delivery/updateDeliveryToExamine", flowData.value).then((res) => { |
| | | if (res.code == 200 && res.data===true) { |
| | | request.post("/delivery/updateDeliveryToExamine", flowData.value).then((res) => { |
| | | if (res.code == 200 && res.data==="true") { |
| | | ElMessage.success(t('basicData.msg.ReviewSuccess')) |
| | | router.push({path: '/main/delivery/selectDelivery', query:{random:Math.random()}}) |
| | | //router.push({path: '/main/delivery/selectDelivery', query:{random:Math.random()}}) |
| | | router.push({path:'/main/delivery/createDelivery',query:{ |
| | | deliveryID:titleUploadData.value.deliveryId, |
| | | random:Math.random()}}) |
| | | } else { |
| | | ElMessage.warning(t('basicData.msg.reviewFail')) |
| | | router.push("/login") |
| | | } |
| | | }).catch((err)=>{ |
| | | ElMessage.error(t('basicData.msg.ServerConnectionError')) |
| | |
| | | case 'CounterExamination': { |
| | | let flowData = ref({ |
| | | deliveryId: route.query.deliveryID, |
| | | type: 0 |
| | | type: 0, |
| | | userName:userStore.user.userName, |
| | | userId:userStore.user.userId, |
| | | deliveryOutbound:company.deliveryOutbound |
| | | |
| | | }) |
| | | request.post("/Delivery/updateDeliveryToExamine", flowData.value).then((res) => { |
| | | if (res.code == 200 && res.data===true) { |
| | | request.post("/delivery/updateDeliveryToExamine", flowData.value).then((res) => { |
| | | if (res.code == 200 && res.data==="true") { |
| | | ElMessage.success(t('basicData.msg.cancelReviewSuccess')) |
| | | router.push({path: '/main/delivery/selectDelivery', query:{random:Math.random()}}) |
| | | //router.push({path: '/main/delivery/selectDelivery', query:{random:Math.random()}}) |
| | | router.push({path:'/main/delivery/createDelivery',query:{ |
| | | deliveryID:titleUploadData.value.deliveryId, |
| | | random:Math.random()}}) |
| | | } else { |
| | | ElMessage.warning(t('basicData.msg.reviewFail')) |
| | | router.push("/login") |
| | | } |
| | | }).catch((err)=>{ |
| | | ElMessage.error(t('basicData.msg.ServerConnectionError')) |
| | |
| | | }) |
| | | break |
| | | } |
| | | case 'glassShelf': { |
| | | dialogTableVisible.value=true |
| | | /*if(titleUploadData.value.deliveryId!=null&&titleUploadData.value.deliveryId!=''){ |
| | | router.push({path:'/main/finishedGlassShelf/finishedGlassShelfInformation',query:{deliveryID:titleUploadData.value.deliveryId}}) |
| | | }else if(number.value!=null){ |
| | | router.push({path:'/main/finishedGlassShelf/finishedGlassShelfInformation',query:{orderId:number.value}}) |
| | | }*/ |
| | | |
| | | 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 |
| | | } |
| | | case 'addOtherOrders': { |
| | | // 显示弹窗前更新已选订单ID |
| | | initCurrentOrderIds(); |
| | | // 显示弹窗 |
| | | dialogSelectOrderVisible.value = true; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | }, |
| | |
| | | } |
| | | dataList.forEach((item,index) =>{ |
| | | if(index>=result.start && index<=result.end){ |
| | | //取消选中 |
| | | if(parseInt(firstVal)<=0){ |
| | | xGrid.value.setCheckboxRow(item, false); |
| | | } |
| | | if(result.cell.indexOf('.')>-1){ |
| | | const columnArr = result.cell.split('.') |
| | | item[columnArr[0]][columnArr[1]] = firstVal |
| | | }else{ |
| | | item[result.cell] = firstVal |
| | | } |
| | | |
| | | } |
| | | }) |
| | | } |
| | | break |
| | | } |
| | | case 'copyAll' :{ |
| | | let result = toolbarButtonClickEvent() |
| | | if(result){ |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | let firstVal=null; |
| | | if(result.cell.indexOf('.')>-1){ |
| | | firstVal = eval("dataList["+result.start +"]."+result.cell) |
| | | }else { |
| | | firstVal=dataList[result.start][result.cell]; |
| | | } |
| | | dataList.forEach((item,index) =>{ |
| | | if(index>=result.start){ |
| | | //取消选中 |
| | | if(parseInt(firstVal)<=0){ |
| | | xGrid.value.setCheckboxRow(item, false); |
| | | } |
| | | if(result.cell.indexOf('.')>-1){ |
| | | const columnArr = result.cell.split('.') |
| | | item[columnArr[0]][columnArr[1]] = firstVal |
| | |
| | | |
| | | } |
| | | } |
| | | }, |
| | | cellDblclick ({row,column}) { |
| | | copyTableCellValue(row,column) |
| | | } |
| | | } |
| | | |
| | | //复选框触发事件 |
| | | const handleCheckboxChange = ({ records, checked, row }) => { |
| | | const $grid = xGrid.value; |
| | | if (!$grid) return; |
| | | |
| | | // 获取当前所有选中的行(返回数组) |
| | | const allCheckedRows = $grid.getCheckboxRecords(); |
| | | // 获取表格所有数据(visibleData 是当前可见数据,fullData 是全部数据,根据需求选择) |
| | | const tableData = $grid.getTableData().visibleData; |
| | | // 按箱号分组 |
| | | const boxNoGroup = groupByBoxNo(tableData); |
| | | // 当前行的箱号 |
| | | const currentBoxNo = row.finishedGoodsInventory?.boxNo || ''; |
| | | |
| | | // 选中逻辑:如果是“选中”操作,同箱号的行全部选中 |
| | | if (checked && currentBoxNo!="" && currentBoxNo!=null) { |
| | | const sameBoxRows = boxNoGroup[currentBoxNo] || []; |
| | | // 批量设置同箱号的行为选中状态(跳过已选中的行,避免重复触发) |
| | | sameBoxRows.forEach(item => { |
| | | const isAlreadyChecked = allCheckedRows.some(checkedRow => { |
| | | return checkedRow._X_ROW_KEY === item._X_ROW_KEY; |
| | | }); |
| | | // 未选中则设置为选中 |
| | | if (!isAlreadyChecked) { |
| | | $grid.setCheckboxRow(item, true); |
| | | } |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | |
| | | const groupByBoxNo = (tableData) => { |
| | | return tableData.reduce((group, row) => { |
| | | // 获取当前行的箱号(注意处理 undefined 情况) |
| | | const boxNo = row.finishedGoodsInventory?.boxNo || ''; |
| | | if (!group[boxNo]) { |
| | | group[boxNo] = []; |
| | | } |
| | | group[boxNo].push(row); |
| | | return group; |
| | | }, {}); |
| | | }; |
| | | |
| | | |
| | | //计算金钱 |
| | | const countMoney = (list) => { |
| | |
| | | } |
| | | } |
| | | |
| | | function getNestedProperty(obj, path) { |
| | | return path.split('.').reduce(function(o, p) { |
| | | if(o && o.hasOwnProperty(p)) { |
| | | return o[p]; |
| | | } |
| | | }, obj); |
| | | } |
| | | |
| | | function setNestedValue(obj, path, value) { |
| | | const keys = path.split('.'); |
| | | const lastKey = keys.pop(); |
| | | const lastObj = keys.reduce((obj, key) => obj[key], obj); |
| | | lastObj[lastKey] = value; |
| | | } |
| | | |
| | | |
| | | /*数据校验*/ |
| | | const validRules = ref({ |
| | | "deliveryDetail.quantity": [{ |
| | |
| | | return new Error(t('delivery.theShipmentQuantityCannotBeGreaterThanTheInventoryQuantity')) |
| | | }else if (e.row.deliveryDetail.quantity ==="") { |
| | | return new Error(t('delivery.theShipmentQuantityCannotBeEmptyOr0')) |
| | | } |
| | | } |
| | | const regex = /^[1-9]\d*$/g |
| | | if ( !regex.test(e.row.deliveryDetail.quantity) ) { |
| | | return new Error(t('productStock.pleaseEnterAPositiveInteger')) |
| | |
| | | |
| | | }) |
| | | |
| | | const editClosedEvent = ({ row, column }) => { |
| | | |
| | | if (['deliveryDetail.quantity'].includes(column.property)) { |
| | | if(parseInt(row.deliveryDetail.quantity)===0){ |
| | | xGrid.value.setCheckboxRow(row, false); |
| | | } |
| | | } |
| | | |
| | | } |
| | | const datas=ref(null) |
| | | const handleChildResult = (data) => { |
| | | datas.value=data |
| | | dialogTableVisible.value=false |
| | | dialogTableVisible2.value=true |
| | | }; |
| | | |
| | | const handleChildResult2 = (data) => { |
| | | dialogTableVisible2.value=false |
| | | }; |
| | | |
| | | |
| | | // 处理从SelectOrderList选中的订单 |
| | | const handleSelectedOrders = async (selectedOrders) => { |
| | | if (!selectedOrders || selectedOrders.length === 0) return; |
| | | |
| | | // 关闭弹窗 |
| | | dialogSelectOrderVisible.value = false; |
| | | |
| | | // 验证选中的订单是否符合条件 |
| | | const { customerId, project } = titleUploadData.value; |
| | | const invalidOrders = selectedOrders.filter(order => |
| | | order.customerId !== parseInt(customerId) || order.project !== project |
| | | ); |
| | | |
| | | if (invalidOrders.length > 0) { |
| | | ElMessage.warning(t('delivery.onlySameCustomerProject')); |
| | | return; |
| | | } |
| | | |
| | | try { |
| | | // 显示加载状态 |
| | | gridOptions.loading = true; |
| | | |
| | | // 批量查询订单明细(按订单ID) |
| | | const orderIds = selectedOrders.map(order => order.orderId).join('|'); |
| | | filterData.value.orderId=orderIds |
| | | request.post("/delivery/getSelectShippingOrderDetails/1/100",filterData.value).then((res) => { |
| | | if (res.code == 200) { |
| | | // 处理返回的明细数据 |
| | | const orderDetails = res.data.data || []; |
| | | //合并数据 |
| | | mergeData(orderDetails); |
| | | } else { |
| | | ElMessage.warning(res.msg || t('basicData.msg.data获取失败')); |
| | | } |
| | | }) |
| | | } catch (error) { |
| | | ElMessage.error(t('basicData.msg.ServerConnectionError')); |
| | | console.error('查询订单明细失败:', error); |
| | | } finally { |
| | | // 关闭加载状态 |
| | | gridOptions.loading = false; |
| | | } |
| | | }; |
| | | |
| | | // 合并数据:判断orderId、orderNumber、boxNo是否相同,相同则累加数量,不同则新增 |
| | | const mergeData = (newDataList) => { |
| | | // 复制现有数据(避免直接修改响应式源数据) |
| | | const currentList = [...produceList]; |
| | | |
| | | newDataList.forEach(newItem => { |
| | | // 提取新数据的关键比对字段 |
| | | const newOrderId = newItem.orderId; |
| | | const newOrderNumber = newItem.orderNumber; |
| | | const newBoxNo = newItem.finishedGoodsInventory?.boxNo || ''; // 处理可能的undefined |
| | | |
| | | // 在现有数据中查找匹配项(三个字段完全相同) |
| | | const matchedItem = currentList.find(item => |
| | | item.orderId === newOrderId && |
| | | item.orderNumber === newOrderNumber && |
| | | (item.finishedGoodsInventory?.boxNo || '') === newBoxNo |
| | | ); |
| | | |
| | | if (matchedItem) { |
| | | // 找到匹配项:累加数量(确保是数值类型) |
| | | matchedItem.deliveryDetail.quantity = (Number(matchedItem.deliveryDetail.quantity) || 0) + |
| | | (Number(newItem.deliveryDetail.quantity) || 0); |
| | | } else { |
| | | // 未找到匹配项:新增一条数据 |
| | | currentList.push(newItem); |
| | | } |
| | | }); |
| | | |
| | | // 更新响应式数据 |
| | | produceList = currentList; |
| | | // 刷新表格 |
| | | xGrid.value.reloadData(produceList); |
| | | }; |
| | | |
| | | </script> |
| | | |
| | | <template> |
| | | <div class="main-div"> |
| | | <div class="order-primary" style="background-color: white"> |
| | | <div style="width: 100%;height: 100%"> |
| | | <div class="head" style="background-color: white"> |
| | | <el-row> |
| | | <el-col :span="2"><el-text>{{$t('customer.customerNumber')}}:</el-text></el-col> |
| | | <el-col :span="3"><el-input style="font-size: large;color: #181818" v-model="titleUploadData.customerId" :readonly="true" ></el-input></el-col> |
| | | <el-col :span="2"><el-text>{{$t('customer.customerName')}}:</el-text></el-col> |
| | | <el-col :span="5"><el-input v-model="titleUploadData.customerName" :readonly="true"></el-input></el-col> |
| | | <el-col :span="2"><el-text>{{$t('customer.customerNumber')}}:</el-text></el-col> |
| | | <el-col :span="2"><el-text>{{$t('order.project')}}:</el-text></el-col> |
| | | <el-col :span="5"><el-input v-model="titleUploadData.project" :readonly="true"></el-input></el-col> |
| | | </el-row> |
| | | <el-row> |
| | |
| | | <el-col :span="2"><el-input v-model="titleUploadData.freight" :readonly="true"/></el-col> |
| | | </el-row> |
| | | </div> |
| | | <div class="order-detail"> |
| | | <div class="main-table"> |
| | | <vxe-grid |
| | | max-height="97%" |
| | | height="100%" |
| | | class="mytable-scrollbar" |
| | | ref="xGrid" |
| | | v-bind="gridOptions" |
| | | v-on="gridEvents" |
| | | :edit-rules="validRules" |
| | | @edit-closed="editClosedEvent" |
| | | @checkbox-change="handleCheckboxChange" |
| | | |
| | | > |
| | | <template #num1_filter="{ column, $panel }"> |
| | | <div> |
| | | <div v-for="(option, index) in column.filters" :key="index"> |
| | | <input type="type" v-model="option.data" @input="changeFilterEvent($event, option, $panel)"/> |
| | | <input |
| | | type="type" |
| | | v-model="option.data" |
| | | @keyup.enter.native="$panel.confirmFilter()" |
| | | @input="changeFilterEvent($event, option, $panel)"/> |
| | | </div> |
| | | </div> |
| | | </template> |
| | |
| | | ref="refOtherMoney" |
| | | :otherMoney="otherMoney" |
| | | style="width: 100%;height: 100%" /> |
| | | </el-dialog> |
| | | |
| | | <!-- 料架库存弹窗--> |
| | | <el-dialog v-model="dialogTableVisible" |
| | | :title="$t('finishedGlassShelf.finishedGlassShelfInformation')" |
| | | style="width: 70%;height:75%" |
| | | destroy-on-close |
| | | :close-on-click-modal="false" |
| | | :close-on-press-escape="false"> |
| | | <Finished-glass-shelf-information |
| | | style="width: 100%;height: 600px" |
| | | type=1 |
| | | @handle-result="handleChildResult" |
| | | /> |
| | | </el-dialog> |
| | | |
| | | <!-- 料架出库弹窗--> |
| | | <el-dialog v-model="dialogTableVisible2" |
| | | :title="$t('finishedGlassShelf.finishedGlassShelfEmit')" |
| | | style="width: 70%;height:75% " |
| | | destroy-on-close |
| | | :close-on-click-modal="false" |
| | | :close-on-press-escape="false"> |
| | | <Create-finished-glass-shelf-emit |
| | | style="width: 100%;height: 600px" |
| | | type=1 |
| | | :customerName="titleUploadData.customerName" |
| | | :project="titleUploadData.project" |
| | | :data="datas" |
| | | @handle-result="handleChildResult2" |
| | | /> |
| | | </el-dialog> |
| | | |
| | | <el-dialog |
| | | v-model="dialogSelectOrderVisible" |
| | | :title="t('delivery.orderAdd')" |
| | | style="width: 70%;height:75% " |
| | | destroy-on-close |
| | | :close-on-click-modal="false" |
| | | :close-on-press-escape="false"> |
| | | <SelectOrderList |
| | | style="width: 100%;height: 600px" |
| | | :customer-id="titleUploadData.customerId" |
| | | :project="titleUploadData.project" |
| | | :exclude-order-ids="currentOrderIds" |
| | | @select-orders="handleSelectedOrders" |
| | | /> |
| | | </el-dialog> |
| | | </div> |
| | | |
| | |
| | | height: 90%; |
| | | width: 100%; |
| | | } |
| | | |
| | | .head{ |
| | | width: 100%; |
| | | height: 170px; |
| | | } |
| | | |
| | | .main-table{ |
| | | width: 100%; |
| | | height: calc(100% - 170px); |
| | | } |
| | | </style> |