From 1298d0da727f35decf5f1e5fc842a0263ea9f631 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 17:16:36 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E5=BA=94=E7=94=A8=E5=85=A8?= =?UTF-8?q?=E9=83=A8=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assetsManagement/mobileApplication.vue | 146 ++++++++++++-- .../components/assetsManagement/mobileApp.js | 146 +++++++++++++- .../components/assetsManagement/mobileApp.vue | 188 +++++++++++++++++- 3 files changed, 458 insertions(+), 22 deletions(-) diff --git a/src/views/auditPages/assetsManagement/mobileApplication.vue b/src/views/auditPages/assetsManagement/mobileApplication.vue index 3c48914..c8ec235 100644 --- a/src/views/auditPages/assetsManagement/mobileApplication.vue +++ b/src/views/auditPages/assetsManagement/mobileApplication.vue @@ -18,11 +18,21 @@ >导入 - 导出 - 新增资产 @@ -33,6 +43,7 @@ size="small" :inline="true" label-width="110px" + class="search-form" > @@ -141,6 +163,48 @@ :limit.sync="formInline.size" @pagination="getList" /> + + + + +
将文件拖到此处,或点击上传
+
+ + 仅允许导入xls、xlsx格式文件。 + 下载模板 +
+
+ +
+ + @@ -152,7 +216,10 @@ import { deleteAssetApp, schema, } from "@/api/auditPagesApi/index"; +import mobileApp from "@/views/auditPages/components/assetsManagement/mobileApp.vue"; + export default { + components: { mobileApp }, dicts: ["gzh_state"], data() { return { @@ -198,6 +265,23 @@ export default { this.getDeptTree(); }, methods: { + // 弹窗操作 + handleDialog(id, disabled) { + this.$refs.myDialog.openDialog(id, disabled); + }, + //删除 + handleDel(id) { + this.$modal + .confirm('是否确认删除用户编号为"' + id + '"的数据项?') + .then(function () { + return deleteAssetApp(id); + }) + .then(() => { + this.getList(); + this.$modal.msgSuccess("删除成功"); + }) + .catch(() => {}); + }, // 修改table背景色 tableRowClassName({ row, rowIndex }) { if (rowIndex % 2 !== 0) { @@ -259,16 +343,52 @@ export default { this.tableData = res.data.records; }); }, + // 导出 + handleExport() { + this.download( + "/tc/assetApp/export", + { + ...this.formInline, + }, + `移动应用程序资产${new Date().getTime()}.xlsx` + ); + }, + // 导入 + handleImport() { + this.upload.open = true; + }, + /** 下载模板操作 */ + importTemplate() { + this.download( + "/tc/assetApp/importTemplate", + {}, + `移动应用程序资产导入模板${new Date().getTime()}.xlsx` + ); + }, + // 文件上传中处理 + handleFileUploadProgress(event, file, fileList) { + this.upload.isUploading = true; + }, + // 文件上传成功处理 + handleFileSuccess(response, file, fileList) { + this.upload.open = false; + this.upload.isUploading = false; + this.$refs.upload.clearFiles(); + this.$alert( + "
" + + response.msg + + "
", + "导入结果", + { dangerouslyUseHTMLString: true } + ); + this.getList(); + }, + // 提交上传文件 + submitFileForm() { + this.$refs.upload.submit(); + }, }, }; - + diff --git a/src/views/auditPages/components/assetsManagement/mobileApp.js b/src/views/auditPages/components/assetsManagement/mobileApp.js index 8653e1a..64e3d82 100644 --- a/src/views/auditPages/components/assetsManagement/mobileApp.js +++ b/src/views/auditPages/components/assetsManagement/mobileApp.js @@ -1,3 +1,145 @@ -const formData = []; -const formRules = {}; +const formData = [ + { + key: "ssdw", + label: "所属单位", + type: "autocomplete", + prop: "ssdw", + }, + { + key: "appName", + label: "移动应用名称", + type: "input", + prop: "appName", + }, + + { + key: "pack", + label: "包名", + type: "input", + prop: "pack", + }, + { + key: "icpState", + label: "icp备案状态", + type: "select", + prop: "icpState", + dict: "app_icp_state", + }, + { + key: "icpbah", + label: "icp备案号", + type: "input", + prop: "icpbah", + }, + { + key: "tyshxydm", + label: "统一社会信用代码", + type: "input", + prop: "tyshxydm", + }, + { + key: "wjm", + label: "文件名", + type: "input", + prop: "wjm", + }, + { + key: "sshy", + label: "所属行业", + type: "select", + prop: "sshy", + dict: "app_sshy", + }, + { + key: "zdhy", + label: "重点行业", + type: "select", + prop: "zdhy", + dict: "app_zdhy", + }, + { + key: "xzqh", + label: "行政区划", + type: "select", + prop: "xzqh", + dict: "app_xzqh", + }, + { + key: "aqjgqk", + label: "安全加固情况", + type: "select", + prop: "aqjgqk", + dict: "app_aqjgqk", + }, + { + key: "bbxx", + label: "版本信息", + type: "input", + prop: "bbxx", + }, + { + key: "bbh", + label: "版本信息(版本号)", + type: "input", + prop: "bbh", + }, + { + key: "bbxxMd5", + label: "版本信息(MD5)", + type: "input", + prop: "bbxxMd5", + }, + { + key: "bbxxSjpt", + label: "版本信息(上架平台)", + type: "input", + prop: "bbxxSjpt", + }, + { + key: "wjdx", + label: "文件大小", + type: "input", + prop: "wjdx", + }, + { + key: "appState", + label: "移动应用系统状态", + type: "select", + prop: "appState", + dict: "gzh_state", + }, + { + key: "jj", + label: "简介", + type: "textarea", + prop: "jj", + }, +]; +const formRules = { + ssdw: [{ required: true, message: "请填写", trigger: "blur" }], + appName: [{ required: true, message: "请填写", trigger: "blur" }], + pack: [{ required: true, message: "请填写", trigger: "blur" }], + icpState: [{ required: true, message: "请填写", trigger: "blur" }], + icpbah: [{ required: true, message: "请填写", trigger: "blur" }], + tyshxydm: [ + { required: true, message: "请填写", trigger: "blur" }, + { + pattern: /^[a-zA-Z0-9]{18}$/, + message: "请输入正确格式的18位统一社会信用代码", + trigger: "blur", + }, + ], + wjm: [{ required: true, message: "请填写", trigger: "blur" }], + sshy: [{ required: true, message: "请填写", trigger: "blur" }], + zdhy: [{ required: true, message: "请填写", trigger: "blur" }], + xzqh: [{ required: true, message: "请填写", trigger: "blur" }], + aqjgqk: [{ required: true, message: "请填写", trigger: "blur" }], + bbxx: [{ required: true, message: "请填写", trigger: "blur" }], + bbh: [{ required: true, message: "请填写", trigger: "blur" }], + bbxxMd5: [{ required: true, message: "请填写", trigger: "blur" }], + bbxxSjpt: [{ required: true, message: "请填写", trigger: "blur" }], + wjdx: [{ required: true, message: "请填写", trigger: "blur" }], + appState: [{ required: true, message: "请填写", trigger: "blur" }], + jj: [{ required: true, message: "请填写", trigger: "blur" }], +}; export { formData, formRules }; diff --git a/src/views/auditPages/components/assetsManagement/mobileApp.vue b/src/views/auditPages/components/assetsManagement/mobileApp.vue index 87039a3..da705be 100644 --- a/src/views/auditPages/components/assetsManagement/mobileApp.vue +++ b/src/views/auditPages/components/assetsManagement/mobileApp.vue @@ -14,7 +14,83 @@ label-position="right" :disabled="disabled" > + +
+ + + + + + + + + + + + + + + + + +
+ + 返 回 + 确 定 + @@ -22,8 +98,17 @@ import formTitle from "../formTitle.vue"; import { checkRole } from "@/utils/permission"; // 权限判断函数 import { formData, formRules } from "./mobileApp.js"; +import { assetApp, assetAppInfo, unitAllList } from "@/api/auditPagesApi/index"; export default { components: { formTitle }, + dicts: [ + "app_icp_state", + "app_sshy", + "app_zdhy", + "app_xzqh", + "app_aqjgqk", + "gzh_state", + ], data() { return { loading: false, @@ -31,15 +116,104 @@ export default { list: formData, title: "", open: false, - ruleForm: { - rules: formRules, - disabled: false, - }, + ruleForm: {}, + rules: formRules, + 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) { + assetAppInfo(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", "appName", "tyshxydm"]; + 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 assetApp("put", this.ruleForm); + this.$modal.msgSuccess("修改成功"); + } else { + await assetApp("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("请输入正确的企业"); + } + }, + }, }; - +