From 89f61cea248a73be5ce596b2629c7a4d1b5d2de4 Mon Sep 17 00:00:00 2001
From: shj <1790240199@qq.com>
Date: 星期六, 30 七月 2022 11:59:34 +0800
Subject: [PATCH] 对接

---
 src/views/facilityManagement/InstrumentationInformation/index.vue |   87 +++++++++++++------------------------------
 1 files changed, 27 insertions(+), 60 deletions(-)

diff --git a/src/views/facilityManagement/InstrumentationInformation/index.vue b/src/views/facilityManagement/InstrumentationInformation/index.vue
index 9cb55c1..ae6a667 100644
--- a/src/views/facilityManagement/InstrumentationInformation/index.vue
+++ b/src/views/facilityManagement/InstrumentationInformation/index.vue
@@ -119,16 +119,12 @@
 	</div>
 </template>
 <script lang="ts">
-import { defineComponent, ref, reactive, watch } from 'vue';
+import { defineComponent, ref, reactive, watch, onMounted } from 'vue';
 import updata from '/@/components/updata/updata.vue'
 import Dailog from '/@/components/equipmentDailog/Dailog.vue'
-import { ElTree, TabsPaneContext } from 'element-plus';
+import { ElTree, TabsPaneContext,ElMessage} from 'element-plus';
+import { facilityManagementApi } from '/@/api/facilityManagement';
 import { EditPen, Plus, Delete, Download, Refresh, Upload } from '@element-plus/icons-vue';
-interface Tree {
-	id: number;
-	label: string;
-	children?: Tree[];
-}
 export default defineComponent({
 	components:{updata,Dailog},
 	setup() {
@@ -140,10 +136,26 @@
 		const treeRef = ref<InstanceType<typeof ElTree>>();
 
 		const defaultProps = {
-			children: 'children',
-			label: 'label',
+			lable: 'typeName',
+			children: 'childList',
+			value: 'id',
 		};
-
+		// 树形
+			const listApiTree = () => {
+			facilityManagementApi()
+				.getequipmentTypeMngTreeData()
+				.then((res) => {
+					if (res.data.code == 200) {
+						data.value = res.data.data;
+					} else {
+						ElMessage({
+							showClose: true,
+							message: res.data.msg,
+							type: 'error',
+						});
+					}
+				});
+		};
 		watch(filterText, (val) => {
 			treeRef.value!.filter(val);
 		});
@@ -153,56 +165,10 @@
 			return data.label.includes(value);
 		};
 
-		const data: Tree[] = [
-			{
-				id: 1,
-				label: 'Level one 1',
-				children: [
-					{
-						id: 4,
-						label: 'Level two 1-1',
-						children: [
-							{
-								id: 9,
-								label: 'Level three 1-1-1',
-							},
-							{
-								id: 10,
-								label: 'Level three 1-1-2',
-							},
-						],
-					},
-				],
-			},
-			{
-				id: 2,
-				label: 'Level one 2',
-				children: [
-					{
-						id: 5,
-						label: 'Level two 2-1',
-					},
-					{
-						id: 6,
-						label: 'Level two 2-2',
-					},
-				],
-			},
-			{
-				id: 3,
-				label: 'Level one 3',
-				children: [
-					{
-						id: 7,
-						label: 'Level two 3-1',
-					},
-					{
-						id: 8,
-						label: 'Level two 3-2',
-					},
-				],
-			},
-		];
+		const data=ref([])
+		onMounted(()=>{
+			listApiTree()
+		})
 		const tableData = [
 			{
 				date: '2016-05-03',
@@ -254,6 +220,7 @@
          ShowD.value.openDailog(false)
 		}
 		return {
+			listApiTree,
 			activeName,
 			handleClick,
 			ruleForm,

--
Gitblit v1.9.2