Commit e5ef073a by 袁成

fix: 基础数据组件

parent ddebe5e9
...@@ -140,6 +140,10 @@ export default { ...@@ -140,6 +140,10 @@ export default {
isVxe: { isVxe: {
type: Boolean, type: Boolean,
default: false default: false
},
showtype: {
type: String,
default: ''
} }
}, },
data () { data () {
......
...@@ -3,14 +3,14 @@ ...@@ -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"> <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"> <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)"> <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>
<li v-if="baseDataList.length === 0"> <li v-if="baseDataList.length === 0">
<span class="list-empty">无匹配数据</span> <span class="list-empty">无匹配数据</span>
</li> </li>
</ul> </ul>
<div class="select-box" slot="reference"> <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-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" /> <Icon type="ios-more" class="more-select" slot="suffix" @click="handleInputSelect" />
</Input> </Input>
...@@ -100,6 +100,13 @@ export default { ...@@ -100,6 +100,13 @@ export default {
this.getBaseDataList() this.getBaseDataList()
} }
} }
},
showModal(val) {
if (val) {
this.$nextTick(() => {
this.dataListShow = false
})
}
} }
}, },
mounted () { mounted () {
...@@ -110,6 +117,15 @@ export default { ...@@ -110,6 +117,15 @@ export default {
this.removeDomListener() this.removeDomListener()
}, },
methods: { 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() { addDomListener() {
if (this.isVxe) { if (this.isVxe) {
let doms = document.querySelectorAll('.rootClass') let doms = document.querySelectorAll('.rootClass')
...@@ -170,33 +186,36 @@ export default { ...@@ -170,33 +186,36 @@ export default {
this.selection[0] = this.value this.selection[0] = this.value
this.showModal = true this.showModal = true
} }
this.dataListShow = false this.$nextTick(() => {
this.dataListShow = false
})
} }
}, },
// 下拉列表 // 下拉列表
handleFocus() { handleFocus() {
if (this.showModal) return
this.selectIndex = -1 this.selectIndex = -1
this.hasFocus = true this.hasFocus = true
this.getBaseDataList() this.getBaseDataList()
}, },
handleBlur() { // handleBlur() {
// if (!this.onResultList) { // if (!this.onResultList) {
// this.hasFocus = false // this.hasFocus = false
// this.dataListShow = false // this.dataListShow = false
// } // }
// this.selectValue = String(this.selectValue) // this.selectValue = String(this.selectValue)
// if (this.value === null) { // if (this.value === null) {
// this.selectValue = '' // this.selectValue = ''
// this.selectIndex = -1 // this.selectIndex = -1
// this.selectedItem = {} // this.selectedItem = {}
// } else { // } else {
// this.selectValue = this.value.name // this.selectValue = this.value.name
// this.selectedItem = this.value // this.selectedItem = this.value
// this.findIndex() // this.findIndex()
// } // }
// this.$emit('data-change', this.value) // this.$emit('data-change', this.value)
}, // },
// 输入查询时 // 输入查询时
handleChange() { handleChange() {
if (this.selectValue === '' || this.selectValue === null) { if (this.selectValue === '' || this.selectValue === null) {
......
...@@ -17,7 +17,8 @@ ...@@ -17,7 +17,8 @@
} }
.table-view { .table-view {
width: calc(~'100% - 160px'); // width: calc(~'100% - 160px');
width: calc(~'100% - 10px');
margin-left: 10px; margin-left: 10px;
height: 100%; height: 100%;
float: left; float: left;
...@@ -36,7 +37,7 @@ ...@@ -36,7 +37,7 @@
:disabled="selection.length == 0" :disabled="selection.length == 0"
@on-change="allCancel" @on-change="allCancel"
/> />
{{"已选" + selection.length + ")条"}} {{"已选(" + selection.length + ")条"}}
</div> </div>
<div class="selected-view-content"> <div class="selected-view-content">
<SelectedView <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