Merge branch 'master' of https://gitcode.com/hk_openRepo/OpenRepo_Portal into dev-shenjianbin

This commit is contained in:
MaxShen
2025-03-18 21:02:00 +08:00
6 changed files with 198 additions and 66 deletions

View File

@@ -50,3 +50,39 @@ export function subscribeSoftware(params): catchRt<any> {
customError: true
}));
}
// 获取高级筛选语言列表
export function searchLanguageList() {
return request({
url: `/api/v1/repo/lan/list`,
method: 'get'
});
}
// 获取首页公告列表
export function getHomeNoticeList() {
return request({
url: '/api/v1/home/notice/list',
method: 'get',
params: {}
});
}
// 获取依赖关系列表
export function getDepencyList(softwareId: string) {
return request({
url: '/api/v1/repo/release/info',
method: 'get',
params: { softwareId: 2 }
});
}
// 获取AI修复建议
export function getRepairInfo() {
return request({
url: '/api/v1/repo/repair/info',
method: 'get',
params: {}
});
}

View File

@@ -3,7 +3,30 @@
:key="$route.path + $route.query?.val" id="golbalSearch" class="g-header-search"
v-model.trim="searchStr" placeholder="输入搜索内容..." @keyup.enter="search" @clear="handleClear" clearable >
<template #prepend>
<d-select v-model="searchType" :options="options"></d-select>
<d-dropdown @toggle="onCateToggle($event)">
<div class="flex items-center gap-1 cursor-pointer">
{{ searchType }}
<d-icon :rotate="cateRotate" name="icon-chevron-down-2"></d-icon>
</div>
<template #menu>
<ul class="list-menu">
<li class="menu-item" @click="onCategoryChange('软件')">软件</li>
<d-dropdown :position="position" :offset="0">
<li class="menu-item">
行业
<i class="icon icon-chevron-right"></i>
</li>
<template #menu>
<ul class="list-menu">
<li class="menu-item" v-for="option in industryOptions" @click="onCategoryChange(option)">
{{ option }}
</li>
</ul>
</template>
</d-dropdown>
</ul>
</template>
</d-dropdown>
</template>
<template #append>
<d-icon @click="search" name="search" style="font-size: inherit;" />
@@ -19,11 +42,16 @@ import microApp from '@micro-zoe/micro-app';
const route = useRoute();
const router = useRouter();
const searchStr = ref(route?.query?.val || '');
const searchType = ref('License');
const options = reactive(['License']);
const searchType = ref('软件');
const position = ref(['right-start', 'right-end']);
const industryOptions = ref(['通信', '军工', '金融', '能源']);
const placeholder = ref('「开搜」一搜即达开发者的AI搜索');
const onCategoryChange = (event) => {
searchType.value = event;
}
const search = () => {
if (!searchStr.value) {
document.querySelector('#golbalSearch').blur();
@@ -81,4 +109,23 @@ onUnmounted(() => {
width: 40px;
}
}
.menu-item {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
padding: 4px;
cursor: pointer;
&:hover {
background-color: var(--devui-list-item-hover-bg, #f2f5fc);
color: var(--devui-list-item-hover-text, #526ecc);
}
}
.list-menu {
padding: 8px;
margin: 0;
width: 100px;
}
</style>

View File

@@ -37,7 +37,7 @@
<template #append>
<div class="advanced-search" @click="openAdvancedSearch">
<span>高级筛选</span>
<d-badge :count="5" :bg-color="'#f0f0f0'"></d-badge>
<d-badge :count="6" :bg-color="'#f0f0f0'"></d-badge>
<d-icon :rotate="rotate" name="icon-chevron-down-2"></d-icon>
</div>
</template>
@@ -68,11 +68,14 @@
<d-timeline-item v-for="(item, index) in infoList" :key="index"
:dot-color="item.dotColor" :line-color="'var(--devui-form-control-line-hover)'">
<template #default>
<div style="display: flex; justify-content: space-between;">
<div class="cursor-pointer" @click="openWarningDetail(item.text, index)">{{ item.text }}</div>
<div style="display: flex; align-items: center; gap: 8px;">
<div class="flex items-center justify-between w-full">
<div class="cursor-pointer notice-content flex gap-2 items-center" @click="openWarningDetail(item, index)">
<span>{{ item.subject }}</span>
<d-tag :color="tagMap[item.importance]" size="sm">{{ item.importance }}</d-tag>
</div>
<div class="time-container">
<d-icon name="icon-time"></d-icon>
{{ item.time }}
{{ item.pulishTime }}
</div>
</div>
</template>
@@ -85,12 +88,18 @@
</div>
</div>
</div>
<d-modal class="warning-modal" v-model="warningModalVisable" title="主题:" style="width: 600px;">
<EarlyWarningDetail :warningData="currentWarning" :type="'user'"></EarlyWarningDetail>
</d-modal>
</template>
<script setup lang="ts">
import { ref, onMounted, onBeforeUnmount } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import AdvanceSearch from '@/components/AdvanceSearch/index.vue';
import { getHomeNoticeList } from '@/api/jyh'
import EarlyWarningDetail from '@/views/Jyh/PersonalCenter/Detail/EarlyWarningDetail.vue';
const route = useRoute();
const router = useRouter();
@@ -104,30 +113,18 @@ const offset = ref({ mainAxis: 7 , crossAxis: -10 });
const isOpen = ref(false);
const rotate = ref(0);
const cateRotate = ref(0);
const infoList = ref([
{
text: '公告1',
time: '2021-10-1',
dotColor: 'var(--devui-info)',
},
{
text: '公告2',
time: '2021-10-2',
dotColor: 'var(--devui-info)',
},
{
text: '公告3',
time: '2021-10-3',
},
{
text: '公告4',
time: '2021-10-3',
},
])
const infoList = ref([])
const warningModalVisable = ref(false);
const currentWarning = ref();
const homeSearch = ref(null);
const dropdownWidth = ref(0);
const selectedCate = ref('软件');
const tagMap = {
'高': '#f66f6a',
'中': '#fac20a',
'低': '#5e7ce0'
}
const searchInput = ref(null);
const openAdvancedSearch = () => {
@@ -149,7 +146,7 @@ const closeOutside = () => {
const submit = (formData) => {
isOpen.value = false;
router.push({ name: 'Search', query: { ...formData, searchType: selectedCate.value }});
router.push({ name: 'Search', query: { searchWord: searchStr, ...formData, searchType: selectedCate.value}});
};
const inputFocus = () => {
@@ -167,7 +164,7 @@ const updateDropdownWidth = () => {
};
const search = () => {
router.push({ name: 'Search', query: { val: searchStr.value || '', type: route?.query?.type || 'License' }});
router.push({ name: 'Search', query: { searchWord: searchStr.value, searchType: selectedCate.value}});
};
const onCategoryChange = (cate) => {
@@ -190,6 +187,9 @@ const openWarningDetail = (event, index) => {
item.dotColor = '';
}
})
warningModalVisable.value = true;
currentWarning.value = event;
}
let resizeObserver: ResizeObserver | null = null;
@@ -209,6 +209,15 @@ onBeforeUnmount(() => {
}
});
const getNoticeList = async() => {
const res:any = await getHomeNoticeList();
if (!res.error) {
infoList.value = res.data.data;
}
}
getNoticeList();
</script>
<style scoped lang="scss">
@@ -381,4 +390,37 @@ onBeforeUnmount(() => {
font-size: 14px;
font-weight: 500;
}
.notice-content {
flex: 1;
overflow: hidden;
margin-right: 8px;
span {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: block;
}
}
.time-container {
display: flex;
align-items: center;
gap: 8px;
width: 120px;
flex-shrink: 0;
}
:deep(.devui-timeline-item-data-right) {
width: 80%;
}
</style>
<style>
.warning-modal {
.devui-modal__body {
padding: 0px !important;
}
}
</style>

View File

@@ -22,14 +22,14 @@
<span>可使用</span>
<span class="green">3</span>
<span style="height: 14px" class="split"></span>
<span>未治理</span>
<span class="yellow">3</span>
<span style="height: 14px" class="split"></span>
<span>有风险</span>
<span class="red">3</span>
<span style="height: 14px" class="split"></span>
<span>未治理</span>
<span class="yellow">3</span>
</div>
<div class="left-btn">
<a class="cursor-pointer" href="/static/template.xlsx" download><i class="icon icon-download-2"></i>下载excel模板</a>
<a v-if="isLogin" class="cursor-pointer" href="/static/template.xlsx" download><i class="icon icon-download-2"></i>下载excel模板</a>
<span v-if="isLogin" style="height: 14px" class="split"></span>
<d-button v-if="isLogin" class="output-btn" icon="icon-share" variant="text">导出</d-button>
<span v-if="isLogin" style="height: 14px" class="split"></span>
@@ -72,8 +72,11 @@
<template v-else-if="column.key === 'versionName'">
<a>{{ scope.row.versionName }}</a>
</template>
<template v-else-if="column.key === 'version'">
<a @click="gotoDetail(scope.row)">{{ scope.row.version }}</a>
<template v-else-if="column.key === 'softwareName'">
<a @click="gotoDetail(scope.row)">{{ scope.row.softwareName }}</a>
</template>
<template v-else-if="column.key === 'softwareVersion'">
<a @click="gotoDetail(scope.row)">{{ scope.row.softwareVersion }}</a>
</template>
<template v-else-if="column.key === 'versionCode'">
<a @click="gotoDetail(scope.row)">{{ scope.row.versionCode }}</a>
@@ -98,6 +101,7 @@
</d-column>
</template>
<d-column header="操作" width="200" fixed-right="0px">
<!--TODO:申请入口只有校验不通过的才显示-->
<template #default="scope">
<d-button
variant="text"
@@ -132,7 +136,7 @@
<script setup lang="ts">
import SettingTitle from '@/components/Setting/SettingTitle/index.vue';
import SettingText from '@/components/Setting/SettingText/index.vue';
import { ref,reactive } from 'vue';
import { ref, reactive, onMounted } from 'vue';
import { getGroupClaList, setGroupClaStatus, deleteGroupCla } from '@/api/cla';
import { useRouter, useRoute } from 'vue-router';
import { GModal } from '@/components/Setting/index';
@@ -143,6 +147,7 @@ import { useAccountStore } from '@/stores/user';
import { storeToRefs } from 'pinia';
import TableSetting from '@/components/TableSetting/index.vue';
import FileUploadButton from '@/components/FileUploadButton/index.vue';
import { releasePage } from '@/api/jyh';
// 处理文件上传
const handleFileUpload = async (file) => {
@@ -161,35 +166,16 @@ const { isLogin } = storeToRefs(userInfo);
const { namespace } = getOrgInfo();
const tableData = ref([
{result:1,tjsj: '可使用', versionName:'CleanSource V8.0', name:'eslint-plugin-import',code: '05811AFV',version: '2.29.0',versionCode: '0583423820',smStatus: '同主软件(GA)',type:'依赖软件',license:'Apache License V2.0',risk:'中',useType:'软件',status:'未开始',url:'https://example17.com/security_updates_page',key:'',created:'2025-03-10 17:25:19',updated:'2025-03-10 17:25:19'},
{result:1,tjsj: '可使用', versionName:'CleanSource V8.0', name:'eslint-plugin-import',code: '05811AFV',version: '2.29.0',versionCode: '0583423820',smStatus: '同主软件(GA)',type:'依赖软件',license:'Apache License V2.0',risk:'中',useType:'软件',status:'未开始',url:'https://example17.com/security_updates_page',key:'',created:'2025-03-10 17:25:19',updated:'2025-03-10 17:25:19'},
{result:0,tjsj: '可使用', versionName:'CleanSource V8.0', name:'eslint-plugin-import',code: '05811AFV',version: '2.29.0',versionCode: '0583423820',smStatus: '同主软件(GA)',type:'依赖软件',license:'Apache License V2.0',risk:'中',useType:'软件',status:'未开始',url:'https://example17.com/security_updates_page',key:'',created:'2025-03-10 17:25:19',updated:'2025-03-10 17:25:19'},
{result:0,tjsj: '可使用', versionName:'CleanSource V8.0', name:'eslint-plugin-import',code: '05811AFV',version: '2.29.0',versionCode: '0583423820',smStatus: '同主软件(GA)',type:'依赖软件',license:'Apache License V2.0',risk:'中',useType:'软件',status:'未开始',url:'https://example17.com/security_updates_page',key:'',created:'2025-03-10 17:25:19',updated:'2025-03-10 17:25:19'},
{result:0,tjsj: '可使用', versionName:'CleanSource V8.0', name:'eslint-plugin-import',code: '05811AFV',version: '2.29.0',versionCode: '0583423820',smStatus: '同主软件(GA)',type:'依赖软件',license:'Apache License V2.0',risk:'中',useType:'软件',status:'未开始',url:'https://example17.com/security_updates_page',key:'',created:'2025-03-10 17:25:19',updated:'2025-03-10 17:25:19'},
{result:1,tjsj: '可使用', versionName:'CleanSource V8.0', name:'eslint-plugin-import',code: '05811AFV',version: '2.29.0',versionCode: '0583423820',smStatus: '同主软件(GA)',type:'依赖软件',license:'Apache License V2.0',risk:'中',useType:'软件',status:'未开始',url:'https://example17.com/security_updates_page',key:'',created:'2025-03-10 17:25:19',updated:'2025-03-10 17:25:19'},
{result:2,tjsj: '可使用', versionName:'CleanSource V8.0', name:'eslint-plugin-import',code: '05811AFV',version: '2.29.0',versionCode: '0583423820',smStatus: '同主软件(GA)',type:'依赖软件',license:'Apache License V2.0',risk:'中',useType:'软件',status:'未开始',url:'https://example17.com/security_updates_page',key:'',created:'2025-03-10 17:25:19',updated:'2025-03-10 17:25:19'},
{result:2,tjsj: '可使用', versionName:'CleanSource V8.0', name:'eslint-plugin-import',code: '05811AFV',version: '2.29.0',versionCode: '0583423820',smStatus: '同主软件(GA)',type:'依赖软件',license:'Apache License V2.0',risk:'中',useType:'软件',status:'未开始',url:'https://example17.com/security_updates_page',key:'',created:'2025-03-10 17:25:19',updated:'2025-03-10 17:25:19'},
{result:1,tjsj: '可使用', versionName:'CleanSource V8.0', name:'eslint-plugin-import',code: '05811AFV',version: '2.29.0',versionCode: '0583423820',smStatus: '同主软件(GA)',type:'依赖软件',license:'Apache License V2.0',risk:'中',useType:'软件',status:'未开始',url:'https://example17.com/security_updates_page',key:'',created:'2025-03-10 17:25:19',updated:'2025-03-10 17:25:19'},
{result:1,tjsj: '可使用', versionName:'CleanSource V8.0', name:'eslint-plugin-import',code: '05811AFV',version: '2.29.0',versionCode: '0583423820',smStatus: '同主软件(GA)',type:'依赖软件',license:'Apache License V2.0',risk:'中',useType:'软件',status:'未开始',url:'https://example17.com/security_updates_page',key:'',created:'2025-03-10 17:25:19',updated:'2025-03-10 17:25:19'},
]);
const tableData = ref([]);
const columns = ref([
{ key: 'result', label: '校验结果', visible: true, filterable: true, sortable: false },
{ key: 'versionName', label: '选取版本火车名称', visible: true, filterable: true, sortable: false },
{ key: 'name', label: '软件名称', visible: true, filterable: true, sortable: false },
{ key: 'code', label: '软件编码', visible: true, filterable: true, sortable: false },
{ key: 'version', label: '软件版本', visible: true, filterable: true, sortable: false },
{ key: 'versionCode', label: '版本编码', visible: true, filterable: true, sortable: true },
{ key: 'smStatus', label: '生命周期状态', visible: true, filterable: true, sortable: true },
{ key: 'type', label: '主/依赖软件类型', visible: true, filterable: false, sortable: false },
{ key: 'license', label: 'License名称', visible: true, filterable: true, sortable: false },
{ key: 'url', label: '官网漏洞披露地址', visible: true, filterable: false, sortable: false },
{ key: 'risk', label: '集成风险', visible: false, filterable: false, sortable: false }, // 隐藏字段
{ key: 'useType', label: '适用类型', visible: false, filterable: false, sortable: false }, // 隐藏字段
{ key: 'status', label: '状态', visible: false, filterable: false, sortable: false }, // 隐藏字段
{ key: 'key', label: '键值', visible: false, filterable: false, sortable: false }, // 隐藏字段
{ key: 'created', label: '创建时间', visible: false, filterable: false, sortable: false }, // 隐藏字段
{ key: 'updated', label: '更新时间', visible: false, filterable: false, sortable: false }, // 隐藏字段
{ key: 'softwareName', label: '软件名称', visible: true, filterable: true, sortable: false },
{ key: 'softwareVersion', label: '软件版本', visible: true, filterable: true, sortable: false },
{ key: 'securityScore', label: '软件评分', visible: true, filterable: false, sortable: true },
{ key: 'licenseCount', label: 'License数量', visible: true, filterable: false, sortable: false },
{ key: 'industryCategory', label: '行业类型', visible: true, filterable: true, sortable: false },
{ key: 'primaryLanguage', label: '编程语言', visible: true, filterable: true, sortable: false },
{ key: 'codeLines', label: '代码量', visible: true, filterable: false, sortable: false },
]);
const formData = ref({ title: '',type: '', useType: '',formData:'',select: '',time1:null,name:'',versionCode:'',pulishTime:'' });
const typeOptions = reactive(['主软件', '依赖软件']);
@@ -217,6 +203,20 @@ const openDelete = (row: any) => {
deletevModels.value = true;
};
const getReleaseList = async() => {
const { data, error } = await releasePage({ current: pager.value.pageIndex,size: pager.value.pageSize });
if (!error && data) {
debugger
tableData.value = data.data.records;
pager.value.total = data.data.total;
}
};
onMounted(async() => {
getReleaseList();
});
const router = useRouter();
// 定义 showColumnList 状态
@@ -238,6 +238,7 @@ const handleBatchImport = async() => { // 多个项目导入
// 跳转
const gotoDetail = (row) => {
<!--TODO:如果是可使用有风险的点击软件版本可跳转到软件详情页面如果是未治理的无法跳转-->
// 后续请换成params暂时params传参没传过去
router.push({
path: 'repoDetail/' + row.version

View File

@@ -67,6 +67,7 @@
</template>
<script setup lang="ts">
import { ref, reactive } from 'vue';
import { getDepencyList } from '@/api/jyh'
const checked = ref(false);
const showDetail = ref(false);
const table = ref(null)
@@ -216,6 +217,11 @@ const openAll = (tree) => {
const sortNumberMethod = (a, b) => {
return a.number > b.number
}
const getList = async() => {
const res = await getDepencyList('APACHE-001');
}
getList();
</script>
<style scoped lang="scss">