艺术家
2025-06-11 4b2e902503ac1fabde7340ca26a1adbc0018d118
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
<template>
  <div class="Enteroverhaul">
    <div class="btns">
      <el-button class="btn" type="primary" @click="startMaintenceTask">
        <div
          style="
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
          "
        >
          <img
            style="width: 4.75rem; height: 4.75rem"
            src="@/assets/Enteroverhaul/start.png"
            alt=""
          />
          <span
            style="
              color: rgba(0, 239, 248, 1);
              font-size: 1.25rem;
              margin-top: 1.6rem;
            "
            class="btn_text"
            >开始检修</span
          >
        </div>
      </el-button>
      <el-button
        class="btn"
        type="primary"
        style="margin-left: 6.81rem"
        @click="stopMaintenceTask"
      >
        <div
          style="
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
          "
        >
          <img
            style="width: 4.75rem; height: 4.75rem"
            src="@/assets/Enteroverhaul/pause.png"
            alt=""
          />
          <span
            style="
              color: rgba(0, 239, 248, 1);
              font-size: 1.25rem;
              margin-top: 1.6rem;
            "
            class="btn_text"
            >结束检修</span
          >
        </div>
      </el-button>
    </div>
    <div class="content_box">
      <el-table
        :height="isMobile ? '' : '250'"
        empty-text="暂无数据"
        :data="tableData"
        style="width: 100%"
        :header-cell-style="{
          height: '1.61rem',
          color: '#1AC8FE',
          background: '#0A5B91',
          fontSize: '2rem',
        }"
        :cell-style="{
          color: '#fff',
          background: '#147BAF',
          fontSize: '2.5rem',
        }"
      >
        <el-table-column
          prop="userTrueName"
          label="用户名称"
          align="center"
          min-width="1%"
        />
        <el-table-column
          prop="unit"
          label="单位"
          align="center"
          min-width="1%"
        />
        <el-table-column
          prop="userteam"
          align="center"
          label="班组"
          min-width="1%"
        />
        <el-table-column
          prop="roleName"
          align="center"
          label="角色"
          min-width="1%"
        />
        <el-table-column
          prop="ipAddress"
          label="轨道站"
          align="center"
          min-width="1%"
        />
        <el-table-column
          prop="maintenanceStatus"
          label="检修状态"
          align="center"
          min-width="1%"
        >
          <template #default="scope">
            <span v-if="scope.row.maintenanceStatus === 0">未开始</span>
            <span v-else-if="scope.row.maintenanceStatus === 1">进行中</span>
            <span v-else-if="scope.row.maintenanceStatus === 2"
              >已结束</span
            ></template
          >
        </el-table-column>
        <el-table-column
          prop="maintenancStartTime"
          label="开始时间"
          align="center"
          min-width="2%"
        />
        <el-table-column prop="" label="操作" align="center" min-width="2%">
          <template #default="scope">
            <el-button
              type="primary"
              size="small"
              @click="forceOffline(scope.row)"
            >
              强制下线</el-button
            >
          </template>
        </el-table-column>
      </el-table>
    </div>
    <el-pagination
      style="margin-top: 2rem"
      background
      layout="prev, pager, next"
      :total="pageTotal"
      @current-change="handleCurrentChange"
    />
  </div>
</template>
<script setup>
import { onMounted, reactive, ref, toRef } from "vue";
import store from "@/store/index";
import {
  MaintenanceTasksOfTheDay,
  StartMaintenceTask,
  StopMaintenanceTask,
} from "@/api/user";
import {
  YShowStartTake,
  PersonnelMonitoring,
  ForceOffline,
} from "@/api/newapi/Maintenance.js";
import { ElMessage } from "element-plus";
 
const userInfo = ref(store.state.userInfo);
const isStart = ref(false); //是否开始检修
const tableData = ref([]); //检修任务数据
const isMobile = ref(false); //是否是移动端
const obj = {
  selectType: "",
  inputcontent: "",
};
const queryForm = toRef({ ...obj });
//分页请求参数
const pageQuery = reactive({
  page: 1, //当前页面
  rows: 20, //每页显示条数
  order: "desc", //排序方式
  sort: "", //排序字段
  wheres: "", //条件查询
});
const pageTotal = ref(0); //总条数
//获取当天检修任务
const getMaintenanceTasksOfTheDay = async () => {
  MaintenanceTasksOfTheDay({
    account: userInfo.value.userName,
  }).then((res) => {
    tableData.value = [res.data];
  });
};
const getStartTake = async () => {
  PersonnelMonitoring({
    pageIndex: pageQuery.page,
    pageSize: pageQuery.rows,
    searchKeyword: queryForm.value.inputcontent,
  }).then((res) => {
    if (res.data.length > 0) {
      isStart.value = true;
    } else {
      isStart.value = false;
    }
    pageTotal.value = res.data.totalCount;
    tableData.value = res.data.items;
  });
};
const startdisabled = ref(false); //开始按钮是否禁用
//开始检修
const startMaintenceTask = async () => {
  StartMaintenceTask({
    account: userInfo.value.userName,
  }).then((res) => {
    getStartTake();
  });
};
//结束检修
const stopMaintenceTask = async () => {
  StopMaintenanceTask({
    account: userInfo.value.userName,
  }).then((res) => {
    isStart.value = false;
    getStartTake();
  });
};
// 强制下线
const forceOffline = async (row) => {
  ForceOffline({
    id: row.id,
    account: userInfo.value.userName,
  }).then((res) => {
    ElMessage({
      message: res.message,
      type: "success",
      duration: 2000,
    });
    getStartTake();
  });
};
const handleCurrentChange = (val) => {
  pageQuery.page = val;
  getStartTake();
};
 
onMounted(() => {
  console.log(pageQuery);
 
  // getMaintenanceTasksOfTheDay();
  // 获取当前屏幕得宽度
  const screenWidth = window.innerWidth;
  if (screenWidth <= 1080) {
    isMobile.value = true;
  }
  getStartTake();
});
</script>
<style lang="scss" scoped>
.Enteroverhaul {
  display: flex;
  flex-direction: column;
  align-items: center;
 
  .btns {
    margin-top: 7%;
    .btn {
      width: 12.19rem;
      height: 11.63rem;
      background-image: url("@/assets/Enteroverhaul/btnbg.png");
      background-size: 100% 100%;
      background-repeat: no-repeat;
      border: none;
    }
  }
 
  .content_box {
    width: 95%;
    height: 40%;
    background-color: rgba(9, 48, 104, 1);
    color: rgba(16, 16, 16, 1);
    font-size: 0.88rem;
    box-shadow: 0rem 0.13rem 0.38rem 0rem rgba(6, 229, 231, 1);
    border: 0.06rem solid rgba(6, 229, 231, 1);
    margin-top: 5.19rem;
  }
}
:deep(.el-table__empty-block) {
  background-color: rgb(9, 48, 104);
}
@media screen and (max-width: 1080px) {
  .Enteroverhaul {
    display: flex;
    flex-direction: column;
    align-items: center;
 
    .btns {
      margin-top: 7%;
      .btn {
        width: 25.19rem;
        height: 24.63rem;
        background-image: url("@/assets/Enteroverhaul/btnbg.png");
        background-size: 100% 100%;
        background-repeat: no-repeat;
        border: none;
        .btn_text {
          font-size: 2.88rem !important;
        }
      }
    }
 
    .content_box {
      width: 95%;
      height: 40%;
      background-color: rgba(9, 48, 104, 1);
      color: rgba(16, 16, 16, 1);
      font-size: 0.88rem;
      box-shadow: 0rem 0.13rem 0.38rem 0rem rgba(6, 229, 231, 1);
      border: 0.06rem solid rgba(6, 229, 231, 1);
      margin-top: 5.19rem;
    }
  }
}
</style>