list.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <a-card size="small" :bordered="false" class="pushOrder-wrap">
  3. <!-- 搜索条件 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline">
  6. <a-row :gutter="15">
  7. <a-col :md="6" :sm="24">
  8. <a-form-item label="创建时间">
  9. <rangeDate ref="rangeDate" @change="dateChange" />
  10. </a-form-item>
  11. </a-col>
  12. <a-col :md="6" :sm="24">
  13. <a-form-item label="客户名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
  14. <custList id="pushOrder-buyerName" ref="custList" @change="custChange"></custList>
  15. </a-form-item>
  16. </a-col>
  17. <a-col :md="6" :sm="24">
  18. <a-form-item label="关联销售单号">
  19. <a-input id="pushOrder-salesBillNo" v-model.trim="queryParam.salesBillNo" 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="pushOrder-dispatchBillNo" v-model.trim="queryParam.dispatchBillNo" allowClear placeholder="请输入备货单号"/>
  26. </a-form-item>
  27. </a-col>
  28. <a-col :md="6" :sm="24">
  29. <a-form-item label="业务状态">
  30. <v-select
  31. v-model="queryParam.billStatus"
  32. ref="billStatus"
  33. id="pushOrder-billStatus"
  34. code="DISPATCH_BILL_STATUS"
  35. placeholder="请选择业务状态"
  36. allowClear></v-select>
  37. </a-form-item>
  38. </a-col>
  39. </template>
  40. <a-col :md="6" :sm="24">
  41. <span class="table-page-search-submitButtons">
  42. <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
  43. <a-button style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
  44. <a @click="advanced=!advanced" style="margin-left: 8px">
  45. {{ advanced ? '收起' : '展开' }}
  46. <a-icon :type="advanced ? 'up' : 'down'"/>
  47. </a>
  48. </span>
  49. </a-col>
  50. </a-row>
  51. </a-form>
  52. </div>
  53. <!-- alert -->
  54. <a-alert type="info" showIcon style="margin-bottom:15px">
  55. <div slot="message">
  56. 下推总单数::<strong>{{ totalData.totalRecord }}</strong>;
  57. 下推总数量:<strong>{{ totalData.totalQty }}</strong>;
  58. 下推总金额:<strong>{{ totalData.totalAmount }}</strong>元;
  59. </div>
  60. </a-alert>
  61. <!-- 列表 -->
  62. <s-table
  63. class="sTable"
  64. ref="table"
  65. size="default"
  66. :rowKey="(record) => record.id"
  67. :columns="columns"
  68. :data="loadData"
  69. :scroll="{ x: 1510, y:tableHeight }"
  70. bordered>
  71. <!-- 销售单号 -->
  72. <template slot="salesBillNo" slot-scope="text, record">
  73. <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record,0)">{{ record.salesBillNo }}</span>
  74. </template>
  75. <!-- 备货单号 -->
  76. <template slot="dispatchBillNo" slot-scope="text, record">
  77. <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record,1)">{{ record.dispatchBillNo }}</span>
  78. </template>
  79. </s-table>
  80. </a-card>
  81. </template>
  82. <script>
  83. import rangeDate from '@/views/common/rangeDate.vue'
  84. import { STable, VSelect } from '@/components'
  85. import custList from '@/views/common/custList.vue'
  86. import { dispatchlList, dispatchQueryCount } from '@/api/dispatch'
  87. export default {
  88. name: 'TableList',
  89. components: { STable, VSelect, custList, rangeDate },
  90. data () {
  91. return {
  92. tableHeight: 0,
  93. advanced: false, // 高级搜索 展开/关闭
  94. disabled: false, // 查询、重置按钮是否可操作
  95. // 查询参数
  96. queryParam: {
  97. beginDate: '',
  98. endDate: '',
  99. buyerSn: undefined, // 客户名称
  100. salesBillNo: '', // 销售单号
  101. dispatchBillNo: '', // 备货单号
  102. billStatus: undefined // 业务状态
  103. },
  104. totalData: {
  105. totalAmount: 0,
  106. totalQty: 0,
  107. totalRecord: 0
  108. },
  109. // 表头
  110. columns: [
  111. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  112. // { title: '区域', dataIndex: 'shippingAddrCountyName', width: 120, align: 'center' },
  113. // { title: '省份', dataIndex: 'shippingAddrProvinceName', width: 120, align: 'center' },
  114. { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
  115. { title: '备货单号', scopedSlots: { customRender: 'dispatchBillNo' }, width: 210, align: 'center' },
  116. { title: '关联销售单号', scopedSlots: { customRender: 'salesBillNo' }, width: 210, align: 'center' },
  117. { title: '客户名称', dataIndex: 'buyerName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  118. { title: '下推数量', dataIndex: 'totalQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  119. { title: '下推金额', dataIndex: 'totalAmount', width: 100, align: 'center', customRender: function (text) { return '¥' + (text || 0) } },
  120. { title: '备货时间', dataIndex: 'stockUpDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  121. { title: '出库时间', dataIndex: 'stockOutDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  122. { title: '业务状态', dataIndex: 'billStatusDictValue', width: 110, align: 'center' }
  123. ],
  124. // 加载数据方法 必须为 Promise 对象
  125. loadData: parameter => {
  126. this.disabled = true
  127. if (this.tableHeight == 0) {
  128. this.tableHeight = window.innerHeight - 440
  129. }
  130. // 查询总计
  131. dispatchQueryCount(Object.assign(parameter, this.queryParam)).then(res => {
  132. console.log(res)
  133. this.totalData = Object.assign(this.totalData, res.data || {})
  134. })
  135. return dispatchlList(Object.assign(parameter, this.queryParam)).then(res => {
  136. const data = res.data
  137. const no = (data.pageNo - 1) * data.pageSize
  138. for (var i = 0; i < data.list.length; i++) {
  139. data.list[i].no = no + i + 1
  140. }
  141. this.disabled = false
  142. return data
  143. })
  144. }
  145. }
  146. },
  147. methods: {
  148. // 时间 change
  149. dateChange (date) {
  150. this.queryParam.beginDate = date[0]
  151. this.queryParam.endDate = date[1]
  152. },
  153. custChange (val) {
  154. this.queryParam.buyerSn = val.key
  155. },
  156. // 详情
  157. handleDetail (row, type) {
  158. if (type == 0) {
  159. this.$router.push({ name: 'salesDetail', params: { sn: row.salesBillSn } })
  160. } else {
  161. this.$router.push({ name: 'pushOrderDetail', params: { sn: row.dispatchBillSn, type: 'pushOrder' } })
  162. }
  163. },
  164. // 重置
  165. resetSearchForm () {
  166. this.$refs.rangeDate.resetDate()
  167. this.queryParam.beginDate = ''
  168. this.queryParam.endDate = ''
  169. this.queryParam.buyerSn = undefined
  170. this.$refs.custList.resetForm()
  171. this.queryParam.salesBillNo = ''
  172. this.queryParam.purchaseBillNo = ''
  173. this.queryParam.payType = undefined
  174. this.queryParam.billStatus = undefined
  175. this.queryParam.financialStatus = undefined
  176. this.$refs.table.refresh(true)
  177. }
  178. },
  179. beforeRouteEnter (to, from, next) {
  180. next(vm => {
  181. })
  182. }
  183. }
  184. </script>
  185. <style lang="less">
  186. .pushOrder-wrap{
  187. .sTable{
  188. margin-top: 15px;
  189. }
  190. }
  191. </style>