out_storage_codes.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import {
  2. goodsPurchaseRetCodeList,
  3. goodsPurchaseRetItemAddCode,
  4. goodsPurchaseRetItemDelCode
  5. } from '@/api/merchandisePurchaseReturn.js'
  6. export default {
  7. data() {
  8. return {}
  9. },
  10. methods: {
  11. getGoodsPurchaseRetCodeList() {
  12. if (this.formData.id) {
  13. goodsPurchaseRetCodeList({
  14. pageNum: 1,
  15. pageSize: -1,
  16. params: [{ param: 'c.goods_purchase_ret_id', compare: '=', value: this.formData.id }]
  17. }).then(res => {
  18. this.formData.codeInfoList = res.data.records
  19. console.log(this.formData.codeInfoList)
  20. })
  21. }
  22. },
  23. // 添加条码信息
  24. addCodeInfo() {
  25. this.formData.codeInfoList.unshift({
  26. brandId: '',
  27. brandName: '',
  28. mainId: '',
  29. mainName: '',
  30. smallId: '',
  31. smallName: '',
  32. goodsMaterialId: '',
  33. goodsMaterialName: '',
  34. specsName: '',
  35. goodsMaterialItemType: '',
  36. goodsMaterialItemId: '',
  37. goodsMaterialItemName: '',
  38. uniqueCode: '',
  39. code: '',
  40. codeQty: '',
  41. goodsPurchaseRetItemId: '',
  42. goodsPurchaseRetId: this.formData.id
  43. })
  44. this.isEditIndex = 0
  45. },
  46. addCode(row) {
  47. if (this.isEditIndex > -1) {
  48. this.$refs.formRef.validateField(this.getCodeVfyKey(), (valid, invalidFields, errLabels) => {
  49. if (valid && this.eidtCodeItems()) {
  50. goodsPurchaseRetItemAddCode({
  51. codeList: [{ ...row }]
  52. }).then(res => {
  53. this.isEditIndex = -1
  54. this.getGoodsPurchaseRetCodeList()
  55. })
  56. }
  57. })
  58. }
  59. },
  60. delCode(row, index) {
  61. if (row.id) {
  62. goodsPurchaseRetItemDelCode({
  63. codeId: row.id,
  64. id: row.goodsPurchaseRetId
  65. }).then(res => {
  66. this.getGoodsPurchaseRetCodeList()
  67. })
  68. } else {
  69. this.formData?.codeInfoList?.splice(index, 1)
  70. if (index == this.isEditIndex) {
  71. this.isEditIndex = -1
  72. }
  73. }
  74. }
  75. }
  76. }