change_list.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <template-page
  3. ref="pageRef"
  4. :operation="operation()"
  5. :optionsEvensGroup="optionsEvensGroup"
  6. :getList="getList"
  7. :exportList="exportList"
  8. :tableAttributes="tableAttributes"
  9. :tableEvents="tableEvents"
  10. :columnParsing="columnParsing"
  11. :replaceOrNotMap="false"
  12. >
  13. <Popu v-if="showPage !== 1">
  14. <ChangeListDetail v-if="showPage == 2" @refresh="refreshFn" :detailList="detailList" />
  15. <ChangeListExamine v-if="showPage == 3" @refresh="refreshFn" :detailList="detailList" />
  16. <ChangeListReview v-if="showPage == 4" @refresh="refreshFn" :detailList="detailList" />
  17. </Popu>
  18. </template-page>
  19. </template>
  20. <script>
  21. import TemplatePage from '@/components/template/template-page-1.vue'
  22. import { getChangeList, getChangeListDetail, getTransferSubmit, getTransferCancel } from '@/api/finance/change_list'
  23. import { financeTransferList, financeTransferListExport } from '@/api/finance/change_list_v2'
  24. import Popu from '@/components/template/popu.vue'
  25. import import_mixin from '@/components/template/import_mixin.js'
  26. import add_callback_mixin from '@/components/template/add_callback_mixin.js'
  27. import ChangeListDetail from './components/change_list-detail'
  28. import ChangeListExamine from './components/change_list-examine'
  29. import ChangeListReview from './components/change_list-review'
  30. export default {
  31. components: {
  32. ChangeListDetail,
  33. ChangeListExamine,
  34. ChangeListReview,
  35. TemplatePage,
  36. Popu
  37. },
  38. mixins: [import_mixin, add_callback_mixin],
  39. data() {
  40. return {
  41. isCustomer: null,
  42. showPage: 1,
  43. detailList: {},
  44. optionsEvensGroup: [],
  45. // 表格属性
  46. tableAttributes: {
  47. // 启用勾选列
  48. selectColumn: false
  49. },
  50. // 表格事件
  51. tableEvents: {
  52. 'selection-change': this.selectionChange
  53. },
  54. recordSelected: []
  55. }
  56. },
  57. created() {
  58. const res = JSON.parse(localStorage.getItem('supply_user'))
  59. this.isCustomer = res.isCustomer
  60. },
  61. methods: {
  62. // 列表请求函数
  63. getList: financeTransferList,
  64. // 列表导出函数
  65. exportList: financeTransferListExport,
  66. // 表格列解析渲染数据更改
  67. columnParsing(item, defaultData) {
  68. return defaultData
  69. },
  70. // 监听勾选变化
  71. selectionChange(data) {
  72. this.recordSelected = data
  73. },
  74. operation() {
  75. return (h, { row, index, column }) => {
  76. return (
  77. <div class="operation-btns">
  78. {this.$checkBtnRole('apply', this.$route.meta.roles) && row.examineStatus == 'SAVE' ? (
  79. <el-button
  80. onClick={() => {
  81. this.submitFn(row.id)
  82. }}
  83. type="text"
  84. class="textColor"
  85. slot="reference"
  86. >
  87. 提审
  88. </el-button>
  89. ) : null}
  90. {row.examineStatus == 'WAIT' &&
  91. !this.isCustomer &&
  92. this.$checkBtnRole('examine', this.$route.meta.roles) ? (
  93. <el-button
  94. onClick={() => {
  95. this.examineFn(row.id)
  96. }}
  97. type="text"
  98. class="textColor"
  99. slot="reference"
  100. >
  101. 审核
  102. </el-button>
  103. ) : null}
  104. {(row.examineStatus == 'FAIL_ONE' || row.examineStatus == 'SAVE') &&
  105. this.$checkBtnRole('edit', this.$route.meta.roles) ? (
  106. <el-button
  107. type="text"
  108. class="textColor"
  109. slot="reference"
  110. onClick={() => {
  111. this.editFn(row.id)
  112. }}
  113. >
  114. 修改
  115. </el-button>
  116. ) : null}
  117. <el-button
  118. onClick={() => {
  119. this.detailFn(row.id)
  120. }}
  121. type="text"
  122. class="textColor"
  123. slot="reference"
  124. >
  125. 详情
  126. </el-button>
  127. {row.examineStatus == 'WAIT' ? (
  128. <el-button
  129. onClick={() => {
  130. this.cancelFn(row.id)
  131. }}
  132. type="text"
  133. class="textColor"
  134. slot="reference"
  135. >
  136. 取消
  137. </el-button>
  138. ) : null}
  139. </div>
  140. )
  141. }
  142. },
  143. //取消
  144. async cancelFn(id) {
  145. await getTransferCancel({ id })
  146. this.refreshFn()
  147. this.$message.success('取消成功')
  148. },
  149. //刷新
  150. refreshFn() {
  151. this.$refs.pageRef.refreshList()
  152. this.addOff(() => {
  153. this.showPage = 1
  154. })()
  155. },
  156. //提审
  157. async submitFn(id) {
  158. await getTransferSubmit({ id })
  159. this.$message.success('提审成功')
  160. this.refreshFn()
  161. },
  162. //详情
  163. async detailFn(id) {
  164. const res = await getChangeListDetail({ id })
  165. this.detailList = res.data
  166. this.showPage = 2
  167. },
  168. //修改
  169. async editFn(id) {
  170. const res = await getChangeListDetail({ id })
  171. this.detailList = res.data
  172. this.showPage = 4
  173. },
  174. //审核
  175. async examineFn(id) {
  176. const res = await getChangeListDetail({ id })
  177. this.detailList = res.data
  178. this.showPage = 3
  179. }
  180. }
  181. }
  182. </script>
  183. <style lang="scss" scoped></style>