parent
477f14ac57
commit
326f2538ad
8 changed files with 913 additions and 800 deletions
@ -0,0 +1,42 @@ |
||||
import request from '@/router/axios'; |
||||
|
||||
export const getList = (current, size, params) => { |
||||
return request({ |
||||
url: '/alarmInformation/list', |
||||
method: 'get', |
||||
params: { |
||||
...params, |
||||
current, |
||||
size, |
||||
} |
||||
}) |
||||
} |
||||
|
||||
export const getDetail = (code) => { |
||||
return request({ |
||||
url: '/api/blade-system/region/detail', |
||||
method: 'get', |
||||
params: { |
||||
code |
||||
} |
||||
}) |
||||
} |
||||
|
||||
export const remove = (id) => { |
||||
return request({ |
||||
url: '/api/blade-system/region/remove', |
||||
method: 'post', |
||||
params: { |
||||
id, |
||||
} |
||||
}) |
||||
} |
||||
|
||||
export const submit = (row) => { |
||||
return request({ |
||||
url: '/api/blade-system/region/submit', |
||||
method: 'post', |
||||
data: row |
||||
}) |
||||
} |
||||
|
||||
|
After Width: | Height: | Size: 26 KiB |
@ -1,33 +1,70 @@ |
||||
<template> |
||||
<div> |
||||
<div id='mapContainer' style="widht:1000px;height:1000px;background:red;"></div> |
||||
</div> |
||||
<div> |
||||
<div id='mapContainer' style="widht:1000px;height:1000px;"></div> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import Img from "@/assets/image/position_icon.png"; |
||||
export default { |
||||
name: "map", |
||||
data() { |
||||
return { |
||||
}; |
||||
}, |
||||
destroyed() { |
||||
window.map.destroy(); |
||||
window.map = null; |
||||
}, |
||||
mounted() { |
||||
window.map = new jsmapbase.JSMap({ |
||||
container: 'mapContainer', |
||||
mapServerURL: 'data/map' |
||||
}); |
||||
window.map.openMapById('0001'); |
||||
window.map.on("loadComplete", e => { |
||||
var floorControl = new jsmapbase.JSFloorControl({ |
||||
position: jsmapbase.JSControlPosition.LEFT_TOP,//控件在容器中的位置 |
||||
showBtnCount: 3,//默认显示楼层的个数 TODO |
||||
allLayers: false, //初始是否是多层显示,默认单层显示 |
||||
needAllLayerBtn: true, // 是否显示多层/单层切换按钮 |
||||
offset: { |
||||
x: 20, |
||||
y: 10 |
||||
}//位置x,y的偏移量 |
||||
}); |
||||
window.map.addControl(floorControl); |
||||
console.log('点位标注') |
||||
//点位标注 |
||||
var imagerMarker = new jsmapbase.JSImageMarker({ |
||||
id: 'iamgeMareker1',//id |
||||
image: Img,//图片路径 |
||||
position: new jsmapbase.JSPoint(120.61988850529002, 31.37531834395683, 0),//坐标位置 |
||||
width: 55,//尺寸-宽 |
||||
height: 55,//尺寸-高 |
||||
floorId: 1,//楼层id |
||||
offset: jsmapbase.JSControlPosition.RIGHT_BOTTOM,//偏移位置 |
||||
depthTest: false,//是否开启深度检测 |
||||
show: true, //是否显示 |
||||
properties: { |
||||
name: 'test' |
||||
},//属性设置 |
||||
callback: (node) => { |
||||
console.log(node); |
||||
}//回调 |
||||
}); |
||||
window.map.addMarker(imagerMarker); |
||||
}); |
||||
}, |
||||
methods: { |
||||
|
||||
export default { |
||||
name: "map", |
||||
data() { |
||||
return { |
||||
}; |
||||
}, |
||||
mounted() { |
||||
window.map = new jsmapbase.JSMap({ |
||||
container:'mapContainer', |
||||
mapServerURL:'data/map' |
||||
}); |
||||
window.map.openMapById('0001'); |
||||
}, |
||||
methods: { |
||||
|
||||
}, |
||||
}; |
||||
}, |
||||
}; |
||||
</script> |
||||
|
||||
<style> |
||||
.el-font-size { |
||||
font-size: 14px; |
||||
} |
||||
.el-font-size { |
||||
font-size: 14px; |
||||
} |
||||
</style> |
||||
|
||||
|
||||
@ -1,470 +1,555 @@ |
||||
<template> |
||||
<basic-container> |
||||
<avue-crud :option="option" |
||||
:table-loading="loading" |
||||
:data="data" |
||||
:page.sync="page" |
||||
ref="crud" |
||||
v-model="form" |
||||
:permission="permissionList" |
||||
:before-open="beforeOpen" |
||||
@search-change="searchChange" |
||||
@search-reset="searchReset" |
||||
@selection-change="selectionChange" |
||||
@current-change="currentChange" |
||||
@size-change="sizeChange" |
||||
@refresh-change="refreshChange" |
||||
@on-load="onLoad"> |
||||
<avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" v-model="form" |
||||
:permission="permissionList" :before-open="beforeOpen" @search-change="searchChange" @search-reset="searchReset" |
||||
@selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange" |
||||
@refresh-change="refreshChange" @on-load="onLoad" :selecttable="selectable1"> |
||||
<template slot="menuLeft"> |
||||
<el-button |
||||
size="small" |
||||
@click="handleAddPre"> |
||||
<i class="add_item"></i> |
||||
一键布防 |
||||
<el-button type="primary" icon="el-icon-plus" size="small" @click="handleAdd"> |
||||
新 增 |
||||
</el-button> |
||||
<el-button |
||||
type="primary" |
||||
size="small" |
||||
@click="handleCancel"> |
||||
<i class="cancel_item"></i> |
||||
一键撤防 |
||||
</el-button> |
||||
<el-button |
||||
type="primary" |
||||
size="small" |
||||
@click="handleAdd"> |
||||
新增 |
||||
<el-button type="danger" icon="el-icon-delete" size="small" plain @click="handleDelete"> |
||||
删 除 |
||||
</el-button> |
||||
</template> |
||||
<template slot-scope="{row}" |
||||
slot="status"> |
||||
<template slot-scope="{row}" slot="status"> |
||||
<el-tag type="danger" v-show="row.status == 0">关闭</el-tag> |
||||
<el-tag type="success" v-show="row.status == 1">开启</el-tag> |
||||
</template> |
||||
<template #menu="{size:row,index}"> |
||||
<el-button size="small" @click="handleDetail(row,index)">详情</el-button> |
||||
<el-button size="small" @click="handleEdit(row,index)">编辑</el-button> |
||||
<el-button size="small" @click="handleDelete(row,index)">删除</el-button> |
||||
<template #menu="{ size, row, index }"> |
||||
<el-button type="text" icon="el-icon-view" size="small" @click="handleDetail(row, index)">详情</el-button> |
||||
<el-button type="text" icon="el-icon-edit" size="small" @click="handleEdit(row, index)">编辑</el-button> |
||||
<el-button type="text" icon="el-icon-delete" size="small" @click="handleDeleteRow(row, index)">删除</el-button> |
||||
</template> |
||||
</avue-crud> |
||||
<el-dialog |
||||
title="布防设置" |
||||
:visible.sync="dialogVisible" |
||||
:append-to-body="true" |
||||
:close-on-click-modal="false" |
||||
:close-on-press-escape="false" |
||||
custom-class="dia_box" |
||||
> |
||||
<el-form v-model="addForm"> |
||||
<el-form-item label="布防时间:" prop="preTime"> |
||||
<el-time-picker |
||||
v-model="addForm.preTime" |
||||
placeholder="请选择布防时间" |
||||
:readonly="isDetail ? true : false" |
||||
value-format="HH:mm:ss"> |
||||
</el-time-picker> |
||||
</el-form-item> |
||||
<el-dialog title="布/撤防设置" :visible.sync="dialogVisible" v-if="dialogVisible" :append-to-body="true" :close-on-click-modal="false" |
||||
:close-on-press-escape="false" custom-class="dia_box" width="950px"> |
||||
<el-form :model="addForm" ref="addform" :rules="addRules" label-width="100px"> |
||||
<el-row :gutter="20"> |
||||
<el-col :span="12"> |
||||
<el-form-item label="任务标题:" prop="taskTitle"> |
||||
<el-input v-model="addForm.taskTitle" placeholder="请输入任务标题" :disabled="isDetail ? true : false" |
||||
maxlength="30" clearable> |
||||
</el-input> |
||||
</el-form-item> |
||||
<el-form-item label="任务时间:" prop="executeTime"> |
||||
<el-time-picker v-model="addForm.executeTime" placeholder="请选择任务时间" :disabled="isDetail ? true : false" |
||||
value-format="HH:mm:ss" style="width:100%;"> |
||||
</el-time-picker> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="12"> |
||||
<el-form-item label="任务类型:" prop="type"> |
||||
<el-radio-group v-model="addForm.type" :disabled="isDetail ? true : false"> |
||||
<el-radio :label="1">布防</el-radio> |
||||
<el-radio :label="2">撤防</el-radio> |
||||
</el-radio-group> |
||||
</el-form-item> |
||||
<el-form-item label="是否启用:" prop="status"> |
||||
<el-switch v-model="addForm.status" active-value="1" inactive-value="0" :disabled="isDetail ? true : false"> |
||||
</el-switch> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-row> |
||||
<el-form-item label="选择设备:"> |
||||
<el-table |
||||
class="table_box" |
||||
ref="multipleTable" |
||||
:data="tableData" |
||||
tooltip-effect="dark" |
||||
style="width: 100%" |
||||
@selection-change="handleSelectionChange"> |
||||
<el-table-column |
||||
type="selection" |
||||
width="55" |
||||
align="center" |
||||
:reserve-selection="true" |
||||
:selectable="selectable" |
||||
> |
||||
<el-table class="table_box" ref="multipleTable" row-key="id" :data="tableData" tooltip-effect="dark" |
||||
style="width: 100%" @selection-change="handleSelectionChange" size="small"> |
||||
<el-table-column type="selection" width="55" align="center" reserve-selection :selectable="selectable"> |
||||
</el-table-column> |
||||
<el-table-column prop="name" label="设备名称"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.row.name }}/{{ scope.row.remark }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column |
||||
prop="deviceName" |
||||
label="设备名称"> |
||||
<el-table-column prop="productName" label="设备所属产品"> |
||||
</el-table-column> |
||||
<el-table-column |
||||
prop="deviceNo" |
||||
label="设备编号"> |
||||
<el-table-column prop="nodeLabel" label="节点类型"> |
||||
</el-table-column> |
||||
<el-table-column |
||||
prop="deviceType" |
||||
label="设备大类"> |
||||
<el-table-column prop="gateway" label="网关信息"> |
||||
</el-table-column> |
||||
<el-table-column |
||||
prop="deviceArea" |
||||
label="所在区域"> |
||||
<el-table-column prop="statusLabel" label="设备状态"> |
||||
</el-table-column> |
||||
<el-table-column |
||||
prop="position" |
||||
label="安装位置"> |
||||
<el-table-column prop="createTime" label="创建时间" width="160px"> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="page_box"> |
||||
<el-pagination |
||||
@size-change="handleSizeChange" |
||||
@current-change="handleCurrentChange" |
||||
:current-page="diaPage.currentPage" |
||||
:page-sizes="[10, 20, 30, 40]" |
||||
:page-size="diaPage.pageSize" |
||||
background |
||||
layout="total, sizes, prev, pager, next, jumper" |
||||
:total="diaPage.total"> |
||||
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" |
||||
:current-page="diaPage.currentPage" :page-sizes="[10, 20, 30, 40]" :page-size="diaPage.pageSize" background |
||||
layout="total, sizes, prev, pager, next, jumper" :total="diaPage.total"> |
||||
</el-pagination> |
||||
</div> |
||||
</el-form-item> |
||||
<el-form-item label="是否启用:" prop="isOpen"> |
||||
<el-switch |
||||
v-model="addForm.isOpen" |
||||
active-text="禁用" |
||||
inactive-text="启用" |
||||
:readonly="isDetail ? true : false"> |
||||
</el-switch> |
||||
<el-form-item label="任务描述:" prop="taskDescribe"> |
||||
<el-input type="textarea" v-model="addForm.taskDescribe" placeholder="请输入任务描述" |
||||
:disabled="isDetail ? true : false" maxlength="200" show-word-limit> |
||||
</el-input> |
||||
</el-form-item> |
||||
</el-form> |
||||
<div slot="footer" class="dialog-footer"> |
||||
<el-button @click="dialogVisible = false">取 消</el-button> |
||||
<el-button type="primary" @click="submitForm">确认布防</el-button> |
||||
<el-button type="primary" @click="submitForm" v-if="!isDetail">确 认</el-button> |
||||
</div> |
||||
</el-dialog> |
||||
</basic-container> |
||||
</template> |
||||
|
||||
<script> |
||||
import {mapGetters} from "vuex"; |
||||
import { mapGetters } from "vuex"; |
||||
import { bizLogin, bizDeviceList, bizDeviceStatus, bizNodeType, cornJobList, cornJobSave, cornJobUpdate, cornJobRemove } from "@/api/wirelessintrusion/wirelessintrusion"; |
||||
|
||||
export default { |
||||
data() { |
||||
return { |
||||
form: {}, |
||||
query: {}, |
||||
dialogVisible:false, |
||||
loading: true, |
||||
page: { |
||||
pageSize: 10, |
||||
currentPage: 1, |
||||
total: 0 |
||||
}, |
||||
diaPage:{ |
||||
pageSize:10, |
||||
currentPage:1, |
||||
total:10, |
||||
}, |
||||
addForm:{}, |
||||
selectionList: [], |
||||
option: { |
||||
height: 'auto', |
||||
menuWidth:300, |
||||
calcHeight: 30, |
||||
dialogWidth: 950, |
||||
tip: false, |
||||
searchShow: true, |
||||
searchMenuSpan: 6, |
||||
border: true, |
||||
addBtn:false, |
||||
viewBtn: false, |
||||
editBtn:false, |
||||
delBtn:false, |
||||
selection: true, |
||||
excelBtn: true, |
||||
dialogClickModal: false, |
||||
column: [ |
||||
{ |
||||
label: "布防时间", |
||||
prop: "time", |
||||
span: 12, |
||||
// search: true, |
||||
addDisplay: false, |
||||
editDisplay: false, |
||||
viewDisplay: false, |
||||
}, |
||||
{ |
||||
label: "关联设备", |
||||
prop: "device", |
||||
type: 'textarea', |
||||
span: 12, |
||||
overHidden: true, |
||||
}, |
||||
{ |
||||
label: "布防状态", |
||||
type: "select", |
||||
prop: "brandCode", |
||||
span: 12, |
||||
hide: true, |
||||
search: true, |
||||
addDisplay: false, |
||||
editDisplay: false, |
||||
viewDisplay: false, |
||||
}, |
||||
{ |
||||
label: "是否启用", |
||||
prop: "status", |
||||
span: 24, |
||||
width: 80, |
||||
align: "center", |
||||
slot: true, |
||||
addDisplay: false, |
||||
editDisplay: false, |
||||
viewDisplay: false, |
||||
}, |
||||
] |
||||
}, |
||||
tableData:[], |
||||
data: [ |
||||
{time:'09:00:00',device:'空调1、空调2、消防1、消防2、消防3、消防4、消防5...',status:'0'}, |
||||
{time:'09:00:00',device:'空调1、空调2、消防1、消防2、消防3、消防4、消防5...',status:'1'}, |
||||
export default { |
||||
data() { |
||||
return { |
||||
form: {}, |
||||
query: {}, |
||||
dialogVisible: false, |
||||
loading: true, |
||||
page: { |
||||
pageSize: 10, |
||||
currentPage: 1, |
||||
total: 0 |
||||
}, |
||||
diaPage: { |
||||
pageSize: 10, |
||||
currentPage: 1, |
||||
total: 10, |
||||
}, |
||||
addForm: {}, |
||||
addRules: { |
||||
taskTitle: [ |
||||
{ required: true, message: "请输入任务标题", trigger: "blur,change" }, |
||||
], |
||||
multipleSelection:[], |
||||
selectedArr:[], |
||||
isDetail:false |
||||
executeTime: [ |
||||
{ required: true, message: "请选择任务时间", trigger: "change" }, |
||||
], |
||||
}, |
||||
selectionList: [], |
||||
option: { |
||||
height: 'auto', |
||||
menuWidth: 200, |
||||
calcHeight: 30, |
||||
dialogWidth: 950, |
||||
tip: false, |
||||
searchShow: true, |
||||
searchMenuSpan: 6, |
||||
searchLabelWidth: 100, |
||||
border: true, |
||||
addBtn: false, |
||||
viewBtn: false, |
||||
editBtn: false, |
||||
delBtn: false, |
||||
selection: true, |
||||
excelBtn: false, |
||||
dialogClickModal: false, |
||||
column: [ |
||||
{ |
||||
label: "任务标题", |
||||
prop: "taskTitle", |
||||
minWidth: 200, |
||||
overHidden: true, |
||||
}, |
||||
{ |
||||
label: "布/撤防时间", |
||||
prop: "executeTime", |
||||
addDisplay: false, |
||||
editDisplay: false, |
||||
viewDisplay: false, |
||||
}, |
||||
// { |
||||
// label: "关联设备", |
||||
// prop: "deviceId", |
||||
// overHidden: true, |
||||
// }, |
||||
{ |
||||
label: "任务类型", |
||||
type: "select", |
||||
prop: "type", |
||||
dicData: [ |
||||
{ value: 1, label: '布防' }, { value: 2, label: '撤防' } |
||||
], |
||||
search: true, |
||||
}, |
||||
{ |
||||
label: "是否启用", |
||||
prop: "status", |
||||
align: "center", |
||||
slot: true, |
||||
}, |
||||
] |
||||
}, |
||||
tableData: [], |
||||
data: [], |
||||
multipleSelection: [], |
||||
selectedArr: [], |
||||
isDetail: false |
||||
}; |
||||
}, |
||||
computed: { |
||||
...mapGetters(["permission"]), |
||||
permissionList() { |
||||
return { |
||||
addBtn: this.vaildData(this.permission.notice_add, false), |
||||
viewBtn: this.vaildData(this.permission.notice_view, false), |
||||
delBtn: this.vaildData(this.permission.notice_delete, false), |
||||
editBtn: this.vaildData(this.permission.notice_edit, false) |
||||
}; |
||||
}, |
||||
computed: { |
||||
...mapGetters(["permission"]), |
||||
permissionList() { |
||||
return { |
||||
addBtn: this.vaildData(this.permission.notice_add, false), |
||||
viewBtn: this.vaildData(this.permission.notice_view, false), |
||||
delBtn: this.vaildData(this.permission.notice_delete, false), |
||||
editBtn: this.vaildData(this.permission.notice_edit, false) |
||||
}; |
||||
}, |
||||
|
||||
ids() { |
||||
let ids = []; |
||||
this.selectionList.forEach(ele => { |
||||
ids.push(ele.id); |
||||
}); |
||||
return ids.join(","); |
||||
|
||||
ids() { |
||||
let ids = []; |
||||
this.selectionList.forEach(ele => { |
||||
ids.push(ele.id); |
||||
}); |
||||
return ids.join(","); |
||||
} |
||||
}, |
||||
mounted() { |
||||
this.loadDict(); |
||||
}, |
||||
methods: { |
||||
//字典加载 |
||||
loadDict() { |
||||
let token = window.sessionStorage.getItem('bizToken'); |
||||
if (token == 'undefined' || !token) { |
||||
bizLogin({ appKey: 'Arf7bd4f26', appSecret: 'kb207044c8' }).then(res => { |
||||
window.sessionStorage.setItem('bizToken', res.data.data.token); |
||||
bizDeviceStatus(res.data.data.token).then(res => { |
||||
this.bizDeviceStatus = res.data.data; |
||||
}) |
||||
bizNodeType(res.data.data.token).then(res => { |
||||
this.bizNodeType = res.data.data; |
||||
}) |
||||
}) |
||||
} else { |
||||
bizDeviceStatus(token).then(res => { |
||||
if (res.data.code == 401) { |
||||
window.sessionStorage.removeItem('bizToken'); |
||||
this.loadDict(); |
||||
} |
||||
else if (res.data.code == 200) { |
||||
this.bizDeviceStatus = res.data.data; |
||||
} |
||||
}) |
||||
bizNodeType(token).then(res => { |
||||
this.bizNodeType = res.data.data; |
||||
}) |
||||
} |
||||
}, |
||||
methods: { |
||||
//多选框禁选 |
||||
selectable(row, index) { |
||||
//row 就是每行的数据 |
||||
let data = this.selectedArr //这是多选按钮保存的数据 |
||||
//return : false 就是禁用 |
||||
//return : true 不禁用 |
||||
return data.findIndex(item => item == row.id) === -1 |
||||
}, |
||||
//点击新增按钮 |
||||
handleAdd(){ |
||||
this.dialogVisible = true; |
||||
this.isDetail = false; |
||||
this.tableData = [ |
||||
{id:'001',deviceName:'空调',deviceNo:"A101",deviceType:'空调设备',deviceArea:'1号楼一层北',position:'120.51,36.12'}, |
||||
{id:'002',deviceName:'空调',deviceNo:"A101",deviceType:'空调设备',deviceArea:'1号楼一层北',position:'120.51,36.12'}, |
||||
{id:'003',deviceName:'空调',deviceNo:"A101",deviceType:'空调设备',deviceArea:'1号楼一层北',position:'120.51,36.12'}, |
||||
{id:'004',deviceName:'空调',deviceNo:"A101",deviceType:'空调设备',deviceArea:'1号楼一层北',position:'120.51,36.12'}, |
||||
{id:'005',deviceName:'空调',deviceNo:"A101",deviceType:'空调设备',deviceArea:'1号楼一层北',position:'120.51,36.12'}, |
||||
{id:'006',deviceName:'空调',deviceNo:"A101",deviceType:'空调设备',deviceArea:'1号楼一层北',position:'120.51,36.12'}, |
||||
{id:'007',deviceName:'空调',deviceNo:"A101",deviceType:'空调设备',deviceArea:'1号楼一层北',position:'120.51,36.12'}, |
||||
{id:'008',deviceName:'空调',deviceNo:"A101",deviceType:'空调设备',deviceArea:'1号楼一层北',position:'120.51,36.12'}, |
||||
{id:'009',deviceName:'空调',deviceNo:"A101",deviceType:'空调设备',deviceArea:'1号楼一层北',position:'120.51,36.12'}, |
||||
{id:'010',deviceName:'空调',deviceNo:"A101",deviceType:'空调设备',deviceArea:'1号楼一层北',position:'120.51,36.12'}, |
||||
] |
||||
this.selectedArr = ['001','003','005'] |
||||
}, |
||||
// 弹窗表格多选 |
||||
handleSelectionChange(val){ |
||||
this.multipleSelection = val |
||||
}, |
||||
// 弹窗确认按钮 |
||||
submitForm(){ |
||||
console.log(this.addForm) |
||||
}, |
||||
// 一键布防 |
||||
handleAddPre(){ |
||||
if (this.selectionList.length === 0) { |
||||
this.$message.warning("请选择至少一条数据"); |
||||
return; |
||||
} |
||||
}, |
||||
// 一键撤防 |
||||
handleCancel(){ |
||||
if (this.selectionList.length === 0) { |
||||
this.$message.warning("请选择至少一条数据"); |
||||
return; |
||||
} |
||||
}, |
||||
searchReset() { |
||||
this.query = {}; |
||||
this.onLoad(this.page); |
||||
}, |
||||
searchChange(params, done) { |
||||
this.query = params; |
||||
this.page.currentPage = 1; |
||||
this.onLoad(this.page, params); |
||||
done(); |
||||
}, |
||||
selectionChange(list) { |
||||
console.log(list) |
||||
this.selectionList = list; |
||||
}, |
||||
selectionClear() { |
||||
this.selectionList = []; |
||||
this.$refs.crud.toggleSelection(); |
||||
}, |
||||
//查看详情 |
||||
handleDetail(row){ |
||||
this.dialogVisible = true; |
||||
this.isDetail = true; |
||||
this.tableData = [ |
||||
{id:'001',deviceName:'空调',deviceNo:"A101",deviceType:'空调设备',deviceArea:'1号楼一层北',position:'120.51,36.12'}, |
||||
{id:'002',deviceName:'空调',deviceNo:"A101",deviceType:'空调设备',deviceArea:'1号楼一层北',position:'120.51,36.12'}, |
||||
]; |
||||
this.addForm = { |
||||
preTime:'09:00:00', |
||||
isOpen:Boolean(1) |
||||
//节点类型转换 |
||||
renderLabel(node, col) { |
||||
const dicData = this[col]; |
||||
let idx = dicData.findIndex(item => item.dictValue == node); |
||||
return idx > -1 ? dicData[idx].dictLabel : ''; |
||||
}, |
||||
//设备列表多选框禁选 |
||||
selectable() { |
||||
return this.isDetail ? false : true; |
||||
}, |
||||
//任务列表多选框禁选 |
||||
selectable1(row, index) { |
||||
return row.status == 1 ? false : true; |
||||
}, |
||||
//点击新增按钮 |
||||
handleAdd() { |
||||
this.addForm = { |
||||
taskTitle: '', |
||||
taskDescribe: '', |
||||
type: 1, |
||||
executeTime: null, |
||||
deviceId: '', |
||||
status: '1' |
||||
} |
||||
this.multipleSelection = []; |
||||
this.dialogVisible = true; |
||||
this.isDetail = false; |
||||
this.diaPage.currentPage = 1; |
||||
this.$nextTick(() => { |
||||
this.queryDeviceList(this.diaPage); |
||||
}) |
||||
}, |
||||
// 弹窗表格多选 |
||||
handleSelectionChange(val) { |
||||
this.multipleSelection = val.map(item => item.id); |
||||
console.log(this.multipleSelection) |
||||
}, |
||||
// 弹窗确认按钮 |
||||
submitForm() { |
||||
this.$refs.addform.validate((valid) => { |
||||
if (valid) { |
||||
if (this.multipleSelection.length === 0) { |
||||
this.$message({ |
||||
type: "warning", |
||||
message: "请选择关联设备" |
||||
}) |
||||
return; |
||||
} |
||||
let ids = this.multipleSelection.join(","); |
||||
console.log(ids) |
||||
this.submitLoading = true; |
||||
if (this.addForm.id > 0) { |
||||
cornJobUpdate({ ...this.addForm, deviceId: ids }).then((res) => { |
||||
this.submitLoading = false; |
||||
this.dialogVisible = false; |
||||
this.onLoad(this.page); |
||||
this.$message({ |
||||
type: "success", |
||||
message: "操作成功!" |
||||
}); |
||||
}, () => { |
||||
this.submitLoading = false; |
||||
}) |
||||
} else { |
||||
cornJobSave({ ...this.addForm, deviceId: ids }).then(res => { |
||||
this.submitLoading = false; |
||||
this.dialogVisible = false; |
||||
this.onLoad(this.page); |
||||
this.$message({ |
||||
type: "success", |
||||
message: "操作成功!" |
||||
}); |
||||
}, () => { |
||||
this.submitLoading = false; |
||||
}) |
||||
} |
||||
} |
||||
}, |
||||
//点击编辑按钮 |
||||
handleEdit(){ |
||||
this.dialogVisible = true; |
||||
this.isDetail = false; |
||||
this.tableData = [ |
||||
{id:'001',deviceName:'空调',deviceNo:"A101",deviceType:'空调设备',deviceArea:'1号楼一层北',position:'120.51,36.12'}, |
||||
{id:'002',deviceName:'空调',deviceNo:"A101",deviceType:'空调设备',deviceArea:'1号楼一层北',position:'120.51,36.12'}, |
||||
{id:'003',deviceName:'空调',deviceNo:"A101",deviceType:'空调设备',deviceArea:'1号楼一层北',position:'120.51,36.12'}, |
||||
{id:'004',deviceName:'空调',deviceNo:"A101",deviceType:'空调设备',deviceArea:'1号楼一层北',position:'120.51,36.12'}, |
||||
{id:'005',deviceName:'空调',deviceNo:"A101",deviceType:'空调设备',deviceArea:'1号楼一层北',position:'120.51,36.12'}, |
||||
{id:'006',deviceName:'空调',deviceNo:"A101",deviceType:'空调设备',deviceArea:'1号楼一层北',position:'120.51,36.12'}, |
||||
{id:'007',deviceName:'空调',deviceNo:"A101",deviceType:'空调设备',deviceArea:'1号楼一层北',position:'120.51,36.12'}, |
||||
{id:'008',deviceName:'空调',deviceNo:"A101",deviceType:'空调设备',deviceArea:'1号楼一层北',position:'120.51,36.12'}, |
||||
{id:'009',deviceName:'空调',deviceNo:"A101",deviceType:'空调设备',deviceArea:'1号楼一层北',position:'120.51,36.12'}, |
||||
{id:'010',deviceName:'空调',deviceNo:"A101",deviceType:'空调设备',deviceArea:'1号楼一层北',position:'120.51,36.12'}, |
||||
] |
||||
this.selectedArr = ['001','003','005'] |
||||
let selectArr = ['002','004'] |
||||
let map = new Map(); |
||||
for (let item of this.tableData) { |
||||
if (!map.has(item.id)) { |
||||
map.set(item.id, item); |
||||
}; |
||||
}; |
||||
this.multipleSelection = [...map.values()].filter(item => selectArr.includes(item.id)); |
||||
this.$nextTick(() =>{ |
||||
this.multipleSelection.forEach((row) => { |
||||
this.$refs.multipleTable.toggleRowSelection(row, true) //选中已经选择的 |
||||
}) |
||||
}) |
||||
}, |
||||
searchReset() { |
||||
this.query = {}; |
||||
this.onLoad(this.page); |
||||
}, |
||||
searchChange(params, done) { |
||||
this.query = params; |
||||
this.page.currentPage = 1; |
||||
this.onLoad(this.page, params); |
||||
done(); |
||||
}, |
||||
selectionChange(list) { |
||||
console.log(list) |
||||
this.selectionList = list; |
||||
}, |
||||
selectionClear() { |
||||
this.selectionList = []; |
||||
this.$refs.crud.toggleSelection(); |
||||
}, |
||||
//查看详情 |
||||
handleDetail(row) { |
||||
row.status = row.status + ''; |
||||
this.addForm = row; |
||||
this.dialogVisible = true; |
||||
this.isDetail = true; |
||||
this.$nextTick(() => { |
||||
this.queryDeviceList(this.diaPage); |
||||
}) |
||||
}, |
||||
//点击编辑按钮 |
||||
handleEdit(row, index) { |
||||
row.status = row.status + ''; |
||||
this.addForm = row; |
||||
this.dialogVisible = true; |
||||
this.isDetail = false; |
||||
this.$nextTick(() => { |
||||
this.queryDeviceList(this.diaPage); |
||||
}) |
||||
}, |
||||
handleDelete() { |
||||
if (this.selectionList.length === 0) { |
||||
this.$message.warning("请选择至少一条数据"); |
||||
return; |
||||
} |
||||
this.$confirm("确定将选择数据删除?", { |
||||
confirmButtonText: "确定", |
||||
cancelButtonText: "取消", |
||||
type: "warning" |
||||
}) |
||||
.then(() => { |
||||
return cornJobRemove({ ids: this.ids.join(",") }); |
||||
}) |
||||
|
||||
}, |
||||
handleDelete() { |
||||
this.$confirm("确定将选择数据删除?", { |
||||
confirmButtonText: "确定", |
||||
cancelButtonText: "取消", |
||||
type: "warning" |
||||
.then(() => { |
||||
this.onLoad(this.page); |
||||
this.selectionClear(); |
||||
this.$message({ |
||||
type: "success", |
||||
message: "操作成功!" |
||||
}); |
||||
}); |
||||
}, |
||||
handleDeleteRow(row) { |
||||
this.$confirm("确定将选择数据删除?", { |
||||
confirmButtonText: "确定", |
||||
cancelButtonText: "取消", |
||||
type: "warning" |
||||
}) |
||||
.then(() => { |
||||
return cornJobRemove({ ids: row.id }); |
||||
}) |
||||
.then(() => { |
||||
|
||||
}) |
||||
.then(() => { |
||||
// this.onLoad(this.page); |
||||
// this.$message({ |
||||
// type: "success", |
||||
// message: "操作成功!" |
||||
// }); |
||||
// this.$refs.crud.toggleSelection(); |
||||
.then(() => { |
||||
this.onLoad(this.page); |
||||
this.$message({ |
||||
type: "success", |
||||
message: "操作成功!" |
||||
}); |
||||
}, |
||||
currentChange(currentPage) { |
||||
this.page.currentPage = currentPage; |
||||
}, |
||||
sizeChange(pageSize) { |
||||
this.page.pageSize = pageSize; |
||||
}, |
||||
refreshChange() { |
||||
this.onLoad(this.page, this.query); |
||||
}, |
||||
onLoad(page, params = {}) { |
||||
// const {releaseTimeRange} = this.query; |
||||
// let values = { |
||||
// ...params, |
||||
// ...this.query |
||||
// }; |
||||
// if (releaseTimeRange) { |
||||
// values = { |
||||
// ...values, |
||||
// releaseTime_datege: releaseTimeRange[0], |
||||
// releaseTime_datelt: releaseTimeRange[1], |
||||
// }; |
||||
// values.releaseTimeRange = null; |
||||
// } |
||||
// this.loading = true; |
||||
// getList(page.currentPage, page.pageSize, values).then(res => { |
||||
// const data = res.data.data; |
||||
// this.page.total = data.total; |
||||
// this.data = data.records; |
||||
// this.loading = false; |
||||
// this.selectionClear(); |
||||
// }); |
||||
this.data = [ |
||||
{time:'09:00:00',device:'空调1、空调2、消防1、消防2、消防3、消防4、消防5...',status:0}, |
||||
{time:'09:00:00',device:'空调1、空调2、消防1、消防2、消防3、消防4、消防5...',status:1}, |
||||
]; |
||||
}); |
||||
}, |
||||
currentChange(currentPage) { |
||||
this.page.currentPage = currentPage; |
||||
}, |
||||
sizeChange(pageSize) { |
||||
this.page.pageSize = pageSize; |
||||
}, |
||||
refreshChange() { |
||||
this.onLoad(this.page, this.query); |
||||
}, |
||||
onLoad(page, params = {}) { |
||||
let values = { |
||||
...params, |
||||
...this.query |
||||
}; |
||||
this.loading = true; |
||||
cornJobList({ current: page.currentPage, size: page.pageSize, ...values }).then(res => { |
||||
const data = res.data.data; |
||||
this.page.total = data.total; |
||||
this.data = data.records; |
||||
this.loading = false; |
||||
this.selectionClear(); |
||||
}, err => { |
||||
this.loading = false; |
||||
this.page.total = this.data.length; |
||||
this.selectionClear(); |
||||
}); |
||||
}, |
||||
//设备列表 |
||||
queryDeviceList(page, params = {}) { |
||||
let values = { |
||||
...params, |
||||
pid: 100 |
||||
}; |
||||
let token = window.sessionStorage.getItem('bizToken'); |
||||
if (token == 'undefined' || !token) { |
||||
bizLogin({ appKey: 'Arf7bd4f26', appSecret: 'kb207044c8' }).then(res => { |
||||
window.sessionStorage.setItem('bizToken', res.data.data.token); |
||||
bizDeviceList(res.data.data.token, { ...values, pageSize: page.pageSize, pageNum: page.currentPage }).then(res2 => { |
||||
const data = res2.data; |
||||
this.diaPage.total = data.total; |
||||
data.rows.map(item => { |
||||
item.node = item.bizProduct.node; |
||||
item.nodeLabel = this.renderLabel(item.node, 'bizNodeType'); |
||||
item.statusLabel = this.renderLabel(item.status, 'bizDeviceStatus') |
||||
item.productName = item.bizProduct.name; |
||||
}) |
||||
this.tableData = data.records; |
||||
this.$refs.multipleTable.clearSelection(); |
||||
this.multipleSelection = this.addForm.deviceId ? this.addForm.deviceId.split(",") : []; |
||||
if (this.multipleSelection.length > 0) { // 判断是否存在勾选过的数据 |
||||
this.$nextTick(() => { |
||||
this.tableData.forEach(row => { // 获取数据列表接口请求到的数据 |
||||
this.multipleSelection.forEach(item => { // 勾选到的数据 |
||||
if (row.id === parseInt(item)) { |
||||
this.$refs.multipleTable.toggleRowSelection(row, true); // 若有重合,则回显该条数据 |
||||
} |
||||
}); |
||||
}) |
||||
}) |
||||
|
||||
} |
||||
}); |
||||
}) |
||||
} else { |
||||
bizDeviceList(token, { ...values, pageSize: page.pageSize, pageNum: page.currentPage, pid: 100 }).then(res2 => { |
||||
if (res2.data.code == 401) { |
||||
window.sessionStorage.removeItem('bizToken'); |
||||
this.queryDeviceList(); |
||||
} |
||||
else if (res2.data.code == 200) { |
||||
const data = res2.data; |
||||
this.diaPage.total = data.total; |
||||
data.rows.map(item => { |
||||
item.node = item.bizProduct.node; |
||||
item.nodeLabel = this.renderLabel(item.node, 'bizNodeType'); |
||||
item.statusLabel = this.renderLabel(item.status, 'bizDeviceStatus') |
||||
item.productName = item.bizProduct.name; |
||||
}) |
||||
this.tableData = data.rows; |
||||
this.$refs.multipleTable.clearSelection(); |
||||
this.multipleSelection = this.addForm.deviceId ? this.addForm.deviceId.split(",") : []; |
||||
if (this.multipleSelection.length > 0) { // 判断是否存在勾选过的数据 |
||||
this.$nextTick(() => { |
||||
this.tableData.forEach(row => { // 获取数据列表接口请求到的数据 |
||||
this.multipleSelection.forEach(item => { // 勾选到的数据 |
||||
if (row.id === parseInt(item)) { |
||||
this.$refs.multipleTable.toggleRowSelection(row, true); // 若有重合,则回显该条数据 |
||||
} |
||||
}); |
||||
}) |
||||
}) |
||||
} |
||||
} |
||||
}, err => { |
||||
}); |
||||
} |
||||
} |
||||
}; |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
::v-deep .cancel_item { |
||||
background: url('~@/assets/image/cancel_iten.png') center no-repeat; // 注意此处的url,在这里引入自己的图片 |
||||
background: url('~@/assets/image/cancel_iten.png') center no-repeat; // 注意此处的url,在这里引入自己的图片 |
||||
font-size: 12px; |
||||
background-size: cover; |
||||
} |
||||
|
||||
::v-deep .cancel_item:before { |
||||
content: "替"; |
||||
font-size: 12px; |
||||
visibility: hidden; |
||||
} |
||||
|
||||
::v-deep .add_item { |
||||
background: url('~@/assets/image/add.png') center no-repeat; // 注意此处的url,在这里引入自己的图片 |
||||
background: url('~@/assets/image/add.png') center no-repeat; // 注意此处的url,在这里引入自己的图片 |
||||
font-size: 12px; |
||||
background-size: cover; |
||||
} |
||||
|
||||
::v-deep .add_item:before { |
||||
content: "替"; |
||||
font-size: 12px; |
||||
visibility: hidden; |
||||
} |
||||
.table_box{ |
||||
th.el-table__cell{ |
||||
|
||||
.table_box { |
||||
th.el-table__cell { |
||||
background: #F7F8FA; |
||||
} |
||||
} |
||||
} |
||||
</style> |
||||
<style lang="scss"> |
||||
.dia_box{ |
||||
height: 700px; |
||||
overflow: auto; |
||||
|
||||
.el-table{ |
||||
width: 90% !important; |
||||
border: 1px solid #D6D8DF; |
||||
} |
||||
.el-table th.el-table__cell{ |
||||
background: #F7F8FA; |
||||
} |
||||
.dialog-footer{ |
||||
width: 100%; |
||||
height: 100%; |
||||
display: flex; |
||||
align-items: center; |
||||
justify-content: center; |
||||
} |
||||
.dia_box { |
||||
height: 700px; |
||||
overflow: auto; |
||||
|
||||
.page_box{ |
||||
width: 90%; |
||||
margin-left: 9%; |
||||
display: flex; |
||||
align-items: center; |
||||
justify-content: center; |
||||
margin-top: 15px; |
||||
} |
||||
.el-table { |
||||
width: 100% !important; |
||||
border: 1px solid #D6D8DF; |
||||
} |
||||
|
||||
.el-table th.el-table__cell { |
||||
background: #F7F8FA; |
||||
} |
||||
|
||||
.dialog-footer { |
||||
width: 100%; |
||||
height: 100%; |
||||
display: flex; |
||||
align-items: center; |
||||
justify-content: center; |
||||
} |
||||
|
||||
.page_box { |
||||
width: 90%; |
||||
margin-left: 9%; |
||||
display: flex; |
||||
align-items: center; |
||||
justify-content: center; |
||||
margin-top: 15px; |
||||
} |
||||
} |
||||
</style> |
||||
|
||||
Loading…
Reference in new issue