Przeglądaj źródła

Merge branch 'feat/production-safety' of http://14.103.151.10:8888/product-group-fe/sfy-safety-group/sfy-safety into feat/production-safety

sunqijun 1 miesiąc temu
rodzic
commit
67577f3245

+ 1 - 0
src/api/safety-culture/index.ts

@@ -109,6 +109,7 @@ export interface ActivityRegistrationTargetItem {
   totalScore: number; // 总分数
   addScore: number; // 加分项分数
   subtractScore: number; // 减分项分数
+  status?: number; // 启用状态:1-启用,0-禁用
 }
 
 

+ 17 - 2
src/views/production-safety/safety-culture/accidentCaseManagement/components/accidentCaseManagementDetail.vue

@@ -33,6 +33,7 @@
           v-model:file-list="approvalImageFileList"
           :auto-upload="false"
           list-type="picture-card"
+          accept=".jpg,.jpeg,.png"
           :limit="1"
           :disabled="isViewMode"
           :on-change="handleApprovalImageChange"
@@ -223,8 +224,13 @@ const handleSubmit = async () => {
   const res = await handleValidate();
   if (!res) return;
 
+  if (!ruleFormData.description || ruleFormData.description == '<p><br></p>') {
+    ElMessage.error('请输入案例描述');
+    return;
+  }
+
   if (!ruleFormData.attachmentUrl || ruleFormData.attachmentUrl.length === 0) {
-    ElMessage.warning('请上传文件');
+    ElMessage.error('请上传文件');
     return;
   }
 
@@ -267,7 +273,16 @@ const previewOnline = (url: string | undefined, type) => {
 
 const handleApprovalImageChange = (uploadFile: UploadUserFile) => {
   if (!uploadFile.raw) return;
-
+  // 限制文件类型为 JPG、JPEG、PNG 格式
+  const allowedTypes = ['image/jpeg', 'image/jpg', 'image/png'];
+  const fileType = uploadFile.raw.type;
+  if (!allowedTypes.includes(fileType)) {
+    ElMessage.error('只能上传 JPG、JPEG、PNG 格式的图片文件!');
+    approvalImageFileList.value = approvalImageFileList.value.filter(
+      file => file.uid !== uploadFile.uid
+    );
+    return;
+  }
   uploadFileApi({
     file: uploadFile.raw,
     bizType: UPLOAD_BIZ_TYPE['DICTIONARY'],

+ 2 - 2
src/views/production-safety/safety-culture/safetyCultureActivityManagement/components/activityRegistrationManagement.vue

@@ -13,7 +13,7 @@
     <main class="safety-platform-container__main">
       <div class="search-table-container">
         <header>
-            <el-button type="primary" :icon="Plus" style="margin-bottom:20px" @click="selectDeptType">
+            <el-button type="primary" :icon="Plus" style="margin-bottom:20px" @click="selectDeptType" v-if="activityRegistrationDetail.status !== 3">
             添加
             </el-button>
           <div class="act-search">
@@ -57,7 +57,7 @@
           <BasicTable ref="basicTableRef" :tableData="tableData" :tableConfig="tableConfig"
             @update:pageSize="handleSizeChange" @update:pageNumber="handleCurrentChange">
             <template #action="scope">
-              <div class="action-container--div" style="justify-content: left">
+              <div class="action-container--div" style="justify-content: left" v-if="activityRegistrationDetail.status !== 3">
                 <ActionButton text="编辑" @click="handleEdit(scope.row)" />
                 <ActionButton text="删除" @click="handleDelete(scope.row)" />
               </div>

+ 7 - 5
src/views/production-safety/safety-culture/safetyCultureActivityManagementExecutor/components/activityRegistrationManagement.vue

@@ -13,6 +13,11 @@
     <main class="safety-platform-container__main">
       <div class="search-table-container">
         <header>
+          <div style="position: relative">
+            <el-button type="primary" class="search-table-container--button" @click="selectDeptType" v-if="activityRegistrationDetail.status !== 3">
+              添加
+            </el-button>
+          </div>
           <div class="act-search">
             <section class="select-box">
               <div class="select-box--item">
@@ -41,9 +46,6 @@
             <section class="search-btn">
               <el-button type="primary" @click="handleSearch">查询</el-button>
               <el-button @click="handleReset">重置</el-button>
-              <el-button type="primary" style="margin:0 10px;" @click="selectDeptType">
-                添加
-              </el-button>
               <!-- <el-button plain @click="handleExport">
                 导出
               </el-button> -->
@@ -55,7 +57,7 @@
           <BasicTable ref="basicTableRef" :tableData="tableData" :tableConfig="tableConfig"
             @update:pageSize="handleSizeChange" @update:pageNumber="handleCurrentChange">
             <template #action="scope">
-              <div class="action-container--div" style="justify-content: left">
+              <div class="action-container--div" style="justify-content: left" v-if="activityRegistrationDetail.status !== 3">
                 <ActionButton text="编辑" @click="handleEdit(scope.row)" />
                 <ActionButton text="删除" @click="handleDelete(scope.row)" />
               </div>
@@ -344,7 +346,7 @@ const handleSave = async () => {
     getTableData();
   } catch (e) {
     console.error('保存失败:', e);
-    ElMessage.error(isEditMode.value ? '更新失败' : '保存失败');
+    ElMessage.error(e.message);
   }
 };
 

+ 11 - 1
src/views/production-safety/safety-culture/safetyCultureMaterialManagement/components/safetyCultureMaterialManagementDetail.vue

@@ -59,6 +59,7 @@
           :auto-upload="false"
           list-type="picture-card"
           :limit="1"
+          accept=".jpg,.jpeg,.png"
           :disabled="isViewMode"
           :on-change="handleApprovalImageChange"
           :on-exceed="handleApprovalImageExceed"
@@ -213,7 +214,16 @@
 
   const handleApprovalImageChange = (uploadFile: UploadUserFile) => {
     if (!uploadFile.raw) return;
-
+    // 限制文件类型为 JPG、JPEG、PNG 格式
+    const allowedTypes = ['image/jpeg', 'image/jpg', 'image/png'];
+    const fileType = uploadFile.raw.type;
+    if (!allowedTypes.includes(fileType)) {
+      ElMessage.error('只能上传 JPG、JPEG、PNG 格式的图片文件!');
+      approvalImageFileList.value = approvalImageFileList.value.filter(
+        file => file.uid !== uploadFile.uid
+      );
+      return;
+    }
     uploadFileApi({
       file: uploadFile.raw,
       bizType: UPLOAD_BIZ_TYPE['DICTIONARY'],

+ 6 - 0
src/views/production-safety/safety-culture/safetyPublicityBoardManagement/components/safetyPublicityBoardManagementDetail.vue

@@ -239,6 +239,12 @@
       ElMessage.warning('请上传文件');
       return;
     }
+
+    if (!ruleFormData.description || ruleFormData.description == '<p><br></p>') {
+      ElMessage.error('请输入资料描述');
+      return;
+    }
+
     try {
       const uploadedFileList = await formatAttachmentList(ruleFormData.attachmentUrl);
       const basePayload = {

+ 1 - 0
src/views/production-safety/safety-culture/safetyPublicityBoardManagement/configs/form.ts

@@ -51,4 +51,5 @@ export const ACADEMY_FILE_FORM_DATA = {
 export const ACADEMY_FILE_FORM_RULES = {
   materialName: [{ required: true, message: '请输入宣传资料名称', trigger: 'blur' }],
   description: [{ required: true, message: '请输入资料描述', trigger: 'blur' }],
+  attachmentUrl: [{ required: true, message: '请上传文档文件', trigger: 'blur' }],
 };