From fb67f3b60fcae9a95f20d2954899f818b5cbfd61 Mon Sep 17 00:00:00 2001 From: xy <271556543@qq.com> Date: Thu, 25 Jan 2024 11:22:03 +0800 Subject: [PATCH] 1 --- .../sysManage/file/component/addFile.vue | 47 +++++--- src/views/sysManage/file/component/drawer.vue | 107 ++++++++++++++++++ src/views/sysManage/file/index.vue | 32 +++++- .../sysManage/menu/component/addMenu.vue | 21 ++-- src/views/sysManage/menu/index.vue | 31 ++++- 5 files changed, 198 insertions(+), 40 deletions(-) create mode 100644 src/views/sysManage/file/component/drawer.vue diff --git a/src/views/sysManage/file/component/addFile.vue b/src/views/sysManage/file/component/addFile.vue index 68beae0..7af6c7a 100644 --- a/src/views/sysManage/file/component/addFile.vue +++ b/src/views/sysManage/file/component/addFile.vue @@ -26,19 +26,16 @@
目录 :
- - - + :show-all-levels="false" + :value="form.menu_id" + :options="menu_ids" + :props="{ value: 'id', label: 'name', checkStrictly: true }" + @change="pidCascaderHandler" + >
@@ -125,6 +122,7 @@ export default { }, data() { return { + cascaderId_pid: 0, isShow: false, id: "", type: "", @@ -209,14 +207,20 @@ export default { }, async getDetail() { - const res = await show({ id: this.id }); + const res = await show({ regulation_article_id: this.id }); this.$integrateData(this.form, res); + this.file_list = res.regulation_article_file.map(i => ({ + name: i.files.original_name, + url: i.files.url, + response: i + })) }, submit() { + this.form.file_list = this.file_list.map(i => i.response?.id) if (this.type === "add") { - if (this.form.hasOwnProperty("id")) { - delete this.form.id; + if (this.form.hasOwnProperty("regulation_article_id")) { + delete this.form.regulation_article_id; } store(this.form).then((res) => { this.$message({ @@ -229,7 +233,7 @@ export default { }); } if (this.type === "editor") { - Object.defineProperty(this.form, "id", { + Object.defineProperty(this.form, "regulation_article_id", { value: this.id, enumerable: true, configurable: true, @@ -246,6 +250,13 @@ export default { }); } }, + pidCascaderHandler(e) { + if (e.length > 0) { + this.form.menu_id = e.at(-1); + } else { + this.form.menu_id = ""; + } + }, }, watch: { isShow(val) { @@ -256,11 +267,15 @@ export default { } else { this.id = ""; this.type = ""; + this.file_list = []; this.init(); this.$refs["dialog"].clearValidate(); - delete this.form.id; + delete this.form.regulation_article_id; } }, + menu_ids() { + ++this.cascaderId_pid; + }, }, }; diff --git a/src/views/sysManage/file/component/drawer.vue b/src/views/sysManage/file/component/drawer.vue new file mode 100644 index 0000000..86f0efe --- /dev/null +++ b/src/views/sysManage/file/component/drawer.vue @@ -0,0 +1,107 @@ + + + + + diff --git a/src/views/sysManage/file/index.vue b/src/views/sysManage/file/index.vue index a282be4..bbc94b8 100644 --- a/src/views/sysManage/file/index.vue +++ b/src/views/sysManage/file/index.vue @@ -61,7 +61,7 @@ > 编辑 - - + +