소스 검색

左侧树新增修改,删除按钮

wyh 9 달 전
부모
커밋
8508a26ded
1개의 변경된 파일60개의 추가작업 그리고 0개의 파일을 삭제
  1. 60 0
      src/components/module_interLock/UEquipmentTree/UEquipmentTree.vue

+ 60 - 0
src/components/module_interLock/UEquipmentTree/UEquipmentTree.vue

@@ -14,6 +14,44 @@
         :replace-fields="replaceFields"
         @select="selectNode"
         >
+        <template v-slot:title="nodeData">
+          <div style="display: flex; justify-content: space-between; width: 100%;">
+            <div style="width: 85%;">{{nodeData.interlockName}}</div>
+            <div style="width: 15%;">
+              <a-dropdown>
+                <a-icon type="more" />
+                <a-menu slot="overlay">
+                  <a-menu-item>
+                    <a @click="handleEdit(nodeData)">修改</a>
+                  </a-menu-item>
+                  <a-menu-item>
+                    <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(nodeData.id)">
+                      <a>删除</a>
+                    </a-popconfirm>
+                  </a-menu-item>
+                </a-menu>
+              </a-dropdown>
+            </div>
+          </div>
+          <!-- <span>{{nodeData.interlockName}}</span>
+          <a-dropdown>
+            <a-icon type="more" />
+            <a-menu slot="overlay">
+              <a-menu-item>
+                <a @click="handleEdit(nodeData)">详情</a>
+              </a-menu-item>
+              <a-menu-item>
+                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(nodeData.id)">
+                  <a>删除</a>
+                </a-popconfirm>
+              </a-menu-item>
+            </a-menu>
+          </a-dropdown> -->
+          <!-- <a-button-group style="float:right;">
+              <a-button size="small" @click="addNode(nodeData)">新增下级</a-button>
+              <a-button size="small" @click="deleteNode(nodeData)">删除</a-button>
+          </a-button-group> -->
+        </template>
         <!-- :filter-tree-node="filterTreeNode" -->
       </a-tree>
     </div>
@@ -136,6 +174,28 @@
       selectNode(selectedKeys, e){
         this.$emit('select', selectedKeys, e)
       },
+      handleEdit: function (record) {
+        // this.$refs.modalForm.edit(record);
+        // this.$refs.modalForm.title = "编辑";
+        // this.$refs.modalForm.disableSubmit = false;
+      },
+      handleDelete: function (id) {
+        // if(!this.url.delete){
+        //   this.$message.error("请设置url.delete属性!")
+        //   return
+        // }
+        // var that = this;
+        // deleteAction(that.url.delete, {id: id}).then((res) => {
+        //   if (res.success) {
+        //     //重新计算分页问题
+        //     that.reCalculatePage(1)
+        //     that.$message.success(res.message);
+        //     that.loadData();
+        //   } else {
+        //     that.$message.warning(res.message);
+        //   }
+        // });
+      },
     },
   })
 </script>