<template>
|
<el-card shadow="never" class="aui-card--fill">
|
<div class="mod-health-evaluate}">
|
<el-form :inline="true" :model="dataForm">
|
<el-form-item>
|
<el-input v-model="dataForm.devName" :placeholder="$t('healthEvaluate.devName')" clearable></el-input>
|
</el-form-item>
|
<el-form-item>
|
<dict-select-tag style="width: 100%" v-model="dataForm.healthLevel" dictCode="device_health_level"
|
:placeholder="$t('healthEvaluate.healthLevel')" clearable></dict-select-tag>
|
</el-form-item>
|
<el-form-item>
|
<el-button @click="getDataList()">{{ $t('query') }}</el-button>
|
</el-form-item>
|
<el-form-item>
|
<el-button v-if="$hasPermission('device:healthEvaluate:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}
|
</el-button>
|
</el-form-item>
|
<el-form-item>
|
<el-button v-if="$hasPermission('device:healthEvaluate:delete')" type="danger" @click="deleteHandle()">{{ $t('deleteBatch')
|
}}
|
</el-button>
|
</el-form-item>
|
<el-form-item>
|
<el-button type="success" @click="enableHandle()">启用</el-button>
|
</el-form-item>
|
<el-form-item>
|
<el-button type="danger" @click="disableHandle()">禁用</el-button>
|
</el-form-item>
|
</el-form>
|
<el-table
|
v-loading="dataListLoading"
|
:data="dataList"
|
border
|
@selection-change="dataListSelectionChangeHandle"
|
@sort-change="dataListSortChangeHandle"
|
style="width: 100%;">
|
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
|
<el-table-column prop="devNo" :label="$t('healthEvaluate.devNo')" header-align="center"
|
align="left" min-width="150"></el-table-column>
|
<el-table-column prop="devName" :label="$t('healthEvaluate.devName')" header-align="center"
|
align="left" min-width="150"></el-table-column>
|
<el-table-column prop="modelCode" :label="$t('healthEvaluate.modelCode')" header-align="center"
|
align="left" min-width="150"></el-table-column>
|
<el-table-column prop="healthLevel" :label="$t('healthEvaluate.healthLevel')" header-align="center"
|
align="center" min-width="100">
|
<template slot-scope="scope">
|
<el-tag v-if="scope.row.healthLevel === '1'" size="small" type="success">健康</el-tag>
|
<el-tag v-if="scope.row.healthLevel === '2'" size="small" type="warning">良好</el-tag>
|
<el-tag v-if="scope.row.healthLevel === '3'" size="small" type="danger">不良</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column prop="healthScore" :label="$t('healthEvaluate.healthScore')" header-align="center"
|
align="center" min-width="100">
|
</el-table-column>
|
<el-table-column prop="abnormalCount" :label="$t('healthEvaluate.abnormalCount')" header-align="center"
|
align="center" min-width="100">
|
</el-table-column>
|
<el-table-column prop="reportDate" :label="$t('healthEvaluate.reportDate')" header-align="center"
|
align="center" min-width="200">
|
</el-table-column>
|
<el-table-column prop="isPushed" :label="$t('healthEvaluate.isPushed')" header-align="center"
|
align="center" min-width="100">
|
<template slot-scope="scope">
|
<el-switch
|
v-model="scope.row.isPushed === 1"
|
active-color="#13ce66"
|
inactive-color="#ff4949">
|
</el-switch>
|
</template>
|
</el-table-column>
|
<el-table-column prop="isEnable" :label="$t('healthEvaluate.isEnable')" header-align="center"
|
align="center" min-width="100">
|
<template slot-scope="scope">
|
<el-tag v-if="scope.row.isEnable === 1" size="small" type="success">启用</el-tag>
|
<el-tag v-else size="small" type="danger">禁用</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">
|
<template slot-scope="scope">
|
<el-button type="text" size="small"
|
@click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}
|
</el-button>
|
<el-button type="text" size="small"
|
@click="deleteHandle(scope.row.id)">{{ $t('delete') }}
|
</el-button>
|
<el-button type="text" size="small"
|
@click="viewReport(scope.row.devNo)">查看报告
|
</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
<el-pagination
|
:current-page="page"
|
:page-sizes="[10, 20, 50, 100]"
|
:page-size="limit"
|
:total="total"
|
layout="total, sizes, prev, pager, next, jumper"
|
@size-change="pageSizeChangeHandle"
|
@current-change="pageCurrentChangeHandle">
|
</el-pagination>
|
<!-- 弹窗, 新增 / 修改 -->
|
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
|
<!-- 弹窗, 评价报告 -->
|
<health-report v-if="healthReportVisible" ref="healthReport"></health-report>
|
|
</div>
|
|
</el-card>
|
</template>
|
<script>
|
import mixinViewModule from '@/mixins/view-module'
|
import DictSelectTag from "@/components/dict/dict-select-tag";
|
import AddOrUpdate from './health-evaluate-add-or-update'
|
import HealthReport from './health-report'
|
|
export default {
|
mixins: [mixinViewModule],
|
data() {
|
return {
|
mixinViewModuleOptions: {
|
getDataListURL: '/iailab-ntt-model/device/health-evaluate/page',
|
getDataListIsPage: true,
|
exportURL: '/iailab-ntt-model/device/health-evaluate/export',
|
deleteURL: '/iailab-ntt-model/device/health-evaluate',
|
deleteIsBatch: true
|
},
|
dataForm: {
|
devName: '',
|
healthLevel: ''
|
},
|
healthReportVisible: false
|
}
|
},
|
components: {
|
DictSelectTag,
|
AddOrUpdate,
|
HealthReport
|
},
|
methods: {
|
viewReport(devNo) {
|
this.healthReportVisible = true
|
this.$nextTick(() => {
|
this.$refs.healthReport.init(devNo)
|
})
|
|
},
|
// 启用
|
enableHandle(id) {
|
if (!id && this.dataListSelections.length <= 0) {
|
return this.$message({
|
message: this.$t('prompt.checkBatch'),
|
type: 'warning',
|
duration: 500
|
})
|
}
|
this.$confirm(this.$t('prompt.info', {'handle': '启用'}), this.$t('prompt.title'), {
|
confirmButtonText: this.$t('confirm'),
|
cancelButtonText: this.$t('cancel'),
|
type: 'warning'
|
}).then(() => {
|
this.$http.put('/iailab-ntt-model/device/health-evaluate/enable', id ? [id] : this.dataListSelections.map(item => item.id)).then(({data: res}) => {
|
if (res.code !== 0) {
|
return this.$message.error(res.msg)
|
}
|
this.$message({
|
message: this.$t('prompt.success'),
|
type: 'success',
|
duration: 500,
|
onClose: () => {
|
this.getDataList()
|
}
|
})
|
}).catch(() => {
|
})
|
}).catch(() => {
|
})
|
},
|
|
// 禁用
|
disableHandle(id) {
|
if (!id && this.dataListSelections.length <= 0) {
|
return this.$message({
|
message: this.$t('prompt.checkBatch'),
|
type: 'warning',
|
duration: 500
|
})
|
}
|
this.$confirm(this.$t('prompt.info', {'handle': '禁用'}), this.$t('prompt.title'), {
|
confirmButtonText: this.$t('confirm'),
|
cancelButtonText: this.$t('cancel'),
|
type: 'warning'
|
}).then(() => {
|
this.$http.put('/iailab-ntt-model/device/health-evaluate/disable', id ? [id] : this.dataListSelections.map(item => item.id)).then(({data: res}) => {
|
if (res.code !== 0) {
|
return this.$message.error(res.msg)
|
}
|
this.$message({
|
message: this.$t('prompt.success'),
|
type: 'success',
|
duration: 500,
|
onClose: () => {
|
this.getDataList()
|
}
|
})
|
}).catch(() => {
|
})
|
}).catch(() => {
|
})
|
},
|
}
|
}
|
</script>
|