rk
2025-09-29 218e84d2264e413f31a2f3957f05bb7b8ad42d5d
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
<template>
  <TableLayout :permissions="['business:rooms:query']">
    <!-- 搜索表单 -->
    <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="80px" inline>
      <!-- <el-form-item label="会议室名称" prop="name">
        <el-input v-model="searchForm.name" placeholder="请输入名称" @keypress.enter.native="search"></el-input>
      </el-form-item> -->
      <!-- <el-form-item label="会议室" prop="roomId">
        <el-select
          v-model="searchForm.roomId"
          filterable
          clearable
          placeholder="请选择会议室"
        >
          <el-option
            v-for="item in rooms"
            :key="item.id"
            :value="item.id"
            :label="item.name"
          />
        </el-select>
      </el-form-item> -->
      <el-form-item label="年份" prop="yearNum">
        <!-- <div @click="selectMemberAction">
          <el-input v-model="searchForm.id" disabled placeholder="选择部门成员"></el-input>
        </div> -->
        <!-- {{ searchForm.sysList }} -->
        <el-select
          v-model="searchForm.yearNum"
          clearable
          placeholder="选择部门成员"
        >
          <el-option
            v-for="item in years"
            :key="item"
            :value="item"
            :label="`${item}年`"
          ></el-option>
          <!-- <el-option :key="1" :value="1" label="禁用" /> -->
        </el-select>
      </el-form-item>
 
      <section>
        <el-button type="primary" @click="search">搜索</el-button>
 
        <el-button @click="reset">重置</el-button>
      </section>
    </el-form>
    <!-- 表格和分页 -->
    <template v-slot:table-wrap>
      <ul class="toolbar" v-permissions="['business:rooms:create', 'business:rooms:delete']">
        <li><el-button :loading="isWorking.export" v-permissions="['business:rooms:exportExcel']" @click="exportExcel">导出</el-button></li>
        <!-- <li><el-button type="primary" @click="$refs.operaRoomsWindow.open('新建会议室')" v-permissions="['business:rooms:create']">新建</el-button></li>
        <li><el-button @click="deleteByIdInBatch" v-permissions="['business:rooms:delete']">删除</el-button></li> -->
      </ul>
      <el-table
          :height="tableHeightNew"
        v-loading="isWorking.search"
        :data="tableData.list"
        stripe
        @selection-change="handleSelectionChange"
      >
        <el-table-column prop="roomName" label="会议室" align="center" min-width="120px"></el-table-column>
        <el-table-column prop="januaryCount" label="一月" align="center" min-width="80px">
          <template slot-scope="{row}">
            {{ `${row.januaryCount}H` }}
          </template>
        </el-table-column>
        <el-table-column prop="januaryCount" label="二月" align="center" min-width="80px">
          <template slot-scope="{row}">
            {{ `${row.februaryCount}H` }}
          </template>
        </el-table-column>
        <el-table-column prop="januaryCount" label="三月" align="center" min-width="80px">
          <template slot-scope="{row}">
            {{ `${row.marchCount}H` }}
          </template>
        </el-table-column>
        <el-table-column prop="januaryCount" label="四月" align="center" min-width="80px">
          <template slot-scope="{row}">
            {{ `${row.aprilCount}H` }}
          </template>
        </el-table-column>
        <el-table-column prop="januaryCount" label="五月" align="center" min-width="80px">
          <template slot-scope="{row}">
            {{ `${row.mayCount}H` }}
          </template>
        </el-table-column>
        <el-table-column prop="januaryCount" label="六月" align="center" min-width="80px">
          <template slot-scope="{row}">
            {{ `${row.juneCount}H` }}
          </template>
        </el-table-column>
        <el-table-column prop="januaryCount" label="七月" align="center" min-width="80px">
          <template slot-scope="{row}">
            {{ `${row.julyCount}H` }}
          </template>
        </el-table-column>
        <el-table-column prop="januaryCount" label="八月" align="center" min-width="80px">
          <template slot-scope="{row}">
            {{ `${row.augustCount}H` }}
          </template>
        </el-table-column>
        <el-table-column prop="januaryCount" label="九月" align="center" min-width="80px">
          <template slot-scope="{row}">
            {{ `${row.septemberCount}H` }}
          </template>
        </el-table-column>
        <el-table-column prop="januaryCount" label="十月" align="center" min-width="80px">
          <template slot-scope="{row}">
            {{ `${row.octoberCount}H` }}
          </template>
        </el-table-column>
        <el-table-column prop="januaryCount" label="十一月" align="center" min-width="80px">
          <template slot-scope="{row}">
            {{ `${row.novemberCount}H` }}
          </template>
        </el-table-column>
        <el-table-column prop="januaryCount" label="十二月" align="center" min-width="80px">
          <template slot-scope="{row}">
            {{ `${row.decemberCount}H` }}
          </template>
        </el-table-column>
 
      </el-table>
    </template>
  </TableLayout>
</template>
 
<script>
import BaseTable from '@/components/base/BaseTable'
import TableLayout from '@/layouts/TableLayout'
import { getRoomStatistics, exportRoomStatistics } from '@/api/meeting/bookings'
// import { findList } from '@/api/meeting/rooms'
export default {
  name: 'Rooms',
  extends: BaseTable,
  components: { TableLayout,  },
  data () {
    return {
      years: [
        '2021', '2022', '2023'
      ],
      rooms: [],
      // 搜索
      searchForm: {
        yearNum: '',
        roomId: ''
      }
    }
  },
 
  created () {
    this.config({
      module: '会议室信息表',
      api: '/meeting/rooms',
      'field.id': 'id',
      'field.main': 'id'
    })
    // findList({})
    //   .then(res => {
    //     this.rooms = res
    //   })
    let tempYear = new Date().getFullYear()
    this.searchForm.yearNum = tempYear
    this.years = [tempYear-2, tempYear-1, tempYear]
    this.search()
  },
  methods: {
    // 导出Excel
    exportExcel () {
      this.__checkApi()
      this.$dialog.exportConfirm('确认导出吗?')
        .then(() => {
          this.isWorking.export = true
          exportRoomStatistics({
            page: this.tableData.pagination.pageIndex,
            capacity: 1000000,
            model: this.searchForm,
            sorts: this.tableData.sorts
          })
            .then(response => {
              this.download(response)
            })
            .catch(e => {
             //  this.$tip.apiFailed(e)
            })
            .finally(() => {
              this.isWorking.export = false
            })
        })
        .catch(() => {})
    },
    // 页码变更处理
    handlePageChange () {
      this.isWorking.search = true
      getRoomStatistics(this.searchForm.yearNum, this.searchForm.roomId)
        .then(data => {
          this.tableData.list = data
          // this.tableData.pagination.total = data.total
        })
        .catch(e => {
         //  this.$tip.apiFailed(e)
        })
        .finally(() => {
          this.isWorking.search = false
        })
    },
    // selectMemberAction() {
    //   console.log('21212');
    //   this.$refs.selectMember.open('选择管理员')
    // },
    changeStatus(item) {
      updateById({
        id: item.id,
        status: item.status
      }).then(res => {
        this.search()
      })
    }
  },
}
</script>
 
<style scoped>
::v-deep .el-input.is-disabled .el-input__inner {
  background-color: #fff !important;
  cursor: pointer;
}
</style>