diff --git a/src/main/resources/modules/SpringBoot/resources/templates/control/nav.ftl b/src/main/resources/modules/SpringBoot/resources/templates/control/nav.ftl index fd5fed23..1b46adca 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/control/nav.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/control/nav.ftl @@ -731,5 +731,62 @@ ' filterable ' + ' :placeholder="placeholder">' + '' - }) + }); + //下拉按钮 + Vue.component('wb-dropdown', { + data: function () { + return { + items: [] + } + }, + props: { + size: { + type: String, + default: 'small' + }, + type: { + type: String, + default: 'primary' + }, + splitButton: { + type: Boolean, + default: true + }, + }, + methods: { + input: function (value) { + this.$emit('input', value[value.length - 1]); + }, + onCommand: function (index) { + if (this.items[index].click) { + this.items[index].click(); + } + } + }, + created: function () { + for (var i = 0; i < this.$slots.default.length; i++) { + var tag = this.$slots.default[i]; + if (tag.tag === 'wb-dropdown-item') { + this.items.push({ + value: tag.data.attrs ? tag.data.attrs['value'] : "", + icon: tag.data.attrs ? tag.data.attrs['icon'] : "", + click: tag.data.on ? tag.data.on['click'] : undefined + }) + } + } + }, + template: '' + + '{{items[0].value}}' + + ' ' + + ' ' + + ' {{item.value}}' + + ' ' + + ' ' + + '' + }); \ No newline at end of file diff --git a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/mgr.ftl b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/mgr.ftl index 38e90ae6..ec87250d 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/mgr.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/mgr.ftl @@ -144,14 +144,10 @@ width="120" label="操作"> @@ -300,29 +296,39 @@ }, - onCommand: function (arg) { - const cmd = arg[0]; - const item = arg[1]; - switch (cmd) { - case "edit": - this.form.title = "${table.tableComment?default("")}编辑"; - this.form.dialog = true; - this.form.id = item.id; + onEdit: function (item) { + this.form.title = "${table.tableComment?default("")}编辑"; + this.form.dialog = true; + this.form.id = item.id; <#list fields as item> <#if !item.isSystem> - this.form.${item.getFName()} = item.${item.getFName()}; + this.form.${item.getFName()} = item.${item.getFName()}; - this.form.rowVersion = item.rowVersion; - break; - case "delete": - this.onDelete(item); - break; - default: - nav.w("未找到对应的命令"); - break; - } + this.form.rowVersion = item.rowVersion; }, + onDelete: function (item) { + this.$confirm('将删除该项, 是否继续?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(function () { + new Ajax() + .module(this.module) + .target(this.target) + .data({id: item.id}) + .delete(function (response) { + if (response.errors.length > 0) { + nav.e(response.errors[0].message); + } else { + nav.s("删除成功"); + this.onFind(); + } + }.bind(this)) + }.bind(this)).catch(function (action) { + + }); + } }, mounted: function () { this.onFind(); diff --git a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/dept.ftl b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/dept.ftl index d2cab2a1..51c350b4 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/dept.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/dept.ftl @@ -85,8 +85,8 @@ width="80" label="是否有效"> @@ -301,6 +297,38 @@ this.form.deptAlias = ""; this.form.valid = true; }, + onEdit: function (item) { + this.form.title = "部门编辑"; + this.form.dialog = true; + this.form.id = item.id; + this.form.deptCode = item.deptCode; + this.form.deptName = item.deptName; + this.form.deptAlias = item.deptAlias; + this.form.valid = item.valid; + this.form.rowVersion = item.rowVersion; + }, + onDelete: function (item) { + this.$confirm('将删除该项, 是否继续?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(function () { + new Ajax() + .module(this.module) + .target(this.target) + .data({id: item.id}) + .delete(function (response) { + if (response.errors.length > 0) { + nav.e(response.errors[0].message); + } else { + nav.s("删除成功"); + this.onFind(); + } + }.bind(this)) + }.bind(this)).catch(function (action) { + + }); + }, onTreeCreate: function (pItem) { this.form.title = "部门新增"; this.form.dialog = true; @@ -327,28 +355,6 @@ if (!value) return true; return data.deptName.indexOf(value) !== -1; }, - onCommand: function (arg) { - const cmd = arg[0]; - const item = arg[1]; - switch (cmd) { - case "edit": - this.form.title = "部门编辑"; - this.form.dialog = true; - this.form.id = item.id; - this.form.deptCode = item.deptCode; - this.form.deptName = item.deptName; - this.form.deptAlias = item.deptAlias; - this.form.valid = item.valid; - this.form.rowVersion = item.rowVersion; - break; - case "delete": - this.onDelete(item); - break; - default: - nav.w("未找到对应的命令"); - break; - } - }, onLoadTree: function () { new Ajax() .module("system") diff --git a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/dict.ftl b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/dict.ftl index bdb2b78e..8dcdb39c 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/dict.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/dict.ftl @@ -72,8 +72,8 @@ width="80" label="是否有效"> @@ -222,37 +218,47 @@ this.form.version = ''; this.form.valid = true; }, - onCommand: function (args) { - const cmd = args[0]; - const item = args[1]; - switch (cmd) { - case "edit": - this.form.title = '字典编辑'; - this.form.dialog = true; - this.form.id = item.id; - this.form.dictName = item.dictName; - this.form.dictComment = item.dictComment; - this.form.version = item.version; - this.form.valid = item.valid; - this.form.rowVersion = item.rowVersion; - break; - case "delete": - this.onDelete(item); - break; - case "view": - if (!parent || !parent.index) { - nav.e("找不到上级页面!"); - } else { - parent.index.addTab({ - title: "字典项管理", - name: "dictItem" + item.dictName, - url: "${context}/system/dictItem.htm?dictName=" + item.dictName - }); - } - break; - default: - nav.w("未找到对应的命令"); - break; + onEdit: function (item) { + this.form.title = '字典编辑'; + this.form.dialog = true; + this.form.id = item.id; + this.form.dictName = item.dictName; + this.form.dictComment = item.dictComment; + this.form.version = item.version; + this.form.valid = item.valid; + this.form.rowVersion = item.rowVersion; + }, + onDelete: function (item) { + this.$confirm('将删除该项, 是否继续?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(function () { + new Ajax() + .module(this.module) + .target(this.target) + .data({id: item.id}) + .delete(function (response) { + if (response.errors.length > 0) { + nav.e(response.errors[0].message); + } else { + nav.s("删除成功"); + this.onFind(); + } + }.bind(this)) + }.bind(this)).catch(function (action) { + + }); + }, + onView: function (item) { + if (!parent || !parent.index) { + nav.e("找不到上级页面!"); + } else { + parent.index.addTab({ + title: "字典项管理", + name: "dictItem" + item.dictName, + url: "${context}/system/dictItem.htm?dictName=" + item.dictName + }); } } }, diff --git a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/dictItem.ftl b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/dictItem.ftl index ac4a11ab..e2181d14 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/dictItem.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/dictItem.ftl @@ -75,8 +75,8 @@ width="80" label="是否有效"> @@ -217,28 +213,38 @@ this.form.sort = this.vm.totalCount + 1; this.form.valid = true; }, - onCommand: function (arg) { - const cmd = arg[0]; - const item = arg[1]; - switch (cmd) { - case "edit": - this.form.title = '字典项编辑'; - this.form.dialog = true; - this.form.id = item.id; - this.form.dictName = item.dictName; - this.form.key = item.key; - this.form.value = item.value; - this.form.sort = item.sort; - this.form.valid = item.valid; - this.form.rowVersion = item.rowVersion; - break; - case "delete": - this.onDelete(item); - break; - default: - nav.w("未找到对应的命令"); - break; - } + onEdit: function (item) { + this.form.title = '字典项编辑'; + this.form.dialog = true; + this.form.id = item.id; + this.form.dictName = item.dictName; + this.form.key = item.key; + this.form.value = item.value; + this.form.sort = item.sort; + this.form.valid = item.valid; + this.form.rowVersion = item.rowVersion; + }, + onDelete: function (item) { + this.$confirm('将删除该项, 是否继续?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(function () { + new Ajax() + .module(this.module) + .target(this.target) + .data({id: item.id}) + .delete(function (response) { + if (response.errors.length > 0) { + nav.e(response.errors[0].message); + } else { + nav.s("删除成功"); + this.onFind(); + } + }.bind(this)) + }.bind(this)).catch(function (action) { + + }); } }, mounted: function () { diff --git a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/file.ftl b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/file.ftl index 052c21fc..36ccf6ee 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/file.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/file.ftl @@ -94,14 +94,10 @@ width="120" label="操作"> @@ -222,31 +218,41 @@ this.form.url = ""; this.form.urlDownload = ""; }, - onCommand: function (arg) { - const cmd = arg[0]; - const item = arg[1]; - switch (cmd) { - case "edit": - this.form.title = "文件编辑"; - this.form.dialog = true; - this.form.id = item.id; - this.form.name = item.name; - this.form.fileType = item.fileType; - this.form.attribute1 = item.attribute1; - this.form.attribute2 = item.attribute2; - this.form.location = item.location; - this.form.url = item.url; - this.form.urlDownload = item.urlDownload; - this.form.rowVersion = item.rowVersion; - break; - case "delete": - this.onDelete(item); - break; - default: - nav.w("未找到对应的命令"); - break; - } + onEdit: function (item) { + this.form.title = "文件编辑"; + this.form.dialog = true; + this.form.id = item.id; + this.form.name = item.name; + this.form.fileType = item.fileType; + this.form.attribute1 = item.attribute1; + this.form.attribute2 = item.attribute2; + this.form.location = item.location; + this.form.url = item.url; + this.form.urlDownload = item.urlDownload; + this.form.rowVersion = item.rowVersion; }, + onDelete: function (item) { + this.$confirm('将删除该项, 是否继续?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(function () { + new Ajax() + .module(this.module) + .target(this.target) + .data({id: item.id}) + .delete(function (response) { + if (response.errors.length > 0) { + nav.e(response.errors[0].message); + } else { + nav.s("删除成功"); + this.onFind(); + } + }.bind(this)) + }.bind(this)).catch(function (action) { + + }); + } }, mounted: function () { this.onFind(); diff --git a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/logErr.ftl b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/logErr.ftl index bd737a68..245c4bc9 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/logErr.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/logErr.ftl @@ -119,14 +119,10 @@ width="120" label="操作"> @@ -187,7 +183,7 @@ vm: {//条件及分页参数 logErrType: "", title: "", - logErrResult: "", + logErrResult: "未处理", attribute1: "", attribute2: "", attribute3: "", @@ -246,31 +242,41 @@ this.form.attribute2 = ""; this.form.attribute3 = ""; }, - onCommand: function (arg) { - const cmd = arg[0]; - const item = arg[1]; - switch (cmd) { - case "edit": - this.form.title = "错误日志编辑"; - this.form.dialog = true; - this.form.id = item.id; - this.form.logErrType = item.logErrType; - this.form.title = item.title; - this.form.content = item.content; - this.form.logErrResult = item.logErrResult; - this.form.attribute1 = item.attribute1; - this.form.attribute2 = item.attribute2; - this.form.attribute3 = item.attribute3; - this.form.rowVersion = item.rowVersion; - break; - case "delete": - this.onDelete(item); - break; - default: - nav.w("未找到对应的命令"); - break; - } - } + onEdit: function (item) { + this.form.title = "错误日志编辑"; + this.form.dialog = true; + this.form.id = item.id; + this.form.logErrType = item.logErrType; + this.form.title = item.title; + this.form.content = item.content; + this.form.logErrResult = item.logErrResult; + this.form.attribute1 = item.attribute1; + this.form.attribute2 = item.attribute2; + this.form.attribute3 = item.attribute3; + this.form.rowVersion = item.rowVersion; + }, + onDelete: function (item) { + this.$confirm('将删除该项, 是否继续?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(function () { + new Ajax() + .module(this.module) + .target(this.target) + .data({id: item.id}) + .delete(function (response) { + if (response.errors.length > 0) { + nav.e(response.errors[0].message); + } else { + nav.s("删除成功"); + this.onFind(); + } + }.bind(this)) + }.bind(this)).catch(function (action) { + + }); + }, }, mounted: function () { this.onFind(); diff --git a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/res.ftl b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/res.ftl index dbdbd62b..37b6020c 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/res.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/res.ftl @@ -81,8 +81,8 @@ label="是否有效" width="80"> @@ -306,6 +301,39 @@ this.form.resValue = ""; this.form.valid = true; }, + onEdit: function (item) { + this.form.title = "资源编辑"; + this.form.dialog = true; + this.form.id = item.id; + this.form.resCode = item.resCode; + this.form.resName = item.resName; + this.form.resType = item.resType; + this.form.resValue = item.resValue; + this.form.valid = item.valid; + this.form.rowVersion = item.rowVersion; + }, + onDelete: function (item) { + this.$confirm('将删除该项, 是否继续?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(function () { + new Ajax() + .module(this.module) + .target(this.target) + .data({id: item.id}) + .delete(function (response) { + if (response.errors.length > 0) { + nav.e(response.errors[0].message); + } else { + nav.s("删除成功"); + this.onFind(); + } + }.bind(this)) + }.bind(this)).catch(function (action) { + + }); + }, onTreeCreate: function (pItem) { this.form.title = "资源新增"; this.form.dialog = true; @@ -334,29 +362,6 @@ if (!value) return true; return data.comment.indexOf(value) !== -1; }, - onCommand: function (arg) { - const cmd = arg[0]; - const item = arg[1]; - switch (cmd) { - case "edit": - this.form.title = "资源编辑"; - this.form.dialog = true; - this.form.id = item.id; - this.form.resCode = item.resCode; - this.form.resName = item.resName; - this.form.resType = item.resType; - this.form.resValue = item.resValue; - this.form.valid = item.valid; - this.form.rowVersion = item.rowVersion; - break; - case "delete": - this.onDelete(item); - break; - default: - nav.w("未找到对应的命令"); - break; - } - }, onLoadTree: function () { new Ajax() .module("system") diff --git a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/role.ftl b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/role.ftl index 8761a4cd..2c3f8b0c 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/role.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/role.ftl @@ -90,13 +90,11 @@ width="120" label="操作"> @@ -214,48 +212,58 @@ this.form.name = ""; this.form.comment = ""; }, - onCommand: function (arg) { - const cmd = arg[0]; - const item = arg[1]; - switch (cmd) { - case "edit": - this.form.title = "角色编辑"; - this.form.dialog = true; - this.form.id = item.id; - this.form.code = item.code; - this.form.name = item.name; - this.form.comment = item.comment; - this.form.rowVersion = item.rowVersion; - break; - case "resourceEdit": - this.formResource.title = "分配资源"; - this.formResource.dialog = true; - this.formResource.roleId = item.id; - this.formResource.roleCode = item.code; - new Ajax() - .module("system") - .target("roleRes") - .data({roleId: item.id, pageSize: 0}) - .find(function (response) { - if (response.errors.length > 0) { - nav.e(response.errors[0].message); - } else { - this.$refs.tree.setCheckedKeys([]); - var ids = []; - for (var i = 0; i < response.result.length; i++) { - ids.push(response.result[i].resId); - } - this.$refs.tree.setCheckedKeys(ids); - } - }.bind(this)) - break; - case "delete": - this.onDelete(item); - break; - default: - nav.w("未找到对应的命令"); - break; - } + onEdit: function (item) { + this.form.title = "角色编辑"; + this.form.dialog = true; + this.form.id = item.id; + this.form.code = item.code; + this.form.name = item.name; + this.form.comment = item.comment; + this.form.rowVersion = item.rowVersion; + }, + onDelete: function (item) { + this.$confirm('将删除该项, 是否继续?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(function () { + new Ajax() + .module(this.module) + .target(this.target) + .data({id: item.id}) + .delete(function (response) { + if (response.errors.length > 0) { + nav.e(response.errors[0].message); + } else { + nav.s("删除成功"); + this.onFind(); + } + }.bind(this)) + }.bind(this)).catch(function (action) { + + }); + }, + onResEdit: function (item) { + this.formResource.title = "分配资源"; + this.formResource.dialog = true; + this.formResource.roleId = item.id; + this.formResource.roleCode = item.code; + new Ajax() + .module("system") + .target("roleRes") + .data({roleId: item.id, pageSize: 0}) + .find(function (response) { + if (response.errors.length > 0) { + nav.e(response.errors[0].message); + } else { + this.$refs.tree.setCheckedKeys([]); + var ids = []; + for (var i = 0; i < response.result.length; i++) { + ids.push(response.result[i].resId); + } + this.$refs.tree.setCheckedKeys(ids); + } + }.bind(this)) }, onCheck: function (item, status) { new Ajax() diff --git a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/tokens.ftl b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/tokens.ftl index 24f7ec4e..fa3eaf58 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/tokens.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/tokens.ftl @@ -86,8 +86,8 @@ prop="valid" label="是否有效"> @@ -248,41 +243,29 @@ } }, methods: { - onCommand: function (arg) { - const cmd = arg[0]; - const item = arg[1]; - switch (cmd) { - case "delete": - this.onDelete(item); - break; - case "logout": - this.$confirm('将注销该用户的登录信息, 是否继续?', '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning' - }).then(function () { - new Ajax() - .module("system") - .target("tokens") - .method("logout") - .data({token: item.token}) - .post(function (response) { - if (response.errors.length > 0) { - nav.e(response.errors[0].message); - } else { - nav.s("注销成功"); - this.onFind(); - } - }.bind(this)) - }.bind(this)).catch(function (action) { + onLogout:function (item) { + this.$confirm('将注销该用户的登录信息, 是否继续?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(function () { + new Ajax() + .module("system") + .target("tokens") + .method("logout") + .data({token: item.token}) + .post(function (response) { + if (response.errors.length > 0) { + nav.e(response.errors[0].message); + } else { + nav.s("注销成功"); + this.onFind(); + } + }.bind(this)) + }.bind(this)).catch(function (action) { - }); - break; - default: - nav.w("未找到对应的命令"); - break; - } - }, + }); + } }, mounted: function () { this.onFind(); diff --git a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/user.ftl b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/user.ftl index 3388f65f..b6c1f50e 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/user.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/user.ftl @@ -95,8 +95,8 @@ prop="userStatus" label="用户状态"> @@ -249,32 +245,42 @@ this.form.deptCode = ""; this.form.deptName = ""; }, - onCommand: function (arg) { - const cmd = arg[0]; - const item = arg[1]; - switch (cmd) { - case "edit": - this.form.title = "用户编辑"; - this.form.dialog = true; - this.form.id = item.id; - this.form.userName = item.userName; - this.form.userCode = item.userCode; - this.form.userAlias = item.userAlias; - this.form.userPwd = item.userPwd; - this.form.userStatus = item.userStatus; - this.form.deptId = item.deptId; - this.form.deptCode = item.deptCode; - this.form.deptName = item.deptName; - this.form.roleCodeList = item.roleCodes.split(",") - this.form.rowVersion = item.rowVersion; - break; - case "delete": - this.onDelete(item); - break; - default: - nav.w("未找到对应的命令"); - break; - } + onEdit: function (item) { + this.form.title = "用户编辑"; + this.form.dialog = true; + this.form.id = item.id; + this.form.userName = item.userName; + this.form.userCode = item.userCode; + this.form.userAlias = item.userAlias; + this.form.userPwd = item.userPwd; + this.form.userStatus = item.userStatus; + this.form.deptId = item.deptId; + this.form.deptCode = item.deptCode; + this.form.deptName = item.deptName; + this.form.roleCodeList = item.roleCodes.split(",") + this.form.rowVersion = item.rowVersion; + }, + onDelete: function (item) { + this.$confirm('将删除该项, 是否继续?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(function () { + new Ajax() + .module(this.module) + .target(this.target) + .data({id: item.id}) + .delete(function (response) { + if (response.errors.length > 0) { + nav.e(response.errors[0].message); + } else { + nav.s("删除成功"); + this.onFind(); + } + }.bind(this)) + }.bind(this)).catch(function (action) { + + }); }, loadRoles: function () { new Ajax() @@ -298,6 +304,6 @@ mounted: function () { this.onFind(); this.loadRoles(); - }, + } })