list.vue 20 KB

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