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

170 lines
3.8 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-15 12:01:11 +08:00
<d-table :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-14 20:03:14 +08:00
<d-column v-for="(column, index) in tableConfig" :field="column.field"
:header="column.header" :sortable="column.sortable" :sort-method="column.sortMethod"></d-column>
<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>
</d-content>
</d-layout>
</div>
2025-03-15 12:01:11 +08:00
<div class="license-info-container-page">
<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-15 12:01:11 +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">
import { ref } from 'vue';
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';
const currentData = ref(null);
2025-03-15 12:01:11 +08:00
const pager = ref({
pageIndex: 1,
pageSize: 30,
total: 10
})
const pageOptions = ref({
})
2025-03-14 20:03:14 +08:00
const showDetail = ref(false);
const close = () => {
showDetail.value = false;
}
const openPanel = (row) => {
currentData.value = row
2025-03-15 12:01:11 +08:00
showDetail.value = true;
}
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
},
{
field: 'affectedComponent',
header: '影响软件',
2025-03-14 20:03:14 +08:00
sortable: true,
sortMethod: null
},
{
field: 'version',
header: '版本',
sortable: true,
sortMethod: null
}
])
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-14 20:03:14 +08:00
])
2025-03-18 22:01:02 +08:00
const getList = async() => {
const res: any = await getLicenseList();
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-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;
margin-top: 20px
2025-03-14 20:03:14 +08:00
}
.operation {
cursor: pointer;
width: 14px;
height: 14px;
}
</style>