mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-25 14:25:23 +00:00
[Update] 继续优化select2组件
This commit is contained in:
@@ -133,7 +133,6 @@ export default {
|
||||
field = this.generateFieldByName(name, field)
|
||||
field = this.generateFieldByOther(field, fieldMeta)
|
||||
field = Object.assign(field, this.fieldsMeta[name] || {})
|
||||
console.log(field)
|
||||
_.set(field, 'attrs.error', '')
|
||||
return field
|
||||
},
|
||||
|
@@ -88,6 +88,22 @@ export default {
|
||||
hasMore: true,
|
||||
pageSize: defaultPageSize
|
||||
}
|
||||
return {
|
||||
loading: false,
|
||||
initialized: false,
|
||||
iValue: this.value ? this.value : [],
|
||||
defaultParams: _.cloneDeep(defaultParams),
|
||||
params: _.cloneDeep(defaultParams),
|
||||
iOptions: this.options || [],
|
||||
initialOptions: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
optionsValues() {
|
||||
return this.iOptions.map((v) => v.value)
|
||||
},
|
||||
iAjax() {
|
||||
const defaultPageSize = 10
|
||||
const defaultMakeParams = (params) => {
|
||||
const page = params.page || 1
|
||||
const offset = (page - 1) * params.pageSize
|
||||
@@ -115,27 +131,17 @@ export default {
|
||||
makeParams: defaultMakeParams,
|
||||
processResults: defaultProcessResults
|
||||
}
|
||||
const iAjax = Object.assign(defaultAjax, this.ajax, this.url ? { url: this.url } : {})
|
||||
return {
|
||||
loading: false,
|
||||
initialized: false,
|
||||
iAjax: iAjax,
|
||||
iValue: this.value ? this.value : [],
|
||||
defaultParams: _.cloneDeep(defaultParams),
|
||||
params: _.cloneDeep(defaultParams),
|
||||
iOptions: this.options || [],
|
||||
initialOptions: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
optionsValues() {
|
||||
return this.iOptions.map((v) => v.value)
|
||||
return Object.assign(defaultAjax, this.ajax, this.url ? { url: this.url } : {})
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
url(newValue, oldValue) {
|
||||
// url(newValue, oldValue) {
|
||||
// this.$log.debug('Select url changed: ', oldValue, ' => ', newValue)
|
||||
// this.iAjax.url = newValue
|
||||
// this.refresh()
|
||||
// },
|
||||
iAjax(newValue, oldValue) {
|
||||
this.$log.debug('Select url changed: ', oldValue, ' => ', newValue)
|
||||
this.iAjax.url = newValue
|
||||
this.refresh()
|
||||
}
|
||||
},
|
||||
|
@@ -46,7 +46,9 @@ export default {
|
||||
groups: {
|
||||
el: {
|
||||
multiple: true,
|
||||
url: '/api/v1/users/groups/',
|
||||
ajax: {
|
||||
url: '/api/v1/users/groups/'
|
||||
},
|
||||
value: []
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user