123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <template>
- <div
- class="stockSearch"
- style="display: inline-block; width: 200px; padding-left: 10px"
- >
- {{ stockName }}
- <div class="block">
- <!-- <el-cascader
- style="width: 400px"
- :options="options"
- v-model="value"
- collapse-tags
- :props="{ multiple: true, checkStrictly: false }"
- clearable
- filterable
- @change="a"
- ></el-cascader> -->
- <el-select
- :size="searchSize"
- v-model="value"
- multiple
- filterable
- remote
- :disabled="companyName === ''"
- reserve-keyword
- placeholder="请选择仓库"
- :remote-method="remoteMethod"
- :loading="loading"
- @change="a"
- >
- <el-option
- v-for="item in options"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </div>
- </div>
- </template>
- <script>
- import { mapGetters } from "vuex";
- export default {
- data() {
- return {
- company_name: "",
- options: [],
- value: [],
- list: [],
- states: [],
- };
- },
- mounted() {
- this.list = this.states.map((item) => {
- return { value: `value:${item}`, label: `label:${item}` };
- });
- },
- watch: {
- companyName: "nameChange",
- },
- computed: {
- ...mapGetters(["searchSize"]),
- },
- props: ["options", "companyName", "stockName"],
- methods: {
- nameChange() {
- console.log("选择了其他公司");
- this.value = "";
- // console.log(this.value);
- console.log(this.stockName);
- this.options = this.stockName;
- },
- a() {
- console.log("选择了一个仓库");
- this.$emit("searchCard");
- this.company_name = this.companyName;
- // console.log(this.companyName);
- // console.log(this.company_name);
- // console.log(this.value);
- },
- remoteMethod(query) {
- if (query !== "") {
- this.loading = true;
- console.log(this.options);
- // setTimeout(() => {
- // this.loading = false;
- // this.options = this.list.filter((item) => {
- // return item.label.toLowerCase().indexOf(query.toLowerCase()) > -1;
- // });
- // }, 200);
- } else {
- this.options = [];
- }
- },
- },
- };
- </script>
- <style>
- </style>
|