bill.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <!-- 付款账单 -->
  2. <template>
  3. <div class="container">
  4. <my-table :data="data" :columns="columns" :table-filter="tableFilter" :table-page="params" @event-handle="eventHandle" @on-change="changePage"></my-table>
  5. <bill-modal v-model="show" :data="formData"></bill-modal>
  6. </div>
  7. </template>
  8. <script>
  9. import { GetPaymentBill } from '@/api/applyPurchase'
  10. import MyTable from '_c/my-table/my-table'
  11. import BillModal from './bill-modal'
  12. import { exportExcel } from '@/libs/util'
  13. export default {
  14. name: 'material_bill',
  15. components: {
  16. MyTable,
  17. BillModal
  18. },
  19. data () {
  20. return {
  21. formData: {},
  22. show: false,
  23. data: [{}],
  24. columns: [
  25. {
  26. title: '序号',
  27. type: 'index',
  28. width: 60,
  29. align: 'center'
  30. },
  31. {
  32. title: '账单时间',
  33. key: 'billTime',
  34. minWidth: 150
  35. },
  36. {
  37. title: '付款期限',
  38. key: 'payLimitTime',
  39. minWidth: 150
  40. },
  41. {
  42. title: '明细数量',
  43. key: 'detailNum',
  44. minWidth: 150
  45. },
  46. {
  47. title: '累计应付',
  48. key: 'totalAmount',
  49. minWidth: 150
  50. },
  51. {
  52. title: '查看详情',
  53. key: 'purchaseBillNo',
  54. minWidth: 100,
  55. fixed: 'right',
  56. align: 'center',
  57. render: (h, params) => {
  58. let _this = this
  59. return h('a', {
  60. on: {
  61. click () {
  62. _this.formData = { ...params.row }
  63. _this.show = true
  64. }
  65. }
  66. }, '查看详情')
  67. }
  68. }
  69. ],
  70. tableFilter: [
  71. {
  72. name: 'Input',
  73. value: 'keyword',
  74. placeholder: '请输入关键字'
  75. },
  76. {
  77. name: 'Button',
  78. type: 'primary',
  79. text: '查询',
  80. e: 'search'
  81. },
  82. {
  83. name: 'Button',
  84. type: 'primary',
  85. text: '导出Excel',
  86. e: 'export'
  87. }
  88. ],
  89. params: {
  90. pageIndex: 1,
  91. pageSize: 20,
  92. total: 0
  93. }
  94. }
  95. },
  96. methods: {
  97. cfm (type, formData) {
  98. if (type === 'add') {
  99. FacPriceAdd({
  100. ...formData,
  101. materialCode: formData.code
  102. }).then(res => {
  103. if (res.code === 0) {
  104. this.$Message.info(res.msg)
  105. this.getList()
  106. }
  107. })
  108. } else if (type === 'edit') {
  109. FacPriceChange({
  110. ...formData,
  111. factoryPriceId: formData.id
  112. }).then(res => {
  113. if (res.code === 0) {
  114. this.$Message.info(res.msg)
  115. this.getList()
  116. }
  117. })
  118. }
  119. },
  120. // 检索条件事件处理
  121. eventHandle (option) {
  122. switch (option._evnet) {
  123. case 'search':
  124. this.params.pageIndex = 1
  125. this.params.keyWord = option.key
  126. this.getList()
  127. break
  128. case 'add':
  129. this.formType = 'add'
  130. this.show = true
  131. break
  132. case 'back':
  133. this.$router.go(-1)
  134. break
  135. case 'export':
  136. GetPaymentBill({
  137. ...this.params,
  138. pageIndex: 1,
  139. pageSize: 99999
  140. }).then(res => {
  141. if (res.code === 0) {
  142. let data = res.result.list
  143. if (data.length < 1) return this.$Message.error('数据为空!')
  144. exportExcel(this.columns, data, '合同账单')
  145. }
  146. })
  147. break
  148. }
  149. },
  150. changePage (pageIndex) {
  151. this.params.pageIndex = pageIndex
  152. this.getList()
  153. },
  154. getList () {
  155. GetPaymentBill(this.params).then(res => {
  156. if (res.code === 0) {
  157. this.data = res.result.list
  158. this.params.total = res.result.totalCount
  159. }
  160. })
  161. }
  162. },
  163. mounted () {
  164. this.getList()
  165. }
  166. }
  167. </script>
  168. <style lang="less" scoped>
  169. .container {
  170. height: 100%;
  171. }
  172. </style>