list.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <a-card size="small" :bordered="false" class="companyReceivablePayableList-wrap">
  3. <!-- 搜索条件 -->
  4. <div ref="tableSearch" class="table-page-search-wrapper">
  5. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  6. <a-row :gutter="15">
  7. <a-col :md="6" :sm="24">
  8. <a-form-item label="单位名称">
  9. <a-input id="companyReceivablePayableList-settleClientName" v-model.trim="queryParam.settleClientName" allowClear placeholder="请输入单位名称"/>
  10. </a-form-item>
  11. </a-col>
  12. <a-col :md="6" :sm="24">
  13. <a-form-item label="单位类型">
  14. <v-select
  15. v-model="queryParam.settleClientType"
  16. ref="settleClientType"
  17. id="companyReceivablePayableList-settleClientType"
  18. code="SETTLE_CLIENT_TYPE"
  19. placeholder="请选择单位类型"
  20. allowClear></v-select>
  21. </a-form-item>
  22. </a-col>
  23. <a-col :md="6" :sm="24">
  24. <span class="table-page-search-submitButtons">
  25. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="companyReceivablePayableList-refresh">查询</a-button>
  26. <a-button style="margin-left: 8px" @click="resetSearchForm()" :disabled="disabled" id="companyReceivablePayableList-reset">重置</a-button>
  27. </span>
  28. </a-col>
  29. </a-row>
  30. </a-form>
  31. </div>
  32. <!-- alert -->
  33. <a-alert type="info" style="margin-bottom:10px">
  34. <div slot="message">
  35. 共 <strong>{{ total }}</strong> 条记录,
  36. 应收金额合计 <strong>{{ (productTotal&&(productTotal.receipt || productTotal.receipt==0)) ? '¥'+productTotal.receipt : '--' }}</strong> ,
  37. 应付金额合计 <strong>¥{{ (productTotal&&productTotal.pay) ? Math.abs(productTotal.pay) : 0 }}</strong>
  38. </div>
  39. </a-alert>
  40. <!-- 列表 -->
  41. <s-table
  42. class="sTable fixPagination"
  43. ref="table"
  44. :style="{ height: tableHeight+84.5+'px' }"
  45. size="small"
  46. :rowKey="(record) => record.id"
  47. :columns="columns"
  48. :data="loadData"
  49. :scroll="{ y: tableHeight }"
  50. bordered>
  51. <!-- 操作 -->
  52. <template slot="action" slot-scope="text, record">
  53. <a-button
  54. v-if="$hasPermissions('M_collectionPayment')"
  55. size="small"
  56. type="link"
  57. class="button-info"
  58. @click="handleCollectionPayment(record)"
  59. id="companyReceivablePayableList-collectionPayment-btn">收付款</a-button>
  60. <a-button
  61. v-if="$hasPermissions('M_companyReceivablePayable_detail')"
  62. size="small"
  63. type="link"
  64. class="button-success"
  65. @click="handleDetail(record)"
  66. id="companyReceivablePayableList-detail-btn">详情</a-button>
  67. <span v-if="!$hasPermissions('M_collectionPayment') && !$hasPermissions('M_companyReceivablePayable_detail')">--</span>
  68. </template>
  69. </s-table>
  70. </a-card>
  71. </template>
  72. <script>
  73. import { STable, VSelect } from '@/components'
  74. import { settleUnitClientList, settleInfoQuerySum } from '@/api/settle'
  75. export default {
  76. components: { STable, VSelect },
  77. data () {
  78. return {
  79. disabled: false, // 查询、重置按钮是否可操作
  80. tableHeight: 0,
  81. // 查询参数
  82. queryParam: {
  83. settleClientName: '',
  84. settleClientType: undefined
  85. },
  86. // 表头
  87. columns: [
  88. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  89. { title: '单位名称', dataIndex: 'settleClientName', align: 'center', customRender: function (text) { return text || '--' } },
  90. { title: '单位类型', dataIndex: 'settleClientTypeDictValue', align: 'center', customRender: function (text) { return text || '--' } },
  91. { title: '应收金额', dataIndex: 'unSettleAmountReceipt', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  92. { title: '应付金额', dataIndex: 'unSettleAmountPay', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  93. { title: '操作', scopedSlots: { customRender: 'action' }, width: 200, align: 'center' }
  94. ],
  95. // 加载数据方法 必须为 Promise 对象
  96. loadData: parameter => {
  97. this.disabled = true
  98. this.spinning = true
  99. return settleUnitClientList(Object.assign(parameter, this.queryParam)).then(res => {
  100. const data = res.data
  101. const no = (data.pageNo - 1) * data.pageSize
  102. for (var i = 0; i < data.list.length; i++) {
  103. data.list[i].no = no + i + 1
  104. // 应付金额 值为负,应显示为正
  105. data.list[i].unSettleAmountPay = Math.abs(data.list[i].unSettleAmountPay) || 0
  106. }
  107. this.disabled = false
  108. this.spinning = false
  109. this.total = data.count || 0
  110. this.getTotal(Object.assign(parameter, this.queryParam))
  111. return data
  112. })
  113. },
  114. total: 0, // 总条数
  115. productTotal: null
  116. }
  117. },
  118. methods: {
  119. // 详情
  120. handleDetail (row) {
  121. this.$router.push({ path: `/financialManagement/companyReceivablePayable/detail/${row.settleClientSn}/${row.settleClientName}` })
  122. },
  123. // 合计
  124. getTotal (param) {
  125. settleInfoQuerySum(param).then(res => {
  126. if (res.status == 200 && res.data) {
  127. this.productTotal = res.data
  128. } else {
  129. this.productTotal = null
  130. }
  131. })
  132. },
  133. // 收付款
  134. handleCollectionPayment (row) {
  135. this.$router.push({ path: `/financialManagement/companyReceivablePayable/collectionPayment/${row.settleClientSn}/${row.settleClientName}` })
  136. },
  137. // 重置
  138. resetSearchForm () {
  139. this.queryParam.settleClientName = ''
  140. this.queryParam.settleClientType = undefined
  141. this.$refs.table.refresh(true)
  142. },
  143. setTableH () {
  144. const tableSearchH = this.$refs.tableSearch.offsetHeight
  145. this.tableHeight = window.innerHeight - tableSearchH - 230
  146. }
  147. },
  148. mounted () {
  149. const _this = this
  150. this.$nextTick(() => { // 页面渲染完成后的回调
  151. _this.setTableH()
  152. })
  153. },
  154. beforeRouteEnter (to, from, next) {
  155. next(vm => {
  156. if (!vm.disabled) {
  157. vm.$refs.table.refresh()
  158. }
  159. })
  160. }
  161. }
  162. </script>
  163. <style lang="less">
  164. .companyReceivablePayableList-wrap{
  165. .sTable{
  166. margin-top: 10px;
  167. }
  168. }
  169. </style>