Commit dfdedcb2 authored by zhangjianqian's avatar zhangjianqian

修改该设备监测

parent a8ad186e
var URL = "/danger"
export default { export default {
URL:'http://36.148.1.253:8901/danger', //URL:'http://36.148.1.253:8901/danger',
//URL:'http://127.0.0.1:60018/danger', URL:'http://127.0.0.1:60018/danger',
//URL:'http://192.168.2.6:8081/danger',
//URL:'http://36.148.23.59:8901/danger', //URL:'http://36.148.23.59:8901/danger',
// URL:URL,
titleArray: [], titleArray: [],
enterpriseId:'', enterpriseId:'',
componentUrl: { componentUrl: {
AlarmMg:'Alarm', AlarmMg:'Alarm',
monitorMg:'monitor',
EnseList:'EnseList', EnseList:'EnseList',
EnterprisesMg:'Enterprises', EnterprisesMg:'Enterprises',
EnterprisesCheck:'Enterprises', EnterprisesCheck:'Enterprises',
......
<template> <template>
<div class="EnseList"> <div class="EnseList">
<el-row class="topBar"> <el-row class="topBar">
<el-col> <el-col>
<el-form :inline="true" :model="searchData"> <el-form :inline="true" :model="searchData">
<el-form-item label=""> <el-form-item label="" v-if ="enterpriseId=='all'">
<el-select v-model="searchData.dataType" placeholder="请选择设备类型"> <el-select v-model="searchData.enterpriseId" placeholder="请选择公司" >
<el-option label="监控设备" value="1"></el-option> <el-option
<el-option label="传感器" value="2"></el-option> v-for="item in companyTableData.pageData"
</el-select> :key="item.enterpriseId"
</el-form-item> :label="item.unitName==null?'':item.unitName"
<el-form-item label=""> :value="item.enterpriseId"
<el-input v-model="searchData.deviceName" placeholder="请输入设备名称"></el-input> ></el-option>
</el-form-item> </el-select>
<el-form-item label=""> </el-form-item>
<el-input v-model="searchData.deviceNumber" placeholder="请输入设备号"></el-input> <el-form-item label="">
</el-form-item> <el-select v-model="searchData.dataType" placeholder="请选择设备类型">
<el-form-item label=""> <el-option label="监控设备" value="1"></el-option>
<el-input v-model="searchData.shortNum" placeholder="请输入设备短号"></el-input> <el-option label="预警设备" value="2"></el-option>
</el-form-item> <el-option label="传感器" value="3"></el-option>
<el-form-item> </el-select>
<el-button type="primary" @click="searchFun()"> </el-form-item>
<i class="el-icon-search"></i> 搜索 <el-form-item label="">
</el-button> <el-input v-model="searchData.deviceName" placeholder="请输入设备名称"></el-input>
<el-button type="primary" @click="resetFun()"> </el-form-item>
<i class="el-icon-refresh"></i> 重置 <el-form-item label="">
</el-button> <el-input v-model="searchData.deviceNumber" placeholder="请输入设备号"></el-input>
</el-form-item> </el-form-item>
<el-form-item class="fr"> <!--<el-form-item label="">-->
<el-button plain type="primary" @click="addFun()"> <!--<el-input v-model="searchData.shortNum" placeholder="请输入设备短号"></el-input>-->
<i class="el-icon-plus"></i> 新增 <!--</el-form-item>-->
</el-button> <el-form-item>
</el-form-item> <el-button type="primary" @click="searchFun()">
</el-form> <i class="el-icon-search"></i> 搜索
</el-col> </el-button>
</el-row> <el-button type="primary" @click="resetFun()">
<el-table :data="tableData.pageData" stripe border style="width:100%;" :loading="loading"> <i class="el-icon-refresh"></i> 重置
<el-table-column width="50" type="index" label="序号"></el-table-column> </el-button>
<el-table-column prop="enterpriseName" label="企业名称"></el-table-column> </el-form-item>
<el-input type="hidden" pro="enterpriseId"></el-input> <el-form-item class="fr">
<el-table-column prop="deviceName" label="设备名称"></el-table-column> <el-button plain type="primary" @click="addFun()">
<el-table-column prop="deviceName" label="设备类型"> <i class="el-icon-plus"></i> 新增
<template slot-scope="scope"> </el-button>
<font>{{ scope.row.dataType == 1 ? '监控设备' : '传感器'}}</font> </el-form-item>
</template> </el-form>
</el-table-column> </el-col>
<el-table-column prop="deviceIp" label="设备IP"></el-table-column> </el-row>
<el-table-column prop="deviceNumber" label="设备编号"></el-table-column> <el-table :data="tableData.pageData" stripe border style="width:100%;" :loading="loading">
<el-table-column prop="shortNum" label="设备短号"></el-table-column> <el-table-column width="50" type="index" label="序号"></el-table-column>
<el-table-column prop="goodsName" label="所在厂区位置"></el-table-column> <el-table-column prop="enterpriseName" label="企业名称"></el-table-column>
<!-- <el-table-column prop="stockNum" label="库存数量"></el-table-column> --> <el-input type="hidden" pro="enterpriseId"></el-input>
<!-- <el-table-column prop="dangerGrade" label="危险等级"></el-table-column> --> <el-table-column prop="deviceName" label="设备名称"></el-table-column>
<el-table-column label="操作" width="220" align="center"> <el-table-column label="设备类型">
<template slot-scope="scope"> <template scope="scope">
<el-button @click="editFun(scope.row)" size="small">编辑</el-button> <p v-if="scope.row.dataType=='1'">
<el-button type="danger" @click="delFun(scope.row)" size="small">删除</el-button> 监控设备
</template> </p>
</el-table-column> <p v-if="scope.row.dataType=='2'">预警设备</p>
</el-table> <p v-if="scope.row.dataType=='3'">传感器</p>
<el-pagination background layout="total,sizes, prev, pager, next, jumper" :total="tableData.total" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="PAGE.page" :page-size="PAGE.size"></el-pagination> </template>
<SafetyDeviceMgEdit :dialogVisible="dialogVisible" :editForm="formData" :title="dialogTit" @dialogFun="closeDialog" @refreshTableData="getTableData" :key="zjKey"></SafetyDeviceMgEdit> <!--<template slot-scope="scope">-->
</div> <!--<font>{{ scope.row.dataType == 1 ? '监控设备' : '传感器'}}</font>-->
<!--</template>-->
</el-table-column>
<el-table-column prop="deviceIp" label="设备IP"></el-table-column>
<el-table-column prop="deviceNumber" label="设备编号"></el-table-column>
<el-table-column prop="shortNum" label="设备短号"></el-table-column>
<el-table-column prop="goodsName" label="所在厂区位置"></el-table-column>
<!-- <el-table-column prop="stockNum" label="库存数量"></el-table-column> -->
<!-- <el-table-column prop="dangerGrade" label="危险等级"></el-table-column> -->
<el-table-column label="操作" width="220" align="center">
<template slot-scope="scope">
<el-button @click="editFun(scope.row)" size="small">编辑</el-button>
<el-button type="danger" @click="delFun(scope.row)" size="small">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination background layout="total,sizes, prev, pager, next, jumper" :total="tableData.total" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="PAGE.page" :page-size="PAGE.size"></el-pagination>
<SafetyDeviceMgEdit :dialogVisible="dialogVisible" :editForm="formData" :title="dialogTit" @dialogFun="closeDialog" @refreshTableData="getTableData" :key="zjKey"></SafetyDeviceMgEdit>
</div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { import {
Component, Component,
Vue, Vue,
Provide Provide
} from "vue-property-decorator"; } from "vue-property-decorator";
import SafetyDeviceMgEdit from "./SafetyDeviceMgEdit.vue"; import SafetyDeviceMgEdit from "./SafetyDeviceMgEdit.vue";
import METHOD from "@/utils/methods"; import METHOD from "@/utils/methods";
@Component({ @Component({
components: { components: {
SafetyDeviceMgEdit SafetyDeviceMgEdit
} }
}) })
export default class SafetyDeviceMg extends Vue { export default class SafetyDeviceMg extends Vue {
@Provide() tableData: Object = { @Provide() tableData: Object = {
pageData: [], pageData: [],
total: 0 total: 0
}; };
@Provide() PAGE: any = { @Provide() companyTableData: Object = {
page: 1, pageData: [],
size: 10 total: 0
}; };
@Provide() searchData: any = { @Provide() PAGE: any = {
deviceName: "",
deviceNumber: "",
shortNum: "",
dataType: '',
};
@Provide() loading: Boolean = false;
//编辑组件
@Provide() dialogVisible: Boolean = false;
@Provide() dialogTit: String = "新增";
@Provide() formData: any = {
dataType: "",
enterpriseId: ""
};
@Provide() zjKey: any = 0;
@Provide() enterpriseId: string = "all";
@Provide() dataType: string = "";
getTableData() {
let that = this,
param = Object.assign({}, that.PAGE, that.searchData);
that.enterpriseId="all";
that.loading = true;
METHOD.axiosPost(
that,
`/safetyDeviceInfo/selectSafetyDeviceInfoList/${that.enterpriseId}`,
param,
function (res: any) {
that.loading = false;
if (res.code == 0) {
that.tableData = res.data;
}
}
);
}
searchFun() {
this.PAGE = {
page: 1, page: 1,
size: 10 size: 10
}; };
this.getTableData(); @Provide() PAGE2: any = {
}
resetFun() {
this.PAGE = {
page: 1, page: 1,
size: 10 size: 100
}; };
this.searchData = { @Provide() searchData: any = {
deviceName: "", deviceName: "",
deviceNumber: "", deviceNumber: "",
shortNum: "", shortNum: "",
dataType: '' dataType: '',
enterpriseId:''
}; };
this.getTableData(); @Provide() loading: Boolean = false;
} //编辑组件
addFun() { @Provide() dialogVisible: Boolean = false;
this.zjKey++; @Provide() dialogTit: String = "新增";
this.dialogVisible = true; @Provide() formData: any = {
//this.formData.dataType = this.searchData.dataType; dataType: "",
if(METHOD.enterpriseId){ enterpriseId: ""
this.formData.enterpriseId = METHOD.enterpriseId; };
@Provide() zjKey: any = 0;
@Provide() enterpriseId: string = "all";
@Provide() dataType: string = "";
getTableData() {
console.log(this.searchData)
let that = this,
param = Object.assign({}, that.PAGE, that.searchData);
//that.enterpriseId="all";
that.loading = true;
METHOD.axiosPost(
that,
`/safetyDeviceInfo/selectSafetyDeviceInfoList/${that.enterpriseId}`,
param,
function (res: any) {
that.loading = false;
if (res.code == 0) {
that.tableData = res.data;
}
}
);
} }
} getCompanyTableData() {
editFun(row: any) { let that = this,
this.dialogTit = "编辑"; param = Object.assign({accountStatus:'0'}, that.PAGE2, that.searchData);
this.formData = Object.assign({}, row); that.loading = true;
this.zjKey++; METHOD.axiosPost(
this.dialogVisible = true; that,
} `/enterpriseInfo/queryEnterpriseInfo`,
delFun(row: any) { param,
let that = this as any; function(res: any) {
METHOD.deleteFun( that.loading = false;
this, if (res.code == 0) {
`/safetyDeviceInfo/deleteSafetyDeviceInfoById/${row.id}`, console.log(res.data)
function () { that.companyTableData = res.data;
that.getTableData(); }
}
);
}
searchFun() {
this.PAGE = {
page: 1,
size: 10
};
this.getTableData();
}
resetFun() {
this.PAGE = {
page: 1,
size: 10
};
this.searchData = {
deviceName: "",
deviceNumber: "",
shortNum: "",
dataType: ''
};
this.getTableData();
}
addFun() {
this.zjKey++;
this.dialogVisible = true;
//this.formData.dataType = this.searchData.dataType;
if(METHOD.enterpriseId){
this.formData.enterpriseId = METHOD.enterpriseId;
} }
); }
} editFun(row: any) {
handleSizeChange(val: any) { this.dialogTit = "编辑";
this.PAGE.size = val; this.formData = Object.assign({}, row);
this.getTableData(); this.zjKey++;
} this.dialogVisible = true;
handleCurrentChange(val: any) { }
this.PAGE.page = val; delFun(row: any) {
this.getTableData(); let that = this as any;
} METHOD.deleteFun(
closeDialog() { this,
//关闭窗口 `/safetyDeviceInfo/deleteSafetyDeviceInfoById/${row.id}`,
this.dialogVisible = false; function () {
this.formData = {}; that.getTableData();
} }
selectChange(val: any) { );
this.searchData.dataType = val; }
this.getTableData(); handleSizeChange(val: any) {
} this.PAGE.size = val;
created() { this.getTableData();
this.enterpriseId = METHOD.enterpriseId; }
this.getTableData(); handleCurrentChange(val: any) {
this.PAGE.page = val;
this.getTableData();
}
closeDialog() {
//关闭窗口
this.dialogVisible = false;
this.formData = {};
}
selectChange(val: any) {
this.searchData.dataType = val;
this.getTableData();
}
created() {
this.enterpriseId = "all";
let usd = sessionStorage.getItem("userInfo");
if (usd) {
if(JSON.parse(usd).accountType==2){
this.enterpriseId = METHOD.enterpriseId;
}
}
this.getTableData();
this.getCompanyTableData();
}
} }
}
</script> </script>
<style lang="scss"> <style lang="scss">
@import "@/utils/public.scss"; @import "@/utils/public.scss";
@media screen and (max-width: 1350px) { @media screen and (max-width: 1350px) {
main > div .el-table { main > div .el-table {
height: calc(100% - 180px); height: calc(100% - 180px);
}
} }
}
</style> </style>
<template> <template>
<div class="wrapper editwrap"> <div class="wrapper editwrap">
<el-dialog <el-dialog
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
:title="title" :title="title"
:show-close="false" :show-close="false"
:close-on-click-modal="false" :close-on-click-modal="false"
> >
<el-form ref="editForm" :model="editForm" :rules="rules" label-width="106px"> <el-form ref="editForm" :model="editForm" :rules="rules" label-width="106px">
<el-form-item label="选择企业" prop="enterpriseId" v-if="play"> <el-form-item label="选择企业" prop="enterpriseId" v-if="play">
...@@ -20,7 +20,8 @@ ...@@ -20,7 +20,8 @@
<el-form-item label="设备类型" prop="dataType"> <el-form-item label="设备类型" prop="dataType">
<el-select v-model="editForm.dataType"> <el-select v-model="editForm.dataType">
<el-option label="监控设备" value="1"></el-option> <el-option label="监控设备" value="1"></el-option>
<el-option label="传感器" value="2"></el-option> <el-option label="预警设备" value="2"></el-option>
<el-option label="传感器" value="3"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="设备名称" prop="deviceName"> <el-form-item label="设备名称" prop="deviceName">
...@@ -76,9 +77,12 @@ ...@@ -76,9 +77,12 @@
<el-form-item label="联系电话" prop="phone"> <el-form-item label="联系电话" prop="phone">
<el-input v-model="editForm.phone"></el-input> <el-input v-model="editForm.phone"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="物品类型" prop="category"> <el-form-item label="监测介质" prop="category">
<el-input v-model="editForm.category"></el-input> <el-input v-model="editForm.category"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="单位" prop="unit">
<el-input v-model="editForm.unit"></el-input>
</el-form-item>
<!--<el-form-item label="否是重大危险源" prop="isBigDanger"> <!--<el-form-item label="否是重大危险源" prop="isBigDanger">
<el-radio-group v-model="editForm.isBigDanger"> <el-radio-group v-model="editForm.isBigDanger">
<el-radio :label="'0'"></el-radio> <el-radio :label="'0'"></el-radio>
...@@ -103,156 +107,160 @@ ...@@ -103,156 +107,160 @@
</span> </span>
</el-dialog> </el-dialog>
<Mapdialog <Mapdialog
v-if="loadmap" v-if="loadmap"
:dialogTableVisible="dialogTableVisible" :dialogTableVisible="dialogTableVisible"
@dialogcancelFun="dialogcancelFun" @dialogcancelFun="dialogcancelFun"
:slat="editForm.latitude" :slat="editForm.latitude"
:slng="editForm.longitude" :slng="editForm.longitude"
@confirm="qrFun" @confirm="qrFun"
/> />
</div> </div>
</template> </template>
<style lang="scss"> <style lang="scss">
</style> </style>
<script lang="ts"> <script lang="ts">
import { Component, Vue, Provide, Prop, Watch } from "vue-property-decorator"; import { Component, Vue, Provide, Prop, Watch } from "vue-property-decorator";
import { State, Getter, Mutation, Action } from "vuex-class"; import { State, Getter, Mutation, Action } from "vuex-class";
import Mapdialog from "@/components/maplnglat.vue"; import Mapdialog from "@/components/maplnglat.vue";
import METHOD from "@/utils/methods"; import METHOD from "@/utils/methods";
@Component({ @Component({
components: { Mapdialog } components: { Mapdialog }
}) })
export default class SafetyDeviceMgEdit extends Vue { export default class SafetyDeviceMgEdit extends Vue {
//属性或参数中使用!:表示强制解析(告诉typescript编译器,这里一定有值),常用于vue-decorator中的@Prop //属性或参数中使用!:表示强制解析(告诉typescript编译器,这里一定有值),常用于vue-decorator中的@Prop
@Prop(Boolean) dialogVisible!: Boolean; @Prop(Boolean) dialogVisible!: Boolean;
@Provide() loading: Boolean = false; @Provide() loading: Boolean = false;
@Prop(Object) editForm!: { @Prop(Object) editForm!: {
deviceName: String; deviceName: String;
longitude: Number; longitude: Number;
latitude: Number; latitude: Number;
dataType: String; dataType: String;
enterpriseId: String; enterpriseId: String;
}; unit:String;
@Prop(String) title!: String; };
// @Provide() editForm: any = {}; @Prop(String) title!: String;
@Provide() enterpriseList: any = []; // @Provide() editForm: any = {};
@Provide() qvvalue: any = []; //区域值 @Provide() enterpriseList: any = [];
@Provide() signsArr: any = []; //图例list @Provide() qvvalue: any = []; //区域值
@Provide() dialogTableVisible: Boolean = false; @Provide() signsArr: any = []; //图例list
@Provide() rules: any = { @Provide() dialogTableVisible: Boolean = false;
enterpriseId: [{ required: true, trigger: "blur", message: "该项为必填项!" }], @Provide() rules: any = {
deviceName: [ enterpriseId: [{ required: true, trigger: "blur", message: "该项为必填项!" }],
{ required: true, trigger: "blur", message: "该项为必填项!" } deviceName: [
], { required: true, trigger: "blur", message: "该项为必填项!" }
dataType: [{ required: true, trigger: "blur", message: "该项为必填项!" }], ],
/*isBigDanger: [ deviceNumber:[
{ required: true, trigger: "blur", message: "该项为必填项!" } { required: true, trigger: "blur", message: "该项为必填项!" }
], ],
dangerGrade: [ dataType: [{ required: true, trigger: "blur", message: "该项为必填项!" }],
{ required: true, trigger: "blur", message: "该项为必填项!" } /*isBigDanger: [
],*/ { required: true, trigger: "blur", message: "该项为必填项!" }
factoryLocation: [ ],
{ required: true, trigger: "blur", message: "该项为必填项!" } dangerGrade: [
], { required: true, trigger: "blur", message: "该项为必填项!" }
longitude: [{ required: true, trigger: "blur", message: "该项为必填项!" }], ],*/
latitude: [{ required: true, trigger: "blur", message: "该项为必填项!" }] factoryLocation: [
}; { required: true, trigger: "blur", message: "该项为必填项!" }
@Provide() loadmap: Boolean = false; ],
@Provide() play: Boolean = false; longitude: [{ required: true, trigger: "blur", message: "该项为必填项!" }],
@Provide() enterpriseId: string = "dbe0c3268a3c4911913f35a2fdcd0e3e"; latitude: [{ required: true, trigger: "blur", message: "该项为必填项!" }]
};
@Provide() loadmap: Boolean = false;
@Provide() play: Boolean = false;
@Provide() enterpriseId: string = "dbe0c3268a3c4911913f35a2fdcd0e3e";
qrFun(v: any) { qrFun(v: any) {
//确认选择经纬度 //确认选择经纬度
this.editForm.longitude = v.lng; this.editForm.longitude = v.lng;
this.editForm.latitude = v.lat; this.editForm.latitude = v.lat;
} }
MapdialogFun() { MapdialogFun() {
this.loadmap = false; this.loadmap = false;
this.$nextTick(() => { this.$nextTick(() => {
this.loadmap = true; this.loadmap = true;
}); });
this.dialogTableVisible = true; this.dialogTableVisible = true;
} }
dialogcancelFun() { dialogcancelFun() {
this.dialogTableVisible = false; this.dialogTableVisible = false;
} }
//取消事件要在父级取消是所以用到 $emit //取消事件要在父级取消是所以用到 $emit
confirmFun(formName: string) { confirmFun(formName: string) {
let that = this, let that = this,
params = that.editForm; params = that.editForm;
(that as any).$refs[formName].validate((valid: boolean) => { (that as any).$refs[formName].validate((valid: boolean) => {
if (valid) { if (valid) {
METHOD.axiosPost(
that,
`/safetyDeviceInfo/addOrEditSafetyDeviceInfo`,
params,
function(res: any) {
if (res.code == 0) {
(that as any).$emit("dialogFun");
(that as any).$message({
message: "操作成功!",
type: "success"
});
that.$emit("refreshTableData"); //刷新表格
}
}
);
} else {
return false;
}
});
}
getnterpriseListInfo() {
let that = this,
param ={accountStatus:'0'};
that.loading = true;
METHOD.axiosPost( METHOD.axiosPost(
that, that,
`/safetyDeviceInfo/addOrEditSafetyDeviceInfo`, `/enterpriseInfo/queryEnterpriseListInfo`,
params, param,
function(res: any) { function(res: any) {
if (res.code == 0) { that.loading = false;
(that as any).$emit("dialogFun"); if (res.code == 0) {
(that as any).$message({ that.enterpriseList = res.data;
message: "操作成功!", }
type: "success"
});
that.$emit("refreshTableData"); //刷新表格
} }
}
); );
} else { }
return false; getnterpriseListInfo() {
} let that = this,
}); param ={accountStatus:'0'};
} that.loading = true;
getnterpriseListInfo() { METHOD.axiosPost(
let that = this, that,
param ={accountStatus:'0'}; `/enterpriseInfo/queryEnterpriseListInfo`,
that.loading = true; param,
METHOD.axiosPost( function(res: any) {
that, that.loading = false;
`/enterpriseInfo/queryEnterpriseListInfo`, if (res.code == 0) {
param, that.enterpriseList = res.data;
function(res: any) { }
that.loading = false;
if (res.code == 0) {
that.enterpriseList = res.data;
}
}
);
}
getnterpriseListInfo() {
let that = this,
param ={accountStatus:'0'};
that.loading = true;
METHOD.axiosPost(
that,
`/enterpriseInfo/queryEnterpriseListInfo`,
param,
function(res: any) {
that.loading = false;
if (res.code == 0) {
that.enterpriseList = res.data;
} }
);
}
seletChange(enterpriseId: any) {
let that = this,
arr;
arr = that.enterpriseList.filter((ele: any) => enterpriseId == ele.enterpriseId);
that.editForm.enterpriseListId = arr[0].enterpriseId;
}
created() {
//this.editForm = this.editFormData;
if(METHOD.enterpriseId){
this.enterpriseId = METHOD.enterpriseId;
}else{
//政府用户
this.play = true;
this.getnterpriseListInfo();
} }
); }
} }
seletChange(enterpriseId: any) {
let that = this,
arr;
arr = that.enterpriseList.filter((ele: any) => enterpriseId == ele.enterpriseId);
that.editForm.enterpriseListId = arr[0].enterpriseId;
}
created() {
//this.editForm = this.editFormData;
if(METHOD.enterpriseId){
this.enterpriseId = METHOD.enterpriseId;
}else{
//政府用户
this.play = true;
this.getnterpriseListInfo();
}
}
}
</script> </script>
<style lang="scss"> <style lang="scss">
@import "@/utils/public.scss"; @import "@/utils/public.scss";
</style> </style>
...@@ -561,7 +561,7 @@ ...@@ -561,7 +561,7 @@
addMark(obj: any, index: any) { addMark(obj: any, index: any) {
let icon, let icon,
that = this; that = this;
icon = require("@/assets/mark/markqy.png"); icon = require("@/assets/mark/markmapqy.png");
let option = { let option = {
position: [Number(obj.longitude), Number(obj.latitude)], position: [Number(obj.longitude), Number(obj.latitude)],
content: ` <img src="${icon}" width="25">`, content: ` <img src="${icon}" width="25">`,
......
<template>
<div class="EnseList">
<el-row class="topBar">
<el-col>
<el-form :inline="true" :model="searchData" >
<el-form-item label="" v-if ="enterpriseId=='all'" >
<el-select v-model="searchData.enterpriseId" placeholder="请选择公司" >
<el-option
v-for="item in companyTableData.pageData"
:key="item.enterpriseId"
:label="item.unitName==null?'':item.unitName"
:value="item.enterpriseId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="">
<el-input v-model="searchData.deviceName" placeholder="请输入设备名称"></el-input>
</el-form-item>
<el-form-item label="">
<el-input v-model="searchData.deviceNumber" placeholder="请输入设备号"></el-input>
</el-form-item>
<!--<el-form-item label="">-->
<!--<el-input v-model="searchData.shortNum" placeholder="请输入设备短号"></el-input>-->
<!--</el-form-item>-->
<el-form-item>
<el-button type="primary" @click="searchFun()">
<i class="el-icon-search"></i> 搜索
</el-button>
<el-button type="primary" @click="resetFun()">
<i class="el-icon-refresh"></i> 重置
</el-button>
</el-form-item>
<!--<el-form-item class="fr">-->
<!--<el-button plain type="primary" @click="addFun()">-->
<!--<i class="el-icon-plus"></i> 新增-->
<!--</el-button>-->
<!--</el-form-item>-->
</el-form>
</el-col>
</el-row>
<el-table :data="tableData.pageData" stripe border style="width:100%;" :loading="loading">
<el-table-column width="50" type="index" label="序号"></el-table-column>
<el-table-column prop="enterpriseName" label="企业名称"></el-table-column>
<el-input type="hidden" pro="enterpriseId"></el-input>
<el-table-column prop="deviceName" label="设备名称"></el-table-column>
<el-table-column prop="deviceNum" label="设备编号"></el-table-column>
<el-table-column prop="category" label="检测介质"></el-table-column>
<el-table-column prop="concentration" label="浓度"></el-table-column>
<el-table-column prop="unit" label="单位"></el-table-column>
<el-table-column prop="status" label="状态">
<template scope="scope">
<p v-if="scope.row.status=='1'"> 正常</p>
<p v-if="scope.row.status=='2'">错误</p>
<p v-if="scope.row.status=='3'">传感器故障</p>
<p v-if="scope.row.status=='4'"> 报警</p>
<p v-if="scope.row.status=='5'">低报</p>
<p v-if="scope.row.status=='6'">高报</p>
<p v-if="scope.row.status=='7'"> 通信故障</p>
<p v-if="scope.row.status=='8'">超量程</p>
<p v-if="scope.row.status=='9'"> 离线</p>
<p v-if="scope.row.status=='10'">电量低</p>
<p v-if="scope.row.status=='13'">无此节点</p>
<p v-if="scope.row.status=='14'"> 低电压</p>
<p v-if="scope.row.status=='15'">故障</p>
<p v-if="scope.row.status=='16'">报警联动</p>
</template>
</el-table-column>
<el-table-column prop="createTime" label="检测时间"></el-table-column>
<!-- <el-table-column prop="stockNum" label="库存数量"></el-table-column> -->
<!-- <el-table-column prop="dangerGrade" label="危险等级"></el-table-column> -->
<!--<el-table-column label="操作" width="220" align="center">-->
<!--<template slot-scope="scope">-->
<!--<el-button @click="editFun(scope.row)" size="small">编辑</el-button>-->
<!--<el-button type="danger" @click="delFun(scope.row)" size="small">删除</el-button>-->
<!--</template>-->
<!--</el-table-column>-->
</el-table>
<el-pagination background layout="total,sizes, prev, pager, next, jumper" :total="tableData.total" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="PAGE.page" :page-size="PAGE.size"></el-pagination>
</div>
</template>
<script lang="ts">
import {
Component,
Vue,
Provide
} from "vue-property-decorator";
import METHOD from "@/utils/methods";
@Component({
components: {
}
})
export default class SafetyDeviceMg extends Vue {
@Provide() tableData: Object = {
pageData: [],
total: 0
};
@Provide() companyTableData: Object = {
pageData: [],
total: 0
};
@Provide() PAGE: any = {
page: 1,
size: 10
};
@Provide() PAGE2: any = {
page: 1,
size: 100
};
@Provide() searchData: any = {
deviceName: "",
deviceNumber: "",
shortNum: "",
dataType: '',
enterpriseId:''
};
@Provide() loading: Boolean = false;
//编辑组件
@Provide() dialogVisible: Boolean = false;
@Provide() dialogTit: String = "新增";
@Provide() formData: any = {
dataType: "",
enterpriseId: ""
};
@Provide() zjKey: any = 0;
@Provide() enterpriseId: string = "all";
@Provide() dataType: string = "";
getTableData() {
let that = this,
param = Object.assign({}, that.PAGE, that.searchData);
//that.enterpriseId="all";
that.loading = true;
METHOD.axiosPost(
that,
`/safetyDeviceInfo/getDeviceSensor/${that.enterpriseId}`,
param,
function (res: any) {
that.loading = false;
if (res.code == 0) {
that.tableData = res.data;
console.log(res.data)
}
}
);
}
getCompanyTableData() {
let that = this,
param = Object.assign({accountStatus:'0'}, that.PAGE2, that.searchData);
that.loading = true;
METHOD.axiosPost(
that,
`/enterpriseInfo/queryEnterpriseInfo`,
param,
function(res: any) {
that.loading = false;
if (res.code == 0) {
console.log(res.data)
that.companyTableData = res.data;
}
}
);
}
searchFun() {
this.PAGE = {
page: 1,
size: 10
};
this.getTableData();
}
resetFun() {
this.PAGE = {
page: 1,
size: 10
};
this.searchData = {
deviceName: "",
deviceNumber: "",
enterpriseName:"",
shortNum: "",
dataType: ''
};
this.getTableData();
}
addFun() {
this.zjKey++;
this.dialogVisible = true;
//this.formData.dataType = this.searchData.dataType;
if(METHOD.enterpriseId){
this.formData.enterpriseId = METHOD.enterpriseId;
}
}
editFun(row: any) {
this.dialogTit = "编辑";
this.formData = Object.assign({}, row);
this.zjKey++;
this.dialogVisible = true;
}
delFun(row: any) {
let that = this as any;
METHOD.deleteFun(
this,
`/safetyDeviceInfo/deleteSafetyDeviceInfoById/${row.id}`,
function () {
that.getTableData();
}
);
}
handleSizeChange(val: any) {
this.PAGE.size = val;
this.getTableData();
}
handleCurrentChange(val: any) {
this.PAGE.page = val;
this.getTableData();
}
closeDialog() {
//关闭窗口
this.dialogVisible = false;
this.formData = {};
}
selectChange(val: any) {
this.searchData.dataType = val;
this.getTableData();
}
created() {
this.enterpriseId = "all";
let usd = sessionStorage.getItem("userInfo");
if (usd) {
if(JSON.parse(usd).accountType==2){
this.enterpriseId = METHOD.enterpriseId;
}
}
//this.enterpriseId = METHOD.enterpriseId;
this.getTableData();
this.getCompanyTableData();
}
}
</script>
<style lang="scss">
@import "@/utils/public.scss";
@media screen and (max-width: 1350px) {
main > div .el-table {
height: calc(100% - 180px);
}
}
</style>
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
</div> </div>
<div @click="mapwh" class="markbox-div" ref="wh"> <div @click="mapwh" class="markbox-div" ref="wh">
<div ref="whimg" class="markbox-click" style="width: 30%;height: 100%;float: left;text-align: right;"> <div ref="whimg" class="markbox-click" style="width: 30%;height: 100%;float: left;text-align: right;">
<img width="32px" src="@/assets/mark/weihaichangsuo.png" /> <img width="32px" src="@/assets/mark/weihai.png" />
</div> </div>
<div class="markbox-span" ref="zwh" style="width: 70%;height: 100%;float: left;text-align: center;line-height: 10px;padding-top: 18px;"> <div class="markbox-span" ref="zwh" style="width: 70%;height: 100%;float: left;text-align: center;line-height: 10px;padding-top: 18px;">
<span>职业危害场所<p></p><span style="font-family: 'UnidreamLED';font-size: 1.5rem;">{{tjNumberObj.harmNum}}</span></span> <span>职业危害场所<p></p><span style="font-family: 'UnidreamLED';font-size: 1.5rem;">{{tjNumberObj.harmNum}}</span></span>
...@@ -581,7 +581,7 @@ ...@@ -581,7 +581,7 @@
addMark(obj: any, index: any) { addMark(obj: any, index: any) {
let icon, let icon,
that = this; that = this;
icon = require("@/assets/mark/markqy.png"); icon = require("@/assets/mark/markmapqy.png");
let option = { let option = {
position: [Number(obj.longitude), Number(obj.latitude)], position: [Number(obj.longitude), Number(obj.latitude)],
content: ` <img src="${icon}" width="25">`, content: ` <img src="${icon}" width="25">`,
...@@ -933,6 +933,7 @@ ...@@ -933,6 +933,7 @@
console.log("qyyedianji") console.log("qyyedianji")
that.Mutil.closeAllOverlays(); that.Mutil.closeAllOverlays();
let id = evt.selected[0].get('did'); let id = evt.selected[0].get('did');
console.log(id);
if (id) that.getPopcon(id); if (id) that.getPopcon(id);
} else if (evt.selected[0].get('type') === 'wxy') {//其他类的气泡 } else if (evt.selected[0].get('type') === 'wxy') {//其他类的气泡
that.Mutil.closeAllOverlays(); that.Mutil.closeAllOverlays();
......
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