695593266@qq.com 11 месяцев назад
Родитель
Сommit
9af9b27d61

+ 12 - 0
src/api/system/file/index.js

@@ -114,6 +114,18 @@ export async function downLoadFiexs() {
   download(res.data, 'CS配置教程.docx');
 }
 
+export async function downLoadBom() {
+  const res = await request.post(
+    '/main/user/downLoadTemplate',
+    {},
+    {
+      responseType: 'blob'
+    }
+  );
+  console.log(res.data, '***********');
+  download(res.data, 'BOM导入模板.xlsx');
+}
+
 /**
  * 删除文件
  */

+ 3 - 3
src/components/upload/comm-dialog.vue

@@ -1,7 +1,7 @@
 <template>
   <!-- 上传 -->
   <el-dialog title="导入文件上传" :visible.sync="dialogVisible" width="40%">
-    <el-form label-width="110px" class="zw-criterion" >
+    <el-form label-width="110px" class="zw-criterion">
       <el-form-item label="选择文件">
         <el-upload
           class="avatar-uploader"
@@ -116,11 +116,11 @@
       },
       //下载模板
       downLoadTemplate() {
-        console.log(1234)
+        console.log(1234);
         this.loading = true;
         try {
           downLoadTemplateNew(this.fileUrl, this.fileName);
-        }finally {
+        } finally {
           this.loading = false;
         }
       }

+ 77 - 77
src/components/upload/import-dialog.vue

@@ -42,90 +42,90 @@
 </template>
 
 <script>
-import { importBatch,downLoadTemplate } from '@/api/system/file/index.js';
+  import { importBatch, downLoadTemplate } from '@/api/system/file/index.js';
 
-export default {
-  props: {
-    // eslint-disable-next-line vue/require-prop-type-constructor
-    defModule: ''
-  },
-  //注册组件
-  data() {
-    return {
-      showViewer: false, // 显示查看器
-      dialogVisible: false,
-      uploadShow: false,
-      module: '',
-      attaments: [], //上传文件
-      file: ''
-    };
-  },
-  created() {},
-  methods: {
-    open() {
-      this.attaments = [];
-      this.module = '';
-      this.dialogVisible = true;
+  export default {
+    props: {
+      // eslint-disable-next-line vue/require-prop-type-constructor
+      defModule: ''
     },
-    //删除附件
-    delFileList(index) {
-      this.attaments.splice(index, 1);
+    //注册组件
+    data() {
+      return {
+        showViewer: false, // 显示查看器
+        dialogVisible: false,
+        uploadShow: false,
+        module: '',
+        attaments: [], //上传文件
+        file: ''
+      };
     },
-    //上传限制
-    beforeUpload(file) {
-      const isLt10M = file.size / 1024 / 1024 < 10;
-      if (!isLt10M) {
-        this.$message.error('导入单文件大小不能超过 10MB!');
-      }
-      return isLt10M;
-    },
-    //图片上传
-    handlSuccess(param) {
-      this.file = param.file;
-      this.attaments.push(param.file);
-    },
-    // 文件上传
-    async upload() {
-      if (this.attaments.length == 0) {
-        return this.$message.warning('文件不能为空!');
-      }
-      this.module = this.$props.defModule;
+    created() {},
+    methods: {
+      open() {
+        this.attaments = [];
+        this.module = '';
+        this.dialogVisible = true;
+      },
+      //删除附件
+      delFileList(index) {
+        this.attaments.splice(index, 1);
+      },
+      //上传限制
+      beforeUpload(file) {
+        const isLt10M = file.size / 1024 / 1024 < 10;
+        if (!isLt10M) {
+          this.$message.error('导入单文件大小不能超过 10MB!');
+        }
+        return isLt10M;
+      },
+      //图片上传
+      handlSuccess(param) {
+        this.file = param.file;
+        this.attaments.push(param.file);
+      },
+      // 文件上传
+      async upload() {
+        if (this.attaments.length == 0) {
+          return this.$message.warning('文件不能为空!');
+        }
+        this.module = this.$props.defModule;
 
-      await importBatch({
-        module: this.module,
-        multiPartFiles: this.attaments
-      });
-      this.$message.success('操作成功!');
-      this.dialogVisible = false;
-      this.$emit('success');
-    },
-    //下载模板
-    downLoadTemplate(){
-      downLoadTemplate()
+        await importBatch({
+          module: this.module,
+          multiPartFiles: this.attaments
+        });
+        this.$message.success('操作成功!');
+        this.dialogVisible = false;
+        this.$emit('success');
+      },
+      //下载模板
+      downLoadTemplate() {
+        downLoadTemplate();
+      }
     }
-  }
-};
+  };
 </script>
 
 <style lang="scss">
-.zw-table-header {
-  float: right;
-}
+  .zw-table-header {
+    float: right;
+  }
 
-.imgs-box .imgs-p {
-  height: 30px;
-  background: #f0f3f3;
-  line-height: 30px;
-  width: 372px;
-  margin-bottom: 5px;
-  padding: 0 10px;
-  display: flex;
-  justify-content: space-between;
-}
-.zw-criterion-normal {
-  padding: 20px 0 0 0;
-}
-.el-main {
-  overflow: hidden;
-}
+  .imgs-box .imgs-p {
+    height: 30px;
+    background: #f0f3f3;
+    line-height: 30px;
+    width: 372px;
+    margin-bottom: 5px;
+    padding: 0 10px;
+    display: flex;
+    justify-content: space-between;
+  }
+  .zw-criterion-normal {
+    padding: 20px 0 0 0;
+  }
+  .el-main {
+    overflow: hidden;
+  }
 </style>

+ 11 - 9
src/views/classifyManage/treeClassify/components/upload-dialog.vue

@@ -13,7 +13,9 @@
           <el-button icon="el-icon-plus" size="small" type="primary"
             >文件上传</el-button
           >
-          <div slot="tip" class="el-upload__tip">只能上传excel文件,或批量上传打包成zip、rar压缩文件,单文件不超过10mb</div>
+          <div slot="tip" class="el-upload__tip"
+            >只能上传excel文件,或批量上传打包成zip、rar压缩文件,单文件不超过10mb</div
+          >
         </el-upload>
       </el-form-item>
       <el-form-item label="上传列表">
@@ -33,14 +35,14 @@
 </template>
 
 <script>
-import {importBatch, uploadBatch} from '@/api/system/file/index.js';
+  import { importBatch, uploadBatch } from '@/api/system/file/index.js';
 
   export default {
     props: {
       defModule: ''
     },
     //注册组件
-    data () {
+    data() {
       return {
         showViewer: false, // 显示查看器
         dialogVisible: false,
@@ -50,19 +52,19 @@ import {importBatch, uploadBatch} from '@/api/system/file/index.js';
         file: ''
       };
     },
-    created () {},
+    created() {},
     methods: {
-      open () {
+      open() {
         this.attaments = [];
         this.module = '';
         this.dialogVisible = true;
       },
       //删除附件
-      delFileList (index) {
+      delFileList(index) {
         this.attaments.splice(index, 1);
       },
       //上传限制
-      beforeUpload (file) {
+      beforeUpload(file) {
         const isLt10M = file.size / 1024 / 1024 < 10;
         if (!isLt10M) {
           this.$message.error('上传文件大小不能超过 10MB!');
@@ -70,12 +72,12 @@ import {importBatch, uploadBatch} from '@/api/system/file/index.js';
         return isLt10M;
       },
       //图片上传
-      handlSuccess (param) {
+      handlSuccess(param) {
         this.file = param.file;
         this.attaments.push(param.file);
       },
       // 文件上传
-      async upload () {
+      async upload() {
         if (this.attaments.length == 0) {
           return this.$message.warning('文件不能为空!');
         }

+ 9 - 7
src/views/documentManagement/docManagement/components/upload-dialog.vue

@@ -39,7 +39,7 @@
 
   export default {
     //注册组件
-    data () {
+    data() {
       return {
         showViewer: false, // 显示查看器
         dialogVisible: false,
@@ -49,19 +49,19 @@
         file: ''
       };
     },
-    created () {},
+    created() {},
     methods: {
-      open () {
+      open() {
         this.attaments = [];
         this.module = '';
         this.dialogVisible = true;
       },
       //删除附件
-      delFileList (index) {
+      delFileList(index) {
         this.attaments.splice(index, 1);
       },
       //上传限制
-      beforeUpload (file) {
+      beforeUpload(file) {
         const isLt10M = file.size / 1024 / 1024 < 10;
         if (!isLt10M) {
           this.$message.error('上传文件大小不能超过 10MB!');
@@ -69,12 +69,14 @@
         return isLt10M;
       },
       //图片上传
-      handlSuccess (param) {
+      handlSuccess(param) {
         this.file = param.file;
         this.attaments.push(param.file);
       },
+
+      downLoadTemplate() {},
       // 文件上传
-      async upload () {
+      async upload() {
         if (this.attaments.length == 0) {
           return this.$message.warning('文件不能为空!');
         }

+ 24 - 10
src/views/material/BOMmanage/qualityTesting/import-dialog.vue

@@ -10,13 +10,20 @@
           :http-request="handlSuccess"
           :before-upload="beforeUpload"
         >
-        <!-- x -->
+          <!-- x -->
           <el-button icon="el-icon-plus" size="small" type="primary"
             >文件上传</el-button
           >
-          <div slot="tip" class="el-upload__tip"
-            >只能上传excel文件</div
-          >
+          <div slot="tip" class="el-upload__tip">
+            只能上传excel文件,点击
+            <el-link
+              type="primary"
+              :underline="false"
+              @click="downLoadTemplate()"
+            >
+              下载模板</el-link
+            >
+          </div>
         </el-upload>
       </el-form-item>
 
@@ -26,9 +33,9 @@
             <span> {{ item.name }}</span>
             <el-link @click="delFileList(index)" type="primary">删除</el-link>
           </p>
-          <el-progress 
+          <el-progress
             v-if="progressVisible"
-            :percentage="percentage" 
+            :percentage="percentage"
             :status="uploadStatus"
           />
         </div>
@@ -36,13 +43,16 @@
     </el-form>
     <div slot="footer" class="dialog-footer">
       <el-button size="small" @click="dialogVisible = false">关 闭</el-button>
-      <el-button size="small" :loading="loading"  @click="upload" type="primary">上 传</el-button>
+      <el-button size="small" :loading="loading" @click="upload" type="primary"
+        >上 传</el-button
+      >
     </div>
   </el-dialog>
 </template>
 
 <script>
   import { importPBom } from '@/api/system/file/index.js';
+  import { downLoadBom } from '@/api/system/file/index.js';
 
   export default {
     props: {
@@ -57,9 +67,9 @@
         module: '',
         attaments: [], //上传文件
         file: '',
-        percentage: 0,        // 进度百分比 (0-100)
+        percentage: 0, // 进度百分比 (0-100)
         progressVisible: false, // 是否显示进度条
-        uploadStatus: '',     // 进度条状态 (success/exception)
+        uploadStatus: '', // 进度条状态 (success/exception)
         loading: false
       };
     },
@@ -92,7 +102,11 @@
         this.file = param.file;
         this.attaments.push(param.file);
       },
-      
+
+      downLoadTemplate() {
+        downLoadBom();
+      },
+
       // 文件上传
       async upload() {
         if (this.attaments.length == 0) {