list.vue 14 KB

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