Files
Situation-Awareness-Platfor…/src/views/Jyh/LicenseInfo/index.vue

173 lines
4.0 KiB
Vue
Raw Normal View History

2025-03-14 20:03:14 +08:00
<template>
<div class="license-info-container">
2025-03-15 12:01:11 +08:00
<div class="license-info-content">
2025-03-14 20:03:14 +08:00
<d-layout>
<d-content class="dcontent">
2025-03-20 16:30:06 +08:00
<d-table class="jyh-table" v-if="list.length > 0" :data="list" style="width: 100%">
<template #empty>
<NoData></NoData>
</template>
2025-03-15 12:01:11 +08:00
<d-column type="index" width="40"></d-column>
2025-03-25 09:15:17 +08:00
<d-column v-for="(column, index) in tableConfig" :field="column.field" :header="column.header"></d-column>
2025-03-14 20:03:14 +08:00
<d-column header="详情" width="100px">
<template #default="scope">
<a class="devui-link" @click="openPanel(scope.row)">查看</a>
2025-03-14 20:03:14 +08:00
</template>
</d-column>
</d-table>
2025-03-19 19:07:42 +08:00
<NoData v-else :small="false"></NoData>
2025-03-14 20:03:14 +08:00
</d-content>
</d-layout>
</div>
2025-03-20 16:30:06 +08:00
<div class="license-info-container-page" v-if="list.length > 0">
2025-03-15 12:01:11 +08:00
<d-pagination
size="sm"
:total="pager.total"
v-model:pageSize="pager.pageSize"
v-model:pageIndex="pager.pageIndex"
:can-view-total="true"
:can-change-page-size="true"
:can-jump-page="true"
:max-items="5"
/>
2025-03-14 20:03:14 +08:00
</div>
</div>
2025-03-20 16:30:06 +08:00
<d-drawer v-model="showDetail" style="width: 800px; padding: 20px">
<SidePanel :data="currentData" @close="close" />
2025-03-15 12:01:11 +08:00
</d-drawer>
2025-03-14 20:03:14 +08:00
</template>
<script setup lang="ts">
2025-03-25 09:15:17 +08:00
import { ref, defineProps } from 'vue';
2025-03-14 20:03:14 +08:00
import SidePanel from '@/components/LicenseInfo/SidePanel.vue';
2025-03-18 22:01:02 +08:00
import { getLicenseList } from '@/api/jyh';
import NoData from '@/components/NoData/NoData.vue';
2025-03-21 09:49:58 +08:00
const propsData = defineProps(['versionId']);
const currentData = ref(null);
2025-03-15 12:01:11 +08:00
const pager = ref({
pageIndex: 1,
pageSize: 30,
total: 10
2025-03-20 16:30:06 +08:00
});
const pageOptions = ref({});
2025-03-14 20:03:14 +08:00
const showDetail = ref(false);
const close = () => {
showDetail.value = false;
2025-03-20 16:30:06 +08:00
};
2025-03-14 20:03:14 +08:00
const openPanel = (row) => {
2025-03-20 16:30:06 +08:00
currentData.value = row;
2025-03-15 12:01:11 +08:00
showDetail.value = true;
2025-03-20 16:30:06 +08:00
};
2025-03-15 12:01:11 +08:00
2025-03-14 20:03:14 +08:00
const tableConfig = ref([
{
field: 'licenseName',
header: '许可证名称',
sortable: true,
sortMethod: null
},
{
field: 'category',
2025-03-14 20:03:14 +08:00
header: '许可证种类',
sortable: false,
sortMethod: null
2025-03-25 09:15:17 +08:00
}
2025-03-21 11:42:28 +08:00
// {
// field: 'affectedComponent',
// header: '影响软件',
// sortable: true,
// sortMethod: null
// },
// {
// field: 'version',
// header: '版本',
// sortable: true,
// sortMethod: null
// }
2025-03-20 16:30:06 +08:00
]);
2025-03-14 20:03:14 +08:00
const list = ref([
// {
// licenseName: 'Apache License 2.0',
// licenseType: '获准的',
// affectedComponent: 'org.apache.commons:commons-collections4',
// version: '4.4',
// },
// {
// licenseName: 'Apache License 2.0',
// licenseType: '获准的',
// affectedComponent: 'org.apache.commons:commons-collections4',
// version: '4.4',
// },
// {
// licenseName: 'Apache License 2.0',
// licenseType: '获准的',
// affectedComponent: 'org.apache.commons:commons-collections4',
// version: '4.4',
// },
// {
// licenseName: 'Apache License 2.0',
// licenseType: '获准的',
// affectedComponent: 'org.apache.commons:commons-collections4',
// version: '4.4',
// }
2025-03-20 16:30:06 +08:00
]);
2025-03-18 22:01:02 +08:00
2025-03-20 16:30:06 +08:00
const getList = async () => {
2025-03-21 09:49:58 +08:00
const res: any = await getLicenseList({
softwareId: propsData.versionId,
componentId: '',
current: pager.value.pageIndex,
2025-03-25 09:15:17 +08:00
size: pager.value.pageSize
2025-03-21 09:49:58 +08:00
});
if (!res.error) {
console.log(res);
list.value = res.data.data.records;
pager.value.total = res.data.data.records.length;
} else {
list.value = [];
}
2025-03-20 16:30:06 +08:00
};
2025-03-18 22:01:02 +08:00
getList();
2025-03-14 20:03:14 +08:00
</script>
<style scoped lang="scss">
.license-info-container {
display: flex;
2025-03-15 12:01:11 +08:00
gap: 12px;
flex-direction: column;
2025-03-14 20:03:14 +08:00
width: 100%;
.license-info-content {
2025-03-15 12:01:11 +08:00
background-color: $devui-global-bg-normal;
border-radius: 10px;
}
&-page {
width: 100%;
display: flex;
justify-content: end;
2025-03-14 20:03:14 +08:00
}
}
.dheader {
display: flex;
flex-direction: row;
align-items: center;
gap: 12px;
padding: 12px;
}
2025-03-15 12:01:11 +08:00
.dfooter {
display: flex;
justify-content: end;
2025-03-20 16:30:06 +08:00
margin-top: 20px;
2025-03-14 20:03:14 +08:00
}
.operation {
cursor: pointer;
width: 14px;
height: 14px;
}
</style>