文件管理、数据字典、字典项

Raod 3 years ago
parent b40d3fb889
commit 05fb7d316e

@ -0,0 +1,75 @@
import request from '@/utils/request'
// 字典管理查询
export function getDictList(params) {
return request({
url: '/gaeaDict/pageList',
method: 'GET',
params,
})
}
// 获取单个字典数据
export function getDictItems(dictCode) {
return request({
url: `/gaeaDict/select/${dictCode}`,
method: 'get',
})
}
// 字典管理新增
export function dictAdd(data) {
return request({
url: '/gaeaDict',
method: 'POST',
data,
})
}
// 字典管理编辑
export function dictEdit(data) {
return request({
url: '/gaeaDict',
method: 'PUT',
data,
})
}
export function dictDetail(data) {
return request({
url: '/gaeaDict/' + data.id,
method: 'get',
params: { accessKey: data.accessKey },
})
}
// 字典管理批量删除
export function dictsDelect(data) {
return request({
url: `/gaeaDict/delete/batch`,
method: 'POST',
data,
})
}
/**
* 刷新数据字典
* @param data
*/
export function freshDict(data) {
return request({
url: '/gaeaDict/freshDict',
method: 'POST',
data,
})
}
// 获取国家省份城市
export function queryCountryCity(value) {
return request({
url: `/countryCity/select`,
method: 'get',
params: {
value: value,
},
})
}
export default { dictDetail, getDictList, dictAdd, dictEdit, dictsDelect }

@ -0,0 +1,47 @@
import request from '@/utils/request'
// 字典项管理查询
export function dictItemPageList(params) {
return request({
url: '/gaeaDictItem/pageList',
method: 'GET',
params,
})
}
// 字典项管理新增
export function dictItemAdd(data) {
return request({
url: '/gaeaDictItem',
method: 'POST',
data,
})
}
// 字典项管理编辑
export function dictItemEdit(data) {
return request({
url: '/gaeaDictItem',
method: 'PUT',
data,
})
}
// 字典项管理批量删除
export function dictsItemDelect(data) {
return request({
url: `/gaeaDictItem/delete/batch`,
method: 'POST',
data,
})
}
export function dictItemDetail(data) {
return request({
url: '/gaeaDictItem/' + data.id,
method: 'get',
params: { accessKey: data.accessKey },
})
}
export default { dictItemDetail, dictItemPageList, dictItemAdd, dictItemEdit, dictsItemDelect }

@ -51,6 +51,14 @@ export const constantRouterMap = [
//{ path: 'excelreport', name: 'excelreport', component: () => import('@/views/report/excelreport/index'), meta: { title: '表格报表', icon: 'iconliebiao', keepAlive: true, requireAuth: true, permission: 'excelManage'} }, //{ path: 'excelreport', name: 'excelreport', component: () => import('@/views/report/excelreport/index'), meta: { title: '表格报表', icon: 'iconliebiao', keepAlive: true, requireAuth: true, permission: 'excelManage'} },
] ]
}, },
{
path: '/system', name: 'system', component: Layout, meta: { title: '系统设置', icon: 'icon-xitong', requireAuth: true, permission: 'fileManage|dictManage|dictItemManage' },
children: [
{ path: 'file', name: 'file', component: () => import('@/views/file-management/index'), meta: { title: '文件管理', icon: 'icondatabase', keepAlive: true, requireAuth: true, permission: 'fileManage'} },
{ path: 'dict', name: 'dict', component: () => import('@/views/dict/index'), meta: { title: '数据字典', icon: 'iconAPIwangguan', keepAlive: true, requireAuth: true, permission: 'dictManage'} },
{ path: 'dictItem', name: 'dictItem', component: () => import('@/views/dict/dict-item'), meta: { title: '字典项', icon: 'iconnavicon-ywcs', keepAlive: true, requireAuth: true, permission: 'dictItemManage'} },
]
},
{ path: '/bigscreen/viewer', component: () => import('@/views/report/bigscreen/viewer'), hidden: true, meta: { requireAuth: true }}, { path: '/bigscreen/viewer', component: () => import('@/views/report/bigscreen/viewer'), hidden: true, meta: { requireAuth: true }},
{ path: '/bigscreen/designer', component: () => import('@/views/report/bigscreen/designer'), hidden: true, meta: { requireAuth: true }}, { path: '/bigscreen/designer', component: () => import('@/views/report/bigscreen/designer'), hidden: true, meta: { requireAuth: true }},
{ path: '/404', component: () => import('@/views/404'), hidden: true }, { path: '/404', component: () => import('@/views/404'), hidden: true },
@ -71,4 +79,4 @@ export default new Router({
// mode: 'history', //后端支持可开 // mode: 'history', //后端支持可开
scrollBehavior: () => ({ y: 0 }), scrollBehavior: () => ({ y: 0 }),
routes: constantRouterMap routes: constantRouterMap
}) })

@ -0,0 +1,239 @@
<template>
<anji-crud ref="listPage" :option="crudOption">
<!-- <template v-slot:buttonLeftOnTable>-->
<!-- <el-button type="primary" icon="el-icon-plus" @click="handleOpenDialog1">1</el-button>-->
<!-- </template>-->
<!--自定义的卡片插槽将在编辑详情页面出现在底部新卡片-->
<!-- <template v-slot:cardInEditPage>-->
<!-- <div class="anji-card">-->
<!-- <div class="card-head">-->
<!-- 自定义标题-->
<!-- </div>-->
<!-- <div class="card-body">-->
<!-- 自定义内容区-->
<!-- </div>-->
<!-- </div>-->
<!-- </template>-->
<!--这里可以将自定义的弹出框代码放入到page中
<template v-slot:pageSection>
<div>插入底部html片段</div>
</template>
-->
</anji-crud>
</template>
<script>
import { dictItemDetail, dictItemPageList, dictItemAdd, dictItemEdit, dictsItemDelect } from '@/api/dictItem'
export default {
name: 'DictItem',
components: {
anjiCrud: require('@/components/AnjiPlus/anji-crud/anji-crud').default,
},
data() {
return {
searchForm: {
project: this.$route.query.project,
dictCode: this.$route.query.dictCode,
itemCode: null,
itemLabel: null,
itemValue: null,
remark: null,
pageNumber: 1,
pageSize: 10,
},
crudOption: {
// 使
title: '字典项',
//
labelWidth: '120px',
//
queryFormFields: [
{
inputType: 'input',
label: '字典编码',
field: 'dictCode',
disabled: this.isBlank(this.$route.query['dictCode']) == false,
defaultValue: this.$route.query['dictCode'],
},
{
inputType: 'input',
label: '显示文字',
field: 'itemLabel',
},
{
inputType: 'input',
label: '提交值',
field: 'itemValue',
},
{
inputType: 'input',
label: '备注',
field: 'remark',
},
{
label: '语言标识',
inputType: 'anji-select',
anjiSelectOption: {
dictCode: 'LOCALE',
},
field: 'locale',
},
],
//
buttons: {
query: {
api: dictItemPageList,
permission: 'dictItemManage:query',
},
queryByPrimarykey: {
api: dictItemDetail,
permission: 'dictItemManage:query',
},
add: {
api: dictItemAdd,
permission: 'dictItemManage:insert',
},
delete: {
api: dictsItemDelect,
permission: 'dictItemManage:delete',
},
edit: {
api: dictItemEdit,
permission: 'dictItemManage:update',
},
},
//
columns: [
{
label: '',
field: 'id',
primaryKey: true, // ,
tableHide: true, //
editHide: true, //
},
{
label: '字典编码', //
placeholder: '',
field: 'dictCode',
editField: 'dictCode',
inputType: 'input',
rules: [
{ required: true, message: '字典编码不能为空', trigger: 'blur' },
{ min: 1, max: 64, message: '不超过64个字符', trigger: 'blur' }
],
// disabled: false,
disabled: this.isBlank(this.$route.query['dictCode']) == false,
defaultValue: this.$route.query['dictCode'],
},
{
label: '字典项名称', //
placeholder: '',
field: 'itemName',
editField: 'itemName',
inputType: 'input',
rules: [
{ required: true, message: '字典项名称不能为空', trigger: 'blur' },
{ min: 1, max: 64, message: '不超过64个字符', trigger: 'blur' }],
disabled: false
},
{
label: '提交值', //
placeholder: '',
field: 'itemValue',
editField: 'itemValue',
inputType: 'input',
rules: [
{ required: true, message: '提交值不能为空', trigger: 'blur' },
{ min: 1, max: 64, message: '不超过64个字符', trigger: 'blur' },
],
disabled: 'disableOnEdit',
},
{
label: '语言标识', //
placeholder: '',
field: 'locale',
editField: 'locale',
fieldTableRowRenderer: (row) => {
return this.getDictLabelByCode('LOCALE', row['locale'])
},
inputType: 'anji-select',
anjiSelectOption: {
dictCode: 'LOCALE',
},
rules: [{ required: true, message: '语言标识不能为空', trigger: 'blur' }],
disabled: false,
defaultValue: 'zh'
},
{
label: '状态',//0-- 1-- DIC_NAME=ENABLE_FLAG
placeholder: '',
field: 'enabled',
fieldTableRowRenderer: (row) => {
return this.getDictLabelByCode('ENABLE_FLAG', row['enabled'])
},
colorStyle: {
0: 'table-danger', //keyeditField'': 'danger','': 'primary','绿': 'success','': 'warning','': 'info',''''
1: 'table-success',
},
editField: 'enabled',
inputType: 'anji-select',
anjiSelectOption: {
dictCode: "ENABLE_FLAG" //
},
rules: [
{ required: true, message: '状态不能为空', trigger: 'blur' },
],
disabled: false,
},
{
label: '排序', //
placeholder: '',
field: 'sort',
editField: 'sort',
inputType: 'input',
rules: [],
disabled: false,
},
{
label: '描述', //
placeholder: '',
field: 'remark',
editField: 'remark',
inputType: 'input',
rules: [{ min: 1, max: 64, message: '不超过64个字符', trigger: 'blur' }],
disabled: false,
tableHide: true, //
},
{
label: '扩展项', //
placeholder: '',
field: 'itemExtend',
editField: 'itemExtend',
inputType: 'input',
rules: [{ min: 1, max: 2048, message: '不超过2048个字符', trigger: 'blur' }],
disabled: false,
tableHide: true, //
},
{
label: '创建人',
placeholder: '',
field: 'updateBy',
editField: 'updateBy',
inputType: 'input',
disabled: false,
editHide: true, //
},
],
},
}
},
created() {
console.log(this.searchForm.dictCode)
},
methods: {},
}
</script>

@ -0,0 +1,212 @@
<template>
<anji-crud ref="listPage" :option="crudOption">
<template v-slot:buttonLeftOnTable>
<el-button type="primary" icon="el-icon-edit" @click="dictRefresh" v-permission="'dictManage:fresh'">
</el-button>
</template>
<template slot="rowButton" slot-scope="props">
<el-button type="text" @click="editItem(props)" v-permission="'dictItemManage:query'"></el-button>
<el-button type="text" @click="itemRefresh(props)" v-permission="'dictManage:fresh'"></el-button>
</template>
<!--自定义的卡片插槽将在编辑详情页面出现在底部新卡片-->
<!-- <template v-slot:cardInEditPage>-->
<!-- <div class="anji-card">-->
<!-- <div class="card-head">-->
<!-- 自定义标题-->
<!-- </div>-->
<!-- <div class="card-body">-->
<!-- 自定义内容区-->
<!-- </div>-->
<!-- </div>-->
<!-- </template>-->
<!--这里可以将自定义的弹出框代码放入到page中
<template v-slot:pageSection>
<div>插入底部html片段</div>
</template>
-->
</anji-crud>
</template>
<script>
import {dictDetail, getDictList, dictAdd, dictEdit, dictsDelect, freshDict} from '@/api/dict'
export default {
name: 'Dict',
components: {
anjiCrud: require('@/components/AnjiPlus/anji-crud/anji-crud').default,
},
data() {
const that = this
return {
crudOption: {
// 使
title: '数据字典',
//
labelWidth: '120px',
//
queryFormFields: [
{
inputType: 'input',
label: '字典名称',
field: 'dictName',
},
{
inputType: 'input',
label: '字典编码',
field: 'dictCode',
},
],
queryFormChange(queryForm, fileName, fileval) {
if (queryForm['project']) {
that.$store.commit('user/SET_PROJECT', queryForm['project'])
}
},
//
buttons: {
query: {
api: getDictList,
permission: 'dictManage:query',
},
queryByPrimarykey: {
api: dictDetail,
permission: 'dictManage:query',
},
add: {
api: dictAdd,
permission: 'dictManage:insert',
},
delete: {
api: dictsDelect,
permission: 'dictManage:delete',
},
edit: {
api: dictEdit,
permission: 'dictManage:update',
},
//
customButton: {
operationWidth: 240, // row
},
},
//
columns: [
{
label: '',
field: 'id',
primaryKey: true, // ,
tableHide: true, //
editHide: true, //
},
{
label: '字典名称', //
placeholder: '',
field: 'dictName',
editField: 'dictName',
inputType: 'input',
rules: [
{required: true, message: '字典名称不能为空', trigger: 'blur'},
{min: 1, max: 64, message: '不超过64个字符', trigger: 'blur'},
],
disabled: false,
},
{
label: '字典编码', //
placeholder: '',
field: 'dictCode',
editField: 'dictCode',
inputType: 'input',
rules: [
{required: true, message: '字典编码不能为空', trigger: 'blur'},
{min: 1, max: 64, message: '不超过64个字符', trigger: 'blur'},
],
disabled: 'disableOnEdit',
},
{
label: '描述', //
placeholder: '',
field: 'remark',
editField: 'remark',
inputType: 'input',
rules: [{min: 1, max: 64, message: '不超过64个字符', trigger: 'blur'}],
disabled: false,
},
{
label: '创建时间',
placeholder: '',
field: 'createTime',
editField: 'createTime',
inputType: 'input',
disabled: false,
editHide: true, //
},
{
label: '创建人',
placeholder: '',
field: 'createBy',
editField: 'createBy',
inputType: 'input',
disabled: false,
editHide: true, //
},
{
label: '更新时间',
placeholder: '',
field: 'updateTime',
editField: 'updateTime',
inputType: 'input',
disabled: false,
editHide: true, //
},
{
label: '更新人',
placeholder: '',
field: 'updateBy',
editField: 'updateBy',
inputType: 'input',
disabled: false,
editHide: true, //
},
],
},
}
},
created() {
},
methods: {
//
async dictRefresh() {
var checkRecords = this.$refs.listPage.checkRecords
var dictCodes = []
if (checkRecords.length > 0) {
dictCodes = checkRecords.map((item) => item.dictCode)
}
const {code} = await freshDict(dictCodes)
if (code != '200') return
this.$message.success('刷新成功')
},
//
async itemRefresh(val) {
const selectedList = val.msg
let dictCodes = []
if (selectedList.length > 0) {
dictCodes = selectedList.map((item) => item.dictCode)
}
const {code} = await freshDict(dictCodes)
if (code != '200') return
this.$message.success('刷新成功')
},
//
editItem(val) {
this.$router.push({
path: '/system/dictItem',
query: {
dictCode: val.msg.dictCode,
project: this.$store.state.user.project,
},
})
},
},
}
</script>
Loading…
Cancel
Save