error.vue
5.33 KB
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
<template>
<div>
<back-box>
<template slot="title">
<span>异常设备信息</span>
</template>
</back-box>
<div class="page-content">
<el-table :data="tableData" border style="width: 100%">
<el-table-column
prop="sn"
label="设备编码"
align="center"
width="160"
></el-table-column>
<el-table-column prop="abnormalSource" label="设备类型" align="center">
<template slot-scope="scoped">
{{
scoped.row.abnormalSource == 0
? "无"
: scoped.row.abnormalSource == 1
? "云平台"
: scoped.row.abnormalSource == 2
? "授课端"
: scoped.row.abnormalSource == 3
? "出厂工具"
: "发卡工具"
}}
</template>
</el-table-column>
<el-table-column label="异常类型" align="center">
<template slot-scope="scoped">
{{
scoped.row.status == 0
? "正常"
: scoped.row.status == 1
? "低电量异常"
: scoped.row.status == 2
? "配对码异常"
: "关联班级异常"
}}
</template></el-table-column
>
<template v-if="type == 1">
<el-table-column
prop="pairingCode"
label="配对码"
align="center"
></el-table-column>
<el-table-column label="关联班级" align="center">
<template slot-scope="scoped">
<p v-for="(item, index) in scoped.row.classList" :key="index">
{{ item.className }}
</p>
</template>
</el-table-column>
</template>
<el-table-column
prop="modifiedTime"
label="最早发现时间"
align="center"
width="200"
></el-table-column>
<el-table-column
v-if="type == 2"
prop="answerTimes"
label="答题次数"
align="center"
></el-table-column>
<el-table-column
prop="abnormalRemark"
label="状态"
align="center"
></el-table-column>
<el-table-column label="操作" align="center" width="100"
><template slot-scope="scoped">
<el-link
:disabled="scoped.row.abnormalRemark"
@click="openDia(scoped.row)"
>处理</el-link
></template
></el-table-column
>
</el-table>
<div class="pagination-box">
<el-pagination
small=""
layout="total,prev, pager, next"
:hide-on-single-page="true"
:total="total"
@current-change="changePage"
:current-page="page"
:page-size="size"
>
</el-pagination>
</div>
</div>
<el-dialog title="备注" :visible.sync="diaNotes" width="400">
<el-form ref="formClass" label-width="100px">
<el-form-item label="处理备注:" prop="studentName">
<el-col :span="12">
<el-input
type="textarea"
:rows="3"
maxlength="200"
v-model="ntoes"
/>
</el-col>
</el-form-item>
</el-form>
<div class="dialog-footer" slot="footer">
<el-button @click="_SaveNotes" type="primary">确 定</el-button>
<el-button @click="diaNotes = false">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
role: "",
loading: false,
diaNotes: false,
ntoes: "",
deviceId: "",
type: 1,
tableData: [],
total: 0,
page: 1,
size: 20,
};
},
created() {
this.type = this.$route.query.type;
this.role =
this.$store.getters.info.showRole ||
this.$store.getters.info.permissions[0].role;
this._QueryData();
},
methods: {
changePage(page) {
this.page = page;
this._QueryData();
},
openDia(obj) {
this.diaNotes = true;
this.deviceId = obj.id;
this.ntoes = "";
},
async _SaveNotes() {
if (!this.ntoes.trim()) {
this.$message.warning("请填写备注内容!");
return;
}
const { status, info } = await this.$request.abnormalRemark({
deviceId: this.deviceId,
abnormalRemark: this.ntoes,
});
if (status === 0) {
this.ntoes = "";
this.diaNotes = false;
this._QueryData();
} else {
this.$message.error(info);
}
},
async _QueryData() {
this.loading = true;
const deviceList =
this.role != "ROLE_JITUAN"
? this.$request.deviceList
: this.$request.tenantDeviceList;
this.tableData = [];
const { data, status, info } = await deviceList({
status: 1,
deviceType: this.type,
page: this.page,
size: this.size,
});
this.loading = false;
if (status === 0) {
this.tableData = (data?.list && [...data?.list]) || [];
this.total = data.count;
} else {
this.$message.error(info);
}
},
},
};
</script>
<style lang="scss" scoped>
.page-content {
padding: 20px;
}
</style>