item-search.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <!-- 搜索表单 -->
  2. <template>
  3. <el-form
  4. label-width="90px"
  5. class="ele-form-search"
  6. @keyup.enter.native="search"
  7. @submit.native.prevent
  8. >
  9. <el-row :gutter="15">
  10. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  11. <el-form-item label="仓库:" prop="warehouseId" label-width="60px">
  12. <template>
  13. <el-select
  14. clearable
  15. style="width: 100%"
  16. v-model="params.warehouseId"
  17. placeholder="请选择"
  18. >
  19. <el-option
  20. v-for="item in warehouseList"
  21. :label="item.name"
  22. :value="item.id"
  23. :key="item.id"
  24. >
  25. </el-option>
  26. </el-select>
  27. </template>
  28. </el-form-item>
  29. </el-col>
  30. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  31. <el-form-item label="列表维度:" prop="dimension">
  32. <template>
  33. <el-select
  34. clearable
  35. @change="$emit('handledime', $event)"
  36. v-model="dimension"
  37. placeholder="请选择"
  38. >
  39. <el-option label="物品维度" value="1"> </el-option>
  40. <el-option label="批次维度" value="2"> </el-option>
  41. </el-select>
  42. </template>
  43. </el-form-item>
  44. </el-col>
  45. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  46. <el-form-item label="物品编码:" prop="code">
  47. <el-input
  48. clearable
  49. placeholder="请输入"
  50. v-model.trim="params.code"
  51. ></el-input>
  52. </el-form-item>
  53. </el-col>
  54. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  55. <el-form-item label="物品名称:" prop="assetName">
  56. <el-input
  57. clearable
  58. v-model="params.assetName"
  59. placeholder="请输入"
  60. ></el-input>
  61. </el-form-item>
  62. </el-col>
  63. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  64. <div class="ele-form-actions">
  65. <el-button
  66. type="primary"
  67. icon="el-icon-search"
  68. class="ele-btn-icon"
  69. @click="search"
  70. size="small"
  71. >
  72. 查询
  73. </el-button>
  74. <el-button
  75. @click="reset"
  76. icon="el-icon-refresh-left"
  77. size="small"
  78. type="primary"
  79. >重置</el-button
  80. >
  81. </div>
  82. </el-col>
  83. </el-row>
  84. </el-form>
  85. </template>
  86. <script>
  87. import { getWarehouseList } from '@/api/classifyManage/itemInformation';
  88. export default {
  89. data() {
  90. // 默认表单数据
  91. const defaultParams = {
  92. informationName: '',
  93. warehouseId: ''
  94. };
  95. return {
  96. // 表单数据
  97. params: { ...defaultParams },
  98. warehouseList: [],
  99. dimension: '1'
  100. };
  101. },
  102. computed: {
  103. // 是否开启响应式布局
  104. styleResponsive() {
  105. return this.$store.state.theme.styleResponsive;
  106. }
  107. },
  108. created() {
  109. this.getArguInfo();
  110. },
  111. methods: {
  112. //搜索数据源
  113. async getArguInfo() {
  114. const { data } = await getWarehouseList();
  115. this.warehouseList = data;
  116. },
  117. /* 搜索 */
  118. search() {
  119. console.log(this.current);
  120. this.$emit('search', {
  121. ...this.params
  122. });
  123. },
  124. /* 重置 */
  125. reset() {
  126. this.params = { ...this.defaultParams };
  127. this.search();
  128. }
  129. }
  130. };
  131. </script>