|
|
@@ -19,7 +19,7 @@
|
|
|
<span>
|
|
|
<i>*</i>型号:
|
|
|
</span>
|
|
|
- <input type="text" class="form-control" :class="{'error': !validObj.code}" v-model="applyObj.code" maxlength="30" @blur="checkCode" @input="onCodeChange" />
|
|
|
+ <input type="text" class="form-control" :class="{'error': !validObj.code}" v-model="applyObj.code" @blur="checkCode" @input="onCodeChange" />
|
|
|
<ul v-show="showSimilarCodeList">
|
|
|
<li v-for="sCode in similarCode" @click="setCode(sCode.code)">{{sCode.code}}</li>
|
|
|
</ul>
|
|
|
@@ -28,7 +28,7 @@
|
|
|
<span>
|
|
|
<i>*</i>品牌:
|
|
|
</span>
|
|
|
- <input type="text" class="form-control" :class="{'error': !validObj.brand}" maxlength="20" v-model="applyObj.brand" @blur="checkBrand" @input="onBrandChange" />
|
|
|
+ <input type="text" class="form-control" :class="{'error': !validObj.brand}" v-model="applyObj.brand" @blur="checkBrand" @input="onBrandChange" />
|
|
|
<ul class="brand-similar-list" v-show="showSimilarBrandList">
|
|
|
<li v-for="sBrand in similarBrand" @click="setBrand(sBrand.nameEn)">{{sBrand.nameEn}}</li>
|
|
|
</ul>
|
|
|
@@ -150,6 +150,14 @@
|
|
|
}
|
|
|
return len
|
|
|
}
|
|
|
+ let isIncludeChinese = function (str) {
|
|
|
+ for (let i = 0; i < str.length; i++) {
|
|
|
+ if (str.charCodeAt(i) > 127 || str.charCodeAt(i) === 94) {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false
|
|
|
+ }
|
|
|
export default {
|
|
|
data () {
|
|
|
return {
|
|
|
@@ -170,7 +178,9 @@
|
|
|
// encapsulation: true,
|
|
|
// produceDate: true,
|
|
|
amount: true,
|
|
|
- deadline: true
|
|
|
+ deadline: true,
|
|
|
+ brandChinese: true,
|
|
|
+ codeChinese: true
|
|
|
},
|
|
|
pickerOptions: {
|
|
|
disabledDate (time) {
|
|
|
@@ -231,9 +241,17 @@
|
|
|
})
|
|
|
} else {
|
|
|
if (!this.validObj.code) {
|
|
|
- this.$message.error('型号不能为空')
|
|
|
+ if (!this.validObj.codeChinese) {
|
|
|
+ this.$message.error('请勿填中文符号')
|
|
|
+ } else {
|
|
|
+ this.$message.error('型号不能为空')
|
|
|
+ }
|
|
|
} else if (!this.validObj.brand) {
|
|
|
- this.$message.error('品牌不能为空')
|
|
|
+ if (!this.validObj.brandChinese) {
|
|
|
+ this.$message.error('请勿填中文符号')
|
|
|
+ } else {
|
|
|
+ this.$message.error('品牌不能为空')
|
|
|
+ }
|
|
|
} else if (!this.validObj.deadline) {
|
|
|
this.$message.error('截止日期不能为空')
|
|
|
} else if (!this.validObj.amount || !this.validObj.unitPrice) {
|
|
|
@@ -265,10 +283,22 @@
|
|
|
},
|
|
|
checkCode: function () {
|
|
|
this.validObj.code = this.applyObj.code && this.applyObj.code !== ''
|
|
|
+ if (isIncludeChinese(this.applyObj.code)) {
|
|
|
+ this.validObj.code = false
|
|
|
+ this.validObj.codeChinese = false
|
|
|
+ } else {
|
|
|
+ this.validObj.codeChinese = true
|
|
|
+ }
|
|
|
return this.validObj.code
|
|
|
},
|
|
|
checkBrand: function () {
|
|
|
this.validObj.brand = this.applyObj.brand && this.applyObj.brand !== ''
|
|
|
+ if (isIncludeChinese(this.applyObj.brand)) {
|
|
|
+ this.validObj.brand = false
|
|
|
+ this.validObj.brandChinese = false
|
|
|
+ } else {
|
|
|
+ this.validObj.brandChinese = true
|
|
|
+ }
|
|
|
return this.validObj.brand
|
|
|
},
|
|
|
checkUnitPrice: function () {
|
|
|
@@ -319,14 +349,14 @@
|
|
|
}
|
|
|
},
|
|
|
onCodeChange: function () {
|
|
|
- if (this.applyObj.code && getRealLen(this.applyObj.code) > 30) {
|
|
|
+ if (this.applyObj.code && getRealLen(this.applyObj.code) > 100) {
|
|
|
this.applyObj.code = this.applyObj.code.substring(0, this.applyObj.code.length - 1)
|
|
|
} else {
|
|
|
this.getSimilarCode()
|
|
|
}
|
|
|
},
|
|
|
onBrandChange: function () {
|
|
|
- if (this.applyObj.brand && getRealLen(this.applyObj.brand) > 20) {
|
|
|
+ if (this.applyObj.brand && getRealLen(this.applyObj.brand) > 50) {
|
|
|
this.applyObj.brand = this.applyObj.brand.substring(0, this.applyObj.brand.length - 1)
|
|
|
} else {
|
|
|
this.getSimilarBrand()
|