系统打印模板管理
This commit is contained in:
parent
9e5365c96f
commit
be6b362344
54
src/api/liswork/xtwh/reportdictApi.ts
Normal file
54
src/api/liswork/xtwh/reportdictApi.ts
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
//参数设置字典
|
||||||
|
// @ts-ignore
|
||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询字典列表
|
||||||
|
export function listreportdict(params:any) {
|
||||||
|
return request({
|
||||||
|
url: '/reportdict/list',
|
||||||
|
method: 'get',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询字典详细
|
||||||
|
export function getreportdict(id:number) {
|
||||||
|
return request({
|
||||||
|
url: `/reportdict/${id}`,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增字典
|
||||||
|
export function addreportdict(params:any) {
|
||||||
|
return request({
|
||||||
|
url: '/reportdict',
|
||||||
|
method: 'post',
|
||||||
|
data:params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改字典
|
||||||
|
export function updatereportdict(params:any) {
|
||||||
|
return request({
|
||||||
|
url: '/reportdict',
|
||||||
|
method: 'put',
|
||||||
|
data:params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除字典
|
||||||
|
export function delreportdict(id:any) {
|
||||||
|
return request({
|
||||||
|
url: `/reportdict/${id}`,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
// 自动加载
|
||||||
|
export function autoload() {
|
||||||
|
return request({
|
||||||
|
url: '/reportdict/autoload',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
493
src/views/liswork/xtwh/reportdict/index.vue
Normal file
493
src/views/liswork/xtwh/reportdict/index.vue
Normal file
@ -0,0 +1,493 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch">
|
||||||
|
<el-form-item :label="menuname + '类别'" prop="reportType">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.reportType"
|
||||||
|
:placeholder="`请选择${menuname}类别`"
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
|
@change="handleQuery"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in reportTypeOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="模板文件名(.jrxml)" prop="reportCode">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.reportCode"
|
||||||
|
:placeholder="`请输入${menuname}编码`"
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="`${menuname}名称`" prop="reportName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.reportName"
|
||||||
|
: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>
|
||||||
|
|
||||||
|
<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="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="autoloading"
|
||||||
|
>自动加载</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="5" class="table-container">
|
||||||
|
<el-table v-loading="loading" :data="regdictList" @selection-change="handleSelectionChange" class="report-table" height="100%">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column :label="`${menuname}类别`" align="center" prop="reportType" width="100" show-overflow-tooltip>
|
||||||
|
<template #default="scope">
|
||||||
|
<span
|
||||||
|
class="report-type-cell"
|
||||||
|
:style="{
|
||||||
|
backgroundColor: getreportTypeColor(scope.row.reportType),
|
||||||
|
color: '#fff' // 文字白色,保证对比
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
{{ reportTypeOptions.find(item => item.value === scope.row.reportType)?.label || scope.row.reportType }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="编号" align="center" prop="reportId" width="50" show-overflow-tooltip/>
|
||||||
|
<el-table-column label="模板文件名" align="center" prop="reportCode" width="150" show-overflow-tooltip />
|
||||||
|
<el-table-column :label="`${menuname}名称`" align="left" prop="reportName" show-overflow-tooltip />
|
||||||
|
<el-table-column label="排版类别" align="center" prop="reportOptiontype"width="80">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>
|
||||||
|
{{ reportOptiontypeOptions.find(item => item.value === scope.row.reportOptiontype)?.label || scope.row.reportOptiontype }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="参数" align="center" prop="reportDefvalue" show-overflow-tooltip />
|
||||||
|
<el-table-column label="备注" align="left" prop="remark" show-overflow-tooltip />
|
||||||
|
<el-table-column label="排序" align="center" prop="reportSort" 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="400" 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="Link" @click="handleDelete(scope.row)" >预览模板</el-button>
|
||||||
|
<el-button link type="primary" icon="Upload" @click="uploadfile(scope.row)" >更替模板</el-button>
|
||||||
|
<el-button link type="primary" icon="Download" @click="downloadfile(scope.row)" >下载模板</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-row>
|
||||||
|
<!-- 添加或修改模板对话框 -->
|
||||||
|
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||||
|
|
||||||
|
<el-form ref="reportdictRef" :model="form" :rules="rules" label-width="150px">
|
||||||
|
<el-form-item :label="`${menuname}类别`" prop="reportType">
|
||||||
|
<el-select
|
||||||
|
v-model="form.reportType"
|
||||||
|
:placeholder="`请选择${menuname}类别`"
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in reportTypeOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="模板文件名(.jrxml)" prop="reportCode">
|
||||||
|
<el-input v-model="form.reportCode" :placeholder="`请输入${menuname}编码`" disabled class="disabled-input-gray"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="`${menuname}名称`" prop="reportName">
|
||||||
|
<el-input v-model="form.reportName" :placeholder="`请输入${menuname}名称`" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="`${menuname}排版类别`" prop="reportOptiontype">
|
||||||
|
<el-select
|
||||||
|
v-model="form.reportOptiontype"
|
||||||
|
:placeholder="`请选择${menuname}排版类别`"
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in reportOptiontypeOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="`${menuname}参数`" prop="reportDefvalue">
|
||||||
|
<el-input v-model="form.reportDefvalue" :placeholder="`请输入${menuname}参数`" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="顺序" prop="reportSort">
|
||||||
|
<el-input-number v-model="form.reportSort" 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="备注" 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>
|
||||||
|
<!-- 用户导入对话框 -->
|
||||||
|
<el-dialog :title="upload.title" v-model="upload.open" width="400px" append-to-body>
|
||||||
|
<el-upload ref="uploadRef" :limit="1" accept=".jrxml" :headers="upload.headers"
|
||||||
|
:action="upload.url + '?reportId=' + upload.reportId" :disabled="upload.isUploading"
|
||||||
|
:on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
|
||||||
|
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
||||||
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||||
|
<template #tip>
|
||||||
|
<div class="el-upload__tip text-center">
|
||||||
|
<span>仅允许导入jrxml格式文件。</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-upload>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitFileForm">确 定</el-button>
|
||||||
|
<el-button @click="upload.open = false">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="reportdict">
|
||||||
|
import { getToken } from "@/utils/auth";
|
||||||
|
import {
|
||||||
|
addreportdict, delreportdict,
|
||||||
|
getreportdict,
|
||||||
|
listreportdict,
|
||||||
|
updatereportdict,autoload
|
||||||
|
} from "@/api/liswork/xtwh/reportdictApi.ts";
|
||||||
|
// 1. 定义类别下拉选项(根据实际业务调整)
|
||||||
|
const reportTypeOptions = ref([
|
||||||
|
{ label: "检验报告", value: "0",color: "#56BBBD" },
|
||||||
|
{ label: "条码标签", value: "1",color: "#67C23A" },
|
||||||
|
{ label: "回单标签", value: "2",color: "#7E84F7" },
|
||||||
|
{ label: "统计报表", value: "3",color: "#F08784" },
|
||||||
|
{ label: "其他报表", value: "4",color: "#909399" },
|
||||||
|
]);
|
||||||
|
// 2. 定义获取类别对应颜色的方法
|
||||||
|
function getreportTypeColor(type) {
|
||||||
|
// 匹配对应类别的颜色,无匹配时用默认色
|
||||||
|
const item = reportTypeOptions.value.find(item => item.value === type);
|
||||||
|
return item?.color || "#909399"; // 默认灰色
|
||||||
|
}
|
||||||
|
// 2. 定义参数类别下拉选项(根据实际业务调整)
|
||||||
|
const reportOptiontypeOptions = 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 getreportOptionTypeColor(type) {
|
||||||
|
// 匹配对应类别的颜色,无匹配时用默认色
|
||||||
|
const item = reportOptiontypeOptions.value.find(item => item.value === type);
|
||||||
|
return item?.color || "#909399"; // 默认灰色
|
||||||
|
}
|
||||||
|
/*** 用户导入参数 */
|
||||||
|
const upload = reactive({
|
||||||
|
// 是否显示弹出层(用户导入)
|
||||||
|
open: false,
|
||||||
|
// 弹出层标题(用户导入)
|
||||||
|
title: "",
|
||||||
|
// 是否禁用上传
|
||||||
|
isUploading: false,
|
||||||
|
// 更新的模板号
|
||||||
|
reportId: 0,
|
||||||
|
// 设置上传的请求头部
|
||||||
|
headers: { Authorization: "Bearer " + getToken() },
|
||||||
|
// 上传的地址
|
||||||
|
url: import.meta.env.VITE_APP_BASE_API + "/reportdict/importfile"
|
||||||
|
});
|
||||||
|
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: {
|
||||||
|
reportCode: undefined,
|
||||||
|
reportName: undefined,
|
||||||
|
reportType:"0",
|
||||||
|
status: undefined
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
reportType: [{ required: true, message: menuname.value+"类别不能为空", trigger: "blur" }],
|
||||||
|
reportName: [{ required: true, message: menuname.value+"名称不能为空", trigger: "blur" }],
|
||||||
|
reportCode: [{ required: true, message: menuname.value+"编码不能为空", trigger: "blur" }],
|
||||||
|
reportSort: [{ required: true, message: menuname.value+"顺序不能为空", trigger: "blur" }],
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const { queryParams, form, rules } = toRefs(data);
|
||||||
|
|
||||||
|
/** 查询模板列表 */
|
||||||
|
function getList() {
|
||||||
|
loading.value = true;
|
||||||
|
listreportdict(queryParams.value).then(response => {
|
||||||
|
console.log('response:', response);
|
||||||
|
regdictList.value = response.data;
|
||||||
|
total.value = response.data.length;
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/** 取消按钮 */
|
||||||
|
function cancel() {
|
||||||
|
open.value = false;
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
/** 表单重置 */
|
||||||
|
function reset() {
|
||||||
|
form.value = {
|
||||||
|
reportId: undefined,
|
||||||
|
reportCode: undefined,
|
||||||
|
reportName: undefined,
|
||||||
|
reportType: reportTypeOptions.value[0]?.value || "",
|
||||||
|
reportOptiontype: reportOptiontypeOptions.value[0]?.value || "",
|
||||||
|
reportDefvalue:undefined,
|
||||||
|
reportSort: 0,
|
||||||
|
status: "0",
|
||||||
|
remark: undefined
|
||||||
|
};
|
||||||
|
proxy.resetForm("reportdictRef");
|
||||||
|
}
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
function handleQuery() {
|
||||||
|
queryParams.value.pageNum = 1;
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
function resetQuery() {
|
||||||
|
proxy.resetForm("queryRef");
|
||||||
|
handleQuery();
|
||||||
|
}
|
||||||
|
/** 多选框选中数据 */
|
||||||
|
function handleSelectionChange(selection) {
|
||||||
|
ids.value = selection.map(item => item.reportId);
|
||||||
|
single.value = selection.length != 1;
|
||||||
|
multiple.value = !selection.length;
|
||||||
|
}
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
function handleAdd() {
|
||||||
|
upload.reportId=0;
|
||||||
|
upload.title = "新增模板";
|
||||||
|
upload.open = true;
|
||||||
|
}
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
function handleUpdate(row) {
|
||||||
|
reset();
|
||||||
|
const reportId = row.reportId || ids.value;
|
||||||
|
getreportdict(reportId).then(response => {
|
||||||
|
form.value = response.data;
|
||||||
|
open.value = true;
|
||||||
|
title.value = "修改"+menuname.value;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/** 提交按钮 */
|
||||||
|
function submitForm() {
|
||||||
|
proxy.$refs["reportdictRef"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
|
||||||
|
if (form.value.reportId != undefined) {
|
||||||
|
updatereportdict(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("修改成功");
|
||||||
|
open.value = false;
|
||||||
|
getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addreportdict(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("新增成功");
|
||||||
|
open.value = false;
|
||||||
|
getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**文件上传中处理 */
|
||||||
|
const handleFileUploadProgress = (event, file, fileList) => {
|
||||||
|
upload.isUploading = true;
|
||||||
|
};
|
||||||
|
/** 文件上传成功处理 */
|
||||||
|
const handleFileSuccess = (response, file, fileList) => {
|
||||||
|
upload.open = false;
|
||||||
|
upload.isUploading = false;
|
||||||
|
proxy.$refs["uploadRef"].handleRemove(file);
|
||||||
|
proxy.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
|
||||||
|
handleQuery()
|
||||||
|
};
|
||||||
|
/** 提交上传文件 */
|
||||||
|
function submitFileForm() {
|
||||||
|
proxy.$refs["uploadRef"].submit();
|
||||||
|
};
|
||||||
|
/** 导入按钮操作 */
|
||||||
|
function uploadfile(row) {
|
||||||
|
upload.reportId= row.reportId;
|
||||||
|
upload.title = "模板上传";
|
||||||
|
upload.open = true;
|
||||||
|
};
|
||||||
|
/** 下载模板操作 */
|
||||||
|
function downloadfile(row) {
|
||||||
|
const params = {
|
||||||
|
filename: row.reportCode
|
||||||
|
};
|
||||||
|
proxy.download("reportdict/downloadfile", params, `${row.reportCode}.jrxml`);
|
||||||
|
};
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
function handleDelete(row) {
|
||||||
|
const reportIds = row.reportId || ids.value;
|
||||||
|
proxy.$modal.confirm('是否确认删除"' + menuname.value + '"编号为"' + reportIds + '"的数据项?').then(function() {
|
||||||
|
|
||||||
|
return delreportdict(reportIds);
|
||||||
|
}).then(() => {
|
||||||
|
getList();
|
||||||
|
proxy.$modal.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {});
|
||||||
|
}
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
function handleExport() {
|
||||||
|
proxy.download("delreportdict/export", {
|
||||||
|
...queryParams.value
|
||||||
|
}, `dict_${new Date().getTime()}.xlsx`);
|
||||||
|
}
|
||||||
|
|
||||||
|
function autoloading(){
|
||||||
|
loading.value = true;
|
||||||
|
autoload().then(response => {
|
||||||
|
getList();
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
getList();
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
.app-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 90vh;
|
||||||
|
/* 容器高度等于窗口高度 */
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.mb8 {
|
||||||
|
height: 30px;
|
||||||
|
/* 固定高度 */
|
||||||
|
}
|
||||||
|
.table-container {
|
||||||
|
flex: 1;
|
||||||
|
/* 占满剩余高度 */
|
||||||
|
overflow: hidden;
|
||||||
|
/* 避免表格超出容器 */
|
||||||
|
}
|
||||||
|
/* 1. 减小表格行高(核心) */
|
||||||
|
:deep(.report-table .el-table__row) {
|
||||||
|
height: 30px !important; /* 原默认行高约40px,按需调整(建议28-35px) */
|
||||||
|
line-height: 30px !important; /* 行高与height一致,保证垂直居中 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 2. 减小单元格内边距(配合行高优化) */
|
||||||
|
:deep(.report-table .el-table__cell) {
|
||||||
|
padding: 2px 4px !important;
|
||||||
|
height: 30px !important; /* 单元格高度与行高一致 */
|
||||||
|
line-height: 1.2 !important; /* 文字行高适配矮行 */
|
||||||
|
vertical-align: middle !important; /* 强制垂直居中 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 3. 类别单元格适配矮行高 */
|
||||||
|
.report-type-cell {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
min-height: 26px; /* 适配30px行高,略小一点 */
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 0;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 可选:优化操作列按钮大小,适配矮行 */
|
||||||
|
:deep(.report-table .el-button--link) {
|
||||||
|
padding: 0 4px !important;
|
||||||
|
font-size: 12px !important;
|
||||||
|
}
|
||||||
|
.disabled-input-gray :deep(.el-input__inner){
|
||||||
|
background-color: #e9e9e9 !important; /* 灰色底色(可根据需求调整色值) */
|
||||||
|
color: #666 !important; /* 文字颜色加深,提升可读性 */
|
||||||
|
cursor: not-allowed !important; /* 鼠标悬浮显示禁止图标 */
|
||||||
|
}
|
||||||
|
</style>
|
||||||
272
src/views/liswork/xtwh/reportsetting/reportlist.vue
Normal file
272
src/views/liswork/xtwh/reportsetting/reportlist.vue
Normal file
@ -0,0 +1,272 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch">
|
||||||
|
<el-form-item label="模板编码" prop="zddh">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.zddh"
|
||||||
|
placeholder="请输入模板编码"
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="模板名称" prop="zdmc">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.zdmc"
|
||||||
|
placeholder="请输入模板名称"
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="userflag">
|
||||||
|
<el-select v-model="queryParams.userflag" 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="diagnosisList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="模板编码" align="center" prop="zddh" />
|
||||||
|
<el-table-column label="模板名称" align="center" prop="zdmc" />
|
||||||
|
<el-table-column label="模板排序" align="center" prop="diagSort" />
|
||||||
|
<el-table-column label="状态" align="center" prop="userflag">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options="sys_normal_disable" :value="scope.row.userflag" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
|
<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="diagnosisRef" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="模板名称" prop="diagName">
|
||||||
|
<el-input v-model="form.diagName" placeholder="请输入模板名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="模板编码" prop="diagCode">
|
||||||
|
<el-input v-model="form.diagCode" placeholder="请输入编码名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="模板顺序" prop="diagSort">
|
||||||
|
<el-input-number v-model="form.diagSort" 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="备注" 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="diagnosis">
|
||||||
|
import { listdiagnosis, adddiagnosis, deldiagnosis, getdiagnosis, updatediagnosis } from "@/api/regional/dict/diagnosis";
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance();
|
||||||
|
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
||||||
|
|
||||||
|
const diagnosisList = 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 data = reactive({
|
||||||
|
form: {},
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 15,
|
||||||
|
diagCode: undefined,
|
||||||
|
diagName: undefined,
|
||||||
|
status: undefined
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
diagName: [{ required: true, message: "模板名称不能为空", trigger: "blur" }],
|
||||||
|
diagCode: [{ required: true, message: "模板编码不能为空", trigger: "blur" }],
|
||||||
|
diagSort: [{ required: true, message: "模板顺序不能为空", trigger: "blur" }],
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const { queryParams, form, rules } = toRefs(data);
|
||||||
|
|
||||||
|
/** 查询模板列表 */
|
||||||
|
function getList() {
|
||||||
|
loading.value = true;
|
||||||
|
listdiagnosis(queryParams.value).then(response => {
|
||||||
|
diagnosisList.value = response.rows;
|
||||||
|
total.value = response.total;
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/** 取消按钮 */
|
||||||
|
function cancel() {
|
||||||
|
open.value = false;
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
/** 表单重置 */
|
||||||
|
function reset() {
|
||||||
|
form.value = {
|
||||||
|
diagId: undefined,
|
||||||
|
diagCode: undefined,
|
||||||
|
diagName: undefined,
|
||||||
|
diagSort: 0,
|
||||||
|
status: "0",
|
||||||
|
remark: undefined
|
||||||
|
};
|
||||||
|
proxy.resetForm("diagnosisRef");
|
||||||
|
}
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
function handleQuery() {
|
||||||
|
queryParams.value.pageNum = 1;
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
function resetQuery() {
|
||||||
|
proxy.resetForm("queryRef");
|
||||||
|
handleQuery();
|
||||||
|
}
|
||||||
|
/** 多选框选中数据 */
|
||||||
|
function handleSelectionChange(selection) {
|
||||||
|
ids.value = selection.map(item => item.diagId);
|
||||||
|
single.value = selection.length != 1;
|
||||||
|
multiple.value = !selection.length;
|
||||||
|
}
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
function handleAdd() {
|
||||||
|
reset();
|
||||||
|
open.value = true;
|
||||||
|
title.value = "添加模板";
|
||||||
|
}
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
function handleUpdate(row) {
|
||||||
|
reset();
|
||||||
|
const diagId = row.diagId || ids.value;
|
||||||
|
getdiagnosis(diagId).then(response => {
|
||||||
|
form.value = response.data;
|
||||||
|
open.value = true;
|
||||||
|
title.value = "修改模板";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/** 提交按钮 */
|
||||||
|
function submitForm() {
|
||||||
|
proxy.$refs["diagnosisRef"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (form.value.diagId != undefined) {
|
||||||
|
updatediagnosis(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("修改成功");
|
||||||
|
open.value = false;
|
||||||
|
getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
adddiagnosis(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("新增成功");
|
||||||
|
open.value = false;
|
||||||
|
getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
function handleDelete(row) {
|
||||||
|
const diagIds = row.diagId || ids.value;
|
||||||
|
proxy.$modal.confirm('是否确认删除模板编号为"' + diagIds + '"的数据项?').then(function() {
|
||||||
|
return deldiagnosis(diagIds);
|
||||||
|
}).then(() => {
|
||||||
|
getList();
|
||||||
|
proxy.$modal.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {});
|
||||||
|
}
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
function handleExport() {
|
||||||
|
proxy.download("system/diagnosis/export", {
|
||||||
|
...queryParams.value
|
||||||
|
}, `diag_${new Date().getTime()}.xlsx`);
|
||||||
|
}
|
||||||
|
|
||||||
|
getList();
|
||||||
|
</script>
|
||||||
Loading…
x
Reference in New Issue
Block a user