postdischarge-ui/src/views/system/department/index.vue
2024-11-29 16:53:13 +08:00

1170 lines
35 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="app-container" ref="layout">
<el-row :gutter="20">
<el-col :span="5" :xs="24">
<!-- <div class="head-container">
<el-input
v-model="goodsCategoryName"
placeholder="请输入区域名称"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</div>-->
<div class="head-container">
<el-tree
:data="deptOptions"
:props="defaultProps"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
highlight-current
@node-click="handleNodeClick"
/>
</div>
</el-col>
<el-col :span="19" :xs="24">
<div ref="topform" class="form">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="科室名称" prop="departmentName">
<el-input
maxlength="100"
v-model="queryParams.departmentName"
placeholder="请输入科室名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="科室代码" prop="departmentCode">
<el-input
maxlength="30"
v-model="queryParams.departmentCode"
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>
</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:department: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:department: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:department:remove']"
>删除</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-upload2"
size="mini"
@click="handleImport"
v-hasPermi="['system:person:importStationPerson']"
>导入</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:department: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="departmentList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column
label="科室名称"
align="center"
prop="departmentName"
/>
<el-table-column
label="科室代码"
align="center"
prop="departmentCode"
:show-overflow-tooltip="true"
/>
<el-table-column
label="科室类型"
align="center"
prop="departmentType"
>
<template slot-scope="scope">
{{
scope.row.departmentType == "ADMINISTRATION_LOGISTICS"
? "行政后勤类"
: ""
}}
{{
scope.row.departmentType == "MEDICAL_ASSISTANCE"
? "医疗辅助类"
: ""
}}
{{
scope.row.departmentType == "MEDICAL_TECHNOLOGY"
? "医疗技术类"
: ""
}}
{{
scope.row.departmentType == "CLINICAL_SERVICES"
? "临床服务类"
: ""
}}
</template>
</el-table-column>
<el-table-column
label="提供服务类别"
align="center"
prop="provideServiceCategory"
>
<template slot-scope="scope"
>{{
scope.row.provideServiceCategory == "OUTPATIENT_SERVICE"
? "门诊"
: ""
}}
{{
scope.row.provideServiceCategory == "EMERGENCY_TREATMENT"
? "急诊"
: ""
}}
{{
scope.row.provideServiceCategory == "BE_HOSPITALIZED"
? "住院"
: ""
}}
{{ scope.row.provideServiceCategory == "WARD" ? "病区" : "" }}
{{
scope.row.provideServiceCategory == "MEDICAL_TECHNOLOGY"
? "医技"
: ""
}}
{{ scope.row.provideServiceCategory == "DRUG" ? "药剂" : "" }}
{{
scope.row.provideServiceCategory == "FINANCE" ? "财务" : ""
}}
{{
scope.row.provideServiceCategory == "ADMINISTRATION"
? "行政"
: ""
}}
{{
scope.row.provideServiceCategory == "PHARMACY" ? "药房" : ""
}}
{{
scope.row.provideServiceCategory == "DRUG_STORAGE"
? "药库"
: ""
}}
{{
scope.row.provideServiceCategory == "PUBLIC_HEALTH"
? "公卫"
: ""
}}
</template></el-table-column
>
<el-table-column
label="科室电话"
align="center"
prop="departmentPhone"
/>
<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:department:edit']"
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:department: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" /> -->
<myPagination
v-show="total > 0"
:total="total"
:pageSize="queryParams.pageSize"
:indexFromWrap="queryParams.pageNum"
@updateCPage="updateCPage"
></myPagination>
</el-col>
</el-row>
<!-- 导入 -->
<el-dialog
:title="upload.title"
:visible.sync="upload.open"
width="400px"
append-to-body
>
<el-upload
ref="upload"
:limit="1"
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">
将文件拖到此处,或
<em>点击上传</em>
</div>
<div class="el-upload__tip text-center" slot="tip">
<span>仅允许导入xls、xlsx格式文件。</span>
<el-link
type="primary"
:underline="false"
style="font-size: 12px; vertical-align: baseline"
@click="importTemplate"
>下载模板</el-link
>
</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm">确 定</el-button>
<el-button @click="upload.open = false">取 消</el-button>
</div>
</el-dialog>
<!-- 添加或修改科室信息对话框 -->
<el-dialog
:title="title"
:visible.sync="open"
width="1000px"
append-to-body
>
<el-form
ref="form"
:model="form"
:rules="rules"
label-width="120px"
:inline="true"
>
<!-- <el-form-item label="上级科室id" prop="parentDepartmentId">
<el-input
v-model="form.parentDepartmentId"
placeholder="请输入上级科室id"
/>
</el-form-item>
<el-form-item label="所属机构id" prop="hospitalAgencyId">
<el-input v-model="form.hospitalAgencyId" placeholder="请输入所属机构id" />
</el-form-item>
<el-form-item label="所属机构名称" prop="agencyName">
<el-input
v-model="form.agencyName"
placeholder="请输入所属机构名称"
/>
</el-form-item> -->
<div class="nameinformation">基本信息</div>
<div class="content">
<el-form-item label="科室名称" prop="departmentName">
<el-input
maxlength="100"
v-model="form.departmentName"
placeholder="请输入科室名称"
/>
</el-form-item>
<el-form-item label="科室代码" prop="departmentCode">
<el-input
maxlength="30"
onKeyUp="value=value.replace(/[\W]/g,'')"
v-model="form.departmentCode"
placeholder="请输入科室代码"
/>
</el-form-item>
<el-form-item label="科室简称" prop="departmentAbbreviation">
<el-input
maxlength="100"
v-model="form.departmentAbbreviation"
placeholder="请输入科室简称"
/>
</el-form-item>
<el-form-item label="科室类型" prop="departmentType">
<el-select
v-model="form.departmentType"
placeholder="请选择"
style="width: 205px"
clearable=""
>
<el-option
v-for="item in departmentoptions"
:key="item.dictValue"
:label="item.dictLabel"
:value="item.dictValue"
>
</el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="科室负责人id" prop="departmentPersonId">
<el-input
v-model="form.departmentPersonId"
placeholder="请输入科室负责人id"
/>
</el-form-item> -->
<el-form-item label="科室负责人姓名" prop="departmentPersonName">
<el-input
maxlength="20"
v-model="form.departmentPersonName"
placeholder="请输入科室负责人姓名"
/>
</el-form-item>
<el-form-item label="节点类型" prop="nodeType">
<el-select
v-model="form.nodeType"
placeholder="请选择"
style="width: 205px"
clearable
>
<el-option
v-for="item in nodeTypeoptions"
:key="item.dictValue"
:label="item.dictLabel"
:value="item.dictValue"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="所属机构" prop="hospitalAgencyName">
<el-cascader
clearable
:props="{ checkStrictly: true }"
:options="treeOptions"
@change="change"
style="width: 205px; color: black"
v-model="form.hospitalAgencyIdtwo"
:show-all-levels="false"
:placeholder="
form.hospitalAgencyName ? form.hospitalAgencyName : ''
"
ref="cascader"
:key="isResouceShow"
></el-cascader>
</el-form-item>
<el-form-item label="上级科室" prop="parentDepartmentId">
<el-select
v-model="form.parentDepartmentName"
placeholder="请选择"
style="width: 205px"
@change="changeparentDepartment"
clearable
>
<el-option
v-for="item in optionsparentDepartment"
:key="item.id"
:label="item.departmentName"
:value="item.id"
>
</el-option>
</el-select>
<!-- <el-cascader
:props="{ checkStrictly: true }"
:options="treeOptionsagencyCategoryId"
@change="changeagencyCategoryId($event)"
style="width: 205px"
:placeholder="
form.parentDepartmentName
? form.parentDepartmentName
: '请选择上级科室'
"
v-model="form.parentDepartmentId"
:show-all-levels="false"
ref="cascader"
:key="isResouceShows"
></el-cascader> -->
</el-form-item>
</div>
<div class="nameinformation">扩展信息</div>
<div class="content">
<el-form-item label="提供服务类别" prop="provideServiceCategory">
<el-select
clearable
v-model="form.provideServiceCategory"
placeholder="请选择"
style="width: 205px"
>
<el-option
v-for="item in options"
:key="item.dictValue"
:label="item.dictLabel"
:value="item.dictValue"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="细分类别" prop="subdivisionCategoryId">
<el-select
v-model="form.subdivisionCategoryName"
placeholder="请选择"
style="width: 205px"
clearable
@change="optionsubdivision"
>
<el-option
v-for="item in optionsubdivisionCategory"
:key="item.subdivisionCategoryCode"
:label="item.subdivisionCategoryName"
:value="item.subdivisionCategoryCode"
>
</el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="细分类别名称" prop="subdivisionCategoryName">
<el-input
v-model="form.subdivisionCategoryName"
placeholder="请输入细分类别名称"
/>
</el-form-item> -->
<el-form-item label="标准科室对照" prop="normDepartmentCompareId">
<el-select
v-model="form.normDepartmentCompareId"
placeholder="请选择"
style="width: 205px"
clearable
>
<el-option
v-for="item in compareList"
:key="item.departmentId"
:label="item.departmentName"
:value="item.departmentId"
>
</el-option>
</el-select>
<!-- <el-input
v-model="form.normDepartmentCompareId"
placeholder="请输入标准科室对照id"
/> -->
</el-form-item>
<!-- <el-form-item label="标准科室对照名称" prop="normDepartmentCompareName">
<el-input
v-model="form.normDepartmentCompareName"
placeholder="请输入标准科室对照名称"
/>
</el-form-item> -->
<el-form-item label="编制床位数" prop="prepareBedsCount">
<el-input
maxlength="8"
onKeyUp="value=value.replace(/[\W]/g,'')"
v-model="form.prepareBedsCount"
placeholder="请输入编制床位数"
/>
</el-form-item>
<el-form-item label="科室电话" prop="departmentPhone">
<el-input
maxlength="12"
onKeyUp="value=value.replace(/[\W]/g,'')"
v-model="form.departmentPhone"
placeholder="请输入科室电话"
/>
</el-form-item>
<el-form-item label="科室邮箱" prop="departmentMail">
<el-input
maxlength="20"
v-model="form.departmentMail"
placeholder="请输入科室邮箱"
/>
</el-form-item>
<el-form-item label="成立日期" prop="establishDate">
<el-date-picker
clearable
v-model="form.establishDate"
type="date"
style="width: 205px"
value-format="yyyy-MM-dd"
placeholder="请选择成立日期"
>
</el-date-picker>
</el-form-item>
<el-form-item label="撤销日期" prop="revokeDate">
<el-date-picker
clearable
v-model="form.revokeDate"
type="date"
style="width: 205px"
value-format="yyyy-MM-dd"
placeholder="请选择撤销日期"
>
</el-date-picker>
</el-form-item>
</div>
</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>
</div>
</template>
<script>
import {
listDepartment,
getDepartment,
delDepartment,
addDepartment,
updateDepartment,
getDepartmentList,
} from "@/api/system/department";
import { agencyList, getAgencytype } from "@/api/system/agency";
import { getToken } from "@/utils/auth";
import { listSubdivision } from "@/api/system/subdivision";
import { listCompare } from "@/api/system/compare";
export default {
name: "Department",
data() {
return {
optionsparentDepartment: [],
queryParamscompare: {
pageNum: 1,
pageSize: 10,
departmentId: null,
departmentName: null,
normCompareName: null,
normCompareCode: null,
normCompareSort: null,
normCompareRemark: null,
},
// 细分
optionsubdivisionCategory: [],
// 标准科室对照4
compareList: [],
option: [],
nodeTypeoptions: [],
treeOptions: [],
treeOptionsagencyCategoryId: [],
departmentoptions: [],
options: [
// {
// value: "PUBLIC_HEALTH",
// label: "公卫",
// },
// {
// value: "DRUG_STORAGE",
// label: "药库",
// },
// {
// value: "ADMINISTRATION",
// label: "行政",
// },
// {
// value: "PHARMACY",
// label: "药房",
// },
// {
// value: "FINANCE",
// label: "财务",
// },
// {
// value: "DRUG",
// label: "药剂",
// },
// {
// value: "WARD",
// label: "病区",
// },
// {
// value: "BE_HOSPITALIZED",
// label: "住院",
// },
// {
// value: "EMERGENCY_TREATMENT",
// label: "急诊",
// },
],
deptOptions: undefined,
defaultProps: {
children: "children",
label: "label",
},
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 科室信息表格数据
departmentList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
parentDepartmentId: null,
hospitalAgencyId: null,
hospitalAgencyName: null,
departmentName: null,
departmentCode: null,
departmentType: null,
departmentAbbreviation: null,
departmentPersonId: null,
departmentPersonName: null,
nodeType: null,
provideServiceCategory: null,
subdivisionCategoryId: null,
subdivisionCategoryName: null,
normDepartmentCompareId: null,
normDepartmentCompareName: null,
prepareBedsCount: null,
departmentPhone: null,
departmentMail: null,
establishDate: null,
revokeDate: null,
},
// 表单参数
form: {},
// 用户导入参数
upload: {
// 是否显示弹出层(用户导入)
open: false,
// 弹出层标题(用户导入)
title: "",
// 是否禁用上传
isUploading: false,
// 设置上传的请求头部
headers: { Authorization: "Bearer " + getToken() },
// 上传的地址
url:
process.env.VUE_APP_BASE_API +
"/system/department/insertDepartmentList",
},
isResouceShow: 1,
isResouceShows: 1,
maxTableHeight: undefined,
id: "",
// 表单校验
rules: {
nodeType: [
{ required: true, message: "节点类型不能为空", trigger: "blur" },
],
hospitalAgencyName: [
{ required: true, message: "所属机构不能为空", trigger: "blur" },
],
departmentName: [
{ required: true, message: "科室名称不能为空", trigger: "blur" },
],
departmentCode: [
{ required: true, message: "科室代码不能为空", trigger: "blur" },
],
departmentPhone: [
{
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
message: "请输入正确的科室电话",
trigger: "blur",
},
],
departmentMail: [
{
type: "email",
message: "请输入正确的邮箱地址",
trigger: ["blur", "change"],
},
],
},
};
},
// 默认选中第一行
watch: {
deptOptions: {
handler(val) {
if (val) {
this.$nextTick(() => {
document.querySelector(".el-tree-node__content").click();
});
}
},
immediate: true,
},
},
mounted() {
this.getMaxTableHeight()
this.screenChange()
},
created() {
this.getList();
this.gettreelist();
this.info();
this.infolist();
this.getinfo();
this.getinfolist();
this.infodepartment();
this.infocompare();
},
methods: {
updateCPage(index, size) {
this.queryParams.pageNum = index
this.queryParams.pageSize = size
this.getList();
},
optionsubdivision(e) {
// this.form.subdivisionCategoryId = this.optionsubdivisionCategory.find(
// (e) => e.id == this.form.subdivisionCategoryId
// ).subdivisionCategoryName;
// console.log(this.form.subdivisionCategoryName)
},
// 上级科室
changeparentDepartment(e) {
this.form.parentDepartmentId = e;
},
/** 查询标准科室对照信息列表 */
infocompare() {
this.loading = true;
listCompare(this.queryParamscompare).then((response) => {
this.compareList = response.rows;
// this.total = response.total;
this.loading = false;
});
},
// 细分类别
getinfolist() {
listSubdivision().then((res) => {
this.optionsubdivisionCategory = res.rows;
});
},
// 上级科室
getinfo() {
getDepartmentList().then((res) => {
this.optionsparentDepartment = res.data;
});
},
// 节点类型
info() {
var dictType = "department_node_type";
getAgencytype(dictType).then((res) => {
this.nodeTypeoptions = res.data;
});
},
// 科室类型
infodepartment() {
var dictType = "department_type";
getAgencytype(dictType).then((res) => {
this.departmentoptions = res.data;
});
},
// 服务类别
infolist() {
var dictType = "provide_service_category";
getAgencytype(dictType).then((res) => {
this.options = res.data;
});
},
// 所属机构
change(e) {
if (e) {
this.form.hospitalAgencyId = e[e.length - 1];
if (this.form.hospitalAgencyId) {
const arr = this.$refs["cascader"].getCheckedNodes()[0].pathLabels;
this.form.hospitalAgencyName = arr.slice(-1).join(",");
this.gethaveinfo(e[e.length - 1])
this.form.parentDepartmentId = ''
this.form.parentDepartmentName = ''
} else {
this.form.parentDepartmentId = ''
this.form.hospitalAgencyName = "";
}
} else {
this.getinfo();
}
},
gethaveinfo(id) {
getDepartmentList({ hospitalAgencyId: id }).then((res) => {
this.optionsparentDepartment = res.data;
});
},
// changeagencyCategoryId(e) {
// this.form.parentDepartmentId = e[e.length - 1];
// },
// gettreelistitem() {
// agencyCategoryList().then((res) => {
// // 接口请求
// this.treeOptionsagencyCategoryId = res.data.map((item) => {
// return { value: item.id, ...item };
// });
// });
// },
// 所属机构
gettreelist() {
agencyList().then((res) => {
// 接口请求
this.deptOptions = res.data;
this.treeOptions = res.data.map((item) => {
return { value: item.id, ...item };
});
});
},
/** 导入按钮操作 */
handleImport() {
this.upload.open = true;
this.upload.title = "科室导入";
},
/** 下载模板操作 */
importTemplate() {
this.download(
"/system/importDownload/downloadTemplate?fileType=department",
{},
`科室下载模板.xlsx`
);
},
// 提交上传文件
submitFileForm() {
this.$refs.upload.submit();
},
// 文件上传成功处理
handleFileSuccess(response, file, fileList) {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert(
"<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
response.msg +
"</div>",
"导入结果",
{ dangerouslyUseHTMLString: true }
);
this.getList();
this.gettreelist();
},
// 文件上传中处理
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
// 筛选节点
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
// 节点单击事件
handleNodeClick(data) {
console.log(data, "5");
this.queryParams.hospitalAgencyId = data.id;
this.getList();
},
/** 查询科室信息列表 */
getList() {
this.loading = true;
listDepartment(this.queryParams).then((response) => {
this.departmentList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
parentDepartmentId: null,
hospitalAgencyId: null,
hospitalAgencyIdtwo: null,
hospitalAgencyName: null,
departmentName: null,
departmentCode: null,
departmentType: null,
departmentAbbreviation: null,
departmentPersonId: null,
departmentPersonName: null,
nodeType: null,
provideServiceCategory: null,
subdivisionCategoryId: null,
subdivisionCategoryName: null,
normDepartmentCompareId: null,
normDepartmentCompareName: null,
prepareBedsCount: null,
departmentPhone: null,
departmentMail: null,
establishDate: null,
revokeDate: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
parentDepartmentName: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;
},
getLeafIds(nodes) {
console.log(nodes, ';node')
this.form.hospitalAgencyIdtwo = JSON.parse(localStorage.getItem('user')).hospitalAgencyId;
let leafIds = [];
nodes.forEach(node => {
if (node.id == this.form.hospitalAgencyIdtwo) {
this.form.hospitalAgencyName = node.label;
} else {
if (node.children) {
// 如果有子节点递归调用getLeafIds
leafIds = leafIds.concat(this.getLeafIds(node.children));
} else {
// 如果没有子节点取当前节点的id
leafIds.push(node.id);
}
}
});
return leafIds;
},
/** 新增按钮操作 */
handleAdd() {
this.getinfo()
this.reset();
this.open = true;
this.title = "添加科室信息";
if (localStorage.getItem('roleKey') != 'admin') {
this.getLeafIds(this.treeOptions)
}
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
getDepartment(id).then((response) => {
this.form = response.data;
this.form.hospitalAgencyIdtwo = this.form.hospitalAgencyId
this.form.parentDepartmentName = response.data.parentDepartmentName;
this.open = true;
this.gethaveinfo(this.form.hospitalAgencyId)
this.title = "修改科室信息";
});
},
/** 提交按钮 */
submitForm() {
let reg = new RegExp("-", "g");
if (this.form.establishDate && this.form.revokeDate && new Date(this.form.establishDate.replace(reg, "/")) >
new Date(this.form.revokeDate.replace(reg, "/"))) {
this.$message.error("撤销日期要大于成立日期");
}
else {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.id != null) {
updateDepartment(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
if (!this.form.hospitalAgencyId) {
this.form.hospitalAgencyId = this.form.hospitalAgencyIdtwo
}
addDepartment(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 delDepartment(ids);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => { });
},
/** 导出按钮操作 */
handleExport() {
this.download(
"system/department/export",
{
...this.queryParams,
},
`科室信息_${new Date().getTime()}.xlsx`
);
},
// 获取表格最高高度
getMaxTableHeight() {
const windowInnerHeight = window.innerHeight // 屏幕可视高度
const layoutDiv = this.$refs.layout
const formDiv = this.$refs.topform
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)
})
},
},
};
</script>
<style lang="scss">
.el-cascader .el-input input::-webkit-input-placeholder {
color: black;
}
.nameinformation {
border-left: 3px solid #4d9de7;
width: 200px;
height: 20px;
padding-left: 10px;
font-size: 18px;
// margin-top: 8px;
color: black;
}
.content {
margin: 22px;
}
</style>
<style lang="scss" scoped>
.el-cascader .el-input input::-webkit-input-placeholder {
color: #686a6d;
}
.app-container {
padding: 20px 0 0 20px !important;
}
::v-deep .el-row {
height: 100% !important;
}
.head-container {
height: calc(100vh - 119px);
overflow-y: auto;
}
</style>