retStorage.vue 5.9 KB

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