list.vue 14 KB

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