list.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <a-card size="small" :bordered="false" class="urgentItemsOffsetList-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. <a-range-picker
  10. style="width:100%"
  11. id="urgentItemsOffsetList-creatTime"
  12. :disabledDate="disabledDate"
  13. v-model="time"
  14. :format="dateFormat"
  15. :placeholder="['开始时间', '结束时间']" />
  16. </a-form-item>
  17. </a-form-item>
  18. </a-col>
  19. <a-col :md="6" :sm="24">
  20. <a-form-item label="客户名称">
  21. <a-select
  22. id="urgentItemsOffsetList-buyerName"
  23. placeholder="请选择"
  24. allowClear
  25. v-model="queryParam.buyerName"
  26. :showSearch="true"
  27. option-filter-prop="children"
  28. :filter-option="filterOption">
  29. <a-select-option v-for="item in custAllList" :key="item.customerSn" :value="item.customerName">{{ item.customerName }}</a-select-option>
  30. </a-select>
  31. </a-form-item>
  32. </a-col>
  33. <a-col :md="6" :sm="24">
  34. <a-form-item label="销售单号">
  35. <a-input id="urgentItemsOffsetList-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
  36. </a-form-item>
  37. </a-col>
  38. <template v-if="advanced">
  39. <a-col :md="6" :sm="24">
  40. <a-form-item label="急件单号">
  41. <a-input id="urgentItemsOffsetList-urgentBillNo" v-model.trim="queryParam.urgentBillNo" allowClear placeholder="请输入急件单号"/>
  42. </a-form-item>
  43. </a-col>
  44. <a-col :md="6" :sm="24">
  45. <a-form-item label="状态">
  46. <v-select
  47. v-model="queryParam.status"
  48. ref="status"
  49. id="chainTransferInList-status"
  50. code="URGENT_STATUS"
  51. placeholder="请选择状态"
  52. allowClear></v-select>
  53. </a-form-item>
  54. </a-col>
  55. </template>
  56. <a-col :md="6" :sm="24">
  57. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="urgentItemsOffsetList-refresh">查询</a-button>
  58. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="urgentItemsOffsetList-reset">重置</a-button>
  59. <a @click="advanced=!advanced" style="margin-left: 8px">
  60. {{ advanced ? '收起' : '展开' }}
  61. <a-icon :type="advanced ? 'up' : 'down'"/>
  62. </a>
  63. </a-col>
  64. </a-row>
  65. </a-form>
  66. </div>
  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: 1340, y: tableHeight }"
  76. bordered>
  77. <!-- 单号 -->
  78. <template slot="urgentBillNo" slot-scope="text, record">
  79. <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record)">{{ record.urgentBillNo }}</span>
  80. </template>
  81. </s-table>
  82. </a-card>
  83. </template>
  84. <script>
  85. import moment from 'moment'
  86. import { custAllList } from '@/api/customer'
  87. import { urgentList } from '@/api/urgent'
  88. import { STable, VSelect } from '@/components'
  89. export default {
  90. components: { STable, VSelect },
  91. data () {
  92. return {
  93. tableHeight: 0,
  94. advanced: false, // 高级搜索 展开/关闭
  95. queryParam: { // 查询条件
  96. buyerName: undefined, // 客户名称
  97. salesBillNo: '', // 销售单号
  98. urgentBillNo: '', // 急件单号
  99. status: undefined // 状态
  100. },
  101. disabled: false, // 查询、重置按钮是否可操作
  102. dateFormat: 'YYYY-MM-DD',
  103. time: [], // 创建时间
  104. custAllList: [], // 客户下拉数据
  105. columns: [
  106. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  107. { title: '急件单号', scopedSlots: { customRender: 'urgentBillNo' }, width: 220, align: 'center' },
  108. { title: '销售单号', dataIndex: 'salesBillNo', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
  109. { title: '客户名称', dataIndex: 'buyerName', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
  110. { title: '总款数', dataIndex: 'totalCategory', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  111. { title: '总数量', dataIndex: 'totalQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  112. { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
  113. { title: '冲减时间', dataIndex: 'offSetTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  114. { title: '状态', dataIndex: 'statusDictValue', width: 100, align: 'center' }
  115. ],
  116. // 加载数据方法 必须为 Promise 对象
  117. loadData: parameter => {
  118. this.disabled = true
  119. if (this.tableHeight == 0) {
  120. this.tableHeight = window.innerHeight
  121. }
  122. // 创建时间
  123. if (this.time && this.time.length > 0) {
  124. this.queryParam.beginDate = moment(this.time[0]).format(this.dateFormat)
  125. this.queryParam.endDate = moment(this.time[1]).format(this.dateFormat)
  126. } else {
  127. this.queryParam.beginDate = undefined
  128. this.queryParam.endDate = undefined
  129. }
  130. return urgentList(Object.assign(parameter, this.queryParam)).then(res => {
  131. const data = res.data
  132. const no = (data.pageNo - 1) * data.pageSize
  133. for (var i = 0; i < data.list.length; i++) {
  134. data.list[i].no = no + i + 1
  135. }
  136. this.disabled = false
  137. return data
  138. })
  139. }
  140. }
  141. },
  142. methods: {
  143. // 不可选日期
  144. disabledDate (date, dateStrings) {
  145. return date && date.valueOf() > Date.now()
  146. },
  147. filterOption (input, option) {
  148. return (
  149. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  150. )
  151. },
  152. // 重置
  153. resetSearchForm () {
  154. this.queryParam.buyerName = undefined
  155. this.queryParam.salesBillNo = ''
  156. this.queryParam.urgentBillNo = ''
  157. this.queryParam.status = undefined
  158. this.time = []
  159. this.$refs.table.refresh(true)
  160. },
  161. // 详情
  162. handleDetail (row) {
  163. this.$router.push({ path: `/salesManagement/urgentItemsOffset/detail/${row.urgentBillSn}` })
  164. },
  165. // 客户无分页列表数据
  166. getCustAllList () {
  167. const _this = this
  168. custAllList().then(res => {
  169. if (res.status == 200) {
  170. _this.custAllList = res.data || []
  171. } else {
  172. _this.custAllList = []
  173. }
  174. })
  175. }
  176. },
  177. beforeRouteEnter (to, from, next) {
  178. next(vm => {
  179. vm.getCustAllList()
  180. })
  181. }
  182. }
  183. </script>
  184. <style lang="less">
  185. .urgentItemsOffsetList-wrap{
  186. .sTable{
  187. margin-top: 20px;
  188. }
  189. .red{
  190. color: #ed1c24;
  191. }
  192. .green{
  193. color: #19be6b;
  194. }
  195. }
  196. </style>