middleground_code_v2/src/views/masterDataOptions/settingMenu.vue

245 lines
5.9 KiB
Vue
Raw Normal View History

2024-03-26 11:18:19 +08:00
<template>
<div class="settingMenu">
<div class="menu">
<div class="appInfo">
<div class="img" v-loading="imgLoading">
<template v-if="imgUrl">
<img :src="imgUrl" alt="" style="width: 64px; height: 64px"/>
</template>
<template v-if="!imgUrl">
<img src="./images/icon.png" alt="" style="width: 64px; height: 64px"/>
</template>
</div>
<div class="appName">{{ name }}</div>
<div class="version" v-if="code">编码{{ code }}</div>
2024-03-26 11:18:19 +08:00
</div>
<div class="menuList">
<div class="item" v-for="(item, index) in settingMunu" :key="index" @click="menuClick(index, item)">
<div class="icon" :class="{ actived: index == menuActived }">
<svg-icon class="iconfont" :icon-class="item.icon" fill="currentColor"/>
</div>
<div class="title">{{ item.title }}</div>
</div>
</div>
</div>
<div class="content">
<router-view ref="routerChunk" :build="billid" @saveSuccess="saveSuccess" @saveSuccessInit="saveSuccessInit"
@flashActive="flashActive"
></router-view>
2024-03-26 11:18:19 +08:00
</div>
</div>
</template>
<script>
import { getApiModuleApi } from '@/api/apiChunks/index.js'
import configData from './configData'
2024-03-26 11:18:19 +08:00
// 应用信息
import masterDataAdd from './masterDataAdd.vue'
import request from '@/utils/request'
2024-03-26 11:18:19 +08:00
export default {
data() {
return {
menuActived: 0,
settingMunu: configData.settingMenu,
query: this.$route.query,
name: '',
code: '',
imgUrl: '',
versionNumber: '',
2024-03-26 11:18:19 +08:00
imgLoading: false,
billid: ''
}
2024-03-26 11:18:19 +08:00
},
methods: {
//当新增完基本信息后
saveSuccessInit(res, fun) {
console.log(res, 'res')
this.billid = res.attribute.id
2024-06-20 11:40:09 +08:00
this.mdmCode = res.attribute.mdmCode
this.$refs.routerChunk.billid = this.billid
this.initEditFormData()
fun()
},
2024-03-26 11:18:19 +08:00
flashActive(val) {
this.menuActived = val
},
async initEditFormData() {
const res = await getApiModuleApi({
tl: 'mdmModuleService',
as: '',
dj: 'getMdm'
}, { id: this.billid })
2024-03-26 11:18:19 +08:00
if (res.status === '200') {
this.name = res.attribute.mdmName
this.code = res.attribute.mdmCode
2024-03-26 11:18:19 +08:00
//下载logo
this.imgLoading = true
return request({
url: '/kangarooDataCenterV3/entranceController/fileDownloadNew?id=' + res.attribute.mdmLogo,
method: 'get',
2024-03-26 11:18:19 +08:00
responseType: 'arraybuffer'
}).then((res) => {
this.imgLoading = false
if (!res.byteLength) {
this.imgUrl = false
return
}
this.imgUrl =
'data:image/png/jpg;base64,' + btoa(new Uint8Array(res).reduce((data, byte) => data + String.fromCharCode(byte), ''))
2024-03-26 11:18:19 +08:00
})
}
},
//菜单点击事件
saveSuccess() {
this.initEditFormData()
},
menuClick(index, item) {
console.log(index, item)
if (index !== 0 && !this.billid) {
this.$vmNews('当前为新增请先新增后再跳转该模块')
return
}
2024-03-26 11:18:19 +08:00
if (item.path && !this.$route.path.includes(item.path)) {
this.menuActived = index
this.$set(this.query, 'id', this.billid)
2024-06-20 11:40:09 +08:00
this.$set(this.query, 'mdmCode', this.mdmCode)
2024-03-26 11:18:19 +08:00
this.$router.replace({
2024-06-20 11:40:09 +08:00
path: item.path,
2024-03-26 11:18:19 +08:00
query: this.query
})
2024-03-26 11:18:19 +08:00
}
}
2024-03-26 11:18:19 +08:00
},
components: {
masterDataAdd
2024-03-26 11:18:19 +08:00
},
mounted() {
if (this.$route.query.flag !== 'new') {
this.billid = this.$route.query.id
2024-06-20 11:40:09 +08:00
this.mdmCode = this.$route.query.mdmCode
this.initEditFormData()
}
2024-03-26 11:18:19 +08:00
}
}
2024-03-26 11:18:19 +08:00
</script>
<style scoped lang="scss">
2024-03-26 11:18:19 +08:00
.settingMenu {
width: 100%;
display: flex;
position: relative;
background: #fafafa !important;
overflow: auto;
.menu {
position: fixed;
width: 180px;
2024-03-26 11:18:19 +08:00
height: 90vh;
//margin-right: 1%;
background-color: #fff;
border-radius: 16px;
overflow: auto;
.appInfo {
padding: 10px 0;
2024-03-26 11:18:19 +08:00
border-bottom: 1px solid #f3f3f3;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
> .img {
width: 64px;
height: 64px;
}
.appName {
margin-top: 8px;
font-weight: 600;
font-size: 18px;
}
.version {
margin-top: 10px;
2024-03-26 11:18:19 +08:00
font-size: 12px;
padding: 1px 2px;
color: #ff8b0f;
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 14px;
color: #333333;
line-height: 20px;
text-align: left;
font-style: normal;
2024-03-26 11:18:19 +08:00
}
}
.menuList {
margin-top: 20px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.item {
margin-bottom: 20px;
2024-03-26 11:18:19 +08:00
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
> .icon {
width: 50px;
height: 50px;
2024-03-26 11:18:19 +08:00
text-align: center;
border-radius: 12px;
display: flex;
justify-content: center;
align-items: center;
> .iconfont {
font-weight: 300;
font-size: 35px;
2024-03-26 11:18:19 +08:00
color: #000;
}
&:hover {
background-color: #1478f6 !important;
> .iconfont {
color: #fff !important;
}
}
}
> .title {
margin-top: 10px;
2024-03-26 11:18:19 +08:00
color: #333333;
font-size: 16px;
2024-03-26 11:18:19 +08:00
font-weight: 600;
user-select: none;
}
}
.actived {
background-color: #1478f6 !important;
> .iconfont {
color: #fff !important;
}
}
}
}
.content {
margin-left: 180px;
flex: 1;
width: calc(100% - 190px);
2024-03-26 11:18:19 +08:00
border-radius: 16px;
}
}
</style>