retStorage.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <template-page ref="pageRef" :get-list="getList" :exportList="exportList" :table-attributes="tableAttributes"
  3. :table-events="tableEvents" :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters"
  4. :column-parsing="columnParsing" :operation="operation()" :replaceOrNotMap="false">
  5. <div class="cartographer">
  6. <el-dialog :title="({ M: '辅材退货单', P: '配件退货单' })[storageType]" width="100%" :modal="false" :visible.sync="formDialog"
  7. :before-close="formCancel">
  8. <zj-form-container v-if="formDialog" ref="formRef" :form-data="formData" :styleSwitch="false">
  9. <zj-form-module title="单据信息" label-width="120px" :showPackUp="false" :form-data="formData"
  10. :form-items="formItems1">
  11. </zj-form-module>
  12. <zj-form-module :title="({ M: '辅材信息', P: '配件信息' })[storageType]" label-width="120px" :showPackUp="false"
  13. :form-data="formData" :form-items="formItems2">
  14. </zj-form-module>
  15. </zj-form-container>
  16. <div slot="footer" class="dialog-footer">
  17. <el-button size="mini" @click="formCancel">取 消</el-button>
  18. <el-button v-if="~[0, 1].indexOf(formDialogType)" size="mini" @click="formConfirm" type="primary">确
  19. 定</el-button>
  20. <el-button v-if="~[3].indexOf(formDialogType)" size="mini" @click="passExamination"
  21. type="primary">审核通过</el-button>
  22. </div>
  23. </el-dialog>
  24. </div>
  25. </template-page>
  26. </template>
  27. <script>
  28. import TemplatePage from '@/components/template/template-page-1.vue'
  29. import import_mixin from '@/components/template/import_mixin.js'
  30. import form_tpl from "../mixins/form_tpl.js"
  31. import operation_mixin from '@/components/template/operation_mixin.js'
  32. import { websitPurchaseRetList, websitPurchaseRetListExport, websitPurchaseRetAdd, websitPurchaseRetEdit, websitPurchaseRetConfirm, websitPurchaseRetDetail } from "@/api/purchasingManagement.js"
  33. export default {
  34. props: {
  35. storageType: {
  36. type: String,
  37. default: ""
  38. }
  39. },
  40. components: { TemplatePage },
  41. mixins: [import_mixin, form_tpl, operation_mixin],
  42. data() {
  43. return {
  44. formData: {
  45. companyWechatName: JSON.parse(localStorage.getItem('greemall_user')).companyName,
  46. "companyWechatId": "",
  47. "confirmBy": "",
  48. "confirmTime": "",
  49. "createBy": "",
  50. "createTime": "",
  51. "flag": "",
  52. "goodsType": this.storageType,
  53. "purchaseId": "",
  54. "purchaseRetId": "",
  55. "remark": "",
  56. "retTime": "",
  57. "retTotalAmount": 0,
  58. "retTotalQty": 0,
  59. "updateBy": "",
  60. "updateTime": "",
  61. "venderId": "",
  62. "venderName": "",
  63. "websitId": "",
  64. "websitName": "",
  65. items: [],
  66. imageUrl: []
  67. },
  68. }
  69. },
  70. methods: {
  71. // 列表请求函数
  72. getList(p, cb) {
  73. var pam = JSON.parse(JSON.stringify(p))
  74. pam.params.push({ "param": "a.goods_type", "compare": "=", "value": this.storageType })
  75. if (pam.flag) {
  76. pam.params.push({ "param": "a.flag", "compare": "=", "value": pam.flag })
  77. }
  78. cb && cb(pam)
  79. return websitPurchaseRetList(pam)
  80. },
  81. // 列表导出函数
  82. exportList: websitPurchaseRetListExport,
  83. operation() {
  84. return this.operationBtn({
  85. edit: {
  86. conditions: ({ row, index, column }) => {
  87. return row.flag == "SAVE"
  88. },
  89. click: ({ row, index, column }) => {
  90. this.getDetail(row.purchaseRetId, 1)
  91. }
  92. },
  93. detail: {
  94. click: ({ row, index, column }) => {
  95. this.getDetail(row.purchaseRetId, 2)
  96. }
  97. },
  98. examine: {
  99. conditions: ({ row, index, column }) => {
  100. return row.flag == "SAVE"
  101. },
  102. click: ({ row, index, column }) => {
  103. this.getDetail(row.purchaseRetId, 3)
  104. }
  105. },
  106. })
  107. },
  108. getDetail(purchaseRetId, type) {
  109. websitPurchaseRetDetail({ purchaseRetId }).then(res => {
  110. Object.assign(this.formData, res.data, {
  111. imageUrl: res.data.imageUrl ? [{ url: res.data.imageUrl }] : [],
  112. items: res.data.items.map(item => ({
  113. ...item,
  114. isEditRow: false
  115. }))
  116. })
  117. this.formDialogType = type
  118. this.openForm()
  119. })
  120. },
  121. formConfirm() {
  122. this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
  123. if (valid) {
  124. ([websitPurchaseRetAdd, websitPurchaseRetEdit][this.formDialogType])({
  125. ...this.formData,
  126. "goodsType": this.storageType,
  127. imageUrl: this.formData.imageUrl.map(item => item.url).join(","),
  128. }).then(res => {
  129. this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
  130. this.formCancel()
  131. this.$refs.pageRef.refreshList()
  132. })
  133. }
  134. })
  135. },
  136. passExamination() {
  137. this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
  138. if (valid) {
  139. websitPurchaseRetConfirm({ purchaseRetId: this.formData.purchaseRetId, flag: "OK" }).then(res => {
  140. this.$message({ type: 'success', message: `审核通过!` })
  141. this.formCancel()
  142. this.$refs.pageRef.refreshList()
  143. })
  144. }
  145. })
  146. }
  147. }
  148. }
  149. </script>
  150. <style lang="scss">
  151. .redbordererr {
  152. .el-form-item {
  153. margin: 0 !important;
  154. overflow: hidden;
  155. }
  156. }
  157. </style>