list.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <a-card size="small" :bordered="false" class="exportCheckList-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <!-- 搜索条件 -->
  5. <div ref="tableSearch">
  6. <a-form-model
  7. id="exportCheckList-form"
  8. ref="ruleForm"
  9. class="form-model-con"
  10. :model="queryParam"
  11. :rules="rules"
  12. :labelCol="labelCol"
  13. :wrapperCol="wrapperCol"
  14. @keyup.enter.native="handleSearch" >
  15. <a-row :gutter="15">
  16. <a-col :md="12" :sm="24">
  17. <a-form-model-item label="选择盘点单" prop="checkWarehouseSn">
  18. <a-select id="exportCheckList-print" v-model="queryParam.checkWarehouseSn" placeholder="请选择盘点单" allowClear>
  19. <a-select-option v-for="item in checkList" :value="item.checkWarehouseSn" :key="item.checkWarehouseSn">
  20. <span>{{ item.financeAuditTime }} - {{ item.checkWarehouseNo }}</span>
  21. </a-select-option>
  22. </a-select>
  23. </a-form-model-item>
  24. </a-col>
  25. </a-row>
  26. <a-row :gutter="15">
  27. <a-col :md="12" :sm="24">
  28. <a-form-model-item label="选择仓库" prop="warehouseSn">
  29. <warehouse
  30. v-model="queryParam.warehouseSn"
  31. id="exportCheckList-warehouseSn"
  32. placeholder="请选择仓库"
  33. />
  34. </a-form-model-item>
  35. </a-col>
  36. </a-row>
  37. <a-form-model-item :wrapper-col="{ span: 12, offset: 6 }">
  38. <a-button
  39. type="primary"
  40. class="button-warning"
  41. @click="handleExport"
  42. :disabled="disabled"
  43. :loading="exportLoading"
  44. id="exportCheckList-export">导出</a-button>
  45. <a-button @click="cancel" style="margin-left: 15px" id="chooseCustom-btn-back">重置</a-button>
  46. </a-form-model-item>
  47. </a-form-model>
  48. </div>
  49. </a-spin>
  50. </a-card>
  51. </template>
  52. <script>
  53. import { commonMixin } from '@/utils/mixin'
  54. import { STable, VSelect } from '@/components'
  55. import { checkWarehouseExcelList, checkWarehouseExport } from '@/api/checkWarehouse'
  56. import warehouse from '@/views/common/chooseWarehouse.js'
  57. import { hdExportExcel } from '@/libs/exportExcel'
  58. export default {
  59. name: 'ExportCheckList',
  60. mixins: [commonMixin],
  61. components: { STable, VSelect, warehouse },
  62. data () {
  63. return {
  64. spinning: false,
  65. tableHeight: 0,
  66. labelCol: { span: 8 },
  67. wrapperCol: { span: 16 },
  68. queryParam: { // 查询条件
  69. checkWarehouseSn: undefined,
  70. warehouseSn: undefined
  71. },
  72. rules: {
  73. checkWarehouseSn: [{ required: true, message: '请选择盘点单', trigger: 'change' }],
  74. warehouseSn: [{ required: true, message: '请选择仓库', trigger: 'change' }]
  75. },
  76. disabled: false, // 查询、重置按钮是否可操作
  77. exportLoading: false,
  78. checkList: []
  79. }
  80. },
  81. methods: {
  82. getList () {
  83. checkWarehouseExcelList().then(res => {
  84. if (res.status == 200) {
  85. this.checkList = res.data || []
  86. } else {
  87. this.checkList = []
  88. }
  89. })
  90. },
  91. // 导出
  92. handleExport () {
  93. const _this = this
  94. this.$refs.ruleForm.validate(valid => {
  95. if (valid) {
  96. const params = _this.queryParam
  97. _this.exportLoading = true
  98. _this.spinning = true
  99. hdExportExcel(checkWarehouseExport, params, '导出盘点', function () {
  100. _this.exportLoading = false
  101. _this.spinning = false
  102. })
  103. } else {
  104. console.log('error submit!!')
  105. return false
  106. }
  107. })
  108. },
  109. cancel(){
  110. this.queryParam.checkWarehouseSn = undefined
  111. this.queryParam.warehouseSn = undefined
  112. this.$refs.ruleForm.resetFields()
  113. },
  114. pageInit () {
  115. this.cancel()
  116. this.getList()
  117. }
  118. },
  119. mounted () {
  120. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  121. this.pageInit()
  122. }
  123. },
  124. activated () {
  125. // 如果是新页签打开,则重置当前页面
  126. if (this.$store.state.app.isNewTab) {
  127. this.pageInit()
  128. }
  129. // 仅刷新列表,不重置页面
  130. if (this.$store.state.app.updateList) {
  131. this.pageInit()
  132. }
  133. },
  134. beforeRouteEnter (to, from, next) {
  135. next(vm => {})
  136. }
  137. }
  138. </script>
  139. <style lang="less">
  140. .exportCheckList-wrap{
  141. height: 99%;
  142. .form-model-con{
  143. margin-top: 50px;
  144. }
  145. }
  146. </style>