list.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <a-card size="small" :bordered="false" class="companyReceivablePayableList-wrap">
  3. <!-- 搜索条件 -->
  4. <div 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" showIcon 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"
  43. ref="table"
  44. size="small"
  45. :rowKey="(record) => record.id"
  46. :columns="columns"
  47. :data="loadData"
  48. :scroll="{ y: tableHeight }"
  49. bordered>
  50. <!-- 操作 -->
  51. <template slot="action" slot-scope="text, record">
  52. <a-button
  53. v-if="$hasPermissions('M_collectionPayment')"
  54. size="small"
  55. type="link"
  56. class="button-info"
  57. @click="handleCollectionPayment(record)"
  58. id="companyReceivablePayableList-collectionPayment-btn">收付款</a-button>
  59. <a-button
  60. v-if="$hasPermissions('M_companyReceivablePayable_detail')"
  61. size="small"
  62. type="link"
  63. class="button-success"
  64. @click="handleDetail(record)"
  65. id="companyReceivablePayableList-detail-btn">详情</a-button>
  66. <span v-if="!$hasPermissions('M_collectionPayment') && !$hasPermissions('M_companyReceivablePayable_detail')">--</span>
  67. </template>
  68. </s-table>
  69. </a-card>
  70. </template>
  71. <script>
  72. import { STable, VSelect } from '@/components'
  73. import { settleUnitClientList, settleInfoQuerySum } from '@/api/settle'
  74. export default {
  75. components: { STable, VSelect },
  76. data () {
  77. return {
  78. disabled: false, // 查询、重置按钮是否可操作
  79. tableHeight: 0,
  80. // 查询参数
  81. queryParam: {
  82. settleClientName: '',
  83. settleClientType: undefined
  84. },
  85. // 表头
  86. columns: [
  87. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  88. { title: '单位名称', dataIndex: 'settleClientName', align: 'center', customRender: function (text) { return text || '--' } },
  89. { title: '单位类型', dataIndex: 'settleClientTypeDictValue', align: 'center', customRender: function (text) { return text || '--' } },
  90. { title: '应收金额', dataIndex: 'unSettleAmountReceipt', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  91. { title: '应付金额', dataIndex: 'unSettleAmountPay', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  92. { title: '操作', scopedSlots: { customRender: 'action' }, width: 200, align: 'center' }
  93. ],
  94. // 加载数据方法 必须为 Promise 对象
  95. loadData: parameter => {
  96. this.disabled = true
  97. if (this.tableHeight == 0) {
  98. this.tableHeight = window.innerHeight - 380
  99. }
  100. return settleUnitClientList(Object.assign(parameter, this.queryParam)).then(res => {
  101. const data = res.data
  102. const no = (data.pageNo - 1) * data.pageSize
  103. for (var i = 0; i < data.list.length; i++) {
  104. data.list[i].no = no + i + 1
  105. // 应付金额 值为负,应显示为正
  106. data.list[i].unSettleAmountPay = Math.abs(data.list[i].unSettleAmountPay) || 0
  107. }
  108. this.disabled = false
  109. this.total = data.count
  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. }
  144. }
  145. </script>
  146. <style lang="less">
  147. .companyReceivablePayableList-wrap{
  148. .sTable{
  149. margin-top: 15px;
  150. }
  151. }
  152. </style>