|
@@ -6,7 +6,8 @@
|
|
|
<el-form-item label="物料" prop="materialNumber" :rules="[
|
|
|
{ required: true, message: '请选择物料', trigger: 'blur' }
|
|
|
]">
|
|
|
- <el-select v-model="form.materialNumber" placeholder="请选择物料" filterable style="width:100%">
|
|
|
+ <el-select v-model="form.materialNumber" remote reserve-keyword placeholder="请选择物料" filterable
|
|
|
+ style="width:100%" :remote-method="getMaterialListV2Http">
|
|
|
<el-option v-for="(item, index) in selectList" :key="index" :label="item.name + ' - ' + item.specification"
|
|
|
:value="item.number"></el-option>
|
|
|
</el-select>
|
|
@@ -41,7 +42,9 @@ export default {
|
|
|
[
|
|
|
{
|
|
|
name: '新增',
|
|
|
- click: this.openForm
|
|
|
+ click: () => {
|
|
|
+ this.openForm()
|
|
|
+ }
|
|
|
}
|
|
|
]
|
|
|
],
|
|
@@ -105,20 +108,32 @@ export default {
|
|
|
selectionChange(data) {
|
|
|
this.recordSelected = data
|
|
|
},
|
|
|
- openForm() {
|
|
|
+ openForm(text) {
|
|
|
+ this.getMaterialListV2Http(text)
|
|
|
+ this.dialogVisible = true
|
|
|
+ },
|
|
|
+ getMaterialListV2Http(text) {
|
|
|
const loading = this.$loading({
|
|
|
lock: true,
|
|
|
text: '正在打开',
|
|
|
spinner: 'el-icon-loading',
|
|
|
background: 'rgba(0, 0, 0, 0.7)'
|
|
|
})
|
|
|
- getMaterialListV2({ "pageNum": 1, "pageSize": -1, "params": [] }).then(res => {
|
|
|
- this.selectList = res.data.records
|
|
|
- this.dialogVisible = true
|
|
|
- loading.close()
|
|
|
- }).catch(() => {
|
|
|
- loading.close()
|
|
|
- })
|
|
|
+ if (!text) {
|
|
|
+ getMaterialListV2({ "pageNum": 1, "pageSize": 100, "params": [] }).then(res => {
|
|
|
+ this.selectList = res.data.records
|
|
|
+ loading.close()
|
|
|
+ }).catch(() => {
|
|
|
+ loading.close()
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ getMaterialListV2({ "pageNum": 1, "pageSize": -1, "params": [{ "param": "a.specification", "compare": "like", "value": text }] }).then(res => {
|
|
|
+ this.selectList = res.data.records
|
|
|
+ loading.close()
|
|
|
+ }).catch(() => {
|
|
|
+ loading.close()
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
handleClose() {
|
|
|
this.dialogVisible = false
|
|
@@ -141,7 +156,7 @@ export default {
|
|
|
materialNumber: res.data.materialNumber,
|
|
|
costPrice: res.data.costPrice
|
|
|
}
|
|
|
- this.openForm()
|
|
|
+ this.openForm(row.specification)
|
|
|
})
|
|
|
}}
|
|
|
>
|