Your Name
2022-08-01 1621b3719092d93e6c29f7a27e401529e0454420
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
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
<template>
    <div class="home-container">
        <el-scrollbar height="100%">
        <el-row class="homeCard">
            <el-col :span="12">
                <div class="grid-content topInfo">
                    <el-select v-model="searchType" @change="changeSearch" placeholder="任务名称">
                        <el-option label="巡检任务类型" value="巡检任务类型" />
                        <el-option label="创建人" value="创建人" />
                        <el-option label="巡检人" value="巡检人" />
                        <el-option label="检查频次" value="检查频次" />
                        <el-option label="开始时间" value="开始时间" />
                    </el-select>
                    <el-input v-model="searchContent" v-if="searchType == '任务名称'" placeholder="请输入任务名称"></el-input>
                    <el-input
                            v-else-if="searchType == '检查频次'"
                            v-model="searchContent"
                            placeholder="请输入检查频次"
                    >
                        <template #append>
                            <el-select v-model="searchUnit" placeholder="选择单位">
                                <el-option label="分钟" value="分钟" />
                                <el-option label="小时" value="小时" />
                                <el-option label="天" value="天" />
                            </el-select>
                        </template>
                    </el-input>
                    <el-select v-model="searchContent" v-else-if="searchType == '巡检任务类型'" placeholder="请选择任务类型">
                        <el-option v-for="(item,index) in typeOptions" :label="item.name" :value="item.value" :key="index"/>
                    </el-select>
                    <el-select v-model="searchContent" v-else-if="searchType == '创建人'" placeholder="请选择创建人">
                        <el-option v-for="(item,index) in createrOptions" :label="item.name" :value="item.value" :key="index"/>
                    </el-select>
                    <el-select v-model="searchContent" v-else-if="searchType == '巡检人'" placeholder="请选择巡检人">
                        <el-option v-for="(item,index) in inspectorOptions" :label="item.name" :value="item.value" :key="index"/>
                    </el-select>
                    <el-date-picker
                            v-model="searchContent"
                            type="date"
                            v-else
                            :placeholder="'请选择' + searchType"
                            size="large"
                            style="margin-right: 20px"
                    />
                    <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" @click="dialogAddRecord=true">新建</el-button>
                        <el-button type="danger" :icon="Delete" size="default" plain>删除</el-button>
                    </el-col>
                    <el-button type="primary" :icon="Refresh" size="default"/>
                </el-row>
                <el-table
                        ref="multipleTableRef"
                        :data="tableData"
                        style="width: 100%"
                        :header-cell-style="{background: '#fafafa'}"
                        @selection-change="handleSelectionChange"
                >
                    <el-table-column type="selection" width="55" />
                    <el-table-column property="name" label="任务名称" width="200"/>
                    <el-table-column property="type" label="任务类型"/>
                    <el-table-column property="creater" label="创建人"/>
                    <el-table-column property="inspector" label="巡检人"/>
                    <el-table-column property="frequency" label="检查频次"/>
                    <el-table-column property="unit" label="频次单位"/>
                    <el-table-column property="startTime" label="任务开始时间" width="180"/>
                    <el-table-column property="validTime" label="任务有效时间" width="180"/>
                    <el-table-column property="createTime" label="创建时间" width="180"/>
                    <el-table-column property="chainLength" label="巡检链长度" width="160"/>
                    <el-table-column property="status" label="状态" width="60"/>
                    <el-table-column fixed="right" label="操作" align="center" width="300">
                        <template #default="scope">
                            <el-button link type="primary" size="small" :icon="View" @click="viewRecord(scope.row)">查看</el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </div>
            <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>
        </el-scrollbar>
        <el-dialog v-model="dialogDetails" title="巡检任务">
            <el-form :model="details" label-width="120px">
                <el-form-item label="任务名称">
                    <el-input
                            v-model="details.name"
                            readonly
                    />
                </el-form-item>
                <el-form-item label="任务类型">
                    <el-input
                            v-model="details.type"
                            readonly
                    />
                </el-form-item>
                <el-form-item label="执行巡检人员">
                    <el-input
                            v-model="details.inspector"
                            readonly
                    />
                </el-form-item>
                <el-form-item label="检查频次">
                    <el-input
                            v-model="details.inspector"
                            readonly
                    />
                </el-form-item>
                <el-form-item label="检查频次" prop="frequency">
                    <el-input
                            v-model="details.frequency"
                            readonly
                    >
                        <template #append>
                            <el-input
                                    v-model="details.unit"
                                    readonly
                            />
                        </template>
                    </el-input>
                </el-form-item>
                <el-form-item label="周期开始时间">
                    <el-input
                            v-model="details.startTime"
                            readonly
                    />
                </el-form-item>
                <el-form-item label="周期有效时间">
                    <el-input
                            v-model="details.validTime"
                            readonly
                    />
                </el-form-item>
                <el-form-item label="巡检链">
                    <div style="width: 100%;margin-left: -30px">
                        <div v-for="(item,index) in details.shiftSteps" class="stepItem">
                            <div class="stepNum">{{index+1}}</div>
                            <div class="stepCard">
                                <el-card class="box-card" shadow="hover">
                                    <template #header>
                                        <div class="card-header">
                                            <div>{{item.name}}</div>
                                        </div>
                                    </template>
                                    <div>
                                        <el-table :data="item.inspectorData" style="width: 100%" :default-sort="{ prop: 'sort', order: 'ascending'}" :header-cell-style="{background: '#fafafa',padding: '5px'}">
                                            <el-table-column property="sort" sortable label="排序"/>
                                            <el-table-column property="name" label="巡检点名称"/>
                                            <el-table-column property="section" label="所属设备区域"/>
                                            <el-table-column property="rfid" label="关联RFID"/>
                                            <el-table-column property="norm" label="巡检指标"/>
                                            <el-table-column property="reference" label="数据参考值"/>
                                        </el-table>
                                    </div>
                                </el-card>
                            </div>
                        </div>
                    </div>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="dialogDetails = false" size="default">确认</el-button>
                </el-form-item>
            </el-form>
        </el-dialog>
    </div>
</template>
 
<script lang="ts" setup>
    import { toRefs, reactive, ref } from 'vue';
    import { storeToRefs } from 'pinia';
    import { initBackEndControlRoutes } from '/@/router/backEnd';
    import {useUserInfo} from "/@/stores/userInfo";
    import { Session } from '/@/utils/storage';
    import { Edit, View, Plus, Delete, Refresh, Search, Download } from '@element-plus/icons-vue'
    import { ElTable, ElMessage } from 'element-plus'
    import { FormInstance, FormRules } from 'element-plus'
    let global: any = {
        homeChartOne: null,
        homeChartTwo: null,
        homeCharThree: null,
        dispose: [null, '', undefined],
    };
 
    interface stateType {
        homeOne: Array <type>
    }
    interface type {
 
    }
            const userInfo = useUserInfo()
            const { userInfos } = storeToRefs(userInfo);
 
            // 顶部筛选搜索
            const searchType = ref('任务名称')
            const typeOptions = ref([
                {
                    name: '日常检查',
                    value: '日常检查'
                },
                {
                    name: '周期检查',
                    value: '周期检查'
                }
            ])
            const createrOptions = ref([
                {
                    name: '张三',
                    value: '张三'
                },
                {
                    name: '李四',
                    value: '李四'
                }
            ])
            const inspectorOptions = ref([
                {
                    name: '李四',
                    value: '李四'
                },
                {
                    name: '张三',
                    value: '张三'
                }
            ])
            const searchUnit = ref('小时')
            const changeSearch =()=>{
                searchContent.value=''
            }
            const searchContent = ref()
 
 
            const currentPage = ref(1)
            const pageSize = ref(10)
            const chosenIndex = ref(-1)
            const chosenShiftIndex = ref(-1)
            const chosenInspectionIndex = ref(-1)
            const handleSizeChange = (val: number) => {
                console.log(`${val} items per page`)
            }
            const handleCurrentChange = (val: number) => {
                console.log(`current page: ${val}`)
            }
 
            // 时间格式化
            const timeForm = {
                hour12: false,
                year: 'numeric',
                month: '2-digit',
                day: '2-digit',
                hour: '2-digit',
                minute: '2-digit',
                second: '2-digit'
            }
            const tableData = reactive(
                    [
                    {
                        name: '甲醛装置()列现场岗位巡检',
                        type: '周期检查',
                        creater: '管理员A',
                        inspector: '张三',
                        frequency: 2,
                        unit: '小时',
                        startTime: '2022-07-02 13:01:37',
                        validTime: '30分钟',
                        createTime: '2022-07-02 12:03:47',
                        chainLength: '20',
                        status: '开启',
                        shiftSteps:[
                            {
                                name: '风机系统',
                                inspectorData:[
                                    {
                                        sort: 1,
                                        name: '73011',
                                        section: '风机系统',
                                        rfid: '风机系统1标签',
                                        norm: '风机声音',
                                        reference: '10<正常<50'
                                    },
                                    {
                                        sort: 2,
                                        name: '73012',
                                        section: '风机系统',
                                        rfid: '风机系统2标签',
                                        norm: '设备温度',
                                        reference: '20<正常<50'
                                    },
                                    {
                                        sort: 3,
                                        name: '73013',
                                        section: '风机系统',
                                        rfid: '风机系统3标签',
                                        norm: '风机震动',
                                        reference: '30<正常<50'
                                    }
                                ]
 
                            },
                            {
                                name: 'A场所',
                                inspectorData:[
                                    {
                                        sort: 1,
                                        name: '73021',
                                        section: '风机系统',
                                        rfid: '风机系统1标签',
                                        norm: '风机声音',
                                        reference: '10<正常<50'
                                    },
                                    {
                                        sort: 2,
                                        name: '73022',
                                        section: '风机系统',
                                        rfid: '风机系统2标签',
                                        norm: '设备温度',
                                        reference: '20<正常<50'
                                    },
                                    {
                                        sort: 3,
                                        name: '73023',
                                        section: '风机系统',
                                        rfid: '风机系统3标签',
                                        norm: '风机震动',
                                        reference: '30<正常<50'
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        name: 'A车间日常巡检',
                        type: '日常检查',
                        creater: '管理员B',
                        inspector: '李四',
                        frequency: 4,
                        unit: '小时',
                        startTime: '2022-07-02 12:45:37',
                        validTime: '30分钟',
                        createTime: '2022-07-02 08:15:41',
                        chainLength: '15',
                        status: '开启'
                    }
                ]
            )
 
            const dialogDetails = ref(false)
 
            const details = ref({})
            const viewRecord = (row) =>{
                details.value = JSON.parse(JSON.stringify(row))
                dialogDetails.value = true
            }
 
            // 折线图
            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: 100%;
        overflow: hidden;
        padding: 20px;
        .homeCard{
            width: 100%;
            padding: 20px;
            background: #fff;
            border-radius: 4px;
        }
        .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;
                }
            }
        }
        .mainPages{
            height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
        }
        .main-card{
            width: 100%;
            .cardTop{
                display: flex;
                align-items: center;
                justify-content: space-between;
                margin-bottom: 20px;
                .mainCardBtn{
                    margin: 0;
                }
            }
        }
        .pageBtn{
            display: flex;
            align-items: center;
            justify-content: right;
            margin-top: 20px;
 
            .demo-pagination-block + .demo-pagination-block {
                margin-top: 10px;
            }
            .demo-pagination-block .demonstration {
                margin-bottom: 16px;
            }
        }
    }
    .stepItem{
        width: 100%;
        display: flex;
        align-items: flex-start;
        margin-bottom: 30px;
        margin-left: 30px;
        padding-bottom: 30px;
        border-left: 2px solid #ccc;
        &:first-of-type{
            margin-top: 30px;
        }
        &:last-of-type{
            margin-bottom: 0;
            border-left: none;
        }
        .stepNum {
            width: 30px;
            height: 30px;
            border-radius: 15px;
            box-sizing: border-box;
            color: #333;
            border: 1px solid #999;
            line-height: 28px;
            text-align: center;
            margin-right: 10px;
            margin-left: -16px;
            margin-top: -30px;
        }
        .stepCard {
            width: 100%;
            margin-top: -30px;
 
            .box-card {
                width: 100%;
                &:deep(.el-card__header){
                    padding: 10px 15px
                }
                .card-header {
                    width: 100%;
                    display: flex;
                    justify-content: space-between;
                    align-items: center;
                    &>div:first-of-type{
                        margin-right: 80px;
                        font-size: 18px;
                        font-weight: bold;
                    }
                }
            }
        }
        &:hover .card-header{
            color: #0098F5;
        }
        &:hover .stepNum{
            border: 2px solid #0098F5;
            color: #0098F5;
        }
    }
    .el-input{
        width: 100% !important;
    }
    :deep(.el-date-editor){
        width: 100%;
    }
    .el-select{
        width: 100%;
    }
</style>