list.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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. <rangeDateTime 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 moment from 'moment'
  64. import getDate from '@/libs/getDate.js'
  65. import { STable, VSelect } from '@/components'
  66. import rangeDateTime from '@/views/common/rangeDateTime.vue'
  67. import custSatelliteList from '@/views/common/custSatelliteList.vue'
  68. import { satelliteWHSeparateList, satelliteWHSeparateTotal } from '@/api/satelliteWH'
  69. export default {
  70. components: { STable, VSelect, rangeDateTime, custSatelliteList },
  71. data () {
  72. return {
  73. advanced: false, // 高级搜索 展开/关闭
  74. disabled: false, // 查询、重置按钮是否可操作
  75. createDate: [
  76. moment(getDate.getRecentTime().starttime, 'YYYY-MM-DD HH:mm:ss'),
  77. moment(getDate.getRecentTime().endtime, 'YYYY-MM-DD HH:mm:ss')
  78. ],
  79. // 查询参数
  80. queryParam: {
  81. customer: {
  82. customerSn: undefined
  83. },
  84. dealerProduct: {
  85. name: '',
  86. code: ''
  87. },
  88. beginDate: getDate.getRecentTime().starttime,
  89. endDate: getDate.getRecentTime().endtime
  90. },
  91. // 表头
  92. columns: [
  93. { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
  94. { title: '分账时间', dataIndex: 'separateTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  95. { title: '客户名称', dataIndex: 'customer.customerName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  96. { title: '关联工单号', dataIndex: 'separateBizNo', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
  97. { title: '配件名称', dataIndex: 'dealerProduct.name', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  98. { title: '配件编码', dataIndex: 'dealerProduct.code', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
  99. { title: '数量', dataIndex: 'productQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  100. { title: '分账金额(¥)', dataIndex: 'separateAmount', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  101. { title: '分账状态', dataIndex: 'stateDictValue', width: 150, align: 'center', customRender: function (text) { return text || '--' } },
  102. { title: '备注', dataIndex: 'remark', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
  103. ],
  104. // 加载数据方法 必须为 Promise 对象
  105. loadData: parameter => {
  106. this.disabled = true
  107. return satelliteWHSeparateList(Object.assign(parameter, this.queryParam)).then(res => {
  108. const data = res.data
  109. const no = (data.pageNo - 1) * data.pageSize
  110. for (var i = 0; i < data.list.length; i++) {
  111. data.list[i].no = no + i + 1
  112. }
  113. this.disabled = false
  114. this.total = data.list.length || 0
  115. this.getTotal(Object.assign(parameter, this.queryParam))
  116. return data
  117. })
  118. },
  119. total: 0, // 总条数
  120. totalAmount: ''
  121. }
  122. },
  123. methods: {
  124. // 时间 change
  125. dateChange (date) {
  126. this.queryParam.beginDate = date[0]
  127. this.queryParam.endDate = date[1]
  128. },
  129. // 合计
  130. getTotal (params) {
  131. satelliteWHSeparateTotal(params).then(res => {
  132. if (res.status == 200) {
  133. this.totalAmount = res.data
  134. } else {
  135. this.totalAmount = ''
  136. }
  137. })
  138. },
  139. custSatelliteChange (val) {
  140. this.queryParam.customer.customerSn = val.key
  141. },
  142. // 重置
  143. resetSearchForm () {
  144. this.$refs.rangeDate.resetDate(this.createDate)
  145. this.queryParam.beginDate = getDate.getRecentTime().starttime
  146. this.queryParam.endDate = getDate.getRecentTime().endtime
  147. this.queryParam.customer.customerSn = undefined
  148. this.queryParam.dealerProduct.name = ''
  149. this.queryParam.dealerProduct.code = ''
  150. this.$refs.custSatelliteList.resetForm()
  151. this.$refs.table.refresh(true)
  152. }
  153. }
  154. }
  155. </script>
  156. <style lang="less">
  157. .ledgerRecordList-wrap{
  158. .sTable{
  159. margin-top: 15px;
  160. }
  161. }
  162. </style>