|
|
|
@ -7,9 +7,14 @@
|
|
|
|
|
clickable
|
|
|
|
|
readonly
|
|
|
|
|
:label="label"
|
|
|
|
|
@click="showPicker"
|
|
|
|
|
right-icon="logistics"
|
|
|
|
|
placeholder="车牌号码">
|
|
|
|
|
right-icon="logistics">
|
|
|
|
|
<template slot="input">
|
|
|
|
|
<div class="cphm">
|
|
|
|
|
<span class="cphm-qy" @click="showPicker">{{prefix}}</span>
|
|
|
|
|
<input class="cphm-bh" @click="showInput" readonly v-model="suffix"/>
|
|
|
|
|
<span>{{result}}</span>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</van-field>
|
|
|
|
|
<van-popup
|
|
|
|
|
v-model="showPopup"
|
|
|
|
@ -45,8 +50,9 @@
|
|
|
|
|
},
|
|
|
|
|
data(){
|
|
|
|
|
return {
|
|
|
|
|
prefix: '',
|
|
|
|
|
suffix: '',
|
|
|
|
|
showPopup: false,
|
|
|
|
|
value: '',
|
|
|
|
|
columns: [
|
|
|
|
|
{
|
|
|
|
|
values: [
|
|
|
|
@ -173,47 +179,113 @@
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
result(){
|
|
|
|
|
this.$emit('input', this.prefix + this.suffix);
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
props: {
|
|
|
|
|
'label': String,
|
|
|
|
|
'required': Boolean
|
|
|
|
|
'label': {
|
|
|
|
|
type: String,
|
|
|
|
|
default: ''
|
|
|
|
|
},
|
|
|
|
|
'required': {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false
|
|
|
|
|
},
|
|
|
|
|
'readonly': {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false
|
|
|
|
|
},
|
|
|
|
|
'value': {
|
|
|
|
|
type: String,
|
|
|
|
|
default: 0
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
onConfirm() {
|
|
|
|
|
//隐藏区域选择并弹出字母键盘
|
|
|
|
|
const c = this.$refs['prefix'].getValues();
|
|
|
|
|
this.prefix = c[0].text + c[1];
|
|
|
|
|
this.showPopup = false;
|
|
|
|
|
keyboard({
|
|
|
|
|
value: c[0].text + c[1],
|
|
|
|
|
cols: 10,
|
|
|
|
|
keys: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[+]'],
|
|
|
|
|
finish: this.finish,
|
|
|
|
|
filter: this.filter,
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
onCancel() {
|
|
|
|
|
this.showPopup = false;
|
|
|
|
|
},
|
|
|
|
|
onChange(picker, values) {
|
|
|
|
|
window.console.log(values);
|
|
|
|
|
// picker.setColumnValues(1, values.children);
|
|
|
|
|
picker.setColumnValues(1, values[0].children);
|
|
|
|
|
},
|
|
|
|
|
showPicker(){
|
|
|
|
|
this.columns[0].defaultIndex = 0;
|
|
|
|
|
this.columns[1].defaultIndex = 0;
|
|
|
|
|
let sheng = this.prefix.substr(0, 1);
|
|
|
|
|
let shi = this.prefix.substr(1, 1);
|
|
|
|
|
this.columns[0].values.forEach((item, index) => {
|
|
|
|
|
if (sheng === item.text) {
|
|
|
|
|
this.columns[0].defaultIndex = index;
|
|
|
|
|
item.children.forEach((item_, index_) => {
|
|
|
|
|
if (shi === item_) {
|
|
|
|
|
this.columns[1].defaultIndex = index_;
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.showPopup = true;
|
|
|
|
|
},
|
|
|
|
|
showInput(){
|
|
|
|
|
keyboard({
|
|
|
|
|
value: '',
|
|
|
|
|
cols: 10,
|
|
|
|
|
keys: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[+]'],
|
|
|
|
|
finish: this.finish,
|
|
|
|
|
filter: this.filter,
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
finish(value){
|
|
|
|
|
this.value = value;
|
|
|
|
|
this.$emit('input', this.value);
|
|
|
|
|
this.suffix = value;
|
|
|
|
|
},
|
|
|
|
|
filter(key){
|
|
|
|
|
if (key === '[+]') {
|
|
|
|
|
Toast("扫描未实现")
|
|
|
|
|
Toast("扫描未实现");
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
return key;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted(){
|
|
|
|
|
let value = this.value;
|
|
|
|
|
if (value.match("[\u4e00-\u9fa5].*")) {
|
|
|
|
|
this.prefix = value.substr(0, 2);
|
|
|
|
|
this.suffix = value.substr(2, value.length);
|
|
|
|
|
} else {
|
|
|
|
|
let item = this.columns[0].values[0];
|
|
|
|
|
this.prefix = item.text + item.children[0];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
<style lang="less">
|
|
|
|
|
.cphm {
|
|
|
|
|
-webkit-box-flex: 0;
|
|
|
|
|
-webkit-flex: none;
|
|
|
|
|
flex: none;
|
|
|
|
|
vertical-align: top;
|
|
|
|
|
|
|
|
|
|
&-qy {
|
|
|
|
|
display: inline-block;
|
|
|
|
|
vertical-align: top;
|
|
|
|
|
height: 30px;
|
|
|
|
|
line-height: 30px;
|
|
|
|
|
padding: 0 5px;
|
|
|
|
|
background-color: #f2f3f5;
|
|
|
|
|
}
|
|
|
|
|
&-bh {
|
|
|
|
|
vertical-align: top;
|
|
|
|
|
padding: 0 0 0 5px;
|
|
|
|
|
height: 30px;
|
|
|
|
|
border: 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|