临时提交

This commit is contained in:
648540858
2024-07-26 17:53:10 +08:00
parent a2b00a4f4e
commit b246fd6a20
15 changed files with 263 additions and 156 deletions

View File

@@ -10,7 +10,7 @@
</div>
</div>
</div>
<div >
<div>
<vue-easy-tree
ref="veTree"
node-key="id"
@@ -19,14 +19,19 @@
style="height: 78vh; padding: 2rem"
:load="loadNode"
:data="treeData"
:default-expanded-keys="['']"
@node-contextmenu="contextmenuEventHandler"
@node-click="nodeClickHandler"
>
<span class="custom-tree-node" slot-scope="{ node, data }">
<span v-if="node.data.type === 0" style="color: #409EFF" class="iconfont icon-bianzubeifen3"></span>
<span v-if="node.data.type === 1" style="color: #409EFF" class="iconfont icon-file-stream2"></span>
<span style=" padding-left: 1px">{{ node.label }}</span>
</span>
<span @click.stop >
<el-radio v-if="node.data.type === 0 && node.level !== 1 " style="margin-right: 0" v-model="chooseId" @input="chooseIdChange" :label="node.data.id">{{''}}</el-radio>
</span>
<span v-if="node.data.type === 0" style="color: #409EFF" class="iconfont icon-bianzubeifen3"></span>
<span v-if="node.data.type === 1" style="color: #409EFF" class="iconfont icon-file-stream2"></span>
<span style=" padding-left: 1px" v-if="node.data.id !==''">{{ node.label }}({{ node.data.id }})</span>
<span style=" padding-left: 1px" v-if="node.data.id ===''">{{ node.label }}</span>
</span>
</vue-easy-tree>
</div>
<regionCode ref="regionCode"></regionCode>
@@ -47,13 +52,14 @@ export default {
data() {
return {
searchSrt: "",
chooseId: "",
// props: {
// label: "name",
// },
treeData: [],
}
},
props: ['edit', 'clickEvent', 'contextMenuEvent'],
props: ['edit', 'clickEvent', 'chooseIdChange'],
created() {
// this.$axios({
// method: 'get',
@@ -107,7 +113,14 @@ export default {
loadNode: function (node, resolve) {
console.log(22222)
console.log(node)
if (node.level === 0 || node.data.id.length < 8) {
if (node.level === 0) {
resolve([{
id: "",
label: "根资源组",
isLeaf: false,
type: 0
}]);
} else if (node.data.id.length < 8) {
this.$axios({
method: 'get',
url: `/api/region/tree/list`,
@@ -115,7 +128,7 @@ export default {
query: this.searchSrt,
parent: node.data.id
}
}).then((res)=> {
}).then((res) => {
if (res.data.code === 0) {
resolve(res.data.data);
}
@@ -123,7 +136,7 @@ export default {
}).catch(function (error) {
console.log(error);
});
}else {
} else {
resolve([]);
}
},
@@ -176,7 +189,8 @@ export default {
reset: function () {
this.$forceUpdate();
},
contextmenuEventHandler: function (event,data,node,element){
contextmenuEventHandler: function (event, data, node, element) {
console.log(node.level)
if (node.data.type === 1) {
data.parentId = node.parent.data.id;
this.$contextmenu({
@@ -187,10 +201,10 @@ export default {
disabled: false,
onClick: () => {
this.$axios({
method:"delete",
url:"/api/platform/catalog/relation/del",
method: "delete",
url: "/api/platform/catalog/relation/del",
data: data
}).then((res)=>{
}).then((res) => {
console.log("移除成功")
node.parent.loaded = false
node.parent.expand();
@@ -204,7 +218,7 @@ export default {
customClass: "custom-class", // 自定义菜单 class
zIndex: 3000, // 菜单样式 z-index
});
}else if (node.data.type === 0){
} else if (node.data.type === 0) {
this.$contextmenu({
items: [
{
@@ -224,9 +238,9 @@ export default {
}
},
{
label: "修改节点",
label: "重命名",
icon: "el-icon-edit",
disabled: false,
disabled: node.level === 1,
onClick: () => {
this.editCatalog(data, node);
}
@@ -234,14 +248,14 @@ export default {
{
label: "删除节点",
icon: "el-icon-delete",
disabled: false,
disabled: node.level === 1,
onClick: () => {
this.$confirm('确定删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.removeCatalog(data.id, node)
this.removeRegion(data.id, node)
}).catch(() => {
});
@@ -276,30 +290,43 @@ export default {
return false;
},
refreshNode: function (node){
removeRegion: function (id, node) {
this.$axios({
method: "delete",
url: `/api/region/delete`,
params: {
deviceId: id,
}
}).then((res) => {
if (res.data.code === 0) {
console.log("移除成功")
node.parent.loaded = false
node.parent.expand();
}
})
.catch(function (error) {
console.log(error);
});
},
refreshNode: function (node) {
node.loaded = false
node.expand();
},
addRegion: function (id, node){
addRegion: function (id, node) {
console.log(node)
this.$refs.regionCode.openDialog(code=>{
console.log(this.form)
console.log("code===> " + code)
this.form.gbDeviceId = code;
console.log("code22===> " + code)
this.$refs.regionCode.openDialog(form => {
node.loaded = false
node.expand();
}, id);
},
nodeClickHandler: function (data, node, tree){
nodeClickHandler: function (data, node, tree) {
console.log(data)
console.log(node)
this.chooseId = data.id;
this.chooseName = data.name;
if (this.catalogIdChange)this.catalogIdChange(this.chooseId, this.chooseName);
// this.chooseId = data.id;
// this.chooseName = data.name;
// if (this.catalogIdChange)this.catalogIdChange(this.chooseId, this.chooseName);
}
},
destroyed() {
@@ -325,4 +352,7 @@ export default {
.device-offline {
color: #727272;
}
.custom-tree-node .el-radio__label {
padding-left: 4px !important;
}
</style>

View File

@@ -14,39 +14,33 @@
<div class="show-code-item">{{ allVal[0].val }}</div>
<div style="text-align: center">{{ allVal[0].meaning }}</div>
</div>
<el-radio-group v-model="allVal[0].val" @input="deviceChange">
<el-radio v-for="item in regionList" :key="item.deviceId" :label="item.deviceId" style="line-height: 2rem">
{{ item.name }} - {{ item.deviceId }}
</el-radio>
</el-radio-group>
<el-radio v-for="item in regionList" v-model="allVal[0].val" :key="item.deviceId" :name="item.name" :label="item.deviceId" @input="deviceChange(item)" style="line-height: 2rem">
{{ item.name }} - {{ item.deviceId }}
</el-radio>
</el-tab-pane>
<el-tab-pane name="1">
<div slot="label">
<div class="show-code-item">{{ allVal[1].val?allVal[1].val:"--" }}</div>
<div style="text-align: center">{{ allVal[1].meaning }}</div>
</div>
<el-radio-group v-model="allVal[1].val" :disabled="allVal[1].lock" @input="deviceChange">
<el-radio :key="-1" label="" style="line-height: 2rem">
不添加
</el-radio>
<el-radio v-for="item in regionList" :key="item.deviceId" :label="item.deviceId.substring(2)" style="line-height: 2rem">
{{ item.name }} - {{ item.deviceId.substring(2) }}
</el-radio>
</el-radio-group>
<el-radio :key="-1" v-model="allVal[1].val" @input="deviceChange" label="" style="line-height: 2rem">
不添加
</el-radio>
<el-radio v-for="item in regionList" v-model="allVal[1].val" @input="deviceChange(item)" :key="item.deviceId" :label="item.deviceId.substring(2)" style="line-height: 2rem">
{{ item.name }} - {{ item.deviceId.substring(2) }}
</el-radio>
</el-tab-pane>
<el-tab-pane name="2">
<div slot="label">
<div class="show-code-item">{{ allVal[2].val?allVal[2].val:"--" }}</div>
<div style="text-align: center">{{ allVal[2].meaning }}</div>
</div>
<el-radio-group v-model="allVal[2].val" :disabled="allVal[2].lock" @input="deviceChange">
<el-radio :key="-1" label="" style="line-height: 2rem">
不添加
</el-radio>
<el-radio v-for="item in regionList" :key="item.deviceId" :label="item.deviceId.substring(4)" style="line-height: 2rem">
{{ item.name }} - {{ item.deviceId.substring(4) }}
</el-radio>
</el-radio-group>
<el-radio :key="-1" label="" v-model="allVal[2].val" style="line-height: 2rem" @input="deviceChange">
不添加
</el-radio>
<el-radio v-for="item in regionList" v-model="allVal[2].val" @input="deviceChange(item)" :key="item.deviceId" :label="item.deviceId.substring(4)" style="line-height: 2rem">
{{ item.name }} - {{ item.deviceId.substring(4) }}
</el-radio>
</el-tab-pane>
<el-tab-pane name="3">
请手动输入基层接入单位编码,两位数字
@@ -136,21 +130,64 @@ export default {
},
methods: {
openDialog: function (endCallBck, parentDeviceId, code, lockContent) {
console.log(code)
console.log(parentDeviceId)
this.showVideoDialog = true
this.activeKey= '0';
this.regionList = []
this.form.parentDeviceId = parentDeviceId
this.getRegionList()
if (typeof code != 'undefined' && code.length === 8) {
console.log(111)
this.allVal[0].val = code.substring(0, 2)
this.allVal[1].val = code.substring(2, 4)
this.allVal[2].val = code.substring(4, 6)
this.allVal[3].val = code.substring(6, 8)
this.allVal = [
{
id: [1, 2],
meaning: '省级编码',
val: '11',
type: '中心编码',
lock: false,
},
{
id: [3, 4],
meaning: '市级编码',
val: '',
type: '中心编码',
lock: false,
},
{
id: [5, 6],
meaning: '区级编码',
val: '',
type: '中心编码',
lock: false,
},
{
id: [7, 8],
meaning: '基层接入单位编码',
val: '',
type: '中心编码',
lock: false,
}
]
if (parentDeviceId) {
console.log(parentDeviceId)
console.log(parentDeviceId.length)
if (parentDeviceId.length >= 2) {
this.allVal[0].val = parentDeviceId.substring(0, 2)
this.activeKey = "1"
}
if (parentDeviceId.length >= 4) {
this.allVal[1].val = parentDeviceId.substring(2, 4)
this.activeKey = "2"
}
if (parentDeviceId.length >= 6) {
this.allVal[2].val = parentDeviceId.substring(4, 6)
this.activeKey = "3"
}
}
this.getRegionList()
// if (typeof code != 'undefined' && code.length === 8) {
// this.allVal[0].val = code.substring(0, 2)
// this.allVal[1].val = code.substring(2, 4)
// this.allVal[2].val = code.substring(4, 6)
// this.allVal[3].val = code.substring(6, 8)
// }
console.log(this.allVal)
this.endCallBck = endCallBck;
},
@@ -246,7 +283,8 @@ export default {
closeModel: function (){
this.showVideoDialog = false
},
deviceChange: function (){
deviceChange: function (item){
console.log(item)
let code = this.allVal[0].val
if (this.allVal[1].val) {
code += this.allVal[1].val
@@ -263,22 +301,29 @@ export default {
this.allVal[3].val = ""
}
this.form.deviceId = code
if (item) {
this.form.name = item.name
}
},
handleOk: function() {
const code =
this.allVal[0].val +
this.allVal[1].val +
this.allVal[2].val +
this.allVal[3].val +
this.allVal[4].val +
this.allVal[5].val +
this.allVal[6].val +
this.allVal[7].val
console.log(code)
if (this.endCallBck) {
this.endCallBck(code)
}
this.showVideoDialog = false
this.$axios({
method: 'post',
url: "/api/region/add/",
data: this.form
}).then((res) => {
if (res.data.code === 0) {
if (typeof this.endCallBck == "function") {
this.endCallBck(this.form)
}
this.showVideoDialog = false
} else {
this.$message.error(res.data.msg);
}
}).catch((error) => {
this.$message.error(error);
});
}
},
};

View File

@@ -2,7 +2,7 @@
<div id="region" style="width: 100%">
<el-container v-loading="loading" >
<el-aside width="400px" >
<RegionTree ref="regionTree" :edit="true" :clickEvent="treeNodeClickEvent"></RegionTree>
<RegionTree ref="regionTree" :edit="true" :clickEvent="treeNodeClickEvent" :chooseIdChange="chooseIdChange"></RegionTree>
</el-aside>
<el-main style="padding: 5px;">
<div class="page-header">
@@ -27,7 +27,9 @@
</div>
</div>
<el-table ref="channelListTable" :data="channelList" :height="winHeight" style="width: 100%"
header-row-class-name="table-header">
header-row-class-name="table-header" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55">
</el-table-column>
<el-table-column prop="gbName" label="名称" min-width="180">
</el-table-column>
<el-table-column prop="gbDeviceId" label="编号" min-width="180">
@@ -84,27 +86,23 @@ export default {
searchSrt: "",
channelType: "",
online: "",
winHeight: window.innerHeight - 200,
winHeight: window.innerHeight - 180,
currentPage: 1,
count: 15,
total: 0,
loading: false,
loadSnap: {},
regionId: ""
};
},
mounted() {
created() {
this.initData();
},
destroyed() {},
methods: {
initData: function () {
if (typeof (this.parentChannelId) == "undefined" || this.parentChannelId == 0) {
this.getChannelList();
} else {
this.showSubchannels();
}
this.getChannelList();
},
currentChange: function (val) {
this.currentPage = val;
@@ -116,28 +114,19 @@ export default {
},
getChannelList: function () {
let that = this;
if (typeof (this.$route.params.deviceId) == "undefined") return;
this.$axios({
method: 'get',
url: `/api/device/query/devices/${this.$route.params.deviceId}/channels`,
url: `/api/common/channel/list`,
params: {
page: that.currentPage,
count: that.count,
query: that.searchSrt,
online: that.online,
channelType: that.channelType
online: that.online
}
}).then(function (res) {
if (res.data.code === 0) {
that.total = res.data.data.total;
that.deviceChannelList = res.data.data.list;
that.deviceChannelList.forEach(e => {
e.ptzType = e.ptzType + "";
that.$set(e, "location", "");
if (e.longitude && e.latitude) {
that.$set(e, "location", e.longitude + "," + e.latitude);
}
});
that.channelList = res.data.data.list;
// 防止出现表格错位
that.$nextTick(() => {
that.$refs.channelListTable.doLayout();
@@ -148,7 +137,14 @@ export default {
console.log(error);
});
},
handleSelectionChange: function (val){
console.log(val)
},
add: function (row) {
if (!this.regionId) {
this.$message.info("请选择左侧行政区划节点")
}
},
remove: function (row) {
},
@@ -165,13 +161,10 @@ export default {
this.initData();
},
treeNodeClickEvent: function (device, data, isCatalog) {
console.log(device)
if (!!!data.channelId) {
this.parentChannelId = device.deviceId;
} else {
this.parentChannelId = data.channelId;
}
this.initData();
},
chooseIdChange: function (id) {
this.regionId = id;
},
}
};