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/BloodRoutinePanel.vue | 291 +++++++++++++++++++++++++++++++++-------------------------
1 files changed, 166 insertions(+), 125 deletions(-)
diff --git a/src/views/business/maintain/components/BloodRoutinePanel.vue b/src/views/business/maintain/components/BloodRoutinePanel.vue
index 483150b..19fbf42 100644
--- a/src/views/business/maintain/components/BloodRoutinePanel.vue
+++ b/src/views/business/maintain/components/BloodRoutinePanel.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
@@ -79,13 +79,19 @@
/>
<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>
- <div v-if="scope.row.reference && scope.row.values[index]" class="validation-indicator">
+ <div
+ v-if="scope.row.reference && scope.row.values[index]"
+ class="validation-indicator"
+ >
<i
v-if="isValueValid(scope.row, scope.row.values[index])"
class="el-icon-success valid-icon"
@@ -100,20 +106,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>
<!-- 缁熻淇℃伅 -->
@@ -121,7 +113,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>
@@ -194,7 +188,11 @@
>
鍒犻櫎
</el-button>
- <el-button type="primary" @click="confirmAddColumn" :loading="saveLoading">
+ <el-button
+ type="primary"
+ @click="confirmAddColumn"
+ :loading="saveLoading"
+ >
纭畾
</el-button>
</span>
@@ -206,18 +204,19 @@
import UploadAttachment from "@/components/UploadAttachment";
export default {
- name: 'BloodRoutinePanel',
+ name: "BloodRoutinePanel",
components: {
- UploadAttachment,
+ UploadAttachment
},
props: {
isEditing: {
type: Boolean,
default: false
},
+ // 淇敼涓� Object 绫诲瀷锛屾敮鎸佸鏉傛暟鎹粨鏋�
initialData: {
- type: Array,
- default: () => []
+ type: Object,
+ default: () => ({})
},
showStatistics: {
type: Boolean,
@@ -227,33 +226,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" }]
}
};
},
@@ -262,7 +251,7 @@
let count = 0;
this.tableData.forEach(row => {
row.values.forEach(value => {
- if (value && value.toString().trim() !== '') {
+ if (value && value.toString().trim() !== "") {
count++;
}
});
@@ -275,14 +264,20 @@
}
},
watch: {
+ // 鐩戝惉 initialData 鍙樺寲锛岀‘淇濇暟鎹纭帴鏀�
+ initialData: {
+ handler(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: 'blood_routine',
- data: this.tableData,
- columns: this.dynamicColumns,
- attachments: this.attachments
- });
+ this.saveData();
}
this.$nextTick(() => {
this.forceTableLayout();
@@ -299,54 +294,105 @@
}
},
methods: {
+ // 浠庡閮ㄦ暟鎹垵濮嬪寲缁勪欢
+ initFromExternalData() {
+ 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 = [
- {
- itemName: 'WBC',
- unit: '脳10鈦�/L',
- required: true,
- reference: '3.5-9.5',
- min: 3.5,
- max: 9.5,
- type: 'number'
- },
- {
- itemName: 'NEUT%',
- unit: '%',
- required: true,
- reference: '40-75',
- min: 40,
- max: 75,
- type: 'number'
- },
- {
- itemName: 'Hb',
- unit: 'g/L',
- required: true,
- reference: '130-175',
- min: 130,
- max: 175,
- type: 'number'
- },
- {
- itemName: '琛�灏忔澘',
- unit: '脳10鈦�/L',
- required: true,
- reference: '125-350',
- min: 125,
- max: 350,
- type: 'number'
- }
- ];
+ 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('')
+ values: new Array(this.dynamicColumns.length).fill("")
}));
},
+ // 琛�甯歌妫�娴嬮」鐩畾涔�
+ getMedicalItems() {
+ return [
+ {
+ itemName: "WBC",
+ unit: "脳10鈦�/L",
+ required: true,
+ reference: "3.5-9.5",
+ min: 3.5,
+ max: 9.5,
+ type: "number"
+ },
+ {
+ itemName: "NEUT%",
+ unit: "%",
+ required: true,
+ reference: "40-75",
+ min: 40,
+ max: 75,
+ type: "number"
+ },
+ {
+ itemName: "Hb",
+ unit: "g/L",
+ required: true,
+ reference: "130-175",
+ min: 130,
+ max: 175,
+ type: "number"
+ },
+ {
+ itemName: "琛�灏忔澘",
+ unit: "脳10鈦�/L",
+ required: true,
+ reference: "125-350",
+ min: 125,
+ max: 350,
+ type: "number"
+ }
+ ];
+ },
+
+ // 淇濆瓨鏁版嵁鍒扮埗缁勪欢
+ saveData() {
+ const dataToEmit = {
+ type: "blood_routine",
+ data: this.tableData,
+ columns: this.dynamicColumns,
+ attachments: this.attachments
+ };
+
+ this.$emit("data-change", dataToEmit);
+ },
+
getPlaceholder(row) {
- return row.reference ? `鍙傝��: ${row.reference}` : '璇疯緭鍏ユ暟鍊�';
+ return row.reference ? `鍙傝��: ${row.reference}` : "璇疯緭鍏ユ暟鍊�";
},
isValueValid(row, value) {
@@ -358,9 +404,9 @@
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(() => {
@@ -374,15 +420,15 @@
this.columnForm = {
date: column.date,
time: column.time,
- remark: column.remark || ''
+ remark: column.remark || ""
};
this.columnDialogVisible = true;
},
confirmAddColumn() {
- this.$refs.columnFormB.validate((valid) => {
+ this.$refs.columnFormB.validate(valid => {
if (!valid) {
- this.$message.warning('璇峰畬鍠勬椂闂寸偣淇℃伅');
+ this.$message.warning("璇峰畬鍠勬椂闂寸偣淇℃伅");
return;
}
@@ -395,10 +441,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()}`,
@@ -407,11 +452,13 @@
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;
@@ -422,10 +469,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 => {
@@ -433,7 +480,7 @@
});
this.columnDialogVisible = false;
this.tableKey += 1;
- this.$message.success('鏃堕棿鐐瑰垹闄ゆ垚鍔�');
+ this.$message.success("鏃堕棿鐐瑰垹闄ゆ垚鍔�");
});
}
},
@@ -441,9 +488,9 @@
handleDialogClosed() {
this.editingColumnIndex = null;
this.columnForm = {
- date: '',
- time: '',
- remark: ''
+ date: "",
+ time: "",
+ remark: ""
};
this.$refs.columnFormB && this.$refs.columnFormB.clearValidate();
},
@@ -453,26 +500,22 @@
},
handleValueChange(row, columnIndex) {
- this.$emit('data-change', {
- type: 'blood_routine',
- data: this.tableData,
- columns: this.dynamicColumns
- });
+ this.saveData();
},
handleAttachmentChange(fileList) {
this.attachments = fileList;
- this.$emit('attachment-change', {
- type: 'blood_routine',
+ this.$emit("attachment-change", {
+ type: "blood_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"));
}
});
},
@@ -496,7 +539,13 @@
}
},
mounted() {
- this.initTableData();
+ // 纭繚缁勪欢姝g‘鎸傝浇鍚庡垵濮嬪寲鏁版嵁
+ this.$nextTick(() => {
+ if (Object.keys(this.internalData).length === 0) {
+ this.initTableData();
+ }
+ this.forceTableLayout();
+ });
}
};
</script>
@@ -681,13 +730,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