1
This commit is contained in:
@@ -14,23 +14,19 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="型号" required>
|
<el-form-item label="型号" required>
|
||||||
<el-select
|
<el-autocomplete
|
||||||
v-model="form.model"
|
v-model="form.model"
|
||||||
class="model-select-full"
|
class="model-input-full"
|
||||||
filterable
|
:fetch-suggestions="queryModels"
|
||||||
allow-create
|
placeholder="可输入、可改;点选联想项会带出最近一单付款 / 后返"
|
||||||
default-first-option
|
|
||||||
clearable
|
clearable
|
||||||
placeholder="必选或输入新型号;从历史单选时将带出最近一单付款 / 后返"
|
:trigger-on-focus="true"
|
||||||
@change="onModelChange"
|
@select="onModelSuggestionSelect"
|
||||||
>
|
>
|
||||||
<el-option
|
<template slot-scope="{ item }">
|
||||||
v-for="item in modelOptions"
|
<span class="model-suggest-label">{{ item.label }}</span>
|
||||||
:key="item.modelNumber"
|
</template>
|
||||||
:label="modelOptionLabel(item)"
|
</el-autocomplete>
|
||||||
:value="item.modelNumber"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="下单地址" required>
|
<el-form-item label="下单地址" required>
|
||||||
<el-input
|
<el-input
|
||||||
@@ -196,9 +192,27 @@ export default {
|
|||||||
// 静默失败,不影响手输型号
|
// 静默失败,不影响手输型号
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onModelChange(val) {
|
queryModels(queryString, cb) {
|
||||||
const key = (val != null ? String(val) : '').trim()
|
const q = (queryString || '').trim().toLowerCase()
|
||||||
if (!key) return
|
const rows = this.modelOptions
|
||||||
|
.filter(o => {
|
||||||
|
const m = String(o.modelNumber || '').trim()
|
||||||
|
if (!m) return false
|
||||||
|
if (!q) return true
|
||||||
|
return m.toLowerCase().includes(q)
|
||||||
|
})
|
||||||
|
.slice(0, 100)
|
||||||
|
cb(
|
||||||
|
rows.map(o => ({
|
||||||
|
value: String(o.modelNumber).trim(),
|
||||||
|
label: this.modelOptionLabel(o)
|
||||||
|
}))
|
||||||
|
)
|
||||||
|
},
|
||||||
|
/** 仅从联想列表点选时回填金额;型号本身为输入框,选后仍可继续编辑 */
|
||||||
|
onModelSuggestionSelect(item) {
|
||||||
|
if (!item || !item.value) return
|
||||||
|
const key = String(item.value).trim()
|
||||||
const hit = this.modelOptions.find(o => o && String(o.modelNumber || '').trim() === key)
|
const hit = this.modelOptions.find(o => o && String(o.modelNumber || '').trim() === key)
|
||||||
if (!hit) return
|
if (!hit) return
|
||||||
const payRaw = hit.lastPaymentAmount
|
const payRaw = hit.lastPaymentAmount
|
||||||
@@ -499,13 +513,15 @@ export default {
|
|||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.model-select-full {
|
.model-input-full {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.model-select-full ::v-deep .el-input__inner,
|
.model-suggest-label {
|
||||||
.model-select-full ::v-deep .el-input__prefix {
|
display: block;
|
||||||
line-height: normal;
|
line-height: 1.45;
|
||||||
|
white-space: normal;
|
||||||
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-row {
|
.btn-row {
|
||||||
|
|||||||
Reference in New Issue
Block a user