ysy před 1 rokem
rodič
revize
21bfd335d2

binární
dist.rar


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

@@ -102,3 +102,21 @@ export async function importBatch (data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+// 导入pbom
+export async function importPBom (data) {
+  const formData = new FormData();
+  data.multiPartFiles.forEach((item, index) => {
+    formData.append(`multiPartFiles`, item);
+  });
+  const res = await request.post(
+    `/main/bomCategory/importPBom`,
+    formData
+  );
+  if (res.data.code === '0') {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+

+ 19 - 4
src/views/material/BOMmanage/details.vue

@@ -81,7 +81,7 @@
                 plain
                 >导出</el-button
               >
-              <el-button     v-if="currentNodeData.bomType == 1"  type="primary" size="mini" icon="el-icon-upload2" plain
+              <el-button   @click="uploadFile" v-if="currentNodeData.bomType == 1"  type="primary" size="mini" icon="el-icon-upload2" plain
                 >导入</el-button
               >
               <el-button
@@ -152,6 +152,8 @@
       </ele-split-layout>
     </el-card>
     <bomTreeDialog ref="bomTreeDialogRef" @reload="bomTreeDialogReload" />
+
+    <importDialog :defModule="moudleName" ref="importDialogRef" @success="reload" />
   </div>
 </template>
 
@@ -171,6 +173,7 @@
   import document from './components/document.vue';
   import workmanship from './components/workmanship.vue';
   import bomTreeDialog from './components/bomTreeDialog.vue';
+  import importDialog from "./qualityTesting/import-dialog.vue";
   export default {
     name: 'BOMmanage',
     components: {
@@ -179,7 +182,8 @@
       document,
       workmanship,
       bomTreeDialog,
-      routing
+      routing,
+      importDialog
     },
     data() {
       return {
@@ -203,7 +207,9 @@
         versions: null,
         loadingInstance: null,
         noBack: false,
-        treeId: null
+        treeId: null,
+
+        moudleName : "mainUser",
       };
     },
     mounted() {
@@ -367,7 +373,16 @@
             children: []
           };
         }
-      }
+      },
+
+      uploadFile () {
+      this.$refs.importDialogRef.open();
+    },
+    
+    reload(where) {
+      this.getTreeData();
+      },
+
     }
   };
 </script>

+ 126 - 0
src/views/material/BOMmanage/qualityTesting/import-dialog.vue

@@ -0,0 +1,126 @@
+<template>
+  <!-- 上传 -->
+  <el-dialog title="导入文件上传" :visible.sync="dialogVisible" width="40%">
+    <el-form label-width="110px" class="zw-criterion">
+      <el-form-item label="选择文件">
+        <el-upload
+          class="avatar-uploader"
+          action="#"
+          :show-file-list="false"
+          :http-request="handlSuccess"
+          :before-upload="beforeUpload"
+        >
+          <el-button icon="el-icon-plus" size="small" type="primary"
+            >文件上传</el-button
+          >
+          <div slot="tip" class="el-upload__tip"
+            >只能上传excel文件</div
+          >
+        </el-upload>
+      </el-form-item>
+      <el-form-item label="上传列表">
+        <div class="imgs-box">
+          <p v-for="(item, index) in attaments" :key="index" class="imgs-p">
+            <span> {{ item.name }}</span>
+            <el-link @click="delFileList(index)" type="primary">删除</el-link>
+          </p>
+        </div>
+      </el-form-item>
+    </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>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+  import { importPBom } from '@/api/system/file/index.js';
+
+  export default {
+    props: {
+      defModule: ''
+    },
+    //注册组件
+    data() {
+      return {
+        showViewer: false, // 显示查看器
+        dialogVisible: false,
+        uploadShow: false,
+        module: '',
+        attaments: [], //上传文件
+        file: '',
+
+        loading: false
+      };
+    },
+    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;
+
+        this.loading = true;
+        await importPBom({
+          module: this.module,
+          multiPartFiles: this.attaments
+        });
+
+        setTimeout(() => {
+          this.loading = false;
+        }, 10000);
+        this.$message.success('操作成功!');
+        this.dialogVisible = false;
+        this.$emit('success');
+      }
+    }
+  };
+</script>
+
+<style lang="scss">
+  .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;
+  }
+</style>

+ 1 - 1
src/views/material/BOMmanage/qualityTesting/inspectionClassify/index.vue

@@ -1,6 +1,6 @@
 <template>
   <el-dialog
-    title="质检"
+    title="质检"
     :visible.sync="visible"
     :before-close="handleClose"
     :close-on-click-modal="false"

+ 3 - 3
src/views/material/product/detail.vue

@@ -161,7 +161,7 @@
               </div>
             </el-form-item>
           </el-col>
-          <el-col :span="8">
+          <!-- <el-col :span="8">
             <el-form-item label="所属部门">
               <deptSelect
                 v-model="form.chargeGroupId"
@@ -178,7 +178,7 @@
                 :init="false"
               />
             </el-form-item>
-          </el-col>
+          </el-col> -->
           <el-col :span="8">
             <el-form-item label="级别">
               <template>
@@ -381,7 +381,7 @@
 
         this.categoryLevelPathId = info.category.categoryLevelPathIdParent;
         this.judgeSet(info);
-        this.searchDeptNodeClick(this.form.chargeDeptId);
+        // this.searchDeptNodeClick(this.form.chargeDeptId);
 
         if (this.status == 1) {
           rootCategoryCode(this.categoryLevelPathId).then((res) => {