提交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

@@ -29,6 +29,15 @@
</el-button>
</div>
<div>
<span class="descriptions-item-label">实际执行时间</span>
<el-date-picker
v-model="exeDate"
type="datetime"
format="YYYY/MM/DD HH:mm:ss"
value-format="YYYY/MM/DD HH:mm:ss"
:clearable="false"
@change="handleGetPrescription"
/>
<span class="descriptions-item-label">全选</span>
<el-switch v-model="chooseAll" @change="handelSwicthChange" />
<el-button
@@ -139,6 +148,8 @@
border
:ref="'tableRef' + index"
:header-cell-style="{ background: '#eef9fd !important' }"
@select="(selection, row) => handleRowSelect(selection, row, index)"
@select-all="(selection) => handleSelectAll(selection, index)"
>
<el-table-column type="selection" align="center" width="50" />
<el-table-column label="类型" align="center" prop="therapyEnum_enumText" width="80">
@@ -173,7 +184,7 @@
</template>
</el-table-column>
<el-table-column label="开始/终止" prop="requestTime" width="200" />
<el-table-column label="预计执行" prop="times">
<el-table-column :label="props.exeStatus == 1 ? '预计执行' : '执行时间'" prop="times">
<template #default="scope">
<div
v-for="(item, timeIndex) in scope.row.times"
@@ -215,13 +226,19 @@
<script setup>
import { getPrescriptionList, adviceExecute, adviceCancel, adviceNoExecute } from './api';
<<<<<<< HEAD
import { patientInfoList } from '../store/patient.js';
=======
import { patientInfoList } from '../../components/store/patient.js';
import { lotNumberMatch } from '@/api/public';
>>>>>>> v1.3
import { formatDate, formatDateStr } from '@/utils/index';
import { ref, getCurrentInstance } from 'vue';
import { ref, getCurrentInstance, nextTick } from 'vue';
const activeNames = ref([]);
const prescriptionList = ref([]);
const deadline = ref(formatDateStr(new Date(), 'YYYY-MM-DD') + ' 23:59:59');
const exeDate = ref(formatDateStr(new Date(), 'YYYY-MM-DD') + ' 23:59:59');
const therapyEnum = ref(undefined);
const { proxy } = getCurrentInstance();
const loading = ref(false);
@@ -392,6 +409,10 @@ function handleGetPrescription() {
// 将分组结果转换为数组形式
prescriptionList.value = Object.values(groupedPrescriptions);
loading.value = false;
// 默认选中全部行
nextTick(() => {
defaultSelectAllRows();
});
// } catch {
// loading.value = false;
// }
@@ -406,6 +427,7 @@ function handleGetPrescription() {
// 执行
function handleExecute() {
let list = getSelectRows();
let encounterIds = patientInfoList.value.map((i) => i.encounterId).join(',');
list = list.map((item) => {
return {
requestId: item.requestId,
@@ -415,13 +437,35 @@ function handleExecute() {
};
});
console.log(list, 'list');
adviceExecute({ adviceExecuteDetailList: list }).then((res) => {
adviceExecute({ exeDate: exeDate.value, adviceExecuteDetailList: list }).then((res) => {
if (res.code == 200) {
handleGetPrescription();
lotNumberMatch({ encounterIdList: encounterIds });
}
});
}
// 不执行
function handleNoExecute() {
let list = getSelectRows();
list = list.map((item) => {
return {
requestId: item.requestId,
encounterId: item.encounterId,
patientId: item.patientId,
adviceTable: item.adviceTable,
executeTimes: item.executeTimes,
};
});
console.log(list, 'list');
adviceNoExecute({ adviceExecuteDetailList: list }).then((res) => {
if (res.code == 200) {
handleGetPrescription();
}
});
}
<<<<<<< HEAD
// 不执行
function handleNoExecute() {
let list = getSelectRows();
@@ -456,6 +500,22 @@ function handleCancel() {
})
);
});
=======
// 取消执行
function handleCancel() {
let list = getSelectRows();
let producerIds = [];
list.forEach((item) => {
producerIds.push(
...item.procedureIds.map((value) => {
return {
procedureId: value,
therapyEnum: item.therapyEnum,
};
})
);
});
>>>>>>> v1.3
adviceCancel({ adviceExecuteDetailList: producerIds }).then((res) => {
if (res.code == 200) {
handleGetPrescription();
@@ -504,6 +564,7 @@ function getDateRange(startDate, endDate) {
function handleRateChange(value, date, time, row, rateItem) {
// 拼接当前选中时间
<<<<<<< HEAD
let tiemStr = row.year + '-' + date + ' ' + time + ':00';
let index = row.executeTimes.indexOf(tiemStr);
debugger;
@@ -514,14 +575,215 @@ function handleRateChange(value, date, time, row, rateItem) {
row.executeTimes.splice(row.executeTimes.indexOf(tiemStr), 1);
row.procedureIds.splice(row.executeTimes.indexOf(rateItem.producerId), 1);
}
=======
let timeStr = row.year + '-' + date + ' ' + time + ':00';
let timeIndex = row.executeTimes.indexOf(timeStr);
if (value) {
// 选中checkbox如果时间不在执行时间列表中则添加
if (timeIndex === -1) {
row.executeTimes.push(timeStr);
}
// 如果有procedureId添加到列表中
if (rateItem.procedureId && !row.procedureIds.includes(rateItem.procedureId)) {
row.procedureIds.push(rateItem.procedureId);
}
} else {
// 取消选中checkbox从执行时间列表中移除
if (timeIndex !== -1) {
row.executeTimes.splice(timeIndex, 1);
}
// 移除对应的procedureId
if (rateItem.procedureId) {
const procedureIndex = row.procedureIds.indexOf(rateItem.procedureId);
if (procedureIndex !== -1) {
row.procedureIds.splice(procedureIndex, 1);
}
}
}
// 检查该行所有checkbox是否全部选中联动表格行选中状态
nextTick(() => {
checkAndToggleRowSelection(row);
});
>>>>>>> v1.3
}
function handelSwicthChange(value) {
prescriptionList.value.forEach((item, index) => {
proxy.$refs['tableRef' + index][0].toggleAllSelection();
const tableRef = proxy.$refs['tableRef' + index];
if (tableRef && tableRef[0]) {
if (value) {
// 全选选中所有行并联动checkbox
item.forEach((row) => {
tableRef[0].toggleRowSelection(row, true);
selectAllCheckboxesInRow(row);
});
} else {
// 取消全选取消选中所有行并联动checkbox
item.forEach((row) => {
tableRef[0].toggleRowSelection(row, false);
unselectAllCheckboxesInRow(row);
});
}
}
});
}
// 默认选中全部行
function defaultSelectAllRows() {
prescriptionList.value.forEach((item, index) => {
const tableRef = proxy.$refs['tableRef' + index];
if (tableRef && tableRef[0]) {
// 选中该表格的所有行
item.forEach((row) => {
tableRef[0].toggleRowSelection(row, true);
// 同时选中该行内部的所有checkbox
selectAllCheckboxesInRow(row);
});
}
});
// 更新全选开关状态
chooseAll.value = true;
}
// 选中行内部的所有checkbox
function selectAllCheckboxesInRow(row) {
if (!row.times || !row.rate) return;
// 遍历所有时间点选中所有checkbox
row.times.forEach((time, timeIndex) => {
const rateItems = row.rate[time] || [];
if (rateItems.length > 0) {
// 获取该时间点的所有rate值
const allRates = rateItems.map((item) => item.rate);
// 设置为全选
row.checkedRates[timeIndex] = [...allRates];
// 更新执行时间列表
allRates.forEach((rate) => {
const timeStr = row.year + '-' + time + ' ' + rate + ':00';
if (!row.executeTimes.includes(timeStr)) {
row.executeTimes.push(timeStr);
}
// 添加procedureId
const rateItem = rateItems.find((item) => item.rate === rate);
if (rateItem && rateItem.procedureId && !row.procedureIds.includes(rateItem.procedureId)) {
row.procedureIds.push(rateItem.procedureId);
}
});
}
});
}
// 取消选中行内部的所有checkbox
function unselectAllCheckboxesInRow(row) {
if (!row.times) return;
// 清空所有checkbox选中状态
row.times.forEach((time, timeIndex) => {
row.checkedRates[timeIndex] = [];
});
// 清空执行时间列表和procedureIds
row.executeTimes = [];
row.procedureIds = [];
}
// 检查行内部所有checkbox是否全部选中
function isAllCheckboxesSelected(row) {
if (!row.times || !row.rate) return false;
// 遍历所有时间点,检查是否全部选中
for (let timeIndex = 0; timeIndex < row.times.length; timeIndex++) {
const time = row.times[timeIndex];
const rateItems = row.rate[time] || [];
const checkedRates = row.checkedRates[timeIndex] || [];
// 如果该时间点的checkbox没有全部选中返回false
if (rateItems.length > 0 && checkedRates.length !== rateItems.length) {
return false;
}
}
return true;
}
// 检查并联动表格行选中状态
function checkAndToggleRowSelection(row) {
prescriptionList.value.forEach((item, tableIndex) => {
const rowIndex = item.findIndex((r) => r.requestId === row.requestId);
if (rowIndex !== -1) {
const tableRef = proxy.$refs['tableRef' + tableIndex];
if (tableRef && tableRef[0]) {
const isAllSelected = isAllCheckboxesSelected(row);
const selectedRows = tableRef[0].getSelectionRows();
const isCurrentlySelected = selectedRows.some((r) => r.requestId === row.requestId);
// 根据checkbox状态更新表格行选中状态
if (isAllSelected && !isCurrentlySelected) {
tableRef[0].toggleRowSelection(row, true);
} else if (!isAllSelected && isCurrentlySelected) {
tableRef[0].toggleRowSelection(row, false);
}
}
}
});
}
// 处理表格行选中事件
function handleRowSelect(selection, row, tableIndex) {
const isSelected = selection.some((item) => item.requestId === row.requestId);
if (isSelected) {
// 选中行时选中该行内部的所有checkbox
selectAllCheckboxesInRow(row);
} else {
// 取消选中行时取消选中该行内部的所有checkbox
unselectAllCheckboxesInRow(row);
}
// 更新全选开关状态
updateChooseAllStatus();
}
// 处理表格全选事件
function handleSelectAll(selection, tableIndex) {
const tableData = prescriptionList.value[tableIndex];
if (!tableData) return;
if (selection.length > 0) {
// 全选时选中所有行内部的所有checkbox
tableData.forEach((row) => {
selectAllCheckboxesInRow(row);
});
} else {
// 取消全选时取消选中所有行内部的所有checkbox
tableData.forEach((row) => {
unselectAllCheckboxesInRow(row);
});
}
// 更新全选开关状态
updateChooseAllStatus();
}
// 更新全选开关状态
function updateChooseAllStatus() {
let allSelected = true;
prescriptionList.value.forEach((item, index) => {
const tableRef = proxy.$refs['tableRef' + index];
if (tableRef && tableRef[0]) {
const selectedRows = tableRef[0].getSelectionRows();
if (selectedRows.length !== item.length) {
allSelected = false;
}
} else {
allSelected = false;
}
});
chooseAll.value = allSelected;
}
// 处理后端返回的时间集合
function handleTime() {}