|  |  |  | 
|---|
|  |  |  | <template> | 
|---|
|  |  |  | <el-collapse v-model="activeName" accordion> | 
|---|
|  |  |  | <el-collapse-item | 
|---|
|  |  |  | v-for="item in exceptionLogs" | 
|---|
|  |  |  | :key="item.createdTime" | 
|---|
|  |  |  | name="1" | 
|---|
|  |  |  | style="overflow: auto; max-height: 600px" | 
|---|
|  |  |  | <AppContainer> | 
|---|
|  |  |  | <ProTableV2 | 
|---|
|  |  |  | :columns="columns" | 
|---|
|  |  |  | :show-pagination="false" | 
|---|
|  |  |  | :table-data="exceptionLogs" | 
|---|
|  |  |  | :column-render-map="columnsRenderProps" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <ProForm :model="item" is-read> | 
|---|
|  |  |  | <ProFormItemV2 label="type:"> | 
|---|
|  |  |  | {{ item.type }} | 
|---|
|  |  |  | </ProFormItemV2> | 
|---|
|  |  |  | <ProFormItemV2 label="code:">{{ item.code }} </ProFormItemV2> | 
|---|
|  |  |  | <ProFormItemV2 label="message:"> {{ item.message }}</ProFormItemV2> | 
|---|
|  |  |  | <ProFormItemV2 label="stackTrace:"> {{ item.stackTrace }}</ProFormItemV2> | 
|---|
|  |  |  | <ProFormItemV2 label="createdUser:"> | 
|---|
|  |  |  | <json-viewer | 
|---|
|  |  |  | :copyable="true" | 
|---|
|  |  |  | :boxed="true" | 
|---|
|  |  |  | :value="JSON.parse(JSON.stringify(item.createdUser))" | 
|---|
|  |  |  | ></json-viewer> | 
|---|
|  |  |  | </ProFormItemV2> | 
|---|
|  |  |  | <ProFormItemV2 label="createdTime:"> | 
|---|
|  |  |  | {{ format(item.createdTime, 'YYYY-MM-DD HH:mm:ss') }}</ProFormItemV2 | 
|---|
|  |  |  | <template #createdUser="{ row }"> | 
|---|
|  |  |  | <el-button type="primary" link @click="handleAdd({ json: row.createdUser })" | 
|---|
|  |  |  | >查看</el-button | 
|---|
|  |  |  | > | 
|---|
|  |  |  | </ProForm> | 
|---|
|  |  |  | </el-collapse-item> | 
|---|
|  |  |  | </el-collapse> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  | </ProTableV2> | 
|---|
|  |  |  | <JsonViewerDialog v-bind="dialogProps" /> | 
|---|
|  |  |  | </AppContainer> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <script setup lang="ts"> | 
|---|
|  |  |  | import { ProForm, ProFormItemV2 } from '@bole-core/components'; | 
|---|
|  |  |  | import JsonViewer from 'vue-json-viewer'; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import { format } from '@/utils'; | 
|---|
|  |  |  | import { | 
|---|
|  |  |  | AppContainer, | 
|---|
|  |  |  | ProTableV2, | 
|---|
|  |  |  | defineColumns, | 
|---|
|  |  |  | ProTableV2Props, | 
|---|
|  |  |  | useFormDialog, | 
|---|
|  |  |  | } from '@bole-core/components'; | 
|---|
|  |  |  | import JsonViewerDialog from './JsonViewerDialog.vue'; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | defineOptions({ | 
|---|
|  |  |  | name: 'ExceptionLogsView', | 
|---|
|  |  |  | 
|---|
|  |  |  | type Props = { | 
|---|
|  |  |  | exceptionLogs: API.GetExceptionLogsQueryResultItem[]; | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | const activeName = ref('1'); | 
|---|
|  |  |  | const props = withDefaults(defineProps<Props>(), { | 
|---|
|  |  |  | exceptionLogs: () => [] as API.GetExceptionLogsQueryResultItem[], | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <style lang="scss" scoped> | 
|---|
|  |  |  | @use '@/style/common.scss' as *; | 
|---|
|  |  |  | </style> | 
|---|
|  |  |  | const columns = defineColumns( | 
|---|
|  |  |  | ['type', 'code', 'message', 'stackTrace', 'createdUser', 'createdTime'].map((x, index) => ({ | 
|---|
|  |  |  | id: index + '', | 
|---|
|  |  |  | enCode: x, | 
|---|
|  |  |  | name: x, | 
|---|
|  |  |  | })) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const columnsRenderProps: ProTableV2Props['columnRenderMap'] = { | 
|---|
|  |  |  | createdTime: { type: 'date', format: 'YYYY-MM-DD HH:mm:ss' }, | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const { dialogProps, handleAdd } = useFormDialog({ | 
|---|
|  |  |  | defaultFormParams: { | 
|---|
|  |  |  | json: null, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | </script> | 
|---|