From 4a68a94d5e429eca8b01a24bdbf601c0331ff73d Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期一, 09 三月 2026 17:27:51 +0800
Subject: [PATCH] 保养预览

---
 src/pages/equipmentManagement/upkeep/maintain.vue | 1502 +++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 1,237 insertions(+), 265 deletions(-)

diff --git a/src/pages/equipmentManagement/upkeep/maintain.vue b/src/pages/equipmentManagement/upkeep/maintain.vue
index c70ec14..d3b8549 100644
--- a/src/pages/equipmentManagement/upkeep/maintain.vue
+++ b/src/pages/equipmentManagement/upkeep/maintain.vue
@@ -1,298 +1,1270 @@
 <template>
-	<view class="upkeep-maintain">
-		<!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
-		<PageHeader title="鏂板淇濆吇" @back="goBack" />
-		
-		<!-- 琛ㄥ崟鍐呭 -->
-		<van-form @submit="sendForm" ref="formRef" label-width="110px" input-align="right" error-message-align="right" scroll-to-error scroll-to-error-position="center">
-			<!-- 鍩烘湰淇℃伅 -->
-			<van-cell-group title="淇濆吇淇℃伅" inset>
-				<van-field
-					v-model="form.maintenanceActuallyName"
-					label="瀹為檯淇濆吇浜�"
-					placeholder="璇疯緭鍏ュ疄闄呬繚鍏讳汉"
-					:rules="formRules.maintenanceActuallyName"
-					required
-					clearable
-				/>
-				<van-field
-					v-model="form.maintenanceActuallyTime"
-					label="瀹為檯淇濆吇鏃ユ湡"
-					placeholder="璇烽�夋嫨瀹為檯淇濆吇鏃ユ湡"
-					:rules="formRules.maintenanceActuallyTime"
-					required
-					readonly
-					@click="showDatePicker"
-					clearable
-				/>
-				<van-field
-					v-model="maintenanceResultText"
-					label="淇濆吇缁撴灉"
-					placeholder="璇烽�夋嫨淇濆吇缁撴灉"
-					:rules="formRules.maintenanceResult"
-					required
-					readonly
-					@click="showResultPicker"
-					clearable
-				/>
-			</van-cell-group>
-			
-			<!-- 鎻愪氦鎸夐挳 -->
-			<view class="footer-btns">
-				<van-button class="cancel-btn" @click="goBack">鍙栨秷</van-button>
-				<van-button class="save-btn" native-type="submit" form-type="submit" :loading="loading">淇濆瓨</van-button>
-			</view>
-		</van-form>
-
-		<!-- 鏃ユ湡閫夋嫨鍣� -->
-		<van-popup v-model:show="showDate" position="bottom">
-			<van-date-picker
-				v-model="currentDate"
-				title="閫夋嫨鏃ユ湡"
-				@confirm="onDateConfirm"
-				@cancel="showDate = false"
-			/>
-		</van-popup>
-
-		<!-- 淇濆吇缁撴灉閫夋嫨鍣� -->
-		<van-popup v-model:show="showResult" position="bottom">
-			<van-picker
-				:model-value="resultPickerValue"
-				:columns="resultColumns"
-				@confirm="onResultConfirm"
-				@cancel="showResult = false"
-			/>
-		</van-popup>
-	</view>
+  <view class="upkeep-maintain">
+    <!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
+    <PageHeader title="鏂板淇濆吇"
+                @back="goBack" />
+    <!-- 琛ㄥ崟鍐呭 -->
+    <u-form ref="formRef"
+            :model="form"
+            :rules="formRules"
+            label-width="110px"
+            :error-type="['message']">
+      <!-- 鍩烘湰淇℃伅 -->
+      <u-form-item label="瀹為檯淇濆吇浜�"
+                   prop="maintenanceActuallyName"
+                   required
+                   border-bottom>
+        <u-input v-model="form.maintenanceActuallyName"
+                 placeholder="璇疯緭鍏ュ疄闄呬繚鍏讳汉"
+                 clearable />
+      </u-form-item>
+      <u-form-item label="瀹為檯淇濆吇鏃ユ湡"
+                   prop="maintenanceActuallyTime"
+                   required
+                   border-bottom>
+        <u-input v-model="form.maintenanceActuallyTime"
+                 placeholder="璇烽�夋嫨瀹為檯淇濆吇鏃ユ湡"
+                 readonly
+                 @click="showDatePicker"
+                 clearable />
+        <template #right>
+          <u-icon name="arrow-right"
+                  @click.stop="showDatePicker" />
+        </template>
+      </u-form-item>
+      <u-form-item label="淇濆吇缁撴灉"
+                   prop="maintenanceResult"
+                   required
+                   border-bottom>
+        <u-input v-model="form.maintenanceResult"
+                 placeholder="璇疯緭鍏ヤ繚鍏荤粨鏋�"
+                 clearable />
+      </u-form-item>
+      <u-form-item label="淇濆吇鐘舵��"
+                   prop="maintenancestatusText"
+                   required
+                   border-bottom>
+        <u-input v-model="maintenancestatusText"
+                 placeholder="璇烽�夋嫨淇濆吇鐘舵��"
+                 readonly
+                 @click="showResultPicker"
+                 clearable />
+        <template #right>
+          <u-icon name="arrow-right"
+                  @click="showResultPicker" />
+        </template>
+      </u-form-item>
+      <u-form-item label="璁惧澶囦欢"
+                   prop="sparePartsIds"
+                   border-bottom>
+        <view class="spare-parts-container"
+              @click="showSparePartPicker">
+          <view v-if="selectedSpareParts.length > 0"
+                class="spare-parts-list">
+            <view v-for="(item, index) in selectedSpareParts"
+                  :key="index"
+                  class="spare-part-tag">
+              <text>{{ item.name }}</text>
+              <u-icon name="close"
+                      size="12"
+                      color="#fff"
+                      @click="removeSparePart(index)" />
+            </view>
+          </view>
+          <text v-else
+                class="placeholder">璇烽�夋嫨璁惧澶囦欢</text>
+        </view>
+        <template #right>
+          <u-icon name="arrow-right"
+                  @click="showSparePartPicker" />
+        </template>
+      </u-form-item>
+      <!-- 涓婁紶闄勪欢 -->
+      <u-form-item v-if="form.status == '1'"
+                   label="淇濆吇闄勪欢"
+                   border-bottom>
+        <view class="simple-upload-area">
+          <view class="upload-buttons">
+            <u-button type="primary"
+                      @click="chooseMedia('image')"
+                      :loading="uploading"
+                      :disabled="uploadFiles.length >= uploadConfig.limit"
+                      :customStyle="{ marginRight: '10px', flex: 1 }">
+              <u-icon name="camera"
+                      size="18"
+                      color="#fff"
+                      style="margin-right: 5px;"></u-icon>
+              {{ uploading ? '涓婁紶涓�...' : '鎷嶇収' }}
+            </u-button>
+            <!-- <u-button type="success"
+                      @click="chooseMedia('video')"
+                      :loading="uploading"
+                      :disabled="uploadFiles.length >= uploadConfig.limit"
+                      :customStyle="{ flex: 1 }">
+              <uni-icons type="videocam"
+                         name="videocam"
+                         size="18"
+                         color="#fff"
+                         style="margin-right: 5px;"></uni-icons>
+              {{ uploading ? '涓婁紶涓�...' : '鎷嶈棰�' }}
+            </u-button> -->
+          </view>
+          <!-- 涓婁紶杩涘害 -->
+          <view v-if="uploading"
+                class="upload-progress">
+            <u-line-progress :percentage="uploadProgress"
+                             :showText="true"
+                             activeColor="#409eff"></u-line-progress>
+          </view>
+          <!-- 涓婁紶鐨勬枃浠跺垪琛� -->
+          <view v-if="uploadFiles.length > 0"
+                class="file-list">
+            <view v-for="(file, index) in uploadFiles"
+                  :key="index"
+                  class="file-item">
+              <view class="file-preview-container">
+                <!-- {{formatFileUrl(file.url)}} -->
+                <image v-if="file.type === 'image' || isImageFile(file)"
+                       :src="formatFileUrl(file.url || file.tempFilePath || file.path || file.downloadUrl)"
+                       class="file-preview"
+                       mode="aspectFill" />
+                <view v-else-if="file.type === 'video'"
+                      class="video-preview">
+                  <uni-icons type="videocam"
+                             name="videocam"
+                             size="18"
+                             color="#fff"
+                             style="margin-right: 5px;"></uni-icons>
+                  <text class="video-text">瑙嗛</text>
+                </view>
+                <!-- 鍒犻櫎鎸夐挳 -->
+                <view class="delete-btn"
+                      @click="removeFile(index)">
+                  <u-icon name="close"
+                          size="12"
+                          color="#fff"></u-icon>
+                </view>
+              </view>
+              <view class="file-info">
+                <text class="file-name">{{ file.bucketFilename || file.name || (file.type === 'image' ? '鍥剧墖' : '瑙嗛')
+                  }}</text>
+                <text class="file-size">{{ formatFileSize(file.size) }}</text>
+              </view>
+            </view>
+          </view>
+          <view v-if="uploadFiles.length === 0"
+                class="empty-state">
+            <text>璇烽�夋嫨瑕佷笂浼犵殑淇濆吇鍥剧墖</text>
+          </view>
+        </view>
+      </u-form-item>
+      <!-- 鎻愪氦鎸夐挳 -->
+      <view class="footer-btns">
+        <u-button class="cancel-btn"
+                  @click="goBack">鍙栨秷</u-button>
+        <u-button class="save-btn"
+                  @click="sendForm"
+                  :loading="loading">淇濆瓨</u-button>
+      </view>
+    </u-form>
+    <!-- 鏃ユ湡閫夋嫨鍣� -->
+    <u-popup v-model="showDate"
+             mode="bottom"
+             :closeable="true">
+      <u-datetime-picker v-model="form.maintenanceActuallyTime"
+                         mode="date"
+                         title="閫夋嫨鏃ユ湡"
+                         @confirm="onDateConfirm"
+                         @cancel="showDate = false" />
+    </u-popup>
+    <!-- 淇濆吇缁撴灉閫夋嫨鍣� -->
+    <up-action-sheet :show="showResult"
+                     :actions="resultColumns"
+                     title="閫夋嫨淇濆吇缁撴灉"
+                     @select="onResultConfirm"
+                     @close="showResult = false" />
+    <!-- 璁惧澶囦欢閫夋嫨鍣� -->
+    <up-popup :show="showSparePart"
+              mode="bottom"
+              :closeable="true"
+              @close="showSparePart = false">
+      <view class="spare-part-popup">
+        <view class="popup-header">
+          <text class="popup-title">閫夋嫨璁惧澶囦欢</text>
+        </view>
+        <view class="spare-part-options">
+          <view v-for="(item, index) in sparePartOptions"
+                :key="index"
+                class="spare-part-option"
+                :class="{ 'selected': isSparePartSelected(item.id) }"
+                @click="toggleSparePartSelection(item)">
+            <text>{{ item.name }}</text>
+            <u-icon v-if="isSparePartSelected(item.id)"
+                    name="checkmark"
+                    color="#2c7be5" />
+          </view>
+        </view>
+        <up-button type="primary"
+                   size="small"
+                   :customStyle="{ borderRadius: '6px', padding: '4px 12px' }"
+                   @click="confirmSparePartSelection">纭畾</up-button>
+      </view>
+    </up-popup>
+  </view>
 </template>
 
 <script setup>
-import { ref, onMounted } from 'vue';
-import { onShow } from '@dcloudio/uni-app';
-import PageHeader from '@/components/PageHeader.vue';
-import { addMaintenance } from '@/api/equipmentManagement/upkeep';
-import useUserStore from "@/store/modules/user";
-import dayjs from "dayjs";
-import { showToast } from 'vant';
+  import { ref, onMounted } from "vue";
+  import { onShow } from "@dcloudio/uni-app";
+  import PageHeader from "@/components/PageHeader.vue";
+  import {
+    addMaintenance,
+    getSparePartsOptions,
+  } from "@/api/equipmentManagement/upkeep";
+  import useUserStore from "@/store/modules/user";
+  import dayjs from "dayjs";
+  import { formatDateToYMD } from "@/utils/ruoyi";
+  import config from "@/config";
 
-defineOptions({
-	name: "璁惧淇濆吇琛ㄥ崟",
-});
+  // 鏄剧ず鎻愮ず淇℃伅
+  const showToast = message => {
+    uni.showToast({
+      title: message,
+      icon: "none",
+    });
+  };
 
-const userStore = useUserStore();
+  defineOptions({
+    name: "璁惧淇濆吇琛ㄥ崟",
+  });
 
-// 琛ㄥ崟寮曠敤
-const formRef = ref(null);
-const loading = ref(false);
-const showDate = ref(false);
-const showResult = ref(false);
-const currentDate = ref([new Date().getFullYear(), new Date().getMonth() + 1, new Date().getDate()]);
-const resultPickerValue = ref([]);
-const maintenanceResultText = ref('');
+  const userStore = useUserStore();
 
-// 淇濆吇缁撴灉閫夐」
-const resultColumns = [
-	{ text: '瀹屽ソ', value: 1 },
-	{ text: '缁翠慨', value: 0 }
-];
+  // 琛ㄥ崟寮曠敤
+  const formRef = ref(null);
+  const loading = ref(false);
+  const showDate = ref(false);
+  const showResult = ref(false);
+  const showSparePart = ref(false);
+  const currentDate = ref([
+    new Date().getFullYear(),
+    new Date().getMonth() + 1,
+    new Date().getDate(),
+  ]);
+  const resultPickerValue = ref([]);
+  const maintenancestatusText = ref("");
+  const selectedSpareParts = ref([]);
+  const tempSelectedSpareParts = ref([]);
 
-// 琛ㄥ崟楠岃瘉瑙勫垯
-const formRules = {
-	maintenanceActuallyName: [{ required: true, trigger: "blur", message: "璇疯緭鍏ュ疄闄呬繚鍏讳汉" }],
-	maintenanceActuallyTime: [{ required: true, trigger: "change", message: "璇烽�夋嫨瀹為檯淇濆吇鏃ユ湡" }],
-	maintenanceResult: [{ required: true, trigger: "change", message: "璇烽�夋嫨淇濆吇缁撴灉" }],
-};
+  // 鏂囦欢涓婁紶鐩稿叧
+  const uploadFiles = ref([]);
+  const uploading = ref(false);
+  const uploadProgress = ref(0);
+  const number = ref(0);
 
-// 浣跨敤 ref 澹版槑琛ㄥ崟鏁版嵁
-const form = ref({
-	maintenanceActuallyName: userStore.nickName || '', // 榛樿浣跨敤褰撳墠鐢ㄦ埛鏄电О
-	maintenanceResult: undefined, // 淇濆吇缁撴灉
-	maintenanceActuallyTime: dayjs().format("YYYY-MM-DD"), // 瀹為檯淇濆吇鏃ユ湡锛堝彧鏄剧ず鏃ユ湡锛�
-});
+  // 涓婁紶閰嶇疆
+  const uploadConfig = {
+    limit: 9,
+    fileType: ["jpg", "jpeg", "png", "gif", "webp", "mp4", "mov", "avi", "wmv"],
+    maxVideoDuration: 60,
+  };
 
-// 娓呴櫎琛ㄥ崟鏍¢獙鐘舵��
-const clearValidate = () => {
-	// Vant4涓笉闇�瑕佹墜鍔ㄦ竻闄ら獙璇佺姸鎬侊紝閲嶇疆琛ㄥ崟鏃朵細鑷姩娓呴櫎
-	// formRef.value?.clearValidate(); // 鍒犻櫎杩欒
-};
+  // 涓婁紶鏂囦欢URL
+  const uploadFileUrl = ref(`${config.baseUrl}/file/upload`);
 
-// 閲嶇疆琛ㄥ崟鏁版嵁鍜屾牎楠岀姸鎬�
-const resetForm = () => {
-	form.value = {
-		maintenanceActuallyName: userStore.nickName || '',
-		maintenanceResult: undefined,
-		maintenanceActuallyTime: dayjs().format("YYYY-MM-DD"),
-	};
-	maintenanceResultText.value = '';
-};
+  // 淇濆吇缁撴灉閫夐」
+  const resultColumns = [
+    { name: "瀹岀粨", value: 1 },
+    { name: "寰呬繚鍏�", value: 0 },
+    { name: "澶辫触", value: 2 },
+  ];
 
-const resetFormAndValidate = () => {
-	resetForm();
-	// clearValidate(); // 鍒犻櫎杩欒锛孷ant4浼氳嚜鍔ㄥ鐞�
-};
+  // 琛ㄥ崟楠岃瘉瑙勫垯
+  const formRules = {
+    maintenanceActuallyName: [
+      { required: true, trigger: "blur", message: "璇疯緭鍏ュ疄闄呬繚鍏讳汉" },
+    ],
+    maintenanceActuallyTime: [
+      { required: true, trigger: "change", message: "璇烽�夋嫨瀹為檯淇濆吇鏃ユ湡" },
+    ],
+    maintenanceResult: [
+      { required: true, trigger: "change", message: "璇烽�夋嫨淇濆吇缁撴灉" },
+    ],
+  };
 
-// 鎻愪氦琛ㄥ崟
-const sendForm = async () => {
-	try {
-		// 浣跨敤Vant4鐨勬纭獙璇佹柟寮�
-		formRef.value?.validate().then(() => {
-			// 楠岃瘉閫氳繃
-			submitFormData();
-		}).catch((errors) => {
-			// 楠岃瘉澶辫触
-			showToast('璇峰~鍐欏畬鏁翠俊鎭�');
-		});
-	} catch (e) {
-		showToast('琛ㄥ崟楠岃瘉澶辫触');
-	}
-};
+  // 浣跨敤 ref 澹版槑琛ㄥ崟鏁版嵁
+  const form = ref({
+    maintenanceActuallyName: userStore.nickName || "", // 榛樿浣跨敤褰撳墠鐢ㄦ埛鏄电О
+    maintenanceResult: undefined, // 淇濆吇缁撴灉
+    maintenanceActuallyTime: dayjs().format("YYYY-MM-DD HH:mm:ss"), // 瀹為檯淇濆吇鏃ユ湡锛堝彧鏄剧ず鏃ユ湡锛�
+    sparePartsIds: undefined, // 璁惧澶囦欢ID
+  });
 
-// 鎻愪氦琛ㄥ崟鏁版嵁
-const submitFormData = async () => {
-	try {
-		loading.value = true;
-		const id = getPageId();
-		
-		if (!id) {
-			showToast('鍙傛暟閿欒');
-			loading.value = false;
-			return;
-		}
-		
-		// 鍑嗗鎻愪氦鏁版嵁锛宮aintenanceActuallyTime 鍔犱笂褰撳墠鏃跺垎绉�
-		const submitData = { ...form.value };
-		if (submitData.maintenanceActuallyTime && !submitData.maintenanceActuallyTime.includes(':')) {
-			// 濡傛灉 maintenanceActuallyTime 鍙寘鍚棩鏈燂紝娣诲姞褰撳墠鏃跺垎绉�
-			submitData.maintenanceActuallyTime = submitData.maintenanceActuallyTime + ' ' + dayjs().format('HH:mm:ss');
-		}
-		
-		const { code } = await addMaintenance({ id: id, ...submitData });
-		
-		if (code == 200) {
-			showToast('鏂板淇濆吇鎴愬姛');
-			resetFormAndValidate();
-			setTimeout(() => {
-				uni.navigateBack();
-			}, 1500);
-		} else {
-			loading.value = false;
-		}
-	} catch (e) {
-		loading.value = false;
-		showToast('鎿嶄綔澶辫触');
-	}
-};
+  // 娓呴櫎琛ㄥ崟鏍¢獙鐘舵��
+  const clearValidate = () => {
+    // uview-plus涓嶉渶瑕佹墜鍔ㄦ竻闄ら獙璇佺姸鎬侊紝閲嶇疆琛ㄥ崟鏃朵細鑷姩娓呴櫎
+  };
 
-// 杩斿洖涓婁竴椤�
-const goBack = () => {
-	uni.navigateBack();
-};
+  // 閲嶇疆琛ㄥ崟鏁版嵁鍜屾牎楠岀姸鎬�
+  const resetForm = () => {
+    form.value = {
+      maintenanceActuallyName: userStore.nickName || "",
+      maintenanceResult: undefined,
+      maintenanceActuallyTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
+      sparePartsIds: [],
+    };
+    maintenancestatusText.value = "";
+    selectedSpareParts.value = [];
+    tempSelectedSpareParts.value = [];
+  };
 
-// 鑾峰彇椤甸潰ID
-const getPageId = () => {
-	const pages = getCurrentPages();
-	const currentPage = pages[pages.length - 1];
-	const options = currentPage.options;
-	return options.id;
-};
+  const resetFormAndValidate = () => {
+    resetForm();
+    // clearValidate(); // 鍒犻櫎杩欒锛孷ant4浼氳嚜鍔ㄥ鐞�
+  };
+  // 鍒ゆ柇鏄惁涓哄浘鐗囨枃浠�
+  const isImageFile = file => {
+    // 妫�鏌ontentType瀛楁
+    if (file.contentType && file.contentType.startsWith("image/")) {
+      return true;
+    }
 
-// 鏄剧ず鏃ユ湡閫夋嫨鍣�
-const showDatePicker = () => {
-	showDate.value = true;
-};
+    // 妫�鏌ュ師鏈夌殑type瀛楁
+    if (file.type === "image") return true;
 
-// 纭鏃ユ湡閫夋嫨
-const onDateConfirm = ({ selectedValues }) => {
-	// 鍙繚瀛樺勾鏈堟棩锛屼笉鍖呭惈鏃跺垎绉�
-	form.value.maintenanceActuallyTime = selectedValues.join('-');
-	currentDate.value = selectedValues;
-	showDate.value = false;
-};
+    // 妫�鏌ユ枃浠舵墿灞曞悕
+    const name = file.bucketFilename || file.originalFilename || file.name || "";
+    const ext = name.split(".").pop()?.toLowerCase();
+    return ["jpg", "jpeg", "png", "gif", "webp"].includes(ext);
+  };
 
-// 鏄剧ず淇濆吇缁撴灉閫夋嫨鍣�
-const showResultPicker = () => {
-	showResult.value = true;
-};
+  // 鎻愪氦琛ㄥ崟
+  const sendForm = async () => {
+    console.log(form.value.sparePartsIds, "form.value.sparePartsIds");
+    try {
+      // 鎵嬪姩楠岃瘉琛ㄥ崟
+      let isValid = true;
+      let errorMessage = "";
+      if (!form.value.maintenanceActuallyName) {
+        isValid = false;
+        errorMessage = "璇疯緭鍏ュ疄闄呬繚鍏讳汉";
+      } else if (!form.value.maintenanceActuallyTime) {
+        isValid = false;
+        errorMessage = "璇烽�夋嫨瀹為檯淇濆吇鏃ユ湡";
+      } else if (form.value.maintenanceResult === undefined) {
+        isValid = false;
+        errorMessage = "璇烽�夋嫨淇濆吇缁撴灉";
+      } else if (uploadFiles.value.length === 0 && form.value.status == "1") {
+        isValid = false;
+        errorMessage = "璇蜂笂浼犱繚鍏荤収鐗�";
+      }
 
-// 纭淇濆吇缁撴灉閫夋嫨
-const onResultConfirm = ({ selectedValues, selectedOptions }) => {
-	form.value.maintenanceResult = selectedOptions[0].value;
-	maintenanceResultText.value = selectedOptions[0].text;
-	resultPickerValue.value = selectedValues;
-	showResult.value = false;
-};
+      if (!isValid) {
+        showToast(errorMessage);
+        return;
+      }
 
-// 鍒濆鍖栬〃鍗曟暟鎹�
-const initForm = () => {
-	// 璁剧疆淇濆吇浜轰负褰撳墠鐢ㄦ埛鏄电О
-	form.value.maintenanceActuallyName = userStore.nickName || '';
-	// 璁剧疆褰撳墠鏃ユ湡锛堝彧鍖呭惈骞存湀鏃ワ級
-	form.value.maintenanceActuallyTime = dayjs().format('YYYY-MM-DD');
-	currentDate.value = [new Date().getFullYear(), new Date().getMonth() + 1, new Date().getDate()];
-};
+      // 楠岃瘉閫氳繃
+      submitFormData();
+    } catch (e) {
+      showToast("琛ㄥ崟楠岃瘉澶辫触");
+    }
+  };
 
-onShow(() => {
-	// 椤甸潰鏄剧ず鏃跺垵濮嬪寲琛ㄥ崟
-	initForm();
-});
+  // 鎻愪氦琛ㄥ崟鏁版嵁
+  const submitFormData = async () => {
+    try {
+      loading.value = true;
+      const id = getPageId();
 
-onMounted(() => {
-	// 椤甸潰鍔犺浇鏃跺垵濮嬪寲琛ㄥ崟
-	initForm();
-});
+      if (!id) {
+        showToast("鍙傛暟閿欒");
+        loading.value = false;
+        return;
+      }
+      // 鍑嗗鎻愪氦鏁版嵁锛宮aintenanceActuallyTime 鍔犱笂褰撳墠鏃跺垎绉�
+      const submitData = {
+        ...form.value,
+        imagesFile: form.value.status == "1" ? uploadFiles.value : [],
+        sparePartsIds: form.value.sparePartsIds
+          ? form.value.sparePartsIds.join(",")
+          : "",
+      };
+      const { code } = await addMaintenance({ id: id, ...submitData });
+
+      if (code == 200) {
+        showToast("鏂板淇濆吇鎴愬姛");
+        resetFormAndValidate();
+        setTimeout(() => {
+          uni.navigateBack();
+        }, 1500);
+      } else {
+        loading.value = false;
+      }
+    } catch (e) {
+      loading.value = false;
+      showToast("鎿嶄綔澶辫触");
+    }
+  };
+
+  // 杩斿洖涓婁竴椤�
+  const goBack = () => {
+    // 娓呴櫎瀛樺偍鐨刬d鍜屾暟鎹�
+    uni.removeStorageSync("repairId");
+    uni.removeStorageSync("upkeepItemData");
+    uni.navigateBack();
+  };
+
+  // 鑾峰彇椤甸潰ID
+  const getPageId = () => {
+    // 浠庢湰鍦板瓨鍌ㄨ幏鍙杋d
+    return uni.getStorageSync("repairId");
+  };
+
+  const dataform = ref({});
+  // 鑾峰彇璁惧淇℃伅
+  const getUpkeepItemData = () => {
+    try {
+      const dataStr = uni.getStorageSync("upkeepItemData");
+      if (!dataStr) {
+        return null;
+      }
+      dataform.value = JSON.parse(dataStr);
+      fetchSparePartOptions(dataform.value.deviceLedgerId);
+      return JSON.parse(dataStr);
+    } catch (e) {
+      console.error("瑙f瀽璁惧鏁版嵁澶辫触:", e);
+      return null;
+    }
+  };
+
+  // 鏄剧ず鏃ユ湡閫夋嫨鍣�
+  const showDatePicker = () => {
+    showDate.value = true;
+  };
+
+  // 纭鏃ユ湡閫夋嫨
+  const onDateConfirm = e => {
+    // 鍙繚瀛樺勾鏈堟棩锛屼笉鍖呭惈鏃跺垎绉�
+    form.value.maintenanceActuallyTime = dayjs(e.value).format(
+      "YYYY-MM-DD HH:mm:ss"
+    );
+    showDate.value = false;
+  };
+
+  // 鏄剧ず淇濆吇缁撴灉閫夋嫨鍣�
+  const showResultPicker = () => {
+    showResult.value = true;
+  };
+
+  // 纭淇濆吇缁撴灉閫夋嫨
+  const onResultConfirm = selected => {
+    form.value.status = selected.value;
+    maintenancestatusText.value = selected.name;
+    showResult.value = false;
+  };
+
+  // 鏄剧ず璁惧澶囦欢閫夋嫨鍣�
+  const showSparePartPicker = () => {
+    tempSelectedSpareParts.value = [...selectedSpareParts.value];
+    showSparePart.value = true;
+  };
+
+  // 妫�鏌ュ浠舵槸鍚﹀凡閫変腑
+  const isSparePartSelected = id => {
+    return tempSelectedSpareParts.value.some(
+      item => item.id === id || item.value === id
+    );
+  };
+
+  // 鍒囨崲澶囦欢閫変腑鐘舵��
+  const toggleSparePartSelection = item => {
+    const itemId = item.id || item.value;
+    const index = tempSelectedSpareParts.value.findIndex(
+      selected => selected.id === itemId || selected.value === itemId
+    );
+    if (index > -1) {
+      tempSelectedSpareParts.value.splice(index, 1);
+    } else {
+      tempSelectedSpareParts.value.push(item);
+    }
+  };
+
+  // 纭澶囦欢閫夋嫨
+  const confirmSparePartSelection = () => {
+    selectedSpareParts.value = [...tempSelectedSpareParts.value];
+    form.value.sparePartsIds = selectedSpareParts.value.map(item => item.id);
+    showSparePart.value = false;
+  };
+
+  // 绉婚櫎宸查�夊浠�
+  const removeSparePart = index => {
+    selectedSpareParts.value.splice(index, 1);
+    form.value.sparePartsIds = selectedSpareParts.value.map(item => item.id);
+  };
+  const sparePartsIds = ref([]);
+  // 鍒濆鍖栬〃鍗曟暟鎹�
+  const initForm = () => {
+    // 鑾峰彇璁惧淇℃伅
+    const itemData = getUpkeepItemData();
+
+    // 閲嶇疆閫夋嫨鐨勫浠�
+    selectedSpareParts.value = [];
+    // 閲嶇疆涓婁紶鐨勬枃浠�
+    uploadFiles.value = [];
+    uploading.value = false;
+    uploadProgress.value = 0;
+    maintenancestatusText.value = "";
+
+    // 璁剧疆淇濆吇浜轰负褰撳墠鐢ㄦ埛鏄电О
+    form.value.maintenanceActuallyName = userStore.nickName || "";
+    // 璁剧疆褰撳墠鏃ユ湡锛堝彧鍖呭惈骞存湀鏃ワ級
+    form.value.maintenanceActuallyTime = dayjs().format("YYYY-MM-DD HH:mm:ss");
+    currentDate.value = [
+      new Date().getFullYear(),
+      new Date().getMonth() + 1,
+      new Date().getDate(),
+    ];
+
+    // 濡傛灉鏈夎澶囦俊鎭紝濉厖宸叉湁鐨勪繚鍏绘暟鎹�
+    if (itemData) {
+      // 濉厖瀹為檯淇濆吇浜�
+      if (itemData.maintenanceActuallyName) {
+        form.value.maintenanceActuallyName = itemData.maintenanceActuallyName;
+      }
+      // 濉厖淇濆吇缁撴灉
+      if (
+        itemData.maintenanceResult !== undefined &&
+        itemData.maintenanceResult !== null
+      ) {
+        form.value.maintenanceResult = itemData.maintenanceResult;
+      }
+      // 濉厖瀹為檯淇濆吇鏃ユ湡
+      if (itemData.maintenanceActuallyTime) {
+        form.value.maintenanceActuallyTime = itemData.maintenanceActuallyTime;
+        // 瑙f瀽鏃ユ湡璁剧疆鍒版棩鏈熼�夋嫨鍣�
+        const date = dayjs(itemData.maintenanceActuallyTime);
+        currentDate.value = [date.year(), date.month() + 1, date.date()];
+      }
+      // 濉厖淇濆吇鐘舵��
+      if (itemData.status) {
+        const statusMap = {
+          0: "寰呬繚鍏�",
+          1: "瀹岀粨",
+          2: "澶辫触",
+        };
+        maintenancestatusText.value = statusMap[itemData.status] || "";
+      }
+      // 濉厖澶囦欢鏁版嵁
+
+      // 澶勭悊瀛楃涓叉牸寮忕殑澶囦欢IDs
+      sparePartsIds.value = itemData.sparePartsIds;
+
+      // 濉厖闄勪欢鏁版嵁
+      if (itemData.files && itemData.files.length > 0) {
+        uploadFiles.value = itemData.files.map(file => ({
+          id: file.id,
+          name: file.name || file.bucketFilename || file.originalFilename,
+          url: file.url || file.downloadUrl,
+          type:
+            file.type ||
+            (file.contentType && file.contentType.startsWith("image/")
+              ? "image"
+              : "video"),
+          size: file.size || file.byteSize,
+        }));
+      } else if (itemData.uploadFiles && itemData.uploadFiles.length > 0) {
+        uploadFiles.value = itemData.uploadFiles.map(file => ({
+          id: file.id,
+          name: file.name || file.bucketFilename || file.originalFilename,
+          url: file.url || file.downloadUrl || file.tempFilePath || file.path,
+          type: file.type,
+          size: file.size,
+        }));
+      }
+    }
+  };
+
+  onShow(async () => {
+    // 鍏堣幏鍙栧浠堕�夐」锛屽啀鍒濆鍖栬〃鍗�
+    const pageId = getPageId();
+    if (pageId) {
+      await fetchSparePartOptions(pageId);
+    }
+    // 椤甸潰鏄剧ず鏃跺垵濮嬪寲琛ㄥ崟
+  });
+  const sparePartOptions = ref([]);
+  const fetchSparePartOptions = deviceLedgerId => {
+    return new Promise((resolve, reject) => {
+      getSparePartsOptions({ deviceLedgerId: deviceLedgerId })
+        .then(res => {
+          if (res.code == 200) {
+            sparePartOptions.value = res.data || [];
+            const idArray =
+              typeof sparePartsIds.value === "string"
+                ? sparePartsIds.value.split(",")
+                : sparePartsIds.value;
+
+            if (idArray.length > 0) {
+              selectedSpareParts.value = sparePartOptions.value
+                .filter(
+                  option =>
+                    idArray.includes(option.id.toString()) ||
+                    idArray.includes(option.value?.toString())
+                )
+                .map(option => ({
+                  id: option.id || option.value,
+                  name: option.name,
+                  code: option.code,
+                  value: option.id || option.value,
+                }));
+              // 璁剧疆澶囦欢IDs
+              form.value.sparePartsIds = idArray.join(",");
+            }
+            resolve(res.data);
+          } else {
+            resolve([]);
+          }
+        })
+        .catch(err => {
+          console.error("鑾峰彇澶囦欢閫夐」澶辫触:", err);
+          resolve([]);
+        });
+    });
+  };
+
+  // 鏍煎紡鍖栨枃浠禪RL
+  // const formatFileUrl = url => {
+  //   if (!url) return "";
+
+  //   // 濡傛灉宸茬粡鏄畬鏁寸殑URL锛坔ttp鎴杊ttps寮�澶达級锛岀洿鎺ヨ繑鍥�
+  //   if (url.startsWith("http://") || url.startsWith("https://")) {
+  //     return url;
+  //   }
+
+  //   // 濡傛灉鏄湰鍦拌矾寰勶紙濡� D:\\ruoyi\\prod\\uploads...锛夛紝闇�瑕佽浆鎹负缃戠粶URL
+  //   // 浠庤矾寰勪腑鎻愬彇uploads鍚庨潰鐨勯儴鍒�
+  //   const uploadsIndex = url.indexOf("uploads");
+  //   if (uploadsIndex !== -1) {
+  //     const relativePath = url.substring(uploadsIndex);
+  //     // 浣跨敤baseUrl + /profile/ + 鐩稿璺緞
+  //     return `http://192.168.1.35:8888/profile/${relativePath}`;
+  //   }
+
+  //   // 鍏朵粬鎯呭喌锛屽皾璇曠洿鎺ユ嫾鎺�
+  //   return `http://192.168.1.35:8888/profile/${url}`;
+  // };
+
+  // 鏍煎紡鍖栨枃浠跺ぇ灏�
+  const formatFileSize = size => {
+    if (!size) return "";
+    if (size < 1024) return size + "B";
+    if (size < 1024 * 1024) return (size / 1024).toFixed(1) + "KB";
+    return (size / (1024 * 1024)).toFixed(1) + "MB";
+  };
+
+  // 鎷嶇収/鎷嶈棰�
+  const chooseMedia = type => {
+    if (uploadFiles.value.length >= uploadConfig.limit) {
+      uni.showToast({
+        title: `鏈�澶氬彧鑳介�夋嫨${uploadConfig.limit}涓枃浠禶,
+        icon: "none",
+      });
+      return;
+    }
+
+    const remaining = uploadConfig.limit - uploadFiles.value.length;
+
+    // 浼樺厛锛歝hooseMedia锛堟敮鎸� image/video锛�
+    if (typeof uni.chooseMedia === "function") {
+      uni.chooseMedia({
+        count: Math.min(remaining, 1),
+        mediaType: [type || "image"],
+        sizeType: ["compressed", "original"],
+        sourceType: ["camera"], // 鏀寔鐩告満鍜岀浉鍐�
+        success: res => {
+          try {
+            const files = res?.tempFiles || [];
+            if (!files.length) throw new Error("鏈幏鍙栧埌鏂囦欢");
+
+            files.forEach((tf, idx) => {
+              const filePath = tf.tempFilePath || tf.path || "";
+              const fileType = tf.fileType || type || "image";
+              const ext = fileType === "video" ? "mp4" : "jpg";
+              const file = {
+                tempFilePath: filePath,
+                path: filePath,
+                type: fileType,
+                name: `${fileType}_${Date.now()}_${idx}.${ext}`,
+                size: tf.size || 0,
+                duration: tf.duration || 0,
+                createTime: Date.now(),
+                uid: Date.now() + Math.random() + idx,
+              };
+
+              console.log("chooseMedia 鎴愬姛鑾峰彇鏂囦欢:", file);
+              handleBeforeUpload(file);
+            });
+          } catch (e) {
+            console.error("澶勭悊鎷嶆憚缁撴灉澶辫触:", e);
+            uni.showToast({ title: "澶勭悊鏂囦欢澶辫触", icon: "error" });
+          }
+        },
+        fail: err => {
+          console.error("鎷嶆憚澶辫触:", err);
+          uni.showToast({ title: "鎷嶆憚澶辫触", icon: "error" });
+        },
+      });
+      return;
+    }
+
+    // 闄嶇骇锛歝hooseImage / chooseVideo
+    if (type === "video") {
+      uni.chooseVideo({
+        sourceType: ["camera", "album"],
+        maxDuration: uploadConfig.maxVideoDuration,
+        camera: "back",
+        success: res => {
+          try {
+            if (!res.tempFilePath) {
+              throw new Error("鏈幏鍙栧埌瑙嗛鏂囦欢");
+            }
+
+            const file = {
+              tempFilePath: res.tempFilePath,
+              path: res.tempFilePath,
+              type: "video",
+              name: `video_${Date.now()}.mp4`,
+              size: res.size || 0,
+              duration: res.duration || 0,
+              createTime: new Date().getTime(),
+              uid: Date.now() + Math.random(),
+            };
+
+            handleBeforeUpload(file);
+          } catch (error) {
+            console.error("澶勭悊鎷嶈棰戠粨鏋滃け璐�:", error);
+            uni.showToast({ title: "澶勭悊瑙嗛澶辫触", icon: "error" });
+          }
+        },
+        fail: err => {
+          console.error("鎷嶈棰戝け璐�:", err);
+          uni.showToast({ title: "鎷嶈棰戝け璐�", icon: "error" });
+        },
+      });
+    } else {
+      uni.chooseImage({
+        count: 1,
+        sizeType: ["compressed", "original"],
+        sourceType: ["camera", "album"],
+        success: res => {
+          const tempFilePath = res?.tempFilePaths?.[0];
+          const tempFile = res?.tempFiles?.[0] || {};
+          if (!tempFilePath) return;
+          handleBeforeUpload({
+            tempFilePath,
+            path: tempFilePath,
+            type: "image",
+            name: `photo_${Date.now()}.jpg`,
+            size: tempFile.size || 0,
+            createTime: Date.now(),
+            uid: Date.now() + Math.random(),
+          });
+        },
+      });
+    }
+  };
+
+  // 鍒犻櫎鏂囦欢
+  const removeFile = index => {
+    uni.showModal({
+      title: "纭鍒犻櫎",
+      content: "纭畾瑕佸垹闄よ繖涓枃浠跺悧锛�",
+      success: res => {
+        if (res.confirm) {
+          uploadFiles.value.splice(index, 1);
+          uni.showToast({
+            title: "鍒犻櫎鎴愬姛",
+            icon: "success",
+          });
+        }
+      },
+    });
+  };
+
+  // 涓婁紶鍓嶆牎楠�
+  const handleBeforeUpload = async file => {
+    // 鏍¢獙鏂囦欢绫诲瀷
+    if (
+      uploadConfig.fileType &&
+      Array.isArray(uploadConfig.fileType) &&
+      uploadConfig.fileType.length > 0
+    ) {
+      const fileName = file.name || "";
+      const fileExtension = fileName
+        ? fileName.split(".").pop().toLowerCase()
+        : "";
+
+      // 鏍规嵁鏂囦欢绫诲瀷纭畾鏈熸湜鐨勬墿灞曞悕
+      let expectedTypes = [];
+      if (file.type === "image") {
+        expectedTypes = ["jpg", "jpeg", "png", "gif", "webp"];
+      } else if (file.type === "video") {
+        expectedTypes = ["mp4", "mov", "avi", "wmv"];
+      }
+
+      // 妫�鏌ユ枃浠舵墿灞曞悕鏄惁鍦ㄥ厑璁哥殑绫诲瀷涓�
+      if (fileExtension && expectedTypes.length > 0) {
+        const isAllowed = expectedTypes.some(
+          type => uploadConfig.fileType.includes(type) && type === fileExtension
+        );
+
+        if (!isAllowed) {
+          uni.showToast({
+            title: `鏂囦欢鏍煎紡涓嶆敮鎸侊紝璇锋媿鎽� ${expectedTypes.join("/")} 鏍煎紡鐨勬枃浠禶,
+            icon: "none",
+          });
+          return false;
+        }
+      }
+    }
+
+    // 鏍¢獙閫氳繃锛屽紑濮嬩笂浼�
+    uploadFile(file);
+    return true;
+  };
+
+  // 鏂囦欢涓婁紶澶勭悊
+  const uploadFile = async file => {
+    uploading.value = true;
+    uploadProgress.value = 0;
+    number.value++;
+
+    // 纭繚token瀛樺湪
+    const token = userStore.token;
+    if (!token) {
+      handleUploadError("鐢ㄦ埛鏈櫥褰�");
+      return;
+    }
+
+    uploadWithUniUploadFile(file, file.tempFilePath || file.path || "", token);
+  };
+
+  // 浣跨敤uni.uploadFile涓婁紶
+  const uploadWithUniUploadFile = (file, filePath, token) => {
+    if (!filePath) {
+      handleUploadError("鏂囦欢璺緞涓嶅瓨鍦�");
+      return;
+    }
+
+    const uploadTask = uni.uploadFile({
+      url: uploadFileUrl.value,
+      filePath: filePath,
+      name: "file",
+      formData: {
+        type: 10, // 淇濆吇闄勪欢绫诲瀷
+      },
+      header: {
+        Authorization: `Bearer ${token}`,
+      },
+      success: res => {
+        try {
+          if (res.statusCode === 200) {
+            const response = JSON.parse(res.data);
+            if (response.code === 200) {
+              handleUploadSuccess(response, file);
+              uni.showToast({
+                title: "涓婁紶鎴愬姛",
+                icon: "success",
+              });
+            } else {
+              handleUploadError(response.msg || "鏈嶅姟鍣ㄨ繑鍥為敊璇�");
+            }
+          } else {
+            handleUploadError(`鏈嶅姟鍣ㄩ敊璇紝鐘舵�佺爜: ${res.statusCode}`);
+          }
+        } catch (e) {
+          console.error("瑙f瀽鍝嶅簲澶辫触:", e);
+          console.error("鍘熷鍝嶅簲鏁版嵁:", res.data);
+          handleUploadError("鍝嶅簲鏁版嵁瑙f瀽澶辫触: " + e.message);
+        }
+      },
+      fail: err => {
+        console.error("涓婁紶澶辫触:", err.errMsg || err);
+        number.value--;
+
+        let errorMessage = "涓婁紶澶辫触";
+        if (err.errMsg) {
+          if (err.errMsg.includes("statusCode: null")) {
+            errorMessage = "缃戠粶杩炴帴澶辫触锛岃妫�鏌ョ綉缁滆缃�";
+          } else if (err.errMsg.includes("timeout")) {
+            errorMessage = "涓婁紶瓒呮椂锛岃閲嶈瘯";
+          } else if (err.errMsg.includes("fail")) {
+            errorMessage = "涓婁紶澶辫触锛岃妫�鏌ョ綉缁滆繛鎺�";
+          } else {
+            errorMessage = err.errMsg;
+          }
+        }
+
+        handleUploadError(errorMessage);
+      },
+      complete: () => {
+        uploading.value = false;
+        uploadProgress.value = 0;
+      },
+    });
+
+    // 鐩戝惉涓婁紶杩涘害
+    if (uploadTask && uploadTask.onProgressUpdate) {
+      uploadTask.onProgressUpdate(res => {
+        uploadProgress.value = res.progress;
+      });
+    }
+  }; // 鏍煎紡鍖栨枃浠禪RL
+  const formatFileUrl = url => {
+    if (!url) return "";
+    if (url.startsWith("http://") || url.startsWith("https://")) {
+      return url;
+    }
+    // const uploadsIndex = url.indexOf("uploads");
+    // if (uploadsIndex !== -1) {
+    //   const relativePath = url.substring(uploadsIndex);
+    //   return `${config.fileUrl}/${relativePath}`;
+    // }
+    return `${config.fileUrl}/${url}`;
+  };
+
+  // 涓婁紶鎴愬姛澶勭悊
+  const handleUploadSuccess = (res, file) => {
+    console.log("涓婁紶鎴愬姛鍝嶅簲:", res);
+
+    // 澶勭悊涓嶅悓鐨勬暟鎹粨鏋勶細鍙兘鏄暟缁勶紝涔熷彲鑳芥槸鍗曚釜瀵硅薄
+    let uploadedFile = null;
+    uploadedFile = res.data;
+
+    if (!uploadedFile) {
+      console.error("鏃犳硶瑙f瀽涓婁紶鍝嶅簲鏁版嵁:", res);
+      number.value--;
+      handleUploadError("涓婁紶鍝嶅簲鏁版嵁鏍煎紡閿欒", false);
+      return;
+    }
+    console.log("涓婁紶鎴愬姛鏂囦欢鏁版嵁:", uploadedFile, file);
+
+    // 纭繚涓婁紶鐨勬枃浠舵暟鎹畬鏁达紝鍖呭惈id鍜宼ype
+    const fileData = {
+      name: uploadedFile.originalName,
+      type: file.type,
+      url: uploadedFile.tempPath,
+    };
+
+    uploadFiles.value.push(fileData);
+    number.value = 0;
+  };
+
+  // 涓婁紶澶辫触澶勭悊
+  const handleUploadError = (message = "涓婁紶鏂囦欢澶辫触", showRetry = false) => {
+    uploading.value = false;
+    uploadProgress.value = 0;
+
+    if (showRetry) {
+      uni.showModal({
+        title: "涓婁紶澶辫触",
+        content: message + "锛屾槸鍚﹂噸璇曪紵",
+        success: res => {
+          if (res.confirm) {
+            // 鐢ㄦ埛閫夋嫨閲嶈瘯锛岃繖閲屽彲浠ラ噸鏂拌Е鍙戜笂浼�
+          }
+        },
+      });
+    } else {
+      uni.showToast({
+        title: message,
+        icon: "error",
+      });
+    }
+  };
+
+  onMounted(() => {
+    // 椤甸潰鍔犺浇鏃跺垵濮嬪寲琛ㄥ崟
+    initForm();
+  });
 </script>
 
 <style scoped lang="scss">
-.upkeep-maintain {
-	min-height: 100vh;
-	background: #f8f9fa;
-	padding-bottom: 5rem;
-}
+  @import "@/static/scss/form-common.scss";
+  .upkeep-maintain {
+    min-height: 100vh;
+    background: #f8f9fa;
+    padding-bottom: 5rem;
+  }
 
-.footer-btns {
-	position: fixed;
-	left: 0;
-	right: 0;
-	bottom: 0;
-	background: #fff;
-	display: flex;
-	justify-content: space-around;
-	align-items: center;
-	padding: 0.75rem 0;
-	box-shadow: 0 -0.125rem 0.5rem rgba(0,0,0,0.05);
-	z-index: 1000;
-}
+  .footer-btns {
+    position: fixed;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    background: #fff;
+    display: flex;
+    justify-content: space-around;
+    align-items: center;
+    padding: 0.75rem 0;
+    box-shadow: 0 -0.125rem 0.5rem rgba(0, 0, 0, 0.05);
+    z-index: 1000;
+  }
 
-.cancel-btn {
-	font-weight: 400;
-	font-size: 1rem;
-	color: #FFFFFF;
-	width: 6.375rem;
-	background: #C7C9CC;
-	box-shadow: 0 0.25rem 0.625rem 0 rgba(3,88,185,0.2);
-	border-radius: 2.5rem 2.5rem 2.5rem 2.5rem;
-}
+  .cancel-btn {
+    font-weight: 400;
+    font-size: 1rem;
+    color: #ffffff;
+    width: 6.375rem;
+    background: #c7c9cc;
+    box-shadow: 0 0.25rem 0.625rem 0 rgba(3, 88, 185, 0.2);
+    border-radius: 2.5rem 2.5rem 2.5rem 2.5rem;
+  }
 
-.save-btn {
-	font-weight: 400;
-	font-size: 1rem;
-	color: #FFFFFF;
-	width: 14rem;
-	background: linear-gradient( 140deg, #00BAFF 0%, #006CFB 100%);
-	box-shadow: 0 0.25rem 0.625rem 0 rgba(3,88,185,0.2);
-	border-radius: 2.5rem 2.5rem 2.5rem 2.5rem;
-}
+  .save-btn {
+    font-weight: 400;
+    font-size: 1rem;
+    color: #ffffff;
+    width: 14rem;
+    background: linear-gradient(140deg, #00baff 0%, #006cfb 100%);
+    box-shadow: 0 0.25rem 0.625rem 0 rgba(3, 88, 185, 0.2);
+    border-radius: 2.5rem 2.5rem 2.5rem 2.5rem;
+  }
 
-// 鍝嶅簲寮忚皟鏁�
-@media (max-width: 768px) {
-	.submit-section {
-		padding: 12px;
-	}
-}
+  // 鍝嶅簲寮忚皟鏁�
+  @media (max-width: 768px) {
+    .submit-section {
+      padding: 12px;
+    }
+  }
 
-.tip-text { 
-	padding: 4px 16px 0 16px; 
-	font-size: 12px; 
-	color: #888; 
-}
+  .tip-text {
+    padding: 4px 16px 0 16px;
+    font-size: 12px;
+    color: #888;
+  }
+
+  /* 璁惧澶囦欢澶氶�夋牱寮� */
+  .spare-parts-container {
+    flex: 1;
+    min-height: 40px;
+    display: flex;
+    align-items: center;
+  }
+
+  .spare-parts-list {
+    display: flex;
+    flex-wrap: wrap;
+    gap: 8px;
+  }
+
+  .spare-part-tag {
+    display: flex;
+    align-items: center;
+    gap: 4px;
+    background: #2c7be5;
+    color: #fff;
+    padding: 4px 8px;
+    border-radius: 4px;
+    font-size: 12px;
+  }
+
+  .placeholder {
+    color: #c0c4cc;
+    font-size: 14px;
+  }
+
+  /* 澶囦欢閫夋嫨寮圭獥鏍峰紡 */
+  .spare-part-popup {
+    padding: 16px;
+    max-height: 60vh;
+    display: flex;
+    flex-direction: column;
+  }
+
+  .popup-header {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    margin-bottom: 16px;
+    padding-bottom: 12px;
+    border-bottom: 1px solid #e8e8e8;
+  }
+
+  .popup-title {
+    font-size: 16px;
+    font-weight: 600;
+    color: #333;
+  }
+
+  .spare-part-options {
+    flex: 1;
+    overflow-y: auto;
+  }
+
+  .spare-part-option {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    padding: 12px 0;
+    border-bottom: 1px solid #f0f0f0;
+    font-size: 14px;
+    color: #333;
+  }
+
+  .spare-part-option.selected {
+    color: #2c7be5;
+    font-weight: 500;
+  }
+
+  /* 澶囦欢閫夋嫨寮圭獥鏍峰紡 */
+  .spare-part-popup {
+    width: 100%;
+    max-height: 80vh;
+    background: #fff;
+    border-radius: 16px 16px 0 0;
+    overflow: hidden;
+  }
+
+  .popup-header {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    padding: 16px 20px;
+    border-bottom: 1px solid #f0f0f0;
+    background: #f8f9fa;
+  }
+
+  .popup-title {
+    font-size: 16px;
+    font-weight: 600;
+    color: #333;
+  }
+
+  .spare-part-options {
+    padding: 10px 0;
+    max-height: 60vh;
+    overflow-y: auto;
+  }
+
+  .spare-part-option {
+    position: relative;
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    padding: 14px 20px;
+    border-bottom: 1px solid #f0f0f0;
+    transition: all 0.2s ease;
+  }
+
+  .spare-part-option:last-child {
+    border-bottom: none;
+  }
+
+  .spare-part-option:hover {
+    background: #f8f9fa;
+  }
+
+  .spare-part-option.selected {
+    background: #e6f7ff;
+    color: #1890ff;
+  }
+
+  .spare-part-option.selected::before {
+    content: "";
+    position: absolute;
+    left: 0;
+    top: 0;
+    bottom: 0;
+    width: 4px;
+    background: #1890ff;
+  }
+
+  /* 鏂囦欢涓婁紶鏍峰紡 */
+  .simple-upload-area {
+    width: 100%;
+  }
+
+  .upload-buttons {
+    display: flex;
+    margin-bottom: 12px;
+  }
+
+  .upload-progress {
+    margin: 12px 0;
+  }
+
+  .file-list {
+    margin-top: 12px;
+  }
+
+  .file-item {
+    display: flex;
+    align-items: center;
+    margin-bottom: 12px;
+    padding: 10px;
+    background: #f8f9fa;
+    border-radius: 8px;
+  }
+
+  .file-preview-container {
+    position: relative;
+    margin-right: 12px;
+  }
+
+  .file-preview {
+    width: 80px;
+    height: 80px;
+    border-radius: 4px;
+  }
+
+  .video-preview {
+    width: 80px;
+    height: 80px;
+    background: #333;
+    border-radius: 4px;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    color: #fff;
+    font-size: 12px;
+  }
+
+  .delete-btn {
+    position: absolute;
+    top: -8px;
+    right: -8px;
+    width: 20px;
+    height: 20px;
+    background: #f56c6c;
+    border-radius: 50%;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+  }
+
+  .file-info {
+    flex: 1;
+  }
+
+  .file-name {
+    display: block;
+    font-size: 14px;
+    color: #333;
+    margin-bottom: 4px;
+    line-height: 1.4;
+  }
+
+  .file-size {
+    font-size: 12px;
+    color: #999;
+  }
+
+  .empty-state {
+    padding: 20px 0;
+    text-align: center;
+    color: #999;
+    font-size: 14px;
+  }
 </style>
\ No newline at end of file

--
Gitblit v1.9.3