Commit 73e73739 authored by xinzhedeai's avatar xinzhedeai

设备信息

parent 75619be6
...@@ -8,6 +8,14 @@ export function getDepts(params) { ...@@ -8,6 +8,14 @@ export function getDepts(params) {
}) })
} }
export function getDeptList(params) {
return request({
url: 'api/dept/tree',
method: 'get',
params
})
}
export function getDeptSuperior(ids) { export function getDeptSuperior(ids) {
const data = ids.length || ids.length === 0 ? ids : Array.of(ids) const data = ids.length || ids.length === 0 ? ids : Array.of(ids)
return request({ return request({
......
<template> <template>
<div class="app-container"> <div class="app-container">
<!--工具栏--> <!--工具栏-->
<!-- <span style="color: red;font-size: 10px;">* 原型图菜单叫监控数据,但其他2处监控叫实时数据,此页面查询的也是最新的测点数据,为措辞统一,这里也叫实时数据了。</span> <div class="head-container">
<span style="color: red;font-size: 10px;">* 测点类型在新增时是填写的,在这里是选择的?在填过的内容里选择吗?等对接了硬件可能会更清楚这个类型是干什么用的。</span> --> <div>
<div class="head-container"> <el-input
<div> v-model="equipname"
<el-input clearable size="small" placeholder="测点名称" style="width: 200px;" class="filter-item" /> clearable
<el-select v-model="value" placeholder="测点类型?" style="width: 200px;" class="filter-item"> size="small"
<el-option label="测点类型?" value="1" /> placeholder="测点名称"
</el-select> style="width: 200px"
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="$message('等待硬件对接中')">搜索</el-button> class="filter-item"
<el-button class="filter-item" size="mini" type="warning" icon="el-icon-refresh-left">重置</el-button> />
</div> <date-range-picker v-model="datarealtime" class="date-item" />
<el-button
class="filter-item"
size="mini"
type="success"
icon="el-icon-search"
@click="search"
>搜索</el-button
>
<el-button
class="filter-item"
size="mini"
type="warning"
icon="el-icon-refresh-left"
@click="clearSearch"
>重置</el-button
>
</div> </div>
<!--表格-->
<el-table ref="table" v-loading="searching" :data="tableData" row-key="id">
<el-table-column :show-overflow-tooltip="true" prop="id" label="编号" width="100px" align="center" />
<el-table-column :show-overflow-tooltip="true" prop="mineName" label="测点名称" align="center" />
<el-table-column :show-overflow-tooltip="true" prop="name" label="测点编号" align="center" />
<el-table-column :show-overflow-tooltip="true" prop="code" label="监测值" align="center" />
<el-table-column :show-overflow-tooltip="true" prop="monitoringType" label="监测时间" align="center" />
<el-table-column :show-overflow-tooltip="true" prop="unit" label="报警状态" align="center" />
</el-table>
<el-pagination
:page-sizes="[10, 20, 50, 100]"
:current-page.sync="searchParam.page"
:page-size.sync="searchParam.count"
:total="searchResult.total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="searchSubmit"
@current-change="searchSubmit"
/>
</div> </div>
</template>
<!--表格-->
<script> <el-table ref="table" v-loading="loading" :data="tableData" row-key="id">
export default { <el-table-column
name: 'EIotEnvironmentData', // 本页面名 :show-overflow-tooltip="true"
data() { prop="sensorid"
return { label="站点编号"
searching: false, width="130px"
searchParam: {}, align="center"
searchResult: { />
results: [] <el-table-column
} :show-overflow-tooltip="true"
} prop="sensorname"
label="测站名称"
align="center"
/>
<el-table-column
:show-overflow-tooltip="true"
prop="dispx"
label="X变化量"
align="center"
/>
<el-table-column
:show-overflow-tooltip="true"
prop="dispy"
label="Y变化量"
align="center"
/>
<el-table-column
:show-overflow-tooltip="true"
prop="disph"
label="Z变化量"
align="center"
/>
<el-table-column
:show-overflow-tooltip="true"
prop="time"
label="监测时间"
align="center"
>
</el-table-column>
</el-table>
<el-pagination
:page-sizes="[10, 20, 50, 100]"
:current-page.sync="page"
:page-size.sync="size"
:total="totalElement"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</template>
<script>
import API from "@/api/newResource/data.js";
import { getToken } from "@/utils/auth";
import { mapGetters } from "vuex";
import DateRangePicker from '@/components/DateRangePicker'
export default {
name: "newResourceDisplaceMachine", // 本页面名
data() {
return {
equipname: '',
datarealtime: '',
loading: false,
tableData: [],
// 总的个数
totalElement: 0,
// 当前页的条数
size: 10,
// 当前页码
page: 1,
};
},
components: { DateRangePicker },
mounted() {
this.search()
},
methods: {
getData() {
this.loading = true;
API.getDataList({
page: this.page,
size: this.size,
time: this.datarealtime && this.datarealtime.join(',') || '',
sensorname: this.equipname,
})
.then((response) => {
this.loading = false;
this.tableData = response.body.list;
})
.catch(() => {
this.loading = false;
});
},
// 模糊搜索
search() {
this.getData();
},
clearSearch() {
this.equipname = ''
this.datarealtime = ''
this.size = 10;
this.page = 0;
this.getData();
}, },
computed: { // 当前页的条数变化
tableData() { handleSizeChange(val) {
// 此处对返回值进行算法重组 this.size = val;
return this.searchResult.results this.getData();
}
}, },
mounted() { // 当前第几页
handleCurrentChange(val) {
this.page = val;
this.getData();
}, },
methods: {
} },
} };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-input-number .el-input__inner { ::v-deep .el-input-number .el-input__inner {
text-align: left; text-align: left;
} }
::v-deep .vue-treeselect__control,::v-deep .vue-treeselect__placeholder,::v-deep .vue-treeselect__single-value { ::v-deep .vue-treeselect__control,
height: 30px; ::v-deep .vue-treeselect__placeholder,
line-height: 30px; ::v-deep .vue-treeselect__single-value {
} height: 30px;
</style> line-height: 30px;
}
\ No newline at end of file </style>
...@@ -3,521 +3,154 @@ ...@@ -3,521 +3,154 @@
<!--工具栏--> <!--工具栏-->
<div class="head-container"> <div class="head-container">
<div> <div>
<el-input v-model="searchParam.nameLike" clearable size="small" placeholder="测点名称" style="width: 200px;" class="filter-item" /> <el-input
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="searchSubmit">搜索</el-button> v-model="equipname"
<el-button class="filter-item" size="mini" type="warning" icon="el-icon-refresh-left" @click="searchParamReset">重置</el-button> clearable
<el-tooltip class="item" effect="dark" content="按当前查询条件导出" placement="top"> size="small"
<el-button :loading="exporting" class="filter-item" size="mini" type="info" plain icon="el-icon-download" @click="exportSubmit">导出</el-button> placeholder="测点名称"
</el-tooltip> style="width: 200px"
class="filter-item"
/>
<date-range-picker v-model="datarealtime" class="date-item" />
<el-button
class="filter-item"
size="mini"
type="success"
icon="el-icon-search"
@click="search"
>搜索</el-button
>
<el-button
class="filter-item"
size="mini"
type="warning"
icon="el-icon-refresh-left"
@click="clearSearch"
>重置</el-button
>
</div> </div>
<el-button class="filter-item" size="mini" type="primary" icon="el-icon-plus" @click="doAdd()">新增</el-button>
<el-upload
class="filter-item"
action="/api/iot-normal-machine/environment/import"
multiple
:data="{mineType:selectedMine.mineType,mineId:selectedMine.id}"
:headers="httpHeaders"
:before-upload="beforeImport"
:on-success="importSuccess"
:on-error="importError"
:show-file-list="false"
>
<el-button :loading="dialog3Saving" size="mini" type="success" icon="el-icon-upload2">导入</el-button>
</el-upload>
</div> </div>
<!--弹出框1-->
<el-dialog append-to-body :close-on-click-modal="true" :visible.sync="dialog1Show" :title="editState==1?'新增':editState==2?'修改':'查看'" width="960px">
<el-form ref="dialog1Form" :hide-required-asterisk="!dialog1Editing" :model="dialog1Data" :rules="dialog1Rules" size="mini" label-width="180px" style="margin-right: 80px;">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="测点编号:" prop="code">
<span v-show="!dialog1Editing">{{ dialog1Data.code }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.code" :disabled="editState==2" maxlength="100" show-word-limit />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="测点名称:" prop="name">
<span v-show="!dialog1Editing">{{ dialog1Data.name }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.name" maxlength="100" show-word-limit />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="测点类型:" prop="monitoringType">
<span v-show="!dialog1Editing">{{ (getMonitoringTypeByCode(dialog1Data.code)||{}).name }}</span>
<el-input v-show="dialog1Editing" :disabled="true" :value="(getMonitoringTypeByCode(dialog1Data.code)||{}).name" show-word-limit />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="监测点数值类型:" prop="monitoringPointDataType">
<span v-for="item in iotEnvironmentMachineApi.monitoringPointDataTypes()" v-show="!dialog1Editing && item.key==dialog1Data.monitoringPointDataType" :key="item.key">
{{ item.value }}
</span>
<el-select v-show="dialog1Editing" v-model="dialog1Data.monitoringPointDataType" placeholder="请选择" style="width: 100%;">
<el-option v-for="item in iotEnvironmentMachineApi.monitoringPointDataTypes()" :key="item.key" :label="item.value" :value="item.key" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<template v-if="dialog1Data.monitoringPointDataType==2">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="测点单位:" prop="unit">
<span v-show="!dialog1Editing">{{ dialog1Data.unit }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.unit" maxlength="10" show-word-limit />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="量程上限:" prop="rangeMax">
<span v-show="!dialog1Editing">{{ dialog1Data.rangeMax }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.rangeMax" :precision="4" :controls="false" style="width: 100%;" :min="0" :max="999999" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="量程下限:" prop="rangeMin">
<span v-show="!dialog1Editing">{{ dialog1Data.rangeMin }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.rangeMin" :precision="4" :controls="false" style="width: 100%;" :min="0" :max="999999" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="报警超上限阈值:" prop="thresholdLevel1">
<span v-show="!dialog1Editing">{{ dialog1Data.thresholdLevel1 }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.thresholdLevel1" :precision="4" :controls="false" style="width: 100%;" :min="0" :max="999999" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="报警上限阈值:" prop="thresholdLevel2">
<span v-show="!dialog1Editing">{{ dialog1Data.thresholdLevel2 }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.thresholdLevel2" :precision="4" :controls="false" style="width: 100%;" :min="0" :max="999999" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="报警下限阈值:" prop="thresholdLevel2Low">
<span v-show="!dialog1Editing">{{ dialog1Data.thresholdLevel2Low }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.thresholdLevel2Low" :precision="4" :controls="false" style="width: 100%;" :min="0" :max="999999" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="报警超下限阈值:" prop="thresholdLevel1Low">
<span v-show="!dialog1Editing">{{ dialog1Data.thresholdLevel1Low }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.thresholdLevel1Low" :precision="4" :controls="false" style="width: 100%;" :min="0" :max="999999" />
</el-form-item>
</el-col>
</el-row>
</template>
<template v-if="dialog1Data.monitoringPointDataType==1">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="开描述:" prop="trueInfo">
<span v-show="!dialog1Editing">{{ dialog1Data.trueInfo }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.trueInfo" maxlength="100" show-word-limit />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="停描述:" prop="falseInfo">
<span v-show="!dialog1Editing">{{ dialog1Data.falseInfo }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.falseInfo" maxlength="100" show-word-limit />
</el-form-item>
</el-col>
</el-row>
</template>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="安装位置:" prop="place">
<span v-show="!dialog1Editing">{{ dialog1Data.place }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.place" maxlength="100" show-word-limit />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="安装位置描述:" prop="placeNote">
<span v-show="!dialog1Editing">{{ dialog1Data.placeNote }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.placeNote" maxlength="100" show-word-limit />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="高程:" prop="elevation">
<span v-show="!dialog1Editing">{{ dialog1Data.elevation }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.elevation" :precision="2" :controls="false" style="width: 100%;" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="监测对象:" prop="monitoringTo">
<span v-show="!dialog1Editing">{{ dialog1Data.monitoringTo }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.monitoringTo" maxlength="100" show-word-limit />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="经度:" prop="longitude">
<span v-show="!dialog1Editing">{{ dialog1Data.longitude }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.longitude" :precision="6" :controls="false" style="width: 100%;" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="纬度:" prop="latitude">
<span v-show="!dialog1Editing">{{ dialog1Data.latitude }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.latitude" :precision="6" :controls="false" style="width: 100%;" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item v-show="dialog1Editing || dialog1Data.longitude && dialog1Data.latitude" label="位置地图:">
<AMapSearchPoint :is-search="dialog1Editing" :point="mapPoint" @choosePoint="choosePoint" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div v-show="dialog1Editing" slot="footer" class="dialog-footer">
<el-button type="text" @click="dialog1Show=false">取消</el-button>
<el-button :loading="dialog1Saving" type="primary" @click="dialog1Submit">确认</el-button>
</div>
</el-dialog>
<!--弹出框2-->
<el-dialog append-to-body :close-on-click-modal="true" :visible.sync="dialog2Show" :title="'确认删除'" width="580px">
<div>
<span>确认要环境监测测点吗?</span>
</div>
<div>
<span>测点删除后,此测点的监测数据会一同删除!</span>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="dialog2Show=false">取消</el-button>
<el-button :loading="dialog2Saving" type="primary" @click="dialog2Submit">确认</el-button>
</div>
</el-dialog>
<!--弹出框3-->
<el-dialog append-to-body :close-on-click-modal="true" :visible.sync="dialog3Show" :title="'导入结果'" width="580px">
<div>
<span>共计成功导入:</span>
<span style="font-weight: bold;">{{ dialog3Data.successCount + dialog3Data.failCount }}</span>
<span>条,请核对总数。</span>
</div>
<div>
<span>其中,成功:</span>
<span style="color: #67C23A;">{{ dialog3Data.successCount }}</span>
<span>条;失败:</span>
<span style="color: #F56C6C;">{{ dialog3Data.failCount }}</span>
<span>条。</span>
</div>
<br>
<div v-if="dialog3Data.failCount">
<div><span>失败信息:</span></div>
<br>
<div v-for="failReason in dialog3Data.failReasonList" :key="failReason.index">
<span>{{ failReason.index }}条数据</span>
<span v-if="failReason.row" style="font-size: 10px;color: #909399;">{{ failReason.row }}</span>
<span v-if="failReason.col" style="font-size: 10px;color: #909399;">{{ failReason.col }}</span>
<span v-if="failReason.data" style="margin-left: 10px; color: #F56C6C;">{{ failReason.data }}</span>
<span style="margin-left: 10px;">{{ failReason.reason }}</span>
</div>
</div>
</el-dialog>
<!--表格--> <!--表格-->
<el-table ref="table" v-loading="searching" :data="tableData" row-key="id"> <el-table ref="table" v-loading="loading" :data="tableData" row-key="id">
<el-table-column :show-overflow-tooltip="true" prop="id" label="编号" width="100px" align="center" /> <el-table-column
<el-table-column :show-overflow-tooltip="true" prop="code" label="测点编号" align="center" /> :show-overflow-tooltip="true"
<el-table-column :show-overflow-tooltip="true" prop="name" label="测点名称" align="center" /> prop="equipno"
<el-table-column :show-overflow-tooltip="true" prop="monitoringType" label="测点类型" align="center"> label="站点编号"
<template slot-scope="scope"> width="130px"
<span>{{ (getMonitoringTypeByCode(scope.row.code)||{}).name }}</span> align="center"
</template> />
</el-table-column> <el-table-column
<el-table-column :show-overflow-tooltip="true" prop="monitoringPointDataType" label="测点数值类型" align="center"> :show-overflow-tooltip="true"
<template slot-scope="scope"> prop="equipname"
<span v-for="item in iotEnvironmentMachineApi.monitoringPointDataTypes()" v-show="item.key==scope.row.monitoringPointDataType" :key="item.key"> label="测站名称"
{{ item.value }} align="center"
</span> />
</template> <el-table-column
</el-table-column> :show-overflow-tooltip="true"
<el-table-column :show-overflow-tooltip="true" prop="unit" label="单位" align="center" /> prop="online"
<el-table-column :show-overflow-tooltip="true" prop="xxx" label="状态" align="center" /><!-- TODO 状态 --> label="设备状态"
<el-table-column label="操作" width="300px" align="center" fixed="right"> align="center"
<template slot-scope="scope"> />
<el-button size="mini" round @click="doEdit(scope.row.id,false)">查看</el-button> <el-table-column
<el-button size="mini" round @click="doEdit(scope.row.id,true)">修改</el-button> :show-overflow-tooltip="true"
<el-button size="mini" round @click="doDelete(scope.row.id)">删除</el-button> prop="datarealtime"
</template> label="监测时间"
align="center"
>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination <el-pagination
:page-sizes="[10, 20, 50, 100]" :page-sizes="[10, 20, 50, 100]"
:current-page.sync="searchParam.page" :current-page.sync="page"
:page-size.sync="searchParam.count" :page-size.sync="size"
:total="searchResult.total" :total="totalElement"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
@size-change="searchSubmit" @size-change="handleSizeChange"
@current-change="searchSubmit" @current-change="handleCurrentChange"
/> />
</div> </div>
</template> </template>
<script> <script>
import iotEnvironmentMachineApi from '@/api/kd/iotEnvironmentMachine' import API from "@/api/newResource/machine.js";
import AMapSearchPoint from '@/components/AMap/AMapSearchPoint' import { getToken } from "@/utils/auth";
import { getToken } from '@/utils/auth' import { mapGetters } from "vuex";
import { mapGetters } from 'vuex' import DateRangePicker from '@/components/DateRangePicker'
import { downloadFile } from '@/utils'
const searchParam = {// 默认搜索条件
page: 1,
count: 10,
searchCount: true
}
export default { export default {
name: 'EIotEnvironmentMachine', // 本页面名 name: "newResourceDisplaceMachine", // 本页面名
components: { AMapSearchPoint },
data() { data() {
return { return {
selectedMine: {}, equipname: '',
httpHeaders: { datarealtime: '',
'Authorization': getToken() loading: false,
}, tableData: [],
iotEnvironmentMachineApi: iotEnvironmentMachineApi, // 总的个数
searching: false, totalElement: 0,
exporting: false, // 当前页的条数
searchParam: {}, size: 10,
searchResult: { // 当前页码
total: 0, page: 1,
results: [] // 搜索结果 };
},
dialog1Show: false,
dialog1Editing: false,
dialog1Saving: false,
dialog1Data: {},
dialog1Rules: {
code: [{ required: true, message: '请填写' }],
name: [{ required: true, message: '请填写' }],
monitoringPointDataType: [{ required: true, message: '请选择' }]
},
editState: 0, // (刚打开窗口时)记录了上次窗口作用;(保存编辑时)记录了当前窗口作用; 0无 1新增 2修改 3查看
addingData: {}, // 上次正在新增时的内容,下次打开dialog1窗口时记录下来
dialog2Show: false,
dialog2Saving: false,
dialog2Data: {},
dialog3Show: false,
dialog3Data: {},
dialog3Saving: false
}
},
computed: {
...mapGetters([
'user'
]),
tableData() {
// 此处对返回值进行算法重组
return this.searchResult.results
},
mapPoint() {
if (this.dialog1Data.longitude && this.dialog1Data.latitude) {
return [this.dialog1Data.longitude * 1, this.dialog1Data.latitude * 1]
}
return null
}
}, },
components: { DateRangePicker },
mounted() { mounted() {
const selectedMineJson = window.localStorage.getItem('kd.selected.mine') this.search()
let noMine = false
if (!selectedMineJson) {
noMine = true
} else {
const selectedMine = JSON.parse(selectedMineJson)
if (!selectedMine || selectedMine.enterpriseId !== this.user.enterpriseId) {
noMine = true
} else {
this.selectedMine = selectedMine
}
}
// if (noMine) {
// this.$message.error('当前未选择矿山')
// this.$router.replace('/dashboard')
// }
this.searchParamReset()
this.searchSubmit()
}, },
methods: { methods: {
searchParamReset() { getData() {
this.searchParam = JSON.parse(JSON.stringify(searchParam)) this.loading = true;
}, API.getDataList({
searchSubmit() { page: this.page,
this.searching = true size: this.size,
this.searchParam.mineType = this.selectedMine.mineType datarealtime: this.datarealtime && this.datarealtime.join(',') || '',
this.searchParam.mineId = this.selectedMine.id equipname: this.equipname,
iotEnvironmentMachineApi.getPage(this.searchParam).then(response => { deviceType: '3'
this.searching = false
this.searchResult = response
}).catch(() => {
this.searching = false
})
},
exportSubmit() {
this.exporting = true
this.searchParam.mineType = this.selectedMine.mineType
this.searchParam.mineId = this.selectedMine.id
iotEnvironmentMachineApi.export(this.searchParam).then(response => {
downloadFile(response, '环境监测设备', 'xlsx')
this.exporting = false
}).catch(() => {
this.exporting = false
})
},
getMonitoringTypeByCode(code) {
return iotEnvironmentMachineApi.getMonitoringTypeByCode(code)
},
dialog1Submit() {
this.$refs['dialog1Form'].validate(valid => {
if (!valid) {
return
} else if (!this.getMonitoringTypeByCode(this.dialog1Data.code)) {
this.$message.error('请正确填写编号,需解析出【监测类型】')
} else {
this.dialog1Saving = true
this.removeOtherMonitoringPoint(this.dialog1Data)
if (this.editState === 1) { // 新增
this.dialog1Data.mineType = this.selectedMine.mineType
this.dialog1Data.mineId = this.selectedMine.id
iotEnvironmentMachineApi.add(this.dialog1Data).then(() => {
this.dialog1Show = false
this.$message.success('保存成功')
setTimeout(() => { // 立即清除会导致输入框Validate一闪变红
this.dialog1Data = {}
this.dialog1Saving = false
}, 500)
this.searchSubmit()
}).catch(() => {
this.dialog1Saving = false
})
} else if (this.editState === 2) { // 修改
iotEnvironmentMachineApi.set(this.dialog1Data).then(() => {
this.dialog1Show = false
this.$message.success('修改成功')
setTimeout(() => { // 立即清除会导致输入框Validate一闪变红
this.dialog1Data = {}
this.dialog1Saving = false
}, 500)
this.searchSubmit()
}).catch(() => {
this.dialog1Saving = false
})
} else {
this.$message.error('出错啦,请重试')
this.dialog1Saving = false
}
}
})
},
beforeDialog1Open() { // 窗口打开前的统一操作
if (this.editState === 1) {
this.addingData = this.dialog1Data
}
},
doAdd() {
this.beforeDialog1Open()
this.editState = 1
this.dialog1Editing = true
this.dialog1Data = this.addingData // 初始值:上次编辑的内容
this.dialog1Show = true
this.$nextTick(() => {
this.$refs['dialog1Form'].clearValidate()
}) })
}, .then((response) => {
doEdit(id, isEdit) { this.loading = false;
this.beforeDialog1Open() this.tableData = response.body.list;
this.editState = isEdit ? 2 : 3
iotEnvironmentMachineApi.getById(id).then(response => {
this.dialog1Data = response
this.dialog1Editing = isEdit
this.dialog1Show = true
this.$nextTick(() => {
this.$refs['dialog1Form'].clearValidate()
}) })
}).catch(() => { .catch(() => {
this.searchSubmit() this.loading = false;
}) });
},
dialog2Submit() {
this.dialog2Saving = true
iotEnvironmentMachineApi.del(this.dialog2Data).then(() => {
this.dialog2Show = false
this.$message.success('删除成功')
this.dialog2Data = {}
this.dialog2Saving = false
this.searchSubmit()
}).catch(() => {
this.dialog2Saving = false
})
},
doDelete(id) {
iotEnvironmentMachineApi.getById(id).then(response => {
this.dialog2Data = response
this.dialog2Show = true
}).catch(() => {
this.searchSubmit()
})
}, },
choosePoint(lnglat) { // 模糊搜索
if (lnglat) { search() {
this.$set(this.dialog1Data, 'longitude', lnglat[0]) this.getData();
this.$set(this.dialog1Data, 'latitude', lnglat[1])
} else {
this.$set(this.dialog1Data, 'longitude', null)
this.$set(this.dialog1Data, 'latitude', null)
}
}, },
beforeImport() { clearSearch() {
this.dialog3Saving = true this.equipname = ''
this.datarealtime = ''
this.size = 10;
this.page = 0;
this.getData();
}, },
importSuccess(response, file, fileList) { // 当前页的条数变化
this.dialog3Data = response handleSizeChange(val) {
this.dialog3Show = true this.size = val;
this.searchSubmit() this.getData();
this.dialog3Saving = false
}, },
importError(error) { // 当前第几页
this.$message.error('导入失败') handleCurrentChange(val) {
console.error('导入失败', error) this.page = val;
this.dialog3Saving = false this.getData();
}, },
/**
* 按照测点数据类型移除不属于此类型的多余数据。 },
* 例如:开关量时,移除量程、报警阈值等。 };
* @param {Object} data 将要提交的machine对象
*/
removeOtherMonitoringPoint(data) {
if (data.monitoringPointDataType !== 1) {
data.trueInfo = null
data.falseInfo = null
}
if (data.monitoringPointDataType !== 2) {
data.unit = null
data.rangeMax = null
data.rangeMin = null
data.thresholdLevel1 = null
data.thresholdLevel2 = null
data.thresholdLevel2Low = null
data.thresholdLevel1Low = null
}
}
}
}
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-input-number .el-input__inner { ::v-deep .el-input-number .el-input__inner {
text-align: left; text-align: left;
} }
::v-deep .vue-treeselect__control,::v-deep .vue-treeselect__placeholder,::v-deep .vue-treeselect__single-value { ::v-deep .vue-treeselect__control,
height: 30px; ::v-deep .vue-treeselect__placeholder,
line-height: 30px; ::v-deep .vue-treeselect__single-value {
} height: 30px;
line-height: 30px;
}
</style> </style>
...@@ -3,521 +3,155 @@ ...@@ -3,521 +3,155 @@
<!--工具栏--> <!--工具栏-->
<div class="head-container"> <div class="head-container">
<div> <div>
<el-input v-model="searchParam.nameLike" clearable size="small" placeholder="测点名称" style="width: 200px;" class="filter-item" /> <el-input
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="searchSubmit">搜索</el-button> v-model="equipname"
<el-button class="filter-item" size="mini" type="warning" icon="el-icon-refresh-left" @click="searchParamReset">重置</el-button> clearable
<el-tooltip class="item" effect="dark" content="按当前查询条件导出" placement="top"> size="small"
<el-button :loading="exporting" class="filter-item" size="mini" type="info" plain icon="el-icon-download" @click="exportSubmit">导出</el-button> placeholder="测点名称"
</el-tooltip> style="width: 200px"
class="filter-item"
/>
<date-range-picker v-model="datarealtime" class="date-item" />
<el-button
class="filter-item"
size="mini"
type="success"
icon="el-icon-search"
@click="search"
>搜索</el-button
>
<el-button
class="filter-item"
size="mini"
type="warning"
icon="el-icon-refresh-left"
@click="clearSearch"
>重置</el-button
>
</div> </div>
<el-button class="filter-item" size="mini" type="primary" icon="el-icon-plus" @click="doAdd()">新增</el-button>
<el-upload
class="filter-item"
action="/api/iot-normal-machine/environment/import"
multiple
:data="{mineType:selectedMine.mineType,mineId:selectedMine.id}"
:headers="httpHeaders"
:before-upload="beforeImport"
:on-success="importSuccess"
:on-error="importError"
:show-file-list="false"
>
<el-button :loading="dialog3Saving" size="mini" type="success" icon="el-icon-upload2">导入</el-button>
</el-upload>
</div> </div>
<!--弹出框1-->
<el-dialog append-to-body :close-on-click-modal="true" :visible.sync="dialog1Show" :title="editState==1?'新增':editState==2?'修改':'查看'" width="960px">
<el-form ref="dialog1Form" :hide-required-asterisk="!dialog1Editing" :model="dialog1Data" :rules="dialog1Rules" size="mini" label-width="180px" style="margin-right: 80px;">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="测点编号:" prop="code">
<span v-show="!dialog1Editing">{{ dialog1Data.code }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.code" :disabled="editState==2" maxlength="100" show-word-limit />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="测点名称:" prop="name">
<span v-show="!dialog1Editing">{{ dialog1Data.name }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.name" maxlength="100" show-word-limit />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="测点类型:" prop="monitoringType">
<span v-show="!dialog1Editing">{{ (getMonitoringTypeByCode(dialog1Data.code)||{}).name }}</span>
<el-input v-show="dialog1Editing" :disabled="true" :value="(getMonitoringTypeByCode(dialog1Data.code)||{}).name" show-word-limit />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="监测点数值类型:" prop="monitoringPointDataType">
<span v-for="item in iotEnvironmentMachineApi.monitoringPointDataTypes()" v-show="!dialog1Editing && item.key==dialog1Data.monitoringPointDataType" :key="item.key">
{{ item.value }}
</span>
<el-select v-show="dialog1Editing" v-model="dialog1Data.monitoringPointDataType" placeholder="请选择" style="width: 100%;">
<el-option v-for="item in iotEnvironmentMachineApi.monitoringPointDataTypes()" :key="item.key" :label="item.value" :value="item.key" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<template v-if="dialog1Data.monitoringPointDataType==2">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="测点单位:" prop="unit">
<span v-show="!dialog1Editing">{{ dialog1Data.unit }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.unit" maxlength="10" show-word-limit />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="量程上限:" prop="rangeMax">
<span v-show="!dialog1Editing">{{ dialog1Data.rangeMax }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.rangeMax" :precision="4" :controls="false" style="width: 100%;" :min="0" :max="999999" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="量程下限:" prop="rangeMin">
<span v-show="!dialog1Editing">{{ dialog1Data.rangeMin }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.rangeMin" :precision="4" :controls="false" style="width: 100%;" :min="0" :max="999999" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="报警超上限阈值:" prop="thresholdLevel1">
<span v-show="!dialog1Editing">{{ dialog1Data.thresholdLevel1 }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.thresholdLevel1" :precision="4" :controls="false" style="width: 100%;" :min="0" :max="999999" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="报警上限阈值:" prop="thresholdLevel2">
<span v-show="!dialog1Editing">{{ dialog1Data.thresholdLevel2 }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.thresholdLevel2" :precision="4" :controls="false" style="width: 100%;" :min="0" :max="999999" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="报警下限阈值:" prop="thresholdLevel2Low">
<span v-show="!dialog1Editing">{{ dialog1Data.thresholdLevel2Low }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.thresholdLevel2Low" :precision="4" :controls="false" style="width: 100%;" :min="0" :max="999999" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="报警超下限阈值:" prop="thresholdLevel1Low">
<span v-show="!dialog1Editing">{{ dialog1Data.thresholdLevel1Low }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.thresholdLevel1Low" :precision="4" :controls="false" style="width: 100%;" :min="0" :max="999999" />
</el-form-item>
</el-col>
</el-row>
</template>
<template v-if="dialog1Data.monitoringPointDataType==1">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="开描述:" prop="trueInfo">
<span v-show="!dialog1Editing">{{ dialog1Data.trueInfo }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.trueInfo" maxlength="100" show-word-limit />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="停描述:" prop="falseInfo">
<span v-show="!dialog1Editing">{{ dialog1Data.falseInfo }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.falseInfo" maxlength="100" show-word-limit />
</el-form-item>
</el-col>
</el-row>
</template>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="安装位置:" prop="place">
<span v-show="!dialog1Editing">{{ dialog1Data.place }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.place" maxlength="100" show-word-limit />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="安装位置描述:" prop="placeNote">
<span v-show="!dialog1Editing">{{ dialog1Data.placeNote }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.placeNote" maxlength="100" show-word-limit />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="高程:" prop="elevation">
<span v-show="!dialog1Editing">{{ dialog1Data.elevation }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.elevation" :precision="2" :controls="false" style="width: 100%;" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="监测对象:" prop="monitoringTo">
<span v-show="!dialog1Editing">{{ dialog1Data.monitoringTo }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.monitoringTo" maxlength="100" show-word-limit />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="经度:" prop="longitude">
<span v-show="!dialog1Editing">{{ dialog1Data.longitude }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.longitude" :precision="6" :controls="false" style="width: 100%;" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="纬度:" prop="latitude">
<span v-show="!dialog1Editing">{{ dialog1Data.latitude }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.latitude" :precision="6" :controls="false" style="width: 100%;" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item v-show="dialog1Editing || dialog1Data.longitude && dialog1Data.latitude" label="位置地图:">
<AMapSearchPoint :is-search="dialog1Editing" :point="mapPoint" @choosePoint="choosePoint" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div v-show="dialog1Editing" slot="footer" class="dialog-footer">
<el-button type="text" @click="dialog1Show=false">取消</el-button>
<el-button :loading="dialog1Saving" type="primary" @click="dialog1Submit">确认</el-button>
</div>
</el-dialog>
<!--弹出框2-->
<el-dialog append-to-body :close-on-click-modal="true" :visible.sync="dialog2Show" :title="'确认删除'" width="580px">
<div>
<span>确认要环境监测测点吗?</span>
</div>
<div>
<span>测点删除后,此测点的监测数据会一同删除!</span>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="dialog2Show=false">取消</el-button>
<el-button :loading="dialog2Saving" type="primary" @click="dialog2Submit">确认</el-button>
</div>
</el-dialog>
<!--弹出框3-->
<el-dialog append-to-body :close-on-click-modal="true" :visible.sync="dialog3Show" :title="'导入结果'" width="580px">
<div>
<span>共计成功导入:</span>
<span style="font-weight: bold;">{{ dialog3Data.successCount + dialog3Data.failCount }}</span>
<span>条,请核对总数。</span>
</div>
<div>
<span>其中,成功:</span>
<span style="color: #67C23A;">{{ dialog3Data.successCount }}</span>
<span>条;失败:</span>
<span style="color: #F56C6C;">{{ dialog3Data.failCount }}</span>
<span>条。</span>
</div>
<br>
<div v-if="dialog3Data.failCount">
<div><span>失败信息:</span></div>
<br>
<div v-for="failReason in dialog3Data.failReasonList" :key="failReason.index">
<span>{{ failReason.index }}条数据</span>
<span v-if="failReason.row" style="font-size: 10px;color: #909399;">{{ failReason.row }}</span>
<span v-if="failReason.col" style="font-size: 10px;color: #909399;">{{ failReason.col }}</span>
<span v-if="failReason.data" style="margin-left: 10px; color: #F56C6C;">{{ failReason.data }}</span>
<span style="margin-left: 10px;">{{ failReason.reason }}</span>
</div>
</div>
</el-dialog>
<!--表格--> <!--表格-->
<el-table ref="table" v-loading="searching" :data="tableData" row-key="id"> <el-table ref="table" v-loading="loading" :data="tableData" row-key="id">
<el-table-column :show-overflow-tooltip="true" prop="id" label="编号" width="100px" align="center" /> <el-table-column
<el-table-column :show-overflow-tooltip="true" prop="code" label="测点编号" align="center" /> :show-overflow-tooltip="true"
<el-table-column :show-overflow-tooltip="true" prop="name" label="测点名称" align="center" /> prop="equipno"
<el-table-column :show-overflow-tooltip="true" prop="monitoringType" label="测点类型" align="center"> label="站点编号"
<template slot-scope="scope"> width="130px"
<span>{{ (getMonitoringTypeByCode(scope.row.code)||{}).name }}</span> align="center"
</template> />
</el-table-column> <el-table-column
<el-table-column :show-overflow-tooltip="true" prop="monitoringPointDataType" label="测点数值类型" align="center"> :show-overflow-tooltip="true"
<template slot-scope="scope"> prop="equipname"
<span v-for="item in iotEnvironmentMachineApi.monitoringPointDataTypes()" v-show="item.key==scope.row.monitoringPointDataType" :key="item.key"> label="测站名称"
{{ item.value }} align="center"
</span> />
</template> <el-table-column
</el-table-column> :show-overflow-tooltip="true"
<el-table-column :show-overflow-tooltip="true" prop="unit" label="单位" align="center" /> prop="online"
<el-table-column :show-overflow-tooltip="true" prop="xxx" label="状态" align="center" /><!-- TODO 状态 --> label="设备状态"
<el-table-column label="操作" width="300px" align="center" fixed="right"> align="center"
<template slot-scope="scope"> />
<el-button size="mini" round @click="doEdit(scope.row.id,false)">查看</el-button> <el-table-column
<el-button size="mini" round @click="doEdit(scope.row.id,true)">修改</el-button> :show-overflow-tooltip="true"
<el-button size="mini" round @click="doDelete(scope.row.id)">删除</el-button> prop="datarealtime"
</template> label="监测时间"
align="center"
>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination <el-pagination
:page-sizes="[10, 20, 50, 100]" :page-sizes="[10, 20, 50, 100]"
:current-page.sync="searchParam.page" :current-page.sync="page"
:page-size.sync="searchParam.count" :page-size.sync="size"
:total="searchResult.total" :total="totalElement"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
@size-change="searchSubmit" @size-change="handleSizeChange"
@current-change="searchSubmit" @current-change="handleCurrentChange"
/> />
</div> </div>
</template> </template>
<script> <script>
import iotEnvironmentMachineApi from '@/api/kd/iotEnvironmentMachine' import API from "@/api/newResource/machine.js";
import AMapSearchPoint from '@/components/AMap/AMapSearchPoint' import { getToken } from "@/utils/auth";
import { getToken } from '@/utils/auth' import { mapGetters } from "vuex";
import { mapGetters } from 'vuex' import DateRangePicker from '@/components/DateRangePicker'
import { downloadFile } from '@/utils'
const searchParam = {// 默认搜索条件
page: 1,
count: 10,
searchCount: true
}
export default { export default {
name: 'EIotEnvironmentMachine', // 本页面名 name: "newResourceDisplaceMachine", // 本页面名
components: { AMapSearchPoint },
data() { data() {
return { return {
selectedMine: {}, equipname: '',
httpHeaders: { datarealtime: '',
'Authorization': getToken() loading: false,
}, tableData: [],
iotEnvironmentMachineApi: iotEnvironmentMachineApi, // 总的个数
searching: false, totalElement: 0,
exporting: false, // 当前页的条数
searchParam: {}, size: 10,
searchResult: { // 当前页码
total: 0, page: 1,
results: [] // 搜索结果 };
},
dialog1Show: false,
dialog1Editing: false,
dialog1Saving: false,
dialog1Data: {},
dialog1Rules: {
code: [{ required: true, message: '请填写' }],
name: [{ required: true, message: '请填写' }],
monitoringPointDataType: [{ required: true, message: '请选择' }]
},
editState: 0, // (刚打开窗口时)记录了上次窗口作用;(保存编辑时)记录了当前窗口作用; 0无 1新增 2修改 3查看
addingData: {}, // 上次正在新增时的内容,下次打开dialog1窗口时记录下来
dialog2Show: false,
dialog2Saving: false,
dialog2Data: {},
dialog3Show: false,
dialog3Data: {},
dialog3Saving: false
}
},
computed: {
...mapGetters([
'user'
]),
tableData() {
// 此处对返回值进行算法重组
return this.searchResult.results
},
mapPoint() {
if (this.dialog1Data.longitude && this.dialog1Data.latitude) {
return [this.dialog1Data.longitude * 1, this.dialog1Data.latitude * 1]
}
return null
}
}, },
components: { DateRangePicker },
mounted() { mounted() {
const selectedMineJson = window.localStorage.getItem('kd.selected.mine') this.search()
let noMine = false
if (!selectedMineJson) {
noMine = true
} else {
const selectedMine = JSON.parse(selectedMineJson)
if (!selectedMine || selectedMine.enterpriseId !== this.user.enterpriseId) {
noMine = true
} else {
this.selectedMine = selectedMine
}
}
// if (noMine) {
// this.$message.error('当前未选择矿山')
// this.$router.replace('/dashboard')
// }
this.searchParamReset()
this.searchSubmit()
}, },
methods: { methods: {
searchParamReset() { getData() {
this.searchParam = JSON.parse(JSON.stringify(searchParam)) this.loading = true;
}, API.getDataList({
searchSubmit() { page: this.page,
this.searching = true size: this.size,
this.searchParam.mineType = this.selectedMine.mineType datarealtime: this.datarealtime && this.datarealtime.join(',') || '',
this.searchParam.mineId = this.selectedMine.id equipname: this.equipname,
iotEnvironmentMachineApi.getPage(this.searchParam).then(response => { deviceType: '8',
this.searching = false different: '温度'
this.searchResult = response
}).catch(() => {
this.searching = false
})
},
exportSubmit() {
this.exporting = true
this.searchParam.mineType = this.selectedMine.mineType
this.searchParam.mineId = this.selectedMine.id
iotEnvironmentMachineApi.export(this.searchParam).then(response => {
downloadFile(response, '环境监测设备', 'xlsx')
this.exporting = false
}).catch(() => {
this.exporting = false
})
},
getMonitoringTypeByCode(code) {
return iotEnvironmentMachineApi.getMonitoringTypeByCode(code)
},
dialog1Submit() {
this.$refs['dialog1Form'].validate(valid => {
if (!valid) {
return
} else if (!this.getMonitoringTypeByCode(this.dialog1Data.code)) {
this.$message.error('请正确填写编号,需解析出【监测类型】')
} else {
this.dialog1Saving = true
this.removeOtherMonitoringPoint(this.dialog1Data)
if (this.editState === 1) { // 新增
this.dialog1Data.mineType = this.selectedMine.mineType
this.dialog1Data.mineId = this.selectedMine.id
iotEnvironmentMachineApi.add(this.dialog1Data).then(() => {
this.dialog1Show = false
this.$message.success('保存成功')
setTimeout(() => { // 立即清除会导致输入框Validate一闪变红
this.dialog1Data = {}
this.dialog1Saving = false
}, 500)
this.searchSubmit()
}).catch(() => {
this.dialog1Saving = false
})
} else if (this.editState === 2) { // 修改
iotEnvironmentMachineApi.set(this.dialog1Data).then(() => {
this.dialog1Show = false
this.$message.success('修改成功')
setTimeout(() => { // 立即清除会导致输入框Validate一闪变红
this.dialog1Data = {}
this.dialog1Saving = false
}, 500)
this.searchSubmit()
}).catch(() => {
this.dialog1Saving = false
})
} else {
this.$message.error('出错啦,请重试')
this.dialog1Saving = false
}
}
})
},
beforeDialog1Open() { // 窗口打开前的统一操作
if (this.editState === 1) {
this.addingData = this.dialog1Data
}
},
doAdd() {
this.beforeDialog1Open()
this.editState = 1
this.dialog1Editing = true
this.dialog1Data = this.addingData // 初始值:上次编辑的内容
this.dialog1Show = true
this.$nextTick(() => {
this.$refs['dialog1Form'].clearValidate()
}) })
}, .then((response) => {
doEdit(id, isEdit) { this.loading = false;
this.beforeDialog1Open() this.tableData = response.body.list;
this.editState = isEdit ? 2 : 3
iotEnvironmentMachineApi.getById(id).then(response => {
this.dialog1Data = response
this.dialog1Editing = isEdit
this.dialog1Show = true
this.$nextTick(() => {
this.$refs['dialog1Form'].clearValidate()
}) })
}).catch(() => { .catch(() => {
this.searchSubmit() this.loading = false;
}) });
},
dialog2Submit() {
this.dialog2Saving = true
iotEnvironmentMachineApi.del(this.dialog2Data).then(() => {
this.dialog2Show = false
this.$message.success('删除成功')
this.dialog2Data = {}
this.dialog2Saving = false
this.searchSubmit()
}).catch(() => {
this.dialog2Saving = false
})
},
doDelete(id) {
iotEnvironmentMachineApi.getById(id).then(response => {
this.dialog2Data = response
this.dialog2Show = true
}).catch(() => {
this.searchSubmit()
})
}, },
choosePoint(lnglat) { // 模糊搜索
if (lnglat) { search() {
this.$set(this.dialog1Data, 'longitude', lnglat[0]) this.getData();
this.$set(this.dialog1Data, 'latitude', lnglat[1])
} else {
this.$set(this.dialog1Data, 'longitude', null)
this.$set(this.dialog1Data, 'latitude', null)
}
}, },
beforeImport() { clearSearch() {
this.dialog3Saving = true this.equipname = ''
this.datarealtime = ''
this.size = 10;
this.page = 0;
this.getData();
}, },
importSuccess(response, file, fileList) { // 当前页的条数变化
this.dialog3Data = response handleSizeChange(val) {
this.dialog3Show = true this.size = val;
this.searchSubmit() this.getData();
this.dialog3Saving = false
}, },
importError(error) { // 当前第几页
this.$message.error('导入失败') handleCurrentChange(val) {
console.error('导入失败', error) this.page = val;
this.dialog3Saving = false this.getData();
}, },
/**
* 按照测点数据类型移除不属于此类型的多余数据。 },
* 例如:开关量时,移除量程、报警阈值等。 };
* @param {Object} data 将要提交的machine对象
*/
removeOtherMonitoringPoint(data) {
if (data.monitoringPointDataType !== 1) {
data.trueInfo = null
data.falseInfo = null
}
if (data.monitoringPointDataType !== 2) {
data.unit = null
data.rangeMax = null
data.rangeMin = null
data.thresholdLevel1 = null
data.thresholdLevel2 = null
data.thresholdLevel2Low = null
data.thresholdLevel1Low = null
}
}
}
}
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-input-number .el-input__inner { ::v-deep .el-input-number .el-input__inner {
text-align: left; text-align: left;
} }
::v-deep .vue-treeselect__control,::v-deep .vue-treeselect__placeholder,::v-deep .vue-treeselect__single-value { ::v-deep .vue-treeselect__control,
height: 30px; ::v-deep .vue-treeselect__placeholder,
line-height: 30px; ::v-deep .vue-treeselect__single-value {
} height: 30px;
line-height: 30px;
}
</style> </style>
...@@ -3,521 +3,155 @@ ...@@ -3,521 +3,155 @@
<!--工具栏--> <!--工具栏-->
<div class="head-container"> <div class="head-container">
<div> <div>
<el-input v-model="searchParam.nameLike" clearable size="small" placeholder="测点名称" style="width: 200px;" class="filter-item" /> <el-input
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="searchSubmit">搜索</el-button> v-model="equipname"
<el-button class="filter-item" size="mini" type="warning" icon="el-icon-refresh-left" @click="searchParamReset">重置</el-button> clearable
<el-tooltip class="item" effect="dark" content="按当前查询条件导出" placement="top"> size="small"
<el-button :loading="exporting" class="filter-item" size="mini" type="info" plain icon="el-icon-download" @click="exportSubmit">导出</el-button> placeholder="测点名称"
</el-tooltip> style="width: 200px"
class="filter-item"
/>
<date-range-picker v-model="datarealtime" class="date-item" />
<el-button
class="filter-item"
size="mini"
type="success"
icon="el-icon-search"
@click="search"
>搜索</el-button
>
<el-button
class="filter-item"
size="mini"
type="warning"
icon="el-icon-refresh-left"
@click="clearSearch"
>重置</el-button
>
</div> </div>
<el-button class="filter-item" size="mini" type="primary" icon="el-icon-plus" @click="doAdd()">新增</el-button>
<el-upload
class="filter-item"
action="/api/iot-normal-machine/environment/import"
multiple
:data="{mineType:selectedMine.mineType,mineId:selectedMine.id}"
:headers="httpHeaders"
:before-upload="beforeImport"
:on-success="importSuccess"
:on-error="importError"
:show-file-list="false"
>
<el-button :loading="dialog3Saving" size="mini" type="success" icon="el-icon-upload2">导入</el-button>
</el-upload>
</div> </div>
<!--弹出框1-->
<el-dialog append-to-body :close-on-click-modal="true" :visible.sync="dialog1Show" :title="editState==1?'新增':editState==2?'修改':'查看'" width="960px">
<el-form ref="dialog1Form" :hide-required-asterisk="!dialog1Editing" :model="dialog1Data" :rules="dialog1Rules" size="mini" label-width="180px" style="margin-right: 80px;">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="测点编号:" prop="code">
<span v-show="!dialog1Editing">{{ dialog1Data.code }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.code" :disabled="editState==2" maxlength="100" show-word-limit />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="测点名称:" prop="name">
<span v-show="!dialog1Editing">{{ dialog1Data.name }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.name" maxlength="100" show-word-limit />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="测点类型:" prop="monitoringType">
<span v-show="!dialog1Editing">{{ (getMonitoringTypeByCode(dialog1Data.code)||{}).name }}</span>
<el-input v-show="dialog1Editing" :disabled="true" :value="(getMonitoringTypeByCode(dialog1Data.code)||{}).name" show-word-limit />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="监测点数值类型:" prop="monitoringPointDataType">
<span v-for="item in iotEnvironmentMachineApi.monitoringPointDataTypes()" v-show="!dialog1Editing && item.key==dialog1Data.monitoringPointDataType" :key="item.key">
{{ item.value }}
</span>
<el-select v-show="dialog1Editing" v-model="dialog1Data.monitoringPointDataType" placeholder="请选择" style="width: 100%;">
<el-option v-for="item in iotEnvironmentMachineApi.monitoringPointDataTypes()" :key="item.key" :label="item.value" :value="item.key" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<template v-if="dialog1Data.monitoringPointDataType==2">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="测点单位:" prop="unit">
<span v-show="!dialog1Editing">{{ dialog1Data.unit }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.unit" maxlength="10" show-word-limit />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="量程上限:" prop="rangeMax">
<span v-show="!dialog1Editing">{{ dialog1Data.rangeMax }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.rangeMax" :precision="4" :controls="false" style="width: 100%;" :min="0" :max="999999" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="量程下限:" prop="rangeMin">
<span v-show="!dialog1Editing">{{ dialog1Data.rangeMin }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.rangeMin" :precision="4" :controls="false" style="width: 100%;" :min="0" :max="999999" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="报警超上限阈值:" prop="thresholdLevel1">
<span v-show="!dialog1Editing">{{ dialog1Data.thresholdLevel1 }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.thresholdLevel1" :precision="4" :controls="false" style="width: 100%;" :min="0" :max="999999" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="报警上限阈值:" prop="thresholdLevel2">
<span v-show="!dialog1Editing">{{ dialog1Data.thresholdLevel2 }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.thresholdLevel2" :precision="4" :controls="false" style="width: 100%;" :min="0" :max="999999" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="报警下限阈值:" prop="thresholdLevel2Low">
<span v-show="!dialog1Editing">{{ dialog1Data.thresholdLevel2Low }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.thresholdLevel2Low" :precision="4" :controls="false" style="width: 100%;" :min="0" :max="999999" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="报警超下限阈值:" prop="thresholdLevel1Low">
<span v-show="!dialog1Editing">{{ dialog1Data.thresholdLevel1Low }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.thresholdLevel1Low" :precision="4" :controls="false" style="width: 100%;" :min="0" :max="999999" />
</el-form-item>
</el-col>
</el-row>
</template>
<template v-if="dialog1Data.monitoringPointDataType==1">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="开描述:" prop="trueInfo">
<span v-show="!dialog1Editing">{{ dialog1Data.trueInfo }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.trueInfo" maxlength="100" show-word-limit />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="停描述:" prop="falseInfo">
<span v-show="!dialog1Editing">{{ dialog1Data.falseInfo }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.falseInfo" maxlength="100" show-word-limit />
</el-form-item>
</el-col>
</el-row>
</template>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="安装位置:" prop="place">
<span v-show="!dialog1Editing">{{ dialog1Data.place }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.place" maxlength="100" show-word-limit />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="安装位置描述:" prop="placeNote">
<span v-show="!dialog1Editing">{{ dialog1Data.placeNote }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.placeNote" maxlength="100" show-word-limit />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="高程:" prop="elevation">
<span v-show="!dialog1Editing">{{ dialog1Data.elevation }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.elevation" :precision="2" :controls="false" style="width: 100%;" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="监测对象:" prop="monitoringTo">
<span v-show="!dialog1Editing">{{ dialog1Data.monitoringTo }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.monitoringTo" maxlength="100" show-word-limit />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="经度:" prop="longitude">
<span v-show="!dialog1Editing">{{ dialog1Data.longitude }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.longitude" :precision="6" :controls="false" style="width: 100%;" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="纬度:" prop="latitude">
<span v-show="!dialog1Editing">{{ dialog1Data.latitude }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.latitude" :precision="6" :controls="false" style="width: 100%;" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item v-show="dialog1Editing || dialog1Data.longitude && dialog1Data.latitude" label="位置地图:">
<AMapSearchPoint :is-search="dialog1Editing" :point="mapPoint" @choosePoint="choosePoint" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div v-show="dialog1Editing" slot="footer" class="dialog-footer">
<el-button type="text" @click="dialog1Show=false">取消</el-button>
<el-button :loading="dialog1Saving" type="primary" @click="dialog1Submit">确认</el-button>
</div>
</el-dialog>
<!--弹出框2-->
<el-dialog append-to-body :close-on-click-modal="true" :visible.sync="dialog2Show" :title="'确认删除'" width="580px">
<div>
<span>确认要环境监测测点吗?</span>
</div>
<div>
<span>测点删除后,此测点的监测数据会一同删除!</span>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="dialog2Show=false">取消</el-button>
<el-button :loading="dialog2Saving" type="primary" @click="dialog2Submit">确认</el-button>
</div>
</el-dialog>
<!--弹出框3-->
<el-dialog append-to-body :close-on-click-modal="true" :visible.sync="dialog3Show" :title="'导入结果'" width="580px">
<div>
<span>共计成功导入:</span>
<span style="font-weight: bold;">{{ dialog3Data.successCount + dialog3Data.failCount }}</span>
<span>条,请核对总数。</span>
</div>
<div>
<span>其中,成功:</span>
<span style="color: #67C23A;">{{ dialog3Data.successCount }}</span>
<span>条;失败:</span>
<span style="color: #F56C6C;">{{ dialog3Data.failCount }}</span>
<span>条。</span>
</div>
<br>
<div v-if="dialog3Data.failCount">
<div><span>失败信息:</span></div>
<br>
<div v-for="failReason in dialog3Data.failReasonList" :key="failReason.index">
<span>{{ failReason.index }}条数据</span>
<span v-if="failReason.row" style="font-size: 10px;color: #909399;">{{ failReason.row }}</span>
<span v-if="failReason.col" style="font-size: 10px;color: #909399;">{{ failReason.col }}</span>
<span v-if="failReason.data" style="margin-left: 10px; color: #F56C6C;">{{ failReason.data }}</span>
<span style="margin-left: 10px;">{{ failReason.reason }}</span>
</div>
</div>
</el-dialog>
<!--表格--> <!--表格-->
<el-table ref="table" v-loading="searching" :data="tableData" row-key="id"> <el-table ref="table" v-loading="loading" :data="tableData" row-key="id">
<el-table-column :show-overflow-tooltip="true" prop="id" label="编号" width="100px" align="center" /> <el-table-column
<el-table-column :show-overflow-tooltip="true" prop="code" label="测点编号" align="center" /> :show-overflow-tooltip="true"
<el-table-column :show-overflow-tooltip="true" prop="name" label="测点名称" align="center" /> prop="equipno"
<el-table-column :show-overflow-tooltip="true" prop="monitoringType" label="测点类型" align="center"> label="站点编号"
<template slot-scope="scope"> width="130px"
<span>{{ (getMonitoringTypeByCode(scope.row.code)||{}).name }}</span> align="center"
</template> />
</el-table-column> <el-table-column
<el-table-column :show-overflow-tooltip="true" prop="monitoringPointDataType" label="测点数值类型" align="center"> :show-overflow-tooltip="true"
<template slot-scope="scope"> prop="equipname"
<span v-for="item in iotEnvironmentMachineApi.monitoringPointDataTypes()" v-show="item.key==scope.row.monitoringPointDataType" :key="item.key"> label="测站名称"
{{ item.value }} align="center"
</span> />
</template> <el-table-column
</el-table-column> :show-overflow-tooltip="true"
<el-table-column :show-overflow-tooltip="true" prop="unit" label="单位" align="center" /> prop="online"
<el-table-column :show-overflow-tooltip="true" prop="xxx" label="状态" align="center" /><!-- TODO 状态 --> label="设备状态"
<el-table-column label="操作" width="300px" align="center" fixed="right"> align="center"
<template slot-scope="scope"> />
<el-button size="mini" round @click="doEdit(scope.row.id,false)">查看</el-button> <el-table-column
<el-button size="mini" round @click="doEdit(scope.row.id,true)">修改</el-button> :show-overflow-tooltip="true"
<el-button size="mini" round @click="doDelete(scope.row.id)">删除</el-button> prop="datarealtime"
</template> label="监测时间"
align="center"
>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination <el-pagination
:page-sizes="[10, 20, 50, 100]" :page-sizes="[10, 20, 50, 100]"
:current-page.sync="searchParam.page" :current-page.sync="page"
:page-size.sync="searchParam.count" :page-size.sync="size"
:total="searchResult.total" :total="totalElement"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
@size-change="searchSubmit" @size-change="handleSizeChange"
@current-change="searchSubmit" @current-change="handleCurrentChange"
/> />
</div> </div>
</template> </template>
<script> <script>
import iotEnvironmentMachineApi from '@/api/kd/iotEnvironmentMachine' import API from "@/api/newResource/machine.js";
import AMapSearchPoint from '@/components/AMap/AMapSearchPoint' import { getToken } from "@/utils/auth";
import { getToken } from '@/utils/auth' import { mapGetters } from "vuex";
import { mapGetters } from 'vuex' import DateRangePicker from '@/components/DateRangePicker'
import { downloadFile } from '@/utils'
const searchParam = {// 默认搜索条件
page: 1,
count: 10,
searchCount: true
}
export default { export default {
name: 'EIotEnvironmentMachine', // 本页面名 name: "newResourceDisplaceMachine", // 本页面名
components: { AMapSearchPoint },
data() { data() {
return { return {
selectedMine: {}, equipname: '',
httpHeaders: { datarealtime: '',
'Authorization': getToken() loading: false,
}, tableData: [],
iotEnvironmentMachineApi: iotEnvironmentMachineApi, // 总的个数
searching: false, totalElement: 0,
exporting: false, // 当前页的条数
searchParam: {}, size: 10,
searchResult: { // 当前页码
total: 0, page: 1,
results: [] // 搜索结果 };
},
dialog1Show: false,
dialog1Editing: false,
dialog1Saving: false,
dialog1Data: {},
dialog1Rules: {
code: [{ required: true, message: '请填写' }],
name: [{ required: true, message: '请填写' }],
monitoringPointDataType: [{ required: true, message: '请选择' }]
},
editState: 0, // (刚打开窗口时)记录了上次窗口作用;(保存编辑时)记录了当前窗口作用; 0无 1新增 2修改 3查看
addingData: {}, // 上次正在新增时的内容,下次打开dialog1窗口时记录下来
dialog2Show: false,
dialog2Saving: false,
dialog2Data: {},
dialog3Show: false,
dialog3Data: {},
dialog3Saving: false
}
},
computed: {
...mapGetters([
'user'
]),
tableData() {
// 此处对返回值进行算法重组
return this.searchResult.results
},
mapPoint() {
if (this.dialog1Data.longitude && this.dialog1Data.latitude) {
return [this.dialog1Data.longitude * 1, this.dialog1Data.latitude * 1]
}
return null
}
}, },
components: { DateRangePicker },
mounted() { mounted() {
const selectedMineJson = window.localStorage.getItem('kd.selected.mine') this.search()
let noMine = false
if (!selectedMineJson) {
noMine = true
} else {
const selectedMine = JSON.parse(selectedMineJson)
if (!selectedMine || selectedMine.enterpriseId !== this.user.enterpriseId) {
noMine = true
} else {
this.selectedMine = selectedMine
}
}
// if (noMine) {
// this.$message.error('当前未选择矿山')
// this.$router.replace('/dashboard')
// }
this.searchParamReset()
this.searchSubmit()
}, },
methods: { methods: {
searchParamReset() { getData() {
this.searchParam = JSON.parse(JSON.stringify(searchParam)) this.loading = true;
}, API.getDataList({
searchSubmit() { page: this.page,
this.searching = true size: this.size,
this.searchParam.mineType = this.selectedMine.mineType datarealtime: this.datarealtime && this.datarealtime.join(',') || '',
this.searchParam.mineId = this.selectedMine.id equipname: this.equipname,
iotEnvironmentMachineApi.getPage(this.searchParam).then(response => { deviceType: '8',
this.searching = false different: '风速'
this.searchResult = response
}).catch(() => {
this.searching = false
})
},
exportSubmit() {
this.exporting = true
this.searchParam.mineType = this.selectedMine.mineType
this.searchParam.mineId = this.selectedMine.id
iotEnvironmentMachineApi.export(this.searchParam).then(response => {
downloadFile(response, '环境监测设备', 'xlsx')
this.exporting = false
}).catch(() => {
this.exporting = false
})
},
getMonitoringTypeByCode(code) {
return iotEnvironmentMachineApi.getMonitoringTypeByCode(code)
},
dialog1Submit() {
this.$refs['dialog1Form'].validate(valid => {
if (!valid) {
return
} else if (!this.getMonitoringTypeByCode(this.dialog1Data.code)) {
this.$message.error('请正确填写编号,需解析出【监测类型】')
} else {
this.dialog1Saving = true
this.removeOtherMonitoringPoint(this.dialog1Data)
if (this.editState === 1) { // 新增
this.dialog1Data.mineType = this.selectedMine.mineType
this.dialog1Data.mineId = this.selectedMine.id
iotEnvironmentMachineApi.add(this.dialog1Data).then(() => {
this.dialog1Show = false
this.$message.success('保存成功')
setTimeout(() => { // 立即清除会导致输入框Validate一闪变红
this.dialog1Data = {}
this.dialog1Saving = false
}, 500)
this.searchSubmit()
}).catch(() => {
this.dialog1Saving = false
})
} else if (this.editState === 2) { // 修改
iotEnvironmentMachineApi.set(this.dialog1Data).then(() => {
this.dialog1Show = false
this.$message.success('修改成功')
setTimeout(() => { // 立即清除会导致输入框Validate一闪变红
this.dialog1Data = {}
this.dialog1Saving = false
}, 500)
this.searchSubmit()
}).catch(() => {
this.dialog1Saving = false
})
} else {
this.$message.error('出错啦,请重试')
this.dialog1Saving = false
}
}
})
},
beforeDialog1Open() { // 窗口打开前的统一操作
if (this.editState === 1) {
this.addingData = this.dialog1Data
}
},
doAdd() {
this.beforeDialog1Open()
this.editState = 1
this.dialog1Editing = true
this.dialog1Data = this.addingData // 初始值:上次编辑的内容
this.dialog1Show = true
this.$nextTick(() => {
this.$refs['dialog1Form'].clearValidate()
}) })
}, .then((response) => {
doEdit(id, isEdit) { this.loading = false;
this.beforeDialog1Open() this.tableData = response.body.list;
this.editState = isEdit ? 2 : 3
iotEnvironmentMachineApi.getById(id).then(response => {
this.dialog1Data = response
this.dialog1Editing = isEdit
this.dialog1Show = true
this.$nextTick(() => {
this.$refs['dialog1Form'].clearValidate()
}) })
}).catch(() => { .catch(() => {
this.searchSubmit() this.loading = false;
}) });
},
dialog2Submit() {
this.dialog2Saving = true
iotEnvironmentMachineApi.del(this.dialog2Data).then(() => {
this.dialog2Show = false
this.$message.success('删除成功')
this.dialog2Data = {}
this.dialog2Saving = false
this.searchSubmit()
}).catch(() => {
this.dialog2Saving = false
})
},
doDelete(id) {
iotEnvironmentMachineApi.getById(id).then(response => {
this.dialog2Data = response
this.dialog2Show = true
}).catch(() => {
this.searchSubmit()
})
}, },
choosePoint(lnglat) { // 模糊搜索
if (lnglat) { search() {
this.$set(this.dialog1Data, 'longitude', lnglat[0]) this.getData();
this.$set(this.dialog1Data, 'latitude', lnglat[1])
} else {
this.$set(this.dialog1Data, 'longitude', null)
this.$set(this.dialog1Data, 'latitude', null)
}
}, },
beforeImport() { clearSearch() {
this.dialog3Saving = true this.equipname = ''
this.datarealtime = ''
this.size = 10;
this.page = 0;
this.getData();
}, },
importSuccess(response, file, fileList) { // 当前页的条数变化
this.dialog3Data = response handleSizeChange(val) {
this.dialog3Show = true this.size = val;
this.searchSubmit() this.getData();
this.dialog3Saving = false
}, },
importError(error) { // 当前第几页
this.$message.error('导入失败') handleCurrentChange(val) {
console.error('导入失败', error) this.page = val;
this.dialog3Saving = false this.getData();
}, },
/**
* 按照测点数据类型移除不属于此类型的多余数据。 },
* 例如:开关量时,移除量程、报警阈值等。 };
* @param {Object} data 将要提交的machine对象
*/
removeOtherMonitoringPoint(data) {
if (data.monitoringPointDataType !== 1) {
data.trueInfo = null
data.falseInfo = null
}
if (data.monitoringPointDataType !== 2) {
data.unit = null
data.rangeMax = null
data.rangeMin = null
data.thresholdLevel1 = null
data.thresholdLevel2 = null
data.thresholdLevel2Low = null
data.thresholdLevel1Low = null
}
}
}
}
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-input-number .el-input__inner { ::v-deep .el-input-number .el-input__inner {
text-align: left; text-align: left;
} }
::v-deep .vue-treeselect__control,::v-deep .vue-treeselect__placeholder,::v-deep .vue-treeselect__single-value { ::v-deep .vue-treeselect__control,
height: 30px; ::v-deep .vue-treeselect__placeholder,
line-height: 30px; ::v-deep .vue-treeselect__single-value {
} height: 30px;
line-height: 30px;
}
</style> </style>
...@@ -3,521 +3,154 @@ ...@@ -3,521 +3,154 @@
<!--工具栏--> <!--工具栏-->
<div class="head-container"> <div class="head-container">
<div> <div>
<el-input v-model="searchParam.nameLike" clearable size="small" placeholder="测点名称" style="width: 200px;" class="filter-item" /> <el-input
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="searchSubmit">搜索</el-button> v-model="equipname"
<el-button class="filter-item" size="mini" type="warning" icon="el-icon-refresh-left" @click="searchParamReset">重置</el-button> clearable
<el-tooltip class="item" effect="dark" content="按当前查询条件导出" placement="top"> size="small"
<el-button :loading="exporting" class="filter-item" size="mini" type="info" plain icon="el-icon-download" @click="exportSubmit">导出</el-button> placeholder="测点名称"
</el-tooltip> style="width: 200px"
class="filter-item"
/>
<date-range-picker v-model="datarealtime" class="date-item" />
<el-button
class="filter-item"
size="mini"
type="success"
icon="el-icon-search"
@click="search"
>搜索</el-button
>
<el-button
class="filter-item"
size="mini"
type="warning"
icon="el-icon-refresh-left"
@click="clearSearch"
>重置</el-button
>
</div> </div>
<el-button class="filter-item" size="mini" type="primary" icon="el-icon-plus" @click="doAdd()">新增</el-button>
<el-upload
class="filter-item"
action="/api/iot-normal-machine/environment/import"
multiple
:data="{mineType:selectedMine.mineType,mineId:selectedMine.id}"
:headers="httpHeaders"
:before-upload="beforeImport"
:on-success="importSuccess"
:on-error="importError"
:show-file-list="false"
>
<el-button :loading="dialog3Saving" size="mini" type="success" icon="el-icon-upload2">导入</el-button>
</el-upload>
</div> </div>
<!--弹出框1-->
<el-dialog append-to-body :close-on-click-modal="true" :visible.sync="dialog1Show" :title="editState==1?'新增':editState==2?'修改':'查看'" width="960px">
<el-form ref="dialog1Form" :hide-required-asterisk="!dialog1Editing" :model="dialog1Data" :rules="dialog1Rules" size="mini" label-width="180px" style="margin-right: 80px;">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="测点编号:" prop="code">
<span v-show="!dialog1Editing">{{ dialog1Data.code }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.code" :disabled="editState==2" maxlength="100" show-word-limit />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="测点名称:" prop="name">
<span v-show="!dialog1Editing">{{ dialog1Data.name }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.name" maxlength="100" show-word-limit />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="测点类型:" prop="monitoringType">
<span v-show="!dialog1Editing">{{ (getMonitoringTypeByCode(dialog1Data.code)||{}).name }}</span>
<el-input v-show="dialog1Editing" :disabled="true" :value="(getMonitoringTypeByCode(dialog1Data.code)||{}).name" show-word-limit />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="监测点数值类型:" prop="monitoringPointDataType">
<span v-for="item in iotEnvironmentMachineApi.monitoringPointDataTypes()" v-show="!dialog1Editing && item.key==dialog1Data.monitoringPointDataType" :key="item.key">
{{ item.value }}
</span>
<el-select v-show="dialog1Editing" v-model="dialog1Data.monitoringPointDataType" placeholder="请选择" style="width: 100%;">
<el-option v-for="item in iotEnvironmentMachineApi.monitoringPointDataTypes()" :key="item.key" :label="item.value" :value="item.key" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<template v-if="dialog1Data.monitoringPointDataType==2">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="测点单位:" prop="unit">
<span v-show="!dialog1Editing">{{ dialog1Data.unit }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.unit" maxlength="10" show-word-limit />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="量程上限:" prop="rangeMax">
<span v-show="!dialog1Editing">{{ dialog1Data.rangeMax }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.rangeMax" :precision="4" :controls="false" style="width: 100%;" :min="0" :max="999999" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="量程下限:" prop="rangeMin">
<span v-show="!dialog1Editing">{{ dialog1Data.rangeMin }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.rangeMin" :precision="4" :controls="false" style="width: 100%;" :min="0" :max="999999" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="报警超上限阈值:" prop="thresholdLevel1">
<span v-show="!dialog1Editing">{{ dialog1Data.thresholdLevel1 }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.thresholdLevel1" :precision="4" :controls="false" style="width: 100%;" :min="0" :max="999999" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="报警上限阈值:" prop="thresholdLevel2">
<span v-show="!dialog1Editing">{{ dialog1Data.thresholdLevel2 }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.thresholdLevel2" :precision="4" :controls="false" style="width: 100%;" :min="0" :max="999999" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="报警下限阈值:" prop="thresholdLevel2Low">
<span v-show="!dialog1Editing">{{ dialog1Data.thresholdLevel2Low }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.thresholdLevel2Low" :precision="4" :controls="false" style="width: 100%;" :min="0" :max="999999" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="报警超下限阈值:" prop="thresholdLevel1Low">
<span v-show="!dialog1Editing">{{ dialog1Data.thresholdLevel1Low }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.thresholdLevel1Low" :precision="4" :controls="false" style="width: 100%;" :min="0" :max="999999" />
</el-form-item>
</el-col>
</el-row>
</template>
<template v-if="dialog1Data.monitoringPointDataType==1">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="开描述:" prop="trueInfo">
<span v-show="!dialog1Editing">{{ dialog1Data.trueInfo }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.trueInfo" maxlength="100" show-word-limit />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="停描述:" prop="falseInfo">
<span v-show="!dialog1Editing">{{ dialog1Data.falseInfo }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.falseInfo" maxlength="100" show-word-limit />
</el-form-item>
</el-col>
</el-row>
</template>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="安装位置:" prop="place">
<span v-show="!dialog1Editing">{{ dialog1Data.place }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.place" maxlength="100" show-word-limit />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="安装位置描述:" prop="placeNote">
<span v-show="!dialog1Editing">{{ dialog1Data.placeNote }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.placeNote" maxlength="100" show-word-limit />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="高程:" prop="elevation">
<span v-show="!dialog1Editing">{{ dialog1Data.elevation }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.elevation" :precision="2" :controls="false" style="width: 100%;" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="监测对象:" prop="monitoringTo">
<span v-show="!dialog1Editing">{{ dialog1Data.monitoringTo }}</span>
<el-input v-show="dialog1Editing" v-model="dialog1Data.monitoringTo" maxlength="100" show-word-limit />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="经度:" prop="longitude">
<span v-show="!dialog1Editing">{{ dialog1Data.longitude }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.longitude" :precision="6" :controls="false" style="width: 100%;" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="纬度:" prop="latitude">
<span v-show="!dialog1Editing">{{ dialog1Data.latitude }}</span>
<el-input-number v-show="dialog1Editing" v-model="dialog1Data.latitude" :precision="6" :controls="false" style="width: 100%;" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item v-show="dialog1Editing || dialog1Data.longitude && dialog1Data.latitude" label="位置地图:">
<AMapSearchPoint :is-search="dialog1Editing" :point="mapPoint" @choosePoint="choosePoint" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div v-show="dialog1Editing" slot="footer" class="dialog-footer">
<el-button type="text" @click="dialog1Show=false">取消</el-button>
<el-button :loading="dialog1Saving" type="primary" @click="dialog1Submit">确认</el-button>
</div>
</el-dialog>
<!--弹出框2-->
<el-dialog append-to-body :close-on-click-modal="true" :visible.sync="dialog2Show" :title="'确认删除'" width="580px">
<div>
<span>确认要环境监测测点吗?</span>
</div>
<div>
<span>测点删除后,此测点的监测数据会一同删除!</span>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="dialog2Show=false">取消</el-button>
<el-button :loading="dialog2Saving" type="primary" @click="dialog2Submit">确认</el-button>
</div>
</el-dialog>
<!--弹出框3-->
<el-dialog append-to-body :close-on-click-modal="true" :visible.sync="dialog3Show" :title="'导入结果'" width="580px">
<div>
<span>共计成功导入:</span>
<span style="font-weight: bold;">{{ dialog3Data.successCount + dialog3Data.failCount }}</span>
<span>条,请核对总数。</span>
</div>
<div>
<span>其中,成功:</span>
<span style="color: #67C23A;">{{ dialog3Data.successCount }}</span>
<span>条;失败:</span>
<span style="color: #F56C6C;">{{ dialog3Data.failCount }}</span>
<span>条。</span>
</div>
<br>
<div v-if="dialog3Data.failCount">
<div><span>失败信息:</span></div>
<br>
<div v-for="failReason in dialog3Data.failReasonList" :key="failReason.index">
<span>{{ failReason.index }}条数据</span>
<span v-if="failReason.row" style="font-size: 10px;color: #909399;">{{ failReason.row }}</span>
<span v-if="failReason.col" style="font-size: 10px;color: #909399;">{{ failReason.col }}</span>
<span v-if="failReason.data" style="margin-left: 10px; color: #F56C6C;">{{ failReason.data }}</span>
<span style="margin-left: 10px;">{{ failReason.reason }}</span>
</div>
</div>
</el-dialog>
<!--表格--> <!--表格-->
<el-table ref="table" v-loading="searching" :data="tableData" row-key="id"> <el-table ref="table" v-loading="loading" :data="tableData" row-key="id">
<el-table-column :show-overflow-tooltip="true" prop="id" label="编号" width="100px" align="center" /> <el-table-column
<el-table-column :show-overflow-tooltip="true" prop="code" label="测点编号" align="center" /> :show-overflow-tooltip="true"
<el-table-column :show-overflow-tooltip="true" prop="name" label="测点名称" align="center" /> prop="equipno"
<el-table-column :show-overflow-tooltip="true" prop="monitoringType" label="测点类型" align="center"> label="站点编号"
<template slot-scope="scope"> width="130px"
<span>{{ (getMonitoringTypeByCode(scope.row.code)||{}).name }}</span> align="center"
</template> />
</el-table-column> <el-table-column
<el-table-column :show-overflow-tooltip="true" prop="monitoringPointDataType" label="测点数值类型" align="center"> :show-overflow-tooltip="true"
<template slot-scope="scope"> prop="equipname"
<span v-for="item in iotEnvironmentMachineApi.monitoringPointDataTypes()" v-show="item.key==scope.row.monitoringPointDataType" :key="item.key"> label="测站名称"
{{ item.value }} align="center"
</span> />
</template> <el-table-column
</el-table-column> :show-overflow-tooltip="true"
<el-table-column :show-overflow-tooltip="true" prop="unit" label="单位" align="center" /> prop="online"
<el-table-column :show-overflow-tooltip="true" prop="xxx" label="状态" align="center" /><!-- TODO 状态 --> label="设备状态"
<el-table-column label="操作" width="300px" align="center" fixed="right"> align="center"
<template slot-scope="scope"> />
<el-button size="mini" round @click="doEdit(scope.row.id,false)">查看</el-button> <el-table-column
<el-button size="mini" round @click="doEdit(scope.row.id,true)">修改</el-button> :show-overflow-tooltip="true"
<el-button size="mini" round @click="doDelete(scope.row.id)">删除</el-button> prop="datarealtime"
</template> label="监测时间"
align="center"
>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination <el-pagination
:page-sizes="[10, 20, 50, 100]" :page-sizes="[10, 20, 50, 100]"
:current-page.sync="searchParam.page" :current-page.sync="page"
:page-size.sync="searchParam.count" :page-size.sync="size"
:total="searchResult.total" :total="totalElement"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
@size-change="searchSubmit" @size-change="handleSizeChange"
@current-change="searchSubmit" @current-change="handleCurrentChange"
/> />
</div> </div>
</template> </template>
<script> <script>
import iotEnvironmentMachineApi from '@/api/kd/iotEnvironmentMachine' import API from "@/api/newResource/machine.js";
import AMapSearchPoint from '@/components/AMap/AMapSearchPoint' import { getToken } from "@/utils/auth";
import { getToken } from '@/utils/auth' import { mapGetters } from "vuex";
import { mapGetters } from 'vuex' import DateRangePicker from '@/components/DateRangePicker'
import { downloadFile } from '@/utils'
const searchParam = {// 默认搜索条件
page: 1,
count: 10,
searchCount: true
}
export default { export default {
name: 'EIotEnvironmentMachine', // 本页面名 name: "newResourceDisplaceMachine", // 本页面名
components: { AMapSearchPoint },
data() { data() {
return { return {
selectedMine: {}, equipname: '',
httpHeaders: { datarealtime: '',
'Authorization': getToken() loading: false,
}, tableData: [],
iotEnvironmentMachineApi: iotEnvironmentMachineApi, // 总的个数
searching: false, totalElement: 0,
exporting: false, // 当前页的条数
searchParam: {}, size: 10,
searchResult: { // 当前页码
total: 0, page: 1,
results: [] // 搜索结果 };
},
dialog1Show: false,
dialog1Editing: false,
dialog1Saving: false,
dialog1Data: {},
dialog1Rules: {
code: [{ required: true, message: '请填写' }],
name: [{ required: true, message: '请填写' }],
monitoringPointDataType: [{ required: true, message: '请选择' }]
},
editState: 0, // (刚打开窗口时)记录了上次窗口作用;(保存编辑时)记录了当前窗口作用; 0无 1新增 2修改 3查看
addingData: {}, // 上次正在新增时的内容,下次打开dialog1窗口时记录下来
dialog2Show: false,
dialog2Saving: false,
dialog2Data: {},
dialog3Show: false,
dialog3Data: {},
dialog3Saving: false
}
},
computed: {
...mapGetters([
'user'
]),
tableData() {
// 此处对返回值进行算法重组
return this.searchResult.results
},
mapPoint() {
if (this.dialog1Data.longitude && this.dialog1Data.latitude) {
return [this.dialog1Data.longitude * 1, this.dialog1Data.latitude * 1]
}
return null
}
}, },
components: { DateRangePicker },
mounted() { mounted() {
const selectedMineJson = window.localStorage.getItem('kd.selected.mine') this.search()
let noMine = false
if (!selectedMineJson) {
noMine = true
} else {
const selectedMine = JSON.parse(selectedMineJson)
if (!selectedMine || selectedMine.enterpriseId !== this.user.enterpriseId) {
noMine = true
} else {
this.selectedMine = selectedMine
}
}
// if (noMine) {
// this.$message.error('当前未选择矿山')
// this.$router.replace('/dashboard')
// }
this.searchParamReset()
this.searchSubmit()
}, },
methods: { methods: {
searchParamReset() { getData() {
this.searchParam = JSON.parse(JSON.stringify(searchParam)) this.loading = true;
}, API.getDataList({
searchSubmit() { page: this.page,
this.searching = true size: this.size,
this.searchParam.mineType = this.selectedMine.mineType datarealtime: this.datarealtime && this.datarealtime.join(',') || '',
this.searchParam.mineId = this.selectedMine.id equipname: this.equipname,
iotEnvironmentMachineApi.getPage(this.searchParam).then(response => { deviceType: '6',
this.searching = false
this.searchResult = response
}).catch(() => {
this.searching = false
})
},
exportSubmit() {
this.exporting = true
this.searchParam.mineType = this.selectedMine.mineType
this.searchParam.mineId = this.selectedMine.id
iotEnvironmentMachineApi.export(this.searchParam).then(response => {
downloadFile(response, '环境监测设备', 'xlsx')
this.exporting = false
}).catch(() => {
this.exporting = false
})
},
getMonitoringTypeByCode(code) {
return iotEnvironmentMachineApi.getMonitoringTypeByCode(code)
},
dialog1Submit() {
this.$refs['dialog1Form'].validate(valid => {
if (!valid) {
return
} else if (!this.getMonitoringTypeByCode(this.dialog1Data.code)) {
this.$message.error('请正确填写编号,需解析出【监测类型】')
} else {
this.dialog1Saving = true
this.removeOtherMonitoringPoint(this.dialog1Data)
if (this.editState === 1) { // 新增
this.dialog1Data.mineType = this.selectedMine.mineType
this.dialog1Data.mineId = this.selectedMine.id
iotEnvironmentMachineApi.add(this.dialog1Data).then(() => {
this.dialog1Show = false
this.$message.success('保存成功')
setTimeout(() => { // 立即清除会导致输入框Validate一闪变红
this.dialog1Data = {}
this.dialog1Saving = false
}, 500)
this.searchSubmit()
}).catch(() => {
this.dialog1Saving = false
})
} else if (this.editState === 2) { // 修改
iotEnvironmentMachineApi.set(this.dialog1Data).then(() => {
this.dialog1Show = false
this.$message.success('修改成功')
setTimeout(() => { // 立即清除会导致输入框Validate一闪变红
this.dialog1Data = {}
this.dialog1Saving = false
}, 500)
this.searchSubmit()
}).catch(() => {
this.dialog1Saving = false
})
} else {
this.$message.error('出错啦,请重试')
this.dialog1Saving = false
}
}
})
},
beforeDialog1Open() { // 窗口打开前的统一操作
if (this.editState === 1) {
this.addingData = this.dialog1Data
}
},
doAdd() {
this.beforeDialog1Open()
this.editState = 1
this.dialog1Editing = true
this.dialog1Data = this.addingData // 初始值:上次编辑的内容
this.dialog1Show = true
this.$nextTick(() => {
this.$refs['dialog1Form'].clearValidate()
}) })
}, .then((response) => {
doEdit(id, isEdit) { this.loading = false;
this.beforeDialog1Open() this.tableData = response.body.list;
this.editState = isEdit ? 2 : 3
iotEnvironmentMachineApi.getById(id).then(response => {
this.dialog1Data = response
this.dialog1Editing = isEdit
this.dialog1Show = true
this.$nextTick(() => {
this.$refs['dialog1Form'].clearValidate()
}) })
}).catch(() => { .catch(() => {
this.searchSubmit() this.loading = false;
}) });
},
dialog2Submit() {
this.dialog2Saving = true
iotEnvironmentMachineApi.del(this.dialog2Data).then(() => {
this.dialog2Show = false
this.$message.success('删除成功')
this.dialog2Data = {}
this.dialog2Saving = false
this.searchSubmit()
}).catch(() => {
this.dialog2Saving = false
})
},
doDelete(id) {
iotEnvironmentMachineApi.getById(id).then(response => {
this.dialog2Data = response
this.dialog2Show = true
}).catch(() => {
this.searchSubmit()
})
}, },
choosePoint(lnglat) { // 模糊搜索
if (lnglat) { search() {
this.$set(this.dialog1Data, 'longitude', lnglat[0]) this.getData();
this.$set(this.dialog1Data, 'latitude', lnglat[1])
} else {
this.$set(this.dialog1Data, 'longitude', null)
this.$set(this.dialog1Data, 'latitude', null)
}
}, },
beforeImport() { clearSearch() {
this.dialog3Saving = true this.equipname = ''
this.datarealtime = ''
this.size = 10;
this.page = 0;
this.getData();
}, },
importSuccess(response, file, fileList) { // 当前页的条数变化
this.dialog3Data = response handleSizeChange(val) {
this.dialog3Show = true this.size = val;
this.searchSubmit() this.getData();
this.dialog3Saving = false
}, },
importError(error) { // 当前第几页
this.$message.error('导入失败') handleCurrentChange(val) {
console.error('导入失败', error) this.page = val;
this.dialog3Saving = false this.getData();
}, },
/**
* 按照测点数据类型移除不属于此类型的多余数据。 },
* 例如:开关量时,移除量程、报警阈值等。 };
* @param {Object} data 将要提交的machine对象
*/
removeOtherMonitoringPoint(data) {
if (data.monitoringPointDataType !== 1) {
data.trueInfo = null
data.falseInfo = null
}
if (data.monitoringPointDataType !== 2) {
data.unit = null
data.rangeMax = null
data.rangeMin = null
data.thresholdLevel1 = null
data.thresholdLevel2 = null
data.thresholdLevel2Low = null
data.thresholdLevel1Low = null
}
}
}
}
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-input-number .el-input__inner { ::v-deep .el-input-number .el-input__inner {
text-align: left; text-align: left;
} }
::v-deep .vue-treeselect__control,::v-deep .vue-treeselect__placeholder,::v-deep .vue-treeselect__single-value { ::v-deep .vue-treeselect__control,
height: 30px; ::v-deep .vue-treeselect__placeholder,
line-height: 30px; ::v-deep .vue-treeselect__single-value {
} height: 30px;
line-height: 30px;
}
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment