Blame view

src/components/fee/exportCarFeeImportExcel.vue 4.72 KB
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
1
  <template>
2e0fd29c   wuxw   开发报修
2
    <el-dialog :title="$t('exportCarFeeImportExcel.templateExport')" :visible.sync="visible" width="50%">
963f5a4f   wuxw   车辆功能测试完成
3
      <el-form label-width="150px" class="text-left">
2e0fd29c   wuxw   开发报修
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
        <el-form-item :label="$t('exportCarFeeImportExcel.parkingLot')">
          <div>
            <el-checkbox v-model="isParkingAreaAll" @change="changeAllParkingAreas">
              {{ $t('exportCarFeeImportExcel.all') }}
            </el-checkbox>
            <el-checkbox-group v-model="selectedParkingAreas" @change="changeItemParkingArea">
              <el-checkbox v-for="item in parkingAreas" :key="item.paId" :label="item.paId" style="margin-left:15px">
                {{ item.num }}{{ $t('exportCarFeeImportExcel.parkingLotPlaceholder') }}
              </el-checkbox>
            </el-checkbox-group>
          </div>
        </el-form-item>
  
        <el-form-item :label="$t('exportCarFeeImportExcel.feeItem')">
          <div>
            <el-checkbox v-model="isConfigAll" @change="changeAllConfigs">
              {{ $t('exportCarFeeImportExcel.all') }}
            </el-checkbox>
            <el-checkbox-group v-model="selectedConfigs" @change="changeItemConfig">
              <template v-for="item in configs">
                <el-checkbox :key="item.configId" :label="item.configId" style="margin-left:15px"
                  v-if="item.feeTypeCd !== '888800010001' && item.feeTypeCd !== '888800010009' && item.feeTypeCd !== '888800010011'">
                  {{ item.feeName }}
                </el-checkbox>
              </template>
            </el-checkbox-group>
          </div>
        </el-form-item>
      </el-form>
  
      <div slot="footer" class="dialog-footer">
        <el-button @click="visible = false">{{ $t('exportCarFeeImportExcel.cancel') }}</el-button>
        <el-button type="primary" @click="handleExport">{{ $t('exportCarFeeImportExcel.export') }}</el-button>
      </div>
    </el-dialog>
  </template>
  
  <script>
a2e5ee01   wuxw   v1.9 优化车辆费用导入模版没法...
42
43
44
  import { listParkingAreas, listFeeConfigs } from '@/api/fee/carCreateFeeApi'
  import { exportData } from '@/api/fee/exportFeeImportExcelApi'
  import { getCommunityId } from '@/api/community/communityApi'
2e0fd29c   wuxw   开发报修
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
113
114
115
116
  
  export default {
    name: 'ExportCarFeeImportExcel',
    data() {
      return {
        visible: false,
        isParkingAreaAll: true,
        isConfigAll: true,
        selectedParkingAreas: [],
        selectedConfigs: [],
        parkingAreas: [],
        configs: []
      }
    },
    created() {
      this.fetchData()
    },
    methods: {
      async fetchData() {
        try {
          // 获取停车场
          const parkingRes = await listParkingAreas({
            page: 1,
            row: 150
          })
          this.parkingAreas = parkingRes.parkingAreas || []
          this.selectedParkingAreas = this.parkingAreas.map(item => item.paId)
  
          // 获取费用配置
          const configRes = await listFeeConfigs({
            page: 1,
            row: 100,
            isDefault: 'F'
          })
          this.configs = configRes.feeConfigs || []
          this.selectedConfigs = this.configs
            .filter(item => item.feeTypeCd !== '888800010001' && item.feeTypeCd !== '888800010009' && item.feeTypeCd !== '888800010011')
            .map(item => item.configId)
  
        } catch (error) {
          console.error('获取数据失败:', error)
        }
      },
      open() {
        this.visible = true
      },
      changeAllParkingAreas() {
        if (this.isParkingAreaAll) {
          this.selectedParkingAreas = this.parkingAreas.map(item => item.paId)
        } else {
          this.selectedParkingAreas = []
        }
      },
      changeItemParkingArea() {
        this.isParkingAreaAll = this.selectedParkingAreas.length === this.parkingAreas.length
      },
      changeAllConfigs() {
        if (this.isConfigAll) {
          this.selectedConfigs = this.configs
            .filter(item => item.feeTypeCd !== '888800010001' && item.feeTypeCd !== '888800010009' && item.feeTypeCd !== '888800010011')
            .map(item => item.configId)
        } else {
          this.selectedConfigs = []
        }
      },
      changeItemConfig() {
        this.isConfigAll = this.selectedConfigs.length === this.configs
          .filter(item => item.feeTypeCd !== '888800010001' && item.feeTypeCd !== '888800010009' && item.feeTypeCd !== '888800010011')
          .length
      },
      async handleExport() {
        try {
a2e5ee01   wuxw   v1.9 优化车辆费用导入模版没法...
117
118
119
120
121
122
123
124
125
126
127
128
129
          const params = {
          paIds: this.selectedParkingAreas.join(','),
          configIds: this.selectedConfigs.join(','),
          communityId: getCommunityId(),
          type: '2002',
          pagePath: 'exportCreateFeeTemplate'
        }
          exportData(params).then(response => {
            this.$message.success(response.msg)
            if (response.code === 0) {
              this.visible = false
              this.$router.push('/pages/property/downloadTempFile?tab=下载中心')
            }
2e0fd29c   wuxw   开发报修
130
131
          })
  
2e0fd29c   wuxw   开发报修
132
133
134
135
136
137
138
        } catch (error) {
          this.$message.error(this.$t('common.exportError'))
        }
      }
    }
  }
  </script>