Blame view

src/components/fee/downloadCollectionLetterOrder.vue 2.67 KB
24d3590f   wuxw   房屋收费页面开发完成
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
  <template>
    <el-dialog
      :title="$t('downloadCollectionLetterOrder.title')"
      :visible.sync="visible"
      width="70%"
      :before-close="handleClose"
    >
      <el-form label-width="120px">
        <template v-if="roomId">
          <el-alert
            :title="$t('downloadCollectionLetterOrder.confirmExport')"
            type="info"
            show-icon
          ></el-alert>
        </template>
        <template v-else>
          <el-form-item :label="$t('downloadCollectionLetterOrder.selectFloor')">
            <el-select
              v-model="floorId"
              :placeholder="$t('downloadCollectionLetterOrder.floorPlaceholder')"
              style="width: 100%"
            >
              <el-option
                v-for="item in floors"
                :key="item.floorId"
                :label="item.floorNum"
                :value="item.floorId"
              ></el-option>
            </el-select>
          </el-form-item>
        </template>
      </el-form>
  
      <span slot="footer" class="dialog-footer">
        <el-button @click="handleClose">{{ $t('common.cancel') }}</el-button>
        <el-button 
          type="primary" 
          @click="handleExport"
          :disabled="!floorId && !roomId"
        >{{ $t('common.export') }}</el-button>
      </span>
    </el-dialog>
  </template>
  
  <script>
  import { exportData, queryFloors } from '@/api/fee/downloadCollectionLetterOrderApi'
  import { getCommunityId } from '@/api/community/communityApi'
  
  export default {
    name: 'DownloadCollectionLetterOrder',
    data() {
      return {
        visible: false,
        roomId: '',
        floorId: '',
        floors: []
      }
    },
    computed: {
      communityId() {
        return getCommunityId()
      }
    },
    methods: {
      open(params) {
        this.visible = true
        this.roomId = params.roomId || ''
        this.loadFloors()
      },
      
      loadFloors() {
        queryFloors({
          page: 1,
          row: 100,
          communityId: this.communityId
        }).then(response => {
          this.floors = response.data.apiFloorDataVoList
        })
      },
      
      handleExport() {
        const params = {
          communityId: this.communityId,
          pagePath: 'dataFeeManualCollection',
          floorId: this.floorId,
          roomId: this.roomId
        }
        
        exportData(params).then(response => {
          const res = response.data
          this.$message.success(res.msg)
          if (res.code === 0) {
            this.handleClose()
            this.$router.push('/pages/property/downloadTempFile?tab=下载中心')
          }
        }).catch(error => {
          this.$message.error(error.message)
        })
      },
      
      handleClose() {
        this.visible = false
        this.reset()
      },
      
      reset() {
        this.roomId = ''
        this.floorId = ''
      }
    }
  }
  </script>