pengwei
2025-04-21 7bbf1a9df53f5fe1c6c419304460ceec5b7a3629
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
<template>
  <div class="Maintenancemanagement">
    <div class="Maintenancemanagement_l">
      <div class="content">
        <div class="checkbox">
          <span style="
              color: rgba(0, 9, 56, 1);
              font-size: 1.13rem;
              font-weight: bold;
            ">在检人员监控</span>
          <div style="color: rgba(0, 9, 56, 1); font-size: 0.88rem">
            正在检修人员数量:<span style="color: red; font-size: 1.25rem; font-weight: bold">{{ totalCount }}</span>位
          </div>
        </div>
        <div class="serch">
          <div class="time_box">
            <el-select v-model="queryForm.selectType" :empty-values="[null, undefined]" placeholder="请选择" size="small"
              style="width: 9rem;height:2rem; margin-right: 0.98rem;">
              <el-option v-for="item in stateType" :key="item.value" :label="item.label" :value="item.value" />
            </el-select>
          </div>
          <div class="serch_box">
            <div class="serchb">全局搜索</div>
            <input v-model="queryForm.inputcontent" placeholder="请输入关键词搜索" style="border-left: 0.06rem solid #e2e2e2" />
          </div>
          <el-button @click="handleQuery" type="primary" size="small"
            style="margin-left: 0.98rem; height: 2rem">查询</el-button>
          <el-button size="small" style="height: 2rem" @click="resetQuery">重置</el-button>
        </div>
        <div style="margin-top: 1rem; height: 100%">
          <el-table empty-text="暂无数据" height="450" :data="tableData" style="width: 100%" :header-cell-style="{
            background: 'rgba(250,250,250,1)',
            color: '#101010',
            fontSize: '0.88rem',
            height: '3rem',
            border: 'none',
          }" :row-style="{
            color: '#101010',
            fontSize: '0.88rem',
            height: '3rem',
          }">
            <el-table-column prop="userTrueName" label="姓名" align="center" />
            <el-table-column prop="userteam" label="班组" align="center" />
            <el-table-column prop="headImageUrl" label="人脸" align="center">
              <template #default="scope">
                <el-image style="width: 5rem; height: 5rem" :src="'http://192.168.0.80:1598' + scope.row.headImageUrl"
                  :fit="fit" />
              </template>
            </el-table-column>
            <el-table-column prop="maintenanceDate" label="分配时间" align="center" />
            <el-table-column prop="fuzyuan" label="检修状态" align="center">
              <template #default="scope">
                <span style="color: #e7a307; font-size: 0.88rem" v-if="scope.row.maintenanceStatus == 0">待开始</span>
                <span style="color: red; font-size: 0.88rem" v-if="scope.row.maintenanceStatus == 1">检修中</span>
                <span style="color: #eee; font-size: 0.88rem" v-if="scope.row.maintenanceStatus == 2">已完成</span>
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div style="
            display: flex;
            justify-content: right;
            align-self: flex-end;
            margin-bottom: 1.19rem;
            margin-right: 1.25rem;
          ">
          <el-pagination size="small" background layout="prev, pager, next" :current-page="pageQuery.page"
            :page-size="pageQuery.rows" :total="pageTotal" @size-change="handleSizeChange"
            @current-change="handleCurrentChange" />
        </div>
      </div>
    </div>
    <div class="Maintenancemanagement_r">
      <div class="content">
        <div class="checkbox">
          <span style="
              color: rgba(0, 9, 56, 1);
              font-size: 1.13rem;
              font-weight: bold;
            ">设置检修权限</span>
        </div>
        <div class="serch">
          <div class="serch_box">
            <div class="serchb">全局搜索</div>
            <input v-model="queryForm1.inputcontent" placeholder="请输入关键词搜索"
              style="border-left: 0.06rem solid #e2e2e2" />
          </div>
          <el-button @click="handleQuery1" type="primary" size="small"
            style="margin-left: 0.98rem; height: 2rem">查询</el-button>
          <el-button size="small" style="height: 2rem" @click="resetQuery1">重置</el-button>
        </div>
        <div style="margin-top: 1rem; height: 100%">
          <el-table empty-text="暂无数据" height="450" :data="gridData" style="width: 100%" :header-cell-style="{
            background: 'rgba(250,250,250,1)',
            color: '#101010',
            fontSize: '0.88rem',
            height: '3rem',
            border: 'none',
          }" :row-style="{
            color: '#101010',
            fontSize: '0.88rem',
            height: '3rem',
          }">
            <el-table-column prop="userTrueName" label="姓名" align="center" min-width="3%" />
            <el-table-column prop="userName" label="账号" align="center" min-width="3%" />
            <el-table-column prop="cardNumber" label="卡号" align="center" min-width="3%" />
 
            <el-table-column prop="userteam" label="班组" align="center" min-width="3%" />
            <el-table-column prop="headImageUrl" label="人脸" align="center" min-width="3%">
              <template #default="scope">
                <el-image style="width: 5rem; height: 5rem" :src="'http://192.168.0.80:1598' + scope.row.headImageUrl"
                  :fit="fit" />
              </template>
            </el-table-column>
            <el-table-column label="操作" align="center" min-width="4%">
              <template #default="scope">
                <div v-if="scope.row.isPossible == null" style="
                    display: flex;
                    flex-direction: column;
                    justify-content: space-between;
                    align-items: center;
                  ">
                  <el-button style="
                      height: 2.32rem;
                      width:9rem;
                      font-size: 0.75rem;
                      color: #fff;
                      margin-left: 1rem;
                    " size="small" type="primary" @click="allow(scope.row)">允许进入检修</el-button>
                  <el-button style="
                      height: 2.32rem;
                      width: 9rem;
                      font-size: 0.75rem;
                      color: #fff;
                      margin-top: 0.25rem;
                    " size="small" @click="forbid(scope.row)" type="warning">禁止进入检修</el-button>
                </div>
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div style="
            display: flex;
            justify-content: right;
            align-self: flex-end;
            margin-bottom: 1.19rem;
            margin-right: 1.25rem;
          ">
          <el-pagination size="small" background layout="prev, pager, next" :current-page="pageQuery1.page"
            :page-size="pageQuery1.rows" :total="pageTotal1" @size-change="handleSizeChange1"
            @current-change="handleCurrentChange1" />
        </div>
      </div>
    </div>
 
    <!-- 允许进入检修 -->
    <el-dialog v-model="claimdialogVisible" title="允许进入检修" width="400" align-center>
      <div style="
          height: 5rem;
          display: flex;
          justify-content: center;
          align-items: center;
        ">
        <el-icon color="#FAAD14">
          <WarningFilled />
        </el-icon>
        <span style="color: rgba(0, 0, 0, 1); font-size: 1.25rem">是否确认【{{ info.userTrueName }}】今日允许进入检修?</span>
      </div>
      <template #footer>
        <div class="dialog-footer" style="text-align: right">
          <el-button @click="claimdialogVisible = false">取消</el-button>
          <el-button type="primary" @click="allowfn"> 确认 </el-button>
        </div>
      </template>
    </el-dialog>
 
    <!-- 禁止进入检修 -->
    <el-dialog v-model="claimdialogVisible1" title="禁止进入检修" width="400" align-center>
      <div style="
          height: 5rem;
          display: flex;
          justify-content: center;
          align-items: center;
        ">
        <el-icon color="#FAAD14">
          <WarningFilled />
        </el-icon>
        <span style="color: rgba(0, 0, 0, 1); font-size: 1.25rem">是否确认【{{ info.userTrueName }}】今日禁止进入检修?</span>
      </div>
      <template #footer>
        <div class="dialog-footer" style="text-align: right">
          <el-button @click="claimdialogVisible1 = false">取消</el-button>
          <el-button type="primary" @click="forbidfn"> 确认 </el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>
<script setup>
import { ref, toRef, onMounted } from "vue";
import { ElMessage } from "element-plus";
import {
  ShowMaintence,
  PersonnelMonitoring,
  RunOperation,
  ChangeTasState,
} from "@/api/newapi/Maintenance";
//变量
const obj = {
  selectType: "",
  inputcontent: "",
};
const queryForm = toRef({ ...obj });
const queryForm1 = toRef({ ...obj });
const tableData = ref([]);
const gridData = ref([]);
const stateType = ref([
  {
    label: "全部状态",
    value: "",
  },
  {
    label: "待开始",
    value: "0",
  },
  {
    label: "检修中",
    value: "1",
  },
  {
    label: "已完成",
    value: "2",
  },
]);
//分页请求参数
const pageQuery = ref({
  page: 1, //当前页面
  rows: 20, //每页显示条数
  order: "desc", //排序方式
  sort: "", //排序字段
  wheres: "", //条件查询
});
//分页请求参数
const pageQuery1 = ref({
  page: 1, //当前页面
  rows: 20, //每页显示条数
  order: "desc", //排序方式
  sort: "", //排序字段
  wheres: "", //条件查询
});
const pageTotal = ref(0);
const pageTotal1 = ref(0);
const claimdialogVisible = ref(false);
const claimdialogVisible1 = ref(false);
const info = ref({});
//正在检修的人数
const totalCount = ref(0);
 
const allow = (val) => {
  console.log(val);
  info.value = val;
  claimdialogVisible.value = true;
};
const allowfn = () => {
  RunOperation(info.value.id, true).then((res) => {
    ElMessage({
      message: "操作成功",
      type: "success",
      plain: true,
    });
    claimdialogVisible.value = false;
    initData();
  });
};
const forbid = (val) => {
  console.log(val);
 
  info.value = val;
  claimdialogVisible1.value = true;
};
const forbidfn = () => {
  RunOperation(info.value.id, false).then((res) => {
    ElMessage({
      message: "操作成功",
      type: "success",
      plain: true,
    });
    claimdialogVisible1.value = false;
    initData();
  });
};
 
//分页页面大小改变
const handleSizeChange = (val) => {
  pageQuery.value.rows = val;
};
 
//分页页面改变
const handleCurrentChange = (val) => {
  pageQuery.value.page = val;
};
//分页页面大小改变
const handleSizeChange1 = (val) => {
  pageQuery.value.rows = val;
};
 
//分页页面改变
const handleCurrentChange1 = (val) => {
  pageQuery.value.page = val;
};
 
//查询
const handleQuery = () => {
  PersonnelMonitoring({
    pageIndex: pageQuery.value.page,
    pageSize: pageQuery.value.rows,
    searchKeyword: queryForm.value.inputcontent,
    status: queryForm.value.selectType,
  }).then((res) => {
    tableData.value = res.data.items;
    pageTotal.value = res.data.totalCount;
    totalCount.value = res.data.items.filter(
      (v) => v.maintenanceStatus == 1
    ).length;
  });
};
 
const handleQuery1 = () => {
  ShowMaintence({
    pageIndex: pageQuery.value.page,
    pageSize: pageQuery.value.rows,
    searchKeyword: queryForm1.value.inputcontent,
  }).then((res) => {
    gridData.value = res.data.items;
    pageTotal1.value = res.data.totalCount;
  });
};
 
//重置
const resetQuery = () => {
  queryForm.value = { ...obj };
  handleQuery();
};
const resetQuery1 = () => {
  queryForm1.value = { ...obj };
  handleQuery1();
};
 
const initData = () => {
  ShowMaintence({
    pageIndex: pageQuery.value.page,
    pageSize: pageQuery.value.rows,
    searchKeyword: queryForm1.value.inputcontent,
  }).then((res) => {
    gridData.value = res.data.items;
    pageTotal1.value = res.data.totalCount;
  });
  PersonnelMonitoring({
    pageIndex: pageQuery.value.page,
    pageSize: pageQuery.value.rows,
    searchKeyword: queryForm.value.inputcontent,
    status: queryForm.value.selectType,
  }).then((res) => {
    tableData.value = res.data.items;
    pageTotal.value = res.data.totalCount;
    totalCount.value = res.data.items.filter(
      (v) => v.maintenanceStatus == 1
    ).length;
  });
};
 
onMounted(() => {
  initData();
});
</script>
<style lang="scss" scoped>
.Maintenancemanagement {
  display: flex;
 
  .Maintenancemanagement_l,
  .Maintenancemanagement_r {
    width: 50%;
    display: flex;
    background-color: #fff;
    margin-right: 1rem;
 
    .content {
      width: 100%;
      display: flex;
      flex-direction: column;
 
      .checkbox {
        display: flex;
        justify-content: space-between;
        padding: 0.88rem 0.88rem;
      }
 
      .serch {
        display: flex;
        margin-top: 1.31rem;
        align-items: center;
 
        .time_box {
          display: flex;
          align-items: center;
          text-align: center;
          margin-left: 0.98rem;
        }
 
        .serch_box {
          display: flex;
          align-items: center;
          text-align: center;
          margin-left: 0.98rem;
          border-radius: 0.38rem;
 
          .serchb {
            box-sizing: border-box;
            width: 6.88rem;
            height: 2rem;
            text-align: center;
            font-size: 0.75rem;
            display: flex;
            align-items: center;
            justify-content: center;
            border: 0.06rem solid rgba(222, 222, 222, 1);
          }
 
          input {
            box-sizing: border-box;
            outline: none;
            width: 19rem;
            height: 2rem;
            border: 0.06rem solid rgba(222, 222, 222, 1);
            border-radius: 0 0.25rem 0.25rem 0;
            padding-left: 0.3125rem;
            font-size: 1rem;
          }
        }
      }
 
      .btns {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 1.31rem;
        margin-left: 1.13rem;
        padding-right: 2rem;
        box-sizing: border-box;
      }
    }
  }
 
  .Maintenancemanagement_r {
    width: 50%;
    display: flex;
    background-color: #fff;
    margin-right: 0;
  }
}
</style>