From f5e6487a78789ee372a8c6458bfd0cb740d6a0e8 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期三, 13 五月 2026 22:13:58 +0800
Subject: [PATCH] 青岛维护
---
src/components/assessInfoComponents/OrganAssessmentForm.vue | 138 ++++++++++++++++++++++++++++++++++++---------
1 files changed, 110 insertions(+), 28 deletions(-)
diff --git a/src/components/assessInfoComponents/OrganAssessmentForm.vue b/src/components/assessInfoComponents/OrganAssessmentForm.vue
index a3be60e..bccb24d 100644
--- a/src/components/assessInfoComponents/OrganAssessmentForm.vue
+++ b/src/components/assessInfoComponents/OrganAssessmentForm.vue
@@ -1,6 +1,20 @@
<template>
<div class="organ-assessment-form">
<el-form :model="formData" label-width="120px">
+ <!-- 娣诲姞璇勪及鏃堕棿瀛楁 -->
+ <el-form-item label="璇勪及鏃堕棿">
+ <el-date-picker
+ v-model="formData.assessmentTime"
+ type="datetime"
+ placeholder="閫夋嫨璇勪及鏃堕棿"
+ format="yyyy-MM-dd HH:mm:ss"
+ value-format="yyyy-MM-dd HH:mm:ss"
+ :default-value="new Date()"
+ style="width: 100%"
+ />
+ </el-form-item>
+
+ <!-- 鍙妯″紡涓嬫樉绀鸿瘎浼版椂闂� -->
<el-form-item label="鍔熻兘鐘舵��">
<el-select v-model="formData.functionStatus">
<el-option label="姝e父" value="1" />
@@ -77,7 +91,7 @@
</el-table-column>
<el-table-column label="涓婁紶鏃堕棿" width="160">
<template slot-scope="scope">
- <span>{{ formatDateTime(scope.row.uploadTime) }}</span>
+ <span>{{ scope.row.uploadTime }}</span>
</template>
</el-table-column>
<el-table-column label="鏂囦欢澶у皬" width="100">
@@ -179,6 +193,7 @@
formData: {
functionStatus: "",
assessmentOpinion: "",
+ assessmentTime: "", // 鏂板璇勪及鏃堕棿瀛楁
attachments: []
},
// 棰勮鐩稿叧
@@ -215,6 +230,14 @@
},
created() {
this.initData();
+ // 濡傛灉璇勪及鏃堕棿涓虹┖锛岃缃粯璁ゅ��
+ if (!this.formData.assessmentTime) {
+ this.$set(
+ this.formData,
+ "assessmentTime",
+ this.getDefaultAssessmentTime()
+ );
+ }
},
methods: {
// 鍒濆鍖栨暟鎹�
@@ -223,6 +246,7 @@
this.formData = {
functionStatus: "",
assessmentOpinion: "",
+ assessmentTime: this.getDefaultAssessmentTime(),
attachments: []
};
this.attachmentFileList = [];
@@ -241,14 +265,26 @@
) {
this.currentAssessment = assessData[this.assessmentIndex];
- // 娣辨嫹璐濇暟鎹紝閬垮厤淇敼鍘熷鏁版嵁
+ // 娣辨嫹璐濇暟鎹�
const assessmentCopy = JSON.parse(
JSON.stringify(this.currentAssessment)
);
+ // 澶勭悊璇勪及鏃堕棿
+ let assessmentTime = assessmentCopy.assessmentTime;
+
+ // 濡傛灉鏃堕棿涓嶆槸鏈夋晥鐨勬棩鏈熷瓧绗︿覆锛屼娇鐢ㄩ粯璁ゅ��
+ if (!this.isValidDate(assessmentTime)) {
+ assessmentTime = this.getDefaultAssessmentTime();
+ } else {
+ // 纭繚鏃堕棿鏍煎紡姝g‘
+ assessmentTime = this.formatDateForPicker(assessmentTime);
+ }
+
this.formData = {
functionStatus: assessmentCopy.functionStatus || "",
assessmentOpinion: assessmentCopy.assessmentOpinion || "",
+ assessmentTime: assessmentTime, // 澶勭悊鍚庣殑鏃堕棿
attachments: Array.isArray(assessmentCopy.attachments)
? [...assessmentCopy.attachments]
: []
@@ -272,17 +308,64 @@
this.resetForm();
}
},
+ // 楠岃瘉鏃ユ湡鏄惁鏈夋晥
+ isValidDate(dateString) {
+ if (!dateString) return false;
+ try {
+ const date = new Date(dateString);
+ return !isNaN(date.getTime()) && dateString.trim() !== "";
+ } catch (error) {
+ return false;
+ }
+ },
+
+ // 涓烘棩鏈熼�夋嫨鍣ㄦ牸寮忓寲鏃ユ湡
+ formatDateForPicker(dateString) {
+ if (!dateString) return "";
+
+ try {
+ const date = new Date(dateString);
+ if (isNaN(date.getTime())) {
+ return this.getDefaultAssessmentTime();
+ }
+
+ // 鏍煎紡鍖栦负 yyyy-MM-dd HH:mm:ss
+ const year = date.getFullYear();
+ const month = String(date.getMonth() + 1).padStart(2, "0");
+ const day = String(date.getDate()).padStart(2, "0");
+ const hours = String(date.getHours()).padStart(2, "0");
+ const minutes = String(date.getMinutes()).padStart(2, "0");
+ const seconds = String(date.getSeconds()).padStart(2, "0");
+
+ return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
+ } catch (error) {
+ console.error("鏃ユ湡鏍煎紡鍖栭敊璇�:", error);
+ return this.getDefaultAssessmentTime();
+ }
+ },
// 閲嶇疆琛ㄥ崟
resetForm() {
this.formData = {
functionStatus: "",
assessmentOpinion: "",
+ assessmentTime: this.getDefaultAssessmentTime(), // 璁剧疆榛樿鏃堕棿
attachments: []
};
this.attachmentFileList = [];
},
+ // 鑾峰彇榛樿璇勪及鏃堕棿
+ getDefaultAssessmentTime() {
+ const now = new Date();
+ const year = now.getFullYear();
+ const month = String(now.getMonth() + 1).padStart(2, "0");
+ const day = String(now.getDate()).padStart(2, "0");
+ const hours = String(now.getHours()).padStart(2, "0");
+ const minutes = String(now.getMinutes()).padStart(2, "0");
+ const seconds = String(now.getSeconds()).padStart(2, "0");
+ return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
+ },
// 淇濆瓨璇勪及
handleSave() {
// 楠岃瘉蹇呰瀛楁
@@ -296,20 +379,31 @@
return;
}
+ if (!this.formData.assessmentTime) {
+ this.$message.warning("璇烽�夋嫨璇勪及鏃堕棿");
+ return;
+ }
+
+ // 楠岃瘉鏃堕棿鏍煎紡
+ if (!this.isValidDate(this.formData.assessmentTime)) {
+ this.$message.warning("璇勪及鏃堕棿鏍煎紡涓嶆纭紝璇烽噸鏂伴�夋嫨");
+ return;
+ }
+
// 鍑嗗淇濆瓨鐨勬暟鎹�
const saveData = {
functionStatus: this.formData.functionStatus,
assessmentOpinion: this.formData.assessmentOpinion,
+ assessmentTime: this.formData.assessmentTime,
attachments: Array.isArray(this.formData.attachments)
? [...this.formData.attachments]
: []
};
- // 娣诲姞璇勪及鑰呭拰璇勪及鏃堕棿
+ // 娣诲姞璇勪及鑰�
const assessmentData = {
...saveData,
- assessor: this.currentUser.name,
- assessmentTime: new Date().toISOString()
+ assessor: this.currentUser.name
};
console.log("鍙戦�佷繚瀛樿姹�:", assessmentData);
@@ -320,7 +414,6 @@
assessmentIndex: this.assessmentIndex
});
},
-
handleCancel() {
this.$emit("cancel");
},
@@ -369,7 +462,7 @@
/** 涓婁紶鎴愬姛澶勭悊 */
handleUploadSuccess({ file, fileList, response }) {
- console.log(response,'response');
+ console.log(response, "response");
if (response.code === 200) {
console.log(response, "涓婁紶鏁版嵁");
@@ -509,26 +602,6 @@
const sizes = ["B", "KB", "MB", "GB"];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
- },
-
- /** 鏃ユ湡鏃堕棿鏍煎紡鍖� */
- formatDateTime(dateTime) {
- if (!dateTime) return "";
-
- try {
- const date = new Date(dateTime);
- if (isNaN(date.getTime())) return dateTime;
-
- const year = date.getFullYear();
- const month = String(date.getMonth() + 1).padStart(2, "0");
- const day = String(date.getDate()).padStart(2, "0");
- const hours = String(date.getHours()).padStart(2, "0");
- const minutes = String(date.getMinutes()).padStart(2, "0");
-
- return `${year}-${month}-${day} ${hours}:${minutes}`;
- } catch (error) {
- return dateTime;
- }
}
}
};
@@ -581,7 +654,16 @@
font-size: 13px;
margin-left: 8px;
}
-
+.readonly-time {
+ font-size: 14px;
+ color: #606266;
+ font-weight: 500;
+ padding: 8px 15px;
+ background: #f5f7fa;
+ border-radius: 4px;
+ display: inline-block;
+ min-width: 200px;
+}
::v-deep .el-upload__tip {
font-size: 12px;
color: #909399;
--
Gitblit v1.9.3