临时提交
This commit is contained in:
@@ -36,20 +36,20 @@
|
||||
</span>
|
||||
</vue-easy-tree>
|
||||
</div>
|
||||
<regionCode ref="regionCode"></regionCode>
|
||||
<groupEdit ref="groupEdit"></groupEdit>
|
||||
<gbDeviceSelect ref="gbDeviceSelect"></gbDeviceSelect>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import VueEasyTree from "@wchbrad/vue-easy-tree";
|
||||
import regionCode from './../dialog/regionCode'
|
||||
import groupEdit from './../dialog/groupEdit'
|
||||
import gbDeviceSelect from './../dialog/GbDeviceSelect'
|
||||
|
||||
export default {
|
||||
name: 'DeviceTree',
|
||||
components: {
|
||||
VueEasyTree, regionCode, gbDeviceSelect
|
||||
VueEasyTree, groupEdit, gbDeviceSelect
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -77,7 +77,7 @@ export default {
|
||||
} else if (node.data.id.length <= 8) {
|
||||
this.$axios({
|
||||
method: 'get',
|
||||
url: `/api/region/tree/list`,
|
||||
url: `/api/group/tree/list`,
|
||||
params: {
|
||||
query: this.searchSrt,
|
||||
parent: node.data.id
|
||||
@@ -112,7 +112,7 @@ export default {
|
||||
console.log(data)
|
||||
this.$axios({
|
||||
method: "post",
|
||||
url: `/api/common/channel/region/delete`,
|
||||
url: `/api/common/channel/group/delete`,
|
||||
data: {
|
||||
channelIds: [data.dbId]
|
||||
}
|
||||
@@ -145,11 +145,11 @@ export default {
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "新建节点",
|
||||
label: node.level === 1?"新建业务分组":"新建虚拟组织",
|
||||
icon: "el-icon-plus",
|
||||
disabled: false,
|
||||
onClick: () => {
|
||||
this.addRegion(data.id, node);
|
||||
this.addGroup(data.id, node);
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -171,7 +171,7 @@ export default {
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.removeRegion(data.id, node)
|
||||
this.removeGroup(data.id, node)
|
||||
}).catch(() => {
|
||||
|
||||
});
|
||||
@@ -222,10 +222,10 @@ export default {
|
||||
|
||||
return false;
|
||||
},
|
||||
removeRegion: function (id, node) {
|
||||
removeGroup: function (id, node) {
|
||||
this.$axios({
|
||||
method: "delete",
|
||||
url: `/api/region/delete`,
|
||||
url: `/api/group/delete`,
|
||||
params: {
|
||||
deviceId: id,
|
||||
}
|
||||
@@ -247,7 +247,7 @@ export default {
|
||||
}
|
||||
this.$axios({
|
||||
method: 'post',
|
||||
url: `/api/common/channel/region/device/add`,
|
||||
url: `/api/common/channel/group/device/add`,
|
||||
data: {
|
||||
civilCode: node.data.id,
|
||||
deviceIds: deviceIds,
|
||||
@@ -278,7 +278,7 @@ export default {
|
||||
}
|
||||
this.$axios({
|
||||
method: 'post',
|
||||
url: `/api/common/channel/region/device/delete`,
|
||||
url: `/api/common/channel/group/device/delete`,
|
||||
data: {
|
||||
deviceIds: deviceIds,
|
||||
}
|
||||
@@ -310,11 +310,10 @@ export default {
|
||||
node.loaded = false
|
||||
node.expand();
|
||||
},
|
||||
addRegion: function (id, node) {
|
||||
|
||||
console.log(node)
|
||||
|
||||
this.$refs.regionCode.openDialog(form => {
|
||||
addGroup: function (id, node) {
|
||||
this.$refs.groupEdit.openDialog({
|
||||
id: null
|
||||
},form => {
|
||||
node.loaded = false
|
||||
node.expand();
|
||||
}, id);
|
||||
|
||||
91
web_src/src/components/dialog/groupEdit.vue
Executable file
91
web_src/src/components/dialog/groupEdit.vue
Executable file
@@ -0,0 +1,91 @@
|
||||
<template>
|
||||
<div id="groupEdit" v-loading="loading">
|
||||
<el-dialog
|
||||
title="分组编辑"
|
||||
width="40%"
|
||||
top="2rem"
|
||||
:append-to-body="true"
|
||||
:close-on-click-modal="false"
|
||||
:visible.sync="showDialog"
|
||||
:destroy-on-close="true"
|
||||
@close="close()"
|
||||
>
|
||||
<div id="shared" style="margin-top: 1rem;margin-right: 100px;">
|
||||
<el-form ref="form" :rules="rules" :model="group" label-width="140px" >
|
||||
<el-form-item label="节点编号" prop="id" >
|
||||
<el-input v-model="group.deviceId" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="节点名称" prop="name">
|
||||
<el-input v-model="group.name" clearable></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<div style="float: right;">
|
||||
<el-button type="primary" @click="onSubmit" >确认</el-button>
|
||||
<el-button @click="close">取消</el-button>
|
||||
</div>
|
||||
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: "groupEdit",
|
||||
computed: {},
|
||||
props: [],
|
||||
created() {},
|
||||
data() {
|
||||
return {
|
||||
submitCallback: null,
|
||||
showDialog: false,
|
||||
loading: false,
|
||||
level: 0,
|
||||
group: {},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
openDialog: function (group, callback) {
|
||||
console.log(group)
|
||||
this.group = group;
|
||||
this.showDialog = true;
|
||||
this.submitCallback = callback;
|
||||
},
|
||||
onSubmit: function () {
|
||||
|
||||
this.$axios({
|
||||
method:"post",
|
||||
url: this.group.id ? '/api/group/add':'/api/group/update',
|
||||
data: this.group
|
||||
}).then((res)=> {
|
||||
if (res.data.code === 0) {
|
||||
this.$message.success("保存成功")
|
||||
if (this.submitCallback)this.submitCallback(this.group)
|
||||
}else {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: res.data.msg,
|
||||
type: "error",
|
||||
});
|
||||
}
|
||||
this.close();
|
||||
})
|
||||
.catch((error)=> {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: error,
|
||||
type: "error",
|
||||
});
|
||||
});
|
||||
},
|
||||
close: function () {
|
||||
this.showDialog = false;
|
||||
console.log(this.group)
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -21,7 +21,7 @@
|
||||
<el-option label="离线" value="false"></el-option>
|
||||
</el-select>
|
||||
添加状态:
|
||||
<el-select size="mini" style="width: 8rem; margin-right: 1rem;" @change="search" v-model="hasCivilCode" placeholder="请选择"
|
||||
<el-select size="mini" style="width: 8rem; margin-right: 1rem;" @change="search" v-model="hasGroup" placeholder="请选择"
|
||||
default-first-option>
|
||||
<el-option label="全部" value=""></el-option>
|
||||
<el-option label="已添加" value="true"></el-option>
|
||||
@@ -64,8 +64,8 @@
|
||||
<el-table-column label="添加状态" min-width="100">
|
||||
<template slot-scope="scope">
|
||||
<div slot="reference" class="name-wrapper">
|
||||
<el-tag size="medium" :title="scope.row.gbCivilCode" v-if="scope.row.gbCivilCode">已添加</el-tag>
|
||||
<el-tag size="medium" type="info" v-if="!scope.row.gbCivilCode">未添加</el-tag>
|
||||
<el-tag size="medium" :title="scope.row.gbBusinessGroupId" v-if="scope.row.gbBusinessGroupId">已添加</el-tag>
|
||||
<el-tag size="medium" type="info" v-if="!scope.row.gbBusinessGroupId">未添加</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -103,7 +103,7 @@ export default {
|
||||
searchSrt: "",
|
||||
channelType: "",
|
||||
online: "",
|
||||
hasCivilCode: "false",
|
||||
hasGroup: "false",
|
||||
winHeight: window.innerHeight - 180,
|
||||
currentPage: 1,
|
||||
count: 15,
|
||||
@@ -140,7 +140,7 @@ export default {
|
||||
count: this.count,
|
||||
query: this.searchSrt,
|
||||
online: this.online,
|
||||
hasCivilCode: this.hasCivilCode
|
||||
hasGroup: this.hasGroup
|
||||
}
|
||||
}).then((res)=> {
|
||||
if (res.data.code === 0) {
|
||||
|
||||
Reference in New Issue
Block a user