postdischarge-ui/src/views/system/compare/index.vue

406 lines
15 KiB
Vue
Raw Normal View History

2024-02-28 17:26:28 +08:00
<template>
2024-06-14 15:30:24 +08:00
<div class="app-container" ref="layout">
2024-06-16 15:31:29 +08:00
<div ref="topform" class="form">
2024-06-14 15:30:24 +08:00
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<!-- <el-form-item label="所属科室id" prop="departmentId">
2024-02-28 17:26:28 +08:00
<el-input
v-model="queryParams.departmentId"
placeholder="请输入所属科室id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="所属科室名称" prop="departmentName">
<el-input
v-model="queryParams.departmentName"
placeholder="请输入所属科室名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item> -->
2024-06-14 15:30:24 +08:00
<el-form-item label="标准对照名称" prop="normCompareName">
<el-input v-model="queryParams.normCompareName" placeholder="请输入标准对照名称" clearable
@keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="标准对照编码" prop="normCompareCode">
<el-input v-model="queryParams.normCompareCode" placeholder="请输入标准对照编码" clearable
@keyup.enter.native="handleQuery" />
</el-form-item>
<!-- <el-form-item label="标准对照排序" prop="normCompareSort">
2024-02-28 17:26:28 +08:00
<el-input
v-model="queryParams.normCompareSort"
placeholder="请输入标准对照排序"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="标准对照概述" prop="normCompareRemark">
<el-input
v-model="queryParams.normCompareRemark"
placeholder="请输入标准对照概述"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item> -->
2024-06-14 15:30:24 +08:00
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</div>
<div ref="mb8" class="mb8">
<el-row :gutter="10" class="">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['system:compare:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
v-hasPermi="['system:compare:edit']">修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
v-hasPermi="['system:compare:remove']">删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
v-hasPermi="['system:compare:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</div>
<div ref="table">
<el-table :max-height="maxTableHeight" v-loading="loading" :data="compareList"
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="主键id" align="center" prop="id" />
2024-02-28 17:26:28 +08:00
<el-table-column label="所属科室id" align="center" prop="departmentId" /> -->
2024-06-14 15:30:24 +08:00
<!-- <el-table-column label="所属科室名称" align="center" prop="departmentName" /> -->
<el-table-column label="标准对照名称" align="center" prop="normCompareName" />
<el-table-column label="标准对照编码" align="center" prop="normCompareCode" />
<el-table-column label="标准对照排序" align="center" prop="normCompareSort" />
<el-table-column label="标准对照概述" align="center" prop="normCompareRemark" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['system:compare:edit']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['system:compare:remove']">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList" />
2024-02-28 17:26:28 +08:00
<!-- 添加或修改标准科室对照信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
2024-03-06 11:31:55 +08:00
<el-form ref="form" :model="form" :rules="rules" label-width="110px" :inline="true">
2024-02-28 17:26:28 +08:00
<!-- <el-form-item label="所属科室id" prop="departmentId">
<el-input v-model="form.departmentId" placeholder="请输入所属科室id" />
</el-form-item> -->
<el-form-item label="所属科室" prop="departmentId">
2024-06-14 15:30:24 +08:00
<el-button type="" v-if="form.departmentName == '请选择科室'" @click="clickinnerVisible()" style="
2024-02-28 17:26:28 +08:00
width: 208px;
text-align: left;
height: 36px;
color: #c0c4cc;
overflow: hidden;
2024-06-14 15:30:24 +08:00
">{{ form.departmentName }}</el-button>
<el-button @click="clickinnerVisible()" type="" v-else style="
2024-02-28 17:26:28 +08:00
width: 208px;
text-align: left;
height: 36px;
padding-left: -10px;
overflow: hidden;
2024-06-14 15:30:24 +08:00
">{{ form.departmentName }}</el-button>
2024-02-28 17:26:28 +08:00
</el-form-item>
<!-- <el-form-item label="所属科室名称" prop="departmentName">
<el-input v-model="form.departmentName" placeholder="请输入所属科室名称" />
</el-form-item> -->
<el-form-item label="标准对照名称" prop="normCompareName">
2024-03-06 11:31:55 +08:00
<el-input v-model="form.normCompareName" maxlength="100" placeholder="请输入标准对照名称" />
2024-02-28 17:26:28 +08:00
</el-form-item>
<el-form-item label="标准对照编码" prop="normCompareCode">
2024-06-14 15:30:24 +08:00
<el-input v-model="form.normCompareCode" maxlength="20" placeholder="请输入标准对照编码"
onKeyUp="value=value.replace(/[\W]/g,'')" />
2024-02-28 17:26:28 +08:00
</el-form-item>
<el-form-item label="标准对照排序" prop="normCompareSort">
2024-06-14 15:30:24 +08:00
<el-input-number v-model="form.normCompareSort" controls-position="right" :min="0" placeholder="请输入标准对照排序" />
2024-04-09 16:15:25 +08:00
<!-- <el-input v-model="form.normCompareSort" maxlength="8" placeholder="请输入标准对照排序" /> -->
2024-02-28 17:26:28 +08:00
</el-form-item>
<el-form-item label="标准对照概述" prop="normCompareRemark">
2024-06-14 15:30:24 +08:00
<el-input type="textarea" style="width: 206px" v-model="form.normCompareRemark" maxlength="100"
placeholder="请输入标准对照概述" />
2024-02-28 17:26:28 +08:00
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
2024-06-14 15:30:24 +08:00
<!-- 科室弹框 -->
<el-dialog title="" :visible.sync="innerVisibleshow" width="1000px" append-to-body
:before-close="innerVisiblecancel">
<el-form ref="queryForm" :model="informationqueryParams" :rules="rules" label-width="80px" :inline="true">
2024-02-28 17:26:28 +08:00
<el-form-item label="科室名称" prop="departmentName" label-width="120">
2024-06-14 15:30:24 +08:00
<el-input v-model="informationqueryParams.departmentName" placeholder="请输入科室名称" clearable />
2024-02-28 17:26:28 +08:00
</el-form-item>
<el-form-item>
2024-06-14 15:30:24 +08:00
<el-button type="primary" icon="el-icon-search" size="mini" @click="informationInfoinfo">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="addresetQuerylist">重置</el-button>
2024-02-28 17:26:28 +08:00
</el-form-item>
</el-form>
2024-06-14 15:30:24 +08:00
<el-table :data="infolist" @cell-dblclick="nurseclick" v-loading="loading">
2024-02-28 17:26:28 +08:00
<el-table-column label="请选择" width="100" align="center">
<template slot-scope="scope">
2024-06-14 15:30:24 +08:00
<el-button type="primary" style="width: 15px; height: 15px"
v-if="form.departmentId == scope.row.departmentCode" circle @click="nurseclick(scope.row)"></el-button>
<el-button v-else style="width: 15px; height: 15px" circle @click="nurseclick(scope.row)"></el-button>
2024-02-28 17:26:28 +08:00
</template>
</el-table-column>
2024-06-14 15:30:24 +08:00
<el-table-column property="departmentName" label="科室名称" align="center" :show-overflow-tooltip="true">
2024-02-28 17:26:28 +08:00
</el-table-column>
</el-table>
2024-06-14 15:30:24 +08:00
<pagination v-show="totaldepartment > 0" :total="totaldepartment" :page.sync="informationqueryParams.pageNum"
:limit.sync="informationqueryParams.pageSize" @pagination="informationInfoinfo" />
2024-02-28 17:26:28 +08:00
</el-dialog>
</div>
</template>
<script>
import { listCompare, getCompare, delCompare, addCompare, updateCompare } from "@/api/system/compare";
2024-06-14 15:30:24 +08:00
import { department } from "@/api/manage/script";
2024-02-28 17:26:28 +08:00
export default {
name: "Compare",
data() {
return {
2024-06-14 15:30:24 +08:00
maxTableHeight: undefined,
totaldepartment: 0,
infolist: [],
2024-02-28 17:26:28 +08:00
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 标准科室对照信息表格数据
compareList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
departmentId: null,
departmentName: null,
normCompareName: null,
normCompareCode: null,
normCompareSort: null,
normCompareRemark: null,
},
// 表单参数
form: {},
2024-06-14 15:30:24 +08:00
// 科室
informationqueryParams: {
2024-02-28 17:26:28 +08:00
pageNum: 1,
pageSize: 10,
departmentName: null,
},
2024-06-14 15:30:24 +08:00
innerVisibleshow: false,
2024-02-28 17:26:28 +08:00
// 表单校验
rules: {
2024-06-14 15:30:24 +08:00
departmentId: [
{ required: true, message: "所属科室不能为空", trigger: "blur" },
2024-03-06 11:31:55 +08:00
],
2024-06-14 15:30:24 +08:00
normCompareName: [
{ required: true, message: "标准对照名称不能为空", trigger: "blur" },
2024-03-06 11:31:55 +08:00
]
2024-02-28 17:26:28 +08:00
}
};
},
created() {
this.getList();
},
2024-06-14 15:30:24 +08:00
mounted() {
this.getMaxTableHeight()
this.screenChange()
},
2024-02-28 17:26:28 +08:00
methods: {
2024-06-14 15:30:24 +08:00
// 科室名称重置
addresetQuerylist() {
2024-02-28 17:26:28 +08:00
this.informationqueryParams = {
pageNum: 1,
pageSize: 10,
};
this.informationInfoinfo();
},
innerVisiblecancel() {
this.innerVisibleshow = false;
},
// 科室名称圆点按钮
nurseclick(row) {
this.form.departmentId = row.departmentCode;
this.form.departmentName = row.departmentName;
// console.log(this.departmentName, "0000");
this.innerVisibleshow = false;
},
// 科室列表
informationInfoinfo() {
department(this.informationqueryParams).then((response) => {
this.infolist = response.rows;
this.totaldepartment = response.total;
this.loading = false;
});
// this.informationqueryParams.page = 1;
},
// 点击科室
clickinnerVisible() {
this.innerVisibleshow = true;
// if (this.itemname) {
2024-06-14 15:30:24 +08:00
this.informationqueryParams.departmentId = this.itemname;
2024-02-28 17:26:28 +08:00
// } else {
2024-06-14 15:30:24 +08:00
this.informationqueryParams.departmentId = null;
2024-02-28 17:26:28 +08:00
// }
this.informationInfoinfo();
},
/** 查询标准科室对照信息列表 */
getList() {
this.loading = true;
listCompare(this.queryParams).then(response => {
this.compareList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
departmentId: null,
departmentName: null,
normCompareName: null,
normCompareCode: null,
2024-04-09 16:15:25 +08:00
normCompareSort: undefined,
2024-02-28 17:26:28 +08:00
normCompareRemark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
2024-06-14 15:30:24 +08:00
this.single = selection.length !== 1
2024-02-28 17:26:28 +08:00
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
2024-06-14 15:30:24 +08:00
this.form.departmentName = "请选择科室"
2024-02-28 17:26:28 +08:00
this.title = "添加标准科室对照信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getCompare(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改标准科室对照信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateCompare(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addCompare(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
2024-06-14 15:30:24 +08:00
this.$modal.confirm('是否确认删除标准科室对照信息编号为"' + ids + '"的数据项?').then(function () {
2024-02-28 17:26:28 +08:00
return delCompare(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
2024-06-14 15:30:24 +08:00
}).catch(() => { });
2024-02-28 17:26:28 +08:00
},
/** 导出按钮操作 */
handleExport() {
this.download('system/compare/export', {
...this.queryParams
2024-05-13 17:11:48 +08:00
}, `标准科室对照信息_${new Date().getTime()}.xlsx`)
2024-06-14 15:30:24 +08:00
},
// 获取表格最高高度
getMaxTableHeight() {
const windowInnerHeight = window.innerHeight // 屏幕可视高度
const layoutDiv = this.$refs.layout
2024-06-16 15:31:29 +08:00
const formDiv = this.$refs.topform
2024-06-14 15:30:24 +08:00
const mb8Div = this.$refs.mb8
this.maxTableHeight =
windowInnerHeight - 134 -
this.getBoxPadding(layoutDiv) -
this.getBoxHeight(mb8Div) -
this.getBoxHeight(formDiv)
},
// 屏幕resize监听
screenChange() {
// 屏幕resize监听事件一旦屏幕宽高发生变化就会执行resize
window.addEventListener('resize', this.getMaxTableHeight, true)
// 将屏幕监听事件移除
// 这步是必须的。离开页面时不移除,再返回,或者进入到别的有相同元素的页面会报错
// 或者将这里的方法直接写在beforeDestroy函数中也可以
this.$once('hook:beforeDestroy', () => {
window.removeEventListener('resize', this.getMaxTableHeight, true)
})
},
2024-02-28 17:26:28 +08:00
}
};
</script>