Commit 5644c224 authored by 智勇's avatar 智勇

全选

parent 3f033b95
......@@ -13,13 +13,14 @@
<el-card>
<el-button
v-for="item in ns.repos"
:key="item.domain"
:key="item.appname"
:type="dependant[ns.type] && dependant[ns.type].find(sys => sys.appname === item.appname) ? 'success' : ''"
style="margin:3px"
@click="selectSystem(item, ns.type)">
{{ item.appname }}
</el-button>
</el-card>
<el-checkbox :indeterminate="isIndeterminate[ns.type]" v-model="checkAll[ns.type]" @change="handleCheckAllChange(checkAll[ns.type],ns.type)">全选</el-checkbox>
</el-form-item>
</el-form>
......@@ -47,7 +48,9 @@ export default {
dependant: {},
repoNamespaces: [],
currentTemplate: '',
templates: {}
templates: {},
checkAll: {},
isIndeterminate: {}
}
},
......@@ -64,6 +67,10 @@ export default {
getAllRepos() {
getAppRepos().then(res => {
this.repoNamespaces = res.data
this.repoNamespaces.forEach(item => {
this.checkAll[item.type] = false
this.isIndeterminate[item.type] = true
})
})
},
......@@ -83,6 +90,12 @@ export default {
}
},
handleCheckAllChange(val, type) {
this.$set(this.dependant, type, [])
this.isIndeterminate[type] = false
if (val) this.dependant[type] = this.repoNamespaces.filter(item => item.type === type)[0].repos.concat()
},
useTemplate() {
const vm = this
const t = this.templates.find(item => item.name === this.currentTemplate)
......
......@@ -20,6 +20,7 @@
{{ item.appname }}
</el-button>
</el-card>
<el-checkbox :indeterminate="isIndeterminate[ns.type]" v-model="checkAll[ns.type]" @change="handleCheckAllChange(checkAll[ns.type],ns.type)">全选</el-checkbox>
</el-form-item>
</el-form >
<div style="float:right">
......@@ -53,7 +54,8 @@ export default {
currentTemplate: '',
currentTemplateObj: {},
templates: {},
loading: true
checkAll: {},
isIndeterminate: {}
}
},
......@@ -66,7 +68,10 @@ export default {
getAllRepos() {
getAllRepos().then(res => {
this.repoNamespaces = res.data
this.loading = false
this.repoNamespaces.forEach(item => {
this.checkAll[item.type] = false
this.isIndeterminate[item.type] = true
})
})
},
......@@ -87,6 +92,12 @@ export default {
}
},
handleCheckAllChange(val, type) {
this.$set(this.dependant, type, [])
this.isIndeterminate[type] = false
if (val) this.dependant[type] = this.repoNamespaces.filter(item => item.type === type)[0].repos.concat()
},
useTemplate() {
const vm = this
this.currentTemplateObj = this.templates.find(item => item.name === this.currentTemplate)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment