| | |
| | | <template> |
| | | <el-collapse v-model="activeName" accordion> |
| | | <!-- <el-collapse v-model="activeName" accordion> |
| | | <el-collapse-item |
| | | v-for="item in threeResourceLogs" |
| | | :key="item.id" |
| | |
| | | > |
| | | </ProForm> |
| | | </el-collapse-item> |
| | | </el-collapse> |
| | | </el-collapse> --> |
| | | <AppContainer> |
| | | <ProTableV2 |
| | | :columns="columns" |
| | | :show-pagination="false" |
| | | :table-data="threeResourceLogs" |
| | | :column-render-map="columnsRenderProps" |
| | | > |
| | | <template #requestHeaders="{ row }"> |
| | | <el-button type="primary" link @click="handleAdd({ json: JSON.parse(row.requestHeaders) })" |
| | | >查看</el-button |
| | | > |
| | | </template> |
| | | <template #request="{ row }"> |
| | | <el-button type="primary" link @click="handleAdd({ json: JSON.parse(row.request) })" |
| | | >查看</el-button |
| | | > |
| | | </template> |
| | | <template #responseHeaders="{ row }"> |
| | | <el-button type="primary" link @click="handleAdd({ json: JSON.parse(row.responseHeaders) })" |
| | | >查看</el-button |
| | | > |
| | | </template> |
| | | <template #response="{ row }"> |
| | | <el-button type="primary" link @click="handleAdd({ json: JSON.parse(row.response) })" |
| | | >查看</el-button |
| | | > |
| | | </template> |
| | | <template #createdUser="{ row }"> |
| | | <el-button |
| | | type="primary" |
| | | link |
| | | @click="handleAdd({ json: JSON.parse(JSON.stringify(row.createdUser)) })" |
| | | >查看</el-button |
| | | > |
| | | </template> |
| | | </ProTableV2> |
| | | <JsonViewerDialog v-bind="dialogProps" /> |
| | | </AppContainer> |
| | | </template> |
| | | |
| | | <script setup lang="ts"> |
| | | import { ProForm, ProFormItemV2 } from '@bole-core/components'; |
| | | import { |
| | | AppContainer, |
| | | ProTableV2, |
| | | defineColumns, |
| | | ProTableV2Props, |
| | | useFormDialog, |
| | | } from '@bole-core/components'; |
| | | import { EnumResourceMethodText } from '@/constants'; |
| | | import JsonViewer from 'vue-json-viewer'; |
| | | |
| | | import { format } from '@/utils'; |
| | | import JsonViewerDialog from './JsonViewerDialog.vue'; |
| | | |
| | | defineOptions({ |
| | | name: 'ThreeResourceLogsView', |
| | |
| | | type Props = { |
| | | threeResourceLogs: API.GetThreeResourceLogsQueryResultItem[]; |
| | | }; |
| | | const activeName = ref('1'); |
| | | const props = withDefaults(defineProps<Props>(), { |
| | | threeResourceLogs: () => [] as API.GetThreeResourceLogsQueryResultItem[], |
| | | }); |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | @use '@/style/common.scss' as *; |
| | | </style> |
| | | const columns = defineColumns( |
| | | [ |
| | | 'method', |
| | | 'domain', |
| | | 'path', |
| | | 'requestHeaders', |
| | | 'request', |
| | | 'responseHeaders', |
| | | 'response', |
| | | 'isSuccess', |
| | | 'elapsedMilliseconds', |
| | | 'createdUser', |
| | | 'createdTime', |
| | | ].map((x, index) => ({ |
| | | id: index + '', |
| | | enCode: x, |
| | | name: x, |
| | | width: 160, |
| | | })) |
| | | ); |
| | | |
| | | const columnsRenderProps: ProTableV2Props['columnRenderMap'] = { |
| | | method: { type: 'enum', valueEnum: EnumResourceMethodText }, |
| | | isSuccess: { |
| | | formatter: (row: API.GetResourceLogsQueryResultItem) => { |
| | | return row.isSuccess ? '是' : '否'; |
| | | }, |
| | | }, |
| | | createdTime: { type: 'date', format: 'YYYY-MM-DD HH:mm:ss' }, |
| | | }; |
| | | |
| | | const { dialogProps, handleAdd } = useFormDialog({ |
| | | defaultFormParams: { |
| | | json: null, |
| | | }, |
| | | }); |
| | | </script> |