Browse Source

修改地块编号过滤汉字

master
邓宏 2 years ago
parent
commit
6a1f70f967
  1. 2
      pages/massif/info.vue
  2. 19
      uni_modules/d-form/components/d-form/d-form.vue

2
pages/massif/info.vue

@ -33,7 +33,7 @@ import request from '@/common/request'
fields:{
plantBaseInfoName:{label:"基地名称",disabled:true},
plotName:{label:"地块名称"},
plotNumber:{label:"地块编号"},
plotNumber:{label:"地块编号",filter:v=>v.replace(/[\u2E80-\u9FFF]/g,'')},
drawArea:{label:"勾画面积(亩)",disabled:true,type:'digit'},
realityArea:{label:"实际面积",type:'digit'},
image:{label:"地块图片",type:"upImg",num:3,value:''},

19
uni_modules/d-form/components/d-form/d-form.vue

@ -302,7 +302,13 @@
<slot v-if="!!$slots.default"/>
<view v-else-if="/^text$|^number$|^digit$|^password$/.test(type)" class="textinput">
<u-input :placeholder="placeholder||`请输入${labelName}`" :type="type" :disabled="disabled" :value="value" @input="$emit('input',$event)" @blur="/^number$|^digit$/.test(type) && $emit('input', /^\d+$/.test($event)?parseFloat($event):$event)">
<u-input
:placeholder="placeholder||`请输入${labelName}`"
:type="type"
:disabled="disabled"
:value="value"
@input="$emit('input',$event)"
@blur="inputBlur">
<text v-if="suffix" slot="suffix" style="color:#999;" @click="$emit('suffixFun')">{{typeof suffix=='function'?suffix():suffix}}</text>
</u-input>
<button v-if="btnText || btnIcon" @click="btnFun" class="cu-btn bg-green shadow" :class="btnIcon">{{btnText}}</button>
@ -506,6 +512,10 @@ import {computeArea} from '@/common/utils'
type:Function,
default:()=>''
},
filter:{
type:[Function,Object],
default:null
},
startPlaceholder:"",
endPlaceholder:"",
},
@ -663,6 +673,13 @@ import {computeArea} from '@/common/utils'
this.$refs.picker.setColumnValues(e.columnIndex+1,e.value[0].children)
}
},
inputBlur(e){
if(/^number$|^digit$/.test(this.type)){
this.$emit('input', /^[\d\.]+$/.test(e)?parseFloat(e):e)
}else if(this.type=='text'&&typeof this.filter=='function'){
this.$emit("input",this.filter(e))
}
},
openMap(){
// uni.navigateTo({url:"/plantPages/massif/mapEditor"})

Loading…
Cancel
Save