|
@@ -57,15 +57,15 @@
|
|
|
v-model="item.vendor_id"
|
|
|
:remote-method="($e: any) => queryVenderList($e, index)"
|
|
|
filterable
|
|
|
- allow-create
|
|
|
remote
|
|
|
style="width: 100%"
|
|
|
placeholder="请选择供应商"
|
|
|
@change="($e) => changeVenderSelect($e, index)"
|
|
|
>
|
|
|
+ <!-- allow-create -->
|
|
|
<el-option
|
|
|
- v-for="option in vendorList[index]"
|
|
|
- :key="option.id"
|
|
|
+ v-for="(option, subIndex) in vendorList[index]"
|
|
|
+ :key="option.id || subIndex"
|
|
|
:value="option.id"
|
|
|
:label="option.name"
|
|
|
></el-option>
|
|
@@ -326,7 +326,9 @@
|
|
|
<el-input
|
|
|
v-model="item.product_capacity"
|
|
|
placeholder="请输入容量"
|
|
|
- @input="($e) => inputFilter($e, forms[index], 'product_capacity')"
|
|
|
+ @input="
|
|
|
+ ($e) => inputFilter($e, forms[index], 'product_capacity')
|
|
|
+ "
|
|
|
></el-input>
|
|
|
<div
|
|
|
v-if="index < forms.length - 1"
|
|
@@ -349,7 +351,9 @@
|
|
|
<el-input
|
|
|
v-model="item.product_material"
|
|
|
placeholder="请输入材质"
|
|
|
- @input="($e) => inputFilter($e, forms[index], 'product_material')"
|
|
|
+ @input="
|
|
|
+ ($e) => inputFilter($e, forms[index], 'product_material')
|
|
|
+ "
|
|
|
></el-input>
|
|
|
<div
|
|
|
v-if="index < forms.length - 1"
|
|
@@ -372,7 +376,9 @@
|
|
|
<el-input
|
|
|
v-model="item.product_battery"
|
|
|
placeholder="是否带电池"
|
|
|
- @input="($e) => inputFilter($e, forms[index], 'product_battery')"
|
|
|
+ @input="
|
|
|
+ ($e) => inputFilter($e, forms[index], 'product_battery')
|
|
|
+ "
|
|
|
></el-input>
|
|
|
<div
|
|
|
v-if="index < forms.length - 1"
|
|
@@ -395,7 +401,10 @@
|
|
|
<el-input
|
|
|
v-model="item.product_require_print"
|
|
|
placeholder="请输入要求"
|
|
|
- @input="($e) => inputFilter($e, forms[index], 'product_require_print')"
|
|
|
+ @input="
|
|
|
+ ($e) =>
|
|
|
+ inputFilter($e, forms[index], 'product_require_print')
|
|
|
+ "
|
|
|
></el-input>
|
|
|
<div
|
|
|
v-if="index < forms.length - 1"
|
|
@@ -420,7 +429,9 @@
|
|
|
<el-input
|
|
|
v-model="item.product_color"
|
|
|
placeholder="请输入颜色"
|
|
|
- @input="($e) => inputFilter($e, forms[index], 'product_color')"
|
|
|
+ @input="
|
|
|
+ ($e) => inputFilter($e, forms[index], 'product_color')
|
|
|
+ "
|
|
|
></el-input>
|
|
|
<div
|
|
|
v-if="index < forms.length - 1"
|
|
@@ -443,7 +454,10 @@
|
|
|
<el-input
|
|
|
v-model="item.product_require_color"
|
|
|
placeholder="请输入颜色定制要求"
|
|
|
- @input="($e) => inputFilter($e, forms[index], 'product_require_color')"
|
|
|
+ @input="
|
|
|
+ ($e) =>
|
|
|
+ inputFilter($e, forms[index], 'product_require_color')
|
|
|
+ "
|
|
|
></el-input>
|
|
|
<div
|
|
|
v-if="index < forms.length - 1"
|
|
@@ -470,7 +484,9 @@
|
|
|
placeholder="其他信息"
|
|
|
type="textarea"
|
|
|
:rows="3"
|
|
|
- @input="($e) => inputFilter($e, forms[index], 'product_other')"
|
|
|
+ @input="
|
|
|
+ ($e) => inputFilter($e, forms[index], 'product_other')
|
|
|
+ "
|
|
|
></el-input>
|
|
|
<div
|
|
|
v-if="index < forms.length - 1"
|
|
@@ -1308,17 +1324,32 @@ watch(
|
|
|
show.value = visible > 0
|
|
|
},
|
|
|
)
|
|
|
-const queryVenderList = function (keywords: string, index: number) {
|
|
|
+const queryVenderList = function (keyword: string, index: number) {
|
|
|
+ let keywords = keyword.trim()
|
|
|
+ if (!keywords.length) return
|
|
|
getVendorList({ keywords }).then((response: any) => {
|
|
|
+ const defaultCreateOption = {
|
|
|
+ name: keywords,
|
|
|
+ id: '',
|
|
|
+ }
|
|
|
if (Array.isArray(response.result)) {
|
|
|
+ const tempStr = keywords.replace(/\S_-/g, '').toLowerCase()
|
|
|
+ const tempList = response.result.map((i: any) =>
|
|
|
+ i.name.replace(/\S_-/g, '').toLowerCase(),
|
|
|
+ )
|
|
|
+ let result = []
|
|
|
+ if (response.result.length) {
|
|
|
+ if (tempList.includes(tempStr)) {
|
|
|
+ result = response.result
|
|
|
+ } else {
|
|
|
+ // 结果里面没找到输入的搜索字符串, 就把它加入到结果里面当成‘新增的’
|
|
|
+ result = [cloneDeep(defaultCreateOption)].concat(response.result)
|
|
|
+ }
|
|
|
+ }
|
|
|
if (manualVendor.value.id) {
|
|
|
- vendorList.value.splice(
|
|
|
- index,
|
|
|
- 1,
|
|
|
- [manualVendor.value].concat(response.result || []),
|
|
|
- )
|
|
|
+ vendorList.value.splice(index, 1, [manualVendor.value].concat(result))
|
|
|
} else {
|
|
|
- vendorList.value.splice(index, 1, response.result || [])
|
|
|
+ vendorList.value.splice(index, 1, result)
|
|
|
}
|
|
|
}
|
|
|
})
|