|
|
|
@ -5,11 +5,14 @@
|
|
|
|
|
<div class="left">
|
|
|
|
|
<a-button class="btn btn-add" type="primary" @click="addboxLine">添加</a-button>
|
|
|
|
|
<a-button class="btn btn-delete" @click="removeLine" :style="{ marginRight: '50px' }">删除</a-button>
|
|
|
|
|
<a-button class="btn btn-more-name" type="primary" @click="openDialog" :disabled="tableData.length === 0"><a-icon type="appstore" />多品名
|
|
|
|
|
<a-button class="btn btn-more-name" type="primary" @click="openDialog" :disabled="tableData.length === 0"
|
|
|
|
|
><a-icon type="appstore" />多品名
|
|
|
|
|
</a-button>
|
|
|
|
|
<a-button class="btn btn-import-station" type="primary" @click="importYarn" :loading="YarnLoading"><a-icon type="import" />引入场站数据</a-button
|
|
|
|
|
<a-button class="btn btn-import-station" type="primary" @click="importYarn" :loading="YarnLoading"
|
|
|
|
|
><a-icon type="import" />引入场站数据</a-button
|
|
|
|
|
>
|
|
|
|
|
<a-button class="btn btn-weight" type="primary" @click="importWeight" :loading="WeightLoading"><a-icon type="import" />引入箱皮重</a-button
|
|
|
|
|
<a-button class="btn btn-weight" type="primary" @click="importWeight" :loading="WeightLoading"
|
|
|
|
|
><a-icon type="import" />引入箱皮重</a-button
|
|
|
|
|
>
|
|
|
|
|
<a-button class="btn btn-weight" type="primary" @click="arrowsWeight">
|
|
|
|
|
<a-icon type="arrows-alt" />展开箱量
|
|
|
|
@ -171,7 +174,7 @@ export default {
|
|
|
|
|
class="ctnallView"
|
|
|
|
|
allow-clear={true}
|
|
|
|
|
style="width: 90px"
|
|
|
|
|
filter-option={ this.filterOption }
|
|
|
|
|
filter-option={this.filterOption}
|
|
|
|
|
on-change={val => {
|
|
|
|
|
// console.log('== 箱型内部监听change ==')
|
|
|
|
|
if (val !== undefined) {
|
|
|
|
@ -294,7 +297,7 @@ export default {
|
|
|
|
|
showSearch
|
|
|
|
|
defaultValue={row['kindpkgs']}
|
|
|
|
|
option-filter-prop="children"
|
|
|
|
|
filter-option={ this.filterOption }
|
|
|
|
|
filter-option={this.filterOption}
|
|
|
|
|
style="width: 120px"
|
|
|
|
|
class="kindpkgsView"
|
|
|
|
|
on-change={val => {
|
|
|
|
@ -309,10 +312,12 @@ export default {
|
|
|
|
|
// console.log('== 设置其他箱 - 包装 ==', index, item.kindpkgs)
|
|
|
|
|
if (
|
|
|
|
|
document
|
|
|
|
|
.getElementsByClassName('kindpkgsView')[index].getElementsByClassName('ant-select-selection-selected-value')[0]
|
|
|
|
|
.getElementsByClassName('kindpkgsView')
|
|
|
|
|
[index].getElementsByClassName('ant-select-selection-selected-value')[0]
|
|
|
|
|
) {
|
|
|
|
|
document
|
|
|
|
|
.getElementsByClassName('kindpkgsView')[index].getElementsByClassName('ant-select-selection-selected-value')[0].innerHTML =
|
|
|
|
|
.getElementsByClassName('kindpkgsView')
|
|
|
|
|
[index].getElementsByClassName('ant-select-selection-selected-value')[0].innerHTML =
|
|
|
|
|
this.packageList[val].name || ''
|
|
|
|
|
} else {
|
|
|
|
|
document.getElementsByClassName('kindpkgsView')[index].getElementsByTagName('input')[0].val =
|
|
|
|
@ -328,7 +333,8 @@ export default {
|
|
|
|
|
if (index !== rowIndex) {
|
|
|
|
|
item.kindpkgs = ''
|
|
|
|
|
document
|
|
|
|
|
.getElementsByClassName('kindpkgsView')[index].getElementsByClassName('ant-select-selection-selected-value')[0].innerHTML = ''
|
|
|
|
|
.getElementsByClassName('kindpkgsView')
|
|
|
|
|
[index].getElementsByClassName('ant-select-selection-selected-value')[0].innerHTML = ''
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
@ -481,11 +487,14 @@ export default {
|
|
|
|
|
edit: false,
|
|
|
|
|
renderBodyCell: ({ row, column, rowIndex }, h) => {
|
|
|
|
|
return (
|
|
|
|
|
<a-date-picker value={row['weighdate']} on-change={(date, dateString) => {
|
|
|
|
|
// console.log('== 选择日期 ==', dateString)
|
|
|
|
|
this.tableData[rowIndex].weighdate = dateString
|
|
|
|
|
row['weighdate'] = dateString
|
|
|
|
|
}} />
|
|
|
|
|
<a-date-picker
|
|
|
|
|
value={row['weighdate']}
|
|
|
|
|
on-change={(date, dateString) => {
|
|
|
|
|
// console.log('== 选择日期 ==', dateString)
|
|
|
|
|
this.tableData[rowIndex].weighdate = dateString
|
|
|
|
|
row['weighdate'] = dateString
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
)
|
|
|
|
|
},
|
|
|
|
|
renderHeaderCell: ({ column }, h) => {
|
|
|
|
@ -495,7 +504,7 @@ export default {
|
|
|
|
|
</span>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
modelColumns: [
|
|
|
|
|
{
|
|
|
|
@ -644,7 +653,9 @@ export default {
|
|
|
|
|
tableData: [],
|
|
|
|
|
editOption: {
|
|
|
|
|
beforeCellValueChange: ({ row, column, changeValue }) => {
|
|
|
|
|
if (this.inTableLoad) { return false }
|
|
|
|
|
if (this.inTableLoad) {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
if (
|
|
|
|
|
['pkgs', 'kgs', 'cbm', 'tareweight'].includes(column.field) &&
|
|
|
|
|
!new RegExp(/^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+)$/).test(changeValue)
|
|
|
|
@ -689,7 +700,9 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
afterCellValueChange: ({ row, column, changeValue }) => {
|
|
|
|
|
if (this.inTableLoad) { return false }
|
|
|
|
|
if (this.inTableLoad) {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
if (['kgs', 'cbm', 'tareweight', 'weighkgs'].includes(column.field)) {
|
|
|
|
|
changeValue = changeValue + ''
|
|
|
|
|
const valIndex = changeValue.includes('.') ? changeValue.indexOf('.') + 1 : false
|
|
|
|
@ -811,8 +824,7 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
cellValueChange: ({ row, column }) => {
|
|
|
|
|
}
|
|
|
|
|
cellValueChange: ({ row, column }) => {}
|
|
|
|
|
},
|
|
|
|
|
editChildOption: {
|
|
|
|
|
beforeCellValueChange: ({ row, column, changeValue }) => {
|
|
|
|
@ -1049,19 +1061,20 @@ export default {
|
|
|
|
|
val: this.totalCbm
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
openEdit (nval, oval) {
|
|
|
|
|
openEdit(nval, oval) {
|
|
|
|
|
// 箱信息 下拉框自动弹出部分 - 测试中
|
|
|
|
|
if (nval) {
|
|
|
|
|
const editDom = document.getElementsByClassName('ve-table-edit-input')[0]
|
|
|
|
|
// console.log('窗扣生成', editDom)
|
|
|
|
|
editDom.addEventListener('focus', (e) => {
|
|
|
|
|
editDom.addEventListener('focus', e => {
|
|
|
|
|
// console.log('== 当前是否允许编辑 ==', this.cellSelectionOption.enable)
|
|
|
|
|
// if (!this.cellSelectionOption.enable) { return false }
|
|
|
|
|
document.onkeydown = event => {
|
|
|
|
|
// 临时功能 - start
|
|
|
|
|
if (event.key === 'Backspace' && this.ctnallViewIndex !== null) {
|
|
|
|
|
const val = document.getElementsByClassName('ctnallView')[this.ctnallViewIndex].getElementsByTagName('input')[0]
|
|
|
|
|
.value
|
|
|
|
|
const val = document
|
|
|
|
|
.getElementsByClassName('ctnallView')
|
|
|
|
|
[this.ctnallViewIndex].getElementsByTagName('input')[0].value
|
|
|
|
|
document
|
|
|
|
|
.getElementsByClassName('ctnallView')
|
|
|
|
|
[this.ctnallViewIndex].getElementsByTagName('input')[0].value = val.substr(0, val.length - 1)
|
|
|
|
@ -1076,8 +1089,12 @@ export default {
|
|
|
|
|
[this.kindpkgsViewIndex].getElementsByTagName('input')[0].value = val.substr(0, val.length - 1)
|
|
|
|
|
// this.tableData[this.ctnallViewIndex].ctnall = val.substr(0, val.length - 1)
|
|
|
|
|
}
|
|
|
|
|
// 临时功能 - end
|
|
|
|
|
console.log('按下:' + event.key + '键:' + event.keyCode, '== 当前是否允许编辑 ==', this.cellSelectionOption.enable);
|
|
|
|
|
// 临时功能 - end
|
|
|
|
|
console.log(
|
|
|
|
|
'按下:' + event.key + '键:' + event.keyCode,
|
|
|
|
|
'== 当前是否允许编辑 ==',
|
|
|
|
|
this.cellSelectionOption.enable
|
|
|
|
|
)
|
|
|
|
|
// console.log('按下:' + event.key + '键:' + event.keyCode, document.activeElement);
|
|
|
|
|
// if ([37, 38, 39, 40, 9].includes(event.keyCode)) {
|
|
|
|
|
// event = window.event || event;
|
|
|
|
@ -1131,10 +1148,10 @@ export default {
|
|
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
isDOM(item) {
|
|
|
|
|
// 首先判断是否支持HTMLELement,如果支持,使用HTMLElement,如果不支持,通过判断DOM的特征,如果拥有这些特征说明就是ODM节点,特征使用的越多越准确
|
|
|
|
|
return (typeof HTMLElement === 'function')
|
|
|
|
|
? (item instanceof HTMLElement)
|
|
|
|
|
: (item && (typeof item === 'object') && (item.nodeType === 1) && (typeof item.nodeName === 'string'));
|
|
|
|
|
// 首先判断是否支持HTMLELement,如果支持,使用HTMLElement,如果不支持,通过判断DOM的特征,如果拥有这些特征说明就是ODM节点,特征使用的越多越准确
|
|
|
|
|
return typeof HTMLElement === 'function'
|
|
|
|
|
? item instanceof HTMLElement
|
|
|
|
|
: item && typeof item === 'object' && item.nodeType === 1 && typeof item.nodeName === 'string'
|
|
|
|
|
},
|
|
|
|
|
// 给可控属性重新赋值
|
|
|
|
|
changeSelectedRowKeys(keys) {
|
|
|
|
@ -1145,7 +1162,7 @@ export default {
|
|
|
|
|
this.$refs['tableRef'].startEditingCell({ rowKey, colKey, defaultValue })
|
|
|
|
|
},
|
|
|
|
|
setCellSelection(rowKey, colKey) {
|
|
|
|
|
this.$refs['tableRef'].setCellSelection({ rowKey, colKey });
|
|
|
|
|
this.$refs['tableRef'].setCellSelection({ rowKey, colKey })
|
|
|
|
|
},
|
|
|
|
|
init() {
|
|
|
|
|
this.inTableLoad = true
|
|
|
|
@ -1211,9 +1228,7 @@ export default {
|
|
|
|
|
}, 1200)
|
|
|
|
|
},
|
|
|
|
|
filterOption(input, option) {
|
|
|
|
|
return (
|
|
|
|
|
option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
|
|
|
);
|
|
|
|
|
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
|
|
|
},
|
|
|
|
|
enmuErrorLabel(val) {
|
|
|
|
|
switch (val) {
|
|
|
|
@ -1276,6 +1291,9 @@ export default {
|
|
|
|
|
this.totalPkgs = pkgs
|
|
|
|
|
this.checkboxOption.selectedRowKeys = []
|
|
|
|
|
this.selectArr = []
|
|
|
|
|
this.tableData.forEach((item, index) => {
|
|
|
|
|
item.rowKey = index
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
developboxLine() {
|
|
|
|
|
const arr = []
|
|
|
|
@ -1496,6 +1514,7 @@ export default {
|
|
|
|
|
this.$message.error('请选择一条数据')
|
|
|
|
|
} else {
|
|
|
|
|
console.log(this.tableData, this.selectArr[0])
|
|
|
|
|
console.log(this.tableData[this.selectArr[0]])
|
|
|
|
|
if (this.tableData[this.selectArr[0]].ctnnum > 1) {
|
|
|
|
|
console.log(
|
|
|
|
|
parseFloat(this.tableData[this.selectArr[0]].ctnnum),
|
|
|
|
|