ソースを参照

SOP通知规则页面通知角色和模板列内容不展示问题,修改通知规则接口调用由updateNotifyConfig更换为insertNotifyConfig

wyn 3 ヶ月 前
コミット
8f5deaa00d

+ 20 - 10
src/views/sopm/sop/NotificationRules.vue

@@ -117,6 +117,8 @@ onMounted(async ()=>{
   await getActionNoticeData()
   const data=await SopApi.selectSopById(route.query.id)
   enableNotifications.value = data.enableNotifications
+  console.log('noticeList:', noticeList.value)
+
 })
 
 // 返回
@@ -168,23 +170,31 @@ const getNotifyData = async () => {
       const notifyTimeTypeLabel = getDictLabel(dictMap.notifyTimeType, item.notifyTimeType)
       let notifyTimeDisplay = notifyTimeTypeLabel
 
-      if (item.notifyTimeType === 0 || item.notifyTimeType === 2) {
+      if (item.notifyTimeType == 0 || item.notifyTimeType == 2) {
         // 转换为分钟展示
         const minutes = Math.floor(item.notifyTime / 60)
         notifyTimeDisplay += `(${minutes}分钟)`
       }
 
       // ✅ 通知角色与模板显示拼接(status === 1 且一行一个)
+      // const detailDisplay = (item.notifyConfigDetailRespVOList || [])
+      //   .filter(d => d.status == 1)
+      //   .map(d => {
+      //     let role = d.roleName
+      //     if (d.isClient == 1) {
+      //       role += '(当事人)'
+      //     }
+      //     return `${role}:${d.notifyTemplateName || '-'}`
+      //   })
+      //   .join('<br/>')  // ✅ 多行显示,用 <br/> 拼接
+
       const detailDisplay = (item.notifyConfigDetailRespVOList || [])
-        .filter(d => d.status === 1)
+        .filter(d => d.isClient == 1) // 过滤当事人
         .map(d => {
-          let role = d.roleName
-          if (d.isClient === 1) {
-            role += '(当事人)'
-          }
-          return `${role}:${d.notifyTemplateName || '-'}`
+          const role = `${d.roleName || '未知角色'}(当事人)`; // 这里就直接拼接了
+          return `${role}:${d.notifyTemplateName || '-'}`;
         })
-        .join('<br/>')  // ✅ 多行显示,用 <br/> 拼接
+        .join('<br/>');
 
       return {
         ...item,
@@ -243,7 +253,7 @@ const openForm = ({type, id, rowId, workstationId,}: { type: string
   rowId?: number
   workstationId?: number
 }) => {
-  if (type === 'create') {
+  if (type == 'create') {
     router.push({
       name: 'NotificationUpdate',
       query: {
@@ -252,7 +262,7 @@ const openForm = ({type, id, rowId, workstationId,}: { type: string
         type: 'create',
       },
     })
-  } else if (type === 'update') {
+  } else if (type == 'update') {
     router.push({
       name: 'NotificationUpdate',
       query: {

+ 4 - 2
src/views/sopm/sop/NotificationUpdate.vue

@@ -507,7 +507,7 @@ const submit = async () => {
 
     // ✅ 校验 2:如果 status 或 isClient 为 1,则 notifyTemplateCode 不可为空
     const hasMissingTemplate = notifyConfigDetailRespVOList.some((item) => {
-      return (item.status === 1 || item.isClient === 1) && !item.notifyTemplateCode
+      return (item.status == 1 || item.isClient == 1) && !item.notifyTemplateCode
     })
     if (hasMissingTemplate) {
       ElMessage.warning('存在启用通知或仅通知当事人的角色,但模板未填写')
@@ -555,7 +555,9 @@ const submitUpdate = async () => {
       id: item.notifyConfigId // 有id则为修改,无id则为新增
     }))
   }
-  const data = await NotificationRules.updateNotifyConfig(payload)
+  // const data = await NotificationRules.updateNotifyConfig(payload)
+  const data = await NotificationRules.insertNotifyConfig(payload)
+
   if (data) {
     ElMessage.success('更新成功')
   }