Jelajahi Sumber

feat(组件): 修复bug

tangning 2 tahun lalu
induk
melakukan
78c5d99edd

+ 8 - 1
src/api/demo/error.ts

@@ -9,4 +9,11 @@ enum Api {
  * @description: Trigger ajax error
  */
 
-export const fireErrorApi = () => defHttp.post({ url: Api.Error });
+export const fireErrorApi = (params) => defHttp.post({ 
+  url: Api.Error,
+  params: params,
+  headers: {
+    // @ts-ignore
+    ignoreCancelToken: true,
+  },
+});

+ 0 - 1
src/layouts/default/header/components/user-dropdown/index.vue

@@ -78,7 +78,6 @@
       const userStore = useUserStore();
       const { createConfirm } = useMessage();
       const getUserInfo = computed(() => {
-        console.log('realName',userStore.getUserInfo)
         const { nickName = '', avatar, desc } = userStore.getUserInfo || {};
         return { realName:nickName, avatar: avatar || headerImg, desc };
       });

+ 4 - 1
src/views/customer/device.vue

@@ -12,7 +12,7 @@
             :actions="[
               {
                 label: '解绑',
-                ifShow:getCheckPerm('device-unbind'),
+                ifShow:getCheckPerm('device-unbind') && Boolean(record.userName),
                 color: 'error',
                 onClick: handleUnbind.bind(null, record),
               },
@@ -26,6 +26,7 @@
 </template>
 <script lang="ts">
   import { defineComponent, h, reactive, toRefs, onMounted } from 'vue';
+  import { isBoolean } from 'lodash';
   import {
     BasicTable,
     useTable,
@@ -44,6 +45,7 @@
   import { useRouter } from 'vue-router';
   import { useI18n } from '/@/hooks/web/useI18n';
   import { UnbindCameraApi } from '/@/api/account';
+import { isBoolean } from 'lodash';
   const { t } = useI18n();
   export default defineComponent({
     components: {
@@ -254,6 +256,7 @@
         registerLinkModal,
         back,
         getCheckPerm,
+        isBoolean,
       };
     },
   });

+ 2 - 0
src/views/operate/components/new/addModal.vue

@@ -158,6 +158,8 @@
           const detail = await NewsDetail({id:data.id})
           setFieldsValue({
             ...detail,
+            newsUrl:detail.newType == 1?detail.content:'',
+            content:detail.newType != 1?detail.content:'',
             coverImageUrl:detail.coverImageUrl?[detail.coverImageUrl]:''
           });
         }else{

+ 17 - 1
src/views/operate/data.tsx

@@ -11,10 +11,15 @@ export const refundTimeTableSchema: BasicColumn[] = [
   },
   {
     title: '留言内容',
-    width: 150,
+    width: 250,
     dataIndex: 'content',
   },
   {
+    title: '提交时间',
+    width: 150,
+    dataIndex: 'createTime',
+  },
+  {
     title: '状态',
     width: 150,
     dataIndex: 'state',
@@ -63,6 +68,12 @@ export const agentSchema: BasicColumn[] = [
     },
   },
   {
+    title: '申请人职位',
+    width: 150,
+    dataIndex: 'post',
+    ellipsis: true,
+  },
+  {
     title: '申请人电话',
     width: 150,
     dataIndex: 'phone',
@@ -138,6 +149,11 @@ export const DMegaSchema: BasicColumn[] = [
     dataIndex: 'email',
   },
   {
+    title: '备注',
+    width: 150,
+    dataIndex: 'remark',
+  },
+  {
     title: '提交时间',
     width: 150,
     dataIndex: 'createTime',

+ 11 - 4
src/views/operate/messageList.vue

@@ -66,7 +66,7 @@
         autoSubmitOnEnter:true,
         schemas: [
           {
-            field: 'sceneName',
+            field: 'time',
             label: '提交时间',
             component: 'RangePicker',
             componentProps: {
@@ -81,8 +81,8 @@
             },
           },
           {
-            field: 'type',
-            label: t('routes.operate.newsTitle'),
+            field: 'content',
+            label: '留言内容',
             component: 'Input',
             colProps: {
               xl: 6,
@@ -106,9 +106,16 @@
         formConfig: searchForm,
         dataSource: refundTimeTableData,
         showTableSetting: true,
+        useSearchForm: true,
         showIndexColumn: false,
         canResize:true,
-        // pagination: { pageSize: 20 },
+        beforeFetch:(T)=>{
+            if(T.time){
+                T.startTime = T.time[0]
+                T.endTime = T.time[1]
+              }
+          return T
+        },
         actionColumn: {
           width: 100,
           title: '操作',

+ 1 - 1
src/views/operate/recruitList.vue

@@ -175,7 +175,7 @@
           // },
           {
             field: 'workName',
-            label: t('routes.operate.newsTitle'),
+            label: '职位名称',
             component: 'Input',
             colProps: {
               xl: 6,

+ 1 - 1
src/views/operate/sceneList.vue

@@ -146,7 +146,7 @@
           title: '发送邮件',
           content: `确定要发送邮件至${record.email}吗?`,
           onOk: async () => {
-            await sendEmail({ sceneApplyId: record.id,mailTemplateId:1, });
+            await sendEmail({ sceneApplyId: record.id,mailTemplateId:2, });
             reload();
             createMessage.success(t('common.optSuccess'));
           },

+ 4 - 4
src/views/product/firmware/EditModal.vue

@@ -8,12 +8,12 @@
     @ok="handleSubmit"
   >
     <div class="pt-2px pr-3px">
-      <BasicForm @register="registerForm" :model="model" >
+      <BasicForm @register="registerForm" >
         <template #text="{ model, field }">
           {{ model[field]  }}
         </template>
-        <template #typoe="{ model, field }">
-          {{ renderOwnTypeLabel(model[field])}}
+        <template #type="{ model, field }">
+          {{ renderOwnTypeLabel(Number(model[field]))}}
         </template>
         
       </BasicForm>
@@ -182,6 +182,7 @@
         data && onDataReceive(data);
       });
       function renderOwnTypeLabel(type: number): string {
+        console.log('renderOwnTypeLabel',type)
         switch (type) {
           case 2:
             return t('routes.product.type.2');
@@ -245,7 +246,6 @@
         renderOwnTypeLabel,
         schemas,
         registerForm,
-        model: modelRef,
         fileFlow,
         handleVisibleChange,
         handleSubmit,

+ 6 - 63
src/views/sys/error-log/data.tsx

@@ -1,70 +1,13 @@
-import { Tag } from 'ant-design-vue';
-import { BasicColumn } from '/@/components/Table/index';
 import { ErrorTypeEnum } from '/@/enums/exceptionEnum';
 import { useI18n } from '/@/hooks/web/useI18n';
 
 const { t } = useI18n();
 
-export function getColumns(): BasicColumn[] {
-  return [
-    {
-      dataIndex: 'nickName',
-      title: '姓名',
-      width: 100,
-    },{
-      dataIndex: 'userName',
-      title: '账号',
-      width: 100,
-    },
-    {
-      dataIndex: 'uri',
-      title: '请求URL',
-      width: 280,
-    },
-    {
-      dataIndex: 'method',
-      title: '请求方式',
-      width: 80,
-      customRender: ({record}) => {
-        return <Tag color={'blue'}>{record.method}</Tag>;
-      },
-    },{
-      dataIndex: 'params',
-      title: '请求参数',
-      width: 200,
-    },
-    {
-      dataIndex: 'ip',
-      title: 'IP地址',
-      width: 100,
-    },
-    {
-      dataIndex: 'browser',
-      title: '浏览器类型',
-      width: 200,
-    },
-    {
-      dataIndex: 'createTime',
-      title: '操作时间',
-      width: 160,
-    },
-    // {
-    //   dataIndex: 'message',
-    //   title: t('sys.errorLog.tableColumnMsg'),
-    //   width: 300,
-    // },
-    // {
-    //   dataIndex: 'stack',
-    //   title: t('sys.errorLog.tableColumnStackMsg'),
-    // },
-  ];
-}
-
 export function getDescSchema(): any {
-  return getColumns().map((column) => {
-    return {
-      field: column.dataIndex!,
-      label: column.title,
-    };
-  });
+  // return getColumns().map((column) => {
+  //   return {
+  //     field: column.dataIndex!,
+  //     label: column.title,
+  //   };
+  // });
 }

+ 154 - 132
src/views/sys/error-log/index.vue

@@ -1,155 +1,177 @@
 <template>
   <div class="p-4">
-    <template v-for="src in imgList" :key="src">
-      <img :src="src" v-show="false" />
-    </template>
-    <DetailModal :info="rowInfo" @register="registerModal" />
-    <BasicTable @register="register" class="error-handle-table">
-      <!-- <template #toolbar>
-        <a-button @click="fireVueError" type="primary">
-          {{ t('sys.errorLog.fireVueError') }}
-        </a-button>
-        <a-button @click="fireResourceError" type="primary">
-          {{ t('sys.errorLog.fireResourceError') }}
-        </a-button>
-        <a-button @click="fireAjaxError" type="primary">
-          {{ t('sys.errorLog.fireAjaxError') }}
-        </a-button>
-      </template> -->
-      <template #action="{ record }">
-        <TableAction
-          :actions="[
-            { label: t('sys.errorLog.tableActionDesc'), onClick: handleDetail.bind(null, record) },
-          ]"
-        />
-      </template>
+    <BasicTable @register="register">
     </BasicTable>
   </div>
 </template>
 
-<script lang="ts" setup>
+<script lang="ts">
+import { BasicColumn } from '/@/components/Table/index';
 import type { ErrorLogInfo } from '/#/store';
-import { watch, ref, nextTick } from 'vue';
-import DetailModal from './DetailModal.vue';
+import { watch, ref, nextTick, defineComponent } from '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';
+import { Tag } from 'ant-design-vue';
+export default defineComponent({
+  components: {
+    BasicTable,
+    TableAction,
+    Tag,
+  },
+  setup() {
+    const rowInfo = ref<ErrorLogInfo>();
+    const imgList = ref<string[]>([]);
 
-const rowInfo = ref<ErrorLogInfo>();
-const imgList = ref<string[]>([]);
-
-const { t } = useI18n();
-const errorLogStore = useErrorLogStore();
-const searchForm: Partial<FormProps> = {
-  labelWidth: 100,
-  schemas: [
-    {
-      field: 'nickName',
-      label: '姓名',
-      component: 'Input',
-      componentProps: {
-        maxLength: 100,
+    const { t } = useI18n();
+    const errorLogStore = useErrorLogStore();
+    const columns: BasicColumn[] = [
+      {
+        dataIndex: 'nickName',
+        title: '姓名',
+        width: 100,
       },
-      colProps: {
-        xl: 5,
-        xxl: 5,
+      {
+        dataIndex: 'userName',
+        title: '账号',
+        width: 100,
       },
-    },
-    {
-      field: 'userName',
-      label: '账号',
-      component: 'Input',
-      componentProps: {
-        maxLength: 100,
+      {
+        dataIndex: 'uri',
+        title: '请求URL',
+        width: 280,
       },
-      colProps: {
-        xl: 5,
-        xxl: 5,
+      {
+        dataIndex: 'method',
+        title: '请求方式',
+        width: 80,
+        // customRender: ({record}) => {
+        //   return <Tag color={'blue'}>{record.method}</Tag>;
+        // },
       },
-    },
-    {
-      field: 'time',
-      label: '操作时间',
-      component: 'RangePicker',
-      componentProps: {
-        maxLength: 100,
-        valueFormat: 'YYYY-MM-DD',
-        format: 'YYYY-MM-DD',
+      {
+        dataIndex: 'params',
+        title: '请求参数',
+        width: 200,
       },
-      colProps: {
-        xl: 7,
-        xxl: 7,
+      {
+        dataIndex: 'ip',
+        title: 'IP地址',
+        width: 100,
       },
-    },
-  ],
-};
-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));
+      {
+        dataIndex: 'browser',
+        title: '浏览器类型',
+        width: 200,
+      },
+      {
+        dataIndex: 'createTime',
+        title: '操作时间',
+        width: 160,
+      },
+      // {
+      //   dataIndex: 'message',
+      //   title: t('sys.errorLog.tableColumnMsg'),
+      //   width: 300,
+      // },
+      // {
+      //   dataIndex: 'stack',
+      //   title: t('sys.errorLog.tableColumnStackMsg'),
+      // },
+    ];
+    const searchForm: Partial<FormProps> = {
+      labelWidth: 100,
+      schemas: [
+        {
+          field: 'nickName',
+          label: '姓名',
+          component: 'Input',
+          componentProps: {
+            maxLength: 100,
+          },
+          colProps: {
+            xl: 5,
+            xxl: 5,
+          },
+        },
+        {
+          field: 'userName',
+          label: '账号',
+          component: 'Input',
+          componentProps: {
+            maxLength: 100,
+          },
+          colProps: {
+            xl: 5,
+            xxl: 5,
+          },
+        },
+        {
+          field: 'time',
+          label: '操作时间',
+          component: 'RangePicker',
+          componentProps: {
+            maxLength: 100,
+            valueFormat: 'YYYY-MM-DD',
+            format: 'YYYY-MM-DD',
+          },
+          colProps: {
+            xl: 7,
+            xxl: 7,
+          },
+        },
+      ],
+    };
+    const [register] = useTable({
+      api: fireErrorApi,
+      title: t('sys.errorLog.tableTitle'),
+      columns: columns,
+      useSearchForm: true,
+      formConfig: searchForm,
+      showIndexColumn: false,
+      showTableSetting: true,
+      rowKey: 'id',
+      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,
     });
-  },
-  {
-    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 fireResourceError() {
-  imgList.value.push(`${new Date().getTime()}.png`);
-}
 
-async function fireAjaxError() {
-  await fireErrorApi();
-}
+    watch(
+      () => errorLogStore.getErrorLogInfoList,
+      (list) => {
+        nextTick(() => {
+          setTableData(cloneDeep(list));
+        });
+      },
+      {
+        immediate: true,
+      },
+    );
+    // if (import.meta.env.DEV) {
+    //   createMessage.info(t('sys.errorLog.enableMessage'));
+    // }
+    // 查看详情
+    return {
+      register,
+      rowInfo,
+      // registerModal,
+      imgList,
+      // openModal,
+      };
+  },
+});
 </script>