list.vue 14 KB

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