From a136cd7a0543065b949a65be816c2821bb058c10 Mon Sep 17 00:00:00 2001
From: 李喆(开发组) <lzhe@yxqiche.com>
Date: 星期一, 04 八月 2025 17:40:30 +0800
Subject: [PATCH] 1

---
 src/views/basesetting/machine.vue |  117 +++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 75 insertions(+), 42 deletions(-)

diff --git a/src/views/basesetting/machine.vue b/src/views/basesetting/machine.vue
index 792224d..3c1e0f6 100644
--- a/src/views/basesetting/machine.vue
+++ b/src/views/basesetting/machine.vue
@@ -17,8 +17,8 @@
     >
       <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="handleView">瀵煎叆</el-button>
-        <!-- <el-button type="primary" size="default" icon="el-icon-circle-plus" plain @click="handleAdd">鏂板</el-button> -->
+        <!-- <el-button type="primary" size="default" icon="el-icon-circle-plus" plain @click="handleView">瀵煎叆</el-button> -->
+        <el-button type="primary" size="default" icon="el-icon-circle-plus" plain @click="handleAdd">鏂板</el-button>
       </template>
       <template #menu="scope">
         <el-button type="primary" text size="default" icon="el-icon-upload" @click.stop="handleEdit(scope.row, scope.index)">缂栬緫</el-button>
@@ -34,7 +34,7 @@
     <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">
         <template #ownerDept="{}">
-          <el-tree-select v-model="editForm.ownerDept" :data="organizationTreeList"/>
+          <el-tree-select v-model="editForm.ownerDept" :data="organizationTreeList" :props="treePropsConfig"/>
         </template>
       </avue-form>
     </el-dialog>
@@ -51,6 +51,11 @@
   data() {
     var that = this;
     return {
+      treePropsConfig: {
+        value:  'id',
+        label: 'title',
+        children: 'children'
+      },
       organizationTreeList: [],
       machineTitle: "鏂板",
       isAdd: true,
@@ -80,7 +85,8 @@
             type: 'input',
             prop: 'keyword',
             search: true,
-            hide: true
+            hide: true,
+            showColumn: false
           },
           {
             label: '鏈哄簥缂栧彿',
@@ -133,6 +139,13 @@
             type: 'input',
             span: 12,
             dataType: 'string',
+            rules: [
+              {
+                required: true,
+                message: '璇疯緭鍏ユ満搴婄紪鍙�',
+                trigger: 'blur'
+              }
+            ]
           },
           {
             label: '鏈哄簥鍨嬪彿',
@@ -140,6 +153,13 @@
             type: 'input',
             span: 12,
             dataType: 'string',
+            rules: [
+              {
+                required: true,
+                message: '璇疯緭鍏ユ満搴婂瀷鍙�',
+                trigger: 'blur'
+              }
+            ]
           },
           {
             label: '鏈哄簥绫诲瀷',
@@ -150,7 +170,14 @@
             props: {
               label: 'dictValue',
               value: 'dictKey',
-            }
+            },
+            rules: [
+              {
+                required: true,
+                message: '璇烽�夋嫨鏈哄簥绫诲瀷',
+                trigger: 'change'
+              }
+            ]
           },
           {
             label: '鎵�灞炴満搴婄粍',
@@ -161,7 +188,14 @@
             props: {
               label: 'dictValue',
               value: 'dictKey',
-            }
+            },
+            rules: [
+              {
+                required: true,
+                message: '璇烽�夋嫨鎵�灞炴満搴婄粍',
+                trigger: 'change'
+              }
+            ]
           },
           {
             label: '鎿嶄綔鍛�',
@@ -173,18 +207,19 @@
           {
             label: '鎵�灞炵粍缁�',
             prop: 'ownerDept',
-            span: 12
+            type: 'tree',
+            span: 12,
+            rules: [
+              {
+                required: true,
+                message: '璇烽�夋嫨鎵�灞炵粍缁�',
+                trigger: 'click'
+              }
+            ]
           },
           {
             label: '鐢熶骇鍟�',
             prop: 'manufacturer',
-            type: 'input',
-            span: 12,
-            dataType: 'string',
-          },
-          {
-            label: '杞鏃堕棿锛堝皬鏃讹級',
-            prop: 'pollingHours',
             type: 'input',
             span: 12,
             dataType: 'string',
@@ -237,6 +272,17 @@
     };
   },
   methods: {
+    initData(tenantId) {
+      axios({
+        url: 'blade-system/dept/tree',
+        method: 'get'
+      }).then(
+        res => {
+          //const column = this.findObject(this.option.column, 'parentId');
+          //column.dicData = res.data.data;
+        }
+      );
+    },
     handleAdd() {
       this.machineTitle = "鏂板";
       this.isAdd = true;
@@ -331,22 +377,17 @@
         var url = '/blade-mdm/machine/update';
       }
       this.loading = true;
-      axios({
-        url: url,
-        method: 'post',
-        data: obj,
-      }).then(
-        res => {
-          this.loading = false;
-          this.$message({
-            type: 'success',
-            message: '鎿嶄綔鎴愬姛!',
-          });
+      axios({url: url,method: 'post',data: obj}).then(res => {
+        this.loading = false;
+        if(res,res.data.success) {
           this.editBox = false;
+          this.$message({type: 'success',message: '鎿嶄綔鎴愬姛!'});
           this.onLoad();
-          done();
+        }else {
+          this.$message({type: 'error',message: res.data.msg});
         }
-      );
+        done();
+      });
     },
     handleView() {
 
@@ -372,14 +413,14 @@
       this.loading = true;
       var obj = {
         keyword: this.search.keyword,
-        machineGroupCode: this.search.machineGroupCode,
+        machineGroupCode: this.search.machineGroupName,
         current: this.mypage.current,
         size: this.mypage.size,
       }
       axios({
         url: '/blade-mdm/machine/page',
         method: 'get',
-        date: obj,
+        params: obj,
       }).then(
         res => {
           const data = res.data.data;
@@ -408,19 +449,11 @@
       });
     }
   },
-  mounted() {
-    //鍒ゆ柇鐗堟湰  0:娑夊瘑缃戯紝1:宸ユ帶缃戯紱//宸ユ帶缃�5涓紝娑夊瘑缃�4涓�  
-    axios({url: '/blade-mdm/system/param/getValue?paramKey=networkType',method: 'get'}).then(res => {
-        if(res.data.data === "0") {
-          var aurl = "/blade-system/dept/lazy-list";
-        }else {
-          var aurl = "/blade-mdm/system/dept/lazy-list";
-        }
-        axios({url: aurl,method: 'get'}).then(resp => {
-          this.organizationTreeList = this.traversalLabelValueToTree(resp.data.data);
-        })
-      }
-    );
+  mounted() { 
+    //鎵�灞炵粍缁� /api/blade-system/dept/tree
+    axios({url: '/blade-system/dept/tree',method: 'get'}).then(resp => {
+      this.organizationTreeList = this.traversalLabelValueToTree(resp.data.data);
+    })
   }
 };
 </script>

--
Gitblit v1.9.3