list.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <a-card size="small" :bordered="false" class="ledgerRecordList-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. <rangeDate ref="rangeDate" :value="createDate" @change="dateChange" />
  10. </a-form-item>
  11. </a-col>
  12. <a-col :md="6" :sm="24">
  13. <a-form-item label="客户名称">
  14. <custSatelliteList ref="custSatelliteList" @change="custSatelliteChange"></custSatelliteList>
  15. </a-form-item>
  16. </a-col>
  17. <a-col :md="6" :sm="24">
  18. <a-form-item label="产品名称">
  19. <a-input id="ledgerRecordList-name" v-model.trim="queryParam.dealerProduct.name" allowClear placeholder="请输入产品名称"/>
  20. </a-form-item>
  21. </a-col>
  22. <template v-if="advanced">
  23. <a-col :md="6" :sm="24">
  24. <a-form-item label="产品编码">
  25. <a-input id="ledgerRecordList-code" v-model.trim="queryParam.dealerProduct.code" allowClear placeholder="请输入产品编码"/>
  26. </a-form-item>
  27. </a-col>
  28. </template>
  29. <a-col :md="6" :sm="24">
  30. <span class="table-page-search-submitButtons">
  31. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="ledgerRecordList-refresh">查询</a-button>
  32. <a-button style="margin-left: 8px" @click="resetSearchForm()" :disabled="disabled" id="ledgerRecordList-reset">重置</a-button>
  33. <a @click="advanced=!advanced" style="margin-left: 8px">
  34. {{ advanced ? '收起' : '展开' }}
  35. <a-icon :type="advanced ? 'up' : 'down'"/>
  36. </a>
  37. </span>
  38. </a-col>
  39. </a-row>
  40. </a-form>
  41. </div>
  42. <!-- alert -->
  43. <a-alert type="info" showIcon style="margin-bottom:15px">
  44. <div slot="message">
  45. 总计:<strong>{{ total }}</strong>条 ,
  46. 分账金额:<strong>{{ (totalAmount || totalAmount == 0) ? totalAmount+'元' : '--' }}</strong>
  47. </div>
  48. </a-alert>
  49. <!-- 列表 -->
  50. <s-table
  51. class="sTable"
  52. ref="table"
  53. size="default"
  54. :rowKey="(record) => record.id"
  55. :columns="columns"
  56. :data="loadData"
  57. :scroll="{ x: 1690 }"
  58. bordered>
  59. </s-table>
  60. </a-card>
  61. </template>
  62. <script>
  63. import getDate from '@/libs/getDate.js'
  64. import { STable, VSelect } from '@/components'
  65. import rangeDate from '@/views/common/rangeDate.vue'
  66. import custSatelliteList from '@/views/common/custSatelliteList.vue'
  67. import { satelliteWHSeparateList, satelliteWHSeparateTotal } from '@/api/satelliteWH'
  68. export default {
  69. components: { STable, VSelect, rangeDate, custSatelliteList },
  70. data () {
  71. return {
  72. advanced: false, // 高级搜索 展开/关闭
  73. disabled: false, // 查询、重置按钮是否可操作
  74. createDate: [
  75. getDate.getRecentday().starttime,
  76. getDate.getRecentday().endtime
  77. ],
  78. // 查询参数
  79. queryParam: {
  80. customer: {
  81. customerSn: undefined
  82. },
  83. dealerProduct: {
  84. name: '',
  85. code: ''
  86. },
  87. beginDate: getDate.getRecentday().starttime + ' 00:00:00',
  88. endDate: getDate.getRecentday().endtime + ' 23:59:59'
  89. },
  90. // 表头
  91. columns: [
  92. { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
  93. { title: '分账时间', dataIndex: 'separateTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  94. { title: '客户名称', dataIndex: 'customer.customerName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  95. { title: '关联工单号', dataIndex: 'separateBizNo', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
  96. { title: '产品名称', dataIndex: 'dealerProduct.name', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  97. { title: '产品编码', dataIndex: 'dealerProduct.code', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
  98. { title: '数量', dataIndex: 'productQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  99. { title: '分账金额(¥)', dataIndex: 'separateAmount', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  100. { title: '分账状态', dataIndex: 'stateDictValue', width: 150, align: 'center', customRender: function (text) { return text || '--' } },
  101. { title: '备注', dataIndex: 'remark', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
  102. ],
  103. // 加载数据方法 必须为 Promise 对象
  104. loadData: parameter => {
  105. this.disabled = true
  106. return satelliteWHSeparateList(Object.assign(parameter, this.queryParam)).then(res => {
  107. const data = res.data
  108. const no = (data.pageNo - 1) * data.pageSize
  109. for (var i = 0; i < data.list.length; i++) {
  110. data.list[i].no = no + i + 1
  111. }
  112. this.disabled = false
  113. this.total = data.count || 0
  114. this.getTotal(Object.assign(parameter, this.queryParam))
  115. return data
  116. })
  117. },
  118. total: 0, // 总条数
  119. totalAmount: ''
  120. }
  121. },
  122. methods: {
  123. // 时间 change
  124. dateChange (date) {
  125. this.queryParam.beginDate = date[0] ? date[0] + ' 00:00:00' : ''
  126. this.queryParam.endDate = date[1] ? date[1] + ' 23:59:59' : ''
  127. },
  128. // 合计
  129. getTotal (params) {
  130. satelliteWHSeparateTotal(params).then(res => {
  131. if (res.status == 200) {
  132. this.totalAmount = res.data
  133. } else {
  134. this.totalAmount = ''
  135. }
  136. })
  137. },
  138. custSatelliteChange (val) {
  139. this.queryParam.customer.customerSn = val.key
  140. },
  141. // 重置
  142. resetSearchForm () {
  143. this.$refs.rangeDate.resetDate(this.createDate)
  144. this.queryParam.beginDate = getDate.getRecentday().starttime + ' 00:00:00'
  145. this.queryParam.endDate = getDate.getRecentday().endtime + ' 23:59:59'
  146. this.queryParam.customer.customerSn = undefined
  147. this.queryParam.dealerProduct.name = ''
  148. this.queryParam.dealerProduct.code = ''
  149. this.$refs.custSatelliteList.resetForm()
  150. this.$refs.table.refresh(true)
  151. }
  152. }
  153. }
  154. </script>
  155. <style lang="less">
  156. .ledgerRecordList-wrap{
  157. .sTable{
  158. margin-top: 15px;
  159. }
  160. }
  161. </style>