From 78bdb5114382f006fb53fd461c7b90f4f43afc39 Mon Sep 17 00:00:00 2001
From: “linengliang” <vanSuperEnergy@163.com>
Date: 星期二, 29 八月 2023 11:59:30 +0800
Subject: [PATCH] 设备分类

---
 src/views/eam/modules/equipmentCategory/EquipmentCategoryLeft.vue |   84 ++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 81 insertions(+), 3 deletions(-)

diff --git a/src/views/eam/modules/equipmentCategory/EquipmentCategoryLeft.vue b/src/views/eam/modules/equipmentCategory/EquipmentCategoryLeft.vue
index cbe5b81..d0bf837 100644
--- a/src/views/eam/modules/equipmentCategory/EquipmentCategoryLeft.vue
+++ b/src/views/eam/modules/equipmentCategory/EquipmentCategoryLeft.vue
@@ -66,7 +66,51 @@
         @select="onSelect"
         @expand="onExpand"
       >
+      <template
+          slot="title"
+          slot-scope="{key,entity,title,leaf}"
+        >
+        <span>{{ title }}</span>
+          <a-dropdown
+            v-if="entity"
+            :trigger="['click']"
+            placement="bottomCenter"
+          >
+            <a-menu slot="overlay">
+              <a-menu-item v-if="key!=-1">
+                <a
+                  href="javascript:;"
+                  @click="handleEdit(entity)"
+                >缂栬緫</a>
+              </a-menu-item>
+              <a-menu-item>
+                <a
+                  href="javascript:;"
+                  @click="handleAdd(entity)"
+                >
+               娣诲姞瀛愮被鍒�
+                </a>
+              </a-menu-item>
+              <a-menu-item v-if="key!=-1&&leaf">
+                <a-popconfirm
+                  title="纭畾鍒犻櫎鍚�?"
+                  @confirm="() => handleDelete(entity.id)"
+                >
+                  <a>鍒犻櫎</a>
+                </a-popconfirm>
+              </a-menu-item>
+            </a-menu>
+            <span :style="{position: 'absolute',right: 0}">
+              <a-icon type="down" />
+            </span>
+          </a-dropdown>
+        </template>
       </a-tree>
+      <equipment-category-model
+      ref="modalForm"
+      @ok="modalFormOk"
+      :mainId="mainId"
+    ></equipment-category-model>
     </a-spin>
   </a-card>
 </template>
@@ -75,24 +119,33 @@
 import { getAction } from '@/api/manage'
 import Tooltip from 'ant-design-vue/es/tooltip'
 import JEllipsis from "@/components/jeecg/JEllipsis"
+import EquipmentCategoryModel from './EquipmentCategoryModel'
+import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+import { deleteAction } from '../../../../api/manage'
 
 export default {
   name: 'EquipmentCategoryLeft',
+  mixins: [JeecgListMixin],
   components: {
     Tooltip,
-    JEllipsis
+    JEllipsis,
+    EquipmentCategoryModel,
   },
   props: ['value'],
   data() {
     return {
       searchInput: '',
+      disableMixinCreated:true,
       cardLoading: false,
       loading: false,
       treeDataSource: [],
       selectedKeys: [],
       expandedKeys: [],
+      mainId:'',
       url: {
-        equipmentCategoryTreeList: '/eam/equipmentCategory/loadTree'
+        equipmentCategoryTreeList: '/eam/equipmentCategory/loadTree',
+        delete: "/eam/equipmentCategory/delete",
+        list: "/eam/equipmentCategory/getAllChildren",
       },
       searchValue: '',
       dataList: [],
@@ -111,6 +164,12 @@
     getCurrSelectedTitle() {
       return !this.currSelected.title ? '' : this.currSelected.title;
     },
+    handleAdd: function (record) {
+      this.$refs.modalForm.add({ parentNum: record.num, parentName: record.name });
+      this.$refs.modalForm.title = "鏂板";
+      this.$refs.modalForm.disableSubmit = false;
+      this.$refs.modalForm.parentId = record.id;
+    },
     onClearSelected() {
       this.hiding = true;
       this.currSelected = {};
@@ -121,6 +180,7 @@
       let record = e.node.dataRef;
       this.currSelected = Object.assign({}, record);
       this.selectedKeys = [record.key];
+      this.mainId = record.key;
     },
     onExpand(expandedKeys) {
       this.expandedKeys = expandedKeys;
@@ -190,7 +250,25 @@
       }
       return parentKey;
     },
-
+    handleDelete(id) {
+      if (!this.url.delete) {
+        this.$message.error("璇疯缃畊rl.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.queryTreeData();
+          that.$bus.$emit('loadData')
+          that.alterFlag = new Date();
+        } else {
+          that.$message.warning(res.message);
+        }
+      });
+    },
     generateList(data) {
       for (let i = 0; i < data.length; i++) {
         const node = data[i];

--
Gitblit v1.9.3