list.vue 7.9 KB

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