Your Name
2022-08-15 7d1d7639ce54590befad48f79e3847b9a5f361b0
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
<template>
    <div class="home-container">
        <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
            <el-tab-pane label="申请中" name="Applying">
                <div style="height: 100%">
                    <el-row class="homeCard">
                            <el-col :span="8">
                                <div class="grid-content topInfo">
                                    <el-input v-model="searchWord" placeholder="作业证名称"></el-input>
                                    <el-button type="primary">查询</el-button>
                                    <el-button plain>重置</el-button>
                                </div>
                            </el-col>
                    </el-row>
                    <div class="homeCard">
                        <div class="main-card">
                            <el-row class="cardTop">
                                <el-col :span="12" class="mainCardBtn">
                                    <el-button type="primary" :icon="Plus" size="default">申请</el-button>
<!--                                    <el-button type="danger" :icon="Delete" size="default">删除</el-button>-->
<!--                                    <el-button type="success" size="default">设置分类</el-button>-->
                                </el-col>
                                <el-button type="primary" :icon="Refresh" size="default"/>
                            </el-row>
                            <el-table
                                    ref="multipleTableRef"
                                    :data="applyData"
                                    style="width: 100%"
                                    height="calc(100% - 100px)"
                                    :header-cell-style="{background: '#fafafa'}"
                                    @selection-change="handleSelectionChange"
                            >
                                <el-table-column type="selection" width="55" />
                                <el-table-column type="index" label="作业证编号" width="200"/>
                                <el-table-column property="level" label="作业证等级" width="180" sortable />
                                <el-table-column property="applyDate" label="申请日期" sortable />
                                <el-table-column property="name" label="申请人" width="180"/>
                                <el-table-column property="department" label="申请部门" width="180" />
                                <el-table-column label="申请状态" width="180">
                                    <template #default="scope">
                                        <el-tag type="success">{{ scope.row.status }}</el-tag>
                                    </template>
                                </el-table-column>
                                <el-table-column fixed="right" label="操作" align="center" width="250">
                                    <template #default="scope">
                                        <el-button link type="primary" size="small" :icon="View" @click="viewRecord(scope.row)">查看</el-button>
                                        <el-button link type="danger" size="small" :icon="Delete" @click="deleteRecord(scope.$index)">删除</el-button>
                                    </template>
                                </el-table-column>
                            </el-table>
                            <div class="pageBtn">
                                <el-pagination
                                        v-model:currentPage="currentPage"
                                        v-model:page-size="pageSize"
                                        :page-sizes="[10, 15]"
                                        small=false
                                        background
                                        layout="total, sizes, prev, pager, next, jumper"
                                        :total="100"
                                        @size-change="handleSizeChange"
                                        @current-change="handleCurrentChange"
                                />
                            </div>
                        </div>
                    </div>
                </div>
                <el-dialog v-model="dialogDetails" title="作业票查看">
                    <el-form :model="details" label-width="120px">
                        <el-form-item label="作业证等级">
                            <el-input
                                    v-model="details.level"
                                    readonly
                            />
                        </el-form-item>
                        <el-form-item label="申请日期">
                            <el-input
                                    v-model="details.applyDate"
                                    readonly
                            />
                        </el-form-item>
                        <el-form-item label="申请人">
                            <el-input
                                    v-model="details.name"
                                    readonly
                            />
                        </el-form-item>
                        <el-form-item label="申请部门">
                            <el-input
                                    v-model="details.department"
                                    readonly
                            />
                        </el-form-item>
                        <el-form-item label="状态">
                            <el-input
                                    v-model="details.status"
                                    readonly
                            />
                        </el-form-item>
                        <el-form-item>
                            <el-button type="primary" @click="dialogDetails = false" size="default">确认</el-button>
                        </el-form-item>
                    </el-form>
                </el-dialog>
                <el-dialog v-model="deleteDialog" title="提示" width="30%" center @close="indexClear">
                    <span>您确定要删除该条记录吗?</span>
                    <template #footer>
                          <span class="dialog-footer">
                              <el-button @click="deleteDialog = false" size="default">取消</el-button>
                            <el-button type="primary" @click="conFirmDelete" size="default" v-throttle>确认</el-button>
                          </span>
                    </template>
                </el-dialog>
            </el-tab-pane>
            <el-tab-pane label="已通过" name="passed">
                <div style="height: 100%">
                    <el-row class="homeCard">
                        <el-col :span="8">
                            <div class="grid-content topInfo">
                                <el-input v-model="searchWord" placeholder="作业证名称"></el-input>
                                <el-button type="primary">查询</el-button>
                                <el-button plain>重置</el-button>
                            </div>
                        </el-col>
                    </el-row>
                    <div class="homeCard">
                        <div class="main-card">
<!--                            <el-row class="cardTop">-->
<!--                                <el-col :span="12" class="mainCardBtn">-->
<!--                                    <el-button type="primary" :icon="Plus" size="default">申请</el-button>-->
<!--                                    <el-button type="danger" :icon="Delete" size="default">删除</el-button>-->
<!--                                    <el-button type="success" size="default">设置分类</el-button>-->
<!--                                </el-col>-->
<!--                                <el-button type="primary" size="default" :icon="Refresh" />-->
<!--                            </el-row>-->
                            <el-table
                                    ref="multipleTableRef"
                                    :data="passedData"
                                    style="width: 100%"
                                    height="calc(100% - 48px)"
                                    :header-cell-style="{background: '#fafafa'}"
                                    @selection-change="handleSelectionChange"
                            >
                                <el-table-column type="selection" width="55" />
                                <el-table-column type="index" label="编号" width="200"/>
                                <el-table-column property="level" label="作业证等级" width="180" sortable />
                                <el-table-column property="applyDate" label="申请日期" sortable />
                                <el-table-column property="name" label="申请人" width="180"/>
                                <el-table-column property="department" label="申请部门" width="180" />
                                <el-table-column label="申请状态" width="180">
                                    <template #default="scope">
                                        <el-tag type="success">{{ scope.row.status }}</el-tag>
                                    </template>
                                </el-table-column>
                            </el-table>
                            <div class="pageBtn">
                                <el-pagination
                                        v-model:currentPage="currentPage"
                                        v-model:page-size="pageSize"
                                        :page-sizes="[10, 15]"
                                        small=false
                                        background
                                        layout="total, sizes, prev, pager, next, jumper"
                                        :total="100"
                                        @size-change="handleSizeChange"
                                        @current-change="handleCurrentChange"
                                />
                            </div>
                        </div>
                    </div>
                </div>
            </el-tab-pane>
        </el-tabs>
    </div>
</template>
 
<script lang="ts" setup>
    import { toRefs, reactive, defineComponent, ref } from 'vue';
    import { storeToRefs } from 'pinia';
    import { initBackEndControlRoutes } from '/@/router/backEnd';
    import {useUserInfo} from "/@/stores/userInfo";
    import { Session } from '/@/utils/storage';
    import { Plus, Delete, Refresh } from '@element-plus/icons-vue'
    import { ElTable } from 'element-plus'
    import type { TabsPaneContext } from 'element-plus'
    let global: any = {
        homeChartOne: null,
        homeChartTwo: null,
        homeCharThree: null,
        dispose: [null, '', undefined],
    };
 
    interface stateType {
        homeOne: Array <type>
    }
    interface type {
 
    }
    interface User {
        num: string
        level: string
        applyDate: string
        name: string
        department: string
        status: string
    }
    const userInfo = useUserInfo()
    const { userInfos } = storeToRefs(userInfo);
    const activeName = ref('Applying')
    const handleClick = (tab: TabsPaneContext, event: Event) => {
        console.log(tab, event)
    }
    const multipleTableRef = ref<InstanceType<typeof ElTable>>()
    const multipleSelection = ref<User[]>([])
    const handleSelectionChange = (val: User[]) => {
        multipleSelection.value = val
    }
    const currentPage = ref(1)
    const pageSize = ref(10)
    const handleSizeChange = (val: number) => {
        console.log(`${val} items per page`)
    }
    const handleCurrentChange = (val: number) => {
        console.log(`current page: ${val}`)
    }
    const applyData = reactive([
        {
            level: '等级一',
            applyDate: '2022-07-27 14:19:33',
            name: '张三',
            department: '部门一',
            status: '审核中'
 
        },
        {
            level: '等级一',
            applyDate: '2022-07-27 14:19:33',
            name: '张三',
            department: '部门一',
            status: '审核中'
 
        },
        {
            level: '等级一',
            applyDate: '2022-07-27 14:19:33',
            name: '张三',
            department: '部门一',
            status: '审核中'
 
        }
    ])
    const chosenIndex = ref(-1)
    const passedData: User[] = []
    const dialogDetails = ref(false)
    const details = ref({})
    const deleteDialog = ref(false)
 
    // 查看记录
    const viewRecord = (row) =>{
        details.value = JSON.parse(JSON.stringify(row))
        dialogDetails.value = true
    }
 
    // 删除记录
    const deleteRecord = (index) =>{
        chosenIndex.value = index
        deleteDialog.value = true
    }
 
    // 弹窗确认删除记录
    const conFirmDelete = ()=> {
        applyData.splice(chosenIndex.value,1)
        deleteDialog.value = false
    }
    // 折线图
    const renderMenu = async (value: string) => {
        Session.set('projectId',value)
        userInfos.value.projectId = value
        await initBackEndControlRoutes();
    };
</script>
 
<style scoped lang="scss">
    $homeNavLengh: 8;
    .home-container {
        height: calc(100vh - 144px);
        box-sizing: border-box;
        overflow: hidden;
        .demo-tabs{
            width: 100%;
            height: 100%;
 
            &::v-deep(.el-tabs__content){
                height: calc(100% - 60px);
            }
 
            .el-tab-pane{
                height: 100%;
            }
        }
        .homeCard{
            width: 100%;
            padding: 20px;
            box-sizing: border-box;
            background: #fff;
            border-radius: 4px;
 
            .main-card{
                width: 100%;
                height: 100%;
                .cardTop{
                    display: flex;
                    align-items: center;
                    justify-content: space-between;
                    margin-bottom: 20px;
                    .mainCardBtn{
                        margin: 0;
                    }
                }
                .pageBtn{
                    height: 60px;
                    display: flex;
                    align-items: center;
                    justify-content: right;
 
                    .demo-pagination-block + .demo-pagination-block {
                        margin-top: 10px;
                    }
                    .demo-pagination-block .demonstration {
                        margin-bottom: 16px;
                    }
                }
            }
            &:last-of-type{
                height: calc(100% - 100px);
            }
        }
        .el-row{
            display: flex;
            align-items: center;
            margin-bottom: 20px;
            &:last-child {
                margin-bottom: 0;
            }
            .grid-content{
                align-items: center;
                min-height: 36px;
            }
 
            .topInfo {
                display: flex;
                align-items: center;
                font-size: 16px;
                font-weight: bold;
 
                &>div{
                    white-space: nowrap;
                    margin-right: 20px;
                }
            }
        }
    }
</style>