| | |
| | | import downLoadFile from "@/hook/downLoadFile" |
| | | import footSum from "@/hook/footSum" |
| | | import {useI18n} from "vue-i18n" |
| | | import {multiply} from '@/utils/decimal' |
| | | import {multiply,multiplyAuto,divideAuto} from '@/utils/decimal' |
| | | const { t } = useI18n() |
| | | |
| | | let dialogTableVisible = ref(false) |
| | |
| | | let errorAreaVisible = ref(false) |
| | | let otherMoneyVisible = ref(false) |
| | | let sizeCheckVisible = ref(false) |
| | | const maxTableLen =ref(200) |
| | | let orderIdVisible = ref(false) |
| | | const maxTableLen =ref(500) |
| | | let errorArea = ref(0.4) |
| | | const userStore = useUserInfoStore() |
| | | const company = companyInfo() |
| | |
| | | const shapeList = ref([ |
| | | {label:t('order.universalShape'),value:'1'}, {label:t('order.alien'),value:'2'} |
| | | ]) |
| | | const newOrderId = ref([]) |
| | | |
| | | // 定义表头上传数据 |
| | | const titleUploadData = ref({ |
| | |
| | | { code: 'incrementalChecked', name: t('basicData.incrementalChecked'), prefixIcon: 'vxe-icon-copy', visible: true, disabled: false }, |
| | | { code: 'errorArea', name: t('basicData.errorSettlementArea'), prefixIcon: 'vxe-icon-chart-bar-x', visible: true, disabled: false }, |
| | | { code: 'otherMoney', name: t('basicData.otherAmounts'), prefixIcon: 'vxe-icon-chart-bar-x', visible: true, disabled: false }, |
| | | { code: 'sizeCheck', name: t('basicData.sizeReview'), prefixIcon: 'vxe-icon-eye-fill', visible: true, disabled: false } |
| | | { code: 'sizeCheck', name: t('basicData.sizeReview'), prefixIcon: 'vxe-icon-eye-fill', visible: true, disabled: false }, |
| | | { code: 'updateOrderId', name: '修改订单号', prefixIcon: 'vxe-icon-eye-fill', visible: true, disabled: false } |
| | | ] |
| | | ] |
| | | } |
| | |
| | | otherMoney:otherMoney.value, |
| | | orderIdType:company.orderIdType, |
| | | creator:userStore.user.userName, |
| | | creatorId:userStore.user.userId |
| | | creatorId:userStore.user.userId, |
| | | newOrderId:newOrderId.value |
| | | } |
| | | const grossAreaList = $grid.getTableData().fullData.filter( |
| | | item=>item.grossArea === 0 |
| | | ) |
| | | const errorAreaList = $grid.getTableData().fullData.filter( |
| | | item=>item.width*item.height/1000000 < errorArea.value*1 |
| | | item=>(item.width*item.height/1000000 < errorArea.value*1) |
| | | ) |
| | | if(grossAreaList.length>0){ |
| | | alert(t('order.msg.grossAreaIsNot0')) |
| | |
| | | ElMessage.error(t('basicData.msg.checkoutLose')) |
| | | return |
| | | } |
| | | |
| | | titleUploadData.value.creatorId=userStore.user.userId |
| | | titleUploadData.value.creator=userStore.user.userName |
| | | let order ={ |
| | | title:titleUploadData.value, |
| | | } |
| | |
| | | sizeCheckVisible.value=true |
| | | break |
| | | } |
| | | case 'updateOrderId' :{ |
| | | orderIdVisible.value=true |
| | | break |
| | | } |
| | | case 'incrementalAll' :{ |
| | | let result = toolbarButtonClickEvent() |
| | | if(result){ |
| | |
| | | dataList.forEach((item,index) =>{ |
| | | if(index>=result.start ){ |
| | | let newStr = subStr1.replace(reg, number); |
| | | if(parseInt(newStr)>9){ |
| | | newStr=parseInt(newStr) |
| | | } |
| | | setNestedValue(item,result.cell,subStr2+newStr) |
| | | number=number+1 |
| | | } |
| | |
| | | dataList.forEach((item,index) =>{ |
| | | if(index >= result.start && index <= result.end){ |
| | | let newStr = subStr1.replace(reg, number); |
| | | if(parseInt(newStr)>9){ |
| | | newStr=parseInt(newStr) |
| | | } |
| | | setNestedValue(item,result.cell,subStr2+newStr) |
| | | number=number+1 |
| | | } |
| | |
| | | addListener(xGrid.value,gridOptions) |
| | | const str = route.query.orderId || history.state.orderId |
| | | if (typeof str === 'undefined' || str === null || str === '' || str === '\n' || str === '\r'){ |
| | | |
| | | gridOptions.menuConfig.body.options[0][11].disabled = true |
| | | gridOptions.loading = false |
| | | return |
| | | } |
| | |
| | | request.post(`/order/getOrderById/${str}`).then((res) => { |
| | | if(res.code==200){ |
| | | titleUploadData.value = res.data.order |
| | | newOrderId.value=titleUploadData.value.orderId |
| | | if(history.state.orderId!=null){ |
| | | titleUploadData.value.orderId='' |
| | | titleUploadData.value.id=null |
| | |
| | | |
| | | if(history.state.type=='copy'){ |
| | | xGrid.value.reloadData(orderDetails) |
| | | gridOptions.menuConfig.body.options[0][11].disabled = true |
| | | } |
| | | if(history.state.type=='copyTitle'){ |
| | | gridOptions.menuConfig.body.options[0][11].disabled = true |
| | | } |
| | | |
| | | gridOptions.loading = false |
| | |
| | | //工艺审核后保存按钮禁用 |
| | | if(res.data.order.processReview === 2){ |
| | | gridOptions.toolbarConfig.buttons[4].disabled = true |
| | | gridOptions.menuConfig.body.options[0][11].disabled = true |
| | | |
| | | |
| | | } |
| | |
| | | gridOptions.toolbarConfig.buttons[2].code='reviews' |
| | | gridOptions.toolbarConfig.buttons[2].name=t('basicData.cancelReview') |
| | | gridOptions.toolbarConfig.buttons[3].disabled = false |
| | | gridOptions.menuConfig.body.options[0][11].disabled = true |
| | | |
| | | const button = {'code': 'cancelOrder', |
| | | status: 'primary', |
| | |
| | | gridOptions.toolbarConfig.buttons[2].disabled = true |
| | | gridOptions.toolbarConfig.buttons[3].disabled = true |
| | | gridOptions.toolbarConfig.buttons[4].disabled = true |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | if(res.data.order.productionOrder !==0 ){ |
| | | gridOptions.toolbarConfig.buttons[2].disabled = true |
| | | } |
| | |
| | | gridOptions.editRules[`otherColumns.${item.column}`] = [ |
| | | { |
| | | validator ({ cellValue }) { |
| | | const regex = /^(0(\.\d{1,2})?|([1-9]\d{0,4})(\.\d{1,2})?|99999(\.9{1,2})?)$/ |
| | | const regex = /^(0(\.\d{1,3})?|([1-9]\d{0,4})(\.\d{1,3})?|99999(\.9{1,3})?)$/ |
| | | if (cellValue && !regex.test(cellValue)) { |
| | | return new Error(t('basicData.msg.range99999Dec2')) |
| | | return new Error(t('basicData.msg.range99999Dec3')) |
| | | } |
| | | } |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | //修改订单号方法 |
| | | const updateOrderId = () => { |
| | | let orderId ={ |
| | | oldOrderId:titleUploadData.value.orderId, |
| | | newOrderId:newOrderId.value, |
| | | orderIdType:company.orderIdType, |
| | | creator:userStore.user.userName, |
| | | } |
| | | request.post(`/order/updateOrderId`,orderId).then((res) => { |
| | | if(res.code==200 && res.data==="true"){ |
| | | ElMessage.success(t('basicData.msg.saveSuccess')) |
| | | router.push({path:'/main/order/createOrder',query:{ |
| | | orderId:newOrderId.value, |
| | | random:Math.random()}}) |
| | | }else if(res.data==="false1"){ |
| | | ElMessage.warning("输入订单号不能大于最大订单号") |
| | | }else if(res.data==="false2"){ |
| | | ElMessage.warning("输入订单号已存在") |
| | | }else if(res.data==="false3"){ |
| | | ElMessage.warning("输入订单号相同") |
| | | }else if(res.data==="false4"){ |
| | | ElMessage.warning("输入订单号长度不符") |
| | | }else if(res.data==="false5"){ |
| | | ElMessage.warning("请输入数字") |
| | | }else if(res.data==="false6"){ |
| | | ElMessage.warning("不能修改第一个单子") |
| | | } |
| | | }) |
| | | } |
| | | |
| | | //更新金额重置 |
| | | const updateMoney = () => { |
| | | titleUploadData.value.creatorId=userStore.user.userId |
| | | titleUploadData.value.creator=userStore.user.userName |
| | | const updateData = { |
| | | order: titleUploadData.value, |
| | | detail: xGrid.value.getTableData().fullData, |
| | |
| | | } |
| | | |
| | | const area = (row) => { |
| | | return parseFloat((row.width * row.height/1000000).toFixed(company.decValue)) |
| | | return parseFloat(divideAuto(row.width * row.height,1000000,company.decValue)) |
| | | } |
| | | const countArea = (row) => { |
| | | const area = parseFloat((row.width * row.height/1000000).toFixed(company.decValue)) |
| | | const area = parseFloat(divideAuto(row.width * row.height,1000000,company.decValue)) |
| | | let areaSum = 0 |
| | | // 获取保留面积, |
| | | const decValue = company.decValue |
| | | switch (titleUploadData.value.calculateType){ |
| | | case 2:{ |
| | | areaSum = parseFloat((row.width * row.height * row.quantity/1000000).toFixed(decValue)) |
| | | areaSum = parseFloat(divideAuto(row.width * row.height* row.quantity,1000000,company.decValue)) |
| | | break |
| | | } |
| | | default :{ |
| | | areaSum = parseFloat((area * row.quantity).toFixed(decValue)) |
| | | areaSum = parseFloat(multiplyAuto(area ,row.quantity,company.decValue)) |
| | | break |
| | | } |
| | | } |
| | |
| | | const decValue = company.decValue |
| | | |
| | | if(titleUploadData.value.calculateType===1){ |
| | | item.computeGrossArea = parseFloat((item.computeArea*item.quantity).toFixed(decValue)) |
| | | item.computeGrossArea = parseFloat(multiplyAuto(item.computeArea,item.quantity,decValue)) |
| | | }else if(titleUploadData.value.calculateType===2){ |
| | | item.computeGrossArea = item.grossArea |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | const cellStyle = ({ row, column }) => { |
| | | if(company.longSide!=null){ |
| | | if (column.field === 'width') { |
| | | if (row.width > parseInt(company.longSide)) { |
| | | return { |
| | | backgroundColor: '#ec6969' |
| | | } |
| | | } |
| | | } |
| | | if (column.field === 'height') { |
| | | if (row.height > parseInt(company.longSide)) { |
| | | return { |
| | | backgroundColor: '#ec6969' |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | }; |
| | | |
| | | //误差面积计算方法 |
| | | const errorAreaComputed = () => { |
| | | const regex = /^(0(\.\d{1,2})?|([1-9]\d{0,4})(\.\d{1,2})?|99999(\.9{1,2})?)$/ |
| | |
| | | if( !isNaN(item.computeArea*1) && item.computeArea != null && trueArea < errorArea.value){ |
| | | |
| | | item.computeArea = errorArea.value |
| | | item.computeGrossArea = parseFloat((item.computeArea*item.quantity).toFixed(2)) |
| | | item.grossAmount=parseFloat((item.price * item.computeGrossArea).toFixed(2)) |
| | | item.computeGrossArea = parseFloat(multiply(item.computeArea,item.quantity)) |
| | | item.grossAmount=parseFloat(multiply(item.price , item.computeGrossArea)) |
| | | } |
| | | }) |
| | | titleUploadData.value.money=countMoney(xGrid.value.getTableData().fullData).toString() |
| | |
| | | |
| | | if( !isNaN(item.computeArea*1) && item.computeArea != null ){ |
| | | if(titleUploadData.value.calculateType===3){ |
| | | item.grossAmount=parseFloat((item.price * item.quantity).toFixed(2)) |
| | | item.grossAmount=parseFloat(multiply(item.price , item.quantity)) |
| | | }else{ |
| | | item.grossArea = countArea(item) |
| | | item.computeGrossArea = item.grossArea |
| | | item.grossAmount=parseFloat((item.price * item.computeGrossArea).toFixed(2)) |
| | | item.grossAmount=parseFloat(multiply(item.price , item.computeGrossArea)) |
| | | } |
| | | } |
| | | }) |
| | |
| | | v-on="gridEvents" |
| | | @keydown="handleKeyDown" |
| | | @edit-closed="editClosedEvent" |
| | | :cell-style="cellStyle" |
| | | > |
| | | <template #num1_filter="{ column, $panel }"> |
| | | <div> |
| | |
| | | </el-col> |
| | | </el-row> |
| | | </el-dialog> |
| | | <el-dialog v-model="orderIdVisible" style="width: 300px;height:150px "> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-input v-model="newOrderId"/> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-button @click="updateOrderId">{{$t('basicData.confirmButtonText')}}</el-button> |
| | | </el-col> |
| | | </el-row> |
| | | </el-dialog> |
| | | <el-dialog v-model="otherMoneyVisible" |
| | | :title="$t('basicData.otherAmounts')" |
| | | :close-on-click-modal="false" |