临时提交

pull/1642/head
panlinlin 2024-07-28 07:36:20 +08:00
parent 8169983f21
commit e285257f24
3 changed files with 29 additions and 6 deletions

View File

@ -1,6 +1,7 @@
package com.genersoft.iot.vmp.gb28181.service.impl; package com.genersoft.iot.vmp.gb28181.service.impl;
import com.genersoft.iot.vmp.common.CivilCodePo; import com.genersoft.iot.vmp.common.CivilCodePo;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.gb28181.bean.Region; import com.genersoft.iot.vmp.gb28181.bean.Region;
import com.genersoft.iot.vmp.gb28181.bean.RegionTree; import com.genersoft.iot.vmp.gb28181.bean.RegionTree;
import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper; import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper;
@ -9,9 +10,11 @@ import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
import com.genersoft.iot.vmp.gb28181.service.IRegionService; import com.genersoft.iot.vmp.gb28181.service.IRegionService;
import com.genersoft.iot.vmp.utils.CivilCodeUtil; import com.genersoft.iot.vmp.utils.CivilCodeUtil;
import com.genersoft.iot.vmp.utils.DateUtil; import com.genersoft.iot.vmp.utils.DateUtil;
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
@ -45,7 +48,12 @@ public class RegionServiceImpl implements IRegionService {
} }
region.setCreateTime(DateUtil.getNow()); region.setCreateTime(DateUtil.getNow());
region.setUpdateTime(DateUtil.getNow()); region.setUpdateTime(DateUtil.getNow());
regionMapper.add(region); try {
regionMapper.add(region);
}catch (DuplicateKeyException e){
throw new ControllerException(ErrorCode.ERROR100.getCode(), "此行政区划已存在");
}
} }
@Override @Override

View File

@ -1,6 +1,6 @@
<template> <template>
<div id="DeviceTree"> <div id="DeviceTree">
<div class="page-header" style="margin-bottom: 1rem"> <div class="page-header" style="margin-bottom: 1rem;">
<div class="page-title">行政区划</div> <div class="page-title">行政区划</div>
<div class="page-header-btn"> <div class="page-header-btn">
<div style="display: inline;"> <div style="display: inline;">

View File

@ -20,7 +20,7 @@
<el-option label="在线" value="true"></el-option> <el-option label="在线" value="true"></el-option>
<el-option label="离线" value="false"></el-option> <el-option label="离线" value="false"></el-option>
</el-select> </el-select>
<el-button size="medium" type="primary" @click="add()"> <el-button size="mini" type="primary" @click="add()">
添加 添加
</el-button> </el-button>
</div> </div>
@ -28,7 +28,7 @@
</div> </div>
<el-table ref="channelListTable" :data="channelList" :height="winHeight" style="width: 100%" <el-table ref="channelListTable" :data="channelList" :height="winHeight" style="width: 100%"
header-row-class-name="table-header" @selection-change="handleSelectionChange"> header-row-class-name="table-header" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55"> <el-table-column type="selection" width="55" :selectable="selectable">
</el-table-column> </el-table-column>
<el-table-column prop="gbName" label="名称" min-width="180"> <el-table-column prop="gbName" label="名称" min-width="180">
</el-table-column> </el-table-column>
@ -92,7 +92,8 @@ export default {
total: 0, total: 0,
loading: false, loading: false,
loadSnap: {}, loadSnap: {},
regionId: "" regionId: "",
multipleSelection: []
}; };
}, },
@ -138,12 +139,26 @@ export default {
}); });
}, },
handleSelectionChange: function (val){ handleSelectionChange: function (val){
console.log(val) this.multipleSelection = val;
},
selectable: function (row, rowIndex) {
if (row.civilCode) {
return false
}else {
return true
}
}, },
add: function (row) { add: function (row) {
if (!this.regionId) { if (!this.regionId) {
this.$message.info("请选择左侧行政区划节点") this.$message.info("请选择左侧行政区划节点")
} }
console.log(this.regionId)
console.log(this.multipleSelection)
let channels = []
for (let i = 0; i < this.multipleSelection.length; i++) {
channels.push(this.multipleSelection[i].gbId)
}
console.log(channels)
}, },
remove: function (row) { remove: function (row) {