提交 699461e8 编写于 作者: ibizdev's avatar ibizdev

labadmin 发布系统代码

上级 cc2a28fb
[
{
"srfkey": "YesNo",
"emptytext": "未定义",
"codelisttype":"static",
"items": [
{
"id": "1",
"label": "是",
"text": "是",
"data":"",
"codename":"Item_1",
"value": "1",
"disabled": false
}
, {
"id": "0",
"label": "否",
"text": "否",
"data":"",
"codename":"Item_0",
"value": "0",
"disabled": false
}
]
},
{
"srfkey": "CLAuthCode",
"emptytext": "未定义",
"codelisttype":"static",
......
......@@ -23,6 +23,14 @@
"viewname": "SYS_USER_ROLERedirectView",
"viewtag": "12f53853382743f095a6af867669d8c1"
},
"sysappeditview": {
"title": "应用编辑视图",
"caption": "应用",
"viewtype": "DEEDITVIEW",
"viewmodule": "uaa",
"viewname": "SysAppEditView",
"viewtag": "137b8f036994965b8926455611848134"
},
"sys_rolepickupgridview": {
"title": "角色选择表格视图",
"caption": "系统角色",
......@@ -231,6 +239,14 @@
"viewname": "SYS_PERMISSIONMPickupView",
"viewtag": "b8a97c1797a1b91fbb37f8c2d14b1fb6"
},
"sysappgridview": {
"title": "应用表格视图",
"caption": "应用",
"viewtype": "DEGRIDVIEW",
"viewmodule": "uaa",
"viewname": "SysAppGridView",
"viewtag": "bb58e4db8024f089e1d808f0ede81302"
},
"sys_permissionredirectview": {
"title": "权限表数据重定向视图",
"caption": "权限/资源",
......
......@@ -12,6 +12,11 @@
position: absolute;
background: #FFF;
// border: 1px solid #e3e3e3;
.tree-right-menu{
.ivu-select-dropdown{
overflow: auto;
}
}
.ivu-divider{
width: 100%;
}
......
// .ibiz-page-tag {
// position: relative;
// box-sizing: border-box;
// // width: calc(100% + 30px);
// height: 38px;
// padding: 0 60px 0 30px;
// background: #f6f6f6;
// .tags-body {
// position: relative;
// width: 100%;
// height: 100%;
// overflow: hidden;
// .tags-container {
// position: absolute;
// overflow: visible;
// white-space: nowrap;
// transition: left .3s ease;
// .ivu-tag {
// margin: 0;
// height: 38px;
// line-height: 38px;
// border: 0;
// border-radius: 0;
// border-right: 1px solid #ddd;
// font-size: 14px;
// .text-icon {
// height: 16px;
// margin-bottom: -3px;
// }
// .ivu-icon-ios-close {
// visibility: hidden;
// }
// .tag-text {
// display: table-cell;
// .ivu-tooltip {
// display: block;
// .ivu-tooltip-rel {
// display: block;
// max-width: 200px;
// overflow: hidden;
// text-overflow: ellipsis;
// }
// }
// }
// }
// .ivu-tag.tag-is-active {
// background: #fff;
// }
// .ivu-tag:hover,.ivu-tag.tag-is-active {
// .ivu-icon-ios-close {
// visibility: initial;
// }
// }
// }
// }
// .move-btn {
// font-size: 18px;
// width: 30px;
// height: 38px;
// line-height: 38px;
// border-left: 1px solid #ddd;
// border-right: 1px solid #ddd;
// text-align: center;
// cursor: pointer;
// }
// .move-btn:hover {
// background: #efefef;
// }
// .move-left, .move-right, .ivu-dropdown{
// position: absolute;
// top: 0;
// }
// .move-left {
// left: 0;
// }
// .move-right {
// right: 30px;
// }
// .ivu-dropdown {
// right: 0;
// }
// }
// .tags-transition-move {
// transition: transform .3s;
// }
// .tags-transition-enter,.tags-transition-leave-to{
// opacity: 0;
// }
.ibiz-page-tag {
.el-tabs{
.el-tabs__nav{
padding:0px 10px;
border:none;
}
.el-tabs__item{
color:#ccc;
border:none;
}
.el-tabs__item:hover{
color:#409eff;
}
.is-active{
color:#409eff;
border-bottom:2px solid #409eff !important;
}
.el-tabs__nav-scroll{
background-color: white;
}
position: relative;
.left{
.el-tabs__header{
box-shadow: 0 1px 2px 0 rgba(0,0,0,.15);
margin:0 0 1 0;
padding-right:120px;
}
}
.right{
position: absolute;
right:0px;
top:0px;
width:120px;
margin:5px 0px;
display: flex;
justify-content: center;
}
>.tag-tabs{
background-color: #F0F0F0 !important;
.el-tabs{
.el-tabs__nav{
padding:0px 10px;
border:none;
}
.el-tabs__active-bar{
background-color: transparent !important;
}
.el-tabs__item{
height: 32px;
line-height: 32px;
border: 1px solid #e8eaec!important;
color: #515a6e!important;
background: #fff!important;
padding: 0 12px;
display: inline-block;
margin: 4px 4px 4px 0;
border-radius: 3px;
font-size: 12px;
vertical-align: middle;
opacity: 1;
overflow: hidden;
.ivu-tag-dot-inner{
display: inline-block;
width: 12px;
height: 12px;
margin-right: 8px;
border-radius: 50%;
background: #e8eaec;
position: relative;
top: 1px;
}
}
.el-tabs__item:hover{
color:#409eff;
}
.is-active{
color:#409eff;
.ivu-tag-dot-inner{
background-color:#409eff !important;
}
border-bottom:2px solid transparent !important;
}
.el-tabs__header{
margin:0 0 1 0;
}
}
}
}
\ No newline at end of file
<template>
<div class="ibiz-page-tag">
<el-tabs
type="card"
@tab-click="changePage"
v-model="editableTabsValue"
closable
@tab-remove="onClose"
>
<el-tab-pane
v-for="(meta, index) of $store.state.pageMetas"
:label="getCaption(meta.caption, meta.info)"
:name="index+''"
:key="index+''"
></el-tab-pane>
</el-tabs>
<div class="tag-tabs left">
<el-tabs
type="card"
@tab-click="changePage"
v-model="editableTabsValue"
closable
@tab-remove="onClose"
>
<el-tab-pane
v-for="(meta, index) of $store.state.pageMetas"
:name="index+''"
:key="index+''"
>
<span slot="label"><span class="ivu-tag-dot-inner"></span>{{ getCaption(meta.caption, meta.info) }}</span>
</el-tab-pane>
</el-tabs>
</div>
<div v-show="$store.state.pageMetas.length > 0" class="right">
<el-dropdown @command="handlerClose">
<el-button size="mini" type="primary">
更多<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="item" v-for="(item,index) in actions" :key="index">{{ $t(item.text) }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</div>
</template>
......@@ -23,6 +37,7 @@ import { Environment } from "../../environments/environment";
@Component({})
export default class TabPageExp extends Vue {
@Provide()
public styleLeft: number = 0;
......@@ -32,7 +47,14 @@ export default class TabPageExp extends Vue {
{ text: "app.tabpage.closeother", value: "closeOther" }
];
public editableTabsValue: any = "";
/**
* 关闭tab页方法
*/
public handlerClose(item: any){
this.doTagAction(item.value);
}
public editableTabsValue: any = ""; //tabs页绑定值
@Watch("$route")
public onRouteChange(newVal: any) {
......
......@@ -248,7 +248,8 @@ export default class EditViewEngine extends ViewEngine {
public setTabCaption(info: string): void {
let viewdata: any = this.view.model;
if (viewdata && info && !Object.is(info, '') && this.view.$tabPageExp && (viewdata.srfTitle.indexOf(" - ") === -1)) {
this.view.$tabPageExp.setCurPageCaption(viewdata.srfCaption, viewdata.srfTitle, info);
this.view.$tabPageExp.setCurPageCaption(viewdata.srfTitle, viewdata.srfTitle, info);
this.view.$route.meta.info = info;
this.view.model.srfTitle = `${this.view.$t(viewdata.srfTitle)} - ${viewdata.dataInfo}`;
}
}
......
import sysauthlog_en_US from '@locale/lanres/entities/sys-auth-log/sys-auth-log_en_US';
import sysapp_en_US from '@locale/lanres/entities/sys-app/sys-app_en_US';
import sysrolepermission_en_US from '@locale/lanres/entities/sys-role-permission/sys-role-permission_en_US';
import syspermission_en_US from '@locale/lanres/entities/sys-permission/sys-permission_en_US';
import sysuserrole_en_US from '@locale/lanres/entities/sys-user-role/sys-user-role_en_US';
......@@ -67,11 +68,13 @@ export default {
menuitem3: '用户',
menuitem6: '角色',
menuitem1: '认证日志',
menuitem2: '接入应用',
},
},
},
entities: {
sysauthlog: sysauthlog_en_US,
sysapp: sysapp_en_US,
sysrolepermission: sysrolepermission_en_US,
syspermission: syspermission_en_US,
sysuserrole: sysuserrole_en_US,
......
import sysauthlog_zh_CN from '@locale/lanres/entities/sys-auth-log/sys-auth-log_zh_CN';
import sysapp_zh_CN from '@locale/lanres/entities/sys-app/sys-app_zh_CN';
import sysrolepermission_zh_CN from '@locale/lanres/entities/sys-role-permission/sys-role-permission_zh_CN';
import syspermission_zh_CN from '@locale/lanres/entities/sys-permission/sys-permission_zh_CN';
import sysuserrole_zh_CN from '@locale/lanres/entities/sys-user-role/sys-user-role_zh_CN';
......@@ -67,11 +68,13 @@ export default {
menuitem3: '用户',
menuitem6: '角色',
menuitem1: '认证日志',
menuitem2: '接入应用',
},
},
},
entities: {
sysauthlog: sysauthlog_zh_CN,
sysapp: sysapp_zh_CN,
sysrolepermission: sysrolepermission_zh_CN,
syspermission: syspermission_zh_CN,
sysuserrole: sysuserrole_zh_CN,
......
export default {
YesNo: {
'1': '是',
'0': '否',
empty: '',
},
CLAuthCode: {
'200': '成功',
'400': '用户不存在',
......
export default {
YesNo: {
'1': '是',
'0': '否',
empty: '',
},
CLAuthCode: {
'200': '成功',
'400': '用户不存在',
......
export default {
fields: {
id: '应用标识',
label: '应用名',
systemid: '系统标识',
fullname: '全称',
type: '类型',
addr: '地址',
icon: '图标',
visabled: '可见',
},
views: {
editview: {
caption: "应用",
title: '应用',
},
gridview: {
caption: "应用",
title: '应用',
},
},
main_form: {
details: {
group1: "应用基本信息",
formpage1: "基本信息",
srforikey: "",
srfkey: "应用标识",
srfmajortext: "应用名",
srftempmode: "",
srfuf: "",
srfdeid: "",
srfsourcekey: "",
pssystemid: "系统标识",
appid: "应用标识",
appname: "应用名",
apptype: "类型",
fullname: "全称",
icon: "图标",
visabled: "可见",
addr: "地址",
},
uiactions: {
},
},
main_grid: {
columns: {
pssystemid: "系统标识",
appid: "应用标识",
appname: "应用名",
apptype: "类型",
fullname: "全称",
icon: "图标",
addr: "地址",
visabled: "可见",
},
uiactions: {
},
},
default_searchform: {
details: {
formpage1: "常规条件",
n_pssystemid_eq: "系统标识(等于(=))",
n_appname_like: "应用名(文本包含(%))",
},
uiactions: {
},
},
gridviewtoolbar_toolbar: {
tbitem3: {
caption: "New",
tip: "New",
},
tbitem4: {
caption: "Edit",
tip: "Edit {0}",
},
tbitem6: {
caption: "Copy",
tip: "Copy {0}",
},
tbitem7: {
caption: "-",
tip: "",
},
tbitem24: {
caption: "行编辑",
tip: "行编辑",
},
tbitem25: {
caption: "新建行",
tip: "新建行",
},
tbitem26: {
caption: "-",
tip: "",
},
tbitem8: {
caption: "Remove",
tip: "Remove {0}",
},
tbitem9: {
caption: "-",
tip: "",
},
tbitem13: {
caption: "Export",
tip: "Export {0} Data To Excel",
},
tbitem10: {
caption: "-",
tip: "",
},
tbitem19: {
caption: "Filter",
tip: "Filter",
},
},
editviewtoolbar_toolbar: {
tbitem3: {
caption: "Save",
tip: "Save",
},
tbitem5: {
caption: "Save And Close",
tip: "Save And Close Window",
},
tbitem6: {
caption: "-",
tip: "",
},
tbitem12: {
caption: "New",
tip: "New",
},
tbitem13: {
caption: "-",
tip: "",
},
tbitem14: {
caption: "Copy",
tip: "Copy {0}",
},
},
};
\ No newline at end of file
export default {
fields: {
id: '应用标识',
label: '应用名',
systemid: '系统标识',
fullname: '全称',
type: '类型',
addr: '地址',
icon: '图标',
visabled: '可见',
},
views: {
editview: {
caption: '应用',
title: '应用',
},
gridview: {
caption: '应用',
title: '应用',
},
},
main_form: {
details: {
group1: '应用基本信息',
formpage1: '基本信息',
srforikey: '',
srfkey: '应用标识',
srfmajortext: '应用名',
srftempmode: '',
srfuf: '',
srfdeid: '',
srfsourcekey: '',
pssystemid: '系统标识',
appid: '应用标识',
appname: '应用名',
apptype: '类型',
fullname: '全称',
icon: '图标',
visabled: '可见',
addr: '地址',
},
uiactions: {
},
},
main_grid: {
columns: {
pssystemid: '系统标识',
appid: '应用标识',
appname: '应用名',
apptype: '类型',
fullname: '全称',
icon: '图标',
addr: '地址',
visabled: '可见',
},
uiactions: {
},
},
default_searchform: {
details: {
formpage1: '常规条件',
n_pssystemid_eq: '系统标识(等于(=))',
n_appname_like: '应用名(文本包含(%))',
},
uiactions: {
},
},
gridviewtoolbar_toolbar: {
tbitem3: {
caption: '新建',
tip: '新建',
},
tbitem4: {
caption: '编辑',
tip: '编辑',
},
tbitem6: {
caption: '拷贝',
tip: '拷贝',
},
tbitem7: {
caption: '-',
tip: '',
},
tbitem24: {
caption: '行编辑',
tip: '行编辑',
},
tbitem25: {
caption: '新建行',
tip: '新建行',
},
tbitem26: {
caption: '-',
tip: '',
},
tbitem8: {
caption: '删除',
tip: '删除',
},
tbitem9: {
caption: '-',
tip: '',
},
tbitem13: {
caption: '导出',
tip: '导出',
},
tbitem10: {
caption: '-',
tip: '',
},
tbitem19: {
caption: '过滤',
tip: '过滤',
},
},
editviewtoolbar_toolbar: {
tbitem3: {
caption: '保存',
tip: '保存',
},
tbitem5: {
caption: '保存并关闭',
tip: '保存并关闭',
},
tbitem6: {
caption: '-',
tip: '',
},
tbitem12: {
caption: '新建',
tip: '新建',
},
tbitem13: {
caption: '-',
tip: '',
},
tbitem14: {
caption: '拷贝',
tip: '拷贝',
},
},
};
\ No newline at end of file
......@@ -63,6 +63,24 @@ mock.onGet('v7/mainappmenu').reply((config: any) => {
textcls: '',
appfunctag: 'Auto6',
resourcetag: '',
},
{
id: '1CDA0214-F2CF-44CD-ACD1-2DE168FF5C0F',
name: 'menuitem2',
text: '接入应用',
type: 'MENUITEM',
counterid: '',
tooltip: '接入应用',
expanded: false,
separator: false,
hidden: false,
hidesidebar: false,
opendefault: false,
iconcls: 'fa fa-buysellads',
icon: '',
textcls: '',
appfunctag: '_2',
resourcetag: '',
},
],
}];
......
......@@ -8,6 +8,33 @@ mock.onGet('./assets/json/data-dictionary.json').reply((config: any) => {
let status = MockAdapter.mockStatus(config);
return [status, [
{
srfkey: 'YesNo',
emptytext: '未定义',
"codelisttype":"static",
items: [
{
id: '1',
label: '是',
text: '是',
"data":"",
"codename":"Item_1",
value: '1',
disabled: false,
},
{
id: '0',
label: '否',
text: '否',
"data":"",
"codename":"Item_0",
value: '0',
disabled: false,
},
]
},
{
srfkey: 'CLAuthCode',
emptytext: '未定义',
"codelisttype":"static",
......
import qs from 'qs';
import { MockAdapter } from '@/mock/mock-adapter';
const mock = MockAdapter.getInstance();
// 模拟数据
const mockDatas: Array<any> = [
];
//getwflink
mock.onGet(new RegExp(/^\/wfcore\/ibzuaa-app-web\/sysapps\/[a-zA-Z0-9\-\;]+\/usertasks\/[a-zA-Z0-9\-\;]+\/ways$/)).reply((config: any) => {
console.groupCollapsed("实体:sysapp 方法: getwflink");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
}
return [status,[
{"sequenceFlowId":"dfdsfdsfdsfdsfds","sequenceFlowName":"同意",
"taskId":"aaaaddddccccddddd","processDefinitionKey":"support-workorders-approve-v1",
"processInstanceId":"ddlfldldfldsfds","refViewKey":""},
{"sequenceFlowId":"ddssdfdfdfdfsfdf","sequenceFlowName":"不同意",
"taskId":"aaaaddddccccddddd","processDefinitionKey":"support-workorders-approve-v1",
"processInstanceId":"ddfdsldlfdlldsf","refViewKey":"workorder_ltform_editview"}
]];
});
// getwfstep
mock.onGet(new RegExp(/^\/wfcore\/ibzuaa-app-web\/sysapps\/process-definitions-nodes$/)).reply((config: any) => {
console.groupCollapsed("实体:sysapp 方法: getwfstep");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
}
return [status, [
{"userTaskId":"sddfddfd-dfdf-fdfd-fdf-dfdfd",
"userTaskName":"待审",
"cnt":0,
"processDefinitionKey":"support-workorders-approve-v1",
"processDefinitionName":"工单审批流程v1"
},
{"userTaskId":"sddfddfd-dfdf-fdfd-fdf-87927",
"userTaskName":"待分配",
"cnt":3,
"processDefinitionKey":"support-workorders-approve-v1",
"processDefinitionName":"工单审批流程v1"}
]];
});
// createBatch
mock.onPost(new RegExp(/^\/sysapps\/batch$/)).reply((config: any) => {
console.groupCollapsed("实体:sysapp 方法: createBatch");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
}
return [status, {}];
});
// updateBatch
mock.onPut(new RegExp(/^\/sysapps\/batch$/)).reply((config: any) => {
console.groupCollapsed("实体:sysapp 方法: updateBatch");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
}
return [status, {}];
});
// removeBatch
mock.onDelete(new RegExp(/^\/sysapps\/batch$/)).reply((config: any) => {
console.groupCollapsed("实体:sysapp 方法: removeBatch");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
}
return [status, {}];
});
// Select
mock.onGet(new RegExp(/^\/sysapps\/([a-zA-Z0-9\-\;]{1,35})\/select$/)).reply((config: any) => {
console.groupCollapsed("实体:sysapp 方法: Select");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['id'];
const matchArray:any = new RegExp(/^\/sysapps\/([a-zA-Z0-9\-\;]{1,35})\/select$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
let items = mockDatas ? mockDatas : [];
let _items = items.find((item: any) => Object.is(item.id, tempValue.id));
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(_items);
console.groupEnd();
console.groupEnd();
return [status, _items];
});
// Save
mock.onPost(new RegExp(/^\/sysapps\/?([a-zA-Z0-9\-\;]{0,35})\/save$/)).reply((config: any) => {
console.groupCollapsed("实体:sysapp 方法: Save");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['id'];
const matchArray:any = new RegExp(/^\/sysapps\/([a-zA-Z0-9\-\;]{1,35})\/save$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
//let items = mockDatas ? mockDatas : [];
//let _items = items.find((item: any) => Object.is(item.id, tempValue.id));
let data = JSON.parse(config.data);
mockDatas.forEach((item)=>{
if(item['id'] == tempValue['id'] ){
for(let value in data){
if(item.hasOwnProperty(value)){
item[value] = data[value];
}
}
}
})
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(data);
console.groupEnd();
console.groupEnd();
return [status, data];
});
// GetDraft
mock.onGet(new RegExp(/^\/sysapps\/getdraft$/)).reply((config: any) => {
console.groupCollapsed("实体:sysapp 方法: GetDraft");
console.table({url:config.url, method: config.method, data:config.data});
// GetDraft
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table({});
console.groupEnd();
console.groupEnd();
return [status, {}];
});
// CheckKey
mock.onPost(new RegExp(/^\/sysapps\/?([a-zA-Z0-9\-\;]{0,35})\/checkkey$/)).reply((config: any) => {
console.groupCollapsed("实体:sysapp 方法: CheckKey");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['id'];
const matchArray:any = new RegExp(/^\/sysapps\/([a-zA-Z0-9\-\;]{1,35})\/checkkey$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
//let items = mockDatas ? mockDatas : [];
//let _items = items.find((item: any) => Object.is(item.id, tempValue.id));
let data = JSON.parse(config.data);
mockDatas.forEach((item)=>{
if(item['id'] == tempValue['id'] ){
for(let value in data){
if(item.hasOwnProperty(value)){
item[value] = data[value];
}
}
}
})
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(data);
console.groupEnd();
console.groupEnd();
return [status, data];
});
// Update
mock.onPut(new RegExp(/^\/sysapps\/?([a-zA-Z0-9\-\;]{0,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:sysapp 方法: Update");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['id'];
const matchArray:any = new RegExp(/^\/sysapps\/([a-zA-Z0-9\-\;]{1,35})$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
//let items = mockDatas ? mockDatas : [];
//let _items = items.find((item: any) => Object.is(item.id, tempValue.id));
let data = JSON.parse(config.data);
mockDatas.forEach((item)=>{
if(item['id'] == tempValue['id'] ){
for(let value in data){
if(item.hasOwnProperty(value)){
item[value] = data[value];
}
}
}
})
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(data);
console.groupEnd();
console.groupEnd();
return [status, data];
});
// Create
mock.onPost(new RegExp(/^\/sysapps\/?([a-zA-Z0-9\-\;]{0,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:sysapp 方法: Create");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['id'];
const matchArray:any = new RegExp(/^\/sysapps\/([a-zA-Z0-9\-\;]{1,35})$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(mockDatas[0]);
console.groupEnd();
console.groupEnd();
return [status, mockDatas[0]];
});
// FetchDefault
mock.onGet(new RegExp(/^\/sysapps\/fetchdefault$/)).reply((config: any) => {
console.groupCollapsed("实体:sysapp 方法: FetchDefault");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(mockDatas);
console.groupEnd();
console.groupEnd();
return [status, mockDatas ? mockDatas : []];
});
// FetchDefault
mock.onGet(new RegExp(/^\/sysapps\/fetchdefault(\?[\w-./?%&=,]*)*$/)).reply((config: any) => {
console.groupCollapsed("实体:sysapp 方法: FetchDefault");
console.table({url:config.url, method: config.method, data:config.data});
if(config.url.includes('page')){
let url = config.url.split('?')[1];
let params = qs.parse(url);
Object.assign(config, params);
}
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
let total = mockDatas.length;
let records: Array<any> = [];
if(!config.page || !config.size){
records = mockDatas;
}else{
if((config.page-1)*config.size < total){
records = mockDatas.slice(config.page,config.size);
}
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(records ? records : []);
console.groupEnd();
console.groupEnd();
return [status, records ? records : []];
});
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// Remove
mock.onDelete(new RegExp(/^\/sysapps\/([a-zA-Z0-9\-\;]{1,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:sysapp 方法: Remove");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['id'];
const matchArray:any = new RegExp(/^\/sysapps\/([a-zA-Z0-9\-\;]{1,35})$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
let items = mockDatas ? mockDatas : [];
let _items = items.find((item: any) => Object.is(item.id, tempValue.id));
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(_items?_items:{});
console.groupEnd();
console.groupEnd();
return [status, _items?_items:{}];
});
// Get
mock.onGet(new RegExp(/^\/sysapps\/([a-zA-Z0-9\-\;]{1,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:sysapp 方法: Get");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['id'];
const matchArray:any = new RegExp(/^\/sysapps\/([a-zA-Z0-9\-\;]{1,35})$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
let items = mockDatas ? mockDatas : [];
let _items = items.find((item: any) => Object.is(item.id, tempValue.id));
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(_items?_items:{});
console.groupEnd();
console.groupEnd();
return [status, _items?_items:{}];
});
......@@ -8,6 +8,7 @@ import './upload/upload';
// 实体级接口对象
import './entity/sys-auth-logs/sys-auth-logs';
import './entity/sys-apps/sys-apps';
import './entity/sys-role-permissions/sys-role-permissions';
import './entity/sys-permissions/sys-permissions';
import './entity/sys-user-roles/sys-user-roles';
......
......@@ -31,6 +31,14 @@ mock.onGet('./assets/json/view-config.json').reply((config: any) => {
"viewname": "SYS_USER_ROLERedirectView",
"viewtag": "12f53853382743f095a6af867669d8c1"
},
"sysappeditview": {
"title": "应用编辑视图",
"caption": "应用",
"viewtype": "DEEDITVIEW",
"viewmodule": "uaa",
"viewname": "SysAppEditView",
"viewtag": "137b8f036994965b8926455611848134"
},
"sys_rolepickupgridview": {
"title": "角色选择表格视图",
"caption": "系统角色",
......@@ -239,6 +247,14 @@ mock.onGet('./assets/json/view-config.json').reply((config: any) => {
"viewname": "SYS_PERMISSIONMPickupView",
"viewtag": "b8a97c1797a1b91fbb37f8c2d14b1fb6"
},
"sysappgridview": {
"title": "应用表格视图",
"caption": "应用",
"viewtype": "DEGRIDVIEW",
"viewmodule": "uaa",
"viewname": "SysAppGridView",
"viewtag": "bb58e4db8024f089e1d808f0ede81302"
},
"sys_permissionredirectview": {
"title": "权限表数据重定向视图",
"caption": "权限/资源",
......
export const PageComponents = {
install(Vue: any, opt: any) {
Vue.component('sys-rolepickup-view', () => import('@pages/uaa/sys-rolepickup-view/sys-rolepickup-view.vue'));
Vue.component('sys-role-permissioncustom-view', () => import('@pages/uaa/sys-role-permissioncustom-view/sys-role-permissioncustom-view.vue'));
Vue.component('sys-app-grid-view', () => import('@pages/uaa/sys-app-grid-view/sys-app-grid-view.vue'));
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-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-user-roleedit-view', () => import('@pages/uaa/sys-user-roleedit-view/sys-user-roleedit-view.vue'));
......
......@@ -26,6 +26,7 @@ const router = new Router({
},
meta: {
caption: 'app.views.index.title',
info:'',
viewType: 'APPINDEX',
parameters: [
{ pathName: 'index', parameterName: 'index' },
......@@ -34,10 +35,25 @@ const router = new Router({
},
component: () => import('@pages/uaa/index/index.vue'),
children: [
{
path: 'sysapps/:sysapp?/gridview/:gridview?',
meta: {
caption: 'entities.sysapp.views.gridview.title',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'sysapps', parameterName: 'sysapp' },
{ pathName: 'gridview', parameterName: 'gridview' },
],
requireAuth: true,
},
component: () => import('@pages/uaa/sys-app-grid-view/sys-app-grid-view.vue'),
},
{
path: 'sysroles/:sysrole?/pickupview/:pickupview?',
meta: {
caption: 'entities.sysrole.views.pickupview.title',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'sysroles', parameterName: 'sysrole' },
......@@ -47,10 +63,39 @@ const router = new Router({
},
component: () => import('@pages/uaa/sys-rolepickup-view/sys-rolepickup-view.vue'),
},
{
path: 'sysapps/:sysapp?/editview/:editview?',
meta: {
caption: 'entities.sysapp.views.editview.title',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'sysapps', parameterName: 'sysapp' },
{ pathName: 'editview', parameterName: 'editview' },
],
requireAuth: true,
},
component: () => import('@pages/uaa/sys-app-edit-view/sys-app-edit-view.vue'),
},
{
path: 'sysusers/:sysuser?/mpickupview/:mpickupview?',
meta: {
caption: 'entities.sysuser.views.mpickupview.title',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'sysusers', parameterName: 'sysuser' },
{ pathName: 'mpickupview', parameterName: 'mpickupview' },
],
requireAuth: true,
},
component: () => import('@pages/uaa/sys-usermpickup-view/sys-usermpickup-view.vue'),
},
{
path: 'sysroles/:sysrole?/sysrolepermissions/:sysrolepermission?/customview/:customview?',
meta: {
caption: 'entities.sysrolepermission.views.customview.title',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'sysroles', parameterName: 'sysrole' },
......@@ -65,6 +110,7 @@ const router = new Router({
path: 'syspermissions/:syspermission?/sysrolepermissions/:sysrolepermission?/customview/:customview?',
meta: {
caption: 'entities.sysrolepermission.views.customview.title',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'syspermissions', parameterName: 'syspermission' },
......@@ -79,6 +125,7 @@ const router = new Router({
path: 'sysrolepermissions/:sysrolepermission?/customview/:customview?',
meta: {
caption: 'entities.sysrolepermission.views.customview.title',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'sysrolepermissions', parameterName: 'sysrolepermission' },
......@@ -88,23 +135,11 @@ const router = new Router({
},
component: () => import('@pages/uaa/sys-role-permissioncustom-view/sys-role-permissioncustom-view.vue'),
},
{
path: 'sysusers/:sysuser?/mpickupview/:mpickupview?',
meta: {
caption: 'entities.sysuser.views.mpickupview.title',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'sysusers', parameterName: 'sysuser' },
{ pathName: 'mpickupview', parameterName: 'mpickupview' },
],
requireAuth: true,
},
component: () => import('@pages/uaa/sys-usermpickup-view/sys-usermpickup-view.vue'),
},
{
path: 'sysusers/:sysuser?/pickupgridview/:pickupgridview?',
meta: {
caption: 'entities.sysuser.views.pickupgridview.title',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'sysusers', parameterName: 'sysuser' },
......@@ -118,6 +153,7 @@ const router = new Router({
path: 'sysroles/:sysrole?/editview/:editview?',
meta: {
caption: 'entities.sysrole.views.editview.title',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'sysroles', parameterName: 'sysrole' },
......@@ -131,6 +167,7 @@ const router = new Router({
path: 'sysusers/:sysuser?/sysuserroles/:sysuserrole?/editview/:editview?',
meta: {
caption: 'entities.sysuserrole.views.editview.title',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'sysusers', parameterName: 'sysuser' },
......@@ -145,6 +182,7 @@ const router = new Router({
path: 'sysroles/:sysrole?/sysuserroles/:sysuserrole?/editview/:editview?',
meta: {
caption: 'entities.sysuserrole.views.editview.title',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'sysroles', parameterName: 'sysrole' },
......@@ -159,6 +197,7 @@ const router = new Router({
path: 'sysuserroles/:sysuserrole?/editview/:editview?',
meta: {
caption: 'entities.sysuserrole.views.editview.title',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'sysuserroles', parameterName: 'sysuserrole' },
......@@ -172,6 +211,7 @@ const router = new Router({
path: 'sysroles/:sysrole?/mpickupview/:mpickupview?',
meta: {
caption: 'entities.sysrole.views.mpickupview.title',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'sysroles', parameterName: 'sysrole' },
......@@ -185,6 +225,7 @@ const router = new Router({
path: 'sysauthlogs/:sysauthlog?/gridview/:gridview?',
meta: {
caption: 'entities.sysauthlog.views.gridview.title',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'sysauthlogs', parameterName: 'sysauthlog' },
......@@ -198,6 +239,7 @@ const router = new Router({
path: 'sysusers/:sysuser?/pickupview/:pickupview?',
meta: {
caption: 'entities.sysuser.views.pickupview.title',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'sysusers', parameterName: 'sysuser' },
......@@ -211,6 +253,7 @@ const router = new Router({
path: 'sysroles/:sysrole?/gridview/:gridview?',
meta: {
caption: 'entities.sysrole.views.gridview.title',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'sysroles', parameterName: 'sysrole' },
......@@ -224,6 +267,7 @@ const router = new Router({
path: 'sysusers/:sysuser?/editview/:editview?',
meta: {
caption: 'entities.sysuser.views.editview.title',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'sysusers', parameterName: 'sysuser' },
......@@ -237,6 +281,7 @@ const router = new Router({
path: 'sysusers/:sysuser?/sysuserroles/:sysuserrole?/gridview/:gridview?',
meta: {
caption: 'entities.sysuserrole.views.gridview.title',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'sysusers', parameterName: 'sysuser' },
......@@ -251,6 +296,7 @@ const router = new Router({
path: 'sysroles/:sysrole?/sysuserroles/:sysuserrole?/gridview/:gridview?',
meta: {
caption: 'entities.sysuserrole.views.gridview.title',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'sysroles', parameterName: 'sysrole' },
......@@ -265,6 +311,7 @@ const router = new Router({
path: 'sysuserroles/:sysuserrole?/gridview/:gridview?',
meta: {
caption: 'entities.sysuserrole.views.gridview.title',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'sysuserroles', parameterName: 'sysuserrole' },
......@@ -278,6 +325,7 @@ const router = new Router({
path: 'sysroles/:sysrole?/pickupgridview/:pickupgridview?',
meta: {
caption: 'entities.sysrole.views.pickupgridview.title',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'sysroles', parameterName: 'sysrole' },
......@@ -291,6 +339,7 @@ const router = new Router({
path: 'sysusers/:sysuser?/gridview/:gridview?',
meta: {
caption: 'entities.sysuser.views.gridview.title',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'sysusers', parameterName: 'sysuser' },
......@@ -304,6 +353,7 @@ const router = new Router({
path: 'sys_user_roleredirectview/:sys_user_roleredirectview?',
meta: {
caption: 'entities.sysuserrole.views.redirectview.title',
info:'',
parameters: [
{ pathName: 'sys_user_roleredirectview', parameterName: 'sys_user_roleredirectview' },
],
......@@ -315,6 +365,7 @@ const router = new Router({
path: 'sys_role_permissionredirectview/:sys_role_permissionredirectview?',
meta: {
caption: 'entities.sysrolepermission.views.redirectview.title',
info:'',
parameters: [
{ pathName: 'sys_role_permissionredirectview', parameterName: 'sys_role_permissionredirectview' },
],
......@@ -326,6 +377,7 @@ const router = new Router({
path: 'sys_userredirectview/:sys_userredirectview?',
meta: {
caption: 'entities.sysuser.views.redirectview.title',
info:'',
parameters: [
{ pathName: 'sys_userredirectview', parameterName: 'sys_userredirectview' },
],
......@@ -337,6 +389,7 @@ const router = new Router({
path: 'sys_roleredirectview/:sys_roleredirectview?',
meta: {
caption: 'entities.sysrole.views.redirectview.title',
info:'',
parameters: [
{ pathName: 'sys_roleredirectview', parameterName: 'sys_roleredirectview' },
],
......@@ -348,6 +401,7 @@ const router = new Router({
path: 'sys_permissionredirectview/:sys_permissionredirectview?',
meta: {
caption: 'entities.syspermission.views.redirectview.title',
info:'',
parameters: [
{ pathName: 'sys_permissionredirectview', parameterName: 'sys_permissionredirectview' },
],
......@@ -362,6 +416,7 @@ const router = new Router({
path: '/sysauthlogs/:sysauthlog?/gridview/:gridview?',
meta: {
caption: 'entities.sysauthlog.views.gridview.title',
info:'',
parameters: [
{ pathName: 'sysauthlogs', parameterName: 'sysauthlog' },
{ pathName: 'gridview', parameterName: 'gridview' },
......@@ -370,10 +425,24 @@ const router = new Router({
},
component: () => import('@pages/uaa/sys-authloggrid-view/sys-authloggrid-view.vue'),
},
{
path: '/sysapps/:sysapp?/editview/:editview?',
meta: {
caption: 'entities.sysapp.views.editview.title',
info:'',
parameters: [
{ pathName: 'sysapps', parameterName: 'sysapp' },
{ pathName: 'editview', parameterName: 'editview' },
],
requireAuth: true,
},
component: () => import('@pages/uaa/sys-app-edit-view/sys-app-edit-view.vue'),
},
{
path: '/sysroles/:sysrole?/pickupgridview/:pickupgridview?',
meta: {
caption: 'entities.sysrole.views.pickupgridview.title',
info:'',
parameters: [
{ pathName: 'sysroles', parameterName: 'sysrole' },
{ pathName: 'pickupgridview', parameterName: 'pickupgridview' },
......@@ -386,6 +455,7 @@ const router = new Router({
path: '/sysusers/:sysuser?/sysuserroles/:sysuserrole?/editview/:editview?',
meta: {
caption: 'entities.sysuserrole.views.editview.title',
info:'',
parameters: [
{ pathName: 'sysusers', parameterName: 'sysuser' },
{ pathName: 'sysuserroles', parameterName: 'sysuserrole' },
......@@ -399,6 +469,7 @@ const router = new Router({
path: '/sysroles/:sysrole?/sysuserroles/:sysuserrole?/editview/:editview?',
meta: {
caption: 'entities.sysuserrole.views.editview.title',
info:'',
parameters: [
{ pathName: 'sysroles', parameterName: 'sysrole' },
{ pathName: 'sysuserroles', parameterName: 'sysuserrole' },
......@@ -412,6 +483,7 @@ const router = new Router({
path: '/sysuserroles/:sysuserrole?/editview/:editview?',
meta: {
caption: 'entities.sysuserrole.views.editview.title',
info:'',
parameters: [
{ pathName: 'sysuserroles', parameterName: 'sysuserrole' },
{ pathName: 'editview', parameterName: 'editview' },
......@@ -424,6 +496,7 @@ const router = new Router({
path: '/sysusers/:sysuser?/mpickupview/:mpickupview?',
meta: {
caption: 'entities.sysuser.views.mpickupview.title',
info:'',
parameters: [
{ pathName: 'sysusers', parameterName: 'sysuser' },
{ pathName: 'mpickupview', parameterName: 'mpickupview' },
......@@ -436,6 +509,7 @@ const router = new Router({
path: '/sysroles/:sysrole?/editview/:editview?',
meta: {
caption: 'entities.sysrole.views.editview.title',
info:'',
parameters: [
{ pathName: 'sysroles', parameterName: 'sysrole' },
{ pathName: 'editview', parameterName: 'editview' },
......@@ -448,6 +522,7 @@ const router = new Router({
path: '/sysroles/:sysrole?/pickupview/:pickupview?',
meta: {
caption: 'entities.sysrole.views.pickupview.title',
info:'',
parameters: [
{ pathName: 'sysroles', parameterName: 'sysrole' },
{ pathName: 'pickupview', parameterName: 'pickupview' },
......@@ -460,6 +535,7 @@ const router = new Router({
path: '/sysusers/:sysuser?/pickupgridview/:pickupgridview?',
meta: {
caption: 'entities.sysuser.views.pickupgridview.title',
info:'',
parameters: [
{ pathName: 'sysusers', parameterName: 'sysuser' },
{ pathName: 'pickupgridview', parameterName: 'pickupgridview' },
......@@ -472,6 +548,7 @@ const router = new Router({
path: '/sysusers/:sysuser?/editview/:editview?',
meta: {
caption: 'entities.sysuser.views.editview.title',
info:'',
parameters: [
{ pathName: 'sysusers', parameterName: 'sysuser' },
{ pathName: 'editview', parameterName: 'editview' },
......@@ -484,6 +561,7 @@ const router = new Router({
path: '/sysroles/:sysrole?/gridview/:gridview?',
meta: {
caption: 'entities.sysrole.views.gridview.title',
info:'',
parameters: [
{ pathName: 'sysroles', parameterName: 'sysrole' },
{ pathName: 'gridview', parameterName: 'gridview' },
......@@ -492,10 +570,24 @@ const router = new Router({
},
component: () => import('@pages/uaa/sys-rolegrid-view/sys-rolegrid-view.vue'),
},
{
path: '/sysapps/:sysapp?/gridview/:gridview?',
meta: {
caption: 'entities.sysapp.views.gridview.title',
info:'',
parameters: [
{ pathName: 'sysapps', parameterName: 'sysapp' },
{ pathName: 'gridview', parameterName: 'gridview' },
],
requireAuth: true,
},
component: () => import('@pages/uaa/sys-app-grid-view/sys-app-grid-view.vue'),
},
{
path: '/sysusers/:sysuser?/gridview/:gridview?',
meta: {
caption: 'entities.sysuser.views.gridview.title',
info:'',
parameters: [
{ pathName: 'sysusers', parameterName: 'sysuser' },
{ pathName: 'gridview', parameterName: 'gridview' },
......@@ -508,6 +600,7 @@ const router = new Router({
path: '/sysroles/:sysrole?/mpickupview/:mpickupview?',
meta: {
caption: 'entities.sysrole.views.mpickupview.title',
info:'',
parameters: [
{ pathName: 'sysroles', parameterName: 'sysrole' },
{ pathName: 'mpickupview', parameterName: 'mpickupview' },
......@@ -520,6 +613,7 @@ const router = new Router({
path: '/sysusers/:sysuser?/pickupview/:pickupview?',
meta: {
caption: 'entities.sysuser.views.pickupview.title',
info:'',
parameters: [
{ pathName: 'sysusers', parameterName: 'sysuser' },
{ pathName: 'pickupview', parameterName: 'pickupview' },
......@@ -532,6 +626,7 @@ const router = new Router({
path: '/sysroles/:sysrole?/sysrolepermissions/:sysrolepermission?/customview/:customview?',
meta: {
caption: 'entities.sysrolepermission.views.customview.title',
info:'',
parameters: [
{ pathName: 'sysroles', parameterName: 'sysrole' },
{ pathName: 'sysrolepermissions', parameterName: 'sysrolepermission' },
......@@ -545,6 +640,7 @@ const router = new Router({
path: '/syspermissions/:syspermission?/sysrolepermissions/:sysrolepermission?/customview/:customview?',
meta: {
caption: 'entities.sysrolepermission.views.customview.title',
info:'',
parameters: [
{ pathName: 'syspermissions', parameterName: 'syspermission' },
{ pathName: 'sysrolepermissions', parameterName: 'sysrolepermission' },
......@@ -558,6 +654,7 @@ const router = new Router({
path: '/sysrolepermissions/:sysrolepermission?/customview/:customview?',
meta: {
caption: 'entities.sysrolepermission.views.customview.title',
info:'',
parameters: [
{ pathName: 'sysrolepermissions', parameterName: 'sysrolepermission' },
{ pathName: 'customview', parameterName: 'customview' },
......@@ -570,6 +667,7 @@ const router = new Router({
path: '/sysusers/:sysuser?/sysuserroles/:sysuserrole?/gridview/:gridview?',
meta: {
caption: 'entities.sysuserrole.views.gridview.title',
info:'',
parameters: [
{ pathName: 'sysusers', parameterName: 'sysuser' },
{ pathName: 'sysuserroles', parameterName: 'sysuserrole' },
......@@ -583,6 +681,7 @@ const router = new Router({
path: '/sysroles/:sysrole?/sysuserroles/:sysuserrole?/gridview/:gridview?',
meta: {
caption: 'entities.sysuserrole.views.gridview.title',
info:'',
parameters: [
{ pathName: 'sysroles', parameterName: 'sysrole' },
{ pathName: 'sysuserroles', parameterName: 'sysuserrole' },
......@@ -596,6 +695,7 @@ const router = new Router({
path: '/sysuserroles/:sysuserrole?/gridview/:gridview?',
meta: {
caption: 'entities.sysuserrole.views.gridview.title',
info:'',
parameters: [
{ pathName: 'sysuserroles', parameterName: 'sysuserrole' },
{ pathName: 'gridview', parameterName: 'gridview' },
......
<template>
<div class="view-container deeditview sys-app-edit-view">
<app-studioaction :viewTitle="$t(model.srfTitle)" viewName="sysappeditview"></app-studioaction>
<card class='view-card ' :disHover="true" :bordered="false">
<p slot='title'>
<span class='caption-info'>{{$t(model.srfTitle)}}</span>
</p>
<div slot="extra">
<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.sysapp.editviewtoolbar_toolbar.tbitem3.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.sysapp.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.sysapp.editviewtoolbar_toolbar.tbitem5.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.sysapp.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.sysapp.editviewtoolbar_toolbar.tbitem12.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.sysapp.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.sysapp.editviewtoolbar_toolbar.tbitem14.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.sysapp.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 } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import { Subject } from 'rxjs';
import SysAppService from '@/service/sys-app/sys-app-service';
import EditViewEngine from '@engine/view/edit-view-engine';
@Component({
components: {
},
})
export default class SysAppEditViewBase extends Vue {
/**
* 实体服务对象
*
* @type {SysAppService}
* @memberof SysAppEditViewBase
*/
public appEntityService: SysAppService = new SysAppService;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof SysAppEditViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof SysAppEditViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof SysAppEditViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof SysAppEditViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof SysAppEditViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图标识
*
* @type {string}
* @memberof SysAppEditViewBase
*/
public viewtag: string = '137b8f036994965b8926455611848134';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof SysAppEditViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof SysAppEditViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof SysAppEditViewBase
*/
public model: any = {
srfCaption: 'entities.sysapp.views.editview.caption',
srfTitle: 'entities.sysapp.views.editview.title',
srfSubTitle: 'entities.sysapp.views.editview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof SysAppEditViewBase
*/
@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 SysAppEditViewBase
*/
@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 SysAppEditViewBase
*/
public containerModel: any = {
view_toolbar: { name: 'toolbar', type: 'TOOLBAR' },
view_form: { name: 'form', type: 'FORM' },
};
/**
* 计数器刷新
*
* @memberof SysAppEditViewBase
*/
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 SysAppEditViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 工具栏模型
*
* @type {*}
* @memberof SysAppEditView
*/
public toolBarModels: any = {
tbitem3: { name: 'tbitem3', caption: '保存', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'Save', target: '' } },
tbitem5: { name: 'tbitem5', caption: '保存并关闭', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'SaveAndExit', target: '' } },
tbitem6: { name: 'tbitem6', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem12: { name: 'tbitem12', caption: '新建', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'New', target: '' } },
tbitem13: { name: 'tbitem13', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem14: { name: 'tbitem14', caption: '拷贝', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'Copy', target: 'SINGLEKEY' } },
};
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof SysAppEditViewBase
*/
public engine: EditViewEngine = new EditViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof SysAppEditViewBase
*/
public engineInit(): void {
this.engine.init({
view: this,
form: this.$refs.form,
p2k: '0',
keyPSDEField: 'sysapp',
majorPSDEField: 'label',
isLoadDefault: true,
});
}
/**
* 应用上下文
*
* @type {*}
* @memberof SysAppEditViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof SysAppEditViewBase
*/
public viewparams:any = {};
/**
* 解析视图参数
*
* @public
* @memberof SysAppEditViewBase
*/
public parseViewParam(): 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(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();
}
/**
* 处理自定义视图数据
*
* @memberof SysAppEditViewBase
*/
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 SysAppEditViewBase
*/
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
});
}
}
}
}
/**
* Vue声明周期
*
* @memberof SysAppEditViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof SysAppEditViewBase
*/
public afterCreated(){
const secondtag = this.$util.createUUID();
this.$store.commit('viewaction/createdView', { viewtag: this.viewtag, secondtag: secondtag });
this.viewtag = secondtag;
this.parseViewParam();
}
/**
* 销毁之前
*
* @memberof SysAppEditViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof SysAppEditViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof SysAppEditViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
}
/**
* toolbar 部件 click 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysAppEditViewBase
*/
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 SysAppEditViewBase
*/
public form_save($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'save', $event);
}
/**
* form 部件 remove 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysAppEditViewBase
*/
public form_remove($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'remove', $event);
}
/**
* form 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysAppEditViewBase
*/
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,"SysApp");
}
/**
* 逻辑事件
*
* @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,"SysApp");
}
/**
* 逻辑事件
*
* @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,"SysApp");
}
/**
* 逻辑事件
*
* @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,"SysApp");
}
/**
* 逻辑事件
*
* @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,"SysApp");
}
/**
* 逻辑事件
*
* @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,"SysApp");
}
/**
* 逻辑事件
*
* @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,"SysApp");
}
/**
* 保存
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysAppEditViewBase
*/
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 SysAppEditViewBase
*/
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 SysAppEditViewBase
*/
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 SysAppEditViewBase
*/
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 SysAppEditViewBase
*/
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 SysAppEditViewBase
*/
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 SysAppEditViewBase
*/
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 SysAppEditViewBase
*/
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 SysAppEditViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof SysAppEditViewBase
*/
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);
}
})
}
}
}
}
</script>
<style lang='less'>
@import './sys-app-edit-view.less';
</style>
\ No newline at end of file
.view-card {
>.ivu-card-extra {
top: 5px;
right: 0px;
}
}
.sys-app-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 SysAppEditViewBase from './sys-app-edit-view-base.vue';
import view_form from '@widgets/sys-app/main-form/main-form.vue';
@Component({
components: {
view_form,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
vm.$store.commit('addCurPageViewtag', { fullPath: to.fullPath, viewtag: vm.viewtag });
});
},
})
export default class SysAppEditView extends SysAppEditViewBase {
}
</script>
\ No newline at end of file
<template>
<div class='view-container degridview sys-app-grid-view'>
<app-studioaction :viewTitle="$t(model.srfTitle)" viewName="sysappgridview"></app-studioaction>
<card class='view-card ' :dis-hover="true" :bordered="false">
<p slot='title'>
<span class='caption-info'>{{$t(model.srfTitle)}}</span>
</p>
<div class='content-container'>
<div class='view-top-messages'>
</div>
<div style='margin-bottom: 6px;'>
<i-input v-show="!isExpandSearchForm" v-model="query" search enter-button @on-search="onSearch($event)" class='quick-search-input' style='max-width: 400px;' placeholder="应用名" />
<div class='pull-right'>
<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-file-text-o'></i>
<span class='caption'>{{$t('entities.sysapp.gridviewtoolbar_toolbar.tbitem3.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.sysapp.gridviewtoolbar_toolbar.tbitem3.tip')}}</div>
</tooltip>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem4.visabled" :disabled="toolBarModels.tbitem4.disabled" class='' @click="toolbar_click({ tag: 'tbitem4' }, $event)">
<i class='fa fa-edit'></i>
<span class='caption'>{{$t('entities.sysapp.gridviewtoolbar_toolbar.tbitem4.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.sysapp.gridviewtoolbar_toolbar.tbitem4.tip')}}</div>
</tooltip>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem6.visabled" :disabled="toolBarModels.tbitem6.disabled" class='' @click="toolbar_click({ tag: 'tbitem6' }, $event)">
<i class='fa fa-copy'></i>
<span class='caption'>{{$t('entities.sysapp.gridviewtoolbar_toolbar.tbitem6.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.sysapp.gridviewtoolbar_toolbar.tbitem6.tip')}}</div>
</tooltip>
<span class='seperator'>|</span> <tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem24.visabled" :disabled="toolBarModels.tbitem24.disabled" class='' @click="toolbar_click({ tag: 'tbitem24' }, $event)">
<i class='fa fa-table'></i>
<span class='caption'>{{$t('entities.sysapp.gridviewtoolbar_toolbar.tbitem24.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.sysapp.gridviewtoolbar_toolbar.tbitem24.tip')}}</div>
</tooltip>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem25.visabled" :disabled="toolBarModels.tbitem25.disabled" class='' @click="toolbar_click({ tag: 'tbitem25' }, $event)">
<i class='fa fa-plus'></i>
</i-button>
<div slot='content'>{{$t('entities.sysapp.gridviewtoolbar_toolbar.tbitem25.tip')}}</div>
</tooltip>
<span class='seperator'>|</span> <tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem8.visabled" :disabled="toolBarModels.tbitem8.disabled" class='' @click="toolbar_click({ tag: 'tbitem8' }, $event)">
<i class='fa fa-remove'></i>
<span class='caption'>{{$t('entities.sysapp.gridviewtoolbar_toolbar.tbitem8.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.sysapp.gridviewtoolbar_toolbar.tbitem8.tip')}}</div>
</tooltip>
<span class='seperator'>|</span> <tooltip :transfer="true" :max-width="600">
<app-export-excel :item="toolBarModels.tbitem13" :caption="$t('entities.sysapp.gridviewtoolbar_toolbar.tbitem13.caption')" @exportexcel="toolbar_click({ tag: 'tbitem13' }, $event)"></app-export-excel>
<div slot='content'>{{$t('entities.sysapp.gridviewtoolbar_toolbar.tbitem13.tip')}}</div>
</tooltip>
<span class='seperator'>|</span> <tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem19.visabled" :disabled="toolBarModels.tbitem19.disabled" class='' @click="toolbar_click({ tag: 'tbitem19' }, $event)">
<i class='fa fa-filter'></i>
<span class='caption'>{{$t('entities.sysapp.gridviewtoolbar_toolbar.tbitem19.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.sysapp.gridviewtoolbar_toolbar.tbitem19.tip')}}</div>
</tooltip>
</div>
</div>
</div>
<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"
:showBusyIndicator="true"
:isOpenEdit="false"
:gridRowActiveMode="gridRowActiveMode"
@save="onSave"
updateAction="Update"
removeAction="Remove"
loaddraftAction="GetDraft"
loadAction="Get"
createAction="Create"
fetchAction="FetchDefault"
:newdata="newdata"
:opendata="opendata"
name="grid"
ref='grid'
@selectionchange="grid_selectionchange($event)"
@beforeload="grid_beforeload($event)"
@rowdblclick="grid_rowdblclick($event)"
@remove="grid_remove($event)"
@load="grid_load($event)"
@closeview="closeView($event)">
</view_grid>
<div class='view-bottom-messages'>
</div>
</div>
</card>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import { Subject } from 'rxjs';
import SysAppService from '@/service/sys-app/sys-app-service';
import GridViewEngine from '@engine/view/grid-view-engine';
import CodeListService from "@service/app/codelist-service";
@Component({
components: {
},
})
export default class SysAppGridViewBase extends Vue {
/**
* 实体服务对象
*
* @type {SysAppService}
* @memberof SysAppGridViewBase
*/
public appEntityService: SysAppService = new SysAppService;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof SysAppGridViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof SysAppGridViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof SysAppGridViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof SysAppGridViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof SysAppGridViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图标识
*
* @type {string}
* @memberof SysAppGridViewBase
*/
public viewtag: string = 'bb58e4db8024f089e1d808f0ede81302';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof SysAppGridViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof SysAppGridViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof SysAppGridViewBase
*/
public model: any = {
srfCaption: 'entities.sysapp.views.gridview.caption',
srfTitle: 'entities.sysapp.views.gridview.title',
srfSubTitle: 'entities.sysapp.views.gridview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof SysAppGridViewBase
*/
@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 SysAppGridViewBase
*/
@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 SysAppGridViewBase
*/
public containerModel: any = {
view_toolbar: { name: 'toolbar', type: 'TOOLBAR' },
view_grid: { name: 'grid', type: 'GRID' },
view_searchform: { name: 'searchform', type: 'SEARCHFORM' },
};
/**
* 计数器刷新
*
* @memberof SysAppGridViewBase
*/
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 SysAppGridViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 工具栏模型
*
* @type {*}
* @memberof SysAppGridView
*/
public toolBarModels: any = {
tbitem3: { name: 'tbitem3', caption: '新建', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'New', target: '' } },
tbitem4: { name: 'tbitem4', caption: '编辑', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'Edit', target: 'SINGLEKEY' } },
tbitem6: { name: 'tbitem6', caption: '拷贝', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'Copy', target: 'SINGLEKEY' } },
tbitem7: { name: 'tbitem7', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem24: { name: 'tbitem24', caption: '行编辑', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'ToggleRowEdit', target: '' } },
tbitem25: { name: 'tbitem25', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'NewRow', target: '' } },
tbitem26: { name: 'tbitem26', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem8: { name: 'tbitem8', caption: '删除', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'Remove', target: 'MULTIKEY' } },
tbitem9: { name: 'tbitem9', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem13: { name: 'tbitem13', caption: '导出', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'ExportExcel', target: '' }, MaxRowCount: 1000 },
tbitem10: { name: 'tbitem10', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem19: { name: 'tbitem19', caption: '过滤', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'ToggleFilter', target: '' } },
};
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof SysAppGridViewBase
*/
public engine: GridViewEngine = new GridViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof SysAppGridViewBase
*/
public engineInit(): void {
this.engine.init({
view: this,
opendata: (args: any[],fullargs?:any[],params?: any, $event?: any, xData?: any) => {
this.opendata(args,fullargs, params, $event, xData);
},
newdata: (args: any[],fullargs?:any[],params?: any, $event?: any, xData?: any) => {
this.newdata(args,fullargs, params, $event, xData);
},
grid: this.$refs.grid,
searchform: this.$refs.searchform,
keyPSDEField: 'sysapp',
majorPSDEField: 'label',
isLoadDefault: true,
});
}
/**
* 应用上下文
*
* @type {*}
* @memberof SysAppGridViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof SysAppGridViewBase
*/
public viewparams:any = {};
/**
* 解析视图参数
*
* @public
* @memberof SysAppGridViewBase
*/
public parseViewParam(): 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(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();
}
/**
* 处理自定义视图数据
*
* @memberof SysAppGridViewBase
*/
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 SysAppGridViewBase
*/
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
});
}
}
}
}
/**
* Vue声明周期
*
* @memberof SysAppGridViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof SysAppGridViewBase
*/
public afterCreated(){
const secondtag = this.$util.createUUID();
this.$store.commit('viewaction/createdView', { viewtag: this.viewtag, secondtag: secondtag });
this.viewtag = secondtag;
this.parseViewParam();
if(this.formDruipart){
this.formDruipart.subscribe((res:any) =>{
if(Object.is(res.action,'save')){
this.viewState.next({ tag:'grid', action: 'save', data: this.viewparams });
}
if(Object.is(res.action,'load')){
const _this: any = this;
_this.engine.load(res.data,true);
}
});
}
}
/**
* 销毁之前
*
* @memberof SysAppGridViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof SysAppGridViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof SysAppGridViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
}
/**
* toolbar 部件 click 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysAppGridViewBase
*/
public toolbar_click($event: any, $event2?: any) {
if (Object.is($event.tag, 'tbitem3')) {
this.toolbar_tbitem3_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem4')) {
this.toolbar_tbitem4_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem5')) {
this.toolbar_tbitem5_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem6')) {
this.toolbar_tbitem6_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem24')) {
this.toolbar_tbitem24_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem25')) {
this.toolbar_tbitem25_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem8')) {
this.toolbar_tbitem8_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem13')) {
this.toolbar_tbitem13_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem11')) {
this.toolbar_tbitem11_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem19')) {
this.toolbar_tbitem19_click(null, '', $event2);
}
}
/**
* grid 部件 selectionchange 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysAppGridViewBase
*/
public grid_selectionchange($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'selectionchange', $event);
}
/**
* grid 部件 beforeload 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysAppGridViewBase
*/
public grid_beforeload($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'beforeload', $event);
}
/**
* grid 部件 rowdblclick 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysAppGridViewBase
*/
public grid_rowdblclick($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'rowdblclick', $event);
}
/**
* grid 部件 remove 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysAppGridViewBase
*/
public grid_remove($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'remove', $event);
}
/**
* grid 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysAppGridViewBase
*/
public grid_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'load', $event);
}
/**
* searchform 部件 save 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysAppGridViewBase
*/
public searchform_save($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'save', $event);
}
/**
* searchform 部件 search 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysAppGridViewBase
*/
public searchform_search($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'search', $event);
}
/**
* searchform 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SysAppGridViewBase
*/
public searchform_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', '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.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.New(datas, contextJO,paramJO, $event, xData,this,"SysApp");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem4_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.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Edit(datas, contextJO,paramJO, $event, xData,this,"SysApp");
}
/**
* 逻辑事件
*
* @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.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.View(datas, contextJO,paramJO, $event, xData,this,"SysApp");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem6_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.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Copy(datas, contextJO,paramJO, $event, xData,this,"SysApp");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem24_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.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.ToggleRowEdit(datas, contextJO,paramJO, $event, xData,this,"SysApp");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem25_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.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.NewRow(datas, contextJO,paramJO, $event, xData,this,"SysApp");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem8_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.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Remove(datas, contextJO,paramJO, $event, xData,this,"SysApp");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem13_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.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.ExportExcel(datas, contextJO,paramJO, $event, xData,this,"SysApp");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem11_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.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Print(datas, contextJO,paramJO, $event, xData,this,"SysApp");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem19_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.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.ToggleFilter(datas, contextJO,paramJO, $event, xData,this,"SysApp");
}
/**
* 打开新建数据视图
*
* @param {any[]} args
* @param {*} [params]
* @param {*} [fullargs]
* @param {*} [$event]
* @param {*} [xData]
* @memberof SysAppGridView
*/
public newdata(args: any[],fullargs?:any[], params?: any, $event?: any, xData?: any) {
const data: any = {};
if(args[0].srfsourcekey){
data.srfsourcekey = args[0].srfsourcekey;
}
let curViewParam = JSON.parse(JSON.stringify(this.context));
delete curViewParam.sysapp;
if(args.length >0){
Object.assign(curViewParam,args[0]);
}
const deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'sysapps', parameterName: 'sysapp' },
];
const _this: any = this;
const openDrawer = (view: any, data: any) => {
let container: Subject<any> = this.$appdrawer.openDrawer(view, curViewParam, data);
container.subscribe((result: any) => {
if (!result || !Object.is(result.ret, 'OK')) {
return;
}
if (!xData || !(xData.refresh instanceof Function)) {
return;
}
xData.refresh(result.datas);
});
}
const view: any = {
viewname: 'sys-app-edit-view',
height: 0,
width: 0,
title: this.$t('entities.sysapp.views.editview.title'),
placement: 'DRAWER_RIGHT',
};
openDrawer(view, data);
}
/**
* 打开编辑数据视图
*
* @param {any[]} args
* @param {*} [params]
* @param {*} [fullargs]
* @param {*} [$event]
* @param {*} [xData]
* @memberof SysAppGridView
*/
public opendata(args: any[],fullargs?:any[],params?: any, $event?: any, xData?: any) {
const data: any = {};
let curViewParam = JSON.parse(JSON.stringify(this.context));
if(args.length >0){
Object.assign(curViewParam,args[0]);
}
const deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'sysapps', parameterName: 'sysapp' },
];
const _this: any = this;
const openDrawer = (view: any, data: any) => {
let container: Subject<any> = this.$appdrawer.openDrawer(view, curViewParam, data);
container.subscribe((result: any) => {
if (!result || !Object.is(result.ret, 'OK')) {
return;
}
if (!xData || !(xData.refresh instanceof Function)) {
return;
}
xData.refresh(result.datas);
});
}
const view: any = {
viewname: 'sys-app-edit-view',
height: 0,
width: 0,
title: this.$t('entities.sysapp.views.editview.title'),
placement: 'DRAWER_RIGHT',
};
openDrawer(view, data);
}
/**
* 新建
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysAppGridViewBase
*/
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 SysAppGridViewBase
*/
public Edit(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.opendata && _this.opendata instanceof Function) {
const data: any = { };
if (args.length > 0) {
Object.assign(data, { sysapp: args[0].sysapp })
}
_this.opendata([{ ...data }], params, $event, xData);
} else {
_this.$Notice.error({ title: '错误', desc: 'opendata 视图处理逻辑不存在,请添加!' });
}
}
/**
* 查看
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysAppGridViewBase
*/
public View(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.opendata && _this.opendata instanceof Function) {
const data: any = { };
if (args.length > 0) {
Object.assign(data, { sysapp: args[0].sysapp })
}
_this.opendata([{ ...data }], params, $event, xData);
} else {
_this.$Notice.error({ title: '错误', desc: 'opendata 视图处理逻辑不存在,请添加!' });
}
}
/**
* 拷贝
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysAppGridViewBase
*/
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 SysAppGridViewBase
*/
public ToggleRowEdit(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
xData.actualIsOpenEdit = !xData.actualIsOpenEdit;
}
/**
* 新建行
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysAppGridViewBase
*/
public NewRow(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
const data: any = {};
if (_this.newRow && _this.newRow instanceof Function) {
_this.newRow([{ ...data }], params, $event, xData);
} else if(xData.newRow && xData.newRow instanceof Function) {
xData.newRow([{ ...data }], params, $event, xData);
}else{
_this.$Notice.error({ title: '错误', desc: 'newRow 视图处理逻辑不存在,请添加!' });
}
}
/**
* 删除
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysAppGridViewBase
*/
public Remove(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (!xData || !(xData.remove instanceof Function)) {
return ;
}
xData.remove(args);
}
/**
* 导出
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysAppGridViewBase
*/
public ExportExcel(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (!xData || !(xData.exportExcel instanceof Function) || !$event) {
return ;
}
xData.exportExcel($event.exportparms);
}
/**
* 打印
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysAppGridViewBase
*/
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 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof SysAppGridViewBase
*/
public ToggleFilter(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (_this.hasOwnProperty('isExpandSearchForm')) {
_this.isExpandSearchForm = !_this.isExpandSearchForm;
}
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof SysAppGridViewBase
*/
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 SysAppGridViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof SysAppGridViewBase
*/
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);
}
})
}
}
}
/**
* 是否单选
*
* @type {boolean}
* @memberof SysAppGridViewBase
*/
public isSingleSelect: boolean = false;
/**
* 是否嵌入关系界面
*
* @type {boolean}
* @memberof SysAppGridViewBase
*/
@Prop({default:false}) public isformDruipart?: boolean;
/**
* 界面关系通讯对象
*
* @type {Subject<ViewState>}
* @memberof SysAppGridViewBase
*/
@Prop() public formDruipart?: Subject<ViewState>;
/**
* 搜索值
*
* @type {string}
* @memberof SysAppGridViewBase
*/
public query: string = '';
/**
* 是否展开搜索表单
*
* @type {boolean}
* @memberof SysAppGridViewBase
*/
public isExpandSearchForm: boolean = false;
/**
* 表格行数据默认激活模式
* 0 不激活
* 1 单击激活
* 2 双击激活
*
* @type {(number | 0 | 1 | 2)}
* @memberof SysAppGridViewBase
*/
public gridRowActiveMode: number | 0 | 1 | 2 = 2;
/**
* 快速搜索
*
* @param {*} $event
* @memberof SysAppGridViewBase
*/
public onSearch($event: any): void {
const grid: any = this.$refs.grid;
if (grid) {
grid.load(this.context, true);
}
}
/**
* grid 部件 save 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof ENTITYTEST1Usr2GridViewBase
*/
public onSave($event: any) {
this.$emit('drdatasaved', $event);
}
/**
* 刷新数据
*
* @readonly
* @type {(number | null)}
* @memberof SysAppGridViewBase
*/
get refreshdata(): number | null {
return this.$store.getters['viewaction/getRefreshData'](this.viewtag);
}
/**
* 监控数据变化
*
* @param {*} newVal
* @param {*} oldVal
* @returns
* @memberof SysAppGridViewBase
*/
@Watch('refreshdata')
onRefreshData(newVal: any, oldVal: any) {
if (newVal === null || newVal === undefined) {
return;
}
if (newVal === 0) {
return;
}
const grid: any = this.$refs.grid;
if (grid) {
grid.load({});
}
}
}
</script>
<style lang='less'>
@import './sys-app-grid-view.less';
</style>
\ No newline at end of file
.sys-app-grid-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 SysAppGridViewBase from './sys-app-grid-view-base.vue';
import view_grid from '@widgets/sys-app/main-grid/main-grid.vue';
import view_searchform from '@widgets/sys-app/default-searchform/default-searchform.vue';
@Component({
components: {
view_grid,
view_searchform,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
vm.$store.commit('addCurPageViewtag', { fullPath: to.fullPath, viewtag: vm.viewtag });
});
},
})
export default class SysAppGridView extends SysAppGridViewBase {
}
</script>
\ No newline at end of file
......@@ -40,6 +40,7 @@ export class EntityServiceRegister {
*/
protected init(): void {
this.allEntityService.set('sysauthlog', () => import('@/service/sys-auth-log/sys-auth-log-service'));
this.allEntityService.set('sysapp', () => import('@/service/sys-app/sys-app-service'));
this.allEntityService.set('sysrolepermission', () => import('@/service/sys-role-permission/sys-role-permission-service'));
this.allEntityService.set('syspermission', () => import('@/service/sys-permission/sys-permission-service'));
this.allEntityService.set('sysuserrole', () => import('@/service/sys-user-role/sys-user-role-service'));
......
import { Http,Util } from '@/utils';
import EntityService from '../entity-service';
/**
* 应用服务对象基类
*
* @export
* @class SysAppServiceBase
* @extends {EntityServie}
*/
export default class SysAppServiceBase extends EntityService {
/**
* Creates an instance of SysAppServiceBase.
*
* @param {*} [opts={}]
* @memberof SysAppServiceBase
*/
constructor(opts: any = {}) {
super(opts);
}
/**
* 初始化基础数据
*
* @memberof SysAppServiceBase
*/
public initBasicData(){
this.APPLYDEKEY ='sysapp';
this.APPDEKEY = 'id';
this.APPDENAME = 'sysapps';
this.APPDETEXT = 'label';
this.APPNAME = 'web';
this.SYSTEMNAME = 'ibzuaa';
}
// 实体接口
/**
* Select接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof SysAppServiceBase
*/
public async Select(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
return Http.getInstance().get(`/sysapps/${context.sysapp}/select`,isloading);
}
/**
* Remove接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof SysAppServiceBase
*/
public async Remove(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
return Http.getInstance().delete(`/sysapps/${context.sysapp}`,isloading);
}
/**
* Get接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof SysAppServiceBase
*/
public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/sysapps/${context.sysapp}`,isloading);
return res;
}
/**
* Save接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof SysAppServiceBase
*/
public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/sysapps/${context.sysapp}/save`,data,isloading);
return res;
}
/**
* GetDraft接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof SysAppServiceBase
*/
public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/sysapps/getdraft`,isloading);
res.data.sysapp = data.sysapp;
return res;
}
/**
* CheckKey接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof SysAppServiceBase
*/
public async CheckKey(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
return Http.getInstance().post(`/sysapps/${context.sysapp}/checkkey`,data,isloading);
}
/**
* Update接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof SysAppServiceBase
*/
public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/sysapps/${context.sysapp}`,data,isloading);
return res;
}
/**
* Create接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof SysAppServiceBase
*/
public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
Object.assign(data,masterData);
if(!data.srffrontuf || data.srffrontuf !== "1"){
data[this.APPDEKEY] = null;
}
if(data.srffrontuf){
delete data.srffrontuf;
}
let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/sysapps`,data,isloading);
return res;
}
/**
* FetchDefault接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof SysAppServiceBase
*/
public async FetchDefault(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let tempData:any = JSON.parse(JSON.stringify(data));
return Http.getInstance().get(`/sysapps/fetchdefault`,tempData,isloading);
}
}
\ No newline at end of file
import { Http,Util } from '@/utils';
import SysAppServiceBase from './sys-app-service-base';
/**
* 应用服务对象
*
* @export
* @class SysAppService
* @extends {SysAppServiceBase}
*/
export default class SysAppService extends SysAppServiceBase {
/**
* Creates an instance of SysAppService.
*
* @param {*} [opts={}]
* @memberof SysAppService
*/
constructor(opts: any = {}) {
super(opts);
}
}
\ No newline at end of file
......@@ -20,6 +20,7 @@ export const viewstate: any = {
viewdatachange: false,
refviews: [
'9e9a67908b3c85516085fe19e3dd4113',
'bb58e4db8024f089e1d808f0ede81302',
'0134ebf9391cb5f988839332c1352cd9',
'cb64b5009e70f225a91046314f40977a',
],
......@@ -34,6 +35,15 @@ export const viewstate: any = {
'1ee68b6d5d4c5c9413f6874e0ccabc43',
],
},
{
viewtag: '137b8f036994965b8926455611848134',
viewmodule: 'uaa',
viewname: 'SysAppEditView',
viewaction: '',
viewdatachange: false,
refviews: [
],
},
{
viewtag: '1a3413067ee48ab30691eab9f345f517',
viewmodule: 'uaa',
......@@ -295,6 +305,16 @@ export const viewstate: any = {
'9c0b351150648f7661be53c10eaabd67',
],
},
{
viewtag: 'bb58e4db8024f089e1d808f0ede81302',
viewmodule: 'uaa',
viewname: 'SysAppGridView',
viewaction: '',
viewdatachange: false,
refviews: [
'137b8f036994965b8926455611848134',
],
},
{
viewtag: 'c1c2bc63580de24bac60af103a3fcc0f',
viewmodule: 'uaa',
......
......@@ -237,6 +237,12 @@
}
}
// 清除看板里视图的阴影
.dashboard .portlet .view-container{
-webkit-box-shadow: none ;
box-shadow: none;
}
/*** END:多数据视图属性布局 ***/
// 看板视图,卡片模式
......
import { Environment } from '@/environments/environment';
import { UIActionTool,Util } from '@/utils';
import UIService from '../ui-service';
import { Subject } from 'rxjs';
import SysAppService from '@/service/sys-app/sys-app-service';
/**
* 应用UI服务对象基类
*
* @export
* @class SysAppUIServiceBase
*/
export default class SysAppUIServiceBase extends UIService {
/**
* 是否支持工作流
*
* @memberof SysAppUIServiceBase
*/
public isEnableWorkflow:boolean = false;
/**
* 当前UI服务对应的数据服务对象
*
* @memberof SysAppUIServiceBase
*/
public dataService:SysAppService = new SysAppService();
/**
* 所有关联视图
*
* @memberof SysAppUIServiceBase
*/
public allViewMap: Map<string, Object> = new Map();
/**
* 状态值
*
* @memberof SysAppUIServiceBase
*/
public stateValue: number = 0;
/**
* 状态属性
*
* @memberof SysAppUIServiceBase
*/
public stateField: string = "";
/**
* 主状态属性集合
*
* @memberof SysAppUIServiceBase
*/
public mainStateFields:Array<any> = [];
/**
* 主状态集合Map
*
* @memberof SysAppUIServiceBase
*/
public allDeMainStateMap:Map<string,string> = new Map();
/**
* Creates an instance of SysAppUIServiceBase.
*
* @param {*} [opts={}]
* @memberof SysAppUIServiceBase
*/
constructor(opts: any = {}) {
super(opts);
this.initViewMap();
this.initDeMainStateMap();
}
/**
* 初始化视图Map
*
* @memberof SysAppUIServiceBase
*/
public initViewMap(){
this.allViewMap.set('EDITVIEW:',{viewname:'editview',srfappde:'sysapps'});
this.allViewMap.set('MDATAVIEW:',{viewname:'gridview',srfappde:'sysapps'});
}
/**
* 初始化主状态集合
*
* @memberof SysAppUIServiceBase
*/
public initDeMainStateMap(){
}
/**
* 获取指定数据的重定向页面
*
* @param srfkey 数据主键
* @param isEnableWorkflow 重定向视图是否需要处理流程中的数据
* @memberof SysAppUIServiceBase
*/
public async getRDAppView(srfkey:string,isEnableWorkflow:boolean){
this.isEnableWorkflow = isEnableWorkflow;
// 进行数据查询
let result:any = await this.dataService.Get({sysapp:srfkey});
const curData:any = result.data;
//判断当前数据模式,默认为true,todo
const iRealDEModel:boolean = true;
let bDataInWF:boolean = false;
let bWFMode:any = false;
// 计算数据模式
if (this.isEnableWorkflow) {
bDataInWF = await this.dataService.testDataInWF({stateValue:this.stateValue,stateField:this.stateField},curData);
if (bDataInWF) {
bDataInWF = true;
bWFMode = await this.dataService.testUserExistWorklist(null,curData);
}
}
let strPDTViewParam:string = await this.getDESDDEViewPDTParam(curData, bDataInWF, bWFMode);
//若不是当前数据模式,处理strPDTViewParam,todo
//查找视图
//返回视图
return this.allViewMap.get(strPDTViewParam);
}
/**
* 获取实际的数据类型
*
* @memberof SysAppUIServiceBase
*/
public getRealDEType(entity:any){
}
/**
* 获取实体单数据实体视图预定义参数
*
* @param curData 当前数据
* @param bDataInWF 是否有数据在工作流中
* @param bWFMode 是否工作流模式
* @memberof SysAppUIServiceBase
*/
public async getDESDDEViewPDTParam(curData:any, bDataInWF:boolean, bWFMode:boolean){
let strPDTParam:string = '';
if (bDataInWF) {
// 判断数据是否在流程中
}
//多表单,todo
const isEnableMultiForm:boolean = false;
const multiFormDEField:string|null =null;
if (isEnableMultiForm && multiFormDEField) {
const objFormValue:string = curData[multiFormDEField];
if(!Environment.isAppMode){
return 'MOBEDITVIEW'+objFormValue;
}
return 'EDITVIEW'+objFormValue;
}
if(!Environment.isAppMode){
if(this.getDEMainStateTag(curData)){
return `MOBEDITVIEW:MSTAG:${ await this.getDEMainStateTag(curData)}`;
}
return 'MOBEDITVIEW:';
}
if(this.getDEMainStateTag(curData)){
return `EDITVIEW:MSTAG:${ await this.getDEMainStateTag(curData)}`;
}
return 'EDITVIEW:';
}
/**
* 获取数据对象的主状态标识
*
* @param curData 当前数据
* @memberof SysAppUIServiceBase
*/
public async getDEMainStateTag(curData:any){
if(this.mainStateFields.length === 0) return null;
this.mainStateFields.forEach((singleMainField:any) =>{
if(!(singleMainField in curData)){
console.error(`当前数据对象不包含属性singleMainField,可能会发生错误`);
}
})
let strTag:String = "";
for (let i = 0; i <= 1; i++) {
let strTag:string = (curData[this.mainStateFields[0]])?(i == 0) ? curData[this.mainStateFields[0]] : "":"";
if (this.mainStateFields.length >= 2) {
for (let j = 0; j <= 1; j++) {
let strTag2:string = (curData[this.mainStateFields[1]])?`${strTag}__${(j == 0) ? curData[this.mainStateFields[1]] : ""}`:strTag;
if (this.mainStateFields.length >= 3) {
for (let k = 0; k <= 1; k++) {
let strTag3:string = (curData[this.mainStateFields[2]])?`${strTag2}__${(k == 0) ? curData[this.mainStateFields[2]] : ""}`:strTag2;
// 判断是否存在
return this.allDeMainStateMap.get(strTag3);
}
}else{
return this.allDeMainStateMap.get(strTag2);
}
}
}else{
return this.allDeMainStateMap.get(strTag);
}
}
return null;
}
}
\ No newline at end of file
import SysAppUIServiceBase from './sys-app-ui-service-base';
/**
* 应用UI服务对象
*
* @export
* @class SysAppUIService
*/
export default class SysAppUIService extends SysAppUIServiceBase {
/**
* Creates an instance of SysAppUIService.
*
* @param {*} [opts={}]
* @memberof SysAppUIService
*/
constructor(opts: any = {}) {
super(opts);
}
}
\ No newline at end of file
......@@ -40,6 +40,7 @@ export class UIServiceRegister {
*/
protected init(): void {
this.allUIService.set('sysauthlog', () => import('@/uiservice/sys-auth-log/sys-auth-log-ui-service'));
this.allUIService.set('sysapp', () => import('@/uiservice/sys-app/sys-app-ui-service'));
this.allUIService.set('sysrolepermission', () => import('@/uiservice/sys-role-permission/sys-role-permission-ui-service'));
this.allUIService.set('syspermission', () => import('@/uiservice/sys-permission/sys-permission-ui-service'));
this.allUIService.set('sysuserrole', () => import('@/uiservice/sys-user-role/sys-user-role-ui-service'));
......
......@@ -565,6 +565,9 @@ export default class MainBase extends Vue implements ControlInterface {
case 'Auto5':
this.clickAuto5(item);
return;
case '_2':
this.click_2(item);
return;
case 'Auto6':
this.clickAuto6(item);
return;
......@@ -611,6 +614,24 @@ export default class MainBase extends Vue implements ControlInterface {
this.$router.push(path);
}
/**
* 接入应用
*
* @param {*} [item={}]
* @memberof Main
*/
public click_2(item: any = {}) {
const viewparam: any = {};
Object.assign(viewparam, {});
const deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'sysapps', parameterName: 'sysapp' },
{ pathName: 'gridview', parameterName: 'gridview' },
];
const path: string = this.$viewTool.buildUpRoutePath(this.$route, {}, deResParameters, parameters, [], viewparam);
this.$router.push(path);
}
/**
* 认证日志
*
......
......@@ -70,6 +70,25 @@ export default class MainModel {
appfunctag: 'Auto6',
resourcetag: '',
authtag:'web-Main-menuitem1',
},
{
id: '1CDA0214-F2CF-44CD-ACD1-2DE168FF5C0F',
name: 'menuitem2',
text: '接入应用',
type: 'MENUITEM',
counterid: '',
tooltip: '接入应用',
expanded: false,
separator: false,
hidden: false,
hidesidebar: false,
opendefault: false,
iconcls: 'fa fa-buysellads',
icon: '',
textcls: '',
appfunctag: '_2',
resourcetag: '',
authtag:'web-Main-menuitem2',
},
];
......@@ -105,6 +124,18 @@ export default class MainModel {
{ pathName: 'gridview', parameterName: 'gridview' },
],
},
{
appfunctag: '_2',
appfuncyype: 'APPVIEW',
openmode: '',
codename: 'sysappgridview',
deResParameters: [],
routepath: '/index/:index?/sysapps/:sysapp?/gridview/:gridview?',
parameters: [
{ pathName: 'sysapps', parameterName: 'sysapp' },
{ pathName: 'gridview', parameterName: 'gridview' },
],
},
{
appfunctag: 'Auto6',
appfuncyype: 'APPVIEW',
......
<template>
<i-form :model="this.data" class='app-search-form' ref='searchform' style="">
<input style="display:none;"/>
<row>
<i-col span="20" class="form-content">
<row>
<i-col v-show="detailsModel.n_appname_like.visible" :style="{}" :sm="{ span: 12, offset: 0 }" :md="{ span: 12, offset: 0 }" :lg="{ span: 12, offset: 0 }" :xl="{ span: 12, offset: 0 }">
<app-form-item name='n_appname_like' :itemRules="this.rules.n_appname_like" class='' :caption="$t('entities.sysapp.default_searchform.details.n_appname_like')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.n_appname_like.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.n_appname_like" @enter="onEnter($event)" :disabled="detailsModel.n_appname_like.disabled" type='text' style="width:100px;"></input-box>
</app-form-item>
</i-col>
</row>
</i-col>
<i-col span="4" class="search-button">
<row v-show="Object.keys(data).length>0">
<i-button class='search_reset' size="default" type="primary" @click="onSearch">{{$t('app.searchButton.search')}}</i-button>
<i-button class='search_reset' size="default" @click="onReset">{{this.$t('app.searchButton.reset')}}</i-button>
</row>
</i-col>
</row>
</i-form>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch, Model } from 'vue-property-decorator';
import { CreateElement } from 'vue';
import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils';
import SysAppService from '@/service/sys-app/sys-app-service';
import DefaultService from './default-searchform-service';
import { FormButtonModel, FormPageModel, FormItemModel, FormDRUIPartModel, FormPartModel, FormGroupPanelModel, FormIFrameModel, FormRowItemModel, FormTabPageModel, FormTabPanelModel, FormUserControlModel } from '@/model/form-detail';
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
@Component({
components: {
}
})
export default class DefaultBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof Default
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof Default
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof Default
*/
@Prop() public context: any;
/**
* 视图参数
*
* @type {*}
* @memberof Default
*/
@Prop() public viewparams: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof Default
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof Default
*/
public getControlType(): string {
return 'SEARCHFORM'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof Default
*/
public counterServiceArray:Array<any> = [];
/**
* 建构部件服务对象
*
* @type {DefaultService}
* @memberof Default
*/
public service: DefaultService = new DefaultService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {SysAppService}
* @memberof Default
*/
public appEntityService: SysAppService = new SysAppService({ $store: this.$store });
/**
* 关闭视图
*
* @param {any} args
* @memberof Default
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof Default
*/
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();
}
})
}
}
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof DefaultBase
*/
public getDatas(): any[] {
return [this.data];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof DefaultBase
*/
public getData(): any {
return this.data;
}
/**
* 显示处理提示
*
* @type {boolean}
* @memberof DefaultBase
*/
@Prop({ default: true }) public showBusyIndicator?: boolean;
/**
* 部件行为--loaddraft
*
* @type {string}
* @memberof DefaultBase
*/
@Prop() public loaddraftAction!: string;
/**
* 部件行为--load
*
* @type {string}
* @memberof DefaultBase
*/
@Prop() public loadAction!: string;
/**
* 视图标识
*
* @type {string}
* @memberof DefaultBase
*/
@Prop() public viewtag!: string;
/**
* 表单状态
*
* @type {Subject<any>}
* @memberof DefaultBase
*/
public formState: Subject<any> = new Subject();
/**
* 忽略表单项值变化
*
* @type {boolean}
* @memberof DefaultBase
*/
public ignorefieldvaluechange: boolean = false;
/**
* 数据变化
*
* @public
* @type {Subject<any>}
* @memberof DefaultBase
*/
public dataChang: Subject<any> = new Subject();
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof DefaultBase
*/
public dataChangEvent: Subscription | undefined;
/**
* 原始数据
*
* @public
* @type {*}
* @memberof DefaultBase
*/
public oldData: any = {};
/**
* 表单数据对象
*
* @type {*}
* @memberof DefaultBase
*/
public data: any = {
n_pssystemid_eq: null,
n_appname_like: null,
};
/**
* 属性值规则
*
* @type {*}
* @memberof DefaultBase
*/
public rules: any = {
n_pssystemid_eq: [
{ type: 'string', message: '系统标识(等于(=)) 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '系统标识(等于(=)) 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '系统标识(等于(=)) 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '系统标识(等于(=)) 值不能为空', trigger: 'blur' },
],
n_appname_like: [
{ type: 'string', message: '应用名(文本包含(%)) 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '应用名(文本包含(%)) 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '应用名(文本包含(%)) 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '应用名(文本包含(%)) 值不能为空', trigger: 'blur' },
],
}
/**
* 详情模型集合
*
* @type {*}
* @memberof DefaultBase
*/
public detailsModel: any = {
formpage1: new FormPageModel({ caption: '常规条件', detailType: 'FORMPAGE', name: 'formpage1', visible: true, isShowCaption: true, form: this })
,
n_pssystemid_eq: new FormItemModel({ caption: '系统标识(等于(=))', detailType: 'FORMITEM', name: 'n_pssystemid_eq', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
n_appname_like: new FormItemModel({ caption: '应用名(文本包含(%))', detailType: 'FORMITEM', name: 'n_appname_like', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
};
/**
* 监控表单属性 n_pssystemid_eq 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof DefaultBase
*/
@Watch('data.n_pssystemid_eq')
onN_pssystemid_eqChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'n_pssystemid_eq', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 n_appname_like 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof DefaultBase
*/
@Watch('data.n_appname_like')
onN_appname_likeChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'n_appname_like', newVal: newVal, oldVal: oldVal });
}
/**
* 重置表单项值
*
* @public
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof DefaultBase
*/
public resetFormData({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
}
/**
* 表单逻辑
*
* @public
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof DefaultBase
*/
public formLogic({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
}
/**
* 表单值变化
*
* @public
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @returns {void}
* @memberof DefaultBase
*/
public formDataChange({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
if (this.ignorefieldvaluechange) {
return;
}
this.resetFormData({ name: name, newVal: newVal, oldVal: oldVal });
this.formLogic({ name: name, newVal: newVal, oldVal: oldVal });
this.dataChang.next(JSON.stringify(this.data));
}
/**
* 表单加载完成
*
* @public
* @param {*} [data={}]
* @memberof DefaultBase
*/
public onFormLoad(data: any = {}): void {
this.setFormEnableCond(data);
this.fillForm(data);
this.formLogic({ name: '', newVal: null, oldVal: null });
}
/**
* 值填充
*
* @param {*} [_datas={}]
* @memberof DefaultBase
*/
public fillForm(_datas: any = {}): void {
this.ignorefieldvaluechange = true;
Object.keys(_datas).forEach((name: string) => {
if (this.data.hasOwnProperty(name)) {
this.data[name] = _datas[name];
}
});
this.$nextTick(function () {
this.ignorefieldvaluechange = false;
})
}
/**
* 设置表单项是否启用
*
* @public
* @param {*} data
* @memberof DefaultBase
*/
public setFormEnableCond(data: any): void {
Object.values(this.detailsModel).forEach((detail: any) => {
if (!Object.is(detail.detailType, 'FORMITEM')) {
return;
}
const formItem: FormItemModel = detail;
formItem.setEnableCond(data.srfuf);
});
}
/**
* 重置草稿表单状态
*
* @public
* @memberof DefaultBase
*/
public resetDraftFormStates(): void {
const form: any = this.$refs.form;
if (form) {
form.resetFields();
}
}
/**
* 重置校验结果
*
* @memberof DefaultBase
*/
public resetValidates(): void {
Object.values(this.detailsModel).forEach((detail: any) => {
if (!Object.is(detail.detailType, 'FORMITEM')) {
return;
}
const formItem: FormItemModel = detail;
formItem.setError('');
});
}
/**
* 填充校验结果 (后台)
*
* @param {any[]} fieldErrors
* @memberof DefaultBase
*/
public fillValidates(fieldErrors: any[]): void {
fieldErrors.forEach((error: any) => {
const formItem: FormItemModel = this.detailsModel[error.field];
if (!formItem) {
return;
}
this.$nextTick(() => {
formItem.setError(error.message);
});
});
}
/**
* 表单校验状态
*
* @returns {boolean}
* @memberof DefaultBase
*/
public formValidateStatus(): boolean {
const form: any = this.$refs.searchform;
let validatestate: boolean = true;
form.validate((valid: boolean) => {
validatestate = valid ? true : false;
});
return validatestate
}
/**
* 获取全部值
*
* @returns {*}
* @memberof DefaultBase
*/
public getValues(): any {
return this.data;
}
/**
* 表单项值变更
*
* @param {{ name: string, value: any }} $event
* @returns {void}
* @memberof DefaultBase
*/
public onFormItemValueChange($event: { name: string, value: any }): void {
if (!$event) {
return;
}
if (!$event.name || Object.is($event.name, '') || !this.data.hasOwnProperty($event.name)) {
return;
}
this.data[$event.name] = $event.value;
}
/**
* 设置数据项值
*
* @param {string} name
* @param {*} value
* @returns {void}
* @memberof DefaultBase
*/
public setDataItemValue(name: string, value: any): void {
if (!name || Object.is(name, '') || !this.data.hasOwnProperty(name)) {
return;
}
if (Object.is(this.data[name], value)) {
return;
}
this.data[name] = value;
}
/**
* 分组界面行为事件
*
* @param {*} $event
* @memberof DefaultBase
*/
public groupUIActionClick($event: any): void {
if (!$event) {
return;
}
const item:any = $event.item;
}
/**
* Vue声明周期(处理组件的输入属性)
*
* @memberof DefaultBase
*/
public created(): void {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof DefaultBase
*/
public afterCreated(){
if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if (!Object.is(tag, this.name)) {
return;
}
if (Object.is('autoload', action)) {
this.autoLoad(data);
}
if (Object.is('load', action)) {
this.load(data);
}
if (Object.is('loaddraft', action)) {
this.loadDraft(data);
}
});
}
}
/**
* vue 生命周期
*
* @memberof DefaultBase
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof DefaultBase
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
if (this.dataChangEvent) {
this.dataChangEvent.unsubscribe();
}
}
/**
* 自动加载
*
* @param {*} [arg={}]
* @returns {void}
* @memberof DefaultBase
*/
public autoLoad(arg: any = {}): void {
if (arg.srfkey && !Object.is(arg.srfkey, '')) {
Object.assign(arg, { srfkey: arg.srfkey });
this.load(arg);
return;
}
if (arg.srfkeys && !Object.is(arg.srfkeys, '')) {
Object.assign(arg, { srfkey: arg.srfkeys });
this.load(arg);
return;
}
this.loadDraft(arg);
}
/**
* 加载
*
* @public
* @param {*} [opt={}]
* @memberof DefaultBase
*/
public load(opt: any = {}): void {
if(!this.loadAction){
this.$Notice.error({ title: '错误', desc: 'SysAppGridView视图搜索表单loadAction参数未配置' });
return;
}
const arg: any = { ...opt };
Object.assign(arg,{viewparams:this.viewparams});
const get: Promise<any> = this.service.get(this.loadAction,JSON.parse(JSON.stringify(this.context)), arg, this.showBusyIndicator);
get.then((response: any) => {
if (response && response.status === 200) {
const data = response.data;
this.onFormLoad(data);
this.$emit('load', data);
this.$nextTick(() => {
this.formState.next({ type: 'load', data: data });
});
}
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
return;
}
const { data: _data } = response;
this.$Notice.error({ title: _data.title, desc: _data.message });
});
}
/**
* 加载草稿
*
* @param {*} [opt={}]
* @memberof DefaultBase
*/
public loadDraft(opt: any = {},mode?:string): void {
if(!this.loaddraftAction){
this.$Notice.error({ title: '错误', desc: 'SysAppGridView视图搜索表单loaddraftAction参数未配置' });
return;
}
const arg: any = { ...opt } ;
Object.assign(arg,{viewparams:this.viewparams});
let post: Promise<any> = this.service.loadDraft(this.loaddraftAction,JSON.parse(JSON.stringify(this.context)), arg, this.showBusyIndicator);
post.then((response: any) => {
if (!response.status || response.status !== 200) {
if (response.errorMessage) {
this.$Notice.error({ title: '错误', desc: response.errorMessage });
}
return;
}
const data = response.data;
this.resetDraftFormStates();
this.onFormLoad(data);
setTimeout(() => {
const form: any = this.$refs.form;
if (form) {
form.fields.forEach((field: any) => {
field.validateMessage = "";
field.validateState = "";
field.validateStatus = false;
});
}
});
if(Object.is(mode,'RESET')){
if (!this.formValidateStatus()) {
return;
}
}
this.$emit('load', data);
this.$nextTick(() => {
this.formState.next({ type: 'load', data: data });
});
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
return;
}
const { data: _data } = response;
this.$Notice.error({ title: _data.title, desc: _data.message });
});
}
/**
* 表单项更新
*
* @param {string} mode 界面行为名称
* @param {*} [data={}] 请求数据
* @param {string[]} updateDetails 更新项
* @param {boolean} [showloading] 是否显示加载状态
* @returns {void}
* @memberof DefaultBase
*/
public updateFormItems(mode: string, data: any = {}, updateDetails: string[], showloading?: boolean): void {
}
/**
* 回车事件
*
* @param {*} $event
* @memberof DefaultBase
*/
public onEnter($event: any): void {
if (!this.formValidateStatus()) {
return;
}
this.$emit('search', this.data);
}
/**
* 搜索
*
* @memberof DefaultBase
*/
public onSearch() {
if (!this.formValidateStatus()) {
return;
}
this.$emit('search', this.data);
}
/**
* 重置
*
* @memberof DefaultBase
*/
public onReset() {
this.loadDraft({},'RESET');
}
}
</script>
<style lang='less'>
@import './default-searchform.less';
</style>
\ No newline at end of file
/**
* Default 部件模型
*
* @export
* @class DefaultModel
*/
export default class DefaultModel {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof DefaultModel
*/
public getDataItems(): any[] {
return [
{
name: 'srfwfmemo',
prop: 'srfwfmemo',
dataType: 'TEXT',
},
// 前端新增修改标识,新增为"0",修改为"1"或未设值
{
name: 'srffrontuf',
prop: 'srffrontuf',
dataType: 'TEXT',
},
{
name: 'n_pssystemid_eq',
prop: 'systemid',
dataType: 'PICKUP',
},
{
name: 'n_appname_like',
prop: 'label',
dataType: 'TEXT',
},
]
}
}
\ No newline at end of file
import { Http,Util,Errorlog } from '@/utils';
import ControlService from '@/widgets/control-service';
import SysAppService from '@/service/sys-app/sys-app-service';
import DefaultModel from './default-searchform-model';
/**
* Default 部件服务对象
*
* @export
* @class DefaultService
*/
export default class DefaultService extends ControlService {
/**
* 应用服务对象
*
* @type {SysAppService}
* @memberof DefaultService
*/
public appEntityService: SysAppService = new SysAppService({ $store: this.getStore() });
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof DefaultService
*/
public setTempMode(){
this.isTempMode = false;
}
/**
* Creates an instance of DefaultService.
*
* @param {*} [opts={}]
* @memberof DefaultService
*/
constructor(opts: any = {}) {
super(opts);
this.model = new DefaultModel();
}
/**
* 处理数据
*
* @private
* @param {Promise<any>} promise
* @returns {Promise<any>}
* @memberof DefaultService
*/
private doItems(promise: Promise<any>, deKeyField: string, deName: string): Promise<any> {
return new Promise((resolve, reject) => {
promise.then((response: any) => {
if (response && response.status === 200) {
const data = response.data;
data.forEach((item:any,index:number) =>{
item[deName] = item[deKeyField];
data[index] = item;
});
resolve(data);
} else {
reject([])
}
}).catch((response: any) => {
reject([])
});
});
}
/**
* 获取跨实体数据集合
*
* @param {string} serviceName 服务名称
* @param {string} interfaceName 接口名称
* @param {*} data
* @param {boolean} [isloading]
* @returns {Promise<any[]>}
* @memberof DefaultService
*/
@Errorlog
public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> {
return Promise.reject([])
}
/**
* 启动工作流
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {*} [localdata]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public wfstart(action: string,context: any = {},data: any = {}, isloading?: boolean,localdata?:any): Promise<any> {
data = this.handleWFData(data);
context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](context,data, isloading,localdata);
} else {
result = this.appEntityService.WFStart(context,data, isloading,localdata);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 提交工作流
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {*} [localdata]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public wfsubmit(action: string,context: any = {}, data: any = {}, isloading?: boolean,localdata?:any): Promise<any> {
data = this.handleWFData(data,true);
context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](context,data, isloading,localdata);
} else {
result = this.appEntityService.WFSubmit(context,data, isloading,localdata);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 添加数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public add(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Create(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 删除数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public delete(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Remove(Context,Data, isloading);
}
result.then((response) => {
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 修改数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public update(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Update(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 查询数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public get(action: string,context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Get(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 加载草稿
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public loadDraft(action: string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
//仿真主键数据
const PrimaryKey = Util.createUUID();
Data.id = PrimaryKey;
Data.sysapp = PrimaryKey;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.GetDraft(Context,Data, isloading);
}
result.then((response) => {
response.data.id = PrimaryKey;
this.handleResponse(action, response, true);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 前台逻辑
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public frontLogic(action:string,context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any)=>{
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
return Promise.reject({ status: 500, data: { title: '失败', message: '系统异常' } });
}
result.then((response) => {
this.handleResponse(action, response,true);
resolve(response);
}).catch(response => {
reject(response);
});
})
}
/**
* 处理请求数据
*
* @param action 行为
* @param data 数据
* @memberof DefaultService
*/
public handleRequestData(action: string,context:any, data: any = {}){
let mode: any = this.getMode();
if (!mode && mode.getDataItems instanceof Function) {
return data;
}
let formItemItems: any[] = mode.getDataItems();
let requestData:any = {};
formItemItems.forEach((item:any) =>{
if(item && item.dataType && Object.is(item.dataType,'FONTKEY')){
if(item && item.prop){
requestData[item.prop] = context[item.name];
}
}else{
if(item && item.prop){
requestData[item.prop] = data[item.name];
}
}
});
if(data && data.viewparams){
Object.assign(requestData,data.viewparams);
}
let tempContext:any = JSON.parse(JSON.stringify(context));
if(tempContext && tempContext.srfsessionid){
tempContext.srfsessionkey = tempContext.srfsessionid;
delete tempContext.srfsessionid;
}
return {context:tempContext,data:requestData};
}
}
\ No newline at end of file
.ivu-tabs-no-animation>.ivu-tabs-content{
padding: 0 16px;
}
.ivu-card-head{
padding: 14px 0;
}
.app-search-form {
padding: 8px 14px 0;
.ivu-form-item{
margin-bottom: 8px;
}
.search_reset {
margin-right: 12px;
margin-bottom: 8px;
}
.search-button{
text-align: right;
}
}
.app-search-form-flex {
height: 100%;
> .ivu-row {
height: 100%;
> .ivu-tabs {
height: 100%;
display: flex;
flex-direction: column;
> .ivu-tabs-content {
flex-grow: 1;
overflow: auto;
> .ivu-tabs-tabpane {
height: 100%;
}
}
}
}
}
.app-tabpanel-flex {
height: 100%;
> .ivu-tabs-content {
height: calc(100% - 52px);
> .ivu-tabs-tabpane {
height: 100%;
}
}
}
// this is less
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import DefaultBase from './default-searchform-base.vue';
@Component({
components: {
}
})
export default class Default extends DefaultBase {
}
</script>
\ No newline at end of file
<template>
<i-form :model="this.data" class='app-form' ref='form' id='sysapp_main' style="">
<input style="display:none;" />
<row >
<i-col v-show="detailsModel.group1.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-group layoutType="TABLE_24COL" titleStyle="" class='' :uiActionGroup="detailsModel.group1.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.sysapp.main_form.details.group1')" :isShowCaption="true" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<row>
<i-col v-show="detailsModel.pssystemid.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='pssystemid' :itemRules="this.rules.pssystemid" class='' :caption="$t('entities.sysapp.main_form.details.pssystemid')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.pssystemid.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.pssystemid" @enter="onEnter($event)" unit="" :disabled="detailsModel.pssystemid.disabled" type='text' style=""></input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.appid.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='appid' :itemRules="this.rules.appid" class='' :caption="$t('entities.sysapp.main_form.details.appid')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.appid.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.appid" @enter="onEnter($event)" unit="" :disabled="detailsModel.appid.disabled" type='text' style=""></input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.appname.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='appname' :itemRules="this.rules.appname" class='' :caption="$t('entities.sysapp.main_form.details.appname')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.appname.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.appname" @enter="onEnter($event)" unit="" :disabled="detailsModel.appname.disabled" type='text' style=""></input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.apptype.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='apptype' :itemRules="this.rules.apptype" class='' :caption="$t('entities.sysapp.main_form.details.apptype')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.apptype.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.apptype" @enter="onEnter($event)" unit="" :disabled="detailsModel.apptype.disabled" type='text' style=""></input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.fullname.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='fullname' :itemRules="this.rules.fullname" class='' :caption="$t('entities.sysapp.main_form.details.fullname')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.fullname.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.fullname" @enter="onEnter($event)" unit="" :disabled="detailsModel.fullname.disabled" type='text' style=""></input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.icon.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='icon' :itemRules="this.rules.icon" class='' :caption="$t('entities.sysapp.main_form.details.icon')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.icon.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.icon" @enter="onEnter($event)" unit="" :disabled="detailsModel.icon.disabled" type='text' style=""></input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.visabled.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='visabled' :itemRules="this.rules.visabled" class='' :caption="$t('entities.sysapp.main_form.details.visabled')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.visabled.error" :isEmptyCaption="false" labelPos="LEFT">
<app-switch name='visabled' :value="this.data.visabled" @change="($event)=>{this.data.visabled = $event} " :disabled="detailsModel.visabled.disabled" style=""></app-switch>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.addr.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='addr' :itemRules="this.rules.addr" class='' :caption="$t('entities.sysapp.main_form.details.addr')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.addr.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.addr" @enter="onEnter($event)" unit="" :disabled="detailsModel.addr.disabled" type='text' style=""></input-box>
</app-form-item>
</i-col>
</row>
</app-form-group>
</i-col>
</row>
</i-form>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch, Model } from 'vue-property-decorator';
import { CreateElement } from 'vue';
import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils';
import SysAppService from '@/service/sys-app/sys-app-service';
import MainService from './main-form-service';
import { FormButtonModel, FormPageModel, FormItemModel, FormDRUIPartModel, FormPartModel, FormGroupPanelModel, FormIFrameModel, FormRowItemModel, FormTabPageModel, FormTabPanelModel, FormUserControlModel } from '@/model/form-detail';
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
@Component({
components: {
}
})
export default class MainBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof Main
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof Main
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof Main
*/
@Prop() public context: any;
/**
* 视图参数
*
* @type {*}
* @memberof Main
*/
@Prop() public viewparams: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof Main
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof Main
*/
public getControlType(): string {
return 'FORM'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof Main
*/
public counterServiceArray:Array<any> = [];
/**
* 建构部件服务对象
*
* @type {MainService}
* @memberof Main
*/
public service: MainService = new MainService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {SysAppService}
* @memberof Main
*/
public appEntityService: SysAppService = new SysAppService({ $store: this.$store });
/**
* 关闭视图
*
* @param {any} args
* @memberof Main
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof Main
*/
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();
}
})
}
}
/**
* 工作流审批意见控件绑定值
*
* @memberof Main
*/
public srfwfmemo:string = "";
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof Main
*/
public getDatas(): any[] {
return [this.data];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof Main
*/
public getData(): any {
return this.data;
}
/**
* 是否默认保存
*
* @type {boolean}
* @memberof Main
*/
@Prop({ default: false }) public autosave?: boolean;
/**
* 显示处理提示
*
* @type {boolean}
* @memberof Main
*/
@Prop({ default: true }) public showBusyIndicator?: boolean;
/**
* 部件行为--submit
*
* @type {string}
* @memberof Main
*/
@Prop() public WFSubmitAction!: string;
/**
* 部件行为--start
*
* @type {string}
* @memberof Main
*/
@Prop() public WFStartAction!: string;
/**
* 部件行为--update
*
* @type {string}
* @memberof Main
*/
@Prop() public updateAction!: string;
/**
* 部件行为--remove
*
* @type {string}
* @memberof Main
*/
@Prop() public removeAction!: string;
/**
* 部件行为--loaddraft
*
* @type {string}
* @memberof Main
*/
@Prop() public loaddraftAction!: string;
/**
* 部件行为--load
*
* @type {string}
* @memberof Main
*/
@Prop() public loadAction!: string;
/**
* 部件行为--create
*
* @type {string}
* @memberof Main
*/
@Prop() public createAction!: string;
/**
* 部件行为--create
*
* @type {string}
* @memberof Main
*/
@Prop() public searchAction!: string;
/**
* 视图标识
*
* @type {string}
* @memberof Main
*/
@Prop() public viewtag!: string;
/**
* 表单状态
*
* @type {Subject<any>}
* @memberof Main
*/
public formState: Subject<any> = new Subject();
/**
* 忽略表单项值变化
*
* @type {boolean}
* @memberof Main
*/
public ignorefieldvaluechange: boolean = false;
/**
* 数据变化
*
* @public
* @type {Subject<any>}
* @memberof Main
*/
public dataChang: Subject<any> = new Subject();
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof Main
*/
public dataChangEvent: Subscription | undefined;
/**
* 原始数据
*
* @public
* @type {*}
* @memberof Main
*/
public oldData: any = {};
/**
* 表单数据对象
*
* @type {*}
* @memberof Main
*/
public data: any = {
srforikey: null,
srfkey: null,
srfmajortext: null,
srftempmode: null,
srfuf: null,
srfdeid: null,
srfsourcekey: null,
pssystemid: null,
appid: null,
appname: null,
apptype: null,
fullname: null,
icon: null,
visabled: null,
addr: null,
sysapp:null,
};
/**
* 当前执行的行为逻辑
*
* @type {string}
* @memberof Main
*/
public currentAction: string = "";
/**
* 关系界面计数器
*
* @type {number}
* @memberof Main
*/
public drcounter: number = 0;
/**
* 需要等待关系界面保存时,第一次调用save参数的备份
*
* @type {number}
* @memberof Main
*/
public drsaveopt: any = {};
/**
* 表单保存回调存储对象
*
* @type {any}
* @memberof Main
*/
public saveState:any ;
/**
* 属性值规则
*
* @type {*}
* @memberof Main
*/
public rules: any = {
srforikey: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
srfkey: [
{ type: 'string', message: '应用标识 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '应用标识 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '应用标识 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '应用标识 值不能为空', trigger: 'blur' },
],
srfmajortext: [
{ type: 'string', message: '应用名 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '应用名 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '应用名 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '应用名 值不能为空', trigger: 'blur' },
],
srftempmode: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
srfuf: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
srfdeid: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
srfsourcekey: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
pssystemid: [
{ type: 'string', message: '系统标识 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '系统标识 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '系统标识 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '系统标识 值不能为空', trigger: 'blur' },
],
appid: [
{ type: 'string', message: '应用标识 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '应用标识 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '应用标识 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '应用标识 值不能为空', trigger: 'blur' },
],
appname: [
{ type: 'string', message: '应用名 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '应用名 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '应用名 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '应用名 值不能为空', trigger: 'blur' },
],
apptype: [
{ type: 'string', message: '类型 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '类型 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '类型 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '类型 值不能为空', trigger: 'blur' },
],
fullname: [
{ type: 'string', message: '全称 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '全称 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '全称 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '全称 值不能为空', trigger: 'blur' },
],
icon: [
{ type: 'string', message: '图标 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '图标 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '图标 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '图标 值不能为空', trigger: 'blur' },
],
visabled: [
{ type: 'number', message: '可见 值必须为数值类型', trigger: 'change' },
{ type: 'number', message: '可见 值必须为数值类型', trigger: 'blur' },
{ required: false, type: 'number', message: '可见 值不能为空', trigger: 'change' },
{ required: false, type: 'number', message: '可见 值不能为空', trigger: 'blur' },
],
addr: [
{ type: 'string', message: '地址 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '地址 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '地址 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '地址 值不能为空', trigger: 'blur' },
],
}
/**
* 详情模型集合
*
* @type {*}
* @memberof Main
*/
public detailsModel: any = {
group1: new FormGroupPanelModel({ caption: '应用基本信息', detailType: 'GROUPPANEL', name: 'group1', visible: true, isShowCaption: true, form: this, uiActionGroup: { caption: '', langbase: 'entities.sysapp.main_form', extractMode: 'ITEM', details: [] } })
,
formpage1: new FormPageModel({ caption: '基本信息', detailType: 'FORMPAGE', name: 'formpage1', visible: true, isShowCaption: true, form: this })
,
srforikey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srforikey', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srfkey: new FormItemModel({ caption: '应用标识', detailType: 'FORMITEM', name: 'srfkey', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srfmajortext: new FormItemModel({ caption: '应用名', detailType: 'FORMITEM', name: 'srfmajortext', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srftempmode: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srftempmode', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srfuf: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfuf', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srfdeid: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfdeid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srfsourcekey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfsourcekey', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
pssystemid: new FormItemModel({ caption: '系统标识', detailType: 'FORMITEM', name: 'pssystemid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 1 })
,
appid: new FormItemModel({ caption: '应用标识', detailType: 'FORMITEM', name: 'appid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 1 })
,
appname: new FormItemModel({ caption: '应用名', detailType: 'FORMITEM', name: 'appname', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 1 })
,
apptype: new FormItemModel({ caption: '类型', detailType: 'FORMITEM', name: 'apptype', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
fullname: new FormItemModel({ caption: '全称', detailType: 'FORMITEM', name: 'fullname', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
icon: new FormItemModel({ caption: '图标', detailType: 'FORMITEM', name: 'icon', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
visabled: new FormItemModel({ caption: '可见', detailType: 'FORMITEM', name: 'visabled', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
addr: new FormItemModel({ caption: '地址', detailType: 'FORMITEM', name: 'addr', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
};
/**
* 监控表单属性 srforikey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.srforikey')
onSrforikeyChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srforikey', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfkey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.srfkey')
onSrfkeyChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfkey', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfmajortext 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.srfmajortext')
onSrfmajortextChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfmajortext', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srftempmode 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.srftempmode')
onSrftempmodeChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srftempmode', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfuf 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.srfuf')
onSrfufChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfuf', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfdeid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.srfdeid')
onSrfdeidChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfdeid', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfsourcekey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.srfsourcekey')
onSrfsourcekeyChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfsourcekey', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 pssystemid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.pssystemid')
onPssystemidChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'pssystemid', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 appid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.appid')
onAppidChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'appid', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 appname 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.appname')
onAppnameChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'appname', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 apptype 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.apptype')
onApptypeChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'apptype', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 fullname 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.fullname')
onFullnameChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'fullname', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 icon 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.icon')
onIconChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'icon', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 visabled 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.visabled')
onVisabledChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'visabled', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 addr 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.addr')
onAddrChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'addr', newVal: newVal, oldVal: oldVal });
}
/**
* 重置表单项值
*
* @public
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof Main
*/
public resetFormData({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
}
/**
* 置空对象
*
* @param {any[]} args
* @memberof EditForm
*/
public ResetData(_datas:any){
if(Object.keys(_datas).length >0){
Object.keys(_datas).forEach((name: string) => {
if (this.data.hasOwnProperty(name)) {
this.data[name] = null;
}
});
}
}
/**
* 表单逻辑
*
* @public
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof Main
*/
public formLogic({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
}
/**
* 表单值变化
*
* @public
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @returns {void}
* @memberof Main
*/
public formDataChange({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
if (this.ignorefieldvaluechange) {
return;
}
this.resetFormData({ name: name, newVal: newVal, oldVal: oldVal });
this.formLogic({ name: name, newVal: newVal, oldVal: oldVal });
this.dataChang.next(JSON.stringify(this.data));
}
/**
* 表单加载完成
*
* @public
* @param {*} [data={}]
* @param {string} [action]
* @memberof Main
*/
public onFormLoad(data: any = {},action:string): void {
if(Object.is(action,"save") || Object.is(action,"autoSave") || Object.is(action,"submit"))
// 更新context的实体主键
if(data.sysapp){
Object.assign(this.context,{sysapp:data.sysapp})
}
this.setFormEnableCond(data);
this.fillForm(data,action);
this.oldData = {};
Object.assign(this.oldData, JSON.parse(JSON.stringify(this.data)));
this.$store.commit('viewaction/setViewDataChange', { viewtag: this.viewtag, viewdatachange: false });
this.formLogic({ name: '', newVal: null, oldVal: null });
}
/**
* 值填充
*
* @param {*} [_datas={}]
* @param {string} [action]
* @memberof Main
*/
public fillForm(_datas: any = {},action:string): void {
this.ignorefieldvaluechange = true;
Object.keys(_datas).forEach((name: string) => {
if (this.data.hasOwnProperty(name)) {
this.data[name] = _datas[name];
}
});
if(Object.is(action,'loadDraft')){
this.createDefault();
}
if(Object.is(action,'load')){
this.updateDefault();
}
this.$nextTick(function () {
this.ignorefieldvaluechange = false;
})
}
/**
* 设置表单项是否启用
*
* @public
* @param {*} data
* @memberof Main
*/
public setFormEnableCond(data: any): void {
Object.values(this.detailsModel).forEach((detail: any) => {
if (!Object.is(detail.detailType, 'FORMITEM')) {
return;
}
const formItem: FormItemModel = detail;
formItem.setEnableCond(data.srfuf);
});
}
/**
* 重置草稿表单状态
*
* @public
* @memberof Main
*/
public resetDraftFormStates(): void {
const form: any = this.$refs.form;
if (form) {
form.resetFields();
}
}
/**
* 重置校验结果
*
* @memberof Main
*/
public resetValidates(): void {
Object.values(this.detailsModel).forEach((detail: any) => {
if (!Object.is(detail.detailType, 'FORMITEM')) {
return;
}
const formItem: FormItemModel = detail;
formItem.setError('');
});
}
/**
* 填充校验结果 (后台)
*
* @param {any[]} fieldErrors
* @memberof Main
*/
public fillValidates(fieldErrors: any[]): void {
fieldErrors.forEach((error: any) => {
const formItem: FormItemModel = this.detailsModel[error.field];
if (!formItem) {
return;
}
this.$nextTick(() => {
formItem.setError(error.message);
});
});
}
/**
* 表单校验状态
*
* @returns {boolean}
* @memberof Main
*/
public formValidateStatus(): boolean {
const form: any = this.$refs.form;
let validatestate: boolean = true;
form.validate((valid: boolean) => {
validatestate = valid ? true : false;
});
return validatestate
}
/**
* 获取全部值
*
* @returns {*}
* @memberof Main
*/
public getValues(): any {
return this.data;
}
/**
* 表单项值变更
*
* @param {{ name: string, value: any }} $event
* @returns {void}
* @memberof Main
*/
public onFormItemValueChange($event: { name: string, value: any }): void {
if (!$event) {
return;
}
if (!$event.name || Object.is($event.name, '') || !this.data.hasOwnProperty($event.name)) {
return;
}
this.data[$event.name] = $event.value;
}
/**
* 设置数据项值
*
* @param {string} name
* @param {*} value
* @returns {void}
* @memberof Main
*/
public setDataItemValue(name: string, value: any): void {
if (!name || Object.is(name, '') || !this.data.hasOwnProperty(name)) {
return;
}
if (Object.is(this.data[name], value)) {
return;
}
this.data[name] = value;
}
/**
* 分组界面行为事件
*
* @param {*} $event
* @memberof Main
*/
public groupUIActionClick($event: any): void {
if (!$event) {
return;
}
const item:any = $event.item;
}
/**
* Vue声明周期(处理组件的输入属性)
*
* @memberof Main
*/
public created(): void {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof Main
*/
public afterCreated(){
if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if (!Object.is(tag, this.name)) {
return;
}
if (Object.is('autoload', action)) {
this.autoLoad(data);
}
if (Object.is('load', action)) {
this.load(data);
}
if (Object.is('loaddraft', action)) {
if(this.context.srfsourcekey){
this.copy(this.context.srfsourcekey);
}else{
this.loadDraft(data);
}
}
if (Object.is('save', action)) {
this.save(data,data.showResultInfo);
}
if (Object.is('remove', action)) {
this.remove(data);
}
if (Object.is('saveandexit', action)) {
this.saveAndExit(data);
}
if (Object.is('saveandnew', action)) {
this.saveAndNew(data);
}
if (Object.is('removeandexit', action)) {
this.removeAndExit(data);
}
if (Object.is('refresh', action)) {
this.refresh(data);
}
});
}
this.dataChang
.pipe(
debounceTime(300),
distinctUntilChanged()
).subscribe((data: any) => {
if (this.autosave) {
this.autoSave();
}
const state = !Object.is(JSON.stringify(this.oldData), JSON.stringify(this.data)) ? true : false;
this.$store.commit('viewaction/setViewDataChange', { viewtag: this.viewtag, viewdatachange: state });
});
}
/**
* vue 生命周期
*
* @memberof Main
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof Main
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
if (this.dataChangEvent) {
this.dataChangEvent.unsubscribe();
}
}
/**
* 拷贝内容
*
* @param {*} [arg={}]
* @memberof @memberof Main
*/
public copy(srfkey: string): void {
let copyData = this.$store.getters.getCopyData(srfkey);
copyData.srfkey = Util.createUUID();
copyData.sysapp = copyData.srfkey;
copyData.id = copyData.srfkey;
Object.assign(this.context,{sysapp:copyData.sysapp})
this.data = copyData;
this.$nextTick(() => {
this.formState.next({ type: 'load', data: copyData });
this.data.srfuf = '0';
this.setFormEnableCond(this.data);
});
}
/**
*打印
*@memberof @memberof Main
*/
public print(){
let _this:any = this;
_this.$print({id:'sysapp_main',popTitle:'主编辑表单'});
}
/**
* 部件刷新
*
* @param {any[]} args
* @memberof Main
*/
public refresh(args: any[]): void {
let arg: any = {};
Object.assign(arg,args[0]);
if (this.data.srfkey && !Object.is(this.data.srfkey, '')) {
Object.assign(arg, { srfkey: this.data.srfkey });
this.load(arg);
return;
}
if (this.data.srfkeys && !Object.is(this.data.srfkeys, '')) {
Object.assign(arg, { srfkey: this.data.srfkeys });
this.load(arg);
return;
}
}
/**
* 自动加载
*
* @param {*} [arg={}]
* @returns {void}
* @memberof Main
*/
public autoLoad(arg: any = {}): void {
if (arg.srfkey && !Object.is(arg.srfkey, '')) {
Object.assign(arg, { srfkey: arg.srfkey });
this.load(arg);
return;
}
if (arg.srfkeys && !Object.is(arg.srfkeys, '')) {
Object.assign(arg, { srfkey: arg.srfkeys });
this.load(arg);
return;
}
this.loadDraft(arg);
}
/**
* 加载
*
* @public
* @param {*} [opt={}]
* @memberof Main
*/
public load(opt: any = {}): void {
if(!this.loadAction){
this.$Notice.error({ title: '错误', desc: 'SysAppEditView视图表单loadAction参数未配置' });
return;
}
const arg: any = { ...opt };
let viewparamResult:any = Object.assign(arg,this.viewparams);
const get: Promise<any> = this.service.get(this.loadAction,JSON.parse(JSON.stringify(this.context)),{viewparams:viewparamResult}, this.showBusyIndicator);
get.then((response: any) => {
if (response && response.status === 200) {
const data = response.data;
this.onFormLoad(data,'load');
this.$emit('load', data);
this.$nextTick(() => {
this.formState.next({ type: 'load', data: data });
});
}
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
return;
}
});
}
/**
* 加载草稿
*
* @param {*} [opt={}]
* @memberof Main
*/
public loadDraft(opt: any = {}): void {
if(!this.loaddraftAction){
this.$Notice.error({ title: '错误', desc: 'SysAppEditView视图表单loaddraftAction参数未配置' });
return;
}
const arg: any = { ...opt } ;
let viewparamResult:any = Object.assign(arg,this.viewparams);
let post: Promise<any> = this.service.loadDraft(this.loaddraftAction,JSON.parse(JSON.stringify(this.context)),{viewparams:viewparamResult}, this.showBusyIndicator);
post.then((response: any) => {
if (!response.status || response.status !== 200) {
if (response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
}
return;
}
const data = response.data;
if(data.sysapp){
Object.assign(this.context,{sysapp:data.sysapp})
}
this.resetDraftFormStates();
this.onFormLoad(data,'loadDraft');
this.$emit('load', data);
this.$nextTick(() => {
this.formState.next({ type: 'load', data: data });
});
setTimeout(() => {
const form: any = this.$refs.form;
if (form) {
form.fields.forEach((field: any) => {
field.validateMessage = "";
field.validateState = "";
field.validateStatus = false;
});
}
});
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
return;
}
});
}
/**
* 自动保存
*
* @param {*} [opt={}]
* @memberof Main
*/
public autoSave(opt: any = {}): void {
if (!this.formValidateStatus()) {
return;
}
const arg: any = { ...opt };
const data = this.getValues();
Object.assign(arg, data);
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: '错误', desc: 'SysAppEditView视图表单'+actionName+'参数未配置' });
return;
}
Object.assign(arg,{viewparams:this.viewparams});
const post: Promise<any> = this.service.add(action, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator);
post.then((response: any) => {
if (!response.status || response.status !== 200) {
if (response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
}
return;
}
const data = response.data;
this.onFormLoad(data,'autoSave');
this.$emit('save', data);
this.$store.dispatch('viewaction/datasaved', { viewtag: this.viewtag });
this.$nextTick(() => {
this.formState.next({ type: 'save', data: data });
});
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
return;
}
});
}
/**
* 保存
*
* @param {*} [opt={}]
* @param {boolean} [showResultInfo]
* @param {boolean} [ifStateNext] formState是否下发通知
* @returns {Promise<any>}
* @memberof Main
*/
public async save(opt: any = {}, showResultInfo?: boolean, ifStateNext: boolean = true): Promise<any> {
return new Promise((resolve: any, reject: any) => {
showResultInfo = showResultInfo === undefined ? true : false;
if (!this.formValidateStatus()) {
this.$Notice.error({ title: '错误', desc: '值规则校验异常' });
return;
}
const arg: any = { ...opt };
const data = this.getValues();
Object.assign(arg, data);
Object.assign(arg, this.context);
if (ifStateNext) {
this.drcounter = 0;
if(this.drcounter !== 0){
this.drsaveopt = opt;
this.formState.next({ type: 'beforesave', data: arg });//先通知关系界面保存
this.saveState = resolve;
return;
}
}
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: '错误', desc: 'SysAppEditView视图表单'+actionName+'参数未配置' });
return;
}
Object.assign(arg,{viewparams:this.viewparams});
const post: Promise<any> = Object.is(data.srfuf, '1')?this.service.update(action, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator):this.service.add(action,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator);
post.then((response: any) => {
if (!response.status || response.status !== 200) {
if (response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
}
return;
}
const data = response.data;
this.onFormLoad(data,'save');
this.$emit('save', data);
this.$store.dispatch('viewaction/datasaved', { viewtag: this.viewtag });
this.$nextTick(() => {
this.formState.next({ type: 'save', data: data });
});
if (showResultInfo) {
this.$Notice.success({ title: '', desc: (data.srfmajortext ? data.srfmajortext : '') + '&nbsp;保存成功!' });
}
resolve(response);
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
reject(response);
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
reject(response);
return;
}
reject(response);
});
})
}
/**
* 删除
*
* @public
* @param {*} [opt={}]
* @memberof EditForm
*/
public remove(opt:Array<any> = [],showResultInfo?: boolean): Promise<any> {
return new Promise((resolve: any, reject: any) => {
if(!this.removeAction){
this.$Notice.error({ title: '错误', desc: 'SysAppEditView视图表单removeAction参数未配置' });
return;
}
const arg: any = opt[0];
const _this: any = this;
Object.assign(arg,{viewparams:this.viewparams});
this.service.delete(_this.removeAction, JSON.parse(JSON.stringify(this.context)),arg, showResultInfo).then((response: any) => {
if (response) {
const data = response.data;
this.$emit('remove',data);
this.formState.next({ type: 'remove', data: data });
this.data.ismodify = false;
this.$Notice.success({ title: '', desc: (data.srfmajortext ? data.srfmajortext : '') + '&nbsp;删除成功!' });
resolve(response);
}
}).catch((error: any) => {
const { data: _data } = error;
this.$Notice.error({ title: _data.title, desc: _data.message });
reject(error);
});
});
}
/**
* 工作流启动
*
* @param {*} [data={}]
* @param {*} [localdata={}]
* @returns {Promise<any>}
* @memberof Main
*/
public async wfstart(data: any,localdata?:any): Promise<any> {
return new Promise((resolve: any, reject: any) => {
const _this: any = this;
const post: Promise<any> = _this.save({},false);
post.then((response:any) =>{
const arg:any = response.data;
if(this.viewparams){
Object.assign(arg,{viewparams:this.viewparams});
}
const result: Promise<any> = this.service.wfstart(_this.WFStartAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator,localdata);
result.then((response: any) => {
if (!response || response.status !== 200) {
if(response.data){
this.$Notice.error({ title: '', desc: '工作流启动失败, ' + response.data.message });
}
return;
}
this.$Notice.info({ title: '', desc: '工作流启动成功' });
resolve(response);
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
reject(response);
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
reject(response);
return;
}
reject(response);
});
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
reject(response);
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
reject(response);
return;
}
reject(response);
})
});
}
/**
* 工作流提交
*
* @param {*} [data={}]
* @param {*} [localdata={}]
* @returns {Promise<any>}
* @memberof Main
*/
public async wfsubmit(data: any,localdata?:any): Promise<any> {
return new Promise((resolve: any, reject: any) => {
const _this: any = this;
const arg: any = data[0];
Object.assign(arg,{viewparams:this.viewparams});
if (!arg.sysapp || Object.is(arg.sysapp, '')) {
return;
}
const post: Promise<any> = Object.is(arg.srfuf, '1')?this.service.update(this.updateAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator):this.service.add(this.createAction,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator);
post.then((response:any) =>{
const arg:any = response.data;
// 保存完成UI处理
this.onFormLoad(arg,'save');
this.$emit('save', arg);
this.$nextTick(() => {
this.formState.next({ type: 'save', data: arg });
});
// 准备提交参数
if(this.viewparams){
Object.assign(arg,{viewparams:this.viewparams});
}
// 强制补充srfwfmemo
if(this.srfwfmemo){
Object.assign(arg,{srfwfmemo:this.srfwfmemo});
}
const result: Promise<any> = this.service.wfsubmit(_this.WFSubmitAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator,localdata);
result.then((response: any) => {
if (!response || response.status !== 200) {
if(response.data){
this.$Notice.error({ title: '', desc: '工作流提交失败, ' + response.data.message });
}
return;
}
this.onFormLoad(arg,'submit');
this.$store.dispatch('viewaction/datasaved', { viewtag: this.viewtag });
this.$Notice.info({ title: '', desc: '工作流提交成功' });
resolve(response);
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
reject(response);
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
reject(response);
return;
}
reject(response);
});
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
reject(response);
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
reject(response);
return;
}
reject(response);
})
})
}
/**
* 表单项更新
*
* @param {string} mode 界面行为名称
* @param {*} [data={}] 请求数据
* @param {string[]} updateDetails 更新项
* @param {boolean} [showloading] 是否显示加载状态
* @returns {void}
* @memberof Main
*/
public updateFormItems(mode: string, data: any = {}, updateDetails: string[], showloading?: boolean): void {
if (!mode || (mode && Object.is(mode, ''))) {
return;
}
const arg: any = { ...data };
Object.assign(arg,this.viewparams);
const post: Promise<any> = this.service.frontLogic(mode,JSON.parse(JSON.stringify(this.context)),arg, showloading);
post.then((response: any) => {
if (!response || response.status !== 200) {
this.$Notice.error({ title: '错误', desc: '表单项更新失败' });
return;
}
const data = response.data;
const _data: any = {};
updateDetails.forEach((name: string) => {
if (!data.hasOwnProperty(name)) {
return;
}
Object.assign(_data, { [name]: data[name] });
});
this.setFormEnableCond(_data);
this.fillForm(_data,'updateFormItem');
this.formLogic({ name: '', newVal: null, oldVal: null });
this.dataChang.next(JSON.stringify(this.data));
this.$nextTick(() => {
this.formState.next({ type: 'updateformitem', ufimode: arg.srfufimode, data: _data });
});
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
return;
}
});
}
/**
* 回车事件
*
* @param {*} $event
* @memberof Main
*/
public onEnter($event: any): void {
}
/**
* 保存并退出
*
* @param {any[]} args
* @memberof Main
*/
public saveAndExit(data:any[]):Promise<any>{
let _this = this;
return new Promise((resolve: any, reject: any) =>{
let arg: any = {};
if(data && data.length > 0){
Object.assign(arg,data[0]);
}
_this.currentAction = "saveAndExit";
_this.save([arg]).then((res) =>{
if(res){
_this.closeView(res.data);
}
resolve(res);
}).catch((error) =>{
reject(error);
})
})
}
/**
* 保存并新建
*
* @param {any[]} args
* @memberof Main
*/
public saveAndNew(data:any[]):Promise<any>{
let _this = this;
return new Promise((resolve: any, reject: any) =>{
let arg: any = {};
if(data && data.length > 0){
Object.assign(arg,data[0]);
}
_this.currentAction = "saveAndNew";
_this.save([arg]).then((res) =>{
_this.ResetData(res);
_this.loadDraft({});
}).catch((error) =>{
reject(error);
})
})
}
/**
* 删除并退出
*
* @param {any[]} args
* @memberof Main
*/
public removeAndExit(data:any[]):Promise<any>{
let _this = this;
return new Promise((resolve: any, reject: any) =>{
let arg: any = {};
if(data && data.length > 0){
Object.assign(arg,data[0]);
}
_this.remove([arg]).then((res) =>{
if(res){
_this.closeView(res.data);
}
resolve(res);
}).catch((error) =>{
reject(error);
})
})
}
/**
* 关系界面数据保存完成
*
* @param {any} $event
* @memberof Main
*/
public drdatasaved($event:any){
let _this = this;
this.drcounter--;
if(this.drcounter > 0){
return;
}
this.save(this.drsaveopt, undefined, false).then((res) =>{
this.saveState(res);
this.drsaveopt = {};
if(Object.is(_this.currentAction, "saveAndNew")){
_this.ResetData(res);
_this.loadDraft({});
}else if(Object.is(_this.currentAction, "saveAndExit")){
if(res){
_this.closeView(res.data);
}
}
});
}
/**
* 新建默认值
* @memberof Main
*/
public createDefault(){
}
/**
* 更新默认值
* @memberof Main
*/
public updateDefault(){
}
}
</script>
<style lang='less'>
@import './main-form.less';
</style>
\ No newline at end of file
/**
* Main 部件模型
*
* @export
* @class MainModel
*/
export default class MainModel {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof MainModel
*/
public getDataItems(): any[] {
return [
{
name: 'srfwfmemo',
prop: 'srfwfmemo',
dataType: 'TEXT',
},
// 前端新增修改标识,新增为"0",修改为"1"或未设值
{
name: 'srffrontuf',
prop: 'srffrontuf',
dataType: 'TEXT',
},
{
name: 'srforikey',
},
{
name: 'srfkey',
prop: 'id',
dataType: 'TEXT',
},
{
name: 'srfmajortext',
prop: 'label',
dataType: 'TEXT',
},
{
name: 'srftempmode',
},
{
name: 'srfuf',
},
{
name: 'srfdeid',
},
{
name: 'srfsourcekey',
},
{
name: 'pssystemid',
prop: 'systemid',
dataType: 'PICKUP',
},
{
name: 'appid',
prop: 'id',
dataType: 'TEXT',
},
{
name: 'appname',
prop: 'label',
dataType: 'TEXT',
},
{
name: 'apptype',
prop: 'type',
dataType: 'TEXT',
},
{
name: 'fullname',
prop: 'fullname',
dataType: 'TEXT',
},
{
name: 'icon',
prop: 'icon',
dataType: 'TEXT',
},
{
name: 'visabled',
prop: 'visabled',
dataType: 'YESNO',
},
{
name: 'addr',
prop: 'addr',
dataType: 'TEXT',
},
{
name: 'sysapp',
prop: 'id',
dataType: 'FONTKEY',
},
]
}
}
\ No newline at end of file
import { Http,Util,Errorlog } from '@/utils';
import ControlService from '@/widgets/control-service';
import SysAppService from '@/service/sys-app/sys-app-service';
import MainModel from './main-form-model';
/**
* Main 部件服务对象
*
* @export
* @class MainService
*/
export default class MainService extends ControlService {
/**
* 应用服务对象
*
* @type {SysAppService}
* @memberof MainService
*/
public appEntityService: SysAppService = new SysAppService({ $store: this.getStore() });
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof MainService
*/
public setTempMode(){
this.isTempMode = false;
}
/**
* Creates an instance of MainService.
*
* @param {*} [opts={}]
* @memberof MainService
*/
constructor(opts: any = {}) {
super(opts);
this.model = new MainModel();
}
/**
* 处理数据
*
* @private
* @param {Promise<any>} promise
* @returns {Promise<any>}
* @memberof MainService
*/
private doItems(promise: Promise<any>, deKeyField: string, deName: string): Promise<any> {
return new Promise((resolve, reject) => {
promise.then((response: any) => {
if (response && response.status === 200) {
const data = response.data;
data.forEach((item:any,index:number) =>{
item[deName] = item[deKeyField];
data[index] = item;
});
resolve(data);
} else {
reject([])
}
}).catch((response: any) => {
reject([])
});
});
}
/**
* 获取跨实体数据集合
*
* @param {string} serviceName 服务名称
* @param {string} interfaceName 接口名称
* @param {*} data
* @param {boolean} [isloading]
* @returns {Promise<any[]>}
* @memberof MainService
*/
@Errorlog
public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> {
return Promise.reject([])
}
/**
* 启动工作流
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {*} [localdata]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public wfstart(action: string,context: any = {},data: any = {}, isloading?: boolean,localdata?:any): Promise<any> {
data = this.handleWFData(data);
context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](context,data, isloading,localdata);
} else {
result = this.appEntityService.WFStart(context,data, isloading,localdata);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 提交工作流
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {*} [localdata]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public wfsubmit(action: string,context: any = {}, data: any = {}, isloading?: boolean,localdata?:any): Promise<any> {
data = this.handleWFData(data,true);
context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](context,data, isloading,localdata);
} else {
result = this.appEntityService.WFSubmit(context,data, isloading,localdata);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 添加数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public add(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
Object.assign(Data,{id: data.id, srffrontuf: '1'});
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Create(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 删除数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public delete(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Remove(Context,Data, isloading);
}
result.then((response) => {
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 修改数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public update(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Update(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 查询数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public get(action: string,context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Get(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 加载草稿
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public loadDraft(action: string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
//仿真主键数据
const PrimaryKey = Util.createUUID();
Data.id = PrimaryKey;
Data.sysapp = PrimaryKey;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.GetDraft(Context,Data, isloading);
}
result.then((response) => {
response.data.id = PrimaryKey;
this.handleResponse(action, response, true);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 前台逻辑
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public frontLogic(action:string,context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any)=>{
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
return Promise.reject({ status: 500, data: { title: '失败', message: '系统异常' } });
}
result.then((response) => {
this.handleResponse(action, response,true);
resolve(response);
}).catch(response => {
reject(response);
});
})
}
/**
* 处理请求数据
*
* @param action 行为
* @param data 数据
* @memberof MainService
*/
public handleRequestData(action: string,context:any, data: any = {}){
let mode: any = this.getMode();
if (!mode && mode.getDataItems instanceof Function) {
return data;
}
let formItemItems: any[] = mode.getDataItems();
let requestData:any = {};
formItemItems.forEach((item:any) =>{
if(item && item.dataType && Object.is(item.dataType,'FONTKEY')){
if(item && item.prop){
requestData[item.prop] = context[item.name];
}
}else{
if(item && item.prop){
requestData[item.prop] = data[item.name];
}
}
});
if(data && data.viewparams){
Object.assign(requestData,data.viewparams);
}
let tempContext:any = JSON.parse(JSON.stringify(context));
if(tempContext && tempContext.srfsessionid){
tempContext.srfsessionkey = tempContext.srfsessionid;
delete tempContext.srfsessionid;
}
return {context:tempContext,data:requestData};
}
}
\ No newline at end of file
.ivu-tabs-no-animation>.ivu-tabs-content{
padding: 0 16px;
}
.ivu-card-head{
padding: 14px 0;
}
.app-form {
overflow: auto;
> .ivu-row {
> .ivu-tabs {
height: 100%;
display: flex;
flex-direction: column;
> .ivu-tabs-content {
flex-grow: 1;
overflow: auto;
> .ivu-tabs-tabpane {
height: 100%;
}
}
}
}
}
.app-tabpanel-flex {
height: 100%;
> .ivu-tabs-content {
height: calc(100% - 52px);
> .ivu-tabs-tabpane {
height: 100%;
}
}
}
.app-form {
>.ivu-row:nth-child(2) {
>.ivu-col:nth-child(1) {
>.ivu-row.app-form-group.app-group-hiddden-caption:nth-child(1) {
margin-top: 12px;
}
}
}
}
// 表单行间距
.app-form{
.app-form-item{
margin-bottom: 20px;
}
}
// this is less
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import MainBase from './main-form-base.vue';
@Component({
components: {
}
})
export default class Main extends MainBase {
}
</script>
\ No newline at end of file
<template>
<div class='grid' style="height:100%;">
<i-form style="height:100%">
<el-table v-if="isDisplay === true"
:default-sort="{ prop: minorSortPSDEF, order: Object.is(minorSortDir, 'ASC') ? 'ascending' : Object.is(minorSortDir, 'DESC') ? 'descending' : '' }"
@sort-change="onSortChange($event)"
:border="isDragendCol"
:height="isEnablePagingBar && items.length > 0 ? 'calc(100% - 50px)' : '100%'"
:highlight-current-row ="isSingleSelect"
:row-class-name="getRowClassName"
@row-click="rowClick($event)"
@select-all="selectAll($event)"
@select="select($event)"
@row-class-name="onRowClassName($event)"
@row-dblclick="rowDBLClick($event)"
ref='multipleTable' :data="items" :show-header="!isHideHeader">
<template slot="empty">
无数据
</template>
<template v-if="!isSingleSelect">
<el-table-column align="center" type='selection' :width="checkboxColWidth"></el-table-column>
</template>
<template v-if="getColumnState('pssystemid')">
<el-table-column show-overflow-tooltip :prop="'pssystemid'" :label="$t('entities.sysapp.main_grid.columns.pssystemid')" :width="100" :align="'left'">
<template v-slot:header="{column}">
<span class="column-header ">
{{$t('entities.sysapp.main_grid.columns.pssystemid')}}
</span>
</template>
<template v-slot="{row,column,$index}">
<span>{{row.pssystemid}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('appid')">
<el-table-column show-overflow-tooltip :prop="'appid'" :label="$t('entities.sysapp.main_grid.columns.appid')" :width="200" :align="'left'">
<template v-slot:header="{column}">
<span class="column-header ">
{{$t('entities.sysapp.main_grid.columns.appid')}}
</span>
</template>
<template v-slot="{row,column,$index}">
<span>{{row.appid}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('appname')">
<el-table-column show-overflow-tooltip :prop="'appname'" :label="$t('entities.sysapp.main_grid.columns.appname')" :width="200" :align="'left'">
<template v-slot:header="{column}">
<span class="column-header ">
{{$t('entities.sysapp.main_grid.columns.appname')}}
</span>
</template>
<template v-slot="{row,column,$index}">
<span>{{row.appname}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('apptype')">
<el-table-column show-overflow-tooltip :prop="'apptype'" :label="$t('entities.sysapp.main_grid.columns.apptype')" :width="150" :align="'left'">
<template v-slot:header="{column}">
<span class="column-header ">
{{$t('entities.sysapp.main_grid.columns.apptype')}}
</span>
</template>
<template v-slot="{row,column,$index}">
<template v-if="actualIsOpenEdit">
<app-form-item :error="gridItemsModel[$index][column.property].error">
<input-box
:disabled="row.srfuf === 1 ? (3 & 2) !== 2 : (3 & 1) !== 1"
v-model="row[column.property]"
style=""
type="text"
@change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}">
</input-box>
</app-form-item>
</template>
<template v-if="!actualIsOpenEdit">
<app-span name='apptype' editorType="TEXTBOX" :value="row.apptype"></app-span>
</template>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('fullname')">
<el-table-column show-overflow-tooltip :prop="'fullname'" :label="$t('entities.sysapp.main_grid.columns.fullname')" :width="250" :align="'left'">
<template v-slot:header="{column}">
<span class="column-header ">
{{$t('entities.sysapp.main_grid.columns.fullname')}}
</span>
</template>
<template v-slot="{row,column,$index}">
<template v-if="actualIsOpenEdit">
<app-form-item :error="gridItemsModel[$index][column.property].error">
<input-box
:disabled="row.srfuf === 1 ? (3 & 2) !== 2 : (3 & 1) !== 1"
v-model="row[column.property]"
style=""
type="text"
@change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}">
</input-box>
</app-form-item>
</template>
<template v-if="!actualIsOpenEdit">
<app-span name='fullname' editorType="TEXTBOX" :value="row.fullname"></app-span>
</template>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('icon')">
<el-table-column show-overflow-tooltip :prop="'icon'" :label="$t('entities.sysapp.main_grid.columns.icon')" :width="150" :align="'left'">
<template v-slot:header="{column}">
<span class="column-header ">
{{$t('entities.sysapp.main_grid.columns.icon')}}
</span>
</template>
<template v-slot="{row,column,$index}">
<template v-if="actualIsOpenEdit">
<app-form-item :error="gridItemsModel[$index][column.property].error">
<input-box
:disabled="row.srfuf === 1 ? (3 & 2) !== 2 : (3 & 1) !== 1"
v-model="row[column.property]"
style=""
type="text"
@change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}">
</input-box>
</app-form-item>
</template>
<template v-if="!actualIsOpenEdit">
<app-span name='icon' editorType="TEXTBOX" :value="row.icon"></app-span>
</template>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('addr')">
<el-table-column show-overflow-tooltip :prop="'addr'" :label="$t('entities.sysapp.main_grid.columns.addr')" :width="300" :align="'left'">
<template v-slot:header="{column}">
<span class="column-header ">
{{$t('entities.sysapp.main_grid.columns.addr')}}
</span>
</template>
<template v-slot="{row,column,$index}">
<template v-if="actualIsOpenEdit">
<app-form-item :error="gridItemsModel[$index][column.property].error">
<input-box
:disabled="row.srfuf === 1 ? (3 & 2) !== 2 : (3 & 1) !== 1"
v-model="row[column.property]"
style=""
type="text"
@change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}">
</input-box>
</app-form-item>
</template>
<template v-if="!actualIsOpenEdit">
<app-span name='addr' editorType="TEXTBOX" :value="row.addr"></app-span>
</template>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('visabled')">
<el-table-column show-overflow-tooltip :prop="'visabled'" :label="$t('entities.sysapp.main_grid.columns.visabled')" :width="100" :align="'left'">
<template v-slot:header="{column}">
<span class="column-header ">
{{$t('entities.sysapp.main_grid.columns.visabled')}}
</span>
</template>
<template v-slot="{row,column,$index}">
<template v-if="actualIsOpenEdit">
<app-form-item :error="gridItemsModel[$index][column.property].error">
<app-switch name='visabled' :value="row[column.property]" @change="($event)=>{row[column.property] = $event;gridEditItemChange(row, column.property, $event, $index)} " :disabled="row.srfuf === 1 ? (3 & 2) !== 2 : (3 & 1) !== 1" style=""></app-switch>
</app-form-item>
</template>
<template v-if="!actualIsOpenEdit">
<codelist :value="row.visabled" tag='YesNo' codelistType='STATIC' ></codelist>
</template>
</template>
</el-table-column>
</template>
<template v-if="adaptiveState">
<el-table-column></el-table-column>
</template>
</el-table>
</i-form>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch, Model } from 'vue-property-decorator';
import { CreateElement } from 'vue';
import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils';
import SysAppService from '@/service/sys-app/sys-app-service';
import MainService from './main-grid-service';
import CodeListService from "@service/app/codelist-service";
import { FormItemModel } from '@/model/form-detail';
@Component({
components: {
}
})
export default class MainBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof Main
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof Main
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof Main
*/
@Prop() public context: any;
/**
* 视图参数
*
* @type {*}
* @memberof Main
*/
@Prop() public viewparams: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof Main
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof Main
*/
public getControlType(): string {
return 'GRID'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof Main
*/
public counterServiceArray:Array<any> = [];
/**
* 建构部件服务对象
*
* @type {MainService}
* @memberof Main
*/
public service: MainService = new MainService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {SysAppService}
* @memberof Main
*/
public appEntityService: SysAppService = new SysAppService({ $store: this.$store });
/**
* 关闭视图
*
* @param {any} args
* @memberof Main
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof Main
*/
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();
}
})
}
}
/**
* 代码表服务对象
*
* @type {CodeListService}
* @memberof Main
*/
public codeListService:CodeListService = new CodeListService({ $store: this.$store });
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof Main
*/
public getDatas(): any[] {
return this.selections;
}
/**
* 获取单项树
*
* @returns {*}
* @memberof Main
*/
public getData(): any {
return this.selections[0];
}
/**
* 打开新建数据视图
*
* @type {any}
* @memberof Main
*/
@Prop() public newdata: any;
/**
* 打开编辑数据视图
*
* @type {any}
* @memberof Main
*/
@Prop() public opendata: any;
/**
* 显示处理提示
*
* @type {boolean}
* @memberof Main
*/
@Prop({ default: true }) public showBusyIndicator?: boolean;
/**
* 部件行为--update
*
* @type {string}
* @memberof Main
*/
@Prop() public updateAction!: string;
/**
* 部件行为--fetch
*
* @type {string}
* @memberof Main
*/
@Prop() public fetchAction!: string;
/**
* 部件行为--remove
*
* @type {string}
* @memberof Main
*/
@Prop() public removeAction!: string;
/**
* 部件行为--load
*
* @type {string}
* @memberof Main
*/
@Prop() public loadAction!: string;
/**
* 部件行为--loaddraft
*
* @type {string}
* @memberof Main
*/
@Prop() public loaddraftAction!: string;
/**
* 部件行为--create
*
* @type {string}
* @memberof Main
*/
@Prop() public createAction!: string;
/**
* 当前页
*
* @type {number}
* @memberof Main
*/
public curPage: number = 1;
/**
* 数据
*
* @type {any[]}
* @memberof Main
*/
public items: any[] = [];
/**
* 是否支持分页
*
* @type {boolean}
* @memberof Main
*/
public isEnablePagingBar: boolean = false;
/**
* 是否禁用排序
*
* @type {boolean}
* @memberof Main
*/
public isNoSort: boolean = false;
/**
* 排序方向
*
* @type {string}
* @memberof Main
*/
public minorSortDir: string = '';
/**
* 排序字段
*
* @type {string}
* @memberof Main
*/
public minorSortPSDEF: string = '';
/**
* 分页条数
*
* @type {number}
* @memberof Main
*/
public limit: number = 1000;
/**
* 是否显示标题
*
* @type {boolean}
* @memberof Main
*/
public isHideHeader: boolean = false;
/**
* 是否默认选中第一条数据
*
* @type {boolean}
* @memberof Main
*/
@Prop({ default: false }) public isSelectFirstDefault!: boolean;
/**
* 是否单选
*
* @type {boolean}
* @memberof Main
*/
@Prop() public isSingleSelect?: boolean;
/**
* 选中数据字符串
*
* @type {string}
* @memberof Main
*/
@Prop() public selectedData?: string;
/**
* 选中值变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof MainTree
*/
@Watch('selectedData')
public onValueChange(newVal: any, oldVal: any) {
this.selections = [];
if(this.selectedData){
const refs: any = this.$refs;
if (refs.multipleTable) {
refs.multipleTable.clearSelection();
JSON.parse(this.selectedData).forEach((selection:any)=>{
let selectedItem = this.items.find((item:any)=>{
return Object.is(item.srfkey, selection.srfkey);
});
if(selectedItem){
this.rowClick(selectedItem);
}
});
}
}
}
/**
* 表格行数据默认激活模式
* 0 不激活
* 1 单击激活
* 2 双击激活
*
* @type {(number | 0 | 1 | 2)}
* @memberof Main
*/
@Prop({default: 2}) public gridRowActiveMode!: number;
/**
* 是否开启行编辑
*
* @type {boolean}
* @memberof Main
*/
@Prop({default: false}) public isOpenEdit!: boolean;
/**
* 实际是否开启行编辑
*
* @type {boolean}
* @memberof Main
*/
public actualIsOpenEdit: boolean = this.isOpenEdit;
/**
* 总条数
*
* @type {number}
* @memberof Main
*/
public totalrow: number = 0;
/**
* 选中行数据
*
* @type {any[]}
* @memberof Main
*/
public selections: any[] = [];
/**
* 拦截行选中
*
* @type {boolean}
* @memberof Main
*/
public stopRowClick: boolean = false;
/**
* 表格是否显示
*
* @type {boolean}
* @memberof Main
*/
public isDisplay:boolean = true;
/**
* 部件刷新
*
* @param {any[]} args
* @memberof Main
*/
public refresh(args: any[]): void {
this.load();
}
/**
* 选项框列宽
*
* @type {number}
* @memberof AppIndex
*/
public checkboxColWidth: number = 50;
/**
* 是否允许拖动列宽
*
* @type {boolean}
* @memberof AppEmbedPicker
*/
public isDragendCol: boolean = false;
/**
* 所有列成员
*
* @type {any[]}
* @memberof Main
*/
public allColumns: any[] = [
{
name: 'pssystemid',
label: '系统标识',
langtag: 'entities.sysapp.main_grid.columns.pssystemid',
show: true,
util: 'PX'
},
{
name: 'appid',
label: '应用标识',
langtag: 'entities.sysapp.main_grid.columns.appid',
show: true,
util: 'PX'
},
{
name: 'appname',
label: '应用名',
langtag: 'entities.sysapp.main_grid.columns.appname',
show: true,
util: 'PX'
},
{
name: 'apptype',
label: '类型',
langtag: 'entities.sysapp.main_grid.columns.apptype',
show: true,
util: 'PX'
},
{
name: 'fullname',
label: '全称',
langtag: 'entities.sysapp.main_grid.columns.fullname',
show: true,
util: 'PX'
},
{
name: 'icon',
label: '图标',
langtag: 'entities.sysapp.main_grid.columns.icon',
show: true,
util: 'PX'
},
{
name: 'addr',
label: '地址',
langtag: 'entities.sysapp.main_grid.columns.addr',
show: true,
util: 'PX'
},
{
name: 'visabled',
label: '可见',
langtag: 'entities.sysapp.main_grid.columns.visabled',
show: true,
util: 'PX'
},
]
/**
* 表格模型集合
*
* @type {*}
* @memberof Main
*/
public gridItemsModel: any[] = [];
/**
* 获取表格行模型
*
* @type {*}
* @memberof Main
*/
public getGridRowModel(){
return {
icon: new FormItemModel(),
visabled: new FormItemModel(),
addr: new FormItemModel(),
apptype: new FormItemModel(),
srfkey: new FormItemModel(),
fullname: new FormItemModel(),
}
}
/**
* 属性值规则
*
* @type {*}
* @memberof Main
*/
public rules: any = {
icon: [
{ required: false, validator: (rule:any, value:any, callback:any) => { return (rule.required && (value === null || value === undefined || value === "")) ? false : true;}, message: '图标 值不能为空', trigger: 'change' },
{ required: false, validator: (rule:any, value:any, callback:any) => { return (rule.required && (value === null || value === undefined || value === "")) ? false : true;}, message: '图标 值不能为空', trigger: 'blur' },
],
visabled: [
{ required: false, validator: (rule:any, value:any, callback:any) => { return (rule.required && (value === null || value === undefined || value === "")) ? false : true;}, message: '可见 值不能为空', trigger: 'change' },
{ required: false, validator: (rule:any, value:any, callback:any) => { return (rule.required && (value === null || value === undefined || value === "")) ? false : true;}, message: '可见 值不能为空', trigger: 'blur' },
],
addr: [
{ required: false, validator: (rule:any, value:any, callback:any) => { return (rule.required && (value === null || value === undefined || value === "")) ? false : true;}, message: '地址 值不能为空', trigger: 'change' },
{ required: false, validator: (rule:any, value:any, callback:any) => { return (rule.required && (value === null || value === undefined || value === "")) ? false : true;}, message: '地址 值不能为空', trigger: 'blur' },
],
apptype: [
{ required: false, validator: (rule:any, value:any, callback:any) => { return (rule.required && (value === null || value === undefined || value === "")) ? false : true;}, message: '类型 值不能为空', trigger: 'change' },
{ required: false, validator: (rule:any, value:any, callback:any) => { return (rule.required && (value === null || value === undefined || value === "")) ? false : true;}, message: '类型 值不能为空', trigger: 'blur' },
],
srfkey: [
{ required: false, validator: (rule:any, value:any, callback:any) => { return (rule.required && (value === null || value === undefined || value === "")) ? false : true;}, message: '应用标识 值不能为空', trigger: 'change' },
{ required: false, validator: (rule:any, value:any, callback:any) => { return (rule.required && (value === null || value === undefined || value === "")) ? false : true;}, message: '应用标识 值不能为空', trigger: 'blur' },
],
fullname: [
{ required: false, validator: (rule:any, value:any, callback:any) => { return (rule.required && (value === null || value === undefined || value === "")) ? false : true;}, message: '全称 值不能为空', trigger: 'change' },
{ required: false, validator: (rule:any, value:any, callback:any) => { return (rule.required && (value === null || value === undefined || value === "")) ? false : true;}, message: '全称 值不能为空', trigger: 'blur' },
],
}
/**
* 表格行编辑项校验
*
* @param {string} property 属性名
* @param {*} data 行数据
* @param {number} rowIndex 行索引
* @returns Promise<any>
*
* @memberof Main
*/
public validate(property:string, data:any, rowIndex:number):Promise<any>{
return new Promise((resolve, reject) => {
this.$util.validateItem(property,data,this.rules).then(()=>{
this.gridItemsModel[rowIndex][property].setError(null);
resolve(true);
}).catch(({ errors, fields }) => {
this.gridItemsModel[rowIndex][property].setError(errors[0].message);
resolve(false);
});
});
}
/**
* 校验所有修改过的编辑项
*
* @returns Promise<any>
* @memberof Main
*/
public async validateAll(){
let validateState = true;
let index = -1;
for(let item of this.items){
index++;
if(item.rowDataState === "create" || item.rowDataState === "update"){
for(let property of Object.keys(this.rules)){
if(!await this.validate(property,item,index)){
validateState = false;
}
}
}
}
return validateState;
}
/**
* 表格数据加载
*
* @param {*} [arg={}]
* @memberof Main
*/
public load(opt: any = {}, pageReset: boolean = false): void {
if(!this.fetchAction){
this.$Notice.error({ title: '错误', desc: 'SysAppGridView视图表格fetchAction参数未配置' });
return;
}
if(pageReset){
this.curPage = 1;
}
const arg: any = {...opt};
const page: any = {};
if (this.isEnablePagingBar) {
Object.assign(page, { page: this.curPage-1, size: this.limit });
}
// 设置排序
if (!this.isNoSort && !Object.is(this.minorSortDir, '') && !Object.is(this.minorSortPSDEF, '')) {
const sort: string = this.minorSortPSDEF+","+this.minorSortDir;
Object.assign(page, { sort: sort });
}
Object.assign(arg, page);
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{};
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
Object.assign(arg,{viewparams:tempViewParams});
const post: Promise<any> = this.service.search(this.fetchAction,JSON.parse(JSON.stringify(this.context)), arg, this.showBusyIndicator);
post.then((response: any) => {
if (!response.status || response.status !== 200) {
if (response.errorMessage) {
this.$Notice.error({ title: '错误', desc: response.errorMessage });
}
return;
}
const data: any = response.data;
this.totalrow = response.total;
this.items = JSON.parse(JSON.stringify(data));
// 清空selections,gridItemsModel
this.selections = [];
this.gridItemsModel = [];
this.items.forEach(()=>{this.gridItemsModel.push(this.getGridRowModel())});
this.$emit('load', this.items);
// 设置默认选中
let _this = this;
setTimeout(() => {
if(_this.isSelectFirstDefault){
_this.rowClick(_this.items[0]);
}
if(_this.selectedData){
const refs: any = _this.$refs;
if (refs.multipleTable) {
refs.multipleTable.clearSelection();
JSON.parse(_this.selectedData).forEach((selection:any)=>{
let selectedItem = _this.items.find((item:any)=>{
return Object.is(item.srfkey, selection.srfkey);
});
if(selectedItem){
_this.rowClick(selectedItem);
}
});
}
}
}, 300);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: '错误', desc: response.errorMessage });
});
}
/**
* 删除
*
* @param {any[]} datas
* @returns {Promise<any>}
* @memberof Main
*/
public async remove(datas: any[]): Promise<any> {
if(!this.removeAction){
this.$Notice.error({ title: '错误', desc: 'SysAppGridView视图表格removeAction参数未配置' });
return;
}
let _datas:any[] = [];
datas.forEach((record: any, index: number) => {
if (!record.srfkey) {
this.items.some((val: any, num: number) =>{
if(JSON.stringify(val) == JSON.stringify(record)){
this.items.splice(num,1);
this.gridItemsModel.splice(num,1);
return true;
}
});
}else{
_datas.push(datas[index]);
}
});
if (_datas.length === 0) {
return;
}
let dataInfo = '';
_datas.forEach((record: any, index: number) => {
let srfmajortext = record.label;
if (index < 5) {
if (!Object.is(dataInfo, '')) {
dataInfo += '、';
}
dataInfo += srfmajortext;
} else {
return false;
}
});
if (_datas.length < 5) {
dataInfo = dataInfo + ' 共' + _datas.length + '条数据';
} else {
dataInfo = dataInfo + '...' + ' 共' + _datas.length + '条数据';
}
const removeData = () => {
let keys: any[] = [];
_datas.forEach((data: any) => {
keys.push(data.srfkey);
});
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
let _keys = keys.length > 1 ? keys : keys[0] ;
const context:any = JSON.parse(JSON.stringify(this.context));
const post: Promise<any> = this.service.delete(_removeAction,Object.assign(context,{ sysapp: _keys }),Object.assign({ sysapp: _keys },{viewparams:this.viewparams}), this.showBusyIndicator);
return new Promise((resolve: any, reject: any) => {
post.then((response: any) => {
if (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: '删除数据失败,' + response.info });
return;
} else {
this.$Notice.success({ title: '', desc: '删除成功!' });
}
//删除items中已删除的项
console.log(this.items);
_datas.forEach((data: any) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
this.gridItemsModel.splice(index,1);
return true;
}
});
});
this.totalrow -= _datas.length;
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
reject(response);
return;
}
reject(response);
});
});
}
dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '');
this.$Modal.confirm({
title: '警告',
content: '确认要删除 ' + dataInfo + ',删除操作将不可恢复?',
onOk: () => {
removeData();
},
onCancel: () => { }
});
return removeData;
}
/**
* 批量添加
*
* @param {*} [arg={}]
* @memberof Main
*/
public addBatch(arg: any = {}): void {
if(!this.fetchAction){
this.$Notice.error({ title: '错误', desc: 'SysAppGridView视图表格fetchAction参数未配置' });
return;
}
if(!arg){
arg = {};
}
console.error("批量添加未实现");
}
/**
* 数据导入
*
* @param {*} data
* @memberof Main
*/
public importExcel(data:any ={}):void{
//导入excel
const importDataModel:any ={
}
if(Object.keys(importDataModel).length == 0){
this.$Notice.warning({ 'title': (this.$t("app.utilview.warning") as string), 'desc': (this.$t("app.utilview.info") as string) });
return;
}
const view:any ={
viewname: 'app-data-upload',
title: this.$t("app.utilview.importview"),
width: 900,
height: 700
}
let container: Subject<any> = this.$appmodal.openModal(view, JSON.parse(JSON.stringify(this.context)), importDataModel);
container.subscribe((result: any) => {
if(Object.is(result.ret,'OK')){
this.refresh(result.datas);
}
});
}
/**
* 数据导出
*
* @param {*} data
* @memberof Main
*/
public exportExcel(data: any = {}): void {
// 导出Excel
const doExport = async (_data:any) => {
const tHeader: Array<any> = [];
const filterVal: Array<any> = [];
this.allColumns.forEach((item: any) => {
item.show && item.label ? tHeader.push(this.$t(item.langtag)) : "";
item.show && item.name ? filterVal.push(item.name) : "";
});
const data = await this.formatExcelData(filterVal, _data);
this.$export.exportExcel().then((excel:any)=>{
excel.export_json_to_excel({
header: tHeader, //表头 必填
data, //具体数据 必填
filename: "应用表", //非必填
autoWidth: true, //非必填
bookType: "xlsx" //非必填
});
});
};
const page: any = {};
// 设置page,size
if (Object.is(data.type, 'maxRowCount')) {
Object.assign(page, { page: 0, size: data.maxRowCount });
} else if (Object.is(data.type, 'activatedPage')) {
try {
doExport(JSON.parse(JSON.stringify(this.items)));
} catch (error) {
console.error(error);
}
return;
}
// 设置排序
if (!this.isNoSort && !Object.is(this.minorSortDir, '') && !Object.is(this.minorSortPSDEF, '')) {
const sort: string = this.minorSortPSDEF+","+this.minorSortDir;
Object.assign(page, { sort: sort });
}
const arg: any = {};
Object.assign(arg, page);
// 获取query,搜索表单,viewparams等父数据
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata);
const post: Promise<any> = this.service.search(this.fetchAction,JSON.parse(JSON.stringify(this.context)), arg, this.showBusyIndicator);
post.then((response: any) => {
if (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: '数据导出失败,' + response.info });
return;
}
try {
doExport(JSON.parse(JSON.stringify(response.data)));
} catch (error) {
console.error(error);
}
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: '', desc: '数据导出失败' });
});
}
/**
* 导出数据格式化
*
* @param {*} filterVal
* @param {*} jsonData
* @returns {[]}
* @memberof Main
*/
public async formatExcelData(filterVal:any, jsonData:any) {
let codelistColumns:Array<any> = [
{
name: 'visabled',
srfkey: 'YesNo',
codelistType : 'STATIC',
renderMode: 'other',
textSeparator: '、',
valueSeparator: ',',
},
];
let _this = this;
for (const codelist of codelistColumns) {
// 动态代码表处理
if (Object.is(codelist.codelistType, "DYNAMIC")) {
let items = await _this.codeListService.getItems(codelist.srfkey);
jsonData.forEach((row:any)=>{
row[codelist.name] = _this.getCodelistValue(items, row[codelist.name], codelist);
});
// 静态处理
} else if(Object.is(codelist.codelistType, "STATIC")){
let items = await _this.$store.getters.getCodeListItems(codelist.srfkey);
jsonData.forEach((row:any)=>{
row[codelist.name] = _this.getCodelistValue(items, row[codelist.name], codelist);
});
}
}
return jsonData.map((v:any) => filterVal.map((j:any) => v[j]))
}
/**
* 解析代码表和vlaue,设置items
*
* @public
* @param {any[]} items 代码表数据
* @param {*} value
* @returns {*}
* @memberof Main
*/
public getCodelistValue(items: any[], value: any, codelist: any,){
if(!value){
return this.$t('codelist.'+codelist.srfkey+'.empty');
}
if (items) {
let result:any = [];
if(Object.is(codelist.renderMode,"number")){
items.map((_item: any, index: number)=>{
const nValue = parseInt((value as any), 10);
const codevalue = _item.value;
if((parseInt(codevalue, 10) & nValue) > 0){
result.push(_item);
}
});
} else if(Object.is(codelist.renderMode,"string")){
const arrayValue: Array<any> = (value as any).split(codelist.valueSeparator);
arrayValue.map((value: any, index: number) => {
result.push([]);
let values: any[] = Object.is(this.$util.typeOf(value), 'number') ? [value] : [...(value as any).split(codelist.valueSeparator)];
values.map((val:any ,num: number)=>{
const item = this.getItem(items, val, codelist);
if(item){
result[index].push(item);
}
});
});
} else {
let values: any[] = Object.is(this.$util.typeOf(value), 'number') ? [value] : [...(value as any).split(codelist.valueSeparator)];
values.map((value:any ,index: number)=>{
const item = this.getItem(items, value, codelist);
if(item){
result.push(item);
}
});
}
// 设置items
if(result.length != 0){
return result.join(codelist.valueSeparator);
}else{
return value;
}
}
}
/**
* 获取代码项
*
* @public
* @param {any[]} items
* @param {*} value
* @returns {*}
* @memberof Main
*/
public getItem(items: any[], value: any, codelist: any): any {
const arr: Array<any> = items.filter(item => {return item.value == value});
if (arr.length !== 1) {
return undefined;
}
if(Object.is(codelist.codelistType,'STATIC')){
return this.$t('codelist.'+codelist.srfkey+'.'+arr[0].value);
}else{
return arr[0].text;
}
}
/**
* 生命周期
*
* @memberof Main
*/
public created(): void {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof Main
*/
public afterCreated(){
this.setColState();
if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if (!Object.is(tag, this.name)) {
return;
}
if (Object.is('load', action)) {
this.load(data);
}
if (Object.is('remove', action)) {
this.remove(data);
}
if (Object.is('save', action)) {
this.save(data);
}
});
}
}
/**
* vue 生命周期
*
* @memberof Main
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof Main
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
}
/**
* 获取选中行胡数据
*
* @returns {any[]}
* @memberof Main
*/
public getSelection(): any[] {
return this.selections;
}
/**
* 行双击事件
*
* @param {*} $event
* @returns {void}
* @memberof Main
*/
public rowDBLClick($event: any): void {
if (!$event || this.actualIsOpenEdit || Object.is(this.gridRowActiveMode,0)) {
return;
}
this.selections = [];
this.selections.push(JSON.parse(JSON.stringify($event)));
const refs: any = this.$refs;
if (refs.multipleTable) {
refs.multipleTable.clearSelection();
refs.multipleTable.toggleRowSelection($event);
}
this.$emit('rowdblclick', this.selections);
this.$emit('selectionchange', this.selections);
}
/**
* 复选框数据选中
*
* @param {*} $event
* @returns {void}
* @memberof Main
*/
public select($event: any): void {
if (!$event) {
return;
}
this.selections = [];
this.selections = [...JSON.parse(JSON.stringify($event))];
this.$emit('selectionchange', this.selections);
}
/**
* 复选框数据全部选中
*
* @param {*} $event
* @memberof Main
*/
public selectAll($event: any): void {
if (!$event) {
return;
}
this.selections = [];
this.selections = [...JSON.parse(JSON.stringify($event))];
this.$emit('selectionchange', this.selections);
}
/**
* 行单击选中
*
* @param {*} $event
* @returns {void}
* @memberof Main
*/
public rowClick($event: any, ifAlways: boolean = false): void {
if (!ifAlways && (!$event || this.actualIsOpenEdit)) {
return;
}
if(this.stopRowClick) {
this.stopRowClick = false;
return;
}
if(this.isSingleSelect){
this.selections = [];
}
// 已选中则删除,没选中则添加
let selectIndex = this.selections.findIndex((item:any)=>{
return Object.is(item.sys_app,$event.sys_app);
});
if (Object.is(selectIndex,-1)){
this.selections.push(JSON.parse(JSON.stringify($event)));
} else {
this.selections.splice(selectIndex,1);
}
const refs: any = this.$refs;
if (refs.multipleTable) {
if(this.isSingleSelect){
refs.multipleTable.clearSelection();
refs.multipleTable.setCurrentRow($event);
}else{
refs.multipleTable.toggleRowSelection($event);
}
}
this.$emit('selectionchange', this.selections);
}
/**
* 页面变化
*
* @param {*} $event
* @returns {void}
* @memberof Main
*/
public pageOnChange($event: any): void {
if (!$event) {
return;
}
if ($event === this.curPage) {
return;
}
this.curPage = $event;
this.load({});
}
/**
* 分页条数变化
*
* @param {*} $event
* @returns {void}
* @memberof Main
*/
public onPageSizeChange($event: any): void {
if (!$event) {
return;
}
if ($event === this.limit) {
return;
}
this.limit = $event;
if (this.curPage === 1) {
this.load({});
}
}
/**
* 分页刷新
*
* @memberof Main
*/
public pageRefresh(): void {
this.load({});
}
/**
* 排序变化
*
* @param {{ column: any, prop: any, order: any }} { column, prop, order }
* @memberof Main
*/
public onSortChange({ column, prop, order }: { column: any, prop: any, order: any }): void {
const dir = Object.is(order, 'ascending') ? 'asc' : Object.is(order, 'descending') ? 'desc' : '';
if (Object.is(dir, this.minorSortDir) && Object.is(this.minorSortPSDEF, prop)) {
return;
}
this.minorSortDir = dir;
this.minorSortPSDEF = prop ? prop : '';
this.load({});
}
/**
* 表格行选中样式
*
* @param {{ row: any, rowIndex: any }} { row, rowIndex }
* @returns {string}
* @memberof Main
*/
public onRowClassName({ row, rowIndex }: { row: any, rowIndex: any }): string {
const index = this.selections.findIndex((select: any) => Object.is(select.srfkey, row.srfkey));
return index !== -1 ? 'grid-row-select' : '';
}
/**
* 界面行为
*
* @param {*} row
* @param {*} tag
* @param {*} $event
* @memberof Main
*/
public uiAction(row: any, tag: any, $event: any) {
// this.rowClick(row, true);
}
/**
* 设置列状态
*
* @memberof Main
*/
public setColState() {
const _data: any = localStorage.getItem('sys_app_main_grid');
if (_data) {
let columns = JSON.parse(_data);
columns.forEach((col: any) => {
let column = this.allColumns.find((item) => Object.is(col.name, item.name));
if (column) {
Object.assign(column, col);
}
});
}
}
/**
* 列变化
*
* @memberof Main
*/
public onColChange() {
localStorage.setItem('sys_app_main_grid', JSON.stringify(this.allColumns));
}
/**
* 获取列状态
*
* @param {string} name
* @returns {boolean}
* @memberof Main
*/
public getColumnState(name: string): boolean {
let column = this.allColumns.find((col: any) =>
Object.is(name, col.name)
);
return column.show ? true : false;
}
/**
* 表格列是否自适应布局
*
* @readonly
* @type {boolean}
* @memberof Main
*/
get adaptiveState(): boolean {
return !this.allColumns.find((column: any) => column.show && Object.is(column.util, 'STAR'));
}
/**
* 保存
*
* @param {*} $event
* @returns {Promise<any>}
* @memberof Main
*/
public async save(args: any[], params?: any, $event?: any, xData?: any){
let _this = this;
if(!await this.validateAll()){
this.$Notice.error({ title: '错误', desc: '值规则校验异常' });
return [];
}
let successItems:any = [];
let errorItems:any = [];
let errorMessage:any = [];
for (const item of _this.items) {
try {
if(Object.is(item.rowDataState, 'create')){
if(!this.createAction){
this.$Notice.error({ title: '错误', desc: 'SysAppGridView视图表格createAction参数未配置' });
}else{
Object.assign(item,{viewparams:this.viewparams});
let response = await this.service.add(this.createAction, JSON.parse(JSON.stringify(this.context)),item, this.showBusyIndicator);
successItems.push(JSON.parse(JSON.stringify(response.data)));
}
}else if(Object.is(item.rowDataState, 'update')){
if(!this.updateAction){
this.$Notice.error({ title: '错误', desc: 'SysAppGridView视图表格updateAction参数未配置' });
}else{
Object.assign(item,{viewparams:this.viewparams});
if(item.sysapp){
Object.assign(this.context,{sysapp:item.sysapp});
}
let response = await this.service.add(this.updateAction,JSON.parse(JSON.stringify(this.context)),item, this.showBusyIndicator);
successItems.push(JSON.parse(JSON.stringify(response.data)));
}
}
} catch (error) {
errorItems.push(JSON.parse(JSON.stringify(item)));
errorMessage.push(error);
}
}
this.$emit('save', successItems);
this.refresh([]);
if(errorItems.length === 0){
this.$Notice.success({ title: '', desc: '保存成功!' });
}else{
errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: '保存失败', desc: item.majorentityname+'保存失败!' });
console.error(errorMessage[index]);
});
}
return successItems;
}
/**
* 新建行
*
* @param {*} $event
* @returns {void}
* @memberof Main
*/
public newRow(args: any[], params?: any, $event?: any, xData?: any): void {
if(!this.loaddraftAction){
this.$Notice.error({ title: '错误', desc: 'SysAppGridView视图表格loaddraftAction参数未配置' });
return;
}
let _this = this;
Object.assign(args[0],{viewparams:this.viewparams});
let post: Promise<any> = this.service.loadDraft(this.loaddraftAction, JSON.parse(JSON.stringify(this.context)), args[0], this.showBusyIndicator);
post.then((response: any) => {
if (!response.status || response.status !== 200) {
if (response.errorMessage) {
this.$Notice.error({ title: '错误', desc: response.errorMessage });
}
return;
}
const data = response.data;
data.rowDataState = "create";
_this.items.push(data);
_this.gridItemsModel.push(_this.getGridRowModel());
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
return;
}
});
}
/**
* 表格编辑项值变更
*
* @param row 行数据
* @param {{ name: string, value: any }} $event
* @returns {void}
* @memberof Main
*/
public onGridItemValueChange(row: any,$event: { name: string, value: any },rowIndex: number): void {
if (!$event) {
return;
}
if (!$event.name || Object.is($event.name, '') || !row.hasOwnProperty($event.name)) {
return;
}
row[$event.name] = $event.value;
this.gridEditItemChange(row, $event.name, $event.value, rowIndex);
}
/**
* 表格编辑项值变化
*
* @public
* @param row 行数据
* @param property 列编辑项名
* @param row 列编辑项值
* @returns {void}
* @memberof Main
*/
public gridEditItemChange(row: any, property: string, value: any, rowIndex: number){
row.rowDataState = row.rowDataState ? row.rowDataState : "update" ;
this.validate(property,row,rowIndex);
}
/**
* 表格编辑项更新
*
* @param {string} mode 界面行为名称
* @param {*} [data={}] 请求数据
* @param {string[]} updateDetails 更新项
* @param {boolean} [showloading] 是否显示加载状态
* @returns {void}
* @memberof Main
*/
public updateGridEditItem(mode: string, data: any = {}, updateDetails: string[], showloading?: boolean): void {
if (!mode || (mode && Object.is(mode, ''))) {
return;
}
const arg: any = JSON.parse(JSON.stringify(data));
Object.assign(arg,{viewparams:this.viewparams});
const post: Promise<any> = this.service.frontLogic(mode,JSON.parse(JSON.stringify(this.context)),arg, showloading);
post.then((response: any) => {
if (!response || response.status !== 200) {
this.$Notice.error({ title: '错误', desc: '表单项更新失败' });
return;
}
const _data: any = response.data;
if(!_data){
return;
}
updateDetails.forEach((name: string) => {
if (!_data.hasOwnProperty(name)) {
return;
}
data[name] = _data[name];
});
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
return;
}
});
}
/**
* 获取对应行class
*
* @param {*} $args row 行数据,rowIndex 行索引
* @returns {void}
* @memberof Main
*/
public getRowClassName(args:{row: any,rowIndex: number}){
let isSelected = this.selections.some((item:any)=>{
return Object.is(item.sysapp,args.row.sysapp);
});
return isSelected ? "grid-selected-row" : "";
}
}
</script>
<style lang='less'>
@import './main-grid.less';
</style>
\ No newline at end of file
/**
* Main 部件模型
*
* @export
* @class MainModel
*/
export default class MainModel {
/**
* 是否是实体数据导出
*
* @returns {any[]}
* @memberof MainGridMode
*/
public isDEExport: boolean = false;
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof MainGridMode
*/
public getDataItems(): any[] {
if(this.isDEExport){
return [
]
}else{
return [
{
name: 'icon',
prop: 'icon',
dataType: 'TEXT',
},
{
name: 'visabled',
prop: 'visabled',
dataType: 'YESNO',
},
{
name: 'appname',
prop: 'label',
dataType: 'TEXT',
},
{
name: 'appid',
prop: 'id',
dataType: 'TEXT',
},
{
name: 'pssystemid',
prop: 'systemid',
dataType: 'PICKUP',
},
{
name: 'addr',
prop: 'addr',
dataType: 'TEXT',
},
{
name: 'apptype',
prop: 'type',
dataType: 'TEXT',
},
{
name: 'srfmajortext',
prop: 'label',
dataType: 'TEXT',
},
{
name: 'srfdataaccaction',
prop: 'id',
dataType: 'TEXT',
},
{
name: 'srfkey',
prop: 'id',
dataType: 'TEXT',
},
{
name: 'fullname',
prop: 'fullname',
dataType: 'TEXT',
},
{
name: 'sysapp',
prop: 'id',
},
{
name: 'n_pssystemid_eq',
prop: 'n_pssystemid_eq',
dataType: 'PICKUP',
},
{
name: 'n_appname_like',
prop: 'n_appname_like',
dataType: 'TEXT',
},
{
name:'size',
prop:'size'
},
{
name:'query',
prop:'query'
},
{
name:'page',
prop:'page'
},
{
name:'sort',
prop:'sort'
},
{
name:'srfparentdata',
prop:'srfparentdata'
},
// 前端新增修改标识,新增为"0",修改为"1"或未设值
{
name: 'srffrontuf',
prop: 'srffrontuf',
dataType: 'TEXT',
},
]
}
}
}
\ No newline at end of file
import { Http,Util,Errorlog } from '@/utils';
import ControlService from '@/widgets/control-service';
import SysAppService from '@/service/sys-app/sys-app-service';
import MainModel from './main-grid-model';
/**
* Main 部件服务对象
*
* @export
* @class MainService
*/
export default class MainService extends ControlService {
/**
* 应用服务对象
*
* @type {SysAppService}
* @memberof MainService
*/
public appEntityService: SysAppService = new SysAppService({ $store: this.getStore() });
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof MainService
*/
public setTempMode(){
this.isTempMode = false;
}
/**
* Creates an instance of MainService.
*
* @param {*} [opts={}]
* @memberof MainService
*/
constructor(opts: any = {}) {
super(opts);
this.model = new MainModel();
}
/**
* 处理数据
*
* @public
* @param {Promise<any>} promise
* @returns {Promise<any>}
* @memberof MainService
*/
public doItems(promise: Promise<any>, deKeyField: string, deName: string): Promise<any> {
return new Promise((resolve, reject) => {
promise.then((response: any) => {
if (response && response.status === 200) {
const data = response.data;
data.forEach((item:any,index:number) =>{
item[deName] = item[deKeyField];
data[index] = item;
});
resolve(data);
} else {
reject([])
}
}).catch((response: any) => {
reject([])
});
});
}
/**
* 获取跨实体数据集合
*
* @param {string} serviceName 服务名称
* @param {string} interfaceName 接口名称
* @param {*} data
* @param {boolean} [isloading]
* @returns {Promise<any[]>}
* @memberof MainService
*/
@Errorlog
public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> {
return Promise.reject([])
}
/**
* 添加数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public add(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any) => {
const _appEntityService: any = this.appEntityService;
let result: Promise<any>;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
}else{
result =_appEntityService.Create(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 删除数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public delete(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any) => {
const _appEntityService: any = this.appEntityService;
let result: Promise<any>;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
}else{
result =_appEntityService.Remove(Context,Data, isloading);
}
result.then((response) => {
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 修改数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public update(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any) => {
const _appEntityService: any = this.appEntityService;
let result: Promise<any>;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Data,Context,isloading);
}else{
result =_appEntityService.Update(Data,Context,isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 获取数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public get(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Get(Context,Data, isloading);
}
result.then((response) => {
//处理返回数据,补充判断标识
if(response.data){
Object.assign(response.data,{srfuf:0});
}
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 查询数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public search(action: string,context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any) => {
const _appEntityService: any = this.appEntityService;
let result: Promise<any>;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
}else{
result =_appEntityService.FetchDefault(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 加载草稿
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public loadDraft(action: string, context: any = {}, data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.GetDraft(Context,Data, isloading);
}
result.then((response) => {
//处理返回数据,补充判断标识
if(response.data){
Object.assign(response.data,{srfuf:'0'});
//仿真主键数据
response.data.id = Util.createUUID();
}
this.handleResponse(action, response, true);
this.mergeDefaults(response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 合并配置的默认值
* @param {*}
* @memberof MainService
*/
public mergeDefaults(response:any = {}){
if(response.data){
}
}
/**
* 前台逻辑
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public frontLogic(action:string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any)=>{
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
return Promise.reject({ status: 500, data: { title: '失败', message: '系统异常' } });
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
})
}
}
\ No newline at end of file
.grid {
flex-grow: 1;
height: 100%;
overflow: auto;
.el-table__body-wrapper::-webkit-scrollbar {
/*滚动条整体样式*/
width : 10px !important; /*高宽分别对应横竖滚动条的尺寸*/
height: 10px !important;
}
.el-table__body-wrapper::-webkit-scrollbar-thumb {
/*滚动条颜色*/
border-radius : 10px !important;
background-color: #cecece !important;
}
.el-table__body-wrapper::-webkit-scrollbar-track {
/*滚动条里面轨道*/
box-shadow : inset 0 0 5px rgba(0, 0, 0, 0.2) !important;
background : #ededed !important;
border-radius: 10px !important;
}
/*表格文字过长省略*/
.el-table th>.cell, .el-table td>.cell{
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
word-break: break-all;
}
.el-table-column--selection .cell {
padding-left: 0px;
padding-right: 0px;
}
.app-column-link, .app-format-data{
display: inline;
}
.el-table {
.quick-toolbar{
display: inline-block;
button{
background: #ebf3fb;
color: #2575ca;
border: 0;
}
}
.el-tooltip{
.ivu-form-item{
margin-bottom: unset !important;
}
}
}
.grid-pagination {
height: 50px;
padding: 6px 0px;
.page-button {
button {
padding: 0;
font-size: 16px;
min-width: 32px;
height: 32px;
margin-right: 4px;
}
}
.page-column {
position: absolute;
left: 0;
}
.batch-toolbar{
position: absolute;
left: 105px;
>.toolbar-container{
button {
font-size: 16px;
min-width: 32px;
height: 32px;
margin-right: 4px;
margin-top: 0;
margin-bottom: 0;
}
}
}
}
.el-table__body-wrapper{
height: calc(100% - 45px) !important;
}
}
.ivu-modal-content{
.footer{
.ivu-row{
text-align: right;
}
}
}
// this is less
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import MainBase from './main-grid-base.vue';
@Component({
components: {
}
})
export default class Main extends MainBase {
}
</script>
\ No newline at end of file
......@@ -7,6 +7,10 @@ zuul:
path: /sysauthlogs/**
serviceId: ibzuaa-api
stripPrefix: false
sys_app:
path: /sysapps/**
serviceId: ibzuaa-api
stripPrefix: false
sys_role_permission:
path: /sysrolepermissions/**
serviceId: ibzuaa-api
......
......@@ -12,6 +12,14 @@
"datascope":[{"id":"all","name":"全部数据"}]
}
, {
"dename":"SysApp",
"delogicname":"应用",
"sysmoudle":{"id":"UAA","name":"uaa"},
"dedataset":[{"id":"Default" , "name":"DEFAULT"}],
"deaction":[{"id":"Remove" , "name":"Remove" , "type":"BUILTIN" },{"id":"Get" , "name":"Get" , "type":"BUILTIN" },{"id":"Save" , "name":"Save" , "type":"BUILTIN" },{"id":"GetDraft" , "name":"GetDraft" , "type":"BUILTIN" },{"id":"CheckKey" , "name":"CheckKey" , "type":"BUILTIN" },{"id":"Update" , "name":"Update" , "type":"BUILTIN" },{"id":"Create" , "name":"Create" , "type":"BUILTIN" }],
"datascope":[{"id":"all","name":"全部数据"}]
}
, {
"dename":"SysRolePermission",
"delogicname":"角色权限关系",
"sysmoudle":{"id":"UAA","name":"uaa"},
......@@ -57,7 +65,7 @@
{
"appid":"web",
"appname":"UAA鉴权",
"appmenu":[{"menuid":"Main", "menuname":"MAIN", "menuitem":[{ "id":"menuitem3" , "name":"用户" },{ "id":"menuitem6" , "name":"角色" },{ "id":"menuitem1" , "name":"认证日志" }] }]
"appmenu":[{"menuid":"Main", "menuname":"MAIN", "menuitem":[{ "id":"menuitem3" , "name":"用户" },{ "id":"menuitem6" , "name":"角色" },{ "id":"menuitem1" , "name":"认证日志" },{ "id":"menuitem2" , "name":"接入应用" }] }]
}
]
}
package cn.ibizlab.api.dto;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.math.BigInteger;
import java.util.Map;
import java.util.HashMap;
import java.io.Serializable;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.fastjson.annotation.JSONField;
import cn.ibizlab.util.domain.DTOBase;
import lombok.Data;
/**
* 服务DTO对象[SysAppDTO]
*/
@Data
public class SysAppDTO extends DTOBase implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 属性 [APPID]
*
*/
@JSONField(name = "id")
@JsonProperty("id")
private String id;
/**
* 属性 [APPNAME]
*
*/
@JSONField(name = "label")
@JsonProperty("label")
private String label;
/**
* 属性 [PSSYSTEMID]
*
*/
@JSONField(name = "systemid")
@JsonProperty("systemid")
private String systemid;
/**
* 属性 [FULLNAME]
*
*/
@JSONField(name = "fullname")
@JsonProperty("fullname")
private String fullname;
/**
* 属性 [APPTYPE]
*
*/
@JSONField(name = "type")
@JsonProperty("type")
private String type;
/**
* 属性 [ADDR]
*
*/
@JSONField(name = "addr")
@JsonProperty("addr")
private String addr;
/**
* 属性 [ICON]
*
*/
@JSONField(name = "icon")
@JsonProperty("icon")
private String icon;
/**
* 属性 [VISABLED]
*
*/
@JSONField(name = "visabled")
@JsonProperty("visabled")
private Integer visabled;
/**
* 设置 [APPNAME]
*/
public void setLabel(String label){
this.label = label ;
this.modify("appname",label);
}
/**
* 设置 [PSSYSTEMID]
*/
public void setSystemid(String systemid){
this.systemid = systemid ;
this.modify("pssystemid",systemid);
}
/**
* 设置 [FULLNAME]
*/
public void setFullname(String fullname){
this.fullname = fullname ;
this.modify("fullname",fullname);
}
/**
* 设置 [APPTYPE]
*/
public void setType(String type){
this.type = type ;
this.modify("apptype",type);
}
/**
* 设置 [ADDR]
*/
public void setAddr(String addr){
this.addr = addr ;
this.modify("addr",addr);
}
/**
* 设置 [ICON]
*/
public void setIcon(String icon){
this.icon = icon ;
this.modify("icon",icon);
}
/**
* 设置 [VISABLED]
*/
public void setVisabled(Integer visabled){
this.visabled = visabled ;
this.modify("visabled",visabled);
}
}
package cn.ibizlab.api.mapping;
import org.mapstruct.*;
import cn.ibizlab.core.uaa.domain.SysApp;
import cn.ibizlab.api.dto.SysAppDTO;
import cn.ibizlab.util.domain.MappingBase;
import org.mapstruct.factory.Mappers;
@Mapper(componentModel = "spring", uses = {},
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface SysAppMapping extends MappingBase<SysAppDTO, SysApp> {
}
package cn.ibizlab.api.rest;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import lombok.extern.slf4j.Slf4j;
import com.alibaba.fastjson.JSONObject;
import javax.servlet.ServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.http.HttpStatus;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.util.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.access.prepost.PostAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import cn.ibizlab.api.dto.*;
import cn.ibizlab.api.mapping.*;
import cn.ibizlab.core.uaa.domain.SysApp;
import cn.ibizlab.core.uaa.service.ISysAppService;
import cn.ibizlab.core.uaa.filter.SysAppSearchContext;
@Slf4j
@Api(tags = {"应用" })
@RestController("api-sysapp")
@RequestMapping("")
public class SysAppResource {
@Autowired
public ISysAppService sysappService;
@Autowired
@Lazy
public SysAppMapping sysappMapping;
@ApiOperation(value = "删除应用", tags = {"应用" }, notes = "删除应用")
@RequestMapping(method = RequestMethod.DELETE, value = "/sysapps/{sysapp_id}")
@Transactional
public ResponseEntity<Boolean> remove(@PathVariable("sysapp_id") String sysapp_id) {
return ResponseEntity.status(HttpStatus.OK).body(sysappService.remove(sysapp_id));
}
@ApiOperation(value = "批量删除应用", tags = {"应用" }, notes = "批量删除应用")
@RequestMapping(method = RequestMethod.DELETE, value = "/sysapps/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
sysappService.removeBatch(ids);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@ApiOperation(value = "获取应用", tags = {"应用" }, notes = "获取应用")
@RequestMapping(method = RequestMethod.GET, value = "/sysapps/{sysapp_id}")
public ResponseEntity<SysAppDTO> get(@PathVariable("sysapp_id") String sysapp_id) {
SysApp domain = sysappService.get(sysapp_id);
SysAppDTO dto = sysappMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "保存应用", tags = {"应用" }, notes = "保存应用")
@RequestMapping(method = RequestMethod.POST, value = "/sysapps/save")
public ResponseEntity<Boolean> save(@RequestBody SysAppDTO sysappdto) {
return ResponseEntity.status(HttpStatus.OK).body(sysappService.save(sysappMapping.toDomain(sysappdto)));
}
@ApiOperation(value = "批量保存应用", tags = {"应用" }, notes = "批量保存应用")
@RequestMapping(method = RequestMethod.POST, value = "/sysapps/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<SysAppDTO> sysappdtos) {
sysappService.saveBatch(sysappMapping.toDomain(sysappdtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@ApiOperation(value = "获取应用草稿", tags = {"应用" }, notes = "获取应用草稿")
@RequestMapping(method = RequestMethod.GET, value = "/sysapps/getdraft")
public ResponseEntity<SysAppDTO> getDraft() {
return ResponseEntity.status(HttpStatus.OK).body(sysappMapping.toDto(sysappService.getDraft(new SysApp())));
}
@ApiOperation(value = "检查应用", tags = {"应用" }, notes = "检查应用")
@RequestMapping(method = RequestMethod.POST, value = "/sysapps/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody SysAppDTO sysappdto) {
return ResponseEntity.status(HttpStatus.OK).body(sysappService.checkKey(sysappMapping.toDomain(sysappdto)));
}
@ApiOperation(value = "更新应用", tags = {"应用" }, notes = "更新应用")
@RequestMapping(method = RequestMethod.PUT, value = "/sysapps/{sysapp_id}")
@Transactional
public ResponseEntity<SysAppDTO> update(@PathVariable("sysapp_id") String sysapp_id, @RequestBody SysAppDTO sysappdto) {
SysApp domain = sysappMapping.toDomain(sysappdto);
domain .setId(sysapp_id);
sysappService.update(domain );
SysAppDTO dto = sysappMapping.toDto(domain );
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "批量更新应用", tags = {"应用" }, notes = "批量更新应用")
@RequestMapping(method = RequestMethod.PUT, value = "/sysapps/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<SysAppDTO> sysappdtos) {
sysappService.updateBatch(sysappMapping.toDomain(sysappdtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@ApiOperation(value = "新建应用", tags = {"应用" }, notes = "新建应用")
@RequestMapping(method = RequestMethod.POST, value = "/sysapps")
@Transactional
public ResponseEntity<SysAppDTO> create(@RequestBody SysAppDTO sysappdto) {
SysApp domain = sysappMapping.toDomain(sysappdto);
sysappService.create(domain);
SysAppDTO dto = sysappMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "批量新建应用", tags = {"应用" }, notes = "批量新建应用")
@RequestMapping(method = RequestMethod.POST, value = "/sysapps/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<SysAppDTO> sysappdtos) {
sysappService.createBatch(sysappMapping.toDomain(sysappdtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@ApiOperation(value = "获取DEFAULT", tags = {"应用" } ,notes = "获取DEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/sysapps/fetchdefault")
public ResponseEntity<List<SysAppDTO>> fetchDefault(SysAppSearchContext context) {
Page<SysApp> domains = sysappService.searchDefault(context) ;
List<SysAppDTO> list = sysappMapping.toDto(domains.getContent());
return ResponseEntity.status(HttpStatus.OK)
.header("x-page", String.valueOf(context.getPageable().getPageNumber()))
.header("x-per-page", String.valueOf(context.getPageable().getPageSize()))
.header("x-total", String.valueOf(domains.getTotalElements()))
.body(list);
}
@ApiOperation(value = "查询DEFAULT", tags = {"应用" } ,notes = "查询DEFAULT")
@RequestMapping(method= RequestMethod.POST , value="/sysapps/searchdefault")
public ResponseEntity<Page<SysAppDTO>> searchDefault(@RequestBody SysAppSearchContext context) {
Page<SysApp> domains = sysappService.searchDefault(context) ;
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(sysappMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册