Commit e5ef073a by 袁成

fix: 基础数据组件

parent ddebe5e9
......@@ -140,6 +140,10 @@ export default {
isVxe: {
type: Boolean,
default: false
},
showtype: {
type: String,
default: ''
}
},
data () {
......
......@@ -3,14 +3,14 @@
<el-popover ref="popover" popper-class="rbc-basedata-popover" placement="top" trigger="manual" v-model="dataListShow" :visible-arrow="false" :width="searchPopperMinWidth">
<ul ref="searchList" class="acct-search-list" :class="{'is-focus': hasFocus}" @mouseleave="onResultList = false" @mouseenter="onResultList = true">
<li :class="['acct-search-item',selectIndex === index ? 'selected' : '',{active: activeName == item.name}]" v-for="(item,index) in baseDataList" :key="item.code" :value="item.code" @click="handleMainSearchSelectClick(item)">
<span class="acct-search-label">{{ item.code + ' ' + item.name }}</span>
<span class="acct-search-label">{{ getLable(item) }}</span>
</li>
<li v-if="baseDataList.length === 0">
<span class="list-empty">无匹配数据</span>
</li>
</ul>
<div class="select-box" slot="reference">
<Input ref="searchInput" v-model="selectValue" :disabled="disabled" :readonly="readonly || multiple" :class="{'multiple-input': multiple && !readonly}" placeholder="" @on-change="handleChange" @on-focus="handleFocus" @on-blur="handleBlur" @keydown.down.native="handleSelectNext" @keydown.up.native="handleSelectPrev" @keydown.enter.native="handleSelected">
<Input ref="searchInput" v-model="selectValue" :disabled="disabled" :readonly="readonly || multiple" :class="{'multiple-input': multiple && !readonly}" placeholder="" @on-change="handleChange" @on-focus="handleFocus" @keydown.down.native="handleSelectNext" @keydown.up.native="handleSelectPrev" @keydown.enter.native="handleSelected">
<Icon type="ios-close-circle" :class="{'clear-icon': true, 'hidden-icon': disabled || readonly || !selectValue }" slot="suffix" @click="clearList" />
<Icon type="ios-more" class="more-select" slot="suffix" @click="handleInputSelect" />
</Input>
......@@ -100,6 +100,13 @@ export default {
this.getBaseDataList()
}
}
},
showModal(val) {
if (val) {
this.$nextTick(() => {
this.dataListShow = false
})
}
}
},
mounted () {
......@@ -110,6 +117,15 @@ export default {
this.removeDomListener()
},
methods: {
getLable(val) {
if (this.showtype === 'CODE') {
return val.code
} else if (this.showtype === 'NAME') {
return val.name
} else {
return val.code + '' + val.name
}
},
addDomListener() {
if (this.isVxe) {
let doms = document.querySelectorAll('.rootClass')
......@@ -170,33 +186,36 @@ export default {
this.selection[0] = this.value
this.showModal = true
}
this.dataListShow = false
this.$nextTick(() => {
this.dataListShow = false
})
}
},
// 下拉列表
handleFocus() {
if (this.showModal) return
this.selectIndex = -1
this.hasFocus = true
this.getBaseDataList()
},
handleBlur() {
// if (!this.onResultList) {
// this.hasFocus = false
// this.dataListShow = false
// }
// handleBlur() {
// if (!this.onResultList) {
// this.hasFocus = false
// this.dataListShow = false
// }
// this.selectValue = String(this.selectValue)
// if (this.value === null) {
// this.selectValue = ''
// this.selectIndex = -1
// this.selectedItem = {}
// } else {
// this.selectValue = this.value.name
// this.selectedItem = this.value
// this.findIndex()
// }
// this.$emit('data-change', this.value)
},
// this.selectValue = String(this.selectValue)
// if (this.value === null) {
// this.selectValue = ''
// this.selectIndex = -1
// this.selectedItem = {}
// } else {
// this.selectValue = this.value.name
// this.selectedItem = this.value
// this.findIndex()
// }
// this.$emit('data-change', this.value)
// },
// 输入查询时
handleChange() {
if (this.selectValue === '' || this.selectValue === null) {
......
......@@ -17,7 +17,8 @@
}
.table-view {
width: calc(~'100% - 160px');
// width: calc(~'100% - 160px');
width: calc(~'100% - 10px');
margin-left: 10px;
height: 100%;
float: left;
......@@ -36,7 +37,7 @@
:disabled="selection.length == 0"
@on-change="allCancel"
/>
{{"已选" + selection.length + ")条"}}
{{"已选(" + selection.length + ")条"}}
</div>
<div class="selected-view-content">
<SelectedView
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment