perf: 修改一些小 bug

This commit is contained in:
ibuler
2022-03-16 12:02:22 +08:00
committed by huailei
parent 8e4f79fc84
commit 500a91914c
4 changed files with 41 additions and 35 deletions

View File

@@ -4,6 +4,7 @@
<script>
import TagSearch from '@/components/TagSearch'
import i18n from '@/i18n/i18n'
export default {
name: 'AutoDataSearch',
components: { TagSearch },
@@ -78,8 +79,8 @@ export default {
}
if (field.type === 'boolean') {
option.children = [
{ label: this.$t('common.Yes'), value: true },
{ label: this.$t('common.No'), value: false }
{ label: i18n.t('common.Yes'), value: true },
{ label: i18n.t('common.No'), value: false }
]
}
vm.internalOptions.push(option)

View File

@@ -173,8 +173,8 @@ export default {
}
if (column.type === 'boolean') {
col.filters = [
{ text: this.$t('common.Yes'), value: true },
{ text: this.$t('common.No'), value: false }
{ text: i18n.t('common.Yes'), value: true },
{ text: i18n.t('common.No'), value: false }
]
col.sortable = false
col['column-key'] = col.prop

View File

@@ -114,11 +114,16 @@ export default {
if (val && val.length > 0) {
const routeFilter = this.checkInTableColumns()
const routerSearch = routeFilter.search || {}
const routerSearchArrs = routerSearch?.value?.split(',') || []
const routerSearchArrsLength = routerSearchArrs.length || 0
if (routerSearch && routerSearchArrsLength > 0) {
for (let i = 0; i < routerSearchArrsLength; i++) {
const cur = routerSearchArrs[i]
let routerSearchAttrs = []
if (typeof routerSearch?.value !== 'string') {
routerSearchAttrs = [routerSearch.value]
} else {
routerSearchAttrs = routerSearch?.value?.split(',') || []
}
const routerSearchAttrsLength = routerSearchAttrs.length || 0
if (routerSearch && routerSearchAttrsLength > 0) {
for (let i = 0; i < routerSearchAttrsLength; i++) {
const cur = routerSearchAttrs[i]
routeFilter[`search_${cur}`] = {
...routerSearch,
value: cur
@@ -157,32 +162,32 @@ export default {
const routeQueryKeys = Object.keys(routeQuery)
const routeQueryKeysLength = routeQueryKeys.length
const keys = {}
if (routeQueryKeysLength < 1) return keys
if (routeQueryKeysLength > 0) {
for (let i = 0; i < routeQueryKeysLength; i++) {
const key = routeQueryKeys[i]
let valueDecode = decodeURI(routeQuery[key])
const isSearch = key !== 'search'
const curOptions = this.options || []
for (let k = 0, len = curOptions.length; k < len; k++) {
const cur = curOptions[k]
if (cur?.type === 'boolean') {
valueDecode = !!valueDecode
if (routeQueryKeysLength < 1) {
return keys
}
for (const [key, value] of Object.entries(routeQuery)) {
let valueDecode = decodeURI(value)
const isSearch = key !== 'search'
const curOptions = this.options || []
for (let k = 0, len = curOptions.length; k < len; k++) {
const cur = curOptions[k]
if (cur?.type === 'boolean') {
valueDecode = !!valueDecode
}
if (key === cur.value || !isSearch) {
const curChildren = cur.children || []
keys[key] = {
...cur,
key,
label: isSearch ? cur.label : '',
value: valueDecode
}
if (key === cur.value || !isSearch) {
const curChildren = cur.children || []
keys[key] = {
...cur,
key,
label: isSearch ? cur.label : '',
value: valueDecode
}
if (isSearch && curChildren.length > 0) {
for (const item of curChildren) {
if (valueDecode === item.value) {
keys[key].valueLabel = item.label
break
}
if (isSearch && curChildren.length > 0) {
for (const item of curChildren) {
if (valueDecode === item.value) {
keys[key].valueLabel = item.label
break
}
}
}

View File

@@ -351,7 +351,7 @@
"NoData": "暂无数据",
"Open": "打开",
"Other": "其它",
"Others": "其",
"Others": "其",
"Push": "推送",
"QuickUpdate": "快速更新",
"RemoveSuccessMsg": "移除成功",