فهرست منبع

feat:员工头像限制1张

sunqijun 1 ماه پیش
والد
کامیت
eafcb00a09

+ 9 - 5
src/views/production-safety/safetyTrainingAndEducation/employeeTrainingRecordCardManagement/employeeTrainingRecordCardManagementEdit.vue

@@ -63,8 +63,11 @@
               ref="staffImgRef"
               action="#"
               :file-list="staffImgList"
+              :limit="1"
+              :on-exceed="handleImageExceed"
               :disabled="isViewMode"
               :auto-upload="false"
+              :multiple="false"
               accept="image/*"
               :on-change="handleImageUploadChange"
               :on-remove="handlePictureCardDelete"
@@ -208,15 +211,16 @@
   const getDetail = async () => {
     if (!currentId.value) return;
     try {
-      const res = await getEducationStaffTrainingCardDetail(currentId.value);
+      const res: any = await getEducationStaffTrainingCardDetail(currentId.value);
       if (res) {
         Object.assign(form, {
           ...res,
-          deptIdForSelect: parseLastDeptId((res as FormDataType).deptId),
+          deptIdForSelect: parseLastDeptId(res.deptId),
         });
-        if(res.staffImg){
-            form.staffImg = JSON.parse(res.staffImg)
-            staffImgList.value = JSON.parse(res.staffImg) || []
+        if (res.staffImg) {
+          const parsedStaffImg = JSON.parse(res.staffImg);
+          form.staffImg = parsedStaffImg;
+          staffImgList.value = parsedStaffImg || [];
         }
       }
     } catch (e) {