|
|
|
|
@ -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; |
|
|
|
|
|