ysy 1 an în urmă
părinte
comite
5ed668cb08

+ 29 - 0
src/api/material/file.js

@@ -0,0 +1,29 @@
+import request from '@/utils/request';
+
+/**
+ * 查询文件夹分类数据
+ * @data data
+ */
+export async function getDocTreeListAPI(data) {
+  const res = await request.post('/fm/directory/selectTreeList', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+
+/**
+* 查询文件数据
+* @data data
+*/
+export async function filePageAPI(data) {
+  if (!data.lcyStatus) {
+    return true
+  }
+  const res = await request.post('/fm/file/page', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

BIN
src/assets/wjj.png


+ 39 - 139
src/views/material/BOMmanage/components/workingProcedure.vue

@@ -850,85 +850,6 @@
                 >删除</el-link
               >
             </template>
-            <template v-slot:type="{ row }">
-              <div v-if="isView">{{ row.type }}</div>
-              <el-input
-                v-else
-                v-model="row.type"
-                placeholder="请输入"
-              ></el-input>
-            </template>
-
-            <template v-slot:code="{ row }">
-              <div v-if="isView">{{ row.code }}</div>
-              <el-input
-                v-else
-                v-model="row.code"
-                placeholder="请输入"
-              ></el-input>
-            </template>
-
-            <template v-slot:versions="{ row }">
-              <div v-if="isView">{{ row.versions }}</div>
-              <el-input
-                v-else
-                v-model="row.versions"
-                placeholder="请输入"
-              ></el-input>
-            </template>
-
-            <template v-slot:status="{ row }">
-              <div v-if="isView">{{
-                statusOption.filter((item) => item.value == row.status)[0].label
-              }}</div>
-              <div v-else>
-                <template>
-                  <el-select v-model="row.status" placeholder="请选择">
-                    <el-option
-                      v-for="item in statusOption"
-                      :label="item.label"
-                      :value="item.value"
-                      :key="item.value"
-                    >
-                    </el-option>
-                  </el-select>
-                </template>
-              </div>
-            </template>
-
-            <template v-slot:path="{ row }">
-              <div v-if="isView">附件</div>
-              <div v-else
-                ><div class="downLoad">
-                  <fileUpload
-                    v-model="jobFiledList"
-                    :show-file-list="false"
-                    module="main"
-                    @input="uploadedJobSuccess($event, row)"
-                    :showLib="false"
-                    :limit="1"
-                  />
-                  <div v-if="row.path">
-                    <el-button
-                      style="margin-left: 10px"
-                      size="mini"
-                      type="primary"
-                      @click="downloadFile(row.path)"
-                      >下载</el-button
-                    >
-                  </div></div
-                >
-              </div>
-            </template>
-
-            <template v-slot:remark="{ row }">
-              <div v-if="isView">{{ row.remark }}</div>
-              <el-input
-                v-else
-                v-model="row.remark"
-                placeholder="请输入"
-              ></el-input>
-            </template>
           </ele-pro-table>
         </el-tab-pane>
 
@@ -967,6 +888,8 @@
       @selection="chooseStandardList"
     ></standardOutput>
 
+    <fileIndex v-if="fileShow" @close="fileClose"></fileIndex>
+
     <div class="btns">
       <el-button
         type="primary"
@@ -999,6 +922,7 @@
   import jobDialog from './jobDialog.vue';
   import standardOutput from './standardOutput.vue';
   import term from '../qualityTesting/term';
+  import fileIndex from '../file/index.vue';
   export default {
     components: {
       userSearch,
@@ -1008,7 +932,8 @@
       jobDialog,
       ProductModalMultiple,
       standardOutput,
-      term
+      term,
+      fileIndex
     },
     mixins: [dictMixins],
     data() {
@@ -1236,66 +1161,42 @@
         // 表格选中数据
         jobColumns1: [
           {
-            label: '序号',
-            type: 'index',
-            width: 55,
-            align: 'center'
-          },
-          {
-            slot: 'type',
-            prop: 'type',
-            label: '类型',
-            showOverflowTooltip: true,
-            align: 'center',
-            minWidth: 110
-          },
-          {
-            slot: 'code',
-            prop: 'code',
             label: '编码',
-            showOverflowTooltip: true,
+            prop: 'code',
+            width: 180,
             align: 'center',
-            minWidth: 110
+            showOverflowTooltip: true
           },
+
           {
-            slot: 'name',
             prop: 'name',
-            label: '名称',
-            showOverflowTooltip: true,
+            label: '文档名称',
             align: 'center',
-            minWidth: 110
-          },
-          {
-            slot: 'path',
-            prop: 'path',
-            label: '附件',
+            slot: 'name',
             showOverflowTooltip: true,
-            align: 'center',
             minWidth: 200
           },
+
           {
-            slot: 'versions',
-            prop: 'versions',
-            label: '版本',
-            showOverflowTooltip: true,
+            prop: 'storagePath',
+            label: '文件名称',
             align: 'center',
-            minWidth: 110
-          },
-          {
-            slot: 'status',
-            prop: 'status',
-            label: '状态',
+
             showOverflowTooltip: true,
-            align: 'center',
-            minWidth: 110
+            minWidth: 200,
+            formatter: (_row, _column, cellValue) => {
+              return cellValue[0]?.name;
+            }
           },
+
           {
-            prop: 'createName',
-            label: '创建人',
-            showOverflowTooltip: true,
+            prop: 'version',
+            label: '版本',
             align: 'center',
-            minWidth: 110
+            showOverflowTooltip: true,
+            minWidth: 100
           },
+
           {
             prop: 'createTime',
             label: '创建时间',
@@ -1365,7 +1266,9 @@
         beatParam: {},
         normalHours: {},
         qualityParam: [],
-        qualityPointParam: []
+        qualityPointParam: [],
+
+        fileShow: false
       };
     },
     created() {
@@ -1374,20 +1277,17 @@
     },
     methods: {
       addFile() {
-        let userInfo = JSON.parse(localStorage.getItem('info'));
-        this.tableData.taskParam[this.currentIndex]['fileParam'].push({
-          code: '',
-          type: '',
-          name: '',
-          versions: '',
-          name: '',
-          status: 1,
-          createName: userInfo.name,
-          createTime: dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss')
-        });
-        this.$refs.fileTable.setData(
-          this.tableData.taskParam[this.currentIndex]['fileParam']
-        );
+        this.fileShow = true;
+      },
+      fileClose(val) {
+        if (val == false) {
+          this.fileShow = false;
+        } else {
+          this.fileShow = false;
+     
+          console.log(val, 22)
+         
+        }
       },
       addJob() {
         this.$refs.jobRef.open();

+ 1 - 0
src/views/material/BOMmanage/detailsPop.vue

@@ -459,6 +459,7 @@
       bomChange(e) {
         this.searchObj.versions = '';
         this.currentNodeData.bomType = e;
+
         this.getTreeData();
         this.getVersion();
       },

+ 315 - 0
src/views/material/BOMmanage/file/index.vue

@@ -0,0 +1,315 @@
+<template>
+  <el-dialog
+    title="工艺文件"
+    :visible.sync="visible"
+    v-if="visible"
+    :before-close="handleClose"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    width="80%"
+  >
+    <div>
+      <el-card shadow="never" v-loading="loading">
+        <ele-split-layout
+          width="240px"
+          allow-collapse
+          :right-style="{ overflow: 'hidden' }"
+        >
+          <div>
+            <div class="ele-border-lighter sys-organization-list">
+              <el-tree
+                ref="treeRef"
+                :data="fileTreeList"
+                highlight-current
+                :draggable="true"
+                node-key="id"
+                :props="{ label: 'name', children: 'sonDirectoryList' }"
+                :expand-on-click-node="false"
+                :default-expand-all="true"
+                @node-click="onNodeClick"
+                :allow-drop="allowDrop"
+              >
+                <span class="custom-tree-node" slot-scope="{ node, data }">
+                  <div class="tree_lab">
+                    <img src="@/assets/wjj.png" />
+                    <span>{{ node.label }}</span></div
+                  >
+                </span>
+              </el-tree>
+            </div>
+          </div>
+          <template v-slot:content>
+            <!-- 数据表格 -->
+            <ele-pro-table
+              ref="table"
+              :columns="columns"
+              :datasource="datasource"
+              :initLoad="false"
+              height="calc(60vh)"
+              tool-class="ele-toolbar-form"
+              :needPage="false"
+              row-key="id"
+              :selection.sync="selection"
+              highlight-current-row
+            >
+            </ele-pro-table>
+          </template>
+        </ele-split-layout>
+      </el-card>
+    </div>
+
+    <div slot="footer">
+      <el-button type="primary" @click="handleSave"> 选择 </el-button>
+      <el-button @click="handleClose"> 取消 </el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+  import { getDocTreeListAPI, filePageAPI } from '@/api/material/file';
+  import { mapGetters } from 'vuex';
+
+  export default {
+    components: {},
+    mixins: [],
+
+    data() {
+      return {
+        // 加载状态
+        loading: false,
+        // 表格选中数据
+        selection: [],
+
+        visible: true,
+        fileTreeList: [],
+        fileType: 0, //0:公共文档 1:个人文档 2:文档模板
+        parentData: {},
+
+        // 表格列配置
+        columns: [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center'
+          },
+          {
+            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[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
+          },
+          {
+            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
+          }
+        ]
+      };
+    },
+    computed: {
+      ...mapGetters(['user'])
+    },
+    mounted() {
+      this.query();
+    },
+    methods: {
+      query() {
+        this.loading = true;
+        let query = {
+          type: this.fileType,
+          currentUserId: this.user.info.userId
+        };
+        getDocTreeListAPI(query).then((res) => {
+          this.fileTreeList = res;
+          if (res.length > 0) {
+            this.$nextTick(() => {
+              this.parentData = res[0];
+              this.$refs.treeRef.setCurrentKey(res[0].id);
+              this.reload();
+            });
+          }
+        });
+        this.loading = false;
+      },
+
+      datasource({ page, limit, where }) {
+        return filePageAPI({
+          ...where,
+          pageNum: page,
+          size: limit,
+          directoryId: this.parentData?.id,
+          lcyStatus: 1,
+          fileType: 0
+        });
+      },
+      /* 刷新表格 */
+      reload() {
+        this.$refs.table.reload({
+          pageNum: 1
+        });
+      },
+
+      allowDrop(draggingNode, dropNode, type) {
+        //拖拽限制
+        return dropNode.parent.id == draggingNode.parent.id && type != 'inner';
+      },
+
+      /* 选择数据 */
+      onNodeClick(row) {
+        if (row) {
+          this.parentData = row;
+          this.$nextTick(() => {
+            this.reload();
+          });
+        }
+      },
+
+      handleClose() {
+        this.$emit('close', false);
+      },
+      handleSave() {
+        if(this.selection.length == 0) return this.$message.warning('请选择一条数据')
+        this.$emit('close', this.selection);
+      },
+
+      /* 表格操作按钮事件 */
+      handleOperation(type, data) {
+        switch (type) {
+          case 'checkOut':
+            this.checkOut(data);
+            break;
+          case 'checkIn':
+            this.checkIn(data);
+            break;
+          default:
+            break;
+        }
+      },
+
+      // 检出文档
+      checkOut(row) {
+        let query = {
+          id: row.id,
+          userId: this.user.info.userId
+        };
+        checkOutAPI(query).then((res) => {
+          this.$message({
+            type: 'success',
+            message: res.msg,
+            duration: 1000
+          });
+          this.reload();
+        });
+      },
+
+      // 归还文档
+      checkIn(row) {
+        let query = {
+          id: row.id,
+          userId: this.user.info
+        }
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .sys-organization-list {
+    height: calc(100vh - 264px);
+    box-sizing: border-box;
+    border-width: 1px;
+    border-style: solid;
+    overflow: auto;
+  }
+  .tree_lab {
+    display: flex;
+    align-items: center;
+    img {
+      width: 20px;
+      height: 20px;
+    }
+  }
+</style>