From e1fee3c5c1eb50f49d20dad4dc656dfdcb81d4b4 Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期一, 29 九月 2025 17:18:33 +0800
Subject: [PATCH] 工控网界面优化

---
 src/views/tasks/machinereturnfiles.vue |  191 ++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 161 insertions(+), 30 deletions(-)

diff --git a/src/views/tasks/machinereturnfiles.vue b/src/views/tasks/machinereturnfiles.vue
index 73431d1..d3e00bc 100644
--- a/src/views/tasks/machinereturnfiles.vue
+++ b/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,20 +23,27 @@
     >
       <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" v-if="this.search.dirType!='REC'" size="default" icon="el-icon-circle-plus" plain @click="receiveAll">鍏ㄩ儴鎺ユ敹</el-button>
+        <el-button type="primary" v-if="this.search.dirType!='REC'" :disabled="this.selection.length==0" size="default" icon="el-icon-circle-plus" plain @click="receiveBtn">鎺ユ敹宸查��</el-button>
+        <el-button type="primary" v-if="this.search.dirType!='REC'" :disabled="this.selection.length==0" size="default" icon="el-icon-circle-plus" plain @click="rejectBtn">鎷掔粷</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>
-        <el-button type="primary" text size="default" icon="el-icon-document-add" @click.stop="acceptBtn(scope.row, scope.index)">鎺ユ敹</el-button>
+        <el-button type="primary" v-if="scope.row.dirType==='TEMP'" text size="default" icon="el-icon-document-delete" @click.stop="rejectBtn(scope.row, scope.index)">鎷掔粷</el-button>
+        <el-button type="primary" v-if="scope.row.dirType==='TEMP'" text size="default" icon="el-icon-document-add" @click.stop="acceptBtn(scope.row, scope.index)">鎺ユ敹</el-button>
       </template>
+      -->
     </avue-crud>
   </basic-container>
+  </div>
+  </div>
 </template>
 
 <script>
-  import { ElMessage } from 'element-plus';
+import { ElMessage } from 'element-plus';
 import { exportBlob } from '@/api/common';
-import { downloadXls } from '@/utils/util';
+import { downloadXls ,getQueryString} from '@/utils/util';
+
 import { getToken } from '@/utils/auth';
 import NProgress from 'nprogress';
 import 'nprogress/nprogress.css';
@@ -41,17 +53,27 @@
       selection: [],
       search: {
         keyword: "",
-        machineGroupCode: ""
+        machineGroupCode: "",
+        dirType:"",
       },
       loading: true,
+      treeData: [],
+      defaultProps: {
+        children: 'children',
+        label: 'name',
+        isLeaf: (data) => !data.hasChildren
+      },
+      currentNode:{},//褰撳墠鑺傜偣鏁版嵁
       mypage: {
         size: 10,
         current: 1,
         total: 0,
       },
       option: {
+        //size:'small',
         index: true,
         selection: true,
+        selectionWidth:30,
         addBtn: false,
         editBtn: false,
         delBtn: false,
@@ -59,38 +81,56 @@
         emptyBtn: false,
         searchLabelWidth: "120",
         searchSpan: 8,
+        menu:false,
+        width:'100%',
         column: [
-          {
-            label: '浠诲姟缂栫爜',
-            prop: 'programName',
-            hide: true
-          },
-          {
-            label: '鏂囦欢缂栧彿',
-            prop: ''
+		    {
+            label: '鏂囦欢鍚嶇О',
+            prop: 'name',
+            showOverflowTooltip:true,
           },
           {
             label: '鏈哄簥鍙�',
             prop: 'machineCode',
+            showOverflowTooltip:true,
           },
           {
-            label: '鏂囦欢鍚嶇О',
-            prop: 'name',
+            label: '绋嬪簭鐘舵��',
+            prop: 'programStatus',
+            showOverflowTooltip:true,
+            render: ({ row,value }) => {
+              var txt = '鏈煡';
+              switch(row.programStatus){
+                case 1:
+                  txt = '璇曞垏';
+                  break;
+                case 2:
+                  txt = '鍥哄寲';
+                  break;
+                case 3:
+                  txt = '涓存椂鏇存敼鍗�';
+                  break;
+                default:
+                  txt = '鏈煡';
+              }
+              return txt;
+            }
           },
           {
-            label: '鏂囦欢鍥哄寲鐘舵��',
-            prop: 'isCured',
+            label: '鏂囦欢澶у皬',
+            prop: 'fileSizeDisplay',
           },
           {
             label: '鏂囦欢鍒拌揪鏃堕棿',
-            prop: 'arrivedTime',
-          },
+            showOverflowTooltip:true,
+            prop: 'fileCreateTime',
+          },/*
           {
             label: '鏂囦欢鏁版嵁搴撶紪鍙�',
             prop: '',
-          },
+          },*/
           {
-            label: '鍏抽敭淇℃伅',
+            label: '鍏抽敭瀛�',
             prop: 'keyword',
             search: true,
             hide: true,
@@ -117,6 +157,29 @@
     selectionChange(selection) {
       this.selection = selection;
     },
+
+    receiveAll() {
+      //鎺ユ敹绗﹀悎鏉′欢鐨勬墍鏈夋暟鎹�
+      this.$confirm('纭畾瑕佹帴鏀剁鍚堟潯浠剁殑鎵�鏈夋枃浠跺悧?', {  //鍚屾帴鏀舵帴鍙g浉鍚�
+        confirmButtonText: '鏄�',
+        cancelButtonText: '鍚�',
+        type: 'warning',
+      }).then(() => {
+        //璋冪敤鎺ュ彛
+        this.loading = true;
+        axios({
+          url: '/blade-mdm/machinefile/file/temp-accept-all',
+          method: 'post',
+          params: {}
+        }).then(
+          res => {
+            this.loading = false;
+            this.onLoad();
+          }
+        );
+      })
+    },
+
     receiveBtn() {
       if(this.selection.length == 0) {
         ElMessage({message: '璇烽�夋嫨鏁版嵁',type: 'error'})
@@ -133,7 +196,7 @@
         //璋冪敤鎺ュ彛
         this.loading = true;
         axios({
-          url: '/blade-mdm/machineback/file/accept',
+          url: '/blade-mdm/machinefile/collect/temp-accept',
           method: 'post',
           params: {ids: ids.join(',')},
         }).then(
@@ -153,7 +216,7 @@
         //璋冪敤鎺ュ彛
         this.loading = true;
         axios({
-          url: '/blade-mdm/machineback/file/accept',
+          url: '/blade-mdm/machinefile/collect/temp-accept',
           method: 'post',
           params: {ids: row.id},
         }).then(
@@ -173,7 +236,7 @@
         //璋冪敤鎺ュ彛
         this.loading = true;
         axios({
-          url: '/blade-mdm/machineback/file/reject',
+          url: '/blade-mdm/machinefile/collect/temp-reject',
           method: 'post',
           params: {ids: row.id},
         }).then(
@@ -192,7 +255,7 @@
       }).then(() => {
         NProgress.start();
         exportBlob(
-          `/blade-mdm/machineback/file/export-excel?${this.website.tokenHeader}=${getToken()}`
+          `/blade-mdm/machinefile/file/export-excel?${this.website.tokenHeader}=${getToken()}`
         ).then(res => {
           downloadXls(res.data, `鏈哄簥鍥炰紶鏂囦欢鏁版嵁${this.$dayjs().format('YYYY-MM-DD HH:mm:ss')}.xlsx`);
           NProgress.done();
@@ -209,9 +272,11 @@
     },
     currentChange(current) {
       this.mypage.current = current;
+      this.onLoad();
     },
     sizeChange(size) {
       this.mypage.size = size;
+      this.onLoad();
     },
     refreshChange() {
       
@@ -223,13 +288,20 @@
         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,
       }
+      console.log('myupage',this.mypage)
       axios({
-        url: '/blade-mdm/machineback/file/page',
+        url: '/blade-mdm/machinefile/collect/file-page-for-acceept',
         method: 'get',
         params: obj,
       }).then(
         res => {
+          var screenHeight = window.innerHeight;
+          this.option.maxHeight = (screenHeight - 390) + 'px';
           const data = res.data.data;
           this.mypage.total = data.total;
           this.data = data.records;
@@ -240,11 +312,70 @@
         }
       );
 
-    }
+    },
+    handleNodeClick(treeNode,b,c,d) {
+      console.log(treeNode)
+      this.currentNode = treeNode;
+      this.search.dirType = treeNode.dirType;
+      this.onLoad();
+    },
+    treeLoad () {
+      axios({
+        url: '/blade-mdm/gkw/node/load-tree?includeSend=0',
+        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();
+    this.search.dirType = getQueryString("dirType");
+  }
 };
 </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:17%;
+  border-right: 1px solid #ccc;
+}
+.gongkongMain div:nth-child(2) {
+  flex: 1;
+}
+.paginationTree {
+  margin-top: 12px;
+  display: flex;
+  justify-content: flex-end;
+}
+/*
+.Avue-crud{
+  :deep(.el-table) {
+    .el-table__body-wrapper,
+    .el-table__fixed-body-wrapper {
+      max-height:calc(100vh - 630px)!important;
+      overflow-y: auto;
+    }
+  }
+}
+*/
 </style>
\ No newline at end of file

--
Gitblit v1.9.3