|
@@ -28,66 +28,128 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
- import type { ErrorLogInfo } from '/#/store';
|
|
|
- import { watch, ref, nextTick } from 'vue';
|
|
|
- import DetailModal from './DetailModal.vue';
|
|
|
- import { BasicTable, useTable, TableAction } from '/@/components/Table/index';
|
|
|
- import { useModal } from '/@/components/Modal';
|
|
|
- import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
- import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
- import { useErrorLogStore } from '/@/store/modules/errorLog';
|
|
|
- import { fireErrorApi } from '/@/api/demo/error';
|
|
|
- import { getColumns } from './data';
|
|
|
- import { cloneDeep } from 'lodash-es';
|
|
|
+import type { ErrorLogInfo } from '/#/store';
|
|
|
+import { watch, ref, nextTick } from 'vue';
|
|
|
+import DetailModal from './DetailModal.vue';
|
|
|
+import { FormProps } from '/@/components/Table';
|
|
|
+import { BasicTable, useTable, TableAction } from '/@/components/Table/index';
|
|
|
+import { useModal } from '/@/components/Modal';
|
|
|
+import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
+import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
+import { useErrorLogStore } from '/@/store/modules/errorLog';
|
|
|
+import { fireErrorApi } from '/@/api/demo/error';
|
|
|
+import { getColumns } from './data';
|
|
|
+import { cloneDeep } from 'lodash-es';
|
|
|
|
|
|
- const rowInfo = ref<ErrorLogInfo>();
|
|
|
- const imgList = ref<string[]>([]);
|
|
|
+const rowInfo = ref<ErrorLogInfo>();
|
|
|
+const imgList = ref<string[]>([]);
|
|
|
|
|
|
- const { t } = useI18n();
|
|
|
- const errorLogStore = useErrorLogStore();
|
|
|
- const [register, { setTableData }] = useTable({
|
|
|
- api:fireErrorApi,
|
|
|
- title: t('sys.errorLog.tableTitle'),
|
|
|
- columns: getColumns(),
|
|
|
- actionColumn: {
|
|
|
- width: 80,
|
|
|
- title: 'Action',
|
|
|
- dataIndex: 'action',
|
|
|
- slots: { customRender: 'action' },
|
|
|
+const { t } = useI18n();
|
|
|
+const errorLogStore = useErrorLogStore();
|
|
|
+const searchForm: Partial<FormProps> = {
|
|
|
+ labelWidth: 100,
|
|
|
+ schemas: [
|
|
|
+ {
|
|
|
+ field: 'nickName',
|
|
|
+ label: '姓名',
|
|
|
+ component: 'Input',
|
|
|
+ componentProps: {
|
|
|
+ maxLength: 100,
|
|
|
+ },
|
|
|
+ colProps: {
|
|
|
+ xl: 5,
|
|
|
+ xxl: 5,
|
|
|
+ },
|
|
|
},
|
|
|
- });
|
|
|
- const [registerModal, { openModal }] = useModal();
|
|
|
-
|
|
|
- watch(
|
|
|
- () => errorLogStore.getErrorLogInfoList,
|
|
|
- (list) => {
|
|
|
- nextTick(() => {
|
|
|
- setTableData(cloneDeep(list));
|
|
|
- });
|
|
|
+ {
|
|
|
+ field: 'userName',
|
|
|
+ label: '账号',
|
|
|
+ component: 'Input',
|
|
|
+ componentProps: {
|
|
|
+ maxLength: 100,
|
|
|
+ },
|
|
|
+ colProps: {
|
|
|
+ xl: 5,
|
|
|
+ xxl: 5,
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
- immediate: true,
|
|
|
+ field: 'time',
|
|
|
+ label: '操作时间',
|
|
|
+ component: 'RangePicker',
|
|
|
+ componentProps: {
|
|
|
+ maxLength: 100,
|
|
|
+ valueFormat: 'YYYY-MM-DD',
|
|
|
+ format: 'YYYY-MM-DD',
|
|
|
+ },
|
|
|
+ colProps: {
|
|
|
+ xl: 7,
|
|
|
+ xxl: 7,
|
|
|
+ },
|
|
|
},
|
|
|
- );
|
|
|
- const { createMessage } = useMessage();
|
|
|
- if (import.meta.env.DEV) {
|
|
|
- createMessage.info(t('sys.errorLog.enableMessage'));
|
|
|
- }
|
|
|
- // 查看详情
|
|
|
- function handleDetail(row: ErrorLogInfo) {
|
|
|
- rowInfo.value = row;
|
|
|
- openModal(true);
|
|
|
- }
|
|
|
+ ],
|
|
|
+};
|
|
|
+const [register, { setTableData }] = useTable({
|
|
|
+ api: fireErrorApi,
|
|
|
+ title: t('sys.errorLog.tableTitle'),
|
|
|
+ showIndexColumn: false,
|
|
|
+ showTableSetting: true,
|
|
|
+ useSearchForm: true,
|
|
|
+ columns: getColumns(),
|
|
|
+ formConfig: searchForm,
|
|
|
+ fetchSetting: {
|
|
|
+ pageField: 'pageNum',
|
|
|
+ sizeField: 'pageSize',
|
|
|
+ listField: 'list',
|
|
|
+ totalField: 'total',
|
|
|
+ },
|
|
|
+ beforeFetch:(T)=>{
|
|
|
+ if(T.time){
|
|
|
+ T.startTime = T.time[0]
|
|
|
+ T.endTime = T.time[1]
|
|
|
+ }
|
|
|
+ return T
|
|
|
+ },
|
|
|
+ canResize: true,
|
|
|
+ // actionColumn: {
|
|
|
+ // width: 80,
|
|
|
+ // title: 'Action',
|
|
|
+ // dataIndex: 'action',
|
|
|
+ // slots: { customRender: 'action' },
|
|
|
+ // },
|
|
|
+});
|
|
|
+const [registerModal, { openModal }] = useModal();
|
|
|
+
|
|
|
+watch(
|
|
|
+ () => errorLogStore.getErrorLogInfoList,
|
|
|
+ (list) => {
|
|
|
+ nextTick(() => {
|
|
|
+ setTableData(cloneDeep(list));
|
|
|
+ });
|
|
|
+ },
|
|
|
+ {
|
|
|
+ immediate: true,
|
|
|
+ },
|
|
|
+);
|
|
|
+const { createMessage } = useMessage();
|
|
|
+// if (import.meta.env.DEV) {
|
|
|
+// createMessage.info(t('sys.errorLog.enableMessage'));
|
|
|
+// }
|
|
|
+// 查看详情
|
|
|
+function handleDetail(row: ErrorLogInfo) {
|
|
|
+ rowInfo.value = row;
|
|
|
+ openModal(true);
|
|
|
+}
|
|
|
|
|
|
- function fireVueError() {
|
|
|
- throw new Error('fire vue error!');
|
|
|
- }
|
|
|
+function fireVueError() {
|
|
|
+ throw new Error('fire vue error!');
|
|
|
+}
|
|
|
|
|
|
- function fireResourceError() {
|
|
|
- imgList.value.push(`${new Date().getTime()}.png`);
|
|
|
- }
|
|
|
+function fireResourceError() {
|
|
|
+ imgList.value.push(`${new Date().getTime()}.png`);
|
|
|
+}
|
|
|
|
|
|
- async function fireAjaxError() {
|
|
|
- await fireErrorApi();
|
|
|
- }
|
|
|
+async function fireAjaxError() {
|
|
|
+ await fireErrorApi();
|
|
|
+}
|
|
|
</script>
|