588 lines
20 KiB
JavaScript
588 lines
20 KiB
JavaScript
import {
|
|
listPerson,
|
|
getPerson,
|
|
delPerson,
|
|
addPerson,
|
|
updatePerson,
|
|
stationList,
|
|
StationDepartmentList,
|
|
} from "@/api/system/person";
|
|
import { getToken } from "@/utils/auth";
|
|
import { getListByUser } from "@/api/system/userlist.js";
|
|
|
|
export default {
|
|
name: "Person",
|
|
data() {
|
|
// 验证手机号的规则
|
|
var checkMobile = (rule, value, cb) => {
|
|
// 验证手机号的正则表达式
|
|
const regMobile =
|
|
/^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57]|19[0-9])[0-9]{8}$/;
|
|
if (regMobile.test(value)) {
|
|
return cb();
|
|
}
|
|
cb(new Error("请输入正确的联系电话"));
|
|
};
|
|
// 验证手机号的规则
|
|
var checkMobile2 = (rule, value, cb) => {
|
|
// 验证手机号的正则表达式
|
|
const regMobile =
|
|
/^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57]|19[0-9])[0-9]{8}$/;
|
|
if (regMobile.test(value)) {
|
|
return cb();
|
|
}
|
|
cb(new Error("请输入正确的联系电话"));
|
|
};
|
|
return {
|
|
//男女选择
|
|
sexs: [{
|
|
label: "男",
|
|
value: "MALE",
|
|
},
|
|
{
|
|
label: "女",
|
|
value: "FEMALE",
|
|
},
|
|
],
|
|
nursePersonTypes: [{
|
|
label: "护士",
|
|
value: "NURSE",
|
|
},
|
|
{
|
|
label: "护理师",
|
|
value: "NURSE_TEACHER",
|
|
},
|
|
],
|
|
|
|
innerVisible: false,
|
|
innerVisible2: false,
|
|
innerVisiblexg: false,
|
|
innerVisiblexg2: false,
|
|
|
|
// 遮罩层
|
|
loading: true,
|
|
|
|
// 用户导入参数
|
|
upload: {
|
|
// 是否显示弹出层(用户导入)
|
|
open: false,
|
|
// 弹出层标题(用户导入)
|
|
title: "",
|
|
// 是否禁用上传
|
|
isUploading: false,
|
|
// 设置上传的请求头部
|
|
headers: { Authorization: "Bearer " + getToken() },
|
|
// 上传的地址
|
|
url: process.env.VUE_APP_BASE_API +
|
|
"/system/person/insertNurseStationPersonImportList",
|
|
},
|
|
// 选中数组
|
|
ids: [],
|
|
// 非单个禁用
|
|
single: true,
|
|
// 非多个禁用
|
|
multiple: true,
|
|
// 显示搜索条件
|
|
showSearch: true,
|
|
// 总条数
|
|
total: 0,
|
|
departtotal: 0,
|
|
nursetotal: 0,
|
|
// 护理站人员信息表格数据
|
|
nurseStationPersonList: [],
|
|
// 护理站名称
|
|
stationLists: [],
|
|
// 所属科室
|
|
StationDepartmentLists: [],
|
|
nurseStationlist: [],
|
|
stationid: "",
|
|
stationid2: "",
|
|
departid: "",
|
|
nurseStationName: "请选择所属护理站",
|
|
departmentName: "请选择所属科室",
|
|
// 弹出层标题
|
|
title: "",
|
|
title2: "",
|
|
title3: "",
|
|
// 修改弹出层
|
|
open: false,
|
|
// 添加弹出层
|
|
open2: false,
|
|
//权限查询
|
|
// 查询参数
|
|
queryParams: {
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
nurseStationId: null,
|
|
departmentCode: null,
|
|
userId: null,
|
|
departmentName: null,
|
|
nursePersonCode: null,
|
|
nursePersonName: null,
|
|
nursePersonType: null,
|
|
nurseStationName: null,
|
|
phone: null,
|
|
address: null,
|
|
},
|
|
queryParams2: {
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
nurseStationName: null,
|
|
departmentName: null,
|
|
id: null,
|
|
nurseStationId: null,
|
|
},
|
|
|
|
queryParams3: {
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
nurseStationName: null,
|
|
id: null,
|
|
departmentCode: null,
|
|
departmentName: null,
|
|
nurseStationId: null,
|
|
},
|
|
nurseStationqueryParams: {
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
},
|
|
StationqueryParams: {
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
},
|
|
|
|
// 表单参数
|
|
form: {},
|
|
index: "",
|
|
// 表单校验
|
|
rules: {
|
|
nurseStationId: [
|
|
{ required: true, message: "请选择所属护理站", trigger: "blur" },
|
|
],
|
|
departmentName: [
|
|
{ required: true, message: "所属科室不能为空", trigger: "blur" },
|
|
],
|
|
nursePersonName: [
|
|
{ required: true, message: "护理人姓名不能为空", trigger: "blur" },
|
|
],
|
|
nursePersonType: [
|
|
{ required: true, message: "护理人职称不能为空", trigger: "blur" },
|
|
],
|
|
sex: [{ required: true, message: "性别不能为空", trigger: "blur" }],
|
|
phone: [{
|
|
required: true,
|
|
validator: checkMobile2,
|
|
message: "",
|
|
trigger: "blur",
|
|
}, ],
|
|
address: [
|
|
{ required: true, message: "居住地址不能为空", trigger: "blur" },
|
|
],
|
|
nurseStationPersonList: {
|
|
nursePersonName: [{
|
|
required: true,
|
|
message: "请选择所属护理站",
|
|
trigger: "blur",
|
|
}, ],
|
|
departmentCode: [
|
|
{ required: true, message: "所属科室不能为空", trigger: "blur" },
|
|
],
|
|
nurseStationId: [
|
|
{ required: true, message: "请选择所属护理站", trigger: "blur" },
|
|
],
|
|
nursePersonName: [
|
|
{ required: true, message: "护理人姓名不能为空", trigger: "blur" },
|
|
],
|
|
nursePersonType: [
|
|
{ required: true, message: "护理人职称不能为空", trigger: "blur" },
|
|
],
|
|
sex: [{ required: true, message: "性别不能为空", trigger: "blur" }],
|
|
phone: [{
|
|
required: true,
|
|
validator: checkMobile,
|
|
message: "",
|
|
trigger: "blur",
|
|
}, ],
|
|
address: [
|
|
{ required: true, message: "居住地址不能为空", trigger: "blur" },
|
|
],
|
|
},
|
|
},
|
|
homenumber: null,
|
|
};
|
|
},
|
|
created() {
|
|
this.getList();
|
|
},
|
|
methods: {
|
|
// // 新增所属科室按钮
|
|
departclick(item, index) {
|
|
if (this.form.nurseStationId != null) {
|
|
this.getList3();
|
|
console.log(item);
|
|
this.departid = item.departmentCode;
|
|
this.innerVisible2 = true;
|
|
this.index = index;
|
|
|
|
} else {
|
|
// this.innerVisible2 = false;
|
|
this.$message.error('请先选择所属护理站');
|
|
}
|
|
|
|
},
|
|
// // 修改所属科室按钮
|
|
departclick2() {
|
|
if (this.form.nurseStationId != null) {
|
|
this.getList3();
|
|
this.departid2 = this.form.departmentCode;
|
|
this.innerVisiblexg2 = true;
|
|
|
|
} else {
|
|
// this.innerVisible2 = false;
|
|
this.$message.error('请先选择所属护理站');
|
|
}
|
|
},
|
|
//修改护理站按钮
|
|
departclickxg() {
|
|
this.info();
|
|
this.stationid2 = this.form.nurseStationId;
|
|
this.innerVisiblexg = true;
|
|
// this.index = index;
|
|
},
|
|
// 新增护理站按钮
|
|
clickinnerVisible(item, index) {
|
|
this.info();
|
|
this.stationid = item.nurseStationId;
|
|
this.innerVisible = true;
|
|
this.index = index;
|
|
},
|
|
// 修改护理站
|
|
nurseclick2(row) {
|
|
if (this.homenumber) {
|
|
this.queryParams.nurseStationName = row.nurseStationName;
|
|
this.queryParams.nurseStationId = row.id;
|
|
} else {
|
|
this.nurseStationName = row.nurseStationName;
|
|
this.stationid2 = row.id;
|
|
this.form.nurseStationId = row.id;
|
|
this.queryParams3.nurseStationId = row.id;
|
|
this.form.nursename = row.nurseStationName;
|
|
}
|
|
this.innerVisiblexg = false;
|
|
},
|
|
// 护理站名称
|
|
nurseclick(row) {
|
|
console.log(row);
|
|
this.nursename = row.nurseStationName;
|
|
this.stationid = row.id;
|
|
this.form.nurseStationId = row.id;
|
|
this.queryParams3.nurseStationId = row.id;
|
|
console.log(this.form.nurseStationId);
|
|
console.log(this.form);
|
|
this.innerVisible = false;
|
|
this.form.nursename = row.nurseStationName;
|
|
this.form.nurseStationPersonList[this.index].nurseStationName =
|
|
row.nurseStationName;
|
|
this.form.nurseStationPersonList[this.index].nurseStationId = row.id;
|
|
},
|
|
|
|
// 所属科室
|
|
StationDepartmentclick(row) {
|
|
console.log(row);
|
|
this.departname = row.departmentName;
|
|
this.departid = row.departmentCode;
|
|
console.log(this.departid);
|
|
this.departmentCode = row.departmentCode;
|
|
// this.form.nurseStationId = row.id;
|
|
this.innerVisible2 = false;
|
|
this.form.departname = row.departmentName;
|
|
this.form.nurseStationPersonList[this.index].departmentName =
|
|
row.departmentName;
|
|
this.form.nurseStationPersonList[this.index].departmentCode =
|
|
row.departmentCode;
|
|
console.log(this.form);
|
|
},
|
|
// 修改科室
|
|
StationDepartmentclick2(row) {
|
|
this.departmentName = row.departmentName;
|
|
this.form.departmentCode = row.departmentCode;
|
|
this.departid2 = row.departmentCode;
|
|
this.form.departmentName = row.id;
|
|
this.innerVisiblexg2 = false;
|
|
},
|
|
|
|
//主页面打开护理站列表
|
|
ParamsStation(item) {
|
|
this.info();
|
|
this.innerVisiblexg = true
|
|
this.title2 = '选择护理站'
|
|
this.homenumber = item
|
|
this.stationid2 = this.queryParams.nurseStationId;
|
|
},
|
|
|
|
//护理站列表
|
|
info() {
|
|
this.loading = true;
|
|
getListByUser(this.nurseStationqueryParams).then((res) => {
|
|
this.nurseStationlist = res.rows;
|
|
this.nursetotal = res.total;
|
|
this.loading = false;
|
|
});
|
|
},
|
|
/** 查询护理站人员信息列表 */
|
|
getList() {
|
|
// 护理站名称
|
|
this.loading = true;
|
|
listPerson(this.queryParams).then((response) => {
|
|
this.nurseStationPersonList = response.rows;
|
|
this.total = response.total;
|
|
this.loading = false;
|
|
});
|
|
},
|
|
getList3() {
|
|
this.loading = true;
|
|
StationDepartmentList(this.queryParams3).then((res) => {
|
|
this.StationDepartmentLists = res.rows;
|
|
this.departtotal = res.total;
|
|
this.loading = false;
|
|
});
|
|
},
|
|
// 取消按钮
|
|
cancel() {
|
|
this.open = false;
|
|
this.open2 = false;
|
|
this.nurseStationName = "请选择所属护理站";
|
|
this.departmentName = "请选择所属科室";
|
|
// this.upload.open=false;
|
|
this.reset();
|
|
},
|
|
// 表单重置
|
|
reset() {
|
|
this.form = {
|
|
id: null,
|
|
nurseStationId: null,
|
|
departmentCode: null,
|
|
userId: null,
|
|
nursePersonCode: null,
|
|
nursePersonName: null,
|
|
nursePersonType: null,
|
|
phone: null,
|
|
address: null,
|
|
createBy: null,
|
|
createTime: null,
|
|
updateBy: null,
|
|
updateTime: null,
|
|
nurseStationName: "请选择所属护理站",
|
|
departmentName: "请选择所属科室",
|
|
nurseStationPersonList: [{
|
|
id: "",
|
|
nurseStationId: "",
|
|
departmentCode: "",
|
|
nursePersonCode: "",
|
|
nursePersonName: "",
|
|
nursePersonType: "",
|
|
nurseStationName: "请选择所属护理站",
|
|
phone: "",
|
|
address: "",
|
|
sex: "",
|
|
departmentName: "请选择所属科室",
|
|
}, ],
|
|
};
|
|
this.resetForm("form");
|
|
},
|
|
/** 搜索按钮操作 */
|
|
handleQuery2() {
|
|
this.nurseStationqueryParams.pageNum = 1;
|
|
this.info();
|
|
},
|
|
// 修改护理站弹框的搜索
|
|
handleQuery4() {
|
|
this.nurseStationqueryParams.pageNum = 1;
|
|
this.info();
|
|
},
|
|
//修改所属科室
|
|
handleQuery3() {
|
|
this.queryParams3.pageNum = 1;
|
|
this.getList3();
|
|
},
|
|
handleQuery() {
|
|
this.queryParams.pageNum = 1;
|
|
this.getList();
|
|
},
|
|
/** 重置按钮操作 */
|
|
addcancel() {
|
|
this.innerVisible = false;
|
|
this.innerVisiblexg = false;
|
|
this.resetQuery4();
|
|
},
|
|
departcancel() {
|
|
this.innerVisible2 = false;
|
|
this.innerVisiblexg2 = false;
|
|
this.resetQuery3();
|
|
},
|
|
resetQuery2() {
|
|
this.resetForm("queryForm");
|
|
this.nurseStationqueryParams = {
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
};
|
|
this.handleQuery2();
|
|
},
|
|
resetQuery4() {
|
|
this.resetForm("queryForm");
|
|
this.nurseStationqueryParams = {
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
};
|
|
this.handleQuery4();
|
|
},
|
|
resetQuery3() {
|
|
this.queryParams3.pageNum = 1;
|
|
this.queryParams3.pageSize = 10;
|
|
this.queryParams3.departmentName = null;
|
|
this.queryParams3.departmentCode = null;
|
|
this.handleQuery3();
|
|
},
|
|
resetQuery() {
|
|
this.resetForm("queryForm");
|
|
this.queryParams = {
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
nurseStationId: null,
|
|
departmentCode: null,
|
|
userId: null,
|
|
nursePersonCode: null,
|
|
nursePersonName: null,
|
|
nursePersonType: null,
|
|
phone: null,
|
|
address: null,
|
|
};
|
|
this.handleQuery();
|
|
},
|
|
// 多选框选中数据
|
|
handleSelectionChange(selection) {
|
|
this.ids = selection.map((item) => item.id);
|
|
this.single = selection.length !== 1;
|
|
this.multiple = !selection.length;
|
|
},
|
|
/** 新增按钮操作 */
|
|
handleAdd() {
|
|
this.queryParams3.nurseStationId = null
|
|
this.reset();
|
|
this.open2 = true;
|
|
this.title = "添加护理站人员信息";
|
|
this.title2 = "请选择所属护理站";
|
|
this.title3 = "请选择科室";
|
|
},
|
|
/** 修改按钮操作 */
|
|
handleUpdate(row) {
|
|
this.homenumber = null;
|
|
const id = row.id || this.ids;
|
|
getPerson(id).then((response) => {
|
|
console.log(response);
|
|
this.departmentName = response.data.departmentName;
|
|
this.nurseStationName = response.data.nurseStationName;
|
|
this.form = response.data;
|
|
this.queryParams3.nurseStationId = response.data.nurseStationId
|
|
this.open = true;
|
|
this.title = "修改护理站人员信息";
|
|
if (this.departmentName == null && this.departmentName == undefined) {
|
|
this.departmentName = "请选择所属科室";
|
|
} else {
|
|
this.departmentName = response.data.departmentName;
|
|
}
|
|
});
|
|
},
|
|
/** 提交按钮 */
|
|
submitForm() {
|
|
if (this.form.id == null) {
|
|
this.form.nursePersonName = this.form.nurseStationPersonList[0].nursePersonName
|
|
this.form.nursePersonType = this.form.nurseStationPersonList[0].nursePersonType
|
|
this.form.sex = this.form.nurseStationPersonList[0].sex
|
|
this.form.address = this.form.nurseStationPersonList[0].address
|
|
this.form.departmentCode = this.form.nurseStationPersonList[0].departmentCode
|
|
this.form.departmentName = this.form.nurseStationPersonList[0].departmentName
|
|
this.form.phone = this.form.nurseStationPersonList[0].phone
|
|
}
|
|
console.log(this.form);
|
|
this.$refs["form"].validate((valid) => {
|
|
if (valid) {
|
|
if (this.form.id != null) {
|
|
updatePerson(this.form).then((response) => {
|
|
this.$modal.msgSuccess("修改成功");
|
|
this.open = false;
|
|
this.getList();
|
|
});
|
|
} else {
|
|
addPerson(this.form).then((response) => {
|
|
this.$modal.msgSuccess("新增成功");
|
|
this.open2 = false;
|
|
this.getList();
|
|
this.nurseStationName = "请选择所属护理站";
|
|
this.departmentName = "请选择所属科室";
|
|
});
|
|
}
|
|
}
|
|
});
|
|
},
|
|
/** 删除按钮操作 */
|
|
handleDelete(row) {
|
|
const ids = row.id || this.ids;
|
|
this.$modal
|
|
.confirm("是否确认删除护理站人员信息的数据项?")
|
|
.then(function() {
|
|
return delPerson(ids);
|
|
})
|
|
.then(() => {
|
|
this.getList();
|
|
this.$modal.msgSuccess("删除成功");
|
|
})
|
|
.catch(() => {});
|
|
},
|
|
/** 导入按钮操作 */
|
|
handleImport() {
|
|
this.upload.open = true;
|
|
this.upload.title = "护理站人员导入";
|
|
},
|
|
|
|
/** 下载模板操作 */
|
|
importTemplate() {
|
|
this.download(
|
|
"/system/station/downloadTemplate?fileType=nurseStationPerson", {},
|
|
`护理站人员基本信息导入模板.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();
|
|
},
|
|
// 文件上传中处理
|
|
handleFileUploadProgress(event, file, fileList) {
|
|
this.upload.isUploading = true;
|
|
},
|
|
|
|
/** 导出按钮操作 */
|
|
handleExport() {
|
|
this.download(
|
|
"system/person/export", {
|
|
...this.queryParams,
|
|
},
|
|
`person_${new Date().getTime()}.xlsx`
|
|
);
|
|
},
|
|
},
|
|
}; |