Ver Fonte

fix: 文件存储

fanfan há 2 anos atrás
pai
commit
43b63ab473

+ 36 - 41
src/views/infra/oss/data.ts

@@ -1,7 +1,5 @@
-import { listDictModel } from '/@/api/common';
 import { DescItem } from '/@/components/Description';
 import { BasicColumn, FormSchema } from '/@/components/Table';
-import { radioBoolean } from '/@/utils/filters';
 
 export const columns: BasicColumn[] = [
   {
@@ -13,12 +11,16 @@ export const columns: BasicColumn[] = [
     dataIndex: 'name',
   },
   {
-    title: '是否为主配置',
+    title: '主配置',
     dataIndex: 'master',
   },
   {
-    title: '存储类型    字典值:  sys_storage_config',
-    dataIndex: 'storageType',
+    title: '存储类型',
+    dataIndex: 'type',
+  },
+  {
+    title: '文件配置',
+    dataIndex: 'config',
   },
   {
     title: '备注',
@@ -28,14 +30,6 @@ export const columns: BasicColumn[] = [
 
 // 表单列定义
 export const searchFormSchema: FormSchema[] = [
-  {
-    label: '文件配置编码',
-    field: 'code',
-    component: 'Input',
-    componentProps: {
-      placeholder: '请输入文件配置编码',
-    },
-  },
   {
     label: '文件配置名称',
     field: 'name',
@@ -45,22 +39,11 @@ export const searchFormSchema: FormSchema[] = [
     },
   },
   {
-    label: '是否为主配置',
-    field: 'master',
-    component: 'Switch',
-    componentProps: {
-      options: radioBoolean,
-    },
-  },
-  {
-    label: '存储类型    字典值:  sys_storage_config',
-    field: 'storageType',
-    component: 'ApiSelect',
+    label: '存储类型',
+    field: 'type',
+    component: 'Input',
     componentProps: {
-      api: listDictModel,
-      params: {
-        dictCode: 'sys_storage_config',
-      },
+      placeholder: '请输入存储类型',
     },
   },
 ];
@@ -85,22 +68,30 @@ export const dataFormSchema: FormSchema[] = [
     },
   },
   {
-    label: '是否为主配置',
+    label: '主配置',
     field: 'master',
-    component: 'Switch',
+    required: true,
+    component: 'Input',
+    componentProps: {
+      placeholder: '请输入主配置',
+    },
+  },
+  {
+    label: '存储类型',
+    field: 'type',
+    required: true,
+    component: 'Input',
     componentProps: {
-      options: radioBoolean,
+      placeholder: '请输入存储类型',
     },
   },
   {
-    label: '存储类型    字典值:  sys_storage_config',
-    field: 'storageType',
-    component: 'ApiSelect',
+    label: '文件配置',
+    field: 'config',
+    required: true,
+    component: 'Input',
     componentProps: {
-      api: listDictModel,
-      params: {
-        dictCode: 'sys_storage_config',
-      },
+      placeholder: '请输入文件配置',
     },
   },
   {
@@ -128,12 +119,16 @@ export const viewSchema: DescItem[] = [
     field: 'name',
   },
   {
-    label: '是否为主配置',
+    label: '主配置',
     field: 'master',
   },
   {
-    label: '存储类型    字典值:  sys_storage_config',
-    field: 'storageType',
+    label: '存储类型',
+    field: 'type',
+  },
+  {
+    label: '文件配置',
+    field: 'config',
   },
   {
     label: '备注',

+ 7 - 7
src/views/infra/oss/formDrawer.vue

@@ -19,10 +19,10 @@
   import { dataFormSchema } from './data';
 
   import {
-    infraStorageConfigAdd,
-    infraStorageConfigEdit,
-    infraStorageConfigDetail,
-  } from '/@/api/infra/infraStorageConfigApi';
+    infraStorageconfigAdd,
+    infraStorageconfigEdit,
+    infraStorageconfigDetail,
+  } from '/@/api/infra/infraStorageconfigApi';
 
   const emit = defineEmits(['success', 'register']);
 
@@ -46,7 +46,7 @@
     isUpdate.value = !!data?.isUpdate;
 
     if (unref(isUpdate)) {
-      const resData = await infraStorageConfigDetail(data.record.id);
+      const resData = await infraStorageconfigDetail(data.record.id);
       rowId.value = resData.id;
       await setFieldsValue({
         ...resData,
@@ -60,8 +60,8 @@
       const values = await validate();
       setDrawerProps({ confirmLoading: true });
       !unref(isUpdate)
-        ? await infraStorageConfigAdd({ ...values })
-        : await infraStorageConfigEdit({ ...values, id: rowId.value });
+        ? await infraStorageconfigAdd({ ...values })
+        : await infraStorageconfigEdit({ ...values, id: rowId.value });
       !unref(isUpdate) ? createMessage.success('新增成功!') : createMessage.success('编辑成功!');
       closeDrawer();
       emit('success', {

+ 26 - 21
src/views/infra/oss/index.vue

@@ -2,27 +2,25 @@
   <div>
     <BasicTable @register="registerTable">
       <template #bodyCell="{ column, record }">
-        <template v-if="column.key === 'storageType'">
-          <Tag :color="formatDictColor(storageTypeOptions, record.storageType)">
-            {{ formatDictValue(storageTypeOptions, record.storageType) }}
-          </Tag>
-        </template>
         <template v-if="column.key === 'action'">
           <TableAction
             :actions="[
               {
+                auth: 'infra:storageconfig:query',
                 icon: 'icon-eye|iconfont',
                 tooltip: '查看',
                 label: '查看',
                 onClick: handleView.bind(null, record),
               },
               {
+                auth: 'infra:storageconfig:edit',
                 icon: 'icon-edit|iconfont',
                 tooltip: '编辑',
                 label: '编辑',
                 onClick: handleEdit.bind(null, record),
               },
               {
+                auth: 'infra:storageconfig:remove',
                 icon: 'icon-delete|iconfont',
                 tooltip: '删除',
                 label: '删除',
@@ -38,8 +36,21 @@
         </template>
       </template>
       <template #toolbar>
-        <Button type="primary" @click="handleCreate" preIcon="icon-plus|iconfont"> 新增 </Button>
-        <Button type="primary" danger @click="handleDelete(null)" preIcon="icon-delete|iconfont">
+        <Button
+          v-auth="['infra:storageconfig:add']"
+          type="primary"
+          @click="handleCreate"
+          preIcon="icon-plus|iconfont"
+        >
+          新增
+        </Button>
+        <Button
+          v-auth="['infra:storageconfig:remove']"
+          type="primary"
+          danger
+          @click="handleDelete(null)"
+          preIcon="icon-delete|iconfont"
+        >
           批量删除
         </Button>
       </template>
@@ -50,7 +61,6 @@
 </template>
 <script lang="ts" setup>
   import { onBeforeMount, ref } from 'vue';
-  import { Tag } from 'ant-design-vue';
   import { Button } from '/@/components/Button';
 
   import { BasicTable, useTable, TableAction } from '/@/components/Table';
@@ -62,17 +72,12 @@
   import { columns, searchFormSchema } from './data';
 
   import {
-    infraStorageConfigQueryPage,
-    infraStorageConfigRemove,
-  } from '/@/api/infra/infraStorageConfigApi';
-  import { listDictModel } from '/@/api/common';
-  import { formatDictColor, formatDictValue } from '/@/utils';
+    infraStorageconfigQueryPage,
+    infraStorageconfigRemove,
+  } from '/@/api/infra/infraStorageconfigApi';
   import { useDrawer } from '/@/components/Drawer';
 
-  const storageTypeOptions = ref();
-  onBeforeMount(async () => {
-    storageTypeOptions.value = await listDictModel({ dictCode: 'sys_storage_config' });
-  });
+  onBeforeMount(async () => {});
 
   const { createConfirm, createMessage } = useMessage();
   // const [registerModal, { openModal }] = useModal();
@@ -87,8 +92,8 @@
   ]) as any;
 
   const [registerTable, { reload, getSelectRowKeys }] = useTable({
-    title: '门户列表 ',
-    api: infraStorageConfigQueryPage,
+    title: '文件存储配置 ',
+    api: infraStorageconfigQueryPage,
     rowKey: 'id',
     columns,
     showIndexColumn: true,
@@ -141,7 +146,7 @@
   // 删除按钮事件
   async function handleDelete(record: Recordable) {
     if (record) {
-      await infraStorageConfigRemove([record.id]);
+      await infraStorageconfigRemove([record.id]);
       createMessage.success('删除成功!');
       await reload();
     } else {
@@ -150,7 +155,7 @@
         iconType: 'warning',
         onOk: async () => {
           const keys = getSelectRowKeys();
-          await infraStorageConfigRemove(keys);
+          await infraStorageconfigRemove(keys);
           createMessage.success('删除成功!');
           await reload();
         },

+ 3 - 9
src/views/infra/oss/viewDrawer.vue

@@ -15,24 +15,18 @@
   import { Description, useDescription } from '/@/components/Description';
   import { viewSchema } from './data';
 
-  import { infraStorageConfigDetail } from '/@/api/infra/infraStorageConfigApi';
-  import { listDictModel } from '/@/api/common';
-  import { formatDictValue } from '/@/utils';
+  import { infraStorageconfigDetail } from '/@/api/infra/infraStorageconfigApi';
 
   const descData = ref({});
   const getTitle = '查看文件存储配置';
   const width = '45%';
 
-  const storageTypeOptions = ref();
-  onBeforeMount(async () => {
-    storageTypeOptions.value = await listDictModel({ dictCode: 'sys_storage_config' });
-  });
+  onBeforeMount(async () => {});
   const [registerDrawer] = useDrawerInner(async data => {
     console.log('::::::::::', data.record);
-    const resData = await infraStorageConfigDetail(data.record.id);
+    const resData = await infraStorageconfigDetail(data.record.id);
     descData.value = {
       ...resData,
-      storageType: formatDictValue(storageTypeOptions.value, resData.storageType),
     };
   });
   const [registerDesc] = useDescription({