list.vue 7.1 KB

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