From 1879f2aa1a1e3930d495d3e79eb75bc3bc1fa0c8 Mon Sep 17 00:00:00 2001 From: lilu Date: Tue, 3 Jan 2023 11:50:41 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=B1=E4=BF=A1=E6=81=AF=20-=20=E5=8C=85?= =?UTF-8?q?=E8=A3=85=E3=80=81=E7=AE=B1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../detail/modules/goodsTable.vue | 140 ++++++++++++++---- .../detail/modules/operationArea.vue | 2 +- .../detail/modules/remarksInfo.vue | 2 +- 3 files changed, 110 insertions(+), 34 deletions(-) diff --git a/src/views/main/BookingLedger/detail/modules/goodsTable.vue b/src/views/main/BookingLedger/detail/modules/goodsTable.vue index ce6a90c..e528f17 100644 --- a/src/views/main/BookingLedger/detail/modules/goodsTable.vue +++ b/src/views/main/BookingLedger/detail/modules/goodsTable.vue @@ -21,6 +21,7 @@ :columns="columns" :table-data="tableData" borderY + ref="tableRef" style="min-width:970;" :cell-autofill-option="cellAutofillOption" :editOption="editOption" @@ -120,45 +121,59 @@ export default { edit: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return ( - // - // { - // - // } - // { - // - // - // - // } - // { - const data = this.ctnList[val] - this.tableData[rowIndex].ctnall = data.name - this.tableData[rowIndex].ctncode = data.code - row['ctnall'] = data.name - this.$forceUpdate() + 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 {item.name} })} + //
+ // { + // 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) + // }} + // /> + //
) } }, @@ -207,11 +222,42 @@ export default { defaultValue={row['kindpkgs']} option-filter-prop="children" style="width: 120px" + class="kindpkgsView" on-change={val => { - const data = this.packageList[val] - this.tableData[rowIndex].kindpkgs = data.name - row['kindpkgs'] = data.name - this.$forceUpdate() + 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) => { @@ -535,6 +581,8 @@ export default { } }, cellValueChange: ({ row, column }) => { + console.log('cellValueChange row::', row); + console.log('cellValueChange column::', column); } }, editChildOption: { @@ -725,7 +773,9 @@ export default { childModelSelectIndex: null, selectChildArr: [], YarnLoading: false, - WeightLoading: false + WeightLoading: false, + ctnallViewIndex: null, + kindpkgsViewIndex: null } }, watch: { @@ -773,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 = [] diff --git a/src/views/main/BookingLedger/detail/modules/operationArea.vue b/src/views/main/BookingLedger/detail/modules/operationArea.vue index 23733c1..55d22ed 100644 --- a/src/views/main/BookingLedger/detail/modules/operationArea.vue +++ b/src/views/main/BookingLedger/detail/modules/operationArea.vue @@ -65,7 +65,7 @@ :style="{ width: '150px' }" > - + diff --git a/src/views/main/BookingLedger/detail/modules/remarksInfo.vue b/src/views/main/BookingLedger/detail/modules/remarksInfo.vue index 91b1ba2..74769c4 100644 --- a/src/views/main/BookingLedger/detail/modules/remarksInfo.vue +++ b/src/views/main/BookingLedger/detail/modules/remarksInfo.vue @@ -7,7 +7,7 @@
截单备注
- +