stockSearch.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <div
  3. class="stockSearch"
  4. style="display: inline-block; width: 200px; padding-left: 10px"
  5. >
  6. {{ stockName }}
  7. <div class="block">
  8. <!-- <el-cascader
  9. style="width: 400px"
  10. :options="options"
  11. v-model="value"
  12. collapse-tags
  13. :props="{ multiple: true, checkStrictly: false }"
  14. clearable
  15. filterable
  16. @change="a"
  17. ></el-cascader> -->
  18. <el-select
  19. :size="searchSize"
  20. v-model="value"
  21. multiple
  22. filterable
  23. remote
  24. :disabled="companyName === ''"
  25. reserve-keyword
  26. placeholder="请选择仓库"
  27. :remote-method="remoteMethod"
  28. :loading="loading"
  29. @change="a"
  30. >
  31. <el-option
  32. v-for="item in options"
  33. :key="item.value"
  34. :label="item.label"
  35. :value="item.value"
  36. >
  37. </el-option>
  38. </el-select>
  39. </div>
  40. </div>
  41. </template>
  42. <script>
  43. import { mapGetters } from "vuex";
  44. export default {
  45. data() {
  46. return {
  47. company_name: "",
  48. options: [],
  49. value: [],
  50. list: [],
  51. states: [],
  52. };
  53. },
  54. mounted() {
  55. this.list = this.states.map((item) => {
  56. return { value: `value:${item}`, label: `label:${item}` };
  57. });
  58. },
  59. watch: {
  60. companyName: "nameChange",
  61. },
  62. computed: {
  63. ...mapGetters(["searchSize"]),
  64. },
  65. props: ["options", "companyName", "stockName"],
  66. methods: {
  67. nameChange() {
  68. console.log("选择了其他公司");
  69. this.value = "";
  70. // console.log(this.value);
  71. console.log(this.stockName);
  72. this.options = this.stockName;
  73. },
  74. a() {
  75. console.log("选择了一个仓库");
  76. this.$emit("searchCard");
  77. this.company_name = this.companyName;
  78. // console.log(this.companyName);
  79. // console.log(this.company_name);
  80. // console.log(this.value);
  81. },
  82. remoteMethod(query) {
  83. if (query !== "") {
  84. this.loading = true;
  85. console.log(this.options);
  86. // setTimeout(() => {
  87. // this.loading = false;
  88. // this.options = this.list.filter((item) => {
  89. // return item.label.toLowerCase().indexOf(query.toLowerCase()) > -1;
  90. // });
  91. // }, 200);
  92. } else {
  93. this.options = [];
  94. }
  95. },
  96. },
  97. };
  98. </script>
  99. <style>
  100. </style>