From c334c2d76c1b51d0fbe1531bf524e1b90f921a7c Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期二, 20 五月 2025 15:16:39 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev --- src/views/system/post/index.vue | 110 +++++++++++++++++++++++++++--------------------------- 1 files changed, 55 insertions(+), 55 deletions(-) diff --git a/src/views/system/post/index.vue b/src/views/system/post/index.vue index ce63043..2608669 100644 --- a/src/views/system/post/index.vue +++ b/src/views/system/post/index.vue @@ -145,20 +145,20 @@ </template> <script setup name="Post"> -import { listPost, addPost, delPost, getPost, updatePost } from "@/api/system/post"; +import { listPost, addPost, delPost, getPost, updatePost } from "@/api/system/post" -const { proxy } = getCurrentInstance(); -const { sys_normal_disable } = proxy.useDict("sys_normal_disable"); +const { proxy } = getCurrentInstance() +const { sys_normal_disable } = proxy.useDict("sys_normal_disable") -const postList = ref([]); -const open = ref(false); -const loading = ref(true); -const showSearch = ref(true); -const ids = ref([]); -const single = ref(true); -const multiple = ref(true); -const total = ref(0); -const title = ref(""); +const postList = ref([]) +const open = ref(false) +const loading = ref(true) +const showSearch = ref(true) +const ids = ref([]) +const single = ref(true) +const multiple = ref(true) +const total = ref(0) +const title = ref("") const data = reactive({ form: {}, @@ -174,24 +174,24 @@ postCode: [{ required: true, message: "宀椾綅缂栫爜涓嶈兘涓虹┖", trigger: "blur" }], postSort: [{ required: true, message: "宀椾綅椤哄簭涓嶈兘涓虹┖", trigger: "blur" }], } -}); +}) -const { queryParams, form, rules } = toRefs(data); +const { queryParams, form, rules } = toRefs(data) /** 鏌ヨ宀椾綅鍒楄〃 */ function getList() { - loading.value = true; + loading.value = true listPost(queryParams.value).then(response => { - postList.value = response.rows; - total.value = response.total; - loading.value = false; - }); + postList.value = response.rows + total.value = response.total + loading.value = false + }) } /** 鍙栨秷鎸夐挳 */ function cancel() { - open.value = false; - reset(); + open.value = false + reset() } /** 琛ㄥ崟閲嶇疆 */ @@ -203,45 +203,45 @@ postSort: 0, status: "0", remark: undefined - }; - proxy.resetForm("postRef"); + } + proxy.resetForm("postRef") } /** 鎼滅储鎸夐挳鎿嶄綔 */ function handleQuery() { - queryParams.value.pageNum = 1; - getList(); + queryParams.value.pageNum = 1 + getList() } /** 閲嶇疆鎸夐挳鎿嶄綔 */ function resetQuery() { - proxy.resetForm("queryRef"); - handleQuery(); + proxy.resetForm("queryRef") + handleQuery() } /** 澶氶�夋閫変腑鏁版嵁 */ function handleSelectionChange(selection) { - ids.value = selection.map(item => item.postId); - single.value = selection.length != 1; - multiple.value = !selection.length; + ids.value = selection.map(item => item.postId) + single.value = selection.length != 1 + multiple.value = !selection.length } /** 鏂板鎸夐挳鎿嶄綔 */ function handleAdd() { - reset(); - open.value = true; - title.value = "娣诲姞宀椾綅"; + reset() + open.value = true + title.value = "娣诲姞宀椾綅" } /** 淇敼鎸夐挳鎿嶄綔 */ function handleUpdate(row) { - reset(); - const postId = row.postId || ids.value; + reset() + const postId = row.postId || ids.value getPost(postId).then(response => { - form.value = response.data; - open.value = true; - title.value = "淇敼宀椾綅"; - }); + form.value = response.data + open.value = true + title.value = "淇敼宀椾綅" + }) } /** 鎻愪氦鎸夐挳 */ @@ -250,38 +250,38 @@ if (valid) { if (form.value.postId != undefined) { updatePost(form.value).then(response => { - proxy.$modal.msgSuccess("淇敼鎴愬姛"); - open.value = false; - getList(); - }); + proxy.$modal.msgSuccess("淇敼鎴愬姛") + open.value = false + getList() + }) } else { addPost(form.value).then(response => { - proxy.$modal.msgSuccess("鏂板鎴愬姛"); - open.value = false; - getList(); - }); + proxy.$modal.msgSuccess("鏂板鎴愬姛") + open.value = false + getList() + }) } } - }); + }) } /** 鍒犻櫎鎸夐挳鎿嶄綔 */ function handleDelete(row) { - const postIds = row.postId || ids.value; + const postIds = row.postId || ids.value proxy.$modal.confirm('鏄惁纭鍒犻櫎宀椾綅缂栧彿涓�"' + postIds + '"鐨勬暟鎹」锛�').then(function() { - return delPost(postIds); + return delPost(postIds) }).then(() => { - getList(); - proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); + getList() + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛") + }).catch(() => {}) } /** 瀵煎嚭鎸夐挳鎿嶄綔 */ function handleExport() { proxy.download("system/post/export", { ...queryParams.value - }, `post_${new Date().getTime()}.xlsx`); + }, `post_${new Date().getTime()}.xlsx`) } -getList(); +getList() </script> -- Gitblit v1.9.3