Sfoglia il codice sorgente

feat: 联调导入接口

mnisting 5 mesi fa
parent
commit
669f0c932c
5 ha cambiato i file con 62 aggiunte e 63 eliminazioni
  1. BIN
      public/物料导入模版.xlsx
  2. 13 13
      src/router/index.js
  3. 4 4
      src/views/login.vue
  4. 20 21
      src/views/toolsMaterial/index.vue
  5. 25 25
      vite.config.js

BIN
public/物料导入模版.xlsx


+ 13 - 13
src/router/index.js

@@ -111,19 +111,19 @@ export const constantRoutes = [
       },
     ],
   },
-  {
-    path: "/",
-    component: Layout,
-    meta: { title: "", icon: "" },
-    children: [
-      {
-        path: "commonTools",
-        component: () => import("@/views/commonTools/index"),
-        name: "CommonTools",
-        meta: { noCache: true, title: "常用工具管理", icon: "system" },
-      },
-    ],
-  },
+  // {
+  //   path: "/",
+  //   component: Layout,
+  //   meta: { title: "", icon: "" },
+  //   children: [
+  //     {
+  //       path: "commonTools",
+  //       component: () => import("@/views/commonTools/index"),
+  //       name: "CommonTools",
+  //       meta: { noCache: true, title: "常用工具管理", icon: "system" },
+  //     },
+  //   ],
+  // },
 ];
 
 // 动态路由,基于用户权限动态去加载

+ 4 - 4
src/views/login.vue

@@ -235,13 +235,13 @@ $blueQueen: rgb(21, 121, 255);
   background: rgba(255, 255, 255, 0.6);
   box-shadow: 0px 2px 10px 0px rgba(39, 54, 100, 0.1);
   backdrop-filter: blur(8px);
-  .login-welcome{
+  .login-welcome {
     font-family: Helvetica;
     font-size: 24px;
-    color: #004EA2;
+    color: #004ea2;
     line-height: 32px;
   }
-  .login-welcome-en{
+  .login-welcome-en {
     font-weight: 500;
     font-size: 18px;
     color: rgba(#326fb0, 0.8);
@@ -264,7 +264,7 @@ $blueQueen: rgb(21, 121, 255);
   &::before {
     left: 45%;
     bottom: -75%;
-    background-color: rgba($blueQueen,0.15);
+    background-color: rgba($blueQueen, 0.15);
     animation: wawes 10s infinite linear;
   }
 

+ 20 - 21
src/views/toolsMaterial/index.vue

@@ -222,17 +222,18 @@
       :close-on-click-modal="false"
     >
       <div class="el-upload__tip" slot="tip">
-        <el-link
+        <el-button
           type="warning"
           style="font-size: 13px; margin: 10px"
           @click="importTemplate"
-          >下载模板</el-link
+          >下载模板</el-button
         >
         <el-upload
           ref="uploadRef"
           :limit="1"
           accept=".xlsx, .xls"
           :headers="upload.headers"
+          :data="upload.data"
           :action="upload.url"
           :disabled="upload.isUploading"
           :on-progress="handleFileUploadProgress"
@@ -282,20 +283,6 @@ const pager = ref({
 // 表格总数据量
 const total = ref(0);
 
-// 用户导入参数
-const upload = reactive({
-  // 是否显示弹出层(用户导入)
-  open: false,
-  // 弹出层标题(用户导入)
-  title: "导入",
-  // 是否禁用上传
-  isUploading: false,
-  // 设置上传的请求头部
-  headers: { Authorization: "Bearer " + getToken() },
-  // 上传的地址
-  url: import.meta.env.VITE_APP_BASE_API + "/system/user/importData",
-});
-
 // 查询当前工具的物料列表。
 const getList = (params = {}) => {
   loading.value = true;
@@ -345,6 +332,22 @@ watch(
   }
 );
 
+// 导入参数
+const upload = reactive({
+  // 是否显示弹出层(用户导入)
+  open: false,
+  // 弹出层标题(用户导入)
+  title: "导入",
+  // 是否禁用上传
+  isUploading: false,
+  // 设置上传的请求头部
+  headers: { Authorization: "Bearer " + getToken() },
+  // 参数
+  data: { basisId: +toolId.value },
+  // 上传的地址
+  url: import.meta.env.VITE_APP_BASE_API + "/basis/detail/importData",
+});
+
 // 导入
 const handleImport = () => {
   upload.title = "物料导入";
@@ -352,11 +355,7 @@ const handleImport = () => {
 };
 // 下载模版
 const importTemplate = () => {
-  proxy.download(
-    "system/user/importTemplate",
-    {},
-    `user_template_${new Date().getTime()}.xlsx`
-  );
+  window.location.href = "/物料导入模版.xlsx";
 };
 // 文件上传中
 const handleFileUploadProgress = (event, file, fileList) => {

+ 25 - 25
vite.config.js

@@ -1,27 +1,27 @@
-import { defineConfig, loadEnv } from 'vite'
-import path from 'path'
-import createVitePlugins from './vite/plugins'
+import { defineConfig, loadEnv } from "vite";
+import path from "path";
+import createVitePlugins from "./vite/plugins";
 
 // https://vitejs.dev/config/
 export default defineConfig(({ mode, command }) => {
-  const env = loadEnv(mode, process.cwd())
-  const { VITE_APP_ENV } = env
+  const env = loadEnv(mode, process.cwd());
+  const { VITE_APP_ENV } = env;
   return {
     // 部署生产环境和开发环境下的URL。
     // 默认情况下,vite 会假设你的应用是被部署在一个域名的根路径上
     // 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
-    base: VITE_APP_ENV === 'production' ? '/' : '/',
-    plugins: createVitePlugins(env, command === 'build'),
+    base: VITE_APP_ENV === "production" ? "/" : "/",
+    plugins: createVitePlugins(env, command === "build"),
     resolve: {
       // https://cn.vitejs.dev/config/#resolve-alias
       alias: {
         // 设置路径
-        '~': path.resolve(__dirname, './'),
+        "~": path.resolve(__dirname, "./"),
         // 设置别名
-        '@': path.resolve(__dirname, './src')
+        "@": path.resolve(__dirname, "./src"),
       },
       // https://cn.vitejs.dev/config/#resolve-extensions
-      extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
+      extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json", ".vue"],
     },
     // vite 相关配置
     server: {
@@ -30,30 +30,30 @@ export default defineConfig(({ mode, command }) => {
       open: true,
       proxy: {
         // https://cn.vitejs.dev/config/#server-proxy
-        '/dev-api': {
-          target: 'http://172.16.10.65:8080',
+        "/dev-api": {
+          target: "http://172.16.10.61:8080",
           // target: 'https://vue.ruoyi.vip/prod-api',
           changeOrigin: true,
-          rewrite: (p) => p.replace(/^\/dev-api/, '')
-        }
-      }
+          rewrite: (p) => p.replace(/^\/dev-api/, ""),
+        },
+      },
     },
     //fix:error:stdin>:7356:1: warning: "@charset" must be the first rule in the file
     css: {
       postcss: {
         plugins: [
           {
-            postcssPlugin: 'internal:charset-removal',
+            postcssPlugin: "internal:charset-removal",
             AtRule: {
               charset: (atRule) => {
-                if (atRule.name === 'charset') {
+                if (atRule.name === "charset") {
                   atRule.remove();
                 }
-              }
-            }
-          }
-        ]
-      }
-    }
-  }
-})
+              },
+            },
+          },
+        ],
+      },
+    },
+  };
+});