|
|
|
@ -21,6 +21,8 @@
|
|
|
|
|
:columns="columns"
|
|
|
|
|
:table-data="tableData"
|
|
|
|
|
borderY
|
|
|
|
|
ref="tableRef"
|
|
|
|
|
style="min-width:970;"
|
|
|
|
|
:cell-autofill-option="cellAutofillOption"
|
|
|
|
|
:editOption="editOption"
|
|
|
|
|
rowKeyFieldName="rowKey"
|
|
|
|
@ -119,47 +121,59 @@ export default {
|
|
|
|
|
edit: false,
|
|
|
|
|
renderBodyCell: ({ row, column, rowIndex }, h) => {
|
|
|
|
|
return (
|
|
|
|
|
// <a-auto-complete
|
|
|
|
|
// class="certain-category-search"
|
|
|
|
|
// dropdown-class-name="certain-category-search-dropdown"
|
|
|
|
|
// dropdown-match-select-width={false}
|
|
|
|
|
// size="large"
|
|
|
|
|
// style="width: 120px"
|
|
|
|
|
// option-label-prop="value"
|
|
|
|
|
// >
|
|
|
|
|
// {
|
|
|
|
|
// <template slot="dataSource">
|
|
|
|
|
// <a-select-opt-group>
|
|
|
|
|
// {
|
|
|
|
|
// this.ctnList.map((item, index) => {
|
|
|
|
|
// return <a-select-option>{ item.name }</a-select-option>
|
|
|
|
|
// })
|
|
|
|
|
// }
|
|
|
|
|
// </a-select-opt-group>
|
|
|
|
|
// </template>
|
|
|
|
|
// }
|
|
|
|
|
// {
|
|
|
|
|
// <a-input>
|
|
|
|
|
// <a-icon slot="suffix" type="search" class="certain-category-icon" />
|
|
|
|
|
// </a-input>
|
|
|
|
|
// }
|
|
|
|
|
// </a-auto-complete>
|
|
|
|
|
<a-select
|
|
|
|
|
value={row['ctnall']}
|
|
|
|
|
showSearch
|
|
|
|
|
ref="ctnallView"
|
|
|
|
|
class="ctnallView"
|
|
|
|
|
allow-clear={true}
|
|
|
|
|
style="width: 120px"
|
|
|
|
|
style="width: 90px"
|
|
|
|
|
on-change={val => {
|
|
|
|
|
console.log(' change - 修改内容', val)
|
|
|
|
|
if (val) {
|
|
|
|
|
const data = this.ctnList[val]
|
|
|
|
|
this.tableData[rowIndex].ctnall = data.name
|
|
|
|
|
this.tableData[rowIndex].ctncode = data.code
|
|
|
|
|
row['ctnall'] = data.name
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
} else {
|
|
|
|
|
row['ctnall'] = ''
|
|
|
|
|
this.tableData[rowIndex].ctnall = ''
|
|
|
|
|
this.tableData[rowIndex].ctncode = ''
|
|
|
|
|
}
|
|
|
|
|
}}
|
|
|
|
|
on-focus={val => {
|
|
|
|
|
this.ctnallViewIndex = rowIndex
|
|
|
|
|
console.log('=获取焦点=', rowIndex, this.ctnallViewIndex)
|
|
|
|
|
}}
|
|
|
|
|
on-blur={val => {
|
|
|
|
|
this.ctnallViewIndex = null
|
|
|
|
|
console.log('=失去焦点=', rowIndex, this.ctnallViewIndex, val)
|
|
|
|
|
}}
|
|
|
|
|
on-input={val => {
|
|
|
|
|
console.log('== input - 修改内容==', val)
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{this.ctnList.map((item, index) => {
|
|
|
|
|
return <a-select-option value={index}>{item.name}</a-select-option>
|
|
|
|
|
})}
|
|
|
|
|
</a-select>
|
|
|
|
|
// <div class="ctnallView">
|
|
|
|
|
// <input type="text"
|
|
|
|
|
// v-model={row['ctnall']}
|
|
|
|
|
// on-focus={val => {
|
|
|
|
|
// this.ctnallViewIndex = rowIndex
|
|
|
|
|
// console.log('=获取焦点=', rowIndex, this.ctnallViewIndex)
|
|
|
|
|
// }}
|
|
|
|
|
// on-blur={val => {
|
|
|
|
|
// this.ctnallViewIndex = null
|
|
|
|
|
// console.log('=失去焦点=', rowIndex, this.ctnallViewIndex)
|
|
|
|
|
// }}
|
|
|
|
|
// on-input={val => {
|
|
|
|
|
// console.log('修改内容', val)
|
|
|
|
|
// }}
|
|
|
|
|
// />
|
|
|
|
|
// </div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
@ -168,6 +182,7 @@ export default {
|
|
|
|
|
key: 'ctnnum ',
|
|
|
|
|
title: '箱量',
|
|
|
|
|
align: 'left',
|
|
|
|
|
width: 60,
|
|
|
|
|
edit: true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
@ -175,6 +190,7 @@ export default {
|
|
|
|
|
key: 'cntrno',
|
|
|
|
|
title: '箱号',
|
|
|
|
|
align: 'left',
|
|
|
|
|
width: 180,
|
|
|
|
|
edit: true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
@ -202,14 +218,46 @@ export default {
|
|
|
|
|
return (
|
|
|
|
|
<a-select
|
|
|
|
|
allow-clear={true}
|
|
|
|
|
showSearch
|
|
|
|
|
defaultValue={row['kindpkgs']}
|
|
|
|
|
option-filter-prop="children"
|
|
|
|
|
style="width: 120px"
|
|
|
|
|
class="kindpkgsView"
|
|
|
|
|
on-change={val => {
|
|
|
|
|
console.log('包装修改:', this.packageList[val])
|
|
|
|
|
if (val) {
|
|
|
|
|
const data = this.packageList[val]
|
|
|
|
|
this.tableData[rowIndex].kindpkgs = data.name
|
|
|
|
|
row['kindpkgs'] = data.name
|
|
|
|
|
this.tableData.map((item, index) => {
|
|
|
|
|
item.kindpkgs = this.packageList[val].name || ''
|
|
|
|
|
if (document.getElementsByClassName('kindpkgsView')[index].getElementsByClassName('ant-select-selection-selected-value')[0]) {
|
|
|
|
|
document.getElementsByClassName('kindpkgsView')[index].getElementsByClassName('ant-select-selection-selected-value')[0].innerHTML = this.packageList[val].name || ''
|
|
|
|
|
} else {
|
|
|
|
|
document.getElementsByClassName('kindpkgsView')[index].getElementsByTagName('input')[0].val = this.packageList[val].name || ''
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
} else {
|
|
|
|
|
row['kindpkgs'] = ''
|
|
|
|
|
this.tableData[rowIndex].kindpkgs = ''
|
|
|
|
|
this.tableData.map((item, index) => {
|
|
|
|
|
item.kindpkgs = ''
|
|
|
|
|
document.getElementsByClassName('kindpkgsView')[index].getElementsByClassName('ant-select-selection-selected-value')[0].innerHTML = ''
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
console.log(this.tableData)
|
|
|
|
|
}}
|
|
|
|
|
on-focus={val => {
|
|
|
|
|
this.kindpkgsViewIndex = rowIndex
|
|
|
|
|
console.log('=获取焦点=', rowIndex, this.kindpkgsViewIndex)
|
|
|
|
|
}}
|
|
|
|
|
on-blur={val => {
|
|
|
|
|
this.kindpkgsViewIndex = null
|
|
|
|
|
console.log('=失去焦点=', rowIndex, this.kindpkgsViewIndex)
|
|
|
|
|
}}
|
|
|
|
|
on-input={val => {
|
|
|
|
|
console.log('== input - 修改内容==', val)
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{this.packageList.map((item, index) => {
|
|
|
|
@ -305,7 +353,8 @@ export default {
|
|
|
|
|
field: 'cntrno',
|
|
|
|
|
key: 'cntrno',
|
|
|
|
|
title: '箱号',
|
|
|
|
|
align: 'left'
|
|
|
|
|
align: 'left',
|
|
|
|
|
width: 240
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'sealno',
|
|
|
|
@ -532,6 +581,8 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
cellValueChange: ({ row, column }) => {
|
|
|
|
|
console.log('cellValueChange row::', row);
|
|
|
|
|
console.log('cellValueChange column::', column);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
editChildOption: {
|
|
|
|
@ -722,7 +773,9 @@ export default {
|
|
|
|
|
childModelSelectIndex: null,
|
|
|
|
|
selectChildArr: [],
|
|
|
|
|
YarnLoading: false,
|
|
|
|
|
WeightLoading: false
|
|
|
|
|
WeightLoading: false,
|
|
|
|
|
ctnallViewIndex: null,
|
|
|
|
|
kindpkgsViewIndex: null
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
@ -770,9 +823,35 @@ export default {
|
|
|
|
|
|
|
|
|
|
created() {
|
|
|
|
|
this.init()
|
|
|
|
|
document.onkeydown = (event) => {
|
|
|
|
|
console.log("按下:"+event.key+"键:"+event.keyCode, document.activeElement);
|
|
|
|
|
console.log(document.activeElement);
|
|
|
|
|
if (event.key === 'Backspace' && this.ctnallViewIndex !== null) {
|
|
|
|
|
const val = document.getElementsByClassName('ctnallView')[this.ctnallViewIndex].getElementsByTagName('input')[0].value
|
|
|
|
|
console.log('内容', val, this.ctnList)
|
|
|
|
|
document.getElementsByClassName('ctnallView')[this.ctnallViewIndex].getElementsByTagName('input')[0].value = val.substr(0, val.length - 1)
|
|
|
|
|
// this.tableData[this.ctnallViewIndex].ctnall = val.substr(0, val.length - 1)
|
|
|
|
|
}
|
|
|
|
|
if (event.key === 'Backspace' && this.kindpkgsViewIndex !== null) {
|
|
|
|
|
const val = document.getElementsByClassName('kindpkgsView')[this.kindpkgsViewIndex].getElementsByTagName('input')[0].value
|
|
|
|
|
console.log('内容', val, this.ctnList)
|
|
|
|
|
document.getElementsByClassName('kindpkgsView')[this.kindpkgsViewIndex].getElementsByTagName('input')[0].value = val.substr(0, val.length - 1)
|
|
|
|
|
// this.tableData[this.ctnallViewIndex].ctnall = val.substr(0, val.length - 1)
|
|
|
|
|
}
|
|
|
|
|
if (event.key === 'Tab') {
|
|
|
|
|
const activeDom = document.activeElement
|
|
|
|
|
if (activeDom.dataset['next'] === 'box-ctnall') {
|
|
|
|
|
this.startEditingCell('0', 'ctnall')
|
|
|
|
|
}
|
|
|
|
|
console.log(this.ctnallViewIndex)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
startEditingCell(rowKey, colKey, defaultValue) {
|
|
|
|
|
this.$refs['tableRef'].startEditingCell({ rowKey, colKey, defaultValue });
|
|
|
|
|
},
|
|
|
|
|
init() {
|
|
|
|
|
if (Object.keys(this.details).length > 0) {
|
|
|
|
|
const arr = []
|
|
|
|
@ -853,7 +932,7 @@ export default {
|
|
|
|
|
kgs: '',
|
|
|
|
|
cbm: '',
|
|
|
|
|
tareweight: '',
|
|
|
|
|
weightype: '',
|
|
|
|
|
weightype: '累加',
|
|
|
|
|
weighkgs: '',
|
|
|
|
|
rowKey: this.tableData.length > 0 ? Number(this.tableData[this.tableData.length - 1].rowKey) + 1 : 0
|
|
|
|
|
}
|
|
|
|
@ -1047,8 +1126,34 @@ export default {
|
|
|
|
|
if (res.success) {
|
|
|
|
|
const data = JSON.parse(res.data)
|
|
|
|
|
const addTable = []
|
|
|
|
|
const cntrnoArr = []
|
|
|
|
|
this.tableData.map((item, index) => {
|
|
|
|
|
if (!item.cntrno) {
|
|
|
|
|
// delete this.tableData[index]
|
|
|
|
|
this.tableData.splice(index, 1)
|
|
|
|
|
} else {
|
|
|
|
|
cntrnoArr.push(item.cntrno)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
const lastNum = this.tableData.length > 0 ? Number(this.tableData[this.tableData.length - 1].rowKey) + 1 : 0
|
|
|
|
|
data.map((item, index) => {
|
|
|
|
|
if (cntrnoArr.includes(item.CNTRNO)) {
|
|
|
|
|
const setWeighkgs = this.calc(Number(this.tableData[cntrnoArr.indexOf(item.CNTRNO)].kgs), Number(item.TAREWEIGHT), '+')
|
|
|
|
|
this.tableData[cntrnoArr.indexOf(item.CNTRNO)] = {
|
|
|
|
|
rowKey: this.tableData[cntrnoArr.indexOf(item.CNTRNO)].rowKey,
|
|
|
|
|
ctnall: this.tableData[cntrnoArr.indexOf(item.CNTRNO)].ctnall,
|
|
|
|
|
ctnnum: this.tableData[cntrnoArr.indexOf(item.CNTRNO)].ctnnum,
|
|
|
|
|
cntrno: this.tableData[cntrnoArr.indexOf(item.CNTRNO)].cntrno,
|
|
|
|
|
sealno: this.tableData[cntrnoArr.indexOf(item.CNTRNO)].sealno,
|
|
|
|
|
pkgs: this.tableData[cntrnoArr.indexOf(item.CNTRNO)].pkgs,
|
|
|
|
|
kindpkgs: this.tableData[cntrnoArr.indexOf(item.CNTRNO)].kindpkgs,
|
|
|
|
|
kgs: this.tableData[cntrnoArr.indexOf(item.CNTRNO)].kgs,
|
|
|
|
|
cbm: this.tableData[cntrnoArr.indexOf(item.CNTRNO)].cbm,
|
|
|
|
|
tareweight: item.TAREWEIGHT,
|
|
|
|
|
weightype: this.tableData[cntrnoArr.indexOf(item.CNTRNO)].weightype,
|
|
|
|
|
weighkgs: setWeighkgs
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
const _data = {
|
|
|
|
|
rowKey: lastNum + index,
|
|
|
|
|
ctnall: '',
|
|
|
|
@ -1064,6 +1169,7 @@ export default {
|
|
|
|
|
weighkgs: ''
|
|
|
|
|
}
|
|
|
|
|
addTable.push(_data)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.tableData = [...this.tableData, ...addTable]
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|