Quellcode durchsuchen

feat(组件): 修改bug

tangning vor 2 Jahren
Ursprung
Commit
115ce17331

+ 1 - 1
src/locales/lang/zh-CN/sys.ts

@@ -23,7 +23,7 @@ export default {
   },
   app: { logoutTip: '温馨提醒', logoutMessage: '是否确认退出系统?', menuLoading: '菜单加载中...' },
   errorLog: {
-    tableTitle: '错误日志列表',
+    tableTitle: '日志列表',
     tableColumnType: '类型',
     tableColumnDate: '时间',
     tableColumnFile: '文件',

+ 0 - 1
src/router/guard/permissionGuard.ts

@@ -84,7 +84,6 @@ export function createPermissionGuard(router: Router) {
     if (userStore.getLastUpdateTime === 0) {
       try {
         await userStore.getUserInfoAction();
-        console.log('userStore',)
       } catch (err) {
         next();
         return;

+ 2 - 1
src/router/routes/index.ts

@@ -1,6 +1,6 @@
 import type { AppRouteRecordRaw, AppRouteModule } from '/@/router/types';
 
-import { PAGE_NOT_FOUND_ROUTE, REDIRECT_ROUTE } from '/@/router/routes/basic';
+import { PAGE_NOT_FOUND_ROUTE, REDIRECT_ROUTE, ERROR_LOG_ROUTE } from '/@/router/routes/basic';
 
 import { mainOutRoutes } from './mainOut';
 import { PageEnum } from '/@/enums/pageEnum';
@@ -42,5 +42,6 @@ export const basicRoutes = [
   RootRoute,
   ...mainOutRoutes,
   REDIRECT_ROUTE,
+  ERROR_LOG_ROUTE,
   PAGE_NOT_FOUND_ROUTE,
 ];

+ 1 - 1
src/settings/projectSetting.ts

@@ -161,7 +161,7 @@ const setting: ProjectConfig = {
   showBreadCrumbIcon: false,
 
   // Use error-handler-plugin
-  useErrorHandle: false,
+  useErrorHandle: true,
 
   // Whether to open back to top
   useOpenBackTop: true,

+ 1 - 0
src/views/order/downloadList.vue

@@ -177,6 +177,7 @@
         useSearchForm: true,
         formConfig: searchForm,
         showTableSetting: true,
+        showIndexColumn:false,
         rowKey: 'id',
         beforeFetch:(T)=>{
           const {ctivated,tradeNum,userName,orderSn} = T

+ 1 - 0
src/views/order/equityList.vue

@@ -172,6 +172,7 @@
         // titleHelpMessage: ['已启用expandRowByClick', '已启用stopButtonPropagation'],
         columns: columns,
         useSearchForm: true,
+        showIndexColumn:false,
         formConfig: searchForm,
         showTableSetting: true,
         rowKey: 'id',

+ 5 - 10
src/views/product/firmware/EditModal.vue

@@ -12,6 +12,10 @@
         <template #text="{ model, field }">
           {{ model[field]  }}
         </template>
+        <template #typoe="{ model, field }">
+          {{ renderOwnTypeLabel(model[field])}}
+        </template>
+        
       </BasicForm>
     </div>
   </BasicModal>
@@ -51,15 +55,7 @@
           field: 'type',
           component: 'Input',
           label: t('routes.product.types'),
-          show: false,
-          colProps: {
-            span: 24,
-          },
-        },{
-          field: 'type',
-          component: 'Input',
-          label: t('routes.product.types'),
-          slot: 'text',
+          slot: 'type',
           colProps: {
             span: 24,
           },
@@ -219,7 +215,6 @@
         resetFields();
         setFieldsValue({
           ...data,
-          type:renderOwnTypeLabel(Number(data.type)),
         });
       }
       const handleSubmit = async () => {

+ 1 - 1
src/views/staff/list.vue

@@ -35,7 +35,7 @@
             {
               label: '删除',
               color: 'error',
-              ifShow:getCheckPerm('sysuser-delete	'),
+              ifShow:getCheckPerm('sysuser-delete'),
               popConfirm: {
                 title: '是否确认删除',
                 confirm: handleDelete.bind(null, record),

+ 37 - 34
src/views/sys/error-log/data.tsx

@@ -8,52 +8,55 @@ const { t } = useI18n();
 export function getColumns(): BasicColumn[] {
   return [
     {
-      dataIndex: 'type',
-      title: t('sys.errorLog.tableColumnType'),
-      width: 80,
-      customRender: ({ text }) => {
-        const color =
-          text === ErrorTypeEnum.VUE
-            ? 'green'
-            : text === ErrorTypeEnum.RESOURCE
-            ? 'cyan'
-            : text === ErrorTypeEnum.PROMISE
-            ? 'blue'
-            : ErrorTypeEnum.AJAX
-            ? 'red'
-            : 'purple';
-        return <Tag color={color}>{() => text}</Tag>;
-      },
-    },
-    {
-      dataIndex: 'url',
-      title: 'URL',
-      width: 200,
+      dataIndex: 'nickName',
+      title: '姓名',
+      width: 100,
+    },{
+      dataIndex: 'userName',
+      title: '账号',
+      width: 100,
     },
     {
-      dataIndex: 'time',
-      title: t('sys.errorLog.tableColumnDate'),
-      width: 160,
+      dataIndex: 'uri',
+      title: '请求URL',
+      width: 280,
     },
     {
-      dataIndex: 'file',
-      title: t('sys.errorLog.tableColumnFile'),
+      dataIndex: 'method',
+      title: '请求方式',
+      width: 80,
+      customRender: ({record}) => {
+        return <Tag color={'blue'}>{record.method}</Tag>;
+      },
+    },{
+      dataIndex: 'params',
+      title: '请求参数',
       width: 200,
     },
     {
-      dataIndex: 'name',
-      title: 'Name',
-      width: 200,
+      dataIndex: 'ip',
+      title: 'IP地址',
+      width: 100,
     },
     {
-      dataIndex: 'message',
-      title: t('sys.errorLog.tableColumnMsg'),
-      width: 300,
+      dataIndex: 'browser',
+      title: '浏览器类型',
+      width: 200,
     },
     {
-      dataIndex: 'stack',
-      title: t('sys.errorLog.tableColumnStackMsg'),
+      dataIndex: 'createTime',
+      title: '操作时间',
+      width: 160,
     },
+    // {
+    //   dataIndex: 'message',
+    //   title: t('sys.errorLog.tableColumnMsg'),
+    //   width: 300,
+    // },
+    // {
+    //   dataIndex: 'stack',
+    //   title: t('sys.errorLog.tableColumnStackMsg'),
+    // },
   ];
 }
 

+ 115 - 53
src/views/sys/error-log/index.vue

@@ -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>