Blame view

src/components/fee/exportFeeImportExcel.vue 3.84 KB
24d3590f   wuxw   房屋收费页面开发完成
1
  <template>
e2d2dbfb   wuxw   优化房屋收费页面 的批量催缴单
2
3
    <el-dialog :title="$t('exportFeeImportExcel.title')" :visible.sync="visible" width="70%" :before-close="handleClose">
      <el-form label-width="120px" class="text-left">
24d3590f   wuxw   房屋收费页面开发完成
4
5
        <el-form-item :label="$t('exportFeeImportExcel.floor')">
          <div>
e2d2dbfb   wuxw   优化房屋收费页面 的批量催缴单
6
7
8
            <el-checkbox v-model="isFloorAll" @change="toggleAllFloors">{{ $t('exportFeeImportExcel.all') }}</el-checkbox>
            <el-checkbox v-for="item in floors" :key="item.floorId" v-model="selectedFloorIds" :label="item.floorId"
              @change="handleFloorChange" class="margin-left">{{ item.floorName }}</el-checkbox>
24d3590f   wuxw   房屋收费页面开发完成
9
10
11
12
13
          </div>
        </el-form-item>
  
        <el-form-item :label="$t('exportFeeImportExcel.feeItem')">
          <div>
e2d2dbfb   wuxw   优化房屋收费页面 的批量催缴单
14
15
16
17
            <el-checkbox v-model="isConfigAll" @change="toggleAllConfigs">{{ $t('exportFeeImportExcel.all')
              }}</el-checkbox>
            <el-checkbox v-for="item in configs" :key="item.configId" v-model="selectedConfigIds" :label="item.configId"
              @change="handleConfigChange" class="margin-left">{{ item.feeName }}</el-checkbox>
24d3590f   wuxw   房屋收费页面开发完成
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
          </div>
        </el-form-item>
      </el-form>
  
      <span slot="footer" class="dialog-footer">
        <el-button @click="handleClose">{{ $t('common.cancel') }}</el-button>
        <el-button type="primary" @click="handleExport">{{ $t('common.export') }}</el-button>
      </span>
    </el-dialog>
  </template>
  
  <script>
  import { exportData, listFeeConfigs, queryFloors } from '@/api/fee/exportFeeImportExcelApi'
  import { getCommunityId } from '@/api/community/communityApi'
  
  export default {
    name: 'ExportFeeImportExcel',
    data() {
      return {
        visible: false,
        isFloorAll: true,
        isConfigAll: true,
        selectedFloorIds: [],
        selectedConfigIds: [],
        floors: [],
        configs: []
      }
    },
    computed: {
      communityId() {
        return getCommunityId()
      }
    },
    methods: {
      open() {
        this.visible = true
        this.loadFloors()
        this.loadConfigs()
      },
e2d2dbfb   wuxw   优化房屋收费页面 的批量催缴单
57
  
24d3590f   wuxw   房屋收费页面开发完成
58
59
60
61
62
63
      loadFloors() {
        queryFloors({
          page: 1,
          row: 150,
          communityId: this.communityId
        }).then(response => {
e2d2dbfb   wuxw   优化房屋收费页面 的批量催缴单
64
          this.floors = response.apiFloorDataVoList
24d3590f   wuxw   房屋收费页面开发完成
65
66
67
          this.selectedFloorIds = this.floors.map(item => item.floorId)
        })
      },
e2d2dbfb   wuxw   优化房屋收费页面 的批量催缴单
68
  
24d3590f   wuxw   房屋收费页面开发完成
69
70
71
72
73
74
75
      loadConfigs() {
        listFeeConfigs({
          page: 1,
          row: 100,
          communityId: this.communityId,
          isDefault: 'F'
        }).then(response => {
e2d2dbfb   wuxw   优化房屋收费页面 的批量催缴单
76
          this.configs = response.feeConfigs
24d3590f   wuxw   房屋收费页面开发完成
77
78
79
          this.selectedConfigIds = this.configs.map(item => item.configId)
        })
      },
e2d2dbfb   wuxw   优化房屋收费页面 的批量催缴单
80
  
24d3590f   wuxw   房屋收费页面开发完成
81
      toggleAllFloors() {
e2d2dbfb   wuxw   优化房屋收费页面 的批量催缴单
82
        this.selectedFloorIds = this.isFloorAll
24d3590f   wuxw   房屋收费页面开发完成
83
84
85
          ? this.floors.map(item => item.floorId)
          : []
      },
e2d2dbfb   wuxw   优化房屋收费页面 的批量催缴单
86
  
24d3590f   wuxw   房屋收费页面开发完成
87
88
89
90
91
      toggleAllConfigs() {
        this.selectedConfigIds = this.isConfigAll
          ? this.configs.map(item => item.configId)
          : []
      },
e2d2dbfb   wuxw   优化房屋收费页面 的批量催缴单
92
  
24d3590f   wuxw   房屋收费页面开发完成
93
94
95
      handleFloorChange() {
        this.isFloorAll = this.selectedFloorIds.length === this.floors.length
      },
e2d2dbfb   wuxw   优化房屋收费页面 的批量催缴单
96
  
24d3590f   wuxw   房屋收费页面开发完成
97
98
99
      handleConfigChange() {
        this.isConfigAll = this.selectedConfigIds.length === this.configs.length
      },
e2d2dbfb   wuxw   优化房屋收费页面 的批量催缴单
100
  
24d3590f   wuxw   房屋收费页面开发完成
101
102
103
104
105
106
107
108
      handleExport() {
        const params = {
          floorIds: this.selectedFloorIds.join(','),
          configIds: this.selectedConfigIds.join(','),
          communityId: this.communityId,
          type: '1001',
          pagePath: 'exportCreateFeeTemplate'
        }
e2d2dbfb   wuxw   优化房屋收费页面 的批量催缴单
109
  
24d3590f   wuxw   房屋收费页面开发完成
110
        exportData(params).then(response => {
0fd4eb05   wuxw   费用导入功能测试完成
111
          this.$message.success(response.msg)
e2d2dbfb   wuxw   优化房屋收费页面 的批量催缴单
112
          if (response.code === 0) {
24d3590f   wuxw   房屋收费页面开发完成
113
114
115
116
117
118
119
            this.handleClose()
            this.$router.push('/pages/property/downloadTempFile?tab=下载中心')
          }
        }).catch(error => {
          this.$message.error(error.message)
        })
      },
e2d2dbfb   wuxw   优化房屋收费页面 的批量催缴单
120
  
24d3590f   wuxw   房屋收费页面开发完成
121
122
123
124
      handleClose() {
        this.visible = false
        this.reset()
      },
e2d2dbfb   wuxw   优化房屋收费页面 的批量催缴单
125
  
24d3590f   wuxw   房屋收费页面开发完成
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
      reset() {
        this.isFloorAll = true
        this.isConfigAll = true
        this.selectedFloorIds = []
        this.selectedConfigIds = []
      }
    }
  }
  </script>
  
  <style scoped>
  .margin-left {
    margin-left: 15px;
  }
  </style>