list.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <a-card size="small" :bordered="false" class="shelfSetList-wrap jg-page-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. <shelfSList v-model="queryParam.providerSn"></shelfSList>
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="24">
  14. <a-form-item label="调回单号">
  15. <a-input allowClear placeholder="请输入调回单号" v-model.tirm="queryParam.putBizNo"/>
  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.state"
  22. ref="state"
  23. id="shelfSetList-state"
  24. code="STOCK_PUT_STATE"
  25. placeholder="请选择"
  26. allowClear></v-select>
  27. </a-form-item>
  28. </a-col>
  29. <a-col :md="6" :sm="24" style="margin-bottom: 10px">
  30. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="shelfSetList-refresh">查询</a-button>
  31. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="shelfSetList-reset">重置</a-button>
  32. </a-col>
  33. </a-row>
  34. </a-form>
  35. </div>
  36. <!-- 提示 -->
  37. <a-alert type="info" style="margin-bottom: 10px">
  38. <div slot="message">
  39. 共 <strong>{{ count||0 }}</strong> 条记录,
  40. 其中待入库 <strong>{{ putCount||0 }}</strong> 条
  41. </div>
  42. </a-alert>
  43. <!-- 列表 -->
  44. <s-table
  45. class="sTable fixPagination"
  46. ref="table"
  47. :style="{ height: tableHeight+84.5+'px' }"
  48. size="small"
  49. :rowKey="(record) => record.id"
  50. :columns="columns"
  51. :data="loadData"
  52. :scroll="{ y: tableHeight }"
  53. :defaultLoadData="false"
  54. bordered>
  55. <!-- 货位数量 -->
  56. <template slot="shelfPlaceNum" slot-scope="text, record">
  57. <div v-if="record.finishFlag=='1'">{{ record.shelfPlaceNum }}</div>
  58. <div v-else>
  59. <p style="margin: 0;">
  60. <span style="color: red;">{{ record.shelfPlaceBindNum||record.shelfPlaceBindNum==0 ? record.shelfPlaceBindNum:'' }}</span> /
  61. {{ record.shelfPlaceNum }}
  62. </p>
  63. </div>
  64. </template>
  65. <!-- 是否设置完成 -->
  66. <template slot="finishFlag" slot-scope="text, record">
  67. <span v-if="record.finishFlagDictValue" :style="{color: record.finishFlagDictValue=='否' ? 'red':''}">{{ record.finishFlagDictValue }}</span>
  68. <span v-else>--</span>
  69. </template>
  70. <!-- 操作 -->
  71. <template slot="action" slot-scope="text, record">
  72. <a-button size="small" type="link" class="button-primary" @click="handleSet(record)" v-if="record.state=='WAIT'">确认入库</a-button>
  73. <span v-else style="display: inline-block;padding-left: 7px;">--</span>
  74. </template>
  75. </s-table>
  76. </a-spin>
  77. </a-card>
  78. </template>
  79. <script>
  80. import { commonMixin } from '@/utils/mixin'
  81. import { STable, VSelect } from '@/components'
  82. import shelfSList from '@/views/common/shelfList'
  83. import { recallStockList, stockPutCount } from '@/api/shelfRecall.js'
  84. export default {
  85. components: { STable, VSelect, shelfSList },
  86. mixins: [commonMixin],
  87. data () {
  88. return {
  89. spinning: false,
  90. tableHeight: 0,
  91. disabled: false, // 查询、重置按钮是否可操作
  92. count: 0, // 数据总条数
  93. putCount: 0, // 待入库条数
  94. queryParam: {
  95. putBizNo: '',
  96. providerSn: undefined,
  97. state: undefined
  98. },
  99. columns: [
  100. { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
  101. { title: '调回单号', dataIndex: 'putBizNo', width: '15%', align: 'left', customRender: function (text) { return text || '--' } },
  102. { title: '货架名称', dataIndex: 'providerName', width: '25%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  103. { title: '入库总数量', dataIndex: 'productTotalQty', width: '10%', align: 'center', customRender: function (text) { return (text || text == 0) ? text : '--' } },
  104. { title: '入库总成本', dataIndex: 'productTotalCost', width: '10%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  105. { title: '状态', dataIndex: 'stateDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  106. { title: '入库时间', dataIndex: 'auditTime', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  107. { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'left' }
  108. ],
  109. // 加载数据方法 必须为 Promise 对象
  110. loadData: parameter => {
  111. this.disabled = true
  112. this.spinning = true
  113. return recallStockList(Object.assign(parameter, this.queryParam)).then(res => {
  114. let data
  115. if (res.status == 200) {
  116. data = res.data
  117. this.count = res.data.count
  118. this.getStockPutCount(this.queryParam)
  119. const no = (data.pageNo - 1) * data.pageSize
  120. for (var i = 0; i < data.list.length; i++) {
  121. data.list[i].no = no + i + 1
  122. }
  123. this.disabled = false
  124. }
  125. this.spinning = false
  126. return data
  127. })
  128. },
  129. openModal: false,
  130. nowData: null
  131. }
  132. },
  133. methods: {
  134. // 查询待入库条数
  135. getStockPutCount () {
  136. stockPutCount(this.queryParam).then(res => {
  137. if (res.status == 200) {
  138. this.putCount = res.data
  139. } else {
  140. this.putCount = 0
  141. }
  142. })
  143. },
  144. // 设置/修改
  145. handleSet (row) {
  146. this.$router.push({ path: `/numsGoodsShelves/recallStockManagement/editStock/${row.stockPutSn}` })
  147. },
  148. // 重置
  149. resetSearchForm () {
  150. this.queryParam.providerSn = undefined
  151. this.queryParam.putBizNo = ''
  152. this.queryParam.state = undefined
  153. this.$refs.table.refresh(true)
  154. },
  155. setTableH () {
  156. const tableSearchH = this.$refs.tableSearch.offsetHeight
  157. this.tableHeight = window.innerHeight - tableSearchH - 235
  158. },
  159. pageInit () {
  160. const _this = this
  161. this.$nextTick(() => { // 页面渲染完成后的回调
  162. _this.setTableH()
  163. })
  164. }
  165. },
  166. mounted () {
  167. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  168. this.pageInit()
  169. this.resetSearchForm()
  170. }
  171. },
  172. watch: {
  173. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  174. this.setTableH()
  175. }
  176. },
  177. activated () {
  178. // 如果是新页签打开,则重置当前页面
  179. if (this.$store.state.app.isNewTab) {
  180. this.pageInit()
  181. this.resetSearchForm()
  182. }
  183. // 仅刷新列表,不重置页面
  184. if (this.$store.state.app.updateList) {
  185. this.pageInit()
  186. this.$refs.table.refresh()
  187. }
  188. }
  189. }
  190. </script>