给单据增加回车事件

This commit is contained in:
季圣华
2021-11-02 01:20:30 +08:00
parent e6b2b1ecf7
commit 1e0d137739
16 changed files with 84 additions and 32 deletions

View File

@@ -1429,6 +1429,9 @@
this.$nextTick(() => { this.$nextTick(() => {
tbody.scrollTop = tbody.scrollHeight tbody.scrollTop = tbody.scrollHeight
}) })
this.$nextTick(() => {
this.autoJumpNextInputBill('billModal')
})
}, },
/** /**
* 在指定位置添加一行 * 在指定位置添加一行
@@ -2739,8 +2742,55 @@
return content.substr(0,len) return content.substr(0,len)
} }
return content; return content;
},
/** 回车后自动跳到下一个input **/
autoJumpNextInputBill(domInfo) {
let that = this
let domIndex = 0
let inputs = document.getElementById(domInfo).getElementsByTagName('input')
inputs[domIndex].focus()
document.getElementById(domInfo).addEventListener('keydown',function(e){
if(e.keyCode === 13){
domIndex++
if(domIndex === inputs.length) {
domIndex = 0
that.handleClickAdd()
}
inputs[domIndex].focus()
}
})
for(let i=0; i<inputs.length; i++){
//这个index就是做个介质来获取当前的i是第几个
inputs[i].index = i;
inputs[i].onclick = function () {
domIndex = this.index
}
inputs[i].onselect = function () {
domIndex = this.index
}
}
},
/** 自动选中特殊的key **/
autoSelectBySpecialKey(specialKey) {
let trs = this.getElement('tbody').getElementsByClassName('tr')
let trEls = []
for (let tr of trs) {
trEls.push(tr)
}
trEls.forEach(tr => {
let { idx } = tr.dataset
let value = this.inputValues[idx]
for (let key in value) {
if (value.hasOwnProperty(key)) {
let elid = `${key}${value.id}`
let el = document.getElementById(elid)
if (el && key === specialKey) {
el.select()
}
}
}
})
} }
}, },
beforeDestroy() { beforeDestroy() {
this.destroyCleanGroupRequest = true this.destroyCleanGroupRequest = true

View File

@@ -306,7 +306,10 @@
}, },
onSearch() { onSearch() {
if(this.dataSource && this.dataSource.length===1) { if(this.dataSource && this.dataSource.length===1) {
if(this.queryParam.q === this.dataSource[0].mBarCode) { if(this.queryParam.q === this.dataSource[0].mBarCode||
this.queryParam.q === this.dataSource[0].name||
this.queryParam.q === this.dataSource[0].standard||
this.queryParam.q === this.dataSource[0].model) {
let arr = [] let arr = []
arr.push(this.dataSource[0].id) arr.push(this.dataSource[0].id)
this.selectedRowKeys = arr this.selectedRowKeys = arr

View File

@@ -326,6 +326,7 @@ export const BillModalMixin = {
that.getStockByDepotBarCode(row, target) that.getStockByDepotBarCode(row, target)
target.recalcAllStatisticsColumns() target.recalcAllStatisticsColumns()
that.autoChangePrice(target) that.autoChangePrice(target)
target.autoSelectBySpecialKey('operNumber')
} }
} }
}); });
@@ -655,6 +656,7 @@ export const BillModalMixin = {
} }
//置空扫码的内容 //置空扫码的内容
this.scanBarCode = '' this.scanBarCode = ''
this.$refs.scanBarCode.focus()
} }
}) })
}) })

View File

@@ -28,7 +28,7 @@
<a-col :lg="6" :md="12" :sm="24"></a-col> <a-col :lg="6" :md="12" :sm="24"></a-col>
<a-col :lg="6" :md="12" :sm="24"></a-col> <a-col :lg="6" :md="12" :sm="24"></a-col>
</a-row> </a-row>
<j-editable-table <j-editable-table id="billModal"
:ref="refKeys[0]" :ref="refKeys[0]"
:loading="materialTable.loading" :loading="materialTable.loading"
:columns="materialTable.columns" :columns="materialTable.columns"
@@ -51,7 +51,7 @@
<a-button @click="scanEnter">扫码录入</a-button> <a-button @click="scanEnter">扫码录入</a-button>
</a-col> </a-col>
<a-col v-if="!scanStatus" :md="16" :sm="24" style="padding: 0 6px 0 12px"> <a-col v-if="!scanStatus" :md="16" :sm="24" style="padding: 0 6px 0 12px">
<a-input placeholder="请扫码商品条码并回车" v-model="scanBarCode" @pressEnter="scanPressEnter" /> <a-input placeholder="请扫码商品条码并回车" v-model="scanBarCode" @pressEnter="scanPressEnter" ref="scanBarCode"/>
</a-col> </a-col>
<a-col v-if="!scanStatus" :md="6" :sm="24" style="padding: 0px"> <a-col v-if="!scanStatus" :md="6" :sm="24" style="padding: 0px">
<a-button @click="stopScan">收起扫码</a-button> <a-button @click="stopScan">收起扫码</a-button>

View File

@@ -28,7 +28,7 @@
<a-col :lg="6" :md="12" :sm="24"></a-col> <a-col :lg="6" :md="12" :sm="24"></a-col>
<a-col :lg="6" :md="12" :sm="24"></a-col> <a-col :lg="6" :md="12" :sm="24"></a-col>
</a-row> </a-row>
<j-editable-table <j-editable-table id="billModal"
:ref="refKeys[0]" :ref="refKeys[0]"
:loading="materialTable.loading" :loading="materialTable.loading"
:columns="materialTable.columns" :columns="materialTable.columns"
@@ -51,7 +51,7 @@
<a-button @click="scanEnter">扫码录入</a-button> <a-button @click="scanEnter">扫码录入</a-button>
</a-col> </a-col>
<a-col v-if="!scanStatus" :md="16" :sm="24" style="padding: 0 6px 0 12px"> <a-col v-if="!scanStatus" :md="16" :sm="24" style="padding: 0 6px 0 12px">
<a-input placeholder="请扫码商品条码并回车" v-model="scanBarCode" @pressEnter="scanPressEnter" /> <a-input placeholder="请扫码商品条码并回车" v-model="scanBarCode" @pressEnter="scanPressEnter" ref="scanBarCode"/>
</a-col> </a-col>
<a-col v-if="!scanStatus" :md="6" :sm="24" style="padding: 0px"> <a-col v-if="!scanStatus" :md="6" :sm="24" style="padding: 0px">
<a-button @click="stopScan">收起扫码</a-button> <a-button @click="stopScan">收起扫码</a-button>

View File

@@ -28,7 +28,7 @@
<a-col :lg="6" :md="12" :sm="24"></a-col> <a-col :lg="6" :md="12" :sm="24"></a-col>
<a-col :lg="6" :md="12" :sm="24"></a-col> <a-col :lg="6" :md="12" :sm="24"></a-col>
</a-row> </a-row>
<j-editable-table <j-editable-table id="billModal"
:ref="refKeys[0]" :ref="refKeys[0]"
:loading="materialTable.loading" :loading="materialTable.loading"
:columns="materialTable.columns" :columns="materialTable.columns"
@@ -51,7 +51,7 @@
<a-button @click="scanEnter">扫码录入</a-button> <a-button @click="scanEnter">扫码录入</a-button>
</a-col> </a-col>
<a-col v-if="!scanStatus" :md="16" :sm="24" style="padding: 0 6px 0 12px"> <a-col v-if="!scanStatus" :md="16" :sm="24" style="padding: 0 6px 0 12px">
<a-input placeholder="请扫码商品条码并回车" v-model="scanBarCode" @pressEnter="scanPressEnter" /> <a-input placeholder="请扫码商品条码并回车" v-model="scanBarCode" @pressEnter="scanPressEnter" ref="scanBarCode"/>
</a-col> </a-col>
<a-col v-if="!scanStatus" :md="6" :sm="24" style="padding: 0px"> <a-col v-if="!scanStatus" :md="6" :sm="24" style="padding: 0px">
<a-button @click="stopScan">收起扫码</a-button> <a-button @click="stopScan">收起扫码</a-button>

View File

@@ -43,7 +43,7 @@
</a-col> </a-col>
<a-col :lg="6" :md="12" :sm="24"></a-col> <a-col :lg="6" :md="12" :sm="24"></a-col>
</a-row> </a-row>
<j-editable-table <j-editable-table id="billModal"
:ref="refKeys[0]" :ref="refKeys[0]"
:loading="materialTable.loading" :loading="materialTable.loading"
:columns="materialTable.columns" :columns="materialTable.columns"
@@ -66,7 +66,7 @@
<a-button @click="scanEnter">扫码录入</a-button> <a-button @click="scanEnter">扫码录入</a-button>
</a-col> </a-col>
<a-col v-if="!scanStatus" :md="16" :sm="24" style="padding: 0 6px 0 12px"> <a-col v-if="!scanStatus" :md="16" :sm="24" style="padding: 0 6px 0 12px">
<a-input placeholder="请扫码商品条码并回车" v-model="scanBarCode" @pressEnter="scanPressEnter" /> <a-input placeholder="请扫码商品条码并回车" v-model="scanBarCode" @pressEnter="scanPressEnter" ref="scanBarCode"/>
</a-col> </a-col>
<a-col v-if="!scanStatus" :md="6" :sm="24" style="padding: 0px"> <a-col v-if="!scanStatus" :md="6" :sm="24" style="padding: 0px">
<a-button @click="stopScan">收起扫码</a-button> <a-button @click="stopScan">收起扫码</a-button>

View File

@@ -43,7 +43,7 @@
</a-col> </a-col>
<a-col :lg="6" :md="12" :sm="24"></a-col> <a-col :lg="6" :md="12" :sm="24"></a-col>
</a-row> </a-row>
<j-editable-table <j-editable-table id="billModal"
:ref="refKeys[0]" :ref="refKeys[0]"
:loading="materialTable.loading" :loading="materialTable.loading"
:columns="materialTable.columns" :columns="materialTable.columns"
@@ -66,7 +66,7 @@
<a-button @click="scanEnter">扫码录入</a-button> <a-button @click="scanEnter">扫码录入</a-button>
</a-col> </a-col>
<a-col v-if="!scanStatus" :md="16" :sm="24" style="padding: 0 6px 0 12px"> <a-col v-if="!scanStatus" :md="16" :sm="24" style="padding: 0 6px 0 12px">
<a-input placeholder="请扫码商品条码并回车" v-model="scanBarCode" @pressEnter="scanPressEnter" /> <a-input placeholder="请扫码商品条码并回车" v-model="scanBarCode" @pressEnter="scanPressEnter" ref="scanBarCode"/>
</a-col> </a-col>
<a-col v-if="!scanStatus" :md="6" :sm="24" style="padding: 0px"> <a-col v-if="!scanStatus" :md="6" :sm="24" style="padding: 0px">
<a-button @click="stopScan">收起扫码</a-button> <a-button @click="stopScan">收起扫码</a-button>

View File

@@ -47,7 +47,7 @@
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
<j-editable-table <j-editable-table id="billModal"
:ref="refKeys[0]" :ref="refKeys[0]"
:loading="materialTable.loading" :loading="materialTable.loading"
:columns="materialTable.columns" :columns="materialTable.columns"
@@ -70,7 +70,7 @@
<a-button @click="scanEnter">扫码录入</a-button> <a-button @click="scanEnter">扫码录入</a-button>
</a-col> </a-col>
<a-col v-if="!scanStatus" :md="16" :sm="24" style="padding: 0 6px 0 12px"> <a-col v-if="!scanStatus" :md="16" :sm="24" style="padding: 0 6px 0 12px">
<a-input placeholder="请扫码商品条码并回车" v-model="scanBarCode" @pressEnter="scanPressEnter" /> <a-input placeholder="请扫码商品条码并回车" v-model="scanBarCode" @pressEnter="scanPressEnter" ref="scanBarCode"/>
</a-col> </a-col>
<a-col v-if="!scanStatus" :md="6" :sm="24" style="padding: 0px"> <a-col v-if="!scanStatus" :md="6" :sm="24" style="padding: 0px">
<a-button @click="stopScan">收起扫码</a-button> <a-button @click="stopScan">收起扫码</a-button>

View File

@@ -51,7 +51,7 @@
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
<j-editable-table id="purchaseInModal" <j-editable-table id="billModal"
:ref="refKeys[0]" :ref="refKeys[0]"
:loading="materialTable.loading" :loading="materialTable.loading"
:columns="materialTable.columns" :columns="materialTable.columns"
@@ -74,7 +74,7 @@
<a-button @click="scanEnter">扫码录入</a-button> <a-button @click="scanEnter">扫码录入</a-button>
</a-col> </a-col>
<a-col v-if="!scanStatus" :md="16" :sm="24" style="padding: 0 6px 0 12px"> <a-col v-if="!scanStatus" :md="16" :sm="24" style="padding: 0 6px 0 12px">
<a-input placeholder="请扫码商品条码并回车" v-model="scanBarCode" @pressEnter="scanPressEnter" /> <a-input placeholder="请扫码商品条码并回车" v-model="scanBarCode" @pressEnter="scanPressEnter" ref="scanBarCode"/>
</a-col> </a-col>
<a-col v-if="!scanStatus" :md="6" :sm="24" style="padding: 0px"> <a-col v-if="!scanStatus" :md="6" :sm="24" style="padding: 0px">
<a-button @click="stopScan">收起扫码</a-button> <a-button @click="stopScan">收起扫码</a-button>
@@ -178,7 +178,7 @@
import { FormTypes } from '@/utils/JEditableTableUtil' import { FormTypes } from '@/utils/JEditableTableUtil'
import { JEditableTableMixin } from '@/mixins/JEditableTableMixin' import { JEditableTableMixin } from '@/mixins/JEditableTableMixin'
import { BillModalMixin } from '../mixins/BillModalMixin' import { BillModalMixin } from '../mixins/BillModalMixin'
import { getMpListShort, changeListFmtMinus,handleIntroJs,autoJumpNextInput } from "@/utils/util" import { getMpListShort, changeListFmtMinus,handleIntroJs } from "@/utils/util"
import { getAction } from '@/api/manage' import { getAction } from '@/api/manage'
import JUpload from '@/components/jeecg/JUpload' import JUpload from '@/components/jeecg/JUpload'
import JDate from '@/components/jeecg/JDate' import JDate from '@/components/jeecg/JDate'
@@ -324,9 +324,6 @@
let url = this.readOnly ? this.url.detailList : this.url.detailList; let url = this.readOnly ? this.url.detailList : this.url.detailList;
this.requestSubTableData(url, params, this.materialTable); this.requestSubTableData(url, params, this.materialTable);
} }
setTimeout(function() {
autoJumpNextInput('purchaseInModal')
},100)
//复制新增单据-初始化单号和日期 //复制新增单据-初始化单号和日期
if(this.action === 'copyAdd') { if(this.action === 'copyAdd') {
this.model.id = '' this.model.id = ''

View File

@@ -45,7 +45,7 @@
</a-col> </a-col>
<a-col :lg="6" :md="12" :sm="24"></a-col> <a-col :lg="6" :md="12" :sm="24"></a-col>
</a-row> </a-row>
<j-editable-table <j-editable-table id="billModal"
:ref="refKeys[0]" :ref="refKeys[0]"
:loading="materialTable.loading" :loading="materialTable.loading"
:columns="materialTable.columns" :columns="materialTable.columns"
@@ -67,7 +67,7 @@
<a-button @click="scanEnter">扫码录入</a-button> <a-button @click="scanEnter">扫码录入</a-button>
</a-col> </a-col>
<a-col v-if="!scanStatus" :md="16" :sm="24" style="padding: 0 6px 0 12px"> <a-col v-if="!scanStatus" :md="16" :sm="24" style="padding: 0 6px 0 12px">
<a-input placeholder="请扫码商品条码并回车" v-model="scanBarCode" @pressEnter="scanPressEnter" /> <a-input placeholder="请扫码商品条码并回车" v-model="scanBarCode" @pressEnter="scanPressEnter" ref="scanBarCode"/>
</a-col> </a-col>
<a-col v-if="!scanStatus" :md="6" :sm="24" style="padding: 0px"> <a-col v-if="!scanStatus" :md="6" :sm="24" style="padding: 0px">
<a-button @click="stopScan">收起扫码</a-button> <a-button @click="stopScan">收起扫码</a-button>

View File

@@ -49,7 +49,7 @@
</a-row> </a-row>
<a-row class="form-row" :gutter="24"> <a-row class="form-row" :gutter="24">
<a-col :lg="18" :md="12" :sm="24"> <a-col :lg="18" :md="12" :sm="24">
<j-editable-table <j-editable-table id="billModal"
:ref="refKeys[0]" :ref="refKeys[0]"
:loading="materialTable.loading" :loading="materialTable.loading"
:columns="materialTable.columns" :columns="materialTable.columns"
@@ -73,7 +73,7 @@
<a-button @click="scanEnter">扫码录入</a-button> <a-button @click="scanEnter">扫码录入</a-button>
</a-col> </a-col>
<a-col v-if="!scanStatus" :md="16" :sm="24" style="padding: 0 6px 0 12px"> <a-col v-if="!scanStatus" :md="16" :sm="24" style="padding: 0 6px 0 12px">
<a-input placeholder="请扫码商品条码并回车" v-model="scanBarCode" @pressEnter="scanPressEnter" /> <a-input placeholder="请扫码商品条码并回车" v-model="scanBarCode" @pressEnter="scanPressEnter" ref="scanBarCode"/>
</a-col> </a-col>
<a-col v-if="!scanStatus" :md="6" :sm="24" style="padding: 0px"> <a-col v-if="!scanStatus" :md="6" :sm="24" style="padding: 0px">
<a-button @click="stopScan">收起扫码</a-button> <a-button @click="stopScan">收起扫码</a-button>

View File

@@ -56,7 +56,7 @@
</a-row> </a-row>
<a-row class="form-row" :gutter="24"> <a-row class="form-row" :gutter="24">
<a-col :lg="18" :md="12" :sm="24"> <a-col :lg="18" :md="12" :sm="24">
<j-editable-table <j-editable-table id="billModal"
:ref="refKeys[0]" :ref="refKeys[0]"
:loading="materialTable.loading" :loading="materialTable.loading"
:columns="materialTable.columns" :columns="materialTable.columns"
@@ -80,7 +80,7 @@
<a-button @click="scanEnter">扫码录入</a-button> <a-button @click="scanEnter">扫码录入</a-button>
</a-col> </a-col>
<a-col v-if="!scanStatus" :md="16" :sm="24" style="padding: 0 6px 0 12px"> <a-col v-if="!scanStatus" :md="16" :sm="24" style="padding: 0 6px 0 12px">
<a-input placeholder="请扫码商品条码并回车" v-model="scanBarCode" @pressEnter="scanPressEnter" /> <a-input placeholder="请扫码商品条码并回车" v-model="scanBarCode" @pressEnter="scanPressEnter" ref="scanBarCode"/>
</a-col> </a-col>
<a-col v-if="!scanStatus" :md="6" :sm="24" style="padding: 0px"> <a-col v-if="!scanStatus" :md="6" :sm="24" style="padding: 0px">
<a-button @click="stopScan">收起扫码</a-button> <a-button @click="stopScan">收起扫码</a-button>

View File

@@ -47,7 +47,7 @@
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
<j-editable-table <j-editable-table id="billModal"
:ref="refKeys[0]" :ref="refKeys[0]"
:loading="materialTable.loading" :loading="materialTable.loading"
:columns="materialTable.columns" :columns="materialTable.columns"
@@ -70,7 +70,7 @@
<a-button @click="scanEnter">扫码录入</a-button> <a-button @click="scanEnter">扫码录入</a-button>
</a-col> </a-col>
<a-col v-if="!scanStatus" :md="16" :sm="24" style="padding: 0 6px 0 12px"> <a-col v-if="!scanStatus" :md="16" :sm="24" style="padding: 0 6px 0 12px">
<a-input placeholder="请扫码商品条码并回车" v-model="scanBarCode" @pressEnter="scanPressEnter" /> <a-input placeholder="请扫码商品条码并回车" v-model="scanBarCode" @pressEnter="scanPressEnter" ref="scanBarCode"/>
</a-col> </a-col>
<a-col v-if="!scanStatus" :md="6" :sm="24" style="padding: 0px"> <a-col v-if="!scanStatus" :md="6" :sm="24" style="padding: 0px">
<a-button @click="stopScan">收起扫码</a-button> <a-button @click="stopScan">收起扫码</a-button>

View File

@@ -51,7 +51,7 @@
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
<j-editable-table <j-editable-table id="billModal"
:ref="refKeys[0]" :ref="refKeys[0]"
:loading="materialTable.loading" :loading="materialTable.loading"
:columns="materialTable.columns" :columns="materialTable.columns"
@@ -73,7 +73,7 @@
<a-button @click="scanEnter">扫码录入</a-button> <a-button @click="scanEnter">扫码录入</a-button>
</a-col> </a-col>
<a-col v-if="!scanStatus" :md="16" :sm="24" style="padding: 0 6px 0 12px"> <a-col v-if="!scanStatus" :md="16" :sm="24" style="padding: 0 6px 0 12px">
<a-input placeholder="请扫码商品条码并回车" v-model="scanBarCode" @pressEnter="scanPressEnter" /> <a-input placeholder="请扫码商品条码并回车" v-model="scanBarCode" @pressEnter="scanPressEnter" ref="scanBarCode"/>
</a-col> </a-col>
<a-col v-if="!scanStatus" :md="6" :sm="24" style="padding: 0px"> <a-col v-if="!scanStatus" :md="6" :sm="24" style="padding: 0px">
<a-button @click="stopScan">收起扫码</a-button> <a-button @click="stopScan">收起扫码</a-button>

View File

@@ -52,7 +52,7 @@
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
<j-editable-table <j-editable-table id="billModal"
:ref="refKeys[0]" :ref="refKeys[0]"
:loading="materialTable.loading" :loading="materialTable.loading"
:columns="materialTable.columns" :columns="materialTable.columns"
@@ -75,7 +75,7 @@
<a-button @click="scanEnter">扫码录入</a-button> <a-button @click="scanEnter">扫码录入</a-button>
</a-col> </a-col>
<a-col v-if="!scanStatus" :md="16" :sm="24" style="padding: 0 6px 0 12px"> <a-col v-if="!scanStatus" :md="16" :sm="24" style="padding: 0 6px 0 12px">
<a-input placeholder="请扫码商品条码并回车" v-model="scanBarCode" @pressEnter="scanPressEnter" /> <a-input placeholder="请扫码商品条码并回车" v-model="scanBarCode" @pressEnter="scanPressEnter" ref="scanBarCode"/>
</a-col> </a-col>
<a-col v-if="!scanStatus" :md="6" :sm="24" style="padding: 0px"> <a-col v-if="!scanStatus" :md="6" :sm="24" style="padding: 0px">
<a-button @click="stopScan">收起扫码</a-button> <a-button @click="stopScan">收起扫码</a-button>