From 2475c65a3c091cee4fe48f49e0f53697403750df Mon Sep 17 00:00:00 2001
From: Your Name <123456>
Date: 星期三, 17 八月 2022 19:55:34 +0800
Subject: [PATCH] 冲突

---
 src/components/equipmentDailog/Dailog.vue |   90 ++++++++++++++++++++++++++++++---------------
 1 files changed, 60 insertions(+), 30 deletions(-)

diff --git a/src/components/equipmentDailog/Dailog.vue b/src/components/equipmentDailog/Dailog.vue
index c75400c..230d038 100644
--- a/src/components/equipmentDailog/Dailog.vue
+++ b/src/components/equipmentDailog/Dailog.vue
@@ -324,22 +324,8 @@
 				</el-table>
 			</el-tab-pane>
 			<el-tab-pane label="保养维修标准" name="six" v-if="Dailogtype">
-				<el-upload
-					v-model:file-list="fileList"
-					class="upload-demo"
-					action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15"
-					multiple
-					:on-preview="handlePreview"
-					:on-remove="handleRemove"
-					:before-remove="beforeRemove"
-					:limit="3"
-					:on-exceed="handleExceed"
-				>
-					<el-button type="primary">点击上传</el-button>
-					<template #tip>
-						<div class="el-upload__tip"></div>
-					</template>
-				</el-upload>
+				<uploaderFile :fileList="fileList" :systemName="'EQUIPMENT'" :disabled="disabled"
+							  @successUploader="successUploader"></uploaderFile>
 			</el-tab-pane>
 		</el-tabs>
 		<template #footer>
@@ -374,8 +360,10 @@
 import { facilityManagementApi } from '/@/api/facilityManagement';
 import { goalManagementApi } from '/@/api/goalManagement';
 import { deepClone } from '/@/utils/other';
+import uploaderFile from '/@/components/uploaderFile/index.vue';
 export default defineComponent({
-	components: { categoryDailog, regionDailog, DailogSearchUser, maintenanceDailog, detectDailog, repairDailog, standardDailog },
+	components: { categoryDailog, regionDailog, DailogSearchUser, maintenanceDailog,
+		detectDailog, repairDailog, standardDailog,uploaderFile },
 	setup(props, { emit }) {
 		const dialogVisible = ref(false);
 		const ruleFormRef = ref<FormInstance>();
@@ -415,9 +403,6 @@
 			repairStatus: '',
 
 			takecareStardardeDetailList: [
-				{
-					filePath: '123',
-				},
 			],
 
 			nextCheckDate: '',
@@ -528,11 +513,61 @@
 					.then((res) => {
 						if (res.data.code == 200) {
 							form.value = res.data.data;
+
+							//初始化日期格式
+							form.value.actualDestoryDate = timeC(form.value.actualDestoryDate);
+							form.value.actualRecoveryDate = timeC(form.value.actualRecoveryDate);
+							form.value.actualStopDate = timeC(form.value.actualStopDate);
+							form.value.destorySubmitDate = timeC(form.value.destorySubmitDate);
+							form.value.nextCheckDate = timeC(form.value.nextCheckDate);
+							form.value.nextTakecareDate = timeC(form.value.nextTakecareDate);
+							form.value.nextTestDate = timeC(form.value.nextTestDate);
+							form.value.previousCheckDate = timeC(form.value.previousCheckDate);
+							form.value.previousTakecareDate = timeC(form.value.previousTakecareDate);
+							form.value.previousTestDate = timeC(form.value.previousTestDate);
+							form.value.produceTime = timeC(form.value.produceTime);
+							form.value.recoverySubmitDate = timeC(form.value.recoverySubmitDate);
+							form.value.stopSubmitDate = timeC(form.value.stopSubmitDate);
+							form.value.useDate = timeC(form.value.useDate);
+
+							fileList.value = (res.data.data.takecareStardardeDetailList?res.data.data.takecareStardardeDetailList:[])
+							initFileListData()
 						} else {
 							ElMessage.error(res.data.msg);
 						}
 					});
 		};
+		const timeC = (timestamp: any) => {
+			let a = new Date(timestamp).getTime();
+			const date = new Date(a);
+			const Y = date.getFullYear() + '-';
+			const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
+			const D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + '  ';
+			const h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
+			const m = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
+			const s = date.getSeconds(); // 秒
+			const dateString = Y + M + D + h + m +`:${s}`;
+			// console.log('dateString', dateString); // > dateString 2021-07-06 14:23
+			return dateString;
+		};
+		const initFileListData = async () => {
+			for(var a = 0;a<fileList.value.length;a++){
+				fileList.value[a].name = fileList.value[a].filePath
+			}
+		}
+		// 上传成功组装数据
+		const successUploader = (list) =>{
+			fileList.value = list
+			const formFileList = []
+			for(var a = 0;a<fileList.value.length;a++){
+				formFileList.push(
+						{
+							filePath:fileList.value[a].fileName
+						}
+				)
+			}
+			form.value.takecareStardardeDetailList = formFileList
+		}
 		const rules = reactive<FormRules>({
 			qName: [],
 			positionNum: [],
@@ -628,6 +663,7 @@
 			form.value.testDetailList = [];
 			form.value.repaireDetailList = [];
 			form.value.checkStandardeDetailList = [];
+			fileList.value = []
 			dialogVisible.value = false;
 		};
 		const activeName = ref('first');
@@ -665,16 +701,7 @@
 			standardShow.value.openDailog(title, data);
 		};
 		// 上传
-		const fileList = ref<UploadUserFile[]>([
-			{
-				name: 'element-plus-logo.svg',
-				url: 'https://element-plus.org/images/element-plus-logo.svg',
-			},
-			{
-				name: 'element-plus-logo2.svg',
-				url: 'https://element-plus.org/images/element-plus-logo.svg',
-			},
-		]);
+		const fileList = ref([]);
 
 		const handleRemove: UploadProps['onRemove'] = (file, uploadFiles) => {
 			console.log(file, uploadFiles);
@@ -845,6 +872,9 @@
 			FullScreen,
 			timeDate,
 			ruleFormRef,
+			successUploader,
+			initFileListData,
+			timeC
 		};
 	},
 });

--
Gitblit v1.9.2