Files
Situation-Awareness-Platfor…/src/views/Jyh/Search/Components/BatchVerify.vue
2025-03-15 12:03:07 +08:00

337 lines
15 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div class="BatchVerify">
<div class="search-form">
<d-button class="mr-2" variant="solid" :loading="loadingStatus.batchMigrating" @click="handleBatchImport">批量导入</d-button>
<d-input
style="width: 400px"
v-model="formData.title"
placeholder="请输入搜索内容"
maxLength="50"
minLength="2"
>
<template #prefix>
<d-icon name="search" style="font-size: inherit;"></d-icon>
</template>
</d-input>
<d-button class="output-btn" icon="icon-share" variant="text">导出</d-button>
</div>
<div class="mt-3 px-20">
<d-table class="jyh-table" v-if="tableData.length" :striped="false" :data="tableData" table-layout="auto">
<d-column type="index" width="40"></d-column>
<d-column field="result" header="校验结果" filterable :filter-list="filterList" @filter-change="handleFilterChange">
<template #default="scope">
<div v-if="scope.row.result==1" style="display: flex;align-items: center">
<d-icon class="mr-1" name="icon-right-o" style="font-size: 14px;color: rgb(80, 212, 171)"></d-icon>
<span>校验通过</span>
</div>
<div v-else style="display: flex;align-items: center">
<d-icon class="mr-1" name="icon-error-o" style="font-size: 14px;color: rgb(246, 111, 106)"></d-icon>
<span>未通过校验</span>
</div>
</template>
</d-column>
<d-column field="versionName" header="选取版本火车名称" filterable :filter-list="filterList" @filter-change="handleFilterChange">
<template #default="scope">
<a>{{scope.row.versionName}}</a>
</template>
</d-column>
<d-column field="name" header="软件名称" filterable :filter-list="filterList" @filter-change="handleFilterChange"></d-column>
<d-column field="code" header="软件编码" filterable :filter-list="filterList" @filter-change="handleFilterChange"></d-column>
<d-column field="version" header="软件版本" filterable :filter-list="filterList" @filter-change="handleFilterChange">
<template #default="scope">
<a @click="gotoDetail(scope.row)">{{scope.row.version}}</a>
</template>
</d-column>
<d-column field="versionCode" header="版本编码" sortable :sort-method="sortNameMethod" filterable :filter-list="filterList" @filter-change="handleFilterChange">
<template #default="scope">
<a @click="gotoDetail(scope.row)">{{scope.row.versionCode}}</a>
</template>
</d-column>
<d-column field="smStatus" header="生命周期状态" sortable :sort-method="sortNameMethod" filterable :filter-list="filterList" @filter-change="handleFilterChange">
<template #default="scope">
<a>{{scope.row.smStatus}}</a>
</template>
</d-column>
<d-column field="type" header="主/依赖软件类型">
<template #default="scope">
<d-tag type="success">{{scope.row.type}}</d-tag>
</template>
</d-column>
<d-column field="license" header="License名称" filterable :filter-list="filterList" @filter-change="handleFilterChange">
<template #default="scope">
<span class="mr-2">{{scope.row.license}}</span>
<d-tag color="gray">+3</d-tag>
</template>
</d-column>
<d-column field="url" header="官网漏洞披露地址">
<template #default="scope">
<a>{{scope.row.url}}</a>
</template>
</d-column>
<!-- <d-column field="risk" header="集成风险"></d-column>-->
<!-- <d-column field="useType" header="适用类型"></d-column>-->
<!-- <d-column field="status" header="状态">-->
<!-- <d-status>未开始</d-status>-->
<!-- </d-column>-->
<!-- <d-column field="key" header="键值"></d-column>-->
<!-- <d-column field="created" header="创建时间"></d-column>-->
<!-- <d-column field="updated" header="更新时间"></d-column>-->
<!-- <d-column header="操作" width="300">-->
<!-- <template #default="scope">-->
<!-- <div class="flex">-->
<!-- <div class="cursor-pointer flex items-center mr-[32px]" @click="editRow(scope.row)">-->
<!-- <GIcon class="mr-[8px]" name="gt-plane-edit" />-->
<!-- <span class="text-[#3B3E55] text-base font-normal">编辑</span>-->
<!-- </div>-->
<!-- <div class="flex items-center mr-[32px]">-->
<!-- <d-switch v-model="scope.row.status" class="mr-[8px]" @change="setClaStatus(scope.row)"-->
<!-- :active-value="1" :inactive-value="0"> </d-switch>-->
<!-- <span class="text-[#3B3E55] text-base font-normal">{{ scope.row.status === 0 ? '停用' : '启用' }}</span>-->
<!-- </div>-->
<!-- <div class="cursor-pointer flex items-center" @click="openDelete(scope.row)">-->
<!-- <GIcon class="mr-[8px]" name="gt-plane-delete" />-->
<!-- <span class="text-[#3B3E55] text-base font-normal">删除</span>-->
<!-- </div>-->
<!-- </div>-->
<!-- </template>-->
<!-- </d-column>-->
</d-table>
<DataPanel v-else skeleton :card="false" :empty="true">
</DataPanel>
</div>
<div class="mt-20 mb-20 flex justify-end">
<d-pagination size="md" :page-size-options="[10, 20, 50]" :total="pager.total"
v-model:pageSize="pager.pageSize" v-model:pageIndex="pager.pageIndex" :max-items="5"
:can-change-page-size="true" :can-view-total="true" total-item-text="总计" @page-index-change="changeIndex()"
@page-size-change="changeSize()" />
</div>
<!-- 删除组件 -->
<GModal v-model="deletevModels" ref="deleteModal" title="删除?" @confirm="confirmDelete" showWarnIcon
confirmColor="danger">
<span class="inline-block text-G900 text-sm font-normal leading-[20px] break-all">你确认删除此项{{ item.cla_name }}
</span>
</GModal>
</div>
</template>
<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 { getGroupClaList, setGroupClaStatus, deleteGroupCla } from '@/api/cla';
import { useRouter, useRoute } from 'vue-router';
import { GModal } from '@/components/Setting/index';
import { reqCatch } from '@/utils/catch';
import { getOrgInfo } from '@/views/Org/hooks/orgInfo';
import { Message } from 'vue-devui';
const { namespace } = getOrgInfo();
const tableData = ref([
{result:1, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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 formData = ref({ title: '',type: '', useType: '',formData:'',select: '',time1:null,name:'',versionCode:'',pulishTime:'' });
const typeOptions = reactive(['主软件', '依赖软件']);
const riskOptions = reactive(['低', '中', '高']);
const useTypeOptions = reactive(['软件', '文档', '文档+软件']);
const isUseOptions = reactive(['是', '否']);
const pager = ref({
total: 10,
pageIndex: 1,
pageSize: 10
});
const loadingStatus = reactive({
batchMigrating: false
});
// 删除弹窗
const item = ref('');
const deleteModal = ref();
const deletevModels = ref(false);
const openDelete = (row: any) => {
item.value = row;
deleteModal.value.showFlag = true;
deletevModels.value = true;
};
const router = useRouter();
const handleBatchImport = async() => { // 多个项目导入
// importRepo.value = queryTable.value.filter((val) => val.checked);
loadingStatus.batchMigrating = true;
// await batchMigrate();
loadingStatus.batchMigrating = false;
};
// 跳转
const gotoDetail = (row) => {
// 后续请换成params暂时params传参没传过去
router.push({
path: 'repoDetail/' + row.version
});
};
// 分页
const changeIndex = () => {
// getGroupClaListData();
};
const changeSize = () => {
pager.value.pageIndex = 1;
// getGroupClaListData();
};
const repoFun = (arr: any) => {
return arr ? (arr.length > 3 ? arr.slice(0, 3) : arr) : [];
};
// 编辑
const editRow = (row: any) => {
// 后续请换成params暂时params传参没传过去
router.push({
path: 'cla/edit/' + row.object_id,
query: { cla: row.cla, pageType: 'edit' }
});
};
// 确认删除
const confirmDelete = async (e: any) => {
// const res = await reqCatch(deleteGroupCla, { group_id: namespace.value, cla_id: item.value.object_id });
// if (!res.error) {
// getGroupClaListData();
// }
};
// 去成员页
const goMember = (row: any) => {
// 后续请换成params暂时params传参没传过去,注意路由有个:claID
router.push({
path: 'cla/claId/member',
query: { claId: row.object_id, claName: row.cla_name, group_path: namespace.value, pageType: 'edit' }
});
};
const getGroupClaListData = async () => {
// const params = {
// group_id: namespace.value,
// page: pager.value.pageIndex,
// per_page: pager.value.pageSize
// };
// const res = await reqCatch(getGroupClaList, params);
// if (!res.error) {
// tableData.value = res?.data?.data?.content;
// pager.value.total = res.data.data.total;
// }
};
getGroupClaListData();
const setClaStatus = async (row: any) => {
// const params = {
// group_id: namespace.value,
// cla_id: row.object_id,
// status: row.status
// };
// const res = await reqCatch(setGroupClaStatus, params);
// if (!res.error) {
// Message.success('操作成功!');
// getGroupClaListData();
// }
};
const signCla = (row: any) => {
router.push('/cla/' + row.object_id);
};
</script>
<style scoped lang="scss">
@import 'devui-theme/styles-var/devui-var.scss';
.BatchVerify {
position: relative;
.secret-op {
position: absolute;
right: 0;
top: 0;
}
}
.error {
color: $devui-contrast;
}
:deep(.devui-table__row td) {
padding-top: 16px;
padding-bottom: 16px;
}
:deep(.devui-tag .devui-tag--default) {
background-color: #fff;
border-radius: 12px;
padding: 4px 8px;
font-size: 12px;
line-height: 16px;
margin-right: 8px;
border: 1px solid #E3E3EE;
}
.one-line {
word-break: break-all;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.title {
font-size: 14px;
font-weight: 400;
color: #9a9b9c;
line-height: 20px;
}
.cur-title {
font-size: 14px;
font-weight: 500;
color: #2d2d2e;
line-height: 20px;
}
.search-form {
position: relative;
padding: 12px 20px;
display: flex;
border-radius: 8px 0px 8px 8px;
//background: #F2F5FC;
.output-btn {
position: absolute;
right: 28px;
bottom: 4px;
color: #191919;
font-family: HarmonyOS Sans SC;
font-weight: regular;
font-size: 14px;
line-height: 22px;
letter-spacing: 0px;
text-align: left;
}
}
.secret-breadcrumb {
padding: 7px 20px 12px;
background: #ffffff;
}
</style>