From 945d8db170070acab4e96000740b04c63fa02c9d Mon Sep 17 00:00:00 2001 From: izory <599854767@qq.com> Date: Thu, 23 Sep 2021 07:16:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Infrastructure/OptionsSetting.cs | 2 +- ZR.Admin.WebApi/NLog.config | 1 + ZR.Admin.WebApi/appsettings.json | 2 +- .../wwwroot/CodeGenTemplate/VueTemplate.txt | 13 +- ZR.Vue/src/api/gendemo.js | 10 +- ZR.Vue/src/router/index.js | 2 +- ZR.Vue/src/views/gendemo/index.vue | 547 +++++++++--------- ZR.Vue/src/views/tool/gen/index.vue | 50 +- ZRAdmin.xml | 28 +- 9 files changed, 329 insertions(+), 326 deletions(-) diff --git a/Infrastructure/OptionsSetting.cs b/Infrastructure/OptionsSetting.cs index 6743089..6a876d1 100644 --- a/Infrastructure/OptionsSetting.cs +++ b/Infrastructure/OptionsSetting.cs @@ -7,7 +7,7 @@ namespace Infrastructure public class OptionsSetting { public static string ConnAdmin = "conn_zrAdmin"; - public static string ConnDbType = "dbType"; + public static string ConnDbType = "conn_zrAdmin_Type"; public static string DbKey = "DbKey"; public string Redis { get; set; } diff --git a/ZR.Admin.WebApi/NLog.config b/ZR.Admin.WebApi/NLog.config index a9d6783..9921814 100644 --- a/ZR.Admin.WebApi/NLog.config +++ b/ZR.Admin.WebApi/NLog.config @@ -24,6 +24,7 @@ - + @@ -67,7 +67,7 @@ export default { return { labelWidth: "100px", formLabelWidth:"100px", - // 选中数组 + // 选中{primaryKey}数组 ids: [], // 非单个禁用 single: true, @@ -129,7 +129,7 @@ export default { reset() { this.form = { {VueViewEditFormContent} - //需个性化处理内容 + //TODO 根据实际内容调整 }; this.resetForm("form"); }, @@ -142,8 +142,9 @@ export default { pageSize: 20, //TODO 重置字段 }; + this.handleQuery(); }, - // 多选框选中数据 + // 多选框选中数据 handleSelectionChange(selection) { this.ids = selection.map((item) => item.{primaryKey}); this.single = selection.length!=1 diff --git a/ZR.Vue/src/api/gendemo.js b/ZR.Vue/src/api/gendemo.js index 4b11f92..545231c 100644 --- a/ZR.Vue/src/api/gendemo.js +++ b/ZR.Vue/src/api/gendemo.js @@ -1,7 +1,7 @@ import request from '@/utils/request' /** - * 测试分页查询 + * 代码生成测试表分页查询 * @param {查询条件} data */ export function listGendemo(query) { @@ -13,7 +13,7 @@ export function listGendemo(query) { } /** - * 新增测试 + * 新增代码生成测试表 * @param data */ export function addGendemo(data) { @@ -25,7 +25,7 @@ export function addGendemo(data) { } /** - * 修改测试 + * 修改代码生成测试表 * @param data */ export function updateGendemo(data) { @@ -37,8 +37,8 @@ export function updateGendemo(data) { } /** - * 获取测试详情 - * @param {Id} 测试Id + * 获取代码生成测试表详情 + * @param {Id} 代码生成测试表Id */ export function getGendemo(id) { return request({ diff --git a/ZR.Vue/src/router/index.js b/ZR.Vue/src/router/index.js index cd682e2..3dd9d34 100644 --- a/ZR.Vue/src/router/index.js +++ b/ZR.Vue/src/router/index.js @@ -44,7 +44,7 @@ export const constantRoutes = [ }, { path: '/demo', - component: (resolve) => require(['@/views/userInfo/index'], resolve), + component: (resolve) => require(['@/views/gendemo/index'], resolve), hidden: true }, { diff --git a/ZR.Vue/src/views/gendemo/index.vue b/ZR.Vue/src/views/gendemo/index.vue index 62b2748..e26ec42 100644 --- a/ZR.Vue/src/views/gendemo/index.vue +++ b/ZR.Vue/src/views/gendemo/index.vue @@ -1,271 +1,278 @@ - - - + sexOptions: [], + // 数据列表 + dataList: [], + // 总记录数 + total: 0, + // 提交按钮是否显示 + btnSubmitVisible: true, + // 表单校验 + rules: { + id: [{ type: "number", message: "id必须为数字值", trigger: "blur" }], + name: [{ required: true, message: "请输入名称", trigger: "blur" }], + showStatus: [ + { required: true, message: "请输入显示状态", trigger: "blur" }, + ], + }, + }; + }, + mounted() { + // 列表数据查询 + this.getList(); + // 下拉框绑定 + // this.getDicts("sys_normal_disable").then((response) => { + // this.statusOptions = response.data; + // }); + this.getDicts("sys_user_sex").then((response) => { + this.sexOptions = response.data; + }); + }, + methods: { + // 查询数据 + getList() { + console.log(JSON.stringify(this.queryParams)); + listGendemo(this.addDateRange(this.queryParams, this.timeRange)).then( + (res) => { + if (res.code == 200) { + this.dataList = res.data.result; + this.total = res.data.totalCount; + } + } + ); + }, + // 取消按钮 + cancel() { + this.open = false; + this.reset(); + }, + // 重置数据表单 + reset() { + this.form = { + name: undefined, + icon: undefined, + showStatus: undefined, + addTime: undefined, + sex: undefined, + sort: undefined, + + //TODO 根据实际内容调整 + }; + this.resetForm("form"); + }, + /** 重置查询操作 */ + resetQuery() { + this.timeRange = []; + this.resetForm("queryForm"); + this.queryParams = { + pageNum: 1, + pageSize: 20, + //TODO 重置字段 + }; + this.handleQuery(); + }, + // 多选框选中数据 + handleSelectionChange(selection) { + this.ids = selection.map((item) => item.id); + this.single = selection.length != 1; + this.multiple = !selection.length; + }, + /** 选择每页显示数量*/ + handleSizeChange(val) { + this.queryParams.pageSize = val; + this.queryParams.pageNum = 1; + this.handleQuery(); + }, + /** 搜索按钮操作 */ + handleQuery() { + this.getList(); + }, + /** 新增按钮操作 */ + handleAdd() { + this.reset(); + this.open = true; + this.title = "添加"; + }, + /** 删除按钮操作 */ + handleDelete(row) { + const ids = row.id || this.ids; + delGendemo(ids.toString()).then((res) => { + this.msgSuccess("删除成功"); + this.handleQuery(); + }); + }, + /** 修改按钮操作 */ + handleUpdate(row) { + this.reset(); + const id = row.id || this.ids; + getGendemo(id).then((res) => { + if (res.code == 200) { + this.form = res.data; + this.open = true; + this.title = "修改数据"; + } + }); + }, + beforeFileUpload(file) {}, + //文件上传成功方法 + handleUploadIconSuccess(res, file) { + this.form.icon = URL.createObjectURL(file.raw); + // this.$refs.upload.clearFiles(); + }, + // 用户性别字典翻译 + sexFormat(row, column) { + return this.selectDictLabel(this.sexOptions, row.sex); + }, + + /** 提交按钮 */ + submitForm: function () { + this.$refs["form"].validate((valid) => { + if (valid) { + console.log(JSON.stringify(this.form)); + + if (this.form.id != undefined || this.title === "修改数据") { + updateGendemo(this.form).then((res) => { + this.msgSuccess("修改成功"); + this.open = false; + this.getList(); + }); + } else { + addGendemo(this.form).then((res) => { + this.msgSuccess("新增成功"); + this.open = false; + this.getList(); + }); + } + } + }); + }, + }, +}; + + diff --git a/ZR.Vue/src/views/tool/gen/index.vue b/ZR.Vue/src/views/tool/gen/index.vue index 65df6aa..bb3990a 100644 --- a/ZR.Vue/src/views/tool/gen/index.vue +++ b/ZR.Vue/src/views/tool/gen/index.vue @@ -35,11 +35,7 @@ @@ -120,7 +116,7 @@ export default { // 选中的表 tableIds: [], // 非多个禁用 - multiple: true + multiple: true, }; }, created() { @@ -206,21 +202,6 @@ export default { } }); }, - /** - * 选择每页显示数量 - */ - // handleSizeChange(val) { - // this.pagination.pagesize = val; - // this.pagination.pageNum = 1; - // this.loadTableData(); - // }, - /** - * 选择当页面 - */ - // handleCurrentChange(val) { - // this.pagination.pageNum = val; - // this.loadTableData(); - // }, cancel() { this.showGenerate = false; this.currentSelected = {}; @@ -231,18 +212,31 @@ export default { }, handleDelete(row) { const tableIds = row.tableId || this.tableIds; - delTable(tableIds.toString()).then(res => { - if (res.code == 200) { - this.msgSuccess('删除成功') - - this.handleSearch(); - } + this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", }) + .then(() => { + delTable(tableIds.toString()).then((res) => { + if (res.code == 200) { + this.msgSuccess("删除成功"); + + this.handleSearch(); + } + }); + }) + .catch(() => { + this.$message({ + type: "info", + message: "已取消删除", + }); + }); }, handleSelectionChange(section) { this.tableIds = section.map((item) => item.tableId); this.multiple = !section.length; - console.log(this.tableIds) + console.log(this.tableIds); }, }, }; diff --git a/ZRAdmin.xml b/ZRAdmin.xml index 0c37c99..205fd24 100644 --- a/ZRAdmin.xml +++ b/ZRAdmin.xml @@ -27,44 +27,44 @@ - + 代码自动生成 - + - 用户信息接口 + 代码生成测试表接口 - + - 查询用户信息列表 + 查询代码生成测试表列表 - + - 查询用户信息详情 + 查询代码生成测试表详情 - + - + - 添加用户信息 + 添加代码生成测试表 - + - 更新用户信息 + 更新代码生成测试表 - + - 删除用户信息 + 删除代码生成测试表