<template>
|
<div class="app-container">
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="88px">
|
<el-form-item label="医院名称" prop="hospName">
|
<el-input
|
v-model="queryParams.hospName"
|
placeholder="请输入医院名称"
|
clearable
|
@keyup.enter.native="handleQuery"
|
/>
|
</el-form-item>
|
<el-form-item label="省份" prop="hopsProvince">
|
<el-input
|
v-model="queryParams.hopsProvince"
|
placeholder="请输入省份"
|
clearable
|
@keyup.enter.native="handleQuery"
|
/>
|
</el-form-item>
|
<el-form-item label="城市" prop="hopsCity">
|
<el-input
|
v-model="queryParams.hopsCity"
|
placeholder="请输入城市"
|
clearable
|
@keyup.enter.native="handleQuery"
|
/>
|
</el-form-item>
|
<el-form-item label="区域" prop="hopsArea">
|
<el-input
|
v-model="queryParams.hopsArea"
|
placeholder="请输入区域"
|
clearable
|
@keyup.enter.native="handleQuery"
|
/>
|
</el-form-item>
|
<el-form-item label="状态" prop="status">
|
<el-select v-model="queryParams.status" placeholder="医院状态" clearable>
|
<el-option
|
v-for="dict in dict.type.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="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:hosp: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:hosp: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:hosp: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:hosp:export']"
|
>导出</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button
|
type="info"
|
plain
|
icon="el-icon-refresh"
|
size="mini"
|
@click="handleSync"
|
v-hasPermi="['system:hosp:sync']"
|
:loading="syncing"
|
>同步数据</el-button>
|
</el-col>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
</el-row>
|
|
<el-table v-loading="loading" :data="hospList" @selection-change="handleSelectionChange">
|
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column label="医院ID" align="center" prop="hospId" width="80" />
|
<el-table-column label="旧系统ID" align="center" prop="legacyHospId" width="100" />
|
<el-table-column label="医院名称" align="center" prop="hospName" :show-overflow-tooltip="true" min-width="180" />
|
<el-table-column label="医院简称" align="center" prop="hospShort" :show-overflow-tooltip="true" width="120" />
|
<el-table-column label="省份" align="center" prop="hopsProvince" width="100" />
|
<el-table-column label="城市" align="center" prop="hopsCity" width="100" />
|
<el-table-column label="区域" align="center" prop="hopsArea" width="100" />
|
<el-table-column label="医院地址" align="center" prop="hospAddress" :show-overflow-tooltip="true" min-width="200" />
|
<el-table-column label="联系电话" align="center" prop="hospTel" width="120" />
|
<el-table-column label="状态" align="center" prop="status" width="80">
|
<template slot-scope="scope">
|
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
</template>
|
</el-table-column>
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180">
|
<template slot-scope="scope">
|
<el-button
|
size="mini"
|
type="text"
|
icon="el-icon-edit"
|
@click="handleUpdate(scope.row)"
|
v-hasPermi="['system:hosp:edit']"
|
>修改</el-button>
|
<el-button
|
size="mini"
|
type="text"
|
icon="el-icon-delete"
|
@click="handleDelete(scope.row)"
|
v-hasPermi="['system:hosp: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="800px" append-to-body>
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="医院名称" prop="hospName">
|
<el-input v-model="form.hospName" placeholder="请输入医院名称" />
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="医院简称" prop="hospShort">
|
<el-input v-model="form.hospShort" placeholder="请输入医院简称" />
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="8">
|
<el-form-item label="省份" prop="hopsProvince">
|
<el-input v-model="form.hopsProvince" placeholder="请输入省份" />
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="城市" prop="hopsCity">
|
<el-input v-model="form.hopsCity" placeholder="请输入城市" />
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="区域" prop="hopsArea">
|
<el-input v-model="form.hopsArea" placeholder="请输入区域" />
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="24">
|
<el-form-item label="医院地址" prop="hospAddress">
|
<el-input v-model="form.hospAddress" placeholder="请输入医院地址" />
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="联系电话" prop="hospTel">
|
<el-input v-model="form.hospTel" placeholder="请输入联系电话" />
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="医院级别" prop="hospLevel">
|
<el-input-number v-model="form.hospLevel" :min="0" :max="5" placeholder="请输入医院级别" />
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="旧系统ID" prop="legacyHospId">
|
<el-input-number v-model="form.legacyHospId" :disabled="form.hospId != undefined" placeholder="旧系统医院ID" />
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="状态" prop="status">
|
<el-radio-group v-model="form.status">
|
<el-radio
|
v-for="dict in dict.type.sys_normal_disable"
|
:key="dict.value"
|
:label="dict.value"
|
>{{dict.label}}</el-radio>
|
</el-radio-group>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="24">
|
<el-form-item label="备注" prop="remark">
|
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</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 { listHosp, getHosp, delHosp, addHosp, updateHosp, syncHosp } from "@/api/system/hosp";
|
|
export default {
|
name: "Hosp",
|
dicts: ['sys_normal_disable'],
|
data() {
|
return {
|
// 遮罩层
|
loading: true,
|
// 同步加载状态
|
syncing: false,
|
// 选中数组
|
ids: [],
|
// 非单个禁用
|
single: true,
|
// 非多个禁用
|
multiple: true,
|
// 显示搜索条件
|
showSearch: true,
|
// 总条数
|
total: 0,
|
// 医院数据表格数据
|
hospList: [],
|
// 弹出层标题
|
title: "",
|
// 是否显示弹出层
|
open: false,
|
// 查询参数
|
queryParams: {
|
pageNum: 1,
|
pageSize: 10,
|
hospName: null,
|
hopsProvince: null,
|
hopsCity: null,
|
hopsArea: null,
|
status: null
|
},
|
// 表单参数
|
form: {},
|
// 表单校验
|
rules: {
|
hospName: [
|
{ required: true, message: "医院名称不能为空", trigger: "blur" }
|
]
|
}
|
};
|
},
|
created() {
|
this.getList();
|
},
|
methods: {
|
/** 查询医院数据列表 */
|
getList() {
|
this.loading = true;
|
listHosp(this.queryParams).then(response => {
|
this.hospList = response.rows;
|
this.total = response.total;
|
this.loading = false;
|
});
|
},
|
// 取消按钮
|
cancel() {
|
this.open = false;
|
this.reset();
|
},
|
// 表单重置
|
reset() {
|
this.form = {
|
hospId: null,
|
legacyHospId: null,
|
hospName: null,
|
hospCityId: null,
|
hospShort: null,
|
hopsProvince: null,
|
hopsCity: null,
|
hopsArea: null,
|
hospAddress: null,
|
hospTel: null,
|
hospUnitId: null,
|
hospState: null,
|
hospOaId: null,
|
hospIntroducerId: null,
|
hospIntroducerDate: null,
|
hospLevel: null,
|
status: "0",
|
remark: 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.hospId)
|
this.single = selection.length !== 1
|
this.multiple = !selection.length
|
},
|
/** 新增按钮操作 */
|
handleAdd() {
|
this.reset();
|
this.open = true;
|
this.title = "添加医院数据";
|
},
|
/** 修改按钮操作 */
|
handleUpdate(row) {
|
this.reset();
|
const hospId = row.hospId || this.ids
|
getHosp(hospId).then(response => {
|
this.form = response.data;
|
this.open = true;
|
this.title = "修改医院数据";
|
});
|
},
|
/** 提交按钮 */
|
submitForm() {
|
this.$refs["form"].validate(valid => {
|
if (valid) {
|
if (this.form.hospId != null) {
|
updateHosp(this.form).then(response => {
|
this.$modal.msgSuccess("修改成功");
|
this.open = false;
|
this.getList();
|
});
|
} else {
|
addHosp(this.form).then(response => {
|
this.$modal.msgSuccess("新增成功");
|
this.open = false;
|
this.getList();
|
});
|
}
|
}
|
});
|
},
|
/** 删除按钮操作 */
|
handleDelete(row) {
|
const hospIds = row.hospId || this.ids;
|
this.$modal.confirm('是否确认删除医院数据编号为"' + hospIds + '"的数据项?').then(function() {
|
return delHosp(hospIds);
|
}).then(() => {
|
this.getList();
|
this.$modal.msgSuccess("删除成功");
|
}).catch(() => {});
|
},
|
/** 导出按钮操作 */
|
handleExport() {
|
this.download('system/hosp/export', {
|
...this.queryParams
|
}, `hosp_${new Date().getTime()}.xlsx`)
|
},
|
/** 同步数据按钮操作 */
|
handleSync() {
|
this.$modal.confirm('是否确认从SQL Server同步医院数据?此操作可能需要较长时间。').then(() => {
|
this.syncing = true;
|
return syncHosp();
|
}).then(response => {
|
this.syncing = false;
|
this.$modal.msgSuccess("同步完成:" + response.msg);
|
this.getList();
|
}).catch(() => {
|
this.syncing = false;
|
});
|
}
|
}
|
};
|
</script>
|