submit
This commit is contained in:
parent
91cc91ab33
commit
073a83dbc0
|
@ -0,0 +1,87 @@
|
||||||
|
import request from '/@/utils/request';
|
||||||
|
var model = 'kn-setting';
|
||||||
|
export const getList = (params) => {
|
||||||
|
return request({
|
||||||
|
url: '/api/'+model+'/dict-biz/list',
|
||||||
|
method: 'get',
|
||||||
|
params: {
|
||||||
|
...params,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getParentList = (current, size, params) => {
|
||||||
|
return request({
|
||||||
|
url: '/api/'+model+'/dict-biz/parent-list',
|
||||||
|
method: 'get',
|
||||||
|
params: {
|
||||||
|
...params,
|
||||||
|
current,
|
||||||
|
size,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getChildList = (current, size, parentId, params) => {
|
||||||
|
return request({
|
||||||
|
url: '/api/'+model+'/dict-biz/child-list',
|
||||||
|
method: 'get',
|
||||||
|
params: {
|
||||||
|
...params,
|
||||||
|
current,
|
||||||
|
size,
|
||||||
|
parentId: parentId,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const remove = (ids) => {
|
||||||
|
return request({
|
||||||
|
url: '/api/'+model+'/dict-biz/remove',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
ids,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const add = (row) => {
|
||||||
|
return request({
|
||||||
|
url: '/api/'+model+'/dict-biz/submit',
|
||||||
|
method: 'post',
|
||||||
|
data: row
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const update = (row) => {
|
||||||
|
return request({
|
||||||
|
url: '/api/'+model+'/dict-biz/submit',
|
||||||
|
method: 'post',
|
||||||
|
data: row
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const getDict = (id) => {
|
||||||
|
return request({
|
||||||
|
url: '/api/'+model+'/dict-biz/detail',
|
||||||
|
method: 'get',
|
||||||
|
params: {
|
||||||
|
id,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export const getDictTree = () => {
|
||||||
|
return request({
|
||||||
|
url: '/api/'+model+'/dict-biz/tree?code=DICT',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getDictionary = (params) => {
|
||||||
|
return request({
|
||||||
|
url: '/api/'+model+'/dict-biz/dictionary',
|
||||||
|
method: 'get',
|
||||||
|
params,
|
||||||
|
})
|
||||||
|
}
|
|
@ -226,22 +226,23 @@ export const dynamicRoutes = [
|
||||||
// },
|
// },
|
||||||
// ],
|
// ],
|
||||||
// },
|
// },
|
||||||
// {
|
{
|
||||||
// path: '/system',
|
path: '/system',
|
||||||
// name: 'system',
|
name: 'system',
|
||||||
// component: () => import('/@/layout/routerView/parent.vue'),
|
component: () => import('/@/layout/routerView/parent.vue'),
|
||||||
// redirect: '/system/menu',
|
redirect: '/system/menu',
|
||||||
// meta: {
|
meta: {
|
||||||
// title: '系统设置',
|
title: '系统设置',
|
||||||
// isLink: '',
|
isLink: '',
|
||||||
// isHide: false,
|
isHide: false,
|
||||||
// isKeepAlive: true,
|
isKeepAlive: true,
|
||||||
// isAffix: false,
|
isAffix: false,
|
||||||
// isIframe: false,
|
isIframe: false,
|
||||||
// roles: ['admin'],
|
roles: ['admin'],
|
||||||
// icon: 'iconfont icon-xitongshezhi',
|
// icon: 'iconfont icon-xitongshezhi',
|
||||||
// },
|
zh:"系统设置"
|
||||||
// children: [
|
},
|
||||||
|
children: [
|
||||||
// {
|
// {
|
||||||
// path: '/system/menu',
|
// path: '/system/menu',
|
||||||
// name: 'systemMenu',
|
// name: 'systemMenu',
|
||||||
|
@ -302,23 +303,23 @@ export const dynamicRoutes = [
|
||||||
// icon: 'ele-OfficeBuilding',
|
// icon: 'ele-OfficeBuilding',
|
||||||
// },
|
// },
|
||||||
// },
|
// },
|
||||||
// {
|
{
|
||||||
// path: '/system/dic',
|
path: '/system/dic',
|
||||||
// name: 'systemDic',
|
name: 'systemDic',
|
||||||
// component: () => import('/@/views/system/dic/index.vue'),
|
component: () => import('/@/views/system/dic/index.vue'),
|
||||||
// meta: {
|
meta: {
|
||||||
// title: '字典管理',
|
title: '字典管理',
|
||||||
// isLink: '',
|
isLink: '',
|
||||||
// isHide: false,
|
isHide: false,
|
||||||
// isKeepAlive: true,
|
isKeepAlive: true,
|
||||||
// isAffix: false,
|
isAffix: false,
|
||||||
// isIframe: false,
|
isIframe: false,
|
||||||
// roles: ['admin'],
|
roles: ['admin'],
|
||||||
// icon: 'ele-SetUp',
|
// icon: 'ele-SetUp',
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// ],
|
],
|
||||||
// },
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,133 +1,65 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="system-dic-dialog-container">
|
<div class="system-dic-dialog-container">
|
||||||
<el-dialog :title="state.dialog.title"
|
<el-dialog :title="state.dialog.title" v-model="state.dialog.isShowDialog" width="769px">
|
||||||
v-model="state.dialog.isShowDialog"
|
<!-- <el-alert title="半成品,交互过于复杂,请自行扩展!"
|
||||||
width="769px">
|
|
||||||
<el-alert title="半成品,交互过于复杂,请自行扩展!"
|
|
||||||
type="warning"
|
type="warning"
|
||||||
:closable="false"
|
:closable="false"
|
||||||
class="mb20"> </el-alert>
|
class="mb20"> </el-alert> -->
|
||||||
<el-form ref="dicDialogFormRef"
|
<el-form ref="dicDialogFormRef" :model="state.ruleForm" size="default" label-width="90px">
|
||||||
:model="state.ruleForm"
|
|
||||||
size="default"
|
|
||||||
label-width="90px">
|
|
||||||
<el-row :gutter="35">
|
<el-row :gutter="35">
|
||||||
<el-col :xs="24"
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||||
:sm="12"
|
<el-form-item label="字典名">
|
||||||
:md="12"
|
<el-input v-model="state.ruleForm.dictValue" placeholder="请输入字典名称" clearable></el-input>
|
||||||
:lg="12"
|
|
||||||
:xl="12"
|
|
||||||
class="mb20">
|
|
||||||
<el-form-item label="字典名称">
|
|
||||||
<el-input v-model="state.ruleForm.dicName"
|
|
||||||
placeholder="请输入字典名称"
|
|
||||||
clearable></el-input>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="24"
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||||
:sm="12"
|
<el-form-item label="字段Key">
|
||||||
:md="12"
|
<el-input v-model="state.ruleForm.dictKey" placeholder="请输入字段名,拼接 ruleForm.list" clearable></el-input>
|
||||||
:lg="12"
|
|
||||||
:xl="12"
|
|
||||||
class="mb20">
|
|
||||||
<el-form-item label="字段名">
|
|
||||||
<el-input v-model="state.ruleForm.fieldName"
|
|
||||||
placeholder="请输入字段名,拼接 ruleForm.list"
|
|
||||||
clearable></el-input>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="24"
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
||||||
:sm="24"
|
|
||||||
:md="24"
|
|
||||||
:lg="24"
|
|
||||||
:xl="24"
|
|
||||||
class="mb20">
|
|
||||||
<el-form-item label="字典状态">
|
<el-form-item label="字典状态">
|
||||||
<el-switch v-model="state.ruleForm.status"
|
<el-switch v-model="state.ruleForm.status" inline-prompt active-text="启" inactive-text="禁"></el-switch>
|
||||||
inline-prompt
|
|
||||||
active-text="启"
|
|
||||||
inactive-text="禁"></el-switch>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="24"
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
||||||
:sm="24"
|
<el-row :gutter="35" v-for="(v, k) in state.ruleForm.list" :key="k">
|
||||||
:md="24"
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||||
:lg="24"
|
|
||||||
:xl="24"
|
|
||||||
class="mb20">
|
|
||||||
<el-row :gutter="35"
|
|
||||||
v-for="(v, k) in state.ruleForm.list"
|
|
||||||
:key="k">
|
|
||||||
<el-col :xs="24"
|
|
||||||
:sm="12"
|
|
||||||
:md="12"
|
|
||||||
:lg="12"
|
|
||||||
:xl="12"
|
|
||||||
class="mb20">
|
|
||||||
<el-form-item :prop="`list[${k}].label`">
|
<el-form-item :prop="`list[${k}].label`">
|
||||||
<template #label>
|
<template #label>
|
||||||
<el-button type="primary"
|
<el-button type="primary" circle size="small" @click="onAddRow" v-if="k === 0">
|
||||||
circle
|
|
||||||
size="small"
|
|
||||||
@click="onAddRow"
|
|
||||||
v-if="k === 0">
|
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<ele-Plus />
|
<ele-Plus />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button type="danger"
|
<el-button type="danger" circle size="small" @click="onDelRow(k)" v-else>
|
||||||
circle
|
|
||||||
size="small"
|
|
||||||
@click="onDelRow(k)"
|
|
||||||
v-else>
|
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<ele-Delete />
|
<ele-Delete />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
<span class="ml10">字段</span>
|
<span class="ml10">字典名</span>
|
||||||
</template>
|
</template>
|
||||||
<el-input v-model="v.label"
|
<el-input v-model="v.dictValue" style="width: 100%" placeholder="请输入字段名"> </el-input>
|
||||||
style="width: 100%"
|
|
||||||
placeholder="请输入字段名"> </el-input>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="24"
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||||
:sm="12"
|
<el-form-item label="字典Key" :prop="`list[${k}].value`">
|
||||||
:md="12"
|
<el-input v-model="v.dictKey" style="width: 100%" placeholder="请输入字典Key"> </el-input>
|
||||||
:lg="12"
|
|
||||||
:xl="12"
|
|
||||||
class="mb20">
|
|
||||||
<el-form-item label="属性"
|
|
||||||
:prop="`list[${k}].value`">
|
|
||||||
<el-input v-model="v.value"
|
|
||||||
style="width: 100%"
|
|
||||||
placeholder="请输入属性值"> </el-input>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="24"
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
||||||
:sm="24"
|
|
||||||
:md="24"
|
|
||||||
:lg="24"
|
|
||||||
:xl="24"
|
|
||||||
class="mb20">
|
|
||||||
<el-form-item label="字典描述">
|
<el-form-item label="字典描述">
|
||||||
<el-input v-model="state.ruleForm.describe"
|
<el-input v-model="state.ruleForm.remark" type="textarea" placeholder="请输入字典描述" maxlength="150"></el-input>
|
||||||
type="textarea"
|
|
||||||
placeholder="请输入字典描述"
|
|
||||||
maxlength="150"></el-input>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
<el-button @click="onCancel"
|
<el-button @click="onCancel" size="default">取 消</el-button>
|
||||||
size="default">取 消</el-button>
|
<el-button type="primary" @click="onSubmit" size="default">{{ state.dialog.submitTxt }}</el-button>
|
||||||
<el-button type="primary"
|
|
||||||
@click="onSubmit"
|
|
||||||
size="default">{{ state.dialog.submitTxt }}</el-button>
|
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
@ -135,6 +67,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="systemDicDialog">
|
<script setup name="systemDicDialog">
|
||||||
|
import { RowAlign } from 'element-plus';
|
||||||
import { reactive, ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
|
|
||||||
// 定义子组件向父组件传值/事件
|
// 定义子组件向父组件传值/事件
|
||||||
|
@ -144,11 +77,11 @@ const emit = defineEmits(['refresh']);
|
||||||
const dicDialogFormRef = ref();
|
const dicDialogFormRef = ref();
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
ruleForm: {
|
ruleForm: {
|
||||||
dicName: '', // 字典名称
|
dictValue: '', // 字典名称
|
||||||
fieldName: '', // 字段名
|
dictKey: '', // 字段名
|
||||||
status: true, // 字典状态
|
isSealed: 0, // 字典状态
|
||||||
list: [], // 子集字段 + 属性值
|
list: [], // 子集字段 + 属性值
|
||||||
describe: '', // 字典描述
|
remark: '', // 字典描述
|
||||||
},
|
},
|
||||||
dialog: {
|
dialog: {
|
||||||
isShowDialog: false,
|
isShowDialog: false,
|
||||||
|
@ -160,21 +93,26 @@ const state = reactive({
|
||||||
|
|
||||||
// 打开弹窗
|
// 打开弹窗
|
||||||
const openDialog = (type, row) => {
|
const openDialog = (type, row) => {
|
||||||
|
|
||||||
if (type === 'edit') {
|
if (type === 'edit') {
|
||||||
if (row.fieldName === 'SYS_UERINFO') {
|
console.log(row);
|
||||||
row.list = [
|
|
||||||
{ id: Math.random(), label: 'sex', value: '1' },
|
|
||||||
{ id: Math.random(), label: 'sex', value: '0' },
|
|
||||||
];
|
|
||||||
} else {
|
|
||||||
row.list = [
|
|
||||||
{ id: Math.random(), label: 'role', value: 'admin' },
|
|
||||||
{ id: Math.random(), label: 'role', value: 'chief' },
|
|
||||||
{ id: Math.random(), label: 'roleName', value: '超级管理员' },
|
|
||||||
{ id: Math.random(), label: 'roleName', value: '主要管理员' },
|
|
||||||
];
|
|
||||||
}
|
|
||||||
state.ruleForm = row;
|
state.ruleForm = row;
|
||||||
|
state.ruleForm.list = row.children;
|
||||||
|
state.status = row.isSealed === 0;
|
||||||
|
// if (row.fieldName === 'SYS_UERINFO') {
|
||||||
|
// row.list = [
|
||||||
|
// { id: Math.random(), label: 'sex', value: '1' },
|
||||||
|
// { id: Math.random(), label: 'sex', value: '0' },
|
||||||
|
// ];
|
||||||
|
// } else {
|
||||||
|
// row.list = [
|
||||||
|
// { id: Math.random(), label: 'role', value: 'admin' },
|
||||||
|
// { id: Math.random(), label: 'role', value: 'chief' },
|
||||||
|
// { id: Math.random(), label: 'roleName', value: '超级管理员' },
|
||||||
|
// { id: Math.random(), label: 'roleName', value: '主要管理员' },
|
||||||
|
// ];
|
||||||
|
// }
|
||||||
|
// state.ruleForm = row;
|
||||||
state.dialog.title = '修改字典';
|
state.dialog.title = '修改字典';
|
||||||
state.dialog.submitTxt = '修 改';
|
state.dialog.submitTxt = '修 改';
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -18,16 +18,15 @@
|
||||||
</div>
|
</div>
|
||||||
<el-table :data="state.tableData.data" v-loading="state.tableData.loading" style="width: 100%">
|
<el-table :data="state.tableData.data" v-loading="state.tableData.loading" style="width: 100%">
|
||||||
<el-table-column type="index" label="序号" width="50" />
|
<el-table-column type="index" label="序号" width="50" />
|
||||||
<el-table-column prop="dicName" label="字典名称" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="dictValue" label="字典名称" show-overflow-tooltip></el-table-column>
|
||||||
<el-table-column prop="fieldName" label="字段名" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="dictKey" label="字典值" show-overflow-tooltip></el-table-column>
|
||||||
<el-table-column prop="status" label="字典状态" show-overflow-tooltip>
|
<el-table-column prop="isSealed" label="字典状态" show-overflow-tooltip>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tag type="success" v-if="scope.row.status">启用</el-tag>
|
<el-tag type="success" v-if="scope.row.isSealed===0">启用</el-tag>
|
||||||
<el-tag type="info" v-else>禁用</el-tag>
|
<el-tag type="info" v-else>禁用</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="describe" label="字典描述" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="remark" label="字典描述" show-overflow-tooltip></el-table-column>
|
||||||
<el-table-column prop="createTime" label="创建时间" show-overflow-tooltip></el-table-column>
|
|
||||||
<el-table-column label="操作" width="100">
|
<el-table-column label="操作" width="100">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button size="small" text type="primary" @click="onOpenEditDic('edit', scope.row)">修改</el-button>
|
<el-button size="small" text type="primary" @click="onOpenEditDic('edit', scope.row)">修改</el-button>
|
||||||
|
@ -35,7 +34,7 @@
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<el-pagination
|
<!-- <el-pagination
|
||||||
@size-change="onHandleSizeChange"
|
@size-change="onHandleSizeChange"
|
||||||
@current-change="onHandleCurrentChange"
|
@current-change="onHandleCurrentChange"
|
||||||
class="mt15"
|
class="mt15"
|
||||||
|
@ -47,7 +46,7 @@
|
||||||
layout="total, sizes, prev, pager, next, jumper"
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
:total="state.tableData.total"
|
:total="state.tableData.total"
|
||||||
>
|
>
|
||||||
</el-pagination>
|
</el-pagination> -->
|
||||||
</el-card>
|
</el-card>
|
||||||
<DicDialog ref="dicDialogRef" @refresh="getTableData()" />
|
<DicDialog ref="dicDialogRef" @refresh="getTableData()" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -56,7 +55,7 @@
|
||||||
<script setup name="systemDic">
|
<script setup name="systemDic">
|
||||||
import { defineAsyncComponent, reactive, onMounted, ref } from 'vue';
|
import { defineAsyncComponent, reactive, onMounted, ref } from 'vue';
|
||||||
import { ElMessageBox, ElMessage } from 'element-plus';
|
import { ElMessageBox, ElMessage } from 'element-plus';
|
||||||
|
import { getList } from '/@/api/system/dictbiz';
|
||||||
// 引入组件
|
// 引入组件
|
||||||
const DicDialog = defineAsyncComponent(() => import('/@/views/system/dic/dialog.vue'));
|
const DicDialog = defineAsyncComponent(() => import('/@/views/system/dic/dialog.vue'));
|
||||||
|
|
||||||
|
@ -77,22 +76,10 @@ const state = reactive({
|
||||||
// 初始化表格数据
|
// 初始化表格数据
|
||||||
const getTableData = () => {
|
const getTableData = () => {
|
||||||
state.tableData.loading = true;
|
state.tableData.loading = true;
|
||||||
const data = [];
|
getList().then((res) => {
|
||||||
for (let i = 0; i < 2; i++) {
|
state.tableData.data = res;
|
||||||
data.push({
|
|
||||||
dicName: i === 0 ? '角色标识' : '用户性别',
|
|
||||||
fieldName: i === 0 ? 'SYS_ROLE' : 'SYS_UERINFO',
|
|
||||||
describe: i === 0 ? '这是角色字典' : '这是用户性别字典',
|
|
||||||
status: true,
|
|
||||||
createTime: new Date().toLocaleString(),
|
|
||||||
list: [],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
state.tableData.data = data;
|
|
||||||
state.tableData.total = state.tableData.data.length;
|
|
||||||
setTimeout(() => {
|
|
||||||
state.tableData.loading = false;
|
state.tableData.loading = false;
|
||||||
}, 500);
|
});
|
||||||
};
|
};
|
||||||
// 打开新增字典弹窗
|
// 打开新增字典弹窗
|
||||||
const onOpenAddDic = (type) => {
|
const onOpenAddDic = (type) => {
|
||||||
|
|
|
@ -30,7 +30,7 @@ const viteConfig = defineConfig((mode) => {
|
||||||
hmr: true,
|
hmr: true,
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: 'http://192.168.31.14:9090',
|
target: 'http://192.168.31.250:9090',
|
||||||
ws: true,
|
ws: true,
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (path) => path.replace(/^\/api/, ''),
|
rewrite: (path) => path.replace(/^\/api/, ''),
|
||||||
|
|
Loading…
Reference in New Issue