list.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <a-card size="small" :bordered="false" class="supervisionDiskList-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. <a-input id="supervisionDiskList-checkWarehouseNo" v-model.trim="queryParam.checkWarehouseNo" allowClear placeholder="请输入盘点单号"/>
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="24">
  14. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="supervisionDiskList-refresh">查询</a-button>
  15. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="supervisionDiskList-reset">重置</a-button>
  16. </a-col>
  17. </a-row>
  18. </a-form>
  19. </div>
  20. <!-- 列表 -->
  21. <s-table
  22. class="sTable fixPagination"
  23. ref="table"
  24. :style="{ height: tableHeight+84.5+'px' }"
  25. size="small"
  26. :rowKey="(record) => record.id"
  27. :columns="columns"
  28. :data="loadData"
  29. :scroll="{ y: tableHeight }"
  30. :defaultLoadData="false"
  31. bordered>
  32. <!-- 操作 -->
  33. <template slot="action" slot-scope="text, record">
  34. <a-button
  35. size="small"
  36. type="link"
  37. v-if="$hasPermissions('B_supervisionDiskCheck')"
  38. class="button-info"
  39. @click="handleCheck(record)"
  40. id="supervisionDiskList-audit-btn">监盘</a-button>
  41. <span v-else>--</span>
  42. </template>
  43. </s-table>
  44. </a-spin>
  45. </a-card>
  46. </template>
  47. <script>
  48. import { STable, VSelect } from '@/components'
  49. import { checkWarehouseList } from '@/api/checkWarehouse'
  50. export default {
  51. components: { STable, VSelect },
  52. data () {
  53. return {
  54. spinning: false,
  55. tableHeight: 0,
  56. disabled: false, // 查询、重置按钮是否可操作
  57. queryParam: { // 查询条件
  58. checkWarehouseNo: ''
  59. },
  60. columns: [
  61. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  62. { title: '盘点单号', dataIndex: 'checkWarehouseNo', width: '15%', align: 'center' },
  63. { title: '盘点状态', dataIndex: 'checkStateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  64. { title: '盘点人', dataIndex: 'checkPersonName', align: 'center', width: '12%', customRender: function (text) { return text || '--' }, ellipsis: true },
  65. { title: '盘点时间', dataIndex: 'checkTime', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  66. { title: '监盘状态', dataIndex: 'checkSuperviseStateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  67. { title: '产品款数', dataIndex: 'productTotalCategory', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  68. { title: '库存数量', dataIndex: 'totalStockQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  69. { title: '盘点数量', dataIndex: 'checkTotalQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  70. { title: '监盘数量', dataIndex: 'checkSuperviseTotalQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  71. { title: '监盘盈亏数量', dataIndex: 'totalProfitLossQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  72. { title: '操作', scopedSlots: { customRender: 'action' }, width: '6%', align: 'center' }
  73. ],
  74. // 加载数据方法 必须为 Promise 对象
  75. loadData: parameter => {
  76. this.disabled = true
  77. this.spinning = true
  78. return checkWarehouseList(Object.assign(parameter, this.queryParam, { state: 'WAIT_SUPERVISE_CHECK' })).then(res => {
  79. const data = res.data
  80. const no = (data.pageNo - 1) * data.pageSize
  81. for (var i = 0; i < data.list.length; i++) {
  82. data.list[i].no = no + i + 1
  83. }
  84. this.disabled = false
  85. this.spinning = false
  86. return data
  87. })
  88. }
  89. }
  90. },
  91. methods: {
  92. // 监盘
  93. handleCheck (row) {
  94. this.$router.push({ path: `/inventoryManagement/supervisionDisk/check/${row.checkWarehouseSn}` })
  95. },
  96. resetSearchForm () {
  97. this.queryParam.checkWarehouseNo = ''
  98. this.$refs.table.refresh(true)
  99. },
  100. pageInit () {
  101. const _this = this
  102. this.$nextTick(() => { // 页面渲染完成后的回调
  103. _this.setTableH()
  104. })
  105. },
  106. setTableH () {
  107. this.tableHeight = window.innerHeight - 240
  108. }
  109. },
  110. mounted () {
  111. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  112. this.pageInit()
  113. this.$refs.table.refresh(true)
  114. }
  115. },
  116. activated () {
  117. // 如果是新页签打开,则重置当前页面
  118. if (this.$store.state.app.isNewTab) {
  119. this.pageInit()
  120. this.$refs.table.refresh(true)
  121. }
  122. // 仅刷新列表,不重置页面
  123. if (this.$store.state.app.updateList) {
  124. this.pageInit()
  125. this.$refs.table.refresh()
  126. }
  127. },
  128. beforeRouteEnter (to, from, next) {
  129. next(vm => {
  130. const _this = vm
  131. if (vm.$route.query.isRefresh) {
  132. setTimeout(() => {
  133. _this.$refs.table.refresh(true)
  134. }, 300)
  135. }
  136. })
  137. }
  138. }
  139. </script>
  140. <style lang="less">
  141. .supervisionDiskList-wrap{
  142. .active{
  143. color: #ed1c24;
  144. cursor: pointer;
  145. }
  146. .common{
  147. color: rgba(0, 0, 0, 0.65);
  148. }
  149. }
  150. </style>