修复bug:长者管理-长者信息-护理流程功能无法正常使用
This commit is contained in:
parent
52bf0f075d
commit
315739f22d
|
|
@ -2,23 +2,15 @@
|
||||||
<div class="hllcClass" @contextmenu.prevent>
|
<div class="hllcClass" @contextmenu.prevent>
|
||||||
<a-row>
|
<a-row>
|
||||||
<a-col :span="12" style="padding-top: 14px;">
|
<a-col :span="12" style="padding-top: 14px;">
|
||||||
{{customerInfo.name}} - 护理流程展示
|
{{ customerInfo.name }} - 护理流程展示
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12" style="text-align: right;">
|
<a-col :span="12" style="text-align: right;">
|
||||||
<!-- <a-button type="primary" @click="handleFanhui">返回</a-button> -->
|
<!-- <a-button type="primary" @click="handleFanhui">返回</a-button> -->
|
||||||
<!-- <a-button type="primary" @click="getData(customerInfo)">加载</a-button> -->
|
<!-- <a-button type="primary" @click="getData(customerInfo)">加载</a-button> -->
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24" style="margin-top:14px;">
|
<a-col :span="24" style="margin-top:14px;">
|
||||||
<a-table
|
<a-table :columns="columns" :data-source="dataSource" bordered size="small" :pagination="false"
|
||||||
:columns="columns"
|
:rowClassName="setRowClassName" :customRow="handleCustomRow" @contextmenu.prevent>
|
||||||
:data-source="dataSource"
|
|
||||||
bordered
|
|
||||||
size="small"
|
|
||||||
:pagination="false"
|
|
||||||
:rowClassName="setRowClassName"
|
|
||||||
:customRow="handleCustomRow"
|
|
||||||
@contextmenu.prevent
|
|
||||||
>
|
|
||||||
<template #bodyCell="{ column, record, text }">
|
<template #bodyCell="{ column, record, text }">
|
||||||
<template v-if="column.key !== 'minute'">
|
<template v-if="column.key !== 'minute'">
|
||||||
<a-tooltip :title="text" placement="topLeft">
|
<a-tooltip :title="text" placement="topLeft">
|
||||||
|
|
@ -34,17 +26,13 @@
|
||||||
</a-row>
|
</a-row>
|
||||||
|
|
||||||
<!-- 右键菜单 -->
|
<!-- 右键菜单 -->
|
||||||
<div
|
<div v-if="contextMenu.visible" :style="{
|
||||||
v-if="contextMenu.visible"
|
|
||||||
:style="{
|
|
||||||
position: 'fixed',
|
position: 'fixed',
|
||||||
left: `${contextMenu.x}px`,
|
left: `${contextMenu.x}px`,
|
||||||
top: `${contextMenu.y}px`,
|
top: `${contextMenu.y}px`,
|
||||||
zIndex: 1000,
|
zIndex: 1000,
|
||||||
boxShadow: '0 2px 8px rgba(0,0,0,0.15)'
|
boxShadow: '0 2px 8px rgba(0,0,0,0.15)'
|
||||||
}"
|
}" class="context-menu">
|
||||||
class="context-menu"
|
|
||||||
>
|
|
||||||
<a-menu @click="handleMenuClick" style="padding: 14px;">
|
<a-menu @click="handleMenuClick" style="padding: 14px;">
|
||||||
<a-menu-item key="add">新增数据</a-menu-item>
|
<a-menu-item key="add">新增数据</a-menu-item>
|
||||||
<a-menu-item key="edit" :disabled="!contextMenu.record?.[contextMenu.columnKey]">编辑数据</a-menu-item>
|
<a-menu-item key="edit" :disabled="!contextMenu.record?.[contextMenu.columnKey]">编辑数据</a-menu-item>
|
||||||
|
|
@ -53,12 +41,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 数据操作模态框 -->
|
<!-- 数据操作模态框 -->
|
||||||
<a-modal
|
<a-modal v-model:visible="modalVisible" :title="modalTitle" @ok="handleModalOk" @cancel="handleModalCancel">
|
||||||
v-model:visible="modalVisible"
|
|
||||||
:title="modalTitle"
|
|
||||||
@ok="handleModalOk"
|
|
||||||
@cancel="handleModalCancel"
|
|
||||||
>
|
|
||||||
<a-form :model="formState" layout="vertical" style="padding:14px;">
|
<a-form :model="formState" layout="vertical" style="padding:14px;">
|
||||||
<a-form-item label="数据内容">
|
<a-form-item label="数据内容">
|
||||||
<a-input v-model:value="formState.content" />
|
<a-input v-model:value="formState.content" />
|
||||||
|
|
@ -72,41 +55,41 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, reactive, defineExpose,computed } from 'vue';
|
import { ref, reactive, defineExpose, computed } from 'vue';
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
import { defHttp } from '/@/utils/http/axios';
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
|
|
||||||
const emit = defineEmits(['register', 'success']);
|
const emit = defineEmits(['register', 'success']);
|
||||||
const customerInfo = ref<any>({});
|
const customerInfo = ref<any>({});
|
||||||
|
|
||||||
// 右键菜单状态
|
// 右键菜单状态
|
||||||
const contextMenu = reactive({
|
const contextMenu = reactive({
|
||||||
visible: false,
|
visible: false,
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0,
|
y: 0,
|
||||||
record: null as DataRow | null,
|
record: null as DataRow | null,
|
||||||
columnKey: '',
|
columnKey: '',
|
||||||
rowIndex: -1
|
rowIndex: -1
|
||||||
});
|
});
|
||||||
|
|
||||||
// 模态框状态
|
// 模态框状态
|
||||||
const modalVisible = ref(false);
|
const modalVisible = ref(false);
|
||||||
const modalAction = ref<'add' | 'edit' | 'delete'>('add');
|
const modalAction = ref<'add' | 'edit' | 'delete'>('add');
|
||||||
const modalTitle = computed(() => {
|
const modalTitle = computed(() => {
|
||||||
return {
|
return {
|
||||||
add: '新增数据',
|
add: '新增数据',
|
||||||
edit: '编辑数据',
|
edit: '编辑数据',
|
||||||
delete: '确认删除'
|
delete: '确认删除'
|
||||||
}[modalAction.value];
|
}[modalAction.value];
|
||||||
});
|
});
|
||||||
|
|
||||||
const formState = reactive({
|
const formState = reactive({
|
||||||
content: '',
|
content: '',
|
||||||
remark: ''
|
remark: ''
|
||||||
});
|
});
|
||||||
|
|
||||||
// 生成列(24小时)
|
// 生成列(24小时)
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
title: '',
|
title: '',
|
||||||
dataIndex: 'minute',
|
dataIndex: 'minute',
|
||||||
|
|
@ -115,10 +98,10 @@ import { defHttp } from '/@/utils/http/axios';
|
||||||
fixed: 'left',
|
fixed: 'left',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
// 添加小时列
|
// 添加小时列
|
||||||
for (let hour = 0; hour < 24; hour++) {
|
for (let hour = 0; hour < 24; hour++) {
|
||||||
columns.push({
|
columns.push({
|
||||||
title: `${hour.toString().padStart(2, '0')}`,
|
title: `${hour.toString().padStart(2, '0')}`,
|
||||||
dataIndex: `hour_${hour}`,
|
dataIndex: `hour_${hour}`,
|
||||||
|
|
@ -135,20 +118,20 @@ import { defHttp } from '/@/utils/http/axios';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 生成数据(每5分钟一行)
|
// 生成数据(每5分钟一行)
|
||||||
interface DataRow {
|
interface DataRow {
|
||||||
key: number;
|
key: number;
|
||||||
minute: string;
|
minute: string;
|
||||||
remark?: string;
|
remark?: string;
|
||||||
[key: `hour_${number}`]: string;
|
[key: `hour_${number}`]: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const dataSource = ref<DataRow[]>([]);
|
const dataSource = ref<DataRow[]>([]);
|
||||||
|
|
||||||
// 初始化数据
|
// 初始化数据
|
||||||
const initDataSource = () => {
|
const initDataSource = () => {
|
||||||
const newData: DataRow[] = [];
|
const newData: DataRow[] = [];
|
||||||
for (let minute = 0; minute < 60; minute += 5) {
|
for (let minute = 0; minute < 60; minute += 5) {
|
||||||
let row: DataRow = {
|
let row: DataRow = {
|
||||||
|
|
@ -163,28 +146,28 @@ import { defHttp } from '/@/utils/http/axios';
|
||||||
newData.push(row);
|
newData.push(row);
|
||||||
}
|
}
|
||||||
dataSource.value = newData;
|
dataSource.value = newData;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 为奇数行添加斑马纹
|
// 为奇数行添加斑马纹
|
||||||
function setRowClassName(record: DataRow, index: number) {
|
function setRowClassName(record: DataRow, index: number) {
|
||||||
return index % 2 === 0 ? 'even-row' : 'odd-row';
|
return index % 2 === 0 ? 'even-row' : 'odd-row';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化数据
|
// 初始化数据
|
||||||
initDataSource();
|
initDataSource();
|
||||||
|
|
||||||
// 行点击事件处理
|
// 行点击事件处理
|
||||||
const handleCustomRow = (record: DataRow, index: number) => {
|
const handleCustomRow = (record: DataRow, index: number) => {
|
||||||
return {
|
return {
|
||||||
onClick: () => handleRowClick(record, index),
|
onClick: () => handleRowClick(record, index),
|
||||||
onContextmenu: (event: MouseEvent) => {
|
onContextmenu: (event: MouseEvent) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// 显示右键菜单
|
// 显示右键菜单
|
||||||
const showContextMenu = (event: MouseEvent, record: DataRow, columnKey: string, rowIndex: number) => {
|
const showContextMenu = (event: MouseEvent, record: DataRow, columnKey: string, rowIndex: number) => {
|
||||||
// event.preventDefault();
|
// event.preventDefault();
|
||||||
|
|
||||||
// contextMenu.visible = true;
|
// contextMenu.visible = true;
|
||||||
|
|
@ -203,10 +186,10 @@ import { defHttp } from '/@/utils/http/axios';
|
||||||
// };
|
// };
|
||||||
|
|
||||||
// document.addEventListener('click', closeMenu);
|
// document.addEventListener('click', closeMenu);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 菜单点击处理
|
// 菜单点击处理
|
||||||
const handleMenuClick = ({ key }: { key: string }) => {
|
const handleMenuClick = ({ key }: { key: string }) => {
|
||||||
const { record, columnKey } = contextMenu;
|
const { record, columnKey } = contextMenu;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
|
@ -234,10 +217,10 @@ import { defHttp } from '/@/utils/http/axios';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
contextMenu.visible = false;
|
contextMenu.visible = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 模态框确认
|
// 模态框确认
|
||||||
const handleModalOk = () => {
|
const handleModalOk = () => {
|
||||||
const { record, columnKey, rowIndex } = contextMenu;
|
const { record, columnKey, rowIndex } = contextMenu;
|
||||||
|
|
||||||
if (!record || !columnKey || rowIndex === -1) return;
|
if (!record || !columnKey || rowIndex === -1) return;
|
||||||
|
|
@ -260,44 +243,43 @@ import { defHttp } from '/@/utils/http/axios';
|
||||||
}
|
}
|
||||||
|
|
||||||
modalVisible.value = false;
|
modalVisible.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 模态框取消
|
// 模态框取消
|
||||||
const handleModalCancel = () => {
|
const handleModalCancel = () => {
|
||||||
modalVisible.value = false;
|
modalVisible.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 行点击事件
|
// 行点击事件
|
||||||
function handleRowClick(record: DataRow, index: number) {
|
function handleRowClick(record: DataRow, index: number) {
|
||||||
// 可添加行点击逻辑
|
// 可添加行点击逻辑
|
||||||
}
|
}
|
||||||
|
|
||||||
// 单元格点击事件
|
// 单元格点击事件
|
||||||
function handleCellClick(record: DataRow, columnKey: string, rowIndex: number, buttonType: 'left' | 'right') {
|
function handleCellClick(record: DataRow, columnKey: string, rowIndex: number, buttonType: 'left' | 'right') {
|
||||||
// 可添加单元格点击逻辑
|
// 可添加单元格点击逻辑
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleFanhui() {
|
function handleFanhui() {
|
||||||
emit('success');
|
emit('success');
|
||||||
}
|
}
|
||||||
function getData(record: any) {
|
function getData(record: any) {
|
||||||
defHttp.get({
|
defHttp.get({
|
||||||
url: "/nuIpadApi/nuBizNuCustomerServer/getNclist",
|
url: "/api/pad/care/directive/getNclist",
|
||||||
params: { nuId: record.nuId, customerId: record.id }
|
params: { nuId: record.nuId, elderId: record.id }
|
||||||
}).then((data) => {
|
}).then((result) => {
|
||||||
console.log("获取到的数据:", data);
|
console.log("获取到的数据:", result);
|
||||||
|
const data = result.serviceList
|
||||||
|
|
||||||
// 初始化数据源
|
// 初始化数据源
|
||||||
initDataSource();
|
initDataSource();
|
||||||
|
|
||||||
// 处理返回的数据
|
// 处理返回的数据
|
||||||
if (Array.isArray(data)) {
|
if (Array.isArray(data)) {
|
||||||
data.forEach((hourData) => {
|
data.forEach((item) => {
|
||||||
const hour = parseInt(hourData.positioning);
|
const hour = parseInt(item.positioning);
|
||||||
|
|
||||||
// 处理该小时的所有子项
|
// 处理该小时的所有子项
|
||||||
if (hourData.children && hourData.children.length > 0) {
|
|
||||||
hourData.children.forEach((item) => {
|
|
||||||
// 解析开始时间
|
// 解析开始时间
|
||||||
const [startHour, startMinute] = item.startTime.split(':').map(Number);
|
const [startHour, startMinute] = item.startTime.split(':').map(Number);
|
||||||
const rowIndex = Math.floor(startMinute / 5); // 每5分钟一行
|
const rowIndex = Math.floor(startMinute / 5); // 每5分钟一行
|
||||||
|
|
@ -320,48 +302,48 @@ function getData(record: any) {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
console.log('12321312331', dataSource.value)
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSaveBach(){
|
function handleSaveBach() {
|
||||||
console.log("🚀 ~ handleSaveBach ~ dataSource:", dataSource)
|
console.log("🚀 ~ handleSaveBach ~ dataSource:", dataSource)
|
||||||
}
|
}
|
||||||
|
|
||||||
function init(record: any) {
|
function init(record: any) {
|
||||||
customerInfo.value = record;
|
customerInfo.value = record;
|
||||||
console.log("初始化数据:", record);
|
console.log("初始化数据:", record);
|
||||||
getData(record)
|
getData(record)
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
init
|
init
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.hllcClass {
|
.hllcClass {
|
||||||
background: white;
|
background: white;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: calc(100vh - 90px);
|
height: calc(100vh - 90px);
|
||||||
padding: 14px;
|
padding: 14px;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 斑马纹样式 */
|
/* 斑马纹样式 */
|
||||||
:deep(.ant-table) {
|
:deep(.ant-table) {
|
||||||
.even-row {
|
.even-row {
|
||||||
background-color: #fafafa;
|
background-color: #fafafa;
|
||||||
}
|
}
|
||||||
|
|
||||||
.odd-row {
|
.odd-row {
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 单元格悬停效果 */
|
/* 单元格悬停效果 */
|
||||||
.ant-table-tbody > tr > td {
|
.ant-table-tbody>tr>td {
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: #e6f7ff !important;
|
background-color: #e6f7ff !important;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
@ -372,10 +354,10 @@ function handleSaveBach(){
|
||||||
.has-data {
|
.has-data {
|
||||||
background-color: #f6ffed;
|
background-color: #f6ffed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 右键菜单样式 */
|
/* 右键菜单样式 */
|
||||||
.context-menu {
|
.context-menu {
|
||||||
background: white;
|
background: white;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
@ -388,8 +370,9 @@ function handleSaveBach(){
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 5px 12px;
|
padding: 5px 12px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.cell-text {
|
|
||||||
|
.cell-text {
|
||||||
// display: inline-block;
|
// display: inline-block;
|
||||||
// max-width: 50px;
|
// max-width: 50px;
|
||||||
// overflow: hidden;
|
// overflow: hidden;
|
||||||
|
|
@ -398,7 +381,8 @@ function handleSaveBach(){
|
||||||
|
|
||||||
display: -webkit-box;
|
display: -webkit-box;
|
||||||
-webkit-box-orient: vertical;
|
-webkit-box-orient: vertical;
|
||||||
-webkit-line-clamp: 2; /* 限制文本为2行 */
|
-webkit-line-clamp: 2;
|
||||||
|
/* 限制文本为2行 */
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue