Header.vue 8.75 KB
Newer Older
fukai committed
1
<template>
2
  <div class="self-header">
潘际乾 committed
3
    <div style="display: inline-block;margin: 5px 15px 5px 0;height: 50px;">
4
      <img src="../../assets/logo.png" alt="" style="height: 100%;" />
潘际乾 committed
5
    </div>
6
    <div class="self_header_label">
潘际乾 committed
7
      <h2>新一代光大银行国际结算系统</h2>
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
    </div>
    <div class="header-tool">
      <div class="header-subInstName">
        <!-- <marquee
          v-if="subInstName.length > 12"
          behavior="scroll"
          direction="left"
          scrollamount="3"
          >{{ this.subInstName }}</marquee
        > -->
        <span v-if="subInstName.length <= 12">{{ this.subInstName }}</span>
      </div>
      <el-popover
        class="header-tool-popover"
        placement="bottom"
        width="200"
        trigger="hover"
      >
        <div class="header-tool-userdetail">
          <div>{{ user.userName }}</div>
          <div class="long-text" :title="user.userId">
            <i class="el-icon-user" style="padding:0px 5px;"></i>
            <span style="letter-spacing:1px;">{{ user.userId }}</span>
          </div>
          <div class="long-text" :title="user.instName">
            <i class="el-icon-office-building" style="padding:0px 5px;"></i>
            {{ user.instName }}
          </div>
          <div class="long-text" :title="user.roleName">
            <i class="el-icon-collection-tag" style="padding:0px 5px;"></i>
            {{ user.roleName }}
          </div>
          <el-row class="header-tool-userdetail-action">
            <el-button @click="showChgPwdDialog" size="small" style="width:100%"
              >修改密码</el-button
            >
            <el-button
              @click="showLogoutDialog(false)"
              size="small"
              style="width:100%;margin-left:0px;margin-top:5px"
              >用户签退</el-button
            >
            <el-button
              @click="showLogoutDialog(true)"
              size="small"
              style="width:100%;margin-left:0px;margin-top:5px"
              >强制签退</el-button
            >
          </el-row>
        </div>
        <div class="header-tool-item" slot="reference">
          <div>
            <i class="el-icon-user"></i>
            <span class="header-tool-item-text">{{ user.userName }}</span>
            <i class="el-icon-arrow-down" style="font-size: 12px;"></i>
          </div>
        </div>
      </el-popover>
      <el-popover
        class="header-tool-popover"
        placement="bottom"
        width="80"
        trigger="hover"
71
        v-model="langSelectVisible"
72 73
      >
        <ul class="header-tool-item-list">
74 75 76 77 78 79 80
          <li
            v-for="(item, idx) in languageOptions"
            :key="idx"
            @click="handleLang(item.lang)"
          >
            {{ item.fullName }}
          </li>
81 82 83
        </ul>
        <div class="header-tool-item header-tool-item-text" slot="reference">
          <i class="el-icon-setting" style="font-size:14px;"></i>
84
          {{ displayLangName }}
85 86 87 88 89 90 91
          <i class="el-icon-arrow-down" style="font-size:12px;"></i>
        </div>
      </el-popover>
      <el-popover placement="bottom" width="450" trigger="hover">
        <div>
          <el-col :span="24">
            <el-col :span="24">
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
              <c-page title="公告">
                <c-table :data="noticeboardData">
                  <el-table-column
                    label="公告内容"
                    prop="noticeContent"
                  ></el-table-column>
                  <el-table-column
                    label="发布人"
                    prop="publisher"
                  ></el-table-column>
                  <el-table-column
                    label="发布日期"
                    prop="publishDate"
                  ></el-table-column>
                </c-table>
              </c-page>
108 109
            </el-col>
          </el-col>
110
        </div>
111 112
        <div class="header-tool-item" slot="reference">
          <i class="el-icon-bell"></i>
113 114 115
          <span class="header-tool-item-text" style="padding-left:7px;"
            >通知</span
          >
116 117 118
        </div>
      </el-popover>
      <span class="header-tool-item-text">会计日期: {{ accDate }}</span>
fukai committed
119
    </div>
120
  </div>
fukai committed
121 122 123
</template>

<script>
124
import cPage from "../../components/c-page.vue";
fukai committed
125
export default {
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
  components: { cPage },
  data() {
    return {
      txName: "",
      user: {
        userName: this.$store.state.UserContext.userName || "Admin",
        roleName: window.sessionStorage.roleName || "超级管理员",
        instName: window.sessionStorage.instName || "北京分行",
        userId: this.$store.state.UserContext.userId || "2124221421214",
      },
      rules: {
        username: [{ type: "string", required: true, message: "请填写用户名" }],
        password: [{ type: "string", required: true, message: "请填写密码" }],
      },
      dialogOpen: false,
      loading: false,
      count: "",
143
      accDate: window.sessionStorage.accDate || new Date().toLocaleDateString(),
144 145 146 147 148 149
      noticeboardData: [],
      langSelectVisible: false,
      languageOptions: [
        { lang: "zh", shortName: "中文", fullName: "中文" },
        { lang: "en", shortName: "En", fullName: "English" },
      ],
150 151 152 153 154 155 156 157 158
    };
  },
  computed: {
    subInstName() {
      // let subStrList = window.sessionStorage.instName.split("股份有限公司");
      // let length = subStrList.length;
      // return subStrList[length - 1];
      return "北京分行";
    },
159 160 161 162 163 164 165 166 167 168 169 170
    lang() {
      return this.$store.state.I18n.lang;
    },
    displayLangName() {
      for (let i = 0; i < this.languageOptions.length; i++) {
        const op = this.languageOptions[i];
        if (this.lang === op.lang) {
          return op.shortName;
        }
      }
      return "";
    },
171 172 173 174 175 176
  },
  methods: {
    logout() {
      this.$store.commit("UserContext/setLogout");
      this.$router.push("/login");
    },
177 178 179 180
    handleLang(lang) {
      this.$i18n.locale = lang;
      this.$store.dispatch("I18n/setLang", lang);
      this.langSelectVisible = false;
181 182
    },
    showLogoutDialog(flg) {
潘际乾 committed
183 184
      // this.$refs.logoutform.show(flg);
      this.$store.dispatch("TagsView/delAllViews").then(() => this.$router.push("/login"))
185 186 187 188 189 190
    },
    showChgPwdDialog() {
      this.$refs["chgPwdForm"].dialogOpen = true;
    },
  },
};
fukai committed
191 192 193
</script>

<style>
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
.self-header {
  height: 100%;
  /* background-color: #eeeeee; */
  /* margin-bottom: 5px; */
  background-image: url("../../assets/head_bg.png");
}
.self-header h2 {
  margin: 0;
  padding: 0;
}
.header-subInstName {
  display: inline-block;
  margin-right: 12px;
  text-align: right;
  color: #fff;
  font-size: 12px;
  padding: 0px 15px 0px 0px;
  border-right: 1px solid antiquewhite;
}
.self-header {
  height: 100%;
  /* background-color: #eeeeee; */
  /* margin-bottom: 5px; */
  background-image: url("../../assets/head_bg.png");
  position: relative;
  padding: 0px 0px 0px 12px;
  background-size: cover;
}

.self-header h2 {
  margin: 0;
  padding: 0;
  font-size: 22px;
  display: inline;
}

.self_header_label {
  /* color: antiquewhite; */
  color: #fff;
  /* margin-top: 10px !important; */
  position: relative;
  top: 22px;
  /* left: 10px; */
  padding: 0px 15px;
  display: inline-table;
  vertical-align: top;
liushikai committed
240
  font-family: "黑体";
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325
  /* border-left: 1px solid antiquewhite; */
  border-left: 1px solid #fff;
}
.self_header_label p {
  font-family: "Times New Roman", Times, serif;
  text-align: center;
  font-style: italic;
  margin: 0;
  padding: 0;
  font-size: 12px;
  display: inline;
}
.header-tool {
  position: absolute;
  text-align: right;
  right: 35px;
  top: 22px;
  color: #fff;
  font-size: 14px;
}
.header-tool-item {
  display: inline-block;
  margin-right: 12px;
  cursor: pointer;
}
.header-tool-userdetail {
  text-align: center;
}
.header-tool-item-text {
  font-size: 12px;
}
.header-tool-item-list {
  padding: 0;
  margin: 0;
}
.header-tool-userdetail-action {
  margin-top: 10px;
}
.header-tool-item-list li {
  list-style: none;
  padding: 5px;
  text-align: center;
  color: #606266;
  cursor: pointer;
}
.header-tool-item-list li:hover {
  background: rgba(144, 146, 152, 0.3);
}
.logoutdialog .el-dialog .el-dialog__header {
  padding: 10px 20px 0px;
}
.logoutdialog .el-dialog .el-dialog__body {
  padding: 20px 30px 0px 20px;
}
.logoutdialog .el-dialog .el-dialog__footer {
  padding: 0px 20px 15px;
}
/* .header-tool-item-badge {
		margin-top: 10px;
		margin-right: 40px;
	} */
.header-tool-item-badge .el-badge__content {
  background-color: #f56c6c;
  border-radius: 7px;
  /* color: #FFF; */
  display: inline-block;
  font-size: 12px;
  height: 14px;
  line-height: 14px;
  padding: 0 6px;
  text-align: center;
  white-space: nowrap;
  border: 0px;
}
.long-text {
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  text-align: left;
  font-size: 12px;
}
.long-text:hover {
  background-color: #e8f0fe;
}
</style>