retStorage.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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('OK')"
  21. type="primary">审核通过</el-button>
  22. <el-button v-if="~[3].indexOf(formDialogType)" size="mini" @click="passExamination('FAIL')"
  23. type="primary">驳回</el-button>
  24. </div>
  25. </el-dialog>
  26. </div>
  27. </template-page>
  28. </template>
  29. <script>
  30. import TemplatePage from '@/components/template/template-page-1.vue'
  31. import import_mixin from '@/components/template/import_mixin.js'
  32. import form_tpl from "../mixins/form_tpl.js"
  33. import operation_mixin from '@/components/template/operation_mixin.js'
  34. import { websitPurchaseRetList, websitPurchaseRetListExport, websitPurchaseRetAdd, websitPurchaseRetEdit, websitPurchaseRetConfirm, websitPurchaseRetDetail } from "@/api/purchasingManagement.js"
  35. export default {
  36. props: {
  37. storageType: {
  38. type: String,
  39. default: ""
  40. }
  41. },
  42. components: { TemplatePage },
  43. mixins: [import_mixin, form_tpl, operation_mixin],
  44. data() {
  45. return {
  46. formData: {
  47. companyWechatName: JSON.parse(localStorage.getItem('greemall_user')).companyName,
  48. "companyWechatId": "",
  49. "confirmBy": "",
  50. "confirmTime": "",
  51. "createBy": "",
  52. "createTime": "",
  53. "flag": "",
  54. "goodsType": this.storageType,
  55. "purchaseId": "",
  56. "purchaseRetId": "",
  57. "remark": "",
  58. "retTime": "",
  59. "retTotalAmount": 0,
  60. "retTotalQty": 0,
  61. "updateBy": "",
  62. "updateTime": "",
  63. "venderId": "",
  64. "venderName": "",
  65. "websitId": "",
  66. "websitName": "",
  67. items: [],
  68. imageUrl: []
  69. },
  70. }
  71. },
  72. methods: {
  73. // 列表请求函数
  74. getList(p, cb) {
  75. var pam = JSON.parse(JSON.stringify(p))
  76. pam.params.push({ "param": "a.goods_type", "compare": "=", "value": this.storageType })
  77. if (pam.flag) {
  78. pam.params.push({ "param": "a.flag", "compare": "=", "value": pam.flag })
  79. }
  80. cb && cb(pam)
  81. return websitPurchaseRetList(pam)
  82. },
  83. // 列表导出函数
  84. exportList: websitPurchaseRetListExport,
  85. operation() {
  86. return this.operationBtn({
  87. edit: {
  88. conditions: ({ row, index, column }) => {
  89. return row.flag == "SAVE"
  90. },
  91. click: ({ row, index, column }) => {
  92. this.getDetail(row.purchaseRetId, 1)
  93. }
  94. },
  95. detail: {
  96. click: ({ row, index, column }) => {
  97. this.getDetail(row.purchaseRetId, 2)
  98. }
  99. },
  100. examine: {
  101. conditions: ({ row, index, column }) => {
  102. return row.flag == "SAVE"
  103. },
  104. click: ({ row, index, column }) => {
  105. this.getDetail(row.purchaseRetId, 3)
  106. }
  107. },
  108. })
  109. },
  110. getDetail(purchaseRetId, type) {
  111. websitPurchaseRetDetail({ purchaseRetId }).then(res => {
  112. Object.assign(this.formData, res.data, {
  113. imageUrl: res.data.imageUrl ? [{ url: res.data.imageUrl }] : [],
  114. items: res.data.items.map(item => ({
  115. ...item,
  116. isEditRow: false
  117. }))
  118. })
  119. this.formDialogType = type
  120. this.openForm()
  121. })
  122. },
  123. formConfirm() {
  124. this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
  125. if (valid) {
  126. ([websitPurchaseRetAdd, websitPurchaseRetEdit][this.formDialogType])({
  127. ...this.formData,
  128. "goodsType": this.storageType,
  129. imageUrl: this.formData.imageUrl.map(item => item.url).join(","),
  130. }).then(res => {
  131. this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
  132. this.formCancel()
  133. this.$refs.pageRef.refreshList()
  134. })
  135. }
  136. })
  137. },
  138. passExamination(flag) {
  139. this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
  140. if (valid) {
  141. websitPurchaseRetConfirm({ purchaseRetId: this.formData.purchaseRetId, flag: flag }).then(res => {
  142. this.$message({ type: 'success', message: flag=='OK'?`审核通过!`:'驳回通过' })
  143. this.formCancel()
  144. this.$refs.pageRef.refreshList()
  145. })
  146. }
  147. })
  148. }
  149. }
  150. }
  151. </script>
  152. <style lang="scss">
  153. .redbordererr {
  154. .el-form-item {
  155. margin: 0 !important;
  156. overflow: hidden;
  157. }
  158. }
  159. </style>