马宇豪
2022-12-27 771e0da9c6082c78a28f5286f89f4f36b05689d3
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
<template>
    <div class="app-container">
        <div class="filter-container">
            <div class="basic_search">
                <span class="span-filter-label">部门</span>
                <el-select v-model="filter.filter.department"  filterable placeholder="请选择" style="width:200px">
                    <el-option
                        v-for="item in department"
                        :key="item.department"
                        :label="item.department"
                        :value="item.department">
                    </el-option>
                </el-select>
            </div>
 
            <div class="basic_search">
                <span class="span-filter-label">预约日期</span>
                <el-date-picker
                    v-model="filter.filter.appointment"
                    value-format="yyyy-MM-dd"
                    align="right"
                    type="date"
                    placeholder="选择日期"
                    :picker-options="pickerOptions">
                </el-date-picker>
            </div>
 
            <el-button style="margin-left: 10px;" type="primary" icon="el-icon-refresh" @click="refreshHandle">搜索</el-button>
        </div>
        <div class="table_content">
            <el-table
                v-loading="listLoading"
                :key="tableKey"
                :data="tableData"
                border
                fit
                highlight-current-row
                style="width: 100%;"
            >
 
                <el-table-column style="width: 200px;"  prop="appointment"  align="center">
                </el-table-column>
                <el-table-column style="width: 200px;" label="部门"  prop="department"  align="center">
                </el-table-column>
                <el-table-column label="动火" prop="fire" align="center">
                </el-table-column>
                <el-table-column label="受限空间" prop="space" align="center">
                </el-table-column>
                <el-table-column label="吊装作业" prop="hoisting" align="center">
                </el-table-column>
                <el-table-column label="动土作业" prop="soild" align="center">
                </el-table-column>
                <el-table-column label="断路作业" prop="breaks" align="center">
                </el-table-column>
                <el-table-column label="高处作业" prop="high" align="center">
                </el-table-column>
                <el-table-column label="临时用电" prop="electricity" align="center">
                </el-table-column>
                <el-table-column label="盲板作业" prop="blindboard" align="center">
                </el-table-column>
 
            </el-table>
            <br>
            <el-pagination
                v-show="recordTotal>0"
                :current-page="filter.pageIndex"
                :page-sizes="[10, 20, 30, 50]"
                :page-size="filter.pageSize"
                :total="recordTotal"
                layout="total, sizes, prev, pager, next, jumper"
                background
                style="float:right;"
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
            />
            <br>
        </div>
 
    </div>
</template>
 
<script>
import { mapGetters } from 'vuex'
import { computePageCount } from '../../utils'
import {reserveStatistics} from '../../api/workPlan'
import Cookies from 'js-cookie'
import {  getAllDepartment } from '@/api/departmentManage'
 
export default {
  name: 'index',
  filters: {},
  computed: {
    ...mapGetters([
      'userType'
    ]),
    tableData() {
      const tbody = this.statisticsData
      return tbody.length ? [...tbody, ...this.tableFoot] : []
    }
  },
  data() {
    return {
      tableKey: 0,
      statisticsData: [],
      department: [],
      appointment: '',
      listLoading: false,
      recordTotal: 0,
      isSending: false,
      filter: {
        pageIndex: 1,
        pageSize: 10,
        filter: {
          department: '',
          appointment: ''
        }
      },
      tableFoot: [],
      dataForm: {
        id: '',
        fire: '',
        space: '',
        hoisting: '',
        soild: '',
        breaks: '',
        high: '',
        electricity: '',
        blindboard: '',
        appointment: ''
 
      },
      pickerOptions: {
        shortcuts: [{
          text: '今天',
          onClick(picker) {
            picker.$emit('pick', new Date())
          }
        }, {
          text: '昨天',
          onClick(picker) {
            const date = new Date()
            date.setTime(date.getTime() - 3600 * 1000 * 24)
            picker.$emit('pick', date)
          }
        }, {
          text: '明天',
          onClick(picker) {
            const date = new Date()
            date.setTime(date.getTime() + 3600 * 1000 * 24)
            picker.$emit('pick', date)
          }
        }]
      }
 
    }
  },
  mounted() {
    this.getDepartmentList()
    this.getPageList()
  },
  methods: {
    async getPageList() {
      this.listLoading = true
      let res = await reserveStatistics(this.filter)
      if (res.data.code === '200') {
        this.recordTotal = res.data.result.total
        this.pageSize = res.data.result.pageSize
        this.currentPage = res.data.result.pageIndex
        this.statisticsData = res.data.result.records
        res.data.result.extension.appointment = '总计'
        this.tableFoot = [res.data.result.extension]
      } else {
        this.$message({
          message: res.data.message,
          type: 'warning'
        })
      }
      this.listLoading = false
    },
    async getDepartmentList() {
      getAllDepartment()
        .then(res => {
          if (res.data.code === '200')
            this.department = res.data.result
          else
            this.$message({ message: res.data.message,type: 'warning'})
 
        })
    },
    refreshHandle() {
      this.getPageList()
    },
    handleSizeChange(val) {
      this.filter.pageSize = val
      this.getPageList()
    },
    handleCurrentChange(val) {
      this.filter.pageIndex = val
      this.getPageList()
    },
 
  }
}
</script>
<style scoped>
.basic_search{
    display:inline-block;
    padding-bottom: 10px;
}
.span-filter-label {
    font-size: 15px;
    color: #606266;
    margin-right: 4px;
    margin-left: 7px;
}
</style>