index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  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="sku">
  5. <el-input
  6. v-model="queryParams.sku"
  7. placeholder="请输入物料"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="库位" prop="locationNo">
  14. <el-input
  15. v-model="queryParams.locationNo"
  16. placeholder="请输入库位编号"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item>
  23. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  24. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  25. </el-form-item>
  26. </el-form>
  27. <el-row :gutter="10" class="mb8">
  28. <el-col :span="1.5">
  29. <el-button
  30. type="primary"
  31. plain
  32. icon="el-icon-plus"
  33. size="mini"
  34. @click="handleAdj"
  35. v-hasPermi="['ams:invLotLocId:adj']"
  36. >库存调整
  37. </el-button>
  38. </el-col>
  39. <el-col :span="1.5">
  40. <el-button
  41. type="success"
  42. plain
  43. icon="el-icon-edit"
  44. size="mini"
  45. @click="handleMove"
  46. v-hasPermi="['ams:invLotLocId:move']"
  47. >库存移动
  48. </el-button>
  49. </el-col>
  50. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  51. </el-row>
  52. <!--<el-row :gutter="10" class="mb8">
  53. <el-col :span="1.5">
  54. <el-button
  55. type="primary"
  56. plain
  57. icon="el-icon-plus"
  58. size="mini"
  59. @click="handleAdd"
  60. v-hasPermi="['ams:invLotLocId:add']"
  61. >新增</el-button>
  62. </el-col>
  63. <el-col :span="1.5">
  64. <el-button
  65. type="success"
  66. plain
  67. icon="el-icon-edit"
  68. size="mini"
  69. :disabled="single"
  70. @click="handleUpdate"
  71. v-hasPermi="['ams:invLotLocId:edit']"
  72. >修改</el-button>
  73. </el-col>
  74. <el-col :span="1.5">
  75. <el-button
  76. type="danger"
  77. plain
  78. icon="el-icon-delete"
  79. size="mini"
  80. :disabled="multiple"
  81. @click="handleDelete"
  82. v-hasPermi="['ams:invLotLocId:remove']"
  83. >删除</el-button>
  84. </el-col>
  85. <el-col :span="1.5">
  86. <el-button
  87. type="warning"
  88. plain
  89. icon="el-icon-download"
  90. size="mini"
  91. @click="handleExport"
  92. v-hasPermi="['ams:invLotLocId:export']"
  93. >导出</el-button>
  94. </el-col>
  95. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  96. </el-row>-->
  97. <el-table v-loading="loading" :data="invLotLocIdList" @selection-change="handleSelectionChange">
  98. <!--<el-table-column label="lotnum" align="center" prop="lotnum" width="200"/>-->
  99. <el-table-column type="selection" />
  100. <el-table-column label="物料" align="center" prop="sku" width="200"/>
  101. <el-table-column label="物料名称" align="center" prop="skuName" width="200"/>
  102. <el-table-column label="库位" align="center" prop="locationNo" width="200"/>
  103. <el-table-column label="库存数量" align="center" prop="qty"/>
  104. <el-table-column label="已分配数量" align="center" prop="qtyallocated" width="200"/>
  105. <el-table-column
  106. v-for="(item, index) in tableOption"
  107. :key="index"
  108. :label="item.label"
  109. align="center" :prop="item.prop" width="200">
  110. </el-table-column>
  111. <el-table-column label="备注" align="center" prop="remark" />
  112. <!--<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  113. <template slot-scope="scope">
  114. <el-button
  115. size="mini"
  116. type="text"
  117. icon="el-icon-edit"
  118. @click="handleUpdate(scope.row)"
  119. v-hasPermi="['ams:invLotLocId:edit']"
  120. >修改</el-button>
  121. <el-button
  122. size="mini"
  123. type="text"
  124. icon="el-icon-delete"
  125. @click="handleDelete(scope.row)"
  126. v-hasPermi="['ams:invLotLocId:remove']"
  127. >删除</el-button>
  128. </template>
  129. </el-table-column>-->
  130. </el-table>
  131. <pagination
  132. v-show="total>0"
  133. :total="total"
  134. :page.sync="queryParams.pageNum"
  135. :limit.sync="queryParams.pageSize"
  136. @pagination="getList"
  137. />
  138. <!-- 添加或修改库位库存信息对话框 -->
  139. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  140. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  141. <el-form-item label="跟踪号" prop="traceid">
  142. <el-input v-model="form.traceid" placeholder="请输入跟踪号" />
  143. </el-form-item>
  144. <el-form-item label="库存数量(件)" prop="qty">
  145. <el-input v-model="form.qty" placeholder="请输入库存数量(件)" />
  146. </el-form-item>
  147. <el-form-item label="库存数量" prop="qtyEach">
  148. <el-input v-model="form.qtyEach" placeholder="请输入库存数量" />
  149. </el-form-item>
  150. <el-form-item label="分配数量" prop="qtyallocated">
  151. <el-input v-model="form.qtyallocated" placeholder="请输入分配数量" />
  152. </el-form-item>
  153. <el-form-item label="库存数量(件)" prop="qtyallocatedEach">
  154. <el-input v-model="form.qtyallocatedEach" placeholder="请输入库存数量(件)" />
  155. </el-form-item>
  156. <el-form-item label="上架数量" prop="qtypa">
  157. <el-input v-model="form.qtypa" placeholder="请输入上架数量" />
  158. </el-form-item>
  159. <el-form-item label="${comment}" prop="qtyrpin">
  160. <el-input v-model="form.qtyrpin" placeholder="请输入${comment}" />
  161. </el-form-item>
  162. <el-form-item label="${comment}" prop="qtyrpout">
  163. <el-input v-model="form.qtyrpout" placeholder="请输入${comment}" />
  164. </el-form-item>
  165. <el-form-item label="${comment}" prop="qtymvin">
  166. <el-input v-model="form.qtymvin" placeholder="请输入${comment}" />
  167. </el-form-item>
  168. <el-form-item label="${comment}" prop="qtymvout">
  169. <el-input v-model="form.qtymvout" placeholder="请输入${comment}" />
  170. </el-form-item>
  171. <el-form-item label="${comment}" prop="qtyonhold">
  172. <el-input v-model="form.qtyonhold" placeholder="请输入${comment}" />
  173. </el-form-item>
  174. <el-form-item label="备注" prop="remark">
  175. <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
  176. </el-form-item>
  177. </el-form>
  178. <div slot="footer" class="dialog-footer">
  179. <el-button type="primary" @click="submitForm">确 定</el-button>
  180. <el-button @click="cancel">取 消</el-button>
  181. </div>
  182. </el-dialog>
  183. <!-- 库存调整dialog -->
  184. <adj-dialog ref="adjDialog" @getList="getList()"></adj-dialog>
  185. </div>
  186. </template>
  187. <script>
  188. import { listInvLotLocId, getInvLotLocId, adjInvLotLocId, moveInvLotLocId, delInvLotLocId, addInvLotLocId, updateInvLotLocId } from "@/api/ams/invLotLocId";
  189. import { lotattConfigList } from "@/api/ams/config";
  190. import adjDialog from "@/views/ams/inv/invLotLocId/adjDialog";
  191. export default {
  192. name: "InvLotLocId",
  193. components: { adjDialog },
  194. data() {
  195. return {
  196. // 遮罩层
  197. loading: true,
  198. // 选中数组
  199. ids: [],
  200. // 选中的数据
  201. tableSelection: [],
  202. // 是否勾选
  203. isSelect: false,
  204. // 非单个禁用
  205. single: false,
  206. // 非多个禁用
  207. multiple: false,
  208. // 显示搜索条件
  209. showSearch: true,
  210. // 总条数
  211. total: 0,
  212. // 库位库存信息表格数据
  213. invLotLocIdList: [],
  214. // 弹出层标题
  215. title: "",
  216. // 是否显示弹出层
  217. open: false,
  218. // 查询参数
  219. queryParams: {
  220. pageNum: 1,
  221. pageSize: 10,
  222. sku: null,
  223. locationNo: null
  224. },
  225. // 表单参数
  226. form: {},
  227. // 表单校验
  228. rules: {
  229. },
  230. tableOption: []
  231. };
  232. },
  233. created() {
  234. this.initLotatt();
  235. this.getList();
  236. },
  237. methods: {
  238. initLotatt() {
  239. lotattConfigList().then(response => {
  240. let data = response.data
  241. for(let i=0;i<data.length;i++) {
  242. let obj = new Object();
  243. obj.label = data[i].lotattName
  244. obj.prop = data[i].lotattId
  245. this.tableOption.push(obj)
  246. }
  247. })
  248. },
  249. /** 查询库位库存信息列表 */
  250. getList() {
  251. this.loading = true;
  252. listInvLotLocId(this.queryParams).then(response => {
  253. this.invLotLocIdList = response.rows;
  254. this.total = response.total;
  255. this.loading = false;
  256. });
  257. },
  258. // 取消按钮
  259. cancel() {
  260. this.open = false;
  261. this.reset();
  262. },
  263. // 表单重置
  264. reset() {
  265. this.form = {
  266. lotnum: null,
  267. locationId: null,
  268. traceid: null,
  269. customerId: null,
  270. sku: null,
  271. qty: null,
  272. qtyEach: null,
  273. qtyallocated: null,
  274. qtyallocatedEach: null,
  275. qtypa: null,
  276. qtyrpin: null,
  277. qtyrpout: null,
  278. qtymvin: null,
  279. qtymvout: null,
  280. qtyonhold: null,
  281. createBy: null,
  282. createTime: null,
  283. updateBy: null,
  284. updateTime: null,
  285. remark: null
  286. };
  287. this.resetForm("form");
  288. },
  289. /** 搜索按钮操作 */
  290. handleQuery() {
  291. this.queryParams.pageNum = 1;
  292. this.getList();
  293. },
  294. /** 重置按钮操作 */
  295. resetQuery() {
  296. this.resetForm("queryForm");
  297. this.handleQuery();
  298. },
  299. // 多选框选中数据
  300. handleSelectionChange(selection) {
  301. this.ids = selection.map(item => item.lotnum)
  302. this.tableSelection = selection;
  303. this.isSelect = selection.length > 0;
  304. this.single = selection.length == 1;
  305. this.multiple = selection.length > 1;
  306. },
  307. /** 库存调整操作 */
  308. handleAdj() {
  309. if (!this.isSelect) {
  310. this.$modal.alertWarning("请选择一条!");
  311. return;
  312. }
  313. if (!this.single) {
  314. this.$modal.alertWarning("库存调整只能选择单条!");
  315. return;
  316. }
  317. this.$nextTick(() => {
  318. this.$refs.adjDialog.show(this.tableSelection);
  319. });
  320. },
  321. /** 库存移动操作 */
  322. handleMove() {
  323. },
  324. /** 新增按钮操作 */
  325. handleAdd() {
  326. this.reset();
  327. this.open = true;
  328. this.title = "添加库位库存信息";
  329. },
  330. /** 修改按钮操作 */
  331. handleUpdate(row) {
  332. this.reset();
  333. const lotnum = row.lotnum || this.ids
  334. getInvLotLocId(lotnum).then(response => {
  335. this.form = response.data;
  336. this.open = true;
  337. this.title = "修改库位库存信息";
  338. });
  339. },
  340. /** 提交按钮 */
  341. submitForm() {
  342. this.$refs["form"].validate(valid => {
  343. if (valid) {
  344. if (this.form.lotnum != null) {
  345. updateInvLotLocId(this.form).then(response => {
  346. this.$modal.msgSuccess("修改成功");
  347. this.open = false;
  348. this.getList();
  349. });
  350. } else {
  351. addInvLotLocId(this.form).then(response => {
  352. this.$modal.msgSuccess("新增成功");
  353. this.open = false;
  354. this.getList();
  355. });
  356. }
  357. }
  358. });
  359. },
  360. /** 删除按钮操作 */
  361. handleDelete(row) {
  362. const lotnums = row.lotnum || this.ids;
  363. this.$modal.confirm('是否确认删除库位库存信息编号为"' + lotnums + '"的数据项?').then(function() {
  364. return delInvLotLocId(lotnums);
  365. }).then(() => {
  366. this.getList();
  367. this.$modal.msgSuccess("删除成功");
  368. }).catch(() => {});
  369. },
  370. /** 导出按钮操作 */
  371. handleExport() {
  372. this.download('ams/invLotLocId/export', {
  373. ...this.queryParams
  374. }, `invLotLocId_${new Date().getTime()}.xlsx`)
  375. }
  376. }
  377. };
  378. </script>