|
|
@@ -295,15 +295,15 @@
|
|
|
<div class="update-materiel-wrapper-list clearfix" :class="{'overHidden': MaterielItem.standard === 1}">
|
|
|
<div class="name pull-left"><a class="red">*</a>品牌:</div>
|
|
|
<template v-if="MaterielItem.standard === 1">
|
|
|
- {{MaterielItem.brand}}
|
|
|
+ {{MaterielItem.pbranden}}
|
|
|
</template>
|
|
|
<template v-else>
|
|
|
<div class="input pull-left clearfix" :class="{'overHidden': MaterielItem.standard === 1}">
|
|
|
- <input type="text" v-model="MaterielItem.brand" placeholder="请勿填中文符号" @blur.stop="checkBrand" @input.stop="onBrandChange"/>
|
|
|
- <ul class="similar brand-similar-list" v-show="showSimilarBrandList && MaterielItem.brand">
|
|
|
+ <input type="text" v-model="MaterielItem.pbranden" placeholder="请勿填中文符号" @blur.stop="checkBrand" @input.stop="onBrandChange"/>
|
|
|
+ <ul class="similar brand-similar-list" v-show="showSimilarBrandList && MaterielItem.pbranden">
|
|
|
<li v-for="sBrand in similarBrand" @click.stop="setBrand(sBrand.nameEn)">{{sBrand.nameEn}}</li>
|
|
|
</ul>
|
|
|
- <i class="iconfont icon-guanbi1" @click.stop="MaterielItem.brand = ''"></i>
|
|
|
+ <i class="iconfont icon-guanbi1" @click.stop="MaterielItem.pbranden = ''"></i>
|
|
|
</div>
|
|
|
</template>
|
|
|
</div>
|
|
|
@@ -323,23 +323,23 @@
|
|
|
<div class="update-materiel-wrapper-list clearfix">
|
|
|
<div class="name pull-left"><a class="red">*</a>型号:</div>
|
|
|
<template v-if="MaterielItem.standard === 1">
|
|
|
- {{MaterielItem.cmpCode}}
|
|
|
+ {{MaterielItem.pcmpcode}}
|
|
|
</template>
|
|
|
<template v-else>
|
|
|
<div class="input pull-left clearfix">
|
|
|
- <input type="text" v-model="MaterielItem.cmpCode" @blur.stop="checkCode" @input.stop="onCodeChange" placeholder="请勿填中文符号">
|
|
|
- <ul class="similar" v-show="showSimilarCodeList && MaterielItem.cmpCode">
|
|
|
+ <input type="text" v-model="MaterielItem.pcmpcode" @blur.stop="checkCode" @input.stop="onCodeChange" placeholder="请勿填中文符号">
|
|
|
+ <ul class="similar" v-show="showSimilarCodeList && MaterielItem.pcmpcode">
|
|
|
<li v-for="sCode in similarCode" @click.stop="setCode(sCode.code)">{{sCode.code}}</li>
|
|
|
</ul>
|
|
|
- <!--<input type="text" placeholder="请输入型号" v-model="MaterielItem.cmpCode"/>-->
|
|
|
- <i class="iconfont icon-guanbi1" @click.stop="MaterielItem.cmpCode = ''"></i>
|
|
|
+ <!--<input type="text" placeholder="请输入型号" v-model="MaterielItem.pcmpcode"/>-->
|
|
|
+ <i class="iconfont icon-guanbi1" @click.stop="MaterielItem.pcmpcode = ''"></i>
|
|
|
</div>
|
|
|
</template>
|
|
|
</div>
|
|
|
<div class="update-materiel-wrapper-list clearfix">
|
|
|
<div class="name pull-left"><a class="red" style="opacity: 0">*</a>规格:</div>
|
|
|
<div class="input pull-left clearfix">
|
|
|
- <input type="text" placeholder="请输入规格" v-model="MaterielItem.spec" @blur="checkSpec" @input="onSpecInput"/>
|
|
|
+ <input type="text" placeholder="请输入规格" v-model="MaterielItem.spec" @blur="checkSpec" @input="onSpecInput" maxlength="50"/>
|
|
|
<i class="iconfont icon-guanbi1" @click.stop="MaterielItem.spec = ''"></i>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -587,6 +587,7 @@
|
|
|
},
|
|
|
// 编辑物料
|
|
|
updateMateriel(item) {
|
|
|
+ console.log(item)
|
|
|
this.MaterielItem = item
|
|
|
this.$item = this.baseUtils.deepCopy(item)
|
|
|
this.cmpImg = item.cmpImg || ''
|
|
|
@@ -615,56 +616,56 @@
|
|
|
},
|
|
|
checkBrand: function () {
|
|
|
// this.MaterielItem.brand = this.MaterielItem.brand && this.MaterielItem.brand !== ''
|
|
|
- if (!this.MaterielItem.brand || this.MaterielItem.brand === '') {
|
|
|
+ if (!this.MaterielItem.pbranden || this.MaterielItem.pbranden === '') {
|
|
|
this.setRemindText('品牌不能为空')
|
|
|
}
|
|
|
- return this.MaterielItem.brand
|
|
|
+ return this.MaterielItem.pbranden
|
|
|
},
|
|
|
checkCode: function () {
|
|
|
- if (!this.MaterielItem.cmpCode || this.MaterielItem.cmpCode === '') {
|
|
|
+ if (!this.MaterielItem.pcmpcode || this.MaterielItem.pcmpcode === '') {
|
|
|
this.setRemindText('型号不能为空')
|
|
|
}
|
|
|
- return this.MaterielItem.cmpCode
|
|
|
+ return this.MaterielItem.pcmpcode
|
|
|
},
|
|
|
onCodeChange: function () {
|
|
|
- this.MaterielItem.cmpCode = this.MaterielItem.cmpCode.trim()
|
|
|
- if ((/[^\x00-\xff]/g).test(this.MaterielItem.cmpCode)) {
|
|
|
+ this.MaterielItem.pcmpcode = this.MaterielItem.pcmpcode.trim()
|
|
|
+ if ((/[^\x00-\xff]/g).test(this.MaterielItem.pcmpcode)) {
|
|
|
let chineseIndex = -1
|
|
|
- for (let i = 0; i < this.MaterielItem.cmpCode.length; i++) {
|
|
|
- if ((/[^\x00-\xff]/g).test(this.MaterielItem.cmpCode.charAt(i))) {
|
|
|
+ for (let i = 0; i < this.MaterielItem.pcmpcode.length; i++) {
|
|
|
+ if ((/[^\x00-\xff]/g).test(this.MaterielItem.pcmpcode.charAt(i))) {
|
|
|
chineseIndex = i
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
- this.MaterielItem.cmpCode = this.baseUtils.cutOutString(this.MaterielItem.cmpCode, chineseIndex)
|
|
|
- } else if (this.MaterielItem.cmpCode && this.baseUtils.getRealLen(this.MaterielItem.cmpCode) > 100) {
|
|
|
- this.MaterielItem.cmpCode = this.baseUtils.cutOutString(this.MaterielItem.cmpCode, 100)
|
|
|
+ this.MaterielItem.pcmpcode = this.baseUtils.cutOutString(this.MaterielItem.pcmpcode, chineseIndex)
|
|
|
+ } else if (this.MaterielItem.pcmpcode && this.baseUtils.getRealLen(this.MaterielItem.pcmpcode) > 100) {
|
|
|
+ this.MaterielItem.pcmpcode = this.baseUtils.cutOutString(this.MaterielItem.pcmpcode, 100)
|
|
|
} else {
|
|
|
this.getSimilarCode()
|
|
|
}
|
|
|
},
|
|
|
onBrandChange: function () {
|
|
|
- this.MaterielItem.brand = this.MaterielItem.brand.trim()
|
|
|
- if ((/[^\x00-\xff]/g).test(this.MaterielItem.brand)) {
|
|
|
+ this.MaterielItem.pbranden = this.MaterielItem.pbranden.trim()
|
|
|
+ if ((/[^\x00-\xff]/g).test(this.MaterielItem.pbranden)) {
|
|
|
let chineseIndex = -1
|
|
|
- for (let i = 0; i < this.MaterielItem.brand.length; i++) {
|
|
|
- if ((/[^\x00-\xff]/g).test(this.MaterielItem.brand.charAt(i)) && !(/[\u4e00-\u9fa5]/).test(this.MaterielItem.brand.charAt(i))) {
|
|
|
+ for (let i = 0; i < this.MaterielItem.pbranden.length; i++) {
|
|
|
+ if ((/[^\x00-\xff]/g).test(this.MaterielItem.pbranden.charAt(i)) && !(/[\u4e00-\u9fa5]/).test(this.MaterielItem.pbranden.charAt(i))) {
|
|
|
chineseIndex = i
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
if (chineseIndex > -1) {
|
|
|
- this.MaterielItem.brand = this.MaterielItem.brand.substring(0, chineseIndex)
|
|
|
+ this.MaterielItem.pbranden = this.MaterielItem.pbranden.substring(0, chineseIndex)
|
|
|
}
|
|
|
- } else if (this.MaterielItem.brand && this.baseUtils.getRealLen(this.MaterielItem.brand) > 50) {
|
|
|
- this.MaterielItem.brand = this.baseUtils.cutOutString(this.MaterielItem.brand, 50)
|
|
|
+ } else if (this.MaterielItem.pbranden && this.baseUtils.getRealLen(this.MaterielItem.pbranden) > 50) {
|
|
|
+ this.MaterielItem.pbranden = this.baseUtils.cutOutString(this.MaterielItem.pbranden, 50)
|
|
|
} else {
|
|
|
this.getSimilarBrand()
|
|
|
}
|
|
|
},
|
|
|
getSimilarBrand: function () {
|
|
|
- if (this.MaterielItem.brand) {
|
|
|
- this.$http.get('/search/similarBrands', {params: {keyword: this.MaterielItem.brand}})
|
|
|
+ if (this.MaterielItem.pbranden) {
|
|
|
+ this.$http.get('/search/similarBrands', {params: {keyword: this.MaterielItem.pbranden}})
|
|
|
.then(response => {
|
|
|
this.similarBrand = response.data
|
|
|
this.showSimilarBrandList = response.data.length > 0
|
|
|
@@ -674,8 +675,8 @@
|
|
|
}
|
|
|
},
|
|
|
getSimilarCode: function () {
|
|
|
- if (this.MaterielItem.cmpCode) {
|
|
|
- this.$http.get('/search/similarComponents', {params: {keyword: this.MaterielItem.cmpCode}})
|
|
|
+ if (this.MaterielItem.pcmpcode) {
|
|
|
+ this.$http.get('/search/similarComponents', {params: {keyword: this.MaterielItem.pcmpcode}})
|
|
|
.then(response => {
|
|
|
this.similarCode = response.data
|
|
|
this.showSimilarCodeList = response.data.length > 0
|
|
|
@@ -685,11 +686,11 @@
|
|
|
}
|
|
|
},
|
|
|
setCode: function (code) {
|
|
|
- this.MaterielItem.cmpCode = code
|
|
|
+ this.MaterielItem.pcmpcode = code
|
|
|
this.showSimilarCodeList = false
|
|
|
},
|
|
|
setBrand: function (brand) {
|
|
|
- this.MaterielItem.brand = brand
|
|
|
+ this.MaterielItem.pbranden = brand
|
|
|
this.showSimilarBrandList = false
|
|
|
},
|
|
|
setRemindText: function (str) {
|
|
|
@@ -719,24 +720,33 @@
|
|
|
this.showMateriel = false
|
|
|
return
|
|
|
}
|
|
|
- if (this.MaterielItem.brand === '') {
|
|
|
+ if (this.MaterielItem.pbranden === '') {
|
|
|
this.setRemindText('品牌不能为空')
|
|
|
return
|
|
|
} else if (this.MaterielItem.kind === '') {
|
|
|
this.setRemindText('类目不能为空')
|
|
|
return
|
|
|
- } else if (this.MaterielItem.cmpCode === '') {
|
|
|
+ } else if (this.MaterielItem.pcmpcode === '') {
|
|
|
this.setRemindText('型号不能为空')
|
|
|
return
|
|
|
}
|
|
|
- this.MaterielItem.pcmpcode = this.MaterielItem.cmpCode
|
|
|
- this.MaterielItem.pbranden = this.MaterielItem.brand
|
|
|
- this.MaterielItem.pbranden = this.MaterielItem.brand
|
|
|
- this.$http.post('/trade/products/update/product', this.MaterielItem).then(res => {
|
|
|
+ this.MaterielItem.pcmpcode = this.MaterielItem.pcmpcode
|
|
|
+ this.MaterielItem.pbranden = this.MaterielItem.pbranden
|
|
|
+ let item = {
|
|
|
+ id: this.MaterielItem.id,
|
|
|
+ kind : this.MaterielItem.kind,
|
|
|
+ pbranden: this.MaterielItem.pbranden,
|
|
|
+ pcmpcode: this.MaterielItem.pcmpcode,
|
|
|
+ spec: this.MaterielItem.spec,
|
|
|
+ url: ''
|
|
|
+ }
|
|
|
+ this.$http.post('/trade/products/update/product?attachUrl=', item).then(res => {
|
|
|
if (res.data.success) {
|
|
|
this.setRemindText('修改成功')
|
|
|
this.showMateriel = false
|
|
|
this.page = 1
|
|
|
+ this.GetEnterpriseListData = null
|
|
|
+ this.GetEnterpriseListData = []
|
|
|
this.getResourceProvidor()
|
|
|
} else {
|
|
|
this.setRemindText(res.data.message)
|