index.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  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="search"></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 v-if="item.sku">物料:{{item.sku}}</div>
  43. <div v-if="item.sku">数量:{{item.qty}}</div>
  44. </div>
  45. <div class="div" v-else style="background-color: #ebf0f4">
  46. <div style="text-align: center;font-weight: bold;">{{item.locationNo}}</div>
  47. <div v-if="item.sku">物料:{{item.sku}}</div>
  48. <div v-if="item.sku">数量:{{item.qty}}</div>
  49. </div>
  50. </li>
  51. </ul>
  52. </div>
  53. <el-dialog title="操作" :visible.sync="open" width="800px" append-to-body>
  54. <el-form>
  55. <el-form-item>
  56. <el-button type="primary" @click="lockLoc()">锁定/解锁</el-button>
  57. <!--<el-button type="primary" @click="occupyLoc()">占用</el-button>-->
  58. <el-button type="primary" @click="clearLoc()">清空</el-button>
  59. <!--<el-button type="primary" @click="submitForm">初始化一个空托盘</el-button>-->
  60. </el-form-item>
  61. </el-form>
  62. <el-divider content-position="center">批次属性信息</el-divider>
  63. <el-table v-loading="loading" :data="form.lotattList">
  64. <el-table-column label="物料" align="center" prop="sku" width="200"/>
  65. <el-table-column label="物料名称" align="center" prop="skuName" width="200"/>
  66. <el-table-column label="库位" align="center" prop="locationNo" width="200"/>
  67. <el-table-column label="库存数量" align="center" prop="qty"/>
  68. <el-table-column label="已分配数量" align="center" prop="qtyallocated" width="200"/>
  69. <el-table-column
  70. v-for="(item, index) in itemOption"
  71. :key="index"
  72. :label="item.label"
  73. align="center" :prop="item.prop" width="200">
  74. </el-table-column>
  75. </el-table>
  76. <!--<el-descriptions title="批次属性" :column="2" border>
  77. <el-descriptions-item v-for="(item, index) in itemOption" :label="item.label">{{form[`${item.prop}`]}}</el-descriptions-item>
  78. </el-descriptions>-->
  79. </el-dialog>
  80. </div>
  81. </template>
  82. <script>
  83. import { locationView, lockLocRequest, occupyLocRequest, clearLocRequest } from "@/api/ams/locationView";
  84. import { queryLocationZoneDict } from "@/api/base/locationZone";
  85. import { queryWarehouseDict } from "@/api/base/warehouse";
  86. import { lotattConfigList } from "@/api/ams/config";
  87. import { lotattInfo } from "@/api/ams/invLotLocId";
  88. export default {
  89. name: "LocationView",
  90. data() {
  91. return {
  92. divList: [],
  93. // 遮罩层
  94. loading: true,
  95. showSearch: true,
  96. open: false,
  97. // 查询参数
  98. queryParams: {
  99. zoneId: 2,
  100. warehouseId: 1
  101. },
  102. // 表单参数
  103. form: {
  104. lotatt01: '',
  105. lotatt02: '',
  106. lotatt03: '',
  107. lotatt04: '',
  108. lotatt05: '',
  109. lotatt06: '',
  110. lotatt07: '',
  111. lotatt08: '',
  112. lotatt09: '',
  113. lotatt10: '',
  114. lotatt11: '',
  115. lotatt12: '',
  116. lotatt13: '',
  117. lotatt14: '',
  118. lotatt15: '',
  119. lotatt16: '',
  120. lotatt17: '',
  121. lotatt18: '',
  122. lotattList: null
  123. },
  124. // 表单校验
  125. rules: {},
  126. tableAttr: {
  127. rows: 3,
  128. cols: 3
  129. },
  130. currentSelect: null,
  131. locationZoneCombo: [],
  132. warehouseCombo: [],
  133. itemOption: [],
  134. timer: null // 定时器
  135. };
  136. },
  137. created() {
  138. this.init();
  139. this.search();
  140. this.timer = setInterval(() =>{
  141. this.search();
  142. },1000 * 5)
  143. },
  144. methods: {
  145. init() {
  146. queryWarehouseDict().then(response => {
  147. this.warehouseCombo = response.data
  148. });
  149. queryLocationZoneDict().then(response => {
  150. this.locationZoneCombo = response.data
  151. });
  152. lotattConfigList().then(response => {
  153. let data = response.data
  154. for(let i=0;i<data.length;i++) {
  155. let obj = new Object();
  156. obj.label = data[i].lotattName
  157. obj.prop = data[i].lotattId
  158. this.itemOption.push(obj)
  159. }
  160. })
  161. },
  162. search() {
  163. locationView(this.queryParams).then(response => {
  164. let data = response.data
  165. this.tableAttr.rows = data.rows
  166. this.tableAttr.cols = data.cols
  167. this.divList = data.locationViewInfoVOList
  168. })
  169. },
  170. selected(item) {
  171. if (item.locationNo) {
  172. this.currentSelect = parseInt(item.id)
  173. this.open = true;
  174. lotattInfo(this.currentSelect).then(response => {
  175. this.form.lotattList = response.data
  176. this.loading = false;
  177. })
  178. }
  179. },
  180. handleQuery() {
  181. this.search()
  182. },
  183. resetQuery() {
  184. this.resetForm("queryForm");
  185. this.handleQuery();
  186. },
  187. lockLoc() {
  188. let that = this
  189. this.$modal.confirm('是否确认要锁定').then(function() {
  190. lockLocRequest(that.currentSelect).then(response => {
  191. if (response.code === 200) {
  192. that.$modal.msgSuccess(response.msg);
  193. that.search();
  194. that.open = false
  195. } else {
  196. that.$modal.msgError(response.msg);
  197. }
  198. });
  199. });
  200. },
  201. occupyLoc() {
  202. occupyLocRequest(this.currentSelect).then(response => {
  203. if (response.code === 200) {
  204. this.$modal.msgSuccess(response.msg);
  205. this.search();
  206. this.open = false
  207. } else {
  208. this.$modal.msgError(response.msg);
  209. }
  210. });
  211. },
  212. clearLoc() {
  213. let that = this
  214. this.$modal.confirm('是否确认要清空').then(function() {
  215. clearLocRequest(that.currentSelect).then(response => {
  216. if (response.code === 200) {
  217. that.$modal.msgSuccess(response.msg);
  218. that.search();
  219. that.open = false
  220. } else {
  221. that.$modal.msgError(response.msg);
  222. }
  223. });
  224. });
  225. },
  226. destroyed () {
  227. clearInterval(this.timer)
  228. }
  229. }
  230. };
  231. </script>
  232. <style scoped lang="css">
  233. .word span {
  234. line-height: 20px;
  235. text-align: center;
  236. }
  237. .wall-row {
  238. padding: 0;
  239. margin: 0;
  240. display: block;
  241. position: relative;
  242. }
  243. .wall-row li {
  244. list-style: none;
  245. width: 130px;
  246. height: 80px;
  247. border: 0.5px solid #fff;
  248. float: left;
  249. }
  250. .div {
  251. width:130px;
  252. height:80px;
  253. font-weight: bold;
  254. }
  255. </style>