mirror of https://github.com/veops/cmdb.git
[更新] 完成资源类型页面
This commit is contained in:
parent
10f7029722
commit
63792c242f
|
@ -27,7 +27,7 @@
|
||||||
:wrapper-col="formItemLayout.wrapperCol"
|
:wrapper-col="formItemLayout.wrapperCol"
|
||||||
label="描述"
|
label="描述"
|
||||||
>
|
>
|
||||||
<a-textarea placeholder="请输入描述信息..." name="description" :rows="4" />
|
<a-textarea placeholder="请输入描述信息..." name="description" :rows="4" v-decorator="['description', {rules: []} ]"/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
<a-form-item
|
<a-form-item
|
||||||
|
@ -35,13 +35,8 @@
|
||||||
:wrapper-col="formItemLayout.wrapperCol"
|
:wrapper-col="formItemLayout.wrapperCol"
|
||||||
label="权限"
|
label="权限"
|
||||||
>
|
>
|
||||||
<div :style="{ borderBottom: '1px solid #E9E9E9' }">
|
<a-select mode="tags" v-model="perms" style="width: 100%" placeholder="请输入权限名...">
|
||||||
<a-checkbox :indeterminate="indeterminate" @change="onCheckAllChange" :checked="checkAll">
|
</a-select>
|
||||||
全选
|
|
||||||
</a-checkbox>
|
|
||||||
</div>
|
|
||||||
<br />
|
|
||||||
<a-checkbox-group :options="plainOptions" v-model="perms" @change="onPermChange" />
|
|
||||||
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
|
@ -89,10 +84,7 @@ export default {
|
||||||
drawerTitle: '新增资源类型',
|
drawerTitle: '新增资源类型',
|
||||||
drawerVisible: false,
|
drawerVisible: false,
|
||||||
formLayout: 'vertical',
|
formLayout: 'vertical',
|
||||||
perms: ['1'],
|
perms: []
|
||||||
indeterminate: true,
|
|
||||||
checkAll: false,
|
|
||||||
plainOptions: ['1', '2']
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -101,7 +93,6 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
|
||||||
formItemLayout () {
|
formItemLayout () {
|
||||||
const { formLayout } = this
|
const { formLayout } = this
|
||||||
return formLayout === 'horizontal' ? {
|
return formLayout === 'horizontal' ? {
|
||||||
|
@ -127,17 +118,6 @@ export default {
|
||||||
mounted () {
|
mounted () {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onPermChange (perms) {
|
|
||||||
this.indeterminate = !!perms.length && perms.length < this.plainOptions.length
|
|
||||||
this.checkAll = perms.length === this.plainOptions.length
|
|
||||||
},
|
|
||||||
onCheckAllChange (e) {
|
|
||||||
Object.assign(this, {
|
|
||||||
perms: e.target.checked ? this.plainOptions : [],
|
|
||||||
indeterminate: false,
|
|
||||||
checkAll: e.target.checked
|
|
||||||
})
|
|
||||||
},
|
|
||||||
handleCreate () {
|
handleCreate () {
|
||||||
this.drawerVisible = true
|
this.drawerVisible = true
|
||||||
},
|
},
|
||||||
|
@ -152,6 +132,7 @@ export default {
|
||||||
handleEdit (record) {
|
handleEdit (record) {
|
||||||
this.drawerVisible = true
|
this.drawerVisible = true
|
||||||
console.log(record)
|
console.log(record)
|
||||||
|
this.perms = record.perms
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.form.setFieldsValue({
|
this.form.setFieldsValue({
|
||||||
id: record.id,
|
id: record.id,
|
||||||
|
|
|
@ -112,7 +112,7 @@ export default {
|
||||||
title: '类型名',
|
title: '类型名',
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
sorter: false,
|
sorter: false,
|
||||||
width: 50,
|
width: 300,
|
||||||
scopedSlots: {
|
scopedSlots: {
|
||||||
customRender: 'nameSearchRender',
|
customRender: 'nameSearchRender',
|
||||||
filterDropdown: 'filterDropdown',
|
filterDropdown: 'filterDropdown',
|
||||||
|
@ -130,7 +130,7 @@ export default {
|
||||||
{
|
{
|
||||||
title: '描述',
|
title: '描述',
|
||||||
dataIndex: 'description',
|
dataIndex: 'description',
|
||||||
width: 250,
|
width: 500,
|
||||||
sorter: false,
|
sorter: false,
|
||||||
scopedSlots: { customRender: 'description' }
|
scopedSlots: { customRender: 'description' }
|
||||||
},
|
},
|
||||||
|
@ -241,6 +241,15 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
handleEdit (record) {
|
handleEdit (record) {
|
||||||
|
var perms = []
|
||||||
|
var permList = this.id2perms[record.id]
|
||||||
|
if (permList) {
|
||||||
|
for (var i = 0; i < permList.length; i++) {
|
||||||
|
perms.push(permList[i].name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
record.perms = perms
|
||||||
|
console.log(record)
|
||||||
this.$refs.resourceTypeForm.handleEdit(record)
|
this.$refs.resourceTypeForm.handleEdit(record)
|
||||||
},
|
},
|
||||||
handleDelete (record) {
|
handleDelete (record) {
|
||||||
|
|
Loading…
Reference in New Issue