From 10fe40839144bf9a3554e67e41bf1b209d050903 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=99=88=E7=BA=A2=E4=B8=BD?= <1181930680@qq.com>
Date: Mon, 16 Dec 2024 13:44:31 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8A=BD=E5=B1=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/content/layoutItem/edit.vue | 45 +++++++++--------
src/views/content/layoutItem/index.vue | 16 ++----
src/views/data/notice/edit.vue | 69 +++++++++++++-------------
src/views/data/notice/index.vue | 16 ++----
src/views/monitor/job/index.vue | 9 ++--
src/views/monitor/job/log/index.vue | 32 ++++++------
6 files changed, 92 insertions(+), 95 deletions(-)
diff --git a/src/views/content/layoutItem/edit.vue b/src/views/content/layoutItem/edit.vue
index 04cc917..ac9065c 100644
--- a/src/views/content/layoutItem/edit.vue
+++ b/src/views/content/layoutItem/edit.vue
@@ -1,5 +1,5 @@
-
+
{
props.layoutId ? await layoutUpdate(formData) : await layoutAdd(formData);
message.success('操作成功');
- emit('update:visible', false);
+ isDrawer.value = false;
emit('success');
})
.catch((error) => {});
};
const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit);
+ /**
+ * 打开窗体
+ */
+ const openDrawer = async (layoutId) => {
+ isDrawer.value = true;
+ getAllDict();
+ for (const key in formData) {
+ formData[key] = '';
+ }
+ formData.layoutId = null;
+ formData.type = null;
+ formData.sort = 0;
+ if (layoutId) {
+ setFormData(layoutId);
+ }
+ };
/**
* 关闭窗体
*/
const handleClose = () => {
- emit('update:visible', false);
+ isDrawer.value = false;
};
/**
@@ -197,8 +208,8 @@
/**
* 设置表单数据
*/
- const setFormData = async () => {
- const data = await getLayoutDetail(props.layoutId);
+ const setFormData = async (layoutId) => {
+ const data = await getLayoutDetail(layoutId);
for (const key in formData) {
if (data[key] != null && data[key] != undefined) {
//@ts-ignore
@@ -231,13 +242,7 @@
layoutList.value = list ? list : [];
};
- /**
- * 钩子函数
- */
- onMounted(() => {
- getAllDict();
- if (props.layoutId) {
- setFormData();
- }
+ defineExpose({
+ openDrawer,
});
diff --git a/src/views/content/layoutItem/index.vue b/src/views/content/layoutItem/index.vue
index 7a50612..228536f 100644
--- a/src/views/content/layoutItem/index.vue
+++ b/src/views/content/layoutItem/index.vue
@@ -44,13 +44,7 @@
-
+
@@ -185,8 +179,8 @@
*/
const handleAdd = async () => {
layoutId.value = 0;
- await nextTick();
- editVisible.value = true;
+ const { openDrawer } = createModalRef.value;
+ openDrawer();
};
/**
@@ -194,8 +188,8 @@
*/
async function handleEdit(record: Recordable) {
layoutId.value = record.id;
- await nextTick();
- editVisible.value = true;
+ const { openDrawer } = createModalRef.value;
+ openDrawer(layoutId.value);
}
/**
diff --git a/src/views/data/notice/edit.vue b/src/views/data/notice/edit.vue
index de355d7..b37d132 100644
--- a/src/views/data/notice/edit.vue
+++ b/src/views/data/notice/edit.vue
@@ -1,5 +1,5 @@
-
+
{});
};
+ /**
+ * 打开窗体
+ */
+ const openDrawer = async (noticeId) => {
+ isDrawer.value = true;
+ for (const key in formData) {
+ formData[key] = '';
+ }
+ formData.status = 1;
+ formData.type = 1;
+ if (noticeId) {
+ setFormData(noticeId);
+ }
+ };
+
/**
* 关闭窗体
*/
const handleClose = () => {
- emit('update:visible', false);
- };
- const handleUpdate = (show) => {
- if (!show) {
- handleClose();
- }
+ isDrawer.value = false;
};
const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit);
@@ -160,8 +166,8 @@
/**
* 设置表单数据
*/
- const setFormData = async () => {
- const data = await getNoticeDetail(props.noticeId);
+ const setFormData = async (noticeId) => {
+ const data = await getNoticeDetail(noticeId);
for (const key in formData) {
if (data[key] != null && data[key] != undefined) {
//@ts-ignore
@@ -171,12 +177,7 @@
editorRef.value.myValue = formData.content;
};
- /**
- * 钩子函数
- */
- onMounted(() => {
- if (props.noticeId) {
- setFormData();
- }
+ defineExpose({
+ openDrawer,
});
diff --git a/src/views/data/notice/index.vue b/src/views/data/notice/index.vue
index 71f6796..486068b 100644
--- a/src/views/data/notice/index.vue
+++ b/src/views/data/notice/index.vue
@@ -44,13 +44,7 @@
-
+
@@ -186,8 +180,8 @@
*/
const handleAdd = async () => {
noticeId.value = 0;
- await nextTick();
- editVisible.value = true;
+ const { openDrawer } = createModalRef.value;
+ openDrawer();
};
/**
@@ -195,8 +189,8 @@
*/
async function handleEdit(record: Recordable) {
noticeId.value = record.id;
- await nextTick();
- editVisible.value = true;
+ const { openDrawer } = createModalRef.value;
+ openDrawer(noticeId.value);
}
/**
diff --git a/src/views/monitor/job/index.vue b/src/views/monitor/job/index.vue
index 7b39859..03dab14 100644
--- a/src/views/monitor/job/index.vue
+++ b/src/views/monitor/job/index.vue
@@ -51,7 +51,7 @@
v-model:visible="editVisible"
@success="reloadTable('noRefresh')"
/>
-
+
@@ -83,6 +83,7 @@
const dialog = useDialog();
const basicTableRef = ref();
const createModalRef = ref();
+ const jobModalRef = ref();
const editVisible = ref(false);
const editLogVisible = ref(false);
const jobId = ref(0);
@@ -299,10 +300,12 @@
* @param record 参数
*/
const handleJobLog = (record) => {
- console.log(record);
// router.push({path:'/monitorJob/log'})
- editLogVisible.value = true;
jobId.value = record.id;
+ // editLogVisible.value = true;
+
+ const { openDrawer } = jobModalRef.value;
+ openDrawer();
};
/**
diff --git a/src/views/monitor/job/log/index.vue b/src/views/monitor/job/log/index.vue
index 924a2e1..e7bbb56 100644
--- a/src/views/monitor/job/log/index.vue
+++ b/src/views/monitor/job/log/index.vue
@@ -1,5 +1,5 @@
-
+
@@ -70,10 +70,10 @@
const basicTableRef = ref();
const createModalRef = ref();
const editVisible = ref(false);
+ const isDrawer = ref(false);
const logId = ref(0);
const size = document.body.clientWidth - 500;
const rowKeys = ref([]);
- const emit = defineEmits(['update:visible']);
/**
* 定义查询参数
@@ -87,11 +87,6 @@
* 定义接收的参数
*/
const props = defineProps({
- visible: {
- type: Boolean,
- required: true,
- default: false,
- },
jobId: {
type: Number,
required: true,
@@ -191,19 +186,21 @@
labelWidth: 110,
schemas,
});
- const handleClose = () => {
- emit('update:visible', false);
- };
/**
- * 执行更新
- * @param show 参数
+ * 打开窗体
*/
- const handleUpdate = (show) => {
- if (!show) {
- handleClose();
+ const openDrawer = async (noticeId) => {
+ isDrawer.value = true;
+ for (const key in formParams) {
+ formParams[key] = '';
}
};
-
+ /**
+ * 关闭窗体
+ */
+ const handleClose = () => {
+ isDrawer.value = false;
+ };
/**
* 执行查看详情
*/
@@ -231,6 +228,9 @@
},
});
}
+ defineExpose({
+ openDrawer,
+ });