Просмотр исходного кода

fix: 添加验证,修改按钮状态

xiaweibo 1 месяц назад
Родитель
Сommit
5a7d145312

+ 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-禁用
 }
 
 

+ 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>

+ 6 - 4
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>

+ 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

@@ -46,4 +46,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' }],
 };