From 9a57977aa935fbca3bbdcace66588bb26af36d20 Mon Sep 17 00:00:00 2001 From: zhang zhuo Date: Wed, 27 May 2026 15:51:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/model/system.ts | 2 +- src/components/piDictText/index.vue | 2 +- src/components/piEditor/index.vue | 18 ++-- src/components/piExport/index.vue | 13 +-- src/components/piImage/index.vue | 2 +- src/components/piImport/index.vue | 12 ++- src/components/piSelect/index.vue | 2 +- src/components/piTable/index.vue | 12 +-- src/layout/components/msg.vue | 1 + src/utils/print.ts | 138 ++++++++++++++++++++++++++++ src/views/system/account/index.vue | 11 ++- src/views/system/account/save.vue | 5 +- src/views/system/config/index.vue | 1 - src/views/system/dept/index.vue | 16 ++-- src/views/system/dept/save.vue | 10 +- src/views/system/post/index.vue | 6 ++ src/views/system/post/save.vue | 22 +++-- 17 files changed, 217 insertions(+), 56 deletions(-) create mode 100644 src/utils/print.ts diff --git a/src/api/model/system.ts b/src/api/model/system.ts index 9bf11d8..c94d631 100644 --- a/src/api/model/system.ts +++ b/src/api/model/system.ts @@ -86,7 +86,7 @@ export default { return await http.get("post/option", data); }, import: async function (data = {}) { - return await http.get("post/import", data); + return await http.post("post/import", data); }, }, upload: async function (data, config = {}) { diff --git a/src/components/piDictText/index.vue b/src/components/piDictText/index.vue index c494103..fb2dc38 100644 --- a/src/components/piDictText/index.vue +++ b/src/components/piDictText/index.vue @@ -52,7 +52,7 @@ function genCacheKey() { if (!props.cacheKey) { return null; } - return `${props.cacheKey || dictConfig.api.name}:` + tools.crypto.MD5(`${stableStringify({key: props.type})}`).slice(0, 8).toUpperCase() + return `${props.cacheKey || dictConfig.api.name}:` + tools.md5(`${stableStringify({key: props.type})}`).slice(0, 8).toUpperCase() } function stableStringify(obj) { diff --git a/src/components/piEditor/index.vue b/src/components/piEditor/index.vue index dcbc5c5..ebd5e23 100644 --- a/src/components/piEditor/index.vue +++ b/src/components/piEditor/index.vue @@ -2,8 +2,7 @@
+ :defaultConfig="editorConfig" @onCreated="handleCreated"/> props.modelValue, () => { - html.value = props.modelValue -}, {immediate: true}) - -watch(html, () => { - emit("update:modelValue", html.value) +const html = computed({ + get: () => props.modelValue, + set: (val) => emit("update:modelValue", val) }) onUnmounted(() => { @@ -80,6 +75,9 @@ onUnmounted(() => { const handleCreated = (editor) => { editorRef.value = editor + if (html.value) { + editor.setHtml(html.value) + } } function showPicker1() { diff --git a/src/components/piExport/index.vue b/src/components/piExport/index.vue index 5a82629..9982988 100644 --- a/src/components/piExport/index.vue +++ b/src/components/piExport/index.vue @@ -9,10 +9,7 @@ import tools from "@/utils/tools" const {proxy} = getCurrentInstance() const props = defineProps({ - api: { - type: Object, default: () => { - } - }, + api: {type: Object}, params: { type: Object, default: () => { } @@ -25,12 +22,12 @@ let loading = ref(false) async function download() { const data = {module: props.module, name: props.name, params: props.params} - let api = props.api - if (!api) { - api = api.tools.file.export + let apiUrl = props.api + if (!apiUrl) { + apiUrl = api.tools.file.export } loading.value = true - const [res, err] = await tools.go(api(data)) + const [res, err] = await tools.go(apiUrl(data)) loading.value = false if (err) { proxy.$message.error(res.msg) diff --git a/src/components/piImage/index.vue b/src/components/piImage/index.vue index 5170fb6..38a44a3 100644 --- a/src/components/piImage/index.vue +++ b/src/components/piImage/index.vue @@ -1,5 +1,5 @@ diff --git a/src/views/system/dept/save.vue b/src/views/system/dept/save.vue index 816f10c..cc6d97d 100644 --- a/src/views/system/dept/save.vue +++ b/src/views/system/dept/save.vue @@ -78,18 +78,24 @@ function open(m = 'add', data = null) { mode.value = m; visible.value = true; Object.assign(form.value, data) + return {setParent} +} + +function setParent(parent_id=0) { + form.value.parent_id = parent_id } //加载树数据 async function getGroup() { const res = await api.system.dept.list(); - groups.value = tools.makeTreeData(res.data, 0, "dept_id"); + groups.value = tools.makeTreeData(res.data, 0, "dept_id", "parent_id"); } //表单提交方法 async function submit() { // 校验登录 - const validate = await formRef.value.validate().catch(() => {}); + const validate = await formRef.value.validate().catch(() => { + }); if (!validate) { return false } diff --git a/src/views/system/post/index.vue b/src/views/system/post/index.vue index 5fcedb3..0902f8c 100644 --- a/src/views/system/post/index.vue +++ b/src/views/system/post/index.vue @@ -14,6 +14,11 @@ + + +