|
|
|
@ -71,9 +71,6 @@
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="table-right">
|
|
|
|
|
<!-- <span>合计: {{ totalCtnall }}</span> -->
|
|
|
|
|
|
|
|
|
|
<!-- {{ totalPkgs }} {{ tableData.length > 0 ? tableData[0].kindpkgs : '' }} -->
|
|
|
|
|
<span> 件数: {{ totalPkgs }}</span>
|
|
|
|
|
<span>重量: {{ totalKgs }} KGS</span>
|
|
|
|
|
<span>尺码: {{ totalCbm }} CBM</span>
|
|
|
|
@ -347,6 +344,8 @@
|
|
|
|
|
title: '尺码',
|
|
|
|
|
width: 80,
|
|
|
|
|
data: 'cbm',
|
|
|
|
|
type: 'numeric',
|
|
|
|
|
format: '0',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '品名',
|
|
|
|
@ -744,10 +743,13 @@
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
list.value.splice(0)
|
|
|
|
|
let data = res.data
|
|
|
|
|
data.forEach((item, index) => {
|
|
|
|
|
totalPkgs.value = 0
|
|
|
|
|
data.forEach(async (item, index) => {
|
|
|
|
|
totalPkgs.value = totalPkgs.value + item.pkgs
|
|
|
|
|
totalKgs.value = totalKgs.value + item.kgs
|
|
|
|
|
totalCbm.value = totalCbm.value + item.cbm
|
|
|
|
|
totalCtn.value = totalCtn.value + item.ctnNum
|
|
|
|
|
item.rowKey = index
|
|
|
|
|
})
|
|
|
|
|
data.forEach(async (item) => {
|
|
|
|
|
const weightTypeList = weightTypeDict.value.length
|
|
|
|
|
? weightTypeDict.value
|
|
|
|
|
: (await getDictDropDown({ code: 'weight_type' }))?.data
|
|
|
|
@ -832,29 +834,18 @@
|
|
|
|
|
}
|
|
|
|
|
// 删除行
|
|
|
|
|
const confirm = () => {
|
|
|
|
|
// let ApiData = { ids: [] }
|
|
|
|
|
// list.value.forEach((e, i) => {
|
|
|
|
|
// if (e.selected) {
|
|
|
|
|
// ApiData.ids.push(e.id)
|
|
|
|
|
// }
|
|
|
|
|
// })
|
|
|
|
|
// BatchDelOpCtn(ApiData).then((res) => {
|
|
|
|
|
// GetCtnList(props.details)
|
|
|
|
|
// notification.success({
|
|
|
|
|
// message: res.message,
|
|
|
|
|
// duration: 3,
|
|
|
|
|
// })
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
|
let Arr: any = []
|
|
|
|
|
let ApiData = { ids: [] }
|
|
|
|
|
list.value.forEach((e, i) => {
|
|
|
|
|
if (!e.selected) {
|
|
|
|
|
Arr.push(e)
|
|
|
|
|
if (e.selected) {
|
|
|
|
|
ApiData.ids.push(e.id)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
list.value.splice(0)
|
|
|
|
|
Arr.forEach((e) => {
|
|
|
|
|
list.value.push(e)
|
|
|
|
|
BatchDelOpCtn(ApiData).then((res) => {
|
|
|
|
|
GetCtnList(props.details)
|
|
|
|
|
notification.success({
|
|
|
|
|
message: res.message,
|
|
|
|
|
duration: 3,
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
// 打开多品名
|
|
|
|
@ -952,29 +943,7 @@
|
|
|
|
|
// })
|
|
|
|
|
// })
|
|
|
|
|
}
|
|
|
|
|
// function EditRow(record, index, event) {
|
|
|
|
|
// console.log('双击', record, index, event)
|
|
|
|
|
// if (!record.editable) {
|
|
|
|
|
// record.onEdit(true)
|
|
|
|
|
// } else {
|
|
|
|
|
// record.editable = false
|
|
|
|
|
// // record.onCancelEdit()
|
|
|
|
|
// record.onSubmitEdit()
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// 行编辑 结束
|
|
|
|
|
// function EditRowEnd() {
|
|
|
|
|
// totalPkgs.value = 0
|
|
|
|
|
// totalKgs.value = 0
|
|
|
|
|
// totalCbm.value = 0
|
|
|
|
|
// totalCtn.value = 0
|
|
|
|
|
// getDataSource().forEach((item) => {
|
|
|
|
|
// totalPkgs.value = Number(item.pkgs) + Number(totalPkgs.value)
|
|
|
|
|
// totalKgs.value = Number(item.kgs) + Number(totalKgs.value)
|
|
|
|
|
// totalCbm.value = Number(item.size) + Number(totalCbm.value)
|
|
|
|
|
// totalCtn.value = Number(item.size) + Number(totalCtn.value)
|
|
|
|
|
// })
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// -------------------------------
|
|
|
|
|
const loadingTable = ref(false)
|
|
|
|
|
const tableData: any = ref([{}])
|
|
|
|
@ -1029,590 +998,10 @@
|
|
|
|
|
console.log('---')
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
const editOption = ref({
|
|
|
|
|
beforeCellValueChange: ({ row, column, changeValue }) => {
|
|
|
|
|
if (inTableLoad.value) {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
if (
|
|
|
|
|
['pkgs', 'kgs', 'cbm', 'tareweight'].includes(column.field) &&
|
|
|
|
|
!new RegExp(/^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+)$/).test(changeValue)
|
|
|
|
|
) {
|
|
|
|
|
const height = document.body.clientHeight - 100
|
|
|
|
|
notification.config({
|
|
|
|
|
top: `${height}px`,
|
|
|
|
|
duration: 2,
|
|
|
|
|
maxCount: 3,
|
|
|
|
|
})
|
|
|
|
|
notification.error({
|
|
|
|
|
message: `输入的${enmuErrorLabel(column.field)}不符合规则`,
|
|
|
|
|
duration: 3,
|
|
|
|
|
})
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
notification.destroy()
|
|
|
|
|
notification.config({
|
|
|
|
|
top: `100px`,
|
|
|
|
|
duration: 2,
|
|
|
|
|
maxCount: 3,
|
|
|
|
|
})
|
|
|
|
|
}, 2000)
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
if (column.field === 'cntrno') {
|
|
|
|
|
const res = checkCntrno(changeValue)
|
|
|
|
|
if (res !== '') {
|
|
|
|
|
const height = document.body.clientHeight - 100
|
|
|
|
|
notification.config({
|
|
|
|
|
top: `${height}px`,
|
|
|
|
|
duration: 2,
|
|
|
|
|
maxCount: 3,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
notification.error({ message: res, duration: 3 })
|
|
|
|
|
// row['cntrno'] = ''
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
notification.destroy()
|
|
|
|
|
notification.config({
|
|
|
|
|
top: `100px`,
|
|
|
|
|
duration: 2,
|
|
|
|
|
maxCount: 3,
|
|
|
|
|
})
|
|
|
|
|
}, 2000)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
beforeStartCellEditing: ({ row, column, cellValue }) => {
|
|
|
|
|
console.log(column)
|
|
|
|
|
// const arr = this.$options.filters['dictData']('BookingLockCtn')
|
|
|
|
|
let type = true
|
|
|
|
|
// arr.forEach((item) => {
|
|
|
|
|
// if (item.code == column.field && this.isLockBooking) {
|
|
|
|
|
// type = false
|
|
|
|
|
// }
|
|
|
|
|
// })
|
|
|
|
|
return type
|
|
|
|
|
},
|
|
|
|
|
afterCellValueChange: ({ row, column, changeValue }) => {
|
|
|
|
|
if (inTableLoad.value) {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
if (['kgs', 'cbm', 'tareweight', 'weighkgs'].includes(column.field)) {
|
|
|
|
|
changeValue = changeValue + ''
|
|
|
|
|
const valIndex = changeValue.includes('.') ? changeValue.indexOf('.') + 1 : false
|
|
|
|
|
const valCount = changeValue.length - valIndex
|
|
|
|
|
if (valIndex && valCount > 5) {
|
|
|
|
|
const height = document.body.clientHeight - 100
|
|
|
|
|
notification.config({
|
|
|
|
|
top: `${height}px`,
|
|
|
|
|
duration: 2,
|
|
|
|
|
maxCount: 3,
|
|
|
|
|
})
|
|
|
|
|
notification.error({ message: '仅支持小数点后五位', duration: 3 })
|
|
|
|
|
row[column.field] = changeValue.substr(0, valIndex + 5)
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
notification.destroy()
|
|
|
|
|
notification.config({
|
|
|
|
|
top: `100px`,
|
|
|
|
|
duration: 2,
|
|
|
|
|
maxCount: 3,
|
|
|
|
|
})
|
|
|
|
|
}, 2000)
|
|
|
|
|
} else {
|
|
|
|
|
const arrayNum = changeValue.split('.')
|
|
|
|
|
if (!/\./.test(changeValue)) {
|
|
|
|
|
row[column.field] = changeValue + '.00'
|
|
|
|
|
} else if (arrayNum[1].length < 2) {
|
|
|
|
|
row[column.field] = changeValue + '0'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (column.field === 'pkgs') {
|
|
|
|
|
if (!/(^[1-9]\d*$)/.test(changeValue)) {
|
|
|
|
|
const height = document.body.clientHeight - 100
|
|
|
|
|
notification.config({
|
|
|
|
|
top: `${height}px`,
|
|
|
|
|
duration: 2,
|
|
|
|
|
maxCount: 3,
|
|
|
|
|
})
|
|
|
|
|
notification.error({ message: '件数请输入整数', duration: 3 })
|
|
|
|
|
const cNum = changeValue.indexOf('.')
|
|
|
|
|
row[column.field] = changeValue.substr(0, cNum)
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
notification.destroy()
|
|
|
|
|
notification.config({
|
|
|
|
|
top: `100px`,
|
|
|
|
|
duration: 2,
|
|
|
|
|
maxCount: 3,
|
|
|
|
|
})
|
|
|
|
|
}, 2000)
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
let num = 0
|
|
|
|
|
tableData.value.map((item, index) => {
|
|
|
|
|
if (item.pkgs) {
|
|
|
|
|
num += Number(item.pkgs)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
totalPkgs.value = num
|
|
|
|
|
}
|
|
|
|
|
if (column.field === 'kgs') {
|
|
|
|
|
let num: any = 0
|
|
|
|
|
tableData.value.map((item, index) => {
|
|
|
|
|
num = (num * 10000 + Number(item.kgs) * 10000) / 10000
|
|
|
|
|
// num += Number(item.kgs)
|
|
|
|
|
})
|
|
|
|
|
num += ''
|
|
|
|
|
const pNum = num.split('.')
|
|
|
|
|
if (!/\./.test(num)) {
|
|
|
|
|
totalKgs.value = num + '.00'
|
|
|
|
|
} else if (pNum[1].length < 2) {
|
|
|
|
|
totalKgs.value = num + '0'
|
|
|
|
|
} else {
|
|
|
|
|
totalKgs.value = Number(pNum[0] + '.' + pNum[1].substr(0, 5))
|
|
|
|
|
// totalKgs.value = num
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (column.field === 'cbm') {
|
|
|
|
|
let num: any = 0
|
|
|
|
|
tableData.value.map((item, index) => {
|
|
|
|
|
// num += Number(item.cbm)
|
|
|
|
|
num = (num * 10000 + Number(item.cbm) * 10000) / 10000
|
|
|
|
|
})
|
|
|
|
|
num += ''
|
|
|
|
|
const pNum = num.split('.')
|
|
|
|
|
if (!/\./.test(num)) {
|
|
|
|
|
totalCbm.value = num + '.00'
|
|
|
|
|
} else if (pNum[1].length < 2) {
|
|
|
|
|
totalCbm.value = num + '0'
|
|
|
|
|
} else {
|
|
|
|
|
// totalCbm.value = num
|
|
|
|
|
totalCbm.value = Number(pNum[0] + '.' + pNum[1].substr(0, 5))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (column.field === 'kgs' || column.field === 'tareweight') {
|
|
|
|
|
row['weighkgs'] = calc(Number(row['kgs']), Number(row['tareweight']), '+')
|
|
|
|
|
const kgsVal = row['weighkgs'] + ''
|
|
|
|
|
const kgsIndex: any = kgsVal.includes('.') ? kgsVal.indexOf('.') + 1 : false
|
|
|
|
|
const kgsCount: any = kgsVal.includes('.') ? kgsVal.length - kgsIndex : false
|
|
|
|
|
if (kgsCount > 4) {
|
|
|
|
|
row['weighkgs'] = kgsVal.substr(0, kgsIndex + 5)
|
|
|
|
|
} else if (!kgsIndex) {
|
|
|
|
|
row['weighkgs'] = kgsVal + '.00'
|
|
|
|
|
} else {
|
|
|
|
|
const arrayNum = kgsVal.split('.')
|
|
|
|
|
if (!/\./.test(kgsVal)) {
|
|
|
|
|
row['weighkgs'] = kgsVal + '.00'
|
|
|
|
|
} else if (arrayNum[1].length < 2) {
|
|
|
|
|
row['weighkgs'] = kgsVal + '0'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (column.field === 'ctnnum') {
|
|
|
|
|
const map = {}
|
|
|
|
|
const dest: any[] = []
|
|
|
|
|
for (var i = 0; i < tableData.value.length; i++) {
|
|
|
|
|
var ai = tableData.value[i]
|
|
|
|
|
if (!map[ai.ctnall]) {
|
|
|
|
|
dest.push({
|
|
|
|
|
ctnall: ai.ctnall,
|
|
|
|
|
ctnnum: ai.ctnnum,
|
|
|
|
|
})
|
|
|
|
|
map[ai.ctnall] = ai
|
|
|
|
|
} else {
|
|
|
|
|
for (var j = 0; j < dest.length; j++) {
|
|
|
|
|
var dj = dest[j]
|
|
|
|
|
if (dj.ctnall == ai.ctnall) {
|
|
|
|
|
dj.ctnnum = (parseFloat(dj.ctnnum) + parseFloat(ai.ctnnum)).toString()
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
changeEmit1(dest)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
cellValueChange: ({ row, column }) => {
|
|
|
|
|
console.log(row, column)
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
const rowKeyName = 'rowKey'
|
|
|
|
|
const rowStyleOption = ref({
|
|
|
|
|
clickHighlight: false,
|
|
|
|
|
hoverHighlight: false,
|
|
|
|
|
})
|
|
|
|
|
const clipboardOption = ref({
|
|
|
|
|
copy: true,
|
|
|
|
|
paste: true,
|
|
|
|
|
cut: true,
|
|
|
|
|
delete: true,
|
|
|
|
|
beforeCopy: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
log({ data, selectionRangeIndexes, selectionRangeKeys })
|
|
|
|
|
},
|
|
|
|
|
afterCopy: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
log({ data, selectionRangeIndexes, selectionRangeKeys })
|
|
|
|
|
},
|
|
|
|
|
beforePaste: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
const changeValue = data[0][selectionRangeKeys.endColKey]
|
|
|
|
|
if (inTableLoad.value) {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
if (
|
|
|
|
|
['pkgs', 'kgs', 'cbm', 'tareweight'].includes(selectionRangeKeys.endColKey) &&
|
|
|
|
|
!new RegExp(/^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+)$/).test(changeValue)
|
|
|
|
|
) {
|
|
|
|
|
const height = document.body.clientHeight - 100
|
|
|
|
|
notification.config({
|
|
|
|
|
top: `${height}px`,
|
|
|
|
|
duration: 2,
|
|
|
|
|
maxCount: 3,
|
|
|
|
|
})
|
|
|
|
|
notification.error({
|
|
|
|
|
message: `输入的${enmuErrorLabel(selectionRangeKeys.endColKey)}不符合规则`,
|
|
|
|
|
duration: 3,
|
|
|
|
|
})
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
notification.destroy()
|
|
|
|
|
notification.config({
|
|
|
|
|
top: `100px`,
|
|
|
|
|
duration: 2,
|
|
|
|
|
maxCount: 3,
|
|
|
|
|
})
|
|
|
|
|
}, 2000)
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
if (selectionRangeKeys.endColKey === 'cntrno') {
|
|
|
|
|
const res = checkCntrno(changeValue)
|
|
|
|
|
if (res !== '') {
|
|
|
|
|
const height = document.body.clientHeight - 100
|
|
|
|
|
notification.config({
|
|
|
|
|
top: `${height}px`,
|
|
|
|
|
duration: 2,
|
|
|
|
|
maxCount: 3,
|
|
|
|
|
})
|
|
|
|
|
notification.error({ message: res, duration: 3 })
|
|
|
|
|
// row['cntrno'] = ''
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
notification.destroy()
|
|
|
|
|
notification.config({
|
|
|
|
|
top: `100px`,
|
|
|
|
|
duration: 2,
|
|
|
|
|
maxCount: 3,
|
|
|
|
|
})
|
|
|
|
|
}, 2000)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
afterPaste: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
let changeValue = data[0][selectionRangeKeys.endColKey]
|
|
|
|
|
const index = selectionRangeIndexes.startRowIndex
|
|
|
|
|
if (inTableLoad.value) {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
if (['kgs', 'cbm', 'tareweight', 'weighkgs'].includes(selectionRangeKeys.endColKey)) {
|
|
|
|
|
changeValue = changeValue + ''
|
|
|
|
|
const valIndex = changeValue.includes('.') ? changeValue.indexOf('.') + 1 : false
|
|
|
|
|
const valCount = changeValue.length - valIndex
|
|
|
|
|
if (valIndex && valCount > 5) {
|
|
|
|
|
const height = document.body.clientHeight - 100
|
|
|
|
|
notification.config({
|
|
|
|
|
top: `${height}px`,
|
|
|
|
|
duration: 2,
|
|
|
|
|
maxCount: 3,
|
|
|
|
|
})
|
|
|
|
|
notification.error({ message: '仅支持小数点后五位', duration: 3 })
|
|
|
|
|
tableData.value[index][selectionRangeKeys.endColKey] = changeValue.substr(0, valIndex + 5)
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
notification.destroy()
|
|
|
|
|
notification.config({
|
|
|
|
|
top: `100px`,
|
|
|
|
|
duration: 2,
|
|
|
|
|
maxCount: 3,
|
|
|
|
|
})
|
|
|
|
|
}, 2000)
|
|
|
|
|
} else {
|
|
|
|
|
const arrayNum = changeValue.split('.')
|
|
|
|
|
if (!/\./.test(changeValue)) {
|
|
|
|
|
tableData.value[index][selectionRangeKeys.endColKey] = changeValue + '.00'
|
|
|
|
|
} else if (arrayNum[1].length < 2) {
|
|
|
|
|
tableData.value[index][selectionRangeKeys.endColKey] = changeValue + '0'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (selectionRangeKeys.endColKey === 'pkgs') {
|
|
|
|
|
if (!/(^[1-9]\d*$)/.test(changeValue)) {
|
|
|
|
|
const height = document.body.clientHeight - 100
|
|
|
|
|
notification.config({
|
|
|
|
|
top: `${height}px`,
|
|
|
|
|
duration: 2,
|
|
|
|
|
maxCount: 3,
|
|
|
|
|
})
|
|
|
|
|
notification.error({ message: '件数请输入整数', duration: 3 })
|
|
|
|
|
const cNum = changeValue.indexOf('.')
|
|
|
|
|
tableData.value[index][selectionRangeKeys.endColKey] = changeValue.substr(0, cNum)
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
notification.destroy()
|
|
|
|
|
notification.config({
|
|
|
|
|
top: `100px`,
|
|
|
|
|
duration: 2,
|
|
|
|
|
maxCount: 3,
|
|
|
|
|
})
|
|
|
|
|
}, 2000)
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
let num = 0
|
|
|
|
|
tableData.value.map((item, index) => {
|
|
|
|
|
if (item.pkgs) {
|
|
|
|
|
num += Number(item.pkgs)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
totalPkgs.value = num
|
|
|
|
|
}
|
|
|
|
|
if (selectionRangeKeys.endColKey === 'kgs') {
|
|
|
|
|
let num: any = 0
|
|
|
|
|
tableData.value.map((item, index) => {
|
|
|
|
|
num = (num * 10000 + Number(item.kgs) * 10000) / 10000
|
|
|
|
|
// num += Number(item.kgs)
|
|
|
|
|
})
|
|
|
|
|
num += ''
|
|
|
|
|
const pNum = num.split('.')
|
|
|
|
|
if (!/\./.test(num)) {
|
|
|
|
|
totalKgs.value = num + '.00'
|
|
|
|
|
} else if (pNum[1].length < 2) {
|
|
|
|
|
totalKgs.value = num + '0'
|
|
|
|
|
} else {
|
|
|
|
|
totalKgs.value = Number(pNum[0] + '.' + pNum[1].substr(0, 5))
|
|
|
|
|
// totalKgs.value = num
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (selectionRangeKeys.endColKey === 'cbm') {
|
|
|
|
|
let num: any = 0
|
|
|
|
|
tableData.value.map((item, index) => {
|
|
|
|
|
// num += Number(item.cbm)
|
|
|
|
|
num = (num * 10000 + Number(item.cbm) * 10000) / 10000
|
|
|
|
|
})
|
|
|
|
|
num += ''
|
|
|
|
|
const pNum = num.split('.')
|
|
|
|
|
if (!/\./.test(num)) {
|
|
|
|
|
totalCbm.value = num + '.00'
|
|
|
|
|
} else if (pNum[1].length < 2) {
|
|
|
|
|
totalCbm.value = num + '0'
|
|
|
|
|
} else {
|
|
|
|
|
// totalCbm.value = num
|
|
|
|
|
totalCbm.value = Number(pNum[0] + '.' + pNum[1].substr(0, 5))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (selectionRangeKeys.endColKey === 'kgs' || selectionRangeKeys.endColKey === 'tareweight') {
|
|
|
|
|
tableData.value[index]['weighkgs'] = calc(
|
|
|
|
|
Number(tableData.value[index]['kgs']),
|
|
|
|
|
Number(tableData.value[index]['tareweight']),
|
|
|
|
|
'+',
|
|
|
|
|
)
|
|
|
|
|
const kgsVal = tableData.value[index]['weighkgs'] + ''
|
|
|
|
|
const kgsIndex: any = kgsVal.includes('.') ? kgsVal.indexOf('.') + 1 : false
|
|
|
|
|
const kgsCount: any = kgsVal.includes('.') ? kgsVal.length - kgsIndex : false
|
|
|
|
|
if (kgsCount > 4) {
|
|
|
|
|
tableData.value[index]['weighkgs'] = kgsVal.substr(0, kgsIndex + 5)
|
|
|
|
|
} else if (!kgsIndex) {
|
|
|
|
|
tableData.value[index]['weighkgs'] = kgsVal + '.00'
|
|
|
|
|
} else {
|
|
|
|
|
const arrayNum = kgsVal.split('.')
|
|
|
|
|
if (!/\./.test(kgsVal)) {
|
|
|
|
|
tableData.value[index]['weighkgs'] = kgsVal + '.00'
|
|
|
|
|
} else if (arrayNum[1].length < 2) {
|
|
|
|
|
tableData.value[index]['weighkgs'] = kgsVal + '0'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
beforeCut: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
log({ data, selectionRangeIndexes, selectionRangeKeys })
|
|
|
|
|
},
|
|
|
|
|
afterCut: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
log({ data, selectionRangeIndexes, selectionRangeKeys })
|
|
|
|
|
},
|
|
|
|
|
beforeDelete: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
log({ data, selectionRangeIndexes, selectionRangeKeys })
|
|
|
|
|
},
|
|
|
|
|
afterDelete: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
log({ data, selectionRangeIndexes, selectionRangeKeys })
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
const cellSelectionOption = ref({
|
|
|
|
|
enable: true,
|
|
|
|
|
})
|
|
|
|
|
const totalCtnall = ref('')
|
|
|
|
|
const BookingLockCtn = ref({})
|
|
|
|
|
const moreModelconfirm = ref(false)
|
|
|
|
|
const modelColumns = ref([
|
|
|
|
|
{
|
|
|
|
|
field: '',
|
|
|
|
|
key: 'radio',
|
|
|
|
|
type: 'radio',
|
|
|
|
|
title: '',
|
|
|
|
|
width: 40,
|
|
|
|
|
operationColumn: true,
|
|
|
|
|
align: 'center',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'ctnall',
|
|
|
|
|
key: 'ctnall',
|
|
|
|
|
title: '箱型',
|
|
|
|
|
align: 'left',
|
|
|
|
|
width: 80,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'ctnnum',
|
|
|
|
|
key: 'ctnnum ',
|
|
|
|
|
title: '箱量',
|
|
|
|
|
align: 'left',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'cntrno',
|
|
|
|
|
key: 'cntrno',
|
|
|
|
|
title: '箱号',
|
|
|
|
|
align: 'left',
|
|
|
|
|
width: 240,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'sealno',
|
|
|
|
|
key: 'sealno',
|
|
|
|
|
title: '封号',
|
|
|
|
|
align: 'left',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'pkgs',
|
|
|
|
|
key: 'pkgs',
|
|
|
|
|
title: '件数',
|
|
|
|
|
align: 'left',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'kindpkgs',
|
|
|
|
|
key: 'kindpkgs',
|
|
|
|
|
title: '包装',
|
|
|
|
|
align: 'left',
|
|
|
|
|
width: 130,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'kgs',
|
|
|
|
|
key: 'kgs',
|
|
|
|
|
title: '毛重',
|
|
|
|
|
align: 'left',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'cbm',
|
|
|
|
|
key: 'cbm',
|
|
|
|
|
title: '尺码',
|
|
|
|
|
align: 'left',
|
|
|
|
|
},
|
|
|
|
|
])
|
|
|
|
|
const radioOption = ref({
|
|
|
|
|
// 行选择改变事件
|
|
|
|
|
selectedRowChange: ({ row }) => {
|
|
|
|
|
childModelSelect.value = row
|
|
|
|
|
tableData.value.map((item, index) => {
|
|
|
|
|
if (item.rowKey === row.rowKey) {
|
|
|
|
|
childModelSelectIndex.value = index
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
if (tableData.value[childModelSelectIndex.value].ctnDetailInputs) {
|
|
|
|
|
tableData.value[childModelSelectIndex.value].ctnDetailInputs.map((item, index) => {
|
|
|
|
|
item.rowKey = index
|
|
|
|
|
})
|
|
|
|
|
childTableData.value = tableData.value[childModelSelectIndex.value].ctnDetailInputs
|
|
|
|
|
} else {
|
|
|
|
|
childTableData.value = []
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
const childModelSelect: Ref<any> = ref(null)
|
|
|
|
|
const childModelSelectIndex: Ref<any> = ref(null)
|
|
|
|
|
const childTableData: Ref<any> = ref([])
|
|
|
|
|
const selectChildArr = ref([])
|
|
|
|
|
const editChildOption = ref({
|
|
|
|
|
beforeCellValueChange: ({ row, column, changeValue }) => {
|
|
|
|
|
if (
|
|
|
|
|
['pkgs', 'kgs', 'cbm'].includes(column.field) &&
|
|
|
|
|
!new RegExp(/^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+)$/).test(changeValue)
|
|
|
|
|
) {
|
|
|
|
|
notification.error({
|
|
|
|
|
message: `输入的${enmuErrorLabel(column.field)}不符合规则`,
|
|
|
|
|
duration: 3,
|
|
|
|
|
})
|
|
|
|
|
row['cntrno'] = ''
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
notification.destroy()
|
|
|
|
|
notification.config({
|
|
|
|
|
top: `100px`,
|
|
|
|
|
duration: 2,
|
|
|
|
|
maxCount: 3,
|
|
|
|
|
})
|
|
|
|
|
}, 2000)
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
afterCellValueChange: ({ row, column, changeValue }) => {
|
|
|
|
|
let num: any = null
|
|
|
|
|
childTableData.value.map((item: any, index) => {
|
|
|
|
|
if (row.rowKey === item.rowKey) {
|
|
|
|
|
// eslint-disable-next-line no-const-assign
|
|
|
|
|
num = index
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
childTableData.value[num][column.field] = changeValue
|
|
|
|
|
// 暂时屏蔽 - 根据需求放开
|
|
|
|
|
// props.details.ctnInputs[childModelSelect.valueIndex].ctnDetailInputs[num][column.field] = changeValue
|
|
|
|
|
that.$forceUpdate()
|
|
|
|
|
},
|
|
|
|
|
cellValueChange: ({ row, column }) => {
|
|
|
|
|
console.log(row, column)
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
const checkChildboxOption = ref({
|
|
|
|
|
hideSelectAll: false,
|
|
|
|
|
// 行选择改变事件
|
|
|
|
|
selectedRowChange: ({ row, isSelected, selectedRowKeys }) => {
|
|
|
|
|
console.log(row, isSelected, selectedRowKeys)
|
|
|
|
|
selectChildArr.value = selectedRowKeys
|
|
|
|
|
},
|
|
|
|
|
// 全选改变事件
|
|
|
|
|
selectedAllChange: ({ isSelected, selectedRowKeys }) => {
|
|
|
|
|
if (isSelected) {
|
|
|
|
|
selectChildArr.value = selectedRowKeys
|
|
|
|
|
} else {
|
|
|
|
|
selectChildArr.value = []
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
const clipboardChildOption = ref({
|
|
|
|
|
copy: true,
|
|
|
|
|
paste: true,
|
|
|
|
|
cut: true,
|
|
|
|
|
delete: true,
|
|
|
|
|
beforeCopy: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
log({ data, selectionRangeIndexes, selectionRangeKeys })
|
|
|
|
|
},
|
|
|
|
|
afterCopy: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
log({ data, selectionRangeIndexes, selectionRangeKeys })
|
|
|
|
|
},
|
|
|
|
|
beforePaste: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
log({ data, selectionRangeIndexes, selectionRangeKeys })
|
|
|
|
|
},
|
|
|
|
|
afterPaste: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
log({ data, selectionRangeIndexes, selectionRangeKeys })
|
|
|
|
|
},
|
|
|
|
|
beforeCut: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
log({ data, selectionRangeIndexes, selectionRangeKeys })
|
|
|
|
|
},
|
|
|
|
|
afterCut: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
log({ data, selectionRangeIndexes, selectionRangeKeys })
|
|
|
|
|
},
|
|
|
|
|
beforeDelete: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
log({ data, selectionRangeIndexes, selectionRangeKeys })
|
|
|
|
|
},
|
|
|
|
|
afterDelete: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
log({ data, selectionRangeIndexes, selectionRangeKeys })
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
const columnsAuto = ref([
|
|
|
|
|
{
|
|
|
|
|
dataIndex: 'CTNALL',
|
|
|
|
@ -2281,6 +1670,42 @@
|
|
|
|
|
list.value[changes[0][0]]['isTemp'] = dict?.value
|
|
|
|
|
list.value[changes[0][0]]['isTempName'] = dict?.name
|
|
|
|
|
}
|
|
|
|
|
// 计算件数
|
|
|
|
|
if (changes[0][1] === 'pkgs') {
|
|
|
|
|
let RData = 0
|
|
|
|
|
list.value.forEach((e) => {
|
|
|
|
|
RData = RData + e.pkgs
|
|
|
|
|
})
|
|
|
|
|
totalPkgs.value = RData
|
|
|
|
|
|
|
|
|
|
emit('changeTotal', { type: 'totalPkgs', val: totalPkgs.value })
|
|
|
|
|
}
|
|
|
|
|
// 计算毛重
|
|
|
|
|
if (changes[0][1] === 'kgs') {
|
|
|
|
|
let RData = 0
|
|
|
|
|
list.value.forEach((e) => {
|
|
|
|
|
RData = RData + e.kgs
|
|
|
|
|
})
|
|
|
|
|
totalKgs.value = RData
|
|
|
|
|
emit('changeTotal', { type: 'totalKgs', val: totalKgs.value })
|
|
|
|
|
}
|
|
|
|
|
// 计算尺码
|
|
|
|
|
if (changes[0][1] === 'cbm') {
|
|
|
|
|
let RData = 0
|
|
|
|
|
list.value.forEach((e) => {
|
|
|
|
|
RData = RData + e.cbm
|
|
|
|
|
})
|
|
|
|
|
totalCbm.value = RData
|
|
|
|
|
emit('changeTotal', { type: 'totalCbm', val: totalCbm.value })
|
|
|
|
|
}
|
|
|
|
|
// 计算箱量
|
|
|
|
|
if (changes[0][1] === 'ctnNum') {
|
|
|
|
|
let RData = 0
|
|
|
|
|
list.value.forEach((e) => {
|
|
|
|
|
RData = RData + e.ctnNum
|
|
|
|
|
})
|
|
|
|
|
totalCtn.value = RData
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|