From 4685a4bd93c1fa69afce297fdcd0d4b322d9101e Mon Sep 17 00:00:00 2001
From: yangyin <1850366751@qq.com>
Date: 星期四, 29 八月 2024 15:40:46 +0800
Subject: [PATCH] Merge branch 'master' of http://47.103.154.90:83/r/WI/Web.Admin.V1.0

---
 vite.config.ts                                   |    2 
 src/views/project/yw/lowCode/sqlAmis/SqlAmis.vue |  128 ++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 123 insertions(+), 7 deletions(-)

diff --git a/src/views/project/yw/lowCode/sqlAmis/SqlAmis.vue b/src/views/project/yw/lowCode/sqlAmis/SqlAmis.vue
index f2f6b51..8afb1d5 100644
--- a/src/views/project/yw/lowCode/sqlAmis/SqlAmis.vue
+++ b/src/views/project/yw/lowCode/sqlAmis/SqlAmis.vue
@@ -2,6 +2,17 @@
 	<div class="h-full flex flex-col">
 		<div class="grid grid-cols-2 gap-2 h-2/3 flex-0">
 			<div class="h-full overflow-auto">
+				<el-table
+					:data="tableData"
+					row-class-name="cursor-pointer"
+					class="h-full"
+					highlight-current-row
+					@current-change="dockRowChange"
+				>
+					<el-table-column prop="date" label="Date" width="180" />
+					<el-table-column prop="name" label="Name" width="180" />
+					<el-table-column prop="address" label="Address" />
+				</el-table>
 				<!-- <codemirror
 					v-model="dockCode"
 					:style="{ height: '100%' }"
@@ -13,7 +24,6 @@
 					@focus="log('focus', $event)"
 					@blur="log('blur', $event)"
 				/> -->
-				
 			</div>
 			<div class="h-full overflow-auto">
 				<codemirror
@@ -49,19 +59,125 @@
 </template>
 
 <script setup lang="ts">
-import { defineComponent, ref, shallowRef } from 'vue';
-import { Codemirror } from 'vue-codemirror';
 import { json } from '@codemirror/lang-json';
-import { vscodeDark, vscodeLight, vscodeLightInit } from '@uiw/codemirror-theme-vscode';
-import * as codeExample from './testData';
 import { sql } from '@codemirror/lang-sql';
 import { xml } from '@codemirror/lang-xml';
+import { vscodeDark } from '@uiw/codemirror-theme-vscode';
+import { ref } from 'vue';
+import { Codemirror } from 'vue-codemirror';
+import * as codeExample from './testData';
+import _ from 'lodash';
 const log = console.log;
 const jsonCode = ref(codeExample.jsonCode);
 const dockCode = ref(codeExample.dockCode);
 const sqlCode = ref(codeExample.sqlCode);
-
+const tableData = [
+	{
+		date: '2016-05-03',
+		name: 'Tom',
+		address: 'No. 189, Grove St, Los Angeles',
+	},
+	{
+		date: '2016-05-02',
+		name: 'Tom',
+		address: 'No. 189, Grove St, Los Angeles',
+	},
+	{
+		date: '2016-05-04',
+		name: 'Tom',
+		address: 'No. 189, Grove St, Los Angeles',
+	},
+	{
+		date: '2016-05-01',
+		name: 'Tom',
+		address: 'No. 189, Grove St, Los Angeles',
+	},
+];
 const jsonEditorExtensions = [json(), vscodeDark];
 const sqlEditorExtensions = [sql(), vscodeDark];
 const dockEditorExtensions = [xml(), vscodeDark];
+
+const dockRowChange = (row) => {};
+/** @description 璺緞鍒嗛殧绗� */
+const PATH_SEPARATOR = '/';
+/** @description 1 閫�鍑烘墍鏈夊惊鐜� -1閫�鍑哄綋娆″惊鐜� 0鎴栧叾浠栧�肩户缁� */
+const travelObj = (obj, callBack?: (key?: string, value?: any, path?: string) => 1 | -1 | undefined | void | 0, path = '') => {
+	let entry = Object.entries(obj);
+	// if (entry[0] && !entry[0]['isRoot']) {
+	// 	entry = entry.map((item) => {
+	// 		item['isRoot'] = true;
+	// 		item['path'] = '';
+	// 		return item;
+	// 	});
+	// }
+	let res = null;
+
+	iterate: for (const item of entry) {
+		const [key, value] = item;
+		const currentPath = path + key;
+		res = callBack?.(key, value, currentPath);
+		switch (res) {
+			case 1:
+				break iterate;
+			case -1:
+				continue iterate;
+			default:
+				break;
+		}
+		if (!value) {
+			continue;
+		}
+		if (_.isObjectLike(value)) {
+			res = travelObj(value, callBack, currentPath);
+			switch (res) {
+				case 1:
+					break iterate;
+				case -1:
+					continue iterate;
+				default:
+					break;
+			}
+		}
+	}
+	return res;
+};
+
+const enum AmisDockType {
+	Api,
+}
+type AmisDockApi = string;
+type AmisDockValue = AmisDockApi;
+type AmisDockConfig = {
+	type: AmisDockType;
+	value: AmisDockValue;
+};
+const parseJSONData = (json: string) => {
+	if (!json) return;
+	const obj = JSON.parse(json);
+	const configList: AmisDockConfig[] = [];
+	travelObj(
+		{
+			id: 'u:7d4e7d100425',
+			body: [
+				{
+					id: 'u:3e0a8e524d99',
+				},
+			],
+		},
+		(key, value, path) => {
+			console.log('馃殌 ~ key:', key);
+			console.log('馃殌 ~ value:', value);
+			console.log('馃殌 ~ path:', path);
+
+			// if (key === 'api') {
+			// 	configList.push({
+			// 		type: AmisDockType.Api,
+			// 		value: value.url,
+			// 	});
+			// }
+		}
+	);
+};
+
+parseJSONData(codeExample.jsonCode);
 </script>
diff --git a/vite.config.ts b/vite.config.ts
index b355b5a..e793547 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -35,7 +35,7 @@
 			host: '0.0.0.0',
 			port: env.VITE_PORT as unknown as number,
 			open: JSON.parse(env.VITE_OPEN),
-			hmr: true,
+			hmr: false,
 			proxy: {
 				'/gitee': {
 					target: 'https://gitee.com',

--
Gitblit v1.9.3