提交merge1.3

This commit is contained in:
2025-12-27 15:30:25 +08:00
parent 8c607c8749
commit 088861f66e
1245 changed files with 220442 additions and 77616 deletions

View File

@@ -5,7 +5,7 @@
<span style="vertical-align: middle">病区</span>
</template>
<div style="width: 100%">
<el-button type="primary" @click="open = true" class="mb8"> 新增 </el-button>
<el-button type="primary" @click="onIncrease" class="mb8"> 新增 </el-button>
<el-button type="success" plain @click="handleEnableBatch('wardRef')" class="mb8">
批量启用
</el-button>
@@ -16,7 +16,7 @@
<el-table
max-height="630"
:data="wardList"
@cell-click="(row) => clickRow(row, 10)"
@cell-click="(row) => clickRow(row, 10, 0)"
highlight-current-row
ref="wardRef"
>
@@ -95,7 +95,7 @@
<el-table
height="280"
:data="houseList"
@cell-click="(row) => clickRow(row, 8)"
@cell-click="(row) => clickRow(row, 8, 0, 1)"
highlight-current-row
v-loading="loading"
ref="hourseRef"
@@ -134,7 +134,7 @@
@click.stop="
() => {
handleUnable(scope.row).then(() => {
clickRow(houseRow, 10);
getHouseList();
});
}
"
@@ -153,7 +153,7 @@
@click.stop="
() => {
handleEnable(scope.row).then(() => {
clickRow(houseRow, 10);
getHouseList();
});
}
"
@@ -206,7 +206,7 @@
@click.stop="
() => {
handleUnable(scope.row, 10).then(() => {
clickRow(bedRow, 8);
getBedList();
});
}
"
@@ -225,7 +225,7 @@
@click.stop="
() => {
handleEnable(scope.row, 10).then(() => {
clickRow(bedRow, 8);
getBedList();
});
}
"
@@ -255,7 +255,7 @@
</el-radio-group>
</el-form-item>
<el-form-item :label="type + '名称'" prop="name">
<el-input v-model="form.name" placeholder="请输入科室名称" />
<el-input v-model="form.name" :placeholder="'请输入' + type + '名称'" />
</el-form-item>
<el-col>
<el-form-item :label="upLabel" prop="busNoParent">
@@ -304,8 +304,9 @@
</el-dialog>
</div>
</template>
<script setup name="Ward">
import { onMounted, ref } from 'vue';
import {
getList,
addLocation,
@@ -315,33 +316,65 @@ import {
unableLocation,
enableLocation,
} from './components/api';
import { ElMessage } from 'element-plus';
const { proxy } = getCurrentInstance();
// 病区参数
const queryParams = ref({
pageNum: 1,
pageSize: 50,
formEnum: 4,
formEnum: 4, //4 病区 10 病房 8床位
// locationFormList: [4],
});
// 病房参数
const queryHouseParams = ref({
pageNum: 1,
pageSize: 50,
formEnum: 10, //4 病区 10 病房 8床位
// locationFormList: [4],
});
// 病床参数
const querybedParams = ref({
pageNum: 1,
pageSize: 50,
formEnum: 8, //4 病区 10 病房 8床位
// locationFormList: [4],
});
// 病区、病房、病床类型
const type = ref('病区');
// 病区列表
const wardList = ref([]);
// 床位列表
const bedList = ref([]);
// 病房列表
const houseList = ref([]);
const wardListOption = ref([]);
const organization = ref([]);
const loading = ref(false);
const isEdit = ref(false);
const open = ref(false);
// 病区row
const wardRow = ref({});
// 床位row
const bedRow = ref({});
// 病房row
const houseRow = ref({});
// 记录点击的是启用
const clickType = ref(0);
const orgRef = ref();
// 新增数据参数
const form = reactive({
formEnum: 4,
busNoParent: '',
organizationId: '',
name: '',
busNo: '',
});
const upLabel = ref('关联科室');
const title = ref('新增');
const rules = ref({
name: [
{ required: true, message: '请输入科室名称', trigger: 'blur' },
{ min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' },
{ required: true, message: '请输入名称', trigger: 'blur' },
{ required: true, min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' },
],
busNoParent: [
{
@@ -351,23 +384,76 @@ const rules = ref({
},
],
});
/**
* 病区列表
*/
function getWardList() {
queryParams.value.formEnum = 4;
getList(queryParams.value).then((res) => {
wardList.value = res.data.records;
});
}
// 获取科室下啦树
function init() {
getOrgList().then((res) => {
organization.value = res.data.records;
});
}
/**
* 病区列表
*/
function getWardList() {
houseList.value = [];
bedList.value = [];
getList(queryParams.value).then((res) => {
wardList.value = res.data.records;
});
}
// 获取病房列表
const getHouseList = () => {
// 4病区 10病房 8床位
loading.value = true;
// 病区号
queryHouseParams.value.busNo = wardRow.value.busNo;
bedList.value = [];
getList(queryHouseParams.value).then((res) => {
houseList.value = res.data.records;
loading.value = false;
});
};
// 获取床位列表
const getBedList = () => {
// 4病区 10病房 8床位
loading.value = true;
querybedParams.value.busNo = houseRow.value.busNo;
bedList.value = [];
getList(querybedParams.value).then((res) => {
bedList.value = res.data.records;
loading.value = false;
});
};
// 点击新增按钮
const onIncrease = () => {
open.value = true;
};
// 查询病房和病区的下拉选
const getHomeOrBed = (formEnum) => {
const params = {
formEnum,
pageNum: 1,
pageSize: 50,
};
getList(params).then((res) => {
if (formEnum == 10) {
const datas = res.data?.records || [];
const optionsList = datas.map((item) => {
let obj = {
...item,
};
obj.name = item.parentName + '-' + item.name;
return obj;
});
wardListOption.value = optionsList;
} else {
wardListOption.value = res.data?.records || [];
}
});
};
function handleRadioChange(val) {
let formEnum = 4;
if (val == 4) {
type.value = '病区';
upLabel.value = '关联科室';
@@ -375,38 +461,56 @@ function handleRadioChange(val) {
} else if (val == 10) {
type.value = '病房';
upLabel.value = '所属病区';
queryParams.value.formEnum = 4;
formEnum = 4;
// queryParams.value.formEnum = 4;
} else {
type.value = '床位';
upLabel.value = '所属病房';
queryParams.value.formEnum = 10;
formEnum = 10;
// queryParams.value.formEnum = 10;
}
getList(queryParams.value).then((res) => {
wardListOption.value = res.data.records;
});
form.organizationId = '';
form.busNo = '';
form.busNoParent = '';
form.name = '';
getHomeOrBed(formEnum);
}
/**
* 点击患者列表行 获取处方列表
*/
function clickRow(row, val) {
loading.value = true;
queryParams.value.formEnum = val;
queryParams.value.busNo = row.busNo;
bedList.value = [];
getList(queryParams.value).then((res) => {
if (val == 10) {
houseList.value = res.data.records;
houseRow.value = row;
} else if (val == 8) {
bedRow.value = row;
bedList.value = res.data.records;
}
setTimeout(() => {
queryParams.value.busNo = undefined;
loading.value = false;
}, 100);
});
function clickRow(row, val, type) {
// 1点击了启用
clickType.value = type;
console.log('val=====>', JSON.stringify(row));
console.log('type=====>', JSON.stringify(type));
console.log('val=====>', JSON.stringify(val));
// if (type !== 1) {
// if (val == 10) {
// wardRow.value = row;
// getHouseList();
// } else if (val == 8) {
// houseRow.value = row;
// getBedList();
// }
// } else {
// if (val == 10) {
// houseRow.value = row;
// getHouseList();
// } else if (val == 8) {
// bedRow.value = row;
// getBedList();
// }
// }
if (val == 10) {
wardRow.value = row;
getHouseList();
} else if (val == 8) {
houseRow.value = row;
console.log('houseRow=====>', houseRow.value);
getBedList();
}
}
function checkSelectable(row, index) {
@@ -459,38 +563,113 @@ function handleUnableBatch(tableRef) {
});
}
// 新增病床拆分"busNo": "LOC055.LOC056",
const splitBusNo = (busNo) => {
const busNoArr = busNo.split('.') || [];
let busNoParent = '';
if (busNoArr.length > 1) {
busNoParent = busNoArr[0];
}
return busNoParent;
};
function submitForm() {
if (form.busNoParent) {
if (form.formEnum == 4) {
form.organizationId = form.busNoParent;
} else {
form.busNo = form.busNoParent;
if (!orgRef) return;
const params = {
...form,
};
console.log('form========>', JSON.stringify(form));
console.log('params11========>', JSON.stringify(params));
orgRef.value.validate((valid) => {
if (valid) {
console.log('99999999');
if (form.busNoParent) {
if (form.formEnum == 4) {
params.organizationId = form.busNoParent;
} else {
if (!isEdit.value) {
params.busNo = form.busNoParent;
// params.busNoParent = splitBusNo(form.busNoParent);
}
}
} else {
if (form.formEnum == 4) {
if (!(params.organizationId && params.organizationId.length > 0)) {
ElMessage({
type: 'error',
message: '请选择关联科室!',
});
return;
}
} else if (form.formEnum == 10) {
if (!(params.busNo && params.busNo.length > 0)) {
ElMessage({
type: 'error',
message: '请选择所属病区!',
});
return;
}
} else {
if (!(params.busNo && params.busNo.length > 8)) {
ElMessage({
type: 'error',
message: '请选择所属病房!',
});
return;
}
}
}
// console.log('params========>', JSON.stringify(form));
console.log('params========>', JSON.stringify(params));
// console.log('params========>', isEdit.value);
if (!isEdit.value) {
addLocation(params).then((res) => {
if (res.code == 200) {
proxy.$modal.msgSuccess('操作成功');
if (params.formEnum == 4) {
cancel();
getWardList();
} else if (params.formEnum == 10) {
getHouseList();
open.value = false;
} else if (params.formEnum == 8) {
getBedList();
open.value = false;
}
}
});
} else {
editLocation(params).then((res) => {
if (res.code == 200) {
proxy.$modal.msgSuccess('操作成功');
if (params.formEnum == 4) {
cancel();
getWardList();
} else if (params.formEnum == 10) {
getHouseList();
open.value = false;
} else if (params.formEnum == 8) {
getBedList();
open.value = false;
}
}
});
}
}
}
console.log(form);
if (!isEdit.value) {
addLocation(form).then((res) => {
if (res.code == 200) {
proxy.$modal.msgSuccess('操作成功');
cancel();
getWardList();
}
});
} else {
editLocation(form).then((res) => {
if (res.code == 200) {
proxy.$modal.msgSuccess('操作成功');
cancel();
getWardList();
}
});
}
});
}
function handleDelete(row) {
deleteLocation(row.busNo).then((res) => {
if (res.code == 200) {
proxy.$modal.msgSuccess('删除成功');
if (row.formEnum == 4) {
getWardList();
} else if (row.formEnum == 10) {
getHouseList();
} else {
getBedList();
}
}
});
}
@@ -501,24 +680,27 @@ function getLastPartOfString(str) {
}
function handleEdit(row, val) {
console.log('editRow=========>', JSON.stringify(row));
form.id = row.id;
form.name = row.name;
form.formEnum = row.formEnum;
form.busNo = row.busNo;
if (row.organizationId) {
form.busNoParent = row.organizationId;
form.organizationId = row.organizationId;
} else {
form.busNoParent = row.busNo.split('.').slice(0, -1).join('.');
}
isEdit.value = true;
title.value = '编辑';
if (val) {
queryParams.value.formEnum = val;
getList(queryParams.value).then((res) => {
wardListOption.value = res.data.records;
});
}
open.value = true;
console.log('editRow1=========>', JSON.stringify(form));
if (val == 4) {
getHomeOrBed(4);
} else if (val == 10) {
getHomeOrBed(10);
}
}
function cancel() {
@@ -532,10 +714,13 @@ function cancel() {
isEdit.value = false;
title.value = '新增';
}
init();
getWardList();
// 页面挂在成功
onMounted(() => {
// 获取所有科室
init();
// 获取病区列表
getWardList();
});
</script>
<style scoped>
</style>
<style scoped></style>