Kaynağa Gözat

修改执行计划中没有计划时后端逻辑变更后的判断逻辑,通知规则页面和路由创建

wyn 3 ay önce
ebeveyn
işleme
2e75f67f26

+ 14 - 0
src/router/modules/remaining.ts

@@ -295,6 +295,20 @@ const remainingRouter: AppRouteRecordRaw[] = [
           activeMenu: '/sopm/sop'
         }
       },
+      {
+        path: 'sopm/sop/NotificationRules',
+        component: () => import('@/views/sopm/sop/NotificationRules.vue'),
+        name: 'NotificationRules',
+        meta: {
+          title: 'sop通知规则',
+          noCache: true,
+          noTagsView: true,
+          hidden: true,
+          canTo: true,
+          icon: 'ep:view',
+          activeMenu: '/sopm/sop'
+        }
+      },
     ]
   },
   {

+ 9 - 6
src/views/sopm/sop/ExecutePlan.vue

@@ -239,7 +239,7 @@ const tableData = ref([])
 const sopExcuteData = reactive({
   sopId: route.query.id,
   status: '',
-  frequencyUnit: '3',
+  frequencyUnit: 3,
   frequency: '',
   timePoint: null,
   startTime: '',
@@ -343,14 +343,17 @@ const getSopExcuteData = async () => {
     if (excuteList) {
       Object.assign(sopExcuteData, excuteList)
       tableData.value = excuteList.previewDataList
-    }
-  } catch (error) {
-    console.error('获取失败:', error)
-    if(error.code==902){
+    }else{
       // 新增
       ExcuteplanVisible.value = true
-      // isPrompt.value = false //执行计划没有时不提示后端接口消息
     }
+  } catch (error) {
+    console.error('获取失败:', error)
+    // if(error.code==902){
+    //   // 新增
+    //   ExcuteplanVisible.value = true
+    //   // isPrompt.value = false //执行计划没有时不提示后端接口消息
+    // }
   }
 }
 console.log(route.query.id, '是否拿到了id')

+ 121 - 0
src/views/sopm/sop/NotificationRules.vue

@@ -1,11 +1,132 @@
+<template>
+<ContentWrap>
+  <!--    顶部标题-->
+  <div class="topTitle">
+    <span class="tab-title">执行计划:{{route.query.sopName}}</span>
+    <div class="set-btn" @click="goBack">
+      <img src="../../../assets/images/返回.png" alt="" />
+      返回
+    </div>
+  </div>
+</ContentWrap>
 
+<!--  <ContentWrap>-->
+<!--    <div class="tab-header">-->
+<!--      <span class="tab-title">通知设置</span>-->
+<!--    </div>-->
+<!--    <div class="noticeContent">-->
+<!--    <p>启用通知:-->
+<!--      <el-switch-->
+<!--      v-model="NotificationStatus"-->
+<!--      size="small"-->
+<!--      :active-value="0"-->
+<!--      :inactive-value="1"-->
+<!--    /></p>-->
+<!--    <section>-->
+<!--      <el-button-->
+<!--        type="primary"-->
+<!--        plain-->
+<!--        @click="openForm('create')"-->
+<!--        v-hasPermi="['iscs:sop:create']"-->
+<!--      >-->
+<!--        <Icon icon="ep:plus" class="mr-5px" />-->
+<!--        新增-->
+<!--      </el-button>-->
+<!--      <el-button-->
+<!--        type="danger"-->
+<!--        plain-->
+<!--        :disabled="multiple"-->
+<!--        @click="handleDelete()"-->
+<!--        v-hasPermi="['iscs:sop:delete']"-->
+<!--      >-->
+<!--        <Icon icon="ep:delete" class="mr-5px" />-->
+<!--        批量删除-->
+<!--      </el-button>-->
+<!--    </section>-->
 
+<!--    </div>-->
+<!--  </ContentWrap>-->
+</template>
 
 <script setup lang="ts">
 
+
+const router = useRouter()
+const route = useRoute()
+const NotificationStatus=ref('')
+const ids = ref<number[]>([]) // 选中的数据
+const multiple = ref(true) // 非多个禁用
+
+// 返回
+const goBack = () => {
+  router.push('/sopm/sop')
+}
+
+/** 添加/修改/查看操作 */
+const openForm =(type:string)=>{
+  if(type=='create'){
+    console.log('新增了')
+  }
+}
+
+const handleDelete = async () => {
+  // const sopId = id || ids.value
+  // try {
+  //   // 删除的二次确认
+  //   await message.delConfirm()
+  //   // 发起删除
+  //   await SopApi.deleteSopList(sopId)
+  //   message.success(t('common.delSuccess'))
+  //   // 刷新列表
+  //   await getList()
+  // } catch {}
+  console.log('删除功能')
+}
+/** 多选框选中数据 */
+
+const handleSelectionChange = (selection: any[]) => {
+  ids.value = selection.map((item) => item.id)
+  multiple.value = !selection.length
+}
+
+
+
+
 </script>
 
 
 <style scoped lang="scss">
+.topTitle {
+  width: 100%;
+  line-height: 40px;
+}
+.set-btn {
+  width: 60px;
+  height: 30px;
+  border: 1px solid black;
+  border-radius: 6px;
+  text-align: center;
+  line-height: 30px;
+  float: right;
+  cursor: pointer;
+  margin: 10px 0;
+
+  img {
+    width: 14px;
+    height: 14px;
+  }
+}
 
+.tab-header {
+  background-color: #f5f7fa;
+  border-bottom: 1px solid #dcdfe6;
+  padding: 12px 20px;
+  border-radius: 4px 4px 0 0;
+}
+.noticeContent{
+  width: 100%;
+  height: 100%;
+  padding: 10px 30px;
+  background: blue;
+}
 </style>

+ 11 - 1
src/views/sopm/sop/index.vue

@@ -135,7 +135,7 @@
             link
             :icon="Bell"
             type="primary"
-            @click="openForm('update', row.id)"
+            @click="openForm('NotificationRules', row.id,row.sopName)"
             v-hasPermi="['iscs:sop:update']"
           >
             通知规则
@@ -332,6 +332,16 @@ const openForm = (type: string, id?: number,sopName?:string) => {
         type: 'executPlan'
       }
     })
+  } else if(type == 'NotificationRules') {
+  //   通知规则
+    router.push({
+      name:'NotificationRules',
+      query:{
+        id:id,
+        sopName: sopName,
+        type: 'notificationRules'
+      }
+    })
   }
 }