From 2fb857721d32d3fce01f3487a623f5a9be2a3ac9 Mon Sep 17 00:00:00 2001
From: 李喆(开发组) <lzhe@yxqiche.com>
Date: 星期四, 17 七月 2025 18:29:41 +0800
Subject: [PATCH] 1

---
 src/views/basesetting/machine.vue |   78 +++++++++++++++++++++++++++++++-------
 1 files changed, 63 insertions(+), 15 deletions(-)

diff --git a/src/views/basesetting/machine.vue b/src/views/basesetting/machine.vue
index 21e1c63..0f5d542 100644
--- a/src/views/basesetting/machine.vue
+++ b/src/views/basesetting/machine.vue
@@ -23,7 +23,7 @@
       <template #menu="scope">
         <el-button type="primary" text size="default" icon="el-icon-upload" @click.stop="handleEdit(scope.row, scope.index)">缂栬緫</el-button>
         <el-button type="primary" text size="default" icon="el-icon-upload" @click.stop="handleDel(scope.row, scope.index)">鍒犻櫎</el-button>
-        <el-button type="primary" text size="default" icon="el-icon-upload" @click.stop="handleView(scope.row, scope.index)">浜х敓鏈哄簥鍥炰紶鏈烘瀯鏍�</el-button>
+        <el-button type="primary" text size="default" icon="el-icon-upload" @click.stop="handleUp(scope.row, scope.index)">浜х敓鏈哄簥鍥炰紶鏈烘瀯鏍�</el-button>
       </template>
 
       <template #status="{ row }">
@@ -32,7 +32,11 @@
     </avue-crud>
 
     <el-dialog :title="machineTitle" append-to-body v-model="editBox" width="60%">
-      <avue-form ref="editFormModal1" :option="editFormModal" v-model="editForm" @submit="formSubmit" @resetForm="resetForm"/>
+      <avue-form ref="editFormModal1" :option="editFormModal" v-model="editForm" @submit="formSubmit" @resetForm="resetForm">
+        <template #ownerDept="{}">
+          <el-tree-select v-model="editForm.ownerDept" :data="organizationTreeList"/>
+        </template>
+      </avue-form>
     </el-dialog>
   </basic-container>
 </template>
@@ -47,6 +51,7 @@
   data() {
     var that = this;
     return {
+      organizationTreeList: [],
       machineTitle: "鏂板",
       isAdd: true,
       editBox: false,
@@ -168,13 +173,7 @@
           {
             label: '鎵�灞炵粍缁�',
             prop: 'ownerDept',
-            type: 'tree',
-            span: 12,
-            props: {
-              label: 'deptName',
-              value: 'id'
-            },
-            dicUrl: `/blade-system/dept/lazy-list`
+            span: 12
           },
           {
             label: '鐢熶骇鍟�',
@@ -258,7 +257,7 @@
           this.editBox = true;
         },
         error => {
-            
+          this.loading = false;
         }
       );
     },
@@ -279,7 +278,28 @@
           done();
         },
         error => {
-            
+          this.loading = false;
+        }
+      );
+    },
+    handleUp(row,index) {
+      this.loading = true;
+      axios({
+        url: '/blade-mdm/machine/gen-fileback-dirs',
+        method: 'post',
+        params: {id: row.id},
+      }).then(
+        res => {
+          this.loading = false;
+          this.$message({
+            type: 'success',
+            message: '鎿嶄綔鎴愬姛!',
+          });
+          this.onLoad();
+          done();
+        },
+        error => {
+          this.loading = false;
         }
       );
     },
@@ -325,9 +345,6 @@
           this.editBox = false;
           this.onLoad();
           done();
-        },
-        error => {
-            
         }
       );
     },
@@ -374,9 +391,40 @@
             
         }
       );
-
+    },
+    traversalLabelValueToTree(tree) {  //閬嶅巻鏁扮粍
+      return tree.map(node => {
+        // 1. 娣诲姞 label 鍜� value 瀛楁
+        const newNode = {
+          ...node,
+          label: node.fullName,
+          value: node.id,
+        };
+        // 2. 濡傛灉鏈� children锛岄�掑綊澶勭悊
+        if (node.children && node.children.length > 0) {
+          newNode.children = this.traversalLabelValueToTree(node.children);
+        }
+        return newNode;
+      });
     }
   },
+  mounted() {
+    //鍒ゆ柇鐗堟湰  0:娑夊瘑缃戯紝1:宸ユ帶缃戯紱//宸ユ帶缃�5涓紝娑夊瘑缃�4涓�  
+    // 宸ユ帶缃戞槸/blade-mdm/system/dept/lazy-list
+    // 娑夊瘑缃戞槸/blade-mdm/dept/lazy-list
+    axios({url: '/blade-mdm/system/param/getValue?paramKey=networkType',method: 'get'}).then(res => {
+        // if(res.data.data === "0") {
+        //   var aurl = "/blade-mdm/dept/lazy-list";
+        // }else {
+        //   var aurl = "/blade-mdm/system/dept/lazy-list";
+        // }
+        var aurl = "/blade-mdm/dept/lazy-list";
+        axios({url: aurl,method: 'get'}).then(resp => {
+          this.organizationTreeList = this.traversalLabelValueToTree(resp.data.data);
+        })
+      }
+    );
+  }
 };
 </script>
 

--
Gitblit v1.9.3