fix: 修复selectPage组件使用远程数据 初始化回显问题
This commit is contained in:
@@ -508,7 +508,7 @@ export default {
|
|||||||
created () {
|
created () {
|
||||||
this.isEdit = true
|
this.isEdit = true
|
||||||
this.getModuleList()
|
this.getModuleList()
|
||||||
this.getAssetList()
|
// this.getAssetList()
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'batchEndpoint.tableData': {
|
'batchEndpoint.tableData': {
|
||||||
|
|||||||
@@ -31,10 +31,26 @@
|
|||||||
></v-selectpage>
|
></v-selectpage>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- link -->
|
<!-- link -->
|
||||||
<el-form-item v-if="templateType" :label="templateType==1?$t('asset.asset'):$t('asset.endpoint')" prop="link" key="link">
|
<el-form-item v-if="templateType && templateType==1" :label="$t('asset.asset')" prop="link" key="asset">
|
||||||
<v-selectpage
|
<v-selectpage
|
||||||
:data="dataList"
|
:data="'/asset/asset'"
|
||||||
:tb-columns="templateType==1?assetColumns:endpointColumns"
|
:tb-columns="assetColumns"
|
||||||
|
:multiple="false"
|
||||||
|
:language="language"
|
||||||
|
key-field="id"
|
||||||
|
show-field="name"
|
||||||
|
search-field="q"
|
||||||
|
:width="640"
|
||||||
|
v-model="editDashboard.link"
|
||||||
|
class="form-control"
|
||||||
|
:result-format="resultFormat"
|
||||||
|
@values="linkChange"
|
||||||
|
></v-selectpage>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-if="templateType && templateType==2" :label="$t('asset.endpoint')" prop="link" key="endpoint">
|
||||||
|
<v-selectpage
|
||||||
|
:data="endpointList"
|
||||||
|
:tb-columns="endpointColumns"
|
||||||
:multiple="false"
|
:multiple="false"
|
||||||
:language="language"
|
:language="language"
|
||||||
key-field="id"
|
key-field="id"
|
||||||
@@ -236,7 +252,8 @@ export default {
|
|||||||
description: ''
|
description: ''
|
||||||
},
|
},
|
||||||
templateList: [],
|
templateList: [],
|
||||||
dataList: [],
|
endpointList: [],
|
||||||
|
assetList: [],
|
||||||
templateType: undefined // 选中模板的varType
|
templateType: undefined // 选中模板的varType
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -255,6 +272,7 @@ export default {
|
|||||||
this.templateType = newValue
|
this.templateType = newValue
|
||||||
// 判断varType是否变化
|
// 判断varType是否变化
|
||||||
if (oldValue != newValue) {
|
if (oldValue != newValue) {
|
||||||
|
this.editDashboard.link = ''
|
||||||
this.getTableData()
|
this.getTableData()
|
||||||
}
|
}
|
||||||
this.$refs.form.validateField('tmplId')
|
this.$refs.form.validateField('tmplId')
|
||||||
@@ -278,11 +296,8 @@ export default {
|
|||||||
},
|
},
|
||||||
// 根据选中模板vartype请求数据
|
// 根据选中模板vartype请求数据
|
||||||
getTableData () {
|
getTableData () {
|
||||||
this.editDashboard.link = ''
|
this.endpointList = []
|
||||||
this.dataList = []
|
if (this.templateType === 2) {
|
||||||
if (this.templateType === 1) {
|
|
||||||
this.getAssetData()
|
|
||||||
} else if (this.templateType === 2) {
|
|
||||||
this.getEndpointData()
|
this.getEndpointData()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -290,7 +305,7 @@ export default {
|
|||||||
getAssetData () {
|
getAssetData () {
|
||||||
this.$get('asset/asset', { pageSize: -1 }).then(response => {
|
this.$get('asset/asset', { pageSize: -1 }).then(response => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.dataList = response.data.list
|
this.assetList = response.data.list
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -298,7 +313,7 @@ export default {
|
|||||||
getEndpointData () {
|
getEndpointData () {
|
||||||
this.$get('monitor/endpoint', { pageSize: -1 }).then(response => {
|
this.$get('monitor/endpoint', { pageSize: -1 }).then(response => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.dataList = response.data.list
|
this.endpointList = response.data.list
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1882,7 +1882,7 @@ export default {
|
|||||||
this.getProjectList()
|
this.getProjectList()
|
||||||
this.getCredential()
|
this.getCredential()
|
||||||
this.getWalkData()
|
this.getWalkData()
|
||||||
this.getAsset()
|
// this.getAsset()
|
||||||
this.ChartTemplateList()
|
this.ChartTemplateList()
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
this.getAsset()
|
// this.getAsset()
|
||||||
this.getSoftwareTypeList()
|
this.getSoftwareTypeList()
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
|
|||||||
@@ -170,7 +170,11 @@ export default {
|
|||||||
* search content filter
|
* search content filter
|
||||||
*/
|
*/
|
||||||
if (this.search) {
|
if (this.search) {
|
||||||
list = list.filter(val => new RegExp(this.search.toLowerCase()).test(val[this.searchColumn].toLowerCase()))
|
list = list.filter(val => {
|
||||||
|
console.log(val[this.searchColumn])
|
||||||
|
console.log(this.searchColumn)
|
||||||
|
return new RegExp(this.search.toLowerCase()).test(val[this.searchColumn].toLowerCase())
|
||||||
|
})
|
||||||
}
|
}
|
||||||
this.totalRows = list.length
|
this.totalRows = list.length
|
||||||
|
|
||||||
|
|||||||
@@ -99,6 +99,14 @@ Vue.use(vSelectPage, {
|
|||||||
if (params.pageNumber) {
|
if (params.pageNumber) {
|
||||||
params.pageNo = params.pageNumber
|
params.pageNo = params.pageNumber
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 使用服务端数据 初始化选中数据(直接查询时 第一页可能不存在选中数据)
|
||||||
|
if (params.searchKey) {
|
||||||
|
params.ids = params.searchValue
|
||||||
|
delete params.searchKey
|
||||||
|
delete params.searchValue
|
||||||
|
}
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
get(url, params).then(res => {
|
get(url, params).then(res => {
|
||||||
resolve(res)
|
resolve(res)
|
||||||
|
|||||||
Reference in New Issue
Block a user