From c8e9849cb5f24848df0174c13bfbbff37bb08a5a Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期二, 21 七月 2026 15:45:30 +0800
Subject: [PATCH] 维护
---
src/components/MaintainComponents/UrineRoutinePanel.vue | 241 ++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 202 insertions(+), 39 deletions(-)
diff --git a/src/components/MaintainComponents/UrineRoutinePanel.vue b/src/components/MaintainComponents/UrineRoutinePanel.vue
index d8d8a26..0009c88 100644
--- a/src/components/MaintainComponents/UrineRoutinePanel.vue
+++ b/src/components/MaintainComponents/UrineRoutinePanel.vue
@@ -29,7 +29,6 @@
border
style="width: 100%"
class="medical-table"
-
:key="tableKey"
@header-dragend="handleHeaderDragEnd"
v-loading="tableLoading"
@@ -60,12 +59,49 @@
<el-table-column
v-for="(col, index) in dynamicColumns"
:key="col.key"
- :label="col.label"
:min-width="160"
:resizable="isEditing"
header-align="center"
align="center"
>
+ <!-- 鑷畾涔夊垪澶� -->
+ <template #header>
+ <div class="custom-column-header">
+ <div class="header-content" @click.stop="handleEditColumn(index)">
+ <span class="header-label">{{
+ col.label.replace("\n", " ")
+ }}</span>
+ <el-tooltip
+ v-if="col.remark"
+ :content="col.remark"
+ placement="top"
+ >
+ <i class="el-icon-info header-remark-icon"></i>
+ </el-tooltip>
+ </div>
+ <div class="header-actions" v-if="isEditing">
+ <el-tooltip content="缂栬緫鏃堕棿" placement="top">
+ <el-button
+ size="mini"
+ type="text"
+ icon="el-icon-edit"
+ class="header-btn"
+ @click.stop="handleEditColumn(index)"
+ />
+ </el-tooltip>
+ <el-tooltip content="鍒犻櫎姝ゅ垪" placement="top">
+ <el-button
+ size="mini"
+ type="text"
+ icon="el-icon-delete"
+ class="header-btn delete-btn"
+ @click.stop="handleDeleteColumnByIndex(index)"
+ />
+ </el-tooltip>
+ </div>
+ </div>
+ </template>
+
<template #default="scope">
<div class="cell-content-wrapper">
<template v-if="scope.row.type === 'select'">
@@ -412,24 +448,37 @@
methods: {
// 浠庡閮ㄦ暟鎹垵濮嬪寲缁勪欢
initFromExternalData() {
- console.log(this.internalData, "this.internalData");
+ console.log(this.internalData, "this.internalData");
- if (this.internalData.data && this.internalData.columns) {
- this.tableData = this.internalData.data.map(item => ({
- ...item,
- values:
- item.values || new Array(this.internalData.columns.length).fill("")
- }));
- this.dynamicColumns = [...this.internalData.columns];
- } else {
- this.initTableData();
- }
+ if (this.internalData.data && this.internalData.columns) {
+ // 鑾峰彇鏈�鏂扮殑椤圭洰瀹氫箟锛堝惈浣犲垰鏀圭殑鐧界粏鑳� number 绫诲瀷锛�
+ const latestItems = this.getMedicalItems();
- // 鍒濆鍖栭檮浠�
- if (this.internalData.attachments) {
- this.attachments = [...this.internalData.attachments];
- }
- },
+ this.tableData = this.internalData.data.map(item => {
+ // 鎵惧埌瀵瑰簲鐨勬渶鏂板畾涔�
+ const latestItem = latestItems.find(
+ l => l.itemName === item.itemName
+ );
+
+ return {
+ ...item, // 鉁� 鍏堟妸鑰佹暟鎹睍寮�锛堝惈 values銆佹棫 type 绛夛級
+ ...latestItem, // 鉁� 鍐嶇敤鏈�鏂板畾涔夎鐩栵紙寮哄埗鏇存柊 type銆乷ptions銆乽nit 绛夛級
+ values:
+ item.values ||
+ new Array(this.internalData.columns.length).fill("")
+ };
+ });
+
+ this.dynamicColumns = [...this.internalData.columns];
+ } else {
+ this.initTableData();
+ }
+
+ // 鍒濆鍖栭檮浠�
+ if (this.internalData.attachments) {
+ this.attachments = [...this.internalData.attachments];
+ }
+},
// 鍒濆鍖栭粯璁よ〃鏍兼暟鎹�
initTableData() {
@@ -513,15 +562,13 @@
},
{
itemName: "鐧界粏鑳�",
- type: "select",
+ type: "number",
required: true,
- options: [
- { value: "-", label: "闃存��(-)" },
- { value: "+", label: "闃虫��(+)" },
- { value: "++", label: "闃虫��(++)" },
- { value: "+++", label: "闃虫��(+++)" }
- ],
- reference: "姝e父涓洪槾鎬�(-)"
+ unit: "/渭L",
+ reference: "0-385",
+ min: 0,
+ max: 385,
+ placeholder: "0-385"
},
{
itemName: "绾㈢粏鑳�",
@@ -577,15 +624,19 @@
});
},
- editColumn(index) {
+ handleEditColumn(index) {
+ if (!this.isEditing) return;
this.editingColumnIndex = index;
const column = this.dynamicColumns[index];
this.columnForm = {
- date: column.date,
- time: column.time,
+ date: column.date || "",
+ time: column.time || "",
remark: column.remark || ""
};
this.columnDialogVisible = true;
+ this.$nextTick(() => {
+ this.$refs.columnFormU && this.$refs.columnFormU.clearValidate();
+ });
},
confirmAddColumn() {
@@ -598,6 +649,7 @@
this.saveLoading = true;
if (this.editingColumnIndex !== null) {
+ // 缂栬緫鐜版湁鍒�
const column = this.dynamicColumns[this.editingColumnIndex];
column.label = `${this.columnForm.date}\n${this.columnForm.time}`;
column.date = this.columnForm.date;
@@ -605,6 +657,7 @@
column.remark = this.columnForm.remark;
this.$message.success("鏃堕棿鐐逛慨鏀规垚鍔�");
} else {
+ // 鏂板鍒�
const newColumn = {
label: `${this.columnForm.date}\n${this.columnForm.time}`,
key: `time${Date.now()}`,
@@ -612,7 +665,6 @@
time: this.columnForm.time,
remark: this.columnForm.remark
};
- this.internalData.columns.push(newColumn);
this.dynamicColumns.push(newColumn);
this.tableData.forEach(row => {
@@ -631,21 +683,62 @@
handleDeleteColumn() {
if (this.editingColumnIndex !== null) {
- this.$confirm("纭畾瑕佸垹闄よ繖涓椂闂寸偣鍚楋紵", "鎻愮ず", {
- confirmButtonText: "纭畾",
+ this.$confirm(
+ `纭畾瑕佸垹闄ゃ��${this.dynamicColumns[
+ this.editingColumnIndex
+ ].label.replace("\n", " ")}銆嶈繖涓椂闂寸偣鐨勬墍鏈夋暟鎹悧锛焋,
+ "鍒犻櫎纭",
+ {
+ confirmButtonText: "纭畾鍒犻櫎",
+ cancelButtonText: "鍙栨秷",
+ type: "warning"
+ }
+ )
+ .then(() => {
+ this.dynamicColumns.splice(this.editingColumnIndex, 1);
+ this.tableData.forEach(row => {
+ if (row.values && row.values.length > this.editingColumnIndex) {
+ row.values.splice(this.editingColumnIndex, 1);
+ }
+ });
+ this.columnDialogVisible = false;
+ this.tableKey += 1;
+ this.saveData();
+ this.$message.success("鏃堕棿鐐瑰垹闄ゆ垚鍔�");
+ })
+ .catch(() => {
+ // 鍙栨秷鍒犻櫎锛屼笉鍋氫换浣曟搷浣�
+ });
+ }
+ },
+
+ handleDeleteColumnByIndex(index) {
+ this.$confirm(
+ `纭畾瑕佸垹闄ゃ��${this.dynamicColumns[index].label.replace(
+ "\n",
+ " "
+ )}銆嶈繖涓椂闂寸偣鐨勬墍鏈夋暟鎹悧锛焋,
+ "鍒犻櫎纭",
+ {
+ confirmButtonText: "纭畾鍒犻櫎",
cancelButtonText: "鍙栨秷",
type: "warning"
- }).then(() => {
- this.dynamicColumns.splice(this.editingColumnIndex, 1);
+ }
+ )
+ .then(() => {
+ this.dynamicColumns.splice(index, 1);
this.tableData.forEach(row => {
- row.values.splice(this.editingColumnIndex, 1);
+ if (row.values && row.values.length > index) {
+ row.values.splice(index, 1);
+ }
});
- this.columnDialogVisible = false;
this.tableKey += 1;
this.saveData();
this.$message.success("鏃堕棿鐐瑰垹闄ゆ垚鍔�");
+ })
+ .catch(() => {
+ // 鍙栨秷鍒犻櫎锛屼笉鍋氫换浣曟搷浣�
});
- }
},
handleDialogClosed() {
@@ -921,6 +1014,68 @@
overflow-x: auto;
}
+/* 鑷畾涔夊垪澶存牱寮� */
+.custom-column-header {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 4px;
+ padding: 4px 0;
+}
+
+.header-content {
+ display: flex;
+ align-items: center;
+ gap: 4px;
+ cursor: pointer;
+ transition: color 0.2s;
+ white-space: nowrap;
+}
+
+.header-content:hover {
+ color: #409eff;
+}
+
+.header-label {
+ font-size: 13px;
+ line-height: 1.4;
+}
+
+.header-remark-icon {
+ color: #909399;
+ font-size: 12px;
+ cursor: help;
+}
+
+.header-actions {
+ display: flex;
+ gap: 4px;
+ opacity: 0;
+ transition: opacity 0.2s;
+}
+
+.custom-column-header:hover .header-actions {
+ opacity: 1;
+}
+
+.header-btn {
+ padding: 2px 4px !important;
+ font-size: 14px !important;
+}
+
+.header-btn.delete-btn {
+ color: #f56c6c !important;
+}
+
+.header-btn.delete-btn:hover {
+ color: #c0392b !important;
+}
+
+/* 缂栬緫妯″紡涓嬪缁堟樉绀烘搷浣滄寜閽� */
+.is-editing .header-actions {
+ opacity: 1;
+}
+
.item-name-cell {
display: flex;
align-items: center;
@@ -945,7 +1100,7 @@
align-items: center;
justify-content: center;
gap: 8px;
- min-height: 32px;
+ min-height: 36px;
}
.value-input {
@@ -962,7 +1117,7 @@
.value-text {
font-weight: 500;
color: #303133;
- max-width: 80px;
+ max-width: 90px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
@@ -1078,5 +1233,13 @@
flex-direction: column;
gap: 4px;
}
+
+ .custom-column-header {
+ padding: 2px 0;
+ }
+
+ .header-actions {
+ opacity: 1;
+ }
}
</style>
--
Gitblit v1.9.3