list.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <template>
  2. <div>
  3. <a-card size="small" :bordered="false" class="searchBoxNormal">
  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="5" :sm="24">
  9. <a-form-item label="创建时间">
  10. <rangeDate ref="rangeDate" @change="dateChange" />
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="5" :sm="24">
  14. <a-form-item label="客户名称">
  15. <dealerSubareaScopeList ref="custList" id="backorderList-buyerSn" @change="custChange"></dealerSubareaScopeList>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="5" :sm="24">
  19. <a-form-item label="销售单号">
  20. <a-input id="backorderList-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
  21. </a-form-item>
  22. </a-col>
  23. <!-- <a-col :md="6" :sm="24">
  24. <a-form-model-item label="仓库">
  25. <chooseWarehouse ref="warehouse" v-model="queryParam.warehouseSn"></chooseWarehouse>
  26. </a-form-model-item>
  27. </a-col> -->
  28. <a-col :md="5" :sm="24" v-show="isShowCustomerSearch">
  29. <a-form-item label="客服">
  30. <customerService ref="customerName" v-model="queryParam.bizUserSn"></customerService>
  31. </a-form-item>
  32. </a-col>
  33. <a-col :md="4" :sm="24">
  34. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="backorderList-refresh">查询</a-button>
  35. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="backorderList-reset">重置</a-button>
  36. </a-col>
  37. </a-row>
  38. </a-form>
  39. </div>
  40. </a-card>
  41. <a-card size="small" :bordered="false" class="backorderList-wrap">
  42. <a-spin :spinning="spinning" tip="Loading...">
  43. <!-- 列表 -->
  44. <s-table
  45. class="sTable fixPagination"
  46. ref="table"
  47. :style="{ height: tableHeight+70+'px' }"
  48. size="small"
  49. :rowKey="(record) => record.no"
  50. rowKeyName="no"
  51. :columns="columns"
  52. :pageSize="30"
  53. :data="loadData"
  54. :scroll="{ y: tableHeight }"
  55. :defaultLoadData="false"
  56. bordered>
  57. <template slot="salesBillNo" slot-scope="text, record">
  58. <span style="padding-right: 15px;">{{ text }}</span>
  59. <a-badge count="促" v-if="record.promoFlag==1" :number-style="{ backgroundColor: '#52c41a', zoom:'80%' }"></a-badge>
  60. </template>
  61. <!-- 操作 -->
  62. <template slot="action" slot-scope="text, record">
  63. <a-button
  64. size="small"
  65. type="link"
  66. class="button-success"
  67. @click="handleDetail(record)"
  68. v-if="$hasPermissions('B_oosDetail')"
  69. id="backorderList-detail-btn">详情</a-button>
  70. <span v-else>--</span>
  71. </template>
  72. </s-table>
  73. </a-spin>
  74. <!-- 详情 -->
  75. <backorder-detail-modal v-drag :openModal="openModal" :itemSn="itemSn" @close="closeModal" />
  76. </a-card>
  77. </div>
  78. </template>
  79. <script>
  80. import { commonMixin } from '@/utils/mixin'
  81. import rangeDate from '@/views/common/rangeDate.vue'
  82. import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
  83. import { STable, VSelect } from '@/components'
  84. import backorderDetailModal from './detailModal.vue'
  85. import chooseWarehouse from '@/views/common/chooseWarehouse'
  86. import customerService from '@/views/common/customerService'
  87. import { oosList } from '@/api/oos'
  88. export default {
  89. name: 'BackorderList',
  90. mixins: [commonMixin],
  91. components: { STable, VSelect, dealerSubareaScopeList, backorderDetailModal, rangeDate, chooseWarehouse, customerService },
  92. data () {
  93. return {
  94. spinning: false,
  95. tableHeight: 0, // 表格高度
  96. queryParam: { // 查询条件
  97. beginDate: '',
  98. endDate: '',
  99. buyerSn: undefined,
  100. warehouseSn: undefined,
  101. salesBillNo: '',
  102. bizUserSn: undefined
  103. },
  104. disabled: false, // 查询、重置按钮是否可操作
  105. // 加载数据方法 必须为 Promise 对象
  106. loadData: parameter => {
  107. this.disabled = true
  108. this.spinning = true
  109. return oosList(Object.assign(parameter, this.queryParam)).then(res => {
  110. let data
  111. if (res.status == 200) {
  112. data = res.data
  113. const no = (data.pageNo - 1) * data.pageSize
  114. for (var i = 0; i < data.list.length; i++) {
  115. data.list[i].no = no + i + 1
  116. }
  117. this.disabled = false
  118. }
  119. this.spinning = false
  120. return data
  121. })
  122. },
  123. openModal: false,
  124. itemSn: ''
  125. }
  126. },
  127. computed: {
  128. columns () {
  129. const arr = [
  130. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  131. { title: '创建时间', dataIndex: 'createDate', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  132. { title: '销售单号', dataIndex: 'salesBillNo', width: '15%', align: 'center', scopedSlots: { customRender: 'salesBillNo' } },
  133. { title: '客户名称', dataIndex: 'dealerName', width: '25%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  134. // { title: '仓库', dataIndex: 'warehouseName', width: '15%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  135. { title: '缺货款数', dataIndex: 'totalCategory', width: '11%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  136. { title: '缺货数量', dataIndex: 'totalQty', width: '11%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  137. // { title: '缺货金额', dataIndex: 'totalAmount', width: '11%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  138. { title: '操作', scopedSlots: { customRender: 'action' }, width: '11%', align: 'center' }
  139. ]
  140. if (this.$hasPermissions('M_backorderList_salesPrice')) { // 售价权限
  141. arr.splice(6, 0, { title: '缺货金额', dataIndex: 'totalAmount', width: '11%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
  142. }
  143. return arr
  144. }
  145. },
  146. methods: {
  147. // 时间 change
  148. dateChange (date) {
  149. this.queryParam.beginDate = date[0]
  150. this.queryParam.endDate = date[1]
  151. },
  152. custChange (obj) {
  153. this.queryParam.buyerSn = obj.key
  154. },
  155. // 重置
  156. resetSearchForm () {
  157. this.$refs.rangeDate.resetDate()
  158. this.queryParam.beginDate = ''
  159. this.queryParam.endDate = ''
  160. this.queryParam.salesBillNo = ''
  161. this.queryParam.buyerSn = undefined
  162. this.queryParam.warehouseSn = undefined
  163. this.queryParam.bizUserSn = undefined
  164. this.$refs.custList.resetForm()
  165. this.$refs.table.refresh(true)
  166. },
  167. // 关闭
  168. closeModal () {
  169. this.itemSn = ''
  170. this.openModal = false
  171. },
  172. // 详情
  173. handleDetail (row) {
  174. this.itemSn = row.oosBillSn
  175. this.openModal = true
  176. },
  177. pageInit () {
  178. const _this = this
  179. this.$nextTick(() => { // 页面渲染完成后的回调
  180. _this.setTableH()
  181. })
  182. },
  183. setTableH () {
  184. const tableSearchH = this.$refs.tableSearch.offsetHeight
  185. this.tableHeight = window.innerHeight - tableSearchH - 202
  186. }
  187. },
  188. watch: {
  189. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  190. this.setTableH()
  191. }
  192. },
  193. mounted () {
  194. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  195. this.pageInit()
  196. this.resetSearchForm()
  197. }
  198. },
  199. activated () {
  200. // 如果是新页签打开,则重置当前页面
  201. if (this.$store.state.app.isNewTab) {
  202. this.pageInit()
  203. this.resetSearchForm()
  204. }
  205. // 仅刷新列表,不重置页面
  206. if (this.$store.state.app.updateList) {
  207. this.pageInit()
  208. this.$refs.table.refresh()
  209. }
  210. },
  211. beforeRouteEnter (to, from, next) {
  212. next(vm => {})
  213. }
  214. }
  215. </script>