|
|
|
@ -5,7 +5,7 @@
|
|
|
|
|
<div class="left">
|
|
|
|
|
<a-button class="btn" type="primary" @click="addboxLine">添加</a-button>
|
|
|
|
|
<a-button class="btn" @click="removeLine">删除</a-button>
|
|
|
|
|
<a-button class="btn" type="primary" @click="openDialog" :disabled="tableData.length===0">多品名</a-button>
|
|
|
|
|
<a-button class="btn" type="primary" @click="openDialog" :disabled="tableData.length === 0">多品名</a-button>
|
|
|
|
|
<a-button class="btn" type="primary" @click="importYarn">引入场站数据</a-button>
|
|
|
|
|
<a-button class="btn" type="primary" @click="importWeight">引入箱皮重</a-button>
|
|
|
|
|
</div>
|
|
|
|
@ -28,11 +28,9 @@
|
|
|
|
|
:checkbox-option="checkboxOption"
|
|
|
|
|
:clipboard-option="clipboardOption"
|
|
|
|
|
/>
|
|
|
|
|
<div class="table-no-data" v-if="tableData.length === 0">
|
|
|
|
|
暂无数据
|
|
|
|
|
</div>
|
|
|
|
|
<div class="table-no-data" v-if="tableData.length === 0">暂无数据</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="loading" v-else> 加载中 ... </div>
|
|
|
|
|
<div class="loading" v-else>加载中 ...</div>
|
|
|
|
|
</a-card>
|
|
|
|
|
<a-modal
|
|
|
|
|
title="多品名维护"
|
|
|
|
@ -43,7 +41,7 @@
|
|
|
|
|
>
|
|
|
|
|
<div class="model-content">
|
|
|
|
|
<ve-table
|
|
|
|
|
style="width:100%"
|
|
|
|
|
style="width: 100%"
|
|
|
|
|
:columns="modelColumns"
|
|
|
|
|
:table-data="tableData"
|
|
|
|
|
:radio-option="radioOption"
|
|
|
|
@ -66,9 +64,7 @@
|
|
|
|
|
:checkbox-option="checkChildboxOption"
|
|
|
|
|
:clipboard-option="clipboardChildOption"
|
|
|
|
|
/>
|
|
|
|
|
<div class="table-no-data" v-if="childTableData.length === 0">
|
|
|
|
|
暂无数据
|
|
|
|
|
</div>
|
|
|
|
|
<div class="table-no-data" v-if="childTableData.length === 0">暂无数据</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<template slot="footer">
|
|
|
|
@ -136,11 +132,9 @@ export default {
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{
|
|
|
|
|
this.ctnList.map((item, index) => {
|
|
|
|
|
return (<a-select-option value={index}>{item.name}</a-select-option>)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
{this.ctnList.map((item, index) => {
|
|
|
|
|
return <a-select-option value={index}>{item.name}</a-select-option>
|
|
|
|
|
})}
|
|
|
|
|
</a-select>
|
|
|
|
|
)
|
|
|
|
|
},
|
|
|
|
@ -195,14 +189,12 @@ export default {
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{
|
|
|
|
|
this.packageList.map((item, index) => {
|
|
|
|
|
return (<a-select-option value={index}>{item.name}</a-select-option>)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
{this.packageList.map((item, index) => {
|
|
|
|
|
return <a-select-option value={index}>{item.name}</a-select-option>
|
|
|
|
|
})}
|
|
|
|
|
</a-select>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'kgs',
|
|
|
|
@ -256,7 +248,7 @@ export default {
|
|
|
|
|
key: 'weighkgs',
|
|
|
|
|
title: '称重重量',
|
|
|
|
|
align: 'left',
|
|
|
|
|
edit: true
|
|
|
|
|
edit: true,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
modelColumns: [
|
|
|
|
@ -305,7 +297,7 @@ export default {
|
|
|
|
|
key: 'kindpkgs',
|
|
|
|
|
title: '包装',
|
|
|
|
|
align: 'left',
|
|
|
|
|
width: 130
|
|
|
|
|
width: 130,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'weighkgs',
|
|
|
|
@ -359,21 +351,19 @@ export default {
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{
|
|
|
|
|
this.packageList.map((item, index) => {
|
|
|
|
|
return (<a-select-option value={index}>{item.name}</a-select-option>)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
{this.packageList.map((item, index) => {
|
|
|
|
|
return <a-select-option value={index}>{item.name}</a-select-option>
|
|
|
|
|
})}
|
|
|
|
|
</a-select>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'weighkgs',
|
|
|
|
|
key: 'weighkgs',
|
|
|
|
|
title: '毛重',
|
|
|
|
|
align: 'left',
|
|
|
|
|
edit: true
|
|
|
|
|
edit: true,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'cbm',
|
|
|
|
@ -408,13 +398,16 @@ export default {
|
|
|
|
|
tableData: [],
|
|
|
|
|
editOption: {
|
|
|
|
|
beforeCellValueChange: ({ row, column, changeValue }) => {
|
|
|
|
|
if (['pkgs', 'kgs', 'cbm', 'tareweight'].includes(column.field) && !/^\d+$/.test(changeValue)) {
|
|
|
|
|
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
|
|
|
|
|
this.$message.config({
|
|
|
|
|
top: `${height}px`,
|
|
|
|
|
duration: 2,
|
|
|
|
|
maxCount: 3
|
|
|
|
|
});
|
|
|
|
|
maxCount: 3,
|
|
|
|
|
})
|
|
|
|
|
this.$message.error(`输入的${this.enmuErrorLabel(column.field)}不符合规则`)
|
|
|
|
|
row['cntrno'] = ''
|
|
|
|
|
setTimeout(() => {
|
|
|
|
@ -453,7 +446,8 @@ export default {
|
|
|
|
|
// }
|
|
|
|
|
// })
|
|
|
|
|
// this.tableData[nowIndex]['weighkgs'] = Number(this.tableData[nowIndex].kgs) + Number(this.tableData[nowIndex].tareweight)
|
|
|
|
|
row['weighkgs'] = Number(row['kgs']) + Number(row['tareweight'])
|
|
|
|
|
// row['weighkgs'] = Number(row['kgs']) + Number(row['tareweight'])
|
|
|
|
|
row['weighkgs'] = this.calc(Number(row['kgs']), Number(row['tareweight']), '+')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
cellValueChange: ({ row, column }) => {
|
|
|
|
@ -462,13 +456,16 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
editChildOption: {
|
|
|
|
|
beforeCellValueChange: ({ row, column, changeValue }) => {
|
|
|
|
|
if (['pkgs', 'kgs', 'cbm'].includes(column.field) && !/^\d+$/.test(changeValue)) {
|
|
|
|
|
if (
|
|
|
|
|
['pkgs', 'kgs', 'cbm'].includes(column.field) &&
|
|
|
|
|
!new RegExp(/^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+)$/).test(changeValue)
|
|
|
|
|
) {
|
|
|
|
|
const height = document.body.clientHeight - 100
|
|
|
|
|
this.$message.config({
|
|
|
|
|
top: `${height}px`,
|
|
|
|
|
duration: 2,
|
|
|
|
|
maxCount: 3
|
|
|
|
|
});
|
|
|
|
|
maxCount: 3,
|
|
|
|
|
})
|
|
|
|
|
this.$message.error(`输入的${this.enmuErrorLabel(column.field)}不符合规则`)
|
|
|
|
|
row['cntrno'] = ''
|
|
|
|
|
setTimeout(() => {
|
|
|
|
@ -537,74 +534,74 @@ export default {
|
|
|
|
|
cut: true,
|
|
|
|
|
delete: true,
|
|
|
|
|
beforeCopy: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
console.log('beforeCopy');
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys });
|
|
|
|
|
console.log('beforeCopy')
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys })
|
|
|
|
|
},
|
|
|
|
|
afterCopy: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
console.log('afterCopy');
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys });
|
|
|
|
|
console.log('afterCopy')
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys })
|
|
|
|
|
},
|
|
|
|
|
beforePaste: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
console.log('beforePaste');
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys });
|
|
|
|
|
console.log('beforePaste')
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys })
|
|
|
|
|
},
|
|
|
|
|
afterPaste: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
console.log('afterPaste');
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys });
|
|
|
|
|
console.log('afterPaste')
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys })
|
|
|
|
|
},
|
|
|
|
|
beforeCut: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
console.log('beforeCut');
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys });
|
|
|
|
|
console.log('beforeCut')
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys })
|
|
|
|
|
},
|
|
|
|
|
afterCut: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
console.log('afterCut');
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys });
|
|
|
|
|
console.log('afterCut')
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys })
|
|
|
|
|
},
|
|
|
|
|
beforeDelete: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
console.log('beforeDelete');
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys });
|
|
|
|
|
console.log('beforeDelete')
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys })
|
|
|
|
|
},
|
|
|
|
|
afterDelete: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
console.log('afterDelete');
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys });
|
|
|
|
|
console.log('afterDelete')
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys })
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
clipboardChildOption:{
|
|
|
|
|
clipboardChildOption: {
|
|
|
|
|
copy: true,
|
|
|
|
|
paste: true,
|
|
|
|
|
cut: true,
|
|
|
|
|
delete: true,
|
|
|
|
|
beforeCopy: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
console.log('beforeCopy');
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys });
|
|
|
|
|
console.log('beforeCopy')
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys })
|
|
|
|
|
},
|
|
|
|
|
afterCopy: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
console.log('afterCopy');
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys });
|
|
|
|
|
console.log('afterCopy')
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys })
|
|
|
|
|
},
|
|
|
|
|
beforePaste: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
console.log('beforePaste');
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys });
|
|
|
|
|
console.log('beforePaste')
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys })
|
|
|
|
|
},
|
|
|
|
|
afterPaste: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
console.log('afterPaste');
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys });
|
|
|
|
|
console.log('afterPaste')
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys })
|
|
|
|
|
},
|
|
|
|
|
beforeCut: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
console.log('beforeCut');
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys });
|
|
|
|
|
console.log('beforeCut')
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys })
|
|
|
|
|
},
|
|
|
|
|
afterCut: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
console.log('afterCut');
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys });
|
|
|
|
|
console.log('afterCut')
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys })
|
|
|
|
|
},
|
|
|
|
|
beforeDelete: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
console.log('beforeDelete');
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys });
|
|
|
|
|
console.log('beforeDelete')
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys })
|
|
|
|
|
},
|
|
|
|
|
afterDelete: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
|
|
|
|
|
console.log('afterDelete');
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys });
|
|
|
|
|
console.log('afterDelete')
|
|
|
|
|
this.log({ data, selectionRangeIndexes, selectionRangeKeys })
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
tableLoaded: false,
|
|
|
|
@ -639,7 +636,7 @@ export default {
|
|
|
|
|
childTableData: [],
|
|
|
|
|
childModelSelect: null,
|
|
|
|
|
childModelSelectIndex: null,
|
|
|
|
|
selectChildArr: []
|
|
|
|
|
selectChildArr: [],
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
@ -648,7 +645,7 @@ export default {
|
|
|
|
|
// console.log('detail数据改变', nval)
|
|
|
|
|
this.$emit('changeDetail', {
|
|
|
|
|
detail: nval,
|
|
|
|
|
type: 'goodsTable'
|
|
|
|
|
type: 'goodsTable',
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
deep: true,
|
|
|
|
@ -659,7 +656,7 @@ export default {
|
|
|
|
|
// console.log('table数据改变', nval)
|
|
|
|
|
},
|
|
|
|
|
deep: true,
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
created() {
|
|
|
|
@ -667,19 +664,19 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
init () {
|
|
|
|
|
init() {
|
|
|
|
|
if (Object.keys(this.details).length > 0) {
|
|
|
|
|
const arr = []
|
|
|
|
|
const totalCtnall = {}
|
|
|
|
|
this.details.ctnInputs.map((item, index) => {
|
|
|
|
|
arr.push({
|
|
|
|
|
...{ rowKey: index },
|
|
|
|
|
...item
|
|
|
|
|
...item,
|
|
|
|
|
})
|
|
|
|
|
if (!Object.keys(totalCtnall).includes(item.ctnall)) {
|
|
|
|
|
const cData = {
|
|
|
|
|
type: 'ctnall',
|
|
|
|
|
num: item.ctnnum
|
|
|
|
|
num: item.ctnnum,
|
|
|
|
|
}
|
|
|
|
|
this.$set(totalCtnall, item.ctnall, cData)
|
|
|
|
|
}
|
|
|
|
@ -698,29 +695,29 @@ export default {
|
|
|
|
|
this.getCtn()
|
|
|
|
|
this.getPackage()
|
|
|
|
|
},
|
|
|
|
|
getCtn () {
|
|
|
|
|
getCtn() {
|
|
|
|
|
GetCtn({
|
|
|
|
|
Name: ''
|
|
|
|
|
})
|
|
|
|
|
.then((res) => {
|
|
|
|
|
this.ctnList = res.data
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
console.log(err)
|
|
|
|
|
Name: '',
|
|
|
|
|
})
|
|
|
|
|
.then((res) => {
|
|
|
|
|
this.ctnList = res.data
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
console.log(err)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
getPackage () {
|
|
|
|
|
getPackage() {
|
|
|
|
|
GetPackage({
|
|
|
|
|
Name: ''
|
|
|
|
|
})
|
|
|
|
|
.then((res) => {
|
|
|
|
|
this.packageList = res.data
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
console.log(err)
|
|
|
|
|
Name: '',
|
|
|
|
|
})
|
|
|
|
|
.then((res) => {
|
|
|
|
|
this.packageList = res.data
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
console.log(err)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
enmuErrorLabel (val) {
|
|
|
|
|
enmuErrorLabel(val) {
|
|
|
|
|
switch (val) {
|
|
|
|
|
case 'cntrno':
|
|
|
|
|
return '箱型'
|
|
|
|
@ -749,11 +746,11 @@ export default {
|
|
|
|
|
tareweight: '',
|
|
|
|
|
weightype: '',
|
|
|
|
|
weighkgs: '',
|
|
|
|
|
rowKey: this.tableData.length > 0 ? Number(this.tableData[this.tableData.length - 1].rowKey) + 1 : 0
|
|
|
|
|
rowKey: this.tableData.length > 0 ? Number(this.tableData[this.tableData.length - 1].rowKey) + 1 : 0,
|
|
|
|
|
}
|
|
|
|
|
this.tableData.push(data)
|
|
|
|
|
},
|
|
|
|
|
removeLine () {
|
|
|
|
|
removeLine() {
|
|
|
|
|
this.selectArr.map((item, index) => {
|
|
|
|
|
this.tableData.map((oitem, oindex) => {
|
|
|
|
|
if (item === oitem.rowKey) {
|
|
|
|
@ -769,9 +766,7 @@ export default {
|
|
|
|
|
this.moreVisible = true
|
|
|
|
|
},
|
|
|
|
|
// 多品名维护保存
|
|
|
|
|
handleModelSubmit() {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
handleModelSubmit() {},
|
|
|
|
|
handleModelCancel() {
|
|
|
|
|
this.moreVisible = false
|
|
|
|
|
},
|
|
|
|
@ -780,14 +775,15 @@ export default {
|
|
|
|
|
this.$message.error('请选择数据')
|
|
|
|
|
}
|
|
|
|
|
const data = {
|
|
|
|
|
rowKey: this.childTableData.length > 0 ? Number(this.childTableData[this.childTableData.length - 1].rowKey) + 1 : 0,
|
|
|
|
|
rowKey:
|
|
|
|
|
this.childTableData.length > 0 ? Number(this.childTableData[this.childTableData.length - 1].rowKey) + 1 : 0,
|
|
|
|
|
pkgs: '',
|
|
|
|
|
kindpkgs: '',
|
|
|
|
|
weighkgs: '',
|
|
|
|
|
cbm: '',
|
|
|
|
|
hscode: this.details.hscode,
|
|
|
|
|
marks: this.details.marks,
|
|
|
|
|
description: this.details.marks
|
|
|
|
|
description: this.details.marks,
|
|
|
|
|
}
|
|
|
|
|
this.childTableData.push(data)
|
|
|
|
|
},
|
|
|
|
@ -810,55 +806,180 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 引入场站数据
|
|
|
|
|
importYarn () {
|
|
|
|
|
importYarn() {
|
|
|
|
|
if (!this.id) {
|
|
|
|
|
this.$message.error('请先保存订舱信息')
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
GetYardData({
|
|
|
|
|
bookingId: this.id,
|
|
|
|
|
isWeb: false
|
|
|
|
|
})
|
|
|
|
|
.then((res) => {
|
|
|
|
|
if (res.success) {
|
|
|
|
|
const data = JSON.parse(res.data)
|
|
|
|
|
const addTable = []
|
|
|
|
|
const lastNum = this.tableData.length > 0 ? Number(this.tableData[this.tableData.length - 1].rowKey) + 1 : 0
|
|
|
|
|
data.map((item, index) => {
|
|
|
|
|
const _data = {
|
|
|
|
|
rowKey: lastNum + index,
|
|
|
|
|
ctnall: item.CTNALL,
|
|
|
|
|
ctnnum: '',
|
|
|
|
|
cntrno: item.CNTRNO,
|
|
|
|
|
sealno: item.SEALNO,
|
|
|
|
|
pkgs: item.PKGS,
|
|
|
|
|
kindpkgs: item.KINDPKGS,
|
|
|
|
|
kgs: item.KGS,
|
|
|
|
|
cbm: item.CBM,
|
|
|
|
|
tareweight: item.TAREWEIGHT,
|
|
|
|
|
weightype: '',
|
|
|
|
|
weighkgs: ''
|
|
|
|
|
}
|
|
|
|
|
addTable.push(_data)
|
|
|
|
|
})
|
|
|
|
|
this.tableData = [...this.tableData, ...addTable]
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
} else {
|
|
|
|
|
this.$message.error(res.message)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
console.log(err)
|
|
|
|
|
isWeb: false,
|
|
|
|
|
})
|
|
|
|
|
.then((res) => {
|
|
|
|
|
if (res.success) {
|
|
|
|
|
const data = JSON.parse(res.data)
|
|
|
|
|
const addTable = []
|
|
|
|
|
const lastNum = this.tableData.length > 0 ? Number(this.tableData[this.tableData.length - 1].rowKey) + 1 : 0
|
|
|
|
|
data.map((item, index) => {
|
|
|
|
|
const _data = {
|
|
|
|
|
rowKey: lastNum + index,
|
|
|
|
|
ctnall: item.CTNALL,
|
|
|
|
|
ctnnum: '',
|
|
|
|
|
cntrno: item.CNTRNO,
|
|
|
|
|
sealno: item.SEALNO,
|
|
|
|
|
pkgs: item.PKGS,
|
|
|
|
|
kindpkgs: item.KINDPKGS,
|
|
|
|
|
kgs: item.KGS,
|
|
|
|
|
cbm: item.CBM,
|
|
|
|
|
tareweight: item.TAREWEIGHT,
|
|
|
|
|
weightype: '',
|
|
|
|
|
weighkgs: '',
|
|
|
|
|
}
|
|
|
|
|
addTable.push(_data)
|
|
|
|
|
})
|
|
|
|
|
this.tableData = [...this.tableData, ...addTable]
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
} else {
|
|
|
|
|
this.$message.error(res.message)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
console.log(err)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
importWeight () {
|
|
|
|
|
|
|
|
|
|
importWeight() {
|
|
|
|
|
if (!this.id) {
|
|
|
|
|
this.$message.error('请先保存订舱信息')
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
GetYardData({
|
|
|
|
|
bookingId: this.id,
|
|
|
|
|
isWeb: false,
|
|
|
|
|
})
|
|
|
|
|
.then((res) => {
|
|
|
|
|
if (res.success) {
|
|
|
|
|
const data = JSON.parse(res.data)
|
|
|
|
|
const addTable = []
|
|
|
|
|
const lastNum = this.tableData.length > 0 ? Number(this.tableData[this.tableData.length - 1].rowKey) + 1 : 0
|
|
|
|
|
data.map((item, index) => {
|
|
|
|
|
const _data = {
|
|
|
|
|
rowKey: lastNum + index,
|
|
|
|
|
ctnall: '',
|
|
|
|
|
ctnnum: '',
|
|
|
|
|
cntrno: '',
|
|
|
|
|
sealno: '',
|
|
|
|
|
pkgs: '',
|
|
|
|
|
kindpkgs: '',
|
|
|
|
|
kgs: '',
|
|
|
|
|
cbm: '',
|
|
|
|
|
tareweight: item.TAREWEIGHT,
|
|
|
|
|
weightype: '',
|
|
|
|
|
weighkgs: ''
|
|
|
|
|
}
|
|
|
|
|
addTable.push(_data)
|
|
|
|
|
})
|
|
|
|
|
this.tableData = [...this.tableData, ...addTable]
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
} else {
|
|
|
|
|
this.$message.error(res.message)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
console.log(err)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
log({ data, selectionRangeIndexes, selectionRangeKeys }) {
|
|
|
|
|
console.log('data::', data);
|
|
|
|
|
console.log('selectionRangeIndexes::', selectionRangeIndexes);
|
|
|
|
|
console.log('selectionRangeKeys::', selectionRangeKeys);
|
|
|
|
|
console.log('data::', data)
|
|
|
|
|
console.log('selectionRangeIndexes::', selectionRangeIndexes)
|
|
|
|
|
console.log('selectionRangeKeys::', selectionRangeKeys)
|
|
|
|
|
},
|
|
|
|
|
calc(num1, num2, calcStr) {
|
|
|
|
|
var str1, // 转换为字符串的数字
|
|
|
|
|
str2,
|
|
|
|
|
ws1 = 0, // ws1,ws2 用来存储传入的num的小数点后的数字的位数
|
|
|
|
|
ws2 = 0, // 赋默认值,解决当整数和小数运算时倍数计算错误导致的结果误差
|
|
|
|
|
bigger, // bigger和smaller用于加,减,除法找出小的那个数字,给后面补0,解决位数不对从而造成的计算错误的问题;乘法需要将结果除两个数字的倍数之和
|
|
|
|
|
smaller, // 例如:加减除法中1.001 + 2.03 ,如果不给2.03进行补0,最后会变成1001+203,数字错位导致结果错误;乘法中1.12*1.1会放大为112*11,所以结果需要除以1000才会是正确的结果,112*11/1000=1.232
|
|
|
|
|
zeroCount, // 需要补充0的个数
|
|
|
|
|
isExistDot1, // 传入的数字是否存在小数点
|
|
|
|
|
isExistDot2,
|
|
|
|
|
sum,
|
|
|
|
|
beishu = 1
|
|
|
|
|
// 将数字转换为字符串
|
|
|
|
|
str1 = num1.toString()
|
|
|
|
|
str2 = num2.toString()
|
|
|
|
|
// 是否存在小数点(判断需要计算的数字是不是包含小数)
|
|
|
|
|
isExistDot1 = str1.indexOf('.') != -1 ? true : false
|
|
|
|
|
isExistDot2 = str2.indexOf('.') != -1 ? true : false
|
|
|
|
|
// 取小数点后面的位数
|
|
|
|
|
if (isExistDot1) {
|
|
|
|
|
ws1 = str1.split('.')[1].length
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isExistDot2) {
|
|
|
|
|
ws2 = str2.split('.')[1].length
|
|
|
|
|
}
|
|
|
|
|
// 如ws1 和 ws2 无默认值,如果num1 或 num2 不是小数的话则 ws1 或 ws2 的值将为 undefined
|
|
|
|
|
// bigger 和 smaller 的值会和预期不符
|
|
|
|
|
bigger = ws1 > ws2 ? ws1 : ws2
|
|
|
|
|
smaller = ws1 < ws2 ? ws1 : ws2
|
|
|
|
|
|
|
|
|
|
switch (calcStr) {
|
|
|
|
|
// 加减法找出小的那个数字,给后面补0,解决位数不对从而造成的计算错误的问题
|
|
|
|
|
// 例如:1.001 + 2.03 ,如果不给2.03进行补0,最后会变成1001+203,数字错位导致结果错误
|
|
|
|
|
case '+':
|
|
|
|
|
case '-':
|
|
|
|
|
case '/':
|
|
|
|
|
zeroCount = bigger - smaller
|
|
|
|
|
for (var i = 0; i < zeroCount; i++) {
|
|
|
|
|
if (ws1 == smaller) {
|
|
|
|
|
str1 += '0'
|
|
|
|
|
} else {
|
|
|
|
|
str2 += '0'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
case '*':
|
|
|
|
|
// 乘法需要将结果除两个数字的倍数之和
|
|
|
|
|
bigger = bigger + smaller
|
|
|
|
|
break
|
|
|
|
|
default:
|
|
|
|
|
return '暂不支持的计算类型,现已支持的有加法、减法、乘法、除法'
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 去除数字中的小数点
|
|
|
|
|
str1 = str1.replace('.', '')
|
|
|
|
|
str2 = str2.replace('.', '')
|
|
|
|
|
|
|
|
|
|
// 计算倍数,例如:1.001小数点后有三位,则需要乘 1000 变成 1001,变成整数后精度丢失问题则不会存在
|
|
|
|
|
for (var i = 0; i < bigger; i++) {
|
|
|
|
|
beishu *= 10 // 等价于beishu = beishu * 10;
|
|
|
|
|
}
|
|
|
|
|
num1 = parseInt(str1)
|
|
|
|
|
num2 = parseInt(str2)
|
|
|
|
|
// 进行最终计算并除相应倍数
|
|
|
|
|
switch (calcStr) {
|
|
|
|
|
case '+':
|
|
|
|
|
sum = (num1 + num2) / beishu
|
|
|
|
|
break
|
|
|
|
|
case '-':
|
|
|
|
|
sum = (num1 - num2) / beishu
|
|
|
|
|
break
|
|
|
|
|
case '*':
|
|
|
|
|
sum = (num1 * num2) / beishu
|
|
|
|
|
break
|
|
|
|
|
case '/':
|
|
|
|
|
sum = num1 / num2
|
|
|
|
|
/* 除数与被除数同时放大一定倍数,不影响结果,
|
|
|
|
|
所以对数字进行放大对应倍数并进行补0操作后不用另对倍数做处理 */
|
|
|
|
|
break
|
|
|
|
|
default:
|
|
|
|
|
return '暂不支持的计算类型,现已支持的有加法、减法、乘法、除法'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return sum
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
@ -885,15 +1006,15 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.model-content{
|
|
|
|
|
.model-botton-box{
|
|
|
|
|
.model-content {
|
|
|
|
|
.model-botton-box {
|
|
|
|
|
margin: 40px 0;
|
|
|
|
|
.btn{
|
|
|
|
|
.btn {
|
|
|
|
|
margin-right: 10px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.table-no-data{
|
|
|
|
|
.table-no-data {
|
|
|
|
|
width: 100%;
|
|
|
|
|
text-align: center;
|
|
|
|
|
line-height: 60px;
|
|
|
|
|