提交 | 用户 | 时间
|
850106
|
1 |
<template> |
H |
2 |
<el-card shadow="never" class="aui-card--fill"> |
|
3 |
<div class="mod-health-evaluate}"> |
|
4 |
<el-form :inline="true" :model="dataForm"> |
|
5 |
<el-form-item> |
|
6 |
<el-input v-model="dataForm.devName" :placeholder="$t('healthEvaluate.devName')" clearable></el-input> |
|
7 |
</el-form-item> |
|
8 |
<el-form-item> |
|
9 |
<dict-select-tag style="width: 100%" v-model="dataForm.healthLevel" dictCode="device_health_level" |
|
10 |
:placeholder="$t('healthEvaluate.healthLevel')" clearable></dict-select-tag> |
|
11 |
</el-form-item> |
|
12 |
<el-form-item> |
|
13 |
<el-button @click="getDataList()">{{ $t('query') }}</el-button> |
|
14 |
</el-form-item> |
|
15 |
<el-form-item> |
|
16 |
<el-button v-if="$hasPermission('device:healthEvaluate:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }} |
|
17 |
</el-button> |
|
18 |
</el-form-item> |
|
19 |
<el-form-item> |
|
20 |
<el-button v-if="$hasPermission('device:healthEvaluate:delete')" type="danger" @click="deleteHandle()">{{ $t('deleteBatch') |
|
21 |
}} |
|
22 |
</el-button> |
|
23 |
</el-form-item> |
|
24 |
<el-form-item> |
|
25 |
<el-button type="success" @click="enableHandle()">启用</el-button> |
|
26 |
</el-form-item> |
|
27 |
<el-form-item> |
|
28 |
<el-button type="danger" @click="disableHandle()">禁用</el-button> |
|
29 |
</el-form-item> |
|
30 |
</el-form> |
|
31 |
<el-table |
|
32 |
v-loading="dataListLoading" |
|
33 |
:data="dataList" |
|
34 |
border |
|
35 |
@selection-change="dataListSelectionChangeHandle" |
|
36 |
@sort-change="dataListSortChangeHandle" |
|
37 |
style="width: 100%;"> |
|
38 |
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column> |
|
39 |
<el-table-column prop="devNo" :label="$t('healthEvaluate.devNo')" header-align="center" |
|
40 |
align="left" min-width="150"></el-table-column> |
|
41 |
<el-table-column prop="devName" :label="$t('healthEvaluate.devName')" header-align="center" |
|
42 |
align="left" min-width="150"></el-table-column> |
|
43 |
<el-table-column prop="modelCode" :label="$t('healthEvaluate.modelCode')" header-align="center" |
|
44 |
align="left" min-width="150"></el-table-column> |
|
45 |
<el-table-column prop="healthLevel" :label="$t('healthEvaluate.healthLevel')" header-align="center" |
|
46 |
align="center" min-width="100"> |
|
47 |
<template slot-scope="scope"> |
|
48 |
<el-tag v-if="scope.row.healthLevel === '1'" size="small" type="success">健康</el-tag> |
|
49 |
<el-tag v-if="scope.row.healthLevel === '2'" size="small" type="warning">良好</el-tag> |
|
50 |
<el-tag v-if="scope.row.healthLevel === '3'" size="small" type="danger">不良</el-tag> |
|
51 |
</template> |
|
52 |
</el-table-column> |
|
53 |
<el-table-column prop="healthScore" :label="$t('healthEvaluate.healthScore')" header-align="center" |
|
54 |
align="center" min-width="100"> |
|
55 |
</el-table-column> |
|
56 |
<el-table-column prop="abnormalCount" :label="$t('healthEvaluate.abnormalCount')" header-align="center" |
|
57 |
align="center" min-width="100"> |
|
58 |
</el-table-column> |
|
59 |
<el-table-column prop="reportDate" :label="$t('healthEvaluate.reportDate')" header-align="center" |
|
60 |
align="center" min-width="200"> |
|
61 |
</el-table-column> |
|
62 |
<el-table-column prop="isPushed" :label="$t('healthEvaluate.isPushed')" header-align="center" |
|
63 |
align="center" min-width="100"> |
|
64 |
<template slot-scope="scope"> |
|
65 |
<el-switch |
|
66 |
v-model="scope.row.isPushed === 1" |
|
67 |
active-color="#13ce66" |
|
68 |
inactive-color="#ff4949"> |
|
69 |
</el-switch> |
|
70 |
</template> |
|
71 |
</el-table-column> |
|
72 |
<el-table-column prop="isEnable" :label="$t('healthEvaluate.isEnable')" header-align="center" |
|
73 |
align="center" min-width="100"> |
|
74 |
<template slot-scope="scope"> |
|
75 |
<el-tag v-if="scope.row.isEnable === 1" size="small" type="success">启用</el-tag> |
|
76 |
<el-tag v-else size="small" type="danger">禁用</el-tag> |
|
77 |
</template> |
|
78 |
</el-table-column> |
|
79 |
<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150"> |
|
80 |
<template slot-scope="scope"> |
|
81 |
<el-button type="text" size="small" |
|
82 |
@click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }} |
|
83 |
</el-button> |
|
84 |
<el-button type="text" size="small" |
|
85 |
@click="deleteHandle(scope.row.id)">{{ $t('delete') }} |
|
86 |
</el-button> |
|
87 |
<el-button type="text" size="small" |
|
88 |
@click="viewReport(scope.row.devNo)">查看报告 |
|
89 |
</el-button> |
|
90 |
</template> |
|
91 |
</el-table-column> |
|
92 |
</el-table> |
|
93 |
<el-pagination |
|
94 |
:current-page="page" |
|
95 |
:page-sizes="[10, 20, 50, 100]" |
|
96 |
:page-size="limit" |
|
97 |
:total="total" |
|
98 |
layout="total, sizes, prev, pager, next, jumper" |
|
99 |
@size-change="pageSizeChangeHandle" |
|
100 |
@current-change="pageCurrentChangeHandle"> |
|
101 |
</el-pagination> |
|
102 |
<!-- 弹窗, 新增 / 修改 --> |
|
103 |
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update> |
|
104 |
|
|
105 |
<!-- 弹窗, 评价报告 --> |
|
106 |
<health-report v-if="healthReportVisible" ref="healthReport"></health-report> |
|
107 |
|
|
108 |
</div> |
|
109 |
|
|
110 |
</el-card> |
|
111 |
</template> |
|
112 |
<script> |
|
113 |
import mixinViewModule from '@/mixins/view-module' |
|
114 |
import DictSelectTag from "@/components/dict/dict-select-tag"; |
|
115 |
import AddOrUpdate from './health-evaluate-add-or-update' |
|
116 |
import HealthReport from './health-report' |
|
117 |
|
|
118 |
export default { |
|
119 |
mixins: [mixinViewModule], |
|
120 |
data() { |
|
121 |
return { |
|
122 |
mixinViewModuleOptions: { |
|
123 |
getDataListURL: '/iailab-ntt-model/device/health-evaluate/page', |
|
124 |
getDataListIsPage: true, |
|
125 |
exportURL: '/iailab-ntt-model/device/health-evaluate/export', |
|
126 |
deleteURL: '/iailab-ntt-model/device/health-evaluate', |
|
127 |
deleteIsBatch: true |
|
128 |
}, |
|
129 |
dataForm: { |
|
130 |
devName: '', |
|
131 |
healthLevel: '' |
|
132 |
}, |
|
133 |
healthReportVisible: false |
|
134 |
} |
|
135 |
}, |
|
136 |
components: { |
|
137 |
DictSelectTag, |
|
138 |
AddOrUpdate, |
|
139 |
HealthReport |
|
140 |
}, |
|
141 |
methods: { |
|
142 |
viewReport(devNo) { |
|
143 |
this.healthReportVisible = true |
|
144 |
this.$nextTick(() => { |
|
145 |
this.$refs.healthReport.init(devNo) |
|
146 |
}) |
|
147 |
|
|
148 |
}, |
|
149 |
// 启用 |
|
150 |
enableHandle(id) { |
|
151 |
if (!id && this.dataListSelections.length <= 0) { |
|
152 |
return this.$message({ |
|
153 |
message: this.$t('prompt.checkBatch'), |
|
154 |
type: 'warning', |
|
155 |
duration: 500 |
|
156 |
}) |
|
157 |
} |
|
158 |
this.$confirm(this.$t('prompt.info', {'handle': '启用'}), this.$t('prompt.title'), { |
|
159 |
confirmButtonText: this.$t('confirm'), |
|
160 |
cancelButtonText: this.$t('cancel'), |
|
161 |
type: 'warning' |
|
162 |
}).then(() => { |
|
163 |
this.$http.put('/iailab-ntt-model/device/health-evaluate/enable', id ? [id] : this.dataListSelections.map(item => item.id)).then(({data: res}) => { |
|
164 |
if (res.code !== 0) { |
|
165 |
return this.$message.error(res.msg) |
|
166 |
} |
|
167 |
this.$message({ |
|
168 |
message: this.$t('prompt.success'), |
|
169 |
type: 'success', |
|
170 |
duration: 500, |
|
171 |
onClose: () => { |
|
172 |
this.getDataList() |
|
173 |
} |
|
174 |
}) |
|
175 |
}).catch(() => { |
|
176 |
}) |
|
177 |
}).catch(() => { |
|
178 |
}) |
|
179 |
}, |
|
180 |
|
|
181 |
// 禁用 |
|
182 |
disableHandle(id) { |
|
183 |
if (!id && this.dataListSelections.length <= 0) { |
|
184 |
return this.$message({ |
|
185 |
message: this.$t('prompt.checkBatch'), |
|
186 |
type: 'warning', |
|
187 |
duration: 500 |
|
188 |
}) |
|
189 |
} |
|
190 |
this.$confirm(this.$t('prompt.info', {'handle': '禁用'}), this.$t('prompt.title'), { |
|
191 |
confirmButtonText: this.$t('confirm'), |
|
192 |
cancelButtonText: this.$t('cancel'), |
|
193 |
type: 'warning' |
|
194 |
}).then(() => { |
|
195 |
this.$http.put('/iailab-ntt-model/device/health-evaluate/disable', id ? [id] : this.dataListSelections.map(item => item.id)).then(({data: res}) => { |
|
196 |
if (res.code !== 0) { |
|
197 |
return this.$message.error(res.msg) |
|
198 |
} |
|
199 |
this.$message({ |
|
200 |
message: this.$t('prompt.success'), |
|
201 |
type: 'success', |
|
202 |
duration: 500, |
|
203 |
onClose: () => { |
|
204 |
this.getDataList() |
|
205 |
} |
|
206 |
}) |
|
207 |
}).catch(() => { |
|
208 |
}) |
|
209 |
}).catch(() => { |
|
210 |
}) |
|
211 |
}, |
|
212 |
} |
|
213 |
} |
|
214 |
</script> |