提交 64c65c10 编写于 作者: ibizdev's avatar ibizdev

ibiz4j 部署微服务应用

上级 7ac87471
......@@ -55,6 +55,14 @@
"viewname": "SysUserMPickupView",
"viewtag": "1f8cf7e78d6d88588d1d568d1866cc77"
},
"dictoptiongridview": {
"title": "字典项表格视图",
"caption": "字典项",
"viewtype": "DEGRIDVIEW",
"viewmodule": "dict",
"viewname": "DictOptionGridView",
"viewtag": "22e202992971f634c00e022b2cae335e"
},
"sysauthloggridview": {
"title": "认证日志表格视图",
"caption": "认证日志",
......
......@@ -99,6 +99,8 @@ export default {
menuitem16: "任务",
menuitem17: "日志",
menuitem18: "字典管理",
menuitem19: "目录",
menuitem20: "字典项",
},
},
},
......
......@@ -99,6 +99,8 @@ export default {
menuitem16: "任务",
menuitem17: "日志",
menuitem18: "字典管理",
menuitem19: "目录",
menuitem20: "字典项",
},
},
},
......
......@@ -21,6 +21,10 @@ export default {
caption: "字典项",
title: "字典项编辑视图",
},
gridview: {
caption: "字典项",
title: "字典项表格视图",
},
grideditview: {
caption: "字典项",
title: "字典项表格视图",
......@@ -55,6 +59,25 @@ export default {
uiactions: {
},
},
main_grid: {
columns: {
cid: "目录代码",
val: "代码值",
label: "名称",
pval: "父代码值",
showorder: "排序",
cname: "目录",
cls: "栏目样式",
iconcls: "图标",
vfilter: "过滤项",
disabled: "是否禁用",
expired: "过期/失效",
extension: "扩展",
updatedate: "最后修改时间",
},
uiactions: {
},
},
options_grid: {
columns: {
cid: "目录代码",
......@@ -93,6 +116,60 @@ export default {
tip: "关闭",
},
},
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: "新建行",
},
deuiaction1: {
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: "",
},
deuiaction2: {
caption: "Filter",
tip: "Filter",
},
},
grideditviewtoolbar_toolbar: {
tbitem3: {
caption: "New",
......
......@@ -20,6 +20,10 @@ export default {
caption: "字典项",
title: "字典项编辑视图",
},
gridview: {
caption: "字典项",
title: "字典项表格视图",
},
grideditview: {
caption: "字典项",
title: "字典项表格视图",
......@@ -54,6 +58,25 @@ export default {
uiactions: {
},
},
main_grid: {
columns: {
cid: "目录代码",
val: "代码值",
label: "名称",
pval: "父代码值",
showorder: "排序",
cname: "目录",
cls: "栏目样式",
iconcls: "图标",
vfilter: "过滤项",
disabled: "是否禁用",
expired: "过期/失效",
extension: "扩展",
updatedate: "最后修改时间",
},
uiactions: {
},
},
options_grid: {
columns: {
cid: "目录代码",
......@@ -92,6 +115,60 @@ export default {
tip: "关闭",
},
},
gridviewtoolbar_toolbar: {
tbitem3: {
caption: "新建",
tip: "新建",
},
tbitem4: {
caption: "编辑",
tip: "编辑",
},
tbitem6: {
caption: "拷贝",
tip: "拷贝",
},
tbitem7: {
caption: "-",
tip: "",
},
tbitem24: {
caption: "行编辑",
tip: "行编辑",
},
tbitem25: {
caption: "新建行",
tip: "新建行",
},
deuiaction1: {
caption: "保存行",
tip: "保存行",
},
tbitem26: {
caption: "-",
tip: "",
},
tbitem8: {
caption: "删除",
tip: "删除",
},
tbitem9: {
caption: "-",
tip: "",
},
tbitem13: {
caption: "导出",
tip: "导出",
},
tbitem10: {
caption: "-",
tip: "",
},
deuiaction2: {
caption: "过滤",
tip: "过滤",
},
},
grideditviewtoolbar_toolbar: {
tbitem3: {
caption: "新建",
......
......@@ -339,8 +339,46 @@ mock.onGet('v7/indexappmenu').reply((config: any) => {
iconcls: 'fa fa-reorder',
icon: '',
textcls: '',
appfunctag: '',
resourcetag: '',
items: [
{
id: '93B39387-4DF9-4B87-B8E6-99B2F0759268',
name: 'menuitem19',
text: '目录',
type: 'MENUITEM',
counterid: '',
tooltip: '目录',
expanded: false,
separator: false,
hidden: false,
hidesidebar: false,
opendefault: false,
iconcls: 'fa fa-folder-open-o',
icon: '',
textcls: '',
appfunctag: 'Auto10',
resourcetag: '',
},
{
id: 'B24E45E8-5D6D-45A3-92D7-19E8EBDF476D',
name: 'menuitem20',
text: '字典项',
type: 'MENUITEM',
counterid: '',
tooltip: '字典项',
expanded: false,
separator: false,
hidden: false,
hidesidebar: false,
opendefault: false,
iconcls: 'fa fa-stack-exchange',
icon: '',
textcls: '',
appfunctag: '_2',
resourcetag: '',
},
],
},
],
}];
......
......@@ -63,6 +63,14 @@ mock.onGet('./assets/json/view-config.json').reply((config: any) => {
"viewname": "SysUserMPickupView",
"viewtag": "1f8cf7e78d6d88588d1d568d1866cc77"
},
"dictoptiongridview": {
"title": "字典项表格视图",
"caption": "字典项",
"viewtype": "DEGRIDVIEW",
"viewmodule": "dict",
"viewname": "DictOptionGridView",
"viewtag": "22e202992971f634c00e022b2cae335e"
},
"sysauthloggridview": {
"title": "认证日志表格视图",
"caption": "认证日志",
......
<template>
<div class='view-container degridview dict-option-grid-view'>
<app-studioaction :viewTitle="$t(model.srfTitle)" viewName="dictoptiongridview"></app-studioaction>
<card class='view-card ' :dis-hover="true" :bordered="false">
<div slot='title' class="header-container">
<span class='caption-info'>{{$t(model.srfTitle)}}</span>
</div>
<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.dictoption.gridviewtoolbar_toolbar.tbitem3.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.dictoption.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.dictoption.gridviewtoolbar_toolbar.tbitem4.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.dictoption.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.dictoption.gridviewtoolbar_toolbar.tbitem6.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.dictoption.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.dictoption.gridviewtoolbar_toolbar.tbitem24.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.dictoption.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.dictoption.gridviewtoolbar_toolbar.tbitem25.tip')}}</div>
</tooltip>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.deuiaction1.visabled" :disabled="toolBarModels.deuiaction1.disabled" class='' @click="toolbar_click({ tag: 'deuiaction1' }, $event)">
<i class='fa fa-save'></i>
<span class='caption'>{{$t('entities.dictoption.gridviewtoolbar_toolbar.deuiaction1.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.dictoption.gridviewtoolbar_toolbar.deuiaction1.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.dictoption.gridviewtoolbar_toolbar.tbitem8.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.dictoption.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.dictoption.gridviewtoolbar_toolbar.tbitem13.caption')" @exportexcel="toolbar_click({ tag: 'tbitem13' }, $event)"></app-export-excel>
<div slot='content'>{{$t('entities.dictoption.gridviewtoolbar_toolbar.tbitem13.tip')}}</div>
</tooltip>
<span class='seperator'>|</span> <tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.deuiaction2.visabled" :disabled="toolBarModels.deuiaction2.disabled" class='' @click="toolbar_click({ tag: 'deuiaction2' }, $event)">
<i class='fa fa-filter'></i>
<span class='caption'>{{$t('entities.dictoption.gridviewtoolbar_toolbar.deuiaction2.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.dictoption.gridviewtoolbar_toolbar.deuiaction2.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,Inject } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import NavDataService from '@/service/app/navdata-service';
import { Subject,Subscription } from 'rxjs';
import DictOptionService from '@/service/dict-option/dict-option-service';
import GridViewEngine from '@engine/view/grid-view-engine';
import CodeListService from "@service/app/codelist-service";
@Component({
components: {
},
})
export default class DictOptionGridViewBase extends Vue {
/**
* 实体服务对象
*
* @type {DictOptionService}
* @memberof DictOptionGridViewBase
*/
public appEntityService: DictOptionService = new DictOptionService;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof DictOptionGridViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof DictOptionGridViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof DictOptionGridViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof DictOptionGridViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof DictOptionGridViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图默认使用
*
* @type {string}
* @memberof DictOptionGridViewBase
*/
@Inject({from:'navModel',default: 'tab'})
public navModel!:string;
/**
* 视图标识
*
* @type {string}
* @memberof DictOptionGridViewBase
*/
public viewtag: string = '22e202992971f634c00e022b2cae335e';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof DictOptionGridViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof DictOptionGridViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof DictOptionGridViewBase
*/
public model: any = {
srfCaption: 'entities.dictoption.views.gridview.caption',
srfTitle: 'entities.dictoption.views.gridview.title',
srfSubTitle: 'entities.dictoption.views.gridview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof DictOptionGridViewBase
*/
@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 DictOptionGridViewBase
*/
@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 DictOptionGridViewBase
*/
public containerModel: any = {
view_toolbar: { name: 'toolbar', type: 'TOOLBAR' },
view_grid: { name: 'grid', type: 'GRID' },
view_searchform: { name: 'searchform', type: 'SEARCHFORM' },
};
/**
* 计数器刷新
*
* @memberof DictOptionGridViewBase
*/
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 DictOptionGridViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 工具栏模型
*
* @type {*}
* @memberof DictOptionGridView
*/
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: '' } },
deuiaction1: { name: 'deuiaction1', caption: '保存行', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'SaveRow', 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: { } },
deuiaction2: { name: 'deuiaction2', caption: '过滤', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'ToggleFilter', target: '' } },
};
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof DictOptionGridViewBase
*/
public engine: GridViewEngine = new GridViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof DictOptionGridViewBase
*/
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: 'dictoption',
majorPSDEField: 'label',
isLoadDefault: true,
});
}
/**
* 应用导航服务
*
* @type {*}
* @memberof DictOptionGridViewBase
*/
public navDataService = NavDataService.getInstance(this.$store);
/**
* 导航服务事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof DictOptionGridViewBase
*/
public serviceStateEvent: Subscription | undefined;
/**
* 应用上下文
*
* @type {*}
* @memberof DictOptionGridViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof DictOptionGridViewBase
*/
public viewparams:any = {};
/**
* 视图缓存数据
*
* @type {*}
* @memberof DictOptionGridViewBase
*/
public viewCacheData:any;
/**
* 解析视图参数
*
* @public
* @memberof DictOptionGridViewBase
*/
public parseViewParam(inputvalue:any = null): void {
for(let key in this.context){
delete this.context[key];
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
Object.assign(this.viewparams,{srfparentdename:this.context.srfparentdename});
}
if(this.context && this.context.srfparentkey){
Object.assign(this.viewparams,{srfparentkey:this.context.srfparentkey});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
this.handleCustomViewData();
return;
}
const path = (this.$route.matched[this.$route.matched.length - 1]).path;
const keys: Array<any> = [];
const curReg = this.$pathToRegExp.pathToRegexp(path, keys);
const matchArray = curReg.exec(this.$route.path);
let tempValue: Object = {};
keys.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item.name, {
enumerable: true,
value: matchArray[index + 1]
});
});
this.$viewTool.formatRouteParams(tempValue,this.$route,this.context,this.viewparams);
if(inputvalue){
Object.assign(this.context,{'dictoption':inputvalue});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
//初始化导航数据
this.initNavDataWithRoute();
}
/**
* 处理自定义视图数据
*
* @memberof DictOptionGridViewBase
*/
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 DictOptionGridViewBase
*/
public handleCustomDataLogic(curNavData:any,tempData:any,item:string){
// 直接值直接赋值
if(curNavData.isRawValue){
if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: curNavData.value,
writable : true,
enumerable : true,
configurable : true
});
}
}else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(this.context[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(this.viewparams[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.viewparams[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}
}
}
}
/**
* 初始化导航数据(路由模式)
*
* @memberof DictOptionGridViewBase
*/
public initNavDataWithRoute(data:any = null, isNew:boolean = false){
if(this.viewDefaultUsage && Object.is(this.navModel,"route")){
this.navDataService.addNavData({id:'dict-option-grid-view',tag:this.viewtag,srfkey:isNew ? null : this.context.dictoption,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath});
}
}
/**
* 初始化导航数据(分页模式)
*
* @memberof DictOptionGridViewBase
*/
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true){
if(this.viewDefaultUsage && !Object.is(this.navModel,"route")){
this.navDataService.addNavDataByOnly({id:'dict-option-grid-view',tag:this.viewtag,srfkey:this.context.dictoption,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd);
}
}
/**
* Vue声明周期
*
* @memberof DictOptionGridViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof DictOptionGridViewBase
*/
public afterCreated(){
let _this:any = this;
const secondtag = _this.$util.createUUID();
_this.$store.commit('viewaction/createdView', { viewtag: _this.viewtag, secondtag: secondtag });
_this.viewtag = secondtag;
_this.parseViewParam();
_this.serviceStateEvent = _this.navDataService.serviceState.subscribe(({ action,name, data }:{ action:string,name:any,data:any }) => {
if(!Object.is(name,'dict-option-grid-view')){
return;
}
if (Object.is(action, 'viewrefresh')) {
_this.$nextTick(()=>{
_this.parseViewParam(data);
if(_this.engine){
_this.engine.load();
}
});
}
});
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 DictOptionGridViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof DictOptionGridViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof DictOptionGridViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
}
/**
* toolbar 部件 click 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof DictOptionGridViewBase
*/
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, 'deuiaction1')) {
this.toolbar_deuiaction1_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, 'deuiaction2')) {
this.toolbar_deuiaction2_click(null, '', $event2);
}
}
/**
* grid 部件 selectionchange 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof DictOptionGridViewBase
*/
public grid_selectionchange($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'selectionchange', $event);
}
/**
* grid 部件 beforeload 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof DictOptionGridViewBase
*/
public grid_beforeload($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'beforeload', $event);
}
/**
* grid 部件 rowdblclick 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof DictOptionGridViewBase
*/
public grid_rowdblclick($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'rowdblclick', $event);
}
/**
* grid 部件 remove 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof DictOptionGridViewBase
*/
public grid_remove($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'remove', $event);
}
/**
* grid 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof DictOptionGridViewBase
*/
public grid_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'load', $event);
}
/**
* searchform 部件 save 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof DictOptionGridViewBase
*/
public searchform_save($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'save', $event);
}
/**
* searchform 部件 search 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof DictOptionGridViewBase
*/
public searchform_search($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'search', $event);
}
/**
* searchform 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof DictOptionGridViewBase
*/
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,"DictOption");
}
/**
* 逻辑事件
*
* @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,"DictOption");
}
/**
* 逻辑事件
*
* @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,"DictOption");
}
/**
* 逻辑事件
*
* @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,"DictOption");
}
/**
* 逻辑事件
*
* @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,"DictOption");
}
/**
* 逻辑事件
*
* @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,"DictOption");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_deuiaction1_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.SaveRow(datas, contextJO,paramJO, $event, xData,this,"DictOption");
}
/**
* 逻辑事件
*
* @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,"DictOption");
}
/**
* 逻辑事件
*
* @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,"DictOption");
}
/**
* 逻辑事件
*
* @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,"DictOption");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_deuiaction2_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,"DictOption");
}
/**
* 打开新建数据视图
*
* @param {any[]} args
* @param {*} [params]
* @param {*} [fullargs]
* @param {*} [$event]
* @param {*} [xData]
* @memberof DictOptionGridView
*/
public newdata(args: any[],fullargs?:any[], params?: any, $event?: any, xData?: any) {
let localContext:any = null;
let localViewParam:any =null;
const data: any = {};
if(args[0].srfsourcekey){
data.srfsourcekey = args[0].srfsourcekey;
}
let tempContext = JSON.parse(JSON.stringify(this.context));
delete tempContext.dictoption;
if(args.length >0){
Object.assign(tempContext,args[0]);
}
const deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'dictoptions', parameterName: 'dictoption' },
];
const _this: any = this;
const openDrawer = (view: any, data: any) => {
let container: Subject<any> = this.$appdrawer.openDrawer(view, tempContext, 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: 'dict-option-edit-view',
height: 0,
width: 0,
title: this.$t('entities.dictoption.views.editview.title'),
placement: 'DRAWER_RIGHT',
};
openDrawer(view, data);
}
/**
* 打开编辑数据视图
*
* @param {any[]} args
* @param {*} [params]
* @param {*} [fullargs]
* @param {*} [$event]
* @param {*} [xData]
* @memberof DictOptionGridView
*/
public opendata(args: any[],fullargs?:any[],params?: any, $event?: any, xData?: any) {
let localContext:any = null;
let localViewParam:any =null;
const data: any = {};
let tempContext = JSON.parse(JSON.stringify(this.context));
if(args.length >0){
Object.assign(tempContext,args[0]);
}
const deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'dictoptions', parameterName: 'dictoption' },
];
const _this: any = this;
const openDrawer = (view: any, data: any) => {
let container: Subject<any> = this.$appdrawer.openDrawer(view, tempContext, 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: 'dict-option-edit-view',
height: 0,
width: 0,
title: this.$t('entities.dictoption.views.editview.title'),
placement: 'DRAWER_RIGHT',
};
openDrawer(view, data);
}
/**
* 新建
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof DictOptionGridViewBase
*/
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 DictOptionGridViewBase
*/
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, { dictoption: args[0].dictoption })
}
_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 DictOptionGridViewBase
*/
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, { dictoption: args[0].dictoption })
}
_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 DictOptionGridViewBase
*/
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 DictOptionGridViewBase
*/
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 DictOptionGridViewBase
*/
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 DictOptionGridViewBase
*/
public SaveRow(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();
} 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 DictOptionGridViewBase
*/
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 DictOptionGridViewBase
*/
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 DictOptionGridViewBase
*/
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 DictOptionGridViewBase
*/
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 DictOptionGridViewBase
*/
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 DictOptionGridViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof DictOptionGridViewBase
*/
public afterDestroyed(){
if(this.viewDefaultUsage){
let localStoreLength = Object.keys(localStorage);
if(localStoreLength.length > 0){
localStoreLength.forEach((item:string) =>{
if(item.startsWith(this.context.srfsessionid)){
localStorage.removeItem(item);
}
})
}
if(Object.is(this.navModel,"tab")){
this.navDataService.removeNavDataByTag(this.viewtag);
}
if (this.serviceStateEvent) {
this.serviceStateEvent.unsubscribe();
}
}
}
/**
* 是否单选
*
* @type {boolean}
* @memberof DictOptionGridViewBase
*/
public isSingleSelect: boolean = false;
/**
* 是否嵌入关系界面
*
* @type {boolean}
* @memberof DictOptionGridViewBase
*/
@Prop({default:false}) public isformDruipart?: boolean;
/**
* 界面关系通讯对象
*
* @type {Subject<ViewState>}
* @memberof DictOptionGridViewBase
*/
@Prop() public formDruipart?: Subject<ViewState>;
/**
* 搜索值
*
* @type {string}
* @memberof DictOptionGridViewBase
*/
public query: string = '';
/**
* 是否展开搜索表单
*
* @type {boolean}
* @memberof DictOptionGridViewBase
*/
public isExpandSearchForm: boolean = false;
/**
* 表格行数据默认激活模式
* 0 不激活
* 1 单击激活
* 2 双击激活
*
* @type {(number | 0 | 1 | 2)}
* @memberof DictOptionGridViewBase
*/
public gridRowActiveMode: number | 0 | 1 | 2 = 2;
/**
* 快速搜索
*
* @param {*} $event
* @memberof DictOptionGridViewBase
*/
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 DictOptionGridViewBase
*/
get refreshdata(): number | null {
return this.$store.getters['viewaction/getRefreshData'](this.viewtag);
}
/**
* 监控数据变化
*
* @param {*} newVal
* @param {*} oldVal
* @returns
* @memberof DictOptionGridViewBase
*/
@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 './dict-option-grid-view.less';
</style>
\ No newline at end of file
.dict-option-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 DictOptionGridViewBase from './dict-option-grid-view-base.vue';
import view_grid from '@widgets/dict-option/main-grid/main-grid.vue';
import view_searchform from '@widgets/dict-option/default-searchform/default-searchform.vue';
@Component({
components: {
view_grid,
view_searchform,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
if(!Object.is(vm.navModel,"route")){
vm.initNavDataWithTab(vm.viewCacheData);
}
vm.$store.commit('addCurPageViewtag', { fullPath: to.fullPath, viewtag: vm.viewtag });
});
},
})
export default class DictOptionGridView extends DictOptionGridViewBase {
}
</script>
\ No newline at end of file
......@@ -11,9 +11,9 @@ export const PageComponents = {
Vue.component('ibzemployee-grid-view', () => import('@pages/ou/ibzemployee-grid-view/ibzemployee-grid-view.vue'));
Vue.component('sys-user-role-grid-view', () => import('@pages/uaa/sys-user-role-grid-view/sys-user-role-grid-view.vue'));
Vue.component('ibzdepartment-pickup-view', () => import('@pages/ou/ibzdepartment-pickup-view/ibzdepartment-pickup-view.vue'));
Vue.component('wfmember-edit-view', () => import('@pages/workflow/wfmember-edit-view/wfmember-edit-view.vue'));
Vue.component('jobs-log-grid-view', () => import('@pages/task/jobs-log-grid-view/jobs-log-grid-view.vue'));
Vue.component('ibzpost-grid-view', () => import('@pages/ou/ibzpost-grid-view/ibzpost-grid-view.vue'));
Vue.component('wfmember-edit-view', () => import('@pages/workflow/wfmember-edit-view/wfmember-edit-view.vue'));
Vue.component('sys-role-pickup-grid-view', () => import('@pages/uaa/sys-role-pickup-grid-view/sys-role-pickup-grid-view.vue'));
Vue.component('wfmember-grid-view', () => import('@pages/workflow/wfmember-grid-view/wfmember-grid-view.vue'));
Vue.component('dict-catalog-edit-view', () => import('@pages/dict/dict-catalog-edit-view/dict-catalog-edit-view.vue'));
......@@ -25,9 +25,9 @@ export const PageComponents = {
Vue.component('ibzdepartment-tree-exp-view', () => import('@pages/ou/ibzdepartment-tree-exp-view/ibzdepartment-tree-exp-view.vue'));
Vue.component('ibzteam-edit-view', () => import('@pages/ou/ibzteam-edit-view/ibzteam-edit-view.vue'));
Vue.component('sys-role-grid-view', () => import('@pages/uaa/sys-role-grid-view/sys-role-grid-view.vue'));
Vue.component('wfgroup-mpickup-view', () => import('@pages/workflow/wfgroup-mpickup-view/wfgroup-mpickup-view.vue'));
Vue.component('ibzorganization-pickup-view', () => import('@pages/ou/ibzorganization-pickup-view/ibzorganization-pickup-view.vue'));
Vue.component('wfgroup-grid-view', () => import('@pages/workflow/wfgroup-grid-view/wfgroup-grid-view.vue'));
Vue.component('wfgroup-mpickup-view', () => import('@pages/workflow/wfgroup-mpickup-view/wfgroup-mpickup-view.vue'));
Vue.component('dict-catalog-grid-view', () => import('@pages/dict/dict-catalog-grid-view/dict-catalog-grid-view.vue'));
Vue.component('wfuser-pickup-view', () => import('@pages/workflow/wfuser-pickup-view/wfuser-pickup-view.vue'));
Vue.component('ibzteam-member-grid-view', () => import('@pages/ou/ibzteam-member-grid-view/ibzteam-member-grid-view.vue'));
......@@ -40,8 +40,8 @@ export const PageComponents = {
Vue.component('sys-user-pickup-view', () => import('@pages/uaa/sys-user-pickup-view/sys-user-pickup-view.vue'));
Vue.component('jobs-info-grid-view', () => import('@pages/task/jobs-info-grid-view/jobs-info-grid-view.vue'));
Vue.component('wfprocess-definition-grid-view', () => import('@pages/workflow/wfprocess-definition-grid-view/wfprocess-definition-grid-view.vue'));
Vue.component('ibzdept-member-grid-view', () => import('@pages/ou/ibzdept-member-grid-view/ibzdept-member-grid-view.vue'));
Vue.component('sys-user-mpickup-view', () => import('@pages/uaa/sys-user-mpickup-view/sys-user-mpickup-view.vue'));
Vue.component('ibzdept-member-grid-view', () => import('@pages/ou/ibzdept-member-grid-view/ibzdept-member-grid-view.vue'));
Vue.component('jobs-info-edit-view', () => import('@pages/task/jobs-info-edit-view/jobs-info-edit-view.vue'));
Vue.component('ibzdepartment-pickup-grid-view', () => import('@pages/ou/ibzdepartment-pickup-grid-view/ibzdepartment-pickup-grid-view.vue'));
Vue.component('ibzorganization-option-view', () => import('@pages/ou/ibzorganization-option-view/ibzorganization-option-view.vue'));
......@@ -63,6 +63,7 @@ export const PageComponents = {
Vue.component('ibzdept-member-edit-view', () => import('@pages/ou/ibzdept-member-edit-view/ibzdept-member-edit-view.vue'));
Vue.component('sys-role-pickup-view', () => import('@pages/uaa/sys-role-pickup-view/sys-role-pickup-view.vue'));
Vue.component('ibzorganization-pickup-grid-view', () => import('@pages/ou/ibzorganization-pickup-grid-view/ibzorganization-pickup-grid-view.vue'));
Vue.component('dict-option-grid-view', () => import('@pages/dict/dict-option-grid-view/dict-option-grid-view.vue'));
Vue.component('sys-user-pickup-grid-view', () => import('@pages/uaa/sys-user-pickup-grid-view/sys-user-pickup-grid-view.vue'));
Vue.component('dict-catalog-pickup-view', () => import('@pages/dict/dict-catalog-pickup-view/dict-catalog-pickup-view.vue'));
Vue.component('sys-permission-mpickup-view', () => import('@pages/uaa/sys-permission-mpickup-view/sys-permission-mpickup-view.vue'));
......
......@@ -465,41 +465,42 @@ const router = new Router({
component: () => import('@pages/ou/ibzdepartment-pickup-view/ibzdepartment-pickup-view.vue'),
},
{
path: 'jobslogs/:jobslog?/gridview/:gridview?',
path: 'wfusers/:wfuser?/wfmembers/:wfmember?/editview/:editview?',
meta: {
caption: 'entities.jobslog.views.gridview.title',
caption: 'entities.wfmember.views.editview.title',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'jobslogs', parameterName: 'jobslog' },
{ pathName: 'gridview', parameterName: 'gridview' },
{ pathName: 'wfusers', parameterName: 'wfuser' },
{ pathName: 'wfmembers', parameterName: 'wfmember' },
{ pathName: 'editview', parameterName: 'editview' },
],
requireAuth: true,
},
component: () => import('@pages/task/jobs-log-grid-view/jobs-log-grid-view.vue'),
component: () => import('@pages/workflow/wfmember-edit-view/wfmember-edit-view.vue'),
},
{
path: 'ibzposts/:ibzpost?/gridview/:gridview?',
path: 'wfgroups/:wfgroup?/wfmembers/:wfmember?/editview/:editview?',
meta: {
caption: 'entities.ibzpost.views.gridview.title',
caption: 'entities.wfmember.views.editview.title',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'ibzposts', parameterName: 'ibzpost' },
{ pathName: 'gridview', parameterName: 'gridview' },
{ pathName: 'wfgroups', parameterName: 'wfgroup' },
{ pathName: 'wfmembers', parameterName: 'wfmember' },
{ pathName: 'editview', parameterName: 'editview' },
],
requireAuth: true,
},
component: () => import('@pages/ou/ibzpost-grid-view/ibzpost-grid-view.vue'),
component: () => import('@pages/workflow/wfmember-edit-view/wfmember-edit-view.vue'),
},
{
path: 'wfusers/:wfuser?/wfmembers/:wfmember?/editview/:editview?',
path: 'wfmembers/:wfmember?/editview/:editview?',
meta: {
caption: 'entities.wfmember.views.editview.title',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'wfusers', parameterName: 'wfuser' },
{ pathName: 'wfmembers', parameterName: 'wfmember' },
{ pathName: 'editview', parameterName: 'editview' },
],
......@@ -508,33 +509,32 @@ const router = new Router({
component: () => import('@pages/workflow/wfmember-edit-view/wfmember-edit-view.vue'),
},
{
path: 'wfgroups/:wfgroup?/wfmembers/:wfmember?/editview/:editview?',
path: 'jobslogs/:jobslog?/gridview/:gridview?',
meta: {
caption: 'entities.wfmember.views.editview.title',
caption: 'entities.jobslog.views.gridview.title',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'wfgroups', parameterName: 'wfgroup' },
{ pathName: 'wfmembers', parameterName: 'wfmember' },
{ pathName: 'editview', parameterName: 'editview' },
{ pathName: 'jobslogs', parameterName: 'jobslog' },
{ pathName: 'gridview', parameterName: 'gridview' },
],
requireAuth: true,
},
component: () => import('@pages/workflow/wfmember-edit-view/wfmember-edit-view.vue'),
component: () => import('@pages/task/jobs-log-grid-view/jobs-log-grid-view.vue'),
},
{
path: 'wfmembers/:wfmember?/editview/:editview?',
path: 'ibzposts/:ibzpost?/gridview/:gridview?',
meta: {
caption: 'entities.wfmember.views.editview.title',
caption: 'entities.ibzpost.views.gridview.title',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'wfmembers', parameterName: 'wfmember' },
{ pathName: 'editview', parameterName: 'editview' },
{ pathName: 'ibzposts', parameterName: 'ibzpost' },
{ pathName: 'gridview', parameterName: 'gridview' },
],
requireAuth: true,
},
component: () => import('@pages/workflow/wfmember-edit-view/wfmember-edit-view.vue'),
component: () => import('@pages/ou/ibzpost-grid-view/ibzpost-grid-view.vue'),
},
{
path: 'sysroles/:sysrole?/pickupgridview/:pickupgridview?',
......@@ -766,46 +766,46 @@ const router = new Router({
component: () => import('@pages/uaa/sys-role-grid-view/sys-role-grid-view.vue'),
},
{
path: 'ibzorganizations/:ibzorganization?/pickupview/:pickupview?',
path: 'wfgroups/:wfgroup?/mpickupview/:mpickupview?',
meta: {
caption: 'entities.ibzorganization.views.pickupview.title',
caption: 'entities.wfgroup.views.mpickupview.title',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'ibzorganizations', parameterName: 'ibzorganization' },
{ pathName: 'pickupview', parameterName: 'pickupview' },
{ pathName: 'wfgroups', parameterName: 'wfgroup' },
{ pathName: 'mpickupview', parameterName: 'mpickupview' },
],
requireAuth: true,
},
component: () => import('@pages/ou/ibzorganization-pickup-view/ibzorganization-pickup-view.vue'),
component: () => import('@pages/workflow/wfgroup-mpickup-view/wfgroup-mpickup-view.vue'),
},
{
path: 'wfgroups/:wfgroup?/gridview/:gridview?',
path: 'ibzorganizations/:ibzorganization?/pickupview/:pickupview?',
meta: {
caption: 'entities.wfgroup.views.gridview.title',
caption: 'entities.ibzorganization.views.pickupview.title',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'wfgroups', parameterName: 'wfgroup' },
{ pathName: 'gridview', parameterName: 'gridview' },
{ pathName: 'ibzorganizations', parameterName: 'ibzorganization' },
{ pathName: 'pickupview', parameterName: 'pickupview' },
],
requireAuth: true,
},
component: () => import('@pages/workflow/wfgroup-grid-view/wfgroup-grid-view.vue'),
component: () => import('@pages/ou/ibzorganization-pickup-view/ibzorganization-pickup-view.vue'),
},
{
path: 'wfgroups/:wfgroup?/mpickupview/:mpickupview?',
path: 'wfgroups/:wfgroup?/gridview/:gridview?',
meta: {
caption: 'entities.wfgroup.views.mpickupview.title',
caption: 'entities.wfgroup.views.gridview.title',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'wfgroups', parameterName: 'wfgroup' },
{ pathName: 'mpickupview', parameterName: 'mpickupview' },
{ pathName: 'gridview', parameterName: 'gridview' },
],
requireAuth: true,
},
component: () => import('@pages/workflow/wfgroup-mpickup-view/wfgroup-mpickup-view.vue'),
component: () => import('@pages/workflow/wfgroup-grid-view/wfgroup-grid-view.vue'),
},
{
path: 'dictcatalogs/:dictcatalog?/gridview/:gridview?',
......@@ -990,6 +990,20 @@ const router = new Router({
},
component: () => import('@pages/workflow/wfprocess-definition-grid-view/wfprocess-definition-grid-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-user-mpickup-view/sys-user-mpickup-view.vue'),
},
{
path: 'ibzorganizations/:ibzorganization?/ibzdepartments/:ibzdepartment?/ibzemployees/:ibzemployee?/ibzdeptmembers/:ibzdeptmember?/gridview/:gridview?',
meta: {
......@@ -1099,20 +1113,6 @@ const router = new Router({
},
component: () => import('@pages/ou/ibzdept-member-grid-view/ibzdept-member-grid-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-user-mpickup-view/sys-user-mpickup-view.vue'),
},
{
path: 'jobsinfos/:jobsinfo?/editview/:editview?',
meta: {
......@@ -1638,6 +1638,20 @@ const router = new Router({
},
component: () => import('@pages/ou/ibzorganization-pickup-grid-view/ibzorganization-pickup-grid-view.vue'),
},
{
path: 'dictoptions/:dictoption?/gridview/:gridview?',
meta: {
caption: 'entities.dictoption.views.gridview.title',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'dictoptions', parameterName: 'dictoption' },
{ pathName: 'gridview', parameterName: 'gridview' },
],
requireAuth: true,
},
component: () => import('@pages/dict/dict-option-grid-view/dict-option-grid-view.vue'),
},
{
path: 'sysusers/:sysuser?/pickupgridview/:pickupgridview?',
meta: {
......@@ -1845,6 +1859,19 @@ const router = new Router({
},
component: () => import('@pages/uaa/sys-user-mpickup-view/sys-user-mpickup-view.vue'),
},
{
path: '/dictoptions/:dictoption?/gridview/:gridview?',
meta: {
caption: 'entities.dictoption.views.gridview.title',
info:'',
parameters: [
{ pathName: 'dictoptions', parameterName: 'dictoption' },
{ pathName: 'gridview', parameterName: 'gridview' },
],
requireAuth: true,
},
component: () => import('@pages/dict/dict-option-grid-view/dict-option-grid-view.vue'),
},
{
path: '/sysauthlogs/:sysauthlog?/gridview/:gridview?',
meta: {
......
......@@ -76,6 +76,17 @@ export const viewstate: any = {
'6869875c7409bd1dddd3d0fc62c502db',
],
},
{
viewtag: '22e202992971f634c00e022b2cae335e',
viewmodule: 'dict',
viewname: 'DictOptionGridView',
viewaction: '',
viewdatachange: false,
refviews: [
'0986ae2314847b586b20edfbb40fc82b',
'a9c82814d9bcd23dbf78c4c073759d7c',
],
},
{
viewtag: '255944d6d1a575d0eda2b68bc19314f3',
viewmodule: 'uaa',
......@@ -547,6 +558,7 @@ export const viewstate: any = {
'd907ddd1845887ecabac4d8d199bf792',
'13c174556f45e9b10b66dc51834a6ab5',
'f498dfb24e88df7c70a5c09ecb587647',
'22e202992971f634c00e022b2cae335e',
'74a6ce3ddf610ce7fb201662c6d4b8da',
],
},
......
......@@ -80,6 +80,7 @@ export default class DictOptionUIServiceBase extends UIService {
*/
public initViewMap(){
this.allViewMap.set('EDITVIEW:',{viewname:'editview',srfappde:'dictoptions'});
this.allViewMap.set('MDATAVIEW:',{viewname:'gridview',srfappde:'dictoptions'});
this.allViewMap.set(':',{viewname:'grideditview',srfappde:'dictoptions'});
}
......
......@@ -529,6 +529,9 @@ export default class IndexBase extends Vue implements ControlInterface {
case 'Auto8':
this.clickAuto8(item);
return;
case '_2':
this.click_2(item);
return;
case 'Auto13':
this.clickAuto13(item);
return;
......@@ -758,6 +761,29 @@ export default class IndexBase extends Vue implements ControlInterface {
})
}
/**
* 字典项
*
* @param {*} [item={}]
* @memberof Index
*/
public click_2(item: any = {}) {
const viewparam: any = {};
Object.assign(viewparam, {});
const deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'dictoptions', parameterName: 'dictoption' },
{ pathName: 'gridview', parameterName: 'gridview' },
];
const path: string = this.$viewTool.buildUpRoutePath(this.$route, {}, deResParameters, parameters, [], viewparam);
if(Object.is(this.$route.fullPath,path)){
return;
}
this.$nextTick(function(){
this.$router.push(path);
})
}
/**
* 岗位管理
*
......
......@@ -360,9 +360,49 @@ export default class IndexModel {
iconcls: 'fa fa-reorder',
icon: '',
textcls: '',
appfunctag: 'Auto10',
appfunctag: '',
resourcetag: '',
authtag:'Web-Index-menuitem18',
items: [
{
id: '93B39387-4DF9-4B87-B8E6-99B2F0759268',
name: 'menuitem19',
text: '目录',
type: 'MENUITEM',
counterid: '',
tooltip: '目录',
expanded: false,
separator: false,
hidden: false,
hidesidebar: false,
opendefault: false,
iconcls: 'fa fa-folder-open-o',
icon: '',
textcls: '',
appfunctag: 'Auto10',
resourcetag: '',
authtag:'Web-Index-menuitem19',
},
{
id: 'B24E45E8-5D6D-45A3-92D7-19E8EBDF476D',
name: 'menuitem20',
text: '字典项',
type: 'MENUITEM',
counterid: '',
tooltip: '字典项',
expanded: false,
separator: false,
hidden: false,
hidesidebar: false,
opendefault: false,
iconcls: 'fa fa-stack-exchange',
icon: '',
textcls: '',
appfunctag: '_2',
resourcetag: '',
authtag:'Web-Index-menuitem20',
},
],
},
];
......
<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"
:cell-class-name="getCellClassName"
@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('cid')">
<el-table-column show-overflow-tooltip :prop="'cid'" :label="$t('entities.dictoption.main_grid.columns.cid')" :width="100" :align="'left'" :sortable="'custom'">
<template v-slot:header="{column}">
<span class="column-header ">
{{$t('entities.dictoption.main_grid.columns.cid')}}
</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='cid' editorType="HIDDEN" :value="row.cid"></app-span>
</template>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('val')">
<el-table-column show-overflow-tooltip :prop="'val'" :label="$t('entities.dictoption.main_grid.columns.val')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot:header="{column}">
<span class="column-header ">
{{$t('entities.dictoption.main_grid.columns.val')}}
</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='val' editorType="TEXTBOX" :value="row.val"></app-span>
</template>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('label')">
<el-table-column show-overflow-tooltip :prop="'label'" :label="$t('entities.dictoption.main_grid.columns.label')" :width="200" :align="'left'" :sortable="'custom'">
<template v-slot:header="{column}">
<span class="column-header ">
{{$t('entities.dictoption.main_grid.columns.label')}}
</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='label' editorType="TEXTBOX" :value="row.label"></app-span>
</template>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('pval')">
<el-table-column show-overflow-tooltip :prop="'pval'" :label="$t('entities.dictoption.main_grid.columns.pval')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot:header="{column}">
<span class="column-header ">
{{$t('entities.dictoption.main_grid.columns.pval')}}
</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='pval' editorType="TEXTBOX" :value="row.pval"></app-span>
</template>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('showorder')">
<el-table-column show-overflow-tooltip :prop="'showorder'" :label="$t('entities.dictoption.main_grid.columns.showorder')" :width="100" :align="'left'" :sortable="'custom'">
<template v-slot:header="{column}">
<span class="column-header ">
{{$t('entities.dictoption.main_grid.columns.showorder')}}
</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='showorder' editorType="TEXTBOX" :value="row.showorder"></app-span>
</template>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('cname')">
<el-table-column show-overflow-tooltip :prop="'cname'" :label="$t('entities.dictoption.main_grid.columns.cname')" :width="200" :align="'left'" :sortable="'custom'">
<template v-slot:header="{column}">
<span class="column-header ">
{{$t('entities.dictoption.main_grid.columns.cname')}}
</span>
</template>
<template v-slot="{row,column,$index}">
<template v-if="actualIsOpenEdit">
<app-form-item :error="gridItemsModel[$index][column.property].error">
<app-picker
:formState="viewState"
:data="row"
:context="context"
:viewparams="viewparams"
:localContext ='{ }'
:localParam ='{ }'
:disabled="row.srfuf === 1 ? (3 & 2) !== 2 : (3 & 1) !== 1"
name='cname'
deMajorField='name'
deKeyField='dictcatalog'
:service="service"
:acParams="{ serviceName: 'DictCatalogService', interfaceName: 'FetchDefault'}"
valueitem='cid'
:value="row[column.property]"
editortype=""
:pickupView="{ viewname: 'dict-catalog-pickup-view', title: $t('entities.dictcatalog.views.pickupview.title'), deResParameters: [], parameters: [{ pathName: 'dictcatalogs', parameterName: 'dictcatalog' }, { pathName: 'pickupview', parameterName: 'pickupview' } ], placement:'' }"
style=""
@formitemvaluechange="($event)=>{onGridItemValueChange(row,$event,$index)}">
</app-picker>
</app-form-item>
</template>
<template v-if="!actualIsOpenEdit">
<app-span name='cname' editorType="PICKER" :value="row.cname"></app-span>
</template>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('cls')">
<el-table-column show-overflow-tooltip :prop="'cls'" :label="$t('entities.dictoption.main_grid.columns.cls')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot:header="{column}">
<span class="column-header ">
{{$t('entities.dictoption.main_grid.columns.cls')}}
</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='cls' editorType="TEXTBOX" :value="row.cls"></app-span>
</template>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('iconcls')">
<el-table-column show-overflow-tooltip :prop="'iconcls'" :label="$t('entities.dictoption.main_grid.columns.iconcls')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot:header="{column}">
<span class="column-header ">
{{$t('entities.dictoption.main_grid.columns.iconcls')}}
</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='iconcls' editorType="TEXTBOX" :value="row.iconcls"></app-span>
</template>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('vfilter')">
<el-table-column show-overflow-tooltip :prop="'vfilter'" :label="$t('entities.dictoption.main_grid.columns.vfilter')" :width="250" :align="'left'" :sortable="'custom'">
<template v-slot:header="{column}">
<span class="column-header ">
{{$t('entities.dictoption.main_grid.columns.vfilter')}}
</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='vfilter' editorType="TEXTBOX" :value="row.vfilter"></app-span>
</template>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('disabled')">
<el-table-column show-overflow-tooltip :prop="'disabled'" :label="$t('entities.dictoption.main_grid.columns.disabled')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot:header="{column}">
<span class="column-header ">
{{$t('entities.dictoption.main_grid.columns.disabled')}}
</span>
</template>
<template v-slot="{row,column,$index}">
<template v-if="actualIsOpenEdit">
<app-form-item :error="gridItemsModel[$index][column.property].error">
<dropdown-list
v-model="row[column.property]"
:disabled="row.srfuf === 1 ? (3 & 2) !== 2 : (3 & 1) !== 1"
style="width: 100px;"
:data="row"
:context="context"
:viewparams="viewparams"
:localContext ='{ }'
:localParam ='{ }'
tag='YesNo'
codelistType='STATIC'
placeholder='请选择...'
@change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}">
</dropdown-list>
</app-form-item>
</template>
<template v-if="!actualIsOpenEdit">
<codelist :value="row.disabled" tag='YesNo' codelistType='STATIC' ></codelist>
</template>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('expired')">
<el-table-column show-overflow-tooltip :prop="'expired'" :label="$t('entities.dictoption.main_grid.columns.expired')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot:header="{column}">
<span class="column-header ">
{{$t('entities.dictoption.main_grid.columns.expired')}}
</span>
</template>
<template v-slot="{row,column,$index}">
<template v-if="actualIsOpenEdit">
<app-form-item :error="gridItemsModel[$index][column.property].error">
<dropdown-list
v-model="row[column.property]"
:disabled="row.srfuf === 1 ? (3 & 2) !== 2 : (3 & 1) !== 1"
style="width: 100px;"
:data="row"
:context="context"
:viewparams="viewparams"
:localContext ='{ }'
:localParam ='{ }'
tag='YesNo'
codelistType='STATIC'
placeholder='请选择...'
@change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}">
</dropdown-list>
</app-form-item>
</template>
<template v-if="!actualIsOpenEdit">
<codelist :value="row.expired" tag='YesNo' codelistType='STATIC' ></codelist>
</template>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('extension')">
<el-table-column show-overflow-tooltip :prop="'extension'" :label="$t('entities.dictoption.main_grid.columns.extension')" :width="250" :align="'left'" :sortable="'custom'">
<template v-slot:header="{column}">
<span class="column-header ">
{{$t('entities.dictoption.main_grid.columns.extension')}}
</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='extension' editorType="TEXTBOX" :value="row.extension"></app-span>
</template>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('updatedate')">
<el-table-column show-overflow-tooltip :prop="'updatedate'" :label="$t('entities.dictoption.main_grid.columns.updatedate')" :width="250" :align="'left'" :sortable="'custom'">
<template v-slot:header="{column}">
<span class="column-header ">
{{$t('entities.dictoption.main_grid.columns.updatedate')}}
</span>
</template>
<template v-slot="{row,column,$index}">
<app-format-data format="YYYY-MM-DD hh:mm:ss" :data="row.updatedate"></app-format-data>
</template>
</el-table-column>
</template>
<template v-if="adaptiveState">
<el-table-column></el-table-column>
</template>
</el-table>
<row class='grid-pagination' v-show="items.length > 0">
<page class='pull-right' @on-change="pageOnChange($event)"
@on-page-size-change="onPageSizeChange($event)"
:transfer="true" :total="totalrow"
show-sizer :current="curPage" :page-size="limit"
:page-size-opts="[10, 20, 30, 40, 50, 60, 70, 80, 90, 100]" show-elevator show-total>
<span>
<span class="page-column">
<poptip transfer placement="top-start">
<i-button icon="md-menu">{{$t('app.gridpage.choicecolumns')}}</i-button>
<div slot="content">
<template v-for="col in allColumns">
<div :key="col.name"><el-checkbox v-model="col.show" @change="onColChange()">{{$t(col.langtag)}}</el-checkbox></div>
</template>
</div>
</poptip>
</span>
<span class="page-button"><i-button icon="md-refresh" :title="$t('app.gridpage.refresh')" @click="pageRefresh()"></i-button></span>&nbsp;
<span>
{{$t('app.gridpage.show')}}&nbsp;
<span>
<template v-if="items.length === 1">
1
</template>
<template v-else>
<span>{{(curPage - 1) * limit + 1}}&nbsp;-&nbsp;{{totalrow > curPage * limit ? curPage * limit : totalrow}}</span>
</template>
</span>&nbsp;
{{$t('app.gridpage.records')}},{{$t('app.gridpage.totle')}}&nbsp;{{totalrow}}&nbsp;{{$t('app.gridpage.records')}}
</span>
</span>
</page>
</row>
</i-form>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch, Model,Inject } from 'vue-property-decorator';
import { CreateElement } from 'vue';
import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils';
import NavDataService from '@/service/app/navdata-service';
import DictOptionService from '@/service/dict-option/dict-option-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 MainBase
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof MainBase
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof MainBase
*/
@Prop() public context: any;
/**
* 视图参数
*
* @type {*}
* @memberof MainBase
*/
@Prop() public viewparams: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof MainBase
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof MainBase
*/
public getControlType(): string {
return 'GRID'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof MainBase
*/
public counterServiceArray:Array<any> = [];
/**
* 建构部件服务对象
*
* @type {MainService}
* @memberof MainBase
*/
public service: MainService = new MainService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {DictOptionService}
* @memberof MainBase
*/
public appEntityService: DictOptionService = new DictOptionService({ $store: this.$store });
/**
* 关闭视图
*
* @param {any} args
* @memberof MainBase
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof MainBase
*/
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 MainBase
*/
public codeListService:CodeListService = new CodeListService({ $store: this.$store });
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof MainBase
*/
public getDatas(): any[] {
return this.selections;
}
/**
* 获取单项树
*
* @returns {*}
* @memberof MainBase
*/
public getData(): any {
return this.selections[0];
}
/**
* 打开新建数据视图
*
* @type {any}
* @memberof MainBase
*/
@Prop() public newdata: any;
/**
* 打开编辑数据视图
*
* @type {any}
* @memberof MainBase
*/
@Prop() public opendata: any;
/**
* 显示处理提示
*
* @type {boolean}
* @memberof MainBase
*/
@Prop({ default: true }) public showBusyIndicator?: boolean;
/**
* 部件行为--update
*
* @type {string}
* @memberof MainBase
*/
@Prop() public updateAction!: string;
/**
* 部件行为--fetch
*
* @type {string}
* @memberof MainBase
*/
@Prop() public fetchAction!: string;
/**
* 部件行为--remove
*
* @type {string}
* @memberof MainBase
*/
@Prop() public removeAction!: string;
/**
* 部件行为--load
*
* @type {string}
* @memberof MainBase
*/
@Prop() public loadAction!: string;
/**
* 部件行为--loaddraft
*
* @type {string}
* @memberof MainBase
*/
@Prop() public loaddraftAction!: string;
/**
* 部件行为--create
*
* @type {string}
* @memberof MainBase
*/
@Prop() public createAction!: string;
/**
* 当前页
*
* @type {number}
* @memberof MainBase
*/
public curPage: number = 1;
/**
* 数据
*
* @type {any[]}
* @memberof MainBase
*/
public items: any[] = [];
/**
* 是否支持分页
*
* @type {boolean}
* @memberof MainBase
*/
public isEnablePagingBar: boolean = true;
/**
* 是否禁用排序
*
* @type {boolean}
* @memberof MainBase
*/
public isNoSort: boolean = false;
/**
* 排序方向
*
* @type {string}
* @memberof MainBase
*/
public minorSortDir: string = 'ASC';
/**
* 排序字段
*
* @type {string}
* @memberof MainBase
*/
public minorSortPSDEF: string = 'showorder';
/**
* 分页条数
*
* @type {number}
* @memberof MainBase
*/
public limit: number = 50;
/**
* 是否显示标题
*
* @type {boolean}
* @memberof MainBase
*/
public isHideHeader: boolean = false;
/**
* 是否默认选中第一条数据
*
* @type {boolean}
* @memberof MainBase
*/
@Prop({ default: false }) public isSelectFirstDefault!: boolean;
/**
* 是否单选
*
* @type {boolean}
* @memberof MainBase
*/
@Prop() public isSingleSelect?: boolean;
/**
* 选中数据字符串
*
* @type {string}
* @memberof MainBase
*/
@Prop() public selectedData?: string;
/**
* 选中值变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof MainBase
*/
@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 MainBase
*/
@Prop({default: 2}) public gridRowActiveMode!: number;
/**
* 是否开启行编辑
*
* @type {boolean}
* @memberof MainBase
*/
@Prop({default: false}) public isOpenEdit!: boolean;
/**
* 实际是否开启行编辑
*
* @type {boolean}
* @memberof MainBase
*/
public actualIsOpenEdit: boolean = this.isOpenEdit;
/**
* 总条数
*
* @type {number}
* @memberof MainBase
*/
public totalrow: number = 0;
/**
* 选中行数据
*
* @type {any[]}
* @memberof Main
*/
public selections: any[] = [];
/**
* 拦截行选中
*
* @type {boolean}
* @memberof Main
*/
public stopRowClick: boolean = false;
/**
* 表格是否显示
*
* @type {boolean}
* @memberof MainBase
*/
public isDisplay:boolean = true;
/**
* 部件刷新
*
* @param {any[]} args
* @memberof MainBase
*/
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 MainBase
*/
public allColumns: any[] = [
{
name: 'cid',
label: '目录代码',
langtag: 'entities.dictoption.main_grid.columns.cid',
show: false,
util: 'PX'
},
{
name: 'val',
label: '代码值',
langtag: 'entities.dictoption.main_grid.columns.val',
show: true,
util: 'PX'
},
{
name: 'label',
label: '名称',
langtag: 'entities.dictoption.main_grid.columns.label',
show: true,
util: 'PX'
},
{
name: 'pval',
label: '父代码值',
langtag: 'entities.dictoption.main_grid.columns.pval',
show: true,
util: 'PX'
},
{
name: 'showorder',
label: '排序',
langtag: 'entities.dictoption.main_grid.columns.showorder',
show: true,
util: 'PX'
},
{
name: 'cname',
label: '目录',
langtag: 'entities.dictoption.main_grid.columns.cname',
show: true,
util: 'PX'
},
{
name: 'cls',
label: '栏目样式',
langtag: 'entities.dictoption.main_grid.columns.cls',
show: true,
util: 'PX'
},
{
name: 'iconcls',
label: '图标',
langtag: 'entities.dictoption.main_grid.columns.iconcls',
show: true,
util: 'PX'
},
{
name: 'vfilter',
label: '过滤项',
langtag: 'entities.dictoption.main_grid.columns.vfilter',
show: true,
util: 'PX'
},
{
name: 'disabled',
label: '是否禁用',
langtag: 'entities.dictoption.main_grid.columns.disabled',
show: true,
util: 'PX'
},
{
name: 'expired',
label: '过期/失效',
langtag: 'entities.dictoption.main_grid.columns.expired',
show: true,
util: 'PX'
},
{
name: 'extension',
label: '扩展',
langtag: 'entities.dictoption.main_grid.columns.extension',
show: true,
util: 'PX'
},
{
name: 'updatedate',
label: '最后修改时间',
langtag: 'entities.dictoption.main_grid.columns.updatedate',
show: true,
util: 'PX'
},
]
/**
* 表格模型集合
*
* @type {*}
* @memberof MainBase
*/
public gridItemsModel: any[] = [];
/**
* 获取表格行模型
*
* @type {*}
* @memberof MainBase
*/
public getGridRowModel(){
return {
val: new FormItemModel(),
pval: new FormItemModel(),
cls: new FormItemModel(),
expired: new FormItemModel(),
label: new FormItemModel(),
cid: new FormItemModel(),
srfkey: new FormItemModel(),
iconcls: new FormItemModel(),
extension: new FormItemModel(),
vfilter: new FormItemModel(),
showorder: new FormItemModel(),
cname: new FormItemModel(),
disabled: new FormItemModel(),
}
}
/**
* 属性值规则
*
* @type {*}
* @memberof MainBase
*/
public rules: any = {
val: [
{ required: true, validator: (rule:any, value:any, callback:any) => { return (rule.required && (value === null || value === undefined || value === "")) ? false : true;}, message: '代码值 值不能为空', trigger: 'change' },
{ required: true, validator: (rule:any, value:any, callback:any) => { return (rule.required && (value === null || value === undefined || value === "")) ? false : true;}, message: '代码值 值不能为空', trigger: 'blur' },
],
pval: [
{ 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' },
],
cls: [
{ 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' },
],
expired: [
{ 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' },
],
label: [
{ required: true, validator: (rule:any, value:any, callback:any) => { return (rule.required && (value === null || value === undefined || value === "")) ? false : true;}, message: '名称 值不能为空', trigger: 'change' },
{ required: true, validator: (rule:any, value:any, callback:any) => { return (rule.required && (value === null || value === undefined || value === "")) ? false : true;}, message: '名称 值不能为空', trigger: 'blur' },
],
cid: [
{ 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' },
],
iconcls: [
{ 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' },
],
extension: [
{ 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' },
],
vfilter: [
{ 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' },
],
showorder: [
{ 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' },
],
cname: [
{ required: true, validator: (rule:any, value:any, callback:any) => { return (rule.required && (value === null || value === undefined || value === "")) ? false : true;}, message: '目录 值不能为空', trigger: 'change' },
{ required: true, validator: (rule:any, value:any, callback:any) => { return (rule.required && (value === null || value === undefined || value === "")) ? false : true;}, message: '目录 值不能为空', trigger: 'blur' },
],
disabled: [
{ 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 MainBase
*/
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 MainBase
*/
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 MainBase
*/
public load(opt: any = {}, pageReset: boolean = false): void {
if(!this.fetchAction){
this.$Notice.error({ title: '错误', desc: 'DictOptionGridView视图表格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 MainBase
*/
public async remove(datas: any[]): Promise<any> {
if(!this.removeAction){
this.$Notice.error({ title: '错误', desc: 'DictOptionGridView视图表格removeAction参数未配置' });
return;
}
let _datas:any[] = [];
datas.forEach((record: any, index: number) => {
if (Object.is(record.srfuf,"0")) {
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,{ dictoption: _keys }),Object.assign({ dictoption: _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 MainBase
*/
public addBatch(arg: any = {}): void {
if(!this.fetchAction){
this.$Notice.error({ title: '错误', desc: 'DictOptionGridView视图表格fetchAction参数未配置' });
return;
}
if(!arg){
arg = {};
}
console.error("批量添加未实现");
}
/**
* 数据导入
*
* @param {*} data
* @memberof MainBase
*/
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 MainBase
*/
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 MainBase
*/
public async formatExcelData(filterVal:any, jsonData:any) {
let codelistColumns:Array<any> = [
{
name: 'disabled',
srfkey: 'YesNo',
codelistType : 'STATIC',
renderMode: 'other',
textSeparator: '、',
valueSeparator: ',',
},
{
name: 'expired',
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 MainBase
*/
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 MainBase
*/
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 MainBase
*/
public created(): void {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof MainBase
*/
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 MainBase
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof MainBase
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
}
/**
* 获取选中行胡数据
*
* @returns {any[]}
* @memberof MainBase
*/
public getSelection(): any[] {
return this.selections;
}
/**
* 行双击事件
*
* @param {*} $event
* @returns {void}
* @memberof MainBase
*/
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 MainBase
*/
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 MainBase
*/
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 MainBase
*/
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.dict_option,$event.dict_option);
});
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 MainBase
*/
public pageOnChange($event: any): void {
if (!$event) {
return;
}
if ($event === this.curPage) {
return;
}
this.curPage = $event;
this.load({});
}
/**
* 分页条数变化
*
* @param {*} $event
* @returns {void}
* @memberof MainBase
*/
public onPageSizeChange($event: any): void {
if (!$event) {
return;
}
if ($event === this.limit) {
return;
}
this.limit = $event;
if (this.curPage === 1) {
this.load({});
}
}
/**
* 分页刷新
*
* @memberof MainBase
*/
public pageRefresh(): void {
this.load({});
}
/**
* 排序变化
*
* @param {{ column: any, prop: any, order: any }} { column, prop, order }
* @memberof MainBase
*/
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 MainBase
*/
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 MainBase
*/
public uiAction(row: any, tag: any, $event: any) {
// this.rowClick(row, true);
$event.stopPropagation();
}
/**
* 设置列状态
*
* @memberof MainBase
*/
public setColState() {
const _data: any = localStorage.getItem('dict_option_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 MainBase
*/
public onColChange() {
localStorage.setItem('dict_option_main_grid', JSON.stringify(this.allColumns));
}
/**
* 获取列状态
*
* @param {string} name
* @returns {boolean}
* @memberof MainBase
*/
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 MainBase
*/
get adaptiveState(): boolean {
return !this.allColumns.find((column: any) => column.show && Object.is(column.util, 'STAR'));
}
/**
* 保存
*
* @param {*} $event
* @returns {Promise<any>}
* @memberof MainBase
*/
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: 'DictOptionGridView视图表格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: 'DictOptionGridView视图表格updateAction参数未配置' });
}else{
Object.assign(item,{viewparams:this.viewparams});
if(item.dictoption){
Object.assign(this.context,{dictoption:item.dictoption});
}
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 MainBase
*/
public newRow(args: any[], params?: any, $event?: any, xData?: any): void {
if(!this.loaddraftAction){
this.$Notice.error({ title: '错误', desc: 'DictOptionGridView视图表格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;
this.createDefault(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 MainBase
*/
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 MainBase
*/
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 MainBase
*/
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 MainBase
*/
public getRowClassName(args:{row: any,rowIndex: number}){
let isSelected = this.selections.some((item:any)=>{
return Object.is(item.dictoption,args.row.dictoption);
});
return isSelected ? "grid-selected-row" : "";
}
/**
* 获取对应列class
*
* @param {*} $args row 行数据,column 列数据,rowIndex 行索引,列索引
* @returns {void}
* @memberof MainBase
*/
public getCellClassName(args:{row: any, column: any, rowIndex: number, columnIndex:number}){
let hasRowEdit:any = {
'cid':true,
'val':true,
'label':true,
'pval':true,
'showorder':true,
'cname':true,
'cls':true,
'iconcls':true,
'vfilter':true,
'disabled':true,
'expired':true,
'extension':true,
'updatedate':false,
}
return ( hasRowEdit[args.column.property] && this.actualIsOpenEdit ) ? "edit-cell" : "info-cell";
}
/**
* 新建默认值
* @param {*} row 行数据
* @memberof MainBase
*/
public createDefault(row: any){
}
}
</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: 'val',
prop: 'value',
dataType: 'TEXT',
},
{
name: 'pval',
prop: 'parent',
dataType: 'TEXT',
},
{
name: 'cls',
prop: 'cls',
dataType: 'TEXT',
},
{
name: 'expired',
prop: 'expired',
dataType: 'YESNO',
},
{
name: 'label',
prop: 'label',
dataType: 'TEXT',
},
{
name: 'cid',
prop: 'catalog_id',
dataType: 'PICKUP',
},
{
name: 'srfmajortext',
prop: 'label',
dataType: 'TEXT',
},
{
name: 'srfdataaccaction',
prop: 'value_key',
dataType: 'TEXT',
},
{
name: 'srfkey',
prop: 'value_key',
dataType: 'TEXT',
},
{
name: 'iconcls',
prop: 'icon_class',
dataType: 'TEXT',
},
{
name: 'extension',
prop: 'extension',
dataType: 'LONGTEXT_1000',
},
{
name: 'vfilter',
prop: 'filter',
dataType: 'TEXT',
},
{
name: 'showorder',
prop: 'showorder',
dataType: 'INT',
},
{
name: 'updatedate',
prop: 'updatedate',
dataType: 'DATETIME',
},
{
name: 'cname',
prop: 'catalog_name',
dataType: 'PICKUPTEXT',
},
{
name: 'disabled',
prop: 'disabled',
dataType: 'YESNO',
},
{
name: 'dictoption',
prop: 'value_key',
},
{
name: 'n_cname_like',
prop: 'n_cname_like',
dataType: 'PICKUPTEXT',
},
{
name: 'n_val_like',
prop: 'n_val_like',
dataType: 'TEXT',
},
{
name: 'n_label_like',
prop: 'n_label_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 DictOptionService from '@/service/dict-option/dict-option-service';
import MainModel from './main-grid-model';
import DictCatalogService from '@/service/dict-catalog/dict-catalog-service';
/**
* Main 部件服务对象
*
* @export
* @class MainService
*/
export default class MainService extends ControlService {
/**
* 字典项服务对象
*
* @type {DictOptionService}
* @memberof MainService
*/
public appEntityService: DictOptionService = new DictOptionService({ $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();
}
/**
* 字典服务对象
*
* @type {DictCatalogService}
* @memberof MainService
*/
public dictcatalogService: DictCatalogService = new DictCatalogService();
/**
* 处理数据
*
* @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[]> {
if (Object.is(serviceName, 'DictCatalogService') && Object.is(interfaceName, 'FetchDefault')) {
return this.doItems(this.dictcatalogService.FetchDefault(JSON.parse(JSON.stringify(context)),data, isloading), 'id', 'dictcatalog');
}
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.value_key = Util.createUUID();
}
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,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;
}
}
.el-table__body .edit-cell{
padding:0;
.app-form-item{
margin-top: 20px;
margin-bottom: 20px;
}
}
}
.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
......@@ -37,6 +37,11 @@
git clone -b master $para2 ibzrt/
export NODE_OPTIONS=--max-old-space-size=4096
cd ibzrt/
mvn clean package -Pweb
cd ibzrt-app/ibzrt-app-web
mvn -Pweb docker:build
mvn -Pweb docker:push
docker -H $para1 stack deploy --compose-file=src/main/docker/ibzrt-app-web.yaml ibzlab-rt --with-registry-auth
</command>
</hudson.tasks.Shell>
</builders>
......
......@@ -9,6 +9,6 @@ CMD echo "The application will start in ${IBIZ_SLEEP}s..." && \
sleep ${IBIZ_SLEEP} && \
java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /ibzrt-app-web.jar
EXPOSE 8080
EXPOSE 30000
ADD ibzrt-app-web.jar /ibzrt-app-web.jar
......@@ -3,9 +3,22 @@ services:
ibzrt-app-web:
image: registry.cn-shanghai.aliyuncs.com/ibizsys/ibzrt-app-web:latest
ports:
- "8080:8080"
- "30000:30000"
networks:
- agent_network
environment:
- SPRING_CLOUD_NACOS_DISCOVERY_IP=172.16.180.237
- SERVER_PORT=30000
- SPRING_CLOUD_NACOS_DISCOVERY_SERVER-ADDR=172.16.102.211:8848
- SPRING_REDIS_HOST=172.16.100.243
- SPRING_REDIS_PORT=6379
- SPRING_REDIS_DATABASE=0
- SPRING_DATASOURCE_USERNAME=a_A_5d9d78509
- SPRING_DATASOURCE_PASSWORD=@6dEfb3@
- SPRING_DATASOURCE_URL=jdbc:mysql://172.16.180.232:3306/a_A_5d9d78509?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true
- SPRING_DATASOURCE_DRIVER-CLASS-NAME=com.mysql.jdbc.Driver
- SPRING_DATASOURCE_DEFAULTSCHEMA=a_A_5d9d78509
- NACOS=172.16.102.211:8848
deploy:
resources:
limits:
......
......@@ -193,7 +193,7 @@
{
"appid":"Web",
"appname":"ibizlab-runtime",
"appmenu":[{"menuid":"Index", "menuname":"Index", "menuitem":[{ "id":"menuitem7" , "name":"单位人事" , "items":[{ "id":"menuitem1" , "name":"单位管理" },{ "id":"menuitem2" , "name":"部门管理" },{ "id":"menuitem3" , "name":"人员管理" },{ "id":"menuitem12" , "name":"岗位管理" },{ "id":"menuitem13" , "name":"组管理" }]},{ "id":"menuitem8" , "name":"系统权限" , "items":[{ "id":"menuitem4" , "name":"用户角色" },{ "id":"menuitem9" , "name":"认证日志" }]},{ "id":"menuitem10" , "name":"流程管理" , "items":[{ "id":"menuitem6" , "name":"流程定义" },{ "id":"menuitem5" , "name":"流程角色" },{ "id":"menuitem11" , "name":"发布新流程" }]},{ "id":"menuitem14" , "name":"任务管理" , "items":[{ "id":"menuitem15" , "name":"注册" },{ "id":"menuitem16" , "name":"任务" },{ "id":"menuitem17" , "name":"日志" }]},{ "id":"menuitem18" , "name":"字典管理" }] }]
"appmenu":[{"menuid":"Index", "menuname":"Index", "menuitem":[{ "id":"menuitem7" , "name":"单位人事" , "items":[{ "id":"menuitem1" , "name":"单位管理" },{ "id":"menuitem2" , "name":"部门管理" },{ "id":"menuitem3" , "name":"人员管理" },{ "id":"menuitem12" , "name":"岗位管理" },{ "id":"menuitem13" , "name":"组管理" }]},{ "id":"menuitem8" , "name":"系统权限" , "items":[{ "id":"menuitem4" , "name":"用户角色" },{ "id":"menuitem9" , "name":"认证日志" }]},{ "id":"menuitem10" , "name":"流程管理" , "items":[{ "id":"menuitem6" , "name":"流程定义" },{ "id":"menuitem5" , "name":"流程角色" },{ "id":"menuitem11" , "name":"发布新流程" }]},{ "id":"menuitem14" , "name":"任务管理" , "items":[{ "id":"menuitem15" , "name":"注册" },{ "id":"menuitem16" , "name":"任务" },{ "id":"menuitem17" , "name":"日志" }]},{ "id":"menuitem18" , "name":"字典管理" , "items":[{ "id":"menuitem19" , "name":"目录" },{ "id":"menuitem20" , "name":"字典项" }]}] }]
}
]
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册