|
@@ -105,6 +105,8 @@
|
|
|
import { useRouter } from "vue-router"
|
|
import { useRouter } from "vue-router"
|
|
|
import { useBaseStore } from '@/stores/modules/base'
|
|
import { useBaseStore } from '@/stores/modules/base'
|
|
|
import { storeToRefs } from 'pinia'
|
|
import { storeToRefs } from 'pinia'
|
|
|
|
|
+ import Product from '@/class/Product'
|
|
|
|
|
+
|
|
|
const base = useBaseStore()
|
|
const base = useBaseStore()
|
|
|
const router = useRouter()
|
|
const router = useRouter()
|
|
|
const prod = ref()
|
|
const prod = ref()
|
|
@@ -264,14 +266,14 @@
|
|
|
// })
|
|
// })
|
|
|
// return bool
|
|
// return bool
|
|
|
// }
|
|
// }
|
|
|
- const validInput = async (record,min,max,type)=>{
|
|
|
|
|
- if (record[type] > max) {
|
|
|
|
|
- record[type] = max
|
|
|
|
|
- } else if (record[type] < min) {
|
|
|
|
|
- record[type] = min
|
|
|
|
|
- } else {
|
|
|
|
|
- record[type] = record[type]
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ const validInput = (record,min,max,type)=>{
|
|
|
|
|
+ const pd = new Product(record)
|
|
|
|
|
+ let lengthValidData = {min: record.lengthmin, max:record.lengthmax,}
|
|
|
|
|
+ let widthValData = {min: record.widthmin, max: record.widthmax,}
|
|
|
|
|
+ if (!pd.checkDimension({width:widthValData,length:lengthValidData}, record)) {
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+ return true
|
|
|
}
|
|
}
|
|
|
const saveData = (data,type)=>{
|
|
const saveData = (data,type)=>{
|
|
|
if(time.value !== null){
|
|
if(time.value !== null){
|
|
@@ -317,10 +319,8 @@
|
|
|
prodData.value = data
|
|
prodData.value = data
|
|
|
}
|
|
}
|
|
|
const handleOk = ()=>{
|
|
const handleOk = ()=>{
|
|
|
- if (prodData.value.record.cheekschemeid > 0 && !prodData.record.customcheek) return message.warning('请填写完整信息')
|
|
|
|
|
- if (prodData.value.record.colorschemeid > 0 && !prodData.record.customcolors) return message.warning('请填写完整信息')
|
|
|
|
|
- if (prodData.value.record.materialschemeid > 0 && !prodData.record.custommaterial) return message.warning('请填写完整信息')
|
|
|
|
|
- if ((prodData.value.record.spec == '自定义' || prodData.value.record.spec == 'custom') && (!prodData.value.record.length || !prodData.value.record.width)) return message.warning('请填写完整信息')
|
|
|
|
|
|
|
+ if (!validInput(prodData.value.record))
|
|
|
|
|
+ return false
|
|
|
prodData.value.record.isselect = true
|
|
prodData.value.record.isselect = true
|
|
|
prod.value.data.some((item)=>{
|
|
prod.value.data.some((item)=>{
|
|
|
if (item.itemid == prodData.value.itemid) {
|
|
if (item.itemid == prodData.value.itemid) {
|