Commit 3d29bb9c by 杨明

fixed

1 parent 97db8976
<template>
<div class="full-container" v-bind="$attrs">
<el-tooltip placement="top" v-if="hoverStatus">
<div slot="content">
<template v-if="$slots.default"><slot></slot></template>
<template v-else>
{{ label }}
</template>
</div>
<div :class="['full-text', identification]" :style="{ 'max-width': labelWidth + 'px' }" v-if="textType != 'text' && !haveClose">
<el-tag type="info" class="full-text" :disable-transitions="false">
<i class="el-icon-user-solid" v-if="textType == 'user'"></i>
<template v-if="$slots.default"><slot></slot></template>
<template v-else>
{{ label }}
</template>
</el-tag>
</div>
<div v-if="textType != 'text' && haveClose">
<el-tag class="tag-user-closable" :style="{ 'max-width': labelWidth + 'px' }" type="info" :disable-transitions="false" closable @close="handleRemove">
<i class="el-icon-user-solid" v-if="textType == 'user'"></i>
<span :class="['full-text-user', { 'user-icon-checked': textType == 'user' && haveClose }, identification]">{{ label }}</span>
</el-tag>
</div>
<div :class="[line ? 'full-text-line' : 'full-text', identification]" :style="{ 'max-width': labelWidth + 'px', '-webkit-line-clamp': line }" v-if="textType == 'text'">
<template v-if="$slots.default"><slot></slot></template>
<template v-else>
{{ label }}
</template>
</div>
</el-tooltip>
<template v-else>
<div :class="['full-text', identification]" @mouseenter="hoverFun" :style="{ 'max-width': labelWidth + 'px' }" v-if="textType != 'text' && !haveClose">
<el-tag type="info" class="full-text" :disable-transitions="false">
<i class="el-icon-user-solid" v-if="textType == 'user'"></i>
<template v-if="$slots.default"><slot></slot></template>
<template v-else>
{{ label }}
</template>
</el-tag>
</div>
<div @mouseenter="hoverFun" v-if="textType != 'text' && haveClose">
<el-tag class="tag-user-closable" type="info" :style="{ 'max-width': labelWidth + 'px' }" :disable-transitions="false" closable @close="handleRemove">
<i class="el-icon-user-solid" v-if="textType == 'user'"></i>
<span :class="['full-text-user', identification]">{{ label }}</span>
</el-tag>
</div>
<div :class="[line ? 'full-text-line' : 'full-text', identification]" @mouseenter="hoverFun" :style="{ 'max-width': labelWidth + 'px', '-webkit-line-clamp': line }" v-if="textType == 'text'">
<template v-if="$slots.default"><slot></slot></template>
<template v-else>
{{ label }}
</template>
</div>
</template>
</div>
</template>
<script>
export default {
name: 'GLFull',
data() {
return {
hoverStatus: false,
identification: 'text_' + this.identi
}
},
props: {
//唯一标识
identi: {
type: String,
default: 'identi'
},
//文本
label: {
type: String,
default: ''
},
//文本宽度
labelWidth: {
type: Number,
default: 100
},
//行数
line: {
type: Number,
default: 0
},
textType: {
type: String,
default: 'text', // text 文本 user 跟进员工 tag 标签
validator: function(value) {
return ['text', 'user', 'tag'].indexOf(value) !== -1
}
},
//是否包含关闭按钮
haveClose: {
type: Boolean,
default: false
}
},
methods: {
hoverFun() {
if (this.line > 1) {
this.hoverStatus = document.querySelector(`.${this.identification}`).scrollHeight - 10 > document.querySelector(`.${this.identification}`).offsetHeight
return
}
if (this.haveClose) {
//this.hoverStatus = this.identi ? document.querySelector(`.${this.identification}`).scrollWidth > document.querySelector(`.${this.identification}`).offsetWidth : document.querySelector(`.full-text`).scrollWidth > this.labelWidth - 30
this.hoverStatus = document.querySelector(`.${this.identification}`).scrollWidth > document.querySelector(`.${this.identification}`).offsetWidth
} else {
let widthMuti = this.textType == 'user' ? 17 : this.textType == 'tag' ? 20 : 0
// this.hoverStatus = this.identi ? document.querySelector(`.${this.identification}`).scrollWidth - widthMuti > this.labelWidth : document.querySelector(`.full-text`).scrollWidth > this.labelWidth
this.hoverStatus = document.querySelector(`.${this.identification}`).scrollWidth - widthMuti > this.labelWidth
console.log(document.querySelector(`.${this.identification}`).scrollWidth)
}
},
handleRemove() {
this.$emit('handleRemove', this.$attrs)
}
}
}
</script>
<style scoped lang="scss">
.full-container {
display: inline-block;
margin-right: 6px;
/deep/ {
.el-tag {
margin-right: 10px;
line-height: 26px;
height: 26px;
}
}
}
.full-text {
max-width: 100%;
display: inline-block;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.full-text-user {
max-width: calc(100% - 14px);
display: inline-block;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
&.user-icon-checked {
max-width: calc(100% - 30px);
}
}
.tag-user-closable {
display: flex;
align-items: center;
/deep/ {
.el-icon-close {
margin-top: 2px;
}
}
}
.full-text-line {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
word-break: break-all;
}
.el-icon-user-solid {
color: #75acff;
margin-right: 3px;
font-size: 14px;
}
</style>
...@@ -2,8 +2,9 @@ import Vue from 'vue' ...@@ -2,8 +2,9 @@ import Vue from 'vue'
// import { message } from '@/plugins/element.js' // import { message } from '@/plugins/element.js'
import { fetchConfig } from '@/config' import { fetchConfig } from '@/config'
import ElementUI from 'element-ui' import ElementUI from 'element-ui'
import { GLTable, GLButton, GLFooter, GLCombiForm, GLDialog, GLFull } from 'glsx-components' //权限按钮 (根据权限动态创建) import { GLTable, GLButton, GLFooter, GLCombiForm, GLDialog } from 'glsx-components' //权限按钮 (根据权限动态创建)
import GLEditor from 'glsx-components/src/packages/Editor' //权限按钮 (根据权限动态创建) import GLEditor from 'glsx-components/src/packages/Editor' //权限按钮 (根据权限动态创建)
import GLFull from '@/components/GLFull'
import { getRoutes } from '@/router' import { getRoutes } from '@/router'
import render from './render' import render from './render'
Vue.use(ElementUI) Vue.use(ElementUI)
...@@ -11,9 +12,10 @@ Vue.use(GLTable) ...@@ -11,9 +12,10 @@ Vue.use(GLTable)
Vue.use(GLFooter) Vue.use(GLFooter)
Vue.use(GLCombiForm) Vue.use(GLCombiForm)
Vue.use(GLDialog) Vue.use(GLDialog)
Vue.use(GLFull) // Vue.use(GLFull)
// import GLTable from '@/components/glsx-table/index' // import GLTable from '@/components/glsx-table/index'
Vue.component('GLEditor', GLEditor) Vue.component('GLEditor', GLEditor)
Vue.component('GLFull', GLFull)
// import 'glsx-components/src/theme/theme.scss' // import 'glsx-components/src/theme/theme.scss'
import 'glsx-components/dist/glsx-components.css' import 'glsx-components/dist/glsx-components.css'
import '@/assets/css/common.scss' import '@/assets/css/common.scss'
......
...@@ -22,26 +22,49 @@ ...@@ -22,26 +22,49 @@
</div> </div>
<div slot="staffInfo" slot-scope="scope"> <div slot="staffInfo" slot-scope="scope">
<el-popover trigger="hover" placement="top" v-if="staffNameSplit(scope.scope.staffName).length > 3"> <el-popover trigger="hover" placement="top" v-if="staffNameSplit(scope.scope.staffName).length > 3">
<div class="accountType-row" v-for="(item, index) in staffNameSplit(scope.scope.staffName)" :key="index"> <GLFull
<i class="el-icon-user-solid"></i> :labelWidth="110"
<GLTitle :content="item" textLength="4"></GLTitle> :label="item"
</div> textType="user"
:identi="
`text_${Math.random()
.toString()
.replace('.', '')}`
"
v-for="(item, index) in staffNameSplit(scope.scope.staffName)"
:key="index"
></GLFull>
<div slot="reference" class="name-wrapper"> <div slot="reference" class="name-wrapper">
<div v-for="(item, index) in staffNameSplit(scope.scope.staffName)" :key="index" v-show="index < 4"> <div v-for="(item, index) in staffNameSplit(scope.scope.staffName)" :key="index" v-show="index < 4">
<template v-if="index == 3 && staffNameSplit(scope.scope.staffName).length > 3">
<div class="accountType-row"> <div class="accountType-row">
<i class="el-icon-user-solid"></i> <i class="el-icon-user-solid"></i>
<span v-if="index == 3 && staffNameSplit(scope.scope.staffName).length > 3">{{ '...(' + staffNameSplit(scope.scope.staffName).length + ')' }}</span> <span>{{ '...(' + staffNameSplit(scope.scope.staffName).length + ')' }}</span>
<GLTitle :content="item" textLength="4" v-else></GLTitle>
</div> </div>
</template>
<GLFull :labelWidth="110" :label="item" textType="user" v-if="index < 3"></GLFull>
</div> </div>
</div> </div>
</el-popover> </el-popover>
<div v-for="(item, index) in staffNameSplit(scope.scope.staffName)" :key="index" v-else> <GLFull
:labelWidth="110"
:label="item"
textType="user"
:identi="
`text_${Math.random()
.toString()
.replace('.', '')}`
"
v-for="(item, index) in staffNameSplit(scope.scope.staffName)"
:key="index"
v-else
></GLFull>
<!-- <div v-for="(item, index) in staffNameSplit(scope.scope.staffName)" :key="index" v-else>
<div class="accountType-row"> <div class="accountType-row">
<i class="el-icon-user-solid"></i> <i class="el-icon-user-solid"></i>
<GLTitle :content="item" textLength="4"></GLTitle> <GLTitle :content="item" textLength="4"></GLTitle>
</div> </div>
</div> </div> -->
</div> </div>
<div slot="qrCode" slot-scope="scope"> <div slot="qrCode" slot-scope="scope">
<el-popover placement="bottom" width="400" trigger="click"> <el-popover placement="bottom" width="400" trigger="click">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!