系统参数模板设置维护界面
This commit is contained in:
parent
ccce5849f8
commit
adc5df5bdb
46
src/api/liswork/xtwh/configdictApi.ts
Normal file
46
src/api/liswork/xtwh/configdictApi.ts
Normal file
@ -0,0 +1,46 @@
|
||||
//参数设置字典
|
||||
// @ts-ignore
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询字典列表
|
||||
export function listconfigdict(params:any) {
|
||||
return request({
|
||||
url: '/configdict/list',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// 查询字典详细
|
||||
export function getconfigdict(id:number) {
|
||||
return request({
|
||||
url: `/configdict/${id}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增字典
|
||||
export function addconfigdict(params:any) {
|
||||
return request({
|
||||
url: '/configdict',
|
||||
method: 'post',
|
||||
data:params
|
||||
})
|
||||
}
|
||||
|
||||
// 修改字典
|
||||
export function updateconfigdict(params:any) {
|
||||
return request({
|
||||
url: '/configdict',
|
||||
method: 'put',
|
||||
data:params
|
||||
})
|
||||
}
|
||||
|
||||
// 删除字典
|
||||
export function delconfigdict(id:any) {
|
||||
return request({
|
||||
url: `/configdict/${id}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
425
src/views/liswork/xtwh/configdict/index.vue
Normal file
425
src/views/liswork/xtwh/configdict/index.vue
Normal file
@ -0,0 +1,425 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch">
|
||||
<el-form-item :label="menuname + '类别'" prop="configType">
|
||||
<el-select
|
||||
v-model="queryParams.configType"
|
||||
:placeholder="`请选择${menuname}类别`"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
@change="handleQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in configTypeOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="menuname + '编码'" prop="configCode">
|
||||
<el-input
|
||||
v-model="queryParams.configCode"
|
||||
:placeholder="`请输入${menuname}编码`"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="`${menuname}名称`" prop="configName">
|
||||
<el-input
|
||||
v-model="queryParams.configName"
|
||||
:placeholder="`请输入${menuname}名称`"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="状态" clearable style="width: 200px">
|
||||
<el-option
|
||||
v-for="dict in sys_normal_disable"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="Plus"
|
||||
@click="handleAdd"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="Edit"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="Download"
|
||||
@click="handleExport"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="regdictList" @selection-change="handleSelectionChange" class="config-table">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column :label="`${menuname}编号`" align="center" prop="configId" v-if="false"/>
|
||||
<el-table-column :label="`${menuname}类别`" align="center" prop="configType" width="100" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<span
|
||||
class="config-type-cell"
|
||||
:style="{
|
||||
backgroundColor: getConfigTypeColor(scope.row.configType),
|
||||
color: '#fff' // 文字白色,保证对比
|
||||
}"
|
||||
>
|
||||
{{ configTypeOptions.find(item => item.value === scope.row.configType)?.label || scope.row.configType }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="`${menuname}编码`" align="center" prop="configCode" width="150" show-overflow-tooltip />
|
||||
<el-table-column :label="`${menuname}名称`" align="left" prop="configName" show-overflow-tooltip />
|
||||
<el-table-column label="选项类型" align="center" prop="configOptiontype"width="100">
|
||||
<template #default="scope">
|
||||
<span
|
||||
class="config-type-cell"
|
||||
:style="{
|
||||
backgroundColor: getconfigOptionTypeColor(scope.row.configOptiontype),
|
||||
color: '#fff' // 文字白色,保证对比
|
||||
}"
|
||||
>
|
||||
{{ configOptiontypeOptions.find(item => item.value === scope.row.configOptiontype)?.label || scope.row.configOptiontype }}
|
||||
</span>
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column label="默认值" align="center" prop="configDefvalue" show-overflow-tooltip />
|
||||
<el-table-column label="值域规则" align="left" prop="remark" show-overflow-tooltip />
|
||||
<el-table-column label="排序" align="center" prop="configSort" width="80" />
|
||||
<el-table-column label="状态" align="center" prop="status" width="80">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="sys_normal_disable" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="150" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="180" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" >修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" >删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改字典对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
|
||||
<el-form ref="configdictRef" :model="form" :rules="rules" label-width="150px">
|
||||
<el-form-item :label="`${menuname}类别`" prop="configType">
|
||||
<el-select
|
||||
v-model="form.configType"
|
||||
:placeholder="`请选择${menuname}类别`"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in configTypeOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="`${menuname}编码`" prop="configCode">
|
||||
<el-input v-model="form.configCode" :placeholder="`请输入${menuname}编码`" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="`${menuname}名称`" prop="configName">
|
||||
<el-input v-model="form.configName" :placeholder="`请输入${menuname}名称`" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="`${menuname}选项类型`" prop="configOptiontype">
|
||||
<el-select
|
||||
v-model="form.configOptiontype"
|
||||
:placeholder="`请选择${menuname}选项类型`"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in configOptiontypeOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="`${menuname}默认值`" prop="configDefvalue">
|
||||
<el-input v-model="form.configDefvalue" :placeholder="`请输入${menuname}默认值`" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="顺序" prop="configSort">
|
||||
<el-input-number v-model="form.configSort" controls-position="right" :min="0" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio
|
||||
v-for="dict in sys_normal_disable"
|
||||
:key="dict.value"
|
||||
:label="dict.value"
|
||||
>{{ dict.label }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="值域参数JSON" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="configdict">
|
||||
import {
|
||||
addconfigdict, delconfigdict,
|
||||
getconfigdict,
|
||||
listconfigdict,
|
||||
updateconfigdict
|
||||
} from "@/api/liswork/xtwh/configdictApi.ts";
|
||||
// 1. 定义类别下拉选项(根据实际业务调整)
|
||||
const configTypeOptions = ref([
|
||||
{ label: "仪器全局设置", value: "SYSTEM",color: "#E6A23C" },
|
||||
{ label: "仪器界面设置", value: "INPUT", color: "#67C23A" },
|
||||
{ label: "本地选项设置", value: "LOCAL" , color: "#409EFF" },
|
||||
{ label: "本院特殊设置", value: "HISOPT", color: "#909399" },
|
||||
{ label: "门诊采血设置", value: "_MZCX_", color: "#C74127" }
|
||||
]);
|
||||
// 2. 定义获取类别对应颜色的方法
|
||||
function getConfigTypeColor(type) {
|
||||
// 匹配对应类别的颜色,无匹配时用默认色
|
||||
const item = configTypeOptions.value.find(item => item.value === type);
|
||||
return item?.color || "#909399"; // 默认灰色
|
||||
}
|
||||
// 2. 定义参数类别下拉选项(根据实际业务调整)
|
||||
const configOptiontypeOptions = ref([
|
||||
{ label: "单选框", value: "0",color: "#56BBBD" },
|
||||
{ label: "下拉框", value: "1",color: "#67C23A" },
|
||||
{ label: "字典单选", value: "2",color: "#FF443F" },
|
||||
{ label: "字典多选", value: "3",color: "#F08784" },
|
||||
{ label: "特殊", value: "4",color: "#909399" },
|
||||
{ label: "文本框", value: "5",color: "#3282F6" },
|
||||
{ label: "数字框", value: "6",color: "#507F80" },
|
||||
{ label: "日期框", value: "7",color: "#7E84F7" },
|
||||
{ label: "时间框", value: "8",color: "#377D22" },
|
||||
]);
|
||||
function getconfigOptionTypeColor(type) {
|
||||
// 匹配对应类别的颜色,无匹配时用默认色
|
||||
const item = configOptiontypeOptions.value.find(item => item.value === type);
|
||||
return item?.color || "#909399"; // 默认灰色
|
||||
}
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
||||
const regdictList = ref([]);
|
||||
const open = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
const menuname = ref("参数");
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 15,
|
||||
configCode: undefined,
|
||||
configName: undefined,
|
||||
configType:undefined,
|
||||
status: undefined
|
||||
},
|
||||
rules: {
|
||||
configType: [{ required: true, message: menuname.value+"类别不能为空", trigger: "blur" }],
|
||||
configName: [{ required: true, message: menuname.value+"名称不能为空", trigger: "blur" }],
|
||||
configCode: [{ required: true, message: menuname.value+"编码不能为空", trigger: "blur" }],
|
||||
configSort: [{ required: true, message: menuname.value+"顺序不能为空", trigger: "blur" }],
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询字典列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listconfigdict(queryParams.value).then(response => {
|
||||
console.log('response:', response);
|
||||
regdictList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
/** 取消按钮 */
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
}
|
||||
/** 表单重置 */
|
||||
function reset() {
|
||||
form.value = {
|
||||
configId: undefined,
|
||||
configCode: undefined,
|
||||
configName: undefined,
|
||||
configType: configTypeOptions.value[0]?.value || "",
|
||||
configOptiontype: configOptiontypeOptions.value[0]?.value || "",
|
||||
configDefvalue:undefined,
|
||||
configSort: 0,
|
||||
status: "0",
|
||||
remark: undefined
|
||||
};
|
||||
proxy.resetForm("configdictRef");
|
||||
}
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
/** 多选框选中数据 */
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.configId);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加"+menuname.value;
|
||||
}
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
const configId = row.configId || ids.value;
|
||||
getconfigdict(configId).then(response => {
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改"+menuname.value;
|
||||
});
|
||||
}
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["configdictRef"].validate(valid => {
|
||||
if (valid) {
|
||||
|
||||
if (form.value.configId != undefined) {
|
||||
updateconfigdict(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
} else {
|
||||
addconfigdict(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const configIds = row.configId || ids.value;
|
||||
proxy.$modal.confirm('是否确认删除"' + menuname.value + '"编号为"' + configIds + '"的数据项?').then(function() {
|
||||
|
||||
return delconfigdict(configIds);
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
}
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download("delconfigdict/export", {
|
||||
...queryParams.value
|
||||
}, `dict_${new Date().getTime()}.xlsx`);
|
||||
}
|
||||
getList();
|
||||
</script>
|
||||
<style scoped>
|
||||
/* 1. 减小表格行高(核心) */
|
||||
:deep(.config-table .el-table__row) {
|
||||
height: 30px !important; /* 原默认行高约40px,按需调整(建议28-35px) */
|
||||
line-height: 30px !important; /* 行高与height一致,保证垂直居中 */
|
||||
}
|
||||
|
||||
/* 2. 减小单元格内边距(配合行高优化) */
|
||||
:deep(.config-table .el-table__cell) {
|
||||
padding: 2px 4px !important;
|
||||
height: 30px !important; /* 单元格高度与行高一致 */
|
||||
line-height: 1.2 !important; /* 文字行高适配矮行 */
|
||||
vertical-align: middle !important; /* 强制垂直居中 */
|
||||
}
|
||||
|
||||
/* 3. 类别单元格适配矮行高 */
|
||||
.config-type-cell {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-height: 26px; /* 适配30px行高,略小一点 */
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* 可选:优化操作列按钮大小,适配矮行 */
|
||||
:deep(.config-table .el-button--link) {
|
||||
padding: 0 4px !important;
|
||||
font-size: 12px !important;
|
||||
}
|
||||
</style>
|
||||
Loading…
x
Reference in New Issue
Block a user