|
|
|
|
@ -1,131 +1,93 @@ |
|
|
|
|
<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> |
|
|
|
|
<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="primary" icon="el-icon-plus" size="small" @click="handleAdd"> |
|
|
|
|
新 增 |
|
|
|
|
</el-button> |
|
|
|
|
<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-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> |
|
|
|
|
@ -133,6 +95,7 @@ |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import { mapGetters } from "vuex"; |
|
|
|
|
import { bizLogin, bizDeviceList, bizDeviceStatus, bizNodeType, cornJobList, cornJobSave, cornJobUpdate, cornJobRemove } from "@/api/wirelessintrusion/wirelessintrusion"; |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
@ -152,69 +115,70 @@ |
|
|
|
|
total: 10, |
|
|
|
|
}, |
|
|
|
|
addForm: {}, |
|
|
|
|
addRules: { |
|
|
|
|
taskTitle: [ |
|
|
|
|
{ required: true, message: "请输入任务标题", trigger: "blur,change" }, |
|
|
|
|
], |
|
|
|
|
executeTime: [ |
|
|
|
|
{ required: true, message: "请选择任务时间", trigger: "change" }, |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
selectionList: [], |
|
|
|
|
option: { |
|
|
|
|
height: 'auto', |
|
|
|
|
menuWidth:300, |
|
|
|
|
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: true, |
|
|
|
|
excelBtn: false, |
|
|
|
|
dialogClickModal: false, |
|
|
|
|
column: [ |
|
|
|
|
{ |
|
|
|
|
label: "布防时间", |
|
|
|
|
prop: "time", |
|
|
|
|
span: 12, |
|
|
|
|
// search: true, |
|
|
|
|
label: "任务标题", |
|
|
|
|
prop: "taskTitle", |
|
|
|
|
minWidth: 200, |
|
|
|
|
overHidden: true, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: "布/撤防时间", |
|
|
|
|
prop: "executeTime", |
|
|
|
|
addDisplay: false, |
|
|
|
|
editDisplay: false, |
|
|
|
|
viewDisplay: false, |
|
|
|
|
}, |
|
|
|
|
// { |
|
|
|
|
// label: "关联设备", |
|
|
|
|
// prop: "deviceId", |
|
|
|
|
// overHidden: true, |
|
|
|
|
// }, |
|
|
|
|
{ |
|
|
|
|
label: "关联设备", |
|
|
|
|
prop: "device", |
|
|
|
|
type: 'textarea', |
|
|
|
|
span: 12, |
|
|
|
|
overHidden: true, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: "布防状态", |
|
|
|
|
label: "任务类型", |
|
|
|
|
type: "select", |
|
|
|
|
prop: "brandCode", |
|
|
|
|
span: 12, |
|
|
|
|
hide: true, |
|
|
|
|
prop: "type", |
|
|
|
|
dicData: [ |
|
|
|
|
{ value: 1, label: '布防' }, { value: 2, label: '撤防' } |
|
|
|
|
], |
|
|
|
|
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'}, |
|
|
|
|
], |
|
|
|
|
data: [], |
|
|
|
|
multipleSelection: [], |
|
|
|
|
selectedArr: [], |
|
|
|
|
isDetail: false |
|
|
|
|
@ -239,54 +203,116 @@ |
|
|
|
|
return ids.join(","); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
this.loadDict(); |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
//多选框禁选 |
|
|
|
|
selectable(row, index) { |
|
|
|
|
//row 就是每行的数据 |
|
|
|
|
let data = this.selectedArr //这是多选按钮保存的数据 |
|
|
|
|
//return : false 就是禁用 |
|
|
|
|
//return : true 不禁用 |
|
|
|
|
return data.findIndex(item => item == row.id) === -1 |
|
|
|
|
//字典加载 |
|
|
|
|
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; |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
//节点类型转换 |
|
|
|
|
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.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'] |
|
|
|
|
this.diaPage.currentPage = 1; |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
this.queryDeviceList(this.diaPage); |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 弹窗表格多选 |
|
|
|
|
handleSelectionChange(val) { |
|
|
|
|
this.multipleSelection = val |
|
|
|
|
this.multipleSelection = val.map(item => item.id); |
|
|
|
|
console.log(this.multipleSelection) |
|
|
|
|
}, |
|
|
|
|
// 弹窗确认按钮 |
|
|
|
|
submitForm() { |
|
|
|
|
console.log(this.addForm) |
|
|
|
|
}, |
|
|
|
|
// 一键布防 |
|
|
|
|
handleAddPre(){ |
|
|
|
|
if (this.selectionList.length === 0) { |
|
|
|
|
this.$message.warning("请选择至少一条数据"); |
|
|
|
|
this.$refs.addform.validate((valid) => { |
|
|
|
|
if (valid) { |
|
|
|
|
if (this.multipleSelection.length === 0) { |
|
|
|
|
this.$message({ |
|
|
|
|
type: "warning", |
|
|
|
|
message: "请选择关联设备" |
|
|
|
|
}) |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 一键撤防 |
|
|
|
|
handleCancel(){ |
|
|
|
|
if (this.selectionList.length === 0) { |
|
|
|
|
this.$message.warning("请选择至少一条数据"); |
|
|
|
|
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; |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
searchReset() { |
|
|
|
|
this.query = {}; |
|
|
|
|
@ -308,65 +334,61 @@ |
|
|
|
|
}, |
|
|
|
|
//查看详情 |
|
|
|
|
handleDetail(row) { |
|
|
|
|
row.status = row.status + ''; |
|
|
|
|
this.addForm = 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) |
|
|
|
|
} |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
this.queryDeviceList(this.diaPage); |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
//点击编辑按钮 |
|
|
|
|
handleEdit(){ |
|
|
|
|
handleEdit(row, index) { |
|
|
|
|
row.status = row.status + ''; |
|
|
|
|
this.addForm = row; |
|
|
|
|
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) //选中已经选择的 |
|
|
|
|
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(",") }); |
|
|
|
|
}) |
|
|
|
|
.then(() => { |
|
|
|
|
// this.onLoad(this.page); |
|
|
|
|
// this.$message({ |
|
|
|
|
// type: "success", |
|
|
|
|
// message: "操作成功!" |
|
|
|
|
// }); |
|
|
|
|
// this.$refs.crud.toggleSelection(); |
|
|
|
|
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(() => { |
|
|
|
|
this.onLoad(this.page); |
|
|
|
|
this.$message({ |
|
|
|
|
type: "success", |
|
|
|
|
message: "操作成功!" |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
currentChange(currentPage) { |
|
|
|
|
@ -379,33 +401,91 @@ |
|
|
|
|
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}, |
|
|
|
|
]; |
|
|
|
|
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.page.total = this.data.length; |
|
|
|
|
this.selectionClear(); |
|
|
|
|
}, err => { |
|
|
|
|
this.loading = false; |
|
|
|
|
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 => { |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
@ -417,39 +497,44 @@ |
|
|
|
|
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,在这里引入自己的图片 |
|
|
|
|
font-size: 12px; |
|
|
|
|
background-size: cover; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
::v-deep .add_item:before { |
|
|
|
|
content: "替"; |
|
|
|
|
font-size: 12px; |
|
|
|
|
visibility: hidden; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.table_box { |
|
|
|
|
th.el-table__cell { |
|
|
|
|
background: #F7F8FA; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
</style> |
|
|
|
|
<style lang="scss"> |
|
|
|
|
|
|
|
|
|
.dia_box { |
|
|
|
|
height: 700px; |
|
|
|
|
overflow: auto; |
|
|
|
|
|
|
|
|
|
.el-table { |
|
|
|
|
width: 90% !important; |
|
|
|
|
width: 100% !important; |
|
|
|
|
border: 1px solid #D6D8DF; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.el-table th.el-table__cell { |
|
|
|
|
background: #F7F8FA; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.dialog-footer { |
|
|
|
|
width: 100%; |
|
|
|
|
height: 100%; |
|
|
|
|
|