gaoshp
2025-08-28 7e394d280c921445ab71a4a368146504595531c7
src/views/tasks/machinereturnfiles.vue
@@ -1,4 +1,9 @@
<template>
  <div class="gongkongMain">
  <div>
      <el-tree :data="treeData" :props="defaultProps" node-key="id" :default-expand-all="false" :default-expanded-keys="defaultKeys" @node-click="handleNodeClick" />
    </div>
    <div>
  <basic-container>
    <avue-crud
      :addBtn="false"
@@ -18,7 +23,7 @@
    >
      <template #menu-left>
        <!-- el-button type="primary" size="default" icon="el-icon-circle-plus" plain @click="handleExport">导出</el-button> -->
        <el-button type="primary" size="default" icon="el-icon-circle-plus" plain @click="receiveBtn">批量接收</el-button>
        <el-button type="primary" :disabled="this.selection.length==0" size="default" icon="el-icon-circle-plus" plain @click="receiveBtn">批量接收</el-button>
      </template>
      <template #menu="scope">
        <el-button type="primary" text size="default" icon="el-icon-document-delete" @click.stop="rejectBtn(scope.row, scope.index)">拒绝</el-button>
@@ -26,6 +31,8 @@
      </template>
    </avue-crud>
  </basic-container>
  </div>
  </div>
</template>
<script>
@@ -44,6 +51,13 @@
        machineGroupCode: ""
      },
      loading: true,
      treeData: [],
      defaultProps: {
        children: 'children',
        label: 'name',
        isLeaf: (data) => !data.hasChildren
      },
      currentNode:{},//当前节点数据
      mypage: {
        size: 10,
        current: 1,
@@ -220,6 +234,10 @@
        machineSpec: this.search.machineSpec,
        current: this.mypage.current,
        size: this.mypage.size,
        nodeType: this.currentNode.nodeType,
        nodeId: this.currentNode.nodeType!='dir'?this.currentNode.id:undefined,
        dirType:this.currentNode.dirType,
        machineCode: this.currentNode.machineCode,
      }
      axios({
        url: '/blade-mdm/machineback/file/page',
@@ -237,11 +255,59 @@
        }
      );
    }
    },
    handleNodeClick(treeNode,b,c,d) {
      console.log(treeNode)
      this.currentNode = treeNode;
      this.onLoad();
      //this.fileName = "";
      //this.searchTable(TreeNode);
    },
    treeLoad () {
      axios({
        url: '/blade-mdm/gkw/node/load-tree',
        method: 'get',
      }).then(
        res => {
          this.treeData = res.data.data;
          var firstIndex = 0;
          res.data.data.forEach((item,index)=> {
            if(item.children.length != 0) {
              firstIndex = index;
            }
          })
          //defaultKeys.push(item.id);
          this.defaultKeys = [res.data.data[firstIndex].id];
        }
      )
    },
  },
  mounted() {
    this.treeLoad();
  }
};
</script>
<style lang="scss">
.gongkongMain {
  display: flex;
  padding: 0px;
  margin: 0px 7px 10px 7px;
  background-color: #fff;
  border-top: 1px solid #ccc;
  > div {
    padding: 12px;
  }
}
.gongkongMain > div:nth-child(1) {
  width:25%;
  border-right: 1px solid #ccc;
}
.gongkongMain div:nth-child(2) {
  flex: 1;
}
.paginationTree {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}
</style>