|
|
@@ -13,6 +13,7 @@
|
|
|
>
|
|
|
<el-form-item label="账号" prop="userName">
|
|
|
<el-input
|
|
|
+ @input="inputLimit"
|
|
|
:disabled="!!ruleForm.id"
|
|
|
v-model="ruleForm.userName"
|
|
|
maxlength="15"
|
|
|
@@ -27,7 +28,7 @@
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
<!-- 授权 -->
|
|
|
- <div class="limits" v-if="ruleForm.id&&ruleForm.isAdmin !== 1">
|
|
|
+ <div class="limits" v-if="ruleForm.id && ruleForm.isAdmin !== 1">
|
|
|
<span>权限</span> 
|
|
|
<el-checkbox
|
|
|
:indeterminate="isIndeterminate"
|
|
|
@@ -118,6 +119,19 @@ export default {
|
|
|
watch: {},
|
|
|
// 方法集合
|
|
|
methods: {
|
|
|
+ inputLimit (val) {
|
|
|
+ // 正则匹配非中英文及数字的字符
|
|
|
+ const reg = /[^\u4e00-\u9fa5a-zA-Z0-9]/
|
|
|
+ // 查找是否有非中英文及数字的字符
|
|
|
+ // 没有则返回-1,有则返回对应位置
|
|
|
+ const n = val.search(reg)
|
|
|
+ if (n !== -1) {
|
|
|
+ // 由于每次触发,通常只有最后一个字符是有可能异常的
|
|
|
+ // 所以这里是直接截取异常字符前面的部分
|
|
|
+ this.ruleForm.userName = val.slice(0, n)
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
// 关于授权的数据
|
|
|
handleCheckAllChange (val) {
|
|
|
this.checkedCities = val ? this.villageList.map((v) => v.id) : []
|
|
|
@@ -138,7 +152,7 @@ export default {
|
|
|
this.checkAll = true
|
|
|
this.isIndeterminate = false
|
|
|
} else this.isIndeterminate = true
|
|
|
- this.checkedCities = this.checkedCities.map(v => Number(v))
|
|
|
+ this.checkedCities = this.checkedCities.map((v) => Number(v))
|
|
|
} else {
|
|
|
this.checkedCities = []
|
|
|
this.checkAll = this.isIndeterminate = false
|