main
xuechunyuan 2 years ago
parent d28cafe3df
commit 2bd1f17a22
  1. 2
      src/api/rails/rails.js
  2. 41
      src/views/rails/arealist.vue
  3. 45
      src/views/wirelessintrusion/deployment/list.vue

@ -52,7 +52,7 @@ export const railsAdd = (token, data) => {
//围栏编辑
export const railsUpdate = (token, data) => {
return request({
url: baseUrl + '/api/electronicFencePlatform/editRail/' + data.id,
url: baseUrl + '/api/electronicFencePlatform/editRail',
method: 'put',
headers: {
Authorization: token

@ -28,26 +28,27 @@
</el-col>
<el-col :span="12">
<el-form-item label="区域名称" prop="name">
<el-input v-model="addForm.name" placeholder="请输入围栏名称" :disabled="type == 'view'" maxlength="30" clearable />
<el-input v-model="addForm.name" placeholder="请输入围栏名称" :disabled="type == 'view'" maxlength="30"
clearable />
</el-form-item>
</el-col>
</el-row><el-form-item label="">
<el-table class="table_box" ref="multipleTable" row-key="_id" :data="tableData" tooltip-effect="dark"
<el-table class="table_box" ref="multipleTable" :row-key="getRowKey" :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 type="selection" width="55" align="center" :reserve-selection="true"
:selectable="selectable">
</el-table-column>
<el-table-column prop="name" label="围栏名称"></el-table-column>
<el-table-column prop="floorNo" label="楼层编号">
</el-table-column>
<el-table-column prop="type" label="围栏类型">
<template slot-scope="scope">
{{ scope.row.type == 0 ? '当前楼层' : scope.row.type == 1 ? '当前楼层' : ''}}
{{ scope.row.type == 0 ? '当前楼层' : scope.row.type == 1 ? '当前楼层' : '' }}
</template>
</el-table-column>
</el-table>
<div class="page_box">
<el-pagination @current-change="handleCurrentRailsChange"
:current-page="diaPage.currentPage" background
<el-pagination @current-change="handleCurrentRailsChange" :current-page="diaPage.currentPage" background
layout="total, prev, pager, next, jumper" :total="diaPage.total">
</el-pagination>
</div>
@ -55,8 +56,8 @@
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model="addForm.remark" placeholder="请输入备注" :disabled="type == 'view'" maxlength="200" :autosize="{ minRows: 2, maxRows: 4}" clearable
show-word-limit />
<el-input v-model="addForm.remark" placeholder="请输入备注" :disabled="type == 'view'" maxlength="200"
:autosize="{ minRows: 2, maxRows: 4 }" clearable show-word-limit />
</el-form-item>
</el-col>
</el-row>
@ -78,7 +79,8 @@ export default {
data() {
return {
addForm: {
points: []
points: [],
railIds: []
},
rules: {
floorNo: [
@ -166,6 +168,9 @@ export default {
handleSelectionChange(val) {
this.multipleSelection = val;
},
getRowKey(row) {
return row._id;
},
//
rowView(row) {
this.addForm = JSON.parse(JSON.stringify(row));
@ -192,6 +197,7 @@ export default {
this.diaPage.currentPage = 1;
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs.multipleTable.clearSelection();
this.queryRailsList(this.diaPage);
this.$refs.addForm.clearValidate();
})
@ -205,6 +211,7 @@ export default {
this.diaPage.currentPage = 1;
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs.multipleTable.clearSelection();
this.queryRailsList(this.diaPage);
this.$refs.addForm.clearValidate();
})
@ -217,17 +224,19 @@ export default {
if (token == 'undefined' || !token) {
return;
}
if (this.multipleSelection.length < 1) {
if (this.multipleSelection.length < 1 && this.addForm.railIds.length < 1) {
this.$message({
type: "error",
message: "请选择电子围栏!"
});
return;
}
if(this.multipleSelection.length > 0) {
this.addForm.railIds = this.multipleSelection.map(item => item._id);
}
this.submitLoading = true;
this.addForm.railIds = this.multipleSelection.map(item => {return item._id});
if (this.addForm._id != undefined) {
regionUpdate(token, { ...this.addForm, id: this.addForm._id}).then(res => {
regionUpdate(token, { ...this.addForm, id: this.addForm._id }).then(res => {
this.submitLoading = false;
if (res.data.code == 401) {
window.sessionStorage.removeItem('bizToken');
@ -243,7 +252,7 @@ export default {
type: "success",
message: "操作成功!"
});
}else {
} else {
this.$message({
type: "error",
message: res.data.msg
@ -269,7 +278,7 @@ export default {
type: "success",
message: "操作成功!"
});
}else {
} else {
this.$message({
type: "error",
message: res.data.msg
@ -397,7 +406,6 @@ export default {
const data = res2.data.data;
this.diaPage.total = data.totalElements;
this.tableData = data.content;
this.$refs.multipleTable.clearSelection();
if (this.addForm.railIds.length > 0) { //
this.$nextTick(() => {
this.tableData.forEach(row => { //
@ -422,7 +430,7 @@ export default {
const data = res2.data.data;
this.diaPage.total = data.totalElements;
this.tableData = data.content;
this.$refs.multipleTable.clearSelection();
console.log(this.addForm.railIds)
if (this.addForm.railIds.length > 0) { //
this.$nextTick(() => {
this.tableData.forEach(row => { //
@ -457,6 +465,7 @@ export default {
.el-table th.el-table__cell {
background: #F7F8FA;
}
.table_box {
th.el-table__cell {
background: #F7F8FA;

@ -22,8 +22,8 @@
<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" v-if="dialogVisible" :append-to-body="true" :close-on-click-modal="false"
:close-on-press-escape="false" custom-class="dia_box" width="950px">
<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">
@ -179,12 +179,17 @@ export default {
align: "center",
slot: true,
},
{
label: "创建时间",
prop: "createTime",
align: "center",
width: 150
},
]
},
tableData: [],
data: [],
multipleSelection: [],
selectedArr: [],
isDetail: false
};
},
@ -198,13 +203,6 @@ export default {
editBtn: this.vaildData(this.permission.notice_edit, false)
};
},
ids() {
let ids = [];
this.selectionList.forEach(ele => {
ids.push(ele.id);
});
return ids.join(",");
},
},
mounted() {
this.loadDict();
@ -259,6 +257,7 @@ export default {
taskDescribe: '',
type: 1,
executeTime: null,
ids: '',
deviceId: '',
status: '1'
}
@ -267,6 +266,7 @@ export default {
this.isDetail = false;
this.diaPage.currentPage = 1;
this.$nextTick(() => {
this.$refs.multipleTable.clearSelection();
this.queryDeviceList(this.diaPage);
})
},
@ -278,22 +278,26 @@ export default {
submitForm() {
this.$refs.addform.validate((valid) => {
if (valid) {
if (this.multipleSelection.length === 0) {
if (this.multipleSelection.length === 0 && this.addForm.deviceId == '') {
this.$message({
type: "warning",
message: "请选择关联设备"
})
return;
}
let ids = [], deviceId = [];
this.multipleSelection.forEach(ele => {
let tags = JSON.parse(ele.tags)
ids.push(ele.id);
deviceId.push(tags.sectorNo);
});
if (this.multipleSelection.length > 0) {
let ids = [], deviceId = [];
this.multipleSelection.forEach(ele => {
let tags = JSON.parse(ele.tags)
ids.push(ele.id);
deviceId.push(tags.sectorNo);
});
this.addForm.ids = ids.join(",");
this.addForm.deviceId = deviceId.join(",");
}
this.submitLoading = true;
if (this.addForm.id > 0) {
cornJobUpdate({ ...this.addForm, deviceId: deviceId.join(","), ids: ids.join(",") }).then((res) => {
cornJobUpdate(this.addForm).then((res) => {
this.submitLoading = false;
this.dialogVisible = false;
this.onLoad(this.page);
@ -305,7 +309,7 @@ export default {
this.submitLoading = false;
})
} else {
cornJobSave({ ...this.addForm, deviceId: deviceId.join(","), ids: ids.join(",") }).then(res => {
cornJobSave(this.addForm).then(res => {
this.submitLoading = false;
this.dialogVisible = false;
this.onLoad(this.page);
@ -357,6 +361,7 @@ export default {
this.dialogVisible = true;
this.isDetail = false;
this.$nextTick(() => {
this.$refs.multipleTable.clearSelection();
this.queryDeviceList(this.diaPage);
})
},
@ -445,7 +450,6 @@ export default {
item.productName = item.bizProduct.name;
})
this.tableData = data.records;
this.$refs.multipleTable.clearSelection();
let multipleSelection = this.addForm.ids ? this.addForm.ids.split(",") : [];
if (multipleSelection.length > 0) { //
this.$nextTick(() => {
@ -477,7 +481,6 @@ export default {
item.productName = item.bizProduct.name;
})
this.tableData = data.rows;
this.$refs.multipleTable.clearSelection();
let multipleSelection = this.addForm.ids ? this.addForm.ids.split(",") : [];
if (multipleSelection.length > 0) { //
this.$nextTick(() => {

Loading…
Cancel
Save