调整
This commit is contained in:
parent
3dfeadd2f5
commit
c3881eb2a1
@ -99,6 +99,13 @@
|
|||||||
<el-input v-model="form.remark" :readonly="true" />
|
<el-input v-model="form.remark" :readonly="true" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="服务器列表" prop="serverList">
|
<el-form-item label="服务器列表" prop="serverList">
|
||||||
|
<el-checkbox
|
||||||
|
v-model="checkAll"
|
||||||
|
:indeterminate="isInterminate"
|
||||||
|
@change="CheckAllChange"
|
||||||
|
>
|
||||||
|
全选
|
||||||
|
</el-checkbox>
|
||||||
<template>
|
<template>
|
||||||
<el-checkbox-group v-model="form.serverList" @change="handleCheckServersChange">
|
<el-checkbox-group v-model="form.serverList" @change="handleCheckServersChange">
|
||||||
<el-checkbox v-for="server in servers" :key="server.key" :label="server.key">{{ server.label }}</el-checkbox>
|
<el-checkbox v-for="server in servers" :key="server.key" :label="server.key">{{ server.label }}</el-checkbox>
|
||||||
@ -174,6 +181,8 @@ export default {
|
|||||||
audit_is_open: 0,
|
audit_is_open: 0,
|
||||||
serverList: []
|
serverList: []
|
||||||
},
|
},
|
||||||
|
isInterminate: false,
|
||||||
|
checkAll: false,
|
||||||
dialogFormVisible: false,
|
dialogFormVisible: false,
|
||||||
dialogStatus: '',
|
dialogStatus: '',
|
||||||
listLoading: true,
|
listLoading: true,
|
||||||
@ -208,6 +217,9 @@ export default {
|
|||||||
this.dialogStatus = 'update'
|
this.dialogStatus = 'update'
|
||||||
this.dialogTitle = '编辑'
|
this.dialogTitle = '编辑'
|
||||||
this.dialogFormVisible = true
|
this.dialogFormVisible = true
|
||||||
|
const checkedcount = this.form.serverList.length
|
||||||
|
this.checkAll = this.servers.length === checkedcount
|
||||||
|
this.isInterminate = checkedcount > 0 && checkedcount < this.servers.length
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs['form'].clearValidate()
|
this.$refs['form'].clearValidate()
|
||||||
})
|
})
|
||||||
@ -316,8 +328,19 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleCheckServersChange() {
|
handleCheckServersChange(value) {
|
||||||
return
|
const checkedCount = value.length
|
||||||
|
this.checkAll = checkedCount > 0 && checkedCount === this.form.serverList.length
|
||||||
|
this.isInterminate = checkedCount > 0 && checkedCount < this.servers.length
|
||||||
|
},
|
||||||
|
CheckAllChange(value) {
|
||||||
|
this.form.serverList = []
|
||||||
|
if (value) {
|
||||||
|
this.servers.forEach((item, index) => {
|
||||||
|
this.form.serverList.push(item.key)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.isInterminate = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user