From 48736e40f235eddab1062bc49629b720fdb1201a Mon Sep 17 00:00:00 2001
From: gerson <1405270578@qq.com>
Date: 星期日, 08 九月 2024 01:34:38 +0800
Subject: [PATCH] 页面发布、修改

---
 src/views/project/yw/lowCode/sqlAmis/SqlAmis.vue |   55 ++++++++++++++++++++++++++++++-------------------------
 1 files changed, 30 insertions(+), 25 deletions(-)

diff --git a/src/views/project/yw/lowCode/sqlAmis/SqlAmis.vue b/src/views/project/yw/lowCode/sqlAmis/SqlAmis.vue
index 146c262..e36527d 100644
--- a/src/views/project/yw/lowCode/sqlAmis/SqlAmis.vue
+++ b/src/views/project/yw/lowCode/sqlAmis/SqlAmis.vue
@@ -36,32 +36,18 @@
 						</div>
 					</template>
 				</el-table-column> -->
-					<el-table-column prop="id" label="id" width="130" fixed="left" show-overflow-tooltip> </el-table-column>
+					<!-- <el-table-column prop="id" label="id" width="130" fixed="left" show-overflow-tooltip> </el-table-column> -->
 
 					<el-table-column prop="title" label="鏍囬" width="300" fixed="left" show-overflow-tooltip> </el-table-column>
 					<el-table-column prop="prompt" label="鎻愮ず璇�" show-overflow-tooltip> </el-table-column>
-					<el-table-column prop="published" label="鐘舵��" width="120" show-overflow-tooltip>
-						<template #default="scope">
-							<el-select
-								:modelValue="displayTableData[scope.$index].published"
-								@change="(value) => publishStatusChange(value, scope.row.id, scope.$index)"
-							>
-								<el-option
-									v-for="item in Object.keys(supervisorPublishedMap)"
-									:key="item"
-									:value="item"
-									:label="supervisorPublishedMap[item]"
-								></el-option>
-							</el-select>
-						</template>
-					</el-table-column>
+				
 					<el-table-column label="鍒涘缓浜�" prop="creator" width="100" show-overflow-tooltip> </el-table-column>
 					<el-table-column label="鍒涘缓鏃堕棿" prop="create_time" width="105" show-overflow-tooltip> </el-table-column>
 					<el-table-column label="鏇存柊鏃堕棿" prop="update_time" width="105" show-overflow-tooltip> </el-table-column>
 					<el-table-column label="澶囨敞" prop="note" show-overflow-tooltip> </el-table-column>
-					<el-table-column label="鎿嶄綔" width="150" fixed="right" show-overflow-tooltip>
+					<el-table-column label="鎿嶄綔" width="200" fixed="right" show-overflow-tooltip>
 						<template #default="scope">
-							<div class="space-x-2.5 items-center flex">
+							<div class="space-x-3 items-center flex">
 								<el-tooltip effect="dark" content="SQL缂栬緫" placement="top">
 									<i class="ywifont ywicon-sql !text-[14px] text-blue-400 cursor-pointer" @click="editSqlClick(scope.row)"></i>
 								</el-tooltip>
@@ -72,9 +58,25 @@
 									<i class="ywifont ywicon-ceshi !text-[20px] text-blue-400 cursor-pointer" @click="openChatTest(scope.row)"></i>
 								</el-tooltip>
 
-								<!-- <el-tooltip effect="dark" content="鍙戝竷" placement="top">
-									<i class="ywifont ywicon-ceshi !text-[20px] text-blue-400 cursor-pointer" :class="[row]" @click="openChatTest(scope.row)"></i>
-								</el-tooltip> -->
+								<el-tooltip
+									effect="dark"
+									:content="scope.row.published === SupervisorPublished.Y ? '鍙栨秷鍙戝竷' : '鍙戝竷'"
+									placement="top"
+								>
+									<i
+										class="ywifont !text-[20px] cursor-pointer"
+										:class="[
+											scope.row.published === SupervisorPublished.Y ? 'ywicon-quxiaofabu text-red-400' : 'ywicon-fabu text-blue-400',
+										]"
+										@click="
+											publishStatusChange(
+												scope.row.published === SupervisorPublished.Y ? SupervisorPublished.N : SupervisorPublished.Y,
+												scope.row.id,
+												scope.$index
+											)
+										"
+									></i>
+								</el-tooltip>
 								<el-tooltip effect="dark" content="缂栬緫" placement="top">
 									<i class="ywifont ywicon-bianji !text-[15px] text-blue-400 cursor-pointer" @click="openOptDlg(scope.row)"></i>
 								</el-tooltip>
@@ -141,6 +143,7 @@
 import { gotoRoute } from '/@/utils/route';
 import { useCompRef } from '/@/utils/types';
 import { nextTick } from 'vue';
+import { ElMessage } from 'element-plus';
 //#region ====================== 琛ㄦ牸鏁版嵁锛宼able init ======================
 const tableLoading = ref(false);
 const tableData = ref([]);
@@ -152,7 +155,7 @@
 	});
 	tableData.value = (res.values || []).map((item) => {
 		item.create_time = item.create_time?.slice(0, 10);
-		item.update_time = item.create_time?.slice(0, 10);
+		item.update_time = item.update_time?.slice(0, 10);
 
 		return item;
 	});
@@ -224,12 +227,14 @@
 };
 //#endregion
 //#region ====================== 鏀瑰彉鍙戝竷鐘舵�� ======================
-const publishStatusChange = async (isPublished: SupervisorPublished, id, index) => {
+const publishStatusChange = async (published: SupervisorPublished, id, index) => {
 	const res = await updatePublishStatus({
 		id: id,
-		publish: isPublished,
+		publish: published,
 	});
-	displayTableData.value[index].published = isPublished;
+	const origin = published ? SupervisorPublished.N : SupervisorPublished.Y;
+	displayTableData.value[index].published = res.publish ?? origin;
+	published===SupervisorPublished.Y ? ElMessage.success('鍙戝竷鎴愬姛'):ElMessage.info('宸插彇娑堝彂甯�')
 };
 //#endregion
 

--
Gitblit v1.9.3