From ed3ce5c8f6e1f7ac1aad3218ab5e518fc95cdb0f Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期二, 10 九月 2024 10:26:54 +0800
Subject: [PATCH] Merge branch 'master' of http://bore.pub:10439/r/ERP_override
---
north-glass-erp/northglass-erp/src/views/sd/order/CreateOrder.vue | 113 +++++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 82 insertions(+), 31 deletions(-)
diff --git a/north-glass-erp/northglass-erp/src/views/sd/order/CreateOrder.vue b/north-glass-erp/northglass-erp/src/views/sd/order/CreateOrder.vue
index dec18b0..09bd8df 100644
--- a/north-glass-erp/northglass-erp/src/views/sd/order/CreateOrder.vue
+++ b/north-glass-erp/northglass-erp/src/views/sd/order/CreateOrder.vue
@@ -15,6 +15,7 @@
import downLoadFile from "@/hook/downLoadFile"
import footSum from "@/hook/footSum"
import {useI18n} from "vue-i18n"
+import {multiply,multiplyAuto,divideAuto} from '@/utils/decimal'
const { t } = useI18n()
let dialogTableVisible = ref(false)
@@ -22,7 +23,7 @@
let errorAreaVisible = ref(false)
let otherMoneyVisible = ref(false)
let sizeCheckVisible = ref(false)
-const maxTableLen =ref(150)
+const maxTableLen =ref(500)
let errorArea = ref(0.4)
const userStore = useUserInfoStore()
const company = companyInfo()
@@ -185,6 +186,16 @@
const regex = /^(0(\.\d{1,2})?|([1-9]\d{0,4})(\.\d{1,2})?|99999(\.9{1,2})?)$/
if ( !regex.test(cellValue) ) {
return new Error(t('basicData.msg.range99999Dec2') )
+ }
+ }
+ }
+ ],
+ quantity: [
+ {
+ validator ({ cellValue }) {
+ const regex = /^[1-9]\d*$/
+ if ( !regex.test(cellValue) ) {
+ return new Error(t('basicData.msg.greater0') )
}
}
}
@@ -353,7 +364,7 @@
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'))
@@ -378,6 +389,13 @@
selectOrder(order)
}).catch((action)=>{
if(action === 'cancel'){
+ //閲嶇疆缁撶畻闈㈢Н
+ const dataList = xGrid.value.getTableData().fullData
+ dataList.forEach((item,index) =>{
+ item.computeArea = item.area
+ item.computeGrossArea = item.grossArea
+ })
+ computedMoney(null)
selectOrder(order)
}
@@ -427,7 +445,8 @@
ElMessage.error(t('basicData.msg.checkoutLose'))
return
}
-
+ titleUploadData.value.creatorId=userStore.user.userId
+ titleUploadData.value.creator=userStore.user.userName
let order ={
title:titleUploadData.value,
}
@@ -603,7 +622,7 @@
let result = toolbarButtonClickEvent()
if(result){
const dataList = xGrid.value.getTableData().visibleData
- const val = getNestedProperty(dataList[result.start],result.cell)
+ const val = getNestedProperty(dataList[result.start],result.cell)+""
const numbersArr = []
const regex = /\d+/g
@@ -619,6 +638,9 @@
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
}
@@ -634,7 +656,7 @@
let result = toolbarButtonClickEvent()
if (result) {
const dataList = xGrid.value.getTableData().visibleData
- const val = getNestedProperty(dataList[result.start], result.cell)
+ const val = getNestedProperty(dataList[result.start], result.cell)+""
const numbersArr = []
const regex = /\d+/g
let match
@@ -649,6 +671,9 @@
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
}
@@ -743,6 +768,10 @@
gridOptions.loading = false
return
}
+ const buttonTitle = {'code': 'saveOrderTitle',
+ status: 'primary',
+ 'name': t('order.saveHeader')}
+ gridOptions.toolbarConfig.buttons.push(buttonTitle)
//鍙栨秷宸ヨ壓鎸夐挳绂佺敤
gridOptions.toolbarConfig.buttons[1].disabled = false
//宸ヨ壓瀹℃牳鍚庝繚瀛樻寜閽鐢�
@@ -768,10 +797,7 @@
status: 'primary',
'name': (res.data.order.orderReview>0?t('basicData.cancel'):t('basicData.restore'))}
gridOptions.toolbarConfig.buttons.push(button)
- const buttonTitle = {'code': 'saveOrderTitle',
- status: 'primary',
- 'name': t('order.saveHeader')}
- gridOptions.toolbarConfig.buttons.push(buttonTitle)
+
if(res.data.order.orderReview===-2){
gridOptions.toolbarConfig.buttons[2].disabled = true
gridOptions.toolbarConfig.buttons[3].disabled = true
@@ -779,6 +805,9 @@
}
}
if(res.data.order.productionOrder !==0 ){
+ gridOptions.toolbarConfig.buttons[2].disabled = true
+ }
+ if(res.data.order.warehousing !==0 ){
gridOptions.toolbarConfig.buttons[2].disabled = true
}
const orderDetails = res.data.orderDetails
@@ -823,9 +852,9 @@
}
if(titleUploadData.value.calculateType===3){
- item.grossAmount=parseFloat((item.price * item.quantity).toFixed(2))
+ item.grossAmount=multiply(item.price,item.quantity)
}else{
- item.grossAmount=parseFloat((item.price * item.computeGrossArea).toFixed(2))
+ item.grossAmount=multiply(item.price,item.computeGrossArea)
}
})
@@ -884,7 +913,7 @@
titleUploadData.value.icon = titleSelectJson.value.icon[0].basicName
titleUploadData.value.packType = titleSelectJson.value.packType[0].basicName
titleUploadData.value.alType = titleSelectJson.value.alType[0].basicName
- titleUploadData.value.calculateType = 1
+ titleUploadData.value.calculateType = company.calculateType
const today = new Date
today.setTime(today.getTime() + (7 * 24 * 60 * 60 * 1000))
titleUploadData.value.deliveryDate = today.getFullYear() +
@@ -961,6 +990,8 @@
//鏇存柊閲戦閲嶇疆
const updateMoney = () => {
+ titleUploadData.value.creatorId=userStore.user.userId
+ titleUploadData.value.creator=userStore.user.userName
const updateData = {
order: titleUploadData.value,
detail: xGrid.value.getTableData().fullData,
@@ -1022,20 +1053,20 @@
}
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
}
}
@@ -1087,14 +1118,14 @@
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
}
if(titleUploadData.value.calculateType===3){
- item.grossAmount=parseFloat((item.price * item.quantity).toFixed(2))
+ item.grossAmount=multiply(item.price , item.quantity)
}else{
- item.grossAmount=parseFloat((item.price * 1 * item.computeGrossArea).toFixed(2))
+ item.grossAmount=multiply(item.price * 1 , item.computeGrossArea)
}
})
@@ -1154,9 +1185,9 @@
row.computeGrossArea = row.grossArea
}
if(titleUploadData.value.calculateType===3){
- row.grossAmount=parseFloat((row.price * row.quantity).toFixed(2))
+ row.grossAmount=multiply(row.price ,row.quantity)
}else{
- row.grossAmount=parseFloat((row.price * row.computeGrossArea).toFixed(2))
+ row.grossAmount=multiply(row.price , row.computeGrossArea)
}
}else if(column.property === 'computeArea'){
@@ -1164,7 +1195,7 @@
if(titleUploadData.value?.orderReview!==2){
row.computeGrossArea = row.computeArea * row.quantity
}
- row.grossAmount=parseFloat((row.price * row.computeGrossArea).toFixed(2))
+ row.grossAmount=multiply(row.price , row.computeGrossArea)
}
}
@@ -1188,10 +1219,30 @@
}
+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 (!regex.test(errorArea.value)) {
+ if (!regex.test(errorArea.value.toString())) {
ElMessage.warning(t('basicData.msg.range99999Dec2'))
return
}
@@ -1204,13 +1255,14 @@
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()
errorAreaVisible.value= false
}
+
@@ -1233,11 +1285,11 @@
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))
}
}
})
@@ -1270,8 +1322,6 @@
if(evnt.$event.keyCode === 38 ){
const { rowIndex,row,column } = xGrid.value.getSelectedCell() || xGrid.value.getEditRecord()
let nextRowIndex = xGrid.value.getRowIndex(row) - 1;
- console.log(xGrid.value.getTableData().fullData.length)
- console.log(nextRowIndex)
if (nextRowIndex < xGrid.value.getTableData().fullData.length && nextRowIndex>=0) {
xGrid.value.setCurrentRow(xGrid.value.getTableData().fullData[nextRowIndex]);
}
@@ -1375,7 +1425,7 @@
<el-select @change="changeCalculateType" v-model="titleUploadData.calculateType" placeholder=" " >
<el-option :value="1" :label="t('order.areaAmountPerPiece')"/>
<el-option :value="2" :label="t('order.areaAmountAge')"/>
- <el-option :value="3" :label="'鏁伴噺閲戦'"/>
+ <el-option :value="3" :label="t('order.quantityMount')"/>
</el-select>
</el-col>
<el-col :span="2"><el-text>*{{$t('order.salesman')}}锛�</el-text></el-col>
@@ -1433,6 +1483,7 @@
v-on="gridEvents"
@keydown="handleKeyDown"
@edit-closed="editClosedEvent"
+ :cell-style="cellStyle"
>
<template #num1_filter="{ column, $panel }">
<div>
--
Gitblit v1.8.0