123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- <template>
- <div
- class="title"
- :class="{ error: type === 'error', warning: type === 'warning' }"
- >
- <div>
- <span v-for="(item, index) in data" :key="index">
- <span v-html="titleFilter(item)"></span>
- <el-tooltip
- v-if="descs[item.errorType]"
- :content="descs[item.errorType]"
- :open-delay="0.3"
- placement="top"
- >
- <i class="el-icon-warning-outline" style="font-size: 14px" />
- </el-tooltip>
- <b v-if="!ignore.includes(item.errorType)">{{ item.num }}</b>
- </span>
- </div>
- <slot />
- </div>
- </template>
- <script>
- import { descs } from "../constant";
- export default {
- props: {
- type: {
- type: String,
- default: "warning",
- },
- data: {
- type: Array,
- default: [],
- },
- },
- data() {
- return {
- descs,
- ignore: ["NO_CLASS_MUSIC_GROUP_STUDENT_INFO"], // // 忽略类型
- };
- },
- mounted() {},
- methods: {
- titleFilter(item) {
- if (this.ignore.includes(item.errorType)) {
- let tempName = item.name;
- tempName = tempName.replace("{0}",`<b>${item.num}</b>`);
- tempName = tempName.replace("{1}",`<b>${item.num2}</b>`);
- return tempName;
- } else {
- return item.name;
- }
- },
- },
- };
- </script>
- <style lang="less" scoped>
- .title {
- height: 48px;
- line-height: 48px;
- background-color: rgba(0, 0, 0, 0.02);
- overflow: hidden;
- display: flex;
- justify-content: space-between;
- padding-right: 10px;
- font-weight: bold;
- transition: all 0.3s;
- width: 100%;
- box-sizing: content-box;
- /deep/b {
- font-size: 18px;
- }
- &:hover {
- background-color: rgba(0, 0, 0, 0.06);
- }
- &.error {
- /deep/b {
- color: #ed6f62;
- }
- &:before {
- position: absolute;
- background-color: #ed6f62;
- }
- }
- &.warning {
- /deep/b {
- color: #f2a24a;
- }
- &:before {
- position: absolute;
- background-color: #f2a24a;
- }
- }
- &:before {
- content: "";
- display: block;
- position: absolute;
- width: 7px;
- height: 48px;
- left: 0;
- }
- > div {
- position: relative;
- padding-left: 20px;
- font-size: 14px;
- > span {
- margin-right: 10px;
- display: inline-block;
- }
- }
- }
- </style>
|