chencc 1 yıl önce
ebeveyn
işleme
ae2d986d55

BIN
public/importTemplate/产品_物品导入模板.xlsx


+ 12 - 0
src/api/material/list.js

@@ -1,4 +1,5 @@
 import request from '@/utils/request';
+import {download} from "@/utils/file";
 
 // 获取列表
 export async function getGroupPage(data) {
@@ -130,3 +131,14 @@ export async function getQualityTemplate(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+
+// 导出
+export async function exportFile(data) {
+  const res = await request.post(
+    '/main/category/export',data,{
+      responseType: 'blob'
+    }
+  );
+  download(res.data,'产品/物品数据.xlsx')
+}

+ 137 - 0
src/components/upload/import-dialogNew.vue

@@ -0,0 +1,137 @@
+<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"
+          :multiple="true"
+        >
+          <el-button icon="el-icon-plus" size="small" type="primary"
+            >文件上传</el-button
+          >
+          <div slot="tip" class="el-upload__tip" v-if="fileUrl">
+            只能上传excel文件,点击
+            <el-link
+              type="primary"
+              :underline="false"
+              @click="downLoadTemplate()"
+            >
+              下载模板</el-link
+            >
+          </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" @click="upload" type="primary">上 传</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+  import { importBatch } from '@/api/system/file/index.js';
+  import { download1 } from '@/utils/file';
+
+  export default {
+    props: {
+      // eslint-disable-next-line vue/require-prop-type-constructor
+      defModule: '',
+      fileUrl: '',
+      fileName: '',
+      apiUrl: ''
+    },
+    //注册组件
+    data() {
+      return {
+        showViewer: false, // 显示查看器
+        dialogVisible: false,
+        uploadShow: false,
+        module: '',
+        attaments: [], //上传文件
+        file: ''
+      };
+    },
+
+    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() {
+        download1(window.location.origin + this.fileUrl, this.fileName);
+      }
+    }
+  };
+</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>

+ 11 - 3
src/utils/file.js

@@ -2,7 +2,7 @@ import { getToken } from './token-util';
 import { TOKEN_HEADER_NAME } from '@/config/setting';
 
 // 获取图片反显url
-export function getImageUrl (path) {
+export function getImageUrl(path) {
   return `${sessionStorage.filePath}${path}`;
   // if (process.env.NODE_ENV === 'development') {
   //   return `http://192.168.3.51:18086/main/file/getFile?${TOKEN_HEADER_NAME}=${getToken()}&objectName=${path}`;
@@ -13,7 +13,7 @@ export function getImageUrl (path) {
   // }
 }
 // 从反显url上获取接口需要path
-export function getImagePath (url) {
+export function getImagePath(url) {
   if (!url) {
     return '';
   }
@@ -24,7 +24,7 @@ export function getImagePath (url) {
 }
 
 // 下载方法
-export function download (data, name) {
+export function download(data, name) {
   const a = document.createElement('a');
   const url = window.URL.createObjectURL(data);
   const filename = name;
@@ -33,3 +33,11 @@ export function download (data, name) {
   a.click();
   window.URL.revokeObjectURL(url);
 }
+
+export function download1(url, name) {
+  const a = document.createElement('a');
+  const filename = name;
+  a.href = url;
+  a.download = filename;
+  a.click();
+}

+ 5 - 0
src/views/codeManagement/businessCode/components/codeEdit.vue

@@ -136,8 +136,13 @@ export default {
 
     cancel() {
       this.form = { ...defaultForm };
+      this.form.useObjList=[]
       this.$refs.form.clearValidate();
+      this.$nextTick(() => {
+        this.$refs.treeRef.cancel();
+      });
       this.showEditFlag = false;
+    
     }
   }
 };

+ 147 - 141
src/views/codeManagement/businessCode/components/codeSegmentEdit.vue

@@ -17,7 +17,15 @@
             <el-input v-model="form.name" placeholder="请输入"></el-input>
           </el-form-item>
         </el-col>
-
+        <el-col :span="24">
+          <el-form-item label="排序" prop="sort">
+            <el-input
+              clearable
+              v-model.number="form.sort"
+              placeholder="请输入排序"
+            ></el-input>
+          </el-form-item>
+        </el-col>
         <el-col :span="24">
           <el-form-item label="描述" prop="remark">
             <el-input
@@ -38,10 +46,8 @@
             prop="length"
           >
             <el-input
-              v-model="form.length"
-              type="number"
-              min="0"
-              max="12"
+              v-model.number="form.length"
+      
               :disabled="form.roughRule == 4"
             ></el-input>
           </el-form-item>
@@ -99,158 +105,158 @@
     </template>
   </ele-modal>
 </template>
-  
-  <script>
-import { saveSegment } from '@/api/businessCode';
-import { roughRule, fineRule } from '@/enum/dict.js';
 
-export default {
-  components: {},
-  props: {
-    // 上级id
-    businessCodeCategoryId: [Number, String]
-  },
-  data() {
-    const defaultForm = {
-      name: '', //码段名称
-      businessCodeCategoryId: '', //分类id
-      length: '', //长度
-      delimiter: '', //间隔符
-      roughRule: '', //粗规则
-      fineRule: '', //细规则
-      value: [],
-      remark: '' //描述
-    };
-    return {
-      roughRule,
-      fineRule: [],
-      defaultForm,
-      // 表单数据
-      form: { ...defaultForm },
-      // 表单验证规则
-      rules: {},
-      // 提交状态
-      loading: false,
-      showEditFlag: false,
-      title: '',
-      type: '',
-      rules: {
-        name: [
-          {
-            required: true,
-            message: '请输入',
-            trigger: 'blur'
-          }
-        ],
-        // delimiter: [
-        //   {
-        //     required: true,
-        //     message: '请选择',
-        //     trigger: 'blur'
-        //   }
-        // ],
-        roughRule: [
-          {
-            required: true,
-            message: '请选择',
-            trigger: 'blur'
-          }
-        ],
-        fineRule: [
-          {
-            required: true,
-            message: '请选择',
-            trigger: 'blur'
-          }
-        ]
-      }
-    };
-  },
-  computed: {
-    // 是否开启响应式布局
-    styleResponsive() {
-      return this.$store.state.theme.styleResponsive;
-    }
-  },
-  created() {},
-  methods: {
-    async open(type, row) {
-      this.title = type === 'edit' ? '编辑' : '新增';
-      this.showEditFlag = true;
-      this.type = type;
-      if (type == 'add') {
-        this.form.businessCodeCategoryId = this.businessCodeCategoryId;
-      } else {
-        this.form = JSON.parse(JSON.stringify(row));
-        this.fineRule = fineRule.filter(
-          (item) => item.pid == this.form.roughRule
-        );
-      }
+<script>
+  import { saveSegment } from '@/api/businessCode';
+  import { roughRule, fineRule } from '@/enum/dict.js';
+
+  export default {
+    components: {},
+    props: {
+      // 上级id
+      businessCodeCategoryId: [Number, String]
     },
-    roughRuleChange(val) {
-      if (val == 4) {
-        this.form.length = '';
+    data() {
+      const defaultForm = {
+        name: '', //码段名称
+        businessCodeCategoryId: '', //分类id
+        length: '', //长度
+        delimiter: '', //间隔符
+        roughRule: '', //粗规则
+        fineRule: '', //细规则
+        value: [],
+        sort:'',
+        remark: '' //描述
+      };
+      return {
+        roughRule,
+        fineRule: [],
+        defaultForm,
+        // 表单数据
+        form: { ...defaultForm },
+        // 表单验证规则
+        rules: {},
+        // 提交状态
+        loading: false,
+        showEditFlag: false,
+        title: '',
+        type: '',
+        rules: {
+          name: [
+            {
+              required: true,
+              message: '请输入',
+              trigger: 'blur'
+            }
+          ],
+          sort: [
+            {
+              required: true,
+              message: '请输入',
+              trigger: 'blur'
+            }
+          ],
+          roughRule: [
+            {
+              required: true,
+              message: '请选择',
+              trigger: 'blur'
+            }
+          ],
+          fineRule: [
+            {
+              required: true,
+              message: '请选择',
+              trigger: 'blur'
+            }
+          ]
+        }
+      };
+    },
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive() {
+        return this.$store.state.theme.styleResponsive;
       }
-      this.fineRule = fineRule.filter((item) => item.pid == val);
-      this.form.fineRule = '';
     },
-    /* 保存编辑 */
-    save() {
-      this.$refs.form.validate(async (valid) => {
-        if (!valid) {
-          return false;
+    created() {},
+    methods: {
+      async open(type, row) {
+        this.title = type === 'edit' ? '编辑' : '新增';
+        this.showEditFlag = true;
+        this.type = type;
+        if (type == 'add') {
+          this.form.businessCodeCategoryId = this.businessCodeCategoryId;
+        } else {
+          this.form = JSON.parse(JSON.stringify(row));
+          this.fineRule = fineRule.filter(
+            (item) => item.pid == this.form.roughRule
+          );
         }
-
-        const data = {
-          ...this.form
-        };
-        if (this.type != 'edit') {
-          delete data.id;
+      },
+      roughRuleChange(val) {
+        if (val == 4) {
+          this.form.length = '';
         }
-        this.loading = true;
-        saveSegment(data)
-          .then((msg) => {
-            this.loading = false;
-            this.cancel();
-            this.$emit('done');
-          })
-          .catch((e) => {
-            this.loading = false;
-          });
-      });
-    },
+        this.fineRule = fineRule.filter((item) => item.pid == val);
+        this.form.fineRule = '';
+      },
+      /* 保存编辑 */
+      save() {
+        this.$refs.form.validate(async (valid) => {
+          if (!valid) {
+            return false;
+          }
 
-    cancel() {
-      this.form = { ...this.defaultForm };
-      this.$refs.form.clearValidate();
-      this.showEditFlag = false;
+          const data = {
+            ...this.form
+          };
+          if (this.type != 'edit') {
+            delete data.id;
+          }
+          this.loading = true;
+          saveSegment(data)
+            .then((msg) => {
+              this.loading = false;
+              this.cancel();
+              this.$emit('done');
+            })
+            .catch((e) => {
+              this.loading = false;
+            });
+        });
+      },
+
+      cancel() {
+        this.form = { ...this.defaultForm };
+        this.$refs.form.clearValidate();
+        this.showEditFlag = false;
+      }
     }
-  }
-};
+  };
 </script>
-  <style scoped lang="scss">
-.aaa {
-  width: 100%;
-
-  ::v-deep .upload-demo {
+<style scoped lang="scss">
+  .aaa {
     width: 100%;
 
-    .el-upload--text {
+    ::v-deep .upload-demo {
       width: 100%;
 
-      button {
+      .el-upload--text {
         width: 100%;
-        background: #ffffff;
-        border: 1px solid #dbdbdb;
-        border-radius: 5px;
+
+        button {
+          width: 100%;
+          background: #ffffff;
+          border: 1px solid #dbdbdb;
+          border-radius: 5px;
+        }
       }
-    }
 
-    .el-upload-list {
-      transform: translate(10px, -39px);
-      position: absolute;
+      .el-upload-list {
+        transform: translate(10px, -39px);
+        position: absolute;
+      }
     }
   }
-}
 </style>
-  

+ 3 - 7
src/views/codeManagement/businessCode/components/tree.vue

@@ -129,13 +129,6 @@ export default {
       });
     },
     filterLeftData(list, rightIds, newList) {
-      // console.log(rightIds)
-      // list.forEach(leftItem=>{
-      //   if(rightIds.includes(leftItem.id)){
-      //     leftItem
-      //     newList.push(leftItem)
-      //   }
-      // })
       for (let leftItem of list) {
         if (rightIds.includes(leftItem.id)) {
           if (leftItem.children && leftItem.children.length) {
@@ -161,6 +154,9 @@ export default {
       }
       return newList;
     },
+    cancel(){
+        this.selection=[]
+    },
     getList() {
       return this.selection;
     }

Dosya farkı çok büyük olduğundan ihmal edildi
+ 624 - 498
src/views/material/product/components/index-data.vue


+ 1 - 1
vue.config.js

@@ -36,7 +36,7 @@ module.exports = {
     proxy: {
       // 当我们的本地的请求 有/api的时候,就会代理我们的请求地址向另外一个服务器发出请求
       '/api': {
-        target: 'http://192.168.1.125:18086',
+        target: 'http://192.168.1.251:18086',
         // target: 'http://192.168.1.158:18086',
         // target: 'http://192.168.1.176:18086',
         // target: 'http://192.168.1.251:18086',

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor