list.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  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 :xl="6" :lg="6" :md="12" :sm="24">
  9. <a-form-item label="审核时间">
  10. <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
  11. </a-form-item>
  12. </a-col>
  13. <a-col :xl="6" :lg="6" :md="12" :sm="24">
  14. <a-form-item label="单位名称">
  15. <a-input id="outboundOrderList-demanderName" v-model.trim="queryParam.demanderName" placeholder="请输入单位名称" allowClear />
  16. </a-form-item>
  17. </a-col>
  18. <a-col :xl="4" :lg="6" :md="6" :sm="8">
  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. <a-col :xl="4" :lg="6" :md="6" :sm="8">
  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. <a-col :xl="4" :lg="6" :md="6" :sm="8">
  42. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="outboundOrderList-refresh" style="margin-bottom: 10px;">查询</a-button>
  43. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="outboundOrderList-reset">重置</a-button>
  44. </a-col>
  45. </a-row>
  46. </a-form>
  47. </div>
  48. <div v-if="$hasPermissions('B_outboundBatchOut')" style="margin-bottom: 10px">
  49. <a-button type="primary" id="outboundOrderList-export" :loading="loading" @click="handleOutbounds">批量出库</a-button>
  50. <span style="margin-left: 5px" v-if="$hasPermissions('B_outboundBatchOut')">
  51. <template v-if="rowSelectionInfo&&rowSelectionInfo.selectedRowKeys.length>0">
  52. {{ `已选 ${rowSelectionInfo.selectedRowKeys.length} 项` }}
  53. </template>
  54. </span>
  55. </div>
  56. <!-- 列表 -->
  57. <s-table
  58. class="sTable fixPagination"
  59. ref="table"
  60. :style="{ height: tableHeight+84.5+'px' }"
  61. size="small"
  62. :rowKey="(record) => record.outBizSn"
  63. rowKeyName="outBizSn"
  64. :row-selection="$hasPermissions('B_outboundBatchOut') ? { columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: record.state == 'FINISH' } }) } : null"
  65. @rowSelection="rowSelectionFun"
  66. :columns="columns"
  67. :data="loadData"
  68. :scroll="{ y: tableHeight }"
  69. :defaultLoadData="false"
  70. bordered>
  71. <!-- 状态 -->
  72. <template slot="state" slot-scope="text, record">
  73. <stateIcon :title="record.stateDictValue" :state="record.state == 'FINISH'?'1':'2'"></stateIcon>
  74. </template>
  75. <!-- 操作 -->
  76. <template slot="action" slot-scope="text, record">
  77. <a-button
  78. size="small"
  79. type="link"
  80. v-if="record.state=='WAIT'&&$hasPermissions('B_outboundOut')"
  81. class="button-primary"
  82. @click="handleOutbound(record)"
  83. id="outboundOrderList-out-btn">出库</a-button>
  84. <a-button
  85. size="small"
  86. type="link"
  87. v-if="$hasPermissions('B_outboundOrderDetail')"
  88. class="button-success"
  89. @click="handleDetail(record)"
  90. id="outboundOrderList-detail-btn">详情</a-button>
  91. <span v-if="!(record.state=='WAIT'&&$hasPermissions('B_outboundOut')) && !($hasPermissions('B_outboundOrderDetail'))">--</span>
  92. </template>
  93. </s-table>
  94. </a-spin>
  95. <!-- 详情 -->
  96. <a-modal
  97. centered
  98. class="outboundOrderDetail-modal"
  99. :footer="null"
  100. :maskClosable="false"
  101. :bodyStyle="{padding:'12px'}"
  102. :title="detailTitle"
  103. v-model="openModal"
  104. v-if="openModal"
  105. @cancle="cancleModal"
  106. width="80%">
  107. <div style="max-height: 700px;overflow-y: auto;">
  108. <pushOrderDetailModal v-if="outBizType=='PURCHASE_RETURN'" :outBizSn="orderSn" />
  109. <salesDetailModal v-if="outBizType=='SALES'" :outBizSn="orderSn" />
  110. <urgentDetailModal v-if="outBizType=='DISPATCH_DEDUCT'" :outBizSn="orderSn" />
  111. <storeTransferOutDetailModal v-if="outBizType=='SHOP_CALL_OUT'" :outBizSn="orderSn" />
  112. <chainTransferOutDetailModal v-if="outBizType=='LINKAGE_CALL_OUT'" :outBizSn="orderSn" />
  113. <warehouseAllocationDetailModal v-if="outBizType=='WAREHOUSE_CALL_OUT'" :outBizSn="orderSn" />
  114. <warehouseAllocationDetailModal v-if="outBizType=='WAREHOUSE_CALL_OUT'" :outBizSn="orderSn" />
  115. <replenishmentDetailModal v-if="outBizType=='SHELF_REPLENISH'" :outBizSn="orderSn"></replenishmentDetailModal>
  116. </div>
  117. </a-modal>
  118. </a-card>
  119. </template>
  120. <script>
  121. import { commonMixin } from '@/utils/mixin'
  122. import moment from 'moment'
  123. import { STable, VSelect } from '@/components'
  124. import rangeDate from '@/views/common/rangeDate.vue'
  125. import pushOrderDetailModal from '@/views/purchasingManagement/purchaseReturn/detail.vue'
  126. import salesDetailModal from '@/views/salesManagement/salesQuery/detail.vue'
  127. import urgentDetailModal from '@/views/salesManagement/urgentItemsOffset/detail.vue'
  128. import storeTransferOutDetailModal from '@/views/allocationManagement/storeTransferOut/detail.vue'
  129. import chainTransferOutDetailModal from '@/views/allocationManagement/chainTransferOut/detail.vue'
  130. import warehouseAllocationDetailModal from '@/views/allocationManagement/warehouseAllocation/detail.vue'
  131. import replenishmentDetailModal from '@/views/numsGoodsShelves/replenishmentManagement/replenishmentDetail.vue'
  132. import stateIcon from '@/views/common/stateIcon'
  133. import { stockOutList, stockOutOut, stockOutBatchOut } from '@/api/stockOut'
  134. import getDate from '@/libs/getDate.js'
  135. export default {
  136. name: 'OutboundOrderList',
  137. components: { STable, VSelect, rangeDate, pushOrderDetailModal, salesDetailModal, urgentDetailModal, storeTransferOutDetailModal, chainTransferOutDetailModal, warehouseAllocationDetailModal, replenishmentDetailModal, stateIcon },
  138. mixins: [commonMixin],
  139. data () {
  140. return {
  141. spinning: false,
  142. advanced: true, // 高级搜索 展开/关闭
  143. tableHeight: 0, // 表格高度
  144. time: [
  145. moment(getDate.getCurrMonthDays().starttime),
  146. moment(getDate.getCurrMonthDays().endtime)
  147. ],
  148. queryParam: { // 查询条件
  149. beginDate: getDate.getCurrMonthDays().starttime,
  150. endDate: getDate.getCurrMonthDays().endtime,
  151. demanderName: undefined, // 单位名称
  152. outBizType: undefined, // 出库类型
  153. state: undefined // 状态
  154. },
  155. disabled: false, // 查询、重置按钮是否可操作
  156. columns: [
  157. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  158. { title: '关联单号', dataIndex: 'outBizNo', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  159. { title: '出库类型', dataIndex: 'outBizTypeDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  160. { title: '单位名称', dataIndex: 'demanderName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
  161. { title: '总款数', dataIndex: 'productTotalCategory', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  162. { title: '总数量', dataIndex: 'productTotalQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  163. { title: '总售价', dataIndex: 'productTotalPrice', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  164. { title: '审核时间', dataIndex: 'auditTime', width: '11%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true },
  165. { title: '出库时间', dataIndex: 'outTime', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  166. { title: '出库', scopedSlots: { customRender: 'state' }, width: '3%', align: 'center' },
  167. // { title: '出库状态', dataIndex: 'stateDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true },
  168. { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
  169. ],
  170. loading: false,
  171. // 加载数据方法 必须为 Promise 对象
  172. loadData: parameter => {
  173. // 排序
  174. if (parameter.sortField == 'stateDictValue') {
  175. parameter.sortField = 'state'
  176. }
  177. this.disabled = true
  178. this.spinning = true
  179. return stockOutList(Object.assign(parameter, this.queryParam)).then(res => {
  180. let data
  181. if (res.status == 200) {
  182. data = res.data
  183. const no = (data.pageNo - 1) * data.pageSize
  184. for (var i = 0; i < data.list.length; i++) {
  185. data.list[i].no = no + i + 1
  186. }
  187. this.disabled = false
  188. }
  189. this.spinning = false
  190. return data
  191. })
  192. },
  193. openModal: false,
  194. orderSn: undefined,
  195. outBizType: null, // 当前单子类型 SALES销售出库 ALLOCATE调拨出库
  196. rowSelectionInfo: null
  197. }
  198. },
  199. methods: {
  200. // 表格选中项
  201. rowSelectionFun (obj) {
  202. this.rowSelectionInfo = obj || null
  203. },
  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.resetData()
  235. this.$refs.table.refresh(true)
  236. },
  237. // 重置数据
  238. resetData () {
  239. this.$refs.rangeDate.resetDate(this.time)
  240. this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
  241. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  242. this.queryParam.demanderName = undefined
  243. this.queryParam.outBizType = undefined
  244. this.queryParam.state = undefined
  245. },
  246. // 详情
  247. handleDetail (row) {
  248. this.outBizType = row.outBizType
  249. this.detailTitle = row.outBizTypeDictValue + '详情'
  250. // 根据出库类型跳转对应页面
  251. if (row.outBizType == 'PURCHASE_RETURN') { // 采购退货
  252. this.orderSn = row.outBizSn
  253. this.openModal = true
  254. } else if (row.outBizType == 'SPARE_PARTS_RETURN') { // 散件退货
  255. this.$message.warning('该出库类型对应页面未开发')
  256. } else if (row.outBizType == 'SALES') { // 销售
  257. this.orderSn = row.outBizSn
  258. this.openModal = true
  259. } else if (row.outBizType == 'DISPATCH_DEDUCT') { // 急件冲减
  260. this.orderSn = row.outBizSn
  261. this.openModal = true
  262. } else if (row.outBizType == 'SHOP_CALL_OUT') { // 店内调出
  263. this.orderSn = row.outBizSn
  264. this.openModal = true
  265. } else if (row.outBizType == 'CHECK_ORDER_OUT') { // 库存盘点盘亏
  266. this.$message.warning('该出库类型对应页面未开发')
  267. } else if (row.outBizType == 'LINKAGE_CALL_OUT') { // 连锁调出
  268. this.orderSn = row.outBizSn
  269. this.openModal = true
  270. } else if (row.outBizType == 'WAREHOUSE_CALL_OUT') { // 仓库调出
  271. this.orderSn = row.outBizSn
  272. this.openModal = true
  273. } else if (row.outBizType == 'SHELF_REPLENISH') { // 数字货架
  274. this.orderSn = row.outBizSn
  275. this.openModal = true
  276. } else {
  277. this.$message.warning('出库类型未知')
  278. }
  279. },
  280. // 关闭弹框
  281. cancleModal () {
  282. this.outBizType = null
  283. this.orderSn = undefined
  284. this.openModal = false
  285. },
  286. // 单个出库
  287. handleOutbound (row) {
  288. const _this = this
  289. this.$confirm({
  290. title: '提示',
  291. content: '确认要出库吗?',
  292. centered: true,
  293. onOk () {
  294. _this.spinning = true
  295. stockOutOut({ outBizSn: row.outBizSn, outStockEnum: row.outBizType }).then(res => {
  296. if (res.status == 200) {
  297. _this.$message.success(res.message)
  298. _this.$refs.table.refresh()
  299. _this.spinning = false
  300. } else {
  301. _this.spinning = false
  302. }
  303. })
  304. }
  305. })
  306. },
  307. // 批量出库
  308. handleOutbounds () {
  309. if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1)) {
  310. this.$message.warning('请在列表勾选后再进行批量操作!')
  311. return
  312. }
  313. this.loading = true
  314. this.spinning = true
  315. const params = []
  316. this.rowSelectionInfo && this.rowSelectionInfo.selectedRows.map(item => {
  317. params.push({ outBizSn: item.outBizSn, outStockEnum: item.outBizType })
  318. })
  319. stockOutBatchOut(params).then(res => {
  320. this.loading = false
  321. if (res.status == 200) {
  322. this.$message.success(res.message)
  323. this.$refs.table.clearSelected() // 清空表格选中项
  324. this.$refs.table.refresh()
  325. this.spinning = false
  326. } else {
  327. this.spinning = false
  328. }
  329. })
  330. },
  331. pageInit () {
  332. const _this = this
  333. this.$nextTick(() => { // 页面渲染完成后的回调
  334. _this.setTableH()
  335. })
  336. this.$refs.table.clearSelected() // 清空表格选中项
  337. },
  338. setTableH () {
  339. const tableSearchH = this.$refs.tableSearch.offsetHeight
  340. this.tableHeight = window.innerHeight - tableSearchH - 245
  341. }
  342. },
  343. watch: {
  344. advanced (newValue, oldValue) {
  345. const _this = this
  346. this.$nextTick(() => { // 页面渲染完成后的回调
  347. _this.setTableH()
  348. })
  349. },
  350. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  351. this.setTableH()
  352. }
  353. },
  354. mounted () {
  355. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  356. this.pageInit()
  357. this.resetSearchForm()
  358. }
  359. },
  360. activated () {
  361. // 如果是新页签打开,则重置当前页面
  362. if (this.$store.state.app.isNewTab) {
  363. this.resetData()
  364. if (this.$route.query.pageParams) {
  365. this.queryParam.state = JSON.parse(this.$route.query.pageParams).state
  366. this.queryParam.outBizType = JSON.parse(this.$route.query.pageParams).outBizType
  367. }
  368. this.pageInit()
  369. this.$refs.table.refresh(true)
  370. }
  371. },
  372. beforeRouteEnter (to, from, next) {
  373. next(vm => {})
  374. }
  375. }
  376. </script>