list.vue 12 KB

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