pengwei
2025-04-27 366612bd8e8b88d02a98edf508f96d7add23ff9f
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
<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;
            "
            >开始检修</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;
            "
            >结束检修</span
          >
        </div>
      </el-button>
    </div>
    <div v-if="isStart" class="content_box">
      <el-table
        empty-text="暂无数据"
        :data="tableData"
        style="width: 100%"
        :header-cell-style="{
          height: '1.61rem',
          color: '#1AC8FE',
          background: '#0A5B91',
          fontSize: '0.88rem',
        }"
        :cell-style="{
          color: '#fff',
          background: '#147BAF',
        }"
      >
        <el-table-column prop="userAccount" label="用户账号" align="center" />
        <el-table-column prop="modifier" label="修改人" />
        <el-table-column prop="modifyDate" label="修改时间" align="center" />
        <el-table-column
          prop="maintenanceStatus"
          label="检修状态"
          align="center"
        >
          <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="maintenanceDate"
          label="派发任务时间"
          align="center"
        />
 
        <el-table-column
          prop="maintenancStartTime"
          label="开始检修时间"
          align="center"
        />
        <el-table-column
          prop="maintenancEendTime"
          label="结束检修时间"
          align="center"
        />
      </el-table>
    </div>
  </div>
</template>
<script setup>
import { onMounted, ref } from "vue";
import store from "@/store/index";
import {
  MaintenanceTasksOfTheDay,
  StartMaintenceTask,
  StopMaintenanceTask,
} from "@/api/user";
 
const userInfo = ref(store.state.userInfo);
const isStart = ref(false); //是否开始检修
const tableData = ref([]); //检修任务数据
//获取当天检修任务
const getMaintenanceTasksOfTheDay = async () => {
  MaintenanceTasksOfTheDay({
    account: userInfo.value.userName,
  }).then((res) => {
    tableData.value = [res.data];
    console.log("检修任务数据", tableData.value);
  });
};
//开始检修
const startMaintenceTask = async () => {
  StartMaintenceTask({
    account: userInfo.value.userName,
  }).then((res) => {
    isStart.value = true;
    tableData.value = [res.data];
  });
};
//结束检修
const stopMaintenceTask = async () => {
  StopMaintenanceTask({
    account: userInfo.value.userName,
  }).then((res) => {
    isStart.value = false;
    tableData.value = [res.data];
  });
};
 
onMounted(() => {
  getMaintenanceTasksOfTheDay();
});
</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: 70%;
    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>