transferOrderList.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <template-page
  3. ref="pageRef"
  4. :get-list="getList"
  5. :export-list="exportList"
  6. :operation="operation()"
  7. :options-evens-group="optionsEvensGroup"
  8. :column-parsing="columnParsing"
  9. :replace-or-not-map="false"
  10. >
  11. <popu v-if="visible">
  12. <el-page-header slot="head" :content="content" @back="handleClose" />
  13. <transfer-order-form :details-id="detailsId" :module-type="moduleType" @close="handleClose" />
  14. </popu>
  15. </template-page>
  16. </template>
  17. <script>
  18. import TemplatePage from '@/components/template/template-page-1.vue'
  19. import import_mixin from '@/components/template/import_mixin.js'
  20. import add_callback_mixin from '@/components/template/add_callback_mixin.js'
  21. import Popu from '@/components/template/popu.vue'
  22. import TransferOrderForm from './transferOrderForm.vue'
  23. import { getListTransferV2, exportListTransferV2, invoiceCustomerTransfer } from '@/api/transferOrder'
  24. import { mapGetters } from 'vuex'
  25. export default {
  26. components: { TemplatePage, Popu, TransferOrderForm },
  27. mixins: [import_mixin, add_callback_mixin],
  28. data() {
  29. return {
  30. visible: false,
  31. // 表格属性
  32. tableAttributes: {
  33. // 启用勾选列
  34. selectColumn: true
  35. }, // 关闭新增弹窗
  36. // 表格事件
  37. tableEvents: {
  38. 'selection-change': this.selectionChange
  39. },
  40. recordSelected: [],
  41. detailsId: '',
  42. moduleType: 1
  43. }
  44. },
  45. computed: {
  46. ...mapGetters(['isCustomer']),
  47. content() {
  48. const titleArr = ['新增', '详情', '审核', '编辑']
  49. return titleArr[this.moduleType - 1]
  50. },
  51. // 事件组合
  52. optionsEvensGroup() {
  53. return [
  54. ...[
  55. this.isCustomer ? [
  56. [
  57. {
  58. name: '新增',
  59. click: this.addOn(() => {
  60. this.visible = true
  61. this.moduleType = 1
  62. })
  63. }
  64. ]
  65. ] : []
  66. ]
  67. ]
  68. }
  69. },
  70. methods: {
  71. // 列表请求函数
  72. getList(...p) {
  73. this.recordSelected = []
  74. return getListTransferV2(...p)
  75. },
  76. // 列表导出函数
  77. exportList: exportListTransferV2,
  78. // 表格列解析渲染数据更改
  79. columnParsing(item, defaultData) {
  80. return defaultData
  81. },
  82. // 监听勾选变化
  83. selectionChange(data) {
  84. this.recordSelected = data
  85. },
  86. operation() {
  87. return (h, { row, index, column }) => {
  88. return (
  89. <div class='operation-btns'>
  90. <el-button
  91. size='mini'
  92. type='text'
  93. onClick={() => {
  94. this.visible = true
  95. this.detailsId = row.id
  96. this.moduleType = 2
  97. }}
  98. >
  99. 查看
  100. </el-button>
  101. {row.status === 'WAIT' ? (
  102. <el-button
  103. size='mini'
  104. type='text'
  105. onClick={() => {
  106. this.visible = true
  107. this.detailsId = row.id
  108. this.moduleType = 3
  109. }}
  110. >
  111. 审核
  112. </el-button>
  113. ) : null}
  114. {row.status === 'SAVE' || row.status === 'WAIT' ? (
  115. <el-button
  116. size='mini'
  117. type='text'
  118. onClick={() => {
  119. this.visible = true
  120. this.detailsId = row.id
  121. this.moduleType = 4
  122. }}
  123. >
  124. 编辑
  125. </el-button>
  126. ) : null}
  127. {row.status === 'SAVE' ? (
  128. <el-popconfirm
  129. onOnConfirm={ () => {
  130. invoiceCustomerTransfer({
  131. id: row.id,
  132. status: 'WAIT'
  133. }).then(res => {
  134. this.$successMsg('提审成功')
  135. this.$refs.pageRef.refreshList()
  136. })
  137. }}
  138. title='是否确定需要提审该项内容?'
  139. >
  140. <el-button slot='reference' size='mini' type='text'>
  141. 提审
  142. </el-button>
  143. </el-popconfirm>
  144. ) : null}
  145. </div>
  146. )
  147. }
  148. },
  149. handleClose() {
  150. this.moduleType = 1
  151. this.detailsId = null
  152. this.addOff(() => {
  153. this.visible = false
  154. })()
  155. this.$refs.pageRef.refreshList()
  156. }
  157. }
  158. }
  159. </script>
  160. <style lang="scss" scoped></style>