index.vue 9.6 KB

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