postdischarge-ui/src/views/system/compare/index.vue
2024-05-15 10:40:48 +08:00

488 lines
15 KiB
Vue

<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<!-- <el-form-item label="所属科室id" prop="departmentId">
<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> -->
<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">
<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> -->
<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>
<el-row :gutter="10" class="mb8">
<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>
<el-table 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" />
<el-table-column label="所属科室id" align="center" prop="departmentId" /> -->
<!-- <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>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改标准科室对照信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="110px" :inline="true">
<!-- <el-form-item label="所属科室id" prop="departmentId">
<el-input v-model="form.departmentId" placeholder="请输入所属科室id" />
</el-form-item> -->
<el-form-item label="所属科室" prop="departmentId">
<el-button
type=""
v-if="form.departmentName == '请选择科室'"
@click="clickinnerVisible()"
style="
width: 208px;
text-align: left;
height: 36px;
color: #c0c4cc;
overflow: hidden;
"
>{{ form.departmentName }}</el-button
>
<el-button
@click="clickinnerVisible()"
type=""
v-else
style="
width: 208px;
text-align: left;
height: 36px;
padding-left: -10px;
overflow: hidden;
"
>{{ form.departmentName }}</el-button
>
</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">
<el-input v-model="form.normCompareName" maxlength="100" placeholder="请输入标准对照名称" />
</el-form-item>
<el-form-item label="标准对照编码" prop="normCompareCode">
<el-input v-model="form.normCompareCode" maxlength="20" placeholder="请输入标准对照编码" onKeyUp="value=value.replace(/[\W]/g,'')" />
</el-form-item>
<el-form-item label="标准对照排序" prop="normCompareSort">
<el-input-number
v-model="form.normCompareSort"
controls-position="right"
:min="0"
placeholder="请输入标准对照排序"
/>
<!-- <el-input v-model="form.normCompareSort" maxlength="8" placeholder="请输入标准对照排序" /> -->
</el-form-item>
<el-form-item label="标准对照概述" prop="normCompareRemark">
<el-input v-model="form.normCompareRemark" maxlength="100" placeholder="请输入标准对照概述" />
</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>
<!-- 科室弹框 -->
<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"
>
<el-form-item label="科室名称" prop="departmentName" label-width="120">
<el-input
v-model="informationqueryParams.departmentName"
placeholder="请输入科室名称"
clearable
/>
</el-form-item>
<el-form-item>
<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
>
</el-form-item>
</el-form>
<el-table
:data="infolist"
@cell-dblclick="nurseclick"
v-loading="loading"
>
<el-table-column label="请选择" width="100" align="center">
<template slot-scope="scope">
<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>
</template>
</el-table-column>
<el-table-column
property="departmentName"
label="科室名称"
align="center"
:show-overflow-tooltip="true"
>
</el-table-column>
</el-table>
<pagination
v-show="totaldepartment > 0"
:total="totaldepartment"
:page.sync="informationqueryParams.pageNum"
:limit.sync="informationqueryParams.pageSize"
@pagination="informationInfoinfo"
/>
</el-dialog>
</div>
</template>
<script>
import { listCompare, getCompare, delCompare, addCompare, updateCompare } from "@/api/system/compare";
import { department } from "@/api/manage/script";
export default {
name: "Compare",
data() {
return {
totaldepartment:0,
infolist:[],
// 遮罩层
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: {},
// 科室
informationqueryParams: {
pageNum: 1,
pageSize: 10,
departmentName: null,
},
innerVisibleshow:false,
// 表单校验
rules: {
departmentId:[
{ required: true, message: "所属科室不能为空", trigger: "blur" },
],
normCompareName:[
{ required: true, message: "标准对照名称不能为空", trigger: "blur" },
]
}
};
},
created() {
this.getList();
},
methods: {
// 科室名称重置
addresetQuerylist() {
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) {
this.informationqueryParams.departmentId = this.itemname;
// } else {
this.informationqueryParams.departmentId = null;
// }
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,
normCompareSort: undefined,
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)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.form.departmentName = "请选择科室"
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;
this.$modal.confirm('是否确认删除标准科室对照信息编号为"' + ids + '"的数据项?').then(function() {
return delCompare(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/compare/export', {
...this.queryParams
}, `标准科室对照信息_${new Date().getTime()}.xlsx`)
}
}
};
</script>