Merge branch 'dev-3.8' of git.mesalab.cn:nezha/nezha-fronted into dev-3.8
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
<transition name="el-zoom-in-top">
|
||||
<div v-show="item.show" class="nz-collapse-body">
|
||||
<div v-for="(btn, i) in item.children" :key="'info2'+'-'+index+'-'+i" class="buttons image-box-item" :class="btn.id == selectImgId ? 'is-select':''">
|
||||
<img :src="baseUrl + btn.image" v-if="btn.image" class="image-src" @click.stop="selectImageChange(btn)">
|
||||
<img :src="btn.image" v-if="btn.image" class="image-src" @click.stop="selectImageChange(btn)">
|
||||
<i v-if="btn.nzClassName" class="nz-icon image-src" :class="btn.nzClassName" style="font-size: 40px" @click.stop="selectImageChange(btn)"/>
|
||||
<div class="img-text text-ellipsis" :title="btn.imageName">{{btn.imageName}}</div>
|
||||
<i v-if="item.group!=='General'" class="delIcon nz-icon nz-icon-delete" @click.stop="tooltipDelete(btn)"></i>
|
||||
@@ -167,7 +167,7 @@ export default {
|
||||
selectImg: '',
|
||||
unit: '',
|
||||
imageName: '',
|
||||
baseUrl: 'http://192.168.44.22/',
|
||||
baseUrl: '',
|
||||
token: ''
|
||||
}
|
||||
},
|
||||
|
||||
@@ -126,7 +126,7 @@ export default {
|
||||
valueShow: false, // value 的下拉
|
||||
inputReadonly: false,
|
||||
dialogObjValueList: [],
|
||||
selectIndex: 0,
|
||||
selectIndex: -1,
|
||||
valueList: [],
|
||||
oldValueList: [],
|
||||
symbolList: [],
|
||||
@@ -189,7 +189,10 @@ export default {
|
||||
value: 'not exist',
|
||||
remark: '不存在'
|
||||
}
|
||||
]
|
||||
],
|
||||
keyword: [0, 1, 6, 7, 8, 9],
|
||||
text: [0, 1, 6, 7, 8, 9],
|
||||
number: [0, 1, 2, 3, 4, 5]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -215,7 +218,7 @@ export default {
|
||||
}
|
||||
// 5
|
||||
if (e.keyCode == 38) { // 向上
|
||||
if (this.selectIndex == 0) return
|
||||
if (this.selectIndex == -1) return
|
||||
this.selectIndex--
|
||||
}
|
||||
if (e.keyCode == 40 && (this.keyShow || this.valueShow || this.symbolShow)) { // 向下
|
||||
@@ -236,21 +239,31 @@ export default {
|
||||
// console.log(e, 'keyup')
|
||||
// console.log(this.searchStr)
|
||||
// 6
|
||||
// console.log(this.keyShow)
|
||||
if (e.keyCode == 13 && (this.keyShow || this.valueShow || this.symbolShow)) {
|
||||
// 选择对应条件
|
||||
setTimeout(() => {
|
||||
if (this.keyShow) {
|
||||
this.selectKey(this.searchList[this.selectIndex])
|
||||
this.selectKey(this.searchList[this.selectIndex] || { name: this.searchStr })
|
||||
} else if (this.symbolShow) {
|
||||
this.selectSymbol(this.symbolList[this.selectIndex])
|
||||
} else if (this.valueShow) {
|
||||
this.selectValue(this.valueList[this.selectIndex].label)
|
||||
if (this.valueList[this.selectIndex]) {
|
||||
this.selectValue(this.valueList[this.selectIndex].label)
|
||||
} else {
|
||||
this.addSelectArr(this.searchStr)
|
||||
this.searchStr = ''
|
||||
this.contentShow()
|
||||
this.symbol = false
|
||||
this.key = ''
|
||||
}
|
||||
}
|
||||
}, 100)
|
||||
this.$refs.searchStr.focus()
|
||||
return
|
||||
}
|
||||
// 4
|
||||
const index = this.searchStr.indexOf(':')
|
||||
if (e.keyCode == 13 && index !== -1 && this.symbol) {
|
||||
this.addSelectArr(this.searchStr)
|
||||
this.searchStr = ''
|
||||
@@ -284,6 +297,7 @@ export default {
|
||||
switch (item.value) {
|
||||
case '=' :
|
||||
this.$refs.searchStr.focus()
|
||||
this.inputEnd()
|
||||
break
|
||||
case '≠' :
|
||||
this.searchStr = '-' + this.searchStr
|
||||
@@ -323,6 +337,7 @@ export default {
|
||||
this.$refs.searchStr.focus()
|
||||
break
|
||||
}
|
||||
// console.log(' this.setValueList(\'\')')
|
||||
this.setValueList('')
|
||||
this.contentShow('value')
|
||||
},
|
||||
@@ -388,7 +403,7 @@ export default {
|
||||
this.symbolShow = false // symbol 的下拉
|
||||
this.valueShow = false // value 的下拉
|
||||
if (key === 'symbol') {
|
||||
this.setSymBolList()
|
||||
this.setSymBolList(this.key)
|
||||
this.symbolShow = true
|
||||
}
|
||||
if (key === 'key') {
|
||||
@@ -407,14 +422,13 @@ export default {
|
||||
this.key = keyStr
|
||||
}
|
||||
// console.log(this.key)
|
||||
if (key === 'value') { // 处理valueList
|
||||
if (key === 'symbol') { // 处理valueList
|
||||
const findItem = this.oldSearchList.find(item => item.name === this.key)
|
||||
if (findItem && findItem.type !== 'input') {
|
||||
// this.inputReadonly = true
|
||||
this.oldValueList = this[findItem.label]
|
||||
} else {
|
||||
this.oldValueList = []
|
||||
this[key + 'Show'] = false
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -428,17 +442,28 @@ export default {
|
||||
}
|
||||
},
|
||||
setSearchList (str) {
|
||||
this.selectIndex = 0
|
||||
this.selectIndex = -1
|
||||
if (!str) {
|
||||
this.searchList = this.$loadsh.cloneDeep(this.oldSearchList)
|
||||
return
|
||||
}
|
||||
this.searchList = this.oldSearchList.filter(item => item.name.indexOf(str) !== -1)
|
||||
},
|
||||
setSymBolList (str) {
|
||||
let findItemType = 'text'
|
||||
const findItem = this.oldSearchList.find(item => item.name === this.key)
|
||||
this.selectIndex = 0
|
||||
this.symbolList = this.oldSymbolList
|
||||
if (findItem) {
|
||||
findItemType = findItem.type || 'keyword'
|
||||
}
|
||||
this.selectIndex = -1
|
||||
this.symbolList = this.oldSymbolList.filter((item, index) => {
|
||||
return this[findItemType].indexOf(index) !== -1
|
||||
})
|
||||
},
|
||||
setValueList (str) {
|
||||
this.selectIndex = 0
|
||||
this.selectIndex = -1
|
||||
this.valueList = this.oldValueList.filter(item => item.label.indexOf(str) !== -1)
|
||||
// console.log(this.valueList)
|
||||
if (!this.valueList.length) {
|
||||
this.valueShow = false
|
||||
} else {
|
||||
@@ -458,8 +483,10 @@ export default {
|
||||
key,
|
||||
value: [value]
|
||||
})
|
||||
this.setSearchList()
|
||||
}
|
||||
this.setSearchList()
|
||||
this.$emit('change', this.selectArr)
|
||||
this.url
|
||||
},
|
||||
removeSelectArr (index) {
|
||||
this.selectArr.splice(index, 1)
|
||||
@@ -540,6 +567,23 @@ export default {
|
||||
},
|
||||
handleSelect () {
|
||||
|
||||
},
|
||||
inputEnd () { // 光标最后一位
|
||||
// console.log('12313123')
|
||||
const ele = this.$refs.searchStr.$el
|
||||
const obj = ele.getElementsByClassName('el-input__inner')[0]
|
||||
// console.log(obj)
|
||||
obj.focus()
|
||||
const len = obj.value.length
|
||||
if (document.selection) {
|
||||
const sel = obj.createTextRange()
|
||||
sel.moveStart('character', len); sel.collapse(); sel.select()
|
||||
} else if (typeof obj.selectionStart === 'number' && typeof obj.selectionEnd === 'number') {
|
||||
setTimeout(() => {
|
||||
obj.selectionStart = obj.selectionEnd = len
|
||||
}, 100)
|
||||
}
|
||||
// this.searchStr = this.$loadsh.cloneDeep(this.searchStr)
|
||||
},
|
||||
clickOutside () { // 点击页面其他地方触发
|
||||
this.visible = false
|
||||
@@ -547,6 +591,10 @@ export default {
|
||||
this.symbolShow = false // symbol 的下拉
|
||||
this.valueShow = false // value 的下拉
|
||||
this.inputWidth = 400
|
||||
this.searchStr = ''
|
||||
this.searchList = this.$loadsh.cloneDeep(this.oldSearchList)
|
||||
this.symbolList = []
|
||||
this.valueList = []
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
||||
Reference in New Issue
Block a user