|
@@ -1,25 +1,24 @@
|
|
|
<template>
|
|
|
+ <!-- multiple
|
|
|
+ filterable
|
|
|
+ remote
|
|
|
+ :multiple-limit="1" :remote-method="remoteMethod" -->
|
|
|
<el-select
|
|
|
v-model="value"
|
|
|
- multiple
|
|
|
filterable
|
|
|
- remote
|
|
|
- :multiple-limit="1"
|
|
|
reserve-keyword
|
|
|
:size="size || 'medium'"
|
|
|
style="width: 100%"
|
|
|
:placeholder="placeholder || ''"
|
|
|
:disabled="disabled"
|
|
|
- :remote-method="remoteMethod"
|
|
|
:loading="selectLoading"
|
|
|
@change="selectChange"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="(item, index) in options"
|
|
|
- :key="item.id + index"
|
|
|
- :label="item.name"
|
|
|
- :value="item.wsm_code"
|
|
|
- :disabled="item.status === '0'"
|
|
|
+ :key="item.type + index + 'spec'"
|
|
|
+ :label="item.type_cn"
|
|
|
+ :value="item.type"
|
|
|
>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
@@ -58,11 +57,16 @@ export default {
|
|
|
options: [],
|
|
|
selectLoading: false,
|
|
|
searchName: "",
|
|
|
- formValue: {},
|
|
|
+ formValue: {
|
|
|
+ start: "",
|
|
|
+ end: "",
|
|
|
+ creater: "",
|
|
|
+ status: "",
|
|
|
+ type_cn: "",
|
|
|
+ },
|
|
|
};
|
|
|
},
|
|
|
- // watch: {
|
|
|
-
|
|
|
+ watch: {
|
|
|
// names: function (val, old) {
|
|
|
// // console.log(val, old);
|
|
|
// this.searchName = val;
|
|
@@ -70,48 +74,41 @@ export default {
|
|
|
// this.remoteMethod(this.searchName);
|
|
|
// }
|
|
|
// },
|
|
|
- // },
|
|
|
+ },
|
|
|
mounted() {
|
|
|
this.options = [];
|
|
|
this.selectLoading = false;
|
|
|
+ this.remoteMethod();
|
|
|
},
|
|
|
methods: {
|
|
|
async selectChange(e) {
|
|
|
- if (e && e.length > 0) {
|
|
|
- let index = this.options.findIndex((v) => v.wsm_code === e[0]);
|
|
|
- if (index !== -1) {
|
|
|
- let model = {
|
|
|
- id: this.options[index].id,
|
|
|
- code: this.options[index].type,
|
|
|
- label: this.options[index].type_cn,
|
|
|
- };
|
|
|
- this.$emit("searchChange", model);
|
|
|
- } else {
|
|
|
- this.$emit("searchChange", {});
|
|
|
- }
|
|
|
+ let index = this.options.findIndex((v) => v.type === e);
|
|
|
+ if (index !== -1) {
|
|
|
+ let model = {
|
|
|
+ id: this.options[index].type,
|
|
|
+ code: this.options[index].type,
|
|
|
+ label: this.options[index].type_cn,
|
|
|
+ };
|
|
|
+ this.$emit("searchChange", model);
|
|
|
} else {
|
|
|
this.$emit("searchChange", {});
|
|
|
}
|
|
|
},
|
|
|
- async remoteMethod(query) {
|
|
|
+ //query
|
|
|
+ async remoteMethod() {
|
|
|
this.selectLoading = true;
|
|
|
- if (query !== "") {
|
|
|
- this.options = [];
|
|
|
- let res = {};
|
|
|
- this.formValue.supplierNo = query;
|
|
|
- res = await asyncRequest.list(this.formValue);
|
|
|
-
|
|
|
- if (res && res.code === 0 && res.data) {
|
|
|
- const { list } = res.data;
|
|
|
- this.options = list;
|
|
|
- } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
- await this.logout();
|
|
|
- } else {
|
|
|
- this.$message.warning(res.message);
|
|
|
- }
|
|
|
+ this.options = [];
|
|
|
+ const { code, data, message } = await asyncRequest.list(this.formValue);
|
|
|
+ if (code === 0) {
|
|
|
+ this.options = data;
|
|
|
+ } else if (code >= 100 && code <= 104) {
|
|
|
+ await this.logout();
|
|
|
} else {
|
|
|
- this.options = [];
|
|
|
+ this.$message.warning(message);
|
|
|
}
|
|
|
+ // } else {
|
|
|
+ // this.options = [];
|
|
|
+ // }
|
|
|
this.selectLoading = false;
|
|
|
},
|
|
|
},
|