|
@@ -0,0 +1,143 @@
|
|
|
+<template>
|
|
|
+ <div class="page-wrap">
|
|
|
+ <el-row class="tool-bar">
|
|
|
+ <el-col :span="12" class="left">
|
|
|
+ <div class="content-title">
|
|
|
+ 传感器配置
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12" class="right">
|
|
|
+ <el-input v-model="conditions.goafDevName" class="search-input m-right-15" placeholder="请输入设备名称">
|
|
|
+ <el-button slot="append" icon="el-icon-search" @click="getData()" />
|
|
|
+ </el-input>
|
|
|
+ <el-button type="primary" @click="handleAdd">新增</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-row class="m-top-15">
|
|
|
+ <el-table v-loading="listLoading" class="page-table" border fit :data="dataList">
|
|
|
+ <el-table-column type="index" label="序号" header-align="center" align="center" width="60" />
|
|
|
+ <el-table-column prop="goafSensorName" label="传感器名称" align="center" />
|
|
|
+ <el-table-column prop="goafDevName" label="待测设备名称" align="center" />
|
|
|
+ <el-table-column prop="goafDevTypename" label="待测设备类型" align="center" />
|
|
|
+ <el-table-column prop="goafSensorLocation" label="安装地点" align="center" />
|
|
|
+ <el-table-column prop="goafSensorIp" label="一级预警" align="center" />
|
|
|
+ <el-table-column prop="goafSensorIp" label="二级预警" align="center" />
|
|
|
+ <el-table-column prop="goafSensorIp" label="三级预警" align="center" />
|
|
|
+ <el-table-column prop="goafSensorIp" label="四级预警" align="center" />
|
|
|
+ </el-table>
|
|
|
+ <div class="pagination-container" style="float:right;margin-right:40px;">
|
|
|
+ <pagination v-show="total>0" :total="total" :page.sync="conditions.page" :limit.sync="conditions.limit" @pagination="getData" />
|
|
|
+ </div>
|
|
|
+ </el-row>
|
|
|
+ <sensor-Model ref="sensor" @formSuccess="getData" />
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { delSensor, getSensorByPage } from '@/api/goaf/sensor'
|
|
|
+
|
|
|
+import { Pagination } from '@/components'
|
|
|
+import { NumConvertLM } from '@/utils'
|
|
|
+import sensorModel from './components/DeviceModel'
|
|
|
+export default {
|
|
|
+ components: { Pagination, sensorModel },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ dataList: [],
|
|
|
+ total: 0,
|
|
|
+ listLoading: false,
|
|
|
+ conditions: {
|
|
|
+ page: 1,
|
|
|
+ limit: 10,
|
|
|
+ goafDevName: ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getData()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // fetch data
|
|
|
+ NumConvertLM,
|
|
|
+ getData() {
|
|
|
+ this.listLoading = true
|
|
|
+ getSensorByPage(this.conditions).then((resp) => {
|
|
|
+ this.listLoading = false
|
|
|
+ const { code, msg, data } = resp
|
|
|
+ if (code === 0) {
|
|
|
+ this.dataList = data
|
|
|
+ this.total = resp.total
|
|
|
+ } else {
|
|
|
+ this.$message.error(msg)
|
|
|
+ }
|
|
|
+ }).catch((error) => {
|
|
|
+ console.log(error)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleAdd() {
|
|
|
+ this.$refs['sensor'].showAddModel('传感器')
|
|
|
+ },
|
|
|
+
|
|
|
+ // "Edit Risk" Model
|
|
|
+ handleUpdate(data) {
|
|
|
+ this.$refs['sensor'].showEditModel(JSON.parse(JSON.stringify(data)))
|
|
|
+ },
|
|
|
+
|
|
|
+ // Delete Action
|
|
|
+ handleDelete(data) {
|
|
|
+ const { goafSensorId, goafSensorName } = data
|
|
|
+ this.$confirm(`此操作将删除该数据${goafSensorName}, 是否继续?`, '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ delSensor(goafSensorId).then((resp) => {
|
|
|
+ const { code, msg } = resp
|
|
|
+ if (code === 0) {
|
|
|
+ this.getData()
|
|
|
+ this.$message.success(msg)
|
|
|
+ } else {
|
|
|
+ this.$message.error(msg)
|
|
|
+ }
|
|
|
+ }).catch((error) => {
|
|
|
+ console.log(error)
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message.info('已取消删除')
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+ <style lang="scss" scoped>
|
|
|
+ .page-wrap{
|
|
|
+ min-height:90vh;
|
|
|
+ padding: 15px;
|
|
|
+ background-color: #071A29;
|
|
|
+ ::v-deep {
|
|
|
+ .el-table thead.is-group th.el-table__cell{
|
|
|
+ background-color: #132938;
|
|
|
+ }
|
|
|
+ .el-table__header-wrapper{
|
|
|
+ border-bottom: 1px solid #5994bb;
|
|
|
+ }
|
|
|
+ .el-table--border th.el-table__cell{
|
|
|
+ // border-bottom: 1px solid #5994bb;
|
|
|
+ border-right: 1px solid #5994bb;
|
|
|
+ border-top: 1px solid #5994bb;
|
|
|
+ border-color: #5994bb;
|
|
|
+ }
|
|
|
+ .el-table.el-table--border th.el-table__cell.is-leaf, .el-table td.el-table__cell{
|
|
|
+ border-right: 1px solid #5994bb;
|
|
|
+ border-top: 1px solid #5994bb;
|
|
|
+ }
|
|
|
+ .el-table.el-table--border {
|
|
|
+ border-bottom: 1px solid #5994bb;
|
|
|
+ border-left: 1px solid #5994bb;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ </style>
|
|
|
+
|