5 コミット 86870aac3d ... 45875ab43c

作者 SHA1 メッセージ 日付
  jcq 45875ab43c fix: 计算百分比精度问题 1 日 前
  jcq 6c112735a2 Merge branch 'dev-ly' into dev-jcq 1 日 前
  jcq e821220b43 Merge branch 'dev-jcq' into dev-ly 2 日 前
  cmy bf1b454edd Merge branch 'dev-cmn' into dev-ly 2 日 前
  cmy af0d0b0e44 fix:bug修复 2 日 前

+ 2 - 2
src/views/marketing/apps/components/domainCollapse.vue

@@ -104,7 +104,7 @@ function addGroupsUnique(newGroups: DomainItem[]) {
     console.log(filtered);
 		useMessage().success(t('common.addSuccessText'));
   }else{
-    useMessage().warning(t('marketingApps.addDomainTip'));
+    useMessage().error(t('marketingApps.addDomainTip'));
   }
 }
 
@@ -129,7 +129,7 @@ function addSinglesUnique(newSingles: DomainItem[]) {
     console.log('去重后的域名:', filtered);
 		useMessage().success(t('common.addSuccessText'));
   }else{
-    useMessage().warning(t('marketingApps.addDomainTip2'));
+    useMessage().error(t('marketingApps.addDomainTip2'));
   }
 }
 

+ 1 - 1
src/views/marketing/apps/components/form.vue

@@ -126,7 +126,7 @@ const updateDelDomains = (data: string[]) => {
 const formatNum = (value: string | number = 0) => {
   let num = Number(value);
   if(num > 0 && num < 1) {
-    return num * 100 + '%';
+    return (num * 100).toFixed(2) + '%';
   }else if (num >= 1 && num < 10000) {
     return num;
   }

+ 6 - 7
src/views/marketing/apps/components/ipCollapse.vue

@@ -16,7 +16,7 @@
             <!-- 分组 -->
             <el-popover v-else width="200" trigger="hover" placement="top" @show="onLoadDetail(item)">
               <div v-if="item.list.length > 0" class="flex flex-wrap break-all">
-                <span v-for="ip in item.list" :key="String(ip)" class="mr-2">{{ ip }}</span>
+                <span v-for="ip in item.list" :key="String(ip)" class="mr-2">{{ typeof ip == 'string' ? ip : ipSplicing(ip.startIp, ip.endIp) }}</span>
               </div>
               <div v-else>{{ t('marketingApps.noData') }}</div>
               <template #reference>
@@ -92,12 +92,11 @@ function addGroupsUnique(newGroups: IpItem[], ipType: number) {
   const targetList = getTargetList(ipType);
   const conflictType = ipType === IpType.WHITE ? IpType.BLACK : IpType.WHITE;
   const conflictList = getTargetList(conflictType);
-  const existIds = new Set(targetList.filter(i => i.sourceType === SourceType.DOMAIN).map(i => i.groupId));
+  const existIds = new Set(targetList.filter(i => i.sourceType === SourceType.GROUP).map(i => i.groupId));
   const conflictIds = new Set(conflictList.filter(i => i.sourceType === SourceType.GROUP).map(i => i.groupId));
-
   const conflict = newGroups.find(i => conflictIds.has(i.id as string));
   if (conflict) {
-    useMessage().warning(`分组 ${conflict.groupName} 已存在于 ${ipType === IpType.WHITE ? '黑名单' : '白名单'} 中`);
+    useMessage().error(`分组 ${conflict.groupName} 已存在于 ${ipType === IpType.WHITE ? '黑名单' : '白名单'} 中`);
     return;
   }
 
@@ -117,7 +116,7 @@ function addGroupsUnique(newGroups: IpItem[], ipType: number) {
     }));
     setTargetList(ipType, [...targetList, ...processedGroups]);
   } else {
-    useMessage().warning(t('marketingApps.addIpTip'));
+    useMessage().error(t('marketingApps.addIpTip'));
   }
 }
 
@@ -132,7 +131,7 @@ function addSinglesUnique(newSingles: IpItem[], ipType: number) {
   const conflict = newSingles.find(i => conflictIps.has(i.startIp));
   if (conflict) {
     console.log(conflict);
-    useMessage().warning(`IP ${conflict.startIp} 已存在于 ${ipType === IpType.WHITE ? '黑名单' : '白名单'} 中`);
+    useMessage().error(`IP ${conflict.startIp} 已存在于 ${ipType === IpType.WHITE ? '黑名单' : '白名单'} 中`);
     return;
   }
 
@@ -152,7 +151,7 @@ function addSinglesUnique(newSingles: IpItem[], ipType: number) {
     }));
     setTargetList(ipType, [...targetList, ...processedSingles]);
   } else {
-    useMessage().warning(t('marketingApps.addIpTip2'));
+    useMessage().error(t('marketingApps.addIpTip2'));
   }
 }
 

+ 4 - 3
src/views/marketing/apps/index.vue

@@ -286,7 +286,7 @@ const handleEdit = () => {
   console.log('被选中的项', selectObjs);
 
   if (selectObjs.value.length === 0) {
-    useMessage().warning('请选择要修改的项');
+    useMessage().error('请选择要修改的项');
     return;
   }
   EditDialogRef.value.openDialog('', selectObjs.value);
@@ -310,7 +310,7 @@ const onOpenStatistical = (row: any) => {
 // 拉黑操作
 const handleDelete = async (row: any) => {
   try {
-    await useMessageBox().confirm('是否确认拉黑该应用');
+    await useMessageBox().confirm(`是否确认${activeName.value == 'tab2' ? '还原' : '拉黑'}该应用`);
     await delAppById({
       id: row.id,
       status: activeName.value == 'tab2'
@@ -326,7 +326,8 @@ const handleDelete = async (row: any) => {
 const formatNum = (value: string | number = 0) => {
   let num = Number(value);
   if (num > 0 && num < 1) {
-    return num * 100 + '%';
+        return (num * 100).toFixed(2) + '%';
+
   } else if (num >= 1 && num < 10000) {
     return num;
   }

+ 13 - 2
src/views/marketing/config/index.vue

@@ -426,7 +426,6 @@ const onDel = async (data: any) => {
 			delOpen.value = false;
 			getConfig();
 		}
-
 		return;
 	}
 	try {
@@ -535,14 +534,26 @@ const getIpData = async () => {
 			url: '',
 			triggerNum: '',
 		};
+		
 		formData.value = {
 			...val.data,
 			triggerMode: val.data?.triggerMode.toString(),
 			triggerRule: val.data?.triggerRule.toString(),
-			triggerNum: parseFloat(val.data?.triggerNum) < 1 ? parseFloat(val.data?.triggerNum) * 100 + '%' : val.data?.triggerNum,
+			triggerNum: formatNum(val.data?.triggerNum),
 		};
 	});
 };
+// 格式化数据展示
+const formatNum = (value: string | number = 0) => {
+  let num = Number(value);
+  if (num > 0 && num < 1) {
+    return (num * 100).toFixed(2) + '%';
+  } else if (num >= 1 && num < 10000) {
+    return num;
+  }
+  return '--'
+}
+
 
 onMounted(() => {
 	//获取IP列表