From a751e547d67c4f8e2c6fddf958c1559f792515bd Mon Sep 17 00:00:00 2001
From: lyh <925863403@qq.com>
Date: 星期五, 27 六月 2025 16:11:50 +0800
Subject: [PATCH] 添加工作流

---
 src/views/mdc/common/BaseTree.vue |  201 ++++++++++++++++++++++++++-----------------------
 1 files changed, 106 insertions(+), 95 deletions(-)

diff --git a/src/views/mdc/common/BaseTree.vue b/src/views/mdc/common/BaseTree.vue
index 0aab780..11835c5 100644
--- a/src/views/mdc/common/BaseTree.vue
+++ b/src/views/mdc/common/BaseTree.vue
@@ -1,58 +1,64 @@
 <template>
-  <a-card class="tree_con" :loading="cardLoading" :bordered="false" >
+  <a-card class="tree_con" :loading="cardLoading" :bordered="false">
     <a-spin :spinning="loading">
-      <a-alert type="info" :showIcon="false" style="margin-right: 54px;padding-left: 5px">
-        <div slot="message">
-          <span v-if="this.currSelected.title">{{ getCurrSelectedTitle() }}</span>
-          <a v-if="this.currSelected.title" style="margin-left: 10px" @click="onClearSelected">鍙栨秷</a>
-          <span v-else>鏃�</span>
+      <div style="display: flex;flex-direction: column;height: 100%">
+        <div>
+          <a-alert type="info" :showIcon="false" style="margin-right: 54px;padding-left: 5px">
+            <div slot="message">
+              <span v-if="this.currSelected.title">{{ getCurrSelectedTitle() }}</span>
+              <a v-if="this.currSelected.title" style="margin-left: 10px" @click="onClearSelected">鍙栨秷</a>
+              <span v-else>鏃�</span>
+            </div>
+          </a-alert>
+          <div class="drawer-bottom-button">
+            <a-dropdown :trigger="['click']" placement="bottomCenter">
+              <a-menu slot="overlay">
+                <a-menu-item key="1" @click="expandAll">灞曞紑鎵�鏈�</a-menu-item>
+                <a-menu-item key="2" @click="closeAll">鍚堝苟鎵�鏈�</a-menu-item>
+                <a-menu-item key="3" @click="refreshTree">鍒锋柊</a-menu-item>
+              </a-menu>
+              <a-button>
+                <a-icon type="bars"/>
+              </a-button>
+            </a-dropdown>
+          </div>
         </div>
-      </a-alert>
-      <div class="drawer-bootom-button">
-        <a-dropdown :trigger="['click']" placement="bottomCenter">
-          <a-menu slot="overlay">
-            <a-menu-item key="1" @click="expandAll">灞曞紑鎵�鏈�</a-menu-item>
-            <a-menu-item key="2" @click="closeAll">鍚堝苟鎵�鏈�</a-menu-item>
-            <a-menu-item key="3" @click="refreshTree">鍒锋柊</a-menu-item>
-          </a-menu>
-          <a-button>
-            <a-icon type="bars"/>
-          </a-button>
-        </a-dropdown>
-      </div>
-      <a-input-search @search="handleSearch" style="width:100%;margin-top: 10px" placeholder="妫�绱� 绫诲埆缂栫爜/鍚嶇О" allowClear
-                      v-model="searchInput" @change="handleChange"/>
-      <!-- showLine -->
-      <a-tree showLine ref="tree" :checkStrictly="checkStrictly" :expandedKeys.sync="expandedKeys"
-              :selectedKeys="selectedKeys" :dropdownStyle="{maxHeight:'200px',overflow:'auto'}"
-              :treeData="treeDataSource"
-              :autoExpandParent="autoExpandParent" @select="onSelect" @expand="onExpand" slots="{}">
-        <template slot="title" slot-scope="{ title, parentId, entity, key}">
+        <a-input-search @search="handleSearch" style="width:100%;margin-top: 10px" placeholder="妫�绱� 绫诲埆缂栫爜/鍚嶇О" allowClear
+                        v-model="searchInput" @change="handleChange"/>
+        <!-- showLine -->
+        <div style="flex: 1;overflow:auto;margin-top: 10px">
+          <a-tree showLine ref="tree" :checkStrictly="checkStrictly" :expandedKeys.sync="expandedKeys"
+                  :selectedKeys="selectedKeys" :dropdownStyle="{maxHeight:'200px',overflow:'auto'}"
+                  :treeData="treeDataSource"
+                  :autoExpandParent="autoExpandParent" @select="onSelect" @expand="onExpand" slots="{}">
+            <template slot="title" slot-scope="{ title, parentId, entity, key}">
           <span v-if="title.indexOf(searchValue) > -1">
             {{ title.substr(0, title.indexOf(searchValue)) }}
             <span class="replaceSearch">{{ searchValue }}</span>
             {{ title.substr(title.indexOf(searchValue) + searchValue.length) }}
           </span>
-          <span v-else>{{ title }}</span>
-          <a-dropdown v-if="!editDisable && entity.parentId == -1" :trigger="['click']" placement="bottomCenter">
-            <a-menu slot="overlay">
-              <a-menu-item>
-                <a href="javascript:;" @click="handleEdit(entity)">缂栬緫</a>
-              </a-menu-item>
-              <a-menu-item>
-                <a href="javascript:;" @click="batchDel(entity)">
-                  鍒犻櫎
-                </a>
-              </a-menu-item>
-            </a-menu>
-            <span :style="{position: 'absolute',right: 0}">
+              <span v-else>{{ title }}</span>
+              <a-dropdown v-if="!editDisable && entity.parentId == -1" :trigger="['click']" placement="bottomCenter">
+                <a-menu slot="overlay">
+                  <a-menu-item>
+                    <a href="javascript:;" @click="handleEdit(entity)">缂栬緫</a>
+                  </a-menu-item>
+                  <a-menu-item>
+                    <a href="javascript:;" @click="batchDel(entity)">
+                      鍒犻櫎
+                    </a>
+                  </a-menu-item>
+                </a-menu>
+                <span :style="{position: 'absolute',right: 0}">
               <a-icon type="down"/>
             </span>
-          </a-dropdown>
-        </template>
-      </a-tree>
+              </a-dropdown>
+            </template>
+          </a-tree>
+        </div>
+      </div>
     </a-spin>
-    <tier-model ref="tierModalForm"  @ok="modalFormOk"></tier-model>
+    <tier-model ref="tierModalForm" @ok="modalFormOk"></tier-model>
   </a-card>
 </template>
 
@@ -64,7 +70,7 @@
   } from '@/api/manage'
   import Tooltip from 'ant-design-vue/es/tooltip'
   import TierModel from './modules/baseTree/TierModel'
-  import {mapActions} from 'vuex'
+  import { mapActions } from 'vuex'
 
   export default {
     name: 'BaseTree',
@@ -74,6 +80,10 @@
         default() {
           return true
         }
+      },
+      filterAbnormalDeviceKey: {
+        type: String,
+        default: ''
       }
     },
     components: {
@@ -99,7 +109,7 @@
         allTreeKeys: [],
         currSelected: {},
         hiding: false,
-        mathChange:''
+        mathChange: ''
       }
     }
     ,
@@ -112,21 +122,23 @@
       ...mapActions(['QueryProduction']),
       getCurrSelectedTitle() {
         return !this.currSelected.title ? '' : this.currSelected.title
-      }
-      ,
+      },
+      /**
+       * 鍙栨秷杞﹂棿閫変腑椤�
+       */
       onClearSelected() {
         this.hiding = true
         this.currSelected = {}
         this.selectedKeys = []
+        // console.log('鍙戦��')
+        // this.$bus.$emit('treeClearSelected','閲嶇疆鍒楄〃')
         this.$emit('sendSelectBaseTree', '')
       },
-
       onSelect(selectedKeys, e) {
         this.hiding = false
         let record = e.node.dataRef
         this.currSelected = Object.assign({}, record)
         this.selectedKeys = [record.key]
-        console.log(this.selectedKeys)
         this.$emit('sendSelectBaseTree', this.selectedKeys)
       },
       handleEdit(entity) {
@@ -141,16 +153,17 @@
       queryTreeData() {
         this.loading = true
         this.cardLoading = true
-        this.QueryProduction().then(res => {
+        this.QueryProduction(this.filterAbnormalDeviceKey).then(res => {
           if (res.success) {
             this.dataList = []
             this.allTreeKeys = []
             this.treeDataSource = res.result
             this.generateList(res.result)
+            this.expandedKeys = this.allTreeKeys
           } else {
             this.$message.warn(res.message)
           }
-        }).finally(() =>{
+        }).finally(() => {
           this.loading = false
           this.cardLoading = false
         })
@@ -167,13 +180,12 @@
         //   this.loading = false
         //   this.cardLoading = false
         // })
-      }
-      ,
+      },
       handleChange() {
         let search = this.searchInput
         let expandedKeys = this.dataList
           .map(item => {
-            if(item.title !=null){
+            if (item.title != null) {
               if (item.title.indexOf(search) > -1) {
                 return this.getParentKey(item.key, this.treeDataSource)
               }
@@ -186,14 +198,13 @@
           searchValue: search,
           autoExpandParent: true
         })
-      }
-      ,
+      },
       handleSearch(value) {
         let search = value
         let expandedKeys = this.dataList
           .map(item => {
 
-            if(item.title !=null){
+            if (item.title != null) {
               if (item.title.indexOf(search) > -1) {
                 return this.getParentKey(item.key, this.treeDataSource)
               }
@@ -206,8 +217,7 @@
           searchValue: search,
           autoExpandParent: true
         })
-      }
-      ,
+      },
       getParentKey(key, tree) {
         let parentKey
         for (let i = 0; i < tree.length; i++) {
@@ -223,7 +233,6 @@
         }
         return parentKey
       },
-
       generateList(data) {
         for (let i = 0; i < data.length; i++) {
           const node = data[i]
@@ -257,9 +266,9 @@
         if (!ids) {
           // this.$message.warning('璇烽�夋嫨涓�鏉¤褰曪紒')
           this.$notification.warning({
-            message:'娑堟伅',
-            description:"璇烽�夋嫨涓�鏉¤褰�"
-          });
+            message: '娑堟伅',
+            description: '璇烽�夋嫨涓�鏉¤褰�'
+          })
           return
         } else {
           var that = this
@@ -271,7 +280,7 @@
               deleteAction(that.url.deleteBatch, { ids: ids }).then((res) => {
                 if (res.success) {
                   that.$message.success(res.message)
-                  that.queryTreeData();
+                  that.queryTreeData()
                 } else {
                   that.$message.warning(res.message)
                 }
@@ -283,19 +292,17 @@
         }
       },
       modalFormOk(val) {
-        console.log("mmm")
+        console.log('mmm')
         // 鏂板/淇敼 鎴愬姛鏃讹紝閲嶈浇鍒楄〃
         this.queryTreeData()
         // 鏂板/淇敼 鎴愬姛鏃讹紝閲嶈浇鍒楄〃
       }
-
-    }
-    ,
+    },
     //鐩戝惉
     watch: {
       currSelected(val) { //鐩戝惉currSelected 鍙樺寲锛屽皢鍙樺寲鍚庣殑鏁板�间紶閫掔粰 getCurrSelected 浜嬩欢
         this.$emit('getCurrSelected', val)
-      },
+      }
     }
   }
 </script>
@@ -346,10 +353,6 @@
     overflow-y: hidden;
   }
 
-  #app .desktop {
-    height: auto !important;
-  }
-
   /** Button鎸夐挳闂磋窛 */
   .ant-btn {
     margin-left: 3px;
@@ -359,7 +362,7 @@
     padding: 5px 15px 5px 37px;
   }
 
-  .drawer-bootom-button {
+  .drawer-bottom-button {
     position: absolute;
     top: 1px;
     /* padding: 10px 16px; */
@@ -368,34 +371,42 @@
     background: #fff;
     border-radius: 0 0 2px 2px;
   }
-  @media screen and (min-width: 1920px){
-    .tree_con{
-      height: 748px!important;
-      overflow: scroll;
+
+  .tree_con {
+    overflow: hidden;
+  }
+
+  @media screen and (min-width: 1920px) {
+    .tree_con {
+      height: 748px !important;
     }
   }
-  @media screen and (min-width: 1680px) and (max-width: 1920px){
-    .tree_con{
-      height: 748px!important;
-      overflow: scroll;
+
+  @media screen and (min-width: 1680px) and (max-width: 1920px) {
+    .tree_con {
+      height: 748px !important;
     }
   }
-  @media screen and (min-width: 1400px) and (max-width: 1680px){
-    .tree_con{
-      height: 600px!important;
-      overflow: scroll;
+
+  @media screen and (min-width: 1400px) and (max-width: 1680px) {
+    .tree_con {
+      height: 600px !important;
     }
   }
-  @media screen and (min-width: 1280px) and (max-width: 1400px){
-    .tree_con{
-      height: 501px!important;
-      overflow: scroll;
+
+  @media screen and (min-width: 1280px) and (max-width: 1400px) {
+    .tree_con {
+      height: 501px !important;
     }
   }
-  @media screen and (max-width: 1280px){
-    .tree_con{
-      height: 501px!important;
-      overflow: scroll;
+
+  @media screen and (max-width: 1280px) {
+    .tree_con {
+      height: 501px !important;
     }
   }
+
+  /deep/ .ant-card-body, /deep/ .ant-spin-nested-loading, /deep/ .ant-spin-container {
+    height: 100%;
+  }
 </style>

--
Gitblit v1.9.3