index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  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="barcode">
  5. <el-input
  6. v-model="queryParams.barcode"
  7. placeholder="请输入ERP品号"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="仓库id" prop="stockId">
  14. <el-input
  15. v-model="queryParams.stockId"
  16. placeholder="请输入仓库id"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item label="货架编号" prop="locationNo">
  23. <el-input
  24. v-model="queryParams.locationNo"
  25. placeholder="请输入货架编号"
  26. clearable
  27. size="small"
  28. @keyup.enter.native="handleQuery"
  29. />
  30. </el-form-item>
  31. <el-form-item label="栈板号" prop="boxNo">
  32. <el-input
  33. v-model="queryParams.boxNo"
  34. placeholder="请输入栈板号"
  35. clearable
  36. size="small"
  37. @keyup.enter.native="handleQuery"
  38. />
  39. </el-form-item>
  40. <el-form-item>
  41. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  42. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  43. </el-form-item>
  44. </el-form>
  45. <!-- <el-row :gutter="10" class="mb8">-->
  46. <!-- <el-col :span="1.5">-->
  47. <!-- <el-button-->
  48. <!-- type="primary"-->
  49. <!-- plain-->
  50. <!-- icon="el-icon-plus"-->
  51. <!-- size="mini"-->
  52. <!-- @click="handleAdd"-->
  53. <!-- v-hasPermi="['system:barcodes:add']"-->
  54. <!-- >新增</el-button>-->
  55. <!-- </el-col>-->
  56. <!-- <el-col :span="1.5">-->
  57. <!-- <el-button-->
  58. <!-- type="success"-->
  59. <!-- plain-->
  60. <!-- icon="el-icon-edit"-->
  61. <!-- size="mini"-->
  62. <!-- :disabled="single"-->
  63. <!-- @click="handleUpdate"-->
  64. <!-- v-hasPermi="['system:barcodes:edit']"-->
  65. <!-- >修改</el-button>-->
  66. <!-- </el-col>-->
  67. <!-- <el-col :span="1.5">-->
  68. <!-- <el-button-->
  69. <!-- type="danger"-->
  70. <!-- plain-->
  71. <!-- icon="el-icon-delete"-->
  72. <!-- size="mini"-->
  73. <!-- :disabled="multiple"-->
  74. <!-- @click="handleDelete"-->
  75. <!-- v-hasPermi="['system:barcodes:remove']"-->
  76. <!-- >删除</el-button>-->
  77. <!-- </el-col>-->
  78. <!-- <el-col :span="1.5">-->
  79. <!-- <el-button-->
  80. <!-- type="warning"-->
  81. <!-- plain-->
  82. <!-- icon="el-icon-download"-->
  83. <!-- size="mini"-->
  84. <!-- @click="handleExport"-->
  85. <!-- v-hasPermi="['system:skuinv:export']"-->
  86. <!-- >导出</el-button>-->
  87. <!-- </el-col>-->
  88. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  89. </el-row>
  90. <el-table v-loading="loading" :data="barcodesList" @selection-change="handleSelectionChange">
  91. <el-table-column type="selection" width="55" align="center" />
  92. <el-table-column label="ERP品号" align="center" prop="barcode" />
  93. <el-table-column label="仓库id" align="center" prop="stockId" />
  94. <el-table-column label="货架编号" align="center" prop="locationNo" />
  95. <el-table-column label="栈板号" align="center" prop="boxNo" />
  96. <el-table-column label="单位" align="center" prop="userdefine1" />
  97. <el-table-column label="数量" align="center" prop="qty" />
  98. <el-table-column label="产品" align="center" prop="sku" />
  99. <el-table-column label="产品类型" align="center" prop="skuType" />
  100. <!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">-->
  101. <!-- <template slot-scope="scope">-->
  102. <!-- <el-button-->
  103. <!-- size="mini"-->
  104. <!-- type="text"-->
  105. <!-- icon="el-icon-edit"-->
  106. <!-- @click="handleUpdate(scope.row)"-->
  107. <!-- v-hasPermi="['system:barcodesinv:edit']"-->
  108. <!-- >修改</el-button>-->
  109. <!-- <el-button-->
  110. <!-- size="mini"-->
  111. <!-- type="text"-->
  112. <!-- icon="el-icon-delete"-->
  113. <!-- @click="handleDelete(scope.row)"-->
  114. <!-- v-hasPermi="['system:barcodesinv:remove']"-->
  115. <!-- >删除</el-button>-->
  116. <!-- </template>-->
  117. <!-- </el-table-column>-->
  118. </el-table>
  119. <pagination
  120. v-show="total>0"
  121. :total="total"
  122. :page.sync="queryParams.pageNum"
  123. :limit.sync="queryParams.pageSize"
  124. @pagination="getList"
  125. />
  126. <!-- 添加或修改条码扫描记录表对话框 -->
  127. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  128. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  129. <el-form-item label="ERP品号" prop="barcode">
  130. <el-input v-model="form.barcode" placeholder="请输入ERP品号" />
  131. </el-form-item>
  132. <el-form-item label="仓库id" prop="stockId">
  133. <el-input v-model="form.stockId" placeholder="请输入仓库id" />
  134. </el-form-item>
  135. <el-form-item label="货架编号" prop="locationNo">
  136. <el-input v-model="form.locationNo" placeholder="请输入货架编号" />
  137. </el-form-item>
  138. <el-form-item label="栈板号" prop="boxNo">
  139. <el-input v-model="form.boxNo" placeholder="请输入栈板号" />
  140. </el-form-item>
  141. <el-form-item label="单位" prop="lotnum">
  142. <el-input v-model="form.lotnum" 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>
  148. <div slot="footer" class="dialog-footer">
  149. <el-button type="primary" @click="submitForm">确 定</el-button>
  150. <el-button @click="cancel">取 消</el-button>
  151. </div>
  152. </el-dialog>
  153. </div>
  154. </template>
  155. <script>
  156. import { listBarcodes, getBarcodes, delBarcodes, addBarcodes, updateBarcodes } from "@/api/erp/skuinv";
  157. export default {
  158. name: "Barcodes",
  159. data() {
  160. return {
  161. // 遮罩层
  162. loading: true,
  163. // 选中数组
  164. ids: [],
  165. // 非单个禁用
  166. single: true,
  167. // 非多个禁用
  168. multiple: true,
  169. // 显示搜索条件
  170. showSearch: true,
  171. // 总条数
  172. total: 0,
  173. // 条码扫描记录表表格数据
  174. barcodesList: [],
  175. // 弹出层标题
  176. title: "",
  177. // 是否显示弹出层
  178. open: false,
  179. // 查询参数
  180. queryParams: {
  181. pageNum: 1,
  182. pageSize: 10,
  183. barcode: null,
  184. stockId: null,
  185. locationNo: null,
  186. boxNo: null,
  187. lotnum: null,
  188. userdefine1: null,
  189. qty: null,
  190. sku: null,
  191. skuType: null,
  192. type: null,
  193. erpNo: null,
  194. erpName: null,
  195. erpType: null
  196. },
  197. // 表单参数
  198. form: {},
  199. // 表单校验
  200. rules: {
  201. createTime: [
  202. { required: true, message: "$comment不能为空", trigger: "blur" }
  203. ],
  204. }
  205. };
  206. },
  207. created() {
  208. this.getList();
  209. },
  210. methods: {
  211. /** 查询条码扫描记录表列表 */
  212. getList() {
  213. this.loading = true;
  214. listBarcodes(this.queryParams).then(response => {
  215. this.barcodesList = response.rows;
  216. this.total = response.total;
  217. this.loading = false;
  218. });
  219. },
  220. // 取消按钮
  221. cancel() {
  222. this.open = false;
  223. this.reset();
  224. },
  225. // 表单重置
  226. reset() {
  227. this.form = {
  228. id: null,
  229. barcode: null,
  230. stockId: null,
  231. locationNo: null,
  232. boxNo: null,
  233. lotnum: null,
  234. userdefine1: null,
  235. qty: null,
  236. type: null,
  237. erpNo: null,
  238. erpName: null,
  239. erpType: null,
  240. createTime: null,
  241. createBy: null,
  242. updateTime: null,
  243. updateBy: null
  244. };
  245. this.resetForm("form");
  246. },
  247. /** 搜索按钮操作 */
  248. handleQuery() {
  249. this.queryParams.pageNum = 1;
  250. this.getList();
  251. },
  252. /** 重置按钮操作 */
  253. resetQuery() {
  254. this.resetForm("queryForm");
  255. this.handleQuery();
  256. },
  257. // 多选框选中数据
  258. handleSelectionChange(selection) {
  259. this.ids = selection.map(item => item.id)
  260. this.single = selection.length!==1
  261. this.multiple = !selection.length
  262. },
  263. /** 新增按钮操作 */
  264. handleAdd() {
  265. this.reset();
  266. this.open = true;
  267. this.title = "添加条码扫描记录表";
  268. },
  269. /** 修改按钮操作 */
  270. handleUpdate(row) {
  271. this.reset();
  272. const id = row.id || this.ids
  273. getBarcodes(id).then(response => {
  274. this.form = response.data;
  275. this.open = true;
  276. this.title = "修改条码扫描记录表";
  277. });
  278. },
  279. /** 提交按钮 */
  280. submitForm() {
  281. this.$refs["form"].validate(valid => {
  282. if (valid) {
  283. if (this.form.id != null) {
  284. updateBarcodes(this.form).then(response => {
  285. this.$modal.msgSuccess("修改成功");
  286. this.open = false;
  287. this.getList();
  288. });
  289. } else {
  290. addBarcodes(this.form).then(response => {
  291. this.$modal.msgSuccess("新增成功");
  292. this.open = false;
  293. this.getList();
  294. });
  295. }
  296. }
  297. });
  298. },
  299. /** 删除按钮操作 */
  300. handleDelete(row) {
  301. const ids = row.id || this.ids;
  302. this.$modal.confirm('是否确认删除条码扫描记录表编号为"' + ids + '"的数据项?').then(function() {
  303. return delBarcodes(ids);
  304. }).then(() => {
  305. this.getList();
  306. this.$modal.msgSuccess("删除成功");
  307. }).catch(() => {});
  308. },
  309. /** 导出按钮操作 */
  310. handleExport() {
  311. this.download('system/skuinv/export', {
  312. ...this.queryParams
  313. }, `barcodes_${new Date().getTime()}.xlsx`)
  314. }
  315. }
  316. };
  317. </script>