- 创建 SystemDictDetailVo 视图对象用于数据传输 - 修改控制器返回类型为 SystemDictDetailVo - 重构查询方法使用 LambdaQueryWrapper 替代 XML 配置 - 移除 SystemDictDetailTb 中的 dict 关联字段 - 添加字典名称查询的辅助方法 - 更新前端组件移除搜索功能并简化工具栏
134 lines
3.9 KiB
Vue
134 lines
3.9 KiB
Vue
<template>
|
|
<div>
|
|
<div v-if="query.dictName === ''">
|
|
<div class="my-code">点击字典查看详情</div>
|
|
</div>
|
|
<div v-else>
|
|
<!--表单组件-->
|
|
<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"
|
|
>
|
|
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
|
|
<el-form-item label="字典标签" prop="label">
|
|
<el-input v-model="form.label" style="width: 370px;" />
|
|
</el-form-item>
|
|
<el-form-item label="字典值" prop="value">
|
|
<el-input v-model="form.value" style="width: 370px;" />
|
|
</el-form-item>
|
|
<el-form-item label="排序" prop="dictSort">
|
|
<el-input-number
|
|
v-model.number="form.dictSort"
|
|
:min="0"
|
|
:max="999"
|
|
controls-position="right"
|
|
style="width: 370px;"
|
|
/>
|
|
</el-form-item>
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button @click="crud.cancelCU">取消</el-button>
|
|
<el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
<!--表格渲染-->
|
|
<el-table
|
|
ref="table"
|
|
v-loading="crud.loading"
|
|
:data="crud.data"
|
|
highlight-current-row
|
|
style="width: 100%;"
|
|
@selection-change="crud.selectionChangeHandler"
|
|
>
|
|
<el-table-column label="所属字典">
|
|
{{ query.dictName }}
|
|
</el-table-column>
|
|
<el-table-column prop="label" label="字典标签" />
|
|
<el-table-column prop="value" label="字典值" />
|
|
<el-table-column prop="dictSort" label="排序" />
|
|
<el-table-column
|
|
v-if="checkPer(['admin','dict:edit','dict:del'])"
|
|
label="操作"
|
|
width="130px"
|
|
align="center"
|
|
fixed="right"
|
|
>
|
|
<template slot-scope="scope">
|
|
<udOperation
|
|
:data="scope.row"
|
|
:permission="permission"
|
|
/>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<!--分页组件-->
|
|
<pagination />
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import crudDictDetail from '@/api/system/dictDetail'
|
|
import CRUD, { form, header, presenter } from '@crud/crud'
|
|
import pagination from '@crud/Pagination'
|
|
import udOperation from '@crud/UD.operation'
|
|
|
|
const defaultForm = { id: null, label: null, value: null, dictSort: 999 }
|
|
|
|
export default {
|
|
components: { pagination, udOperation },
|
|
cruds() {
|
|
return [
|
|
CRUD({
|
|
title: '字典详情', url: 'api/dictDetail', query: { dictName: '' },
|
|
crudMethod: { ...crudDictDetail },
|
|
optShow: {
|
|
add: true,
|
|
edit: true,
|
|
del: true,
|
|
reset: false
|
|
},
|
|
queryOnPresenterCreated: false
|
|
})
|
|
]
|
|
},
|
|
mixins: [
|
|
presenter(),
|
|
header(),
|
|
form(function() {
|
|
return Object.assign({ dict: { id: this.dictId }}, defaultForm)
|
|
})],
|
|
data() {
|
|
return {
|
|
dictId: null,
|
|
rules: {
|
|
label: [
|
|
{ required: true, message: '请输入字典标签', trigger: 'blur' }
|
|
],
|
|
value: [
|
|
{ required: true, message: '请输入字典值', trigger: 'blur' }
|
|
],
|
|
dictSort: [
|
|
{ required: true, message: '请输入序号', trigger: 'blur', type: 'number' }
|
|
]
|
|
},
|
|
permission: {
|
|
add: ['admin', 'dict:add'],
|
|
edit: ['admin', 'dict:edit'],
|
|
del: ['admin', 'dict:del']
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
::v-deep .el-input-number .el-input__inner {
|
|
text-align: left;
|
|
}
|
|
</style>
|