From fa30385c6d2f9c5b3ba4b35e39c692ea0a21cd18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=AE=8F=E6=9D=B0?= <1943105267@qq.com> Date: Mon, 24 Feb 2025 16:52:39 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=B5=E5=AD=90=E9=82=AE=E4=BB=B6=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E4=BF=AE=E6=94=B9=E6=9F=A5=E7=9C=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auditPages/assetsManagement/email.vue | 33 ++-- .../assetsManagement/emailDialog.js | 139 ++++++++++++- .../assetsManagement/emailDialog.vue | 185 +++++++++++++++++- .../officialAccountDialog.vue | 2 +- 4 files changed, 341 insertions(+), 18 deletions(-) diff --git a/src/views/auditPages/assetsManagement/email.vue b/src/views/auditPages/assetsManagement/email.vue index 0875250..f353bf1 100644 --- a/src/views/auditPages/assetsManagement/email.vue +++ b/src/views/auditPages/assetsManagement/email.vue @@ -32,7 +32,12 @@ >导出 - 新增资产 @@ -43,6 +48,7 @@ size="small" :inline="true" label-width="110px" + class="search-form" > @@ -22,8 +98,21 @@ import formTitle from "../formTitle.vue"; import { checkRole } from "@/utils/permission"; // 权限判断函数 import { formData, formRules } from "./emailDialog.js"; +import { + assetEmail, + assetEmailInfo, + unitAllList, +} from "@/api/auditPagesApi/index"; export default { components: { formTitle }, + dicts: [ + "app_xzqh", + "app_sshy", + "app_zdhy", + "email_jslx", + "email_state", + "email_hasorno", + ], data() { return { loading: false, @@ -36,9 +125,99 @@ export default { disabled: false, }; }, - mounted() {}, - methods: {}, + mounted() { + this.remoteMethod(); + }, + methods: { + /** 打开对话框 */ + openDialog(id, disabled) { + if (!id) { + this.title = "新增电子邮件"; + this.resetForm("ruleForm"); + this.ruleForm = {}; + this.open = true; + } else { + this.getInfo(id); + this.disabled = disabled; + } + }, + getInfo(id) { + assetEmailInfo(id).then((res) => { + this.resetForm("ruleForm"); + this.ruleForm = res.data; + this.title = "修改电子邮件"; + this.open = true; + }); + }, + submit() { + let index = 0; + let portion = []; + let isUnit = checkRole(["unit"]); + if (!isUnit) { + // 只验证部分(管理端) + portion = ["ssdw", "dzyxhz"]; + this.$refs["ruleForm"].validateField(portion, (errors) => { + if (errors) { + console.log("部分字段验证失败:", errors); + } else { + index++; + if (index == portion.length) { + this.subFu(); + } + } + }); + } else { + //全部验证 + this.$refs["ruleForm"].validate((valid) => { + if (valid) { + this.subFu(); + } else { + console.log("error submit!!"); + return false; + } + }); + } + }, + async subFu() { + if (this.ruleForm.id != null) { + await assetEmail("put", this.ruleForm); + this.$modal.msgSuccess("修改成功"); + } else { + await assetEmail("post", this.ruleForm); + this.$modal.msgSuccess("新增成功"); + } + this.open = false; + this.$emit("finish"); + }, + /**单位名称模糊查询 */ + async remoteMethod(query) { + let res = await unitAllList({ nickName: query }); + this.options = res.data; + if (this.options.length == 0) { + this.ruleForm.ssdw = ""; + this.$message.error("请输入正确的企业"); + } + }, + }, }; - + diff --git a/src/views/auditPages/components/assetsManagement/officialAccountDialog.vue b/src/views/auditPages/components/assetsManagement/officialAccountDialog.vue index cf6a057..a346a40 100644 --- a/src/views/auditPages/components/assetsManagement/officialAccountDialog.vue +++ b/src/views/auditPages/components/assetsManagement/officialAccountDialog.vue @@ -212,7 +212,7 @@ export default { }, submit() { let index = 0; - let portion = ["ssdw", "gzhmc", "tyshxydm"]; + let portion = []; let isUnit = checkRole(["unit"]); if (!isUnit) { // 只验证部分(管理端)