行政区划选择器修改

master
toesbieya 6 years ago
parent 70a6873ea9
commit 9702024611
  1. 13
      vue/src/components/RegionSelector/Tab/index.vue
  2. 43
      vue/src/components/RegionSelector/Tab/style.scss
  3. 7
      vue/src/components/UploadFile/index.vue

@ -4,13 +4,14 @@
:value="value" :value="value"
:disabled="readonly" :disabled="readonly"
:size="size" :size="size"
popper-append-to-body
clearable clearable
@clear="() => $emit('clear')" @clear="() => $emit('clear')"
@visible-change="visibleChange" @visible-change="visibleChange"
> >
<template slot="empty"> <template slot="empty">
<div class="rg-header"> <div class="rg-header">
<span>行政区划选择</span> <h3>行政区划选择</h3>
<button class="rg-removeall-button" type="button" title="清除已选" @click="removeAll"> <button class="rg-removeall-button" type="button" title="清除已选" @click="removeAll">
<i class="el-icon-delete"/> <i class="el-icon-delete"/>
</button> </button>
@ -24,8 +25,8 @@
v-model="searchText" v-model="searchText"
class="rg-input" class="rg-input"
type="text" type="text"
placeholder="输入地区id或名称,回车搜索" placeholder="输入地区id或名称搜索"
@keyup.enter="search" @input="search"
> >
</div> </div>
<div class="rg-level-tabs"> <div class="rg-level-tabs">
@ -53,6 +54,7 @@
</template> </template>
<script> <script>
import {debounce} from "@/utils"
import {createLimitTree, getNodeId} from "@/utils/tree" import {createLimitTree, getNodeId} from "@/utils/tree"
import common from '../mixin' import common from '../mixin'
@ -185,7 +187,9 @@
parent = result[i - 1] || {children: this.treeData} parent = result[i - 1] || {children: this.treeData}
const node = parent.children.find(predicate(str)) const node = parent.children.find(predicate(str))
//退
if (!node) break if (!node) break
result.push(node) result.push(node)
} }
@ -196,6 +200,8 @@
this.maxLevel = DEFAULT_MAX_LEVEL this.maxLevel = DEFAULT_MAX_LEVEL
this.selected = JSON.parse(JSON.stringify(DEFAULT_TABS)) this.selected = JSON.parse(JSON.stringify(DEFAULT_TABS))
this.currentLevel = 1 this.currentLevel = 1
this.searchText = ''
this.setItems(this.currentLevel)
}, },
done() { done() {
@ -236,6 +242,7 @@
}, },
created() { created() {
this.search = debounce(this.search, 200)
this.selected = JSON.parse(JSON.stringify(DEFAULT_TABS)) this.selected = JSON.parse(JSON.stringify(DEFAULT_TABS))
}, },

@ -5,22 +5,10 @@
.rg-header { .rg-header {
h3 { h3 {
line-height: normal; padding: 6px;
padding: 6px 80px 10px 10px;
margin: 0; margin: 0;
text-align: left;
color: #24292e; color: #24292e;
font-size: 16px; font-size: 16px;
white-space: nowrap;
.rg-header-selected {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
font-size: 14px;
max-width: 310px;
display: inline-block;
}
} }
button { button {
@ -98,41 +86,21 @@
} }
.rg-results-container { .rg-results-container {
background-color: #fff;
list-style: none;
margin: 0;
padding: 0;
position: relative;
width: 100%;
overflow-y: auto;
overflow-x: hidden;
clear: both;
border-bottom-left-radius: 2px;
border-bottom-right-radius: 2px;
.rg-results { .rg-results {
background-color: #fff;
list-style: none;
margin: 0; margin: 0;
padding: 5px; padding: 5px;
width: 364px; width: 364px;
line-height: 1.5; line-height: 1.5;
li { li {
margin: 0;
overflow: hidden; overflow: hidden;
padding: 3px 10px; padding: 3px 10px;
position: relative;
text-align: left;
white-space: nowrap;
font-size: 14px; font-size: 14px;
color: black; color: black;
cursor: pointer; cursor: pointer;
&.rg-item { &.rg-item {
display: inline-block; display: inline-block;
border-radius: 2px;
margin-right: 5px;
color: #777; color: #777;
&:hover { &:hover {
@ -150,8 +118,6 @@
height: 30px; height: 30px;
line-height: 30px; line-height: 30px;
text-align: center; text-align: center;
box-sizing: content-box;
font-size: 14px;
cursor: default; cursor: default;
} }
} }
@ -159,16 +125,11 @@
} }
.rg-input { .rg-input {
display: block;
background-color: #f5f5f5; background-color: #f5f5f5;
margin: 0 !important;
border: 0; border: 0;
width: 100%; width: 100%;
font-size: 14px; font-size: 14px;
line-height: 1.42; padding: 6px;
padding: 4px 6px;
vertical-align: middle;
box-sizing: border-box;
outline: none !important; outline: none !important;
border-radius: 2px; border-radius: 2px;

@ -13,7 +13,7 @@
action="" action=""
list-type="picture-card" list-type="picture-card"
> >
<i class="el-icon-plus" slot="default"/> <i slot="default" class="el-icon-plus"/>
<template v-slot:file="{file}"> <template v-slot:file="{file}">
<span <span
@ -157,6 +157,9 @@
//remove //remove
remove(file) { remove(file) {
//tooltip
this.handleBlockMouseLeave()
// //
// //
if (!file.raw) this.$emit('remove', {url: file.downloadUrl.replace(attachmentPrefix, '')}) if (!file.raw) this.$emit('remove', {url: file.downloadUrl.replace(attachmentPrefix, '')})
@ -234,7 +237,7 @@
}, },
created() { created() {
this.activateTooltip = debounce(tooltip => tooltip.handleShowPopper(), 100) this.activateTooltip = debounce(tooltip => tooltip.handleShowPopper(), 200)
} }
} }
</script> </script>

Loading…
Cancel
Save