提交:项目详情 设备管理模块增加 tab 选择展示效果

This commit is contained in:
23688nl 2022-09-05 11:35:00 +08:00
parent 6c79234558
commit 457464e133
2 changed files with 111 additions and 21 deletions

View File

@ -70,9 +70,9 @@
>查询</el-button >查询</el-button
> >
</div> </div>
<div class="other-print"> <!-- <div class="other-print">
<i class="el-icon-printer"></i> <i class="el-icon-printer"></i>
</div> </div> -->
</div> </div>
</div> </div>

View File

@ -1,52 +1,142 @@
<template> <template>
<div class="e-object-device-manage"> <div class="e-object-device-manage">
<el-tabs v-model="activeName"> <el-tabs v-model="activeName">
<el-tab-pane :label="tabLabel.dictLabel" :name="tabLabel.dictValue" v-for="(tabLabel, idx) in projectDeviceTagGroup" :key="idx"> <el-tab-pane
<e-device-table v-if="tabLabel.dictValue === activeName" :sourceId="sourceId" :deviceType="tabLabel.dictValue" /> :label="tabLabel.dictLabel"
:name="tabLabel.dictValue"
v-for="(tabLabel, idx) in filterList"
:key="idx"
>
<e-device-table
v-if="tabLabel.dictValue === activeName"
:sourceId="sourceId"
:deviceType="tabLabel.dictValue"
/>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
<div class="e-tabs-screen" v-show="dialogWrapper">
<el-dropdown :hide-on-click="false" @visible-change="handleVisibleChange">
<i class="iconfont iconshaixuan icon-screen"></i>
<el-dropdown-menu slot="dropdown">
<el-checkbox-group v-model="filterSelect">
<el-dropdown-item
v-for="(dropItem, index) in projectDeviceTagGroup"
:key="index"
>
<el-checkbox
:label="dropItem.dictValue"
:disabled="activeName === dropItem['dictValue']"
>{{ dropItem.dictLabel }}</el-checkbox
>
</el-dropdown-item>
<el-dropdown-item divided>
<div
style="
width: 100%;
display: flex;
justify-content: space-evenly;
"
>
<el-button type="text" @click="handleTabReduction">全选</el-button>
<el-button type="primary" size="mini" @click="handleTabScreen"
>确定</el-button
>
</div>
</el-dropdown-item>
</el-checkbox-group>
</el-dropdown-menu>
</el-dropdown>
</div>
</div> </div>
</template> </template>
<script> <script>
import EDeviceTable from './EDeviceTable' import EDeviceTable from "./EDeviceTable";
export default { export default {
name: 'EObjectDeviceManage', name: "EObjectDeviceManage",
components: { components: {
EDeviceTable EDeviceTable,
}, },
props: { props: {
projectInfo: { projectInfo: {
type: Object, type: Object,
require: true require: true,
}, },
sourceId: { sourceId: {
type: [Number, String], type: [Number, String],
require: true require: true,
} },
}, },
data() { data() {
return { return {
activeName: '', activeName: "",
projectDeviceTagGroup: [] projectDeviceTagGroup: [],
} filterList: [],
}, filterSelect: [],
created() { dialogWrapper: false,
this.getDicts("project_device_tag_group").then(response => {
this.projectDeviceTagGroup = response.data;
if (this.projectDeviceTagGroup && this.projectDeviceTagGroup.length > 0) {
this.activeName = this.projectDeviceTagGroup[0]['dictValue'] || ''
}; };
},
watch: {},
created() {
this.getDicts("project_device_tag_group").then((response) => {
this.projectDeviceTagGroup = response.data;
//
this.filterList = [...this.projectDeviceTagGroup];
this.filterSelect = [...this.filterList].map((v) => {
return v["dictValue"];
});
this.dialogWrapper = true;
if (this.projectDeviceTagGroup && this.projectDeviceTagGroup.length > 0) {
this.activeName = this.projectDeviceTagGroup[0]["dictValue"] || "";
}
}); });
}, },
methods: { methods: {
handleVisibleChange(e) {
if (e) {
this.filterSelect = [...this.filterList].map((v) => {
return v["dictValue"];
});
}
},
handleTabReduction() {
this.filterList = [];
this.filterList = [...this.projectDeviceTagGroup];
this.filterSelect = [...this.filterList].map((v) => {
return v["dictValue"];
});
this.$forceUpdate();
},
handleTabScreen() {
this.filterList = [];
this.filterList = this.projectDeviceTagGroup.filter(
(v) => this.filterSelect.indexOf(v["dictValue"]) >= 0
);
console.log(this.filterList)
this.$forceUpdate();
},
// //
statusFormat(row, column) { statusFormat(row, column) {
return this.selectDictLabel(this.projectDeviceTagGroup, row.industry); return this.selectDictLabel(this.projectDeviceTagGroup, row.industry);
}, },
// //
getGatewayDeviceList() { getGatewayDeviceList() {},
}, },
} };
}
</script> </script>
<style lang="scss">
.e-object-device-manage {
width: 100%;
height: 100%;
display: flex;
.e-tabs-screen {
width: 0;
.icon-screen {
position: relative;
right: 25px;
top: 5px;
font-size: 20px;
color: #606266;
}
}
}
</style>