|
@@ -4,14 +4,15 @@
|
|
|
<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;">
|
|
|
- <el-input @input="search" style="visibility:hidden; margin-right: 1rem; width: 12rem;" size="mini" placeholder="关键字"
|
|
|
|
|
|
|
+ <el-input @input="search" style="visibility:hidden; margin-right: 1rem; width: 12rem;" size="mini"
|
|
|
|
|
+ placeholder="关键字"
|
|
|
prefix-icon="el-icon-search" v-model="searchSrt" clearable></el-input>
|
|
prefix-icon="el-icon-search" v-model="searchSrt" clearable></el-input>
|
|
|
|
|
|
|
|
<el-checkbox v-model="showCode">显示编号</el-checkbox>
|
|
<el-checkbox v-model="showCode">显示编号</el-checkbox>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <div v-if="showHeader" style="height: 2rem; background-color: #FFFFFF" ></div>
|
|
|
|
|
|
|
+ <div v-if="showHeader" style="height: 2rem; background-color: #FFFFFF"></div>
|
|
|
<div>
|
|
<div>
|
|
|
<vue-easy-tree
|
|
<vue-easy-tree
|
|
|
class="flow-tree"
|
|
class="flow-tree"
|
|
@@ -27,22 +28,21 @@
|
|
|
@node-contextmenu="contextmenuEventHandler"
|
|
@node-contextmenu="contextmenuEventHandler"
|
|
|
@node-click="nodeClickHandler"
|
|
@node-click="nodeClickHandler"
|
|
|
>
|
|
>
|
|
|
- <template v-slot:default="{ node, data }">
|
|
|
|
|
|
|
+ <template v-slot:default="{ node, data }">
|
|
|
<span class="custom-tree-node">
|
|
<span class="custom-tree-node">
|
|
|
- <span @click.stop v-if="edit">
|
|
|
|
|
- <el-radio v-if="node.data.type === 0 && node.level > 2" style="margin-right: 0" v-model="chooseId" @input="chooseIdChange(node.data.treeId, node.data.deviceId, node.data.businessGroup)" :label="node.data.deviceId">{{''}}</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 && node.data.status === 'ON'" style="color: #409EFF" class="iconfont icon-shexiangtou2"></span>
|
|
|
|
|
- <span v-if="node.data.type === 1 && node.data.status !== 'ON'" style="color: #808181" class="iconfont icon-shexiangtou2"></span>
|
|
|
|
|
- <span style=" padding-left: 1px" v-if="node.data.deviceId !=='' && showCode" :title="node.data.deviceId">{{ node.label }}(编号:{{ node.data.deviceId }})</span>
|
|
|
|
|
- <span style=" padding-left: 1px" v-if="node.data.deviceId ==='' || !showCode" :title="node.data.deviceId">{{ node.label }}</span>
|
|
|
|
|
|
|
+ <span v-if="node.data.type === 0 && chooseId !== node.data.deviceId" style="color: #409EFF" class="iconfont icon-bianzubeifen3"></span>
|
|
|
|
|
+ <span v-if="node.data.type === 0 && chooseId === node.data.deviceId" style="color: #c60135;" class="iconfont icon-bianzubeifen3"></span>
|
|
|
|
|
+ <span v-if="node.data.type === 1 && node.data.status === 'ON'" style="color: #409EFF" class="iconfont icon-shexiangtou2"></span>
|
|
|
|
|
+ <span v-if="node.data.type === 1 && node.data.status !== 'ON'" style="color: #808181" class="iconfont icon-shexiangtou2"></span>
|
|
|
|
|
+ <span style=" padding-left: 1px" v-if="node.data.deviceId !=='' && showCode" :title="node.data.deviceId">{{ node.label }}(编号:{{ node.data.deviceId }})</span>
|
|
|
|
|
+ <span style=" padding-left: 1px" v-if="node.data.deviceId ==='' || !showCode" :title="node.data.deviceId">{{ node.label }}</span>
|
|
|
</span>
|
|
</span>
|
|
|
</template>
|
|
</template>
|
|
|
</vue-easy-tree>
|
|
</vue-easy-tree>
|
|
|
</div>
|
|
</div>
|
|
|
<groupEdit ref="groupEdit"></groupEdit>
|
|
<groupEdit ref="groupEdit"></groupEdit>
|
|
|
<gbDeviceSelect ref="gbDeviceSelect"></gbDeviceSelect>
|
|
<gbDeviceSelect ref="gbDeviceSelect"></gbDeviceSelect>
|
|
|
|
|
+ <gbChannelSelect ref="gbChannelSelect"></gbChannelSelect>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -50,10 +50,12 @@
|
|
|
import VueEasyTree from "@wchbrad/vue-easy-tree";
|
|
import VueEasyTree from "@wchbrad/vue-easy-tree";
|
|
|
import groupEdit from './../dialog/groupEdit'
|
|
import groupEdit from './../dialog/groupEdit'
|
|
|
import gbDeviceSelect from './../dialog/GbDeviceSelect'
|
|
import gbDeviceSelect from './../dialog/GbDeviceSelect'
|
|
|
|
|
+import GbChannelSelect from "../dialog/GbChannelSelect.vue";
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
name: 'DeviceTree',
|
|
name: 'DeviceTree',
|
|
|
components: {
|
|
components: {
|
|
|
|
|
+ GbChannelSelect,
|
|
|
VueEasyTree, groupEdit, gbDeviceSelect
|
|
VueEasyTree, groupEdit, gbDeviceSelect
|
|
|
},
|
|
},
|
|
|
data() {
|
|
data() {
|
|
@@ -68,7 +70,7 @@ export default {
|
|
|
treeData: [],
|
|
treeData: [],
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- props: ['edit', 'clickEvent', 'chooseIdChange', 'onChannelChange', 'showHeader'],
|
|
|
|
|
|
|
+ props: ['edit', 'clickEvent', 'onChannelChange', 'showHeader', 'hasChannel', 'addChannelToGroup'],
|
|
|
created() {
|
|
created() {
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
@@ -94,7 +96,8 @@ export default {
|
|
|
url: `/api/group/tree/list`,
|
|
url: `/api/group/tree/list`,
|
|
|
params: {
|
|
params: {
|
|
|
query: this.searchSrt,
|
|
query: this.searchSrt,
|
|
|
- parent: node.data.id
|
|
|
|
|
|
|
+ parent: node.data.id,
|
|
|
|
|
+ hasChannel: this.hasChannel
|
|
|
}
|
|
}
|
|
|
}).then((res) => {
|
|
}).then((res) => {
|
|
|
if (res.data.code === 0) {
|
|
if (res.data.code === 0) {
|
|
@@ -113,42 +116,7 @@ export default {
|
|
|
if (!this.edit) {
|
|
if (!this.edit) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- console.log(node.level)
|
|
|
|
|
- if (node.data.type === 1) {
|
|
|
|
|
- data.parentId = node.parent.data.id;
|
|
|
|
|
- this.$contextmenu({
|
|
|
|
|
- items: [
|
|
|
|
|
- {
|
|
|
|
|
- label: "移除通道",
|
|
|
|
|
- icon: "el-icon-delete",
|
|
|
|
|
- disabled: false,
|
|
|
|
|
- onClick: () => {
|
|
|
|
|
- console.log(data)
|
|
|
|
|
- this.$axios({
|
|
|
|
|
- method: "post",
|
|
|
|
|
- url: `/api/common/channel/group/delete`,
|
|
|
|
|
- data: {
|
|
|
|
|
- channelIds: [data.id]
|
|
|
|
|
- }
|
|
|
|
|
- }).then((res) => {
|
|
|
|
|
- console.log("移除成功")
|
|
|
|
|
- console.log(node)
|
|
|
|
|
- if (this.onChannelChange) {
|
|
|
|
|
- this.onChannelChange()
|
|
|
|
|
- }
|
|
|
|
|
- node.parent.loaded = false
|
|
|
|
|
- node.parent.expand();
|
|
|
|
|
- }).catch(function (error) {
|
|
|
|
|
- console.log(error);
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- ],
|
|
|
|
|
- event, // 鼠标事件信息
|
|
|
|
|
- customClass: "custom-class", // 自定义菜单 class
|
|
|
|
|
- zIndex: 3000, // 菜单样式 z-index
|
|
|
|
|
- });
|
|
|
|
|
- } else if (node.data.type === 0) {
|
|
|
|
|
|
|
+ if (node.data.type === 0) {
|
|
|
this.$contextmenu({
|
|
this.$contextmenu({
|
|
|
items: [
|
|
items: [
|
|
|
{
|
|
{
|
|
@@ -204,10 +172,19 @@ export default {
|
|
|
label: "移除设备",
|
|
label: "移除设备",
|
|
|
icon: "el-icon-delete",
|
|
icon: "el-icon-delete",
|
|
|
disabled: node.level <= 2,
|
|
disabled: node.level <= 2,
|
|
|
|
|
+ divided: true,
|
|
|
onClick: () => {
|
|
onClick: () => {
|
|
|
this.removeChannelFormDevice(data.id, node)
|
|
this.removeChannelFormDevice(data.id, node)
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ {
|
|
|
|
|
+ label: "添加通道",
|
|
|
|
|
+ icon: "el-icon-plus",
|
|
|
|
|
+ disabled: node.level <= 2,
|
|
|
|
|
+ onClick: () => {
|
|
|
|
|
+ this.addChannel(data.id, node)
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
// {
|
|
// {
|
|
|
// label: "导出",
|
|
// label: "导出",
|
|
|
// icon: "el-icon-download",
|
|
// icon: "el-icon-download",
|
|
@@ -250,15 +227,15 @@ export default {
|
|
|
node.parent.loaded = false
|
|
node.parent.loaded = false
|
|
|
node.parent.expand();
|
|
node.parent.expand();
|
|
|
if (this.onChannelChange) {
|
|
if (this.onChannelChange) {
|
|
|
- this.onChannelChange()
|
|
|
|
|
|
|
+ this.onChannelChange(node.data.deviceId)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}).catch(function (error) {
|
|
}).catch(function (error) {
|
|
|
- console.log(error);
|
|
|
|
|
|
|
+ console.log(error);
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
addChannelFormDevice: function (id, node) {
|
|
addChannelFormDevice: function (id, node) {
|
|
|
- this.$refs.gbDeviceSelect.openDialog((rows)=>{
|
|
|
|
|
|
|
+ this.$refs.gbDeviceSelect.openDialog((rows) => {
|
|
|
let deviceIds = []
|
|
let deviceIds = []
|
|
|
for (let i = 0; i < rows.length; i++) {
|
|
for (let i = 0; i < rows.length; i++) {
|
|
|
deviceIds.push(rows[i].id)
|
|
deviceIds.push(rows[i].id)
|
|
@@ -271,26 +248,26 @@ export default {
|
|
|
businessGroup: node.data.businessGroup,
|
|
businessGroup: node.data.businessGroup,
|
|
|
deviceIds: deviceIds,
|
|
deviceIds: deviceIds,
|
|
|
}
|
|
}
|
|
|
- }).then((res)=> {
|
|
|
|
|
|
|
+ }).then((res) => {
|
|
|
if (res.data.code === 0) {
|
|
if (res.data.code === 0) {
|
|
|
this.$message.success({
|
|
this.$message.success({
|
|
|
- showClose: true,
|
|
|
|
|
- message: "保存成功"
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ showClose: true,
|
|
|
|
|
+ message: "保存成功"
|
|
|
|
|
+ })
|
|
|
if (this.onChannelChange) {
|
|
if (this.onChannelChange) {
|
|
|
this.onChannelChange()
|
|
this.onChannelChange()
|
|
|
}
|
|
}
|
|
|
console.log(node)
|
|
console.log(node)
|
|
|
node.loaded = false
|
|
node.loaded = false
|
|
|
node.expand();
|
|
node.expand();
|
|
|
- }else {
|
|
|
|
|
|
|
+ } else {
|
|
|
this.$message.error({
|
|
this.$message.error({
|
|
|
showClose: true,
|
|
showClose: true,
|
|
|
message: res.data.msg
|
|
message: res.data.msg
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
this.loading = false
|
|
this.loading = false
|
|
|
- }).catch((error)=> {
|
|
|
|
|
|
|
+ }).catch((error) => {
|
|
|
this.$message.error({
|
|
this.$message.error({
|
|
|
showClose: true,
|
|
showClose: true,
|
|
|
message: error
|
|
message: error
|
|
@@ -300,7 +277,7 @@ export default {
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
removeChannelFormDevice: function (id, node) {
|
|
removeChannelFormDevice: function (id, node) {
|
|
|
- this.$refs.gbDeviceSelect.openDialog((rows)=>{
|
|
|
|
|
|
|
+ this.$refs.gbDeviceSelect.openDialog((rows) => {
|
|
|
let deviceIds = []
|
|
let deviceIds = []
|
|
|
for (let i = 0; i < rows.length; i++) {
|
|
for (let i = 0; i < rows.length; i++) {
|
|
|
deviceIds.push(rows[i].id)
|
|
deviceIds.push(rows[i].id)
|
|
@@ -311,25 +288,25 @@ export default {
|
|
|
data: {
|
|
data: {
|
|
|
deviceIds: deviceIds,
|
|
deviceIds: deviceIds,
|
|
|
}
|
|
}
|
|
|
- }).then((res)=> {
|
|
|
|
|
|
|
+ }).then((res) => {
|
|
|
if (res.data.code === 0) {
|
|
if (res.data.code === 0) {
|
|
|
this.$message.success({
|
|
this.$message.success({
|
|
|
- showClose: true,
|
|
|
|
|
- message: "保存成功"
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ showClose: true,
|
|
|
|
|
+ message: "保存成功"
|
|
|
|
|
+ })
|
|
|
if (this.onChannelChange) {
|
|
if (this.onChannelChange) {
|
|
|
this.onChannelChange()
|
|
this.onChannelChange()
|
|
|
}
|
|
}
|
|
|
node.loaded = false
|
|
node.loaded = false
|
|
|
node.expand();
|
|
node.expand();
|
|
|
- }else {
|
|
|
|
|
|
|
+ } else {
|
|
|
this.$message.error({
|
|
this.$message.error({
|
|
|
showClose: true,
|
|
showClose: true,
|
|
|
message: res.data.msg
|
|
message: res.data.msg
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
this.loading = false
|
|
this.loading = false
|
|
|
- }).catch((error)=> {
|
|
|
|
|
|
|
+ }).catch((error) => {
|
|
|
this.$message.error({
|
|
this.$message.error({
|
|
|
showClose: true,
|
|
showClose: true,
|
|
|
message: error
|
|
message: error
|
|
@@ -338,6 +315,13 @@ export default {
|
|
|
});
|
|
});
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
|
|
+ addChannel: function (id, node) {
|
|
|
|
|
+ this.$refs.gbChannelSelect.openDialog((data) => {
|
|
|
|
|
+ console.log("选择的数据")
|
|
|
|
|
+ console.log(data)
|
|
|
|
|
+ this.addChannelToGroup(node.data.deviceId, node.data.businessGroup, data)
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
refreshNode: function (node) {
|
|
refreshNode: function (node) {
|
|
|
console.log(node)
|
|
console.log(node)
|
|
|
node.loaded = false
|
|
node.loaded = false
|
|
@@ -358,10 +342,10 @@ export default {
|
|
|
name: "",
|
|
name: "",
|
|
|
deviceId: "",
|
|
deviceId: "",
|
|
|
civilCode: "",
|
|
civilCode: "",
|
|
|
- parentDeviceId: node.level > 2 ? node.data.deviceId:"",
|
|
|
|
|
|
|
+ parentDeviceId: node.level > 2 ? node.data.deviceId : "",
|
|
|
parentId: node.data.id,
|
|
parentId: node.data.id,
|
|
|
- businessGroup: node.level > 2 ? node.data.businessGroup: node.data.deviceId,
|
|
|
|
|
- },form => {
|
|
|
|
|
|
|
+ businessGroup: node.level > 2 ? node.data.businessGroup : node.data.deviceId,
|
|
|
|
|
+ }, form => {
|
|
|
console.log(node)
|
|
console.log(node)
|
|
|
node.loaded = false
|
|
node.loaded = false
|
|
|
node.expand();
|
|
node.expand();
|
|
@@ -369,13 +353,14 @@ export default {
|
|
|
},
|
|
},
|
|
|
editGroup: function (id, node) {
|
|
editGroup: function (id, node) {
|
|
|
console.log(node)
|
|
console.log(node)
|
|
|
- this.$refs.groupEdit.openDialog(node.data,form => {
|
|
|
|
|
|
|
+ this.$refs.groupEdit.openDialog(node.data, form => {
|
|
|
console.log(node)
|
|
console.log(node)
|
|
|
node.parent.loaded = false
|
|
node.parent.loaded = false
|
|
|
node.parent.expand();
|
|
node.parent.expand();
|
|
|
}, id);
|
|
}, id);
|
|
|
},
|
|
},
|
|
|
nodeClickHandler: function (data, node, tree) {
|
|
nodeClickHandler: function (data, node, tree) {
|
|
|
|
|
+ this.chooseId = data.deviceId;
|
|
|
if (this.clickEvent) {
|
|
if (this.clickEvent) {
|
|
|
this.clickEvent(data)
|
|
this.clickEvent(data)
|
|
|
}
|
|
}
|
|
@@ -404,6 +389,7 @@ export default {
|
|
|
.device-offline {
|
|
.device-offline {
|
|
|
color: #727272;
|
|
color: #727272;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
.custom-tree-node .el-radio__label {
|
|
.custom-tree-node .el-radio__label {
|
|
|
padding-left: 4px !important;
|
|
padding-left: 4px !important;
|
|
|
}
|
|
}
|