list.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. deleteFlag: '0',
  59. checkWarehouseNo: ''
  60. },
  61. columns: [
  62. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  63. { title: '盘点单号', dataIndex: 'checkWarehouseNo', width: '15%', align: 'center' },
  64. { title: '盘点状态', dataIndex: 'checkStateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  65. { title: '盘点人', dataIndex: 'checkPersonName', align: 'center', width: '12%', customRender: function (text) { return text || '--' }, ellipsis: true },
  66. { title: '盘点时间', dataIndex: 'checkTime', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  67. { title: '监盘状态', dataIndex: 'checkSuperviseStateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  68. { title: '产品款数', dataIndex: 'productTotalCategory', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  69. { title: '库存数量', dataIndex: 'totalStockQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  70. { title: '盘点数量', dataIndex: 'checkTotalQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  71. { title: '监盘数量', dataIndex: 'checkSuperviseTotalQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  72. { title: '监盘盈亏数量', dataIndex: 'totalProfitLossQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  73. { title: '操作', scopedSlots: { customRender: 'action' }, width: '6%', align: 'center' }
  74. ],
  75. // 加载数据方法 必须为 Promise 对象
  76. loadData: parameter => {
  77. this.disabled = true
  78. this.spinning = true
  79. return checkWarehouseList(Object.assign(parameter, this.queryParam, { state: 'WAIT_SUPERVISE_CHECK' })).then(res => {
  80. let data
  81. if (res.status == 200) {
  82. data = res.data
  83. const no = (data.pageNo - 1) * data.pageSize
  84. for (var i = 0; i < data.list.length; i++) {
  85. data.list[i].no = no + i + 1
  86. }
  87. this.disabled = false
  88. }
  89. this.spinning = false
  90. return data
  91. })
  92. }
  93. }
  94. },
  95. methods: {
  96. // 监盘
  97. handleCheck (row) {
  98. this.$router.push({ path: `/inventoryManagement/supervisionDisk/check/${row.checkWarehouseSn}` })
  99. },
  100. resetSearchForm () {
  101. this.queryParam.checkWarehouseNo = ''
  102. this.$refs.table.refresh(true)
  103. },
  104. pageInit () {
  105. const _this = this
  106. this.$nextTick(() => { // 页面渲染完成后的回调
  107. _this.setTableH()
  108. })
  109. },
  110. setTableH () {
  111. this.tableHeight = window.innerHeight - 240
  112. }
  113. },
  114. watch: {
  115. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  116. this.setTableH()
  117. }
  118. },
  119. mounted () {
  120. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  121. this.pageInit()
  122. this.$refs.table.refresh(true)
  123. }
  124. },
  125. activated () {
  126. // 如果是新页签打开,则重置当前页面
  127. if (this.$store.state.app.isNewTab) {
  128. this.pageInit()
  129. this.$refs.table.refresh(true)
  130. }
  131. // 仅刷新列表,不重置页面
  132. if (this.$store.state.app.updateList) {
  133. this.pageInit()
  134. this.$refs.table.refresh()
  135. }
  136. },
  137. beforeRouteEnter (to, from, next) {
  138. next(vm => {
  139. const _this = vm
  140. if (vm.$route.query.isRefresh) {
  141. setTimeout(() => {
  142. _this.$refs.table.refresh(true)
  143. }, 300)
  144. }
  145. })
  146. }
  147. }
  148. </script>
  149. <style lang="less">
  150. .supervisionDiskList-wrap{
  151. .active{
  152. color: #ed1c24;
  153. cursor: pointer;
  154. }
  155. .common{
  156. color: rgba(0, 0, 0, 0.65);
  157. }
  158. }
  159. </style>