|
|
@ -3,7 +3,11 @@ |
|
|
|
<div> |
|
|
|
<!--工具栏--> |
|
|
|
<div class="head-container"> |
|
|
|
<crudOperation :permission="permission" /> |
|
|
|
<crudOperation :permission="permission"> |
|
|
|
<template v-slot:left> |
|
|
|
<el-button v-permission="permission.add" class="filter-item" size="mini" type="primary" icon="el-icon-plus" :disabled="!activeAddBtn" @click="crud.toAdd">新增</el-button> |
|
|
|
</template> |
|
|
|
</crudOperation> |
|
|
|
</div> |
|
|
|
<!--表单组件--> |
|
|
|
<el-dialog append-to-body :close-on-click-modal="false" :before-close="crud.cancelCU" :visible="crud.status.cu > 0" :title="crud.status.title" width="500px"> |
|
|
@ -14,7 +18,7 @@ |
|
|
|
<el-form-item label="字典代码" prop="value"> |
|
|
|
<el-input v-model="form.value" style="width: 370px;" /> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="内容说明" prop="description"> |
|
|
|
<el-form-item label="内容说明"> |
|
|
|
<el-input v-model="form.description" style="width: 370px;" type="textarea" :rows="2" /> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
@ -42,7 +46,7 @@ import CRUD, { presenter, header, form } from '@crud/crud' |
|
|
|
import crudOperation from '@crud/CRUD.operation' |
|
|
|
import pagination from '@crud/Pagination' |
|
|
|
|
|
|
|
const defaultForm = { id: null, label: null, value: null, dictSort: 999 } |
|
|
|
const defaultForm = { id: null, label: null, value: null, description: null, dictSort: 999 } |
|
|
|
|
|
|
|
export default { |
|
|
|
components: { crudOperation, pagination }, |
|
|
@ -52,7 +56,7 @@ export default { |
|
|
|
title: '字典内容', url: 'api/dictDetail', query: { dictName: '' }, sort: ['dictSort,asc', 'id,desc'], |
|
|
|
crudMethod: { ...crudDictDetail }, |
|
|
|
optShow: { |
|
|
|
add: true, |
|
|
|
add: false, |
|
|
|
edit: true, |
|
|
|
del: true, |
|
|
|
reset: false, |
|
|
@ -69,15 +73,20 @@ export default { |
|
|
|
form(function() { |
|
|
|
return Object.assign({ dict: { id: this.dictId }}, defaultForm) |
|
|
|
})], |
|
|
|
props: { |
|
|
|
activeAddBtn: { |
|
|
|
type: Boolean |
|
|
|
} |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
dictId: null, |
|
|
|
rules: { |
|
|
|
label: [ |
|
|
|
{ required: true, message: '请输入字典标签', trigger: 'blur' } |
|
|
|
{ required: true, message: '请输入字典名称', trigger: 'blur' } |
|
|
|
], |
|
|
|
value: [ |
|
|
|
{ required: true, message: '请输入字典值', trigger: 'blur' } |
|
|
|
{ required: true, message: '请输入字典代码', trigger: 'blur' } |
|
|
|
] |
|
|
|
}, |
|
|
|
permission: { |
|
|
@ -86,6 +95,30 @@ export default { |
|
|
|
del: ['admin', 'dict:del'] |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// 获取数据前设置好接口地址 |
|
|
|
[CRUD.HOOK.afterDelete]() { |
|
|
|
console.log(this.$parent) |
|
|
|
if (this.$parent) { |
|
|
|
this.$emit('treeRefresh') |
|
|
|
} |
|
|
|
return true |
|
|
|
}, |
|
|
|
[CRUD.HOOK.afterToEdit]() { |
|
|
|
console.log(this.$parent) |
|
|
|
if (this.$parent) { |
|
|
|
this.$emit('treeRefresh') |
|
|
|
} |
|
|
|
return true |
|
|
|
}, |
|
|
|
[CRUD.HOOK.afterToAdd]() { |
|
|
|
console.log(this.$parent) |
|
|
|
if (this.$parent) { |
|
|
|
this.$emit('treeRefresh') |
|
|
|
} |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|