Kaynağa Gözat

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-aps into dengfei

695593266@qq.com 9 ay önce
ebeveyn
işleme
3d32b604aa

+ 2 - 2
src/api/aps/presalesorder.js

@@ -67,8 +67,8 @@ export async function exportFile(params) {
 }
 
 //下载模板
-export async function importTemplate(name) {
-  const res = await request.post('/aps/presalesorder/importTemplate', {}, {
+export async function importTemplate(url,name) {
+  const res = await request.post(url||'/aps/presalesorder/importTemplate', {}, {
     responseType: 'blob'
   });
   download(res.data, name||`交期预估下载模板.xlsx`)

+ 43 - 7
src/api/system/file/index.js

@@ -1,11 +1,11 @@
 import request from '@/utils/request';
-import {download } from '@/utils/file';
+import { download } from '@/utils/file';
 
 /**
  * 上传文件
  * @param file 文件
  */
-export async function uploadFile (data) {
+export async function uploadFile(data) {
   const formData = new FormData();
   formData.append('multiPartFile', data.multiPartFile);
   formData.append('module', data.module);
@@ -15,11 +15,47 @@ export async function uploadFile (data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+/**
+ * 导入文件 批量
+ * @param file 文件
+ */
+export async function importBatch(
+  data,
+  api,
+  onUploadProgressCb,
+  fileKeyName = 'file'
+) {
+  const formData = new FormData();
+  data.multiPartFiles.forEach((item, index) => {
+    formData.append(fileKeyName, item);
+  });
+  const res = await request.post(api, formData, {
+    onUploadProgress: onUploadProgressCb ? onUploadProgressCb : () => {}
+  });
+  if (res.data.code === '0') {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+/**
+ * 下载模板
+ */
+export async function downLoadTemplate(url, name) {
+  const res = await request.post(
+    url,
+    {},
+    {
+      responseType: 'blob'
+    }
+  );
+  console.log(res.data, '***********');
+  download(res.data, name);
+}
 /**
  * 上传文件 批量
  * @param file 文件
  */
-export async function uploadBatch (data) {
+export async function uploadBatch(data) {
   const formData = new FormData();
   data.multiPartFiles.forEach((item, index) => {
     formData.append(`multiPartFiles`, item);
@@ -37,7 +73,7 @@ export async function uploadBatch (data) {
 /**
  * 获取文件路径
  */
-export async function getPathAddress () {
+export async function getPathAddress() {
   const res = await request.post('/main/file/getPathAddress');
   if (res.data.code === '0') {
     return res.data.data;
@@ -47,7 +83,7 @@ export async function getPathAddress () {
 /**
  * 获取文件
  */
-export async function getFile (params, fileName) {
+export async function getFile(params, fileName) {
   const res = await request.get('/main/file/getFile', {
     params,
     responseType: 'blob'
@@ -62,7 +98,7 @@ export async function getFile (params, fileName) {
 /**
  * 删除文件
  */
-export async function removeFile (data) {
+export async function removeFile(data) {
   const res = await request.post(
     `/main/file/delete?fileId=${data.fileId}`,
     data
@@ -75,7 +111,7 @@ export async function removeFile (data) {
 /**
  * 文件列表
  */
-export async function getFileList (data) {
+export async function getFileList(data) {
   const res = await request.post(`/main/file/list`, data);
   if (res.data.code === '0') {
     return res.data.data;

+ 161 - 160
src/components/addDoc/file-table-listTemplate.vue

@@ -27,172 +27,173 @@
 </template>
 
 <script>
-import { filePageAPI } from './api';
-import browse from './browse.vue';
+  import { filePageAPI } from './api';
+  import browse from './browse.vue';
+  import { setFileUrl } from './util.js';
 
-export default {
-  components: { browse },
-  props: {
-    // 上级
-    parentData: {
-      type: Object,
-      default: () => {}
+  export default {
+    components: { browse },
+    props: {
+      // 上级
+      parentData: {
+        type: Object,
+        default: () => {}
+      },
+
+      disabledTableList: {
+        //已选择列表
+        default: () => []
+      }
     },
 
-    disabledTableList: {
-      //已选择列表
-      default: () => []
-    }
-  },
+    data() {
+      return {
+        selection: [],
+        columns: [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center',
+            selectable: (row, index) => {
+              return !this.disabledTableList
+                .map((item) => item.id)
+                .includes(row.id);
+            }
+          },
+          {
+            label: '编码',
+            prop: 'code',
+            width: 180,
+            align: 'center',
+            fixed: 'left',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'name',
+            label: '文档名称',
+            align: 'center',
+            slot: 'name',
+            showOverflowTooltip: true,
+            minWidth: 200
+          },
+          {
+            prop: 'storagePath',
+            label: '文件名称',
+            align: 'center',
 
-  data() {
-    return {
-      selection: [],
-      columns: [
-        {
-          width: 45,
-          type: 'selection',
-          columnKey: 'selection',
-          align: 'center',
-          selectable: (row, index) => {
-            return !this.disabledTableList
-              .map((item) => item.id)
-              .includes(row.id);
-          }
-        },
-        {
-          label: '编码',
-          prop: 'code',
-          width: 180,
-          align: 'center',
-          fixed: 'left',
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'name',
-          label: '文档名称',
-          align: 'center',
-          slot: 'name',
-          showOverflowTooltip: true,
-          minWidth: 200
-        },
-        {
-          prop: 'storagePath',
-          label: '文件名称',
-          align: 'center',
-
-          showOverflowTooltip: true,
-          minWidth: 200,
-          formatter: (_row, _column, cellValue) => {
-            return cellValue[0]?.name;
-          }
-        },
-        {
-          prop: 'version',
-          label: '版本',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 100
-        },
-        {
-          prop: 'checkOutUserName',
-          label: '检出人',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 100
-        },
-        {
-          prop: 'checkOutStatus',
-          label: '检出状态',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 100,
-          formatter: (_row, _column, cellValue) => {
-            return cellValue == 1 ? '已检出' : '';
+            showOverflowTooltip: true,
+            minWidth: 200,
+            formatter: (_row, _column, cellValue) => {
+              return cellValue[0]?.name;
+            }
+          },
+          {
+            prop: 'version',
+            label: '版本',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100
+          },
+          {
+            prop: 'checkOutUserName',
+            label: '检出人',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100
+          },
+          {
+            prop: 'checkOutStatus',
+            label: '检出状态',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100,
+            formatter: (_row, _column, cellValue) => {
+              return cellValue == 1 ? '已检出' : '';
+            }
+          },
+          {
+            prop: 'checkOutTime',
+            label: '检出时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 160
+          },
+          {
+            prop: 'createUserName',
+            label: '创建人',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100
+          },
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 160,
+            formatter: (_row, _column, cellValue) => {
+              return this.$util.toDateString(cellValue);
+            }
+          },
+          {
+            prop: 'updateUserName',
+            label: '修改人',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100
+          },
+          {
+            prop: 'updateTime',
+            label: '修改时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 160
+          },
+          {
+            prop: 'sizeUnit',
+            label: '文档大小',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 150,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true,
+            fixed: 'right'
           }
-        },
-        {
-          prop: 'checkOutTime',
-          label: '检出时间',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 160
-        },
-        {
-          prop: 'createUserName',
-          label: '创建人',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 100
-        },
-        {
-          prop: 'createTime',
-          label: '创建时间',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 160,
-          formatter: (_row, _column, cellValue) => {
-            return this.$util.toDateString(cellValue);
-          }
-        },
-        {
-          prop: 'updateUserName',
-          label: '修改人',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 100
-        },
-        {
-          prop: 'updateTime',
-          label: '修改时间',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 160
-        },
-        {
-          prop: 'sizeUnit',
-          label: '文档大小',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 100
-        },
-        {
-          columnKey: 'action',
-          label: '操作',
-          width: 150,
-          align: 'center',
-          resizable: false,
-          slot: 'action',
-          showOverflowTooltip: true,
-          fixed: 'right'
-        }
-      ]
-    };
-  },
-  created() {},
-
-  methods: {
-    /* 表格数据源 */
-    datasource({ page, limit, where, order }) {
-      return filePageAPI({
-        ...where,
-        ...order,
-        pageNum: page,
-        size: limit,
-        directoryId: this.parentData?.id
-      });
-    },
-    /* 刷新表格 */
-    reload(where) {
-      this.$refs.table.reload({ pageNum: 1, where: where });
+        ]
+      };
     },
+    created() {},
 
-    browseOpen(row) {
-      this.$refs.browseRef.open(row);
-    },
-    getTableList() {
-      return JSON.parse(JSON.stringify(this.selection));
+    methods: {
+      /* 表格数据源 */
+      datasource({ page, limit, where, order }) {
+        return filePageAPI({
+          ...where,
+          ...order,
+          pageNum: page,
+          size: limit,
+          directoryId: this.parentData?.id
+        });
+      },
+      /* 刷新表格 */
+      reload(where) {
+        this.$refs.table.reload({ pageNum: 1, where: where });
+      },
+
+      browseOpen(row) {
+        window.open(setFileUrl(row));
+      },
+      getTableList() {
+        return JSON.parse(JSON.stringify(this.selection));
+      }
     }
-  }
-};
+  };
 </script>

+ 129 - 128
src/components/addDoc/main.vue

@@ -63,7 +63,7 @@
       custom-class="ele-dialog-form"
       append-to-body
       :maxable="true"
-    :resizable="true"
+      :resizable="true"
     >
       <doc_template
         :disabledTableList="tableList"
@@ -79,140 +79,141 @@
 </template>
 
 <script>
-import doc_template from './doc_template.vue';
-import fileEdit from './file-edit.vue';
-import browse from './browse.vue';
-import { queryIds } from './api';
+  import doc_template from './doc_template.vue';
+  import fileEdit from './file-edit.vue';
+  import browse from './browse.vue';
+  import { queryIds } from './api';
+  import { setFileUrl } from './util.js';
 
-export default {
-  components: { doc_template, fileEdit, browse },
+  export default {
+    components: { doc_template, fileEdit, browse },
 
-  data() {
-    return {
-      fileId: [],
-      fileShow: false,
-      showEditFlag: false,
-      tableList: [],
-      type: 'add',
-      columns: [
-        {
-          label: '编码',
-          prop: 'code',
-          width: 180,
-          align: 'center',
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'name',
-          label: '文档名称',
-          align: 'center',
-          slot: 'name',
-          showOverflowTooltip: true,
-          minWidth: 200
-        },
-        {
-          prop: 'storagePath',
-          label: '文件名称',
-          align: 'center',
+    data() {
+      return {
+        fileId: [],
+        fileShow: false,
+        showEditFlag: false,
+        tableList: [],
+        type: 'add',
+        columns: [
+          {
+            label: '编码',
+            prop: 'code',
+            width: 180,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'name',
+            label: '文档名称',
+            align: 'center',
+            slot: 'name',
+            showOverflowTooltip: true,
+            minWidth: 200
+          },
+          {
+            prop: 'storagePath',
+            label: '文件名称',
+            align: 'center',
 
-          showOverflowTooltip: true,
-          minWidth: 200,
-          formatter: (_row, _column, cellValue) => {
-            return cellValue && cellValue[0]?.name;
-          }
-        },
-        {
-          prop: 'version',
-          label: '版本',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 100
-        },
+            showOverflowTooltip: true,
+            minWidth: 200,
+            formatter: (_row, _column, cellValue) => {
+              return cellValue && cellValue[0]?.name;
+            }
+          },
+          {
+            prop: 'version',
+            label: '版本',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100
+          },
 
-        {
-          prop: 'createUserName',
-          label: '创建人',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 100
-        },
-        {
-          prop: 'createTime',
-          label: '创建时间',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 160
-        },
+          {
+            prop: 'createUserName',
+            label: '创建人',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100
+          },
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 160
+          },
 
-        {
-          prop: 'sizeUnit',
-          label: '文档大小',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 100
-        },
+          {
+            prop: 'sizeUnit',
+            label: '文档大小',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100
+          },
 
-        {
-          columnKey: 'action',
-          label: '操作',
-          width: 200,
-          align: 'center',
-          resizable: false,
-          slot: 'action',
-          showOverflowTooltip: true
-        }
-      ]
-    };
-  },
-  created() {},
-
-  methods: {
-    open(fileId, type) {
-      //查看详情:view 新增:add
-      this.showEditFlag = true;
-      this.fileId = fileId || [];
-      if (type) {
-        this.type = type;
-      }
-      this.init();
-    },
-    fileEditOpen() {
-      this.$refs.fileEditRef.open();
-    },
-    remove(row) {
-      this.tableList = this.tableList.filter((item) => item.code != row.code);
-      this.fileId = this.tableList.map((item) => item.id);
-    },
-    async init() {
-      if (this.fileId.length > 0) {
-        this.tableList = await queryIds({ ids: "'" + this.fileId + "'" });
-      } else {
-        this.tableList = [];
-      }
-    },
-    done(id) {
-      this.fileId.push(...id);
-      this.init();
-    },
-    browseOpen(row) {
-      this.$refs.browseRef.open(row);
-    },
-    addFile() {
-      this.$emit(
-        'success',
-        this.tableList.map((item) => item.id)
-      );
-      this.showEditFlag = false;
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 200,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true
+          }
+        ]
+      };
     },
-    addTemplate() {
-      let list = this.$refs.doc_templateRef.getTableList();
-      this.fileShow = false;
-      if (list.length == 0) {
-        this.$message.error('请选择一条数据');
-        return;
+    created() {},
+
+    methods: {
+      open(fileId, type) {
+        //查看详情:view 新增:add
+        this.showEditFlag = true;
+        this.fileId = fileId || [];
+        if (type) {
+          this.type = type;
+        }
+        this.init();
+      },
+      fileEditOpen() {
+        this.$refs.fileEditRef.open();
+      },
+      remove(row) {
+        this.tableList = this.tableList.filter((item) => item.code != row.code);
+        this.fileId = this.tableList.map((item) => item.id);
+      },
+      async init() {
+        if (this.fileId.length > 0) {
+          this.tableList = await queryIds({ ids: "'" + this.fileId + "'" });
+        } else {
+          this.tableList = [];
+        }
+      },
+      done(id) {
+        this.fileId.push(...id);
+        this.init();
+      },
+      browseOpen(row) {
+        window.open(setFileUrl(row));
+      },
+      addFile() {
+        this.$emit(
+          'success',
+          this.tableList.map((item) => item.id)
+        );
+        this.showEditFlag = false;
+      },
+      addTemplate() {
+        let list = this.$refs.doc_templateRef.getTableList();
+        this.fileShow = false;
+        if (list.length == 0) {
+          this.$message.error('请选择一条数据');
+          return;
+        }
+        this.tableList.push(...list);
       }
-      this.tableList.push(...list);
     }
-  }
-};
+  };
 </script>

+ 112 - 55
src/components/addDoc/util.js

@@ -1,65 +1,122 @@
 import store from '@/store';
-const userId = store.state.user?.info?.userId
-const userName = store.state.user?.info?.name
+const userId = store.state.user?.info?.userId;
+const userName = store.state.user?.info?.name;
 export function isPower(data = {}, power, selection = []) {
-
-    if (power == 'add' && data.userAuthority.length == 0) { //文件夹默认开放新增权限
-        return true
-    }
-    if (!data?.id && selection.length == 0) {
-        return false
-
-    }
-    if (power == 'checkEnter' && data?.checkOutUserId != userId) { //检入特殊处理
-        return false
-    }
-    if (selection.length > 0) { //多选情况处理
-        let isPower = true
-        let userAuthorityS = []
-        let createUserIdS = selection.map(item => item.createUserId).filter(createUserId => createUserId == userId)
-        if (createUserIdS.length == selection.length || userName == 'admin') {
-            return true
-        }
-        selection.forEach(val => {
-            const powerObj = val.userAuthority.find(item => item.id == userId)
-            if (powerObj) {
-                userAuthorityS.push(powerObj)
-            }
-        })
-
-        if (userAuthorityS.length == 0) {
-            isPower = false
-        }
-        userAuthorityS.forEach(item => {
-            if (item[power] != '1') {
-                isPower = false
-            }
-        })
-        return isPower
+  if (power == 'add' && data.userAuthority.length == 0) {
+    //文件夹默认开放新增权限
+    return true;
+  }
+  if (!data?.id && selection.length == 0) {
+    return false;
+  }
+  if (power == 'checkEnter' && data?.checkOutUserId != userId) {
+    //检入特殊处理
+    return false;
+  }
+  if (selection.length > 0) {
+    //多选情况处理
+    let isPower = true;
+    let userAuthorityS = [];
+    let createUserIdS = selection
+      .map((item) => item.createUserId)
+      .filter((createUserId) => createUserId == userId);
+    if (createUserIdS.length == selection.length || userName == 'admin') {
+      return true;
     }
+    selection.forEach((val) => {
+      const powerObj = val.userAuthority.find((item) => item.id == userId);
+      if (powerObj) {
+        userAuthorityS.push(powerObj);
+      }
+    });
 
-    if (data.createUserId == userId || userName == 'admin') { //创建人/admin所有权限
-        return true
-    }
-    if (!power) {
-        return false
+    if (userAuthorityS.length == 0) {
+      isPower = false;
     }
-    const powerObj = data.userAuthority.find(item => item.id == userId)
-    if (powerObj) {
+    userAuthorityS.forEach((item) => {
+      if (item[power] != '1') {
+        isPower = false;
+      }
+    });
+    return isPower;
+  }
 
-        return powerObj[power] == '1'
-    }
+  if (data.createUserId == userId || userName == 'admin') {
+    //创建人/admin所有权限
+    return true;
+  }
+  if (!power) {
+    return false;
+  }
+  const powerObj = data.userAuthority.find((item) => item.id == userId);
+  if (powerObj) {
+    return powerObj[power] == '1';
+  }
 }
-
-export function setFolderList(data) { //递归过滤文件夹权限
-    data.forEach((item) => {
-        item['disabled'] = !isPower(item, 'add');
-        if (item.sonDirectoryList && item.sonDirectoryList.length > 0) {
-            setFolderList(item.sonDirectoryList);
-        }
-    });
+export function setFileUrl(row) {
+  let file = row.storagePath[0];
+  let fileNames = file.storePath.split('/');
+  let url =
+    window.location.origin +
+    '/api/main/file/getFile?objectName=' +
+    file.storePath +
+    '&fullfilename=' +
+    fileNames[fileNames.length - 1];
+  return '/kkfile/onlinePreview?url=' + btoa(url);
+}
+export function setFolderList(data) {
+  //递归过滤文件夹权限
+  data.forEach((item) => {
+    item['disabled'] = !isPower(item, 'add');
+    if (item.sonDirectoryList && item.sonDirectoryList.length > 0) {
+      setFolderList(item.sonDirectoryList);
+    }
+  });
 }
 //新迪预览工具支持的文件格式
 export function getFileType() {
-    return ['par', 'asm', 'psm', 'dft', 'sldprt', 'sldasm', 'ipt', 'iam', 'prt', '3dxml', 'CATPart', 'CATProduct', 'cgr', 'model', 'exp', 'session', 'x_t', 'xmt_txt', 'x_b', 'xmp_bin', 'xmp_txt', 'sat', 'sab', 'igs', 'iges', 'stp', 'step', 'jt', 'xcgm', '3dm', 'stl', 'obj', '3mf', 'fbx', 'vda', 'dxf', 'dwg', 'pdf', 'idf', 'idb', 'emn', 'brd']
-}
+  return [
+    'par',
+    'asm',
+    'psm',
+    'dft',
+    'sldprt',
+    'sldasm',
+    'ipt',
+    'iam',
+    'prt',
+    '3dxml',
+    'CATPart',
+    'CATProduct',
+    'cgr',
+    'model',
+    'exp',
+    'session',
+    'x_t',
+    'xmt_txt',
+    'x_b',
+    'xmp_bin',
+    'xmp_txt',
+    'sat',
+    'sab',
+    'igs',
+    'iges',
+    'stp',
+    'step',
+    'jt',
+    'xcgm',
+    '3dm',
+    'stl',
+    'obj',
+    '3mf',
+    'fbx',
+    'vda',
+    'dxf',
+    'dwg',
+    'pdf',
+    'idf',
+    'idb',
+    'emn',
+    'brd'
+  ];
+}

+ 2 - 2
src/components/bpmnProcessDesigner/package/designer/ProcessViewer.vue

@@ -363,7 +363,7 @@
                   <p>部门:${task.assigneeUser.deptName}</p>
                   <p>结果:${this.getDictValue(
                     '流程实例的结果',
-                    task.result
+                    task.result + ''
                   )}</p>
                   <p>创建时间:${task.createTime}</p>`;
             if (task.endTime) {
@@ -386,7 +386,7 @@
           } else if (element.type === 'bpmn:EndEvent' && this.processInstance) {
             html = `<p>结果:${this.getDictValue(
               '流程实例的结果',
-              this.processInstance.result.toString()
+              this.processInstance.result + ''
             )}</p>`;
             if (this.processInstance.endTime) {
               html += `<p>结束时间:${this.processInstance.endTime}</p>`;

+ 189 - 0
src/components/upload/import-dialog.vue

@@ -0,0 +1,189 @@
+<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"
+          :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>
+    <div id="progress" v-if="isProgress">
+      <el-progress
+        type="circle"
+        :percentage="percentage"
+        text-color="#fff"
+      ></el-progress>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+  import { importBatch,downLoadTemplate } from '@/api/system/file/index.js';
+  import { download1 } from '@/utils/file';
+  import { number } from 'echarts';
+
+  export default {
+    props: {
+      // eslint-disable-next-line vue/require-prop-type-constructor
+      defModule: '',
+      fileUrl: '',
+      fileName: '',
+      apiUrl: '',
+      isWeb: {
+        type: Boolean,
+        default: true
+      } ,
+      fileKeyName:'file'
+    },
+    //注册组件
+    data() {
+      return {
+        showViewer: false, // 显示查看器
+        dialogVisible: false,
+        uploadShow: false,
+        isProgress: false,
+        module: '',
+        percentage: 0,
+        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;
+        this.isProgress = true;
+        this.percentage = 0;
+        await importBatch(
+          {
+            module: this.module,
+            multiPartFiles: this.attaments
+          },
+          this.apiUrl,
+          (data) => {
+            console.log(data, 'data');
+            this.percentage = parseFloat(
+              ((data.loaded * 100) / data.total).toFixed(2)
+            );
+            if (this.percentage >= 100) {
+              setTimeout(() => {
+                this.isProgress = false;
+              }, 500);
+            }
+          },
+          this.fileKeyName
+        )
+          .then((res) => {
+            this.$message.success('操作成功!');
+            this.dialogVisible = false;
+            this.isProgress = false;
+            this.$emit('success');
+          })
+          .catch(() => {
+            this.isProgress = false;
+          });
+      },
+      //下载模板
+      downLoadTemplate() {
+        if(this.isWeb){
+          download1(window.location.origin + this.fileUrl, this.fileName);
+        }else{
+          downLoadTemplate(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;
+  }
+  #progress {
+    background: rgba($color: #000000, $alpha: 0.5);
+    position: fixed;
+    width: 100%;
+    height: 100%;
+    top: 0;
+    left: 0;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+  }
+</style>

+ 3 - 2
src/views/productionPlan/components/factoryAdd/index.vue

@@ -411,6 +411,7 @@
       <!-- 选择产品 -->
       <EquipmentDialog
         @choose="confirmChoose"
+        :treeType="['9']"
         :selectList="[]"
         ref="equipmentRefs"
       >
@@ -546,14 +547,14 @@
           {
             slot: 'productName',
             prop: 'productName',
-            label: '产品名称',
+            label: '名称',
             align: 'center',
             minWidth: 140
           },
           {
             slot: 'productCode',
             prop: 'productCode',
-            label: '物料编码',
+            label: '编码',
             align: 'center',
             minWidth: 140
           },

+ 1 - 1
src/views/productionPlan/factoryPlan.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <homeIndex :timeDimensionPlanType="3" :cacheKeyUrl="cacheKeyUrl" :isLineNumbre="true"></homeIndex>
+    <homeIndex :timeDimensionPlanType="3" :cacheKeyUrl="cacheKeyUrl" :isLineNumbre="true" :isImport="true"></homeIndex>
   </div>
 </template>
 

+ 22 - 2
src/views/productionPlan/index.vue

@@ -111,6 +111,14 @@
         >
         <el-button type="danger" size="mini">延期申请</el-button>
         <el-button type="danger" size="mini">变更申请</el-button>
+        <el-button
+          type="info"
+          icon="el-icon-upload2"
+          size="mini"
+          @click="$refs.importDialogRef.open()"
+          v-if="isImport"
+          >导入</el-button
+        >
       </div>
 
       <el-tabs
@@ -322,6 +330,14 @@
       :factoryType="factoryType"
       @close="factoryClose"
     ></factoryAdd>
+    <importDialog
+      ref="importDialogRef"
+      @success="reload"
+      :fileUrl="'/aps/productionplan/importTemplate'"
+      :isWeb="false"
+      fileName="生产临时计划模板"
+      apiUrl="/aps/productionplan/importFile"
+    />
   </div>
 </template>
 
@@ -346,6 +362,8 @@
   import { fieldModel } from '@/api/saleOrder';
   import { debounce } from 'lodash';
   import tabMixins from '@/mixins/tableColumnsMixin';
+  import importDialog from '@/components/upload/import-dialog.vue';
+
   import {
     findBomCategoryByCategoryId,
     listBomType
@@ -360,13 +378,16 @@
       disassemblePlanPop,
       factoryAdd,
       homogeneityInspectDialog,
-      homogeneityInspectInstallDialog
+      homogeneityInspectInstallDialog,importDialog
     },
     props: {
       timeDimensionPlanType: { type: Number, default: 1 },
       isLineNumbre: {
         default: false
       },
+      isImport: {
+        default: false
+      },
       cacheKeyUrl: { type: String, default: '513b2388-aps-productionPlan' }
     },
     data() {
@@ -1113,7 +1134,6 @@
         this.$confirm('确定删除当前数据?', '提示')
           .then(() => {
             if (this.isLineNumbre) {
-
               factoryDelete(row.id).then((res) => {
                 this.reload();
                 this.$message.success('删除成功');

+ 7 - 2
src/views/saleOrder/components/EquipmentDialog.vue

@@ -49,7 +49,7 @@
         <el-col :span="6" class="tree_col">
           <AssetTree
             @handleNodeClick="handleNodeClick"
-            :treeIds="['9', '1']"
+            :treeIds="treeType"
             ref="treeList"
           />
         </el-col>
@@ -89,6 +89,10 @@
       isMultiple: {
         type: String,
         default: '1'
+      },
+      treeType: {
+        type: Array,
+        default: () => ['9', '1']
       }
     },
 
@@ -173,7 +177,8 @@
         this.tableList = data.list;
         return data;
       },
-      open() {
+      open(type) {
+        console.log('type', type);
         this.equipmentdialog = true;
         this.setSelect();
       },

+ 1 - 1
src/views/saleOrder/components/order-search.vue

@@ -400,7 +400,7 @@
             >
               <el-button type="warning" size="mini">批量导入</el-button>
             </el-upload>
-            <el-button type="info" size="mini" @click="importTemplate('销售订单模板.xlsx')" v-if="$hasPermission('aps:salesorder:download')"> 下载模板 </el-button>
+            <el-button type="info" size="mini" @click="importTemplate('/aps/salesorder/importTemplate','销售订单模板.xlsx')" v-if="$hasPermission('aps:salesorder:download')"> 下载模板 </el-button>
             <el-button
               type="danger"
               size="mini"

+ 28 - 14
src/views/saleOrder/index.vue

@@ -29,6 +29,7 @@
         row-key="id"
         @sort-change="onSortChange"
         @columns-change="handleColumnChange"
+        :cacheKeyUrl="cacheKeyUrl"
       >
         <!--   :cache-key="cacheKeyUrl" -->
         <template v-slot:code="{ row }">
@@ -152,7 +153,7 @@
         selection: [],
 
         newColumns: [],
-        // cacheKeyUrl: 'c32a9c7d-aps-saleOrder',
+        cacheKeyUrl: 'c32a9c7d-aps-saleOrder',
         columnsVersion: 1,
         // 订单类型
         orderTypeList: [
@@ -231,19 +232,32 @@
             align: 'center',
             showOverflowTooltip: true
           },
-          // {
-          //   prop: 'bomCategoryName',
-          //   label: 'BOM版本',
-          //   align: 'center',
-          //   width: 130,
-          //   showOverflowTooltip: true,
-          //   formatter: (row) => {
-          //     if (row.bomCategoryName) {
-          //       return `${row.bomCategoryName} (V${row.bomCategoryVersions}.0)`;
-          //     }
-          //     return '';
-          //   }
-          // },
+          {
+            prop: 'bomType',
+            label: 'BOM类型',
+            align: 'center',
+            width: 130,
+            showOverflowTooltip: true,
+            formatter: (row) => {
+              if (row.bomType) {
+                return row.bomType == 1 ? 'PBOM' : row.bomType == 2 ? 'MBOM' :  row.bomType == 3 ? 'ABOM' : 'EBOM';
+              }
+              return '';
+            }
+          },
+          {
+            prop: 'versions',
+            label: 'BOM版本',
+            align: 'center',
+            width: 130,
+            showOverflowTooltip: true,
+            formatter: (row) => {
+              if (row.versions) {
+                return `V${row.versions}.0`;
+              }
+              return '';
+            }
+          },
           {
             prop: 'productName',
             label: '名称',

+ 1 - 1
src/views/workOrder/index.vue

@@ -118,7 +118,7 @@
             派单
           </el-link>
           <el-link
-            v-if="unpackShow(row)"
+            v-if="unpackShow(row)&&row.splitResidue!==0"
             :underline="false"
             type="primary"
             @click="toUnpack(row)"