index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="仓库" prop="warehouseId">
  5. <el-select v-model="queryParams.warehouseId" placeholder="请选择所属仓库" clearable size="small" style="width: 100%">
  6. <el-option
  7. v-for="dict in this.warehouseCombo"
  8. :key="dict.warehouseId"
  9. :label="dict.warehouseName"
  10. :value="dict.warehouseId"
  11. />
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="区域" prop="zoneId">
  15. <el-select v-model="queryParams.zoneId" placeholder="请选择库区" clearable size="small" style="width: 100%">
  16. <el-option
  17. v-for="dict in this.locationZoneCombo"
  18. :key="dict.zoneId"
  19. :label="dict.zoneName"
  20. :value="dict.zoneId"
  21. />
  22. </el-select>
  23. </el-form-item>
  24. <el-form-item>
  25. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  26. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  27. </el-form-item>
  28. </el-form>
  29. <el-row>
  30. <right-toolbar :showSearch.sync="showSearch" @queryTable="init"></right-toolbar>
  31. </el-row>
  32. <div style="overflow-scrolling: auto">
  33. <ul class="wall-row"
  34. :style="{'width':(this.tableAttr.cols * 130)+'px', 'height':(this.tableAttr.rows * 80) + 'px'}">
  35. <li
  36. v-for="(item, index) in divList"
  37. :key="index"
  38. @click="selected(item)">
  39. <div v-if="!item.locationNo" style="background-color: #fff;"><!--空格没有的库位--></div>
  40. <div class="div" v-else-if="item.stockStatus === '10'" style="background-color: yellow">
  41. <div style="text-align: center;font-weight: bold;">{{item.locationNo}}</div>
  42. </div>
  43. <div class="div" v-else style="background-color: #ebf0f4">
  44. <div style="text-align: center;font-weight: bold;">{{item.locationNo}}</div>
  45. <div v-if="item.sku">物料:{{item.sku}}</div>
  46. <div v-if="item.sku">数量:{{item.qty}}</div>
  47. </div>
  48. </li>
  49. </ul>
  50. </div>
  51. <el-dialog title="操作" :visible.sync="open" width="500px" append-to-body>
  52. <el-form>
  53. <el-form-item>
  54. <el-button type="primary" @click="lockLoc()">锁定/解锁</el-button>
  55. <!--<el-button type="primary" @click="occupyLoc()">占用</el-button>-->
  56. <el-button type="primary" @click="clearLoc()">清空</el-button>
  57. <!--<el-button type="primary" @click="submitForm">初始化一个空托盘</el-button>-->
  58. </el-form-item>
  59. </el-form>
  60. </el-dialog>
  61. </div>
  62. </template>
  63. <script>
  64. import { locationView, lockLocRequest, occupyLocRequest, clearLocRequest } from "@/api/ams/locationView";
  65. import { queryLocationZoneDict } from "@/api/base/locationZone";
  66. import { queryWarehouseDict } from "@/api/base/warehouse";
  67. export default {
  68. name: "LocationView",
  69. data() {
  70. return {
  71. divList: [],
  72. // 遮罩层
  73. loading: true,
  74. showSearch: true,
  75. open: false,
  76. // 查询参数
  77. queryParams: {
  78. zoneId: 2,
  79. warehouseId: 1
  80. },
  81. // 表单参数
  82. form: {},
  83. // 表单校验
  84. rules: {},
  85. tableAttr: {
  86. rows: 3,
  87. cols: 3
  88. },
  89. currentSelect: null,
  90. locationZoneCombo: [],
  91. warehouseCombo: []
  92. };
  93. },
  94. created() {
  95. this.init();
  96. this.search();
  97. },
  98. methods: {
  99. init() {
  100. queryWarehouseDict().then(response => {
  101. this.warehouseCombo = response.data
  102. });
  103. queryLocationZoneDict().then(response => {
  104. this.locationZoneCombo = response.data
  105. });
  106. },
  107. search() {
  108. locationView(this.queryParams).then(response => {
  109. let data = response.data
  110. this.tableAttr.rows = data.rows
  111. this.tableAttr.cols = data.cols
  112. this.divList = data.locationViewInfoVOList
  113. })
  114. },
  115. selected(item) {
  116. console.log(item)
  117. if (item.locationNo) {
  118. this.currentSelect = parseInt(item.id)
  119. this.open = true;
  120. }
  121. },
  122. handleQuery() {
  123. this.search()
  124. },
  125. resetQuery() {
  126. this.resetForm("queryForm");
  127. this.handleQuery();
  128. },
  129. lockLoc() {
  130. lockLocRequest(this.currentSelect).then(response => {
  131. this.$modal.msgSuccess(response.msg);
  132. this.search();
  133. });
  134. },
  135. occupyLoc() {
  136. occupyLocRequest(this.currentSelect).then(response => {
  137. this.$modal.msgSuccess(response.msg);
  138. this.init()
  139. });
  140. },
  141. clearLoc() {
  142. clearLocRequest(this.currentSelect).then(response => {
  143. this.$modal.msgSuccess(response.msg);
  144. this.init()
  145. });
  146. }
  147. }
  148. };
  149. </script>
  150. <style scoped lang="css">
  151. .word span {
  152. line-height: 20px;
  153. text-align: center;
  154. }
  155. .wall-row {
  156. padding: 0;
  157. margin: 0;
  158. display: block;
  159. position: relative;
  160. }
  161. .wall-row li {
  162. list-style: none;
  163. width: 130px;
  164. height: 80px;
  165. border: 0.5px solid #fff;
  166. float: left;
  167. }
  168. .div {
  169. width:130px;
  170. height:80px;
  171. font-weight: bold;
  172. }
  173. </style>