list.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <a-card size="small" :bordered="false" class="urgentItemsOffsetList-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <!-- 搜索条件 -->
  5. <div ref="tableSearch" class="table-page-search-wrapper">
  6. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  7. <a-row :gutter="15">
  8. <a-col :md="6" :sm="24">
  9. <a-form-item label="创建时间">
  10. <rangeDate ref="rangeDate" @change="dateChange" />
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="24">
  14. <a-form-item label="客户名称">
  15. <custList ref="custList" @change="custChange" v-model="queryParam.buyerSn"></custList>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="店内单号">
  20. <a-input id="urgentItemsOffsetList-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入店内单号"/>
  21. </a-form-item>
  22. </a-col>
  23. <template v-if="advanced">
  24. <a-col :md="6" :sm="24">
  25. <a-form-item label="急件单号">
  26. <a-input id="urgentItemsOffsetList-urgentBillNo" v-model.trim="queryParam.urgentBillNo" allowClear placeholder="请输入急件单号"/>
  27. </a-form-item>
  28. </a-col>
  29. <a-col :md="6" :sm="24">
  30. <a-form-item label="状态">
  31. <v-select
  32. v-model="queryParam.status"
  33. ref="status"
  34. id="chainTransferInList-status"
  35. code="URGENT_STATUS"
  36. placeholder="请选择状态"
  37. allowClear></v-select>
  38. </a-form-item>
  39. </a-col>
  40. </template>
  41. <a-col :md="6" :sm="24">
  42. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="urgentItemsOffsetList-refresh">查询</a-button>
  43. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="urgentItemsOffsetList-reset">重置</a-button>
  44. <a @click="advanced=!advanced" style="margin-left: 8px">
  45. {{ advanced ? '收起' : '展开' }}
  46. <a-icon :type="advanced ? 'up' : 'down'"/>
  47. </a>
  48. </a-col>
  49. </a-row>
  50. </a-form>
  51. </div>
  52. <!-- 列表 -->
  53. <s-table
  54. class="sTable fixPagination"
  55. ref="table"
  56. :style="{ height: tableHeight+84.5+'px' }"
  57. size="small"
  58. :rowKey="(record) => record.id"
  59. :columns="columns"
  60. :data="loadData"
  61. :scroll="{ x: 1100, y: tableHeight }"
  62. bordered>
  63. <!-- 单号 -->
  64. <template slot="urgentBillNo" slot-scope="text, record">
  65. <span style="color: #ed1c24;cursor: pointer;" v-if="$hasPermissions('M_urgentDetail')" @click="handleDetail(record)">{{ record.urgentBillNo }}</span>
  66. <span v-else>{{ record.urgentBillNo }}</span>
  67. </template>
  68. </s-table>
  69. </a-spin>
  70. </a-card>
  71. </template>
  72. <script>
  73. import { urgentList } from '@/api/urgent'
  74. import { STable, VSelect } from '@/components'
  75. import rangeDate from '@/views/common/rangeDate.vue'
  76. import custList from '@/views/common/custList.vue'
  77. export default {
  78. components: { STable, VSelect, rangeDate, custList },
  79. data () {
  80. return {
  81. spinning: false,
  82. tableHeight: 0,
  83. advanced: true, // 高级搜索 展开/关闭
  84. queryParam: { // 查询条件
  85. beginDate: '',
  86. endDate: '',
  87. buyerSn: undefined, // 客户名称
  88. salesBillNo: '', // 销售单号
  89. urgentBillNo: '', // 急件单号
  90. status: undefined // 状态
  91. },
  92. disabled: false, // 查询、重置按钮是否可操作
  93. columns: [
  94. { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
  95. { title: '急件单号', scopedSlots: { customRender: 'urgentBillNo' }, width: 180, align: 'center' },
  96. { title: '店内单号', dataIndex: 'salesBillNo', width: 180, align: 'center', customRender: function (text) { return text || '--' } },
  97. { title: '客户名称', dataIndex: 'buyerName', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
  98. { title: '总款数', dataIndex: 'totalCategory', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  99. { title: '总数量', dataIndex: 'totalQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  100. { title: '创建时间', dataIndex: 'createDate', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  101. { title: '冲减时间', dataIndex: 'offSetTime', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  102. { title: '状态', dataIndex: 'statusDictValue', width: 80, align: 'center', customRender: function (text) { return text || '--' } }
  103. ],
  104. // 加载数据方法 必须为 Promise 对象
  105. loadData: parameter => {
  106. this.disabled = true
  107. this.spinning = true
  108. return urgentList(Object.assign(parameter, this.queryParam)).then(res => {
  109. const data = res.data
  110. const no = (data.pageNo - 1) * data.pageSize
  111. for (var i = 0; i < data.list.length; i++) {
  112. data.list[i].no = no + i + 1
  113. }
  114. this.disabled = false
  115. this.spinning = false
  116. return data
  117. })
  118. }
  119. }
  120. },
  121. methods: {
  122. // 时间 change
  123. dateChange (date) {
  124. this.queryParam.beginDate = date[0]
  125. this.queryParam.endDate = date[1]
  126. },
  127. // 重置
  128. resetSearchForm () {
  129. this.$refs.rangeDate.resetDate()
  130. this.queryParam.beginDate = ''
  131. this.queryParam.endDate = ''
  132. this.queryParam.buyerSn = undefined
  133. this.queryParam.salesBillNo = ''
  134. this.queryParam.urgentBillNo = ''
  135. this.queryParam.status = undefined
  136. this.$refs.custList.resetForm()
  137. this.$refs.table.refresh(true)
  138. },
  139. // 详情
  140. handleDetail (row) {
  141. this.$router.push({ path: `/salesManagement/urgentItemsOffset/detail/${row.urgentBillSn}` })
  142. },
  143. // 客户 change
  144. custChange (obj) {
  145. this.queryParam.buyerSn = obj.key || undefined
  146. },
  147. setTableH () {
  148. const tableSearchH = this.$refs.tableSearch.offsetHeight
  149. this.tableHeight = window.innerHeight - tableSearchH - 195
  150. }
  151. },
  152. mounted () {
  153. const _this = this
  154. this.$nextTick(() => { // 页面渲染完成后的回调
  155. _this.setTableH()
  156. })
  157. },
  158. watch: {
  159. advanced (newValue, oldValue) {
  160. const _this = this
  161. setTimeout(() => {
  162. _this.setTableH()
  163. }, 400)
  164. }
  165. },
  166. beforeRouteEnter (to, from, next) {
  167. next(vm => {})
  168. }
  169. }
  170. </script>
  171. <style lang="less">
  172. .urgentItemsOffsetList-wrap{
  173. .red{
  174. color: #ed1c24;
  175. }
  176. .green{
  177. color: #19be6b;
  178. }
  179. }
  180. </style>