list.vue 14 KB

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