1
0

index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  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="merchSn">-->
  5. <!-- <el-input-->
  6. <!-- v-model="queryParams.merchSn"-->
  7. <!-- placeholder="请输入商户编号"-->
  8. <!-- clearable-->
  9. <!-- size="small"-->
  10. <!-- @keyup.enter.native="handleQuery"-->
  11. <!-- />-->
  12. <!-- </el-form-item>-->
  13. <!-- <el-form-item label="商户名称" prop="merchName">-->
  14. <!-- <el-input-->
  15. <!-- v-model="queryParams.merchName"-->
  16. <!-- placeholder="请输入商户名称"-->
  17. <!-- clearable-->
  18. <!-- size="small"-->
  19. <!-- @keyup.enter.native="handleQuery"-->
  20. <!-- />-->
  21. <!-- </el-form-item>-->
  22. <!-- <el-form-item label="账册分类代码" prop="emsClassCode">-->
  23. <!-- <el-select v-model="queryParams.emsClassCode" placeholder="请选择账册分类代码" clearable size="small">-->
  24. <!-- <el-option-->
  25. <!-- v-for="dict in emsClassCodeOptions"-->
  26. <!-- :key="dict.dictValue"-->
  27. <!-- :label="dict.dictLabel"-->
  28. <!-- :value="dict.dictValue"-->
  29. <!-- />-->
  30. <!-- </el-select>-->
  31. <!-- </el-form-item>-->
  32. <el-form-item label="SKU" prop="sku">
  33. <el-input
  34. v-model="queryParams.sku"
  35. placeholder="请输入SKU"
  36. clearable
  37. size="small"
  38. @keyup.enter.native="handleQuery"
  39. />
  40. </el-form-item>
  41. <!-- <el-form-item label="库存状态" prop="inveStatus">-->
  42. <!-- <el-select v-model="queryParams.inveStatus" placeholder="请选择库存状态" clearable size="small">-->
  43. <!-- <el-option-->
  44. <!-- v-for="dict in inveStatusOptions"-->
  45. <!-- :key="dict.dictValue"-->
  46. <!-- :label="dict.dictLabel"-->
  47. <!-- :value="dict.dictValue"-->
  48. <!-- />-->
  49. <!-- </el-select>-->
  50. <!-- </el-form-item>-->
  51. <!-- <el-form-item label="仓库编号" prop="wareSn">-->
  52. <!-- <el-input-->
  53. <!-- v-model="queryParams.wareSn"-->
  54. <!-- placeholder="请输入仓库编号"-->
  55. <!-- clearable-->
  56. <!-- size="small"-->
  57. <!-- @keyup.enter.native="handleQuery"-->
  58. <!-- />-->
  59. <!-- </el-form-item>-->
  60. <!-- <el-form-item label="是否有效" prop="isValid">-->
  61. <!-- <el-select v-model="queryParams.isValid" placeholder="请选择是否有效" clearable size="small">-->
  62. <!-- <el-option-->
  63. <!-- v-for="dict in isValidOptions"-->
  64. <!-- :key="dict.dictValue"-->
  65. <!-- :label="dict.dictLabel"-->
  66. <!-- :value="dict.dictValue"-->
  67. <!-- />-->
  68. <!-- </el-select>-->
  69. <!-- </el-form-item>-->
  70. <el-form-item>
  71. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  72. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  73. </el-form-item>
  74. </el-form>
  75. <el-row :gutter="10" class="mb8">
  76. <!-- <el-col :span="1.5">-->
  77. <!-- <el-button-->
  78. <!-- type="primary"-->
  79. <!-- icon="el-icon-plus"-->
  80. <!-- size="mini"-->
  81. <!-- @click="handleAdd"-->
  82. <!-- v-hasPermi="['biz:invemng:add']"-->
  83. <!-- >新增</el-button>-->
  84. <!-- </el-col>-->
  85. <!-- <el-col :span="1.5">-->
  86. <!-- <el-button-->
  87. <!-- type="success"-->
  88. <!-- icon="el-icon-edit"-->
  89. <!-- size="mini"-->
  90. <!-- :disabled="single"-->
  91. <!-- @click="handleUpdate"-->
  92. <!-- v-hasPermi="['biz:invemng:edit']"-->
  93. <!-- >修改</el-button>-->
  94. <!-- </el-col>-->
  95. <!-- <el-col :span="1.5">-->
  96. <!-- <el-button-->
  97. <!-- type="danger"-->
  98. <!-- icon="el-icon-delete"-->
  99. <!-- size="mini"-->
  100. <!-- :disabled="multiple"-->
  101. <!-- @click="handleDelete"-->
  102. <!-- v-hasPermi="['biz:invemng:remove']"-->
  103. <!-- >删除</el-button>-->
  104. <!-- </el-col>-->
  105. <el-col :span="1.5">
  106. <el-button
  107. type="warning"
  108. icon="el-icon-download"
  109. size="mini"
  110. @click="handleExport"
  111. v-hasPermi="['biz:invemng:export']"
  112. >导出</el-button>
  113. </el-col>
  114. <el-col :span="1.5">
  115. <el-button
  116. type="warning"
  117. icon="el-icon-download"
  118. size="mini"
  119. @click="openPullDialog"
  120. v-hasPermi="['biz:invemng:pull']"
  121. >拉取</el-button>
  122. </el-col>
  123. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  124. </el-row>
  125. <el-table v-loading="loading" :data="invemngList" @selection-change="handleSelectionChange">
  126. <el-table-column type="selection" width="55" align="center" />
  127. <!-- <el-table-column label="库存编号" align="center" prop="inveSn" />-->
  128. <el-table-column label="商户编号" align="center" prop="merchSn" />
  129. <el-table-column label="商户名称" align="center" prop="merchName" />
  130. <el-table-column label="账册分类代码" align="center" prop="emsClassCode" :formatter="emsClassCodeFormat" />
  131. <el-table-column label="SKU" align="center" prop="sku" />
  132. <!-- <el-table-column label="库存状态" align="center" prop="inveStatus" :formatter="inveStatusFormat" />-->
  133. <!-- <el-table-column label="仓库编号" align="center" prop="wareSn" />-->
  134. <!-- <el-table-column label="海关代码" align="center" prop="cusCode" :formatter="cusCodeFormat" />-->
  135. <!-- <el-table-column label="保税仓代码" align="center" prop="bondedCode" :formatter="bondedCodeFormat" />-->
  136. <el-table-column label="库存数" align="center" prop="inveNum" />
  137. <el-table-column label="可用数" align="center" prop="validNum" />
  138. <el-table-column label="下单冻结数" align="center" prop="freezeNum" />
  139. <el-table-column label="出库数" align="center" prop="exWareNum" />
  140. <el-table-column label="退货数" align="center" prop="returnNum" />
  141. <el-table-column label="过期数" align="center" prop="expireNum" />
  142. <el-table-column label="盘增数" align="center" prop="checkAddNum" />
  143. <el-table-column label="盘减数" align="center" prop="checkCutNum" />
  144. <el-table-column label="破损数" align="center" prop="damageNum" />
  145. <el-table-column label="国检抽查数" align="center" prop="spotCheckNum" />
  146. <el-table-column label="到货多余" align="center" prop="arrivedAddNum" />
  147. <el-table-column label="到货短少" align="center" prop="arrivedCutNum" />
  148. <el-table-column label="其他冻结数" align="center" prop="otherNum" />
  149. <!-- <el-table-column label="是否有效" align="center" prop="isValid" :formatter="isValidFormat" />-->
  150. <!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">-->
  151. <!-- <template slot-scope="scope">-->
  152. <!-- <el-button-->
  153. <!-- size="mini"-->
  154. <!-- type="text"-->
  155. <!-- icon="el-icon-edit"-->
  156. <!-- @click="handleUpdate(scope.row)"-->
  157. <!-- v-hasPermi="['biz:invemng:edit']"-->
  158. <!-- >修改</el-button>-->
  159. <!-- <el-button-->
  160. <!-- size="mini"-->
  161. <!-- type="text"-->
  162. <!-- icon="el-icon-delete"-->
  163. <!-- @click="handleDelete(scope.row)"-->
  164. <!-- v-hasPermi="['biz:invemng:remove']"-->
  165. <!-- >删除</el-button>-->
  166. <!-- </template>-->
  167. <!-- </el-table-column>-->
  168. </el-table>
  169. <pagination
  170. v-show="total>0"
  171. :total="total"
  172. :page.sync="queryParams.pageNum"
  173. :limit.sync="queryParams.pageSize"
  174. @pagination="getList"
  175. />
  176. <!-- 添加或修改库存管理,wms入库回传时,增加库存数对话框 -->
  177. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  178. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  179. <el-form-item label="商户编号" prop="merchSn">
  180. <el-input v-model="form.merchSn" placeholder="请输入商户编号" />
  181. </el-form-item>
  182. <el-form-item label="商户名称" prop="merchName">
  183. <el-input v-model="form.merchName" placeholder="请输入商户名称" />
  184. </el-form-item>
  185. <el-form-item label="账册分类代码" prop="emsClassCode">
  186. <el-select v-model="form.emsClassCode" placeholder="请选择账册分类代码">
  187. <el-option
  188. v-for="dict in emsClassCodeOptions"
  189. :key="dict.dictValue"
  190. :label="dict.dictLabel"
  191. :value="dict.dictValue"
  192. ></el-option>
  193. </el-select>
  194. </el-form-item>
  195. <el-form-item label="SKU" prop="sku">
  196. <el-input v-model="form.sku" placeholder="请输入SKU" />
  197. </el-form-item>
  198. <el-form-item label="库存状态" prop="inveStatus">
  199. <el-select v-model="form.inveStatus" placeholder="请选择库存状态">
  200. <el-option
  201. v-for="dict in inveStatusOptions"
  202. :key="dict.dictValue"
  203. :label="dict.dictLabel"
  204. :value="dict.dictValue"
  205. ></el-option>
  206. </el-select>
  207. </el-form-item>
  208. <el-form-item label="仓库编号" prop="wareSn">
  209. <el-input v-model="form.wareSn" placeholder="请输入仓库编号" />
  210. </el-form-item>
  211. <el-form-item label="海关代码" prop="cusCode">
  212. <el-select v-model="form.cusCode" placeholder="请选择海关代码">
  213. <el-option
  214. v-for="dict in cusCodeOptions"
  215. :key="dict.dictValue"
  216. :label="dict.dictLabel"
  217. :value="dict.dictValue"
  218. ></el-option>
  219. </el-select>
  220. </el-form-item>
  221. <el-form-item label="保税仓代码" prop="bondedCode">
  222. <el-select v-model="form.bondedCode" placeholder="请选择保税仓代码">
  223. <el-option
  224. v-for="dict in bondedCodeOptions"
  225. :key="dict.dictValue"
  226. :label="dict.dictLabel"
  227. :value="dict.dictValue"
  228. ></el-option>
  229. </el-select>
  230. </el-form-item>
  231. </el-form>
  232. <div slot="footer" class="dialog-footer">
  233. <el-button type="primary" @click="submitForm">确 定</el-button>
  234. <el-button @click="cancel">取 消</el-button>
  235. </div>
  236. </el-dialog>
  237. <!-- 拉取 dialog -->
  238. <el-dialog title="拉取库存" :visible.sync="pullDialog" width="500px" append-to-body>
  239. <el-form ref="pullForm" :model="pullForm" :rules="rules" label-width="80px">
  240. <el-form-item label="商户编号" prop="merchId">
  241. <el-input v-model="pullForm.merchId" placeholder="请输入商户编号" />
  242. </el-form-item>
  243. <el-form-item label="SKU" prop="sku">
  244. <el-input v-model="pullForm.sku" placeholder="请输入SKU" />
  245. </el-form-item>
  246. </el-form>
  247. <div slot="footer" class="dialog-footer">
  248. <el-button type="primary" @click="handlePull">确 定</el-button>
  249. <el-button @click="closePullDialog">取 消</el-button>
  250. </div>
  251. </el-dialog>
  252. </div>
  253. </template>
  254. <script>
  255. import { listInvemng, getInvemng, delInvemng, addInvemng, updateInvemng, exportInvemng ,pullInvemng } from "@/api/warehouse/invemng";
  256. export default {
  257. name: "Invemng",
  258. components: {
  259. },
  260. data() {
  261. return {
  262. // 拉取表单
  263. pullForm: {},
  264. // 拉取数据弹框
  265. pullDialog: false,
  266. // 遮罩层
  267. loading: true,
  268. // 选中数组
  269. ids: [],
  270. // 非单个禁用
  271. single: true,
  272. // 非多个禁用
  273. multiple: true,
  274. // 显示搜索条件
  275. showSearch: true,
  276. // 总条数
  277. total: 0,
  278. // 库存管理,wms入库回传时,增加库存数表格数据
  279. invemngList: [],
  280. // 弹出层标题
  281. title: "",
  282. // 是否显示弹出层
  283. open: false,
  284. // 账册分类代码字典
  285. emsClassCodeOptions: [],
  286. // 库存状态字典
  287. inveStatusOptions: [],
  288. // 海关代码字典
  289. cusCodeOptions: [],
  290. // 保税仓代码字典
  291. bondedCodeOptions: [],
  292. // 是否有效字典
  293. isValidOptions: [],
  294. // 查询参数
  295. queryParams: {
  296. pageNum: 1,
  297. pageSize: 10,
  298. merchSn: null,
  299. merchName: null,
  300. emsClassCode: null,
  301. sku: null,
  302. inveStatus: null,
  303. wareSn: null,
  304. isValid: null,
  305. },
  306. // 表单参数
  307. form: {},
  308. // 表单校验
  309. rules: {
  310. }
  311. };
  312. },
  313. created() {
  314. this.getList();
  315. this.getDicts("ems_class_code").then(response => {
  316. this.emsClassCodeOptions = response.data;
  317. });
  318. this.getDicts("inve_status").then(response => {
  319. this.inveStatusOptions = response.data;
  320. });
  321. this.getDicts("cus_code").then(response => {
  322. this.cusCodeOptions = response.data;
  323. });
  324. this.getDicts("bonded_code").then(response => {
  325. this.bondedCodeOptions = response.data;
  326. });
  327. this.getDicts("valid").then(response => {
  328. this.isValidOptions = response.data;
  329. });
  330. },
  331. methods: {
  332. /**
  333. * 打开拉取库存对话框
  334. */
  335. openPullDialog() {
  336. this.resetPullForm();
  337. this.pullDialog = true;
  338. },
  339. /**
  340. * 关闭拉取库存对话框
  341. */
  342. closePullDialog() {
  343. this.pullDialog = false;
  344. this.resetPullForm();
  345. },
  346. /**
  347. * 清除表单数据
  348. */
  349. resetPullForm() {
  350. this.pullForm = {
  351. merchId: null,
  352. sku: null
  353. };
  354. this.resetForm("pullForm");
  355. },
  356. /** 查询库存管理,wms入库回传时,增加库存数列表 */
  357. getList() {
  358. this.loading = true;
  359. listInvemng(this.queryParams).then(response => {
  360. this.invemngList = response.rows;
  361. this.total = response.total;
  362. this.loading = false;
  363. });
  364. },
  365. // 账册分类代码字典翻译
  366. emsClassCodeFormat(row, column) {
  367. return this.selectDictLabel(this.emsClassCodeOptions, row.emsClassCode);
  368. },
  369. // 库存状态字典翻译
  370. inveStatusFormat(row, column) {
  371. return this.selectDictLabel(this.inveStatusOptions, row.inveStatus);
  372. },
  373. // 海关代码字典翻译
  374. cusCodeFormat(row, column) {
  375. return this.selectDictLabel(this.cusCodeOptions, row.cusCode);
  376. },
  377. // 保税仓代码字典翻译
  378. bondedCodeFormat(row, column) {
  379. return this.selectDictLabel(this.bondedCodeOptions, row.bondedCode);
  380. },
  381. // 是否有效字典翻译
  382. isValidFormat(row, column) {
  383. return this.selectDictLabel(this.isValidOptions, row.isValid);
  384. },
  385. // 取消按钮
  386. cancel() {
  387. this.open = false;
  388. this.reset();
  389. },
  390. // 表单重置
  391. reset() {
  392. this.form = {
  393. inveSn: null,
  394. merchSn: null,
  395. merchName: null,
  396. emsClassCode: null,
  397. sku: null,
  398. inveStatus: null,
  399. wareSn: null,
  400. cusCode: null,
  401. bondedCode: null,
  402. inveNum: null,
  403. validNum: null,
  404. freezeNum: null,
  405. exWareNum: null,
  406. returnNum: null,
  407. expireNum: null,
  408. checkAddNum: null,
  409. checkCutNum: null,
  410. damageNum: null,
  411. spotCheckNum: null,
  412. arrivedAddNum: null,
  413. arrivedCutNum: null,
  414. otherNum: null,
  415. isValid: null,
  416. createrSn: null,
  417. createTime: null,
  418. moderSn: null,
  419. modTime: null,
  420. tstm: null
  421. };
  422. this.resetForm("form");
  423. },
  424. /** 搜索按钮操作 */
  425. handleQuery() {
  426. this.queryParams.pageNum = 1;
  427. this.getList();
  428. },
  429. /** 重置按钮操作 */
  430. resetQuery() {
  431. this.resetForm("queryForm");
  432. this.handleQuery();
  433. },
  434. // 多选框选中数据
  435. handleSelectionChange(selection) {
  436. this.ids = selection.map(item => item.inveSn)
  437. this.single = selection.length!==1
  438. this.multiple = !selection.length
  439. },
  440. /** 新增按钮操作 */
  441. handleAdd() {
  442. this.reset();
  443. this.open = true;
  444. this.title = "添加库存管理,wms入库回传时,增加库存数";
  445. },
  446. /** 修改按钮操作 */
  447. handleUpdate(row) {
  448. this.reset();
  449. const inveSn = row.inveSn || this.ids
  450. getInvemng(inveSn).then(response => {
  451. this.form = response.data;
  452. this.open = true;
  453. this.title = "修改库存管理,wms入库回传时,增加库存数";
  454. });
  455. },
  456. /** 提交按钮 */
  457. submitForm() {
  458. this.$refs["form"].validate(valid => {
  459. if (valid) {
  460. if (this.form.inveSn != null) {
  461. updateInvemng(this.form).then(response => {
  462. this.msgSuccess("修改成功");
  463. this.open = false;
  464. this.getList();
  465. });
  466. } else {
  467. addInvemng(this.form).then(response => {
  468. this.msgSuccess("新增成功");
  469. this.open = false;
  470. this.getList();
  471. });
  472. }
  473. }
  474. });
  475. },
  476. /** 删除按钮操作 */
  477. handleDelete(row) {
  478. const inveSns = row.inveSn || this.ids;
  479. this.$confirm('是否确认删除库存管理,wms入库回传时,增加库存数编号为"' + inveSns + '"的数据项?', "警告", {
  480. confirmButtonText: "确定",
  481. cancelButtonText: "取消",
  482. type: "warning"
  483. }).then(function() {
  484. return delInvemng(inveSns);
  485. }).then(() => {
  486. this.getList();
  487. this.msgSuccess("删除成功");
  488. })
  489. },
  490. /** 导出按钮操作 */
  491. handleExport() {
  492. const queryParams = this.queryParams;
  493. this.$confirm('是否确认导出所有库存?', "警告", {
  494. confirmButtonText: "确定",
  495. cancelButtonText: "取消",
  496. type: "warning"
  497. }).then(function() {
  498. return exportInvemng(queryParams);
  499. }).then(response => {
  500. this.download(response.msg);
  501. })
  502. },
  503. /** 拉取按钮操作 */
  504. handlePull() {
  505. let queryParams = this.pullForm;
  506. console.log("传入的拉取参数 => ", queryParams);
  507. // 添加遮罩
  508. let _this = this;
  509. let that = this;
  510. this.$confirm('是否确认拉取仓库库存?', "警告", {
  511. confirmButtonText: "确定",
  512. cancelButtonText: "取消",
  513. type: "warning"
  514. }).then(function() {
  515. return pullInvemng(queryParams).then(res => {
  516. // 关闭弹出框
  517. that.closePullDialog();
  518. _this.$alert("拉取库存成功...");
  519. }).catch(err => {
  520. // 关闭弹出框
  521. that.closePullDialog();
  522. _this.$alert("拉取库存异常...");
  523. })
  524. }).then(function(){
  525. _this.handleQuery();
  526. })
  527. }
  528. }
  529. };
  530. </script>