list.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. <template>
  2. <a-card size="small" :bordered="false" class="replenishmentManagementList-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" :value="time" @change="dateChange" />
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="24">
  14. <a-form-item label="补货单号"><a-input id="replenishmentManagementList-replenishBillNo" v-model.trim="queryParam.replenishBillNo" allowClear placeholder="请输入补货单号" /></a-form-item>
  15. </a-col>
  16. <a-col :md="6" :sm="24">
  17. <a-form-item label="货架名称">
  18. <shelfSList ref="shelfList" @change="shelfChange" :itemSn="queryParam.shelfSn"></shelfSList>
  19. </a-form-item>
  20. </a-col>
  21. <template v-if="advanced">
  22. <a-col :md="6" :sm="24">
  23. <a-form-item label="产品编码"><a-input id="replenishmentManagementList-productCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码" /></a-form-item>
  24. </a-col>
  25. <a-col :md="6" :sm="24">
  26. <a-form-item label="产品名称">
  27. <a-input id="replenishmentManagementList-productName" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称" />
  28. </a-form-item>
  29. </a-col>
  30. </template>
  31. <a-col :md="6" :sm="24">
  32. <span class="table-page-search-submitButtons">
  33. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="replenishmentManagementList-refresh">查询</a-button>
  34. <a-button style="margin-left: 5px" @click="resetSearchForm()" :disabled="disabled" id="replenishmentManagementList-reset">重置</a-button>
  35. <a @click="advanced = !advanced" style="margin-left: 5px">
  36. {{ advanced ? '收起' : '展开' }}
  37. <a-icon :type="advanced ? 'up' : 'down'" />
  38. </a>
  39. </span>
  40. </a-col>
  41. </a-row>
  42. </a-form>
  43. </div>
  44. <!-- 标签页 -->
  45. <a-tabs type="card" v-model="queryParam.bizType" @change="handleTabChange" class="replenishmentManagementList-tabs ">
  46. <a-tab-pane v-for="item in tabPaneData" :key="item.bizType">
  47. <p slot="tab">{{ item.bizName }}<span v-if="item.countNum || item.countNum==0">({{ item.countNum }})</span></p>
  48. </a-tab-pane>
  49. </a-tabs>
  50. <s-table
  51. class="sTable fixPagination"
  52. ref="table"
  53. :style="{ height: tableHeight+84.5+'px' }"
  54. size="small"
  55. :rowKey="(record) => record.id"
  56. :columns="columns"
  57. :data="loadData"
  58. @expand="expandFun"
  59. :expandRowByClick="true"
  60. :scroll="{ y: tableHeight }"
  61. :showPagination="false"
  62. :defaultLoadData="false"
  63. bordered>
  64. <a-table
  65. slot="expandedRowRender"
  66. slot-scope="record, index"
  67. size="small"
  68. :rowKey="(record) => record.id"
  69. :columns="subColumns"
  70. :data-source="listData[index].subList"
  71. :pagination="false"
  72. :bordered="false"
  73. style="margin: 15px 10px;">
  74. </a-table>
  75. <!-- 操作 -->
  76. <template slot="action" slot-scope="text, record">
  77. <a-button v-if="record.billState=='WAIT_CONFIRM'" size="small" type="link" class="button-primary" @click.stop="handleConfirm(record)">确认</a-button>
  78. <a-button v-if="record.billState=='WAIT_OUT_STOCK'" size="small" type="link" class="button-primary" @click.stop="handlePrintSticker(record)">打印贴签</a-button>
  79. <a-button v-if="record.billState=='WAIT_OUT_STOCK'" size="small" type="link" class="button-primary" @click.stop="handleOutWarehousing(record)">出库</a-button>
  80. <a-button v-if="record.billState=='WAIT_CHECK'" size="small" type="link" class="button-primary" @click.stop="handlePutWarehousing(record)">签收</a-button>
  81. <a-button v-if="record.billState=='WAIT_CONFIRM' || record.billState=='WAIT_OUT_STOCK'" size="small" type="link" class="button-primary" @click.stop="handleCancelOrder(record)">取消补货单</a-button>
  82. </template>
  83. </s-table>
  84. <!-- 确认 -->
  85. <confirm-modal :openModal="openConfirmModal" :nowData="nowData" @ok="handleValidate" @close="handleCancel" />
  86. <!-- 库存不足,确认弹框 -->
  87. <stock-modal
  88. :openModal="openStockModal"
  89. :type="validateType"
  90. :params="paramsData"
  91. :listData="stockList"
  92. @ok="handleStockOk"
  93. @close="handleStockCancel" />
  94. <!-- 打印贴签 -->
  95. <print-sticker-modal :openModal="openPrintStickerModal" :nowData="nowData" @ok="handlePrintStickerOk" @close="handleCancel" />
  96. <!-- 出库 -->
  97. <out-warehousing-modal :openModal="openOutWarehousingModal" :nowData="nowData" @ok="handleOutWarehousingOk" @close="handleCancel" />
  98. <!-- 签收 -->
  99. <put-warehousing-modal :openModal="openPutWarehousingModal" :nowData="nowData" @ok="handlePutWarehousingOk" @close="handleCancel" />
  100. </a-spin>
  101. </a-card>
  102. </template>
  103. <script>
  104. import { commonMixin } from '@/utils/mixin'
  105. import { STable, VSelect } from '@/components'
  106. import getDate from '@/libs/getDate.js'
  107. import rangeDate from '@/views/common/rangeDate.vue'
  108. import shelfSList from '@/views/common/shelfList.vue'
  109. import confirmModal from './confirmModal.vue'
  110. import stockModal from './stockModal.vue'
  111. import printStickerModal from './printStickerModal.vue'
  112. import outWarehousingModal from './outWarehousingModal.vue'
  113. import putWarehousingModal from './putWarehousingModal.vue'
  114. import { shelfReplenishList, shelfReplenishDetailList, shelfReplenishCancel, shelfReplenishStateCount, shelfReplenishDetailStock, shelfReplenishConfirm } from '@/api/shelfReplenish'
  115. export default {
  116. components: { STable, VSelect, rangeDate, shelfSList, confirmModal, stockModal, printStickerModal, outWarehousingModal, putWarehousingModal },
  117. mixins: [commonMixin],
  118. data () {
  119. return {
  120. spinning: false,
  121. advanced: true, // 高级搜索 展开/关闭
  122. tableHeight: 0,
  123. disabled: false, // 查询、重置按钮是否可操作
  124. curBizType: 'ALL',
  125. time: [
  126. getDate.getCurrMonthDays().starttime,
  127. getDate.getCurrMonthDays().endtime
  128. ],
  129. // 查询参数
  130. queryParam: {
  131. beginDate: getDate.getCurrMonthDays().starttime,
  132. endDate: getDate.getCurrMonthDays().endtime,
  133. bizType: 'ALL',
  134. replenishBillNo: '',
  135. shelfSn: undefined,
  136. productCode: '',
  137. productName: ''
  138. },
  139. columns: [
  140. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  141. { title: '创建时间', dataIndex: 'createDate', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  142. { title: '补货单号', dataIndex: 'replenishBillNo', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
  143. { title: '货架名称', dataIndex: 'shelfName', width: '21%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  144. { title: '状态', dataIndex: 'billStateDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  145. { title: '补货应发总量', dataIndex: 'totalQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  146. { title: '实发总量', dataIndex: 'totalConfirmQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  147. { title: '签收总量', dataIndex: 'totalPutQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  148. { title: '操作', scopedSlots: { customRender: 'action' }, width: '18%', align: 'left' }
  149. ],
  150. // 加载数据方法 必须为 Promise 对象
  151. loadData: parameter => {
  152. this.disabled = true
  153. this.spinning = true
  154. return shelfReplenishList(Object.assign(parameter, this.queryParam)).then(res => {
  155. let data
  156. if (res.status == 200) {
  157. data = res.data
  158. const no = (data.pageNo - 1) * data.pageSize
  159. for (var i = 0; i < data.list.length; i++) {
  160. data.list[i].no = no + i + 1
  161. data.list[i].subList = []
  162. }
  163. this.listData = data.list || []
  164. this.disabled = false
  165. }
  166. this.spinning = false
  167. return data
  168. })
  169. },
  170. subColumns: [
  171. { title: '序号', dataIndex: 'no', width: '8%', align: 'center' },
  172. { title: '产品编码', dataIndex: 'product.code', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
  173. { title: '产品名称', dataIndex: 'product.name', width: '28%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  174. { title: '补货应发总量', dataIndex: 'qty', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  175. { title: '实发总量', dataIndex: 'confirmQty', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  176. { title: '签收总量', dataIndex: 'putQty', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  177. { title: '单位', dataIndex: 'product.unit', width: '8%', align: 'center', customRender: function (text) { return text || '--' } }
  178. ],
  179. listData: [],
  180. tabPaneData: [],
  181. nowData: null,
  182. openConfirmModal: false,
  183. openStockModal: false,
  184. openPrintStickerModal: false,
  185. openOutWarehousingModal: false,
  186. openPutWarehousingModal: false,
  187. validateType: 'confirm',
  188. stockList: [],
  189. paramsData: null
  190. }
  191. },
  192. methods: {
  193. // 确认
  194. handleConfirm (row) {
  195. this.nowData = row
  196. this.openConfirmModal = true
  197. },
  198. // cancel
  199. handleCancel () {
  200. this.nowData = null
  201. this.openConfirmModal = false
  202. this.openStockModal = false
  203. this.openPrintStickerModal = false
  204. this.openOutWarehousingModal = false
  205. this.openPutWarehousingModal = false
  206. },
  207. // 库存不足 确认 ok
  208. handleStockOk (type, params) {
  209. this.openStockModal = false
  210. this.openConfirmModal = false
  211. this.openOutWarehousingModal = false
  212. if (type == 'confirm') { // 确认
  213. this.confirmFun(params)
  214. }
  215. },
  216. // 库存不足 确认 cancel
  217. handleStockCancel () {
  218. this.stockList = []
  219. this.validateType = 'confirm'
  220. this.openStockModal = false
  221. },
  222. // 打印贴签
  223. handlePrintSticker (row) {
  224. this.nowData = row
  225. this.openPrintStickerModal = true
  226. },
  227. // 打印贴签 ok
  228. handlePrintStickerOk () {
  229. this.nowData = null
  230. this.openPrintStickerModal = false
  231. this.$refs.table.refresh(true)
  232. },
  233. // 出库
  234. handleOutWarehousing (row) {
  235. this.nowData = row
  236. this.openOutWarehousingModal = true
  237. },
  238. // 出库 ok
  239. handleOutWarehousingOk () {
  240. this.nowData = null
  241. this.openOutWarehousingModal = false
  242. this.$refs.table.refresh(true)
  243. },
  244. handleValidate (type, params) {
  245. // 校验产品库存是否足够
  246. shelfReplenishDetailStock(params).then(res => {
  247. if (res.status == 200) {
  248. if (res.data && res.data.length > 0) {
  249. this.stockList = res.data
  250. this.validateType = 'confirm'
  251. this.paramsData = params
  252. this.openStockModal = true
  253. } else {
  254. if (type == 'confirm') { // 确认
  255. this.confirmFun(params)
  256. }
  257. }
  258. }
  259. })
  260. },
  261. // 提交确认
  262. confirmFun (params) {
  263. shelfReplenishConfirm(params).then(res => {
  264. if (res.status == 200) {
  265. this.$message.success('确认补货成功')
  266. this.$refs.table.refresh(true)
  267. this.handleCancel()
  268. }
  269. })
  270. },
  271. // 签收
  272. handlePutWarehousing (row) {
  273. this.nowData = row
  274. this.openPutWarehousingModal = true
  275. },
  276. // 签收 ok
  277. handlePutWarehousingOk () {
  278. this.nowData = null
  279. this.openPutWarehousingModal = false
  280. this.$refs.table.refresh(true)
  281. },
  282. // 取消补货单
  283. handleCancelOrder (row) {
  284. const _this = this
  285. this.$confirm({
  286. title: '提示',
  287. content: '确认取消补货单吗?',
  288. centered: true,
  289. onOk () {
  290. _this.spinning = true
  291. shelfReplenishCancel({ replenishBillSn: row.replenishBillSn }).then(res => {
  292. if (res.status == 200) {
  293. _this.$message.success(res.message)
  294. _this.$refs.table.refresh()
  295. _this.spinning = false
  296. } else {
  297. _this.spinning = false
  298. }
  299. })
  300. }
  301. })
  302. },
  303. // 货架 change
  304. shelfChange (obj) {
  305. this.queryParam.shelfSn = obj.key || undefined
  306. },
  307. expandFun (expanded, record) {
  308. if (expanded) {
  309. this.getSubItem(record) // 获取表格内部数据
  310. }
  311. },
  312. // 获取子节点数据
  313. getSubItem (record) {
  314. this.spinning = true
  315. shelfReplenishDetailList({ replenishBillSn: record.replenishBillSn }).then(res => {
  316. const ind = this.listData.findIndex(item => item.id == record.id)
  317. if (ind >= 0) {
  318. if (res.status == 200 && res.data && res.data.length) {
  319. res.data.map((item, index) => {
  320. item.no = index + 1
  321. })
  322. this.listData[ind].subList = res.data
  323. } else {
  324. this.listData[ind].subList = []
  325. }
  326. }
  327. this.spinning = false
  328. })
  329. },
  330. // 重置
  331. resetSearchForm () {
  332. this.resetData()
  333. this.$refs.table.refresh(true)
  334. },
  335. // 重置数据
  336. resetData () {
  337. this.$refs.rangeDate.resetDate(this.time)
  338. this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
  339. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  340. this.queryParam.bizType = this.curBizType
  341. this.queryParam.replenishBillNo = ''
  342. this.queryParam.shelfSn = undefined
  343. this.$refs.shelfList.resetForm()
  344. this.queryParam.productCode = ''
  345. this.queryParam.productName = ''
  346. },
  347. // 时间 change
  348. dateChange (date) {
  349. this.queryParam.beginDate = date[0] || null
  350. this.queryParam.endDate = date[1] || null
  351. },
  352. // 选择类型
  353. handleTabChange (key) {
  354. this.queryParam.bizType = key
  355. this.$refs.table.refresh(true)
  356. this.curBizType = key
  357. },
  358. // 客户 change
  359. custChange (obj) {
  360. this.queryParam.customerSn = obj.key || undefined
  361. },
  362. // 获取类型
  363. queryByTypeSum () {
  364. shelfReplenishStateCount({}).then(res => {
  365. if (res.data && res.status == 200) {
  366. this.tabPaneData = [
  367. { bizName: '全部', bizType: 'ALL', countNum: null },
  368. { bizName: '待确认', bizType: 'WAIT_CONFIRM', countNum: 0 },
  369. { bizName: '待出库', bizType: 'WAIT_OUT_STOCK', countNum: 0 },
  370. { bizName: '待签收', bizType: 'WAIT_CHECK', countNum: 0 },
  371. { bizName: '已完成', bizType: 'FINISH', countNum: null },
  372. { bizName: '已取消', bizType: 'CANCEL', countNum: null }
  373. ]
  374. this.queryParam.bizType = 'ALL'
  375. this.tabPaneData[1].countNum = res.data.WAIT_CONFIRM || 0
  376. this.tabPaneData[2].countNum = res.data.WAIT_OUT_STOCK || 0
  377. this.tabPaneData[3].countNum = res.data.WAIT_CHECK || 0
  378. this.$refs.table.refresh(true)
  379. }
  380. })
  381. },
  382. setTableH () {
  383. const tableSearchH = this.$refs.tableSearch.offsetHeight
  384. this.tableHeight = window.innerHeight - tableSearchH - 240
  385. },
  386. pageInit () {
  387. const _this = this
  388. this.$nextTick(() => { // 页面渲染完成后的回调
  389. _this.setTableH()
  390. })
  391. this.queryByTypeSum()
  392. }
  393. },
  394. watch: {
  395. advanced (newValue, oldValue) {
  396. const _this = this
  397. this.$nextTick(() => { // 页面渲染完成后的回调
  398. _this.setTableH()
  399. })
  400. },
  401. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  402. this.setTableH()
  403. }
  404. },
  405. mounted () {
  406. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  407. this.resetData()
  408. this.pageInit()
  409. }
  410. },
  411. activated () {
  412. // 如果是新页签打开,则重置当前页面
  413. if (this.$store.state.app.isNewTab) {
  414. this.resetData()
  415. this.pageInit()
  416. }
  417. }
  418. }
  419. </script>
  420. <style lang="less">
  421. .replenishmentManagementList-wrap{
  422. .replenishmentManagementList-tabs.ant-tabs.ant-tabs-card .ant-tabs-bar{
  423. margin: 0 0 10px 0!important;
  424. }
  425. .replenishmentManagementList-tabs.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-nav-container{
  426. height: 30px!important;
  427. }
  428. .replenishmentManagementList-tabs.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab-active{
  429. height: 30px!important;
  430. }
  431. .replenishmentManagementList-tabs.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab{
  432. line-height: 26px!important;
  433. height: 30px!important;
  434. }
  435. }
  436. </style>