index_back.vue 8.6 KB

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