From 9ff66017debadfc89bc0c1b796684a4d1dbe2bc3 Mon Sep 17 00:00:00 2001 From: fangyuan <527392886@qq.com> Date: 星期五, 16 十二月 2022 10:00:02 +0800 Subject: [PATCH] 已上报到市批量操作按钮隐藏 --- src/views/layout/components/Header/index.vue | 396 +++++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 347 insertions(+), 49 deletions(-) diff --git a/src/views/layout/components/Header/index.vue b/src/views/layout/components/Header/index.vue index 02def97..058dd9d 100644 --- a/src/views/layout/components/Header/index.vue +++ b/src/views/layout/components/Header/index.vue @@ -1,79 +1,377 @@ <template> <!-- 澶撮儴 --> - <el-header> - <!-- 灞曞紑鎺у埗鎸夐挳 --> - <!-- <hamburger :is-active="opened" class="hamburger-container" @toggleClick="toggleSideBar" /> --> - <!-- 鍙充晶鑿滃崟 --> - <div class="header-title"> - <div class="bell"> - <el-icon class="el-icon-bell" style="color: white"></el-icon> + <el-header v-if="show"> + <!-- 宸︿晶鑿滃崟 --> + <div class="header-left"> + <div class="menu-left__item" v-for="(item, index) in menuLeftList" :key="item.id" @click="changeActive(index)"> + <span :class="item.checked ? 'my-active' : ''" @click="menuChange(item)">{{ item.label }}</span> </div> - <div class="userinfo"> - <div class="avatar"></div> - <span class="username">admin</span> + </div> + <!-- 鍙充晶鑿滃崟 --> + <div class="header-right"> + <div class="menu-right__item search"></div> + <!-- 鐧诲綍鐢ㄦ埛 --> + <div class="menu-right__item user" @mousemove="flag.user = true" @mouseleave="flag.user = false"> + <el-avatar :size="20" :src="user.user.icon" v-if="user.user.icon"></el-avatar> + <el-avatar :size="20" src="https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png" v-else> + </el-avatar> + <span style="padding: 0 5px;">{{ user.user.username }}</span> + <i class="el-icon-arrow-down"></i> + <!-- 鐢ㄦ埛鎿嶄綔 --> + <div class="user-card" v-if="flag.user" @mouseleave="flag.user = false"> + <el-card class="box-card"> + <div class="user-card__item" @click="updatePassword()">淇敼瀵嗙爜</div> + <div style="margin-top: 10px;" class="user-card__item" @click="baseInfo()">鍩烘湰淇℃伅</div> + </el-card> + </div> </div> - <div class="loginout">閫�鍑虹櫥褰�</div> + <!-- 娑堟伅 --> + <div class="menu-right__item btn" @mousemove="flag.message = true" @mouseleave="flag.message = false"> + <el-tooltip effect="dark" content="娑堟伅涓績" placement="bottom-end" :hide-after="600"> + <el-badge :value="messageCounts" class="item"> + <i @click="getMessage" class="el-icon-message-solid"></i> + </el-badge> + </el-tooltip> + <!-- 娑堟伅鎿嶄綔 --> + <div class="message-card" v-if="flag.message" @mouseleave="flag.message = false"> + <el-card class="box-card"> + <div class="card-header"> + <span>娑堟伅涓績</span> + <el-button type="text">鎺ユ敹璁剧疆</el-button> + </div> + <div v-for="item in menuMessageList" :key="item.id" class="message-card__item"> + <router-link to='/home/operate/message/messageIndex'> + <span class="label">{{ item.columnName }}</span> + </router-link> + <span>({{ item.messageNumber }})</span> + </div> + </el-card> + </div> + </div> + <!-- 閫�鍑虹櫥褰� --> + <div class="menu-right__item btn" @click="loginout"> + <el-tooltip effect="dark" content="閫�鍑虹櫥褰�" placement="bottom-end" :hide-after="1000"> + <i class="el-icon-switch-button"></i> + </el-tooltip> + </div> + <el-dialog :visible.sync="updatePasswordDialog" width="40%" title="淇敼瀵嗙爜" v-if="updatePasswordDialog" + :before-close="handleClose"> + <updatePassword /> + </el-dialog> + <el-dialog :visible.sync="baseInformationVisible" width="35%" title="鍩烘湰淇℃伅" v-if="baseInformationVisible" + :before-close="handleClose"> + <el-form :model="info" class="info" label-width="6vw"> + <el-form-item label="鐢ㄦ埛ID" min-width="6"> + <el-input v-model="info.id"></el-input> + </el-form-item> + <el-form-item prop="nickName" label="鐢ㄦ埛鍚嶇О" min-width="10"> + <el-input v-model="info.nickName"></el-input> + </el-form-item> + <el-form-item prop="nickName" label="鎵�灞炲鍚�" min-width="8"> + <el-input v-model="info.username"></el-input> + </el-form-item> + <el-form-item prop="mobile" label="鑱旂郴鏂瑰紡" min-width="7"> + <el-input v-model="info.mobile"></el-input> + </el-form-item> + <el-form-item prop="jobTitle" label="鎵�灞炶亴鍔�" min-width="8"> + <el-input v-model="info.jobTitle"></el-input> + </el-form-item> + <el-form-item prop="createTime" label="鍒涘缓鏃堕棿" min-width="10"> + <el-input v-model="info.createTime"></el-input> + </el-form-item> + </el-form> + + </el-dialog> </div> </el-header> </template> <script> -import hamburger from "@/components/hamburger" +import updatePassword from "./updatePassword"; +import users from "@/api/users"; + export default { - data(){ - return { - opened:false - } + components: { + updatePassword }, - components:{ - hamburger + data() { + return { + baseInformationVisible: false, + updatePasswordDialog: false, + menuLeftList: [ + { + label: '椹鹃┒鑸�', + checked: true, + url: '', + id: '1f' + }, + { + label: '瑙嗛宸℃煡', + checked: false, + url: '', + id: '2f' + }, + { + label: '鎵ф硶绠$悊', + checked: false, + url: '', + if: '3f', + }, + ], + flag: { + user: false, + message: false + }, + user: '', + menuMessageList: [], + messageCounts: 0, + keyword: '', + info: null, + show: false + }; + }, + created() { + this.setLoginInfo(); + }, + methods: { + baseInfo() { + this.baseInformationVisible = true; + const name = sessionStorage.getItem('name'); + this.$axios({ + method: 'get', + url: 'sccg/admin/info?name=' + name, + }) + .then(res => { + sessionStorage.setItem('user', JSON.stringify(res.data)); + this.info = res.data.user; + }) + }, + handleClose(done) { + this.$confirm("纭鍏抽棴锛�") + .then((_) => { + this.dialogUpload = false; + done(); + }) + .catch((_) => { }); + }, + //淇敼瀵嗙爜 + updatePassword() { + this.updatePasswordDialog = true; + }, + // 閫�鍑哄姛鑳� + loginout() { + this.$confirm('閫�鍑虹郴缁熺‘璁�', '纭鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + sessionStorage.clear(); + this.$router.push({ path: "/login" }) + }).catch(err => { + }) + }, + // 鏀瑰彉閫変腑鐘舵�� + changeActive(idx) { + this.menuLeftList.forEach((item, index) => { + item.checked = index === idx; + }) + }, + // 璁剧疆鐢ㄦ埛鍩烘湰淇℃伅 + async setLoginInfo() { + const info = JSON.parse(sessionStorage.getItem('user')); + if (info) { + this.user = info; + } else { + this.user = await this.getLoginInfo(); + } + this.getMessage(); + this.show = true + }, + // 鑾峰彇鐧诲綍鐢ㄦ埛淇℃伅 + async getLoginInfo() { + const name = sessionStorage.getItem('name'); + let res = await this.$axios({ + method: 'get', + url: 'sccg/admin/info?name=' + name, + }) + sessionStorage.setItem('user', JSON.stringify(res.data)); + return res.data; + }, + getMessage() { + const userInfo = JSON.parse(sessionStorage.getItem('user')); + users.getMessageAuditList({ userId: userInfo.user.id }) + .then(res => { + this.menuMessageList = res; + this.menuMessageList.forEach(item => { + this.messageCounts += item.messageNumber; + }) + }) + .catch(err => this.$message.error(`${err}`)) + }, + menuChange(data) { + if (data.id === '1f') { + window.open('http://cockpit.patstech.net:28081/cockpit/dist/board.html#/share-board/zfu0LsJ9', '_blank'); + } + } } }; </script> -<style lang="scss" > +<style lang="scss" scoped> +::v-deep .el-form { + padding: 3vh 5vw; + + .el-form-item__label { + color: #4b9bb7; + } +} + .el-header { background-color: #071a38; - color: #333; text-align: center; line-height: 60px; display: flex; align-items: center; - justify-content: flex-end; - padding: 0; - .header-title { + justify-content: space-between; + padding: 0 20px; + color: #4b9bb7; + + .header-left { display: flex; - align-items: center; - width: 280px; - justify-content: space-evenly; - .bell { - background-color: #00d1fa; - width: 25px; - height: 25px; - border-radius: 5px; - text-align: center; - line-height: 25px; + flex: 1; + + .menu-left__item { + width: 120px; + + span { + display: block; + line-height: 40px; + width: 100%; + + &:hover { + cursor: pointer; + color: #fff; + } + } } - .userinfo { - width: 100xp; + + .my-active { + border-radius: 20px; + color: #fff; + background-color: #092c4a; + } + } + + .header-right { + display: flex; + padding-left: 10vw; + flex: 1; + + .item { + width: 100%; + position: relative; + + :deep(.is-fixed) { + width: 20px; + height: 20px; + padding: 0; + top: 20px; + right: 30px; + border-radius: 50%; + position: absolute; + } + } + + .search { + flex: 3; + } + + .user { + margin-left: 20px; + flex: 2; display: flex; align-items: center; - .avatar { - width: 25px; - height: 25px; - border-radius: 50%; - background-image: url("@/assets/imgs/user/default-avatar.jpg"); - background-size: cover; - } - .username { - margin: 0 5px; - color: #22d3eb; - font-size: 14px; + justify-content: center; + position: relative; + + .user-card { + position: absolute; + top: 60px; + width: 120px; + z-index: 3000; + + .user-card__item { + padding: 5px 0; + + &:hover { + color: #fff; + background-color: #071a38; + } + } + + :deep(.el-card) { + background-color: #092c4a; + border: 1px solid #17324c; + color: #4b9bb7; + } + + :deep(.el-card__body) { + line-height: 20px; + padding: 10px; + } } } - .loginout { - color: #22d3eb; - font-size: 14px; + + .btn { + flex: 1; + font-size: 20px; + position: relative; + + .message-card { + position: absolute; + top: 60px; + width: 180px; + left: -50px; + z-index: 3000; + + :deep(.el-card__body) { + padding: 0; + } + + :deep(.el-card) { + background-color: #092c4a; + border: 1px solid #17324c; + color: #4b9bb7; + } + + .card-header { + padding: 0 20px; + line-height: 40px; + font-size: 14px; + display: flex; + border-bottom: 1px solid #17324c; + justify-content: space-between; + } + + .message-card__item { + line-height: 30px; + font-size: 14px; + display: flex; + justify-content: space-between; + padding: 0 20px; + + .label:hover { + cursor: pointer; + color: #fff; + } + } + } + } + + .user:hover, + .btn:hover { + background-color: #092c4a; + cursor: pointer; } } } -- Gitblit v1.8.0