list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <template>
  2. <a-card size="small" :bordered="false" class="outboundOrderList-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="outboundOrderList-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-input id="outboundOrderList-demanderName" v-model.trim="queryParam.demanderName" allowClear placeholder="请输入客户名称"/>
  22. </a-form-item>
  23. </a-col>
  24. <a-col :md="6" :sm="24">
  25. <a-form-item label="出库类型">
  26. <v-select
  27. v-model="queryParam.outBizType"
  28. ref="outBizType"
  29. id="outboundOrderList-outBizType"
  30. code="OUT_STOCK_TYPE"
  31. placeholder="请选择出库类型"
  32. allowClear></v-select>
  33. </a-form-item>
  34. </a-col>
  35. <template v-if="advanced">
  36. <a-col :md="6" :sm="24">
  37. <a-form-item label="出库状态">
  38. <v-select
  39. v-model="queryParam.state"
  40. ref="state"
  41. id="outboundOrderList-state"
  42. code="OUT_STATE"
  43. placeholder="请选择出库状态"
  44. allowClear></v-select>
  45. </a-form-item>
  46. </a-col>
  47. </template>
  48. <a-col :md="6" :sm="24">
  49. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="outboundOrderList-refresh" style="margin-bottom: 15px;">查询</a-button>
  50. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="outboundOrderList-reset">重置</a-button>
  51. <a @click="advanced=!advanced" style="margin-left: 8px">
  52. {{ advanced ? '收起' : '展开' }}
  53. <a-icon :type="advanced ? 'up' : 'down'"/>
  54. </a>
  55. </a-col>
  56. </a-row>
  57. </a-form>
  58. </div>
  59. <!-- 列表 -->
  60. <!-- 暂不做 -->
  61. <!-- <div style="margin-bottom: 15px">
  62. <a-button type="primary" id="outboundOrder-export" :disabled="!hasSelected" :loading="loading" @click="handleOutbounds">批量出库</a-button>
  63. <span style="margin-left: 8px">
  64. <template v-if="hasSelected">{{ `已选 ${selectedRowKeys.length} 项` }}</template>
  65. </span>
  66. </div> -->
  67. <!-- <s-table
  68. class="sTable"
  69. ref="table"
  70. size="default"
  71. :row-selection="rowSelection"
  72. :rowKey="(record) => record.id"
  73. :columns="columns"
  74. :data="loadData"
  75. :showPagination="false"
  76. :scroll="{ x: 1710 }"
  77. bordered> -->
  78. <s-table
  79. class="sTable"
  80. ref="table"
  81. size="default"
  82. :rowKey="(record) => record.id"
  83. :columns="columns"
  84. :data="loadData"
  85. :scroll="{ x: 1720, y: tableHeight }"
  86. bordered>
  87. <!-- 单号 -->
  88. <template slot="outBizNo" slot-scope="text, record">
  89. <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record)">{{ record.outBizNo }}</span>
  90. </template>
  91. <!-- 操作 -->
  92. <template slot="action" slot-scope="text, record">
  93. <a-button
  94. size="small"
  95. type="link"
  96. v-if="record.state=='WAIT'"
  97. class="button-primary"
  98. @click="handleOutbound(record)"
  99. id="outboundOrderList-out-btn">出库</a-button>
  100. </template>
  101. </s-table>
  102. </a-card>
  103. </template>
  104. <script>
  105. import moment from 'moment'
  106. import { STable, VSelect } from '@/components'
  107. import { stockOutList, stockOutOut } from '@/api/stockOut'
  108. export default {
  109. components: { STable, VSelect },
  110. data () {
  111. return {
  112. advanced: false, // 高级搜索 展开/关闭
  113. tableHeight: 0, // 表格高度
  114. queryParam: { // 查询条件
  115. demanderName: '', // 客户名称
  116. outBizType: undefined, // 出库类型
  117. state: undefined // 状态
  118. },
  119. disabled: false, // 查询、重置按钮是否可操作
  120. dateFormat: 'YYYY-MM-DD',
  121. time: [], // 审核时间
  122. columns: [
  123. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  124. { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
  125. { title: '下推单号', scopedSlots: { customRender: 'outBizNo' }, width: 220, align: 'center' },
  126. { title: '单号', dataIndex: 'stockOutNo', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
  127. { title: '出库类型', dataIndex: 'outBizTypeDictValue', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  128. { title: '客户名称', dataIndex: 'demanderName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  129. { title: '数量', dataIndex: 'productTotalQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  130. { title: '售价', dataIndex: 'productTotalPrice', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  131. { title: '出库时间', dataIndex: 'outTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  132. { title: '出库状态', dataIndex: 'stateDictValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  133. { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
  134. ],
  135. selectedRowKeys: [], // Check here to configure the default column
  136. loading: false,
  137. // 加载数据方法 必须为 Promise 对象
  138. loadData: parameter => {
  139. this.disabled = true
  140. if (this.tableHeight == 0) {
  141. this.tableHeight = window.innerHeight - 260
  142. }
  143. // 审核时间
  144. if (this.time && this.time.length > 0) {
  145. this.queryParam.beginDate = moment(this.time[0]).format(this.dateFormat)
  146. this.queryParam.endDate = moment(this.time[1]).format(this.dateFormat)
  147. } else {
  148. this.queryParam.beginDate = undefined
  149. this.queryParam.endDate = undefined
  150. }
  151. return stockOutList(Object.assign(parameter, this.queryParam)).then(res => {
  152. const data = res.data
  153. const no = (data.pageNo - 1) * data.pageSize
  154. for (var i = 0; i < data.list.length; i++) {
  155. data.list[i].no = no + i + 1
  156. }
  157. this.disabled = false
  158. return data
  159. })
  160. }
  161. }
  162. },
  163. computed: {
  164. hasSelected () {
  165. return this.selectedRowKeys.length > 0
  166. },
  167. rowSelection () {
  168. return {
  169. selectedRowKeys: this.selectedRowKeys,
  170. onChange: (selectedRowKeys, selectedRows) => {
  171. this.onSelectChange(selectedRowKeys)
  172. },
  173. getCheckboxProps: record => ({
  174. props: {
  175. disabled: record.state == 'FINISH' // Column configuration not to be checked
  176. }
  177. })
  178. }
  179. }
  180. },
  181. methods: {
  182. // 不可选日期
  183. disabledDate (date, dateStrings) {
  184. return date && date.valueOf() > Date.now()
  185. },
  186. filterOption (input, option) {
  187. return (
  188. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  189. )
  190. },
  191. // 重置
  192. resetSearchForm () {
  193. this.queryParam.demanderName = ''
  194. this.queryParam.outBizType = undefined
  195. this.queryParam.state = undefined
  196. this.time = []
  197. this.$refs.table.refresh(true)
  198. },
  199. // 详情
  200. handleDetail (row) {
  201. // 根据出库类型跳转对应页面
  202. // if (row.outBizType == 'PURCHASE_RETURN') { // 采购退货
  203. // this.$router.push({ path: `/purchasingManagement/purchaseReturn/detail/${row.outBizSn}` })
  204. // } else if (row.outBizType == 'SPARE_PARTS_RETURN') { // 散件退货
  205. // this.$message.warning('该出库类型对应页面未开发')
  206. // // this.$router.push({ path: `/purchasingManagement/purchaseReturn/detail/${row.outBizSn}` })
  207. // } else if (row.outBizType == 'SALES') { // 出库
  208. // this.$router.push({ path: `/salesManagement/salesQuery/detail/${row.outBizSn}` })
  209. // } else if (row.outBizType == 'DISPATCH_DEDUCT') { // 急件冲减
  210. // this.$router.push({ path: `/salesManagement/urgentItemsOffset/detail/${row.outBizSn}` })
  211. // } else if (row.outBizType == 'SHOP_CALL_OUT') { // 店内调出
  212. // this.$router.push({ path: `/allocationManagement/storeTransferOut/detail/${row.outBizSn}` })
  213. // } else if (row.outBizType == 'CHECK_ORDER_OUT') { // 库存盘点盘亏
  214. // this.$message.warning('该出库类型对应页面未开发')
  215. // // this.$router.push({ path: `/purchasingManagement/purchaseReturn/detail/${row.outBizSn}` })
  216. // } else if (row.outBizType == 'LINKAGE_CALL_OUT') { // 连锁调出
  217. // this.$message.warning('该出库类型对应页面未开发')
  218. // // this.$router.push({ path: `/purchasingManagement/purchaseReturn/detail/${row.outBizSn}` })
  219. // } else if (row.outBizType == 'WAREHOUSE_CALL_OUT') { // 仓库调出
  220. // this.$router.push({ path: `/allocationManagement/warehouseAllocation/detail/${row.outBizSn}` })
  221. // } else {
  222. // this.$message.warning('出库类型未知')
  223. // }
  224. },
  225. // 单个出库
  226. handleOutbound (row) {
  227. const _this = this
  228. this.$confirm({
  229. title: '提示',
  230. content: '确认要出库吗?',
  231. centered: true,
  232. onOk () {
  233. stockOutOut(Object.assign(row, { outStockEnum: row.outBizType })).then(res => {
  234. if (res.status == 200) {
  235. _this.$message.success(res.message)
  236. _this.$refs.table.refresh()
  237. }
  238. })
  239. }
  240. })
  241. },
  242. // 批量出库
  243. handleOutbounds () {
  244. if (this.selectedRowKeys.length < 1) {
  245. this.$message.warning('请在列表勾选后再进行批量操作!')
  246. return
  247. }
  248. this.loading = true
  249. // ajax request after empty completing
  250. setTimeout(() => {
  251. this.loading = false
  252. this.selectedRowKeys = []
  253. }, 1000)
  254. },
  255. onSelectChange (selectedRowKeys) {
  256. console.log('selectedRowKeys changed: ', selectedRowKeys)
  257. this.selectedRowKeys = selectedRowKeys
  258. }
  259. }
  260. }
  261. </script>