提交: 项目详情-左侧菜单栏目 收缩展开操作

This commit is contained in:
23688nl 2022-09-13 15:53:59 +08:00
parent 8f1460e4cb
commit c9de655899
8 changed files with 359 additions and 194 deletions

View File

@ -214,7 +214,19 @@ export default {
tempType: { tempType: {
type: String, type: String,
require: true require: true
} },
isFoldRight: {
type: Boolean,
default: () => {
return false
}
},
isShrink: {
type: Boolean,
default: () => {
return false
}
},
}, },
data() { data() {
return { return {
@ -277,6 +289,12 @@ export default {
}; };
}, },
watch: { watch: {
isFoldRight() {
this.updateEcharts()
},
isShrink() {
this.updateEcharts()
},
sourceId(val) { sourceId(val) {
if (val !== undefined && val !== null) { if (val !== undefined && val !== null) {
this.handleQuery() this.handleQuery()
@ -287,6 +305,11 @@ export default {
this.init(); this.init();
}, },
methods: { methods: {
updateEcharts() {
if (this.$refs.echartsLineTrend) {
this.$refs.echartsLineTrend.updateEchart()
}
},
handleQuery() { handleQuery() {
this.pageParams.pageNum = 1; this.pageParams.pageNum = 1;
this.time = this.time =
@ -325,6 +348,7 @@ export default {
); );
this.resultOption.xAxis[0].data = result["xAxisData"]; this.resultOption.xAxis[0].data = result["xAxisData"];
this.resultOption.series[0].data = result["seriesData"]; this.resultOption.series[0].data = result["seriesData"];
this.updateEcharts();
this.$forceUpdate(); this.$forceUpdate();
}); });
}, },

View File

@ -114,10 +114,10 @@
<el-dropdown-item @click.native="handleChildrenDevice(devItem)" <el-dropdown-item @click.native="handleChildrenDevice(devItem)"
>查看线路列表</el-dropdown-item >查看线路列表</el-dropdown-item
> >
<el-dropdown-item>修改服务指向</el-dropdown-item> <!-- <el-dropdown-item>修改服务指向</el-dropdown-item>
<el-dropdown-item>设备巡检记录</el-dropdown-item> <el-dropdown-item>设备巡检记录</el-dropdown-item> -->
<el-dropdown-item>设备参数调整</el-dropdown-item> <el-dropdown-item @click.native="handleLinkToDeviceDetails(devItem)">设备参数调整</el-dropdown-item>
<el-dropdown-item>内置定时配置</el-dropdown-item> <!-- <el-dropdown-item>内置定时配置</el-dropdown-item> -->
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</div> </div>
@ -461,6 +461,12 @@ export default {
} }
); );
}, },
/**
* 跳转 设备 详情
*/
handleLinkToDeviceDetails(row) {
this.$router.push({ path:'/device/device', query: { 'deviceId': row.deviceId, 'tempType': 'details' } })
}
}, },
destroyed() { destroyed() {
this.closeSocket(); this.closeSocket();

View File

@ -1,186 +0,0 @@
<template>
<div class="e-nav-menu">
<div
:class="
value === item[props['key']]
? 'nav-menu-item menu-selected'
: 'nav-menu-item'
"
v-for="item in activeList"
:key="item[props['key']]"
:style="{
flexWrap:
item[props['children']] && item[props['children']].length > 0
? 'wrap'
: '',
height:
developList.indexOf(item[props['key']]) >= 0 &&
item[props['children']] &&
item[props['children']].length > 0
? 'auto'
: ''
}"
@click="handleClick(item)"
>
<svg-icon slot="prefix" icon-class="A_yuanjiaodian" class="icon-left" />
<div class="nav-item-title">{{ item[props["label"]] }}</div>
<i class="el-icon-arrow-right icon-right"></i>
<div
style="height: 100%; width: 100%;"
v-if="
developList.indexOf(item[props['key']]) >= 0 &&
item[props['children']] &&
item[props['children']].length > 0
"
>
<div
:class="
value === childItem[props['key']]
? 'nav-menu-item nav-menu-children menu-selected'
: 'nav-menu-item nav-menu-children'
"
v-show="
developList.indexOf(item[props['key']]) >= 0 &&
item[props['children']] &&
item[props['children']].length > 0
"
v-for="childItem in item[props['children']]"
:key="childItem[props['key']]"
@click.stop="handleClick(childItem)"
>
<i
class="icon iconfont icontongxun icon-left"
style="margin-right: 5px"
></i>
<div class="nav-item-title">{{ childItem[props["label"]] }}</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: "ENavMenu",
props: {
value: {
type: [String, Number],
default: () => {
return 0;
},
},
props: {
type: Object,
default: () => {
return {
label: "label",
key: "key",
children: "children",
};
},
},
activeList: {
type: Array,
default: () => {
return [
{
label: "项目管理",
key: "projectOt",
},
{
label: "设备管理",
key: "projectOt",
},
];
},
},
singleDevelop: {
type: Boolean,
default: () => {
return true;
},
},
defaultDevelop: {
type: Array,
default: () => {
return [];
},
},
},
data() {
return {
developList: [],
};
},
created() {
this.developList = this.defaultDevelop;
},
methods: {
handleClick(row) {
if (
!row[this.props["children"]] ||
row[this.props["children"]].length <= 0
) {
this.$emit("input", row);
} else {
if (this.developList.indexOf(row[this.props["key"]]) >= 0) {
this.developList = this.developList.filter((v) => {
v !== row[this.props["key"]];
});
} else {
//
if (this.singleDevelop) {
this.developList = [];
}
this.developList.push(row[this.props["key"]]);
}
}
},
},
};
</script>
<style scoped lang="scss">
.e-nav-menu {
width: 150px;
height: 100%;
padding-top: 15px;
border-right: 1px solid #e8e8e8;
.nav-menu-item {
width: 100%;
height: 32px;
background: #fff;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 10px;
cursor: default;
.nav-item-title {
font-size: 14px;
font-family: "Source Han Sans CN";
font-weight: 400;
color: #344567;
color: #626262;
height: 32px;
display: flex;
align-items: center;
}
.icon-left {
font-size: 16px;
color: #9da3af;
}
.icon-right {
font-size: 18px;
}
}
.nav-menu-children {
padding-left: 35px;
padding-left: 17px;
justify-content: flex-start;
}
.menu-selected {
background: #f4f5f7;
.nav-item-title {
color: #1890ff;
}
}
}
</style>

View File

@ -0,0 +1,280 @@
<template>
<div class="e-nav-menu" :style="isShrink ? 'width: 40px' : ''">
<div
:class="
isShrink ? 'e-shrink is-shrink-true' : 'e-shrink is-shrink-false'
"
>
<i
class="el-icon-d-arrow-right"
title="点击展开"
v-if="isShrink === true"
@click="handleShrink(false)"
></i>
<i
class="el-icon-d-arrow-left"
title="点击折叠"
v-else-if="isShrink === false"
@click="handleShrink(true)"
></i>
</div>
<div v-if="isShrink === false">
<div
v-show="isShrink === false"
:class="
value === item[props['key']]
? 'nav-menu-item menu-selected'
: 'nav-menu-item'
"
v-for="item in activeList"
:key="item[props['key']]"
:style="{
flexWrap:
item[props['children']] && item[props['children']].length > 0
? 'wrap'
: '',
height:
developList.indexOf(item[props['key']]) >= 0 &&
item[props['children']] &&
item[props['children']].length > 0
? 'auto'
: '',
}"
@click="handleClick(item)"
>
<svg-icon slot="prefix" icon-class="A_yuanjiaodian" class="icon-left" />
<div class="nav-item-title">{{ item[props["label"]] }}</div>
<i class="el-icon-arrow-right icon-right"></i>
<div
style="height: 100%; width: 100%"
v-if="
developList.indexOf(item[props['key']]) >= 0 &&
item[props['children']] &&
item[props['children']].length > 0
"
>
<div
:class="
value === childItem[props['key']]
? 'nav-menu-item nav-menu-children menu-selected'
: 'nav-menu-item nav-menu-children'
"
v-show="
developList.indexOf(item[props['key']]) >= 0 &&
item[props['children']] &&
item[props['children']].length > 0
"
v-for="childItem in item[props['children']]"
:key="childItem[props['key']]"
@click.stop="handleClick(childItem)"
>
<i
class="icon iconfont icontongxun icon-left"
style="margin-right: 5px"
></i>
<div class="nav-item-title">{{ childItem[props["label"]] }}</div>
</div>
</div>
</div>
</div>
<div v-if="isShrink === true">
<div
v-show="isShrink === true"
class="nav-menu-item"
v-for="item in activeList"
:key="item[props['key']]"
>
<el-dropdown
type="primary"
placement="right-start"
:hide-on-click="true"
trigger="click"
>
<svg-icon
icon-class="A_yuanjiaodian"
:title="item[props['label']]"
class="icon-left"
/>
<el-dropdown-menu
slot="dropdown"
class="c-dropdown-c"
v-if="item[props['children']] && item[props['children']].length > 0"
>
<el-dropdown-item
v-show="
item[props['children']] && item[props['children']].length > 0
"
@click.native="handleClick(menuItem)"
v-for="(menuItem, idx) in item[props['children']]"
:key="idx"
>{{ menuItem[props["label"]] }}</el-dropdown-item
>
</el-dropdown-menu>
<el-dropdown-menu slot="dropdown" v-else>
<el-dropdown-item @click.native="handleClick(item)">
{{ item[props["label"]] }}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</div>
</div>
</template>
<script>
export default {
name: "ENavMenu",
props: {
value: {
type: [String, Number],
default: () => {
return 0;
},
},
props: {
type: Object,
default: () => {
return {
label: "label",
key: "key",
children: "children",
};
},
},
activeList: {
type: Array,
default: () => {
return [
{
label: "项目管理",
key: "projectOt",
},
{
label: "设备管理",
key: "projectOt",
},
];
},
},
singleDevelop: {
type: Boolean,
default: () => {
return true;
},
},
defaultDevelop: {
type: Array,
default: () => {
return [];
},
},
},
data() {
return {
developList: [],
isShrink: false,
shrinkShow: true,
};
},
created() {
this.developList = this.defaultDevelop;
},
methods: {
handleShrink(isTrue) {
this.isShrink = isTrue;
this.$emit("eventShrink", isTrue);
},
handleClick(row) {
if (
!row[this.props["children"]] ||
row[this.props["children"]].length <= 0
) {
this.$emit("input", row);
} else {
if (this.developList.indexOf(row[this.props["key"]]) >= 0) {
this.developList = this.developList.filter((v) => {
v !== row[this.props["key"]];
});
} else {
//
if (this.singleDevelop) {
this.developList = [];
}
this.developList.push(row[this.props["key"]]);
}
}
},
},
};
</script>
<style scoped lang="scss">
.e-nav-menu {
width: 150px;
height: 100%;
padding-top: 15px;
border-right: 1px solid #e8e8e8;
.e-shrink {
width: 20px;
height: 20px;
display: flex;
align-items: center;
justify-content: left;
border: 1px solid #e9e9e9;
border-radius: 0 50% 50% 0;
position: relative;
left: 40px;
font-size: 15px;
font-weight: 400;
border-left: 0;
top: -14px;
}
.e-shrink:hover {
border-color: #4395ff;
color: #4395ff;
}
.is-shrink-true {
left: 40px;
}
.is-shrink-false {
left: 100%;
}
.nav-menu-item {
width: 100%;
height: 32px;
background: #fff;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 10px;
cursor: default;
.nav-item-title {
font-size: 14px;
font-family: "Source Han Sans CN";
font-weight: 400;
color: #344567;
color: #626262;
height: 32px;
display: flex;
align-items: center;
}
.icon-left {
font-size: 16px;
color: #9da3af;
}
.icon-right {
font-size: 18px;
}
}
.nav-menu-children {
padding-left: 35px;
padding-left: 17px;
justify-content: flex-start;
}
.menu-selected {
background: #f4f5f7;
.nav-item-title {
color: #1890ff;
}
}
}
</style>

View File

@ -77,6 +77,12 @@ export default {
default: () => { default: () => {
return false return false
} }
},
isShrink: {
type: Boolean,
default: () => {
return false
}
} }
}, },
components: { components: {
@ -274,6 +280,17 @@ export default {
this.init(); this.init();
} }
}, },
isShrink() {
if(this.$refs.echartsLineTwoYearsLoad) {
this.$refs.echartsLineTwoYearsLoad.updateEchart()
}
if (this.$refs.echartsLineTwoWeeksLoad) {
this.$refs.echartsLineTwoWeeksLoad.updateEchart();
}
if (this.$refs.echartsLineTwoDaysLoad) {
this.$refs.echartsLineTwoDaysLoad.updateEchart();
}
},
isFoldRight() { isFoldRight() {
if(this.$refs.echartsLineTwoYearsLoad) { if(this.$refs.echartsLineTwoYearsLoad) {
this.$refs.echartsLineTwoYearsLoad.updateEchart() this.$refs.echartsLineTwoYearsLoad.updateEchart()

View File

@ -200,7 +200,13 @@ export default {
default: () => { default: () => {
return false return false
} }
} },
isShrink: {
type: Boolean,
default: () => {
return false
}
},
}, },
components: { components: {
EEchartsLine, EEchartsLine,
@ -319,6 +325,9 @@ export default {
isFoldRight() { isFoldRight() {
this.updateEcharts() this.updateEcharts()
}, },
isShrink() {
this.updateEcharts()
},
sourceId(val) { sourceId(val) {
if (val !== null && val !== undefined) { if (val !== null && val !== undefined) {
this.init(); this.init();

View File

@ -194,6 +194,12 @@ export default {
default: () => { default: () => {
return false return false
} }
},
isShrink: {
type: Boolean,
default: () => {
return false
}
} }
}, },
components: { EEchartsLine }, components: { EEchartsLine },
@ -280,6 +286,9 @@ export default {
isFoldRight() { isFoldRight() {
this.updateEcharts() this.updateEcharts()
}, },
isShrink() {
this.updateEcharts()
},
sourceId(val) { sourceId(val) {
if (val !== null && val !== undefined) { if (val !== null && val !== undefined) {
this.handleQuery(); this.handleQuery();

View File

@ -73,6 +73,9 @@
<e-nav-menu <e-nav-menu
v-model="activeType" v-model="activeType"
:activeList="activeList" :activeList="activeList"
@eventShrink="(data) => {
isShrink = data ? true : false
}"
@input=" @input="
(data) => { (data) => {
activeName = data['template']; activeName = data['template'];
@ -80,13 +83,14 @@
} }
" "
/> />
<div class="main-block"> <div class="main-block" :style="isShrink ? 'width: 100%;':'width: calc(100% - 150px);'">
<component <component
:is="activeName" :is="activeName"
:projectInfo="infoData" :projectInfo="infoData"
:projectTypeOptions="projectTypeOptions" :projectTypeOptions="projectTypeOptions"
:sourceId="stateSourceId" :sourceId="stateSourceId"
:tempType="activeType" :tempType="activeType"
:isShrink="isShrink"
:isFoldRight="isFoldRight" :isFoldRight="isFoldRight"
></component> ></component>
</div> </div>
@ -131,7 +135,7 @@ import ECensusCards from "./ECensusCards";
import ElDescriptions from "@/components/Edescriptions"; import ElDescriptions from "@/components/Edescriptions";
import ElDescriptionsItem from "@/components/Edescriptions/src/descriptions-item"; import ElDescriptionsItem from "@/components/Edescriptions/src/descriptions-item";
import ESimpleCard from "@/components/Cards/index"; import ESimpleCard from "@/components/Cards/index";
import ENavMenu from "./ENavMenu"; import ENavMenu from "./ENavMenu/index";
import EProjectManage from "./EProjectManage"; import EProjectManage from "./EProjectManage";
import ETodayRatio from "./ETodayRatio"; import ETodayRatio from "./ETodayRatio";
import ETypeCensus from "./ETypeCensus"; import ETypeCensus from "./ETypeCensus";
@ -180,6 +184,7 @@ export default {
resultInfo: {}, resultInfo: {},
activeName: "EObjectContainer", activeName: "EObjectContainer",
activeType: "EObjectContainer", activeType: "EObjectContainer",
isShrink: false,
activeList: [ activeList: [
{ {
label: "项目信息", label: "项目信息",
@ -585,6 +590,7 @@ export default {
padding: 15px; padding: 15px;
width: calc(100% - 150px); width: calc(100% - 150px);
height: 100%; height: 100%;
width: 100%;
} }
} }
} }