From 475a352a4bfd7ac3a81e8c7c92d3bb64e2e01037 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期五, 27 二月 2026 15:48:37 +0800
Subject: [PATCH] 青岛维护提交
---
src/views/business/maintain/components/UrineRoutinePanel.vue | 333 +++++++++++++++++++++++++++++++-----------------------
1 files changed, 191 insertions(+), 142 deletions(-)
diff --git a/src/views/business/maintain/components/UrineRoutinePanel.vue b/src/views/business/maintain/components/UrineRoutinePanel.vue
index b548a04..541158f 100644
--- a/src/views/business/maintain/components/UrineRoutinePanel.vue
+++ b/src/views/business/maintain/components/UrineRoutinePanel.vue
@@ -43,7 +43,7 @@
>
<template #default="scope">
<div class="item-name-cell">
- <span :class="{'required-item': scope.row.required}">
+ <span :class="{ 'required-item': scope.row.required }">
{{ scope.row.itemName }}
</span>
<el-tooltip
@@ -85,8 +85,12 @@
:value="option.value"
/>
</el-select>
- <span v-else class="value-text" :title="getSelectLabel(scope.row, index)">
- {{ getSelectLabel(scope.row, index) || '-' }}
+ <span
+ v-else
+ class="value-text"
+ :title="getSelectLabel(scope.row, index)"
+ >
+ {{ getSelectLabel(scope.row, index) || "-" }}
</span>
</template>
@@ -102,9 +106,12 @@
/>
<div v-else class="value-display-container">
<span class="value-text" :title="scope.row.values[index]">
- {{ scope.row.values[index] || '-' }}
+ {{ scope.row.values[index] || "-" }}
</span>
- <span v-if="scope.row.values[index] && scope.row.unit" class="unit-text">
+ <span
+ v-if="scope.row.values[index] && scope.row.unit"
+ class="unit-text"
+ >
{{ scope.row.unit }}
</span>
</div>
@@ -112,20 +119,6 @@
</div>
</template>
</el-table-column>
-
- <!-- <el-table-column
- v-if="isEditing"
- label="鎿嶄綔"
- width="120"
- fixed="right"
- class-name="leave-alone"
- >
- <template #default>
- <el-button link type="primary" @click="addColumn" size="small">
- 鏂板鍒�
- </el-button>
- </template>
- </el-table-column> -->
</el-table>
<!-- 缁熻淇℃伅 -->
@@ -133,7 +126,9 @@
<el-card shadow="never">
<div class="stats-content">
<span class="stats-title">鏁版嵁缁熻:</span>
- <span class="stats-item">鎬昏褰曟暟: {{ dynamicColumns.length }} 涓椂闂寸偣</span>
+ <span class="stats-item"
+ >鎬昏褰曟暟: {{ dynamicColumns.length }} 涓椂闂寸偣</span
+ >
<span class="stats-item">宸插~鍐�: {{ filledCount }} 椤�</span>
<span class="stats-item">瀹屾垚搴�: {{ completionRate }}%</span>
</div>
@@ -145,7 +140,9 @@
<div class="attachment-header">
<i class="el-icon-paperclip"></i>
<span class="attachment-title">闄勪欢涓婁紶</span>
- <span class="attachment-tip">鏀寔涓婁紶灏垮父瑙勬楠屾姤鍛婂崟绛夋枃浠� (鏈�澶�10涓�)</span>
+ <span class="attachment-tip"
+ >鏀寔涓婁紶灏垮父瑙勬楠屾姤鍛婂崟绛夋枃浠� (鏈�澶�10涓�)</span
+ >
</div>
<upload-attachment
:file-list="attachments"
@@ -206,7 +203,11 @@
>
鍒犻櫎
</el-button>
- <el-button type="primary" @click="confirmAddColumn" :loading="saveLoading">
+ <el-button
+ type="primary"
+ @click="confirmAddColumn"
+ :loading="saveLoading"
+ >
纭畾
</el-button>
</span>
@@ -218,18 +219,19 @@
import UploadAttachment from "@/components/UploadAttachment";
export default {
- name: 'UrineRoutinePanel',
+ name: "UrineRoutinePanel",
components: {
- UploadAttachment,
+ UploadAttachment
},
props: {
isEditing: {
type: Boolean,
default: false
},
+ // 淇敼涓� Object 绫诲瀷锛屾敮鎸佸鏉傛暟鎹粨鏋�
initialData: {
- type: Array,
- default: () => []
+ type: Object,
+ default: () => ({})
},
showStatistics: {
type: Boolean,
@@ -239,33 +241,23 @@
data() {
return {
tableData: [],
- dynamicColumns: [
- {
- label: '2024-12-27\n08:00',
- key: 'time1',
- date: '2024-12-27',
- time: '08:00',
- remark: '鏅ㄥ翱妫�娴�'
- }
- ],
+ dynamicColumns: [],
attachments: [],
columnDialogVisible: false,
columnForm: {
- date: '',
- time: '',
- remark: ''
+ date: "",
+ time: "",
+ remark: ""
},
editingColumnIndex: null,
tableKey: 0,
tableLoading: false,
saveLoading: false,
+ // 鍐呴儴鏁版嵁鐘舵��
+ internalData: {},
columnRules: {
- date: [
- { required: true, message: '璇烽�夋嫨鏃ユ湡', trigger: 'change' }
- ],
- time: [
- { required: true, message: '璇烽�夋嫨鏃堕棿', trigger: 'change' }
- ]
+ date: [{ required: true, message: "璇烽�夋嫨鏃ユ湡", trigger: "change" }],
+ time: [{ required: true, message: "璇烽�夋嫨鏃堕棿", trigger: "change" }]
}
};
},
@@ -274,7 +266,7 @@
let count = 0;
this.tableData.forEach(row => {
row.values.forEach(value => {
- if (value && value.toString().trim() !== '') {
+ if (value && value.toString().trim() !== "") {
count++;
}
});
@@ -287,14 +279,22 @@
}
},
watch: {
+ // 鐩戝惉 initialData 鍙樺寲锛岀‘淇濇暟鎹纭帴鏀�
+ initialData: {
+ handler(newData) {
+ console.log(newData);
+
+ if (newData && Object.keys(newData).length > 0) {
+ this.internalData = { ...newData };
+ this.initFromExternalData();
+ }
+ },
+ immediate: true,
+ deep: true
+ },
isEditing(newVal) {
if (!newVal) {
- this.$emit('data-change', {
- type: 'urine_routine',
- data: this.tableData,
- columns: this.dynamicColumns,
- attachments: this.attachments
- });
+ this.saveData();
}
this.$nextTick(() => {
this.forceTableLayout();
@@ -311,114 +311,168 @@
}
},
methods: {
- initTableData() {
- const medicalItems = [
+ // 浠庡閮ㄦ暟鎹垵濮嬪寲缁勪欢
+ initFromExternalData() {
+ 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.attachments) {
+ this.attachments = [...this.internalData.attachments];
+ }
+ },
+
+ // 鍒濆鍖栭粯璁よ〃鏍兼暟鎹�
+ initTableData() {
+ const medicalItems = this.getMedicalItems();
+
+ // 濡傛灉娌℃湁鍔ㄦ�佸垪锛屽垵濮嬪寲榛樿鍒�
+ if (this.dynamicColumns.length === 0) {
+ this.dynamicColumns = [
+ {
+ label: `${new Date().toISOString().split("T")[0]}\n08:00`,
+ key: "time1",
+ date: new Date().toISOString().split("T")[0],
+ time: "08:00",
+ remark: "鏅ㄥ翱妫�娴�"
+ }
+ ];
+ }
+
+ this.tableData = medicalItems.map(item => ({
+ ...item,
+ values: new Array(this.dynamicColumns.length).fill("")
+ }));
+ },
+
+ // 灏垮父瑙勬娴嬮」鐩畾涔�
+ getMedicalItems() {
+ return [
{
- itemName: '灏块噺',
- type: 'number',
+ itemName: "灏块噺",
+ type: "number",
required: true,
- unit: 'ml/h',
- reference: '姝e父鑼冨洿瑙嗘儏鍐佃�屽畾'
+ unit: "ml/h",
+ reference: "姝e父鑼冨洿瑙嗘儏鍐佃�屽畾"
},
{
- itemName: '棰滆壊',
- type: 'select',
+ itemName: "棰滆壊",
+ type: "select",
required: true,
options: [
- { value: '娣¢粍鑹�', label: '娣¢粍鑹�' },
- { value: '榛勮壊', label: '榛勮壊' },
- { value: '娣遍粍鑹�', label: '娣遍粍鑹�' },
- { value: '绾㈣壊', label: '绾㈣壊' },
- { value: '鐧借壊', label: '鐧借壊' },
- { value: '鍏朵粬', label: '鍏朵粬' }
+ { value: "娣¢粍鑹�", label: "娣¢粍鑹�" },
+ { value: "榛勮壊", label: "榛勮壊" },
+ { value: "娣遍粍鑹�", label: "娣遍粍鑹�" },
+ { value: "绾㈣壊", label: "绾㈣壊" },
+ { value: "鐧借壊", label: "鐧借壊" },
+ { value: "鍏朵粬", label: "鍏朵粬" }
]
},
{
- itemName: '澶栬',
- type: 'select',
+ itemName: "澶栬",
+ type: "select",
required: false,
options: [
- { value: '娓呬寒', label: '娓呬寒' },
- { value: '寰祳', label: '寰祳' },
- { value: '娴戞祳', label: '娴戞祳' },
- { value: '娌夋穩', label: '娌夋穩' },
- { value: '鍏朵粬', label: '鍏朵粬' }
+ { value: "娓呬寒", label: "娓呬寒" },
+ { value: "寰祳", label: "寰祳" },
+ { value: "娴戞祳", label: "娴戞祳" },
+ { value: "娌夋穩", label: "娌夋穩" },
+ { value: "鍏朵粬", label: "鍏朵粬" }
]
},
{
- itemName: '灏胯泲鐧�',
- type: 'select',
+ itemName: "灏胯泲鐧�",
+ type: "select",
required: true,
options: [
- { value: '-', label: '闃存��(-)' },
- { value: '卤', label: '寰噺(卤)' },
- { value: '+', label: '闃虫��(+)' },
- { value: '++', label: '闃虫��(++)' },
- { value: '+++', label: '闃虫��(+++)' }
+ { value: "-", label: "闃存��(-)" },
+ { value: "卤", label: "寰噺(卤)" },
+ { value: "+", label: "闃虫��(+)" },
+ { value: "++", label: "闃虫��(++)" },
+ { value: "+++", label: "闃虫��(+++)" }
],
- reference: '姝e父涓洪槾鎬�(-)'
+ reference: "姝e父涓洪槾鎬�(-)"
},
{
- itemName: 'pH鍊�',
- type: 'number',
+ itemName: "pH鍊�",
+ type: "number",
required: true,
- placeholder: '4.5-8.0',
- unit: '',
- reference: '4.5-8.0',
+ placeholder: "4.5-8.0",
+ unit: "",
+ reference: "4.5-8.0",
min: 4.5,
max: 8.0
},
{
- itemName: '鐧界粏鑳�',
- type: 'select',
+ itemName: "鐧界粏鑳�",
+ type: "select",
required: true,
options: [
- { value: '-', label: '闃存��(-)' },
- { value: '+', label: '闃虫��(+)' },
- { value: '++', label: '闃虫��(++)' },
- { value: '+++', label: '闃虫��(+++)' }
+ { value: "-", label: "闃存��(-)" },
+ { value: "+", label: "闃虫��(+)" },
+ { value: "++", label: "闃虫��(++)" },
+ { value: "+++", label: "闃虫��(+++)" }
],
- reference: '姝e父涓洪槾鎬�(-)'
+ reference: "姝e父涓洪槾鎬�(-)"
},
{
- itemName: '绾㈢粏鑳�',
- type: 'number',
+ itemName: "绾㈢粏鑳�",
+ type: "number",
required: true,
- unit: '/渭L',
- reference: '0-9.2',
+ unit: "/渭L",
+ reference: "0-9.2",
min: 0,
max: 9.2
},
{
- itemName: '缁嗚弻',
- type: 'number',
+ itemName: "缁嗚弻",
+ type: "number",
required: true,
- unit: '/渭L',
- reference: '0-385',
+ unit: "/渭L",
+ reference: "0-385",
min: 0,
max: 385
}
];
+ },
- this.tableData = medicalItems.map(item => ({
- ...item,
- values: new Array(this.dynamicColumns.length).fill('')
- }));
+ // 淇濆瓨鏁版嵁鍒扮埗缁勪欢
+ saveData() {
+ const dataToEmit = {
+ type: "urine_routine",
+ data: this.tableData,
+ columns: this.dynamicColumns,
+ attachments: this.attachments
+ };
+ this.$emit("data-change", dataToEmit);
},
getSelectLabel(row, columnIndex) {
- if (!row.options || !row.values[columnIndex]) return row.values[columnIndex];
- const option = row.options.find(opt => opt.value === row.values[columnIndex]);
+ if (!row.options || !row.values[columnIndex])
+ return row.values[columnIndex];
+ const option = row.options.find(
+ opt => opt.value === row.values[columnIndex]
+ );
return option ? option.label : row.values[columnIndex];
},
addColumn() {
this.editingColumnIndex = null;
this.columnForm = {
- date: new Date().toISOString().split('T')[0],
- time: '08:00',
- remark: ''
+ date: new Date().toISOString().split("T")[0],
+ time: "08:00",
+ remark: ""
};
this.columnDialogVisible = true;
this.$nextTick(() => {
@@ -432,15 +486,15 @@
this.columnForm = {
date: column.date,
time: column.time,
- remark: column.remark || ''
+ remark: column.remark || ""
};
this.columnDialogVisible = true;
},
confirmAddColumn() {
- this.$refs.columnFormU.validate((valid) => {
+ this.$refs.columnFormU.validate(valid => {
if (!valid) {
- this.$message.warning('璇峰畬鍠勬椂闂寸偣淇℃伅');
+ this.$message.warning("璇峰畬鍠勬椂闂寸偣淇℃伅");
return;
}
@@ -453,10 +507,9 @@
column.date = this.columnForm.date;
column.time = this.columnForm.time;
column.remark = this.columnForm.remark;
- this.$message.success('鏃堕棿鐐逛慨鏀规垚鍔�');
+ this.$message.success("鏃堕棿鐐逛慨鏀规垚鍔�");
} else {
// 鏂板鍒�
- const newIndex = this.dynamicColumns.length + 1;
const newColumn = {
label: `${this.columnForm.date}\n${this.columnForm.time}`,
key: `time${Date.now()}`,
@@ -464,12 +517,14 @@
time: this.columnForm.time,
remark: this.columnForm.remark
};
+ this.internalData.columns.push(newColumn);
this.dynamicColumns.push(newColumn);
this.tableData.forEach(row => {
- row.values.push('');
+ if (!row.values) row.values = [];
+ row.values.push("");
});
- this.$message.success('鏃堕棿鐐规坊鍔犳垚鍔�');
+ this.$message.success("鏃堕棿鐐规坊鍔犳垚鍔�");
}
this.columnDialogVisible = false;
@@ -480,10 +535,10 @@
handleDeleteColumn() {
if (this.editingColumnIndex !== null) {
- this.$confirm('纭畾瑕佸垹闄よ繖涓椂闂寸偣鍚楋紵', '鎻愮ず', {
- confirmButtonText: '纭畾',
- cancelButtonText: '鍙栨秷',
- type: 'warning'
+ this.$confirm("纭畾瑕佸垹闄よ繖涓椂闂寸偣鍚楋紵", "鎻愮ず", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning"
}).then(() => {
this.dynamicColumns.splice(this.editingColumnIndex, 1);
this.tableData.forEach(row => {
@@ -491,7 +546,7 @@
});
this.columnDialogVisible = false;
this.tableKey += 1;
- this.$message.success('鏃堕棿鐐瑰垹闄ゆ垚鍔�');
+ this.$message.success("鏃堕棿鐐瑰垹闄ゆ垚鍔�");
});
}
},
@@ -499,9 +554,9 @@
handleDialogClosed() {
this.editingColumnIndex = null;
this.columnForm = {
- date: '',
- time: '',
- remark: ''
+ date: "",
+ time: "",
+ remark: ""
};
this.$refs.columnFormU && this.$refs.columnFormU.clearValidate();
},
@@ -511,26 +566,22 @@
},
handleValueChange(row, columnIndex) {
- this.$emit('data-change', {
- type: 'urine_routine',
- data: this.tableData,
- columns: this.dynamicColumns
- });
+ this.saveData();
},
handleAttachmentChange(fileList) {
this.attachments = fileList;
- this.$emit('attachment-change', {
- type: 'urine_routine',
+ this.$emit("attachment-change", {
+ type: "urine_routine",
attachments: fileList
});
},
forceTableLayout() {
this.$nextTick(() => {
- const table = this.$el.querySelector('.el-table');
+ const table = this.$el.querySelector(".el-table");
if (table) {
- window.dispatchEvent(new Event('resize'));
+ window.dispatchEvent(new Event("resize"));
}
});
},
@@ -554,7 +605,13 @@
}
},
mounted() {
- this.initTableData();
+ // 纭繚缁勪欢姝g‘鎸傝浇鍚庡垵濮嬪寲鏁版嵁
+ this.$nextTick(() => {
+ if (Object.keys(this.internalData).length === 0) {
+ this.initTableData();
+ }
+ this.forceTableLayout();
+ });
}
};
</script>
@@ -739,13 +796,5 @@
flex-direction: column;
gap: 4px;
}
-}
-
-/* 鍔ㄧ敾鏁堟灉 */
-.fade-enter-active, .fade-leave-active {
- transition: opacity 0.3s;
-}
-.fade-enter, .fade-leave-to {
- opacity: 0;
}
</style>
--
Gitblit v1.9.3