Compare commits
No commits in common. "76414690886c7d33e76428269029fe0122800a5d" and "5bc39180c1c10d8983172729922a5cb6ae75c600" have entirely different histories.
7641469088
...
5bc39180c1
|
|
@ -1,52 +0,0 @@
|
||||||
<template>
|
|
||||||
<el-input ref="scanInput" v-model="scanValue" :placeholder="props.placeholder" @keydown="handleKeyDown" :type="inputType"
|
|
||||||
@focus="handleFocus" clearable />
|
|
||||||
</template>
|
|
||||||
<script setup>
|
|
||||||
import { ref, defineProps, defineEmits, computed, onMounted } from "vue";
|
|
||||||
import { ElMessage } from 'element-plus'
|
|
||||||
|
|
||||||
const scanValue = ref('')
|
|
||||||
const scanInput = ref(null)
|
|
||||||
|
|
||||||
const props = defineProps({
|
|
||||||
clearAfterScan: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true
|
|
||||||
},
|
|
||||||
placeholder: {
|
|
||||||
type: String,
|
|
||||||
default: '请扫描条码/二维码'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const emit = defineEmits(['scan']);
|
|
||||||
const inputType = ref('text')
|
|
||||||
|
|
||||||
function handleKeyDown(e) {
|
|
||||||
if (e.key === 'Enter') {
|
|
||||||
const value = scanValue.value.trim()
|
|
||||||
if (/[\u4e00-\u9fa5]/.test(value)) {
|
|
||||||
ElMessage.error('扫码内容包含中文或输入法异常,请切换为英文输入法后重试!')
|
|
||||||
scanValue.value = ''
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (value) {
|
|
||||||
// inputType.value = 'text'
|
|
||||||
// props.onScan && props.onScan(value)
|
|
||||||
emit('scan', value)
|
|
||||||
if (props.clearAfterScan) {
|
|
||||||
scanValue.value = ''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleFocus(e) {
|
|
||||||
// 尽量提示和引导用户切换输入法为英文
|
|
||||||
e.target.setAttribute('inputmode', 'text')
|
|
||||||
e.target.setAttribute('lang', 'en')
|
|
||||||
// ElMessage.info('请确保输入法为英文!')
|
|
||||||
// inputType.value = 'password'
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
@ -118,9 +118,6 @@
|
||||||
<el-table-column label="名称" prop="name"></el-table-column>
|
<el-table-column label="名称" prop="name"></el-table-column>
|
||||||
</scTableSelect>
|
</scTableSelect>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="currentM == 'xtScanInput'">
|
|
||||||
<xtScanInput @scan="scanOk"></xtScanInput>
|
|
||||||
</div>
|
|
||||||
</el-main>
|
</el-main>
|
||||||
</el-container>
|
</el-container>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -141,7 +138,6 @@ export default {
|
||||||
"ehsEpSelect",
|
"ehsEpSelect",
|
||||||
"ehsTableSelect",
|
"ehsTableSelect",
|
||||||
"scTableSelect",
|
"scTableSelect",
|
||||||
"xtScanInput"
|
|
||||||
],
|
],
|
||||||
props: {
|
props: {
|
||||||
label: "name",
|
label: "name",
|
||||||
|
|
@ -226,9 +222,6 @@ export default {
|
||||||
window.onScanResult = this.onScanResult;
|
window.onScanResult = this.onScanResult;
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
scanOk(data) {
|
|
||||||
console.log(data);
|
|
||||||
},
|
|
||||||
getMember(data) {
|
getMember(data) {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ import ehsEpSelect from './components/ehsSelect/epselect'
|
||||||
import ehsSelect from './components/ehsSelect/select'
|
import ehsSelect from './components/ehsSelect/select'
|
||||||
import ehsTableSelect from './components/ehsSelect/tableSelect'
|
import ehsTableSelect from './components/ehsSelect/tableSelect'
|
||||||
import xtSelect from './components/xtSelect/index.vue'
|
import xtSelect from './components/xtSelect/index.vue'
|
||||||
import xtScanInput from './components/xtScanInput/index.vue'
|
|
||||||
export default {
|
export default {
|
||||||
install(app) {
|
install(app) {
|
||||||
app.component('ehsUserSelect', ehsUserSelect);
|
app.component('ehsUserSelect', ehsUserSelect);
|
||||||
|
|
@ -11,6 +10,5 @@ export default {
|
||||||
app.component('ehsSelect', ehsSelect);
|
app.component('ehsSelect', ehsSelect);
|
||||||
app.component('ehsTableSelect', ehsTableSelect);
|
app.component('ehsTableSelect', ehsTableSelect);
|
||||||
app.component('xtSelect', xtSelect);
|
app.component('xtSelect', xtSelect);
|
||||||
app.component('xtScanInput', xtScanInput);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue