From 68994735dddb8d2be65149aa605ec0ac12e8775a Mon Sep 17 00:00:00 2001
From: wujingjing <gersonwu@qq.com>
Date: 星期二, 10 九月 2024 15:26:59 +0800
Subject: [PATCH] 未滑动到底部 bug;多次点开对话测试 bug;数据对接SQL为选项之一

---
 src/views/project/yw/lowCode/sqlAmis/optDlg/OptDlg.vue |   72 ++++++++---------------------------
 1 files changed, 17 insertions(+), 55 deletions(-)

diff --git a/src/views/project/yw/lowCode/sqlAmis/optDlg/OptDlg.vue b/src/views/project/yw/lowCode/sqlAmis/optDlg/OptDlg.vue
index 83442ed..4241bf2 100644
--- a/src/views/project/yw/lowCode/sqlAmis/optDlg/OptDlg.vue
+++ b/src/views/project/yw/lowCode/sqlAmis/optDlg/OptDlg.vue
@@ -18,48 +18,6 @@
 			<el-form-item label="澶囨敞" prop="note">
 				<el-input v-model="dialogFormValue.note" type="textarea" :rows="3"></el-input>
 			</el-form-item>
-			<div class="flex max-h-80">
-				<span class="flex-0 ml-2.5">椤甸潰鍙傛暟</span>
-				<div class="ml-3 flex-auto flex-col flex">
-					<EditTable ref="formEditTableRef" class="flex-auto overflow-auto" :data-source="dialogFormValue.args">
-						<EditTableColumn prop="name" label="鍚嶇О" :rules="[{ required: true, message: '璇疯緭鍏ュ悕绉�', trigger: 'blur' }]">
-							<template #edit="{ row }">
-								<el-input size="small" v-model="row.name" />
-							</template>
-						</EditTableColumn>
-						<EditTableColumn prop="title" label="鎻愮ず" :rules="[{ required: true, message: '璇疯緭鍏ユ彁绀�', trigger: 'blur' }]">
-							<template #edit="{ row }">
-								<el-input size="small" v-model="row.title" />
-							</template>
-						</EditTableColumn>
-						<EditTableColumn label="鎿嶄綔">
-							<template #default="{ actions, $index }">
-								<el-button size="small" @click="actions.startEditable($index)">鎿嶄綔</el-button>
-								<el-button size="small" @click="actions.deleteRow($index)">鍒犻櫎</el-button>
-							</template>
-							<template #edit="{ actions, $index }">
-								<el-button size="small" @click="actions.saveEditable($index)">淇濆瓨</el-button>
-								<el-button size="small" @click="actions.cancelEditable($index)">鍙栨秷</el-button>
-								<el-button size="small" @click="actions.deleteRow($index)">鍒犻櫎</el-button>
-							</template>
-						</EditTableColumn>
-					</EditTable>
-					<el-button class="flex-0" @click="formEditTableRef?.editActions.addRow()">鏂板</el-button>
-				</div>
-
-				<!-- <el-table class="ml-3 h-80" border row-class-name="cursor-pointer" :data="dialogFormValue.args" highlight-current-row>
-					<el-table-column prop="name" label="鍚嶇О" width="300" fixed="left" show-overflow-tooltip>
-						<template #default="scope">
-							<el-input v-model="dialogFormValue.args[scope.$index].name"></el-input>
-						</template>
-					</el-table-column>
-					<el-table-column prop="title" label="鎻愮ず" show-overflow-tooltip>
-						<template #default="scope">
-							<el-input v-model="dialogFormValue.args[scope.$index].title"></el-input>
-						</template>
-					</el-table-column>
-				</el-table> -->
-			</div>
 		</el-form>
 	</ywDialog>
 </template>
@@ -81,8 +39,11 @@
 import { useCompRef } from '/@/utils/types';
 import EditTable from '/@/components/table/editTable/EditTable.vue';
 import EditTableColumn from '/@/components/table/editTable/EditTableColumn.vue';
+import { formatDate } from '/@/utils/formatTime';
+import { useUserInfo } from '/@/stores/userInfo';
+import { storeToRefs } from 'pinia';
 
-const props = defineProps(['item']);
+const props = defineProps(['item', 'groupId']);
 const emit = defineEmits(['update', 'insert']);
 //#region ====================== 澧炲姞銆佷慨鏀硅褰曟搷浣�, dialog init======================
 const isEditDialog = ref(false);
@@ -105,37 +66,41 @@
 const openOperateDialog = (row?) => {
 	if (row) {
 		isEditDialog.value = true;
-		const { id, note, prompt, title, args } = row;
-		const formArgs = args ? args : [];
-		dialogFormValue.value = deepClone({ id, note, prompt, title, args: formArgs });
+		const { id, note, prompt, title } = row;
+		dialogFormValue.value = deepClone({ id, note, prompt, title });
 	} else {
 		isEditDialog.value = false;
 
-		dialogFormValue.value = { title: null, prompt: null, note: null, args: [] };
+		dialogFormValue.value = { group: props.groupId, title: null, prompt: null, note: null };
 	}
 };
 const closeDialog = () => {
 	dialogIsShow.value = false;
 	dialogFormRef.value.clearValidate();
 };
+const stores = useUserInfo();
+const { userInfos } = storeToRefs(stores);
 
 const submitFormValue = async () => {
 	const valid = await dialogFormRef.value.validate().catch(() => {});
 	if (!valid) return;
-	const args =
-		!dialogFormValue.value.args || dialogFormValue.value.args.length === 0 ? null : JSON.stringify(dialogFormValue.value.args);
-	const sendForm = { ...dialogFormValue.value, args };
+
+	const sendForm = { ...dialogFormValue.value };
+	const updateTime = formatDate(new Date());
 	if (isEditDialog.value) {
 		const res = await supervisorAdminApi.updateSupervisor(sendForm);
-		emit('update', sendForm);
+		emit('update', { ...dialogFormValue.value, update_time: updateTime.slice(0, 10) });
 
 		closeDialog();
 		ElMessage.success('淇敼椤甸潰鎴愬姛');
 	} else {
 		const res = await supervisorAdminApi.addSupervisor(sendForm);
-			const newData = {
+		const newData = {
 			id: res.agent_id,
 			...dialogFormValue.value,
+			create_time: updateTime.slice(0, 10),
+			update_time: updateTime.slice(0, 10),
+			creator: userInfos.value.userName,
 		};
 		emit('insert', newData);
 		// tableData.value.push(newData);
@@ -146,9 +111,6 @@
 
 //#endregion
 
-//#region ====================== 鍙紪杈戣〃鏍� ======================
-const formEditTableRef = useCompRef(EditTable);
-//#endregion
 
 watch(
 	() => dialogIsShow.value,

--
Gitblit v1.9.3