Browse Source

perf: 优化功能修复bug

曾坤森 1 month ago
parent
commit
e27b420c59

+ 12 - 2
src/api/plugin.ts

@@ -38,8 +38,18 @@ export interface PluginParams {
   server: string | null;
   location: string | null;
 }
-export async function queryPluginList(params: object): Promise<PluginList> {
-  const res = await instance.post('/api/Plugin/PluginList', params);
+export async function queryPluginList(
+  params: Record<string, any>
+): Promise<PluginList> {
+  const formData = new URLSearchParams();
+  Object.keys(params).forEach(key => {
+    formData.append(key, params[key]);
+  });
+  const res = await instance.post('/api/Plugin/PluginList', formData, {
+    headers: {
+      'Content-Type': 'application/x-www-form-urlencoded',
+    },
+  });
   return res.data;
 }
 export async function deletePluginDetails(params: object): Promise<DataRes> {

+ 1 - 0
src/locale/en-US.ts

@@ -30,6 +30,7 @@ export default {
   'searchTable.form.confirm': 'Confirm',
   'searchTable.table.number': 'No.',
   'searchTable.form.edit': 'Edit',
+  'searchTable.form.back': 'Back',
   'searchTable.table.optional': 'Optional',
   'modal.warning.title': 'Warning',
   'modal.warning.content':

+ 1 - 0
src/locale/zh-CN.ts

@@ -30,6 +30,7 @@ export default {
   'searchTable.form.confirm': '确定',
   'searchTable.table.number': '序号',
   'searchTable.form.edit': '编辑',
+  'searchTable.form.back': '返回',
   'searchTable.table.optional': '操作',
   'modal.warning.title': '提示',
   'modal.warning.content': '是否继续进行该操作删除后无法恢复?',

+ 19 - 4
src/views/dashboard/camera/edit.vue

@@ -1,6 +1,14 @@
 <template>
   <div class="container">
     <a-card class="general-card">
+      <a-button
+        class="action-button"
+        size="mini"
+        @click="() => router.push({ name: 'Camera' })"
+      >
+        <icon-left />
+        {{ t('searchTable.form.back') }}
+      </a-button>
       <a-tree
         v-if="!loading"
         :blockNode="true"
@@ -39,6 +47,11 @@
           >
         </template>
       </a-tree>
+      <a-skeleton v-else>
+        <a-space direction="vertical" :style="{ width: '100%' }" size="large">
+          <a-skeleton-line :rows="18" />
+        </a-space>
+      </a-skeleton>
       <CameraDialog
         v-model="showCameraDialog"
         :id="cameraId"
@@ -63,6 +76,7 @@ import useLoading from '@/hooks/loading';
 import { useI18n } from 'vue-i18n';
 import { Modal } from '@arco-design/web-vue';
 import CameraDialog from './component/CameraDialog.vue';
+import router from '@/router';
 
 const this_ = getCurrentInstance()?.appContext.config.globalProperties;
 
@@ -175,11 +189,12 @@ function updateFun() {
 
   // 注意这里的空行是重要的
   .general-card {
-    padding-top: 20px;
-  }
+    padding: 0 20px;
 
-  .action-button {
-    margin-right: 10px;
+    .action-button {
+      margin-top: 10px;
+      margin-bottom: 10px;
+    }
   }
 }
 </style>

+ 1 - 1
src/views/dashboard/plugin/edit.vue

@@ -2,7 +2,7 @@
   <div>
     <a-modal
       v-model:visible="visible"
-      width="auto"
+      width="80%"
       :title="id ? $t('searchTable.form.edit') : $t('searchTable.form.add')"
       @cancel="() => handleCancel()"
       @before-ok="handleBeforeOk"

+ 0 - 19
src/views/dashboard/plugin/index.vue

@@ -207,11 +207,6 @@ const generateFormModel = () => {
   return {
     pageIndex: 1,
     pageSize: 20,
-    hostName: null,
-    address: null,
-    user: null,
-    server: null,
-    location: null,
   } as PluginParams;
 };
 const renderData = ref<DataList[]>([] as DataList[]);
@@ -242,20 +237,6 @@ const search = () => {
 const reset = () => {
   formModel.value = generateFormModel();
 };
-const downloadExcel = () => {
-  setLoading(true);
-  exportPluginList(formModel.value)
-    .then(res => {
-      if (!res.success) {
-        return;
-      }
-      const url = res.data;
-      downLoadFun(url);
-    })
-    .finally(() => {
-      setLoading(false);
-    });
-};
 const onPageChange = (current: number) => {
   formModel.value.pageIndex = current;
   searchTable();

+ 3 - 8
src/views/user/manage/components/edit.vue

@@ -7,8 +7,8 @@
       @cancel="() => handleCancel()"
       @before-ok="handleBeforeOk"
     >
-      <a-form :model="form" ref="formRef">
-        <a-row :gutter="8">
+      <a-form :model="form" auto-label-width ref="formRef">
+        <a-row :gutter="24">
           <a-col :span="12">
             <a-form-item
               field="user"
@@ -24,12 +24,7 @@
               :label="t('manage.form.password')"
               :rules="getRules(t).required"
             >
-              <a-input v-model="form.password" />
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item field="desc" :label="t('manage.form.desc')">
-              <a-input v-model="form.desc" />
+              <a-input-password v-model="form.password" />
             </a-form-item>
           </a-col>
           <a-col :span="12">

+ 0 - 13
src/views/user/manage/index.vue

@@ -23,19 +23,6 @@
                   />
                 </a-form-item>
               </a-col>
-              <a-col :span="6">
-                <a-form-item
-                  field="desc"
-                  :label="t('manage.form.desc')"
-                  label-col-flex="40px"
-                >
-                  <a-input
-                    v-model="formModel.desc"
-                    :placeholder="t('manage.form.desc')"
-                    allow-clear
-                  />
-                </a-form-item>
-              </a-col>
             </a-row>
           </a-form>
         </a-col>