list.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <a-card size="small" :bordered="false" class="backorderList-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" @change="dateChange" />
  10. </a-form-item>
  11. </a-col>
  12. <a-col :md="6" :sm="24">
  13. <a-form-item label="客户名称">
  14. <custList ref="custList" id="backorderList-buyerSn" @change="custChange"></custList>
  15. </a-form-item>
  16. </a-col>
  17. <a-col :md="6" :sm="24">
  18. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="backorderList-refresh">查询</a-button>
  19. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="backorderList-reset">重置</a-button>
  20. </a-col>
  21. </a-row>
  22. </a-form>
  23. </div>
  24. <!-- 列表 -->
  25. <s-table
  26. class="sTable"
  27. ref="table"
  28. size="small"
  29. :rowKey="(record) => record.id"
  30. :columns="columns"
  31. :data="loadData"
  32. :scroll="{ x: 1120, y: tableHeight }"
  33. bordered>
  34. <!-- 操作 -->
  35. <template slot="action" slot-scope="text, record">
  36. <a-button size="small" type="link" @click="handleDetail(record)" v-if="$hasPermissions('B_oosDetail')" id="backorderList-detail-btn">详情</a-button>
  37. <span v-else>--</span>
  38. </template>
  39. </s-table>
  40. <!-- 详情 -->
  41. <backorder-detail-modal :openModal="openModal" :itemSn="itemSn" @close="closeModal" />
  42. </a-card>
  43. </template>
  44. <script>
  45. import rangeDate from '@/views/common/rangeDate.vue'
  46. import custList from '@/views/common/custList.vue'
  47. import { STable, VSelect } from '@/components'
  48. import backorderDetailModal from './detailModal.vue'
  49. import { oosList } from '@/api/oos'
  50. export default {
  51. components: { STable, VSelect, custList, backorderDetailModal, rangeDate },
  52. data () {
  53. return {
  54. tableHeight: 0, // 表格高度
  55. queryParam: { // 查询条件
  56. beginDate: '',
  57. endDate: '',
  58. buyerSn: undefined
  59. },
  60. disabled: false, // 查询、重置按钮是否可操作
  61. columns: [
  62. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  63. { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  64. { title: '销售单号', dataIndex: 'salesBillNo', align: 'center', customRender: function (text) { return text || '--' } },
  65. { title: '客户名称', dataIndex: 'dealerName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  66. { title: '缺货款数', dataIndex: 'totalCategory', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  67. { title: '缺货数量', dataIndex: 'totalQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  68. { title: '缺货金额', dataIndex: 'totalAmount', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  69. { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
  70. ],
  71. // 加载数据方法 必须为 Promise 对象
  72. loadData: parameter => {
  73. this.disabled = true
  74. if (this.tableHeight == 0) {
  75. this.tableHeight = window.innerHeight - 315
  76. }
  77. return oosList(Object.assign(parameter, this.queryParam)).then(res => {
  78. const data = res.data
  79. const no = (data.pageNo - 1) * data.pageSize
  80. for (var i = 0; i < data.list.length; i++) {
  81. data.list[i].no = no + i + 1
  82. }
  83. this.disabled = false
  84. return data
  85. })
  86. },
  87. openModal: false,
  88. itemSn: ''
  89. }
  90. },
  91. methods: {
  92. // 时间 change
  93. dateChange (date) {
  94. this.queryParam.beginDate = date[0]
  95. this.queryParam.endDate = date[1]
  96. },
  97. custChange (obj) {
  98. this.queryParam.buyerSn = obj.key
  99. },
  100. // 重置
  101. resetSearchForm () {
  102. this.$refs.rangeDate.resetDate()
  103. this.queryParam.beginDate = ''
  104. this.queryParam.endDate = ''
  105. this.queryParam.buyerSn = undefined
  106. this.$refs.table.refresh(true)
  107. },
  108. // 关闭
  109. closeModal () {
  110. this.itemSn = ''
  111. this.openModal = false
  112. },
  113. // 详情
  114. handleDetail (row) {
  115. this.itemSn = row.oosBillSn
  116. this.openModal = true
  117. }
  118. }
  119. }
  120. </script>