提交 06e256ca 编写于 作者: ibizdev's avatar ibizdev

labxiekai 部署微服务应用

上级 b73dd11d
......@@ -24,24 +24,24 @@
"viewtag": "12f53853382743f095a6af867669d8c1"
},
"sysappeditview": {
"title": "应用编辑视图",
"caption": "应用",
"title": "接入应用",
"caption": "接入应用",
"viewtype": "DEEDITVIEW",
"viewmodule": "uaa",
"viewname": "SysAppEditView",
"viewtag": "137b8f036994965b8926455611848134"
},
"sys_rolepickupgridview": {
"sysrolepickupgridview": {
"title": "角色选择表格视图",
"caption": "系统角色",
"viewtype": "DEPICKUPGRIDVIEW",
"viewmodule": "uaa",
"viewname": "SYS_ROLEPickupGridView",
"viewname": "SysRolePickupGridView",
"viewtag": "1a3413067ee48ab30691eab9f345f517"
},
"sysuserroleeditview": {
"title": "用户角色关系表编辑视图",
"caption": "用户角色关系",
"title": "用户",
"caption": "用户",
"viewtype": "DEEDITVIEW",
"viewmodule": "uaa",
"viewname": "SysUserRoleEditView",
......@@ -71,12 +71,12 @@
"viewname": "SYS_USER_ROLEPickupGridView",
"viewtag": "320dc0d5f5dc15c74cdfe3dbb820d2ac"
},
"sys_role_permissionmpickupview": {
"sysrolepermissionmpickupview": {
"title": "角色权限关系表数据多项选择视图",
"caption": "角色权限关系",
"viewtype": "DEMPICKUPVIEW",
"viewmodule": "uaa",
"viewname": "SYS_ROLE_PERMISSIONMPickupView",
"viewname": "SysRolePermissionMPickupView",
"viewtag": "3e133a839b837d9e47f80e161d66a861"
},
"sys_permissiongridview": {
......@@ -87,20 +87,20 @@
"viewname": "SYS_PERMISSIONGridView",
"viewtag": "42f3fa04c9dc77f235207bcbe6ac3888"
},
"sys_roleeditview2": {
"title": "角色编辑视图",
"caption": "系统角色",
"sysroleeditview2": {
"title": "角色",
"caption": "角色",
"viewtype": "DEEDITVIEW2",
"viewmodule": "uaa",
"viewname": "SYS_ROLEEditView2",
"viewname": "SysRoleEditView2",
"viewtag": "4470edcdb57a14007444c0d9867e571c"
},
"sys_role_permissionredirectview": {
"sysrolepermissionredirectview": {
"title": "角色权限关系表数据重定向视图",
"caption": "角色权限关系",
"viewtype": "DEREDIRECTVIEW",
"viewmodule": "uaa",
"viewname": "SYS_ROLE_PERMISSIONRedirectView",
"viewname": "SysRolePermissionRedirectView",
"viewtag": "47fb02384b5797f4b095e247619515f4"
},
"sysrolepermissiongridview": {
......@@ -119,20 +119,20 @@
"viewname": "SYS_ROLE_PERMISSIONPickupGridView",
"viewtag": "6baae51f242438b90446176f76405183"
},
"sys_role_permissionpickupview": {
"sysrolepermissionpickupview": {
"title": "角色权限关系表数据选择视图",
"caption": "角色权限关系",
"viewtype": "DEPICKUPVIEW",
"viewmodule": "uaa",
"viewname": "SYS_ROLE_PERMISSIONPickupView",
"viewname": "SysRolePermissionPickupView",
"viewtag": "6cd33d562ef19ad47dd26b312b9a020e"
},
"sys_roleeditview": {
"title": "角色编辑视图",
"caption": "系统角色",
"sysroleeditview": {
"title": "角色",
"caption": "角色",
"viewtype": "DEEDITVIEW",
"viewmodule": "uaa",
"viewname": "SYS_ROLEEditView",
"viewname": "SysRoleEditView",
"viewtag": "6f5a41631520da5e33294a1225101e66"
},
"sys_userredirectview": {
......@@ -199,12 +199,12 @@
"viewname": "SYS_USERPickupGridView",
"viewtag": "936880f60b6ef17d39d5248b5fe390b4"
},
"sys_usereditview": {
"title": "用户表编辑视图",
"caption": "系统用户",
"sysusereditview": {
"title": "用户",
"caption": "用户",
"viewtype": "DEEDITVIEW",
"viewmodule": "uaa",
"viewname": "SYS_USEREditView",
"viewname": "SysUserEditView",
"viewtag": "9a896aa77c214ed87ab9be4fd6c6bec5"
},
"sys_permissionpickupgridview": {
......@@ -279,12 +279,12 @@
"viewname": "SYS_USERPickupView",
"viewtag": "d53cb0ce933245fae5f0623bac4fbf48"
},
"sys_role_permissioncustomview": {
"sysrolepermissioncustomview": {
"title": "角色权限关系自定义视图",
"caption": "角色权限关系",
"viewtype": "DECUSTOMVIEW",
"viewmodule": "uaa",
"viewname": "SYS_ROLE_PERMISSIONCustomView",
"viewname": "SysRolePermissionCustomView",
"viewtag": "e791be173ed0f4bbe9cce942b6edde63"
},
"sys_permissioneditview": {
......@@ -295,12 +295,12 @@
"viewname": "SYS_PERMISSIONEditView",
"viewtag": "eb6498ba353f58d0af17bbd39702ccf7"
},
"sys_user_roleeditview2": {
"title": "用户角色关系表编辑视图",
"caption": "用户角色关系",
"sysuserroleeditview2": {
"title": "用户",
"caption": "用户",
"viewtype": "DEEDITVIEW2",
"viewmodule": "uaa",
"viewname": "SYS_USER_ROLEEditView2",
"viewname": "SysUserRoleEditView2",
"viewtag": "ede089b4741590173bd21b9df99c1cf0"
},
"sys_user_rolepickupview": {
......
......@@ -16,6 +16,7 @@ export default {
success: "Success",
ok: "OK",
cancel: "Cancel",
save: "Save",
codeNotExist: 'Code list does not exist',
reqException: "Request exception",
sysException: "System abnormality",
......@@ -187,6 +188,17 @@ export default {
quarter: "Quarter",
year: "Year",
},
searchFrom: {
notConfig: {
loadAction: "View search form loadAction parameter is not configured",
loaddraftAction: "View search form loaddraftAction parameter is not configured",
},
},
wizardPanel: {
back: "Back",
next: "Next",
complete: "Complete",
},
},
entities: {
sysauthlog: sysauthlog_en_US,
......
......@@ -16,6 +16,7 @@ export default {
success: "成功",
ok: "确认",
cancel: "取消",
save: "保存",
codeNotExist: "代码表不存在",
reqException: "请求异常",
sysException: "系统异常",
......@@ -186,6 +187,17 @@ export default {
quarter: "季度",
year: "年",
},
searchFrom: {
notConfig: {
loadAction: "视图搜索表单loadAction参数未配置",
loaddraftAction: "视图搜索表单loaddraftAction参数未配置",
},
},
wizardPanel: {
back: "上一步",
next: "下一步",
complete: "完成",
},
},
entities: {
sysauthlog: sysauthlog_zh_CN,
......
......@@ -13,8 +13,8 @@ export default {
},
views: {
editview: {
caption: "应用",
title: "应用编辑视图",
caption: "接入应用",
title: "接入应用",
},
gridview: {
caption: "接入应用",
......
......@@ -12,8 +12,8 @@ export default {
},
views: {
editview: {
caption: "应用",
title: "应用编辑视图",
caption: "接入应用",
title: "接入应用",
},
gridview: {
caption: "接入应用",
......
......@@ -13,12 +13,12 @@ export default {
title: "角色选择表格视图",
},
editview2: {
caption: "系统角色",
title: "角色编辑视图",
caption: "角色",
title: "角色",
},
editview: {
caption: "系统角色",
title: "角色编辑视图",
caption: "角色",
title: "角色",
},
pickupview: {
caption: "系统角色",
......
......@@ -12,12 +12,12 @@ export default {
title: "角色选择表格视图",
},
editview2: {
caption: "系统角色",
title: "角色编辑视图",
caption: "角色",
title: "角色",
},
editview: {
caption: "系统角色",
title: "角色编辑视图",
caption: "角色",
title: "角色",
},
pickupview: {
caption: "系统角色",
......
......@@ -18,8 +18,8 @@ export default {
title: "用户角色关系表数据重定向视图",
},
editview: {
caption: "用户角色关系",
title: "用户角色关系表编辑视图",
caption: "用户",
title: "用户",
},
pickupgridview: {
caption: "用户角色关系",
......@@ -30,8 +30,8 @@ export default {
title: "用户角色关系表数据多项选择视图",
},
editview2: {
caption: "用户角色关系",
title: "用户角色关系表编辑视图",
caption: "用户",
title: "用户",
},
pickupview: {
caption: "用户角色关系",
......
......@@ -17,8 +17,8 @@ export default {
title: "用户角色关系表数据重定向视图",
},
editview: {
caption: "用户角色关系",
title: "用户角色关系表编辑视图",
caption: "用户",
title: "用户",
},
pickupgridview: {
caption: "用户角色关系",
......@@ -29,8 +29,8 @@ export default {
title: "用户角色关系表数据多项选择视图",
},
editview2: {
caption: "用户角色关系",
title: "用户角色关系表编辑视图",
caption: "用户",
title: "用户",
},
pickupview: {
caption: "用户角色关系",
......
......@@ -52,8 +52,8 @@ export default {
title: "用户表选择表格视图",
},
editview: {
caption: "系统用户",
title: "用户表编辑视图",
caption: "用户",
title: "用户",
},
gridview: {
caption: "用户",
......
......@@ -51,8 +51,8 @@ export default {
title: "用户表选择表格视图",
},
editview: {
caption: "系统用户",
title: "用户表编辑视图",
caption: "用户",
title: "用户",
},
gridview: {
caption: "用户",
......
......@@ -32,24 +32,24 @@ mock.onGet('./assets/json/view-config.json').reply((config: any) => {
"viewtag": "12f53853382743f095a6af867669d8c1"
},
"sysappeditview": {
"title": "应用编辑视图",
"caption": "应用",
"title": "接入应用",
"caption": "接入应用",
"viewtype": "DEEDITVIEW",
"viewmodule": "uaa",
"viewname": "SysAppEditView",
"viewtag": "137b8f036994965b8926455611848134"
},
"sys_rolepickupgridview": {
"sysrolepickupgridview": {
"title": "角色选择表格视图",
"caption": "系统角色",
"viewtype": "DEPICKUPGRIDVIEW",
"viewmodule": "uaa",
"viewname": "SYS_ROLEPickupGridView",
"viewname": "SysRolePickupGridView",
"viewtag": "1a3413067ee48ab30691eab9f345f517"
},
"sysuserroleeditview": {
"title": "用户角色关系表编辑视图",
"caption": "用户角色关系",
"title": "用户",
"caption": "用户",
"viewtype": "DEEDITVIEW",
"viewmodule": "uaa",
"viewname": "SysUserRoleEditView",
......@@ -79,12 +79,12 @@ mock.onGet('./assets/json/view-config.json').reply((config: any) => {
"viewname": "SYS_USER_ROLEPickupGridView",
"viewtag": "320dc0d5f5dc15c74cdfe3dbb820d2ac"
},
"sys_role_permissionmpickupview": {
"sysrolepermissionmpickupview": {
"title": "角色权限关系表数据多项选择视图",
"caption": "角色权限关系",
"viewtype": "DEMPICKUPVIEW",
"viewmodule": "uaa",
"viewname": "SYS_ROLE_PERMISSIONMPickupView",
"viewname": "SysRolePermissionMPickupView",
"viewtag": "3e133a839b837d9e47f80e161d66a861"
},
"sys_permissiongridview": {
......@@ -95,20 +95,20 @@ mock.onGet('./assets/json/view-config.json').reply((config: any) => {
"viewname": "SYS_PERMISSIONGridView",
"viewtag": "42f3fa04c9dc77f235207bcbe6ac3888"
},
"sys_roleeditview2": {
"title": "角色编辑视图",
"caption": "系统角色",
"sysroleeditview2": {
"title": "角色",
"caption": "角色",
"viewtype": "DEEDITVIEW2",
"viewmodule": "uaa",
"viewname": "SYS_ROLEEditView2",
"viewname": "SysRoleEditView2",
"viewtag": "4470edcdb57a14007444c0d9867e571c"
},
"sys_role_permissionredirectview": {
"sysrolepermissionredirectview": {
"title": "角色权限关系表数据重定向视图",
"caption": "角色权限关系",
"viewtype": "DEREDIRECTVIEW",
"viewmodule": "uaa",
"viewname": "SYS_ROLE_PERMISSIONRedirectView",
"viewname": "SysRolePermissionRedirectView",
"viewtag": "47fb02384b5797f4b095e247619515f4"
},
"sysrolepermissiongridview": {
......@@ -127,20 +127,20 @@ mock.onGet('./assets/json/view-config.json').reply((config: any) => {
"viewname": "SYS_ROLE_PERMISSIONPickupGridView",
"viewtag": "6baae51f242438b90446176f76405183"
},
"sys_role_permissionpickupview": {
"sysrolepermissionpickupview": {
"title": "角色权限关系表数据选择视图",
"caption": "角色权限关系",
"viewtype": "DEPICKUPVIEW",
"viewmodule": "uaa",
"viewname": "SYS_ROLE_PERMISSIONPickupView",
"viewname": "SysRolePermissionPickupView",
"viewtag": "6cd33d562ef19ad47dd26b312b9a020e"
},
"sys_roleeditview": {
"title": "角色编辑视图",
"caption": "系统角色",
"sysroleeditview": {
"title": "角色",
"caption": "角色",
"viewtype": "DEEDITVIEW",
"viewmodule": "uaa",
"viewname": "SYS_ROLEEditView",
"viewname": "SysRoleEditView",
"viewtag": "6f5a41631520da5e33294a1225101e66"
},
"sys_userredirectview": {
......@@ -207,12 +207,12 @@ mock.onGet('./assets/json/view-config.json').reply((config: any) => {
"viewname": "SYS_USERPickupGridView",
"viewtag": "936880f60b6ef17d39d5248b5fe390b4"
},
"sys_usereditview": {
"title": "用户表编辑视图",
"caption": "系统用户",
"sysusereditview": {
"title": "用户",
"caption": "用户",
"viewtype": "DEEDITVIEW",
"viewmodule": "uaa",
"viewname": "SYS_USEREditView",
"viewname": "SysUserEditView",
"viewtag": "9a896aa77c214ed87ab9be4fd6c6bec5"
},
"sys_permissionpickupgridview": {
......@@ -287,12 +287,12 @@ mock.onGet('./assets/json/view-config.json').reply((config: any) => {
"viewname": "SYS_USERPickupView",
"viewtag": "d53cb0ce933245fae5f0623bac4fbf48"
},
"sys_role_permissioncustomview": {
"sysrolepermissioncustomview": {
"title": "角色权限关系自定义视图",
"caption": "角色权限关系",
"viewtype": "DECUSTOMVIEW",
"viewmodule": "uaa",
"viewname": "SYS_ROLE_PERMISSIONCustomView",
"viewname": "SysRolePermissionCustomView",
"viewtag": "e791be173ed0f4bbe9cce942b6edde63"
},
"sys_permissioneditview": {
......@@ -303,12 +303,12 @@ mock.onGet('./assets/json/view-config.json').reply((config: any) => {
"viewname": "SYS_PERMISSIONEditView",
"viewtag": "eb6498ba353f58d0af17bbd39702ccf7"
},
"sys_user_roleeditview2": {
"title": "用户角色关系表编辑视图",
"caption": "用户角色关系",
"sysuserroleeditview2": {
"title": "用户",
"caption": "用户",
"viewtype": "DEEDITVIEW2",
"viewmodule": "uaa",
"viewname": "SYS_USER_ROLEEditView2",
"viewname": "SysUserRoleEditView2",
"viewtag": "ede089b4741590173bd21b9df99c1cf0"
},
"sys_user_rolepickupview": {
......
......@@ -4,17 +4,17 @@ export const PageComponents = {
Vue.component('sys-rolepickup-view', () => import('@pages/uaa/sys-rolepickup-view/sys-rolepickup-view.vue'));
Vue.component('sys-app-edit-view', () => import('@pages/uaa/sys-app-edit-view/sys-app-edit-view.vue'));
Vue.component('sys-usermpickup-view', () => import('@pages/uaa/sys-usermpickup-view/sys-usermpickup-view.vue'));
Vue.component('sys-role-permissioncustom-view', () => import('@pages/uaa/sys-role-permissioncustom-view/sys-role-permissioncustom-view.vue'));
Vue.component('sys-role-permission-custom-view', () => import('@pages/uaa/sys-role-permission-custom-view/sys-role-permission-custom-view.vue'));
Vue.component('sys-userpickup-grid-view', () => import('@pages/uaa/sys-userpickup-grid-view/sys-userpickup-grid-view.vue'));
Vue.component('sys-roleedit-view', () => import('@pages/uaa/sys-roleedit-view/sys-roleedit-view.vue'));
Vue.component('sys-role-edit-view', () => import('@pages/uaa/sys-role-edit-view/sys-role-edit-view.vue'));
Vue.component('sys-user-role-edit-view', () => import('@pages/uaa/sys-user-role-edit-view/sys-user-role-edit-view.vue'));
Vue.component('sys-rolempickup-view', () => import('@pages/uaa/sys-rolempickup-view/sys-rolempickup-view.vue'));
Vue.component('sys-auth-log-grid-view', () => import('@pages/uaa/sys-auth-log-grid-view/sys-auth-log-grid-view.vue'));
Vue.component('sys-userpickup-view', () => import('@pages/uaa/sys-userpickup-view/sys-userpickup-view.vue'));
Vue.component('sys-role-grid-view', () => import('@pages/uaa/sys-role-grid-view/sys-role-grid-view.vue'));
Vue.component('sys-useredit-view', () => import('@pages/uaa/sys-useredit-view/sys-useredit-view.vue'));
Vue.component('sys-user-edit-view', () => import('@pages/uaa/sys-user-edit-view/sys-user-edit-view.vue'));
Vue.component('sys-user-rolegrid-view', () => import('@pages/uaa/sys-user-rolegrid-view/sys-user-rolegrid-view.vue'));
Vue.component('sys-rolepickup-grid-view', () => import('@pages/uaa/sys-rolepickup-grid-view/sys-rolepickup-grid-view.vue'));
Vue.component('sys-role-pickup-grid-view', () => import('@pages/uaa/sys-role-pickup-grid-view/sys-role-pickup-grid-view.vue'));
Vue.component('sys-user-grid-view', () => import('@pages/uaa/sys-user-grid-view/sys-user-grid-view.vue'));
}
};
\ No newline at end of file
......@@ -104,7 +104,7 @@ const router = new Router({
],
requireAuth: true,
},
component: () => import('@pages/uaa/sys-role-permissioncustom-view/sys-role-permissioncustom-view.vue'),
component: () => import('@pages/uaa/sys-role-permission-custom-view/sys-role-permission-custom-view.vue'),
},
{
path: 'syspermissions/:syspermission?/sysrolepermissions/:sysrolepermission?/customview/:customview?',
......@@ -119,7 +119,7 @@ const router = new Router({
],
requireAuth: true,
},
component: () => import('@pages/uaa/sys-role-permissioncustom-view/sys-role-permissioncustom-view.vue'),
component: () => import('@pages/uaa/sys-role-permission-custom-view/sys-role-permission-custom-view.vue'),
},
{
path: 'sysrolepermissions/:sysrolepermission?/customview/:customview?',
......@@ -133,7 +133,7 @@ const router = new Router({
],
requireAuth: true,
},
component: () => import('@pages/uaa/sys-role-permissioncustom-view/sys-role-permissioncustom-view.vue'),
component: () => import('@pages/uaa/sys-role-permission-custom-view/sys-role-permission-custom-view.vue'),
},
{
path: 'sysusers/:sysuser?/pickupgridview/:pickupgridview?',
......@@ -161,7 +161,7 @@ const router = new Router({
],
requireAuth: true,
},
component: () => import('@pages/uaa/sys-roleedit-view/sys-roleedit-view.vue'),
component: () => import('@pages/uaa/sys-role-edit-view/sys-role-edit-view.vue'),
},
{
path: 'sysusers/:sysuser?/sysuserroles/:sysuserrole?/editview/:editview?',
......@@ -275,7 +275,7 @@ const router = new Router({
],
requireAuth: true,
},
component: () => import('@pages/uaa/sys-useredit-view/sys-useredit-view.vue'),
component: () => import('@pages/uaa/sys-user-edit-view/sys-user-edit-view.vue'),
},
{
path: 'sysusers/:sysuser?/sysuserroles/:sysuserrole?/gridview/:gridview?',
......@@ -333,7 +333,7 @@ const router = new Router({
],
requireAuth: true,
},
component: () => import('@pages/uaa/sys-rolepickup-grid-view/sys-rolepickup-grid-view.vue'),
component: () => import('@pages/uaa/sys-role-pickup-grid-view/sys-role-pickup-grid-view.vue'),
},
{
path: 'sysusers/:sysuser?/gridview/:gridview?',
......@@ -362,16 +362,16 @@ const router = new Router({
component: () => import('@pages/uaa/sys-user-roleredirect-view/sys-user-roleredirect-view.vue'),
},
{
path: 'sys_role_permissionredirectview/:sys_role_permissionredirectview?',
path: 'sysrolepermissionredirectview/:sysrolepermissionredirectview?',
meta: {
caption: 'entities.sysrolepermission.views.redirectview.title',
info:'',
parameters: [
{ pathName: 'sys_role_permissionredirectview', parameterName: 'sys_role_permissionredirectview' },
{ pathName: 'sysrolepermissionredirectview', parameterName: 'sysrolepermissionredirectview' },
],
requireAuth: true,
},
component: () => import('@pages/uaa/sys-role-permissionredirect-view/sys-role-permissionredirect-view.vue'),
component: () => import('@pages/uaa/sys-role-permission-redirect-view/sys-role-permission-redirect-view.vue'),
},
{
path: 'sys_userredirectview/:sys_userredirectview?',
......@@ -449,7 +449,7 @@ const router = new Router({
],
requireAuth: true,
},
component: () => import('@pages/uaa/sys-rolepickup-grid-view/sys-rolepickup-grid-view.vue'),
component: () => import('@pages/uaa/sys-role-pickup-grid-view/sys-role-pickup-grid-view.vue'),
},
{
path: '/sysusers/:sysuser?/sysuserroles/:sysuserrole?/editview/:editview?',
......@@ -516,7 +516,7 @@ const router = new Router({
],
requireAuth: true,
},
component: () => import('@pages/uaa/sys-roleedit-view/sys-roleedit-view.vue'),
component: () => import('@pages/uaa/sys-role-edit-view/sys-role-edit-view.vue'),
},
{
path: '/sysroles/:sysrole?/pickupview/:pickupview?',
......@@ -555,7 +555,7 @@ const router = new Router({
],
requireAuth: true,
},
component: () => import('@pages/uaa/sys-useredit-view/sys-useredit-view.vue'),
component: () => import('@pages/uaa/sys-user-edit-view/sys-user-edit-view.vue'),
},
{
path: '/sysroles/:sysrole?/gridview/:gridview?',
......@@ -634,7 +634,7 @@ const router = new Router({
],
requireAuth: true,
},
component: () => import('@pages/uaa/sys-role-permissioncustom-view/sys-role-permissioncustom-view.vue'),
component: () => import('@pages/uaa/sys-role-permission-custom-view/sys-role-permission-custom-view.vue'),
},
{
path: '/syspermissions/:syspermission?/sysrolepermissions/:sysrolepermission?/customview/:customview?',
......@@ -648,7 +648,7 @@ const router = new Router({
],
requireAuth: true,
},
component: () => import('@pages/uaa/sys-role-permissioncustom-view/sys-role-permissioncustom-view.vue'),
component: () => import('@pages/uaa/sys-role-permission-custom-view/sys-role-permission-custom-view.vue'),
},
{
path: '/sysrolepermissions/:sysrolepermission?/customview/:customview?',
......@@ -661,7 +661,7 @@ const router = new Router({
],
requireAuth: true,
},
component: () => import('@pages/uaa/sys-role-permissioncustom-view/sys-role-permissioncustom-view.vue'),
component: () => import('@pages/uaa/sys-role-permission-custom-view/sys-role-permission-custom-view.vue'),
},
{
path: '/sysusers/:sysuser?/sysuserroles/:sysuserrole?/gridview/:gridview?',
......
<template>
<div class="view-container deeditview sys-role-edit-view">
<app-studioaction :viewTitle="$t(model.srfTitle)" viewName="sysroleeditview"></app-studioaction>
<card class='view-card ' :disHover="true" :bordered="false">
<div slot='title' class="header-container">
<span class='caption-info'>{{$t(model.srfTitle)}}</span>
<div class='toolbar-container'>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem3.visabled" :disabled="toolBarModels.tbitem3.disabled" class='' @click="toolbar_click({ tag: 'tbitem3' }, $event)">
<i class='fa fa-save'></i>
<span class='caption'>{{$t('entities.sysrole.editviewtoolbar_toolbar.tbitem3.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.sysrole.editviewtoolbar_toolbar.tbitem3.tip')}}</div>
</tooltip>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem5.visabled" :disabled="toolBarModels.tbitem5.disabled" class='' @click="toolbar_click({ tag: 'tbitem5' }, $event)">
<i class='sx-tb-saveandclose'></i>
<span class='caption'>{{$t('entities.sysrole.editviewtoolbar_toolbar.tbitem5.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.sysrole.editviewtoolbar_toolbar.tbitem5.tip')}}</div>
</tooltip>
<span class='seperator'>|</span> <tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem12.visabled" :disabled="toolBarModels.tbitem12.disabled" class='' @click="toolbar_click({ tag: 'tbitem12' }, $event)">
<i class='fa fa-file-text-o'></i>
<span class='caption'>{{$t('entities.sysrole.editviewtoolbar_toolbar.tbitem12.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.sysrole.editviewtoolbar_toolbar.tbitem12.tip')}}</div>
</tooltip>
<span class='seperator'>|</span> <tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem14.visabled" :disabled="toolBarModels.tbitem14.disabled" class='' @click="toolbar_click({ tag: 'tbitem14' }, $event)">
<i class='fa fa-copy'></i>
<span class='caption'>{{$t('entities.sysrole.editviewtoolbar_toolbar.tbitem14.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.sysrole.editviewtoolbar_toolbar.tbitem14.tip')}}</div>
</tooltip>
</div>
</div>
<div class="content-container">
<div class='view-top-messages'>
</div>
<view_form
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:autosave="false"
:viewtag="viewtag"
:showBusyIndicator="true"
updateAction="Update"
removeAction="Remove"
loaddraftAction="GetDraft"
loadAction="Get"
createAction="Create"
WFSubmitAction=""
WFStartAction=""
style=''
name="form"
ref='form'
@save="form_save($event)"
@remove="form_remove($event)"
@load="form_load($event)"
@closeview="closeView($event)">
</view_form>
<div class='view-bottom-messages'>
</div>
</div>
</card>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch,Inject } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import NavDataService from '@/service/app/navdata-service';
import { Subject,Subscription } from 'rxjs';
import SysRoleService from '@/service/sys-role/sys-role-service';
import EditViewEngine from '@engine/view/edit-view-engine';
@Component({
components: {
},
})
export default class SysRoleEditViewBase extends Vue {
/**
* 实体服务对象
*
* @type {SysRoleService}
* @memberof SysRoleEditViewBase
*/
public appEntityService: SysRoleService = new SysRoleService;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof SysRoleEditViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof SysRoleEditViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof SysRoleEditViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof SysRoleEditViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof SysRoleEditViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图默认使用
*
* @type {string}
* @memberof SysRoleEditViewBase
*/
@Inject({from:'navModel',default: 'tab'})
public navModel!:string;
/**
* 视图标识
*
* @type {string}
* @memberof SysRoleEditViewBase
*/
public viewtag: string = '6f5a41631520da5e33294a1225101e66';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof SysRoleEditViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof SysRoleEditViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof SysRoleEditViewBase
*/
public model: any = {
srfCaption: 'entities.sysrole.views.editview.caption',
srfTitle: 'entities.sysrole.views.editview.title',
srfSubTitle: 'entities.sysrole.views.editview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof SysRoleEditViewBase
*/
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}
}
/**
* 处理应用上下文变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof SysRoleEditViewBase
*/
@Watch('viewdata')
onViewData(newVal: any, oldVal: any) {
const _this: any = this;
if (!Object.is(newVal, oldVal) && _this.engine) {
this.$nextTick(()=>{
_this.parseViewParam();
_this.engine.load();
});
}
}
/**
* 容器模型
*
* @type {*}
* @memberof SysRoleEditViewBase
*/
public containerModel: any = {
view_toolbar: { name: 'toolbar', type: 'TOOLBAR' },
view_form: { name: 'form', type: 'FORM' },
};
/**
* 计数器刷新
*
* @memberof SysRoleEditViewBase
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 视图状态订阅对象
*
* @public
* @type {Subject<{action: string, data: any}>}
* @memberof SysRoleEditViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 工具栏模型
*
* @type {*}
* @memberof SysRoleEditView
*/
public toolBarModels: any = {
tbitem3: { name: 'tbitem3', caption: '保存', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:'2',dataaccaction: '', uiaction: { tag: 'Save', target: '' } },
tbitem5: { name: 'tbitem5', caption: '保存并关闭', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:'2',dataaccaction: '', uiaction: { tag: 'SaveAndExit', target: '' } },
tbitem6: { name: 'tbitem6', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem12: { name: 'tbitem12', caption: '新建', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:'2',dataaccaction: '', uiaction: { tag: 'New', target: '' } },
tbitem13: { name: 'tbitem13', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem14: { name: 'tbitem14', caption: '拷贝', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:'2',dataaccaction: '', uiaction: { tag: 'Copy', target: 'SINGLEKEY' } },
};
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof SysRoleEditViewBase
*/
public engine: EditViewEngine = new EditViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof SysRoleEditViewBase
*/
public engineInit(): void {
this.engine.init({
view: this,
form: this.$refs.form,
p2k: '0',
keyPSDEField: 'sysrole',
majorPSDEField: 'rolename',
isLoadDefault: true,
});
}
/**
* 应用导航服务
*
* @type {*}
* @memberof SysRoleEditViewBase
*/
public navDataService = NavDataService.getInstance(this.$store);
/**
* 导航服务事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof SysRoleEditViewBase
*/
public serviceStateEvent: Subscription | undefined;
/**
* 应用上下文
*
* @type {*}
* @memberof SysRoleEditViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof SysRoleEditViewBase
*/
public viewparams:any = {};
/**
* 视图缓存数据
*
* @type {*}
* @memberof SysRoleEditViewBase
*/
public viewCacheData:any;
/**
* 解析视图参数
*
* @public
* @memberof SysRoleEditViewBase
*/
public parseViewParam(inputvalue:any = null): void {
for(let key in this.context){
delete this.context[key];
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
Object.assign(this.viewparams,{srfparentdename:this.context.srfparentdename});
}
if(this.context && this.context.srfparentkey){
Object.assign(this.viewparams,{srfparentkey:this.context.srfparentkey});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
this.handleCustomViewData();
return;
}
const path = (this.$route.matched[this.$route.matched.length - 1]).path;
const keys: Array<any> = [];
const curReg = this.$pathToRegExp.pathToRegexp(path, keys);
const matchArray = curReg.exec(this.$route.path);
let tempValue: Object = {};
keys.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item.name, {
enumerable: true,
value: matchArray[index + 1]
});
});
this.$viewTool.formatRouteParams(tempValue,this.$route,this.context,this.viewparams);
if(inputvalue){
Object.assign(this.context,{'sysrole':inputvalue});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
//初始化导航数据
this.initNavDataWithRoute();
}
/**
* 处理自定义视图数据
*
* @memberof SysRoleEditViewBase
*/
public handleCustomViewData(){
if(Object.keys(this.customViewNavContexts).length > 0){
Object.keys(this.customViewNavContexts).forEach((item:any) =>{
let tempContext:any = {};
let curNavContext:any = this.customViewNavContexts[item];
this.handleCustomDataLogic(curNavContext,tempContext,item);
Object.assign(this.context,tempContext);
})
}
if(Object.keys(this.customViewParams).length > 0){
Object.keys(this.customViewParams).forEach((item:any) =>{
let tempParam:any = {};
let curNavParam:any = this.customViewParams[item];
this.handleCustomDataLogic(curNavParam,tempParam,item);
Object.assign(this.viewparams,tempParam);
})
}
}
/**
* 处理自定义视图数据逻辑
*
* @memberof SysRoleEditViewBase
*/
public handleCustomDataLogic(curNavData:any,tempData:any,item:string){
// 直接值直接赋值
if(curNavData.isRawValue){
if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: curNavData.value,
writable : true,
enumerable : true,
configurable : true
});
}
}else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(this.context[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(this.viewparams[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.viewparams[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}
}
}
}
/**
* 初始化导航数据(路由模式)
*
* @memberof SysRoleEditViewBase
*/
public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && Object.is(this.navModel,"route")) ){
this.navDataService.addNavData({id:'sys-role-edit-view',tag:this.viewtag,srfkey:isNew ? null : this.context.sysrole,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath});
}
}
/**
* 初始化导航数据(分页模式)
*
* @memberof SysRoleEditViewBase
*/
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && !Object.is(this.navModel,"route")) ){
this.navDataService.addNavDataByOnly({id:'sys-role-edit-view',tag:this.viewtag,srfkey:this.context.sysrole,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd);
}
}
/**
* Vue声明周期
*
* @memberof SysRoleEditViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof SysRoleEditViewBase
*/
public afterCreated(){
let _this:any = this;
const secondtag = _this.$util.createUUID();
_this.$store.commit('viewaction/createdView', { viewtag: _this.viewtag, secondtag: secondtag });
_this.viewtag = secondtag;
_this.parseViewParam();
_this.serviceStateEvent = _this.navDataService.serviceState.subscribe(({ action,name, data }:{ action:string,name:any,data:any }) => {
if(!Object.is(name,'sys-role-edit-view')){
return;
}
if (Object.is(action, 'viewrefresh')) {
_this.$nextTick(()=>{
_this.parseViewParam(data);
if(_this.engine){
_this.engine.load();
}
});
}
});
}
/**
* 销毁之前
*
* @memberof SysRoleEditViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof SysRoleEditViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof SysRoleEditViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
}
/**
* toolbar 部件 click 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysRoleEditViewBase
*/
public toolbar_click($event: any, $event2?: any) {
if (Object.is($event.tag, 'tbitem3')) {
this.toolbar_tbitem3_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem5')) {
this.toolbar_tbitem5_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem9')) {
this.toolbar_tbitem9_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem10')) {
this.toolbar_tbitem10_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem12')) {
this.toolbar_tbitem12_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem14')) {
this.toolbar_tbitem14_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem15')) {
this.toolbar_tbitem15_click(null, '', $event2);
}
}
/**
* form 部件 save 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysRoleEditViewBase
*/
public form_save($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'save', $event);
}
/**
* form 部件 remove 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysRoleEditViewBase
*/
public form_remove($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'remove', $event);
}
/**
* form 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysRoleEditViewBase
*/
public form_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'load', $event);
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem3_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Save(datas, contextJO,paramJO, $event, xData,this,"SysRole");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem5_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.SaveAndExit(datas, contextJO,paramJO, $event, xData,this,"SysRole");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem9_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.SaveAndStart(datas, contextJO,paramJO, $event, xData,this,"SysRole");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem10_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.ViewWFStep(datas, contextJO,paramJO, $event, xData,this,"SysRole");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem12_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.New(datas, contextJO,paramJO, $event, xData,this,"SysRole");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem14_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Copy(datas, contextJO,paramJO, $event, xData,this,"SysRole");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem15_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Print(datas, contextJO,paramJO, $event, xData,this,"SysRole");
}
/**
* 保存
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysRoleEditViewBase
*/
public Save(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
// 界面行为容器对象 _this
const _this: any = this;
if (xData && xData.save instanceof Function) {
xData.save().then((response: any) => {
if (!response || response.status !== 200) {
return;
}
_this.$emit('viewdataschange', [{ ...response.data }]);
});
} else if (_this.save && _this.save instanceof Function) {
_this.save();
}
}
/**
* 保存并关闭
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysRoleEditViewBase
*/
public SaveAndExit(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (xData && xData.saveAndExit instanceof Function) {
xData.saveAndExit().then((response: any) => {
if (!response || response.status !== 200) {
return;
}
if(window.parent){
window.parent.postMessage([{ ...response.data }],'*');
}
});
} else if (_this.saveAndExit && _this.saveAndExit instanceof Function) {
_this.saveAndExit().then((response: any) => {
if (!response || response.status !== 200) {
return;
}
if(window.parent){
window.parent.postMessage([{ ...response.data }],'*');
}
});
}
}
/**
* 开始流程
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysRoleEditViewBase
*/
public SaveAndStart(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (!xData || !(xData.wfstart instanceof Function)) {
return;
}
xData.wfstart(args).then((response: any) => {
if (!response || response.status !== 200) {
return;
}
const { data: _data } = response;
if(window.parent){
window.parent.postMessage({ ..._data },'*');
}
if (_this.viewdata) {
_this.$emit('viewdataschange', [{ ..._data }]);
_this.$emit('close');
}else if (this.$tabPageExp) {
this.$tabPageExp.onClose(this.$route.fullPath);
}
});
}
/**
* 当前流程步骤
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysRoleEditViewBase
*/
public ViewWFStep(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
let _this:any = this;
if (!xData || !(xData.wfsubmit instanceof Function)) {
return;
}
xData.wfsubmit(args).then((response: any) => {
if (!response || response.status !== 200) {
return;
}
const { data: _data } = response;
if (_this.viewdata) {
_this.$emit('viewdataschange', [{ ..._data }]);
_this.$emit('close');
} else if (_this.$tabPageExp) {
_this.$tabPageExp.onClose(_this.$route.fullPath);
}
});
}
/**
* 新建
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysRoleEditViewBase
*/
public New(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (_this.newdata && _this.newdata instanceof Function) {
const data: any = {};
_this.newdata([{ ...data }],[{ ...data }], params, $event, xData);
} else {
_this.$Notice.error({ title: '错误', desc: 'newdata 视图处理逻辑不存在,请添加!' });
}
}
/**
* 拷贝
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysRoleEditViewBase
*/
public Copy(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
if (args.length === 0) {
return;
}
const _this: any = this;
if (_this.newdata && _this.newdata instanceof Function) {
const data: any = {};
if (args.length > 0) {
Object.assign(data, { srfsourcekey: args[0].srfkey })
actionContext.$store.commit('addCopyData', { srfkey: args[0].srfkey, copyData: args[0] });
}
_this.newdata([{ ...data }],[{ ...data }],params, $event, xData);
} else if (xData && xData.copy instanceof Function) {
if (args.length > 0) {
actionContext.$store.commit('addCopyData', { srfkey: args[0].srfkey, copyData: args[0] });
}
xData.copy(args[0].srfkey);
} else {
_this.$Notice.error({ title: '错误', desc: 'opendata 视图处理逻辑不存在,请添加!' });
}
}
/**
* 打印
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysRoleEditViewBase
*/
public Print(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
let _this:any = this;
if (!xData || !(xData.print instanceof Function) || !$event) {
return ;
}
xData.print();
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof SysRoleEditViewBase
*/
public closeView(args: any[]): void {
let _view: any = this;
if (_view.viewdata) {
_view.$emit('viewdataschange', [args]);
_view.$emit('close', [args]);
} else if (_view.$tabPageExp) {
_view.$tabPageExp.onClose(_view.$route.fullPath);
}
}
/**
* 销毁视图回调
*
* @memberof SysRoleEditViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof SysRoleEditViewBase
*/
public afterDestroyed(){
if(this.viewDefaultUsage){
let localStoreLength = Object.keys(localStorage);
if(localStoreLength.length > 0){
localStoreLength.forEach((item:string) =>{
if(item.startsWith(this.context.srfsessionid)){
localStorage.removeItem(item);
}
})
}
if(Object.is(this.navModel,"tab")){
this.navDataService.removeNavDataByTag(this.viewtag);
}
if (this.serviceStateEvent) {
this.serviceStateEvent.unsubscribe();
}
}
}
}
</script>
<style lang='less'>
@import './sys-role-edit-view.less';
</style>
\ No newline at end of file
.view-card {
>.ivu-card-extra {
top: 5px;
right: 0px;
}
}
.sys-role-edit-view{
position: relative;
}
.toolbar-container {
button {
margin: 6px 0px 4px 4px;
.caption {
margin-left: 4px;
}
}
.seperator {
color: #dcdee2;
margin: 0 0px 0 4px;
}
}
// this is less
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import SysRoleEditViewBase from './sys-role-edit-view-base.vue';
import view_form from '@widgets/sys-role/main-form/main-form.vue';
@Component({
components: {
view_form,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
if(!Object.is(vm.navModel,"route")){
vm.initNavDataWithTab(vm.viewCacheData);
}
vm.$store.commit('addCurPageViewtag', { fullPath: to.fullPath, viewtag: vm.viewtag });
});
},
})
export default class SysRoleEditView extends SysRoleEditViewBase {
}
</script>
\ No newline at end of file
<template>
<div class="view-container deeditview2 sys-role-edit-view2">
<app-studioaction :viewTitle="$t(model.srfTitle)" viewName="sysroleeditview2"></app-studioaction>
<card class='view-card ' :dis-hover="true" :bordered="false">
<div slot='title' class="header-container">
<span class='caption-info'>{{$t(model.srfTitle)}}</span>
<template v-if="Object.is(this.selection.id, 'form')">
<div class='toolbar-container'>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem3.visabled" :disabled="toolBarModels.tbitem3.disabled" class='' @click="toolbar_click({ tag: 'tbitem3' }, $event)">
<i class='fa fa-save'></i>
<span class='caption'>{{$t('entities.sysrole.editview2toolbar_toolbar.tbitem3.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.sysrole.editview2toolbar_toolbar.tbitem3.tip')}}</div>
</tooltip>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem5.visabled" :disabled="toolBarModels.tbitem5.disabled" class='' @click="toolbar_click({ tag: 'tbitem5' }, $event)">
<i class='sx-tb-saveandclose'></i>
<span class='caption'>{{$t('entities.sysrole.editview2toolbar_toolbar.tbitem5.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.sysrole.editview2toolbar_toolbar.tbitem5.tip')}}</div>
</tooltip>
<span class='seperator'>|</span> <tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem12.visabled" :disabled="toolBarModels.tbitem12.disabled" class='' @click="toolbar_click({ tag: 'tbitem12' }, $event)">
<i class='fa fa-file-text-o'></i>
<span class='caption'>{{$t('entities.sysrole.editview2toolbar_toolbar.tbitem12.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.sysrole.editview2toolbar_toolbar.tbitem12.tip')}}</div>
</tooltip>
<span class='seperator'>|</span> <tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem14.visabled" :disabled="toolBarModels.tbitem14.disabled" class='' @click="toolbar_click({ tag: 'tbitem14' }, $event)">
<i class='fa fa-copy'></i>
<span class='caption'>{{$t('entities.sysrole.editview2toolbar_toolbar.tbitem14.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.sysrole.editview2toolbar_toolbar.tbitem14.tip')}}</div>
</tooltip>
</div>
</template>
</div>
<div class="content-container edit-view2">
<view_drbar
:viewState="viewState"
loadAction='get'
name='drbar'
ref='drbar'
:viewparams="viewparams"
:context="context"
:formData="formData"
@selectionchange="drbar_selectionchange($event)"
@load="drbar_load($event)"
@closeview="closeView($event)">
<view_form
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:autosave="false"
:viewtag="viewtag"
:showBusyIndicator="true"
updateAction="Update"
removeAction="Remove"
loaddraftAction="GetDraft"
loadAction="Get"
createAction="Create"
WFSubmitAction=""
WFStartAction=""
style=''
name="form"
ref='form'
@save="form_save($event)"
@remove="form_remove($event)"
@load="form_load($event)"
@closeview="closeView($event)">
</view_form>
</view_drbar>
</div>
</card>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch,Inject } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import NavDataService from '@/service/app/navdata-service';
import { Subject,Subscription } from 'rxjs';
import SysRoleService from '@/service/sys-role/sys-role-service';
import EditView2Engine from '@engine/view/edit-view2-engine';
@Component({
components: {
},
})
export default class SysRoleEditView2Base extends Vue {
/**
* 实体服务对象
*
* @type {SysRoleService}
* @memberof SysRoleEditView2Base
*/
public appEntityService: SysRoleService = new SysRoleService;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof SysRoleEditView2Base
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof SysRoleEditView2Base
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof SysRoleEditView2Base
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof SysRoleEditView2Base
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof SysRoleEditView2Base
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图默认使用
*
* @type {string}
* @memberof SysRoleEditView2Base
*/
@Inject({from:'navModel',default: 'tab'})
public navModel!:string;
/**
* 视图标识
*
* @type {string}
* @memberof SysRoleEditView2Base
*/
public viewtag: string = '4470edcdb57a14007444c0d9867e571c';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof SysRoleEditView2Base
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof SysRoleEditView2Base
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof SysRoleEditView2Base
*/
public model: any = {
srfCaption: 'entities.sysrole.views.editview2.caption',
srfTitle: 'entities.sysrole.views.editview2.title',
srfSubTitle: 'entities.sysrole.views.editview2.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof SysRoleEditView2Base
*/
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}
}
/**
* 处理应用上下文变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof SysRoleEditView2Base
*/
@Watch('viewdata')
onViewData(newVal: any, oldVal: any) {
const _this: any = this;
if (!Object.is(newVal, oldVal) && _this.engine) {
this.$nextTick(()=>{
_this.parseViewParam();
_this.engine.load();
});
}
}
/**
* 容器模型
*
* @type {*}
* @memberof SysRoleEditView2Base
*/
public containerModel: any = {
view_toolbar: { name: 'toolbar', type: 'TOOLBAR' },
view_form: { name: 'form', type: 'FORM' },
view_drbar: { name: 'drbar', type: 'DRBAR' },
};
/**
* 计数器刷新
*
* @memberof SysRoleEditView2Base
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 视图状态订阅对象
*
* @public
* @type {Subject<{action: string, data: any}>}
* @memberof SysRoleEditView2Base
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 工具栏模型
*
* @type {*}
* @memberof SysRoleEditView2
*/
public toolBarModels: any = {
tbitem3: { name: 'tbitem3', caption: '保存', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:'2',dataaccaction: '', uiaction: { tag: 'Save', target: '' } },
tbitem5: { name: 'tbitem5', caption: '保存并关闭', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:'2',dataaccaction: '', uiaction: { tag: 'SaveAndExit', target: '' } },
tbitem6: { name: 'tbitem6', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem12: { name: 'tbitem12', caption: '新建', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:'2',dataaccaction: '', uiaction: { tag: 'New', target: '' } },
tbitem13: { name: 'tbitem13', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem14: { name: 'tbitem14', caption: '拷贝', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:'2',dataaccaction: '', uiaction: { tag: 'Copy', target: 'SINGLEKEY' } },
};
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof SysRoleEditView2Base
*/
public engine: EditView2Engine = new EditView2Engine();
/**
* 引擎初始化
*
* @public
* @memberof SysRoleEditView2Base
*/
public engineInit(): void {
this.engine.init({
view: this,
drbar: this.$refs.drbar,
form: this.$refs.form,
p2k: '0',
keyPSDEField: 'sysrole',
majorPSDEField: 'rolename',
isLoadDefault: true,
});
}
/**
* 应用导航服务
*
* @type {*}
* @memberof SysRoleEditView2Base
*/
public navDataService = NavDataService.getInstance(this.$store);
/**
* 导航服务事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof SysRoleEditView2Base
*/
public serviceStateEvent: Subscription | undefined;
/**
* 应用上下文
*
* @type {*}
* @memberof SysRoleEditView2Base
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof SysRoleEditView2Base
*/
public viewparams:any = {};
/**
* 视图缓存数据
*
* @type {*}
* @memberof SysRoleEditView2Base
*/
public viewCacheData:any;
/**
* 解析视图参数
*
* @public
* @memberof SysRoleEditView2Base
*/
public parseViewParam(inputvalue:any = null): void {
for(let key in this.context){
delete this.context[key];
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
Object.assign(this.viewparams,{srfparentdename:this.context.srfparentdename});
}
if(this.context && this.context.srfparentkey){
Object.assign(this.viewparams,{srfparentkey:this.context.srfparentkey});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
this.handleCustomViewData();
return;
}
const path = (this.$route.matched[this.$route.matched.length - 1]).path;
const keys: Array<any> = [];
const curReg = this.$pathToRegExp.pathToRegexp(path, keys);
const matchArray = curReg.exec(this.$route.path);
let tempValue: Object = {};
keys.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item.name, {
enumerable: true,
value: matchArray[index + 1]
});
});
this.$viewTool.formatRouteParams(tempValue,this.$route,this.context,this.viewparams);
if(inputvalue){
Object.assign(this.context,{'sysrole':inputvalue});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
//初始化导航数据
this.initNavDataWithRoute();
}
/**
* 处理自定义视图数据
*
* @memberof SysRoleEditView2Base
*/
public handleCustomViewData(){
if(Object.keys(this.customViewNavContexts).length > 0){
Object.keys(this.customViewNavContexts).forEach((item:any) =>{
let tempContext:any = {};
let curNavContext:any = this.customViewNavContexts[item];
this.handleCustomDataLogic(curNavContext,tempContext,item);
Object.assign(this.context,tempContext);
})
}
if(Object.keys(this.customViewParams).length > 0){
Object.keys(this.customViewParams).forEach((item:any) =>{
let tempParam:any = {};
let curNavParam:any = this.customViewParams[item];
this.handleCustomDataLogic(curNavParam,tempParam,item);
Object.assign(this.viewparams,tempParam);
})
}
}
/**
* 处理自定义视图数据逻辑
*
* @memberof SysRoleEditView2Base
*/
public handleCustomDataLogic(curNavData:any,tempData:any,item:string){
// 直接值直接赋值
if(curNavData.isRawValue){
if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: curNavData.value,
writable : true,
enumerable : true,
configurable : true
});
}
}else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(this.context[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(this.viewparams[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.viewparams[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}
}
}
}
/**
* 初始化导航数据(路由模式)
*
* @memberof SysRoleEditView2Base
*/
public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && Object.is(this.navModel,"route")) ){
this.navDataService.addNavData({id:'sys-role-edit-view2',tag:this.viewtag,srfkey:isNew ? null : this.context.sysrole,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath});
}
}
/**
* 初始化导航数据(分页模式)
*
* @memberof SysRoleEditView2Base
*/
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && !Object.is(this.navModel,"route")) ){
this.navDataService.addNavDataByOnly({id:'sys-role-edit-view2',tag:this.viewtag,srfkey:this.context.sysrole,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd);
}
}
/**
* Vue声明周期
*
* @memberof SysRoleEditView2Base
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof SysRoleEditView2Base
*/
public afterCreated(){
let _this:any = this;
const secondtag = _this.$util.createUUID();
_this.$store.commit('viewaction/createdView', { viewtag: _this.viewtag, secondtag: secondtag });
_this.viewtag = secondtag;
_this.parseViewParam();
_this.serviceStateEvent = _this.navDataService.serviceState.subscribe(({ action,name, data }:{ action:string,name:any,data:any }) => {
if(!Object.is(name,'sys-role-edit-view2')){
return;
}
if (Object.is(action, 'viewrefresh')) {
_this.$nextTick(()=>{
_this.parseViewParam(data);
if(_this.engine){
_this.engine.load();
}
});
}
});
}
/**
* 销毁之前
*
* @memberof SysRoleEditView2Base
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof SysRoleEditView2Base
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof SysRoleEditView2Base
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
}
/**
* toolbar 部件 click 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysRoleEditView2Base
*/
public toolbar_click($event: any, $event2?: any) {
if (Object.is($event.tag, 'tbitem3')) {
this.toolbar_tbitem3_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem5')) {
this.toolbar_tbitem5_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem9')) {
this.toolbar_tbitem9_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem10')) {
this.toolbar_tbitem10_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem12')) {
this.toolbar_tbitem12_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem14')) {
this.toolbar_tbitem14_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem15')) {
this.toolbar_tbitem15_click(null, '', $event2);
}
}
/**
* form 部件 save 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysRoleEditView2Base
*/
public form_save($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'save', $event);
}
/**
* form 部件 remove 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysRoleEditView2Base
*/
public form_remove($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'remove', $event);
}
/**
* form 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysRoleEditView2Base
*/
public form_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'load', $event);
}
/**
* drbar 部件 selectionchange 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysRoleEditView2Base
*/
public drbar_selectionchange($event: any, $event2?: any) {
this.engine.onCtrlEvent('drbar', 'selectionchange', $event);
}
/**
* drbar 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysRoleEditView2Base
*/
public drbar_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('drbar', 'load', $event);
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem3_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Save(datas, contextJO,paramJO, $event, xData,this,"SysRole");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem5_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.SaveAndExit(datas, contextJO,paramJO, $event, xData,this,"SysRole");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem9_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.SaveAndStart(datas, contextJO,paramJO, $event, xData,this,"SysRole");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem10_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.ViewWFStep(datas, contextJO,paramJO, $event, xData,this,"SysRole");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem12_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.New(datas, contextJO,paramJO, $event, xData,this,"SysRole");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem14_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Copy(datas, contextJO,paramJO, $event, xData,this,"SysRole");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem15_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Print(datas, contextJO,paramJO, $event, xData,this,"SysRole");
}
/**
* 保存
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysRoleEditView2Base
*/
public Save(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
// 界面行为容器对象 _this
const _this: any = this;
if (xData && xData.save instanceof Function) {
xData.save().then((response: any) => {
if (!response || response.status !== 200) {
return;
}
_this.$emit('viewdataschange', [{ ...response.data }]);
});
} else if (_this.save && _this.save instanceof Function) {
_this.save();
}
}
/**
* 保存并关闭
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysRoleEditView2Base
*/
public SaveAndExit(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (xData && xData.saveAndExit instanceof Function) {
xData.saveAndExit().then((response: any) => {
if (!response || response.status !== 200) {
return;
}
if(window.parent){
window.parent.postMessage([{ ...response.data }],'*');
}
});
} else if (_this.saveAndExit && _this.saveAndExit instanceof Function) {
_this.saveAndExit().then((response: any) => {
if (!response || response.status !== 200) {
return;
}
if(window.parent){
window.parent.postMessage([{ ...response.data }],'*');
}
});
}
}
/**
* 开始流程
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysRoleEditView2Base
*/
public SaveAndStart(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (!xData || !(xData.wfstart instanceof Function)) {
return;
}
xData.wfstart(args).then((response: any) => {
if (!response || response.status !== 200) {
return;
}
const { data: _data } = response;
if(window.parent){
window.parent.postMessage({ ..._data },'*');
}
if (_this.viewdata) {
_this.$emit('viewdataschange', [{ ..._data }]);
_this.$emit('close');
}else if (this.$tabPageExp) {
this.$tabPageExp.onClose(this.$route.fullPath);
}
});
}
/**
* 当前流程步骤
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysRoleEditView2Base
*/
public ViewWFStep(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
let _this:any = this;
if (!xData || !(xData.wfsubmit instanceof Function)) {
return;
}
xData.wfsubmit(args).then((response: any) => {
if (!response || response.status !== 200) {
return;
}
const { data: _data } = response;
if (_this.viewdata) {
_this.$emit('viewdataschange', [{ ..._data }]);
_this.$emit('close');
} else if (_this.$tabPageExp) {
_this.$tabPageExp.onClose(_this.$route.fullPath);
}
});
}
/**
* 新建
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysRoleEditView2Base
*/
public New(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (_this.newdata && _this.newdata instanceof Function) {
const data: any = {};
_this.newdata([{ ...data }],[{ ...data }], params, $event, xData);
} else {
_this.$Notice.error({ title: '错误', desc: 'newdata 视图处理逻辑不存在,请添加!' });
}
}
/**
* 拷贝
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysRoleEditView2Base
*/
public Copy(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
if (args.length === 0) {
return;
}
const _this: any = this;
if (_this.newdata && _this.newdata instanceof Function) {
const data: any = {};
if (args.length > 0) {
Object.assign(data, { srfsourcekey: args[0].srfkey })
actionContext.$store.commit('addCopyData', { srfkey: args[0].srfkey, copyData: args[0] });
}
_this.newdata([{ ...data }],[{ ...data }],params, $event, xData);
} else if (xData && xData.copy instanceof Function) {
if (args.length > 0) {
actionContext.$store.commit('addCopyData', { srfkey: args[0].srfkey, copyData: args[0] });
}
xData.copy(args[0].srfkey);
} else {
_this.$Notice.error({ title: '错误', desc: 'opendata 视图处理逻辑不存在,请添加!' });
}
}
/**
* 打印
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysRoleEditView2Base
*/
public Print(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
let _this:any = this;
if (!xData || !(xData.print instanceof Function) || !$event) {
return ;
}
xData.print();
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof SysRoleEditView2Base
*/
public closeView(args: any[]): void {
let _view: any = this;
if (_view.viewdata) {
_view.$emit('viewdataschange', [args]);
_view.$emit('close', [args]);
} else if (_view.$tabPageExp) {
_view.$tabPageExp.onClose(_view.$route.fullPath);
}
}
/**
* 销毁视图回调
*
* @memberof SysRoleEditView2Base
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof SysRoleEditView2Base
*/
public afterDestroyed(){
if(this.viewDefaultUsage){
let localStoreLength = Object.keys(localStorage);
if(localStoreLength.length > 0){
localStoreLength.forEach((item:string) =>{
if(item.startsWith(this.context.srfsessionid)){
localStorage.removeItem(item);
}
})
}
if(Object.is(this.navModel,"tab")){
this.navDataService.removeNavDataByTag(this.viewtag);
}
if (this.serviceStateEvent) {
this.serviceStateEvent.unsubscribe();
}
}
}
/**
* 选中数据
*
* @type {*}
* @memberof SysRoleEditView2Base
*/
public selection: any = {};
/**
* 表单数据
*
* @type {*}
* @memberof SysRoleEditView2Base
*/
public formData:any = {};
}
</script>
<style lang='less'>
@import './sys-role-edit-view2.less';
</style>
\ No newline at end of file
.view-card {
>.ivu-card-extra {
top: 5px;
right: 0px;
}
}
.edit-view2 {
flex-direction: row !important;
.view-form {
overflow: auto;
}
}
.sys-role-edit-view2{
position: relative;
}
.toolbar-container {
button {
margin: 6px 0px 4px 4px;
.caption {
margin-left: 4px;
}
}
.seperator {
color: #dcdee2;
margin: 0 0px 0 4px;
}
}
// this is less
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import SysRoleEditView2Base from './sys-role-edit-view2-base.vue';
import view_form from '@widgets/sys-role/main-form/main-form.vue';
import view_drbar from '@widgets/sys-role/default-drbar/default-drbar.vue';
@Component({
components: {
view_form,
view_drbar,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
if(!Object.is(vm.navModel,"route")){
vm.initNavDataWithTab(vm.viewCacheData);
}
vm.$store.commit('addCurPageViewtag', { fullPath: to.fullPath, viewtag: vm.viewtag });
});
},
})
export default class SysRoleEditView2 extends SysRoleEditView2Base {
}
</script>
\ No newline at end of file
<template>
<div class="view-container decustomview sys-role-permission-custom-view">
<app-studioaction :viewTitle="$t(model.srfTitle)" viewName="sysrolepermissioncustomview"></app-studioaction>
<card class='view-card view-no-toolbar' :disHover="true" :padding="0" :bordered="false">
<div slot='title' class="header-container">
<span class='caption-info'>{{$t(model.srfTitle)}}</span>
</div>
<div class="content-container">
</div>
</card>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch,Inject } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import NavDataService from '@/service/app/navdata-service';
import { Subject,Subscription } from 'rxjs';
import SysRolePermissionService from '@/service/sys-role-permission/sys-role-permission-service';
@Component({
components: {
},
})
export default class SysRolePermissionCustomViewBase extends Vue {
/**
* 实体服务对象
*
* @type {SysRolePermissionService}
* @memberof SysRolePermissionCustomViewBase
*/
public appEntityService: SysRolePermissionService = new SysRolePermissionService;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof SysRolePermissionCustomViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof SysRolePermissionCustomViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof SysRolePermissionCustomViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof SysRolePermissionCustomViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof SysRolePermissionCustomViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图默认使用
*
* @type {string}
* @memberof SysRolePermissionCustomViewBase
*/
@Inject({from:'navModel',default: 'tab'})
public navModel!:string;
/**
* 视图标识
*
* @type {string}
* @memberof SysRolePermissionCustomViewBase
*/
public viewtag: string = 'e791be173ed0f4bbe9cce942b6edde63';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof SysRolePermissionCustomViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof SysRolePermissionCustomViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof SysRolePermissionCustomViewBase
*/
public model: any = {
srfCaption: 'entities.sysrolepermission.views.customview.caption',
srfTitle: 'entities.sysrolepermission.views.customview.title',
srfSubTitle: 'entities.sysrolepermission.views.customview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof SysRolePermissionCustomViewBase
*/
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}
}
/**
* 处理应用上下文变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof SysRolePermissionCustomViewBase
*/
@Watch('viewdata')
onViewData(newVal: any, oldVal: any) {
const _this: any = this;
if (!Object.is(newVal, oldVal) && _this.engine) {
this.$nextTick(()=>{
_this.parseViewParam();
_this.engine.load();
});
}
}
/**
* 容器模型
*
* @type {*}
* @memberof SysRolePermissionCustomViewBase
*/
public containerModel: any = {
};
/**
* 计数器刷新
*
* @memberof SysRolePermissionCustomViewBase
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 视图状态订阅对象
*
* @public
* @type {Subject<{action: string, data: any}>}
* @memberof SysRolePermissionCustomViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 引擎初始化
*
* @public
* @memberof SysRolePermissionCustomViewBase
*/
public engineInit(): void {
}
/**
* 应用导航服务
*
* @type {*}
* @memberof SysRolePermissionCustomViewBase
*/
public navDataService = NavDataService.getInstance(this.$store);
/**
* 导航服务事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof SysRolePermissionCustomViewBase
*/
public serviceStateEvent: Subscription | undefined;
/**
* 应用上下文
*
* @type {*}
* @memberof SysRolePermissionCustomViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof SysRolePermissionCustomViewBase
*/
public viewparams:any = {};
/**
* 视图缓存数据
*
* @type {*}
* @memberof SysRolePermissionCustomViewBase
*/
public viewCacheData:any;
/**
* 解析视图参数
*
* @public
* @memberof SysRolePermissionCustomViewBase
*/
public parseViewParam(inputvalue:any = null): void {
for(let key in this.context){
delete this.context[key];
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
Object.assign(this.viewparams,{srfparentdename:this.context.srfparentdename});
}
if(this.context && this.context.srfparentkey){
Object.assign(this.viewparams,{srfparentkey:this.context.srfparentkey});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
this.handleCustomViewData();
return;
}
const path = (this.$route.matched[this.$route.matched.length - 1]).path;
const keys: Array<any> = [];
const curReg = this.$pathToRegExp.pathToRegexp(path, keys);
const matchArray = curReg.exec(this.$route.path);
let tempValue: Object = {};
keys.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item.name, {
enumerable: true,
value: matchArray[index + 1]
});
});
this.$viewTool.formatRouteParams(tempValue,this.$route,this.context,this.viewparams);
if(inputvalue){
Object.assign(this.context,{'sysrolepermission':inputvalue});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
//初始化导航数据
this.initNavDataWithRoute();
}
/**
* 处理自定义视图数据
*
* @memberof SysRolePermissionCustomViewBase
*/
public handleCustomViewData(){
if(Object.keys(this.customViewNavContexts).length > 0){
Object.keys(this.customViewNavContexts).forEach((item:any) =>{
let tempContext:any = {};
let curNavContext:any = this.customViewNavContexts[item];
this.handleCustomDataLogic(curNavContext,tempContext,item);
Object.assign(this.context,tempContext);
})
}
if(Object.keys(this.customViewParams).length > 0){
Object.keys(this.customViewParams).forEach((item:any) =>{
let tempParam:any = {};
let curNavParam:any = this.customViewParams[item];
this.handleCustomDataLogic(curNavParam,tempParam,item);
Object.assign(this.viewparams,tempParam);
})
}
}
/**
* 处理自定义视图数据逻辑
*
* @memberof SysRolePermissionCustomViewBase
*/
public handleCustomDataLogic(curNavData:any,tempData:any,item:string){
// 直接值直接赋值
if(curNavData.isRawValue){
if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: curNavData.value,
writable : true,
enumerable : true,
configurable : true
});
}
}else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(this.context[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(this.viewparams[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.viewparams[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}
}
}
}
/**
* 初始化导航数据(路由模式)
*
* @memberof SysRolePermissionCustomViewBase
*/
public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && Object.is(this.navModel,"route")) ){
this.navDataService.addNavData({id:'sys-role-permission-custom-view',tag:this.viewtag,srfkey:isNew ? null : this.context.sysrolepermission,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath});
}
}
/**
* 初始化导航数据(分页模式)
*
* @memberof SysRolePermissionCustomViewBase
*/
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && !Object.is(this.navModel,"route")) ){
this.navDataService.addNavDataByOnly({id:'sys-role-permission-custom-view',tag:this.viewtag,srfkey:this.context.sysrolepermission,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd);
}
}
/**
* Vue声明周期
*
* @memberof SysRolePermissionCustomViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof SysRolePermissionCustomViewBase
*/
public afterCreated(){
let _this:any = this;
const secondtag = _this.$util.createUUID();
_this.$store.commit('viewaction/createdView', { viewtag: _this.viewtag, secondtag: secondtag });
_this.viewtag = secondtag;
_this.parseViewParam();
_this.serviceStateEvent = _this.navDataService.serviceState.subscribe(({ action,name, data }:{ action:string,name:any,data:any }) => {
if(!Object.is(name,'sys-role-permission-custom-view')){
return;
}
if (Object.is(action, 'viewrefresh')) {
_this.$nextTick(()=>{
_this.parseViewParam(data);
if(_this.engine){
_this.engine.load();
}
});
}
});
}
/**
* 销毁之前
*
* @memberof SysRolePermissionCustomViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof SysRolePermissionCustomViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof SysRolePermissionCustomViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof SysRolePermissionCustomViewBase
*/
public closeView(args: any[]): void {
let _view: any = this;
if (_view.viewdata) {
_view.$emit('viewdataschange', [args]);
_view.$emit('close', [args]);
} else if (_view.$tabPageExp) {
_view.$tabPageExp.onClose(_view.$route.fullPath);
}
}
/**
* 销毁视图回调
*
* @memberof SysRolePermissionCustomViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof SysRolePermissionCustomViewBase
*/
public afterDestroyed(){
if(this.viewDefaultUsage){
let localStoreLength = Object.keys(localStorage);
if(localStoreLength.length > 0){
localStoreLength.forEach((item:string) =>{
if(item.startsWith(this.context.srfsessionid)){
localStorage.removeItem(item);
}
})
}
if(Object.is(this.navModel,"tab")){
this.navDataService.removeNavDataByTag(this.viewtag);
}
if (this.serviceStateEvent) {
this.serviceStateEvent.unsubscribe();
}
}
}
}
</script>
<style lang='less'>
@import './sys-role-permission-custom-view.less';
</style>
\ No newline at end of file
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import SysRolePermissionCustomViewBase from './sys-role-permission-custom-view-base.vue';
@Component({
components: {
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
if(!Object.is(vm.navModel,"route")){
vm.initNavDataWithTab(vm.viewCacheData);
}
vm.$store.commit('addCurPageViewtag', { fullPath: to.fullPath, viewtag: vm.viewtag });
});
},
})
export default class SysRolePermissionCustomView extends SysRolePermissionCustomViewBase {
}
</script>
\ No newline at end of file
<template>
<div class="view-container dempickupview sys-role-permission-mpickup-view">
<app-studioaction :viewTitle="$t(model.srfTitle)" viewName="sysrolepermissionmpickupview"></app-studioaction>
<card class='view-card view-no-caption view-no-toolbar' :dis-hover="true" :padding="0" :bordered="false">
<div class="content-container pickup-view">
<div class="translate-contant">
<div class="center" :style="{width : !isShowButton ? '100%' : ''}">
<view_pickupviewpanel
:viewState="viewState"
:viewparams="JSON.parse(JSON.stringify(viewparams))"
:context="JSON.parse(JSON.stringify(context))"
:isSingleSelect="isSingleSelect"
:selectedData="selectedData"
:isShowButton="isShowButton"
name="pickupviewpanel"
ref='pickupviewpanel'
@selectionchange="pickupviewpanel_selectionchange($event)"
@activated="pickupviewpanel_activated($event)"
@load="pickupviewpanel_load($event)"
@closeview="closeView($event)">
</view_pickupviewpanel>
</div>
<div v-if="isShowButton" class="translate-buttons">
<div class="buttons">
<i-button type="primary" :title="this.containerModel.view_rightbtn.text"
:disabled="this.containerModel.view_rightbtn.disabled"
@click="onCLickRight">
<i class="el-icon-arrow-right"></i>
</i-button>
<i-button type="primary" :title="this.containerModel.view_leftbtn.text"
:disabled="this.containerModel.view_leftbtn.disabled"
@click="onCLickLeft">
<i class="el-icon-arrow-left"></i>
</i-button>
<i-button type="primary" :title="this.containerModel.view_allrightbtn.text"
@click="onCLickAllRight">
<i class="el-icon-d-arrow-right"></i>
</i-button>
<i-button type="primary" :title="this.containerModel.view_allleftbtn.text"
@click="onCLickAllLeft">
<i class="el-icon-d-arrow-left"></i>
</i-button>
</div>
</div>
<div v-if="isShowButton" class="right">
<div class="mpicker-select">
<div v-for="(item, index) in viewSelections" :key="index" :class="item._select ? 'select' : ''" @click="selectionsClick(item)" @dblclick="selectionsDBLClick(item)">
<span>{{item.srfmajortext}}</span>
</div>
</div>
</div>
</div>
<card v-if="isShowButton" :dis-hover="true" :bordered="false" class="footer">
<row :style="{ textAlign: 'right' }">
<i-button type="primary" :disabled="this.viewSelections.length > 0 ? false : true" @click="onClickOk">{{this.containerModel.view_okbtn.text}}</i-button>
&nbsp;&nbsp;
<i-button @click="onClickCancel">{{this.containerModel.view_cancelbtn.text}}</i-button>
</row>
</card>
</div>
</card>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch,Inject } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import NavDataService from '@/service/app/navdata-service';
import { Subject,Subscription } from 'rxjs';
import SysRolePermissionService from '@/service/sys-role-permission/sys-role-permission-service';
import MPickupViewEngine from '@engine/view/mpickup-view-engine';
@Component({
components: {
},
})
export default class SysRolePermissionMPickupViewBase extends Vue {
/**
* 实体服务对象
*
* @type {SysRolePermissionService}
* @memberof SysRolePermissionMPickupViewBase
*/
public appEntityService: SysRolePermissionService = new SysRolePermissionService;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof SysRolePermissionMPickupViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof SysRolePermissionMPickupViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof SysRolePermissionMPickupViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof SysRolePermissionMPickupViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof SysRolePermissionMPickupViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图默认使用
*
* @type {string}
* @memberof SysRolePermissionMPickupViewBase
*/
@Inject({from:'navModel',default: 'tab'})
public navModel!:string;
/**
* 视图标识
*
* @type {string}
* @memberof SysRolePermissionMPickupViewBase
*/
public viewtag: string = '3e133a839b837d9e47f80e161d66a861';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof SysRolePermissionMPickupViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof SysRolePermissionMPickupViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof SysRolePermissionMPickupViewBase
*/
public model: any = {
srfCaption: 'entities.sysrolepermission.views.mpickupview.caption',
srfTitle: 'entities.sysrolepermission.views.mpickupview.title',
srfSubTitle: 'entities.sysrolepermission.views.mpickupview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof SysRolePermissionMPickupViewBase
*/
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
Object.assign(this.viewparams, JSON.parse(this.viewparam));
if(this.viewparams.selectedData){
this.selectedData = JSON.stringify(this.viewparams.selectedData);
}
}
}
/**
* 处理应用上下文变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof SysRolePermissionMPickupViewBase
*/
@Watch('viewdata')
onViewData(newVal: any, oldVal: any) {
const _this: any = this;
if (!Object.is(newVal, oldVal) && _this.engine) {
this.$nextTick(()=>{
_this.parseViewParam();
_this.engine.load();
});
}
}
/**
* 容器模型
*
* @type {*}
* @memberof SysRolePermissionMPickupViewBase
*/
public containerModel: any = {
view_pickupviewpanel: { name: 'pickupviewpanel', type: 'PICKUPVIEWPANEL' },
view_okbtn: { name: 'okbtn', type: 'button', text: '确定', disabled: true },
view_cancelbtn: { name: 'cancelbtn', type: 'button', text: '取消', disabled: false },
view_leftbtn: { name: 'leftbtn', type: 'button', text: '左移', disabled: true },
view_rightbtn: { name: 'rightbtn', type: 'button', text: '右移', disabled: true },
view_allleftbtn: { name: 'allleftbtn', type: 'button', text: '全部左移', disabled: true },
view_allrightbtn: { name: 'allrightbtn', type: 'button', text: '全部右移', disabled: true },
};
/**
* 计数器刷新
*
* @memberof SysRolePermissionMPickupViewBase
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 视图状态订阅对象
*
* @public
* @type {Subject<{action: string, data: any}>}
* @memberof SysRolePermissionMPickupViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof SysRolePermissionMPickupViewBase
*/
public engine: MPickupViewEngine = new MPickupViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof SysRolePermissionMPickupViewBase
*/
public engineInit(): void {
this.engine.init({
view: this,
pickupviewpanel: this.$refs.pickupviewpanel,
keyPSDEField: 'sysrolepermission',
majorPSDEField: 'permissionid',
isLoadDefault: true,
});
}
/**
* 应用导航服务
*
* @type {*}
* @memberof SysRolePermissionMPickupViewBase
*/
public navDataService = NavDataService.getInstance(this.$store);
/**
* 导航服务事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof SysRolePermissionMPickupViewBase
*/
public serviceStateEvent: Subscription | undefined;
/**
* 应用上下文
*
* @type {*}
* @memberof SysRolePermissionMPickupViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof SysRolePermissionMPickupViewBase
*/
public viewparams:any = {};
/**
* 视图缓存数据
*
* @type {*}
* @memberof SysRolePermissionMPickupViewBase
*/
public viewCacheData:any;
/**
* 解析视图参数
*
* @public
* @memberof SysRolePermissionMPickupViewBase
*/
public parseViewParam(inputvalue:any = null): void {
for(let key in this.context){
delete this.context[key];
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
Object.assign(this.viewparams,{srfparentdename:this.context.srfparentdename});
}
if(this.context && this.context.srfparentkey){
Object.assign(this.viewparams,{srfparentkey:this.context.srfparentkey});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
this.handleCustomViewData();
return;
}
const path = (this.$route.matched[this.$route.matched.length - 1]).path;
const keys: Array<any> = [];
const curReg = this.$pathToRegExp.pathToRegexp(path, keys);
const matchArray = curReg.exec(this.$route.path);
let tempValue: Object = {};
keys.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item.name, {
enumerable: true,
value: matchArray[index + 1]
});
});
this.$viewTool.formatRouteParams(tempValue,this.$route,this.context,this.viewparams);
if(inputvalue){
Object.assign(this.context,{'sysrolepermission':inputvalue});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
//初始化导航数据
this.initNavDataWithRoute();
}
/**
* 处理自定义视图数据
*
* @memberof SysRolePermissionMPickupViewBase
*/
public handleCustomViewData(){
if(Object.keys(this.customViewNavContexts).length > 0){
Object.keys(this.customViewNavContexts).forEach((item:any) =>{
let tempContext:any = {};
let curNavContext:any = this.customViewNavContexts[item];
this.handleCustomDataLogic(curNavContext,tempContext,item);
Object.assign(this.context,tempContext);
})
}
if(Object.keys(this.customViewParams).length > 0){
Object.keys(this.customViewParams).forEach((item:any) =>{
let tempParam:any = {};
let curNavParam:any = this.customViewParams[item];
this.handleCustomDataLogic(curNavParam,tempParam,item);
Object.assign(this.viewparams,tempParam);
})
}
}
/**
* 处理自定义视图数据逻辑
*
* @memberof SysRolePermissionMPickupViewBase
*/
public handleCustomDataLogic(curNavData:any,tempData:any,item:string){
// 直接值直接赋值
if(curNavData.isRawValue){
if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: curNavData.value,
writable : true,
enumerable : true,
configurable : true
});
}
}else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(this.context[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(this.viewparams[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.viewparams[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}
}
}
}
/**
* 初始化导航数据(路由模式)
*
* @memberof SysRolePermissionMPickupViewBase
*/
public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && Object.is(this.navModel,"route")) ){
this.navDataService.addNavData({id:'sys-role-permission-mpickup-view',tag:this.viewtag,srfkey:isNew ? null : this.context.sysrolepermission,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath});
}
}
/**
* 初始化导航数据(分页模式)
*
* @memberof SysRolePermissionMPickupViewBase
*/
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && !Object.is(this.navModel,"route")) ){
this.navDataService.addNavDataByOnly({id:'sys-role-permission-mpickup-view',tag:this.viewtag,srfkey:this.context.sysrolepermission,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd);
}
}
/**
* Vue声明周期
*
* @memberof SysRolePermissionMPickupViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof SysRolePermissionMPickupViewBase
*/
public afterCreated(){
let _this:any = this;
const secondtag = _this.$util.createUUID();
_this.$store.commit('viewaction/createdView', { viewtag: _this.viewtag, secondtag: secondtag });
_this.viewtag = secondtag;
_this.parseViewParam();
_this.serviceStateEvent = _this.navDataService.serviceState.subscribe(({ action,name, data }:{ action:string,name:any,data:any }) => {
if(!Object.is(name,'sys-role-permission-mpickup-view')){
return;
}
if (Object.is(action, 'viewrefresh')) {
_this.$nextTick(()=>{
_this.parseViewParam(data);
if(_this.engine){
_this.engine.load();
}
});
}
});
}
/**
* 销毁之前
*
* @memberof SysRolePermissionMPickupViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof SysRolePermissionMPickupViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof SysRolePermissionMPickupViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
if(this.viewparams.selectedData){
this.engine.onCtrlEvent('pickupviewpanel', 'selectionchange', this.viewparams.selectedData);
this.onCLickRight();
}
}
/**
* pickupviewpanel 部件 selectionchange 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysRolePermissionMPickupViewBase
*/
public pickupviewpanel_selectionchange($event: any, $event2?: any) {
this.engine.onCtrlEvent('pickupviewpanel', 'selectionchange', $event);
}
/**
* pickupviewpanel 部件 activated 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysRolePermissionMPickupViewBase
*/
public pickupviewpanel_activated($event: any, $event2?: any) {
this.engine.onCtrlEvent('pickupviewpanel', 'activated', $event);
}
/**
* pickupviewpanel 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysRolePermissionMPickupViewBase
*/
public pickupviewpanel_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('pickupviewpanel', 'load', $event);
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof SysRolePermissionMPickupViewBase
*/
public closeView(args: any[]): void {
let _view: any = this;
if (_view.viewdata) {
_view.$emit('viewdataschange', [args]);
_view.$emit('close', [args]);
} else if (_view.$tabPageExp) {
_view.$tabPageExp.onClose(_view.$route.fullPath);
}
}
/**
* 销毁视图回调
*
* @memberof SysRolePermissionMPickupViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof SysRolePermissionMPickupViewBase
*/
public afterDestroyed(){
if(this.viewDefaultUsage){
let localStoreLength = Object.keys(localStorage);
if(localStoreLength.length > 0){
localStoreLength.forEach((item:string) =>{
if(item.startsWith(this.context.srfsessionid)){
localStorage.removeItem(item);
}
})
}
if(Object.is(this.navModel,"tab")){
this.navDataService.removeNavDataByTag(this.viewtag);
}
if (this.serviceStateEvent) {
this.serviceStateEvent.unsubscribe();
}
}
}
/**
* 是否显示按钮
*
* @type {boolean}
* @memberof SysRolePermissionMPickupViewBase
*/
@Prop({default: true}) public isShowButton!: boolean;
/**
* 选中数据的字符串
*
* @type {string}
* @memberof SysRolePermissionMPickupViewBase
*/
public selectedData: string = "";
/**
* 是否初始化已选中项
*
* @type {any[]}
* @memberof SysRolePermissionMPickupViewBase
*/
public isInitSelected:boolean = false;
/**
* 视图选中数据
*
* @type {any[]}
* @memberof SysRolePermissionMPickupViewBase
*/
public viewSelections:any[] = [];
/**
* 是否单选
*
* @type {boolean}
* @memberof SysRolePermissionMPickupViewBase
*/
public isSingleSelect: boolean = false;
/**
* 选中数据单击
*
* @param {*} item
* @memberof SysRolePermissionMPickupViewBase
*/
public selectionsClick(item:any):void {
item._select = !item._select;
const removeSelect: boolean = this.viewSelections.some((selection: any) => selection._select);
this.containerModel.view_leftbtn.disabled = !removeSelect;
}
/**
* 选中树双击
*
* @param {*} item
* @memberof SysRolePermissionMPickupViewBase
*/
public selectionsDBLClick(item:any):void {
const index: number = this.viewSelections.findIndex((selection: any) => Object.is(selection.srfkey, item.srfkey));
if (index !== -1) {
this.viewSelections.splice(index, 1);
}
const removeSelect: boolean = this.viewSelections.some((selection: any) => selection._select);
this.containerModel.view_leftbtn.disabled = !removeSelect;
this.selectedData = JSON.stringify(this.viewSelections);
}
/**
* 删除右侧全部选中数据
*
* @memberof SysRolePermissionMPickupViewBase
*/
public onCLickLeft():void {
const _selectiions = [...JSON.parse(JSON.stringify(this.viewSelections))];
_selectiions.forEach((item: any) => {
if (!item._select) {
return;
}
const index = this.viewSelections.findIndex((selection: any) => Object.is(item.srfkey, selection.srfkey));
if (index !== -1) {
this.viewSelections.splice(index, 1);
}
});
const removeSelect: boolean = this.viewSelections.some((selection: any) => selection._select);
this.containerModel.view_leftbtn.disabled = !removeSelect;
this.selectedData = JSON.stringify(this.viewSelections);
}
/**
* 添加左侧选中数据
*
* @memberof SysRolePermissionMPickupViewBase
*/
public onCLickRight():void {
Object.values(this.containerModel).forEach((model: any) => {
if (!Object.is(model.type, 'PICKUPVIEWPANEL')) {
return;
}
let newSelections:any[] = [];
model.selections.forEach((item: any) => {
const index: number = this.viewSelections.findIndex((selection: any) => Object.is(item.srfkey, selection.srfkey));
if (index === -1) {
let _item: any = { ...JSON.parse(JSON.stringify(item)) };
Object.assign(_item, { _select: false })
newSelections.push(_item);
}else{
newSelections.push(this.viewSelections[index]);
}
});
this.viewSelections = this.removeDuplicates([...newSelections,...this.viewSelections]);
});
}
/**
* 去重
*
* @memberof SysRolePermissionMPickupViewBase
*/
public removeDuplicates(data:any):Array<any> {
const uniqueSet = new Set(data);
return [...uniqueSet];
}
/**
* 选中数据全部删除
*
* @memberof SysRolePermissionMPickupViewBase
*/
public onCLickAllLeft():void {
this.viewSelections = [];
this.containerModel.view_leftbtn.disabled = true;
this.engine.onCtrlEvent('pickupviewpanel', 'selectionchange', []);
this.selectedData = JSON.stringify(this.viewSelections);
}
/**
* 添加左侧面板所有数据到右侧
*
* @memberof SysRolePermissionMPickupViewBase
*/
public onCLickAllRight():void {
Object.values(this.containerModel).forEach((model: any) => {
if (!Object.is(model.type, 'PICKUPVIEWPANEL')) {
return;
}
if(model.datas.length>0){
model.datas.forEach((data:any,index:any)=>{
Object.assign(data,{srfmajortext: data['permissionid']});
})
}
model.datas.forEach((item: any) => {
const index: number = this.viewSelections.findIndex((selection: any) => Object.is(item.srfkey, selection.srfkey));
if (index === -1) {
let _item: any = { ...JSON.parse(JSON.stringify(item)) };
Object.assign(_item, { _select: false })
this.viewSelections.push(_item);
}
});
});
this.selectedData = JSON.stringify(this.viewSelections);
}
/**
* 确定
*
* @memberof SysRolePermissionMPickupViewBase
*/
public onClickOk(): void {
this.$emit('viewdataschange', this.viewSelections);
this.$emit('close', null);
}
/**
* 取消
*
* @memberof SysRolePermissionMPickupViewBase
*/
public onClickCancel(): void {
this.$emit('close', null);
}
}
</script>
<style lang='less'>
@import './sys-role-permission-mpickup-view.less';
</style>
\ No newline at end of file
.sys-role-permission-mpickup-view{
position: relative;
}
.pickup-view {
>.translate-contant {
flex-grow: 1;
display: flex;
justify-content: flex-end;
height: calc(100% - 64px);
.translate-buttons {
width: 80px;
display: flex;
align-items: center;
text-align: center;
button {
margin-bottom: 5px;
}
}
.left, .right {
width: 300px;
}
.right {
border: 1px solid #e9e9e9;
.mpicker-select {
font-family: helvetica, sans-serif;
font-size: 16px;
text-align: justify;
word-spacing: -3.8pt;
line-height: 1.6;
font-weight: bold;
word-spacing: 10px;
height: 100%;
overflow: auto;
}
.mpicker-select > div {
padding: 3px 10px;
font-size: 14px;
color: rgba(0, 0, 0, 0.85);
font-weight: initial;
cursor: pointer;
min-height: 28px;
border: 1px solid #e9e9e9;
margin: 4px 4px;
transition: all .3s;
}
.mpicker-select > div:hover {
background: #ecf6fd;
}
.mpicker-select > .select{
color: #108ee9;
background: #ecf6fd;
}
}
.center{
width: calc(100% - 380px);
.pickupviewpanel {
width: 100%;
height: 100%;
}
}
}
>.footer {
height: 64px;
}
}
\ No newline at end of file
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import SysRolePermissionMPickupViewBase from './sys-role-permission-mpickup-view-base.vue';
import view_pickupviewpanel from '@widgets/sys-role-permission/mpickup-viewpickupviewpanel-pickupviewpanel/mpickup-viewpickupviewpanel-pickupviewpanel.vue';
@Component({
components: {
view_pickupviewpanel,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
if(!Object.is(vm.navModel,"route")){
vm.initNavDataWithTab(vm.viewCacheData);
}
vm.$store.commit('addCurPageViewtag', { fullPath: to.fullPath, viewtag: vm.viewtag });
});
},
})
export default class SysRolePermissionMPickupView extends SysRolePermissionMPickupViewBase {
}
</script>
\ No newline at end of file
<template>
<div class="view-container depickupview sys-role-permission-pickup-view">
<app-studioaction :viewTitle="$t(model.srfTitle)" viewName="sysrolepermissionpickupview"></app-studioaction>
<card class='view-card view-no-caption view-no-toolbar' :dis-hover="true" :padding="0" :bordered="false">
<div class="content-container pickup-view">
<view_pickupviewpanel
:viewState="viewState"
:viewparams="JSON.parse(JSON.stringify(viewparams))"
:context="JSON.parse(JSON.stringify(context))"
:isSingleSelect="isSingleSelect"
:selectedData="selectedData"
:isShowButton="isShowButton"
name="pickupviewpanel"
ref='pickupviewpanel'
@selectionchange="pickupviewpanel_selectionchange($event)"
@activated="pickupviewpanel_activated($event)"
@load="pickupviewpanel_load($event)"
@closeview="closeView($event)">
</view_pickupviewpanel>
<card v-if="isShowButton" :dis-hover="true" :bordered="false" class="footer">
<row :style="{ textAlign: 'right' }">
<i-button type="primary" :disabled="this.viewSelections.length > 0 ? false : true" @click="onClickOk">{{this.containerModel.view_okbtn.text}}</i-button>
&nbsp;&nbsp;
<i-button @click="onClickCancel">{{this.containerModel.view_cancelbtn.text}}</i-button>
</row>
</card>
</div>
</card>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch,Inject } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import NavDataService from '@/service/app/navdata-service';
import { Subject,Subscription } from 'rxjs';
import SysRolePermissionService from '@/service/sys-role-permission/sys-role-permission-service';
import PickupViewEngine from '@engine/view/pickup-view-engine';
@Component({
components: {
},
})
export default class SysRolePermissionPickupViewBase extends Vue {
/**
* 实体服务对象
*
* @type {SysRolePermissionService}
* @memberof SysRolePermissionPickupViewBase
*/
public appEntityService: SysRolePermissionService = new SysRolePermissionService;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof SysRolePermissionPickupViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof SysRolePermissionPickupViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof SysRolePermissionPickupViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof SysRolePermissionPickupViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof SysRolePermissionPickupViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图默认使用
*
* @type {string}
* @memberof SysRolePermissionPickupViewBase
*/
@Inject({from:'navModel',default: 'tab'})
public navModel!:string;
/**
* 视图标识
*
* @type {string}
* @memberof SysRolePermissionPickupViewBase
*/
public viewtag: string = '6cd33d562ef19ad47dd26b312b9a020e';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof SysRolePermissionPickupViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof SysRolePermissionPickupViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof SysRolePermissionPickupViewBase
*/
public model: any = {
srfCaption: 'entities.sysrolepermission.views.pickupview.caption',
srfTitle: 'entities.sysrolepermission.views.pickupview.title',
srfSubTitle: 'entities.sysrolepermission.views.pickupview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof SysRolePermissionPickupViewBase
*/
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
Object.assign(this.viewparams, JSON.parse(this.viewparam));
if(this.viewparams.selectedData){
this.selectedData = JSON.stringify(this.viewparams.selectedData);
}
}
}
/**
* 处理应用上下文变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof SysRolePermissionPickupViewBase
*/
@Watch('viewdata')
onViewData(newVal: any, oldVal: any) {
const _this: any = this;
if (!Object.is(newVal, oldVal) && _this.engine) {
this.$nextTick(()=>{
_this.parseViewParam();
_this.engine.load();
});
}
}
/**
* 容器模型
*
* @type {*}
* @memberof SysRolePermissionPickupViewBase
*/
public containerModel: any = {
view_pickupviewpanel: { name: 'pickupviewpanel', type: 'PICKUPVIEWPANEL' },
view_okbtn: { name: 'okbtn', type: 'button', text: '确定', disabled: true },
view_cancelbtn: { name: 'cancelbtn', type: 'button', text: '取消', disabled: false },
view_leftbtn: { name: 'leftbtn', type: 'button', text: '左移', disabled: true },
view_rightbtn: { name: 'rightbtn', type: 'button', text: '右移', disabled: true },
view_allleftbtn: { name: 'allleftbtn', type: 'button', text: '全部左移', disabled: true },
view_allrightbtn: { name: 'allrightbtn', type: 'button', text: '全部右移', disabled: true },
};
/**
* 计数器刷新
*
* @memberof SysRolePermissionPickupViewBase
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 视图状态订阅对象
*
* @public
* @type {Subject<{action: string, data: any}>}
* @memberof SysRolePermissionPickupViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof SysRolePermissionPickupViewBase
*/
public engine: PickupViewEngine = new PickupViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof SysRolePermissionPickupViewBase
*/
public engineInit(): void {
this.engine.init({
view: this,
pickupviewpanel: this.$refs.pickupviewpanel,
keyPSDEField: 'sysrolepermission',
majorPSDEField: 'permissionid',
isLoadDefault: true,
});
}
/**
* 应用导航服务
*
* @type {*}
* @memberof SysRolePermissionPickupViewBase
*/
public navDataService = NavDataService.getInstance(this.$store);
/**
* 导航服务事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof SysRolePermissionPickupViewBase
*/
public serviceStateEvent: Subscription | undefined;
/**
* 应用上下文
*
* @type {*}
* @memberof SysRolePermissionPickupViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof SysRolePermissionPickupViewBase
*/
public viewparams:any = {};
/**
* 视图缓存数据
*
* @type {*}
* @memberof SysRolePermissionPickupViewBase
*/
public viewCacheData:any;
/**
* 解析视图参数
*
* @public
* @memberof SysRolePermissionPickupViewBase
*/
public parseViewParam(inputvalue:any = null): void {
for(let key in this.context){
delete this.context[key];
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
Object.assign(this.viewparams,{srfparentdename:this.context.srfparentdename});
}
if(this.context && this.context.srfparentkey){
Object.assign(this.viewparams,{srfparentkey:this.context.srfparentkey});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
this.handleCustomViewData();
return;
}
const path = (this.$route.matched[this.$route.matched.length - 1]).path;
const keys: Array<any> = [];
const curReg = this.$pathToRegExp.pathToRegexp(path, keys);
const matchArray = curReg.exec(this.$route.path);
let tempValue: Object = {};
keys.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item.name, {
enumerable: true,
value: matchArray[index + 1]
});
});
this.$viewTool.formatRouteParams(tempValue,this.$route,this.context,this.viewparams);
if(inputvalue){
Object.assign(this.context,{'sysrolepermission':inputvalue});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
//初始化导航数据
this.initNavDataWithRoute();
}
/**
* 处理自定义视图数据
*
* @memberof SysRolePermissionPickupViewBase
*/
public handleCustomViewData(){
if(Object.keys(this.customViewNavContexts).length > 0){
Object.keys(this.customViewNavContexts).forEach((item:any) =>{
let tempContext:any = {};
let curNavContext:any = this.customViewNavContexts[item];
this.handleCustomDataLogic(curNavContext,tempContext,item);
Object.assign(this.context,tempContext);
})
}
if(Object.keys(this.customViewParams).length > 0){
Object.keys(this.customViewParams).forEach((item:any) =>{
let tempParam:any = {};
let curNavParam:any = this.customViewParams[item];
this.handleCustomDataLogic(curNavParam,tempParam,item);
Object.assign(this.viewparams,tempParam);
})
}
}
/**
* 处理自定义视图数据逻辑
*
* @memberof SysRolePermissionPickupViewBase
*/
public handleCustomDataLogic(curNavData:any,tempData:any,item:string){
// 直接值直接赋值
if(curNavData.isRawValue){
if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: curNavData.value,
writable : true,
enumerable : true,
configurable : true
});
}
}else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(this.context[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(this.viewparams[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.viewparams[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}
}
}
}
/**
* 初始化导航数据(路由模式)
*
* @memberof SysRolePermissionPickupViewBase
*/
public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && Object.is(this.navModel,"route")) ){
this.navDataService.addNavData({id:'sys-role-permission-pickup-view',tag:this.viewtag,srfkey:isNew ? null : this.context.sysrolepermission,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath});
}
}
/**
* 初始化导航数据(分页模式)
*
* @memberof SysRolePermissionPickupViewBase
*/
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && !Object.is(this.navModel,"route")) ){
this.navDataService.addNavDataByOnly({id:'sys-role-permission-pickup-view',tag:this.viewtag,srfkey:this.context.sysrolepermission,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd);
}
}
/**
* Vue声明周期
*
* @memberof SysRolePermissionPickupViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof SysRolePermissionPickupViewBase
*/
public afterCreated(){
let _this:any = this;
const secondtag = _this.$util.createUUID();
_this.$store.commit('viewaction/createdView', { viewtag: _this.viewtag, secondtag: secondtag });
_this.viewtag = secondtag;
_this.parseViewParam();
_this.serviceStateEvent = _this.navDataService.serviceState.subscribe(({ action,name, data }:{ action:string,name:any,data:any }) => {
if(!Object.is(name,'sys-role-permission-pickup-view')){
return;
}
if (Object.is(action, 'viewrefresh')) {
_this.$nextTick(()=>{
_this.parseViewParam(data);
if(_this.engine){
_this.engine.load();
}
});
}
});
}
/**
* 销毁之前
*
* @memberof SysRolePermissionPickupViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof SysRolePermissionPickupViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof SysRolePermissionPickupViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
if(this.viewparams.selectedData){
this.engine.onCtrlEvent('pickupviewpanel', 'selectionchange', this.viewparams.selectedData);
}
}
/**
* pickupviewpanel 部件 selectionchange 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysRolePermissionPickupViewBase
*/
public pickupviewpanel_selectionchange($event: any, $event2?: any) {
this.engine.onCtrlEvent('pickupviewpanel', 'selectionchange', $event);
}
/**
* pickupviewpanel 部件 activated 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysRolePermissionPickupViewBase
*/
public pickupviewpanel_activated($event: any, $event2?: any) {
this.engine.onCtrlEvent('pickupviewpanel', 'activated', $event);
}
/**
* pickupviewpanel 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysRolePermissionPickupViewBase
*/
public pickupviewpanel_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('pickupviewpanel', 'load', $event);
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof SysRolePermissionPickupViewBase
*/
public closeView(args: any[]): void {
let _view: any = this;
if (_view.viewdata) {
_view.$emit('viewdataschange', [args]);
_view.$emit('close', [args]);
} else if (_view.$tabPageExp) {
_view.$tabPageExp.onClose(_view.$route.fullPath);
}
}
/**
* 销毁视图回调
*
* @memberof SysRolePermissionPickupViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof SysRolePermissionPickupViewBase
*/
public afterDestroyed(){
if(this.viewDefaultUsage){
let localStoreLength = Object.keys(localStorage);
if(localStoreLength.length > 0){
localStoreLength.forEach((item:string) =>{
if(item.startsWith(this.context.srfsessionid)){
localStorage.removeItem(item);
}
})
}
if(Object.is(this.navModel,"tab")){
this.navDataService.removeNavDataByTag(this.viewtag);
}
if (this.serviceStateEvent) {
this.serviceStateEvent.unsubscribe();
}
}
}
/**
* 选中数据的字符串
*
* @type {string}
* @memberof SysRolePermissionPickupViewBase
*/
public selectedData: string = "";
/**
* 视图选中数据
*
* @type {any[]}
* @memberof SysRolePermissionPickupViewBase
*/
public viewSelections:any[] = [];
/**
* 是否显示按钮
*
* @type {boolean}
* @memberof SysRolePermissionPickupViewBase
*/
@Prop({default: true}) public isShowButton!: boolean;
/**
* 是否单选
*
* @type {boolean}
* @memberof SysRolePermissionPickupViewBase
*/
public isSingleSelect: boolean = true;
/**
* 确定
*
* @memberof SysRolePermissionPickupViewBase
*/
public onClickOk(): void {
this.$emit('viewdataschange', this.viewSelections);
this.$emit('close', null);
}
/**
* 取消
*
* @memberof SysRolePermissionPickupViewBase
*/
public onClickCancel(): void {
this.$emit('close', null);
}
}
</script>
<style lang='less'>
@import './sys-role-permission-pickup-view.less';
</style>
\ No newline at end of file
.sys-role-permission-pickup-view{
position: relative;
}
.pickup-view {
>.pickupviewpanel {
flex-grow: 1;
display: flex;
justify-content: flex-end;
height: calc(100% - 64px);
}
>.footer {
height: 64px;
}
}
\ No newline at end of file
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import SysRolePermissionPickupViewBase from './sys-role-permission-pickup-view-base.vue';
import view_pickupviewpanel from '@widgets/sys-role-permission/pickup-viewpickupviewpanel-pickupviewpanel/pickup-viewpickupviewpanel-pickupviewpanel.vue';
@Component({
components: {
view_pickupviewpanel,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
if(!Object.is(vm.navModel,"route")){
vm.initNavDataWithTab(vm.viewCacheData);
}
vm.$store.commit('addCurPageViewtag', { fullPath: to.fullPath, viewtag: vm.viewtag });
});
},
})
export default class SysRolePermissionPickupView extends SysRolePermissionPickupViewBase {
}
</script>
\ No newline at end of file
<template>
<div class="view-container deredirectview sys-role-permission-redirect-view">
<app-studioaction :viewTitle="$t(model.srfTitle)" viewName="sysrolepermissionredirectview"></app-studioaction>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch,Inject } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import NavDataService from '@/service/app/navdata-service';
import { Subject,Subscription } from 'rxjs';
import SysRolePermissionService from '@/service/sys-role-permission/sys-role-permission-service';
import UIService from '@/uiservice/ui-service';
@Component({
components: {
},
})
export default class SysRolePermissionRedirectViewBase extends Vue {
/**
* 实体服务对象
*
* @type {SysRolePermissionService}
* @memberof SysRolePermissionRedirectViewBase
*/
public appEntityService: SysRolePermissionService = new SysRolePermissionService;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof SysRolePermissionRedirectViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof SysRolePermissionRedirectViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof SysRolePermissionRedirectViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof SysRolePermissionRedirectViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof SysRolePermissionRedirectViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图默认使用
*
* @type {string}
* @memberof SysRolePermissionRedirectViewBase
*/
@Inject({from:'navModel',default: 'tab'})
public navModel!:string;
/**
* 视图标识
*
* @type {string}
* @memberof SysRolePermissionRedirectViewBase
*/
public viewtag: string = '47fb02384b5797f4b095e247619515f4';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof SysRolePermissionRedirectViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof SysRolePermissionRedirectViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof SysRolePermissionRedirectViewBase
*/
public model: any = {
srfCaption: 'entities.sysrolepermission.views.redirectview.caption',
srfTitle: 'entities.sysrolepermission.views.redirectview.title',
srfSubTitle: 'entities.sysrolepermission.views.redirectview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof SysRolePermissionRedirectViewBase
*/
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}
}
/**
* 处理应用上下文变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof SysRolePermissionRedirectViewBase
*/
@Watch('viewdata')
onViewData(newVal: any, oldVal: any) {
const _this: any = this;
if (!Object.is(newVal, oldVal) && _this.engine) {
this.$nextTick(()=>{
_this.parseViewParam();
_this.engine.load();
});
}
}
/**
* 容器模型
*
* @type {*}
* @memberof SysRolePermissionRedirectViewBase
*/
public containerModel: any = {
};
/**
* 计数器刷新
*
* @memberof SysRolePermissionRedirectViewBase
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 视图状态订阅对象
*
* @public
* @type {Subject<{action: string, data: any}>}
* @memberof SysRolePermissionRedirectViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 引擎初始化
*
* @public
* @memberof SysRolePermissionRedirectViewBase
*/
public engineInit(): void {
}
/**
* 应用导航服务
*
* @type {*}
* @memberof SysRolePermissionRedirectViewBase
*/
public navDataService = NavDataService.getInstance(this.$store);
/**
* 导航服务事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof SysRolePermissionRedirectViewBase
*/
public serviceStateEvent: Subscription | undefined;
/**
* 应用上下文
*
* @type {*}
* @memberof SysRolePermissionRedirectViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof SysRolePermissionRedirectViewBase
*/
public viewparams:any = {};
/**
* 视图缓存数据
*
* @type {*}
* @memberof SysRolePermissionRedirectViewBase
*/
public viewCacheData:any;
/**
* 解析视图参数
*
* @public
* @memberof SysRolePermissionRedirectViewBase
*/
public parseViewParam(inputvalue:any = null): void {
for(let key in this.context){
delete this.context[key];
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
Object.assign(this.viewparams,{srfparentdename:this.context.srfparentdename});
}
if(this.context && this.context.srfparentkey){
Object.assign(this.viewparams,{srfparentkey:this.context.srfparentkey});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
this.handleCustomViewData();
return;
}
const path = (this.$route.matched[this.$route.matched.length - 1]).path;
const keys: Array<any> = [];
const curReg = this.$pathToRegExp.pathToRegexp(path, keys);
const matchArray = curReg.exec(this.$route.path);
let tempValue: Object = {};
keys.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item.name, {
enumerable: true,
value: matchArray[index + 1]
});
});
this.$viewTool.formatRouteParams(tempValue,this.$route,this.context,this.viewparams);
if(inputvalue){
Object.assign(this.context,{'sysrolepermission':inputvalue});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
//初始化导航数据
this.initNavDataWithRoute();
}
/**
* 处理自定义视图数据
*
* @memberof SysRolePermissionRedirectViewBase
*/
public handleCustomViewData(){
if(Object.keys(this.customViewNavContexts).length > 0){
Object.keys(this.customViewNavContexts).forEach((item:any) =>{
let tempContext:any = {};
let curNavContext:any = this.customViewNavContexts[item];
this.handleCustomDataLogic(curNavContext,tempContext,item);
Object.assign(this.context,tempContext);
})
}
if(Object.keys(this.customViewParams).length > 0){
Object.keys(this.customViewParams).forEach((item:any) =>{
let tempParam:any = {};
let curNavParam:any = this.customViewParams[item];
this.handleCustomDataLogic(curNavParam,tempParam,item);
Object.assign(this.viewparams,tempParam);
})
}
}
/**
* 处理自定义视图数据逻辑
*
* @memberof SysRolePermissionRedirectViewBase
*/
public handleCustomDataLogic(curNavData:any,tempData:any,item:string){
// 直接值直接赋值
if(curNavData.isRawValue){
if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: curNavData.value,
writable : true,
enumerable : true,
configurable : true
});
}
}else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(this.context[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(this.viewparams[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.viewparams[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}
}
}
}
/**
* 初始化导航数据(路由模式)
*
* @memberof SysRolePermissionRedirectViewBase
*/
public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && Object.is(this.navModel,"route")) ){
this.navDataService.addNavData({id:'sys-role-permission-redirect-view',tag:this.viewtag,srfkey:isNew ? null : this.context.sysrolepermission,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath});
}
}
/**
* 初始化导航数据(分页模式)
*
* @memberof SysRolePermissionRedirectViewBase
*/
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && !Object.is(this.navModel,"route")) ){
this.navDataService.addNavDataByOnly({id:'sys-role-permission-redirect-view',tag:this.viewtag,srfkey:this.context.sysrolepermission,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd);
}
}
/**
* Vue声明周期
*
* @memberof SysRolePermissionRedirectViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof SysRolePermissionRedirectViewBase
*/
public afterCreated(){
let _this:any = this;
const secondtag = _this.$util.createUUID();
_this.$store.commit('viewaction/createdView', { viewtag: _this.viewtag, secondtag: secondtag });
_this.viewtag = secondtag;
_this.parseViewParam();
_this.serviceStateEvent = _this.navDataService.serviceState.subscribe(({ action,name, data }:{ action:string,name:any,data:any }) => {
if(!Object.is(name,'sys-role-permission-redirect-view')){
return;
}
if (Object.is(action, 'viewrefresh')) {
_this.$nextTick(()=>{
_this.parseViewParam(data);
if(_this.engine){
_this.engine.load();
}
});
}
});
this.viewInit();
}
/**
* 销毁之前
*
* @memberof SysRolePermissionRedirectViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof SysRolePermissionRedirectViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof SysRolePermissionRedirectViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof SysRolePermissionRedirectViewBase
*/
public closeView(args: any[]): void {
let _view: any = this;
if (_view.viewdata) {
_view.$emit('viewdataschange', [args]);
_view.$emit('close', [args]);
} else if (_view.$tabPageExp) {
_view.$tabPageExp.onClose(_view.$route.fullPath);
}
}
/**
* 销毁视图回调
*
* @memberof SysRolePermissionRedirectViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof SysRolePermissionRedirectViewBase
*/
public afterDestroyed(){
if(this.viewDefaultUsage){
let localStoreLength = Object.keys(localStorage);
if(localStoreLength.length > 0){
localStoreLength.forEach((item:string) =>{
if(item.startsWith(this.context.srfsessionid)){
localStorage.removeItem(item);
}
})
}
if(Object.is(this.navModel,"tab")){
this.navDataService.removeNavDataByTag(this.viewtag);
}
if (this.serviceStateEvent) {
this.serviceStateEvent.unsubscribe();
}
}
}
/**
* 初始化视图
*
* @memberof SysRolePermissionRedirectViewBase
*/
public async viewInit(){
const {srfkey:srfkey,srfappde:srfappde} = this.viewparams;
const uiService:UIService = new UIService();
const targetService:any = await uiService.getService(srfappde.toLowerCase());
targetService.getRDAppView(srfkey,true).then((res:any) =>{
if(res && res.viewname && res.srfappde){
const path:string =`/${res.srfappde}/${srfkey}/${res.viewname}`;
this.$router.push({path:path});
}else{
console.error("未查找到重定向视图")
}
})
}
}
</script>
<style lang='less'>
@import './sys-role-permission-redirect-view.less';
</style>
\ No newline at end of file
.sys-role-permission-redirect-view{
position: relative;
}
.sys-role-permission-redirect-view{
display: block;
}
\ No newline at end of file
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import SysRolePermissionRedirectViewBase from './sys-role-permission-redirect-view-base.vue';
@Component({
components: {
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
if(!Object.is(vm.navModel,"route")){
vm.initNavDataWithTab(vm.viewCacheData);
}
vm.$store.commit('addCurPageViewtag', { fullPath: to.fullPath, viewtag: vm.viewtag });
});
},
})
export default class SysRolePermissionRedirectView extends SysRolePermissionRedirectViewBase {
}
</script>
\ No newline at end of file
<template>
<div class='view-container depickupgridview sys-role-pickup-grid-view'>
<app-studioaction :viewTitle="$t(model.srfTitle)" viewName="sysrolepickupgridview"></app-studioaction>
<card class='view-card view-no-caption view-no-toolbar' :dis-hover="true" :bordered="false">
<div class='content-container pickup-grid-view'>
<view_searchform
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:showBusyIndicator="true"
v-show="isExpandSearchForm"
loaddraftAction="FilterGetDraft"
loadAction="FilterGet"
name="searchform"
ref='searchform'
@save="searchform_save($event)"
@search="searchform_search($event)"
@load="searchform_load($event)"
@closeview="closeView($event)">
</view_searchform>
<view_grid
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:isSingleSelect="isSingleSelect"
:selectedData="selectedData"
:showBusyIndicator="true"
updateAction=""
removeAction="Remove"
loaddraftAction=""
loadAction=""
createAction=""
fetchAction="FetchDefault"
name="grid"
ref='grid'
@selectionchange="grid_selectionchange($event)"
@beforeload="grid_beforeload($event)"
@rowdblclick="grid_rowdblclick($event)"
@load="grid_load($event)"
@closeview="closeView($event)">
</view_grid>
</div>
</card>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch,Inject } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import NavDataService from '@/service/app/navdata-service';
import { Subject,Subscription } from 'rxjs';
import SysRoleService from '@/service/sys-role/sys-role-service';
import PickupGridViewEngine from '@engine/view/pickup-grid-view-engine';
@Component({
components: {
},
})
export default class SysRolePickupGridViewBase extends Vue {
/**
* 实体服务对象
*
* @type {SysRoleService}
* @memberof SysRolePickupGridViewBase
*/
public appEntityService: SysRoleService = new SysRoleService;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof SysRolePickupGridViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof SysRolePickupGridViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof SysRolePickupGridViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof SysRolePickupGridViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof SysRolePickupGridViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图默认使用
*
* @type {string}
* @memberof SysRolePickupGridViewBase
*/
@Inject({from:'navModel',default: 'tab'})
public navModel!:string;
/**
* 视图标识
*
* @type {string}
* @memberof SysRolePickupGridViewBase
*/
public viewtag: string = '1a3413067ee48ab30691eab9f345f517';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof SysRolePickupGridViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof SysRolePickupGridViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof SysRolePickupGridViewBase
*/
public model: any = {
srfCaption: 'entities.sysrole.views.pickupgridview.caption',
srfTitle: 'entities.sysrole.views.pickupgridview.title',
srfSubTitle: 'entities.sysrole.views.pickupgridview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof SysRolePickupGridViewBase
*/
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}
}
/**
* 处理应用上下文变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof SysRolePickupGridViewBase
*/
@Watch('viewdata')
onViewData(newVal: any, oldVal: any) {
const _this: any = this;
if (!Object.is(newVal, oldVal) && _this.engine) {
this.$nextTick(()=>{
_this.parseViewParam();
_this.engine.load();
});
}
}
/**
* 容器模型
*
* @type {*}
* @memberof SysRolePickupGridViewBase
*/
public containerModel: any = {
view_grid: { name: 'grid', type: 'GRID' },
view_searchform: { name: 'searchform', type: 'SEARCHFORM' },
};
/**
* 计数器刷新
*
* @memberof SysRolePickupGridViewBase
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 视图状态订阅对象
*
* @public
* @type {Subject<{action: string, data: any}>}
* @memberof SysRolePickupGridViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof SysRolePickupGridViewBase
*/
public engine: PickupGridViewEngine = new PickupGridViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof SysRolePickupGridViewBase
*/
public engineInit(): void {
this.engine.init({
view: this,
grid: this.$refs.grid,
searchform: this.$refs.searchform,
keyPSDEField: 'sysrole',
majorPSDEField: 'rolename',
isLoadDefault: true,
});
}
/**
* 应用导航服务
*
* @type {*}
* @memberof SysRolePickupGridViewBase
*/
public navDataService = NavDataService.getInstance(this.$store);
/**
* 导航服务事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof SysRolePickupGridViewBase
*/
public serviceStateEvent: Subscription | undefined;
/**
* 应用上下文
*
* @type {*}
* @memberof SysRolePickupGridViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof SysRolePickupGridViewBase
*/
public viewparams:any = {};
/**
* 视图缓存数据
*
* @type {*}
* @memberof SysRolePickupGridViewBase
*/
public viewCacheData:any;
/**
* 解析视图参数
*
* @public
* @memberof SysRolePickupGridViewBase
*/
public parseViewParam(inputvalue:any = null): void {
for(let key in this.context){
delete this.context[key];
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
Object.assign(this.viewparams,{srfparentdename:this.context.srfparentdename});
}
if(this.context && this.context.srfparentkey){
Object.assign(this.viewparams,{srfparentkey:this.context.srfparentkey});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
this.handleCustomViewData();
return;
}
const path = (this.$route.matched[this.$route.matched.length - 1]).path;
const keys: Array<any> = [];
const curReg = this.$pathToRegExp.pathToRegexp(path, keys);
const matchArray = curReg.exec(this.$route.path);
let tempValue: Object = {};
keys.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item.name, {
enumerable: true,
value: matchArray[index + 1]
});
});
this.$viewTool.formatRouteParams(tempValue,this.$route,this.context,this.viewparams);
if(inputvalue){
Object.assign(this.context,{'sysrole':inputvalue});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
//初始化导航数据
this.initNavDataWithRoute();
}
/**
* 处理自定义视图数据
*
* @memberof SysRolePickupGridViewBase
*/
public handleCustomViewData(){
if(Object.keys(this.customViewNavContexts).length > 0){
Object.keys(this.customViewNavContexts).forEach((item:any) =>{
let tempContext:any = {};
let curNavContext:any = this.customViewNavContexts[item];
this.handleCustomDataLogic(curNavContext,tempContext,item);
Object.assign(this.context,tempContext);
})
}
if(Object.keys(this.customViewParams).length > 0){
Object.keys(this.customViewParams).forEach((item:any) =>{
let tempParam:any = {};
let curNavParam:any = this.customViewParams[item];
this.handleCustomDataLogic(curNavParam,tempParam,item);
Object.assign(this.viewparams,tempParam);
})
}
}
/**
* 处理自定义视图数据逻辑
*
* @memberof SysRolePickupGridViewBase
*/
public handleCustomDataLogic(curNavData:any,tempData:any,item:string){
// 直接值直接赋值
if(curNavData.isRawValue){
if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: curNavData.value,
writable : true,
enumerable : true,
configurable : true
});
}
}else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(this.context[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(this.viewparams[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.viewparams[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}
}
}
}
/**
* 初始化导航数据(路由模式)
*
* @memberof SysRolePickupGridViewBase
*/
public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && Object.is(this.navModel,"route")) ){
this.navDataService.addNavData({id:'sys-role-pickup-grid-view',tag:this.viewtag,srfkey:isNew ? null : this.context.sysrole,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath});
}
}
/**
* 初始化导航数据(分页模式)
*
* @memberof SysRolePickupGridViewBase
*/
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && !Object.is(this.navModel,"route")) ){
this.navDataService.addNavDataByOnly({id:'sys-role-pickup-grid-view',tag:this.viewtag,srfkey:this.context.sysrole,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd);
}
}
/**
* Vue声明周期
*
* @memberof SysRolePickupGridViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof SysRolePickupGridViewBase
*/
public afterCreated(){
let _this:any = this;
const secondtag = _this.$util.createUUID();
_this.$store.commit('viewaction/createdView', { viewtag: _this.viewtag, secondtag: secondtag });
_this.viewtag = secondtag;
_this.parseViewParam();
_this.serviceStateEvent = _this.navDataService.serviceState.subscribe(({ action,name, data }:{ action:string,name:any,data:any }) => {
if(!Object.is(name,'sys-role-pickup-grid-view')){
return;
}
if (Object.is(action, 'viewrefresh')) {
_this.$nextTick(()=>{
_this.parseViewParam(data);
if(_this.engine){
_this.engine.load();
}
});
}
});
}
/**
* 销毁之前
*
* @memberof SysRolePickupGridViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof SysRolePickupGridViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof SysRolePickupGridViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
}
/**
* grid 部件 selectionchange 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysRolePickupGridViewBase
*/
public grid_selectionchange($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'selectionchange', $event);
}
/**
* grid 部件 beforeload 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysRolePickupGridViewBase
*/
public grid_beforeload($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'beforeload', $event);
}
/**
* grid 部件 rowdblclick 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysRolePickupGridViewBase
*/
public grid_rowdblclick($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'rowdblclick', $event);
}
/**
* grid 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysRolePickupGridViewBase
*/
public grid_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'load', $event);
}
/**
* searchform 部件 save 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysRolePickupGridViewBase
*/
public searchform_save($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'save', $event);
}
/**
* searchform 部件 search 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysRolePickupGridViewBase
*/
public searchform_search($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'search', $event);
}
/**
* searchform 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysRolePickupGridViewBase
*/
public searchform_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'load', $event);
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof SysRolePickupGridViewBase
*/
public closeView(args: any[]): void {
let _view: any = this;
if (_view.viewdata) {
_view.$emit('viewdataschange', [args]);
_view.$emit('close', [args]);
} else if (_view.$tabPageExp) {
_view.$tabPageExp.onClose(_view.$route.fullPath);
}
}
/**
* 销毁视图回调
*
* @memberof SysRolePickupGridViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof SysRolePickupGridViewBase
*/
public afterDestroyed(){
if(this.viewDefaultUsage){
let localStoreLength = Object.keys(localStorage);
if(localStoreLength.length > 0){
localStoreLength.forEach((item:string) =>{
if(item.startsWith(this.context.srfsessionid)){
localStorage.removeItem(item);
}
})
}
if(Object.is(this.navModel,"tab")){
this.navDataService.removeNavDataByTag(this.viewtag);
}
if (this.serviceStateEvent) {
this.serviceStateEvent.unsubscribe();
}
}
}
/**
* 选中数据字符串
*
* @type {string}
* @memberof SysRolePickupGridViewBase
*/
@Prop() public selectedData?: string;
/**
* 是否单选
*
* @type {boolean}
* @memberof SysRolePickupGridViewBase
*/
@Prop() public isSingleSelect?: boolean;
/**
* 搜索值
*
* @type {string}
* @memberof SysRolePickupGridViewBase
*/
public query: string = '';
/**
* 是否展开搜索表单
*
* @type {boolean}
* @memberof SysRolePickupGridViewBase
*/
public isExpandSearchForm: boolean = true;
/**
* 表格行数据默认激活模式
* 0 不激活
* 1 单击激活
* 2 双击激活
*
* @type {(number | 0 | 1 | 2)}
* @memberof SysRolePickupGridViewBase
*/
public gridRowActiveMode: number | 0 | 1 | 2 = 2;
/**
* 快速搜索
*
* @param {*} $event
* @memberof SysRolePickupGridViewBase
*/
public onSearch($event: any): void {
const refs: any = this.$refs;
if (refs.grid) {
refs.grid.load({});
}
}
}
</script>
<style lang='less'>
@import './sys-role-pickup-grid-view.less';
</style>
\ No newline at end of file
.sys-role-pickup-grid-view{
position: relative;
}
.sys-role-pickup-grid-view{
display: block;
}
\ No newline at end of file
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import SysRolePickupGridViewBase from './sys-role-pickup-grid-view-base.vue';
import view_grid from '@widgets/sys-role/main-grid/main-grid.vue';
import view_searchform from '@widgets/sys-role/default-searchform/default-searchform.vue';
@Component({
components: {
view_grid,
view_searchform,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
if(!Object.is(vm.navModel,"route")){
vm.initNavDataWithTab(vm.viewCacheData);
}
vm.$store.commit('addCurPageViewtag', { fullPath: to.fullPath, viewtag: vm.viewtag });
});
},
})
export default class SysRolePickupGridView extends SysRolePickupGridViewBase {
}
</script>
\ No newline at end of file
<template>
<div class="view-container deeditview sys-user-edit-view">
<app-studioaction :viewTitle="$t(model.srfTitle)" viewName="sysusereditview"></app-studioaction>
<card class='view-card ' :disHover="true" :bordered="false">
<div slot='title' class="header-container">
<span class='caption-info'>{{$t(model.srfTitle)}}</span>
<div class='toolbar-container'>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem3.visabled" :disabled="toolBarModels.tbitem3.disabled" class='' @click="toolbar_click({ tag: 'tbitem3' }, $event)">
<i class='fa fa-save'></i>
<span class='caption'>{{$t('entities.sysuser.editviewtoolbar_toolbar.tbitem3.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.sysuser.editviewtoolbar_toolbar.tbitem3.tip')}}</div>
</tooltip>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem5.visabled" :disabled="toolBarModels.tbitem5.disabled" class='' @click="toolbar_click({ tag: 'tbitem5' }, $event)">
<i class='sx-tb-saveandclose'></i>
<span class='caption'>{{$t('entities.sysuser.editviewtoolbar_toolbar.tbitem5.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.sysuser.editviewtoolbar_toolbar.tbitem5.tip')}}</div>
</tooltip>
<span class='seperator'>|</span> <tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem12.visabled" :disabled="toolBarModels.tbitem12.disabled" class='' @click="toolbar_click({ tag: 'tbitem12' }, $event)">
<i class='fa fa-file-text-o'></i>
<span class='caption'>{{$t('entities.sysuser.editviewtoolbar_toolbar.tbitem12.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.sysuser.editviewtoolbar_toolbar.tbitem12.tip')}}</div>
</tooltip>
<span class='seperator'>|</span> <tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem14.visabled" :disabled="toolBarModels.tbitem14.disabled" class='' @click="toolbar_click({ tag: 'tbitem14' }, $event)">
<i class='fa fa-copy'></i>
<span class='caption'>{{$t('entities.sysuser.editviewtoolbar_toolbar.tbitem14.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.sysuser.editviewtoolbar_toolbar.tbitem14.tip')}}</div>
</tooltip>
</div>
</div>
<div class="content-container">
<div class='view-top-messages'>
</div>
<view_form
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:autosave="false"
:viewtag="viewtag"
:showBusyIndicator="true"
updateAction="Update"
removeAction="Remove"
loaddraftAction="GetDraft"
loadAction="Get"
createAction="Create"
WFSubmitAction=""
WFStartAction=""
style=''
name="form"
ref='form'
@save="form_save($event)"
@remove="form_remove($event)"
@load="form_load($event)"
@closeview="closeView($event)">
</view_form>
<div class='view-bottom-messages'>
</div>
</div>
</card>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch,Inject } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import NavDataService from '@/service/app/navdata-service';
import { Subject,Subscription } from 'rxjs';
import SysUserService from '@/service/sys-user/sys-user-service';
import EditViewEngine from '@engine/view/edit-view-engine';
@Component({
components: {
},
})
export default class SysUserEditViewBase extends Vue {
/**
* 实体服务对象
*
* @type {SysUserService}
* @memberof SysUserEditViewBase
*/
public appEntityService: SysUserService = new SysUserService;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof SysUserEditViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof SysUserEditViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof SysUserEditViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof SysUserEditViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof SysUserEditViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图默认使用
*
* @type {string}
* @memberof SysUserEditViewBase
*/
@Inject({from:'navModel',default: 'tab'})
public navModel!:string;
/**
* 视图标识
*
* @type {string}
* @memberof SysUserEditViewBase
*/
public viewtag: string = '9a896aa77c214ed87ab9be4fd6c6bec5';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof SysUserEditViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof SysUserEditViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof SysUserEditViewBase
*/
public model: any = {
srfCaption: 'entities.sysuser.views.editview.caption',
srfTitle: 'entities.sysuser.views.editview.title',
srfSubTitle: 'entities.sysuser.views.editview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof SysUserEditViewBase
*/
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}
}
/**
* 处理应用上下文变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof SysUserEditViewBase
*/
@Watch('viewdata')
onViewData(newVal: any, oldVal: any) {
const _this: any = this;
if (!Object.is(newVal, oldVal) && _this.engine) {
this.$nextTick(()=>{
_this.parseViewParam();
_this.engine.load();
});
}
}
/**
* 容器模型
*
* @type {*}
* @memberof SysUserEditViewBase
*/
public containerModel: any = {
view_toolbar: { name: 'toolbar', type: 'TOOLBAR' },
view_form: { name: 'form', type: 'FORM' },
};
/**
* 计数器刷新
*
* @memberof SysUserEditViewBase
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 视图状态订阅对象
*
* @public
* @type {Subject<{action: string, data: any}>}
* @memberof SysUserEditViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 工具栏模型
*
* @type {*}
* @memberof SysUserEditView
*/
public toolBarModels: any = {
tbitem3: { name: 'tbitem3', caption: '保存', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:'2',dataaccaction: '', uiaction: { tag: 'Save', target: '' } },
tbitem5: { name: 'tbitem5', caption: '保存并关闭', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:'2',dataaccaction: '', uiaction: { tag: 'SaveAndExit', target: '' } },
tbitem6: { name: 'tbitem6', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem12: { name: 'tbitem12', caption: '新建', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:'2',dataaccaction: '', uiaction: { tag: 'New', target: '' } },
tbitem13: { name: 'tbitem13', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem14: { name: 'tbitem14', caption: '拷贝', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:'2',dataaccaction: '', uiaction: { tag: 'Copy', target: 'SINGLEKEY' } },
};
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof SysUserEditViewBase
*/
public engine: EditViewEngine = new EditViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof SysUserEditViewBase
*/
public engineInit(): void {
this.engine.init({
view: this,
form: this.$refs.form,
p2k: '0',
keyPSDEField: 'sysuser',
majorPSDEField: 'personname',
isLoadDefault: true,
});
}
/**
* 应用导航服务
*
* @type {*}
* @memberof SysUserEditViewBase
*/
public navDataService = NavDataService.getInstance(this.$store);
/**
* 导航服务事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof SysUserEditViewBase
*/
public serviceStateEvent: Subscription | undefined;
/**
* 应用上下文
*
* @type {*}
* @memberof SysUserEditViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof SysUserEditViewBase
*/
public viewparams:any = {};
/**
* 视图缓存数据
*
* @type {*}
* @memberof SysUserEditViewBase
*/
public viewCacheData:any;
/**
* 解析视图参数
*
* @public
* @memberof SysUserEditViewBase
*/
public parseViewParam(inputvalue:any = null): void {
for(let key in this.context){
delete this.context[key];
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
Object.assign(this.viewparams,{srfparentdename:this.context.srfparentdename});
}
if(this.context && this.context.srfparentkey){
Object.assign(this.viewparams,{srfparentkey:this.context.srfparentkey});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
this.handleCustomViewData();
return;
}
const path = (this.$route.matched[this.$route.matched.length - 1]).path;
const keys: Array<any> = [];
const curReg = this.$pathToRegExp.pathToRegexp(path, keys);
const matchArray = curReg.exec(this.$route.path);
let tempValue: Object = {};
keys.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item.name, {
enumerable: true,
value: matchArray[index + 1]
});
});
this.$viewTool.formatRouteParams(tempValue,this.$route,this.context,this.viewparams);
if(inputvalue){
Object.assign(this.context,{'sysuser':inputvalue});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
//初始化导航数据
this.initNavDataWithRoute();
}
/**
* 处理自定义视图数据
*
* @memberof SysUserEditViewBase
*/
public handleCustomViewData(){
if(Object.keys(this.customViewNavContexts).length > 0){
Object.keys(this.customViewNavContexts).forEach((item:any) =>{
let tempContext:any = {};
let curNavContext:any = this.customViewNavContexts[item];
this.handleCustomDataLogic(curNavContext,tempContext,item);
Object.assign(this.context,tempContext);
})
}
if(Object.keys(this.customViewParams).length > 0){
Object.keys(this.customViewParams).forEach((item:any) =>{
let tempParam:any = {};
let curNavParam:any = this.customViewParams[item];
this.handleCustomDataLogic(curNavParam,tempParam,item);
Object.assign(this.viewparams,tempParam);
})
}
}
/**
* 处理自定义视图数据逻辑
*
* @memberof SysUserEditViewBase
*/
public handleCustomDataLogic(curNavData:any,tempData:any,item:string){
// 直接值直接赋值
if(curNavData.isRawValue){
if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: curNavData.value,
writable : true,
enumerable : true,
configurable : true
});
}
}else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(this.context[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(this.viewparams[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.viewparams[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}
}
}
}
/**
* 初始化导航数据(路由模式)
*
* @memberof SysUserEditViewBase
*/
public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && Object.is(this.navModel,"route")) ){
this.navDataService.addNavData({id:'sys-user-edit-view',tag:this.viewtag,srfkey:isNew ? null : this.context.sysuser,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath});
}
}
/**
* 初始化导航数据(分页模式)
*
* @memberof SysUserEditViewBase
*/
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && !Object.is(this.navModel,"route")) ){
this.navDataService.addNavDataByOnly({id:'sys-user-edit-view',tag:this.viewtag,srfkey:this.context.sysuser,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd);
}
}
/**
* Vue声明周期
*
* @memberof SysUserEditViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof SysUserEditViewBase
*/
public afterCreated(){
let _this:any = this;
const secondtag = _this.$util.createUUID();
_this.$store.commit('viewaction/createdView', { viewtag: _this.viewtag, secondtag: secondtag });
_this.viewtag = secondtag;
_this.parseViewParam();
_this.serviceStateEvent = _this.navDataService.serviceState.subscribe(({ action,name, data }:{ action:string,name:any,data:any }) => {
if(!Object.is(name,'sys-user-edit-view')){
return;
}
if (Object.is(action, 'viewrefresh')) {
_this.$nextTick(()=>{
_this.parseViewParam(data);
if(_this.engine){
_this.engine.load();
}
});
}
});
}
/**
* 销毁之前
*
* @memberof SysUserEditViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof SysUserEditViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof SysUserEditViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
}
/**
* toolbar 部件 click 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysUserEditViewBase
*/
public toolbar_click($event: any, $event2?: any) {
if (Object.is($event.tag, 'tbitem3')) {
this.toolbar_tbitem3_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem5')) {
this.toolbar_tbitem5_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem9')) {
this.toolbar_tbitem9_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem10')) {
this.toolbar_tbitem10_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem12')) {
this.toolbar_tbitem12_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem14')) {
this.toolbar_tbitem14_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem15')) {
this.toolbar_tbitem15_click(null, '', $event2);
}
}
/**
* form 部件 save 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysUserEditViewBase
*/
public form_save($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'save', $event);
}
/**
* form 部件 remove 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysUserEditViewBase
*/
public form_remove($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'remove', $event);
}
/**
* form 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysUserEditViewBase
*/
public form_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'load', $event);
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem3_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Save(datas, contextJO,paramJO, $event, xData,this,"SysUser");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem5_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.SaveAndExit(datas, contextJO,paramJO, $event, xData,this,"SysUser");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem9_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.SaveAndStart(datas, contextJO,paramJO, $event, xData,this,"SysUser");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem10_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.ViewWFStep(datas, contextJO,paramJO, $event, xData,this,"SysUser");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem12_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.New(datas, contextJO,paramJO, $event, xData,this,"SysUser");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem14_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Copy(datas, contextJO,paramJO, $event, xData,this,"SysUser");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem15_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Print(datas, contextJO,paramJO, $event, xData,this,"SysUser");
}
/**
* 保存
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysUserEditViewBase
*/
public Save(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
// 界面行为容器对象 _this
const _this: any = this;
if (xData && xData.save instanceof Function) {
xData.save().then((response: any) => {
if (!response || response.status !== 200) {
return;
}
_this.$emit('viewdataschange', [{ ...response.data }]);
});
} else if (_this.save && _this.save instanceof Function) {
_this.save();
}
}
/**
* 保存并关闭
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysUserEditViewBase
*/
public SaveAndExit(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (xData && xData.saveAndExit instanceof Function) {
xData.saveAndExit().then((response: any) => {
if (!response || response.status !== 200) {
return;
}
if(window.parent){
window.parent.postMessage([{ ...response.data }],'*');
}
});
} else if (_this.saveAndExit && _this.saveAndExit instanceof Function) {
_this.saveAndExit().then((response: any) => {
if (!response || response.status !== 200) {
return;
}
if(window.parent){
window.parent.postMessage([{ ...response.data }],'*');
}
});
}
}
/**
* 开始流程
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysUserEditViewBase
*/
public SaveAndStart(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (!xData || !(xData.wfstart instanceof Function)) {
return;
}
xData.wfstart(args).then((response: any) => {
if (!response || response.status !== 200) {
return;
}
const { data: _data } = response;
if(window.parent){
window.parent.postMessage({ ..._data },'*');
}
if (_this.viewdata) {
_this.$emit('viewdataschange', [{ ..._data }]);
_this.$emit('close');
}else if (this.$tabPageExp) {
this.$tabPageExp.onClose(this.$route.fullPath);
}
});
}
/**
* 当前流程步骤
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysUserEditViewBase
*/
public ViewWFStep(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
let _this:any = this;
if (!xData || !(xData.wfsubmit instanceof Function)) {
return;
}
xData.wfsubmit(args).then((response: any) => {
if (!response || response.status !== 200) {
return;
}
const { data: _data } = response;
if (_this.viewdata) {
_this.$emit('viewdataschange', [{ ..._data }]);
_this.$emit('close');
} else if (_this.$tabPageExp) {
_this.$tabPageExp.onClose(_this.$route.fullPath);
}
});
}
/**
* 新建
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysUserEditViewBase
*/
public New(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (_this.newdata && _this.newdata instanceof Function) {
const data: any = {};
_this.newdata([{ ...data }],[{ ...data }], params, $event, xData);
} else {
_this.$Notice.error({ title: '错误', desc: 'newdata 视图处理逻辑不存在,请添加!' });
}
}
/**
* 拷贝
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysUserEditViewBase
*/
public Copy(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
if (args.length === 0) {
return;
}
const _this: any = this;
if (_this.newdata && _this.newdata instanceof Function) {
const data: any = {};
if (args.length > 0) {
Object.assign(data, { srfsourcekey: args[0].srfkey })
actionContext.$store.commit('addCopyData', { srfkey: args[0].srfkey, copyData: args[0] });
}
_this.newdata([{ ...data }],[{ ...data }],params, $event, xData);
} else if (xData && xData.copy instanceof Function) {
if (args.length > 0) {
actionContext.$store.commit('addCopyData', { srfkey: args[0].srfkey, copyData: args[0] });
}
xData.copy(args[0].srfkey);
} else {
_this.$Notice.error({ title: '错误', desc: 'opendata 视图处理逻辑不存在,请添加!' });
}
}
/**
* 打印
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysUserEditViewBase
*/
public Print(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
let _this:any = this;
if (!xData || !(xData.print instanceof Function) || !$event) {
return ;
}
xData.print();
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof SysUserEditViewBase
*/
public closeView(args: any[]): void {
let _view: any = this;
if (_view.viewdata) {
_view.$emit('viewdataschange', [args]);
_view.$emit('close', [args]);
} else if (_view.$tabPageExp) {
_view.$tabPageExp.onClose(_view.$route.fullPath);
}
}
/**
* 销毁视图回调
*
* @memberof SysUserEditViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof SysUserEditViewBase
*/
public afterDestroyed(){
if(this.viewDefaultUsage){
let localStoreLength = Object.keys(localStorage);
if(localStoreLength.length > 0){
localStoreLength.forEach((item:string) =>{
if(item.startsWith(this.context.srfsessionid)){
localStorage.removeItem(item);
}
})
}
if(Object.is(this.navModel,"tab")){
this.navDataService.removeNavDataByTag(this.viewtag);
}
if (this.serviceStateEvent) {
this.serviceStateEvent.unsubscribe();
}
}
}
}
</script>
<style lang='less'>
@import './sys-user-edit-view.less';
</style>
\ No newline at end of file
.view-card {
>.ivu-card-extra {
top: 5px;
right: 0px;
}
}
.sys-user-edit-view{
position: relative;
}
.toolbar-container {
button {
margin: 6px 0px 4px 4px;
.caption {
margin-left: 4px;
}
}
.seperator {
color: #dcdee2;
margin: 0 0px 0 4px;
}
}
// this is less
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import SysUserEditViewBase from './sys-user-edit-view-base.vue';
import view_form from '@widgets/sys-user/main-form/main-form.vue';
@Component({
components: {
view_form,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
if(!Object.is(vm.navModel,"route")){
vm.initNavDataWithTab(vm.viewCacheData);
}
vm.$store.commit('addCurPageViewtag', { fullPath: to.fullPath, viewtag: vm.viewtag });
});
},
})
export default class SysUserEditView extends SysUserEditViewBase {
}
</script>
\ No newline at end of file
<template>
<div class="view-container deeditview2 sys-user-role-edit-view2">
<app-studioaction :viewTitle="$t(model.srfTitle)" viewName="sysuserroleeditview2"></app-studioaction>
<card class='view-card ' :dis-hover="true" :bordered="false">
<div slot='title' class="header-container">
<span class='caption-info'>{{$t(model.srfTitle)}}</span>
<template v-if="Object.is(this.selection.id, 'form')">
<div class='toolbar-container'>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem3.visabled" :disabled="toolBarModels.tbitem3.disabled" class='' @click="toolbar_click({ tag: 'tbitem3' }, $event)">
<i class='fa fa-save'></i>
<span class='caption'>{{$t('entities.sysuserrole.editview2toolbar_toolbar.tbitem3.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.sysuserrole.editview2toolbar_toolbar.tbitem3.tip')}}</div>
</tooltip>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem5.visabled" :disabled="toolBarModels.tbitem5.disabled" class='' @click="toolbar_click({ tag: 'tbitem5' }, $event)">
<i class='sx-tb-saveandclose'></i>
<span class='caption'>{{$t('entities.sysuserrole.editview2toolbar_toolbar.tbitem5.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.sysuserrole.editview2toolbar_toolbar.tbitem5.tip')}}</div>
</tooltip>
<span class='seperator'>|</span> <tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem12.visabled" :disabled="toolBarModels.tbitem12.disabled" class='' @click="toolbar_click({ tag: 'tbitem12' }, $event)">
<i class='fa fa-file-text-o'></i>
<span class='caption'>{{$t('entities.sysuserrole.editview2toolbar_toolbar.tbitem12.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.sysuserrole.editview2toolbar_toolbar.tbitem12.tip')}}</div>
</tooltip>
<span class='seperator'>|</span> <tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem14.visabled" :disabled="toolBarModels.tbitem14.disabled" class='' @click="toolbar_click({ tag: 'tbitem14' }, $event)">
<i class='fa fa-copy'></i>
<span class='caption'>{{$t('entities.sysuserrole.editview2toolbar_toolbar.tbitem14.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.sysuserrole.editview2toolbar_toolbar.tbitem14.tip')}}</div>
</tooltip>
</div>
</template>
</div>
<div class="content-container edit-view2">
<view_drbar
:viewState="viewState"
loadAction='get'
name='drbar'
ref='drbar'
:viewparams="viewparams"
:context="context"
:formData="formData"
@selectionchange="drbar_selectionchange($event)"
@load="drbar_load($event)"
@closeview="closeView($event)">
<view_form
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:autosave="false"
:viewtag="viewtag"
:showBusyIndicator="true"
updateAction="Update"
removeAction="Remove"
loaddraftAction="GetDraft"
loadAction="Get"
createAction="Create"
WFSubmitAction=""
WFStartAction=""
style=''
name="form"
ref='form'
@save="form_save($event)"
@remove="form_remove($event)"
@load="form_load($event)"
@closeview="closeView($event)">
</view_form>
</view_drbar>
</div>
</card>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch,Inject } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import NavDataService from '@/service/app/navdata-service';
import { Subject,Subscription } from 'rxjs';
import SysUserRoleService from '@/service/sys-user-role/sys-user-role-service';
import EditView2Engine from '@engine/view/edit-view2-engine';
@Component({
components: {
},
})
export default class SysUserRoleEditView2Base extends Vue {
/**
* 实体服务对象
*
* @type {SysUserRoleService}
* @memberof SysUserRoleEditView2Base
*/
public appEntityService: SysUserRoleService = new SysUserRoleService;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof SysUserRoleEditView2Base
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof SysUserRoleEditView2Base
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof SysUserRoleEditView2Base
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof SysUserRoleEditView2Base
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof SysUserRoleEditView2Base
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图默认使用
*
* @type {string}
* @memberof SysUserRoleEditView2Base
*/
@Inject({from:'navModel',default: 'tab'})
public navModel!:string;
/**
* 视图标识
*
* @type {string}
* @memberof SysUserRoleEditView2Base
*/
public viewtag: string = 'ede089b4741590173bd21b9df99c1cf0';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof SysUserRoleEditView2Base
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof SysUserRoleEditView2Base
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof SysUserRoleEditView2Base
*/
public model: any = {
srfCaption: 'entities.sysuserrole.views.editview2.caption',
srfTitle: 'entities.sysuserrole.views.editview2.title',
srfSubTitle: 'entities.sysuserrole.views.editview2.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof SysUserRoleEditView2Base
*/
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}
}
/**
* 处理应用上下文变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof SysUserRoleEditView2Base
*/
@Watch('viewdata')
onViewData(newVal: any, oldVal: any) {
const _this: any = this;
if (!Object.is(newVal, oldVal) && _this.engine) {
this.$nextTick(()=>{
_this.parseViewParam();
_this.engine.load();
});
}
}
/**
* 容器模型
*
* @type {*}
* @memberof SysUserRoleEditView2Base
*/
public containerModel: any = {
view_toolbar: { name: 'toolbar', type: 'TOOLBAR' },
view_form: { name: 'form', type: 'FORM' },
view_drbar: { name: 'drbar', type: 'DRBAR' },
};
/**
* 计数器刷新
*
* @memberof SysUserRoleEditView2Base
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 视图状态订阅对象
*
* @public
* @type {Subject<{action: string, data: any}>}
* @memberof SysUserRoleEditView2Base
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 工具栏模型
*
* @type {*}
* @memberof SysUserRoleEditView2
*/
public toolBarModels: any = {
tbitem3: { name: 'tbitem3', caption: '保存', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:'2',dataaccaction: '', uiaction: { tag: 'Save', target: '' } },
tbitem5: { name: 'tbitem5', caption: '保存并关闭', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:'2',dataaccaction: '', uiaction: { tag: 'SaveAndExit', target: '' } },
tbitem6: { name: 'tbitem6', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem12: { name: 'tbitem12', caption: '新建', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:'2',dataaccaction: '', uiaction: { tag: 'New', target: '' } },
tbitem13: { name: 'tbitem13', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem14: { name: 'tbitem14', caption: '拷贝', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:'2',dataaccaction: '', uiaction: { tag: 'Copy', target: 'SINGLEKEY' } },
};
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof SysUserRoleEditView2Base
*/
public engine: EditView2Engine = new EditView2Engine();
/**
* 引擎初始化
*
* @public
* @memberof SysUserRoleEditView2Base
*/
public engineInit(): void {
this.engine.init({
view: this,
drbar: this.$refs.drbar,
form: this.$refs.form,
p2k: '0',
keyPSDEField: 'sysuserrole',
majorPSDEField: 'userid',
isLoadDefault: true,
});
}
/**
* 应用导航服务
*
* @type {*}
* @memberof SysUserRoleEditView2Base
*/
public navDataService = NavDataService.getInstance(this.$store);
/**
* 导航服务事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof SysUserRoleEditView2Base
*/
public serviceStateEvent: Subscription | undefined;
/**
* 应用上下文
*
* @type {*}
* @memberof SysUserRoleEditView2Base
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof SysUserRoleEditView2Base
*/
public viewparams:any = {};
/**
* 视图缓存数据
*
* @type {*}
* @memberof SysUserRoleEditView2Base
*/
public viewCacheData:any;
/**
* 解析视图参数
*
* @public
* @memberof SysUserRoleEditView2Base
*/
public parseViewParam(inputvalue:any = null): void {
for(let key in this.context){
delete this.context[key];
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
Object.assign(this.viewparams,{srfparentdename:this.context.srfparentdename});
}
if(this.context && this.context.srfparentkey){
Object.assign(this.viewparams,{srfparentkey:this.context.srfparentkey});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
this.handleCustomViewData();
return;
}
const path = (this.$route.matched[this.$route.matched.length - 1]).path;
const keys: Array<any> = [];
const curReg = this.$pathToRegExp.pathToRegexp(path, keys);
const matchArray = curReg.exec(this.$route.path);
let tempValue: Object = {};
keys.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item.name, {
enumerable: true,
value: matchArray[index + 1]
});
});
this.$viewTool.formatRouteParams(tempValue,this.$route,this.context,this.viewparams);
if(inputvalue){
Object.assign(this.context,{'sysuserrole':inputvalue});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
//初始化导航数据
this.initNavDataWithRoute();
}
/**
* 处理自定义视图数据
*
* @memberof SysUserRoleEditView2Base
*/
public handleCustomViewData(){
if(Object.keys(this.customViewNavContexts).length > 0){
Object.keys(this.customViewNavContexts).forEach((item:any) =>{
let tempContext:any = {};
let curNavContext:any = this.customViewNavContexts[item];
this.handleCustomDataLogic(curNavContext,tempContext,item);
Object.assign(this.context,tempContext);
})
}
if(Object.keys(this.customViewParams).length > 0){
Object.keys(this.customViewParams).forEach((item:any) =>{
let tempParam:any = {};
let curNavParam:any = this.customViewParams[item];
this.handleCustomDataLogic(curNavParam,tempParam,item);
Object.assign(this.viewparams,tempParam);
})
}
}
/**
* 处理自定义视图数据逻辑
*
* @memberof SysUserRoleEditView2Base
*/
public handleCustomDataLogic(curNavData:any,tempData:any,item:string){
// 直接值直接赋值
if(curNavData.isRawValue){
if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: curNavData.value,
writable : true,
enumerable : true,
configurable : true
});
}
}else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(this.context[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(this.viewparams[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.viewparams[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}
}
}
}
/**
* 初始化导航数据(路由模式)
*
* @memberof SysUserRoleEditView2Base
*/
public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && Object.is(this.navModel,"route")) ){
this.navDataService.addNavData({id:'sys-user-role-edit-view2',tag:this.viewtag,srfkey:isNew ? null : this.context.sysuserrole,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath});
}
}
/**
* 初始化导航数据(分页模式)
*
* @memberof SysUserRoleEditView2Base
*/
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && !Object.is(this.navModel,"route")) ){
this.navDataService.addNavDataByOnly({id:'sys-user-role-edit-view2',tag:this.viewtag,srfkey:this.context.sysuserrole,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd);
}
}
/**
* Vue声明周期
*
* @memberof SysUserRoleEditView2Base
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof SysUserRoleEditView2Base
*/
public afterCreated(){
let _this:any = this;
const secondtag = _this.$util.createUUID();
_this.$store.commit('viewaction/createdView', { viewtag: _this.viewtag, secondtag: secondtag });
_this.viewtag = secondtag;
_this.parseViewParam();
_this.serviceStateEvent = _this.navDataService.serviceState.subscribe(({ action,name, data }:{ action:string,name:any,data:any }) => {
if(!Object.is(name,'sys-user-role-edit-view2')){
return;
}
if (Object.is(action, 'viewrefresh')) {
_this.$nextTick(()=>{
_this.parseViewParam(data);
if(_this.engine){
_this.engine.load();
}
});
}
});
}
/**
* 销毁之前
*
* @memberof SysUserRoleEditView2Base
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof SysUserRoleEditView2Base
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof SysUserRoleEditView2Base
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
}
/**
* toolbar 部件 click 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysUserRoleEditView2Base
*/
public toolbar_click($event: any, $event2?: any) {
if (Object.is($event.tag, 'tbitem3')) {
this.toolbar_tbitem3_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem5')) {
this.toolbar_tbitem5_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem9')) {
this.toolbar_tbitem9_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem10')) {
this.toolbar_tbitem10_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem12')) {
this.toolbar_tbitem12_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem14')) {
this.toolbar_tbitem14_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem15')) {
this.toolbar_tbitem15_click(null, '', $event2);
}
}
/**
* form 部件 save 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysUserRoleEditView2Base
*/
public form_save($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'save', $event);
}
/**
* form 部件 remove 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysUserRoleEditView2Base
*/
public form_remove($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'remove', $event);
}
/**
* form 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysUserRoleEditView2Base
*/
public form_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'load', $event);
}
/**
* drbar 部件 selectionchange 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysUserRoleEditView2Base
*/
public drbar_selectionchange($event: any, $event2?: any) {
this.engine.onCtrlEvent('drbar', 'selectionchange', $event);
}
/**
* drbar 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysUserRoleEditView2Base
*/
public drbar_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('drbar', 'load', $event);
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem3_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Save(datas, contextJO,paramJO, $event, xData,this,"SysUserRole");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem5_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.SaveAndExit(datas, contextJO,paramJO, $event, xData,this,"SysUserRole");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem9_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.SaveAndStart(datas, contextJO,paramJO, $event, xData,this,"SysUserRole");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem10_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.ViewWFStep(datas, contextJO,paramJO, $event, xData,this,"SysUserRole");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem12_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.New(datas, contextJO,paramJO, $event, xData,this,"SysUserRole");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem14_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Copy(datas, contextJO,paramJO, $event, xData,this,"SysUserRole");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem15_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Print(datas, contextJO,paramJO, $event, xData,this,"SysUserRole");
}
/**
* 保存
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysUserRoleEditView2Base
*/
public Save(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
// 界面行为容器对象 _this
const _this: any = this;
if (xData && xData.save instanceof Function) {
xData.save().then((response: any) => {
if (!response || response.status !== 200) {
return;
}
_this.$emit('viewdataschange', [{ ...response.data }]);
});
} else if (_this.save && _this.save instanceof Function) {
_this.save();
}
}
/**
* 保存并关闭
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysUserRoleEditView2Base
*/
public SaveAndExit(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (xData && xData.saveAndExit instanceof Function) {
xData.saveAndExit().then((response: any) => {
if (!response || response.status !== 200) {
return;
}
if(window.parent){
window.parent.postMessage([{ ...response.data }],'*');
}
});
} else if (_this.saveAndExit && _this.saveAndExit instanceof Function) {
_this.saveAndExit().then((response: any) => {
if (!response || response.status !== 200) {
return;
}
if(window.parent){
window.parent.postMessage([{ ...response.data }],'*');
}
});
}
}
/**
* 开始流程
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysUserRoleEditView2Base
*/
public SaveAndStart(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (!xData || !(xData.wfstart instanceof Function)) {
return;
}
xData.wfstart(args).then((response: any) => {
if (!response || response.status !== 200) {
return;
}
const { data: _data } = response;
if(window.parent){
window.parent.postMessage({ ..._data },'*');
}
if (_this.viewdata) {
_this.$emit('viewdataschange', [{ ..._data }]);
_this.$emit('close');
}else if (this.$tabPageExp) {
this.$tabPageExp.onClose(this.$route.fullPath);
}
});
}
/**
* 当前流程步骤
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysUserRoleEditView2Base
*/
public ViewWFStep(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
let _this:any = this;
if (!xData || !(xData.wfsubmit instanceof Function)) {
return;
}
xData.wfsubmit(args).then((response: any) => {
if (!response || response.status !== 200) {
return;
}
const { data: _data } = response;
if (_this.viewdata) {
_this.$emit('viewdataschange', [{ ..._data }]);
_this.$emit('close');
} else if (_this.$tabPageExp) {
_this.$tabPageExp.onClose(_this.$route.fullPath);
}
});
}
/**
* 新建
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysUserRoleEditView2Base
*/
public New(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (_this.newdata && _this.newdata instanceof Function) {
const data: any = {};
_this.newdata([{ ...data }],[{ ...data }], params, $event, xData);
} else {
_this.$Notice.error({ title: '错误', desc: 'newdata 视图处理逻辑不存在,请添加!' });
}
}
/**
* 拷贝
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysUserRoleEditView2Base
*/
public Copy(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
if (args.length === 0) {
return;
}
const _this: any = this;
if (_this.newdata && _this.newdata instanceof Function) {
const data: any = {};
if (args.length > 0) {
Object.assign(data, { srfsourcekey: args[0].srfkey })
actionContext.$store.commit('addCopyData', { srfkey: args[0].srfkey, copyData: args[0] });
}
_this.newdata([{ ...data }],[{ ...data }],params, $event, xData);
} else if (xData && xData.copy instanceof Function) {
if (args.length > 0) {
actionContext.$store.commit('addCopyData', { srfkey: args[0].srfkey, copyData: args[0] });
}
xData.copy(args[0].srfkey);
} else {
_this.$Notice.error({ title: '错误', desc: 'opendata 视图处理逻辑不存在,请添加!' });
}
}
/**
* 打印
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysUserRoleEditView2Base
*/
public Print(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
let _this:any = this;
if (!xData || !(xData.print instanceof Function) || !$event) {
return ;
}
xData.print();
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof SysUserRoleEditView2Base
*/
public closeView(args: any[]): void {
let _view: any = this;
if (_view.viewdata) {
_view.$emit('viewdataschange', [args]);
_view.$emit('close', [args]);
} else if (_view.$tabPageExp) {
_view.$tabPageExp.onClose(_view.$route.fullPath);
}
}
/**
* 销毁视图回调
*
* @memberof SysUserRoleEditView2Base
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof SysUserRoleEditView2Base
*/
public afterDestroyed(){
if(this.viewDefaultUsage){
let localStoreLength = Object.keys(localStorage);
if(localStoreLength.length > 0){
localStoreLength.forEach((item:string) =>{
if(item.startsWith(this.context.srfsessionid)){
localStorage.removeItem(item);
}
})
}
if(Object.is(this.navModel,"tab")){
this.navDataService.removeNavDataByTag(this.viewtag);
}
if (this.serviceStateEvent) {
this.serviceStateEvent.unsubscribe();
}
}
}
/**
* 选中数据
*
* @type {*}
* @memberof SysUserRoleEditView2Base
*/
public selection: any = {};
/**
* 表单数据
*
* @type {*}
* @memberof SysUserRoleEditView2Base
*/
public formData:any = {};
}
</script>
<style lang='less'>
@import './sys-user-role-edit-view2.less';
</style>
\ No newline at end of file
.view-card {
>.ivu-card-extra {
top: 5px;
right: 0px;
}
}
.edit-view2 {
flex-direction: row !important;
.view-form {
overflow: auto;
}
}
.sys-user-role-edit-view2{
position: relative;
}
.toolbar-container {
button {
margin: 6px 0px 4px 4px;
.caption {
margin-left: 4px;
}
}
.seperator {
color: #dcdee2;
margin: 0 0px 0 4px;
}
}
// this is less
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import SysUserRoleEditView2Base from './sys-user-role-edit-view2-base.vue';
import view_form from '@widgets/sys-user-role/main-form/main-form.vue';
import view_drbar from '@widgets/sys-user-role/default-drbar/default-drbar.vue';
@Component({
components: {
view_form,
view_drbar,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
if(!Object.is(vm.navModel,"route")){
vm.initNavDataWithTab(vm.viewCacheData);
}
vm.$store.commit('addCurPageViewtag', { fullPath: to.fullPath, viewtag: vm.viewtag });
});
},
})
export default class SysUserRoleEditView2 extends SysUserRoleEditView2Base {
}
</script>
\ No newline at end of file
......@@ -47,7 +47,7 @@ export const viewstate: any = {
{
viewtag: '1a3413067ee48ab30691eab9f345f517',
viewmodule: 'uaa',
viewname: 'SYS_ROLEPickupGridView',
viewname: 'SysRolePickupGridView',
viewaction: '',
viewdatachange: false,
refviews: [
......@@ -96,7 +96,7 @@ export const viewstate: any = {
{
viewtag: '3e133a839b837d9e47f80e161d66a861',
viewmodule: 'uaa',
viewname: 'SYS_ROLE_PERMISSIONMPickupView',
viewname: 'SysRolePermissionMPickupView',
viewaction: '',
viewdatachange: false,
refviews: [
......@@ -116,7 +116,7 @@ export const viewstate: any = {
{
viewtag: '4470edcdb57a14007444c0d9867e571c',
viewmodule: 'uaa',
viewname: 'SYS_ROLEEditView2',
viewname: 'SysRoleEditView2',
viewaction: '',
viewdatachange: false,
refviews: [
......@@ -127,7 +127,7 @@ export const viewstate: any = {
{
viewtag: '47fb02384b5797f4b095e247619515f4',
viewmodule: 'uaa',
viewname: 'SYS_ROLE_PERMISSIONRedirectView',
viewname: 'SysRolePermissionRedirectView',
viewaction: '',
viewdatachange: false,
refviews: [
......@@ -158,7 +158,7 @@ export const viewstate: any = {
{
viewtag: '6cd33d562ef19ad47dd26b312b9a020e',
viewmodule: 'uaa',
viewname: 'SYS_ROLE_PERMISSIONPickupView',
viewname: 'SysRolePermissionPickupView',
viewaction: '',
viewdatachange: false,
refviews: [
......@@ -168,7 +168,7 @@ export const viewstate: any = {
{
viewtag: '6f5a41631520da5e33294a1225101e66',
viewmodule: 'uaa',
viewname: 'SYS_ROLEEditView',
viewname: 'SysRoleEditView',
viewaction: '',
viewdatachange: false,
refviews: [
......@@ -259,7 +259,7 @@ export const viewstate: any = {
{
viewtag: '9a896aa77c214ed87ab9be4fd6c6bec5',
viewmodule: 'uaa',
viewname: 'SYS_USEREditView',
viewname: 'SysUserEditView',
viewaction: '',
viewdatachange: false,
refviews: [
......@@ -358,7 +358,7 @@ export const viewstate: any = {
{
viewtag: 'e791be173ed0f4bbe9cce942b6edde63',
viewmodule: 'uaa',
viewname: 'SYS_ROLE_PERMISSIONCustomView',
viewname: 'SysRolePermissionCustomView',
viewaction: '',
viewdatachange: false,
refviews: [
......@@ -376,7 +376,7 @@ export const viewstate: any = {
{
viewtag: 'ede089b4741590173bd21b9df99c1cf0',
viewmodule: 'uaa',
viewname: 'SYS_USER_ROLEEditView2',
viewname: 'SysUserRoleEditView2',
viewaction: '',
viewdatachange: false,
refviews: [
......
......@@ -54,7 +54,7 @@
refviewtype='DECUSTOMVIEW'
refreshitems=''
:ignorefieldvaluechange="ignorefieldvaluechange"
viewname='sys-role-permissioncustom-view'
viewname='sys-role-permission-custom-view'
:data="JSON.stringify(this.data)"
@drdatasaved="drdatasaved($event)"
style=";overflow: auto;">
......@@ -1176,7 +1176,7 @@ export default class MainBase extends Vue implements ControlInterface {
*/
public load(opt: any = {}): void {
if(!this.loadAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'SYS_ROLEEditView' + (this.$t('app.formpage.notconfig.loadaction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'SysRoleEditView' + (this.$t('app.formpage.notconfig.loadaction') as string) });
return;
}
const arg: any = { ...opt };
......@@ -1211,7 +1211,7 @@ export default class MainBase extends Vue implements ControlInterface {
*/
public loadDraft(opt: any = {}): void {
if(!this.loaddraftAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'SYS_ROLEEditView' + (this.$t('app.formpage.notconfig.loaddraftaction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'SysRoleEditView' + (this.$t('app.formpage.notconfig.loaddraftaction') as string) });
return;
}
const arg: any = { ...opt } ;
......@@ -1273,7 +1273,7 @@ export default class MainBase extends Vue implements ControlInterface {
const action: any = Object.is(data.srfuf, '1') ? this.updateAction : this.createAction;
if(!action){
let actionName:any = Object.is(data.srfuf, '1')?"updateAction":"createAction";
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'SYS_ROLEEditView' + (this.$t('app.formpage.notconfig.actionname') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'SysRoleEditView' + (this.$t('app.formpage.notconfig.actionname') as string) });
return;
}
Object.assign(arg,{viewparams:this.viewparams});
......@@ -1348,7 +1348,7 @@ export default class MainBase extends Vue implements ControlInterface {
const action: any = Object.is(data.srfuf, '1') ? this.updateAction : this.createAction;
if(!action){
let actionName:any = Object.is(data.srfuf, '1')?"updateAction":"createAction";
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'SYS_ROLEEditView' + (this.$t('app.formpage.notconfig.actionname') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'SysRoleEditView' + (this.$t('app.formpage.notconfig.actionname') as string) });
return;
}
Object.assign(arg,{viewparams:this.viewparams});
......@@ -1409,7 +1409,7 @@ export default class MainBase extends Vue implements ControlInterface {
public remove(opt:Array<any> = [],showResultInfo?: boolean): Promise<any> {
return new Promise((resolve: any, reject: any) => {
if(!this.removeAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'SYS_ROLEEditView' + (this.$t('app.formpage.notconfig.removeaction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'SysRoleEditView' + (this.$t('app.formpage.notconfig.removeaction') as string) });
return;
}
const arg: any = opt[0];
......
......@@ -173,7 +173,7 @@ export default class MPickupViewpickupviewpanelBase extends Vue implements Contr
* @memberof MPickupViewpickupviewpanelBase
*/
public view: any = {
viewname: 'sys-rolepickup-grid-view',
viewname: 'sys-role-pickup-grid-view',
data: {},
}
......
......@@ -173,7 +173,7 @@ export default class PickupViewpickupviewpanelBase extends Vue implements Contro
* @memberof PickupViewpickupviewpanelBase
*/
public view: any = {
viewname: 'sys-rolepickup-grid-view',
viewname: 'sys-role-pickup-grid-view',
data: {},
}
......
......@@ -1179,7 +1179,7 @@ export default class MainBase extends Vue implements ControlInterface {
*/
public load(opt: any = {}): void {
if(!this.loadAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'SYS_USER_ROLEEditView2' + (this.$t('app.formpage.notconfig.loadaction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'SysUserRoleEditView2' + (this.$t('app.formpage.notconfig.loadaction') as string) });
return;
}
const arg: any = { ...opt };
......@@ -1214,7 +1214,7 @@ export default class MainBase extends Vue implements ControlInterface {
*/
public loadDraft(opt: any = {}): void {
if(!this.loaddraftAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'SYS_USER_ROLEEditView2' + (this.$t('app.formpage.notconfig.loaddraftaction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'SysUserRoleEditView2' + (this.$t('app.formpage.notconfig.loaddraftaction') as string) });
return;
}
const arg: any = { ...opt } ;
......@@ -1276,7 +1276,7 @@ export default class MainBase extends Vue implements ControlInterface {
const action: any = Object.is(data.srfuf, '1') ? this.updateAction : this.createAction;
if(!action){
let actionName:any = Object.is(data.srfuf, '1')?"updateAction":"createAction";
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'SYS_USER_ROLEEditView2' + (this.$t('app.formpage.notconfig.actionname') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'SysUserRoleEditView2' + (this.$t('app.formpage.notconfig.actionname') as string) });
return;
}
Object.assign(arg,{viewparams:this.viewparams});
......@@ -1351,7 +1351,7 @@ export default class MainBase extends Vue implements ControlInterface {
const action: any = Object.is(data.srfuf, '1') ? this.updateAction : this.createAction;
if(!action){
let actionName:any = Object.is(data.srfuf, '1')?"updateAction":"createAction";
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'SYS_USER_ROLEEditView2' + (this.$t('app.formpage.notconfig.actionname') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'SysUserRoleEditView2' + (this.$t('app.formpage.notconfig.actionname') as string) });
return;
}
Object.assign(arg,{viewparams:this.viewparams});
......@@ -1412,7 +1412,7 @@ export default class MainBase extends Vue implements ControlInterface {
public remove(opt:Array<any> = [],showResultInfo?: boolean): Promise<any> {
return new Promise((resolve: any, reject: any) => {
if(!this.removeAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'SYS_USER_ROLEEditView2' + (this.$t('app.formpage.notconfig.removeaction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'SysUserRoleEditView2' + (this.$t('app.formpage.notconfig.removeaction') as string) });
return;
}
const arg: any = opt[0];
......
......@@ -1166,7 +1166,7 @@ export default class MainBase extends Vue implements ControlInterface {
*/
public load(opt: any = {}): void {
if(!this.loadAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'SYS_USEREditView' + (this.$t('app.formpage.notconfig.loadaction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'SysUserEditView' + (this.$t('app.formpage.notconfig.loadaction') as string) });
return;
}
const arg: any = { ...opt };
......@@ -1201,7 +1201,7 @@ export default class MainBase extends Vue implements ControlInterface {
*/
public loadDraft(opt: any = {}): void {
if(!this.loaddraftAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'SYS_USEREditView' + (this.$t('app.formpage.notconfig.loaddraftaction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'SysUserEditView' + (this.$t('app.formpage.notconfig.loaddraftaction') as string) });
return;
}
const arg: any = { ...opt } ;
......@@ -1263,7 +1263,7 @@ export default class MainBase extends Vue implements ControlInterface {
const action: any = Object.is(data.srfuf, '1') ? this.updateAction : this.createAction;
if(!action){
let actionName:any = Object.is(data.srfuf, '1')?"updateAction":"createAction";
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'SYS_USEREditView' + (this.$t('app.formpage.notconfig.actionname') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'SysUserEditView' + (this.$t('app.formpage.notconfig.actionname') as string) });
return;
}
Object.assign(arg,{viewparams:this.viewparams});
......@@ -1338,7 +1338,7 @@ export default class MainBase extends Vue implements ControlInterface {
const action: any = Object.is(data.srfuf, '1') ? this.updateAction : this.createAction;
if(!action){
let actionName:any = Object.is(data.srfuf, '1')?"updateAction":"createAction";
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'SYS_USEREditView' + (this.$t('app.formpage.notconfig.actionname') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'SysUserEditView' + (this.$t('app.formpage.notconfig.actionname') as string) });
return;
}
Object.assign(arg,{viewparams:this.viewparams});
......@@ -1399,7 +1399,7 @@ export default class MainBase extends Vue implements ControlInterface {
public remove(opt:Array<any> = [],showResultInfo?: boolean): Promise<any> {
return new Promise((resolve: any, reject: any) => {
if(!this.removeAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'SYS_USEREditView' + (this.$t('app.formpage.notconfig.removeaction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'SysUserEditView' + (this.$t('app.formpage.notconfig.removeaction') as string) });
return;
}
const arg: any = opt[0];
......
......@@ -37,6 +37,11 @@
git clone -b master $para2 ibzuaa/
export NODE_OPTIONS=--max-old-space-size=4096
cd ibzuaa/
mvn clean package -Pweb
cd ibzuaa-app/ibzuaa-app-web
mvn -Pweb docker:build
mvn -Pweb docker:push
docker -H $para1 stack deploy --compose-file=src/main/docker/ibzuaa-app-web.yaml ibzlab-rt --with-registry-auth
</command>
</hudson.tasks.Shell>
</builders>
......
......@@ -9,6 +9,6 @@ CMD echo "The application will start in ${IBIZ_SLEEP}s..." && \
sleep ${IBIZ_SLEEP} && \
java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /ibzuaa-app-web.jar
EXPOSE 8080
EXPOSE 30002
ADD ibzuaa-app-web.jar /ibzuaa-app-web.jar
......@@ -3,9 +3,24 @@ services:
ibzuaa-app-web:
image: registry.cn-shanghai.aliyuncs.com/ibizsys/ibzuaa-app-web:latest
ports:
- "8080:8080"
- "30002:30002"
networks:
- agent_network
environment:
- SPRING_CLOUD_NACOS_DISCOVERY_IP=172.16.180.237
- SERVER_PORT=30002
- SPRING_CLOUD_NACOS_DISCOVERY_SERVER-ADDR=172.16.102.211:8848
- SPRING_REDIS_HOST=172.16.100.243
- SPRING_REDIS_PORT=6379
- SPRING_REDIS_DATABASE=0
- SPRING_DATASOURCE_USERNAME=a_A_5d9d78509
- SPRING_DATASOURCE_PASSWORD=@6dEfb3@
- SPRING_DATASOURCE_URL=jdbc:mysql://172.16.180.232:3306/a_A_5d9d78509?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true
- SPRING_DATASOURCE_DRIVER-CLASS-NAME=com.mysql.jdbc.Driver
- SPRING_DATASOURCE_DEFAULTSCHEMA=a_A_5d9d78509
- ABC=1
- DEC=2
- NACOS=172.16.102.211:8848
deploy:
resources:
limits:
......
......@@ -6,7 +6,7 @@
<!--输出实体[SYS_AUTHLOG]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-sys_authlog-39-1">
<changeSet author="a_A_5d9d78509" id="tab-sys_authlog-40-1">
<createTable tableName="IBZAUTHLOG">
<column name="LOGID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_AUTHLOG_LOGID"/>
......@@ -74,7 +74,7 @@
<!--输出实体[SYS_ROLE]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-sys_role-90-4">
<changeSet author="a_A_5d9d78509" id="tab-sys_role-94-4">
<createTable tableName="IBZROLE">
<column name="SYS_ROLEID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_ROLE_SYS_ROLEID"/>
......@@ -92,7 +92,7 @@
<!--输出实体[SYS_ROLE_PERMISSION]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-sys_role_permission-93-5">
<changeSet author="a_A_5d9d78509" id="tab-sys_role_permission-98-5">
<createTable tableName="IBZROLE_PERMISSION">
<column name="SYS_ROLE_PERMISSIONID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_ROLE_PERMISSION_SYS_ROL"/>
......@@ -112,7 +112,7 @@
<!--输出实体[SYS_USER_ROLE]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-sys_user_role-70-6">
<changeSet author="a_A_5d9d78509" id="tab-sys_user_role-72-6">
<createTable tableName="IBZUSER_ROLE">
<column name="SYS_USER_ROLEID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_USER_ROLE_SYS_USER_ROLE"/>
......@@ -133,11 +133,11 @@
<!--输出实体[SYS_PERMISSION]外键关系 -->
<!--输出实体[SYS_ROLE]外键关系 -->
<!--输出实体[SYS_ROLE_PERMISSION]外键关系 -->
<changeSet author="a_A_5d9d78509" id="fk-sys_role_permission-93-7">
<changeSet author="a_A_5d9d78509" id="fk-sys_role_permission-98-7">
<addForeignKeyConstraint baseColumnNames="SYS_PERMISSIONID" baseTableName="IBZROLE_PERMISSION" constraintName="DER1N_SYS_ROLE_PERMISSION_SYS_" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="SYS_PERMISSIONID" referencedTableName="IBZPERMISSION" validate="true"/>
</changeSet>
<!--输出实体[SYS_USER_ROLE]外键关系 -->
<changeSet author="a_A_5d9d78509" id="fk-sys_user_role-70-9">
<changeSet author="a_A_5d9d78509" id="fk-sys_user_role-72-9">
<addForeignKeyConstraint baseColumnNames="SYS_ROLEID" baseTableName="IBZUSER_ROLE" constraintName="DER1N_SYS_USER_ROLE_SYS_ROLE_S" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="SYS_ROLEID" referencedTableName="IBZROLE" validate="true"/>
</changeSet>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册